diff options
author | Thomas White <taw@bitwiz.org.uk> | 2014-10-24 22:29:44 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2014-10-24 22:29:44 +0200 |
commit | 3e9e7a6e07d3de29eb38fce21ea71761be090b2b (patch) | |
tree | 0540ba52b785288b9d14528930b31737d8040e59 /src | |
parent | 60ce618ae2365e9215686785b75f3071ce7ab12c (diff) |
Set SCBlocks, not slides
Diffstat (limited to 'src')
-rw-r--r-- | src/sc_editor.c | 52 | ||||
-rw-r--r-- | src/sc_editor.h | 2 | ||||
-rw-r--r-- | src/slide_window.c | 2 |
3 files changed, 53 insertions, 3 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 773e7e4..bde1731 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -1395,8 +1395,58 @@ GtkWidget *sc_editor_get_widget(SCEditor *e) } -void sc_editor_set_slide(SCEditor *e, struct slide *s) +static void unset_all_frames(SCBlock *bl) { + while ( bl != NULL ) { + sc_block_set_frame(bl, NULL); + if ( sc_block_child(bl) != NULL ) { + unset_all_frames(sc_block_child(bl)); + } + if ( sc_block_macro_child(bl) != NULL ) { + unset_all_frames(sc_block_macro_child(bl)); + } + bl = sc_block_next(bl); + } +} + + +static void free_frame_contents(struct frame *fr) +{ + int i; + + for ( i=0; i<fr->n_lines; i++ ) { + wrap_line_free(&fr->lines[i]); + } + free(fr->lines); + fr->lines = NULL; + fr->n_lines = 0; + fr->max_lines = 0; + + if ( fr->boxes != NULL ) { + free(fr->boxes->boxes); + free(fr->boxes); + } + + fr->boxes = NULL; + + for ( i=0; i<fr->num_children; i++ ) { + free_frame_contents(fr->children[i]); + } + + fr->num_children = 0; +} + + +void sc_editor_set_scblock(SCEditor *e, SCBlock *scblocks) +{ + unset_all_frames(e->scblocks); + e->scblocks = scblocks; + + /* Free all subframes */ + free_frame_contents(&e->top); + + rerender(e); + redraw_editor(e); } diff --git a/src/sc_editor.h b/src/sc_editor.h index 5a59348..6a65bd5 100644 --- a/src/sc_editor.h +++ b/src/sc_editor.h @@ -33,7 +33,7 @@ struct presentation; typedef struct _sceditor SCEditor; -extern void sc_editor_set_slide(SCEditor *e, struct slide *s); +extern void sc_editor_set_scblock(SCEditor *e, SCBlock *scblocks); extern GtkWidget *sc_editor_get_widget(SCEditor *e); extern SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock *stylesheet); extern void sc_editor_set_size(SCEditor *e, int w, int h); diff --git a/src/slide_window.c b/src/slide_window.c index febbe43..6a1cb11 100644 --- a/src/slide_window.c +++ b/src/slide_window.c @@ -342,7 +342,7 @@ void change_edit_slide(SlideWindow *sw, struct slide *np) update_toolbar(sw); - sc_editor_set_slide(sw->sceditor, np); + sc_editor_set_scblock(sw->sceditor, np->scblocks); notify_notes_slide_changed(sw->p, np); |