# HG changeset patch # User insilmaril # Date 1116862100 0 # Node ID c810a11d11d9777072dc52fbdffbc6d958879160 # Parent dba9303a1a5cee3bd7910ebdbb3cb869f8034c7f 1.6.6 Exclusive flags added diff -r dba9303a1a5c -r c810a11d11d9 branchobj.cpp --- a/branchobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/branchobj.cpp Mon May 23 15:28:20 2005 +0000 @@ -1305,7 +1305,7 @@ if (!status.isEmpty()) mainWindow->statusMessage (status); // Update Toolbar - standardFlags->updateToolBar(); + standardFlags->updateToolbar(); // Update Browserbutton if (!url.isEmpty()) @@ -1339,7 +1339,7 @@ textEditor->setInactive(); // unselect all buttons in toolbar - standardFlagsDefault->updateToolBar(); + standardFlagsDefault->updateToolbar(); } QString BranchObj::getSelectString() diff -r dba9303a1a5c -r c810a11d11d9 demos/todo.vym Binary file demos/todo.vym has changed diff -r dba9303a1a5c -r c810a11d11d9 flagobj.cpp --- a/flagobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/flagobj.cpp Mon May 23 15:28:20 2005 +0000 @@ -30,6 +30,7 @@ void FlagObj::init () { name="undefined"; + group="undefined"; icon=new ImageObj (canvas); icon->move (absPos.x(), absPos.y() ); @@ -41,6 +42,7 @@ { MapObj::copy(other); name=other->name; + group=other->group; tooltip=other->tooltip; state=other->state; icon->copy(other->icon); @@ -95,6 +97,16 @@ return name; } +void FlagObj::setGroup (const QString &n) +{ + group=n; +} + +const QString FlagObj::getGroup() +{ + return group; +} + void FlagObj::setToolTip(const QString &n) { tooltip=n; diff -r dba9303a1a5c -r c810a11d11d9 flagobj.h --- a/flagobj.h Wed May 18 07:39:58 2005 +0000 +++ b/flagobj.h Mon May 23 15:28:20 2005 +0000 @@ -24,6 +24,8 @@ void load (const QPixmap&); void setName (const QString&); const QString getName (); + void setGroup (const QString&); + const QString getGroup(); void setToolTip(const QString&); const QString getToolTip(); void setButton (QAction*); @@ -40,6 +42,7 @@ protected: QString name; + QString group; QString tooltip; bool state; bool used; diff -r dba9303a1a5c -r c810a11d11d9 flagrowobj.cpp --- a/flagrowobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/flagrowobj.cpp Mon May 23 15:28:20 2005 +0000 @@ -133,7 +133,7 @@ return false; } -void FlagRowObj::toggle (const QString &foname) +void FlagRowObj::toggle (const QString &foname, bool exclusive) { FlagObj *fo=findFlag (foname); if (fo) @@ -150,6 +150,11 @@ { fo=addFlag (fo); fo->activate(); + if (exclusive) + { + deactivateGroup (fo); + updateToolbar(); + } } else qWarning ("FlagRowObj ("+name+")::toggle ("+foname+") failed - could not find it in parentRow"); } @@ -190,6 +195,7 @@ } } + void FlagRowObj::deactivate (const QString &foname) { FlagObj *fo=findFlag (foname); @@ -204,13 +210,23 @@ { FlagObj *fo; for (fo=flag.first();fo; fo=flag.next() ) - { fo->deactivate(); - } } else qWarning ("FlagRowObj::deactivateAll mustn't be called for ordinary rows"); } +void FlagRowObj::deactivateGroup (FlagObj *keepfo) +{ + // deactivate all flags in keepof, but keep keepfo [sic!] + if (keepfo) + { + FlagObj *fo; + for (fo=flag.first();fo; fo=flag.next() ) + if (keepfo->getGroup()==fo->getGroup() && keepfo!=fo) + flag.remove(fo); + } +} + void FlagRowObj::setEnabled (bool b) { // If we have no parent, we are the default FlagRowObj @@ -262,6 +278,7 @@ void FlagRowObj::makeToolbar (QMainWindow *w, const QString &n) { + //Only make toolbar for the parentrow, not each row in branches if (!parentRow) { // create bar and buttons @@ -291,7 +308,7 @@ qWarning ("FlagRowObj::makeToolbar mustn't be called for ordinary rows"); } -void FlagRowObj::updateToolBar() +void FlagRowObj::updateToolbar() { FlagObj *fo; if (parentRow) @@ -301,7 +318,7 @@ // In parentRow activate all existing (==active) flags for (fo=flag.first();fo; fo=flag.next() ) parentRow->activate(fo->getName()); - parentRow->updateToolBar(); + parentRow->updateToolbar(); } else { // We are the toolbar default diff -r dba9303a1a5c -r c810a11d11d9 flagrowobj.h --- a/flagrowobj.h Wed May 18 07:39:58 2005 +0000 +++ b/flagrowobj.h Mon May 23 15:28:20 2005 +0000 @@ -22,16 +22,17 @@ virtual void calcBBoxSize(); virtual QString getFlagName (const QPoint &p); // Find flag by position bool isActive(const QString&); - void toggle (const QString&); + void toggle (const QString&,bool); void activate(const QString&); void deactivate(const QString&); void deactivateAll(); + void deactivateGroup(FlagObj *); void setEnabled (bool); void resetUsedCounter(); QString saveToDir (const QString &,const QString &,bool); void setName (const QString&); // prefix for exporting flags to dir void makeToolbar (QMainWindow*, const QString &); // Create Toolbar buttons - void updateToolBar(); // Update Toolbar buttons + void updateToolbar(); // Update Toolbar buttons private: FlagRowObj* parentRow; // look for flags in this row FlagObj* findFlag (const QString&); diff -r dba9303a1a5c -r c810a11d11d9 main.cpp --- a/main.cpp Wed May 18 07:39:58 2005 +0000 +++ b/main.cpp Mon May 23 15:28:20 2005 +0000 @@ -91,6 +91,7 @@ QAction *actionSettingsPasteNewHeading; QAction *actionSettingsAutoedit; QAction *actionSettingsUseDelKey; +QAction *actionSettingsUseFlagGroups; QPopupMenu *branchContextMenu; QPopupMenu *branchAddContextMenu; diff -r dba9303a1a5c -r c810a11d11d9 mainwindow.cpp --- a/mainwindow.cpp Wed May 18 07:39:58 2005 +0000 +++ b/mainwindow.cpp Mon May 23 15:28:20 2005 +0000 @@ -129,6 +129,7 @@ extern QAction* actionSettingsAutoselectText; extern QAction* actionSettingsPasteNewHeading; extern QAction* actionSettingsUseDelKey; +extern QAction* actionSettingsUseFlagGroups; extern QPopupMenu* branchContextMenu; extern QPopupMenu* branchAddContextMenu; @@ -253,6 +254,7 @@ settings.writeEntry( "/vym/mapeditor/editmode/pastenewheading",actionSettingsPasteNewHeading->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/autoedit",actionSettingsAutoedit->isOn() ); settings.writeEntry( "/vym/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() ); + settings.writeEntry( "/vym/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() ); QString s; int maps=lastMaps.count(); @@ -517,8 +519,6 @@ actionEditHeading=a; a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_F2, this, "editHeading" ); connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); - a = new QAction( tr( "edit Heading" ),tr( "Edit heading" ), Key_E, this, "editHeading" ); - connect( a, SIGNAL( activated() ), this, SLOT( editHeading() ) ); a->setEnabled (false); a->addTo ( menu ); actionEditHeading=a; @@ -834,6 +834,12 @@ a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useDelKey",false) ); a->addTo( menu ); actionSettingsUseDelKey=a; + + a= new QAction( tr( "Use groups in flag toolbars" ), QPixmap(), tr( "Enable flag groups" ), 0, this, "flaggroups" ); + a->setToggleAction(true); + a->setOn ( settings.readBoolEntry ("/vym/mapeditor/editmode/useFlagGroups",true) ); + a->addTo( menu ); + actionSettingsUseFlagGroups=a; } // Test Actions @@ -964,7 +970,8 @@ a = new QAction( tr( "Export as ASCII (still experimental)" ), QPixmap(), tr( "Export (ASCII)" ), 0, this, "exportASCII" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportASCII() ) ); - a->addTo( exportMenu ); + // FIXME deactivated, doesn't work with QRichtext anyway + // a->addTo( exportMenu ); a = new QAction( tr( "Export XML" ), QPixmap(), tr( "Export XML" ), 0, this, "exportXML" ); connect( a, SIGNAL( activated() ), this, SLOT( fileExportXML() ) ); @@ -2307,8 +2314,12 @@ void Main::helpDoc() { QString docpath; - // default path in SUSE LINUX - docpath="/usr/share/doc/packages/vym/doc/vym.pdf"; + #if defined(Q_OS_MACX) + docpath="./vym.app/Contents/vym.pdf"; + #else + // default path in SUSE LINUX + docpath="/usr/share/doc/packages/vym/doc/vym.pdf"; + #endif if (!QFile (docpath).exists() ) { diff -r dba9303a1a5c -r c810a11d11d9 mapeditor.cpp --- a/mapeditor.cpp Wed May 18 07:39:58 2005 +0000 +++ b/mapeditor.cpp Mon May 23 15:28:20 2005 +0000 @@ -121,6 +121,7 @@ extern QAction *actionSettingsAutoselectHeading; extern QAction *actionSettingsAutoselectText; extern QAction *actionSettingsPasteNewHeading; +extern QAction *actionSettingsUseFlagGroups; extern QPopupMenu *branchContextMenu; extern QPopupMenu *branchLinksContextMenu; @@ -193,22 +194,26 @@ FlagObj *fo = new FlagObj (mapCanvas); fo->load(QPixmap(flag_exclamationmark_xpm)); - fo->setName("exclamationmark"); + fo->setName ("exclamationmark"); + fo->setGroup("standard-mark"); fo->setToolTip(tr("Take care!","Standardflag")); standardFlagsDefault->addFlag (fo); // makes deep copy fo->load(QPixmap(flag_questionmark_xpm)); fo->setName("questionmark"); + fo->setGroup("standard-mark"); fo->setToolTip(tr("Really?","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_hook_green_xpm)); fo->setName("hook-green"); + fo->setGroup("standard-hook"); fo->setToolTip(tr("ok!","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_cross_red_xpm)); fo->setName("cross-red"); + fo->setGroup("standard-hook"); fo->setToolTip(tr("Not ok!","Standardflag")); standardFlagsDefault->addFlag (fo); @@ -219,11 +224,13 @@ fo->load(QPixmap(flag_smiley_good_xpm)); fo->setName("smiley-good"); + fo->setGroup("standard-smiley"); fo->setToolTip(tr("Good","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_smiley_sad_xpm)); fo->setName("smiley-sad"); + fo->setGroup("standard-smiley"); fo->setToolTip(tr("Bad","Standardflag")); standardFlagsDefault->addFlag (fo); @@ -239,21 +246,26 @@ fo->load(QPixmap(flag_arrow_up_xpm)); fo->setName("arrow-up"); + fo->setGroup("standard-arrow"); fo->setToolTip(tr("Important","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_arrow_down_xpm)); fo->setName("arrow-down"); + fo->setGroup("standard-arrow"); fo->setToolTip(tr("Unimportant","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_thumb_up_xpm)); fo->setName("thumb-up"); + fo->setGroup("standard-thumb"); fo->setToolTip(tr("I like this","Standardflag")); standardFlagsDefault->addFlag (fo); fo->load(QPixmap(flag_thumb_down_xpm)); fo->setName("thumb-down"); + fo->setGroup("standard-thumb"); + fo->setToolTip(tr("I like this","Standardflag")); fo->setToolTip(tr("I do not like this","Standardflag")); standardFlagsDefault->addFlag (fo); @@ -549,7 +561,6 @@ if (writeflags) standardFlagsDefault->saveToDir (tmpdir+"/flags/","",writeflags); - return s; } @@ -1996,7 +2007,7 @@ { setChanged(); saveState(PartOfMap,selection); - ((BranchObj*)(selection))->toggleStandardFlag (f); + ((BranchObj*)(selection))->toggleStandardFlag (f,actionSettingsUseFlagGroups); } } @@ -2235,6 +2246,7 @@ uint b=0; uint f=0; uint n=0; + uint xl=0; BranchObj *bo; bo=mapCenter->first(); while (bo) @@ -2242,9 +2254,11 @@ if (!bo->getNote().isEmpty() ) n++; f+= bo->countFloatImages(); b++; + xl+=bo->countXLinks(); bo=bo->next(); } stats+=QString ("%1 branches\n").arg (b-1,6); + stats+=QString ("%1 xLinks \n").arg (xl-1,6); stats+=QString ("%1 notes\n").arg (n,6); stats+=QString ("%1 images\n").arg (f,6); dia.setStats (stats); @@ -2346,7 +2360,10 @@ actionEditCopy->setEnabled (true); actionEditCut->setEnabled (true); - actionEditPaste->setEnabled (true); + if (clipboardME->getMapCenter()->countBranches()>0) + actionEditPaste->setEnabled (true); + else + actionEditPaste->setEnabled (false); for (a=actionListBranches.first();a;a=actionListBranches.next()) a->setEnabled(true); actionEditDelete->setEnabled (true); @@ -2668,6 +2685,7 @@ QMessageBox::critical (0,tr("Critical Import Error"),tr("Cannot find the directory")); else { + // Recursively add subdirs importDir (bo,d); d.cdUp(); } @@ -2685,6 +2703,9 @@ bo=dst->getLastBranch(); bo->setHeading (fi->fileName() ); bo->setColor (QColor("black"),false); + if (fi->fileName().right(4) == ".vym" ) + bo->setVymLink (fi->filePath()); + ++itfile; } } diff -r dba9303a1a5c -r c810a11d11d9 ornamentedobj.cpp --- a/ornamentedobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/ornamentedobj.cpp Mon May 23 15:28:20 2005 +0000 @@ -174,9 +174,9 @@ return note.getNote(); } -void OrnamentedObj::toggleStandardFlag(QString f) +void OrnamentedObj::toggleStandardFlag(QString f, bool exclusive) { - standardFlags->toggle(f); + standardFlags->toggle(f,exclusive); calcBBoxSize(); positionBBox(); move (absPos.x(), absPos.y() ); diff -r dba9303a1a5c -r c810a11d11d9 ornamentedobj.h --- a/ornamentedobj.h Wed May 18 07:39:58 2005 +0000 +++ b/ornamentedobj.h Mon May 23 15:28:20 2005 +0000 @@ -30,7 +30,7 @@ virtual void setNote(QString); // set note virtual void setNote(NoteObj); // set note virtual QString getNote(); // returns note - virtual void toggleStandardFlag(QString); + virtual void toggleStandardFlag(QString, bool); virtual void activateStandardFlag(QString); virtual QString getSystemFlagName (const QPoint &p); diff -r dba9303a1a5c -r c810a11d11d9 tex/vym.tex --- a/tex/vym.tex Wed May 18 07:39:58 2005 +0000 +++ b/tex/vym.tex Mon May 23 15:28:20 2005 +0000 @@ -168,17 +168,18 @@ Select the mapcenter "New map" in the middle of the mapeditor by left-clicking with the mouse. It will turn yellow to show that is -selected. There are two ways to add a new branch to the center: +selected. There are several ways to add a new branch to the center: \begin{itemize} - \item Main menu on top of mapeditor window: - Edit \ra Add new Branch - \item Press \key{Ins} + \item Using the mouse: Open the context meny by clicking with the + right mouse button (CTRL-Click on Mac) onto the + mapcenter and choose Add \ra Add as child + \item Press \key{Ins} or \key{A} \end{itemize} A new branch will appear and you will be able to type the heading of the branch. Finish adding the new branch by pressing \key{Enter}. %tipp Sometimes it comes handy to add a new branch above or below the current -one. Use \key{Ins} together with \key{Shift} or \key{Ctrl}. +one. Use \key{Ins} together with \key{Shift} or \key{Ctrl}. \subsection{Navigate through a map} \subsubsection*{Select branches} @@ -236,7 +237,7 @@ To scroll or unscroll a branch and its childs, press the \begin{itemize} - \item \key{Scroll} key or + \item \key{Scroll} key or \key{S} \item press the middle-mouse button or \item choose the little scroll from the toolbar. \end{itemize} @@ -713,14 +714,17 @@ \begin{longtable}{|lcp{8cm}l|} \hline Version & & Comment & Date \\ \hline \hline \endhead \hline \endfoot -1.6.5 & - & removing a branch and keeping its childs & 2005-05-03 \\ +1.6.6 & - & Exclusive standard flags & 2005-05-23 \\ +1.6.5 & - & removing a branch and keeping its childs & 2005-05-19 \\ & - & removing childs of a branch & \\ & - & insert branch and make selection its child& \\ & - & restructured branch context menu & \\ in a basic version (straight line) & 2005-04-15\\ + & - & New shortcuts for use on Mac OS X & \\ + & - & Importing directories generates vymlinks now & \\ & - & Bugfix: Changing linkstyle now automatically redraws all links again& \\ - & - & New shortcuts (F1-F3) for use on Mac OS X& \\ + & - & Bugfix: Paste icon is disabled if clipboard is empty &\\ 1.6.4 & - & xLinks (arbitrary connection between 2 branches) works in a basic version (straight line) & 2005-04-15\\ 1.6.3 & - & Bugfix: Saving of selection to a vym part (.vyp) &2005-03-30\\ diff -r dba9303a1a5c -r c810a11d11d9 version.h --- a/version.h Wed May 18 07:39:58 2005 +0000 +++ b/version.h Mon May 23 15:28:20 2005 +0000 @@ -1,7 +1,7 @@ #ifndef VERSION_H #define VERSION_H -#define __VYM_VERSION__ "1.6.5" -#define __BUILD_DATE__ "May 17, 2005" +#define __VYM_VERSION__ "1.6.6" +#define __BUILD_DATE__ "May 23, 2005" #endif diff -r dba9303a1a5c -r c810a11d11d9 xlinkobj.cpp --- a/xlinkobj.cpp Wed May 18 07:39:58 2005 +0000 +++ b/xlinkobj.cpp Mon May 23 15:28:20 2005 +0000 @@ -88,6 +88,7 @@ int XLinkObj::getWidth() { + cout << "XLO w="<getHeading()<addXLink (this); endBranch->addXLink (this); - setVisibility (true); + setVisibility (); return true; } else return false; @@ -266,17 +272,27 @@ QString XLinkObj::saveToDir () { - QString s; - if (beginBranch && endBranch) + QString s=""; + if (beginBranch && endBranch &&xLinkState==activeXLink) { - QString colAttr=attribut ("color",color.name()); - QString widAttr=attribut ("width",QString().setNum(width,10)); - QString begSelAttr=attribut ("beginBranch",beginBranch->getSelectString()); - QString endSelAttr=attribut ("endBranch", endBranch->getSelectString()); - s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr); + if (beginBranch==endBranch && xLinkState) + { + //FIXME testing + //cout << " identical ends: "<getSelectString()<getSelectString()); + QString endSelAttr=attribut ("endBranch", endBranch->getSelectString()); + s=beginElement ("xlink", colAttr +widAttr +begSelAttr +endSelAttr); - s+=endElement ("xlink"); + s+=endElement ("xlink"); + } } + //FIXME testing + //cout << s<getCanvas()); if (!a.value( "color").isEmpty() ) { @@ -548,13 +549,13 @@ { xlo->setEnd ((BranchObj*)(lmo)); xlo->activate(); - return true; } } - return true; // Not all branches there yet, no error + success=true; // Not all branches there yet, no error } } - return false; + delete (xlo); + return success; } bool mapBuilderHandler::readHtmlAttr (const QXmlAttributes& a)