Remote control magic
authorThomas White <taw@bitwiz.org.uk>
Sun, 11 Dec 2011 13:57:11 +0000 (14:57 +0100)
committerThomas White <taw@bitwiz.org.uk>
Sun, 11 Dec 2011 13:57:11 +0000 (14:57 +0100)
src/mainwindow.c
src/presentation.c
src/presentation.h
src/slideshow.c

index 2562c69..1201667 100644 (file)
@@ -668,10 +668,17 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
 {
        gboolean r;
 
-       /* Throw the event to the IM context and let it sort things out */
-       r = gtk_im_context_filter_keypress(GTK_IM_CONTEXT(p->im_context),
-                                          event);
-       if ( r ) return FALSE;  /* IM ate it */
+       /* FIXME: Only if doing sensible text input */
+       if ( p->editing_object != NULL ) {
+
+               /* Throw the event to the IM context and let it sort things
+                * out */
+               r = gtk_im_context_filter_keypress(
+                                                 GTK_IM_CONTEXT(p->im_context),
+                                                 event);
+               if ( r ) return FALSE;  /* IM ate it */
+
+       }
 
        p->cur_tool->key_pressed(p->editing_object, event->keyval, p->cur_tool);
 
@@ -692,10 +699,21 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
                break;
 
                case GDK_KEY_B :
-               p->slideshow_linked = 1 - p->slideshow_linked;
-               if ( p->slideshow_linked ) {
+               case GDK_KEY_b :
+               if ( p->slideshow != NULL ) {
+                       if ( p->prefs->b_splits ) {
+                               p->slideshow_linked = 1 - p->slideshow_linked;
+                               if ( p->slideshow_linked ) {
+                                       p->cur_proj_slide = p->cur_edit_slide;
+                                       notify_slideshow_slide_changed(p);
+                               }
+                       } else {
+                               p->ss_blank = 1-p->ss_blank;
+                               gdk_window_invalidate_rect(
+                                                     p->ss_drawingarea->window,
+                                                    NULL, FALSE);
+                       }
                }
-               redraw_overlay(p);
                break;
 
        }
index 7cce628..cdb4a14 100644 (file)
@@ -280,6 +280,10 @@ struct presentation *new_presentation()
        new->titlebar = NULL;
        get_titlebar_string(new);
 
+       /* FIXME: Should be just one of these */
+       new->prefs = calloc(1, sizeof(struct prefs));
+       new->prefs->b_splits = 1;
+
        new->window = NULL;
        new->ui = NULL;
        new->action_group = NULL;
index addcf7c..efe9d5c 100644 (file)
@@ -103,6 +103,12 @@ struct toolinfo
 };
 
 
+struct prefs
+{
+       int b_splits;
+};
+
+
 struct presentation
 {
        char             *titlebar;
@@ -110,6 +116,8 @@ struct presentation
        int               completely_empty;
        int              *num_presentations;
 
+       struct prefs     *prefs;
+
        struct toolinfo  *select_tool;
        struct toolinfo  *text_tool;
        struct toolinfo  *image_tool;
index 8e3b8ca..950c5c5 100644 (file)
@@ -104,6 +104,10 @@ static gint prev_slide_sig(GtkWidget *widget, struct presentation *p)
 
        notify_slideshow_slide_changed(p);
 
+       /* Editor always follows slideshow, even if "unlinked" */
+       p->cur_edit_slide = p->cur_proj_slide;
+       notify_slide_changed(p);
+
        return FALSE;
 }
 
@@ -121,6 +125,10 @@ static gint next_slide_sig(GtkWidget *widget, struct presentation *p)
 
        notify_slideshow_slide_changed(p);
 
+       /* Editor always follows slideshow, even if "unlinked" */
+       p->cur_edit_slide = p->cur_proj_slide;
+       notify_slide_changed(p);
+
        return FALSE;
 }
 
@@ -142,9 +150,17 @@ static gboolean ss_key_press_sig(GtkWidget *da, GdkEventKey *event,
 
        case GDK_KEY_B :
        case GDK_KEY_b :
-               p->ss_blank = 1-p->ss_blank;
-               gdk_window_invalidate_rect(p->ss_drawingarea->window,
-                                          NULL, FALSE);
+               if ( p->prefs->b_splits ) {
+                       p->slideshow_linked = 1 - p->slideshow_linked;
+                       if ( p->slideshow_linked ) {
+                               p->cur_proj_slide = p->cur_edit_slide;
+                               notify_slideshow_slide_changed(p);
+                       }
+               } else {
+                       p->ss_blank = 1-p->ss_blank;
+                       gdk_window_invalidate_rect(p->ss_drawingarea->window,
+                                                  NULL, FALSE);
+               }
                break;
 
        case GDK_KEY_Page_Up :