diff options
author | Thomas White <taw@bitwiz.me.uk> | 2019-04-28 22:34:22 +0200 |
---|---|---|
committer | Thomas White <taw@bitwiz.me.uk> | 2019-04-28 22:34:22 +0200 |
commit | 6e9dba4eca2d65c7cef727fccbc1550c11a61737 (patch) | |
tree | 5d2c435a38138557cff698bf8bc562c05222e961 /libstorycode | |
parent | 516191143294dce6f373819422b9672dc630dca1 (diff) |
Get rid of SlideItem->resizable
Diffstat (limited to 'libstorycode')
-rw-r--r-- | libstorycode/gtk/gtkslideview.c | 12 | ||||
-rw-r--r-- | libstorycode/slide.c | 7 | ||||
-rw-r--r-- | libstorycode/slide_priv.h | 1 |
3 files changed, 9 insertions, 11 deletions
diff --git a/libstorycode/gtk/gtkslideview.c b/libstorycode/gtk/gtkslideview.c index c98fe5b..ab030ec 100644 --- a/libstorycode/gtk/gtkslideview.c +++ b/libstorycode/gtk/gtkslideview.c @@ -48,6 +48,12 @@ G_DEFINE_TYPE_WITH_CODE(GtkSlideView, gtk_slide_view, GTK_TYPE_DRAWING_AREA, NULL) +static int resizable(SlideItem *item) +{ + if ( item->type == SLIDE_ITEM_TEXT ) return 1; + if ( item->type == SLIDE_ITEM_IMAGE ) return 1; + return 0; +} static gboolean resize_sig(GtkWidget *widget, GdkEventConfigure *event, GtkSlideView *e) @@ -257,7 +263,7 @@ static void draw_overlay(cairo_t *cr, GtkSlideView *e) draw_editing_box(cr, e->cursor_frame, stylesheet, slide_w, slide_h, x, y, w, h); - if ( e->cursor_frame->resizable ) { + if ( resizable(e->cursor_frame) ) { /* Draw resize handles */ draw_resize_handle(cr, x, y+h-20.0); draw_resize_handle(cr, x+w-20.0, y); @@ -658,7 +664,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, /* Within the resizing region? */ c = which_corner(x, y, frx, fry, frw, frh); - if ( (c != CORNER_NONE) && e->cursor_frame->resizable && shift ) { + if ( (c != CORNER_NONE) && resizable(e->cursor_frame) && shift ) { e->drag_reason = DRAG_REASON_RESIZE; e->drag_corner = c; @@ -686,7 +692,7 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event, e->start_corner_x = x; e->start_corner_y = y; - if ( clicked->resizable && shift ) { + if ( resizable(clicked) && shift ) { e->drag_status = DRAG_STATUS_COULD_DRAG; e->drag_reason = DRAG_REASON_MOVE; } else { diff --git a/libstorycode/slide.c b/libstorycode/slide.c index 0e11785..f5c4c9c 100644 --- a/libstorycode/slide.c +++ b/libstorycode/slide.c @@ -83,7 +83,6 @@ SlideItem *slide_add_image(Slide *s, char *filename, struct frame_geom geom) item->type = SLIDE_ITEM_IMAGE; item->geom = geom; item->filename = filename; - item->resizable = 1; return item; } @@ -115,12 +114,6 @@ static SlideItem *add_text_item(Slide *s, char **text, int n_text, struct frame_ item->geom = geom; item->align = alignment; - if ( slide_item == SLIDE_ITEM_TEXT ) { - item->resizable = 1; - } else { - item->resizable = 0; - } - return item; } diff --git a/libstorycode/slide_priv.h b/libstorycode/slide_priv.h index 75a2ac5..8479463 100644 --- a/libstorycode/slide_priv.h +++ b/libstorycode/slide_priv.h @@ -64,7 +64,6 @@ struct _slideitem /* For TEXT and IMAGE */ struct frame_geom geom; - int resizable; }; |