1.6.5 new insert/remove options
authorinsilmaril
Wed, 04 May 2005 20:35:39 +0000
changeset 9858adc2d2ed08
parent 97 0b048b6bb6f4
child 99 fac7bf719295
1.6.5 new insert/remove options
branchobj.cpp
branchobj.h
demos/todo.vym
imageobj.cpp
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
tex/vym.tex
version.h
     1.1 --- a/branchobj.cpp	Thu Apr 21 19:14:38 2005 +0000
     1.2 +++ b/branchobj.cpp	Wed May 04 20:35:39 2005 +0000
     1.3 @@ -985,6 +985,25 @@
     1.4  	return bo;
     1.5  }
     1.6  
     1.7 +void BranchObj::removeBranchHere(BranchObj* borem)
     1.8 +{
     1.9 +	// This removes the branch bo from list, but 
    1.10 +	// inserts its childs at the place of bo
    1.11 +	BranchObj *bo;
    1.12 +	bo=borem->getLastBranch();
    1.13 +	while (bo)
    1.14 +	{
    1.15 +		bo->moveBranchTo (borem,1);
    1.16 +		bo=borem->getLastBranch();
    1.17 +	}	
    1.18 +	removeBranch (borem);
    1.19 +}
    1.20 +
    1.21 +void BranchObj::removeChilds()
    1.22 +{
    1.23 +	clear();
    1.24 +}
    1.25 +
    1.26  void BranchObj::removeBranch(BranchObj* bo)
    1.27  {
    1.28      // if bo is not in branch remove returns false, we
    1.29 @@ -1077,9 +1096,9 @@
    1.30  	else
    1.31  		return NULL;
    1.32  
    1.33 -	if (pos<0  || dst->getDepth()==1)
    1.34 +	if (pos<0||dst->getDepth()==0)
    1.35  	{	
    1.36 -		// links adds myself as last branch at dst
    1.37 +		// links myself as last branch at dst
    1.38  		dst->addBranchPtr (this);
    1.39  		return this;
    1.40  	} else
     2.1 --- a/branchobj.h	Thu Apr 21 19:14:38 2005 +0000
     2.2 +++ b/branchobj.h	Wed May 04 20:35:39 2005 +0000
     2.3 @@ -85,6 +85,8 @@
     2.4      virtual BranchObj* insertBranch(int);
     2.5      virtual BranchObj* insertBranch(BranchObj*,int);
     2.6      virtual BranchObj* insertBranchPtr (BranchObj*,int);
     2.7 +    virtual void removeBranchHere(BranchObj*);  
     2.8 +    virtual void removeChilds();  
     2.9      virtual void removeBranch(BranchObj*);  
    2.10      virtual void removeBranchPtr (BranchObj*);  
    2.11      virtual void setLastSelectedBranch(BranchObj*);
     3.1 Binary file demos/todo.vym has changed
     4.1 --- a/imageobj.cpp	Thu Apr 21 19:14:38 2005 +0000
     4.2 +++ b/imageobj.cpp	Wed May 04 20:35:39 2005 +0000
     4.3 @@ -39,7 +39,7 @@
     4.4  {
     4.5  	switch (type)
     4.6  	{
     4.7 -		case undef: qWarning("undef");break;
     4.8 +		case undef: qWarning("Warning: ImageObj::save() type=undef");break;
     4.9  		case qimage: image.save (fn,format,-1);break;
    4.10  		case qpixmap: pixmap.save (fn,format,-1);break;
    4.11  	}
     5.1 --- a/main.cpp	Thu Apr 21 19:14:38 2005 +0000
     5.2 +++ b/main.cpp	Wed May 04 20:35:39 2005 +0000
     5.3 @@ -2,6 +2,7 @@
     5.4  #include <qpixmap.h>
     5.5  #include <qtranslator.h>
     5.6  #include <qdir.h>
     5.7 +#include <qptrlist.h>
     5.8  #include <qtextcodec.h>
     5.9  
    5.10  #include "settings.h"
    5.11 @@ -22,6 +23,10 @@
    5.12  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
    5.13  FlagRowObj *standardFlagsDefault;
    5.14  
    5.15 +// Lists of actions
    5.16 +// (QActionGroup could not be "enabled")
    5.17 +QPtrList <QAction> actionListBranches;
    5.18 +
    5.19  // Actions which change sometimes
    5.20  QAction *actionFileSave;
    5.21  QAction *actionFilePrint;
    5.22 @@ -43,8 +48,11 @@
    5.23  QAction *actionEditHeading;
    5.24  QAction *actionEditDelete;
    5.25  QAction *actionEditAddBranch;
    5.26 +QAction *actionEditAddBranchHere;
    5.27  QAction *actionEditAddBranchAbove;
    5.28  QAction *actionEditAddBranchBelow;
    5.29 +QAction *actionEditRemoveBranchHere;
    5.30 +QAction *actionEditRemoveChilds;
    5.31  QAction *actionEditImportAdd;
    5.32  QAction *actionEditImportReplace;
    5.33  QAction *actionEditSaveBranch;
    5.34 @@ -85,6 +93,8 @@
    5.35  QAction *actionSettingsUseDelKey;
    5.36  
    5.37  QPopupMenu *branchContextMenu;
    5.38 +QPopupMenu *branchAddContextMenu;
    5.39 +QPopupMenu *branchRemoveContextMenu;
    5.40  QPopupMenu *branchLinksContextMenu;
    5.41  QPopupMenu *branchLinksContextMenuDup;
    5.42  QPopupMenu *floatimageContextMenu;
     6.1 --- a/mainwindow.cpp	Thu Apr 21 19:14:38 2005 +0000
     6.2 +++ b/mainwindow.cpp	Wed May 04 20:35:39 2005 +0000
     6.3 @@ -63,6 +63,8 @@
     6.4  extern MapEditor *clipboardME;
     6.5  extern FlagRowObj* standardFlagsDefault;
     6.6  
     6.7 +extern QPtrList <QAction> actionListBranches;
     6.8 +
     6.9  extern QAction* actionFileSave;
    6.10  extern QAction* actionFilePrint;
    6.11  extern QAction* actionEditUndo;
    6.12 @@ -83,8 +85,11 @@
    6.13  extern QAction *actionEditHeading;
    6.14  extern QAction *actionEditDelete;
    6.15  extern QAction *actionEditAddBranch;
    6.16 +extern QAction *actionEditAddBranchHere;
    6.17  extern QAction *actionEditAddBranchAbove;
    6.18  extern QAction *actionEditAddBranchBelow;
    6.19 +extern QAction *actionEditRemoveBranchHere;
    6.20 +extern QAction *actionEditRemoveChilds;
    6.21  extern QAction *actionEditImportAdd;
    6.22  extern QAction *actionEditImportReplace;
    6.23  extern QAction *actionEditSaveBranch;
    6.24 @@ -126,6 +131,8 @@
    6.25  extern QAction* actionSettingsUseDelKey;
    6.26  
    6.27  extern QPopupMenu* branchContextMenu;
    6.28 +extern QPopupMenu* branchAddContextMenu;
    6.29 +extern QPopupMenu* branchRemoveContextMenu;
    6.30  extern QPopupMenu* branchLinksContextMenu;
    6.31  extern QPopupMenu* branchLinksContextMenuDup;
    6.32  extern QPopupMenu* floatimageContextMenu;
    6.33 @@ -396,24 +403,30 @@
    6.34      a->addTo( tb );
    6.35      a->addTo( menu );
    6.36  	actionEditPaste=a;
    6.37 +
    6.38      a = new QAction( tr( "Move branch up" ), QPixmap( editmoveup_xpm ), tr( "Move up" ), Key_PageUp, this, "editMoveUp" );
    6.39      connect( a, SIGNAL( activated() ), this, SLOT( editMoveUp() ) );
    6.40  	a->setEnabled (false);
    6.41      a->addTo( tb );
    6.42      a->addTo( menu );
    6.43 +	actionListBranches.append(a);
    6.44  	actionEditMoveUp=a;
    6.45 +
    6.46      a = new QAction( tr( "Move branch down" ), QPixmap( editmovedown_xpm ), tr( "Move down" ), Key_PageDown, this, "editMoveDown" );
    6.47      connect( a, SIGNAL( activated() ), this, SLOT( editMoveDown() ) );
    6.48  	a->setEnabled (false);
    6.49      a->addTo( tb );
    6.50      a->addTo( menu );
    6.51 +	actionListBranches.append(a);
    6.52  	actionEditMoveDown=a;
    6.53 +	
    6.54  
    6.55      a = new QAction( tr( "Scroll branch" ), QPixmap(flag_scrolled_right_xpm), tr( "Scroll branch" ), Key_ScrollLock, this, "scroll" );
    6.56      connect( a, SIGNAL( activated() ), this, SLOT( editToggleScroll() ) );
    6.57  	a->setEnabled (false);
    6.58      a->addTo( tb );
    6.59      a->addTo( menu );
    6.60 +	actionListBranches.append(a);
    6.61  	actionEditToggleScroll=a;
    6.62  	
    6.63      a = new QAction( tr( "Unscroll all" ), QPixmap(), tr( "Unscroll all scrolled branches" ), 0, this, "scroll" );
    6.64 @@ -439,17 +452,20 @@
    6.65      connect( a, SIGNAL( activated() ), this, SLOT( editURL() ) );
    6.66      a->addTo( menu );
    6.67  	a->setEnabled (false);
    6.68 +	actionListBranches.append(a);
    6.69  	actionEditURL=a;
    6.70  	
    6.71  	a = new QAction( tr( "Use heading of selected branch as URL" ), QPixmap(), tr( "Use heading for URL" ), 0, this, "heading2url" );
    6.72      connect( a, SIGNAL( activated() ), this, SLOT( editHeading2URL() ) );
    6.73      a->addTo( menu );
    6.74  	a->setEnabled (false);
    6.75 +	actionListBranches.append(a);
    6.76  	actionEditHeading2URL=a;
    6.77      
    6.78  	a = new QAction( tr( "Create URL to Bugzilla" ), QPixmap(), tr( "Create URL to Bugzilla" ), 0, this, "bugzilla2url" );
    6.79      connect( a, SIGNAL( activated() ), this, SLOT( editBugzilla2URL() ) );
    6.80  	a->setEnabled (false);
    6.81 +	actionListBranches.append(a);
    6.82  	actionEditBugzilla2URL=a;
    6.83      
    6.84  	menu->insertSeparator();
    6.85 @@ -465,6 +481,7 @@
    6.86      connect( a, SIGNAL( activated() ), this, SLOT( editVymLink() ) );
    6.87      a->addTo( menu );
    6.88  	a->setEnabled (false);
    6.89 +	actionListBranches.append(a);
    6.90  	actionEditVymLink=a;
    6.91  
    6.92      a = new QAction( tr( "Delete link to another vym map" ), QPixmap(), tr( "Delete vym link" ), 0, this, "deleteLinkMap" );
    6.93 @@ -488,12 +505,15 @@
    6.94      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
    6.95  	a->setEnabled (false);
    6.96      a->addTo ( menu );
    6.97 +	actionListBranches.append(a);
    6.98  	actionEditHeading=a;
    6.99      a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_Return, this, "editHeading" );
   6.100      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   6.101 +	actionListBranches.append(a);
   6.102  	actionEditHeading=a;
   6.103      a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" );
   6.104      connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) );
   6.105 +	actionListBranches.append(a);
   6.106      
   6.107      // Shortcut to delete selection
   6.108      a = new QAction( tr( "Delete Selection" ),tr( "Delete Selection" ), Key_Delete, this, "deleteBranch" );
   6.109 @@ -510,44 +530,65 @@
   6.110  	#endif
   6.111      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranch() ) );
   6.112  	a->setEnabled (false);
   6.113 -    a->addTo ( menu );
   6.114 +	actionListBranches.append(a);
   6.115  	actionEditAddBranch=a;
   6.116  
   6.117 +    // Add branch by inserting it at selection
   6.118 +	a = new QAction( tr( "Add a branch by inserting and making selection its child" ),tr( "Add branch (insert)" ), ALT + Key_Insert, this, "newBranchHere" );
   6.119 +    connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchHere() ) );
   6.120 +	a->setEnabled (false);
   6.121 +	actionListBranches.append(a);
   6.122 +	actionEditAddBranchHere=a;
   6.123 +
   6.124  	// Add branch above
   6.125      a = new QAction( tr( "Add a branch above selection" ),tr( "Add branch above" ), SHIFT+Key_Insert, this, "newBranch" );
   6.126      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchAbove() ) );
   6.127  	a->setEnabled (false);
   6.128 -    a->addTo ( menu );
   6.129 +	actionListBranches.append(a);
   6.130  	actionEditAddBranchAbove=a;
   6.131  
   6.132  	// Add branch below 
   6.133      a = new QAction( tr( "Add a branch below selection" ),tr( "Add branch below" ), CTRL +Key_Insert, this, "newBranch" );
   6.134      connect( a, SIGNAL( activated() ), this, SLOT( editNewBranchBelow() ) );
   6.135  	a->setEnabled (false);
   6.136 -    a->addTo ( menu );
   6.137 +	actionListBranches.append(a);
   6.138  	actionEditAddBranchBelow=a;
   6.139  
   6.140  	// Import at selection (adding to selection)
   6.141      a = new QAction( tr( "Add map at selection" ),tr( "Import (add)" ), 0, this, "importAdd" );
   6.142      connect( a, SIGNAL( activated() ), this, SLOT( editImportAdd() ) );
   6.143  	a->setEnabled (false);
   6.144 -    a->addTo ( menu );
   6.145 +	actionListBranches.append(a);
   6.146  	actionEditImportAdd=a;
   6.147  
   6.148  	// Import at selection (replacing selection)
   6.149      a = new QAction( tr( "Replace selection with map" ),tr( "Import (replace)" ), 0, this, "importReplace" );
   6.150      connect( a, SIGNAL( activated() ), this, SLOT( editImportReplace() ) );
   6.151  	a->setEnabled (false);
   6.152 -    a->addTo ( menu );
   6.153 +	actionListBranches.append(a);
   6.154  	actionEditImportReplace=a;
   6.155  
   6.156  	// Save selection 
   6.157 -    a = new QAction( tr( "Save selction" ),tr( "Save selection" ), 0, this, "saveSelection" );
   6.158 +    a = new QAction( tr( "Save selection" ),tr( "Save selection" ), 0, this, "saveSelection" );
   6.159      connect( a, SIGNAL( activated() ), this, SLOT( editSaveBranch() ) );
   6.160  	a->setEnabled (false);
   6.161 -    a->addTo ( menu );
   6.162 +	actionListBranches.append(a);
   6.163  	actionEditSaveBranch=a;
   6.164  
   6.165 +	// Only remove branch, not its childs
   6.166 +    a = new QAction( tr( "Remove only branch and keep its childs" ),tr( "Remove only branch " ), ALT + Key_Delete, this, "removeBranchHere" );
   6.167 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveBranchHere() ) );
   6.168 +	a->setEnabled (false);
   6.169 +	actionListBranches.append(a);
   6.170 +	actionEditRemoveBranchHere=a;
   6.171 +
   6.172 +	// Only remove childs of a branch
   6.173 +    a = new QAction( tr( "Remove childs of branch" ),tr( "Remove childs" ), SHIFT + Key_Delete, this, "removeBranchChilds" );
   6.174 +    connect( a, SIGNAL( activated() ), this, SLOT( editRemoveChilds() ) );
   6.175 +	a->setEnabled (false);
   6.176 +	actionListBranches.append(a);
   6.177 +	actionEditRemoveChilds=a;
   6.178 +
   6.179      // Shortcuts for navigating with cursor:
   6.180      a = new QAction( tr( "Select upper branch" ),tr( "Select upper branch" ), Key_Up, this, "upperBranch" );
   6.181      connect( a, SIGNAL( activated() ), this, SLOT( editUpperBranch() ) );
   6.182 @@ -560,12 +601,14 @@
   6.183      a = new QAction( tr( "Select first branch" ),tr( "Select first branch" ), Key_Home, this, "firstBranch" );
   6.184  	a->setEnabled (false);
   6.185      a->addTo ( menu );
   6.186 +	actionListBranches.append(a);
   6.187  	actionEditSelectFirst=a;
   6.188      connect( a, SIGNAL( activated() ), this, SLOT( editFirstBranch() ) );
   6.189      a = new QAction( tr( "Select last branch" ),tr( "Select last branch" ), Key_End, this, "lastBranch" );
   6.190      connect( a, SIGNAL( activated() ), this, SLOT( editLastBranch() ) );
   6.191  	a->setEnabled (false);
   6.192      a->addTo ( menu );
   6.193 +	actionListBranches.append(a);
   6.194  	actionEditSelectLast=a;
   6.195  
   6.196      a = new QAction( tr( "Add Image" ),tr( "Add Image" ), 0, this, "loadImage" );
   6.197 @@ -593,18 +636,21 @@
   6.198  	a->setEnabled (false);
   6.199      a->addTo( tb );
   6.200      a->addTo( menu );
   6.201 +	actionListBranches.append(a);
   6.202  	actionFormatPickColor=a;
   6.203      a= new QAction( tr( "Color branch" ), QPixmap(formatcoloritem_xpm), tr( "Color &branch" ), CTRL + Key_I, this, "colorItem" );
   6.204      connect( a, SIGNAL( activated() ), this, SLOT( formatColorItem() ) );
   6.205  	a->setEnabled (false);
   6.206      a->addTo( tb );
   6.207      a->addTo( menu );
   6.208 +	actionListBranches.append(a);
   6.209  	actionFormatColorBranch=a;
   6.210      a= new QAction( tr( "Color Subtree" ), QPixmap(formatcolorbranch_xpm), tr( "Color sub&tree" ), CTRL + Key_T, this, "colorBranch" );
   6.211      connect( a, SIGNAL( activated() ), this, SLOT( formatColorBranch() ) );
   6.212  	a->setEnabled (false);
   6.213      a->addTo( menu );
   6.214      a->addTo( tb );
   6.215 +	actionListBranches.append(a);
   6.216  	actionFormatColorSubtree=a;
   6.217  
   6.218      menu->insertSeparator();
   6.219 @@ -822,29 +868,44 @@
   6.220  
   6.221  	// Context Menu for branch or mapcenter
   6.222  	branchContextMenu =new QPopupMenu (this);
   6.223 -	actionEditAddBranch->addTo ( branchContextMenu );
   6.224 -	actionEditAddBranchAbove->addTo ( branchContextMenu );
   6.225 -	actionEditAddBranchBelow->addTo ( branchContextMenu );
   6.226 +
   6.227 +		// Submenu "Add"
   6.228 +		branchAddContextMenu =new QPopupMenu (this);
   6.229 +		actionEditPaste->addTo ( branchAddContextMenu );
   6.230 +		actionEditAddBranch->addTo ( branchAddContextMenu );
   6.231 +		actionEditAddBranchHere->addTo ( branchAddContextMenu );
   6.232 +		actionEditAddBranchAbove->addTo ( branchAddContextMenu );
   6.233 +		actionEditAddBranchBelow->addTo ( branchAddContextMenu );
   6.234 +		branchAddContextMenu->insertSeparator();	
   6.235 +		actionEditLoadImage->addTo( branchAddContextMenu );
   6.236 +		branchAddContextMenu->insertSeparator();	
   6.237 +		actionEditImportAdd->addTo ( branchAddContextMenu );
   6.238 +		actionEditImportReplace->addTo ( branchAddContextMenu );
   6.239 +
   6.240 +		// Submenu "Remove"
   6.241 +		branchRemoveContextMenu =new QPopupMenu (this);
   6.242 +		actionEditCut->addTo ( branchRemoveContextMenu );
   6.243 +		actionEditDelete->addTo ( branchRemoveContextMenu );
   6.244 +		actionEditRemoveBranchHere->addTo( branchRemoveContextMenu );
   6.245 +		actionEditRemoveChilds->addTo( branchRemoveContextMenu );
   6.246 +		
   6.247 +	branchContextMenu->insertItem (tr("Add"),branchAddContextMenu);	
   6.248 +	branchContextMenu->insertItem (tr("Remove"),branchRemoveContextMenu);	
   6.249 +
   6.250  	actionEditSaveBranch->addTo( branchContextMenu );
   6.251 -	branchContextMenu->insertSeparator();	
   6.252 -	actionEditImportAdd->addTo ( branchContextMenu );
   6.253 -	actionEditImportReplace->addTo ( branchContextMenu );
   6.254 +
   6.255  	branchContextMenu->insertSeparator();	
   6.256  	actionEditOpenURL->addTo ( branchContextMenu );
   6.257  	actionEditURL->addTo ( branchContextMenu );
   6.258  	actionEditHeading2URL->addTo ( branchContextMenu );
   6.259      if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) 
   6.260  		actionEditBugzilla2URL->addTo( branchContextMenu );
   6.261 +		
   6.262  	branchContextMenu->insertSeparator();	
   6.263  	actionEditOpenVymLink->addTo ( branchContextMenu );
   6.264  	actionEditVymLink->addTo ( branchContextMenu );
   6.265  	actionEditDeleteVymLink->addTo ( branchContextMenu );
   6.266 -	branchContextMenu->insertSeparator();	
   6.267 -	actionEditLoadImage->addTo( branchContextMenu );
   6.268 -	branchContextMenu->insertSeparator();	
   6.269 -	//actionEditCopy->addTo( branchContextMenu );
   6.270 -	//actionEditCut->addTo( branchContextMenu );
   6.271 -	//actionEditPaste->addTo( branchContextMenu );
   6.272 +	
   6.273  	branchContextMenu->insertSeparator();	
   6.274  	actionGroupFormatFrameTypes->addTo( branchContextMenu );
   6.275  
   6.276 @@ -1906,6 +1967,12 @@
   6.277  		currentMapEditor()->addNewBranch(0);
   6.278  }
   6.279  
   6.280 +void Main::editNewBranchHere()
   6.281 +{
   6.282 +	if (currentMapEditor())
   6.283 +		currentMapEditor()->addNewBranchHere();
   6.284 +}
   6.285 +
   6.286  void Main::editNewBranchAbove()
   6.287  {
   6.288  	if (currentMapEditor())
   6.289 @@ -1933,6 +2000,18 @@
   6.290  	fileSaveAs (PartOfMap);
   6.291  }
   6.292  
   6.293 +void Main::editRemoveBranchHere()
   6.294 +{
   6.295 +	if (currentMapEditor())
   6.296 +		currentMapEditor()->removeBranchHere();
   6.297 +}
   6.298 +
   6.299 +void Main::editRemoveChilds()
   6.300 +{
   6.301 +	if (currentMapEditor())
   6.302 +		currentMapEditor()->removeChilds();
   6.303 +}
   6.304 +
   6.305  void Main::editDeleteSelection()
   6.306  {
   6.307  	if (currentMapEditor())
     7.1 --- a/mainwindow.h	Thu Apr 21 19:14:38 2005 +0000
     7.2 +++ b/mainwindow.h	Wed May 04 20:35:39 2005 +0000
     7.3 @@ -100,11 +100,14 @@
     7.4      void editUnScrollAll();
     7.5      void editHeading();
     7.6      void editNewBranch();
     7.7 +    void editNewBranchHere();
     7.8      void editNewBranchAbove();
     7.9      void editNewBranchBelow();
    7.10      void editImportAdd();
    7.11      void editImportReplace();
    7.12      void editSaveBranch();
    7.13 +    void editRemoveBranchHere();
    7.14 +    void editRemoveChilds();
    7.15      void editDeleteSelection();
    7.16      void editUpperBranch();
    7.17      void editLowerBranch();
     8.1 --- a/mapeditor.cpp	Thu Apr 21 19:14:38 2005 +0000
     8.2 +++ b/mapeditor.cpp	Wed May 04 20:35:39 2005 +0000
     8.3 @@ -61,6 +61,8 @@
     8.4  extern FlagRowObj *standardFlagsDefault;
     8.5  extern MapEditor *clipboardME;
     8.6  
     8.7 +extern QPtrList <QAction> actionListBranches;
     8.8 +
     8.9  extern QAction *actionFileSave;
    8.10  extern QAction *actionEditUndo;
    8.11  extern QAction *actionEditCopy;
    8.12 @@ -81,6 +83,8 @@
    8.13  extern QAction *actionEditAddBranch;
    8.14  extern QAction *actionEditAddBranchAbove;
    8.15  extern QAction *actionEditAddBranchBelow;
    8.16 +extern QAction *actionEditRemoveBranchHere;
    8.17 +extern QAction *actionEditRemoveChilds;
    8.18  extern QAction *actionEditImportAdd;
    8.19  extern QAction *actionEditImportReplace;
    8.20  extern QAction *actionEditSaveBranch;
    8.21 @@ -1343,7 +1347,6 @@
    8.22  	}				
    8.23  }
    8.24  
    8.25 -
    8.26  void MapEditor::addNewBranch(int pos)
    8.27  {
    8.28  	// Finish open lineEdits
    8.29 @@ -1410,6 +1413,57 @@
    8.30  	}	
    8.31  }
    8.32  
    8.33 +
    8.34 +void MapEditor::addNewBranchHere()
    8.35 +{
    8.36 +	// Finish open lineEdits
    8.37 +	if (lineedit) finishedLineEditNoSave();
    8.38 +
    8.39 +	if (selection  &&  
    8.40 +		 (typeid(*selection) == typeid(BranchObj) ) )
    8.41 +	{
    8.42 +		setChanged();
    8.43 +		saveState(PartOfMap,selection);
    8.44 +
    8.45 +		BranchObj* bo1 = (BranchObj*) (selection);
    8.46 +		bool wasScrolled=false;
    8.47 +		BranchObj *newbo=NULL;
    8.48 +		BranchObj *parbo=(BranchObj*)(selection->getParObj());
    8.49 +		if (parbo)
    8.50 +		{
    8.51 +			// add below selection
    8.52 +			newbo=parbo->insertBranch(bo1->getNum()+1);
    8.53 +		} 
    8.54 +
    8.55 +		LinkableMapObj *oldselection=selection;
    8.56 +		((BranchObj*)(selection))->moveBranchTo (newbo,-1);
    8.57 +
    8.58 +		mapCenter->reposition();
    8.59 +		adjustCanvasSize();
    8.60 +		if (actionSettingsAutoedit->isOn() ||
    8.61 +			actionSettingsAutoselectHeading->isOn() )
    8.62 +		{
    8.63 +			selection->unselect();
    8.64 +			selection=newbo;
    8.65 +			selection->select();
    8.66 +			if (actionSettingsPasteNewHeading->isOn() )
    8.67 +			{
    8.68 +				BranchObj *bo2= (BranchObj*)(selection);
    8.69 +				bo2->setHeading("");
    8.70 +			}	
    8.71 +			if (actionSettingsAutoedit->isOn() )
    8.72 +				editHeading();
    8.73 +			if (!actionSettingsAutoselectHeading->isOn()
    8.74 +				&& !wasScrolled)
    8.75 +			{
    8.76 +				selection->unselect();
    8.77 +				selection=oldselection;
    8.78 +				selection->select();
    8.79 +			}
    8.80 +		}	
    8.81 +	}	
    8.82 +}
    8.83 +
    8.84  void MapEditor::deleteSelection()
    8.85  {
    8.86  	// Finish open lineEdits
    8.87 @@ -1459,7 +1513,7 @@
    8.88  	// Finally select the found object
    8.89  	if (lmo)
    8.90  	{
    8.91 -		if (selection) selection->unselect();
    8.92 +		if (selection) unselect();
    8.93  		selection=lmo;
    8.94  		selection->select();
    8.95  		adjustCanvasSize();
    8.96 @@ -2127,6 +2181,33 @@
    8.97  	
    8.98  }
    8.99  
   8.100 +void MapEditor::removeBranchHere()
   8.101 +{
   8.102 +	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   8.103 +	{		
   8.104 +		setChanged();
   8.105 +		saveState(PartOfMap,selection->getParObj());
   8.106 +		QString sel=selection->getSelectString();
   8.107 +		BranchObj* bo=(BranchObj*)(selection);
   8.108 +		BranchObj* par=(BranchObj*)(bo->getParObj());
   8.109 +		unselect();
   8.110 +		par->removeBranchHere(bo);
   8.111 +		mapCenter->reposition();
   8.112 +		select (sel);
   8.113 +	}	
   8.114 +}
   8.115 +
   8.116 +void MapEditor::removeChilds()
   8.117 +{
   8.118 +	if (selection && (typeid(*selection) == typeid(BranchObj) ))
   8.119 +	{		
   8.120 +		setChanged();
   8.121 +		saveState(PartOfMap,selection->getParObj());
   8.122 +		((BranchObj*)(selection))->removeChilds();
   8.123 +		mapCenter->reposition();
   8.124 +	}	
   8.125 +}
   8.126 +
   8.127  void MapEditor::editMapInfo()
   8.128  {
   8.129  	ExtraInfoDialog dia;
   8.130 @@ -2170,6 +2251,7 @@
   8.131  
   8.132  void MapEditor::updateActions()
   8.133  {
   8.134 +	QAction *a;
   8.135  	if (getLinkColorHint()==HeadingColor) 
   8.136  		actionFormatLinkColorHint->setOn(true);
   8.137  	else	
   8.138 @@ -2242,9 +2324,6 @@
   8.139  				actionEditOpenURL->setEnabled (false);
   8.140  			else	
   8.141  				actionEditOpenURL->setEnabled (true);
   8.142 -			actionEditURL->setEnabled (true);	
   8.143 -			actionEditHeading2URL->setEnabled (true);	
   8.144 -			actionEditBugzilla2URL->setEnabled (true);	
   8.145  
   8.146  			if ( bo->getVymLink().isEmpty() )
   8.147  			{
   8.148 @@ -2255,28 +2334,14 @@
   8.149  				actionEditOpenVymLink->setEnabled (true);
   8.150  				actionEditDeleteVymLink->setEnabled (true);
   8.151  			}	
   8.152 -			actionEditVymLink->setEnabled (true);	
   8.153  
   8.154  			actionEditCopy->setEnabled (true);	
   8.155  			actionEditCut->setEnabled (true);	
   8.156  			actionEditPaste->setEnabled (true);	
   8.157 -			actionEditMoveUp->setEnabled (true);	
   8.158 -			actionEditMoveDown->setEnabled (true);	
   8.159 -			actionEditToggleScroll->setEnabled (true);	
   8.160 -			actionEditHeading->setEnabled (true);
   8.161 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
   8.162 +				a->setEnabled(true);
   8.163  			actionEditDelete->setEnabled (true);
   8.164 -			actionEditAddBranch->setEnabled (true);
   8.165 -			actionEditAddBranchAbove->setEnabled (true);
   8.166 -			actionEditAddBranchBelow->setEnabled (true);
   8.167 -			actionEditImportAdd->setEnabled (true);
   8.168 -			actionEditImportReplace->setEnabled (true);
   8.169 -			actionEditSaveBranch->setEnabled (true);
   8.170 -			actionEditSelectFirst->setEnabled (true);
   8.171 -			actionEditSelectLast->setEnabled (true);
   8.172  			actionEditToggleFloatExport->setEnabled (false);
   8.173 -			actionFormatPickColor->setEnabled (true);
   8.174 -			actionFormatColorBranch->setEnabled (true);
   8.175 -			actionFormatColorSubtree->setEnabled (true);
   8.176  			switch (selection->getFrameType())
   8.177  			{
   8.178  				case NoFrame: 
   8.179 @@ -2294,34 +2359,17 @@
   8.180  			standardFlagsDefault->setEnabled (false);
   8.181  
   8.182  			actionEditOpenURL->setEnabled (false);
   8.183 -			actionEditURL->setEnabled (false);	
   8.184 -			actionEditHeading2URL->setEnabled (false);	
   8.185 -			actionEditBugzilla2URL->setEnabled (false);	
   8.186  			actionEditOpenVymLink->setEnabled (false);
   8.187 -			actionEditVymLink->setEnabled (false);	
   8.188  			actionEditDeleteVymLink->setEnabled (false);	
   8.189  
   8.190  			actionEditCopy->setEnabled (true);
   8.191  			actionEditCut->setEnabled (true);	
   8.192  			actionEditPaste->setEnabled (false);	//FIXME
   8.193 -			actionEditMoveUp->setEnabled (false);	
   8.194 -			actionEditMoveDown->setEnabled (false);	
   8.195 -			actionEditToggleScroll->setEnabled (false);	
   8.196 -			actionEditHeading->setEnabled (false);
   8.197 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
   8.198 +				a->setEnabled(false);
   8.199  			actionEditDelete->setEnabled (true);
   8.200 -			actionEditAddBranch->setEnabled (false);
   8.201 -			actionEditAddBranchAbove->setEnabled (false);
   8.202 -			actionEditAddBranchBelow->setEnabled (false);
   8.203 -			actionEditImportAdd->setEnabled (false);
   8.204 -			actionEditSaveBranch->setEnabled (false);
   8.205 -			actionEditImportReplace->setEnabled (false);
   8.206 -			actionEditSelectFirst->setEnabled (false);
   8.207 -			actionEditSelectLast->setEnabled (false);
   8.208  			actionEditToggleFloatExport->setOn
   8.209  				( ((FloatImageObj*)(selection))->getFloatExport() );
   8.210 -			actionFormatPickColor->setEnabled (false);
   8.211 -			actionFormatColorBranch->setEnabled (false);
   8.212 -			actionFormatColorSubtree->setEnabled (false);
   8.213  		}
   8.214  
   8.215  	} else
   8.216 @@ -2331,29 +2379,15 @@
   8.217  		actionEditCopy->setEnabled (false);	
   8.218  		actionEditCut->setEnabled (false);	
   8.219  		actionEditPaste->setEnabled (false);	
   8.220 -		actionEditMoveUp->setEnabled (false);	
   8.221 -		actionEditMoveDown->setEnabled (false);	
   8.222 -		actionEditToggleScroll->setEnabled (false);	
   8.223 +		for (a=actionListBranches.first();a;a=actionListBranches.next())
   8.224 +			a->setEnabled(false);
   8.225 +
   8.226  		actionEditOpenURL->setEnabled (false);
   8.227 -		actionEditURL->setEnabled (false);	
   8.228  		actionEditOpenVymLink->setEnabled (false);
   8.229 -		actionEditVymLink->setEnabled (false);	
   8.230  		actionEditDeleteVymLink->setEnabled (false);	
   8.231  		actionEditHeading2URL->setEnabled (false);	
   8.232 -		actionEditBugzilla2URL->setEnabled (false);	
   8.233 -		actionEditHeading->setEnabled (false);
   8.234  		actionEditDelete->setEnabled (false);
   8.235 -		actionEditAddBranch->setEnabled (false);
   8.236 -		actionEditAddBranchAbove->setEnabled (false);
   8.237 -		actionEditAddBranchBelow->setEnabled (false);
   8.238 -		actionEditSaveBranch->setEnabled (false);
   8.239 -		actionEditImportReplace->setEnabled (false);
   8.240 -		actionEditSelectFirst->setEnabled (false);
   8.241 -		actionEditSelectLast->setEnabled (false);
   8.242  		actionEditToggleFloatExport->setEnabled (false);
   8.243 -		actionFormatPickColor->setEnabled (false);
   8.244 -		actionFormatColorBranch->setEnabled (false);
   8.245 -		actionFormatColorSubtree->setEnabled (false);
   8.246  	}	
   8.247  }
   8.248  
   8.249 @@ -2716,20 +2750,20 @@
   8.250  void MapEditor::testFunction()
   8.251  {
   8.252  	cout << "MapEditor::testFunction() called\n";
   8.253 -	//cout <<((BranchObj*)(selection))->getSelectString()<<endl;
   8.254 -	QString tmpdir,prefix;
   8.255 -	cout << saveToDir(tmpdir,prefix,true,QPoint(0,0),CompleteMap)<<endl;
   8.256  }
   8.257  
   8.258  void MapEditor::ensureSelectionVisible()
   8.259  {
   8.260 -	LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
   8.261 -	QPoint p;
   8.262 -	if (selection->getOrientation() == OrientLeftOfCenter)
   8.263 -		p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
   8.264 -	else	
   8.265 -		p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
   8.266 -	ensureVisible (p.x(), p.y() );
   8.267 +	if (selection)
   8.268 +	{
   8.269 +		LinkableMapObj* lmo= dynamic_cast <LinkableMapObj*> (selection);
   8.270 +		QPoint p;
   8.271 +		if (selection->getOrientation() == OrientLeftOfCenter)
   8.272 +			p= worldMatrix().map(QPoint (lmo->x(),lmo->y()));
   8.273 +		else	
   8.274 +			p= worldMatrix().map(QPoint (lmo->x()+lmo->width(),lmo->y()+lmo->height()));
   8.275 +		ensureVisible (p.x(), p.y() );
   8.276 +	}
   8.277  
   8.278  }
   8.279  
     9.1 --- a/mapeditor.h	Thu Apr 21 19:14:38 2005 +0000
     9.2 +++ b/mapeditor.h	Wed May 04 20:35:39 2005 +0000
     9.3 @@ -74,6 +74,7 @@
     9.4      void moveBranchDown();
     9.5      void editHeading();
     9.6      void addNewBranch(int);			// pos allows to add above/below selection
     9.7 +    void addNewBranchHere();		// insert and make selection its
     9.8      void deleteSelection();
     9.9  	LinkableMapObj* getSelection();	// returns selection
    9.10  	bool select(const QString &);	// Select 
    9.11 @@ -106,6 +107,8 @@
    9.12  	void editVymLink();						// edit link to another map
    9.13  	void deleteVymLink();					// delete link to another map
    9.14  	QString getVymLink();					// return path to map
    9.15 +	void removeBranchHere();				// remove but keep childs
    9.16 +	void removeChilds();					// remove childs
    9.17  	void editMapInfo();						// dialog to enter author, ...
    9.18  	void updateActions();					// update e.g. format buttons
    9.19  	void setLinkStyle (LinkStyle);			// Set style of link
    10.1 --- a/tex/vym.tex	Thu Apr 21 19:14:38 2005 +0000
    10.2 +++ b/tex/vym.tex	Wed May 04 20:35:39 2005 +0000
    10.3 @@ -713,6 +713,11 @@
    10.4  \begin{longtable}{|lcp{8cm}l|} \hline
    10.5  Version	&	&	Comment								& Date	\\ \hline \hline \endhead
    10.6  	\hline \endfoot
    10.7 +1.6.5	& -	&	removing a branch and keeping its childs	& 2005-05-03 \\
    10.8 +        & -	&	removing childs of a branch			& \\
    10.9 +        & -	&	insert branch and make selection its child& \\
   10.10 +        & -	&	restructured branch context menu	& \\
   10.11 +				in a basic version (straight line)	& 2005-04-15\\
   10.12  1.6.4	& -	&	xLinks (arbitrary connection between 2 branches) works
   10.13  				in a basic version (straight line)	& 2005-04-15\\
   10.14  1.6.3	& -	&	Bugfix: Saving of selection to a vym part (.vyp)	&2005-03-30\\
    11.1 --- a/version.h	Thu Apr 21 19:14:38 2005 +0000
    11.2 +++ b/version.h	Wed May 04 20:35:39 2005 +0000
    11.3 @@ -1,7 +1,7 @@
    11.4  #ifndef VERSION_H 
    11.5  #define VERSION_H
    11.6  
    11.7 -#define __VYM_VERSION__ "1.6.4"
    11.8 -#define __BUILD_DATE__ "April 21, 2005"
    11.9 +#define __VYM_VERSION__ "1.6.5"
   11.10 +#define __BUILD_DATE__ "May 4, 2005"
   11.11  
   11.12  #endif