1.1 --- a/mapeditor.cpp Tue Mar 28 20:04:04 2006 +0000
1.2 +++ b/mapeditor.cpp Wed Mar 29 09:11:09 2006 +0000
1.3 @@ -1658,6 +1658,26 @@
1.4 return selection;
1.5 }
1.6
1.7 +void MapEditor::unselect()
1.8 +{
1.9 + if (selection)
1.10 + {
1.11 + selectionLast=selection;
1.12 + selection->unselect();
1.13 + selection=NULL;
1.14 + }
1.15 +}
1.16 +
1.17 +void MapEditor::reselect()
1.18 +{
1.19 + if (selectionLast)
1.20 + {
1.21 + selection=selectionLast;
1.22 + selection->select();
1.23 + selectionLast=NULL;
1.24 + }
1.25 +}
1.26 +
1.27 bool MapEditor::select (const QString &s)
1.28 {
1.29 LinkableMapObj *lmo=mapCenter->findObjBySelect(s);
1.30 @@ -1675,25 +1695,19 @@
1.31 return false;
1.32 }
1.33
1.34 -void MapEditor::unselect()
1.35 +void MapEditor::select (LinkableMapObj *lmo)
1.36 {
1.37 - if (selection)
1.38 + if (lmo && selection != lmo)
1.39 {
1.40 - selectionLast=selection;
1.41 - selection->unselect();
1.42 - selection=NULL;
1.43 + // select the MapObj
1.44 + if (selection) selection->unselect();
1.45 + selection=lmo;
1.46 + selection->select();
1.47 +
1.48 + adjustCanvasSize();
1.49 }
1.50 -}
1.51 -
1.52 -void MapEditor::reselect()
1.53 -{
1.54 - if (selectionLast)
1.55 - {
1.56 - selection=selectionLast;
1.57 - selection->select();
1.58 - selectionLast=NULL;
1.59 - }
1.60 -}
1.61 +
1.62 +}
1.63
1.64 void MapEditor::selectNextBranch()
1.65 {
1.66 @@ -3106,17 +3120,45 @@
1.67 QPoint p = inverseWorldMatrix().map(e->pos());
1.68 LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL);
1.69
1.70 + //Take care of clickdesystem flags _or_ modifier modes
1.71 + //
1.72 + if (lmo && (typeid(*lmo)==typeid(BranchObj) ||
1.73 + typeid(*lmo)==typeid(MapCenterObj) ))
1.74 + {
1.75 + QString foname=((BranchObj*)lmo)->getSystemFlagName(p);
1.76 + if (!foname.isEmpty())
1.77 + {
1.78 + // systemFlag clicked
1.79 + select (lmo);
1.80 + if (foname=="url")
1.81 + {
1.82 + if (e->state() & QMouseEvent::ControlButton)
1.83 + mainWindow->editOpenURLTab();
1.84 + else
1.85 + mainWindow->editOpenURL();
1.86 + }
1.87 + else if (foname=="vymLink")
1.88 + {
1.89 + mainWindow->editOpenVymLink();
1.90 + // tabWidget may change, better return now
1.91 + // before segfaulting...
1.92 + } else if (foname=="note")
1.93 + mainWindow->windowToggleNoteEditor();
1.94 + else if (foname=="hideInExport")
1.95 + toggleHideExport();
1.96 + return;
1.97 + }
1.98 + }
1.99 + // No system flag clicked, take care of modmodes
1.100 +
1.101 // Special case: CTRL is pressed
1.102 if (e->state() & QMouseEvent::ControlButton)
1.103 {
1.104 if (actionModModeColor->isOn())
1.105 {
1.106 - if (e->state() & QMouseEvent::ControlButton)
1.107 - {
1.108 pickingColor=true;
1.109 setCursor (pickColorCursor);
1.110 return;
1.111 - }
1.112 }
1.113 if (actionModModeLink->isOn())
1.114 {
1.115 @@ -3141,49 +3183,11 @@
1.116 tmpXLink->setVisibility (true);
1.117 return;
1.118 }
1.119 - }
1.120 + }
1.121 }
1.122 -
1.123 if (lmo)
1.124 - { // MapObj was found
1.125 - if (selection != lmo)
1.126 - {
1.127 - // select the MapObj
1.128 - if (selection) selection->unselect();
1.129 - selection=lmo;
1.130 - selection->select();
1.131 -
1.132 - adjustCanvasSize();
1.133 - }
1.134 -
1.135 - // Check, if systemFlag clicked
1.136 - if (typeid(*selection)==typeid(BranchObj) ||
1.137 - typeid(*selection)==typeid(MapCenterObj) )
1.138 - {
1.139 - QString foname=((BranchObj*)selection)->getSystemFlagName(p);
1.140 - if (!foname.isEmpty())
1.141 - {
1.142 - // Do not move, if systemFlag clicked
1.143 - if (foname=="url")
1.144 - {
1.145 - if (e->state() & QMouseEvent::ControlButton)
1.146 - mainWindow->editOpenURLTab();
1.147 - else
1.148 - mainWindow->editOpenURL();
1.149 - }
1.150 - else if (foname=="vymLink")
1.151 - {
1.152 - mainWindow->editOpenVymLink();
1.153 - // tabWidget may change, better return now
1.154 - // before segfaulting...
1.155 - return;
1.156 - } else if (foname=="note")
1.157 - mainWindow->windowToggleNoteEditor();
1.158 - else if (foname=="hideInExport")
1.159 - toggleHideExport();
1.160 - }
1.161 - }
1.162 -
1.163 + {
1.164 + select (lmo);
1.165 // Left Button Move Branches
1.166 if (e->button() == QMouseEvent::LeftButton )
1.167 {