diff -r 914f330b6aa8 -r 25a77484ec72 mainwindow.cpp --- a/mainwindow.cpp Thu Apr 02 09:57:47 2009 +0000 +++ b/mainwindow.cpp Tue Apr 07 16:15:53 2009 +0000 @@ -541,7 +541,7 @@ editMenu->addAction (a); actionPaste=a; -/* +/* FIXME-5 // Shortcuts to modify heading: a = new QAction(tr( "Edit heading","Edit menu" ),this); a->setStatusTip ( tr( "edit Heading" )); @@ -579,8 +579,12 @@ actionDelete=a; // Shortcut to add mapcenter - a= new QAction(tr( "Add mapcenter","Canvas context menu" ), this); + a= new QAction(QPixmap(iconPath+"newmapcenter.png"),tr( "Add mapcenter","Canvas context menu" ), this); + a->setShortcut ( Qt::Key_M); + a->setShortcutContext (Qt::WindowShortcut); connect( a, SIGNAL( triggered() ), this, SLOT( editAddMapCenter() ) ); + //actionListBranches.append(a); + tb->addAction (a); actionAddMapCenter = a; @@ -1590,6 +1594,7 @@ // Submenu "Add" branchAddContextMenu =branchContextMenu->addMenu (tr("Add")); branchAddContextMenu->addAction (actionPaste ); + branchAddContextMenu->addAction ( actionAddMapCenter ); branchAddContextMenu->addAction ( actionAddBranch ); branchAddContextMenu->addAction ( actionAddBranchBefore ); branchAddContextMenu->addAction ( actionAddBranchAbove); @@ -1660,8 +1665,7 @@ // Context menu for canvas canvasContextMenu =new QMenu (this); - if (settings.value( "/mainwindow/showTestMenu",false).toBool() ) - actionAddMapCenter->addTo( canvasContextMenu ); + actionAddMapCenter->addTo( canvasContextMenu ); actionMapInfo->addTo( canvasContextMenu ); canvasContextMenu->insertSeparator(); actionGroupFormatLinkStyles->addTo( canvasContextMenu ); @@ -2496,10 +2500,10 @@ if (m) { bool cs=false; - BranchObj *bo=m->findText(s, cs); - if (bo) + BranchItem *bi=m->findText(s, cs); + if (bi) { - statusBar()->message( "Found: " + bo->getHeading(), statusbarTime ); + statusBar()->message( "Found: " + bi->getHeading(), statusbarTime ); } else { QMessageBox::information( findWindow, tr( "VYM -Information:" ), @@ -2935,6 +2939,7 @@ VymModel *m=currentModel(); if (m) { + cout <<"Main::editAddMapCenter\n"; m->addMapCenter (); } } @@ -2944,12 +2949,10 @@ VymModel *m=currentModel(); if (m) { - BranchObj *bo=m->getSelectedBranch(); - prevSelection=m->getSelectString(bo); - BranchObj *newbo=m->addNewBranch(0); - - if (newbo) - m->select (newbo); + BranchItem *bi=m->createBranch(); + + if (bi) + m->select (bi); else return; @@ -2971,18 +2974,17 @@ VymModel *m=currentModel(); if (m) { - BranchObj *bo=m->getSelectedBranch(); - BranchObj *newbo=m->addNewBranchBefore(); - - if (newbo) - m->select (newbo); + BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranchBefore(); + + if (bi) + m->select (bi); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=m->getSelectString(bo); + prevSelection=m->getSelectString(bi); currentMapEditor()->editHeading(); } } @@ -2993,18 +2995,18 @@ VymModel *m=currentModel(); if ( m) { - BranchObj *bo=m->getSelectedBranch(); - BranchObj *newbo=m->addNewBranch (-1); - - if (newbo) - m->select (newbo); + BranchItem *bi=m->createBranch(); //FIXME-1 missing: m->addNewBranch (-1); + + + if (bi) + m->select (bi); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=m->getSelectString (bo); + prevSelection=m->getSelectString (bi); currentMapEditor()->editHeading(); } } @@ -3015,18 +3017,17 @@ VymModel *m=currentModel(); if (m) { - BranchObj *bo=m->getSelectedBranch(); - BranchObj *newbo=m->addNewBranch (1); - - if (newbo) - m->select (newbo); + BranchItem *bi=m->createBranch();//FIXME-1 *newbo=m->addNewBranch (1); + + if (bi) + m->select (bi); else return; if (actionSettingsAutoEditNewBranch->isOn()) { if (!actionSettingsAutoSelectNewBranch->isOn()) - prevSelection=m->getSelectString(bo); + prevSelection=m->getSelectString(bi); currentMapEditor()->editHeading(); } } @@ -3474,9 +3475,9 @@ } */ -void Main::updateContent (QModelIndex index ) +void Main::updateNoteEditor(QModelIndex index ) { - cout << "Main::updateContent model="<setNote (ti->getNoteObj() ); @@ -3510,14 +3511,15 @@ textEditor->setInactive(); } - // Show URL and link in statusbar + // Show URL and link in statusbar // FIXME-2 + /* QString status; QString s=model->getURL(); if (!s.isEmpty() ) status+="URL: "+s+" "; s=model->getVymLink(); if (!s.isEmpty() ) status+="Link: "+s; if (!status.isEmpty() ) statusMessage (status); - +*/ // Update Toolbar // FIXME-1, was so far in BranchObj //updateFlagsToolbar(); @@ -3604,13 +3606,12 @@ else actionRedo->setEnabled( false); - if (selection) + TreeItem *selti=m->getSelectedItem(); + BranchItem *selbi=m->getSelectedBranchItem(); + if (selti) { - if ( (typeid(*selection) == typeid(BranchObj)) || - (typeid(*selection) == typeid(MapCenterObj)) ) + if (selbi) { - BranchItem *bi=(BranchItem*)(selection->getTreeItem() ); - BranchObj *bo=(BranchObj*)selection; // Take care of links // FIXME-1 /* if (bo->countXLinks()==0) @@ -3641,12 +3642,12 @@ standardFlagsDefault->setEnabled (true); actionToggleScroll->setEnabled (true); - if ( bi->isScrolled() ) + if ( selbi->isScrolled() ) actionToggleScroll->setOn(true); else actionToggleScroll->setOn(false); - if ( bo->getURL().isEmpty() ) +/* FIXME-1 if ( selti->getURL().isEmpty() ) { actionOpenURL->setEnabled (false); actionOpenURLTab->setEnabled (false); @@ -3656,7 +3657,7 @@ actionOpenURL->setEnabled (true); actionOpenURLTab->setEnabled (true); } - if ( bo->getVymLink().isEmpty() ) + if ( selti->getVymLink().isEmpty() ) { actionOpenVymLink->setEnabled (false); actionDeleteVymLink->setEnabled (false); @@ -3665,20 +3666,20 @@ actionOpenVymLink->setEnabled (true); actionDeleteVymLink->setEnabled (true); } - - if (bo->canMoveBranchUp()) +*/ +/* FIXME-1 if (selbi->canMoveBranchUp()) actionMoveUp->setEnabled (true); else actionMoveUp->setEnabled (false); - if (bo->canMoveBranchDown()) + if (selbi->canMoveBranchDown()) actionMoveDown->setEnabled (true); else actionMoveDown->setEnabled (false); - +*/ actionSortChildren->setEnabled (true); actionToggleHideExport->setEnabled (true); - actionToggleHideExport->setOn (bo->hideInExport() ); + actionToggleHideExport->setOn (selbi->hideInExport() ); actionFileSave->setEnabled (true); actionCopy->setEnabled (true); @@ -3693,8 +3694,9 @@ actionFormatHideLinkUnselected->setOn (selection->getHideLinkUnselected()); } - if ( (typeid(*selection) == typeid(FloatImageObj)) ) + if ( selti->getType()==TreeItem::Image) { + /* FIXME-2 FloatObj *fo=(FloatImageObj*)selection; actionOpenURL->setEnabled (false); @@ -3714,6 +3716,7 @@ ( selection->getHideLinkUnselected()); actionMoveUp->setEnabled (false); actionMoveDown->setEnabled (false); + */ } } else