From 2eb57179d684be7c7367a49e622fe1242c4bd274 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 23 Jun 2018 20:41:51 +0200 Subject: Preparation for new style model --- data/demo.sc | 20 +- data/stylesheeteditor.ui | 1006 ++++++++++++++++++++++++++++++---------------- src/sc_interp.c | 3 + src/stylesheet_editor.c | 18 - 4 files changed, 669 insertions(+), 378 deletions(-) diff --git a/data/demo.sc b/data/demo.sc index 3b45168..8d8f09f 100644 --- a/data/demo.sc +++ b/data/demo.sc @@ -1,22 +1,20 @@ \stylesheet{ - \font[Cantarell Regular 14] - \bggradv[#333333,#000055] - \fgcol[#c5c5c5] + \style[narrative]{\font[Cantarell Regular 16]\paraspace[0,0,10,10]\pad[10,10,10,10]\fgcol[#222222]\bgcol[#ffffff]} + \style[slide]{\bggradv[#333333,#000055]\slidesize[1024x768]\style[frame]{\fgcol[#c5c5c5]}} - \slidesize[1024x768] - \ss[prestitle]{\f[1fx140u+0+0]\pad[20,20,20,20]\fontsize[64]\fgcol[#eeeeee]\center\contents} - \ss[slidetitle]{\f[1fx90u+0+0]\pad[20,20,20,20]\fontsize[36]\fgcol[#eeeeee]\contents} - \ss[footer]{\f[0.97fx30u+0+740]{\ralign\editable{\fontsize[11]\bold{T. A. White} | \editable{A demonstration talk | 1 March 2018} | \bold{Slide} \slidenumber}}} - \ss[credit]{\f[600ux30u+700+700]{\fontsize[11]\contents}} - \ss[bp]{➤ } + \def[prestitle]{\f[1fx140u+0+0]\pad[20,20,20,20]\fontsize[64]\fgcol[#eeeeee]\center\contents} + \def[slidetitle]{\f[1fx90u+0+0]\pad[20,20,20,20]\fontsize[36]\fgcol[#eeeeee]\contents} + \def[footer]{\f[0.97fx30u+0+740]{\ralign\editable{\fontsize[11]\bold{T. A. White} | \editable{A demonstration talk | 1 March 2018} | \bold{Slide} \slidenumber}}} + \def[credit]{\f[600ux30u+700+700]{\fontsize[11]\contents}} + \def[bp]{➤ } \template[slide]{\slide{\slidetitle{New slide}\footer}} \template[bp,name="Bullet point"]{\bp{}} \template[credit,name="Credit"]{\credit{Image: }} -}\paraspace[0,0,10,10]\pad[10,10,10,10]\fgcol[#222222]\bgcol[#ffffff]\fontsize[40]{\bold{}Hi there, welcome to \bold{Colloquium}!} -\fontsize[16]It looks like this is the first time you've used Colloquium. Keep reading to understand a little bit about how Colloquium works and how to use it. +}\fontsize[40]{\bold{}Hi there, welcome to \bold{Colloquium}!} +It looks like this is the first time you've used Colloquium. Keep reading to understand a little bit about how Colloquium works and how to use it. Colloquium works differently to other presentation programs. Colloquium makes \italic{narrative, not slides,} the centre of attention. Slides come when you need to illustrate something. This window is called the \oblique{narrative editor}. Your slides are embedded into the narrative text, like this:\slide{ \prestitle{Welcome to Colloquium} diff --git a/data/stylesheeteditor.ui b/data/stylesheeteditor.ui index dfff08a..e591906 100644 --- a/data/stylesheeteditor.ui +++ b/data/stylesheeteditor.ui @@ -6,8 +6,6 @@ False Stylesheet editor center-on-parent - 640 - 640 True dialog @@ -76,7 +74,7 @@ True False - This style will be used in the narrative editor and for slides unless overridden + This style will be used in the narrative editor False @@ -103,13 +101,12 @@ - + True True True Sans 12 Preview text - True @@ -118,11 +115,10 @@ - + True True True - False @@ -159,7 +155,6 @@ True False - 0 Flat colour Horizontal gradient @@ -219,6 +214,8 @@ True False + 4 + 4 vertical @@ -228,13 +225,13 @@ True False + 5 Top: 1 True True - 4 0 @@ -265,12 +262,13 @@ True False + 5 Left: False True - 4 + 5 0 @@ -302,12 +300,12 @@ True False + 5 Right: False True - 4 end 3 @@ -328,13 +326,13 @@ True False + 5 Bottom: 1 True True - 4 0 @@ -376,209 +374,6 @@ 3 - - - True - False - 0 - in - - - True - False - 12 - 12 - - - True - True - 8 - 8 - char - - - - - - - True - False - Storycode - - - - - True - True - 4 - 4 - - - - - - - True - False - Default style - - - False - - - - - True - False - 8 - 8 - 8 - 8 - vertical - 8 - - - True - False - This style will be used in the narrative editor - - - False - True - 4 - 0 - - - - - Use default style - True - True - False - True - - - False - True - 1 - - - - - True - False - 8 - - - True - False - Text: - - - False - True - 0 - - - - - True - True - True - Sans 12 - Preview text - - - True - True - 1 - - - - - True - True - True - - - False - True - 2 - - - - - False - True - 4 - 2 - - - - - True - False - 8 - - - True - False - Background: - - - False - True - 0 - - - - - True - False - - Flat colour - Horizontal gradient - Vertical gradient - - - - True - True - 1 - - - - - True - True - True - - - False - True - 2 - - - - - True - True - True - - - False - True - 3 - - - - - False - True - 4 - 3 - - True @@ -594,6 +389,8 @@ True False + 4 + 4 vertical @@ -741,7 +538,7 @@ True False - Paragraph spacing + Padding @@ -752,57 +549,15 @@ 4 - - - True - False - 0 - in - - - True - False - 12 - 12 - - - True - True - 8 - 8 - char - - - - - - - True - False - Storycode - - - - - True - True - 4 - 5 - - - - 1 - True False - Narrative style + Narrative - 1 False @@ -817,40 +572,619 @@ vertical 8 - + True False - 0 - - Presentation title - Slide title - - - + 8 + 8 + 8 + + + True + False + Slide width: + + + False + True + 0 + + + + + True + True + 6 + True + 1024 + + + False + True + 1 + + + + + True + False + Slide height: + + + False + True + 2 + + + + + True + True + 6 + True + 768 + + + False + True + 3 + + + + + True + False + (arbitrary units) + + + False + True + 4 + + + + False True + 4 0 + + + True + False + 8 + + + True + False + Background: + + + False + True + 0 + + + + + True + False + + Flat colour + Horizontal gradient + Vertical gradient + + + + True + True + 1 + + + + + True + True + True + + + False + True + 2 + + + + + True + True + True + + + False + True + 3 + + + + + False + True + 4 + 1 + + + + + True + False + + + False + True + 2 + + + + + True + False + Frames within slides + + + False + True + 3 + + + + + True + False + 8 + + + True + False + Text: + + + False + True + 0 + + + + + True + True + True + Sans 12 + Preview text + + + True + True + 1 + + + + + True + True + True + + + False + True + 2 + + + + + False + True + 4 + 4 + + + + + True + False + 8 + + + True + False + Background: + + + False + True + 0 + + + + + True + False + + Flat colour + Horizontal gradient + Vertical gradient + + + + True + True + 1 + + + + + True + True + True + + + False + True + 2 + + + + + True + True + True + + + False + True + 3 + + + + + False + True + 4 + 5 + + True False 0 - in + out True False 12 - 12 - + True - True - 8 - 8 - char + False + 4 + 4 + vertical + + + True + False + + + True + False + 5 + Top: + 1 + + + True + True + 0 + + + + + True + True + + + False + True + 2 + + + + + False + True + 5 + 0 + + + + + True + False + + + True + False + 5 + Left: + + + False + True + 5 + 0 + + + + + True + True + + + False + True + 1 + + + + + True + True + + + False + True + 5 + end + 2 + + + + + True + False + 5 + Right: + + + False + True + end + 3 + + + + + False + True + 5 + 1 + + + + + True + False + + + True + False + 5 + Bottom: + 1 + + + True + True + 0 + + + + + True + True + + + False + True + 1 + + + + + False + True + 5 + 2 + + + + + + + + + True + False + Paragraph spacing + + + + + False + True + 4 + 6 + + + + + True + False + 0 + out + + + True + False + 12 + + + True + False + 4 + 4 + vertical + + + True + False + + + True + False + 5 + Top: + 1 + + + True + True + 0 + + + + + True + True + + + False + True + 2 + + + + + False + True + 5 + 0 + + + + + True + False + + + True + False + 5 + Left: + + + False + True + 5 + 0 + + + + + True + True + + + False + True + 1 + + + + + True + True + + + False + True + 5 + end + 2 + + + + + True + False + 5 + Right: + + + False + True + end + 3 + + + + + False + True + 5 + 1 + + + + + True + False + + + True + False + 5 + Bottom: + 1 + + + True + True + 0 + + + + + True + True + + + False + True + 1 + + + + + False + True + 5 + 2 + + @@ -859,30 +1193,30 @@ True False - Storycode + Padding - True + False True 4 - 1 + 7 - 2 + 1 True False - Style definitions + Slides - 2 + 1 False @@ -952,17 +1286,17 @@ - 3 + 2 True False - Templates + Style definitions - 3 + 2 False @@ -970,105 +1304,79 @@ True False + 8 + 8 8 8 vertical 8 - + True False - 8 - 8 - 8 - - - True - False - Slide width: - - - False - True - 0 - - - - - True - True - 6 - True - 1024 - - - False - True - 1 - - + 0 + + Presentation title + Slide title + + + + False + True + 0 + + + + + True + False + 0 + in - + True False - Slide height: - - - False - True - 2 - - - - - True - True - 6 - True - 768 + 12 + 12 + + + True + True + 8 + 8 + char + + - - False - True - 3 - - + True False - (arbitrary units) + Storycode - - False - True - 4 - - False + True True 4 - 0 + 1 - - - - 4 + 3 True False - Properties + Templates - 4 + 3 False diff --git a/src/sc_interp.c b/src/sc_interp.c index 2e81dd9..88cd811 100644 --- a/src/sc_interp.c +++ b/src/sc_interp.c @@ -1438,6 +1438,9 @@ void sc_interp_run_stylesheet(SCInterpreter *scin, SCBlock *bl) } else if ( strcmp(name, "ss") == 0 ) { try_add_macro(scin, options, sc_block_child(bl)); + } else if ( strcmp(name, "def") == 0 ) { + try_add_macro(scin, options, sc_block_child(bl)); + } else if ( strcmp(name, "template") == 0 ) { try_add_template(scin, options, sc_block_child(bl)); diff --git a/src/stylesheet_editor.c b/src/stylesheet_editor.c index 6dee835..7d94f66 100644 --- a/src/stylesheet_editor.c +++ b/src/stylesheet_editor.c @@ -134,8 +134,6 @@ void stylesheet_editor_class_init(StylesheetEditorClass *klass) g_type_class_add_private(gobject_class, sizeof(StylesheetEditorPrivate)); - gtk_widget_class_bind_template_child(widget_class, StylesheetEditor, - default_style_ss); gtk_widget_class_bind_template_child(widget_class, StylesheetEditor, default_style_font); gtk_widget_class_bind_template_child(widget_class, StylesheetEditor, @@ -157,9 +155,6 @@ static void set_values_from_presentation(StylesheetEditor *se) PangoFontDescription *fontdesc; double *col; GdkRGBA rgba; - GtkTextBuffer *buf; - char *sc; - SCBlock *ss; scin = sc_interp_new(NULL, NULL, NULL, NULL); sc_interp_run_stylesheet(scin, se->priv->p->stylesheet); /* NULL stylesheet is OK */ @@ -177,19 +172,6 @@ static void set_values_from_presentation(StylesheetEditor *se) rgba.alpha = col[3]; gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(se->default_style_fgcol), &rgba); - ss = se->priv->p->stylesheet; - if ( ss != NULL ) { - const char *name = sc_block_name(ss); - if ( (name != NULL) && (strcmp(name, "stylesheet")==0) ) { - ss = sc_block_child(ss); - } - - sc = serialise_sc_block_chain(ss); - buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(se->default_style_ss)); - gtk_text_buffer_set_text(GTK_TEXT_BUFFER(buf), sc, -1); - free(sc); - } - sc_interp_destroy(scin); } -- cgit v1.2.3