summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann <sandmann@redhat.com>2008-06-05 18:16:52 -0400
committerSøren Sandmann <sandmann@redhat.com>2008-06-05 18:16:52 -0400
commite9eaa5b1ec9eb280589f7f692ca8191dddca9ee7 (patch)
tree9dd36848a8dda44df1b17801682313eed9439105
parent44ffeb68a9914aba719767ce4c318abceaa87b6a (diff)
TODO; draw some slides
-rw-r--r--TODO95
-rw-r--r--main.c82
-rw-r--r--oppress.glade80
-rw-r--r--scrollarea.c2
4 files changed, 206 insertions, 53 deletions
diff --git a/TODO b/TODO
index fab63d0..ca89a1f 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,95 @@
- Think of a better name than oppress
- - Populst?
- - Demagogue?
+ - Populist
+ - Demagogue
+ - Agitate
+ - Vapour
+ - Pep Talk
+ - Deque
+- Features
+ - Object Types
+ - Text
+ - Circles/ellipses
+ - Arrows
+ - Rectangles
+ - Polygons
+ - Lines
+ - Curves
+ - Groups
+ - Images
+ - Helper lines
+ - Mirror (references another item and paints it), changes
+ to this item are reflected in the other.
+ - Post-it notes
+ - Trashcan
+
+ - Objects draggable to screen
+
+ - Objects should connect to each other, like in dia
+ - "Mirror this object on all slides"
+ - "Create animation from this object"
+ - This will make a 'copy' of the object in such a way
+ that when you change any properties of it, the new object
+ will be animated into place. You can move sub-objects around
+ for example, and an animation path will appear between
+ an original 'ghost' and the new position.
+ "Animate Onto Next Slide"?
+ - Creates the copy on the next slide
+ - If there is no next slide, then it creates one.
+
+ - Templates
+ - Is this more than 'mirror on all slides'?
+
+ - Load/Save
+
+ - Display full-screen
+
+ - Deck has an associated screen size (1024x768 say), or
+ it has a paper size.
+
+ - Objects should be in a toolbar and be drag-and-droppable
+ onto the canvas.
+
+ - When you drag and drop a helper line and it gets close to
+ the edges of a slide or to other helper lines, it should
+ display the distance in pixels - or maybe it should display
+ that all the time?
+
+- Staffage
+ - Things that will not be visible in the final show will be
+ shown in the same color, probably blue, maybe dashed. Post-it
+ notes will have a light blue, translucent background, with a
+ dark blue border.
+
+- Implementation
+ - Objects must be able to
+ - Save themselves, plus generate an SFormat
+ - Draw themselves,
+ - in fullscreen mode
+ - in edition mode
+ - in thumbnail mode
+ - Be selected
+ - Edit themselves, probably
+ - List properties
+ - Draw themselves as a ghost
+ - Paint their dnd source
+ - When dnd begins, an object is created, and a grab
+ is taken, but slide input areas are still active.
+
+ slide_begin_drag (slide, new_object);
+
+ The slide activates the grab and stores the new object.
+
+ - on motion the object is invalidated, and has coordinates
+ updated. Maybe there is a simple "move" method.
+
+ - On release, the new object has "add to slide" called
+ on it, and the object adds itself.
+
+ - A Deck contains slides, which contain objects
+
+- Bugs
+ - Infinite recursion - see fixme in "on_changed"
+
+- Undo?
+ - Update files in-place?
diff --git a/main.c b/main.c
index 88fd969..8f4289c 100644
--- a/main.c
+++ b/main.c
@@ -35,6 +35,13 @@ on_thumbs_paint (FooScrollArea *scroll_area,
}
+#define MARGIN 20
+#define RATIO 1.414
+#define N_SLIDES 10
+
+int slide_width;
+int slide_height;
+
static void
on_main_paint (FooScrollArea *scroll_area,
cairo_t *cr,
@@ -42,10 +49,74 @@ on_main_paint (FooScrollArea *scroll_area,
GdkRegion *region,
gpointer data)
{
+ int i;
+
+ cairo_move_to (cr, MARGIN, MARGIN);
+
+ for (i = 0; i < N_SLIDES; ++i)
+ {
+ cairo_move_to (cr, MARGIN, MARGIN + i * (MARGIN + slide_height));
+
+ cairo_set_source_rgba (cr, 1, 1, 1, 1);
+
+ cairo_rel_line_to (cr, slide_width, 0);
+ cairo_rel_line_to (cr, 0, slide_height);
+ cairo_rel_line_to (cr, -slide_width, 0);
+ cairo_close_path (cr);
+
+ cairo_fill_preserve (cr);
+
+ cairo_set_source_rgba (cr, 0, 0, 0, 0.5);
+ cairo_set_line_width (cr, 2);
+ cairo_stroke (cr);
+
+ }
+
g_print ("paint %d %d %d %d\n", extents->x, extents->y, extents->width, extents->height);
}
static void
+on_viewport_changed (FooScrollArea *scroll_area,
+ GdkRectangle *viewport,
+ GdkRectangle *old_viewport)
+{
+ int th;
+ double ratio;
+
+ if (old_viewport)
+ {
+ slide_width = viewport->width - 2 * MARGIN;
+ slide_height = slide_width / RATIO;
+
+ th = N_SLIDES * slide_height + (N_SLIDES + 1) * MARGIN;
+
+ g_print ("new slide height: %d, new y: %d\n", slide_height, viewport->y);
+
+ /* FIXME: We can recurse infinitely here when the area gets
+ * narrow enough that the scrollbar disappears causing the area
+ * to widen a little causing the scrollbar to appear causing
+ * the arrow to narrow causing ...
+ *
+ * For now we work around by have POLICY_ALWAYS on the scrollbar,
+ * it needs to be thought through and fixed in the scroll area
+ */
+
+ ratio = (double)viewport->width / old_viewport->width;
+
+ g_print ("ratio: %f (%d %d)\n", ratio, old_viewport->y, (int)(old_viewport->y * ratio));
+
+ foo_scroll_area_set_size_fixed_y (scroll_area, viewport->width, th,
+ old_viewport->y + 100,
+ (old_viewport->y + 100) * ratio + 0.5);
+ }
+
+#if 0
+ foo_scroll_area_set_size (scroll_area, viewport->width, th);
+#endif
+ foo_scroll_area_invalidate (scroll_area);
+}
+
+static void
set_size (GtkWindow *window)
{
GdkScreen *screen;
@@ -65,14 +136,6 @@ set_size (GtkWindow *window)
gtk_window_resize (window, width, height);
}
-static void
-on_viewport_changed (FooScrollArea *scroll_area,
- GdkRectangle *viewport,
- GdkRectangle *old_viewport)
-{
- foo_scroll_area_set_size (scroll_area, 800, 30);
-}
-
int
main (int argc, char **argv)
{
@@ -94,15 +157,12 @@ main (int argc, char **argv)
GTK_CONTAINER (get_widget (app, "thumbnails_scrolled_window")),
app->thumbnails);
- foo_scroll_area_set_size (app->main_area, 80, 30);
foo_scroll_area_set_min_size (app->thumbnails, 200, -1);
g_signal_connect (app->main_area, "paint",
G_CALLBACK (on_main_paint), app);
-#if 0
g_signal_connect (app->main_area, "viewport_changed",
G_CALLBACK (on_viewport_changed), app);
-#endif
g_signal_connect (app->thumbnails, "paint",
G_CALLBACK (on_thumbs_paint), app);
diff --git a/oppress.glade b/oppress.glade
index 43c3412..edea12c 100644
--- a/oppress.glade
+++ b/oppress.glade
@@ -193,6 +193,46 @@
<property name="spacing">0</property>
<child>
+ <widget class="GtkScrolledWindow" id="thumbnails_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="main_area_scrolled_window">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
<widget class="GtkToolbar" id="toolbar1">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
@@ -375,46 +415,6 @@
<property name="fill">False</property>
</packing>
</child>
-
- <child>
- <widget class="GtkScrolledWindow" id="main_area_scrolled_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="thumbnails_scrolled_window">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
- <property name="shadow_type">GTK_SHADOW_NONE</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
</widget>
<packing>
<property name="padding">0</property>
diff --git a/scrollarea.c b/scrollarea.c
index c4a6954..b5a85f6 100644
--- a/scrollarea.c
+++ b/scrollarea.c
@@ -1119,6 +1119,8 @@ foo_scroll_area_set_size_fixed_y (FooScrollArea *scroll_area,
#if 0
g_print ("diff: %d\n", new_y - old_y);
#endif
+
+ g_print ("old: %d new %d (dy %d)\n", old_y, new_y, dy);
scroll_area->priv->vadj->value += dy;