aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'libstorycode/gtk')
-rw-r--r--libstorycode/gtk/gtknarrativeview.c26
-rw-r--r--libstorycode/gtk/gtknarrativeview.h1
2 files changed, 27 insertions, 0 deletions
diff --git a/libstorycode/gtk/gtknarrativeview.c b/libstorycode/gtk/gtknarrativeview.c
index 6a08857..66ed570 100644
--- a/libstorycode/gtk/gtknarrativeview.c
+++ b/libstorycode/gtk/gtknarrativeview.c
@@ -1214,3 +1214,29 @@ void gtk_narrative_view_set_cursor_para(GtkNarrativeView *e, signed int pos)
e->cpos.trail = 0;
redraw(e);
}
+
+void gtk_narrative_view_add_slide_at_cursor(GtkNarrativeView *e)
+{
+ Narrative *n;
+ Slide *s;
+ int pos;
+
+ n = presentation_get_narrative(e->p);
+
+ s = slide_new();
+ if ( s == NULL ) return;
+
+ split_paragraph_at_cursor(n, e->cpos);
+ pos = narrative_get_slide_number(n, e->cpos.para);
+ presentation_insert_slide(e->p, s, pos);
+ narrative_insert_slide(n, s, e->cpos.para+1);
+
+ rewrap_range(e, e->cpos.para, e->cpos.para+2);
+ e->cpos.para++;
+ e->cpos.pos = 0;
+ e->cpos.trail = 0;
+ update_size(e);
+ check_cursor_visible(e);
+ emit_change_sig(e);
+ redraw(e);
+}
diff --git a/libstorycode/gtk/gtknarrativeview.h b/libstorycode/gtk/gtknarrativeview.h
index 9cbdcbd..c85ca1f 100644
--- a/libstorycode/gtk/gtknarrativeview.h
+++ b/libstorycode/gtk/gtknarrativeview.h
@@ -110,5 +110,6 @@ extern void gtk_narrative_view_paste(GtkNarrativeView *e);
extern void gtk_narrative_view_set_para_highlight(GtkNarrativeView *e, int para_highlight);
extern int gtk_narrative_view_get_cursor_para(GtkNarrativeView *e);
extern void gtk_narrative_view_set_cursor_para(GtkNarrativeView *e, signed int pos);
+extern void gtk_narrative_view_add_slide_at_cursor(GtkNarrativeView *e);
#endif /* GTK_NARRATIVE_VIEW_H */