aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2014-12-11 10:16:23 +0100
committerThomas White <taw@bitwiz.org.uk>2014-12-11 10:16:23 +0100
commitfdac2c8fc30153b103212e92c78885edc1134fb7 (patch)
treea9a9dff708c939686c1a2c4bc83df13dfa6043c6 /src
parent7e210f51ff3eac1392247d523904b885081e5a59 (diff)
WIP on Narrative stylesheet
Diffstat (limited to 'src')
-rw-r--r--src/narrative_window.c12
-rw-r--r--src/sc_editor.c16
-rw-r--r--src/sc_editor.h4
-rw-r--r--src/slide_window.c5
4 files changed, 25 insertions, 12 deletions
diff --git a/src/narrative_window.c b/src/narrative_window.c
index 5976ada..df52390 100644
--- a/src/narrative_window.c
+++ b/src/narrative_window.c
@@ -188,6 +188,12 @@ static void update_toolbar(NarrativeWindow *nw)
}
+static SCBlock *narrative_stylesheet()
+{
+ return sc_parse("\\ss[slide]{\nSLIDE\n}");
+}
+
+
NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
{
NarrativeWindow *nw;
@@ -195,6 +201,7 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
GtkWidget *scroll;
GtkWidget *toolbar;
GtkToolItem *button;
+ SCBlock *stylesheets[3];
if ( p->narrative_window != NULL ) {
fprintf(stderr, "Narrative window is already open!\n");
@@ -218,7 +225,10 @@ NarrativeWindow *narrative_window_new(struct presentation *p, GApplication *app)
vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add(GTK_CONTAINER(nw->window), vbox);
- nw->sceditor = sc_editor_new(nw->p->scblocks, p->stylesheet);
+ stylesheets[0] = p->stylesheet;
+ stylesheets[1] = narrative_stylesheet();
+ stylesheets[2] = NULL;
+ nw->sceditor = sc_editor_new(nw->p->scblocks, stylesheets);
toolbar = gtk_toolbar_new();
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 726b373..82c283a 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -69,17 +69,17 @@ void sc_editor_set_background(SCEditor *e, double r, double g, double b)
/* Update the view, once it's been edited in some way. */
static void rerender(SCEditor *e)
{
- SCBlock *stylesheets[2];
-
if ( e->surface != NULL ) {
cairo_surface_destroy(e->surface);
}
- stylesheets[0] = e->stylesheet;
- stylesheets[1] = NULL;
-
+ 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,
- stylesheets, e->is, ISZ_EDITOR, e->slidenum);
+ e->stylesheets, e->is, ISZ_EDITOR, e->slidenum);
}
@@ -1447,7 +1447,7 @@ void sc_editor_set_top_frame_editable(SCEditor *e, int top_frame_editable)
}
-SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock *stylesheet)
+SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets)
{
SCEditor *sceditor;
GtkTargetEntry targets[1];
@@ -1462,7 +1462,7 @@ SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock *stylesheet)
sceditor->log_w = 100;
sceditor->log_h = 100;
sceditor->is = imagestore_new();
- sceditor->stylesheet = stylesheet;
+ sceditor->stylesheets = stylesheets;
sceditor->slidenum = 0;
sceditor->min_border = 0.0;
sceditor->top_editable = 0;
diff --git a/src/sc_editor.h b/src/sc_editor.h
index eb6b90d..b8f4fa9 100644
--- a/src/sc_editor.h
+++ b/src/sc_editor.h
@@ -92,7 +92,7 @@ struct _sceditor
double log_h;
SCBlock *scblocks;
cairo_surface_t *surface;
- SCBlock *stylesheet;
+ SCBlock **stylesheets;
ImageStore *is;
/* Pointers to the frame currently being edited */
@@ -150,7 +150,7 @@ typedef struct _sceditorclass SCEditorClass;
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 SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets);
extern void sc_editor_set_size(SCEditor *e, int w, int h);
extern void sc_editor_set_logical_size(SCEditor *e, double w, double h);
extern void sc_editor_redraw(SCEditor *e);
diff --git a/src/slide_window.c b/src/slide_window.c
index accf35c..f0bb67b 100644
--- a/src/slide_window.c
+++ b/src/slide_window.c
@@ -530,6 +530,7 @@ SlideWindow *slide_window_open(struct presentation *p, GApplication *app)
GtkWidget *toolbar;
GtkToolItem *button;
SlideWindow *sw;
+ SCBlock *stylesheets[2];
if ( p->slidewindow != NULL ) {
fprintf(stderr, "Slide window is already open!\n");
@@ -596,7 +597,9 @@ SlideWindow *slide_window_open(struct presentation *p, GApplication *app)
"win.last");
update_toolbar(sw);
- sw->sceditor = sc_editor_new(sw->cur_slide->scblocks, p->stylesheet);
+ stylesheets[0] = p->stylesheet;
+ stylesheets[1] = NULL;
+ sw->sceditor = sc_editor_new(sw->cur_slide->scblocks, stylesheets);
scroll = gtk_scrolled_window_new(NULL, NULL);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll),
GTK_POLICY_AUTOMATIC,