1.1 --- a/mainwindow.cpp Thu Apr 21 19:14:38 2005 +0000
1.2 +++ b/mainwindow.cpp Wed May 04 20:35:39 2005 +0000
1.3 @@ -63,6 +63,8 @@
1.4 extern MapEditor *clipboardME;
1.5 extern FlagRowObj* standardFlagsDefault;
1.6
1.7 +extern QPtrList <QAction> actionListBranches;
1.8 +
1.9 extern QAction* actionFileSave;
1.10 extern QAction* actionFilePrint;
1.11 extern QAction* actionEditUndo;
1.12 @@ -83,8 +85,11 @@
1.13 extern QAction *actionEditHeading;
1.14 extern QAction *actionEditDelete;
1.15 extern QAction *actionEditAddBranch;
1.16 +extern QAction *actionEditAddBranchHere;
1.17 extern QAction *actionEditAddBranchAbove;
1.18 extern QAction *actionEditAddBranchBelow;
1.19 +extern QAction *actionEditRemoveBranchHere;
1.20 +extern QAction *actionEditRemoveChilds;
1.21 extern QAction *actionEditImportAdd;
1.22 extern QAction *actionEditImportReplace;
1.23 extern QAction *actionEditSaveBranch;
1.24 @@ -126,6 +131,8 @@
1.25 extern QAction* actionSettingsUseDelKey;
1.26
1.27 extern QPopupMenu* branchContextMenu;
1.28 +extern QPopupMenu* branchAddContextMenu;
1.29 +extern QPopupMenu* branchRemoveContextMenu;
1.30 extern QPopupMenu* branchLinksContextMenu;
1.31 extern QPopupMenu* branchLinksContextMenuDup;
1.32 extern QPopupMenu* floatimageContextMenu;
1.33 @@ -396,24 +403,30 @@
1.34 a->addTo( tb );
1.35 a->addTo( menu );
1.36 actionEditPaste=a;
1.37 +
1.38 a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
1.39 connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
1.40 a->setEnabled (false);
1.41 a->addTo( tb );
1.42 a->addTo( menu );
1.43 + actionListBranches.append(a);
1.44 actionEditMoveUp=a;
1.45 +
1.46 a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
1.47 connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
1.48 a->setEnabled (false);
1.49 a->addTo( tb );
1.50 a->addTo( menu );
1.51 + actionListBranches.append(a);
1.52 actionEditMoveDown=a;
1.53 +
1.54
1.55 a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
1.56 connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
1.57 a->setEnabled (false);
1.58 a->addTo( tb );
1.59 a->addTo( menu );
1.60 + actionListBranches.append(a);
1.61 actionEditToggleScroll=a;
1.62
1.63 a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
1.64 @@ -439,17 +452,20 @@
1.65 connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
1.66 a->addTo( menu );
1.67 a->setEnabled (false);
1.68 + actionListBranches.append(a);
1.69 actionEditURL=a;
1.70
1.71 a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
1.72 connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
1.73 a->addTo( menu );
1.74 a->setEnabled (false);
1.75 + actionListBranches.append(a);
1.76 actionEditHeading2URL=a;
1.77
1.78 a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
1.79 connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
1.80 a->setEnabled (false);
1.81 + actionListBranches.append(a);
1.82 actionEditBugzilla2URL=a;
1.83
1.84 menu->insertSeparator();
1.85 @@ -465,6 +481,7 @@
1.86 connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
1.87 a->addTo( menu );
1.88 a->setEnabled (false);
1.89 + actionListBranches.append(a);
1.90 actionEditVymLink=a;
1.91
1.92 a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
1.93 @@ -488,12 +505,15 @@
1.94 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
1.95 a->setEnabled (false);
1.96 a->addTo ( menu );
1.97 + actionListBranches.append(a);
1.98 actionEditHeading=a;
1.99 a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
1.100 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
1.101 + actionListBranches.append(a);
1.102 actionEditHeading=a;
1.103 a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
1.104 connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
1.105 + actionListBranches.append(a);
1.106
1.107 // Shortcut to delete selection
1.108 a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
1.109 @@ -510,44 +530,65 @@
1.110 #endif
1.111 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
1.112 a->setEnabled (false);
1.113 - a->addTo ( menu );
1.114 + actionListBranches.append(a);
1.115 actionEditAddBranch=a;
1.116
1.117 + // Add branch by inserting it at selection
1.118 + a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_Insert, this, "newBranchHere" );
1.119 + connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
1.120 + a->setEnabled (false);
1.121 + actionListBranches.append(a);
1.122 + actionEditAddBranchHere=a;
1.123 +
1.124 // Add branch above
1.125 a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
1.126 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
1.127 a->setEnabled (false);
1.128 - a->addTo ( menu );
1.129 + actionListBranches.append(a);
1.130 actionEditAddBranchAbove=a;
1.131
1.132 // Add branch below
1.133 a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
1.134 connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
1.135 a->setEnabled (false);
1.136 - a->addTo ( menu );
1.137 + actionListBranches.append(a);
1.138 actionEditAddBranchBelow=a;
1.139
1.140 // Import at selection (adding to selection)
1.141 a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
1.142 connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
1.143 a->setEnabled (false);
1.144 - a->addTo ( menu );
1.145 + actionListBranches.append(a);
1.146 actionEditImportAdd=a;
1.147
1.148 // Import at selection (replacing selection)
1.149 a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
1.150 connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
1.151 a->setEnabled (false);
1.152 - a->addTo ( menu );
1.153 + actionListBranches.append(a);
1.154 actionEditImportReplace=a;
1.155
1.156 // Save selection
1.157 - a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
1.158 + a = new QAction( tr( "Save selection" ),tr( "Save selection" ), 0, this, "saveSelection" );
1.159 connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
1.160 a->setEnabled (false);
1.161 - a->addTo ( menu );
1.162 + actionListBranches.append(a);
1.163 actionEditSaveBranch=a;
1.164
1.165 + // Only remove branch, not its childs
1.166 + a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" );
1.167 + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchHere() ) );
1.168 + a->setEnabled (false);
1.169 + actionListBranches.append(a);
1.170 + actionEditRemoveBranchHere=a;
1.171 +
1.172 + // Only remove childs of a branch
1.173 + a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" );
1.174 + connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
1.175 + a->setEnabled (false);
1.176 + actionListBranches.append(a);
1.177 + actionEditRemoveChilds=a;
1.178 +
1.179 // Shortcuts for navigating with cursor:
1.180 a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
1.181 connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
1.182 @@ -560,12 +601,14 @@
1.183 a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
1.184 a->setEnabled (false);
1.185 a->addTo ( menu );
1.186 + actionListBranches.append(a);
1.187 actionEditSelectFirst=a;
1.188 connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
1.189 a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
1.190 connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
1.191 a->setEnabled (false);
1.192 a->addTo ( menu );
1.193 + actionListBranches.append(a);
1.194 actionEditSelectLast=a;
1.195
1.196 a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
1.197 @@ -593,18 +636,21 @@
1.198 a->setEnabled (false);
1.199 a->addTo( tb );
1.200 a->addTo( menu );
1.201 + actionListBranches.append(a);
1.202 actionFormatPickColor=a;
1.203 a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
1.204 connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
1.205 a->setEnabled (false);
1.206 a->addTo( tb );
1.207 a->addTo( menu );
1.208 + actionListBranches.append(a);
1.209 actionFormatColorBranch=a;
1.210 a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
1.211 connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
1.212 a->setEnabled (false);
1.213 a->addTo( menu );
1.214 a->addTo( tb );
1.215 + actionListBranches.append(a);
1.216 actionFormatColorSubtree=a;
1.217
1.218 menu->insertSeparator();
1.219 @@ -822,29 +868,44 @@
1.220
1.221 // Context Menu for branch or mapcenter
1.222 branchContextMenu =new QPopupMenu (this);
1.223 - actionEditAddBranch->addTo ( branchContextMenu );
1.224 - actionEditAddBranchAbove->addTo ( branchContextMenu );
1.225 - actionEditAddBranchBelow->addTo ( branchContextMenu );
1.226 +
1.227 + // Submenu "Add"
1.228 + branchAddContextMenu =new QPopupMenu (this);
1.229 + actionEditPaste->addTo ( branchAddContextMenu );
1.230 + actionEditAddBranch->addTo ( branchAddContextMenu );
1.231 + actionEditAddBranchHere->addTo ( branchAddContextMenu );
1.232 + actionEditAddBranchAbove->addTo ( branchAddContextMenu );
1.233 + actionEditAddBranchBelow->addTo ( branchAddContextMenu );
1.234 + branchAddContextMenu->insertSeparator();
1.235 + actionEditLoadImage->addTo( branchAddContextMenu );
1.236 + branchAddContextMenu->insertSeparator();
1.237 + actionEditImportAdd->addTo ( branchAddContextMenu );
1.238 + actionEditImportReplace->addTo ( branchAddContextMenu );
1.239 +
1.240 + // Submenu "Remove"
1.241 + branchRemoveContextMenu =new QPopupMenu (this);
1.242 + actionEditCut->addTo ( branchRemoveContextMenu );
1.243 + actionEditDelete->addTo ( branchRemoveContextMenu );
1.244 + actionEditRemoveBranchHere->addTo( branchRemoveContextMenu );
1.245 + actionEditRemoveChilds->addTo( branchRemoveContextMenu );
1.246 +
1.247 + branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);
1.248 + branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);
1.249 +
1.250 actionEditSaveBranch->addTo( branchContextMenu );
1.251 - branchContextMenu->insertSeparator();
1.252 - actionEditImportAdd->addTo ( branchContextMenu );
1.253 - actionEditImportReplace->addTo ( branchContextMenu );
1.254 +
1.255 branchContextMenu->insertSeparator();
1.256 actionEditOpenURL->addTo ( branchContextMenu );
1.257 actionEditURL->addTo ( branchContextMenu );
1.258 actionEditHeading2URL->addTo ( branchContextMenu );
1.259 if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false))
1.260 actionEditBugzilla2URL->addTo( branchContextMenu );
1.261 +
1.262 branchContextMenu->insertSeparator();
1.263 actionEditOpenVymLink->addTo ( branchContextMenu );
1.264 actionEditVymLink->addTo ( branchContextMenu );
1.265 actionEditDeleteVymLink->addTo ( branchContextMenu );
1.266 - branchContextMenu->insertSeparator();
1.267 - actionEditLoadImage->addTo( branchContextMenu );
1.268 - branchContextMenu->insertSeparator();
1.269 - //actionEditCopy->addTo( branchContextMenu );
1.270 - //actionEditCut->addTo( branchContextMenu );
1.271 - //actionEditPaste->addTo( branchContextMenu );
1.272 +
1.273 branchContextMenu->insertSeparator();
1.274 actionGroupFormatFrameTypes->addTo( branchContextMenu );
1.275
1.276 @@ -1906,6 +1967,12 @@
1.277 currentMapEditor()->addNewBranch(0);
1.278 }
1.279
1.280 +void Main::editNewBranchHere()
1.281 +{
1.282 + if (currentMapEditor())
1.283 + currentMapEditor()->addNewBranchHere();
1.284 +}
1.285 +
1.286 void Main::editNewBranchAbove()
1.287 {
1.288 if (currentMapEditor())
1.289 @@ -1933,6 +2000,18 @@
1.290 fileSaveAs (PartOfMap);
1.291 }
1.292
1.293 +void Main::editRemoveBranchHere()
1.294 +{
1.295 + if (currentMapEditor())
1.296 + currentMapEditor()->removeBranchHere();
1.297 +}
1.298 +
1.299 +void Main::editRemoveChilds()
1.300 +{
1.301 + if (currentMapEditor())
1.302 + currentMapEditor()->removeChilds();
1.303 +}
1.304 +
1.305 void Main::editDeleteSelection()
1.306 {
1.307 if (currentMapEditor())