branches/KDE/3.5/kdevelop

Vladimir Prus ghost at cs.msu.su
Wed Aug 24 12:25:12 UTC 2005


SVN commit 452736 by vprus:

Assign shortcuts to most common debugger functions:
F9  -- run/continue
F10 -- step over
F11 -- step in
F12 -- step out

The shortcuts are choosed to be located on the same block of F-keys,
to ease memorization and also so that "step in/step out" are next to each
other.

The "watch from expression" and "toggle breakpoint" actions don't yet
any shortcuts yet -- I believe they probably don't need them. Breakpoint
can be toggled with mouse and watch from expression is in the popup menu.

I'm not sure with F9 -- run in debugger/continue shortcut, one can argue
that F9 should be run while "shift+F9" should be run in debugger. In any case,
some project manager don't have any shortcut for "run" at all, and some use
"shift+f9" and I don't want to mess with that yet.

This change comes at expense of Kate, which no longer has shortcuts for
the "hide/show folding markers", "dynamic word wrap" and 
"hide/show line numbers" action. However, those are far less important in IDE
than debugger actions.

*    src/partcontroller.cpp
     (PartController::integratePart): For texteditor, disable some
     action. Make sure we do it only if the actions are in fact defined,
     and shortcuts conflict with debugger, so that we don't do anything
     wrong if text editor is not Kate. See comment in code for further
     explanations.
          
*    languages/cpp/debugger/debuggerpart.cpp
     (DebuggerPart::DebuggerPart): Assign shortcuts.


CCMAIL: kdevelop-devel at kdevelop.org
BUG: 85453


 M  +4 -4      languages/cpp/debugger/debuggerpart.cpp  
 M  +38 -0     src/partcontroller.cpp  


--- branches/KDE/3.5/kdevelop/languages/cpp/debugger/debuggerpart.cpp #452735:452736
@@ -165,7 +165,7 @@
     KAction *action;
 
 //    action = new KAction(i18n("&Start"), "1rightarrow", CTRL+SHIFT+Key_F9,
-    action = new KAction(i18n("&Start"), "dbgrun", CTRL+SHIFT+Key_F9,
+    action = new KAction(i18n("&Start"), "dbgrun", Key_F9,
                          this, SLOT(slotRun()),
                          actionCollection(), "debug_run");
     action->setToolTip( i18n("Start in debugger") );
@@ -212,7 +212,7 @@
     action->setWhatsThis(i18n("<b>Set Execution Position </b><p>Set the execution pointer to the current cursor position."));
 
 
-    action = new KAction(i18n("Step &Over"), "dbgnext", 0,
+    action = new KAction(i18n("Step &Over"), "dbgnext", Key_F10,
                          this, SLOT(slotStepOver()),
                          actionCollection(), "debug_stepover");
     action->setToolTip( i18n("Step over the next line") );
@@ -230,7 +230,7 @@
     action->setWhatsThis(i18n("<b>Step over instruction</b><p>Steps over the next assembly instruction."));
 
 
-    action = new KAction(i18n("Step &Into"), "dbgstep", 0,
+    action = new KAction(i18n("Step &Into"), "dbgstep", Key_F11,
                          this, SLOT(slotStepInto()),
                          actionCollection(), "debug_stepinto");
     action->setToolTip( i18n("Step into the next statement") );
@@ -247,7 +247,7 @@
     action->setWhatsThis(i18n("<b>Step into instruction</b><p>Steps into the next assembly instruction."));
 
 
-    action = new KAction(i18n("Step O&ut"), "dbgstepout", 0,
+    action = new KAction(i18n("Step O&ut"), "dbgstepout", Key_F12,
                          this, SLOT(slotStepOut()),
                          actionCollection(), "debug_stepout");
     action->setToolTip( i18n("Steps out of the current function") );
--- branches/KDE/3.5/kdevelop/src/partcontroller.cpp #452735:452736
@@ -573,6 +573,44 @@
       return; // to avoid later crash
   }
 
+  // There's shortcut conflict between Kate and the debugger, resolve
+  // it here. Ideally, the should be some standard mechanism, configurable
+  // by config files.
+  // However, it does not exists and situation here some rare commands
+  // like "Dynamic word wrap" or "Show line numbers" from Kate take
+  // all possible shortcuts, leaving us with IDE that has no shortcuts for
+  // debugger, is very bad.
+  //
+  // We could try to handle this in debugger, but that would require
+  // the debugger to intercept all new KTextEditor::View creations, which is
+  // not possible.
+
+  KTextEditor::View* view = dynamic_cast<KTextEditor::View*>(widget);
+  if (view)
+  {
+    KActionCollection* c = view->actionCollection();
+    // Be extra carefull, in case the part either don't provide those
+    // action, or uses different shortcuts.
+
+    if (KAction* a = c->action("view_folding_markers"))
+    {
+      if (a->shortcut() == KShortcut(Key_F9))
+        a->setShortcut(KShortcut());
+    }
+
+    if (KAction* a = c->action("view_dynamic_word_wrap"))
+    {
+      if (a->shortcut() == KShortcut(Key_F10))
+        a->setShortcut(KShortcut());
+    }
+
+    if (KAction* a = c->action("view_line_numbers"))
+    {
+      if (a->shortcut() == KShortcut(Key_F11))
+        a->setShortcut(KShortcut());
+    }
+  }
+      
   TopLevel::getInstance()->embedPartView(widget, url.fileName(), url.url());
 
   addPart(part, activate);




More information about the KDevelop-devel mailing list