From 5e9d52e73d71c84a3a929bea971fa30a0793eab2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Sat, 23 Jul 2016 09:37:38 +0000 Subject: [PATCH] [GB.GTK] * BUG: TextArea: Shortcuts that could modify the text are now disabled if the TextArea is read-only. [GB.GTK3] * BUG: TextArea: Shortcuts that could modify the text are now disabled if the TextArea is read-only. git-svn-id: svn://localhost/gambas/trunk@7830 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- gb.gtk/src/gtextarea.cpp | 46 ++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/gb.gtk/src/gtextarea.cpp b/gb.gtk/src/gtextarea.cpp index 0d634162e..1349c9b51 100644 --- a/gb.gtk/src/gtextarea.cpp +++ b/gb.gtk/src/gtextarea.cpp @@ -406,17 +406,33 @@ static gboolean cb_keypress(GtkWidget *widget, GdkEvent *event, gTextArea *ctrl) { int key = gdk_keyval_to_unicode(gdk_keyval_to_upper(event->key.keyval)); - if (key == 'Z') + if (!ctrl->readOnly()) { - ctrl->undo(); - return true; + if (key == 'Z') + { + ctrl->undo(); + return true; + } + else if (key == 'Y') + { + ctrl->redo(); + return true; + } + else if (key == 'X') + { + ctrl->cut(); + ctrl->ensureVisible(); + return true; + } + else if (key == 'V') + { + ctrl->paste(); + ctrl->ensureVisible(); + return true; + } } - else if (key == 'Y') - { - ctrl->redo(); - return true; - } - else if (key == 'A') + + if (key == 'A') { ctrl->selectAll(); return true; @@ -426,18 +442,6 @@ static gboolean cb_keypress(GtkWidget *widget, GdkEvent *event, gTextArea *ctrl) ctrl->copy(); return true; } - else if (key == 'X') - { - ctrl->cut(); - ctrl->ensureVisible(); - return true; - } - else if (key == 'V') - { - ctrl->paste(); - ctrl->ensureVisible(); - return true; - } } return false;