[ease] Added InspectorPane base class.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease] Added InspectorPane base class.
- Date: Sat, 29 May 2010 00:19:55 +0000 (UTC)
commit 122790c8e41d736a0e775ca5563091b467182934
Author: Nate Stedman <natesm gmail com>
Date: Fri May 28 20:19:47 2010 -0400
Added InspectorPane base class.
Removes redundant "slide" property from subclasses. Virtual method added to
replace the additional work that was done in those properties' setters.
Makefile.am | 1 +
src/Inspector.vala | 7 +++++++
src/InspectorPane.vala | 44 ++++++++++++++++++++++++++++++++++++++++++++
src/SlidePane.vala | 4 +---
src/TransitionPane.vala | 34 +++++++++++++++-------------------
5 files changed, 68 insertions(+), 22 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 239c2ab..80a596e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,6 +24,7 @@ ease_SOURCES = \
src/HTMLExporter.vala \
src/ImageActor.vala \
src/Inspector.vala\
+ src/InspectorPane.vala\
src/InspectorWindow.vala\
src/MainToolbar.vala \
src/Main.vala \
diff --git a/src/Inspector.vala b/src/Inspector.vala
index d0b7441..a267f51 100644
--- a/src/Inspector.vala
+++ b/src/Inspector.vala
@@ -15,12 +15,19 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+/**
+ * Inspector widget for editing slide properties
+ */
public class Ease.Inspector : Gtk.Notebook
{
private TransitionPane transition_pane;
private SlidePane slide_pane;
private Slide slide_priv;
+
+ /**
+ * The { link Slide} that this Inspector is currently affecting.
+ */
public Slide slide
{
get { return slide_priv; }
diff --git a/src/InspectorPane.vala b/src/InspectorPane.vala
new file mode 100644
index 0000000..0496992
--- /dev/null
+++ b/src/InspectorPane.vala
@@ -0,0 +1,44 @@
+/* Ease, a GTK presentation application
+ Copyright (C) 2010 Nate Stedman
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * Base class for inspector panes
+ */
+public abstract class Ease.InspectorPane : Gtk.VBox
+{
+ private Slide slide_priv;
+
+ public Slide slide
+ {
+ get { return slide_priv; }
+ set {
+ slide_priv = value;
+ slide_updated();
+ }
+ }
+
+ public InspectorPane()
+ {
+
+ }
+
+ /**
+ * Override this method to update interface elements when the displayed
+ * slide changes.
+ */
+ protected virtual void slide_updated() {}
+}
diff --git a/src/SlidePane.vala b/src/SlidePane.vala
index aa6359b..3586725 100644
--- a/src/SlidePane.vala
+++ b/src/SlidePane.vala
@@ -18,7 +18,7 @@
/**
* The inspector pane concerning slides
*/
-public class Ease.SlidePane : Gtk.VBox
+public class Ease.SlidePane : InspectorPane
{
public Gtk.ComboBox effect;
public Gtk.SpinButton duration;
@@ -26,8 +26,6 @@ public class Ease.SlidePane : Gtk.VBox
public Gtk.Label variant_label;
public Gtk.ComboBox start_transition;
public Gtk.SpinButton delay;
-
- public Slide slide { get; set; }
public SlidePane()
{
diff --git a/src/TransitionPane.vala b/src/TransitionPane.vala
index 95b7f9b..d588b0a 100644
--- a/src/TransitionPane.vala
+++ b/src/TransitionPane.vala
@@ -19,7 +19,7 @@
/**
* The inspector pane for changing transitions
*/
-public class Ease.TransitionPane : Gtk.VBox
+public class Ease.TransitionPane : InspectorPane
{
public Gtk.ComboBox effect;
private Gtk.SpinButton transition_time;
@@ -29,24 +29,6 @@ public class Ease.TransitionPane : Gtk.VBox
private Gtk.ComboBox start_transition;
private Gtk.SpinButton delay;
private GtkClutter.Embed preview;
-
-
- private Slide slide_priv;
- public Slide slide
- {
- get { return slide_priv; }
- set {
- slide_priv = value;
-
- transition_time.set_value(value.transition_time);
- effect.set_active(Transitions.get_transition_id(slide.transition));
- if (slide.variant != "" && slide.variant != null)
- {
- variant.set_active(Transitions.get_variant_id(slide.transition,
- slide.variant));
- }
- }
- }
public TransitionPane()
{
@@ -175,5 +157,19 @@ public class Ease.TransitionPane : Gtk.VBox
}
});
}
+
+ protected override void slide_updated()
+ {
+ // set transition time box
+ transition_time.set_value(slide.transition_time);
+
+ // set effect and variant combo boxes
+ effect.set_active(Transitions.get_transition_id(slide.transition));
+ if (slide.variant != "" && slide.variant != null)
+ {
+ variant.set_active(Transitions.get_variant_id(slide.transition,
+ slide.variant));
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]