# HG changeset patch # User insilmaril # Date 1238053757 0 # Node ID ee6b0f3a4c2f51b7d983bf70d673d818a37bebc5 # Parent 2d4cc445a86aa893a25ff1bb1bc7d7cbb785ab89 Notes work again (to some degree) diff -r 2d4cc445a86a -r ee6b0f3a4c2f attributedialog.cpp --- a/attributedialog.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/attributedialog.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -88,7 +88,7 @@ { aw=new AttributeWidget (this); aw->setKey (keyList.at(i) ); - // FIXME aw->setValues (table->getValues (keyList.at(i) )); + // FIXME-3 aw->setValues (table->getValues (keyList.at(i) )); aw->show(); tableLayout->addWidget (aw); } diff -r 2d4cc445a86a -r ee6b0f3a4c2f branchobj.cpp --- a/branchobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/branchobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -17,11 +17,7 @@ // BranchObj ///////////////////////////////////////////////////////////////// -BranchObj* BranchObj::itLast=NULL; -BranchObj* BranchObj::itFirst=NULL; - - -BranchObj::BranchObj () :OrnamentedObj() // FIXME needed at all? +BranchObj::BranchObj () :OrnamentedObj() // FIXME-3 needed at all? { // cout << "Const BranchObj ()\n"; setParObj (this); @@ -392,155 +388,6 @@ branch.at(i)->setColorSubtree(col); } -BranchObj* BranchObj::first() -{ - itLast=NULL; - itFirst=this; - return this; -} - -BranchObj* BranchObj::next() -{ - BranchObj *bo; - BranchObj *lmo; - BranchObj *po=(BranchObj*)parObj; - - if (branch.isEmpty()) - bo=NULL; - else - bo=branch.first(); - - if (!itLast) - { - // no itLast, we are just beginning - if (bo) - { - // we have children, return first one - itLast=this; - return bo; - } - else - { - // No children, so there is no next - itLast=this; - return NULL; - } - } - - // We have an itLast - if (itLast==po) - { // We come from parent - if (bo) - { - // there are children, go there - itLast=this; - return bo; - } - else - { // no children, try to go up again - if (po) - { - // go back to parent and try to find next there - itLast=this; - lmo=po->next(); - itLast=this; - return lmo; - - } - else - { - // can't go up, I am mapCenter, no next - itLast=NULL; - return NULL; - } - } - } - - // We don't come from parent, but from brother or children - - // Try to find last child, where we came from, in my own children - bool searching=true; - int i=0; - while (inext(); - itLast=this; - return lmo; - } - else - { - // can't go up, I am mapCenter - itLast=NULL; - return NULL; - } - } - } - - // couldn't find last child, it must be a nephew of mine - if (branch.size()>0) - { - // proceed with my first child - itLast=this; - return branch.first(); - } - else - { - // or go back to my parents - if (po) - { - // go up - itLast=this; - lmo=po->next(); - itLast=this; - return lmo; - } - else - { - // can't go up, I am mapCenter - itLast=NULL; - return NULL; - } - } -} - -BranchObj* BranchObj::getLastIterator() -{ - return itLast; -} - -void BranchObj::setLastIterator(BranchObj* it) -{ - itLast=it; -} - void BranchObj::positionContents() { for (int i=0; isaveToDir (tmpdir,prefix); // save note - if (!note.isEmpty() ) - s+=note.saveToDir(); + if (!treeItem->getNoteObj().isEmpty() ) + s+=treeItem->getNoteObj().saveToDir(); // Save branches for (int i=0; idepth=depth+1; bo->setDefAttr(MovedBranch); if (scrolled) tmpUnscroll(); - //setLastSelectedBranch (bo); //FIXME needed? + //setLastSelectedBranch (bo); //FIXME-3 needed? return bo; } @@ -1112,7 +959,7 @@ bo->depth=depth+1; bo->setDefAttr (MovedBranch); if (scrolled) tmpUnscroll(); - //setLastSelectedBranch (bo); //FIXME needed? + //setLastSelectedBranch (bo); //FIXME-3 needed? qSort (branch.begin(),branch.end(), isAbove); return bo; } @@ -1535,28 +1382,27 @@ bboxTotal.setHeight(max (r.height(), bbox.height())); } -void BranchObj::select() // FIXME try to get rid of this in BO completely +void BranchObj::select() // FIXME-2 try to get rid of this in BO completely { cout << "BO::select()\n"; - // update NoteEditor FIXME do this via VymView::changeSelection - textEditor->setText(note.getNote() ); - QString fnh=note.getFilenameHint(); + textEditor->setText(treeItem->getNoteObj().getNote() ); + QString fnh=treeItem->getNoteObj().getFilenameHint(); if (fnh!="") - textEditor->setFilenameHint(note.getFilenameHint() ); + textEditor->setFilenameHint(treeItem->getNoteObj().getFilenameHint() ); else textEditor->setFilenameHint(getHeading() ); - textEditor->setFontHint (note.getFontHint() ); - isNoteInEditor=true; + textEditor->setFontHint (treeItem->getNoteObj().getFontHint() ); + //isNoteInEditor=true; // set selected and visible LinkableMapObj::select(); - //if (po) po->setLastSelectedBranch(this); FIXME needed? + //if (po) po->setLastSelectedBranch(this); needed? // temporary unscroll, if we have scrolled parents somewhere if (parObj) ((BranchObj*)(parObj))->tmpUnscroll(); - /* FIXME moved to vymmodel or vymview... + /* moved to vymmodel or vymview... // Show URL and link in statusbar QString status; if (!url.isEmpty()) status+="URL: "+url+" "; @@ -1571,15 +1417,17 @@ */ } -void BranchObj::unselect() +void BranchObj::unselect() //FIXME-3 should not be needed { LinkableMapObj::unselect(); // Delete any messages like vymLink in StatusBar - mainWindow->statusMessage (""); //FIXME this causes segfault, when MainWindow is already gone in global destructor on quitting vym + mainWindow->statusMessage (""); //this causes segfault, when MainWindow is already gone in global destructor on quitting vym +/* // Save current note if (isNoteInEditor) getNoteFromTextEditor(); isNoteInEditor=false; +*/ // reset temporary unscroll, if we have scrolled parents somewhere if (parObj) ((BranchObj*)(parObj))->resetTmpUnscroll(); diff -r 2d4cc445a86a -r ee6b0f3a4c2f branchobj.h --- a/branchobj.h Mon Mar 23 09:06:51 2009 +0000 +++ b/branchobj.h Thu Mar 26 07:49:17 2009 +0000 @@ -52,11 +52,6 @@ virtual void setLinkColor(); // set the color of link virtual void setColorSubtree(QColor); // set the color of heading - BranchObj* first (); // set Iterator to first LMO - BranchObj* next (); // find next LMO after given one - BranchObj* getLastIterator(); // to interrupt and resume next iteration - void setLastIterator (BranchObj*); // needed by next() - virtual void positionContents(); virtual void move (double x,double y); virtual void move (QPointF); diff -r 2d4cc445a86a -r ee6b0f3a4c2f branchpropwindow.cpp --- a/branchpropwindow.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/branchpropwindow.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -44,7 +44,7 @@ else hide(); - // FIXME for now remove attribute tab + // FIXME-2 for now remove attribute tab ui.tabWidget->removeTab (3); } @@ -126,7 +126,7 @@ attributeModel->removeRows(0, attributeModel->rowCount(), QModelIndex()); /* - // FIXME some samples for attribute testing + // FIXME-3 some samples for attribute testing QStringList attrTypes=mapEditor->attributeTable()->getTypes(); for (int i=0; igetNote().isEmpty()) + if (!cur->getNoteObj().isEmpty()) { curIndent +=" | "; - s=bo->getNoteASCII( curIndent, 80); + s=cur->getNoteASCII( curIndent, 80); ts << s; } } @@ -240,9 +240,9 @@ if (!bo->hasHiddenExportParent() ) { // If necessary, write note - if (!bo->getNote().isEmpty()) + if (!cur->getNoteObj().isEmpty()) { - s =bo->getNoteASCII(); + s =cur->getNoteASCII(); s=s.replace ("\n","\n"+curIndent); ts << ("\""+s+"\","); } else @@ -419,8 +419,8 @@ } // If necessary, write note - if (!bo->getNote().isEmpty()) { - ts << (bo->getNoteASCII()); + if (!cur->getNoteObj().isEmpty()) { + ts << (cur->getNoteASCII()); ts << ("\n"); } } @@ -446,6 +446,7 @@ uint i=0; bo=current->getFirstBranch(); + TreeItem *ti=bo->getTreeItem(); if (bo) { if (!bo->hasHiddenExportParent() ) @@ -457,8 +458,8 @@ r+=""; r+=quotemeta(bo->getHeading()); // If necessary, write note - if (!bo->getNote().isEmpty()) - r+=bo->getNoteOpenDoc(); + if (!ti->getNoteObj().isEmpty()) + r+=ti->getNoteOpenDoc(); r+=""; r+=buildList (bo); // recursivly add deeper branches r+="\n"; @@ -476,7 +477,7 @@ { QString allPages; -/* FIXME not adapted to multiple mapCenters yet +/* FIXME-2 not adapted to multiple mapCenters yet, see patch already done in 1.12.2... // Insert new content content.replace ("",quotemeta(mapCenter->getHeading())); content.replace ("",quotemeta(mapCenter->getAuthor())); diff -r 2d4cc445a86a -r ee6b0f3a4c2f flagrowobj.cpp --- a/flagrowobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/flagrowobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -295,7 +295,7 @@ name=n; } -void FlagRowObj::updateToolbar() //FIXME this needs to be changed with VM +void FlagRowObj::updateToolbar() //FIXME-2 this needs to be changed with VM { if (parentRow) { diff -r 2d4cc445a86a -r ee6b0f3a4c2f floatimageobj.cpp --- a/floatimageobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/floatimageobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -225,21 +225,3 @@ //TODO abstract in linkablemapobj.h } -/* -QString FloatImageObj::getSelectString() //FIXME move to selection -{ - QString s; - if (parObj) - { - if (parObj->getDepth()==0) - s= "fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this)); - else - s= ((BranchObj*)(parObj))->getSelectString() + ",fi:" + QString("%1").arg( ((BranchObj*)(parObj))->getFloatImageNum(this)); - } else - s="mc:"; - - return s; - -} -*/ - diff -r 2d4cc445a86a -r ee6b0f3a4c2f linkablemapobj.cpp --- a/linkablemapobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/linkablemapobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -150,11 +150,11 @@ model=parObj->getModel(); } -void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int) // FIXME make pure virtual +void LinkableMapObj::setParObjTmp(LinkableMapObj*,QPointF,int) // FIXME-3 make pure virtual { } -void LinkableMapObj::unsetParObjTmp() // FIXME make pure virtual +void LinkableMapObj::unsetParObjTmp() // FIXME-3 make pure virtual { } @@ -247,7 +247,7 @@ void LinkableMapObj::setLinkStyle(Style newstyle) { - //if (newstyle=style) return; FIXME + //if (newstyle=style) return; FIXME-3 delLink(); style=newstyle; @@ -406,11 +406,11 @@ segment.at(i)->show(); break; case PolyLine: - if (!p) cout << "LMO::setVis p==0 (PolyLine)\n"; //FIXME + if (!p) cout << "LMO::setVis p==0 (PolyLine)\n"; //FIXME-3 if (p) p->show(); break; case PolyParabel: - if (!p) cout << "LMO::setVis p==0 (PolyParabel) "<<((BranchObj*)this)->getHeading().toStdString()<getHeading().toStdString()<show(); break; default: diff -r 2d4cc445a86a -r ee6b0f3a4c2f mainwindow.cpp --- a/mainwindow.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/mainwindow.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -122,7 +122,6 @@ procBrowser=NULL; // Satellite windows ////////////////////////////////////////// - // history window historyWindow=new HistoryWindow(); connect (historyWindow, SIGNAL (windowClosed() ), this, SLOT (updateActions())); @@ -1669,7 +1668,7 @@ actionFormatLinkColor->addTo( canvasContextMenu ); actionFormatSelectionColor->addTo( canvasContextMenu ); actionFormatBackColor->addTo( canvasContextMenu ); - // actionFormatBackImage->addTo( canvasContextMenu ); //FIXME makes vym too slow: postponed for later version + // actionFormatBackImage->addTo( canvasContextMenu ); //FIXME-4 makes vym too slow: postponed for later version // Menu for last opened files // Create actions @@ -1902,7 +1901,7 @@ //tabWidget->currentPage() won't be NULL here, because of above... tabWidget->setCurrentIndex (tabIndex); - //FIXME no me anymore... me->viewport()->setFocus(); + //FIXME-3 no me anymore... me->viewport()->setFocus(); if (err!=aborted) { @@ -2018,7 +2017,7 @@ // call fileSaveAs() now, this will call fileSave() // again. // First switch to editor - //FIXME needed??? tabWidget->setCurrentWidget (m->getMapEditor()); + //FIXME-3 needed??? tabWidget->setCurrentWidget (m->getMapEditor()); fileSaveAs(savemode); } @@ -2247,7 +2246,7 @@ if (m) m->exportASCII(); } -void Main::fileExportCSV() //FIXME not scriptable yet +void Main::fileExportCSV() //FIXME-2 not scriptable yet { VymModel *m=currentModel(); if (m) @@ -2266,7 +2265,7 @@ } } -void Main::fileExportLaTeX() //FIXME not scriptable yet +void Main::fileExportLaTeX() //FIXME-2 not scriptable yet { VymModel *m=currentModel(); if (m) @@ -2285,7 +2284,7 @@ } } -void Main::fileExportKDE3Bookmarks() //FIXME not scriptable yet +void Main::fileExportKDE3Bookmarks() //FIXME-2 not scriptable yet { ExportKDE3Bookmarks ex; VymModel *m=currentModel(); @@ -2296,7 +2295,7 @@ } } -void Main::fileExportKDE4Bookmarks() //FIXME not scriptable yet +void Main::fileExportKDE4Bookmarks() //FIXME-2 not scriptable yet { ExportKDE4Bookmarks ex; VymModel *m=currentModel(); @@ -2307,7 +2306,7 @@ } } -void Main::fileExportTaskjuggler() //FIXME not scriptable yet +void Main::fileExportTaskjuggler() //FIXME-2 not scriptable yet { ExportTaskjuggler ex; VymModel *m=currentModel(); @@ -2326,7 +2325,7 @@ } } -void Main::fileExportOOPresentation() //FIXME not scriptable yet +void Main::fileExportOOPresentation() //FIXME-2 not scriptable yet { ExportOOFileDialog *fd=new ExportOOFileDialog( this,vymName+" - "+tr("Export to")+" Open Office"); // TODO add preview in dialog @@ -2395,7 +2394,7 @@ // Better would be delete (me), but then we could have a Qt error: // "QObject: Do not delete object, 'MapEditor', during its event handler!" // So we only remove data now and call deconstructor when vym closes later - // FIXME this needs to be moved to vymview... me->clear(); + // FIXME-3 this needs to be moved to vymview... me->clear(); // some model->clear is needed to free up memory ... updateActions(); @@ -2867,7 +2866,7 @@ // Calc some stats QString stats; -/* FIXME no stats at the moment (view dependent...) +/* FIXME-2 no stats at the moment (view dependent...) stats+=tr("%1 items on map\n","Info about map").arg (mapScene->items().size(),6); uint b=0; @@ -3243,7 +3242,7 @@ } -void Main::formatHideLinkUnselected() //FIXME get rid of this with imagepropertydialog +void Main::formatHideLinkUnselected() //FIXME-3 get rid of this with imagepropertydialog { VymModel *m=currentModel(); if (m) @@ -3455,7 +3454,7 @@ historyWindow->update (undoSet); } -void Main::updateNoteFlag() +void Main::updateNoteFlag() { // this slot is connected to TextEditor::textHasChanged() @@ -3463,9 +3462,66 @@ if (m) m->updateNoteFlag(); } -void Main::updateSatellites(VymModel* model) +/* +void Main::updateNoteInEditor (VymModel *model, const NoteObj ¬e) { - branchPropertyWindow->setModel (model ); + if (model&& model==currentModel() ) + { + textEditor->setNote (note); + } +} +*/ + +void Main::updateContent (QModelIndex index ) +{ + cout << "Main::updateContent model="<getItem(index); + cout << " item="<getHeading().toStdString()<<" ("<setNote (ti->getNoteObj() ); +} + +void Main::changeSelection (VymModel *model, const QItemSelection &newsel, const QItemSelection &oldsel) +{ + //branchPropertyWindow->setModel (model ); //FIXME-1 this used to be called from BranchObj::select() + if (model && model==currentModel() ) + { + // NoteEditor + TreeItem *ti; + if (!oldsel.indexes().isEmpty() ) + { + ti=model->getItem(oldsel.indexes().first()); + //cout << "Main::changeSel getting note from "<getHeading().toStdString()<<": \""<getNote().toStdString()<<"\""<setNoteObj (textEditor->getNoteObj(),false ); + } + if (!newsel.indexes().isEmpty() ) + { + ti=model->getItem(newsel.indexes().first()); + if (!ti->getNoteObj().isEmpty() ) + { + //cout << "Main::changeSel setting note of "<getHeading().toStdString()<<" m=("<getModel()<<") to \""<getNote().toStdString()<<"\""<setNote(ti->getNoteObj() ); + } else + textEditor->setNote(NoteObj() ); + } else + { + textEditor->setInactive(); + } + + // Show URL and link in statusbar + 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(); + + // Update actions + updateActions(); + } } void Main::updateActions() diff -r 2d4cc445a86a -r ee6b0f3a4c2f mainwindow.h --- a/mainwindow.h Mon Mar 23 09:06:51 2009 +0000 +++ b/mainwindow.h Thu Mar 26 07:49:17 2009 +0000 @@ -215,7 +215,10 @@ public slots: void windowToggleSmoothPixmap(); void updateNoteFlag(); - void updateSatellites(VymModel*); +// void updateNoteInEditor (VymModel *model, const NoteObj ¬e); + void updateContent (QModelIndex index); + void changeSelection (VymModel *model,const QItemSelection &newSel, const QItemSelection &delSel); + void updateActions(); ModMode getModMode(); bool autoEditNewBranch(); diff -r 2d4cc445a86a -r ee6b0f3a4c2f mapcenterobj.cpp --- a/mapcenterobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/mapcenterobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -175,11 +175,11 @@ s+=frame->saveToDir (); // Update of note is usually done while unselecting a branch - if (isNoteInEditor) getNoteFromTextEditor(); + //if (isNoteInEditor) getNoteFromTextEditor(); FIXME-3 // save note - if (!note.isEmpty() ) - s+=note.saveToDir(); + if (!treeItem->getNoteObj().isEmpty() ) + s+=treeItem->getNoteObj().saveToDir(); // Save branches for (int i=0; isetScene (mapScene); model->registerEditor(this); -// model->addMapCenter(); // FIXME create this in MapEditor until BO and MCO are independent of scene +// model->addMapCenter(); // FIXME-3 create this in MapEditor until BO and MCO are independent of scene model->makeDefault(); // No changes in model so far setScene (mapScene); @@ -70,7 +70,7 @@ setAcceptDrops (true); - //model->reposition(); //FIXME really still needed? + //model->reposition(); //FIXME-3 really still needed? // Action to embed LineEdit for heading in Scene @@ -93,7 +93,7 @@ selectionColor =QColor (255,255,0); - // Attributes //FIXME testing only... + // Attributes //FIXME-2 testing only... QString k; AttributeDef *ad; attrTable= new AttributeTable(); @@ -128,7 +128,7 @@ MapEditor::~MapEditor() { - cout <<"Destructor MapEditor for "<getMapName().toStdString()<getMapName().toStdString()<width(),15); - // FIXME fileName not any longer available here: pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName); + // FIXME-3 fileName not any longer available here: pp.drawText ( footerBox,Qt::AlignLeft,"VYM - " +fileName); pp.drawText ( footerBox, Qt::AlignRight, QDate::currentDate().toString(Qt::TextDate)); } mapScene->render ( @@ -414,21 +414,21 @@ if (model->getSelectedBranch() ) { // Context Menu on branch or mapcenter - //FIXME model->updateActions(); needed? + //FIXME-3 model->updateActions(); needed? branchContextMenu->popup(e->globalPos() ); } else { if (model->getSelectedFloatImage() ) { // Context Menu on floatimage - // model->updateActions(); FIXME needed? + // model->updateActions(); FIXME-3 needed? floatimageContextMenu->popup(e->globalPos() ); } } } else { // No MapObj found, we are on the Canvas itself // Context Menu on scene - // model->updateActions(); FIXME needed? + // model->updateActions(); FIXME-3 needed? // Open context menu synchronously to position new mapcenter model->setContextPos (p); @@ -513,7 +513,7 @@ mainWindow->windowToggleNoteEditor(); else if (foname=="hideInExport") model->toggleHideExport(); - // FIXME needed? xelection.update(); + // FIXME-3 needed? xelection.update(); return; } } @@ -558,7 +558,7 @@ */ // Select the clicked object - // FIXME VM better let "find" return an index instead of lmo... + // FIXME-2 VM better let "find" return an index instead of lmo... // Get index of clicked LMO TreeItem *ti=lmo->getTreeItem(); /* @@ -603,8 +603,8 @@ // a button in the toolbar) if (e->button() == Qt::MidButton ) model->toggleScroll(); - // model->updateActions(); FIXME needed? - // FIXME needed? xelection.update(); + // model->updateActions(); FIXME-3 needed? + // FIXME-3 needed? xelection.update(); } else { // No MapObj found, we are on the scene itself // Left Button move Pos of sceneView @@ -799,7 +799,7 @@ { tmpXLink->setEnd ( ((BranchObj*)(dst)) ); tmpXLink->updateXLink(); - tmpXLink->activate(); //FIXME savestate missing + tmpXLink->activate(); //FIXME-2 savestate missing //model->saveStateComplete(QString("Activate xLink from %1 to %2").arg(model->getObjectName(tmpXLink->getBegin())).arg(model->getObjectName(tmpXLink->getEnd())) ); } else { @@ -947,13 +947,13 @@ model->reposition(); } } - model->updateSelection(); //FIXME needed? at least not after pos of selection has changed... + model->updateSelection(); //FIXME-3 needed? at least not after pos of selection has changed... // Finally resize scene, if needed scene()->update(); movingObj=NULL; // Just make sure, that actions are still ok,e.g. the move branch up/down buttons... - // model->updateActions(); FIXME neeeded? + // model->updateActions(); FIXME-3 neeeded? } else // maybe we moved View: set old cursor setCursor (Qt::ArrowCursor); @@ -1108,10 +1108,10 @@ } } -void MapEditor::updateCurrent (const QModelIndex &,const QModelIndex &) //FIXME not used? +void MapEditor::updateCurrent (const QModelIndex &,const QModelIndex &) //FIXME-3 not used? { -/* FIXME testing +/* testing cout << "ME::updateCurrent\n"; diff -r 2d4cc445a86a -r ee6b0f3a4c2f noteobj.cpp --- a/noteobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/noteobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -20,11 +20,16 @@ note=s; } +void NoteObj::operator= (const NoteObj &other) +{ + copy (other); +} + void NoteObj::copy (NoteObj other) { note=other.note; fonthint=other.fonthint; - filenamehint=""; + filenamehint=other.filenamehint; } void NoteObj::clear() @@ -39,7 +44,7 @@ note=s; } -QString NoteObj::getNote() +QString NoteObj::getNote() const { return note; } @@ -51,7 +56,7 @@ QString NoteObj::getNoteASCII(const QString &indent, const int &width) { - // FIXME make use of width + // FIXME-3 make use of width QString r=note; // Remove all ... @@ -90,7 +95,7 @@ r.replace (rx,indent); r=indent + r; // Don't forget first line -/* FIXME wrap text at width +/* FIXME-2 wrap text at width if (fonthint !="fixed") { } @@ -143,7 +148,7 @@ fonthint=s; } -QString NoteObj::getFontHint() +QString NoteObj::getFontHint() const { // only for backward compatibility (pre 1.5 ) return fonthint; @@ -154,7 +159,7 @@ filenamehint=s; } -QString NoteObj::getFilenameHint() +QString NoteObj::getFilenameHint() const { return filenamehint; } diff -r 2d4cc445a86a -r ee6b0f3a4c2f noteobj.h --- a/noteobj.h Mon Mar 23 09:06:51 2009 +0000 +++ b/noteobj.h Thu Mar 26 07:49:17 2009 +0000 @@ -15,17 +15,18 @@ public: NoteObj(); NoteObj(const QString&); + void operator= (const NoteObj &); void copy (NoteObj); void clear(); void setNote (const QString&); - QString getNote(); + QString getNote() const; QString getNoteASCII(); - QString getNoteASCII(const QString &indent, const int &width); + QString getNoteASCII(const QString &indent, const int &width=0); QString getNoteOpenDoc(); void setFontHint (const QString&); - QString getFontHint (); + QString getFontHint () const; void setFilenameHint (const QString&); - QString getFilenameHint (); + QString getFilenameHint () const; bool isEmpty(); QString saveToDir(); diff -r 2d4cc445a86a -r ee6b0f3a4c2f ornamentedobj.cpp --- a/ornamentedobj.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/ornamentedobj.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -45,10 +45,6 @@ heading = new HeadingObj(scene); heading->move (absPos.x(), absPos.y()); - note.setNote(""); - note.setFontHint (textEditor->getFontHintDefault() ); - isNoteInEditor=false; - systemFlags=new FlagRowObj(scene); systemFlags->clone(systemFlagsDefault); systemFlags->setName ("systemFlags"); @@ -75,7 +71,6 @@ heading->copy(other->heading); setColor (other->heading->getColor()); - note.copy (other->note); systemFlags->copy (other->systemFlags); standardFlags->copy (other->standardFlags); @@ -260,38 +255,6 @@ move2RelPos (p.x(),p.y()); } -void OrnamentedObj::setNote(QString s) -{ - note.setNote(s); - updateNoteFlag(); -} - -void OrnamentedObj::setNote(NoteObj n) -{ - note=n; - updateNoteFlag(); -} - -QString OrnamentedObj::getNote() -{ - return note.getNote(); -} - -QString OrnamentedObj::getNoteASCII(const QString &indent, const int &width) -{ - return note.getNoteASCII(indent,width); -} - -QString OrnamentedObj::getNoteASCII() -{ - return note.getNoteASCII(); -} - -QString OrnamentedObj::getNoteOpenDoc() -{ - return note.getNoteOpenDoc(); -} - void OrnamentedObj::setURL(QString s) { url=s; @@ -407,20 +370,25 @@ return false; } -void OrnamentedObj::getNoteFromTextEditor () +/* FIXME-3 should move to VymView ?! void OrnamentedObj::getNoteFromTextEditor () { note.setFilenameHint (textEditor->getFilename()); note.setFontHint (textEditor->getFontHint() ); setNote( textEditor->getText() ); } +*/ -void OrnamentedObj::updateNoteFlag() +void OrnamentedObj::updateSystemFlags() { - bool noteEmpty; + // FIXME-3 check if note here and text in editor are still in sync!! + // Best would be to always have current text here... + bool noteEmpty=treeItem->getNoteObj().isEmpty(); + /* if (isNoteInEditor) noteEmpty=textEditor->isEmpty(); else noteEmpty=note.isEmpty(); + */ if (!noteEmpty) { @@ -432,12 +400,11 @@ if (!systemFlags->isActive ("note")) return; systemFlags->deactivate("note"); } - model->setChanged(); + //model->setChanged(); calcBBoxSize(); positionBBox(); move (absPos.x(), absPos.y() ); forceReposition(); - } void OrnamentedObj::updateFlagsToolbar() diff -r 2d4cc445a86a -r ee6b0f3a4c2f ornamentedobj.h --- a/ornamentedobj.h Mon Mar 23 09:06:51 2009 +0000 +++ b/ornamentedobj.h Thu Mar 26 07:49:17 2009 +0000 @@ -53,12 +53,6 @@ virtual void moveBy (QPointF); virtual void move2RelPos (QPointF); // move relativly to parent^ virtual void move2RelPos (double,double); - virtual void setNote(QString); // set note - virtual void setNote(NoteObj); // set note - virtual QString getNote(); // returns note (HTML) - virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII) - virtual QString getNoteASCII(); // returns note (ASCII) - virtual QString getNoteOpenDoc(); // returns note (OpenDoc) virtual void setURL (QString); virtual QString getURL (); @@ -76,18 +70,16 @@ virtual bool isSetStandardFlag(QString); virtual QString getSystemFlagName (const QPointF &p); virtual bool isActiveFlag(const QString&); // check if flag is set - virtual void updateNoteFlag(); - virtual void getNoteFromTextEditor (); + virtual void updateSystemFlags(); + //virtual void getNoteFromTextEditor ();// FIXME should move to vymview?! virtual void updateFlagsToolbar(); virtual void setHideInExport(bool); // set export of object (and children) - virtual bool hideInExport(); - virtual bool isHidden (); + virtual bool hideInExport(); // FIXME moved to treeitem + virtual bool isHidden (); // FIXME moved to treeitem virtual QString getOrnXMLAttr(); // get attributes for saveToDir protected: HeadingObj *heading; // Heading - NoteObj note; // Notes - bool isNoteInEditor; // true if TextEditor has this note FlagRowObj *systemFlags; // System Flags FlagRowObj *standardFlags; // Standard Flags FrameObj *frame; // frame around object @@ -97,7 +89,7 @@ QList attributes; // List with attributes bool hideExport; // hide in exports if set - bool hidden; // true if temporary hidden + bool hidden; // true if temporary hidden // FIXME moved to treeitem needs to move }; #endif diff -r 2d4cc445a86a -r ee6b0f3a4c2f scripts/update-bookmarks --- a/scripts/update-bookmarks Mon Mar 23 09:06:51 2009 +0000 +++ b/scripts/update-bookmarks Thu Mar 26 07:49:17 2009 +0000 @@ -7,3 +7,4 @@ # And now the same using QDBUS in KDE 4: qdbus| grep konqueror- | xargs -iOBJECT qdbus OBJECT /KBookmarkManager/konqueror org.kde.KIO.KBookmarkManager.notifyCompleteChange +#qdbus| grep konqueror- | xargs -iOBJECT qdbus OBJECT /KBookmarkManager/kfilePlaces org.kde.KIO.KBookmarkManager.notifyCompleteChange diff -r 2d4cc445a86a -r ee6b0f3a4c2f selection.cpp --- a/selection.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/selection.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -26,7 +26,7 @@ model=m; } -void Selection::update() // FIXME VM emit signal in VM instead and get rid of this +void Selection::update() // FIXME-2 VM emit signal in VM instead and get rid of this { /* QRectF bbox; @@ -88,19 +88,6 @@ void Selection::unselect() { model->unselect(); - /* - cout << "Sel::unselect\n"; - if (!selectList.isEmpty() ) - { - for (int i=0; i< selectList.count(); ++i) - selectList.at(i)->unselect(); - lastSelectList=selectList; - selectList.clear(); - // FIXME VM move to ME - //while (!selboxList.isEmpty() ) - // delete selboxList.takeFirst(); - } - */ } bool Selection::isBlocked() @@ -164,7 +151,7 @@ TreeItem* Selection::getBranchItem() { BranchObj* bo=getBranch(); - if (bo) return bo->getTreeItem(); // FIXME VM get directly from treemodl + if (bo) return bo->getTreeItem(); // VM get directly from treemodl return NULL; } @@ -186,7 +173,7 @@ return NULL; } -QString Selection::getSelectString() // FIXME VM this is also in VM ?! clean up here... +QString Selection::getSelectString() // FIXME-2 VM this is also in VM ?! clean up here... // TODO no multiselections yet { if (selectList.count()==1) diff -r 2d4cc445a86a -r ee6b0f3a4c2f texteditor.cpp --- a/texteditor.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/texteditor.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -186,6 +186,29 @@ return filenameHint; } +QString TextEditor::getText() +{ + if (e->toPlainText().isEmpty()) + return QString(); + else + return e->text(); +} + +NoteObj TextEditor::getNoteObj() +{ + NoteObj note (getText() ); + note.setFontHint (getFontHint() ); + note.setFilenameHint (getFilenameHint () ); + return note; +} + +void TextEditor::setNote (const NoteObj ¬e) +{ + setText (note.getNote() ); + setFilenameHint (note.getFilenameHint() ); + setFontHint (note.getFontHint() ); +} + bool TextEditor::findText(const QString &t, const QTextDocument::FindFlags &flags) { if (e->find (t,flags)) @@ -504,14 +527,6 @@ return; } -QString TextEditor::getText() -{ - if (e->toPlainText().isEmpty()) - return ""; - else - return e->text(); -} - void TextEditor::editorChanged() { if (isEmpty()) @@ -528,7 +543,7 @@ } -void TextEditor::setText(QString t) +void TextEditor::setText(const QString &t) { blockChangedSignal=true; e->setReadOnly(false); diff -r 2d4cc445a86a -r ee6b0f3a4c2f texteditor.h --- a/texteditor.h Mon Mar 23 09:06:51 2009 +0000 +++ b/texteditor.h Thu Mar 26 07:49:17 2009 +0000 @@ -6,6 +6,7 @@ enum EditorState {inactiveEditor,emptyEditor,filledEditor}; class MyTextEdit; +class NoteObj; class TextEditor : public QMainWindow { Q_OBJECT @@ -23,6 +24,10 @@ QString getFilename (); void setFilenameHint (const QString&); QString getFilenameHint (); + QString getText(); + NoteObj getNoteObj(); + void setNote(const NoteObj ¬e); + bool findText(const QString &, const QTextDocument::FindFlags &); // find Text protected: @@ -33,13 +38,10 @@ void closeEvent( QCloseEvent* ); -public: - QString getText(); - public slots: - void editorChanged(); // received when text() changed - void setText(QString); // set Text (by MapEditor) - void setInactive(); // Nothing can be entered + void editorChanged(); // received when text() changed + void setText(const QString &); // set Text (by MapEditor) + void setInactive(); // Nothing can be entered void editCopyAll(); signals: diff -r 2d4cc445a86a -r ee6b0f3a4c2f treeitem.cpp --- a/treeitem.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/treeitem.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -1,10 +1,16 @@ +#include +using namespace std; + #include #include "branchobj.h" #include "treeitem.h" +#include "vymmodel.h" TreeItem::TreeItem(const QList &data, TreeItem *parent) { + model=NULL; + parentItem = parent; itemData = data; lmo=NULL; @@ -12,6 +18,12 @@ branchOffset=0; branchCounter=0; lastSelectedBranchNum=-1; + + note.setNote(""); + // note.setFontHint (textEditor->getFontHintDefault() ); //FIXME-2 + // isNoteInEditor=false; + + } TreeItem::~TreeItem() @@ -19,10 +31,36 @@ qDeleteAll(childItems); } +QString TreeItem::saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset) +{ + qWarning ("TreeItem::saveToDir called directly"); + return QString(); +} + + +/* +void TreeItem::copy (OrnamentedObj* other) //FIXME-2 + +{ + note.copy (other->note); + model=other->model; +} +*/ + +void TreeItem::setModel (VymModel *m) +{ + model=m; +} + +VymModel* TreeItem::getModel () +{ + return model; +} void TreeItem::appendChild(TreeItem *item) { childItems.append(item); + item->setModel (model); if (item->type == Branch || item->type ==MapCenter) { @@ -32,8 +70,6 @@ } } -#include -using namespace std; void TreeItem::removeChild(int row) { if (row<0 || row > childItems.size()-1) @@ -109,7 +145,7 @@ case Undefined: return -1; case MapCenter: return parentItem->childItems.indexOf (this) - branchOffset; case Branch: return parentItem->childItems.indexOf (this) - branchOffset; - case Image: return -1; // FIXME + case Image: return -1; // FIXME-2 default: return -1; } @@ -132,26 +168,43 @@ void TreeItem::setNote(const QString s) { - switch (type) - { - case MapCenter: - ((BranchObj*)lmo)->setNote(s); - break; - case Branch: - ((BranchObj*)lmo)->setNote(s); - break; - default: ; - } + note.setNote(s); + // updateNoteFlag(); FIXME-2 needed? + if (model) + model->emitContentHasChanged (this); +} + +void TreeItem::setNoteObj(const NoteObj &n, bool updateNoteEditor) +{ + note=n; + // updateNoteFlag(); FIXME-2 needed? + if (model && updateNoteEditor) + model->emitContentHasChanged (this); } QString TreeItem::getNote() { - switch (type) - { - case MapCenter: return ((BranchObj*)lmo)->getNote(); - case Branch: return ((BranchObj*)lmo)->getNote(); - default: return QString (); - } + return note.getNote(); +} + +NoteObj TreeItem::getNoteObj() +{ + return note; +} + +QString TreeItem::getNoteASCII(const QString &indent, const int &width) +{ + return note.getNoteASCII(indent,width); +} + +QString TreeItem::getNoteASCII() +{ + return note.getNoteASCII(); +} + +QString TreeItem::getNoteOpenDoc() +{ + return note.getNoteOpenDoc(); } void TreeItem::setType(const Type t) @@ -221,7 +274,7 @@ return getBranchNum (lastSelectedBranchNum); } -LinkableMapObj* TreeItem::getLMO() // FIXME VM should be unnecessary in the end +LinkableMapObj* TreeItem::getLMO() // FIXME-3 VM should be unnecessary in the end { return lmo; } diff -r 2d4cc445a86a -r ee6b0f3a4c2f treeitem.h --- a/treeitem.h Mon Mar 23 09:06:51 2009 +0000 +++ b/treeitem.h Thu Mar 26 07:49:17 2009 +0000 @@ -4,16 +4,25 @@ #include #include +#include "noteobj.h" +#include "xmlobj.h" + class LinkableMapObj; +class VymModel; -class TreeItem +class TreeItem:public XMLObj { public: enum Type {Undefined,MapCenter,Branch,Image}; TreeItem(const QList &data, TreeItem *parent = 0); ~TreeItem(); + QString saveToDir (const QString &tmpdir,const QString &prefix, const QPointF& offset); + // General housekeeping + void setModel (VymModel *m); + VymModel* getModel(); + void appendChild (TreeItem *child); void removeChild (int row); @@ -33,8 +42,22 @@ QVariant data(int column) const; void setHeading (const QString s); QString getHeading(); + +protected: + NoteObj note; +public: void setNote(const QString s); QString getNote(); + virtual void setNoteObj(const NoteObj &, bool updateNoteEditor=true); + virtual NoteObj getNoteObj(); + virtual QString getNoteASCII(const QString &indent, const int &width); // returns note (ASCII) + virtual QString getNoteASCII(); // returns note (ASCII) + virtual QString getNoteOpenDoc(); // returns note (OpenDoc) + + +protected: + Type type; +public: void setType (const Type t); Type getType (); QString getTypeName (); @@ -53,16 +76,19 @@ void setLMO (LinkableMapObj*); protected: + VymModel *model; + QList childItems; QList itemData; TreeItem *parentItem; - Type type; LinkableMapObj *lmo; int branchOffset; int branchCounter; int lastSelectedBranchNum; + + bool hidden; //! Hidden in export if true }; #endif diff -r 2d4cc445a86a -r ee6b0f3a4c2f treemodel.cpp --- a/treemodel.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/treemodel.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -81,7 +81,8 @@ if (!parentItem) { cout <<"TreeModel::parent ti=="<getHeading().toStdString()<childNumber(), 0, parentItem); @@ -185,9 +186,7 @@ cout << "TreeModel::removeRows row="<getHeading().toStdString()<setModel (this); } @@ -69,22 +70,22 @@ selModel->clearSelection(); // Remove stuff - while (!mapCenters.isEmpty()) // FIXME VM needs to be in treemodel only... + while (!mapCenters.isEmpty()) // FIXME-2 VM needs to be in treemodel only... delete mapCenters.takeFirst(); QModelIndex ri=index(rootItem); - //removeRows (0, rowCount(ri),ri); // FIXME here should be at least a beginRemoveRows... + //removeRows (0, rowCount(ri),ri); // FIXME-2 here should be at least a beginRemoveRows... } void VymModel::init () { // We should have at least one map center to start with - // addMapCenter(); FIXME VM create this in MapEditor as long as model is part of that + // addMapCenter(); FIXME-2 VM create this in MapEditor as long as model is part of that // No MapEditor yet mapEditor=NULL; - // Also no scene yet (should not be needed anyway) FIXME VM + // Also no scene yet (should not be needed anyway) FIXME-3 VM mapScene=NULL; // History @@ -150,7 +151,7 @@ netstate=Offline; // Create MapCenter - // addMapCenter(); FIXME VM create this in MapEditor until BO and MCO are independent of scene + // addMapCenter(); FIXME-2 VM create this in MapEditor until BO and MCO are independent of scene } @@ -164,7 +165,7 @@ } -MapEditor* VymModel::getMapEditor() // FIXME VM better return favourite editor here +MapEditor* VymModel::getMapEditor() // FIXME-2 VM better return favourite editor here { return mapEditor; } @@ -174,7 +175,7 @@ return blockReposition; } -void VymModel::updateActions() // FIXME maybe don't update if blockReposition is set +void VymModel::updateActions() // FIXME-2 maybe don't update if blockReposition is set { cout << "VymModel::updateActions \n"; // Tell mainwindow to update states of actions @@ -233,12 +234,12 @@ s+=xml.beginElement("vymmap",mapAttr); xml.incIndent(); - // Find the used flags while traversing the tree // FIXME this can be done local to vymmodel maybe... + // Find the used flags while traversing the tree // FIXME-2 this can be done local to vymmodel maybe... standardFlagsDefault->resetUsedCounter(); // Reset the counters before saving // TODO constr. of FIO creates lots of objects, better do this in some other way... - FloatImageObj (mapScene).resetSaveCounter();// FIXME this can be done local to vymmodel maybe... + FloatImageObj (mapScene).resetSaveCounter();// FIXME-2 this can be done local to vymmodel maybe... // Build xml recursivly if (!saveSel || typeid (*saveSel) == typeid (MapCenterObj)) @@ -350,7 +351,7 @@ if (lmode==NewMap) { selModel->clearSelection(); - // FIXME VM not needed??? model->setMapEditor(this); + // FIXME-2 VM not needed??? model->setMapEditor(this); // (map state is set later at end of load...) } else { @@ -464,7 +465,7 @@ file.close(); if ( ok ) { - reposition(); // FIXME VM reposition the view instead... + reposition(); // FIXME-2 VM reposition the view instead... selection.update(); if (lmode==NewMap) { @@ -889,7 +890,7 @@ { importDirInt (fd->selectedFile() ); reposition(); - //FIXME VM needed? scene()->update(); + //FIXME-3 VM needed? scene()->update(); } } } @@ -932,7 +933,7 @@ QDateTime tmod=QFileInfo (filePath).lastModified(); if (tmod>fileChangedTime) { - // FIXME VM switch to current mapeditor and finish lineedits... + // FIXME-2 VM switch to current mapeditor and finish lineedits... QMessageBox mb( vymName, tr("The file of the map on disk has changed:\n\n" " %1\n\nDo you want to reload that map with the new file?").arg(filePath), @@ -1200,7 +1201,7 @@ void VymModel::saveState(const SaveMode &savemode, const QString &undoSelection, const QString &undoCom, const QString &redoSelection, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel) { - sendData(redoCom); //FIXME testing + sendData(redoCom); //FIXME-3 testing // Main saveState @@ -1463,7 +1464,7 @@ return QDate::currentDate().toString ("yyyy-MM-dd"); } -int VymModel::countBranches() // FIXME Optimize this: use internal counter instead of going through whole map each time... +int VymModel::countBranches() // FIXME-2 Optimize this: use internal counter instead of going through whole map each time... { int c=0; TreeItem *cur=NULL; @@ -1491,15 +1492,15 @@ "setHeading (\""+s+"\")", QString("Set heading of %1 to \"%2\"").arg(getObjectName(sel)).arg(s) ); sel->setHeading(s ); - /* FIXME testing only + /* FIXME-3 testing only */ TreeItem *ti=getSelectedItem(); if (ti) { ti->setHeading (s); - //FIXME VM ix is wrong ModelIndex below, ix2 is (hopefully) correct: + //FIXME-3 VM ix is wrong ModelIndex below, ix2 is (hopefully) correct: //QModelIndex ix=index( ti->row(), ti->column(), index (0,0,QModelIndex()) ); - //FIXME VM testing only cout <<"VM::setHeading s="<row()<<","<column()<<")"<row()<<","<column()<<")"<update(); + // FIXME-3 VM needed? scene()->update(); } } @@ -1929,7 +1932,7 @@ BranchObj *obo=par->moveBranchUp (bo); // bo will be the one below selection saveState (getSelectString(bo),"moveBranchDown ()",getSelectString(obo),"moveBranchUp ()",QString("Move up %1").arg(getObjectName(bo))); reposition(); - //FIXME VM needed? scene()->update(); + //FIXME-3 VM needed? scene()->update(); selection.update(); ensureSelectionVisible(); } @@ -1946,7 +1949,7 @@ BranchObj *obo=par->moveBranchDown(bo); // bo will be the one above selection saveState(getSelectString(bo),"moveBranchUp ()",getSelectString(obo),"moveBranchDown ()",QString("Move down %1").arg(getObjectName(bo))); reposition(); - //FIXME VM needed? scene()->update(); + //FIXME-3 VM needed? scene()->update(); selection.update(); ensureSelectionVisible(); } @@ -1984,7 +1987,7 @@ BranchObj *bo=getSelectedBranch(); if (bo) { - FloatImageObj *newfio=bo->addFloatImage(); // FIXME VM Old model, merge with below + FloatImageObj *newfio=bo->addFloatImage(); // FIXME-1 VM Old model, merge with below // Create TreeItem QList cData; @@ -1998,7 +2001,7 @@ if (newfio) { newfio->setTreeItem (ti); - select (newfio); // FIXME VM really needed here? + select (newfio); // FIXME-2 VM really needed here? return ti; } } @@ -2008,8 +2011,7 @@ MapCenterObj* VymModel::addMapCenter () { MapCenterObj *mco=addMapCenter (contextPos); - cout <<"VM::addMCO () mapScene="<setMapEditor(mapEditor); //FIXME VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects + mapCenter->setMapEditor(mapEditor); //FIXME-3 VM needed to get defLinkStyle, mapLinkColorHint ... for later added objects mapCenter->move (absPos); mapCenter->setVisibility (true); mapCenter->setHeading (QApplication::translate("Heading of mapcenter in new map", "New map")); @@ -2035,7 +2037,6 @@ QModelIndex parix=index(rootItem); int n=rootItem->branchCount(); - cout << "VM::addMapCenter n="<setTreeItem (ti); - select (newbo); // FIXME VM really needed here? + select (newbo); // FIXME-2 VM really needed here? } }else if (num==-1) { num=bo->getNum()+1; bo=(BranchObj*)bo->getParObj(); - if (bo) newbo=bo->insertBranch(num); //FIXME VM still missing + if (bo) newbo=bo->insertBranch(num); //FIXME-1 VM still missing }else if (num==-3) { num=bo->getNum(); bo=(BranchObj*)bo->getParObj(); - if (bo) newbo=bo->insertBranch(num); //FIXME VM still missing + if (bo) newbo=bo->insertBranch(num); //FIXME-1 VM still missing } } return newbo; @@ -2155,7 +2156,7 @@ if (bo) { - // FIXME VM do we still need this in model? setCursor (Qt::ArrowCursor); + // FIXME-1 VM do we still need this in model? setCursor (Qt::ArrowCursor); newbo=addNewBranchInt (pos-2); @@ -2169,7 +2170,7 @@ QString ("Add new branch to %1").arg(getObjectName(bo))); reposition(); - // selection.update(); FIXME + // selection.update(); FIXME-3 latestSelectionString=getSelectString(newbo); // In Network mode, the client needs to know where the new branch is, // so we have to pass on this information via saveState. @@ -2197,7 +2198,7 @@ BranchObj *parbo=(BranchObj*)(bo->getParObj()); // add below selection - newbo=parbo->insertBranch(bo->getNum()+1); //FIXME VM still missing + newbo=parbo->insertBranch(bo->getNum()+1); //FIXME-1 VM still missing if (newbo) { @@ -2210,7 +2211,7 @@ QString ("Add branch before %1").arg(getObjectName(bo))); reposition(); - // selection.update(); FIXME + // selection.update(); FIXME-3 } } latestSelectionString=selection.getSelectString(); @@ -2219,7 +2220,7 @@ void VymModel::deleteSelection() { - BranchObj *bo = getSelectedBranch(); // FIXME VM should not be necessary + BranchObj *bo = getSelectedBranch(); // FIXME-2 VM should not be necessary if (!bo) return; QModelIndex ix=getSelectedIndex(); @@ -2229,11 +2230,11 @@ if (!parentIndex.isValid()) return; TreeItem *ti=bo->getTreeItem(); - if (selectionType()==TreeItem::MapCenter) //FIXME VM still missing + if (selectionType()==TreeItem::MapCenter) //FIXME-1 VM still missing { // BranchObj* par=(BranchObj*)(bo->getParObj()); //selection.unselect(); - /* FIXME VM Note: does saveStateRemovingPart work for MCO? (No parent!) + /* FIXME-1 VM Note: does saveStateRemovingPart work for MCO? (No parent!) saveStateRemovingPart (bo, QString ("Delete %1").arg(getObjectName(bo))); */ /* @@ -2272,7 +2273,7 @@ emit (layoutChanged() ); return; } - FloatImageObj *fio=selection.getFloatImage(); //FIXME VM still missing + FloatImageObj *fio=selection.getFloatImage(); //FIXME-1 VM still missing if (fio) { @@ -2292,7 +2293,7 @@ } } -void VymModel::deleteKeepChildren() //FIXME VM still missing +void VymModel::deleteKeepChildren() //FIXME-1 VM still missing { BranchObj *bo=getSelectedBranch(); @@ -2329,7 +2330,7 @@ } } -void VymModel::deleteChildren() //FIXME VM still missing +void VymModel::deleteChildren() //FIXME-1 VM still missing { BranchObj *bo=getSelectedBranch(); @@ -2366,7 +2367,7 @@ ); bo->toggleScroll(); selection.update(); - // FIXME VM needed? scene()->update(); + // FIXME-3 VM needed? scene()->update(); return true; } return false; @@ -2391,7 +2392,7 @@ ); bo->toggleScroll(); selection.update(); - // FIXME VM needed? scene()->update(); + // FIXME-3 VM needed? scene()->update(); return true; } return false; @@ -2409,8 +2410,10 @@ } } -void VymModel::unscrollChildren() -{ +void VymModel::unscrollChildren() // FIXME-1 first, next moved to vymmodel + +{ +/* BranchObj *bo=getSelectedBranch(); if (bo) { @@ -2421,7 +2424,9 @@ bo=bo->next(); } } +*/ } + void VymModel::addFloatImage (const QPixmap &img) { BranchObj *bo=getSelectedBranch(); @@ -2434,7 +2439,7 @@ saveState (PartOfMap, s, "nop ()", s, "copy ()","Copy dropped image to clipboard",fio ); saveState (fio,"delete ()", bo,QString("paste(%1)").arg(curStep),"Pasting dropped image"); reposition(); - // FIXME VM needed? scene()->update(); + // FIXME-3 VM needed? scene()->update(); } } @@ -2585,7 +2590,7 @@ "setVymLink (\""+fd->selectedFile()+"\")", QString("Set vymlink of %1 to %2").arg(getObjectName(bo)).arg(fd->selectedFile()) ); - setVymLink (fd->selectedFile() ); // FIXME ok? + setVymLink (fd->selectedFile() ); // FIXME-2 ok? } } } @@ -2619,7 +2624,7 @@ bo->setVymLink ("" ); updateActions(); reposition(); - // FIXME VM needed? scene()->update(); + // FIXME-3 VM needed? scene()->update(); } } @@ -2633,8 +2638,10 @@ } -QStringList VymModel::getVymLinks() -{ +QStringList VymModel::getVymLinks() // FIXME-1 first, next moved to vymmodel +{ + return QStringList(); +/* QStringList links; BranchObj *bo=getSelectedBranch(); if (bo) @@ -2647,6 +2654,7 @@ } } return links; +*/ } @@ -2664,7 +2672,7 @@ } } -void VymModel::editXLink(int i) // FIXME VM missing saveState +void VymModel::editXLink(int i) // FIXME-1 VM missing saveState { BranchObj *bo=getSelectedBranch(); if (bo) @@ -2850,7 +2858,7 @@ parser.setError (Aborted,"Type of selection is not a branch"); } else if (parser.checkParCount(0)) { - //FIXME missing action for copy + //FIXME-1 missing action for copy } ///////////////////////////////////////////////////////////////////// } else if (com=="cut") @@ -3629,7 +3637,7 @@ // Any errors? if (parser.errorLevel()==NoError) { - // setChanged(); FIXME should not be called e.g. for export?! + // setChanged(); FIXME-2 should not be called e.g. for export?! reposition(); } else @@ -3839,12 +3847,15 @@ void VymModel::updateNoteFlag() { setChanged(); + cout << "VM::updateNoteFlag()\n"; + /* FIXME-1 modify note flag BranchObj *bo=getSelectedBranch(); if (bo) { bo->updateNoteFlag(); mainWindow->updateActions(); } + */ } void VymModel::updateRelPositions() @@ -4066,7 +4077,7 @@ } } -void VymModel::selectMapBackgroundImage () // FIXME move to ME +void VymModel::selectMapBackgroundImage () // FIXME-2 move to ME { Q3FileDialog *fd=new Q3FileDialog( NULL); fd->setMode (Q3FileDialog::ExistingFile); @@ -4087,7 +4098,7 @@ } } -void VymModel::setMapBackgroundImage (const QString &fn) //FIXME missing savestate +void VymModel::setMapBackgroundImage (const QString &fn) //FIXME-2 missing savestate { QColor oldcol=mapScene->backgroundBrush().color(); /* @@ -4103,7 +4114,7 @@ mapScene->setBackgroundBrush(brush); } -void VymModel::selectMapBackgroundColor() // FIXME move to ME +void VymModel::selectMapBackgroundColor() // FIXME-1 move to ME { QColor col = QColorDialog::getColor( mapScene->backgroundBrush().color(), NULL); if ( !col.isValid() ) return; @@ -4111,7 +4122,7 @@ } -void VymModel::setMapBackgroundColor(QColor col) // FIXME move to ME +void VymModel::setMapBackgroundColor(QColor col) // FIXME-1 move to ME { QColor oldcol=mapScene->backgroundBrush().color(); saveState( @@ -4121,38 +4132,38 @@ mapScene->setBackgroundBrush(col); } -QColor VymModel::getMapBackgroundColor() // FIXME move to ME +QColor VymModel::getMapBackgroundColor() // FIXME-1 move to ME { return mapScene->backgroundBrush().color(); } -LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME move to ME +LinkableMapObj::ColorHint VymModel::getMapLinkColorHint() // FIXME-1 move to ME { return linkcolorhint; } -QColor VymModel::getMapDefLinkColor() // FIXME move to ME +QColor VymModel::getMapDefLinkColor() // FIXME-1 move to ME { return defLinkColor; } -void VymModel::setMapDefXLinkColor(QColor col) // FIXME move to ME +void VymModel::setMapDefXLinkColor(QColor col) // FIXME-1 move to ME { defXLinkColor=col; } -QColor VymModel::getMapDefXLinkColor() // FIXME move to ME +QColor VymModel::getMapDefXLinkColor() // FIXME-1 move to ME { return defXLinkColor; } -void VymModel::setMapDefXLinkWidth (int w) // FIXME move to ME +void VymModel::setMapDefXLinkWidth (int w) // FIXME-1 move to ME { defXLinkWidth=w; } -int VymModel::getMapDefXLinkWidth() // FIXME move to ME +int VymModel::getMapDefXLinkWidth() // FIXME-1 move to ME { return defXLinkWidth; } @@ -4276,7 +4287,7 @@ if (!tcpServer->listen(QHostAddress::Any,port)) { QMessageBox::critical(NULL, "vym server", QString("Unable to start the server: %1.").arg(tcpServer->errorString())); - //FIXME needed? we are no widget any longer... close(); + //FIXME-3 needed? we are no widget any longer... close(); return; } connect(tcpServer, SIGNAL(newConnection()), this, SLOT(newClient())); @@ -4415,11 +4426,18 @@ mapEditor->setSelectionColor (col); } -void VymModel::updateSelection() -{ - QItemSelection newsel=selModel->selection(); - updateSelection (newsel); +/* +void VymModel::changeSelection (const QItemSelection &newsel,const QItemSelection &oldsel) +{ + cout << "VymModel::changeSelection ("; + if (!newsel.indexes().isEmpty() ) + cout << getItem(newsel.indexes().first() )->getHeading().toStdString(); + cout << ","; + if (!oldsel.indexes().isEmpty() ) + cout << getItem(oldsel.indexes().first() )->getHeading().toStdString(); + cout << ")\n"; } +*/ void VymModel::updateSelection(const QItemSelection &newsel) { @@ -4428,6 +4446,12 @@ sendSelection(); } +void VymModel::updateSelection() +{ + QItemSelection newsel=selModel->selection(); + updateSelection (newsel); +} + void VymModel::setSelectionColor(QColor col) { if ( !col.isValid() ) return; @@ -4450,7 +4474,7 @@ for (int i=0;isetHideTmp (mode); reposition(); - // FIXME needed? scene()->update(); + // FIXME-3 needed? scene()->update(); } @@ -4469,7 +4493,6 @@ void VymModel::setSelectionModel (QItemSelectionModel *sm) { selModel=sm; - cout << "VM::setSelModel selModel="<select (ix,QItemSelectionModel::ClearAndSelect ); ti->setLastSelectedBranch(); - //updateSelection(oldsel); //FIXME needed? + //updateSelection(oldsel); //FIXME-3 needed? return true; } return false; @@ -4545,11 +4568,16 @@ selection.reselect(); } -void VymModel::ensureSelectionVisible() +void VymModel::ensureSelectionVisible() //FIXME-3 needed? in vymmodel.h commented... { LinkableMapObj *lmo=getSelectedLMO(); if (lmo &&mapEditor) mapEditor->ensureVisible (lmo->getBBox() ); - +} + +void VymModel::emitContentHasChanged (TreeItem *ti) +{ + QModelIndex ix=index(ti); + emit (contentHasChanged (ix) ); } void VymModel::selectInt (LinkableMapObj *lmo) @@ -4557,7 +4585,7 @@ if (selection.select(lmo)) { //selection.update(); - sendSelection (); // FIXME VM use signal + sendSelection (); // FIXME-4 VM use signal } } @@ -4947,10 +4975,11 @@ TreeItem* VymModel::getSelectedItem() { - // FIXME this may not only be branch, but also float etc... - BranchObj* bo=getSelectedBranch(); - if (bo) return bo->getTreeItem(); // FIXME VM get directly from treemodl - return NULL; + QModelIndexList list=selModel->selectedIndexes(); + if (!list.isEmpty() ) + return getItem (list.first() ); + else + return NULL; } QModelIndex VymModel::getSelectedIndex() @@ -4976,7 +5005,7 @@ return QString(); } -QString VymModel::getSelectString (LinkableMapObj *lmo) // FIXME VM needs to use TreeModel +QString VymModel::getSelectString (LinkableMapObj *lmo) // FIXME-2 VM needs to use TreeModel { QString s; if (!lmo) return s; diff -r 2d4cc445a86a -r ee6b0f3a4c2f vymmodel.h --- a/vymmodel.h Mon Mar 23 09:06:51 2009 +0000 +++ b/vymmodel.h Thu Mar 26 07:49:17 2009 +0000 @@ -417,7 +417,10 @@ //void ensureSelectionVisible(); //!< Show selection in all views + void emitContentHasChanged (TreeItem *ti); + signals: + void contentHasChanged (QModelIndex ix); void newChildObject(QModelIndex ix); private: @@ -572,6 +575,13 @@ QString getSelectString (); QString getSelectString (LinkableMapObj *lmo); + + /* +public slots: + void changeSelection (const QItemSelection &newSel, const QItemSelection &delSel); + */ + +public: void updateSelection(const QItemSelection &oldsel); void updateSelection(); void selectMapLinkColor(); @@ -583,7 +593,6 @@ public: void setSelectionColor(QColor); QColor getSelectionColor(); - }; #endif diff -r 2d4cc445a86a -r ee6b0f3a4c2f vymview.cpp --- a/vymview.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/vymview.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -35,15 +35,19 @@ selModel, SIGNAL (currentChanged(const QModelIndex &, const QModelIndex &)), me,SLOT (updateCurrent(const QModelIndex &,const QModelIndex &))); - // VymModel may want to update selection, e.g. during animation + // VymModel may want to update selection or other data, e.g. during animation connect ( model, SIGNAL (selectionChanged(const QItemSelection &, const QItemSelection &)), me,SLOT (updateSelection(const QItemSelection &,const QItemSelection &))); connect ( model, SIGNAL (newChildObject(QModelIndex) ), this,SLOT (updateChilds (QModelIndex) ) ); + connect ( + model, SIGNAL (contentHasChanged(QModelIndex) ), + mainWindow, SLOT (updateContent(QModelIndex) ) ); + - //me->viewport()->setFocus(); //FIXME needed? + //me->viewport()->setFocus(); //FIXME-3 needed? me->setAntiAlias (mainWindow->isAliased()); me->setSmoothPixmap(mainWindow->hasSmoothPixmapTransform()); @@ -72,23 +76,19 @@ treeview->setExpanded (ix,true); } -void VymView::changeSelection (const QItemSelection &, const QItemSelection &) +void VymView::changeSelection (const QItemSelection &newsel, const QItemSelection &oldsel) { - cout << "VymView::changeSelection (newsel,delsel)\n"; - //treeview->expandAll(); //FIXME only for testing + /* + cout <<"VymView::changeSelection ("; + if (!newsel.indexes().isEmpty() ) + cout << model->getItem(newsel.indexes().first() )->getHeading().toStdString(); + cout << " <- "; + if (!oldsel.indexes().isEmpty() ) + cout << model->getItem(oldsel.indexes().first() )->getHeading().toStdString(); + cout << ")\n"; + */ - // Show URL and link in statusbar - QString status; - QString s=model->getURL(); - if (!s.isEmpty() ) status+="URL: "+s+" "; - s=model->getVymLink(); - if (!s.isEmpty() ) status+="Link: "+s; - if (!status.isEmpty() ) mainWindow->statusMessage (status); - - // Update Toolbar // FIXME, was so far in BranchObj - //updateFlagsToolbar(); - - // Update actions - mainWindow->updateActions(); + // Notify mainwindow to update satellites like NoteEditor, if needed (model==currenModel...) + mainWindow->changeSelection (model,newsel,oldsel); // FIXME-3 maybe connect VymModel <-> MainWindow directly? } diff -r 2d4cc445a86a -r ee6b0f3a4c2f xml-freemind.cpp --- a/xml-freemind.cpp Mon Mar 23 09:06:51 2009 +0000 +++ b/xml-freemind.cpp Thu Mar 26 07:49:17 2009 +0000 @@ -67,8 +67,8 @@ "saved using freemind " +atts.value("version")+". " "The version of this vym can parse freemind " + v +"."); } - //FIXME TreeItem *ti=model->first(); // FIXME this will be NULL !!! - TreeItem *ti=NULL; // FIXME + //FIXME-3 TreeItem *ti=model->first(); // this will be NULL !!! + TreeItem *ti=NULL; BranchObj *bo; if (ti->getType()==TreeItem::MapCenter) @@ -76,7 +76,7 @@ else qWarning ("parseFreeMindHandler::startElement no mapCenter!!"); - //FIXME cout <<"model="<
","
"); no.setNote (htmldata); - lastBranch->setNote (no); + lastBranch->getTreeItem()->setNoteObj (no); } break; default: @@ -326,7 +326,7 @@ case StateMapSetting:break; case StateMapCenter: break; case StateNote: - lastBranch->setNote(ch_simplified); + lastBranch->getTreeItem()->setNote(ch_simplified); break; case StateBranch: break; case StateStandardFlag: @@ -488,7 +488,7 @@ } if (!a.value( "fonthint").isEmpty() ) no.setFontHint(a.value ("fonthint") ); - lastBranch->setNote(no); + lastBranch->getTreeItem()->setNoteObj(no); return true; }