diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-03-01 00:23:04 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-03-01 00:23:04 +0100 |
commit | 4104a6ff28d3a3be7069663c5677a5ee5076984a (patch) | |
tree | d7cfa39dc7d643140e03bffdaaade852e4f6af08 /libstorycode/gtk/gtknarrativeview.c | |
parent | fcdd59665b27c3a7a558c5593178c5efe6286831 (diff) |
Narrative rendering machinery
Diffstat (limited to 'libstorycode/gtk/gtknarrativeview.c')
-rw-r--r-- | libstorycode/gtk/gtknarrativeview.c | 42 |
1 files changed, 8 insertions, 34 deletions
diff --git a/libstorycode/gtk/gtknarrativeview.c b/libstorycode/gtk/gtknarrativeview.c index 70d59f5..9040d55 100644 --- a/libstorycode/gtk/gtknarrativeview.c +++ b/libstorycode/gtk/gtknarrativeview.c @@ -34,6 +34,7 @@ #include <math.h> #include <presentation.h> +#include <narrative_render_cairo.h> //#include "slide_window.h" #include "gtknarrativeview.h" @@ -121,24 +122,6 @@ static void set_vertical_params(GtkNarrativeView *e) } -static void update_size(GtkNarrativeView *e) -{ -// double total = total_height(e->top); -// -// e->w = e->top->w; -// e->h = total + e->top->pad_t + e->top->pad_b; -// -// e->top->h = e->h; -// -// if ( e->top->h < e->visible_height ) { -// e->top->h = e->visible_height; -// } -// -// set_vertical_params(e); -// set_horizontal_params(e); -} - - static gboolean resize_sig(GtkWidget *widget, GdkEventConfigure *event, GtkNarrativeView *e) { @@ -149,23 +132,13 @@ static gboolean resize_sig(GtkWidget *widget, GdkEventConfigure *event, e->visible_height = event->height; e->visible_width = event->width; - /* Wrap everything with the current width, to get the total height */ - //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; -// recursive_wrap(e->top, pc); -// } -// -// /* Wrap using current width */ -// e->top->w = event->width; -// e->top->h = 0.0; /* To be updated in a moment */ -// e->top->x = 0.0; -// e->top->y = 0.0; -// /* Only the top level needs to be wrapped */ -// wrap_frame(e->top, pc); + e->w = e->visible_width; + e->h = narrative_get_height(presentation_get_narrative(e->p)); - update_size(e); + /* Wrap everything with the current width, to get the total height */ + narrative_wrap(presentation_get_narrative(e->p), + presentation_get_stylesheet(e->p), + pango_language_get_default(), pc, e->w); g_object_unref(pc); @@ -1045,6 +1018,7 @@ GtkNarrativeView *gtk_narrative_view_new(Presentation *p, PangoLanguage *lang, nview->h = 100; nview->scroll_pos = 0; nview->lang = lang; + nview->p = p; nview->para_highlight = 0; |