diff -r 382a444f5b0c -r a6931cd6309a mainwindow.cpp --- a/mainwindow.cpp Thu May 14 12:42:58 2009 +0000 +++ b/mainwindow.cpp Fri May 15 15:22:15 2009 +0000 @@ -228,6 +228,7 @@ restoreState (settings.value("/mainwindow/state",0).toByteArray()); updateGeometry(); + } Main::~Main() @@ -882,52 +883,6 @@ actionListBranches.append(a); actionDeleteChildren=a; - // Shortcuts for navigating with cursor: - a = new QAction(tr( "Select upper branch","Edit menu" ), this); - a->setStatusTip ( tr( "Select upper branch" )); - a->setShortcut (Qt::Key_Up ); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editUpperBranch() ) ); - a = new QAction( tr( "Select lower branch","Edit menu" ),this); - a->setStatusTip (tr( "Select lower branch" )); - a->setShortcut ( Qt::Key_Down ); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editLowerBranch() ) ); - a = new QAction(tr( "Select left branch","Edit menu" ), this); - a->setStatusTip ( tr( "Select left branch" )); - a->setShortcut (Qt::Key_Left ); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editLeftBranch() ) ); - a = new QAction( tr( "Select child branch","Edit menu" ), this); - a->setStatusTip (tr( "Select right branch" )); - a->setShortcut (Qt::Key_Right); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editRightBranch() ) ); - a = new QAction( tr( "Select first branch","Edit menu" ), this); - a->setStatusTip (tr( "Select first branch" )); - a->setShortcut (Qt::Key_Home ); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - a->setEnabled (false); - editMenu->addAction (a); - actionListBranches.append(a); - actionSelectFirst=a; - connect( a, SIGNAL( triggered() ), this, SLOT( editFirstBranch() ) ); - a = new QAction( tr( "Select last branch","Edit menu" ),this); - a->setStatusTip (tr( "Select last branch" )); - a->setShortcut ( Qt::Key_End ); - a->setShortcutContext (Qt::WindowShortcut); - addAction (a); - connect( a, SIGNAL( triggered() ), this, SLOT( editLastBranch() ) ); - a->setEnabled (false); - editMenu->addAction (a); - actionListBranches.append(a); - actionSelectLast=a; - a = new QAction( tr( "Add Image...","Edit menu" ), this); a->setStatusTip (tr( "Add Image" )); connect( a, SIGNAL( triggered() ), this, SLOT( editLoadImage() ) ); @@ -1766,24 +1721,19 @@ updateActions(); } -VymView *Main::createView (VymModel *model) -{ - VymView *vm=new VymView (model); - return vm; -} - void Main::fileNew() { - VymModel *m=new VymModel; - tabModel.append (m); - //MapEditor* me = new MapEditor (m); - //me->setObjectName ("MapEditor"); - - tabWidget->addTab (createView (m),tr("unnamed","MainWindow: name for new and empty file")); + VymModel *vm=new VymModel; + tabModel.append (vm); + + VymView *vv=new VymView (vm); + tabWidget->addTab (vv,tr("unnamed","MainWindow: name for new and empty file")); tabWidget->setCurrentIndex (tabModel.count() ); + vv->initFocus(); + // For the very first map we do not have flagrows yet... - m->select("mc:"); + vm->select("mc:"); } void Main::fileNewCopy() @@ -1860,10 +1810,12 @@ if ( lmode==NewMap && (!vm || !vm->isDefault() ) ) { vm=new VymModel; + VymView *vv=new VymView (vm); tabModel.append (vm); - tabWidget->addTab (createView (vm),fn); + tabWidget->addTab (vv,fn); tabIndex=tabWidget->count()-1; tabWidget->setCurrentPage (tabIndex); + vv->initFocus(); } // Check, if file exists (important for creating new files @@ -2965,43 +2917,6 @@ m->deleteSelection(); } -void Main::editUpperBranch() -{ - VymModel *m=currentModel(); - if (m) m->selectUpperBranch(); // FIXME-3 check also lower... this probably should go into view... -} - -void Main::editLowerBranch() // FIXME-3 check also lower... this probably should go into view... - -{ - VymModel *m=currentModel(); - if (m) m->selectLowerBranch(); -} - -void Main::editLeftBranch() -{ - VymModel *m=currentModel(); - if (m) m->selectLeftBranch(); -} - -void Main::editRightBranch() -{ - VymModel *m=currentModel(); - if (m) m->selectRightBranch(); -} - -void Main::editFirstBranch() -{ - VymModel *m=currentModel(); - if (m) m->selectFirstBranch(); -} - -void Main::editLastBranch() -{ - VymModel *m=currentModel(); - if (m) m->selectLastBranch(); -} - void Main::editLoadImage() { VymModel *m=currentModel(); @@ -3693,14 +3608,13 @@ void Main::testFunction1() { if (!currentMapEditor()) return; - currentMapEditor()->testFunction1(); - //editAttribute(); + currentMapEditor()->testFunction1(); } void Main::testFunction2() { if (!currentMapEditor()) return; - currentMapEditor()->testFunction2(); + currentMapEditor()->setFocus(); } void Main::testCommand()