diff options
author | Thomas White <taw@bitwiz.org.uk> | 2015-10-23 15:12:59 +0100 |
---|---|---|
committer | Thomas White <taw@bitwiz.org.uk> | 2015-10-23 15:12:59 +0100 |
commit | 3a04b087b385978d597c526b279fa264f05b2dc9 (patch) | |
tree | cfa36b15be5fcdb4b880ce6dd81fe855b16a1f83 | |
parent | c5883740a99bc3b032f72bcaecaffbed74cd4c26 (diff) |
Fix top level frame position and editing overlay
-rw-r--r-- | src/render.c | 2 | ||||
-rw-r--r-- | src/sc_editor.c | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/render.c b/src/render.c index 57dff1f..b035893 100644 --- a/src/render.c +++ b/src/render.c @@ -363,6 +363,7 @@ static void do_background(cairo_t *cr, struct frame *fr) static int draw_frame(cairo_t *cr, struct frame *fr, ImageStore *is, enum is_size isz) { + cairo_save(cr); do_background(cr, fr); if ( fr->trouble ) { @@ -376,6 +377,7 @@ static int draw_frame(cairo_t *cr, struct frame *fr, ImageStore *is, /* Actually render the lines */ cairo_translate(cr, fr->pad_l, fr->pad_t); render_lines(fr, cr, is, isz); + cairo_restore(cr); return 0; } diff --git a/src/sc_editor.c b/src/sc_editor.c index 5924f0c..9d4da55 100644 --- a/src/sc_editor.c +++ b/src/sc_editor.c @@ -88,6 +88,7 @@ static void update_size(SCEditor *e) e->h = total_height(e->top); e->log_w = e->w; e->log_h = e->h; + e->top->h = e->h; printf("set %i %i %f %f\n", e->w, e->h, e->log_w, e->log_h); set_vertical_params(e); } @@ -108,6 +109,9 @@ static gboolean resize_sig(GtkWidget *widget, GdkEventConfigure *event, /* 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; wrap_contents(e->top); /* Only the top level needs to be wrapped */ update_size(e); e->need_draw = 1; @@ -276,7 +280,10 @@ static void full_rerender(SCEditor *e) e->is, ISZ_EDITOR, 0, cr); cairo_destroy(cr); + e->top->x = 0.0; + e->top->y = 0.0; e->top->w = e->w; + e->top->h = 0.0; /* To be updated in a moment */ recursive_wrap(e->top, e->is, ISZ_EDITOR); update_size(e); @@ -555,7 +562,6 @@ static void draw_overlay(cairo_t *cr, SCEditor *e) { double x, y, w, h; - if ( e->selection != NULL ) { draw_editing_box(cr, e->selection); @@ -1057,7 +1063,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, struct frame *clicked; x = event->x - e->border_offs_x; - y = event->y - e->border_offs_y; + y = event->y - e->border_offs_y + e->scroll_pos; if ( within_frame(e->selection, x, y) ) { clicked = e->selection; @@ -1728,6 +1734,8 @@ SCEditor *sc_editor_new(SCBlock *scblocks, SCBlock **stylesheets) sceditor->h = 100; sceditor->log_w = 100; sceditor->log_h = 100; + sceditor->border_offs_x = 0; + sceditor->border_offs_y = 0; sceditor->is = imagestore_new(); sceditor->slidenum = 0; sceditor->min_border = 0.0; |