diff options
author | Thomas White <taw@bitwiz.me.uk> | 2018-05-01 22:12:22 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2018-05-01 22:12:22 +0200 |
commit | 072516c65a7335cc168e6ecc9b5a0737c9842913 (patch) | |
tree | 9390bd7da99406258fa4ec2b6f88e8a01cab1fe5 /src/sc_editor.c | |
parent | ebe339f9f26287216d8e6bc969ef3eaba7377e5c (diff) |
Get rid of stylesheet lists and add stylesheet change signal
We no longer have a need for more than one (since the callback stuff
changed, see 61394e51), and removing it makes it much easier to hook up
the stylesheet update code for the stylesheet editor.
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r-- | src/sc_editor.c | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c index 3183fb3..999f919 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -195,8 +195,7 @@ static gboolean resize_sig(GtkWidget *widget, GdkEventConfigure *event, w = e->log_w; h = e->log_h; } - e->top = interp_and_shape(e->scblocks, - e->stylesheets, e->cbl, + e->top = interp_and_shape(e->scblocks, e->stylesheet, e->cbl, e->is, e->slidenum, pc, w, h, e->lang); e->top->scblocks = e->scblocks; @@ -407,8 +406,7 @@ static void full_rerender(SCEditor *e) pc = gdk_pango_context_get(); - e->top = interp_and_shape(e->scblocks, - e->stylesheets, e->cbl, + e->top = interp_and_shape(e->scblocks, e->stylesheet, e->cbl, e->is, e->slidenum, pc, e->log_w, 0.0, e->lang); @@ -2035,34 +2033,9 @@ void sc_editor_set_top_frame_editable(SCEditor *e, int top_frame_editable) } -static SCBlock **copy_ss_list(SCBlock **stylesheets) +void sc_editor_set_stylesheet(SCEditor *e, SCBlock *stylesheet) { - int n_ss = 0; - int i = 0; - SCBlock **ssc; - - if ( stylesheets == NULL ) return NULL; - - while ( stylesheets[n_ss] != NULL ) n_ss++; - n_ss++; /* One more for sentinel */ - - ssc = malloc(n_ss*sizeof(SCBlock *)); - if ( ssc == NULL ) return NULL; - - for ( i=0; i<n_ss; i++ ) ssc[i] = stylesheets[i]; - - return ssc; -} - - -void sc_editor_set_stylesheets(SCEditor *e, SCBlock **stylesheets) -{ - int i = 0;; - while ( e->stylesheets[i] != NULL ) { - sc_block_free(e->stylesheets[i++]); - } - free(e->stylesheets); - e->stylesheets = copy_ss_list(stylesheets); + e->stylesheet = stylesheet; } @@ -2152,7 +2125,7 @@ void sc_editor_set_imagestore(SCEditor *e, ImageStore *is) } -SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets, +SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock *stylesheet, PangoLanguage *lang, const char *storename) { SCEditor *sceditor; @@ -2182,7 +2155,7 @@ SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets, sceditor->para_highlight = 0; sc_editor_remove_cursor(sceditor); - sceditor->stylesheets = copy_ss_list(stylesheets); + sceditor->stylesheet = stylesheet; sceditor->bg_pixbuf = NULL; |