aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2015-12-26 18:41:41 +0100
committerThomas White <taw@bitwiz.org.uk>2015-12-26 18:41:41 +0100
commit7bc3dc12dd7eb45a8bd28fdf020bcfd802ad91f0 (patch)
tree7895c4f3a06a55dfcac883ec7bcf4090e08c1645 /src/sc_editor.c
parent79f3fdbb0b6e379c90eb3783d200e6d4249f4a3b (diff)
Open slide window on right slide
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index ef48e8d..1e273f5 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1161,6 +1161,26 @@ static void calculate_box_size(struct frame *fr, SCEditor *e,
}
+static struct wrap_box *cbox(struct frame *fr, int ln, int bn)
+{
+ return &fr->lines[ln].boxes[bn];
+}
+
+
+static int callback_click(SCEditor *e, struct frame *fr, double x, double y)
+{
+ int ln, bn, pn;
+ struct wrap_box *bx;
+
+ find_cursor(fr, x, y, &ln, &bn, &pn);
+ bx = cbox(fr, ln, bn);
+ if ( bx->type == WRAP_BOX_CALLBACK ) {
+ return bx->click_func(x, y, bx->bvp, bx->vp);
+ }
+ return 0;
+}
+
+
static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
SCEditor *e)
{
@@ -1205,17 +1225,26 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
} else {
- e->cursor_frame = clicked;
- find_cursor(clicked, x-fr->x, y-fr->y,
- &e->cursor_line, &e->cursor_box,
- &e->cursor_pos);
+ /* If this is a callback box, check to see if the owner
+ * is interested */
+ if ( !callback_click(e, clicked, x, y) ) {
+
+ /* else position cursor and prepare for possible
+ * drag */
- e->start_corner_x = event->x - e->border_offs_x;
- e->start_corner_y = event->y - e->border_offs_y;
+ e->cursor_frame = clicked;
+ find_cursor(clicked, x-fr->x, y-fr->y,
+ &e->cursor_line, &e->cursor_box,
+ &e->cursor_pos);
+
+ e->start_corner_x = event->x - e->border_offs_x;
+ e->start_corner_y = event->y - e->border_offs_y;
+
+ if ( fr->resizable ) {
+ e->drag_status = DRAG_STATUS_COULD_DRAG;
+ e->drag_reason = DRAG_REASON_MOVE;
+ }
- if ( fr->resizable ) {
- e->drag_status = DRAG_STATUS_COULD_DRAG;
- e->drag_reason = DRAG_REASON_MOVE;
}
}