Added a few more undo commands in mapeditor
authorinsilmaril
Mon, 01 Aug 2005 19:32:45 +0000
changeset 14356c57552f1d2
parent 142 3590c3490789
child 144 f4bbdc809fec
Added a few more undo commands in mapeditor
mainwindow.cpp
mapeditor.cpp
mapeditor.h
tex/vym.tex
version.h
     1.1 --- a/mainwindow.cpp	Sun Jul 31 12:24:53 2005 +0000
     1.2 +++ b/mainwindow.cpp	Mon Aug 01 19:32:45 2005 +0000
     1.3 @@ -967,9 +967,7 @@
     1.4  
     1.5      a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" );
     1.6      connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) );
     1.7 -	// FIXME Usually deactivated, still experimental
     1.8 -    if (settings.readBoolEntry( "/vym/mainwindow/showTestMenu",false)) ;
     1.9 -		a->addTo( exportMenu );
    1.10 +	a->addTo( exportMenu );
    1.11  
    1.12  	a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ),  0, this, "exportXML" );
    1.13      connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) );
     2.1 --- a/mapeditor.cpp	Sun Jul 31 12:24:53 2005 +0000
     2.2 +++ b/mapeditor.cpp	Mon Aug 01 19:32:45 2005 +0000
     2.3 @@ -706,7 +706,22 @@
     2.4  			s=api.parString (ok,0);
     2.5  			if (ok) setHeading (s);
     2.6  		}	
     2.7 -	}	
     2.8 +	} else if (com=="setURL")
     2.9 +	{
    2.10 +		if (api.checkParamCount(1))
    2.11 +		{
    2.12 +			s=api.parString (ok,0);
    2.13 +			if (ok) setURL(s);
    2.14 +		}	
    2.15 +	} else if (com=="setVymLink")
    2.16 +	{
    2.17 +		if (api.checkParamCount(1))
    2.18 +		{
    2.19 +			s=api.parString (ok,0);
    2.20 +			if (ok) setVymLink(s);
    2.21 +		}	
    2.22 +	}
    2.23 +
    2.24  	// Internal commands, used for undo etc.	
    2.25  	else if (com==QString("undoMap"))
    2.26  	{
    2.27 @@ -1548,6 +1563,34 @@
    2.28  	}
    2.29  }
    2.30  
    2.31 +void MapEditor::setURL (const QString &s)
    2.32 +{
    2.33 +	// Internal function, no saveState needed
    2.34 +	if (selection  &&  
    2.35 +		 (typeid(*selection) == typeid(BranchObj) || 
    2.36 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
    2.37 +	{
    2.38 +		((BranchObj*)(selection))->setURL(s);
    2.39 +		mapCenter->reposition();
    2.40 +		adjustCanvasSize();
    2.41 +		ensureSelectionVisible();
    2.42 +	}
    2.43 +}
    2.44 +
    2.45 +void MapEditor::setVymLink (const QString &s)
    2.46 +{
    2.47 +	// Internal function, no saveState needed
    2.48 +	if (selection  &&  
    2.49 +		 (typeid(*selection) == typeid(BranchObj) || 
    2.50 +		  typeid(*selection) == typeid(MapCenterObj) ) ) 
    2.51 +	{
    2.52 +		((BranchObj*)(selection))->setVymLink(s);
    2.53 +		mapCenter->reposition();
    2.54 +		adjustCanvasSize();
    2.55 +		ensureSelectionVisible();
    2.56 +	}
    2.57 +}
    2.58 +
    2.59  void MapEditor::addNewBranch(int pos)
    2.60  {
    2.61  	// Finish open lineEdits
    2.62 @@ -1557,7 +1600,7 @@
    2.63  		 (typeid(*selection) == typeid(BranchObj) || 
    2.64  		  typeid(*selection) == typeid(MapCenterObj) ) ) 
    2.65  	{
    2.66 -		saveState(selection);
    2.67 +		saveState(selection);	//FIXME undoCommand
    2.68  
    2.69  		BranchObj* bo1 = (BranchObj*) (selection);
    2.70  		bool wasScrolled=false;
    2.71 @@ -2161,7 +2204,7 @@
    2.72  		if (typeid(*selection) == typeid(BranchObj) ||
    2.73  			typeid(*selection) == typeid(MapCenterObj))
    2.74  		{
    2.75 -			saveState(selection);
    2.76 +			saveState(selection);	//FIXME undoCommand
    2.77  			BranchObj *bo=(BranchObj*)(selection);
    2.78  			bo->setColor(actColor, false); // color links, color childs
    2.79  		}    
    2.80 @@ -2187,7 +2230,7 @@
    2.81  {
    2.82  	if (selection)
    2.83  	{
    2.84 -		saveState(selection);	
    2.85 +		saveState(selection);// FIXME undoCommand	
    2.86  		((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups);
    2.87  	}	
    2.88  }
    2.89 @@ -2297,15 +2340,16 @@
    2.90  			typeid(*selection) == typeid(MapCenterObj)) )
    2.91  	{		
    2.92  		bool ok;
    2.93 +		BranchObj *bo=(BranchObj*)(selection);
    2.94  		QString text = QInputDialog::getText(
    2.95  				"VYM", tr("Enter URL:"), QLineEdit::Normal,
    2.96 -				((BranchObj*)(selection))->getURL(), &ok, this );
    2.97 +				bo->getURL(), &ok, this );
    2.98  		if ( ok) 
    2.99  		{
   2.100  			// user entered something and pressed OK
   2.101 -			((BranchObj*)(selection))->setURL (text);
   2.102 +			saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+text+"\")");	
   2.103 +			bo->setURL (text);
   2.104  			updateActions();
   2.105 -			saveState();	//FIXME undoCommand
   2.106  		}	
   2.107  	}
   2.108  }
   2.109 @@ -2315,10 +2359,10 @@
   2.110  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   2.111  			typeid(*selection) == typeid(MapCenterObj)) )
   2.112  	{		
   2.113 -		BranchObj *b=(BranchObj*)(selection);
   2.114 -		b->setURL (b->getHeading());
   2.115 +		BranchObj *bo=(BranchObj*)(selection);
   2.116 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+bo->getHeading()+"\")");	
   2.117 +		bo->setURL (bo->getHeading());
   2.118  		updateActions();
   2.119 -		saveState();	//FIXME undoCommand
   2.120  	}
   2.121  }	
   2.122  
   2.123 @@ -2327,10 +2371,11 @@
   2.124  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   2.125  			typeid(*selection) == typeid(MapCenterObj)) )
   2.126  	{		
   2.127 -		BranchObj *b=(BranchObj*)(selection);
   2.128 -		b->setURL ("https://bugzilla.novell.com/show_bug.cgi?id="+b->getHeading());
   2.129 +		BranchObj *bo=(BranchObj*)(selection);
   2.130 +		QString url= "https://bugzilla.novell.com/show_bug.cgi?id="+bo->getHeading();
   2.131 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")");	
   2.132 +		bo->setURL (url);
   2.133  		updateActions();
   2.134 -		saveState();	//FIXME undoCommand
   2.135  	}
   2.136  }	
   2.137  
   2.138 @@ -2339,21 +2384,24 @@
   2.139  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   2.140  			typeid(*selection) == typeid(MapCenterObj)) )
   2.141  	{		
   2.142 +		BranchObj *bo=(BranchObj*)(selection);
   2.143  		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
   2.144  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
   2.145  		fd->setCaption(tr("VYM - Link to another map"));
   2.146 -		if (! ((BranchObj*)(selection))->getVymLink().isEmpty() )
   2.147 -			fd->setSelection( ((BranchObj*)(selection))->getVymLink() );
   2.148 +		if (! bo->getVymLink().isEmpty() )
   2.149 +			fd->setSelection( bo->getVymLink() );
   2.150  		fd->show();
   2.151  
   2.152  		QString fn;
   2.153  		if ( fd->exec() == QDialog::Accepted )
   2.154 -			((BranchObj*)(selection))->setVymLink (fd->selectedFile() );
   2.155 -		updateActions();
   2.156 -		mapCenter->reposition();
   2.157 -		adjustCanvasSize();
   2.158 -		canvas()->update();
   2.159 -		saveState();	//FIXME undoCommand
   2.160 +		{
   2.161 +			saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\""+fd->selectedFile()+"\")");	
   2.162 +			bo->setVymLink (fd->selectedFile() );
   2.163 +			updateActions();
   2.164 +			mapCenter->reposition();
   2.165 +			adjustCanvasSize();
   2.166 +			canvas()->update();
   2.167 +		}
   2.168  	}
   2.169  }
   2.170  
   2.171 @@ -2362,12 +2410,13 @@
   2.172  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   2.173  			typeid(*selection) == typeid(MapCenterObj)) )
   2.174  	{		
   2.175 -		((BranchObj*)(selection))->setVymLink ("" );
   2.176 +		BranchObj *bo=(BranchObj*)(selection);
   2.177 +		saveState("setVymLink (\""+bo->getVymLink()+"\")","setVymLink (\"\")");	
   2.178 +		bo->setVymLink ("" );
   2.179  		updateActions();
   2.180  		mapCenter->reposition();
   2.181  		adjustCanvasSize();
   2.182  		canvas()->update();
   2.183 -		saveState();	//FIXME undoCommand
   2.184  	}
   2.185  }
   2.186  
     3.1 --- a/mapeditor.h	Sun Jul 31 12:24:53 2005 +0000
     3.2 +++ b/mapeditor.h	Mon Aug 01 19:32:45 2005 +0000
     3.3 @@ -88,6 +88,8 @@
     3.4      void editHeading();					// Start editing heading 
     3.5  private:
     3.6  	void setHeading(const QString &);	// Just set the heading for selection
     3.7 +	void setURL(const QString &);		// Just set the URL for selection
     3.8 +	void setVymLink(const QString &);	// Set vymLink for selection
     3.9  public:	
    3.10      void addNewBranch(int);			// pos allows to add above/below selection
    3.11      void addNewBranchHere();		// insert and make selection its
     4.1 --- a/tex/vym.tex	Sun Jul 31 12:24:53 2005 +0000
     4.2 +++ b/tex/vym.tex	Mon Aug 01 19:32:45 2005 +0000
     4.3 @@ -725,7 +725,7 @@
     4.4  	zip -r vymfile.vym .
     4.5  \end{verbatim}
     4.6  
     4.7 -\subsubsection*{Importa part of a map}
     4.8 +\subsubsection*{Importing a part of a map}
     4.9  Select a branch where you want to add a previously save part of a map
    4.10  ({\tt .vyp}), then open
    4.11  the context menu and choose {\em Add \ra Import}. For the import you can
     5.1 --- a/version.h	Sun Jul 31 12:24:53 2005 +0000
     5.2 +++ b/version.h	Mon Aug 01 19:32:45 2005 +0000
     5.3 @@ -2,6 +2,6 @@
     5.4  #define VERSION_H
     5.5  
     5.6  #define __VYM_VERSION__ "1.7.3"
     5.7 -#define __BUILD_DATE__ "July 28, 2005"
     5.8 +#define __BUILD_DATE__ "August 1, 2005"
     5.9  
    5.10  #endif