mapeditor.cpp
changeset 185 6691000c3262
parent 175 728f51b71e71
child 194 de97201180ea
     1.1 --- a/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.2 +++ b/mapeditor.cpp	Tue Jan 24 15:09:48 2006 +0000
     1.3 @@ -373,7 +373,7 @@
     1.4  	if (linkcolorhint==HeadingColor) 
     1.5  		colhint=attribut("linkColorHint","HeadingColor");
     1.6  
     1.7 -	QString mapAttr=attribut("version",__VYM_VERSION__);
     1.8 +	QString mapAttr=attribut("version",__VYM_VERSION);
     1.9  	if (!saveSelection)
    1.10  		mapAttr+= attribut("author",mapCenter->getAuthor()) +
    1.11  				  attribut("comment",mapCenter->getComment()) +
    1.12 @@ -1065,9 +1065,9 @@
    1.13  	ExportBase ex;
    1.14  	ex.setMapCenter(mapCenter);
    1.15  
    1.16 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (ASCII)"));
    1.17 +	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (ASCII)"));
    1.18  	fd->addFilter ("TXT (*.txt)");
    1.19 -	fd->setCaption("VYM - Export (ASCII) (still experimental)");
    1.20 +	fd->setCaption(__VYM " -" +tr("Export (ASCII) (still experimental)"));
    1.21  	fd->setMode( QFileDialog::AnyFile );
    1.22  	fd->show();
    1.23  
    1.24 @@ -1075,7 +1075,7 @@
    1.25  	{
    1.26  		if (QFile (fd->selectedFile()).exists() )
    1.27  		{
    1.28 -			QMessageBox mb( "VYM",
    1.29 +			QMessageBox mb( __VYM,
    1.30  				tr("The file %1 exists already.\nDo you want to overwrite it?").arg(fd->selectedFile()), 
    1.31  			QMessageBox::Warning,
    1.32  			QMessageBox::Yes | QMessageBox::Default,
    1.33 @@ -1104,9 +1104,9 @@
    1.34  void MapEditor::exportLaTeX()
    1.35  {
    1.36  	// TODO still experimental
    1.37 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (LaTex)"));
    1.38 +	QFileDialog *fd=new QFileDialog( this, __VYM " - " +tr("Export (LaTex)"));
    1.39  	fd->addFilter ("TEX (*.tex)");
    1.40 -	fd->setCaption("VYM - Export (LaTex) (still experimental)");
    1.41 +	fd->setCaption(__VYM  " - " + tr("Export (LaTex) (still experimental)"));
    1.42  	fd->setMode( QFileDialog::AnyFile );
    1.43  	fd->show();
    1.44  
    1.45 @@ -1143,48 +1143,13 @@
    1.46  	}
    1.47  }
    1.48  
    1.49 -void MapEditor::exportOOPresentation()
    1.50 +void MapEditor::exportOOPresentation(const QString &fn, const QString &cf)
    1.51  {
    1.52 -	// TODO still experimental
    1.53 -	/*
    1.54 -	QFileDialog *fd=new QFileDialog( this, tr("VYM - Export (Open Office 1.3.x Presentation)"));
    1.55 -	fd->addFilter ("Open Office 1.3.x presentation (*.sxi)");
    1.56 -	fd->setCaption("VYM - Export (Open Office 1.3.x presentation) (still experimental)");
    1.57 -	fd->setMode( QFileDialog::AnyFile );
    1.58 -	fd->show();
    1.59 -
    1.60 -	if ( fd->exec() == QDialog::Accepted )
    1.61 -	{
    1.62 -		if (QFile (fd->selectedFile()).exists() )
    1.63 -		{
    1.64 -			QMessageBox mb( "VYM",
    1.65 -				tr("The file ") + fd->selectedFile() + 
    1.66 -				tr(" exists already. Do you want to overwrite it?"),
    1.67 -			QMessageBox::Warning,
    1.68 -			QMessageBox::Yes | QMessageBox::Default,
    1.69 -			QMessageBox::Cancel | QMessageBox::Escape,
    1.70 -			QMessageBox::NoButton );
    1.71 -
    1.72 -			mb.setButtonText( QMessageBox::Yes, tr("Overwrite") );
    1.73 -			mb.setButtonText( QMessageBox::No, tr("Cancel"));
    1.74 -			Export ex;
    1.75 -			switch( mb.exec() ) 
    1.76 -			{
    1.77 -				case QMessageBox::Yes:
    1.78 -					// save 
    1.79 -					break;;
    1.80 -				case QMessageBox::Cancel:
    1.81 -					// do nothing
    1.82 -					return;
    1.83 -					break;
    1.84 -			}
    1.85 -		}
    1.86 -		*/
    1.87 -		ExportOO ex;
    1.88 -		//ex.setPath (fd->selectedFile() );
    1.89 -		ex.setMapCenter(mapCenter);
    1.90 -		ex.exportPresentation();
    1.91 -//	}
    1.92 +	ExportOO ex;
    1.93 +	ex.setPath (fn);
    1.94 +	ex.setConfigFile(cf);
    1.95 +	ex.setMapCenter(mapCenter);
    1.96 +	ex.exportPresentation();
    1.97  }
    1.98  
    1.99  
   1.100 @@ -2204,7 +2169,7 @@
   1.101  		if (typeid(*selection) == typeid(BranchObj) ||
   1.102  			typeid(*selection) == typeid(MapCenterObj))
   1.103  		{
   1.104 -			saveState(selection);
   1.105 +			saveState(selection);	//TODO undoCommand
   1.106  			BranchObj *bo=(BranchObj*)selection;
   1.107  			bo->setColor(actColor, true); // color links, color childs
   1.108  		}    
   1.109 @@ -2378,9 +2343,9 @@
   1.110  			typeid(*selection) == typeid(MapCenterObj)) )
   1.111  	{		
   1.112  		BranchObj *bo=(BranchObj*)selection;
   1.113 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Link to another map"));
   1.114 +		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Link to another map"));
   1.115  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
   1.116 -		fd->setCaption(tr("VYM - Link to another map"));
   1.117 +		fd->setCaption(__VYM " - " +tr("Link to another map"));
   1.118  		if (! bo->getVymLink().isEmpty() )
   1.119  			fd->setSelection( bo->getVymLink() );
   1.120  		fd->show();
   1.121 @@ -2792,13 +2757,14 @@
   1.122  	{
   1.123  		BranchObj *bo=((BranchObj*)selection);
   1.124  
   1.125 -		QFileDialog *fd=new QFileDialog( this,tr("vym - load image"));
   1.126 +		QFileDialog *fd=new QFileDialog( this,QString ("vym - ")+tr("Load image"));
   1.127 +		fd->setMode (QFileDialog::ExistingFiles);
   1.128  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
   1.129  		ImagePreview *p =new ImagePreview (fd);
   1.130  		fd->setContentsPreviewEnabled( TRUE );
   1.131  		fd->setContentsPreview( p, p );
   1.132  		fd->setPreviewMode( QFileDialog::Contents );
   1.133 -		fd->setCaption(tr("vym - Load image"));
   1.134 +		fd->setCaption(__VYM " - " +tr("Load image"));
   1.135  		fd->setDir (lastImageDir);
   1.136  		fd->show();
   1.137  
   1.138 @@ -2806,12 +2772,19 @@
   1.139  		if ( fd->exec() == QDialog::Accepted )
   1.140  		{
   1.141  			saveState(selection);
   1.142 -			QString fn=fd->selectedFile();
   1.143  			lastImageDir=fn.left(fn.findRev ("/"));
   1.144 -			bo->addFloatImage();
   1.145 -			// TODO check if load was successful
   1.146 -			bo->getLastFloatImage()->load(fn);
   1.147 -			bo->getLastFloatImage()->setOriginalFilename(fn);
   1.148 +			QStringList flist = fd->selectedFiles();
   1.149 +			QStringList::Iterator it = flist.begin();
   1.150 +			while( it != flist.end() ) 
   1.151 +			{
   1.152 +				fn = *it;
   1.153 +				bo->addFloatImage();
   1.154 +				// TODO check if load was successful
   1.155 +				bo->getLastFloatImage()->load(*it);
   1.156 +				bo->getLastFloatImage()->setOriginalFilename(fn);
   1.157 +				++it;
   1.158 +			}
   1.159 +
   1.160  			mapCenter->reposition();
   1.161  			adjustCanvasSize();
   1.162  			canvas()->update();
   1.163 @@ -2836,7 +2809,7 @@
   1.164  		fd->addFilter ("GIF (*.gif)");
   1.165  		fd->addFilter ("PNM (*.pnm)");
   1.166  		fd->addFilter (QString (tr("Images") + " (*.png *.bmp *.xbm *.jpg *.png *.xpm *.gif *.pnm)"));
   1.167 -		fd->setCaption(tr("vym - Save image as %1").arg(fmt));
   1.168 +		fd->setCaption(__VYM " - " +tr("Save image as %1").arg(fmt));
   1.169  		fd->setMode( QFileDialog::AnyFile );
   1.170  		fd->setSelection (fio->getOriginalFilename());
   1.171  		fd->show();
   1.172 @@ -2846,7 +2819,7 @@
   1.173  		{
   1.174  			if (QFile (fd->selectedFile()).exists() )
   1.175  			{
   1.176 -				QMessageBox mb( "VYM",
   1.177 +				QMessageBox mb( __VYM,
   1.178  					tr("The file %1 exists already.\n"
   1.179  					"Do you want to overwrite it?").arg(fd->selectedFile()),
   1.180  				QMessageBox::Warning,
   1.181 @@ -2981,10 +2954,10 @@
   1.182  		(typeid(*selection) == typeid(BranchObj)) || 
   1.183  		(typeid(*selection) == typeid(MapCenterObj))  )
   1.184  	{
   1.185 -		QFileDialog *fd=new QFileDialog( this,tr("VYM - Choose directory structur to import"));
   1.186 +		QFileDialog *fd=new QFileDialog( this,__VYM " - " +tr("Choose directory structure to import"));
   1.187  		fd->setMode (QFileDialog::DirectoryOnly);
   1.188  		fd->addFilter (QString (tr("vym map") + " (*.vym)"));
   1.189 -		fd->setCaption(tr("VYM - Choose directory structur to import"));
   1.190 +		fd->setCaption(__VYM " - " +tr("Choose directory structure to import"));
   1.191  		fd->show();
   1.192  
   1.193  		QString fn;
   1.194 @@ -3046,7 +3019,10 @@
   1.195  void MapEditor::testFunction()
   1.196  {
   1.197  	cout << "MapEditor::testFunction() called\n";
   1.198 -	mapCenter->move(mapCenter->x(),mapCenter->y());
   1.199 +	if (selection && (typeid(*selection) == typeid(BranchObj)))
   1.200 +	{
   1.201 +		cout << "Note:\n"<<((BranchObj*)selection)->getNoteOpenDoc()<<endl;
   1.202 +	}
   1.203  }
   1.204  
   1.205  void MapEditor::ensureSelectionVisible()