Fixed editing of headings. Undo debug output still enabled
1.1 --- a/branchobj.cpp Tue Aug 29 08:31:42 2006 +0000
1.2 +++ b/branchobj.cpp Wed Aug 30 12:16:25 2006 +0000
1.3 @@ -14,6 +14,7 @@
1.4 /////////////////////////////////////////////////////////////////
1.5
1.6 BranchObj* BranchObj::itLast=NULL;
1.7 +BranchObj* BranchObj::itFirst=NULL;
1.8
1.9
1.10 BranchObj::BranchObj () :OrnamentedObj()
1.11 @@ -406,6 +407,7 @@
1.12 BranchObj* BranchObj::first()
1.13 {
1.14 itLast=NULL;
1.15 + itFirst=this;
1.16 return this;
1.17 }
1.18
1.19 @@ -416,15 +418,17 @@
1.20 BranchObj *po=(BranchObj*)(parObj);
1.21
1.22 if (!itLast)
1.23 - { // We are just beginning at the mapCenter
1.24 + {
1.25 if (bo)
1.26 - {
1.27 + { // We are just beginning,
1.28 + // return first child
1.29 itLast=this;
1.30 return bo;
1.31 }
1.32 else
1.33 {
1.34 - itLast=NULL;
1.35 + // No childs
1.36 + itLast=this;
1.37 return NULL;
1.38 }
1.39 }
1.40 @@ -457,7 +461,7 @@
1.41 }
1.42 }
1.43
1.44 - // Try to find last child, we came from, in my own childs
1.45 + // Try to find last child, where we came from, in my own childs
1.46 bool searching=true;
1.47 while (bo && searching)
1.48 {
1.49 @@ -476,6 +480,7 @@
1.50 {
1.51 if (po)
1.52 {
1.53 + if (this==itFirst) return NULL; // Stop at starting point
1.54 // go up
1.55 itLast=this;
1.56 lmo=po->next();
2.1 --- a/branchobj.h Tue Aug 29 08:31:42 2006 +0000
2.2 +++ b/branchobj.h Wed Aug 30 12:16:25 2006 +0000
2.3 @@ -124,6 +124,7 @@
2.4
2.5 protected:
2.6 static BranchObj* itLast; // iterator for first(), next()
2.7 + static BranchObj* itFirst; // first iterator for first(), next()
2.8 BranchObjPtrList branch; // all child branches
2.9 Q3PtrList<FloatImageObj> floatimage; // child images
2.10 Q3PtrList<XLinkObj> xlink; // xlinks to other branches
3.1 Binary file demos/todo.vym has changed
4.1 --- a/main.cpp Tue Aug 29 08:31:42 2006 +0000
4.2 +++ b/main.cpp Wed Aug 30 12:16:25 2006 +0000
4.3 @@ -52,6 +52,7 @@
4.4 QAction *actionEditBugzilla2URL;
4.5 QAction *actionEditFATE2URL;
4.6 QAction *actionEditOpenVymLink;
4.7 +QAction *actionEditOpenMultipleVymLinks;
4.8 QAction *actionEditVymLink;
4.9 QAction *actionEditToggleHideExport;
4.10 QAction *actionEditDeleteVymLink;
4.11 @@ -112,8 +113,9 @@
4.12 QMenu* branchContextMenu;
4.13 QMenu* branchAddContextMenu;
4.14 QMenu* branchRemoveContextMenu;
4.15 -QMenu* branchLinksContextMenuEdit;
4.16 -QMenu* branchLinksContextMenuFollow;
4.17 +QMenu* branchLinksContextMenu;
4.18 +QMenu* branchXLinksContextMenuEdit;
4.19 +QMenu* branchXLinksContextMenuFollow;
4.20 QMenu* floatimageContextMenu;
4.21 QMenu* canvasContextMenu;
4.22 QMenu* fileLastMapsMenu;
5.1 --- a/mainwindow.cpp Tue Aug 29 08:31:42 2006 +0000
5.2 +++ b/mainwindow.cpp Wed Aug 30 12:16:25 2006 +0000
5.3 @@ -69,6 +69,7 @@
5.4 extern QAction* actionEditBugzilla2URL;
5.5 extern QAction* actionEditFATE2URL;
5.6 extern QAction *actionEditOpenVymLink;
5.7 +extern QAction *actionEditOpenMultipleVymLinks;
5.8 extern QAction *actionEditVymLink;
5.9 extern QAction *actionEditDeleteVymLink;
5.10 extern QAction *actionEditToggleHideExport;
5.11 @@ -129,8 +130,9 @@
5.12 extern QMenu* branchContextMenu;
5.13 extern QMenu* branchAddContextMenu;
5.14 extern QMenu* branchRemoveContextMenu;
5.15 -extern QMenu* branchLinksContextMenuEdit;
5.16 -extern QMenu* branchLinksContextMenuFollow;
5.17 +extern QMenu* branchLinksContextMenu;
5.18 +extern QMenu* branchXLinksContextMenuEdit;
5.19 +extern QMenu* branchXLinksContextMenuFollow;
5.20 extern QMenu* floatimageContextMenu;
5.21 extern QMenu* canvasContextMenu;
5.22 extern QMenu* fileLastMapsMenu;
5.23 @@ -259,10 +261,10 @@
5.24 settings.setValue( "/version/version", __VYM_VERSION );
5.25 settings.setValue( "/version/builddate", __BUILD_DATE );
5.26
5.27 - settings.setValue( "/mapeditor/editmode/autoselectheading",actionSettingsAutoselectHeading->isOn() );
5.28 - settings.setValue( "/mapeditor/editmode/autoselecttext",actionSettingsAutoselectText->isOn() );
5.29 - settings.setValue( "/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() );
5.30 - settings.setValue( "/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() );
5.31 + settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
5.32 + settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
5.33 + settings.setValue( "/mapeditor/editmode/pasteNewHeading",actionSettingsPasteNewHeading->isOn() );
5.34 + settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
5.35 settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
5.36 settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
5.37 settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
5.38 @@ -680,8 +682,8 @@
5.39
5.40 a = new QAction( tr( "Open all URLs in subtree" ), this);
5.41 a->setStatusTip (tr( "Open all URLs in subtree" ));
5.42 - a->setShortcut (Qt::CTRL+Qt::Key_U );
5.43 addAction(a);
5.44 + actionListBranches.append(a);
5.45 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleURLTabs() ) );
5.46 actionEditOpenMultipleURLTabs=a;
5.47
5.48 @@ -716,13 +718,21 @@
5.49 connect( a, SIGNAL( triggered() ), this, SLOT( editFATE2URL() ) );
5.50 actionEditFATE2URL=a;
5.51
5.52 - a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Jump to map" ), this);
5.53 + a = new QAction(QPixmap(flagsPath+"flag-vymlink.png"), tr( "Open xlinked map" ), this);
5.54 a->setStatusTip ( tr( "Jump to another vym map, if needed load it first" ));
5.55 tb->addAction (a);
5.56 a->setEnabled (false);
5.57 connect( a, SIGNAL( triggered() ), this, SLOT( editOpenVymLink() ) );
5.58 actionEditOpenVymLink=a;
5.59
5.60 + a = new QAction(QPixmap(), tr( "Open all vym links in subtree" ), this);
5.61 + a->setStatusTip ( tr( "Open all vym links in subtree" ));
5.62 + a->setEnabled (false);
5.63 + actionListBranches.append(a);
5.64 + connect( a, SIGNAL( triggered() ), this, SLOT( editOpenMultipleVymLinks() ) );
5.65 + actionEditOpenMultipleVymLinks=a;
5.66 +
5.67 +
5.68 a = new QAction(tr( "Edit vym link"+QString("...") ), this);
5.69 a->setEnabled (false);
5.70 a->setStatusTip ( tr( "Edit link to another vym map" ));
5.71 @@ -1413,28 +1423,28 @@
5.72 a = new QAction( tr( "Edit branch after adding it" ), this );
5.73 a->setStatusTip( tr( "Edit branch after adding it" ));
5.74 a->setToggleAction(true);
5.75 - a->setOn ( settings.value ("/mapeditor/editmode/autoedit",true).toBool());
5.76 + a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
5.77 settingsMenu->addAction (a);
5.78 actionSettingsAutoedit=a;
5.79
5.80 a= new QAction( tr( "Select branch after adding it" ), this );
5.81 a->setStatusTip( tr( "Select branch after adding it" ));
5.82 a->setToggleAction(true);
5.83 - a->setOn ( settings.value ("/mapeditor/editmode/autoselect",false).toBool() );
5.84 + a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
5.85 settingsMenu->addAction (a);
5.86 actionSettingsAutoselectHeading=a;
5.87
5.88 a= new QAction(tr( "Select existing heading" ), this);
5.89 a->setStatusTip( tr( "Select heading before editing" ));
5.90 a->setToggleAction(true);
5.91 - a->setOn ( settings.value ("/mapeditor/editmode/autoselectexistingtext",true).toBool() );
5.92 + a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
5.93 settingsMenu->addAction (a);
5.94 actionSettingsAutoselectText=a;
5.95
5.96 a= new QAction(tr( "pasting into new branch" ), this );
5.97 a->setStatusTip( tr( "Pasting into new branch" ));
5.98 a->setToggleAction(true);
5.99 - a->setOn ( settings.value ("/mapeditor/editmode/newheadingisempty",true).toBool() );
5.100 + a->setOn ( settings.value ("/mapeditor/editmode/newHeadingIsEmpty",true).toBool() );
5.101 settingsMenu->addAction (a);
5.102 actionSettingsPasteNewHeading=a;
5.103
5.104 @@ -1527,22 +1537,6 @@
5.105 actionEditSaveBranch->addTo( branchContextMenu );
5.106
5.107 branchContextMenu->addSeparator();
5.108 - branchContextMenu->addAction ( actionEditOpenURL );
5.109 - branchContextMenu->addAction ( actionEditOpenURLTab );
5.110 - branchContextMenu->addAction ( actionEditOpenMultipleURLTabs );
5.111 - branchContextMenu->addAction ( actionEditURL );
5.112 - branchContextMenu->addAction ( actionEditHeading2URL );
5.113 - branchContextMenu->addAction ( actionEditBugzilla2URL );
5.114 - if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
5.115 - {
5.116 - branchContextMenu->addAction ( actionEditFATE2URL );
5.117 - }
5.118 - branchContextMenu->addSeparator();
5.119 - branchContextMenu->addAction ( actionEditOpenVymLink );
5.120 - branchContextMenu->addAction ( actionEditVymLink );
5.121 - branchContextMenu->addAction ( actionEditDeleteVymLink );
5.122 -
5.123 - branchContextMenu->addSeparator();
5.124 branchContextMenu->addAction ( actionFormatFrameNone );
5.125 branchContextMenu->addAction ( actionFormatFrameRectangle);
5.126
5.127 @@ -1551,13 +1545,36 @@
5.128 branchContextMenu->addAction ( actionFormatIncludeImagesHor );
5.129 branchContextMenu->addAction ( actionFormatHideLinkUnselected );
5.130
5.131 - // Context Menu for links in a branch menu
5.132 + // Submenu for Links (URLs, vymLinks)
5.133 + branchLinksContextMenu =new QMenu (this);
5.134 +
5.135 + branchContextMenu->addSeparator();
5.136 + branchLinksContextMenu=branchContextMenu->addMenu(tr("URLs and vymLinks"));
5.137 + branchLinksContextMenu->addAction ( actionEditOpenURL );
5.138 + branchLinksContextMenu->addAction ( actionEditOpenURLTab );
5.139 + branchLinksContextMenu->addAction ( actionEditOpenMultipleURLTabs );
5.140 + branchLinksContextMenu->addAction ( actionEditURL );
5.141 + branchLinksContextMenu->addAction ( actionEditHeading2URL );
5.142 + branchLinksContextMenu->addAction ( actionEditBugzilla2URL );
5.143 + if (settings.value( "/mainwindow/showTestMenu",true).toBool() )
5.144 + {
5.145 + branchLinksContextMenu->addAction ( actionEditFATE2URL );
5.146 + }
5.147 + branchLinksContextMenu->addSeparator();
5.148 + branchLinksContextMenu->addAction ( actionEditOpenVymLink );
5.149 + branchLinksContextMenu->addAction ( actionEditOpenMultipleVymLinks );
5.150 + branchLinksContextMenu->addAction ( actionEditVymLink );
5.151 + branchLinksContextMenu->addAction ( actionEditDeleteVymLink );
5.152 +
5.153 +
5.154 + // Context Menu for XLinks in a branch menu
5.155 // This will be populated "on demand" in MapEditor::updateActions
5.156 branchContextMenu->addSeparator();
5.157 - branchLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
5.158 - branchLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
5.159 - connect( branchLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
5.160 - connect( branchLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
5.161 + branchXLinksContextMenuEdit =branchContextMenu->addMenu (tr ("Edit XLink"));
5.162 + branchXLinksContextMenuFollow =branchContextMenu->addMenu (tr ("Follow XLink"));
5.163 + connect( branchXLinksContextMenuFollow, SIGNAL( triggered(QAction *) ), this, SLOT( editFollowXLink(QAction * ) ) );
5.164 + connect( branchXLinksContextMenuEdit, SIGNAL( triggered(QAction *) ), this, SLOT( editEditXLink(QAction * ) ) );
5.165 +
5.166
5.167 // Context menu for floatimage
5.168 floatimageContextMenu =new QMenu (this);
5.169 @@ -2368,6 +2385,9 @@
5.170 if ( fd->exec() == QDialog::Accepted )
5.171 {
5.172 QString fn=fd->selectedFile();
5.173 + if (!fn.contains (".odp"))
5.174 + fn +=".odp";
5.175 +
5.176 //lastImageDir=fn.left(fn.findRev ("/"));
5.177 if (currentMapEditor())
5.178 currentMapEditor()->exportOOPresentation(fn,fd->selectedConfig());
5.179 @@ -2623,10 +2643,7 @@
5.180 if (currentMapEditor())
5.181 {
5.182 QStringList urls;
5.183 - urls.append ("www.suse.de");
5.184 - urls.append ("www.google.de");
5.185 - urls.append ("www.heise.de");
5.186 - urls.append ("www.insilmaril.de");
5.187 + urls=currentMapEditor()->getURLs();
5.188 openTabs (urls);
5.189 }
5.190 }
5.191 @@ -2661,7 +2678,13 @@
5.192 if (lineedit->isVisible())
5.193 {
5.194 if (currentMapEditor())
5.195 - currentMapEditor()->setHeading(lineedit->text());
5.196 + {
5.197 + MapEditor *me=currentMapEditor();
5.198 + QString oldSel=me->getSelectString();
5.199 + if (me->select (editSel))
5.200 + me->setHeading(lineedit->text());
5.201 + me->select (oldSel);
5.202 + }
5.203 lineedit->releaseKeyboard();
5.204 lineedit->hide();
5.205 setFocus();
5.206 @@ -2697,6 +2720,8 @@
5.207 lineedit->show();
5.208 lineedit->grabKeyboard();
5.209 lineedit->setFocus();
5.210 +
5.211 + editSel=currentMapEditor()->getSelectString();
5.212 #endif
5.213
5.214 }
5.215 @@ -2704,13 +2729,10 @@
5.216 }
5.217 }
5.218
5.219 -void Main::editOpenVymLink()
5.220 +void Main::openVymLinks(const QStringList &vl)
5.221 {
5.222 - // Get current path to map
5.223 - QString currentVymLink;
5.224 - if (currentMapEditor())
5.225 + for (int j=0; j<vl.size(); j++)
5.226 {
5.227 - currentVymLink=currentMapEditor()->getVymLink();
5.228 // compare path with already loaded maps
5.229 int index=-1;
5.230 int i;
5.231 @@ -2718,7 +2740,7 @@
5.232 for (i=0;i<=tabWidget->count() -1;i++)
5.233 {
5.234 me=(MapEditor*)tabWidget->page(i);
5.235 - if (currentVymLink==me->getFilePath() )
5.236 + if (vl.at(j)==me->getFilePath() )
5.237 {
5.238 index=i;
5.239 break;
5.240 @@ -2727,12 +2749,12 @@
5.241 if (index<0)
5.242 // Load map
5.243 {
5.244 - if (!QFile(currentVymLink).exists() )
5.245 + if (!QFile(vl.at(j)).exists() )
5.246 QMessageBox::critical( 0, tr( "Critical Error" ),
5.247 - tr("Couldn't open map %1").arg(currentVymLink));
5.248 + tr("Couldn't open map %1").arg(vl.at(j)));
5.249 else
5.250 {
5.251 - fileLoad (currentVymLink, NewMap);
5.252 + fileLoad (vl.at(j), NewMap);
5.253 tabWidget->setCurrentPage (tabWidget->count()-1);
5.254 }
5.255 } else
5.256 @@ -2741,6 +2763,26 @@
5.257 }
5.258 }
5.259
5.260 +void Main::editOpenVymLink()
5.261 +{
5.262 + if (currentMapEditor())
5.263 + {
5.264 + QStringList vl;
5.265 + vl.append(currentMapEditor()->getVymLink());
5.266 + openVymLinks (vl);
5.267 + }
5.268 +}
5.269 +
5.270 +void Main::editOpenMultipleVymLinks()
5.271 +{
5.272 + QString currentVymLink;
5.273 + if (currentMapEditor())
5.274 + {
5.275 + QStringList vl=currentMapEditor()->getVymLinks();
5.276 + openVymLinks (vl);
5.277 + }
5.278 +}
5.279 +
5.280 void Main::editVymLink()
5.281 {
5.282 if (currentMapEditor())
5.283 @@ -2903,13 +2945,13 @@
5.284 {
5.285
5.286 if (currentMapEditor())
5.287 - currentMapEditor()->followXLink(branchLinksContextMenuFollow->actions().indexOf(a));
5.288 + currentMapEditor()->followXLink(branchXLinksContextMenuFollow->actions().indexOf(a));
5.289 }
5.290
5.291 void Main::editEditXLink(QAction *a)
5.292 {
5.293 if (currentMapEditor())
5.294 - currentMapEditor()->editXLink(branchLinksContextMenuEdit->actions().indexOf(a));
5.295 + currentMapEditor()->editXLink(branchXLinksContextMenuEdit->actions().indexOf(a));
5.296 }
5.297
5.298 void Main::formatSelectColor()
6.1 --- a/mainwindow.h Tue Aug 29 08:31:42 2006 +0000
6.2 +++ b/mainwindow.h Wed Aug 30 12:16:25 2006 +0000
6.3 @@ -100,7 +100,9 @@
6.4 void editHeading2URL();
6.5 void editBugzilla2URL();
6.6 void editFATE2URL();
6.7 + void openVymLinks(const QStringList &);
6.8 void editVymLink();
6.9 + void editOpenMultipleVymLinks();
6.10 public slots:
6.11 void editHeading();
6.12 void editOpenVymLink();
6.13 @@ -191,6 +193,8 @@
6.14 QStringList imageTypes;
6.15
6.16 QLineEdit *lineedit; // to enter headings of branches
6.17 + QString editSel;
6.18 +
6.19 };
6.20
6.21
7.1 --- a/mapeditor.cpp Tue Aug 29 08:31:42 2006 +0000
7.2 +++ b/mapeditor.cpp Wed Aug 30 12:16:25 2006 +0000
7.3 @@ -129,8 +129,9 @@
7.4 extern QMenu* branchContextMenu;
7.5 extern QMenu* branchAddContextMenu;
7.6 extern QMenu* branchRemoveContextMenu;
7.7 -extern QMenu* branchLinksContextMenuEdit;
7.8 -extern QMenu* branchLinksContextMenuFollow;
7.9 +extern QMenu* branchLinksContextMenu;
7.10 +extern QMenu* branchXLinksContextMenuEdit;
7.11 +extern QMenu* branchXLinksContextMenuFollow;
7.12 extern QMenu* floatimageContextMenu;
7.13 extern QMenu* saveImageFormatMenu;
7.14 extern QMenu* canvasContextMenu;
7.15 @@ -376,7 +377,7 @@
7.16 d.mkdir (tmpMapDir,true);
7.17 }
7.18
7.19 -QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSelection)
7.20 +QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSel)
7.21 {
7.22 // tmpdir temporary directory to which data will be written
7.23 // prefix mapname, which will be appended to images etc.
7.24 @@ -408,7 +409,7 @@
7.25 colhint=attribut("linkColorHint","HeadingColor");
7.26
7.27 QString mapAttr=attribut("version",__VYM_VERSION);
7.28 - if (!saveSelection)
7.29 + if (!saveSel)
7.30 mapAttr+= attribut("author",mapCenter->getAuthor()) +
7.31 attribut("comment",mapCenter->getComment()) +
7.32 attribut("date",mapCenter->getDate()) +
7.33 @@ -428,25 +429,28 @@
7.34 FloatImageObj (mapCanvas).resetSaveCounter();
7.35
7.36 // Build xml recursivly
7.37 - if (!saveSelection)
7.38 + if (!saveSel)
7.39 + // Save complete map, if saveSel not set
7.40 s+=mapCenter->saveToDir(tmpdir,prefix,writeflags,offset);
7.41 else
7.42 {
7.43 - if ( typeid(*saveSelection) == typeid(BranchObj) )
7.44 - s+=((BranchObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
7.45 - else if ( typeid(*saveSelection) == typeid(FloatImageObj) )
7.46 - s+=((FloatImageObj*)(saveSelection))->saveToDir(tmpdir,prefix,offset);
7.47 + if ( typeid(*saveSel) == typeid(BranchObj) )
7.48 + // Save Subtree
7.49 + s+=((BranchObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
7.50 + else if ( typeid(*saveSel) == typeid(FloatImageObj) )
7.51 + // Save image
7.52 + s+=((FloatImageObj*)(saveSel))->saveToDir(tmpdir,prefix,offset);
7.53
7.54 else if (selection && typeid(*selection)==typeid(BranchObj))
7.55 - // This is used if selected branch is saved from mainwindow
7.56 - s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
7.57 + // Save selected branch is saved from mainwindow //FIXME maybe use "subtree" above?
7.58 + s+=((BranchObj*)selection)->saveToDir(tmpdir,prefix,offset);
7.59 }
7.60
7.61 // Save local settings
7.62 s+=settings.getXMLData (destPath);
7.63
7.64 // Save selection
7.65 - if (selection && !saveSelection )
7.66 + if (selection && !saveSel )
7.67 s+=valueElement("select",selection->getSelectString());
7.68
7.69 decIndent();
7.70 @@ -459,14 +463,22 @@
7.71
7.72 void MapEditor::saveStateComplete(const QString &comment)
7.73 {
7.74 - // Save complete map
7.75 - saveState (CompleteMap,"",NULL,"",NULL, comment);
7.76 + // Save complete map, Undo will replace whole map
7.77 + saveState (CompleteMap,
7.78 + NULL, "",
7.79 + NULL, "",
7.80 + comment,
7.81 + mapCenter);
7.82 }
7.83
7.84 void MapEditor::saveStatePart(LinkableMapObj *undoSel, const QString &comment)
7.85 {
7.86 - // save the selected part of the map
7.87 - saveState (PartOfMap,"",undoSel,"",NULL, comment);
7.88 + // save the selected part of the map, Undo will replace part of map
7.89 + saveState (PartOfMap,
7.90 + undoSel, "",
7.91 + NULL, "",
7.92 + comment,
7.93 + undoSel);
7.94 }
7.95
7.96 void MapEditor::saveStateConstSelection(const QString &uc, const QString &rc, const QString &comment)
7.97 @@ -474,16 +486,33 @@
7.98 // selection does not change during action,
7.99 // so just save commands for undo and redo
7.100 // and use current selection
7.101 - saveState (UndoCommand,uc,selection,rc,selection, comment);
7.102 + saveState (UndoCommand,
7.103 + selection, uc,
7.104 + selection, rc,
7.105 + comment,
7.106 + NULL);
7.107 }
7.108
7.109 -void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uncom, const QString &comment)
7.110 +void MapEditor::saveStateX(LinkableMapObj *unsel, const QString &uc, const QString &comment)
7.111 {
7.112 - //
7.113 - saveState (UndoCommand,uncom,unsel,"FIXME-redoCom",NULL, comment);
7.114 + // TODO Is this still needed?
7.115 + saveState (UndoCommand,
7.116 + unsel, uc,
7.117 + NULL, "FIXME-redoCom", //FIXME
7.118 + comment,
7.119 + NULL);
7.120 }
7.121
7.122 -void MapEditor::saveState(const SaveMode &savemode, const QString &undoCom, LinkableMapObj *undoSel, const QString &redoCom, LinkableMapObj *redoSel, const QString &comment)
7.123 +void MapEditor::saveStateComData(LinkableMapObj *unSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel)
7.124 +{
7.125 + saveState (UndoCommand,
7.126 + unSel, uc,
7.127 + NULL, "FIXME-redoCom", //FIXME
7.128 + comment,
7.129 + saveSel);
7.130 +}
7.131 +
7.132 +void MapEditor::saveState(const SaveMode &savemode, LinkableMapObj *undoSel, const QString &undoCom, LinkableMapObj *redoSel, const QString &redoCom, const QString &comment, LinkableMapObj *saveSel)
7.133 {
7.134 // Main saveState
7.135
7.136 @@ -491,10 +520,7 @@
7.137
7.138 /* TODO remove after testing
7.139 */
7.140 - cout << "ME::saveState() begin\n"<<endl;
7.141 - cout << " undosTotal="<<undosTotal<<endl;
7.142 - cout << " ---------------------------"<<endl;
7.143 -
7.144 + cout << "ME::saveState() begin"<<endl;
7.145 historyWindow->append (comment);
7.146
7.147 setChanged();
7.148 @@ -526,21 +552,22 @@
7.149 undoSelection=undoSel->getSelectString();
7.150
7.151 // Save depending on how much needs to be saved
7.152 + if (!saveSel)
7.153 + backupXML="";
7.154 + else
7.155 + backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),saveSel);
7.156 +
7.157 QString undoCommand="";
7.158 if (savemode==UndoCommand)
7.159 {
7.160 undoCommand=undoCom;
7.161 - backupXML="";
7.162 }
7.163 else if (savemode==PartOfMap && undoSel)
7.164 {
7.165 undoCommand="undoPart (\""+ undoSelection+"\",\""+bakMapPath+"\")";
7.166 - backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),undoSel);
7.167 } else
7.168 {
7.169 undoCommand="undoMap (\""+bakMapPath+"\")";
7.170 - backupXML=saveToDir (bakMapDir,mapName+"-",false, QPoint (),NULL);
7.171 - undoSelection="";
7.172 }
7.173 if (!backupXML.isEmpty())
7.174 // Write XML Data to disk
7.175 @@ -557,16 +584,17 @@
7.176
7.177 /* TODO remove after testing
7.178 */
7.179 - cout << " into="<< histPath.toStdString()<<endl;
7.180 - cout << " undosAvail="<<undosAvail<<endl;
7.181 - cout << " curStep="<<curStep<<endl;
7.182 + //cout << " into="<< histPath.toStdString()<<endl;
7.183 + cout << " undosTotal="<<undosTotal<<
7.184 + ", undosAvail="<<undosAvail<<
7.185 + ", curStep="<<curStep<<endl;
7.186 cout << " ---------------------------"<<endl;
7.187 cout << " comment="<<comment.toStdString()<<endl;
7.188 cout << " undoCom="<<undoCommand.toStdString()<<endl;
7.189 cout << " undoSel="<<undoSelection.toStdString()<<endl;
7.190 cout << " redoCom="<<redoCom.toStdString()<<endl;
7.191 cout << " redoSel="<<redoSelection.toStdString()<<endl;
7.192 - cout << " ---------------------------"<<endl<<endl;
7.193 + cout << " ---------------------------"<<endl;
7.194 }
7.195
7.196 void MapEditor::parseAtom(const QString &atom)
7.197 @@ -692,8 +720,8 @@
7.198 {
7.199 if (api.checkParamCount(2))
7.200 {
7.201 - s=api.parString (ok,0);
7.202 - t=api.parString (ok,1);
7.203 + s=api.parString (ok,0); // undo selection
7.204 + t=api.parString (ok,1); // backup dir
7.205 undoXML(s,t);
7.206 }
7.207 } else if (com=="select")
7.208 @@ -711,6 +739,7 @@
7.209 // Any errors?
7.210 if (api.error())
7.211 {
7.212 + // TODO Error handling
7.213 qWarning("MapEditor::parseAtom: Error!");
7.214 qWarning(api.errorDesc());
7.215 }
7.216 @@ -1467,43 +1496,6 @@
7.217 }
7.218 }
7.219
7.220 -void MapEditor::editHeading()
7.221 -{
7.222 -/* FIXME not needed any longer
7.223 - if (selection &&
7.224 - (typeid(*selection) == typeid(BranchObj) ||
7.225 - typeid(*selection) == typeid(MapCenterObj) ) )
7.226 - {
7.227 - editingBO=(BranchObj*)selection;
7.228 - ensureSelectionVisible();
7.229 - QPoint p = worldMatrix().map(QPoint (editingBO->x(),editingBO->y()));
7.230 -
7.231 - QDialog *d =new QDialog(NULL);
7.232 - QLineEdit *le=new QLineEdit (d);
7.233 - d->setWindowFlags (Qt::FramelessWindowHint);
7.234 - QPoint q=mapToGlobal (QPoint(0,0));
7.235 - d->setGeometry(p.x()+q.x(),p.y()+q.y(),200,25);
7.236 - le->resize (d->size());
7.237 - le->setText (editingBO->getHeading());
7.238 - le->selectAll();
7.239 - connect (le, SIGNAL (returnPressed()), d, SLOT (accept()));
7.240 - d->activateWindow();
7.241 - d->exec();
7.242 -
7.243 - saveStateConstSelection(
7.244 - "setHeading (\""+editingBO->getHeading()+"\")",
7.245 - "setHeading (\""+le->text()+"\")",
7.246 - QString("Set heading of %1 to \"%2\"").arg(getName(editingBO)).arg(le->text()) );
7.247 - editingBO->setHeading(le->text() );
7.248 - editingBO=NULL;
7.249 - mapCenter->reposition();
7.250 - adjustCanvasSize();
7.251 - ensureSelectionVisible();
7.252 - activateWindow();
7.253 - }
7.254 -*/
7.255 -}
7.256 -
7.257 QString MapEditor::getHeading(bool &ok, QPoint &p)
7.258 {
7.259 if (selection &&
7.260 @@ -1513,8 +1505,8 @@
7.261 ok=true;
7.262 ensureSelectionVisible();
7.263 p = ((BranchObj*)selection)->getAbsPos();
7.264 - p.setY(p.y()+((BranchObj*)selection)->height()/2);
7.265 -// p = mapTo(mainWindow,worldMatrix().map( p));
7.266 + p.setX (p.x() - contentsX());
7.267 + p.setY (p.y() - contentsY() + ((BranchObj*)selection)->height()/2);
7.268 return ((BranchObj*)selection)->getHeading();
7.269 }
7.270 ok=false;
7.271 @@ -1523,7 +1515,6 @@
7.272
7.273 void MapEditor::setHeading(const QString &s)
7.274 {
7.275 - // Internal function, no saveState needed
7.276 if (selection &&
7.277 (typeid(*selection) == typeid(BranchObj) ||
7.278 typeid(*selection) == typeid(MapCenterObj) ) )
7.279 @@ -1682,7 +1673,7 @@
7.280 bo2->setHeading("");
7.281 }
7.282 if (actionSettingsAutoedit->isOn() )
7.283 - editHeading();
7.284 + mainWindow->editHeading();
7.285 if (!actionSettingsAutoselectHeading->isOn()
7.286 && !wasScrolled)
7.287 {
7.288 @@ -1698,12 +1689,13 @@
7.289 {
7.290 if (selection && typeid(*selection) ==typeid(BranchObj) )
7.291 {
7.292 - BranchObj* bo=dynamic_cast <BranchObj*> (selection);
7.293 + BranchObj* bo=(BranchObj*)selection;
7.294 BranchObj* par=(BranchObj*)(bo->getParObj());
7.295 bo->unselect();
7.296 if (selection->getDepth()>1)
7.297 // Normal branch, save parent with childs
7.298 saveStatePart(par,QString("Delete %1").arg(getName(bo)));
7.299 + // naveState (UndoCom, par, QString("insertBranchAt (%1)", bo, "", QString ("Delete %1").arg(getName(bo))));
7.300 else
7.301 // Mainbranch, save whole map
7.302 // TODO Better would be to insert mainbranch again at pos
7.303 @@ -1719,7 +1711,7 @@
7.304 }
7.305 if (selection && typeid(*selection) ==typeid(FloatImageObj) )
7.306 {
7.307 - FloatImageObj* fio=dynamic_cast <FloatImageObj*> (selection);
7.308 + FloatImageObj* fio=(FloatImageObj*)selection;
7.309 BranchObj* par=(BranchObj*)(fio->getParObj());
7.310 saveStatePart(par, QString("Delete %1").arg(getName(fio)));
7.311 fio->unselect();
7.312 @@ -1775,6 +1767,12 @@
7.313 return false;
7.314 }
7.315
7.316 +QString MapEditor::getSelectString()
7.317 +{
7.318 + if (selection) return selection->getSelectString();
7.319 + return QString();
7.320 +}
7.321 +
7.322 void MapEditor::selectInt (LinkableMapObj *lmo)
7.323 {
7.324 if (lmo && selection != lmo)
7.325 @@ -2244,7 +2242,7 @@
7.326 BranchObj* MapEditor::findText (QString s, bool cs)
7.327 {
7.328 QTextDocument::FindFlags flags=0;
7.329 - if (cs) flags=QTextDocument::QTextDocument::FindCaseSensitively;
7.330 + if (cs) flags=QTextDocument::FindCaseSensitively;
7.331
7.332 if (!itFind)
7.333 { // Nothing found or new find process
7.334 @@ -2336,6 +2334,24 @@
7.335 return "";
7.336 }
7.337
7.338 +QStringList MapEditor::getURLs()
7.339 +{
7.340 + QStringList urls;
7.341 + if (selection && (typeid(*selection) == typeid(BranchObj) ||
7.342 + typeid(*selection) == typeid(MapCenterObj)) )
7.343 + {
7.344 + BranchObj *bo=(BranchObj*)selection;
7.345 + bo=bo->first();
7.346 + while (bo)
7.347 + {
7.348 + if (!bo->getURL().isEmpty()) urls.append( bo->getURL());
7.349 + bo=bo->next();
7.350 + }
7.351 + }
7.352 + return urls;
7.353 +}
7.354 +
7.355 +
7.356 void MapEditor::editHeading2URL()
7.357 {
7.358 if (selection && (typeid(*selection) == typeid(BranchObj) ||
7.359 @@ -2454,6 +2470,24 @@
7.360
7.361 }
7.362
7.363 +QStringList MapEditor::getVymLinks()
7.364 +{
7.365 + QStringList links;
7.366 + if (selection && (typeid(*selection) == typeid(BranchObj) ||
7.367 + typeid(*selection) == typeid(MapCenterObj)) )
7.368 + {
7.369 + BranchObj *bo=(BranchObj*)selection;
7.370 + bo=bo->first();
7.371 + while (bo)
7.372 + {
7.373 + if (!bo->getVymLink().isEmpty()) links.append( bo->getVymLink());
7.374 + bo=bo->next();
7.375 + }
7.376 + }
7.377 + return links;
7.378 +}
7.379 +
7.380 +
7.381 void MapEditor::removeBranchKeepChilds()
7.382 {
7.383 if (selection && (typeid(*selection) == typeid(BranchObj) ))
7.384 @@ -2579,14 +2613,14 @@
7.385 // Take care of links
7.386 if (bo->countXLinks()==0)
7.387 {
7.388 - branchLinksContextMenuEdit->clear();
7.389 - branchLinksContextMenuFollow->clear();
7.390 + branchXLinksContextMenuEdit->clear();
7.391 + branchXLinksContextMenuFollow->clear();
7.392 } else
7.393 {
7.394 BranchObj *bot;
7.395 QString s;
7.396 - branchLinksContextMenuEdit->clear();
7.397 - branchLinksContextMenuFollow->clear();
7.398 + branchXLinksContextMenuEdit->clear();
7.399 + branchXLinksContextMenuFollow->clear();
7.400 for (int i=0; i<=bo->countXLinks();i++)
7.401 {
7.402 bot=bo->XLinkTargetAt(i);
7.403 @@ -2595,8 +2629,8 @@
7.404 s=bot->getHeading();
7.405 if (s.length()>25)
7.406 s=s.left(25)+"...";
7.407 - branchLinksContextMenuFollow->addAction (s);
7.408 - branchLinksContextMenuEdit->addAction (s);
7.409 + branchXLinksContextMenuFollow->addAction (s);
7.410 + branchXLinksContextMenuEdit->addAction (s);
7.411 }
7.412 }
7.413 }
7.414 @@ -3631,7 +3665,7 @@
7.415 if (selection) selection->unselect();
7.416 selection=lmo;
7.417 selection->select();
7.418 - editHeading();
7.419 + mainWindow->editHeading();
7.420 }
7.421 }
7.422 }
8.1 --- a/mapeditor.h Tue Aug 29 08:31:42 2006 +0000
8.2 +++ b/mapeditor.h Wed Aug 30 12:16:25 2006 +0000
8.3 @@ -2,14 +2,14 @@
8.4 #define MAPEDITOR_H
8.5
8.6 #include <q3canvas.h>
8.7 +//#include <q3filedialog.h>
8.8 +//#include <q3process.h>
8.9 +#include <QBuffer>
8.10 +#include <QContextMenuEvent>
8.11 #include <QCursor>
8.12 -//#include <q3filedialog.h>
8.13 +#include <QDragEnterEvent>
8.14 +#include <QDropEvent>
8.15 #include <QEvent>
8.16 -//#include <q3process.h>
8.17 -#include <qbuffer.h>
8.18 -#include <QDragEnterEvent>
8.19 -#include <QContextMenuEvent>
8.20 -#include <QDropEvent>
8.21 #include <QLineEdit>
8.22 #include <QMouseEvent>
8.23 #include <QPixmap>
8.24 @@ -46,7 +46,8 @@
8.25 void saveStatePart (LinkableMapObj *, const QString &);
8.26 void saveStateConstSelection (const QString &, const QString &, const QString &);
8.27 void saveStateX (LinkableMapObj *, const QString &, const QString &);
8.28 - void saveState(const SaveMode&, const QString &, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &);
8.29 + void saveStateComData (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
8.30 + void saveState(const SaveMode&, LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
8.31 void parseAtom(const QString &);
8.32
8.33 void addFloatImage(const QPixmap &img);
8.34 @@ -99,7 +100,6 @@
8.35 void move(const int &,const int&);
8.36 void moveBranchUp();
8.37 void moveBranchDown();
8.38 - void editHeading(); // Start editing heading
8.39 QString getHeading (bool &,QPoint &); // Get heading, ok if selection is branch
8.40 void setHeading(const QString &);
8.41 private:
8.42 @@ -113,7 +113,8 @@
8.43 LinkableMapObj* getSelection(); // returns selection
8.44 void unselect(); // before changing current noteedit
8.45 void reselect(); // after changing current noteedit
8.46 - bool select(const QString &); // Select
8.47 + bool select(const QString &); // Select by string
8.48 + QString getSelectString();
8.49 private:
8.50 void selectInt(LinkableMapObj*);
8.51 void selectNextBranchInt(); // Increment number of branch
8.52 @@ -137,12 +138,14 @@
8.53 void findReset(); // Reset Find
8.54 void editURL(); // edit the URL
8.55 QString getURL(); // returns URL of selection or ""
8.56 + QStringList getURLs(); // returns URLs of subtree
8.57 void editHeading2URL(); // copy heading to URL
8.58 void editBugzilla2URL(); // create URL to Bugzilla
8.59 void editFATE2URL(); // create URL to FATE
8.60 void editVymLink(); // edit link to another map
8.61 void deleteVymLink(); // delete link to another map
8.62 QString getVymLink(); // return path to map
8.63 + QStringList getVymLinks(); // return paths in subtree
8.64 void toggleHideExport(); // toggle the export flag
8.65 void removeBranchKeepChilds(); // remove but keep childs
8.66 void removeChilds(); // remove childs
9.1 --- a/tex/vym.changelog Tue Aug 29 08:31:42 2006 +0000
9.2 +++ b/tex/vym.changelog Wed Aug 30 12:16:25 2006 +0000
9.3 @@ -1,3 +1,16 @@
9.4 +-------------------------------------------------------------------
9.5 +Wed Aug 30 14:14:56 CEST 2006 - uwedr
9.6 +
9.7 +- Version: 1.8.54
9.8 +- Bugfix: Editing headings now works both on Mac and Linux
9.9 +
9.10 +-------------------------------------------------------------------
9.11 +Mon Aug 28 13:15:35 CEST 2006 - uwe
9.12 +
9.13 +- Version: 1.8.53
9.14 +- Feature: Opening of all URLs in a subtree
9.15 +- Feature: Opening of all vymLinks in a subtree
9.16 +
9.17 -------------------------------------------------------------------
9.18 Tue Aug 15 13:39:42 CEST 2006 - uwedr
9.19
10.1 --- a/version.h Tue Aug 29 08:31:42 2006 +0000
10.2 +++ b/version.h Wed Aug 30 12:16:25 2006 +0000
10.3 @@ -2,7 +2,7 @@
10.4 #define VERSION_H
10.5
10.6 #define __VYM "VYM"
10.7 -#define __VYM_VERSION "1.8.53"
10.8 -#define __BUILD_DATE "August 23, 2006"
10.9 +#define __VYM_VERSION "1.8.54"
10.10 +#define __BUILD_DATE "August 30, 2006"
10.11
10.12 #endif