1.1 --- a/mainwindow.cpp Wed Jan 10 13:26:12 2007 +0000
1.2 +++ b/mainwindow.cpp Tue Jan 23 11:50:53 2007 +0000
1.3 @@ -5,6 +5,7 @@
1.4 #include <iostream>
1.5
1.6 #include "aboutdialog.h"
1.7 +#include "branchpropwindow.h"
1.8 #include "exportoofiledialog.h"
1.9 #include "exports.h"
1.10 #include "exportxhtmldialog.h"
1.11 @@ -93,6 +94,10 @@
1.12 // Initialize history window;
1.13 historyWindow=new HistoryWindow();
1.14
1.15 + // Initialize properties window
1.16 + branchPropertyWindow = new BranchPropertyWindow();
1.17 + branchPropertyWindow->move (20,20);
1.18 +
1.19 // Initialize some settings, which are platform dependant
1.20 QString p,s;
1.21
1.22 @@ -763,6 +768,10 @@
1.23 connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) );
1.24 actionEditLoadImage=a;
1.25
1.26 + a = new QAction( tr( "Properties","Context menu for images and branches" )+QString ("..."), this);
1.27 + a->setStatusTip (tr( "Set properties for object" ));
1.28 + connect( a, SIGNAL( triggered() ), this, SLOT( showPropertyDialog() ) );
1.29 + actionOpenPropertyDialog=a;
1.30 }
1.31
1.32 // Format Actions
1.33 @@ -840,19 +849,6 @@
1.34 formatMenu->addAction (a);
1.35 actionFormatLinkStylePolyParabel=a;
1.36
1.37 - actionGroupFormatFrameTypes=new QActionGroup ( this);
1.38 - actionGroupFormatFrameTypes->setExclusive (true);
1.39 - a = new QAction( tr( "No Frame","Branch attribute" ), actionGroupFormatFrameTypes );
1.40 - a->setStatusTip (tr("No Frame"));
1.41 - a->setToggleAction(true);
1.42 - connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameNone() ) );
1.43 - actionFormatFrameNone=a;
1.44 - a = new QAction( tr( "Rectangle""Branch attribute" ), actionGroupFormatFrameTypes);
1.45 - a->setStatusTip (tr( "Rectangle" ));
1.46 - a->setToggleAction(true);
1.47 - connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
1.48 - actionFormatFrameRectangle=a;
1.49 -
1.50 a = new QAction( tr( "Include images vertically","Branch attribute" ), this);
1.51 a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
1.52 a->setToggleAction(true);
1.53 @@ -1444,6 +1440,9 @@
1.54 // Context Menu for branch or mapcenter
1.55 branchContextMenu =new QMenu (this);
1.56
1.57 + actionOpenPropertyDialog->addTo (branchContextMenu);
1.58 + branchContextMenu->addSeparator();
1.59 +
1.60 // Submenu "Add"
1.61 branchAddContextMenu =branchContextMenu->addMenu (tr("Add"));
1.62 branchAddContextMenu->addAction (actionEditPaste );
1.63 @@ -1466,11 +1465,6 @@
1.64 actionEditSaveBranch->addTo( branchContextMenu );
1.65
1.66 branchContextMenu->addSeparator();
1.67 - branchContextMenu->addAction ( actionFormatFrameNone );
1.68 - branchContextMenu->addAction ( actionFormatFrameRectangle);
1.69 - branchContextMenu->addAction ( actionFormatHideLinkUnselected );
1.70 -
1.71 - branchContextMenu->addSeparator();
1.72 branchContextMenu->addAction ( actionEditLoadImage);
1.73 branchContextMenu->addAction ( actionFormatIncludeImagesVer );
1.74 branchContextMenu->addAction ( actionFormatIncludeImagesHor );
1.75 @@ -1605,6 +1599,7 @@
1.76 QFileDialog fd(this,caption);
1.77 fd.setMode (QFileDialog::DirectoryOnly);
1.78 fd.setCaption(vymName+ " - "+caption);
1.79 + fd.setDir (lastFileDir);
1.80 fd.show();
1.81
1.82 if ( fd.exec() == QDialog::Accepted )
1.83 @@ -2626,17 +2621,24 @@
1.84 {
1.85 // only called from editHeading(), so there is a currentME
1.86 MapEditor *me=currentMapEditor();
1.87 + if (me)
1.88 + {
1.89 + QPoint p; //Not used here, only to find out pos of branch
1.90 + bool ok;
1.91 + QString s=me->getHeading(ok,p);
1.92
1.93 #if defined(Q_OS_MACX)
1.94 #else
1.95 - me->setHeading(lineedit->text());
1.96 -
1.97 - lineedit->releaseKeyboard();
1.98 - lineedit->hide();
1.99 - setFocus();
1.100 + if (ok && s!=lineedit->text())
1.101 + me->setHeading(lineedit->text());
1.102 +
1.103 + lineedit->releaseKeyboard();
1.104 + lineedit->hide();
1.105 + setFocus();
1.106 #endif
1.107 - if (!prevSelection.isEmpty()) me->select(prevSelection);
1.108 - prevSelection="";
1.109 + if (!prevSelection.isEmpty()) me->select(prevSelection);
1.110 + prevSelection="";
1.111 + }
1.112 }
1.113
1.114 void Main::editHeading()
1.115 @@ -2767,10 +2769,8 @@
1.116
1.117 void Main::editMoveUp()
1.118 {
1.119 - cout << "Main editMoveUp begin\n";
1.120 if (currentMapEditor())
1.121 currentMapEditor()->moveBranchUp();
1.122 - cout << "Main editMoveUp end\n";
1.123 }
1.124
1.125 void Main::editMoveDown()
1.126 @@ -3058,17 +3058,6 @@
1.127 currentMapEditor()->toggleMapLinkColorHint();
1.128 }
1.129
1.130 -void Main::formatFrameNone()
1.131 -{
1.132 - if (currentMapEditor())
1.133 - currentMapEditor()->setFrame(NoFrame);
1.134 -}
1.135 -
1.136 -void Main::formatFrameRectangle()
1.137 -{
1.138 - if (currentMapEditor())
1.139 - currentMapEditor()->setFrame(Rectangle);
1.140 -}
1.141
1.142 void Main::formatIncludeImagesVer()
1.143 {
1.144 @@ -3082,7 +3071,7 @@
1.145 currentMapEditor()->setIncludeImagesHor(actionFormatIncludeImagesHor->isOn());
1.146 }
1.147
1.148 -void Main::formatHideLinkUnselected()
1.149 +void Main::formatHideLinkUnselected() //FIXME get rid of this with imagepropertydialog
1.150 {
1.151 if (currentMapEditor())
1.152 currentMapEditor()->setHideLinkUnselected(actionFormatHideLinkUnselected->isOn());
1.153 @@ -3340,17 +3329,6 @@
1.154 for (int i=0; i<actionListBranches.size(); ++i)
1.155 actionListBranches.at(i)->setEnabled(true);
1.156 actionEditDelete->setEnabled (true);
1.157 - switch (selection->getFrameType())
1.158 - {
1.159 - case NoFrame:
1.160 - actionFormatFrameNone->setOn(true);
1.161 - break;
1.162 - case Rectangle:
1.163 - actionFormatFrameRectangle->setOn(true);
1.164 - break;
1.165 - default:
1.166 - break;
1.167 - }
1.168 actionFormatIncludeImagesVer->setOn
1.169 ( ((BranchObj*)selection)->getIncludeImagesVer());
1.170 actionFormatIncludeImagesHor->setOn
1.171 @@ -3438,6 +3416,23 @@
1.172 actionViewToggleNoteEditor->setOn (false);
1.173 }
1.174
1.175 +void Main::showPropertyDialog()
1.176 +{
1.177 + if(currentMapEditor())
1.178 + {
1.179 + LinkableMapObj *sel=currentMapEditor()->getSelection();
1.180 + if (sel && typeid(*sel) == typeid(BranchObj))
1.181 + {
1.182 + branchPropertyWindow->show();
1.183 + branchPropertyWindow->setMapEditor(currentMapEditor());
1.184 + branchPropertyWindow->setBranch((BranchObj*)sel);
1.185 + return;
1.186 + }
1.187 +
1.188 + }
1.189 + branchPropertyWindow->setBranch(NULL);
1.190 +}
1.191 +
1.192 void Main::windowNextEditor()
1.193 {
1.194 if (tabWidget->currentPageIndex() < tabWidget->count())
1.195 @@ -3452,7 +3447,8 @@
1.196
1.197 void Main::standardFlagChanged()
1.198 {
1.199 - currentMapEditor()->toggleStandardFlag(sender()->name());
1.200 + if (currentMapEditor())
1.201 + currentMapEditor()->toggleStandardFlag(sender()->name());
1.202 }
1.203
1.204 void Main::testFunction()