mapeditor.cpp
changeset 175 728f51b71e71
parent 166 325958acb69b
child 185 6691000c3262
     1.1 --- a/mapeditor.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.2 +++ b/mapeditor.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.3 @@ -27,15 +27,15 @@
     1.4  #include "version.h"
     1.5  
     1.6  #include "api.h"
     1.7 +#include "editxlinkdialog.h"
     1.8 +#include "exports.h"
     1.9 +#include "extrainfodialog.h"
    1.10 +#include "linkablemapobj.h"
    1.11 +#include "mainwindow.h"
    1.12 +#include "misc.h"
    1.13 +#include "settings.h"
    1.14 +#include "texteditor.h"
    1.15  #include "xml.h"
    1.16 -#include "texteditor.h"
    1.17 -#include "linkablemapobj.h"
    1.18 -#include "exports.h"
    1.19 -#include "misc.h"
    1.20 -#include "mainwindow.h"
    1.21 -#include "extrainfodialog.h"
    1.22 -#include "editxlinkdialog.h"
    1.23 -#include "settings.h"
    1.24  
    1.25  
    1.26  extern TextEditor *textEditor;
    1.27 @@ -61,6 +61,7 @@
    1.28  extern QAction *actionEditURL;
    1.29  extern QAction *actionEditHeading2URL;
    1.30  extern QAction *actionEditBugzilla2URL;
    1.31 +extern QAction *actionEditFATE2URL;
    1.32  extern QAction *actionEditOpenVymLink;
    1.33  extern QAction *actionEditVymLink;
    1.34  extern QAction *actionEditDeleteVymLink;
    1.35 @@ -96,6 +97,8 @@
    1.36  extern QAction *actionFormatFrameRectangle;
    1.37  
    1.38  extern QActionGroup *actionGroupFormatLinkStyles;
    1.39 +extern QAction *actionFormatIncludeImagesVer;
    1.40 +extern QAction *actionFormatIncludeImagesHor;
    1.41  extern QAction *actionFormatHideLinkUnselected;
    1.42  extern QAction *actionFormatLinkStyleLine;
    1.43  extern QAction *actionFormatLinkStyleParabel;
    1.44 @@ -147,7 +150,7 @@
    1.45      mapCenter->setVisibility (true);
    1.46  	mapCenter->setMapEditor (this);
    1.47  	mapCenter->setHeading (tr("New Map","Heading of mapcenter in new map"));
    1.48 -	mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->width()/2);
    1.49 +	mapCenter->move(mapCanvas->width()/2-mapCenter->width()/2,mapCanvas->height()/2-mapCenter->height()/2);
    1.50  
    1.51      printer=NULL;
    1.52  
    1.53 @@ -312,7 +315,6 @@
    1.54  		mapCanvas->resize (cw,ch);
    1.55  		if ( (dx!=0) || (dy!=0) ) 
    1.56  		{
    1.57 -			cout << "ME:: canvas="<<cw<<","<<ch<<endl;
    1.58  			mapCenter->moveAllBy(dx,dy);
    1.59  			mapCenter->reposition();
    1.60  
    1.61 @@ -1060,7 +1062,7 @@
    1.62  void MapEditor::exportASCII()
    1.63  {
    1.64  	// TODO still experimental
    1.65 -	Export ex;
    1.66 +	ExportBase ex;
    1.67  	ex.setMapCenter(mapCenter);
    1.68  
    1.69  	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
    1.70 @@ -1082,7 +1084,7 @@
    1.71  
    1.72  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
    1.73  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
    1.74 -			Export ex;
    1.75 +			ExportBase ex;
    1.76  			switch( mb.exec() ) 
    1.77  			{
    1.78  				case QMessageBox::Yes:
    1.79 @@ -1095,7 +1097,7 @@
    1.80  			}
    1.81  		}
    1.82  		ex.setPath (fd->selectedFile() );
    1.83 -		ex.exportMap();
    1.84 +		ex.exportXML();
    1.85  	}
    1.86  }
    1.87  
    1.88 @@ -1122,7 +1124,7 @@
    1.89  
    1.90  			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
    1.91  			mb.setButtonText( QMessageBox::No, tr("Cancel"));
    1.92 -			Export ex;
    1.93 +			ExportLaTeX ex;
    1.94  			switch( mb.exec() ) 
    1.95  			{
    1.96  				case QMessageBox::Yes:
    1.97 @@ -1134,7 +1136,7 @@
    1.98  					break;
    1.99  			}
   1.100  		}
   1.101 -		Export ex;
   1.102 +		ExportLaTeX ex;
   1.103  		ex.setPath (fd->selectedFile() );
   1.104  		ex.setMapCenter(mapCenter);
   1.105  		ex.exportLaTeX();
   1.106 @@ -1178,10 +1180,10 @@
   1.107  			}
   1.108  		}
   1.109  		*/
   1.110 -		Export ex;
   1.111 +		ExportOO ex;
   1.112  		//ex.setPath (fd->selectedFile() );
   1.113  		ex.setMapCenter(mapCenter);
   1.114 -		ex.exportOOPresentation();
   1.115 +		ex.exportPresentation();
   1.116  //	}
   1.117  }
   1.118  
   1.119 @@ -2357,6 +2359,19 @@
   1.120  	}
   1.121  }	
   1.122  
   1.123 +void MapEditor::editFATE2URL()
   1.124 +{
   1.125 +	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   1.126 +			typeid(*selection) == typeid(MapCenterObj)) )
   1.127 +	{		
   1.128 +		BranchObj *bo=(BranchObj*)selection;
   1.129 +		QString url= "http://keeper.suse.de:8080/webfate/match/id?value=ID"+bo->getHeading();
   1.130 +		saveState("setURL (\""+bo->getURL()+"\")","setURL (\""+url+"\")");	
   1.131 +		bo->setURL (url);
   1.132 +		updateActions();
   1.133 +	}
   1.134 +}	
   1.135 +
   1.136  void MapEditor::editVymLink()
   1.137  {
   1.138  	if (selection && (typeid(*selection) == typeid(BranchObj) ||
   1.139 @@ -2588,8 +2603,12 @@
   1.140  				default:
   1.141  					break;
   1.142  			}	
   1.143 +			actionFormatIncludeImagesVer->setOn
   1.144 +				( ((BranchObj*)selection)->getIncludeImagesVer());
   1.145 +			actionFormatIncludeImagesHor->setOn
   1.146 +				( ((BranchObj*)selection)->getIncludeImagesHor());
   1.147  			actionFormatHideLinkUnselected->setOn
   1.148 -				( selection->getHideLinkUnselected());
   1.149 +				(selection->getHideLinkUnselected());
   1.150  		}
   1.151  		if ( (typeid(*selection) == typeid(FloatImageObj)) )
   1.152  		{
   1.153 @@ -2876,6 +2895,24 @@
   1.154  	}
   1.155  }
   1.156  
   1.157 +void MapEditor::setIncludeImagesVer(bool b)
   1.158 +{
   1.159 +	if (selection && 
   1.160 +		(typeid(*selection) == typeid(BranchObj)) || 
   1.161 +		(typeid(*selection) == typeid(MapCenterObj))  )
   1.162 +		((BranchObj*)selection)->setIncludeImagesVer(b);
   1.163 +		mapCenter->reposition();
   1.164 +}
   1.165 +
   1.166 +void MapEditor::setIncludeImagesHor(bool b)
   1.167 +{
   1.168 +	if (selection && 
   1.169 +		(typeid(*selection) == typeid(BranchObj)) || 
   1.170 +		(typeid(*selection) == typeid(MapCenterObj))  )
   1.171 +		((BranchObj*)selection)->setIncludeImagesHor(b);
   1.172 +		mapCenter->reposition();
   1.173 +}
   1.174 +
   1.175  void MapEditor::setHideLinkUnselected (bool b)
   1.176  {
   1.177  	if (selection && 
   1.178 @@ -3009,7 +3046,7 @@
   1.179  void MapEditor::testFunction()
   1.180  {
   1.181  	cout << "MapEditor::testFunction() called\n";
   1.182 -	load (clipboardDir+"/part.xml",ImportAdd);
   1.183 +	mapCenter->move(mapCenter->x(),mapCenter->y());
   1.184  }
   1.185  
   1.186  void MapEditor::ensureSelectionVisible()
   1.187 @@ -3234,11 +3271,6 @@
   1.188  		{
   1.189  			FloatObj *fo=(FloatObj*)selection;
   1.190  			saveState("move "+qpointToString(movingObj_orgPos),fo->getSelectString() );
   1.191 -			if (fo->getLinkStyle()==StyleUndef) 
   1.192 -			{
   1.193 -				fo->setLinkStyle(fo->getDefLinkStyle());
   1.194 -				fo->setLinkColor(fo->getParObj()->getLinkColor());
   1.195 -			}	
   1.196  			fo->move   (p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );		
   1.197  			fo->setRelPos();
   1.198  			fo->reposition();
   1.199 @@ -3264,11 +3296,7 @@
   1.200  					selection=(LinkableMapObj*)(fio);
   1.201  					selection->select();
   1.202  					movingObj=(MapObj*)(fio);
   1.203 -					// setLinkStyle calls updateLink, only set it once
   1.204 -					if (fio->getLinkStyle()!=fio->getDefLinkStyle() ) 
   1.205 -						fio->setLinkStyle (fio->getDefLinkStyle());
   1.206  				}	
   1.207 -				// TODO if (typeid(*selection) == typeid(FloatTextObj))
   1.208  			}
   1.209  		} else	// selection != a FloatObj
   1.210  		{
   1.211 @@ -3291,9 +3319,9 @@
   1.212  					if (lmosel->getOrientation() == OrientLeftOfCenter)
   1.213  						// Add width of bbox here, otherwise alignRelTo will cause jumping around
   1.214  						lmosel->move(p.x() -movingObj_start.x()+lmosel->getBBox().width(), 
   1.215 -							p.y()-movingObj_start.y() );		
   1.216 +							p.y()-movingObj_start.y() +lmosel->getTopPad() );		
   1.217  					else	
   1.218 -						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() );
   1.219 +						lmosel->move(p.x() -movingObj_start.x(), p.y()-movingObj_start.y() -lmosel->getTopPad());
   1.220  				} 
   1.221  				// reposition subbranch
   1.222  				lmosel->reposition();	
   1.223 @@ -3316,7 +3344,7 @@
   1.224  				} else	
   1.225  				{
   1.226  					lmosel->unsetParObjTmp();
   1.227 -					/*
   1.228 +					/* FIXME not needed anymore?
   1.229  					if (lmo &&(lmo==selection))   
   1.230  						// Could link to myself (happens sometimes...)
   1.231  						lmosel->unsetParObjTmp();
   1.232 @@ -3403,6 +3431,13 @@
   1.233      // Have we been moving something?
   1.234      if ( selection && movingObj ) 
   1.235      {	
   1.236 +		// Moved FloatObj? Maybe we need to reposition
   1.237 +		if(typeid(*selection)==typeid (FloatImageObj))
   1.238 +		{
   1.239 +			selection->getParObj()->requestReposition();
   1.240 +			mapCenter->reposition();
   1.241 +		}	
   1.242 +
   1.243  		// Check if we are over another branch, but ignore 
   1.244  		// any found LMOs, which are FloatObjs
   1.245  		dst=mapCenter->findMapObj(inverseWorldMatrix().map(e->pos() ),