aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-12-11 20:06:56 +0100
committerThomas White <taw@bitwiz.org.uk>2014-12-11 20:06:56 +0100
commit244f80ed15ace68b3c3de7e5aa147bb80ab4274a (patch)
treec7fe0c62f6b90c677dcffddacf72c011752aafff /src
parentec55ac7d1fe2491c8e6ee14b19c92034146d376f (diff)
Fix narrative stylesheet
Diffstat (limited to 'src')
-rw-r--r--src/narrative_window.c2
-rw-r--r--src/sc_editor.c28
2 files changed, 23 insertions, 7 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index df52390..c5994ad 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -190,7 +190,7 @@ static void update_toolbar(NarrativeWindow *nw)
static SCBlock *narrative_stylesheet()
{
- return sc_parse("\\ss[slide]{\nSLIDE\n}");
+ return sc_parse("\\stylesheet{\\ss[slide]{\nSLIDE\n}}");
}
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 82c283a..ca64c8e 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -73,11 +73,6 @@ static void rerender(SCEditor *e)
cairo_surface_destroy(e->surface);
}
- int i=0;
- do {
- printf("---%i: %p\n", i, e->stylesheets[i]);
- i++;
- } while ( e->stylesheets[i-1] != NULL );
e->surface = render_sc(e->scblocks, e->w, e->h, e->log_w, e->log_h,
e->stylesheets, e->is, ISZ_EDITOR, e->slidenum);
}
@@ -1447,6 +1442,26 @@ void sc_editor_set_top_frame_editable(SCEditor *e, int top_frame_editable)
}
+static SCBlock **copy_ss_list(SCBlock **stylesheets)
+{
+ 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;
+}
+
+
SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets)
{
SCEditor *sceditor;
@@ -1462,11 +1477,12 @@ SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets)
sceditor->log_w = 100;
sceditor->log_h = 100;
sceditor->is = imagestore_new();
- sceditor->stylesheets = stylesheets;
sceditor->slidenum = 0;
sceditor->min_border = 0.0;
sceditor->top_editable = 0;
+ sceditor->stylesheets = copy_ss_list(stylesheets);
+
err = NULL;
sceditor->bg_pixbuf = gdk_pixbuf_new_from_file(DATADIR"/colloquium/sky.png", &err);
if ( sceditor->bg_pixbuf == NULL ) {