[ease] Fix offset bug for massive damage.
- From: Nate Stedman <natesm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ease] Fix offset bug for massive damage.
- Date: Sat, 27 Nov 2010 11:21:38 +0000 (UTC)
commit f3b7068d0ca0580ba96af7695e3f9539298f3201
Author: Nate Stedman <natesm gmail com>
Date: Sat Nov 27 06:20:29 2010 -0500
Fix offset bug for massive damage.
* ScrollableEmbedWindow used for all Clutter-scrolling needs
* Remove obsolete ScrollableEmbed
* Oh, and the mouse works like it should in the editor.
ease/Makefile.am | 1 -
ease/ease-editor-embed.vala | 38 +++++---
ease/ease-scrollable-embed.vala | 202 ---------------------------------------
ease/ease-welcome-window.vala | 27 +++---
4 files changed, 39 insertions(+), 229 deletions(-)
---
diff --git a/ease/Makefile.am b/ease/Makefile.am
index d57a9ac..37b2b37 100644
--- a/ease/Makefile.am
+++ b/ease/Makefile.am
@@ -21,7 +21,6 @@ ease_SOURCES = \
ease-inspector.vala \
ease-main.vala \
ease-player.vala \
- ease-scrollable-embed.vala \
ease-selection-rectangle.vala \
ease-slide-actor.vala \
ease-slide-button-panel.vala \
diff --git a/ease/ease-editor-embed.vala b/ease/ease-editor-embed.vala
index 948ee68..8de2ac1 100644
--- a/ease/ease-editor-embed.vala
+++ b/ease/ease-editor-embed.vala
@@ -27,7 +27,7 @@
* EditorEmbed is a subclass of { link ScrollableEmbed}, and has both
* horizontal and vertical scrollbars.
*/
-internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
+internal class Ease.EditorEmbed : ScrolledEmbedWindow, UndoSource
{
/**
* The { link EditorWindow} that owns this EditorEmbed.
@@ -176,6 +176,15 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
*/
private Document document;
+ /**
+ * The ClutterGroup used for all elements of the interface. Placed inside
+ * the viewport.
+ */
+ private Clutter.Group group;
+
+ private float width { get { return embed.viewport.width; } }
+ private float height { get { return embed.viewport.height; } }
+
internal signal void element_selected(Element selected);
internal signal void element_deselected(Element? deselected);
@@ -227,18 +236,21 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
*/
internal EditorEmbed(Document d, EditorWindow w)
{
- base(true, true);
+ base(null);
win = w;
// don't fade actors out when zoomed out
- get_stage().use_fog = false;
+ (embed.get_stage() as Clutter.Stage).use_fog = false;
// set the background to a faded version of the normal gtk background
Clutter.Color out_color, color;
GtkClutter.get_bg_color(this, Gtk.StateType.NORMAL, out color);
color.shade(SHADE_FACTOR, out out_color);
+ (embed.get_stage() as Clutter.Stage).color = out_color;
- get_stage().color = out_color;
+ // create the group
+ group = new Clutter.Group();
+ embed.viewport.add_actor(group);
document = d;
set_size_request(320, 240);
@@ -304,7 +316,7 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
// clean up the previous slide
if (slide_actor != null)
{
- contents.remove_actor(slide_actor);
+ group.remove_actor(slide_actor);
foreach (var a in slide_actor.contents)
{
a.button_press_event.disconnect(actor_clicked);
@@ -338,7 +350,7 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
slide_actor.ease_actor_removed.connect(on_ease_actor_removed);
slide_actor.slide.element_removed.connect(on_element_removed);
- contents.add_actor(slide_actor);
+ group.add_actor(slide_actor);
reposition_group();
}
@@ -349,15 +361,15 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
{
if (selection_rectangle != null)
{
- if (selection_rectangle.get_parent() == contents)
+ if (selection_rectangle.get_parent() == group)
{
- contents.remove_actor(selection_rectangle);
+ group.remove_actor(selection_rectangle);
}
foreach (var h in handles)
{
- if (h.get_parent() == contents)
+ if (h.get_parent() == group)
{
- contents.remove_actor(h);
+ group.remove_actor(h);
}
h.button_press_event.disconnect(handle_clicked);
h.button_release_event.disconnect(handle_released);
@@ -495,7 +507,7 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
// make a new selection rectangle
selection_rectangle = new SelectionRectangle();
position_selection();
- contents.add_actor(selection_rectangle);
+ group.add_actor(selection_rectangle);
// place the handles
if (handles == null)
@@ -504,7 +516,7 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
for (int i = 0; i < HANDLE_COUNT; i++)
{
handles[i] = new Handle((HandlePosition)i);
- contents.add_actor(handles[i]);
+ group.add_actor(handles[i]);
handles[i].button_press_event.connect(handle_clicked);
handles[i].button_release_event.connect(handle_released);
}
@@ -513,7 +525,7 @@ internal class Ease.EditorEmbed : ScrollableEmbed, UndoSource
for (int i = 0; i < HANDLE_COUNT; i++)
{
handles[i].reposition(selection_rectangle);
- contents.raise_child(handles[i], selection_rectangle);
+ group.raise_child(handles[i], selection_rectangle);
}
// when something is selected, the embed grabs key focus
diff --git a/ease/ease-welcome-window.vala b/ease/ease-welcome-window.vala
index 6833780..6bebdc6 100644
--- a/ease/ease-welcome-window.vala
+++ b/ease/ease-welcome-window.vala
@@ -37,7 +37,7 @@ internal class Ease.WelcomeWindow : Gtk.Window
private Theme selected_theme;
// clutter view
- private ScrollableEmbed embed;
+ private ScrolledEmbedWindow scrolled;
// previews
private Clutter.Group preview_container;
@@ -176,8 +176,9 @@ internal class Ease.WelcomeWindow : Gtk.Window
// create the upper UI - the embed
// FIXME (or don't) : the next line throws a vblank_mode warning for me
- embed = new ScrollableEmbed(false, false);
- embed.get_stage().use_fog = false;
+ scrolled = new ScrolledEmbedWindow(null);
+ scrolled.hscrollbar_policy = Gtk.PolicyType.NEVER;
+ (scrolled.embed.get_stage() as Clutter.Stage).use_fog = false;
// create the preview container
preview_container = new Clutter.Group();
@@ -226,10 +227,10 @@ internal class Ease.WelcomeWindow : Gtk.Window
});
}
- embed.contents.add_actor (preview_container);
- embed.contents.show_all ();
- vbox.pack_start (embed, true, true, 0);
- vbox.reorder_child (embed, 0);
+ scrolled.embed.viewport.add_actor(preview_container);
+ scrolled.embed.viewport.show_all();
+ vbox.pack_start (scrolled, true, true, 0);
+ vbox.reorder_child (scrolled, 0);
builder.connect_signals (this);
this.add (vbox);
@@ -237,7 +238,7 @@ internal class Ease.WelcomeWindow : Gtk.Window
// reflow the stage
- embed.size_allocate.connect ( () =>
+ scrolled.size_allocate.connect ( () =>
{
reflow_previews ();
});
@@ -296,7 +297,7 @@ internal class Ease.WelcomeWindow : Gtk.Window
// calculate the number of previews per line
var per_line = 2;
for (; per_line * (preview_width + PREVIEW_PADDING) +
- PREVIEW_PADDING < embed.width;
+ PREVIEW_PADDING < scrolled.embed.viewport.width;
per_line++);
per_line--;
@@ -329,7 +330,7 @@ internal class Ease.WelcomeWindow : Gtk.Window
}
// find the initial x position of previews
- var x_origin = embed.width / 2 -
+ var x_origin = scrolled.embed.viewport.width / 2 -
(preview_width * per_line + PREVIEW_PADDING * (per_line - 1)) / 2;
// the y position in pixels
@@ -394,16 +395,16 @@ internal class Ease.WelcomeWindow : Gtk.Window
}
// set the size of the background
- preview_background.width = embed.width;
+ preview_background.width = scrolled.embed.viewport.width;
preview_background.height = x_position != 0
? y_pixels + preview_width * preview_aspect +
PREVIEW_VERT_PADDING
: y_pixels + PREVIEW_VERT_PADDING;
// always fill the background
- if (preview_background.height < embed.height)
+ if (preview_background.height < scrolled.embed.viewport.height)
{
- preview_background.height = embed.height;
+ preview_background.height = scrolled.embed.viewport.height;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]