Browse Source

Make Ctrl+Return work for "Open file at cursor".

git-svn-id: file:///var/svn/tigccpp/trunk@1175 9552661e-59e3-4036-b4f2-dbe53926924f
kevinkofler 16 years ago
parent
commit
0737329565
4 changed files with 16 additions and 5 deletions
  1. 2 1
      ktigcc/NEWS
  2. 9 2
      ktigcc/mainform.cpp
  3. 4 1
      ktigcc/srcfilewin.cpp
  4. 1 1
      ktigcc/srcfilewin.h

+ 2 - 1
ktigcc/NEWS

@@ -1,6 +1,6 @@
 This is a summary of the changes in KTIGCC since the first alpha release:
 
-CVS HEAD (2007-06-30):
+CVS HEAD (2007-07-02):
 
 * Added a full changelog (generated from CVS logs).
 * Fixed stray indentation at the end of the line when autoclosing a curly brace
@@ -23,6 +23,7 @@ CVS HEAD (2007-06-30):
   file name on the computer instead of the old renaming hack.
 * Non-ASCII characters in on-calc file names are now passed to ld-tigcc in
   urlencoded form (more portable).
+* Ctrl+Return now works for "Open file at cursor" (not just Ctrl+Numpad Enter)
 
 
 KTIGCC 1.06 (2006-11-25):

+ 9 - 2
ktigcc/mainform.cpp

@@ -482,7 +482,7 @@ tprLibOpts libopts;
 static QString projectFileName;
 static QString lastDirectory;
 QClipboard *clipboard;
-static QShortcut *shortcuts[17];
+static QShortcut *shortcuts[18];
 static KFindDialog *kfinddialog;
 QStringList findHistory, replacementHistory;
 static Q3ListViewItem *findCurrentDocument;
@@ -1171,6 +1171,8 @@ MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
   shortcuts[15]->setEnabled(TRUE);
   shortcuts[16]=new QShortcut(Qt::CTRL+Qt::Key_F9,this);
   shortcuts[16]->setEnabled(TRUE);
+  shortcuts[17]=new QShortcut(Qt::CTRL+Qt::Key_Return,this);
+  shortcuts[17]->setEnabled(FALSE);
   connect(shortcuts[0],SIGNAL(activated()),this,SLOT(shortcut_0_activated()));
   connect(shortcuts[1],SIGNAL(activated()),this,SLOT(shortcut_1_activated()));
   connect(shortcuts[2],SIGNAL(activated()),this,SLOT(shortcut_2_activated()));
@@ -1188,6 +1190,7 @@ MainForm::MainForm(QWidget* parent, const char* name, Qt::WindowFlags fl)
   connect(shortcuts[14],SIGNAL(activated()),this,SLOT(shortcut_14_activated()));
   connect(shortcuts[15],SIGNAL(activated()),this,SLOT(shortcut_15_activated()));
   connect(shortcuts[16],SIGNAL(activated()),this,SLOT(shortcut_16_activated()));
+  connect(shortcuts[17],SIGNAL(activated()),this,SLOT(findOpenFileAtCursor()));
   kfinddialog = static_cast<KFindDialog *>(NULL);
   kreplace = static_cast<KReplaceWithSelection *>(NULL);
   connect(fileNewAction,SIGNAL(triggered()),this,SLOT(fileNewProject()));
@@ -1320,7 +1323,7 @@ MainForm::~MainForm()
   }
   if (kreplace) delete kreplace;
   if (kfinddialog) delete kfinddialog;
-  for (int i=0; i<17; i++) delete shortcuts[i];
+  for (int i=0; i<18; i++) delete shortcuts[i];
   delete te_popup;
   delete leftStatusLabel;
   delete rowStatusLabel;
@@ -5271,6 +5274,7 @@ void MainForm::fileTreeClicked(Q3ListViewItem *item)
     shortcuts[8]->setEnabled(FALSE);
     shortcuts[9]->setEnabled(FALSE);
     shortcuts[10]->setEnabled(FALSE);
+    shortcuts[17]->setEnabled(FALSE);
   } else if (IS_FILE(item)) {
     fileNewFolderAction->setEnabled(TRUE);
     CATEGORY_OF(category,item->parent());
@@ -5304,6 +5308,7 @@ void MainForm::fileTreeClicked(Q3ListViewItem *item)
       shortcuts[8]->setEnabled(TRUE);
       shortcuts[9]->setEnabled(TRUE);
       shortcuts[10]->setEnabled(TRUE);
+      shortcuts[17]->setEnabled(TRUE);
     } else {
       filePrintAction->setEnabled(FALSE);
       filePrintQuicklyAction->setEnabled(FALSE);
@@ -5330,6 +5335,7 @@ void MainForm::fileTreeClicked(Q3ListViewItem *item)
       shortcuts[8]->setEnabled(FALSE);
       shortcuts[9]->setEnabled(FALSE);
       shortcuts[10]->setEnabled(FALSE);
+      shortcuts[17]->setEnabled(FALSE);
     }
   } else {
     fileNewFolderAction->setEnabled(FALSE);
@@ -5358,6 +5364,7 @@ void MainForm::fileTreeClicked(Q3ListViewItem *item)
     shortcuts[8]->setEnabled(FALSE);
     shortcuts[9]->setEnabled(FALSE);
     shortcuts[10]->setEnabled(FALSE);
+    shortcuts[17]->setEnabled(FALSE);
   }
   currentListItem=item;
   updateLeftStatusLabel();

+ 4 - 1
ktigcc/srcfilewin.cpp

@@ -247,6 +247,7 @@ SourceFileWindow::SourceFileWindow(MainForm *mainfrm, const QString &fn,
   shortcuts[8]=new QShortcut(Qt::CTRL+Qt::Key_J,this);
   shortcuts[9]=new QShortcut(Qt::CTRL+Qt::Key_Space,this);
   shortcuts[10]=new QShortcut(Qt::CTRL+Qt::Key_M,this);
+  shortcuts[11]=new QShortcut(Qt::CTRL+Qt::Key_Return,this);
   shortcuts[0]->setEnabled(CURRENT_VIEW->action(KStandardAction::name(KStandardAction::Undo))->isEnabled());
   shortcuts[1]->setEnabled(CURRENT_VIEW->action(KStandardAction::name(KStandardAction::Redo))->isEnabled());
   shortcuts[2]->setEnabled(CURRENT_VIEW->selection());
@@ -258,6 +259,7 @@ SourceFileWindow::SourceFileWindow(MainForm *mainfrm, const QString &fn,
   shortcuts[8]->setEnabled(TRUE);
   shortcuts[9]->setEnabled(TRUE);
   shortcuts[10]->setEnabled(TRUE);
+  shortcuts[11]->setEnabled(TRUE);
   connect(shortcuts[0],SIGNAL(activated()),this,SLOT(shortcut_0_activated()));
   connect(shortcuts[1],SIGNAL(activated()),this,SLOT(shortcut_1_activated()));
   connect(shortcuts[2],SIGNAL(activated()),this,SLOT(shortcut_2_activated()));
@@ -269,6 +271,7 @@ SourceFileWindow::SourceFileWindow(MainForm *mainfrm, const QString &fn,
   connect(shortcuts[8],SIGNAL(activated()),this,SLOT(shortcut_8_activated()));
   connect(shortcuts[9],SIGNAL(activated()),this,SLOT(shortcut_9_activated()));
   connect(shortcuts[10],SIGNAL(activated()),this,SLOT(shortcut_10_activated()));
+  connect(shortcuts[11],SIGNAL(activated()),this,SLOT(findOpenFileAtCursor()));
   if (preferences.useSystemIcons) {
     // Set the preferred icon size so system toolbar icons don't get annoying
     // padding.
@@ -317,7 +320,7 @@ SourceFileWindow::~SourceFileWindow()
     findHistory=kfinddialog->findHistory();
     delete kfinddialog;
   }
-  for (int i=0; i<11; i++) delete shortcuts[i];
+  for (int i=0; i<12; i++) delete shortcuts[i];
   delete te_popup;
   delete rowStatusLabel;
   delete colStatusLabel;

+ 1 - 1
ktigcc/srcfilewin.h

@@ -71,7 +71,7 @@ public:
   QLabel *charsStatusLabel;
   QLabel *rightStatusLabel;
   Q3PopupMenu *te_popup;
-  QShortcut *shortcuts[11];
+  QShortcut *shortcuts[12];
   KFindDialog *kfinddialog;
   int findCurrentLine;
   KDirWatch *dirWatch;