Show stylesheet storycode in editor
authorThomas White <taw@bitwiz.me.uk>
Sun, 29 Apr 2018 19:01:34 +0000 (21:01 +0200)
committerThomas White <taw@bitwiz.me.uk>
Sun, 29 Apr 2018 19:01:34 +0000 (21:01 +0200)
src/stylesheet_editor.c

index 0d9845f..edc5915 100644 (file)
@@ -87,6 +87,8 @@ static void set_values_from_presentation(StylesheetEditor *se)
        PangoFontDescription *fontdesc;
        double *col;
        GdkRGBA rgba;
+       GtkTextBuffer *buf;
+       char *sc;
 
        scin = sc_interp_new(NULL, NULL, NULL, NULL);
        sc_interp_run_stylesheet(scin, se->priv->p->stylesheet);  /* NULL stylesheet is OK */
@@ -104,6 +106,11 @@ 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);
 
+       sc = serialise_sc_block_chain(sc_block_child(se->priv->p->stylesheet));
+       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);
 }