From d11a7e62862a448fb7451c0345a11cac463ae780 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 5 Jan 2018 10:28:56 +0100 Subject: GUI slide title adding --- src/colloquium.c | 4 ++++ src/sc_editor.c | 9 +++++++++ src/sc_editor.h | 1 + src/slide_window.c | 9 +++++++++ 4 files changed, 23 insertions(+) (limited to 'src') diff --git a/src/colloquium.c b/src/colloquium.c index 001786c..422a231 100644 --- a/src/colloquium.c +++ b/src/colloquium.c @@ -348,6 +348,10 @@ static void colloquium_startup(GApplication *papp) " Slide" " win.slide" " " + " " + " Slide title" + " win.slidetitle" + " " " " " " diff --git a/src/sc_editor.c b/src/sc_editor.c index fa86706..f486598 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -453,6 +453,15 @@ void sc_editor_paste(SCEditor *e) } +void sc_editor_add_storycode(SCEditor *e, const char *sc) +{ + SCBlock *nf; + nf = sc_parse(sc); + sc_block_append_block(e->scblocks, nf); + full_rerender(e); +} + + void sc_editor_copy_selected_frame(SCEditor *e) { char *t; diff --git a/src/sc_editor.h b/src/sc_editor.h index 9996834..ad894f4 100644 --- a/src/sc_editor.h +++ b/src/sc_editor.h @@ -187,6 +187,7 @@ extern void sc_editor_set_top_frame_editable(SCEditor *e, int top_frame_editable); extern void sc_editor_set_callbacks(SCEditor *e, SCCallbackList *cbl); extern void sc_editor_paste(SCEditor *e); +extern void sc_editor_add_storycode(SCEditor *e, const char *sc); extern void sc_editor_copy_selected_frame(SCEditor *e); extern void sc_editor_delete_selected_frame(SCEditor *e); extern void sc_editor_remove_cursor(SCEditor *e); diff --git a/src/slide_window.c b/src/slide_window.c index ae89062..283e96e 100644 --- a/src/slide_window.c +++ b/src/slide_window.c @@ -75,6 +75,14 @@ struct menu_pl }; +static void insert_slidetitle_sig(GSimpleAction *action, GVariant *parameter, + gpointer vp) +{ + SlideWindow *sw = vp; + sc_editor_add_storycode(sw->sceditor, "\\slidetitle{Slide title}"); +} + + static void paste_sig(GSimpleAction *action, GVariant *parameter, gpointer vp) { @@ -219,6 +227,7 @@ GActionEntry sw_entries[] = { { "prev", prev_slide_sig, NULL, NULL, NULL }, { "next", next_slide_sig, NULL, NULL, NULL }, { "last", last_slide_sig, NULL, NULL, NULL }, + { "slidetitle", insert_slidetitle_sig, NULL, NULL, NULL }, }; -- cgit v1.2.3