From 297814164335d154fa00397b72ca9e307d9e189e Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 2 Dec 2017 23:54:17 +0100 Subject: Add option to start slideshow in the middle --- src/colloquium.c | 4 ++++ src/narrative_window.c | 24 +++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'src') 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) " win.startslideshow" " " " " + " Start slideshow here" + " win.startslideshowhere" + " " + " " " Presentation clock..." " win.clock" " " 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 }, -- cgit v1.2.3