aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-16 19:04:33 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-19 22:53:40 +0200
commit1f305d199195d5e27e0731917399dca7de3e75cd (patch)
treea8f1c5401367134ee9877327f63e9153c1416e4d /src/sc_editor.c
parent890e5ac7b89f5cccf120d966dc488f9ddd516a3d (diff)
WIP on slide adding
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c39
1 files changed, 10 insertions, 29 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 5549c54..0db20a8 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -555,34 +555,9 @@ static gboolean draw_sig(GtkWidget *da, cairo_t *cr, SCEditor *e)
}
-void insert_scblock(SCBlock *scblock, SCEditor *e)
+void split_paragraph_at_cursor(SCEditor *e)
{
-#if 0
- /* FIXME: Insert "scblock" at the cursor */
- int sln, sbx, sps;
- struct wrap_box *sbox;
- struct frame *fr = e->cursor_frame;
-
- if ( fr == NULL ) return;
-
- /* If this is, say, the top level frame, do nothing */
- if ( fr->boxes == NULL ) return;
-
- sln = e->cursor_line;
- sbx = e->cursor_box;
- sps = e->cursor_pos;
- sbox = bv_box(e->cursor_frame->lines[sln].boxes, sbx);
-
- sc_insert_block(sbox->scblock, sps+sbox->offs_char, scblock);
-
- fr->empty = 0;
-
- full_rerender(e); /* FIXME: No need for full */
-
- //fixup_cursor(e);
- //advance_cursor(e);
- //sc_editor_redraw(e);
-#endif
+ split_paragraph(e->cursor_frame, e->cursor_para, e->cursor_pos, e->pc);
}
@@ -923,12 +898,18 @@ static gboolean button_press_sig(GtkWidget *da, GdkEventButton *event,
} else {
- /* Selected top new frame, no immediate dragging */
+ /* Clicked an existing frame, no immediate dragging */
e->drag_status = DRAG_STATUS_NONE;
e->drag_reason = DRAG_REASON_NONE;
e->selection = clicked;
e->cursor_frame = clicked;
- check_paragraph(e->cursor_frame, e->pc, e->scblocks);
+ if ( clicked == e->top ) {
+ show_sc_block(clicked->scblocks, ")>");
+ check_paragraph(e->cursor_frame, e->pc, clicked->scblocks);
+ } else {
+ check_paragraph(e->cursor_frame, e->pc,
+ sc_block_child(clicked->scblocks));
+ }
find_cursor(clicked, x-clicked->x, y-clicked->y,
&e->cursor_para, &e->cursor_pos, &e->cursor_trail);