1.1 --- a/mainwindow.cpp Tue Apr 08 08:28:37 2008 +0000
1.2 +++ b/mainwindow.cpp Tue Apr 08 08:28:37 2008 +0000
1.3 @@ -527,6 +527,12 @@
1.4 connect( a, SIGNAL( triggered() ), this, SLOT( editDeleteSelection() ) );
1.5 actionEditDelete=a;
1.6
1.7 + // Shortcut to add mapcenter
1.8 + a= new QAction(tr( "Add mapcenter","Canvas context menu" ), this);
1.9 + connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) );
1.10 + actionEditAddMapCenter = a;
1.11 +
1.12 +
1.13 // Shortcut to add branch
1.14 alt = new QAction(QPixmap(iconPath+"newbranch.png"), tr( "Add branch as child","Edit menu" ), this);
1.15 alt->setStatusTip ( tr( "Add a branch as child of selection" ));
1.16 @@ -1592,6 +1598,8 @@
1.17 // Context menu for canvas
1.18 canvasContextMenu =new QMenu (this);
1.19 actionEditMapInfo->addTo( canvasContextMenu );
1.20 + if (settings.value( "/mainwindow/showTestMenu",false).toBool() )
1.21 + actionEditAddMapCenter->addTo( canvasContextMenu );
1.22 canvasContextMenu->insertSeparator();
1.23 actionGroupFormatLinkStyles->addTo( canvasContextMenu );
1.24 canvasContextMenu->insertSeparator();
1.25 @@ -2855,6 +2863,15 @@
1.26 currentMapEditor()->unscrollChilds();
1.27 }
1.28
1.29 +void Main::editAddMapCenter()
1.30 +{
1.31 + MapEditor *me=currentMapEditor();
1.32 + if (!lineedit->isVisible() && me)
1.33 + {
1.34 + me->addMapCenter ();
1.35 + }
1.36 +}
1.37 +
1.38 void Main::editNewBranch()
1.39 {
1.40 MapEditor *me=currentMapEditor();
1.41 @@ -2863,9 +2880,9 @@
1.42 BranchObj *bo=(BranchObj*)me->getSelection();
1.43 BranchObj *newbo=me->addNewBranch(0);
1.44
1.45 - prevSelection=bo->getSelectString();
1.46 + prevSelection=me->getModel()->getSelectString(bo);
1.47 if (newbo)
1.48 - me->select (newbo->getSelectString());
1.49 + me->select (newbo);
1.50 else
1.51 return;
1.52
1.53 @@ -2892,14 +2909,14 @@
1.54 BranchObj *newbo=me->addNewBranchBefore();
1.55
1.56 if (newbo)
1.57 - me->select (newbo->getSelectString());
1.58 + me->select (newbo);
1.59 else
1.60 return;
1.61
1.62 if (actionSettingsAutoEditNewBranch->isOn())
1.63 {
1.64 if (!actionSettingsAutoSelectNewBranch->isOn())
1.65 - prevSelection=bo->getSelectString();
1.66 + prevSelection=me->getModel()->getSelectString(bo); //TODO access directly
1.67 editHeading();
1.68 }
1.69 }
1.70 @@ -2914,14 +2931,14 @@
1.71 BranchObj *newbo=me->addNewBranch (-1);
1.72
1.73 if (newbo)
1.74 - me->select (newbo->getSelectString());
1.75 + me->select (newbo);
1.76 else
1.77 return;
1.78
1.79 if (actionSettingsAutoEditNewBranch->isOn())
1.80 {
1.81 if (!actionSettingsAutoSelectNewBranch->isOn())
1.82 - prevSelection=bo->getSelectString();
1.83 + prevSelection=me->getModel()->getSelectString (bo); // TODO access directly
1.84 editHeading();
1.85 }
1.86 }
1.87 @@ -2936,14 +2953,14 @@
1.88 BranchObj *newbo=me->addNewBranch (1);
1.89
1.90 if (newbo)
1.91 - me->select (newbo->getSelectString());
1.92 + me->select (newbo);
1.93 else
1.94 return;
1.95
1.96 if (actionSettingsAutoEditNewBranch->isOn())
1.97 {
1.98 if (!actionSettingsAutoSelectNewBranch->isOn())
1.99 - prevSelection=bo->getSelectString();
1.100 + prevSelection=me->getModel()->getSelectString(bo); //TODO access directly
1.101 editHeading();
1.102 }
1.103 }