aboutsummaryrefslogtreecommitdiff
path: root/libstorycode/gtk/gtkslideview.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.me.uk>2019-04-28 22:34:22 +0200
committerThomas White <taw@bitwiz.me.uk>2019-04-28 22:34:22 +0200
commit6e9dba4eca2d65c7cef727fccbc1550c11a61737 (patch)
tree5d2c435a38138557cff698bf8bc562c05222e961 /libstorycode/gtk/gtkslideview.c
parent516191143294dce6f373819422b9672dc630dca1 (diff)
Get rid of SlideItem->resizable
Diffstat (limited to 'libstorycode/gtk/gtkslideview.c')
-rw-r--r--libstorycode/gtk/gtkslideview.c12
1 files changed, 9 insertions, 3 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 {