octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #41217] GUI Editor could support customizable


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #41217] GUI Editor could support customizable keybindings
Date: Fri, 18 Jul 2014 16:15:24 +0000
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:30.0) Gecko/20100101 Firefox/30.0

Follow-up Comment #23, bug #41217 (project octave):

AFAICS QScintilla has a hard coded value for CMD so I don't think it is
possible to instruct it to do the CTRL/META swap.

I think I have found a clue on how to solve the problem. I have made the
following change and all offending shortcuts now work:


diff -r a311cf821fb0 libgui/src/m-editor/octave-qscintilla.cc
--- a/libgui/src/m-editor/octave-qscintilla.cc  Thu Jul 17 19:27:42 2014 +0200
+++ b/libgui/src/m-editor/octave-qscintilla.cc  Fri Jul 18 18:01:24 2014 +0200
@@ -65,6 +65,34 @@
   cmd_set->find (QsciCommand::LineDelete)->setKey (0);
   cmd_set->find (QsciCommand::LineCut)->setKey (0);
   cmd_set->find (QsciCommand::LineCopy)->setKey (0);
+  QList< QsciCommand * > cmd_list = cmd_set->commands ();
+  for (int i = 0; i < cmd_list.length (); i++)
+    {
+      int cmd_key = cmd_list.at (i)->key ();
+      switch (cmd_key)
+        {
+          case Qt::Key_C | Qt::META :     
+          case Qt::Key_A | Qt::META :           
+          case Qt::Key_N | Qt::META :           
+          case Qt::Key_P | Qt::META :             
+          case Qt::Key_F | Qt::META :            
+          case Qt::Key_B | Qt::META :              
+          case Qt::Key_V | Qt::META :   
+            cmd_list.at (i)->setKey (0);
+        }         
+      cmd_key = cmd_list.at (i)->alternateKey ();
+      switch (cmd_key)
+        {
+          case Qt::Key_C | Qt::META :     
+          case Qt::Key_A | Qt::META :           
+          case Qt::Key_N | Qt::META :           
+          case Qt::Key_P | Qt::META :             
+          case Qt::Key_F | Qt::META :            
+          case Qt::Key_B | Qt::META :              
+          case Qt::Key_V | Qt::META :   
+            cmd_list.at (i)->setAlternateKey (0);
+        }         
+    }
 #else



This is clearly not the right approach. Qscintilla's key/alternateKey should
be deleted only when needed, i.e. when octave tries to set a shortcut that is
already defined. 
Could the shortcut manager check for duplicates not only among octave's but
also among qscintilla default keys and alternate keys?  



    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?41217>

_______________________________________________
  Message posté via/par Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]