diff -r a6499713d8ae -r c58b3973337c mainwindow.cpp --- a/mainwindow.cpp Thu May 17 20:19:03 2007 +0000 +++ b/mainwindow.cpp Thu May 17 20:19:03 2007 +0000 @@ -25,6 +25,7 @@ extern Main *mainWindow; extern QString tmpVymDir; extern QString clipboardDir; +extern QString clipboardFile; extern bool clipboardEmpty; extern int statusbarTime; extern FlagRowObj* standardFlagsDefault; @@ -85,6 +86,7 @@ // Create direcctory for clipboard clipboardDir=tmpVymDir+"/clipboard"; + clipboardFile="part"; QDir d(clipboardDir); d.mkdir (clipboardDir,true); makeSubDirs (clipboardDir); @@ -197,6 +199,7 @@ settings.setValue( "/version/version", vymVersion ); settings.setValue( "/version/builddate", vymBuildDate ); + settings.setValue( "/mapeditor/autosave/use",actionSettingsAutosaveToggle->isOn() ); settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() ); settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() ); settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() ); @@ -252,13 +255,19 @@ tb->setObjectName ("mapTB"); QAction *a; - a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New...","File menu" ),this); + a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&New map","File menu" ),this); a->setStatusTip ( tr( "New map","Status tip File menu" ) ); a->setShortcut ( Qt::CTRL + Qt::Key_N ); //New map a->addTo( tb ); fileMenu->addAction (a); connect( a, SIGNAL( triggered() ), this, SLOT( fileNew() ) ); + a = new QAction(QPixmap( iconPath+"filenew.png"), tr( "&Copy to new map","File menu" ),this); + a->setStatusTip ( tr( "Copy selection to mapcenter of a new map","Status tip File menu" ) ); + a->setShortcut ( Qt::CTRL +Qt::SHIFT + Qt::Key_N ); //New map + fileMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( fileNewCopy() ) ); + a = new QAction( QPixmap( iconPath+"fileopen.png"), tr( "&Open..." ,"File menu"),this); a->setStatusTip (tr( "Open","Status tip File menu" ) ); a->setShortcut ( Qt::CTRL + Qt::Key_O ); //Open map @@ -1629,7 +1638,7 @@ void Main::showEvent (QShowEvent * ) { - //FIXME if (textEditor->showWithMain()) textEditor->showNormal(); + if (actionViewToggleNoteEditor->isOn()) textEditor->showNormal(); } bool Main::reallyWriteDirectory(const QString &dir) @@ -1715,6 +1724,29 @@ me->select("mc:"); } +void Main::fileNewCopy() +{ + QString fn="unnamed"; + MapEditor* oldME =currentMapEditor(); + if (oldME) + { + oldME->copy(); + MapEditor* newME = new MapEditor ( NULL); + if (newME) + { + tabWidget->addTab (newME,fn); + tabWidget->showPage(newME); + newME->viewport()->setFocus(); + newME->setAntiAlias (actionViewToggleAntiAlias->isOn()); + newME->setSmoothPixmap(actionViewToggleSmoothPixmapTransform->isOn()); + // For the very first map we do not have flagrows yet... + newME->select("mc:"); + newME->load (clipboardDir+"/"+clipboardFile,ImportReplace); + } + + } +} + ErrorCode Main::fileLoad(QString fn, const LoadMode &lmode) { ErrorCode err=success; @@ -2698,6 +2730,7 @@ MapEditor *me=currentMapEditor(); if (me) { + me->setStateEditHeading (false); QPoint p; //Not used here, only to find out pos of branch bool ok; QString s=me->getHeading(ok,p); @@ -2733,6 +2766,7 @@ if (ok) { + me->setStateEditHeading (true); #if defined(Q_OS_MACX) p=currentMapEditor()->mapTo (this,p); QDialog *d =new QDialog(NULL); @@ -3346,7 +3380,7 @@ MapEditor *me=currentMapEditor(); if (!me) return; - historyWindow->setCaption (vymName + " - " +tr("History for %1").arg(currentMapEditor()->getFileName(),"Window Caption")); + historyWindow->setCaption (vymName + " - " +tr("History for %1","Window Caption").arg(currentMapEditor()->getFileName())); // updateActions is also called when NoteEditor is closed actionViewToggleNoteEditor->setOn (textEditor->isVisible());