aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-08-23 10:20:04 +0200
committerThomas White <taw@bitwiz.org.uk>2013-08-23 10:20:04 +0200
commitbac5d1b43e57415c823e84a87fed226c30f0d0ab (patch)
tree506beb49b45a7f2dd124b365b1622bf21f89792c /src
parent05662243972af0a5db0c62f19540b95e68eee8a5 (diff)
SC prologue for top frame
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.c7
-rw-r--r--src/presentation.h1
-rw-r--r--src/render.c7
-rw-r--r--src/stylesheet.c6
-rw-r--r--src/stylesheet.h2
-rw-r--r--src/wrap.c4
6 files changed, 19 insertions, 8 deletions
diff --git a/src/mainwindow.c b/src/mainwindow.c
index 1171d77..85e3eca 100644
--- a/src/mainwindow.c
+++ b/src/mainwindow.c
@@ -258,6 +258,10 @@ static gint add_furniture(GtkWidget *widget, struct menu_pl *pl)
fr->pos = 0;
p->cursor_pos = 0;
+ /* FIXME: What if the user mixes templates? */
+ p->cur_edit_slide->st = pl->st;
+ p->cur_edit_slide->top->style = pl->st->top_style;
+
do_slide_update(p, p->pc);
return 0;
@@ -317,6 +321,7 @@ static void update_style_menus(struct presentation *p)
p->menu_path_list[k].p = p;
p->menu_path_list[k].sty = s;
+ p->menu_path_list[k].st = t;
item = gtk_menu_item_new_with_label(s->name);
gtk_menu_shell_append(GTK_MENU_SHELL(submenu), item);
@@ -830,7 +835,7 @@ static void draw_caret(cairo_t *cr, struct frame *fr, int pos)
const double t = 1.8;
/* Fix up cursor position if necessary */
- if ( fr->pos < fr->lines[0].sc_offset ) {
+ if ( (fr->n_lines > 0) && (fr->pos < fr->lines[0].sc_offset) ) {
fr->pos = fr->lines[0].sc_offset;
pos = fr->pos;
}
diff --git a/src/presentation.h b/src/presentation.h
index 208ed66..49d39d8 100644
--- a/src/presentation.h
+++ b/src/presentation.h
@@ -84,6 +84,7 @@ struct menu_pl
{
struct presentation *p;
struct style *sty;
+ struct slide_template *st;
};
diff --git a/src/render.c b/src/render.c
index 6fd5b71..159a82d 100644
--- a/src/render.c
+++ b/src/render.c
@@ -291,8 +291,6 @@ static int render_sc(struct frame *fr, double scale, ImageStore *is,
fr->n_lines = 0;
fr->max_lines = 0;
- if ( fr->sc == NULL ) return 0;
-
/* Create surface and Cairo stuff */
if ( fr->contents != NULL ) cairo_surface_destroy(fr->contents);
/* Rounding to get the bitmap size */
@@ -507,10 +505,6 @@ cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh,
h = (hh/ww)*w;
scale = w/ww;
- if ( s->top->style != NULL ) {
- memcpy(&s->top->lop, &s->top->style->lop,
- sizeof(struct layout_parameters));
- }
s->top->lop.x = 0.0;
s->top->lop.y = 0.0;
s->top->lop.w = ww;
@@ -519,6 +513,7 @@ cairo_surface_t *render_slide(struct slide *s, int w, double ww, double hh,
s->top->h = hh;
s->top->pix_w = w;
s->top->pix_h = h;
+
render_frame(s->top, scale, is, isz);
surf = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 9d81e20..866a1b6 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -175,6 +175,12 @@ static int read_template(struct slide_template *t, StyleSheet *ss,
struct ds_node *node)
{
int i;
+ int top_style, r;
+
+ r = get_field_i(node, "top_style", &top_style);
+ if ( !r ) {
+ t->top_style = ss->styles[top_style];
+ }
for ( i=0; i<node->n_children; i++ ) {
diff --git a/src/stylesheet.h b/src/stylesheet.h
index 6879a95..79ee341 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -51,6 +51,8 @@ struct slide_template
/* References to the styles in the main list */
struct style **styles;
int n_styles;
+
+ struct style *top_style;
};
diff --git a/src/wrap.c b/src/wrap.c
index e29b22d..e287522 100644
--- a/src/wrap.c
+++ b/src/wrap.c
@@ -725,7 +725,9 @@ static struct wrap_line *sc_to_wrap_boxes(const char *sc, const char *prefix,
if ( prefix != NULL ) {
run_sc(prefix, &fonts, pc, boxes, lang, 0, 0);
}
- run_sc(sc, &fonts, pc, boxes, lang, 0, 1);
+ if ( sc != NULL ) {
+ run_sc(sc, &fonts, pc, boxes, lang, 0, 1);
+ }
/* Empty the stack */
while ( fonts.n_fonts > 0 ) {