diff -r 7d91b35c1b6f -r 5d0cbeb02bf3 mapeditor.cpp --- a/mapeditor.cpp Tue Mar 28 20:04:04 2006 +0000 +++ b/mapeditor.cpp Wed Mar 29 09:11:09 2006 +0000 @@ -1658,6 +1658,26 @@ return selection; } +void MapEditor::unselect() +{ + if (selection) + { + selectionLast=selection; + selection->unselect(); + selection=NULL; + } +} + +void MapEditor::reselect() +{ + if (selectionLast) + { + selection=selectionLast; + selection->select(); + selectionLast=NULL; + } +} + bool MapEditor::select (const QString &s) { LinkableMapObj *lmo=mapCenter->findObjBySelect(s); @@ -1675,25 +1695,19 @@ return false; } -void MapEditor::unselect() +void MapEditor::select (LinkableMapObj *lmo) { - if (selection) + if (lmo && selection != lmo) { - selectionLast=selection; - selection->unselect(); - selection=NULL; + // select the MapObj + if (selection) selection->unselect(); + selection=lmo; + selection->select(); + + adjustCanvasSize(); } -} - -void MapEditor::reselect() -{ - if (selectionLast) - { - selection=selectionLast; - selection->select(); - selectionLast=NULL; - } -} + +} void MapEditor::selectNextBranch() { @@ -3106,17 +3120,45 @@ QPoint p = inverseWorldMatrix().map(e->pos()); LinkableMapObj* lmo=mapCenter->findMapObj(p, NULL); + //Take care of clickdesystem flags _or_ modifier modes + // + if (lmo && (typeid(*lmo)==typeid(BranchObj) || + typeid(*lmo)==typeid(MapCenterObj) )) + { + QString foname=((BranchObj*)lmo)->getSystemFlagName(p); + if (!foname.isEmpty()) + { + // systemFlag clicked + select (lmo); + if (foname=="url") + { + if (e->state() & QMouseEvent::ControlButton) + mainWindow->editOpenURLTab(); + else + mainWindow->editOpenURL(); + } + else if (foname=="vymLink") + { + mainWindow->editOpenVymLink(); + // tabWidget may change, better return now + // before segfaulting... + } else if (foname=="note") + mainWindow->windowToggleNoteEditor(); + else if (foname=="hideInExport") + toggleHideExport(); + return; + } + } + // No system flag clicked, take care of modmodes + // Special case: CTRL is pressed if (e->state() & QMouseEvent::ControlButton) { if (actionModModeColor->isOn()) { - if (e->state() & QMouseEvent::ControlButton) - { pickingColor=true; setCursor (pickColorCursor); return; - } } if (actionModModeLink->isOn()) { @@ -3141,49 +3183,11 @@ tmpXLink->setVisibility (true); return; } - } + } } - if (lmo) - { // MapObj was found - if (selection != lmo) - { - // select the MapObj - if (selection) selection->unselect(); - selection=lmo; - selection->select(); - - adjustCanvasSize(); - } - - // Check, if systemFlag clicked - if (typeid(*selection)==typeid(BranchObj) || - typeid(*selection)==typeid(MapCenterObj) ) - { - QString foname=((BranchObj*)selection)->getSystemFlagName(p); - if (!foname.isEmpty()) - { - // Do not move, if systemFlag clicked - if (foname=="url") - { - if (e->state() & QMouseEvent::ControlButton) - mainWindow->editOpenURLTab(); - else - mainWindow->editOpenURL(); - } - else if (foname=="vymLink") - { - mainWindow->editOpenVymLink(); - // tabWidget may change, better return now - // before segfaulting... - return; - } else if (foname=="note") - mainWindow->windowToggleNoteEditor(); - else if (foname=="hideInExport") - toggleHideExport(); - } - } - + { + select (lmo); // Left Button Move Branches if (e->button() == QMouseEvent::LeftButton ) {