diff options
author | Thomas White <taw@bitwiz.org.uk> | 2016-05-14 22:38:25 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2016-05-14 22:38:25 +0200 |
commit | ae4799ece4fb654759f9e499d4ebb9f3269b0f33 (patch) | |
tree | e3b89f2579d0d5a5e59536477ee8a664f836d394 /src/sc_editor.c | |
parent | 374120d3ccedb064c30b09ddd48131bc1b0a5df8 (diff) |
Change narrative paragraph instead of advancing slide
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index beb1d5a..9980866 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -422,6 +422,7 @@ static void draw_caret(cairo_t *cr, struct frame *fr, int cursor_para, cairo_set_source_rgba(cr, 0.7, 0.7, 1.0, 0.5); cairo_set_line_width(cr, 5.0); cairo_stroke(cr); + return; } if ( get_cursor_pos(fr, cursor_para, cursor_pos+cursor_trail, @@ -1170,9 +1171,11 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event, switch ( event->keyval ) { case GDK_KEY_Escape : - sc_editor_remove_cursor(e); - sc_editor_redraw(e); - claim = 1; + if ( !e->para_highlight ) { + sc_editor_remove_cursor(e); + sc_editor_redraw(e); + claim = 1; + } break; case GDK_KEY_Left : @@ -1598,6 +1601,38 @@ void sc_editor_set_para_highlight(SCEditor *e, int para_highlight) sc_editor_redraw(e); } +int sc_editor_get_cursor_para(SCEditor *e) +{ + if ( e->cursor_frame == NULL ) return 0; + return e->cursor_para; +} + + +void sc_editor_set_cursor_para(SCEditor *e, signed int pos) +{ + if ( e->cursor_frame == NULL ) { + e->cursor_frame = e->top; + e->selection = e->top; + } + + if ( pos < 0 ) { + e->cursor_para = e->cursor_frame->n_paras; + } else if ( pos >= e->cursor_frame->n_paras ) { + e->cursor_para = e->cursor_frame->n_paras - 1; + } else { + e->cursor_para = pos; + } + e->cursor_pos = 0; + sc_editor_redraw(e); +} + + +int sc_editor_get_num_paras(SCEditor *e) +{ + if ( e->cursor_frame == NULL ) return 1; + return e->cursor_frame->n_paras; +} + SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets, PangoLanguage *lang) |