diff options
author | Thomas White <taw@physics.org> | 2017-12-02 23:54:17 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2017-12-02 23:54:17 +0100 |
commit | 297814164335d154fa00397b72ca9e307d9e189e (patch) | |
tree | 9dd608fde8ac90cf83feaaa66c162b91963900fa /src | |
parent | cdab52532ddbbea9fec424bb2d92d82c5d7f7dfc (diff) |
Add option to start slideshow in the middle
Diffstat (limited to 'src')
-rw-r--r-- | src/colloquium.c | 4 | ||||
-rw-r--r-- | src/narrative_window.c | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/src/colloquium.c b/src/colloquium.c index c5716d9..c89d61e 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -355,6 +355,10 @@ static void colloquium_startup(GApplication *papp) " <attribute name='action'>win.startslideshow</attribute>" " </item>" " <item>" + " <attribute name='label'>Start slideshow here</attribute>" + " <attribute name='action'>win.startslideshowhere</attribute>" + " </item>" + " <item>" " <attribute name='label'>Presentation clock...</attribute>" " <attribute name='action'>win.clock</attribute>" " </item>" diff --git a/src/narrative_window.c b/src/narrative_window.c index c93cba9..e2e4b47 100644 --- a/src/narrative_window.c +++ b/src/narrative_window.c @@ -562,6 +562,28 @@ static gboolean ss_destroy_sig(GtkWidget *da, NarrativeWindow *nw) } +static void start_slideshow_here_sig(GSimpleAction *action, GVariant *parameter, + gpointer vp) +{ + NarrativeWindow *nw = vp; + void *bvp; + + if ( num_slides(nw->p) == 0 ) return; + + bvp = sc_editor_get_cursor_bvp(nw->sceditor); + if ( bvp == NULL ) return; + + nw->show = sc_slideshow_new(nw->p); + if ( nw->show == NULL ) return; + + g_signal_connect(G_OBJECT(nw->show), "key-press-event", + G_CALLBACK(key_press_sig), nw); + g_signal_connect(G_OBJECT(nw->show), "destroy", + G_CALLBACK(ss_destroy_sig), nw); + sc_slideshow_set_slide(nw->show, bvp); + sc_editor_set_para_highlight(nw->sceditor, 1); +} + static void start_slideshow_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) { @@ -570,7 +592,6 @@ static void start_slideshow_sig(GSimpleAction *action, GVariant *parameter, if ( num_slides(nw->p) == 0 ) return; nw->show = sc_slideshow_new(nw->p); - if ( nw->show == NULL ) return; g_signal_connect(G_OBJECT(nw->show), "key-press-event", @@ -661,6 +682,7 @@ GActionEntry nw_entries[] = { { "slide", add_slide_sig, NULL, NULL, NULL }, { "loadstylesheet", load_ss_sig, NULL, NULL, NULL }, { "startslideshow", start_slideshow_sig, NULL, NULL, NULL }, + { "startslideshowhere", start_slideshow_here_sig, NULL, NULL, NULL }, { "clock", open_clock_sig, NULL, NULL, NULL }, { "testcard", testcard_sig, NULL, NULL, NULL }, { "first", first_para_sig, NULL, NULL, NULL }, |