diff -r 9ff332964015 -r ff3b01ce0960 vymmodel.cpp --- a/vymmodel.cpp Wed Apr 01 15:06:57 2009 +0000 +++ b/vymmodel.cpp Thu Apr 02 09:46:29 2009 +0000 @@ -670,6 +670,7 @@ void VymModel::addMapInsertInt (const QString &path, int pos) { +/* FIXME-2 addMapInsertInt not ported yet BranchObj *sel=getSelectedBranch(); if (sel) { @@ -702,6 +703,7 @@ } else QMessageBox::critical( 0, tr( "Critical Error" ), tr("Could not read %1").arg(path)); } +*/ } FloatImageObj* VymModel::loadFloatImageInt (QString fn) @@ -817,6 +819,7 @@ void VymModel::importDirInt(BranchObj *dst, QDir d) { +/* FIXME-2 importDirInt not ported yet BranchObj *bo=getSelectedBranch(); if (bo) { @@ -861,6 +864,7 @@ bo->setVymLink (fi.filePath()); } } +*/ } void VymModel::importDirInt (const QString &s) @@ -1470,8 +1474,8 @@ int VymModel::branchCount() // FIXME-2 Optimize this: use internal counter instead of going through whole map each time... { int c=0; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d; next(cur,prev,d); while (cur) @@ -1981,10 +1985,10 @@ select (mco); } -void VymModel::createBranch() -{ - addNewBranchInt (-2); - return; +BranchItem* VymModel::createBranch() // FIXME-2 switcht addNewBrancInt to BranchItem... +{ + BranchObj* bo=addNewBranchInt (-2); + return (BranchItem*)bo->getTreeItem(); } TreeItem* VymModel::createImage() @@ -2735,7 +2739,8 @@ void VymModel::parseAtom(const QString &atom) { BranchObj *selb=getSelectedBranch(); - BranchItem *bi=getSelectedBranchItem(); + TreeItem* selti=getSelectedItem(); + BranchItem *selbi=getSelectedBranchItem(); QString s,t; double x,y; int n; @@ -2749,7 +2754,7 @@ ///////////////////////////////////////////////////////////////////// if (com=="addBranch") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2773,7 +2778,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="addBranchBefore") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2801,7 +2806,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com==QString("addMapReplace")) { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2817,7 +2822,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com==QString("addMapInsert")) { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2836,7 +2841,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="clearFlags") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2850,7 +2855,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="colorBranch") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2864,7 +2869,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="colorSubtree") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2878,7 +2883,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="copy") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2891,7 +2896,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="cut") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -2906,7 +2911,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="delete") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } @@ -2922,7 +2927,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="deleteKeepChildren") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -2935,7 +2940,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="deleteChildren") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3013,7 +3018,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="importDir") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3027,7 +3032,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="linkTo") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if ( selb) @@ -3087,7 +3092,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="loadImage") { - if (selection.isEmpty()) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3101,7 +3106,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveBranchUp") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3114,7 +3119,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveBranchDown") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3127,7 +3132,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="move") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -3147,7 +3152,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="moveRel") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && @@ -3170,7 +3175,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="paste") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3184,7 +3189,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="qa") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3266,15 +3271,15 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="scroll") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); - } else if (! selb ) + } else if (! selbi ) { parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - if (!scrollBranch (bi)) + if (!scrollBranch (selbi)) parser.setError (Aborted,"Could not scroll branch"); } ///////////////////////////////////////////////////////////////////// @@ -3288,7 +3293,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="selectLastBranch") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3296,16 +3301,16 @@ parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - BranchObj *bo=selb->getLastBranch(); - if (!bo) + BranchItem *bi=selbi->getLastBranch(); + if (!bi) parser.setError (Aborted,"Could not select last branch"); - selectInt (bo); + select (bi); // FIXME-3 was selectInt } ///////////////////////////////////////////////////////////////////// } else if (com=="selectLastImage") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3316,7 +3321,7 @@ FloatImageObj *fio=selb->getLastFloatImage(); if (!fio) parser.setError (Aborted,"Could not select last image"); - selectInt (fio); + select (fio); // FIXME-3 was selectInt } ///////////////////////////////////////////////////////////////////// @@ -3409,7 +3414,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setMapBackgroundColor") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! getSelectedBranch() ) @@ -3423,7 +3428,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setMapDefLinkColor") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3445,7 +3450,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHeading") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3460,7 +3465,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHideExport") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (selectionType()!=TreeItem::Branch && selectionType() != TreeItem::MapCenter &&selectionType()!=TreeItem::Image) @@ -3474,7 +3479,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setIncludeImagesHorizontally") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3488,7 +3493,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setIncludeImagesVertically") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb) @@ -3502,7 +3507,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setHideLinkUnselected") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if ( selectionType()!=TreeItem::Branch && selectionType()!= TreeItem::MapCenter && selectionType()!=TreeItem::Image) @@ -3524,7 +3529,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setURL") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3538,7 +3543,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setVymLink") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3553,7 +3558,7 @@ ///////////////////////////////////////////////////////////////////// else if (com=="setFlag") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3571,7 +3576,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="setFrameType") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3586,7 +3591,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="sortChildren") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3599,7 +3604,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="toggleFlag") { - if (selection.isEmpty() ) + if (!selti ) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3617,7 +3622,7 @@ ///////////////////////////////////////////////////////////////////// } else if (com=="unscroll") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -3625,13 +3630,13 @@ parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - if (!unscrollBranch (bi)) + if (!unscrollBranch (selbi)) parser.setError (Aborted,"Could not unscroll branch"); } ///////////////////////////////////////////////////////////////////// } else if (com=="unscrollChildren") { - if (selection.isEmpty() ) + if (!selti) { parser.setError (Aborted,"Nothing selected"); } else if (! selb ) @@ -4021,8 +4026,8 @@ else linkstyle=LinkableMapObj::UndefinedStyle; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; next (cur,prev,d); @@ -4050,8 +4055,8 @@ ); defLinkColor=col; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4067,8 +4072,8 @@ void VymModel::setMapLinkColorHintInt() { // called from setMapLinkColorHint(lch) or at end of parse - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4092,8 +4097,8 @@ linkcolorhint=LinkableMapObj::DefaultColor; else linkcolorhint=LinkableMapObj::HeadingColor; - TreeItem *cur=NULL; - TreeItem *prev=NULL; + BranchItem *cur=NULL; + BranchItem *prev=NULL; int d=0; BranchObj *bo; cur=next(cur,prev,d); @@ -4608,7 +4613,9 @@ emit (contentHasChanged (ix) ); } -void VymModel::selectInt (LinkableMapObj *lmo) + +//void VymModel::selectInt (LinkableMapObj *lmo) // FIXME-3 still needed? +/* { if (selection.select(lmo)) { @@ -4617,6 +4624,15 @@ } } +void VymModel::selectInt (TreeItem *ti) +{ + if (selection.select(lmo)) + { + //selection.update(); + sendSelection (); // FIXME-4 VM use signal + } +} +*/ void VymModel::selectNextBranchInt() {