diff -r 7df0b7986274 -r 5f9a2771680d mainwindow.cpp --- a/mainwindow.cpp Tue Apr 08 08:28:37 2008 +0000 +++ b/mainwindow.cpp Tue Apr 08 08:28:37 2008 +0000 @@ -527,6 +527,12 @@ connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) ); actionEditDelete=a; + // Shortcut to add mapcenter + a= new QAction(tr( "Add mapcenter","Canvas context menu" ), this); + connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) ); + actionEditAddMapCenter = a; + + // Shortcut to add branch alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this); alt->setStatusTip ( tr( "Add a branch as child of selection" )); @@ -1592,6 +1598,8 @@ // Context menu for canvas canvasContextMenu =new QMenu (this); actionEditMapInfo->addTo( canvasContextMenu ); + if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) + actionEditAddMapCenter->addTo( canvasContextMenu ); canvasContextMenu->insertSeparator(); actionGroupFormatLinkStyles->addTo( canvasContextMenu ); canvasContextMenu->insertSeparator(); @@ -2855,6 +2863,15 @@ currentMapEditor()->unscrollChilds(); } +void Main::editAddMapCenter() +{ + MapEditor *me=currentMapEditor(); + if (!lineedit->isVisible() && me) + { + me->addMapCenter (); + } +} + void Main::editNewBranch() { MapEditor *me=currentMapEditor(); @@ -2863,9 +2880,9 @@ BranchObj *bo=(BranchObj*)me->getSelection(); BranchObj *newbo=me->addNewBranch(0); - prevSelection=bo->getSelectString(); + prevSelection=me->getModel()->getSelectString(bo); if (newbo) - me->select (newbo->getSelectString()); + me->select (newbo); else return; @@ -2892,14 +2909,14 @@ BranchObj *newbo=me->addNewBranchBefore(); if (newbo) - me->select (newbo->getSelectString()); + me->select (newbo); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=bo->getSelectString(); + prevSelection=me->getModel()->getSelectString(bo); //TODO access directly editHeading(); } } @@ -2914,14 +2931,14 @@ BranchObj *newbo=me->addNewBranch (-1); if (newbo) - me->select (newbo->getSelectString()); + me->select (newbo); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=bo->getSelectString(); + prevSelection=me->getModel()->getSelectString (bo); // TODO access directly editHeading(); } } @@ -2936,14 +2953,14 @@ BranchObj *newbo=me->addNewBranch (1); if (newbo) - me->select (newbo->getSelectString()); + me->select (newbo); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=bo->getSelectString(); + prevSelection=me->getModel()->getSelectString(bo); //TODO access directly editHeading(); } }