mapeditor.cpp
changeset 377 5391ab620c95
parent 375 06ab6df252fa
child 381 c79df732d095
     1.1 --- a/mapeditor.cpp	Tue Sep 05 15:05:18 2006 +0000
     1.2 +++ b/mapeditor.cpp	Wed Sep 06 12:47:06 2006 +0000
     1.3 @@ -223,21 +223,15 @@
     1.4  
     1.5  	hidemode=HideNone;
     1.6  
     1.7 -	isInteractive=interactive;
     1.8 -	if (isInteractive)
     1.9 -		// Create temporary files
    1.10 -		makeTmpDirs();
    1.11 +	isInteractive=interactive;	// FIXME still needed?
    1.12 +
    1.13 +	// Create temporary files
    1.14 +	makeTmpDirs();
    1.15  
    1.16  	// Initially set movingCentre
    1.17  	updateViewCenter();
    1.18  
    1.19 -	// For testing purposes create history window
    1.20 -	historyWindow = new ShowTextDialog (this);
    1.21 -	historyWindow->setCaption (fileName);
    1.22 -
    1.23  	mapCenter->reposition();	//	for positioning heading
    1.24 -
    1.25 -
    1.26  }
    1.27  
    1.28  MapEditor::~MapEditor()
    1.29 @@ -352,10 +346,12 @@
    1.30  		
    1.31  		s=(((BranchObj*)lmo)->getHeading());
    1.32  		if (s=="") s="unnamed";
    1.33 -		return QString("branch (<font color=\"#0000ff\">%1</font>)").arg(s);
    1.34 +		return QString("branch (%1)").arg(s);
    1.35 +		//return QString("branch (<font color=\"#0000ff\">%1</font>)").arg(s);
    1.36  	}	
    1.37  	if ((typeid(*lmo) == typeid(FloatImageObj) ))
    1.38 -		return QString ("floatimage [<font color=\"#0000ff\">%1</font>]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.39 +		return QString ("floatimage [%1]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.40 +		//return QString ("floatimage [<font color=\"#0000ff\">%1</font>]").arg(((FloatImageObj*)lmo)->getOriginalFilename());
    1.41  	return QString("Unknown type has no name!");
    1.42  }
    1.43  
    1.44 @@ -365,7 +361,7 @@
    1.45  	tmpMapDir=QDir::convertSeparators (tmpVymDir+QString("/mapeditor-%1").arg(mapNum));
    1.46  	histPath=QDir::convertSeparators (tmpMapDir+"/history");
    1.47  	QDir d;
    1.48 -	d.mkdir (tmpMapDir,true);
    1.49 +	d.mkdir (tmpMapDir);
    1.50  }
    1.51  
    1.52  QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSel)
    1.53 @@ -430,7 +426,7 @@
    1.54  			s+=((BranchObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
    1.55  		else if ( typeid(*saveSel) == typeid(FloatImageObj) )
    1.56  			// Save image
    1.57 -			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
    1.58 +			s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix);
    1.59  			
    1.60  		else if (selection && typeid(*selection)==typeid(BranchObj))
    1.61  			// Save selected branch is saved from mainwindow		//FIXME maybe use "subtree" above?
    1.62 @@ -545,7 +541,6 @@
    1.63  	/* TODO remove after testing
    1.64  	*/
    1.65  	cout << "ME::saveState()  begin"<<endl;
    1.66 -	historyWindow->append (comment);
    1.67  	
    1.68  	setChanged();
    1.69  
    1.70 @@ -609,6 +604,8 @@
    1.71  	cout << "    redoCom="<<redoCom.toStdString()<<endl;
    1.72  	cout << "    redoSel="<<redoSelection.toStdString()<<endl;
    1.73  	cout << "    ---------------------------"<<endl;
    1.74 +
    1.75 +	historyWindow.update (undoSet);
    1.76  }
    1.77  
    1.78  void MapEditor::parseAtom(const QString &atom)
    1.79 @@ -792,10 +789,10 @@
    1.80  
    1.81  void MapEditor::toggleHistoryWindow()
    1.82  {
    1.83 -	if (historyWindow->isVisible())
    1.84 -		historyWindow->hide();
    1.85 +	if (historyWindow.isVisible())
    1.86 +		historyWindow.hide();
    1.87  	else	
    1.88 -		historyWindow->show();
    1.89 +		historyWindow.show();
    1.90  }
    1.91  
    1.92  
    1.93 @@ -865,7 +862,7 @@
    1.94  		mapName=fileName.left(fileName.findRev(".",-1,true) );
    1.95  
    1.96  		// Adjust history window
    1.97 -		historyWindow->setCaption (fileName);
    1.98 +		historyWindow.setCaption (__VYM " - " +tr("History for ")+fileName);
    1.99  	}
   1.100  }
   1.101  
   1.102 @@ -3040,12 +3037,14 @@
   1.103  						break;;
   1.104  					case QMessageBox::Cancel:
   1.105  						// do nothing
   1.106 +						delete (fd);
   1.107  						return;
   1.108  						break;
   1.109  				}
   1.110  			}
   1.111  			fio->save (fd->selectedFile(),imageIO.getType (fd->selectedFilter() ) );
   1.112  		}
   1.113 +		delete (fd);
   1.114  	}
   1.115  }
   1.116