diff -r d922fb6ea482 -r 6b0a5f4923d3 mainwindow.cpp --- a/mainwindow.cpp Fri Sep 11 12:56:15 2009 +0000 +++ b/mainwindow.cpp Thu Sep 17 09:41:09 2009 +0000 @@ -23,7 +23,7 @@ #include "warningdialog.h" #include "xlinkitem.h" -#include // FIXME-3 +//#include // FIXME-3 #if defined(Q_OS_WIN32) // Define only this structure as opposed to @@ -665,6 +665,13 @@ editMenu->addAction (a); actionMoveDown=a; + a = new QAction(QPixmap(), tr( "&Detach","Context menu" ),this); + a->setStatusTip ( tr( "Detach branch and use as mapcenter","Context menu" ) ); + a->setShortcut ( Qt::Key_D ); // Detach branch + editMenu->addAction (a); + connect( a, SIGNAL( triggered() ), this, SLOT( editDetach() ) ); + actionDetach=a; + a = new QAction( QPixmap(iconPath+"editsort.png" ), tr( "Sort children","Edit menu" ), this ); connect( a, SIGNAL( activated() ), this, SLOT( editSortChildren() ) ); a->setEnabled (true); @@ -1547,6 +1554,7 @@ actionSaveBranch->addTo( branchContextMenu ); actionFileNewCopy->addTo (branchContextMenu ); + actionDetach->addTo (branchContextMenu ); branchContextMenu->addSeparator(); branchContextMenu->addAction ( actionLoadImage); @@ -1710,7 +1718,7 @@ { VymModel *vm=new VymModel; -new ModelTest(vm, this); //FIXME-3 +//new ModelTest(vm, this); //FIXME-3 VymView *vv=new VymView (vm); @@ -2699,6 +2707,7 @@ void Main::editMapInfo() { VymModel *m=currentModel(); + if (!m) return; ExtraInfoDialog dia; dia.setMapName (m->getFileName() ); @@ -2707,27 +2716,27 @@ // Calc some stats QString stats; -/* FIXME-2 no stats at the moment (view dependent...) - stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6); + stats+=tr("%1 items on map\n","Info about map").arg (m->getScene()->items().size(),6); uint b=0; uint f=0; uint n=0; uint xl=0; - BranchObj *bo; - bo=m->first(); - while (bo) + BranchItem *cur=NULL; + BranchItem *prev=NULL; + m->next(cur,prev); + while (cur) { - if (!bo->getNote().isEmpty() ) n++; - f+= bo->countFloatImages(); + if (!cur->getNote().isEmpty() ) n++; + f+= cur->imageCount(); b++; - xl+=bo->countXLinks(); - bo=m->next(bo); + xl+=cur->xlinkCount(); + m->next(cur,prev); } + stats+=QString ("%1 xLinks \n").arg (xl,6); stats+=QString ("%1 notes\n").arg (n,6); stats+=QString ("%1 images\n").arg (f,6); -*/ stats+=QString ("%1 branches\n").arg (m->branchCount(),6); dia.setStats (stats); @@ -2751,6 +2760,12 @@ if (m) m->moveDown(); } +void Main::editDetach() +{ + VymModel *m=currentModel(); + if (m) m->detach(); +} + void Main::editSortChildren() { VymModel *m=currentModel(); @@ -3591,6 +3606,11 @@ { if (!currentMapEditor()) return; currentMapEditor()->testFunction1(); + /* + VymModel *m=currentModel(); + if (!m) return; + m->clearItem (m->getSelectedItem()); + */ } void Main::testFunction2()