diff -r b7447adddc9a -r 5522d1da7e37 mainwindow.cpp --- a/mainwindow.cpp Wed Jan 10 13:26:12 2007 +0000 +++ b/mainwindow.cpp Tue Jan 23 11:50:53 2007 +0000 @@ -5,6 +5,7 @@ #include #include "aboutdialog.h" +#include "branchpropwindow.h" #include "exportoofiledialog.h" #include "exports.h" #include "exportxhtmldialog.h" @@ -93,6 +94,10 @@ // Initialize history window; historyWindow=new HistoryWindow(); + // Initialize properties window + branchPropertyWindow = new BranchPropertyWindow(); + branchPropertyWindow->move (20,20); + // Initialize some settings, which are platform dependant QString p,s; @@ -763,6 +768,10 @@ connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); actionEditLoadImage=a; + a = new QAction( tr( "Properties","Context menu for images and branches" )+QString ("..."), this); + a->setStatusTip (tr( "Set properties for object" )); + connect( a, SIGNAL( triggered() ), this, SLOT( showPropertyDialog() ) ); + actionOpenPropertyDialog=a; } // Format Actions @@ -840,19 +849,6 @@ formatMenu->addAction (a); actionFormatLinkStylePolyParabel=a; - actionGroupFormatFrameTypes=new QActionGroup ( this); - actionGroupFormatFrameTypes->setExclusive (true); - a = new QAction( tr( "No Frame","Branch attribute" ), actionGroupFormatFrameTypes ); - a->setStatusTip (tr("No Frame")); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) ); - actionFormatFrameNone=a; - a = new QAction( tr( "Rectangle""Branch attribute" ), actionGroupFormatFrameTypes); - a->setStatusTip (tr( "Rectangle" )); - a->setToggleAction(true); - connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) ); - actionFormatFrameRectangle=a; - a = new QAction( tr( "Include images vertically","Branch attribute" ), this); a->setStatusTip ( tr ("Include top and bottom position of images into branch")); a->setToggleAction(true); @@ -1444,6 +1440,9 @@ // Context Menu for branch or mapcenter branchContextMenu =new QMenu (this); + actionOpenPropertyDialog->addTo (branchContextMenu); + branchContextMenu->addSeparator(); + // Submenu "Add" branchAddContextMenu =branchContextMenu->addMenu (tr("Add")); branchAddContextMenu->addAction (actionEditPaste ); @@ -1466,11 +1465,6 @@ actionEditSaveBranch->addTo( branchContextMenu ); branchContextMenu->addSeparator(); - branchContextMenu->addAction ( actionFormatFrameNone ); - branchContextMenu->addAction ( actionFormatFrameRectangle); - branchContextMenu->addAction ( actionFormatHideLinkUnselected ); - - branchContextMenu->addSeparator(); branchContextMenu->addAction ( actionEditLoadImage); branchContextMenu->addAction ( actionFormatIncludeImagesVer ); branchContextMenu->addAction ( actionFormatIncludeImagesHor ); @@ -1605,6 +1599,7 @@ QFileDialog fd(this,caption); fd.setMode (QFileDialog::DirectoryOnly); fd.setCaption(vymName+ " - "+caption); + fd.setDir (lastFileDir); fd.show(); if ( fd.exec() == QDialog::Accepted ) @@ -2626,17 +2621,24 @@ { // only called from editHeading(), so there is a currentME MapEditor *me=currentMapEditor(); + if (me) + { + QPoint p; //Not used here, only to find out pos of branch + bool ok; + QString s=me->getHeading(ok,p); #if defined(Q_OS_MACX) #else - me->setHeading(lineedit->text()); - - lineedit->releaseKeyboard(); - lineedit->hide(); - setFocus(); + if (ok && s!=lineedit->text()) + me->setHeading(lineedit->text()); + + lineedit->releaseKeyboard(); + lineedit->hide(); + setFocus(); #endif - if (!prevSelection.isEmpty()) me->select(prevSelection); - prevSelection=""; + if (!prevSelection.isEmpty()) me->select(prevSelection); + prevSelection=""; + } } void Main::editHeading() @@ -2767,10 +2769,8 @@ void Main::editMoveUp() { - cout << "Main editMoveUp begin\n"; if (currentMapEditor()) currentMapEditor()->moveBranchUp(); - cout << "Main editMoveUp end\n"; } void Main::editMoveDown() @@ -3058,17 +3058,6 @@ currentMapEditor()->toggleMapLinkColorHint(); } -void Main::formatFrameNone() -{ - if (currentMapEditor()) - currentMapEditor()->setFrame(NoFrame); -} - -void Main::formatFrameRectangle() -{ - if (currentMapEditor()) - currentMapEditor()->setFrame(Rectangle); -} void Main::formatIncludeImagesVer() { @@ -3082,7 +3071,7 @@ currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn()); } -void Main::formatHideLinkUnselected() +void Main::formatHideLinkUnselected() //FIXME get rid of this with imagepropertydialog { if (currentMapEditor()) currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn()); @@ -3340,17 +3329,6 @@ for (int i=0; isetEnabled(true); actionEditDelete->setEnabled (true); - switch (selection->getFrameType()) - { - case NoFrame: - actionFormatFrameNone->setOn(true); - break; - case Rectangle: - actionFormatFrameRectangle->setOn(true); - break; - default: - break; - } actionFormatIncludeImagesVer->setOn ( ((BranchObj*)selection)->getIncludeImagesVer()); actionFormatIncludeImagesHor->setOn @@ -3438,6 +3416,23 @@ actionViewToggleNoteEditor->setOn (false); } +void Main::showPropertyDialog() +{ + if(currentMapEditor()) + { + LinkableMapObj *sel=currentMapEditor()->getSelection(); + if (sel && typeid(*sel) == typeid(BranchObj)) + { + branchPropertyWindow->show(); + branchPropertyWindow->setMapEditor(currentMapEditor()); + branchPropertyWindow->setBranch((BranchObj*)sel); + return; + } + + } + branchPropertyWindow->setBranch(NULL); +} + void Main::windowNextEditor() { if (tabWidget->currentPageIndex() < tabWidget->count()) @@ -3452,7 +3447,8 @@ void Main::standardFlagChanged() { - currentMapEditor()->toggleStandardFlag(sender()->name()); + if (currentMapEditor()) + currentMapEditor()->toggleStandardFlag(sender()->name()); } void Main::testFunction()