# HG changeset patch # User insilmaril # Date 1248263223 0 # Node ID e3a85616dbc5ad000bc3e88755281182e35db5f6 # Parent 053479bc23c6cbe6a7a530922c679fb8c6ae0230 Empty branches are always unscrolled after import, relinking to scrolled branch doesn't open branch diff -r 053479bc23c6 -r e3a85616dbc5 aboutdialog.cpp --- a/aboutdialog.cpp Wed May 06 11:06:17 2009 +0000 +++ b/aboutdialog.cpp Wed Jul 22 11:47:03 2009 +0000 @@ -92,7 +92,7 @@ license->setText ( "
Copyright (C) 2004-2007 Uwe Drechsel
" + "Copyright (C) 2004-2009 Uwe Drechsel
" "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
" diff -r 053479bc23c6 -r e3a85616dbc5 branchobj.cpp --- a/branchobj.cpp Wed May 06 11:06:17 2009 +0000 +++ b/branchobj.cpp Wed Jul 22 11:47:03 2009 +0000 @@ -138,6 +138,8 @@ while (!branch.isEmpty()) delete branch.takeFirst(); + + if (scrolled) unScroll(); } bool isAbove (BranchObj* a, BranchObj *b) @@ -1305,7 +1307,6 @@ bo->setDefAttr(MovedBranch); updateLink(); return bo; - } else return NULL; } diff -r 053479bc23c6 -r e3a85616dbc5 mapeditor.cpp --- a/mapeditor.cpp Wed May 06 11:06:17 2009 +0000 +++ b/mapeditor.cpp Wed Jul 22 11:47:03 2009 +0000 @@ -4973,6 +4973,10 @@ copyingObj=false; if (dst ) { + // Don't unscroll if relinked to a scrolled parent, but + // select parent instead + bool selectParent=false; + // We have a destination, relink to that BranchObj* bsel=xelection.getBranch(); @@ -4994,6 +4998,7 @@ bsel->linkTo ( (BranchObj*)(bdst->getParObj()), bdst->getNum()+1); } else { // Append to dst + if (bdst->isScrolled()) selectParent=true; preDstParStr=model->getSelectString(dst); bsel->linkTo (bdst,-1); if (dst->getDepth()==0) bsel->move (savePos); @@ -5014,6 +5019,8 @@ preSelStr, redoCom, QString("Relink %1 to %2").arg(getName(bsel)).arg(getName(dst)) ); + if (selectParent) select (bdst); + model->reposition(); // not necessary if we undo temporary move below } else { diff -r 053479bc23c6 -r e3a85616dbc5 version.h --- a/version.h Wed May 06 11:06:17 2009 +0000 +++ b/version.h Wed Jul 22 11:47:03 2009 +0000 @@ -4,10 +4,10 @@ #includeThe map you are just trying to load was "
+ "saved using vym " +atts.value("version")+". "
+ "The version of this vym is " + vymVersion +
+ ". If you run into problems after pressing "
+ "the ok-button below, updating vym should help.");
+ else
+ model->setVersion(atts.value( "version" ));
+
+ }
+
+ if (loadMode==NewMap )
+ {
+ // Create mapCenter
+ model->clear();
+ lastBranch=model->first(); // avoid empty pointer
+
+ if (!atts.value( "author").isEmpty() )
+ model->setAuthor(atts.value( "author" ) );
+ if (!atts.value( "comment").isEmpty() )
+ model->setComment (atts.value( "comment" ) );
+ if (!atts.value( "backgroundColor").isEmpty() )
+ {
+ col.setNamedColor(atts.value("backgroundColor"));
+ model->getScene()->setBackgroundBrush(col);
+ }
+ if (!atts.value( "selectionColor").isEmpty() )
+ {
+ col.setNamedColor(atts.value("selectionColor"));
+ model->getMapEditor()->setSelectionColor(col);
+ }
+ if (!atts.value( "linkColorHint").isEmpty() )
+ {
+ if (atts.value("linkColorHint")=="HeadingColor")
+ model->getMapEditor()->setMapLinkColorHint(LinkableMapObj::HeadingColor);
+ else
+ model->getMapEditor()->setMapLinkColorHint(LinkableMapObj::DefaultColor);
+ }
+ if (!atts.value( "linkStyle").isEmpty() )
+ model->getMapEditor()->setMapLinkStyle(atts.value("linkStyle"));
+ if (!atts.value( "linkColor").isEmpty() )
+ {
+ col.setNamedColor(atts.value("linkColor"));
+ model->getMapEditor()->setMapDefLinkColor(col);
+ }
+ if (!atts.value( "defXLinkColor").isEmpty() )
+ {
+ col.setNamedColor(atts.value("defXLinkColor"));
+ model->getMapEditor()->setMapDefXLinkColor(col);
+ }
+ if (!atts.value( "defXLinkWidth").isEmpty() )
+ model->getMapEditor()->setMapDefXLinkWidth(atts.value("defXLinkWidth").toInt ());
+ }
+ } else if ( eName == "select" && state == StateMap )
+ {
+ state=StateMapSelect;
+ } else if ( eName == "setting" && state == StateMap )
+ {
+ state=StateMapSetting;
+ if (loadMode==NewMap)
+ readSettingAttr (atts);
+ } else if ( eName == "mapcenter" && state == StateMap )
+ {
+ state=StateMapCenter;
+ if (loadMode==NewMap)
+ {
+ // Really use the found mapcenter as MCO in a new map
+
+ lastBranch=model->addMapCenter();
+ } else
+ {
+ // Treat the found mapcenter as a branch
+ // in an existing map
+ LinkableMapObj* lmo=model->getSelection();
+ if (lmo && ((typeid(*lmo) == typeid(BranchObj) )
+ || typeid(*lmo) == typeid(MapCenterObj) ) )
+ {
+ lastBranch=(BranchObj*)lmo;
+ if (loadMode==ImportAdd)
+ {
+ lastBranch->addBranch();
+ lastBranch=lastBranch->getLastBranch();
+ } else
+ lastBranch->clear();
+ } else
+ return false;
+ }
+ readBranchAttr (atts);
+ } else if (
+ (eName == "standardflag" ||eName == "standardFlag") &&
+ (state == StateMapCenter || state==StateBranch))
+ {
+ state=StateStandardFlag;
+ } else if ( eName == "heading" && (state == StateMapCenter||state==StateBranch))
+ {
+ laststate=state;
+ state=StateHeading;
+ if (!atts.value( "textColor").isEmpty() )
+ {
+ col.setNamedColor(atts.value("textColor"));
+ lastBranch->setColor(col );
+ }
+ } else if ( eName == "note" &&
+ (state == StateMapCenter ||state==StateBranch))
+ { // only for backward compatibility (<1.4.6). Use htmlnote now.
+ state=StateNote;
+ if (!readNoteAttr (atts) ) return false;
+ } else if ( eName == "htmlnote" && state == StateMapCenter)
+ {
+ laststate=state;
+ state=StateHtmlNote;
+ } else if ( eName == "floatimage" &&
+ (state == StateMapCenter ||state==StateBranch))
+ {
+ state=StateFloatImage;
+ lastBranch->addFloatImage();
+ lastFloat=lastBranch->getLastFloatImage();
+ if (!readFloatImageAttr(atts)) return false;
+ } else if ( (eName == "branch"||eName=="floatimage") && state == StateMap)
+ {
+ // This is used in vymparts, which have no mapcenter!
+ isVymPart=true;
+ LinkableMapObj* lmo=model->getSelection();
+ if (!lmo)
+ {
+ // If a vym part is _loaded_ (not imported),
+ // selection==lmo==NULL
+ // Treat it like ImportAdd then...
+ loadMode=ImportAdd;
+ lmo=model->first(); // FIXME this used to be lmo=mc before
+ }
+ if (lmo && ((typeid(*lmo) == typeid(BranchObj) )
+ || typeid(*lmo) == typeid(MapCenterObj) ) )
+ {
+ lastBranch=(BranchObj*)(lmo);
+ if (eName=="branch")
+ {
+ state=StateBranch;
+ if (loadMode==ImportAdd)
+ {
+ lastBranch->addBranch();
+ lastBranch=lastBranch->getLastBranch();
+
+ } else
+ lastBranch->clear();
+ readBranchAttr (atts);
+ } else if (eName=="floatimage")
+ {
+ state=StateFloatImage;
+ lastBranch->addFloatImage();
+ lastFloat=lastBranch->getLastFloatImage();
+ if (!readFloatImageAttr(atts)) return false;
+ } else return false;
+ } else return false;
+ } else if ( eName == "branch" && state == StateMapCenter)
+ {
+ state=StateBranch;
+ lastBranch->addBranch();
+ lastBranch=lastBranch->getLastBranch();
+ readBranchAttr (atts);
+ } else if ( eName == "htmlnote" && state == StateBranch)
+ {
+ laststate=state;
+ state=StateHtmlNote;
+ no.clear();
+ if (!atts.value( "fonthint").isEmpty() )
+ no.setFontHint(atts.value ("fonthint") );
+ } else if ( eName == "frame" && (state == StateBranch||state==StateMapCenter))
+ {
+ laststate=state;
+ state=StateFrame;
+ if (!readFrameAttr(atts)) return false;
+ } else if ( eName == "xlink" && state == StateBranch )
+ {
+ state=StateBranchXLink;
+ if (!readXLinkAttr (atts)) return false;
+ } else if ( eName == "branch" && state == StateBranch )
+ {
+ lastBranch->addBranch();
+ lastBranch=lastBranch->getLastBranch();
+ readBranchAttr (atts);
+ } else if ( eName == "html" && state == StateHtmlNote )
+ {
+ state=StateHtml;
+ htmldata="<"+eName;
+ readHtmlAttr(atts);
+ htmldata+=">";
+ } else if ( state == StateHtml )
+ {
+ // accept all while in html mode,
+ htmldata+="<"+eName;
+ readHtmlAttr(atts);
+ htmldata+=">";
+ } else
+ return false; // Error
+ return true;
+}
+
+bool parseVYMHandler::endElement ( const QString&, const QString&, const QString &eName)
+{
+ /* Testing
+ cout << "endElement " <
","
");
+ no.setNote (htmldata);
+ lastBranch->setNote (no);
+ }
+ break;
+ default:
+ break;
+ }
+ state=stateStack.takeLast();
+ return true;
+}
+
+bool parseVYMHandler::characters ( const QString& ch)
+{
+ //cout << "characters \""<