aboutsummaryrefslogtreecommitdiff
path: root/src/sc_editor.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2016-04-26 22:34:25 +0200
committerThomas White <taw@bitwiz.org.uk>2016-04-26 22:34:25 +0200
commit1d2e905763d2c403e54850d61044065b238e16bc (patch)
tree29ab44993df243530f8b4005d8250a812498aa16 /src/sc_editor.c
parente90d663864cb60067f90b964adc2686aba69e333 (diff)
Copy slide
Diffstat (limited to 'src/sc_editor.c')
-rw-r--r--src/sc_editor.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/sc_editor.c b/src/sc_editor.c
index 7a89036..4dfec35 100644
--- a/src/sc_editor.c
+++ b/src/sc_editor.c
@@ -1114,6 +1114,25 @@ static gboolean button_release_sig(GtkWidget *da, GdkEventButton *event,
}
+static void copy_selection(SCEditor *e)
+{
+ GtkClipboard *cb;
+ char *storycode;
+ SCBlock *bl;
+
+ bl = block_at_cursor(e->cursor_frame, e->cursor_para,
+ e->cursor_pos+e->cursor_trail);
+ if ( bl == NULL ) return;
+
+ storycode = serialise_sc_block(bl);
+ printf("Got '%s'\n", storycode);
+
+ cb = gtk_clipboard_get(GDK_NONE);
+ gtk_clipboard_set_text(cb, storycode, -1);
+ free(storycode);
+}
+
+
static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
SCEditor *e)
{
@@ -1186,6 +1205,13 @@ static gboolean key_press_sig(GtkWidget *da, GdkEventKey *event,
full_rerender(e);
break;
+ case GDK_KEY_C :
+ case GDK_KEY_c :
+ if ( event->state == GDK_CONTROL_MASK ) {
+ copy_selection(e);
+ }
+ break;
+
}
if ( claim ) return TRUE;