Code simplifications
authorinsilmaril
Mon, 16 Oct 2006 12:42:54 +0000
changeset 3900e1aeb21cb78
parent 389 bb94eec7c8f3
child 391 59106708b5b5
Code simplifications
aboutdialog.cpp
aboutdialog.h
branchobj.cpp
branchobj.h
demos/todo.vym
main.cpp
mainwindow.cpp
mainwindow.h
mapeditor.cpp
mapeditor.h
texteditor.cpp
texteditor.h
version.h
     1.1 --- a/aboutdialog.cpp	Thu Sep 21 13:48:05 2006 +0000
     1.2 +++ b/aboutdialog.cpp	Mon Oct 16 12:42:54 2006 +0000
     1.3 @@ -5,10 +5,8 @@
     1.4  #include "aboutdialog.h"
     1.5  #include "version.h"
     1.6  #include "settings.h"
     1.7 -#include "mainwindow.h"
     1.8  
     1.9  
    1.10 -extern Main *mainWindow;
    1.11  extern Settings settings;
    1.12  extern QString iconPath;
    1.13  
    1.14 @@ -191,5 +189,11 @@
    1.15  {
    1.16  	QProcess *proc= new QProcess ();
    1.17  	proc->start( settings.value("/mainwindow/readerURL").toString(),QStringList ()<<url.toString());
    1.18 -	if (!proc->waitForStarted() &&mainWindow->settingsURL() ) setSource(url);
    1.19 +	//if (!proc->waitForStarted() &&mainWindow->settingsURL() ) setSource(url);
    1.20 +	if (!proc->waitForStarted() )
    1.21 +		QMessageBox::warning(0, 
    1.22 +		tr("Warning"),
    1.23 +		tr("Couldn't find a viewer to open %1.\n").arg(url)+
    1.24 +		tr("Please use Settings->")+tr("Set application to open an URL"));
    1.25 +
    1.26  }
     2.1 --- a/aboutdialog.h	Thu Sep 21 13:48:05 2006 +0000
     2.2 +++ b/aboutdialog.h	Mon Oct 16 12:42:54 2006 +0000
     2.3 @@ -7,6 +7,7 @@
     2.4  #include <QDialog>
     2.5  #include <QPushButton>
     2.6  #include <QString>
     2.7 +#include <QMessageBox>
     2.8  
     2.9  class AboutTextBrowser;
    2.10  /////////////////////////////////////////////////////////////////////////////
     3.1 --- a/branchobj.cpp	Thu Sep 21 13:48:05 2006 +0000
     3.2 +++ b/branchobj.cpp	Mon Oct 16 12:42:54 2006 +0000
     3.3 @@ -6,7 +6,6 @@
     3.4  extern TextEditor *textEditor;
     3.5  extern Main *mainWindow;
     3.6  extern FlagRowObj *standardFlagsDefault;
     3.7 -extern QAction *actionEditOpenURL;
     3.8  
     3.9  
    3.10  /////////////////////////////////////////////////////////////////
    3.11 @@ -1169,7 +1168,6 @@
    3.12  {
    3.13  	savePosInAngle();
    3.14      int i=branch.find(bo1);
    3.15 -	cout << "BO: i="<<i<<endl;
    3.16      if (i>0) 
    3.17  	{	// -1 if bo1 not found 
    3.18  		branch.at(i)->angle--;
     4.1 --- a/branchobj.h	Thu Sep 21 13:48:05 2006 +0000
     4.2 +++ b/branchobj.h	Mon Oct 16 12:42:54 2006 +0000
     4.3 @@ -1,12 +1,13 @@
     4.4  #ifndef BRANCHOBJ_H
     4.5  #define BRANCHOBJ_H
     4.6  
     4.7 +#include <Q3PtrList>
     4.8 +
     4.9  #include "floatimageobj.h"
    4.10  #include "linkablemapobj.h"
    4.11  #include "ornamentedobj.h"
    4.12  #include "xlinkobj.h"
    4.13 -//Added by qt3to4:
    4.14 -#include <Q3PtrList>
    4.15 +
    4.16  
    4.17  class BranchObjPtrList : public Q3PtrList<BranchObj>
    4.18  {
     5.1 Binary file demos/todo.vym has changed
     6.1 --- a/main.cpp	Thu Sep 21 13:48:05 2006 +0000
     6.2 +++ b/main.cpp	Mon Oct 16 12:42:54 2006 +0000
     6.3 @@ -2,11 +2,9 @@
     6.4  #include <QPixmap>
     6.5  #include <QTranslator>
     6.6  #include <QDir>
     6.7 -#include <q3ptrlist.h>
     6.8  #include <QTextCodec>
     6.9  #include <q3network.h>
    6.10 -#include <QMenu>
    6.11 -#include <QActionGroup>
    6.12 +//#include <QActionGroup>
    6.13  
    6.14  #include "settings.h"
    6.15  #include "options.h"
    6.16 @@ -29,98 +27,6 @@
    6.17  FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
    6.18  FlagRowObj *standardFlagsDefault;
    6.19  
    6.20 -// Lists of actions
    6.21 -// (QActionGroup could not be "enabled")
    6.22 -Q3PtrList <QAction> actionListBranches;
    6.23 -
    6.24 -// Actions which change sometimes
    6.25 -QAction *actionFileSave;
    6.26 -QAction *actionFilePrint;
    6.27 -QAction *actionEditUndo;
    6.28 -QAction *actionEditRedo;
    6.29 -QAction *actionEditCopy;
    6.30 -QAction *actionEditCut;
    6.31 -QAction *actionEditPaste;
    6.32 -QAction *actionEditMoveUp;
    6.33 -QAction *actionEditMoveDown;
    6.34 -QAction *actionEditToggleScroll;
    6.35 -QAction *actionEditOpenURL;
    6.36 -QAction *actionEditOpenURLTab;
    6.37 -QAction *actionEditOpenMultipleURLTabs;
    6.38 -QAction *actionEditURL;
    6.39 -QAction *actionEditHeading2URL;
    6.40 -QAction *actionEditBugzilla2URL;
    6.41 -QAction *actionEditFATE2URL;
    6.42 -QAction *actionEditOpenVymLink;
    6.43 -QAction *actionEditOpenMultipleVymLinks;
    6.44 -QAction *actionEditVymLink;
    6.45 -QAction *actionEditToggleHideExport;
    6.46 -QAction *actionEditDeleteVymLink;
    6.47 -QAction *actionEditMapInfo;
    6.48 -QAction *actionEditHeading;
    6.49 -QAction *actionEditDelete;
    6.50 -QAction *actionEditAddBranch;
    6.51 -QAction *actionEditAddBranchHere;
    6.52 -QAction *actionEditAddBranchAbove;
    6.53 -QAction *actionEditAddBranchBelow;
    6.54 -QAction *actionEditRemoveBranchKeepChilds;
    6.55 -QAction *actionEditRemoveChilds;
    6.56 -QAction *actionEditImportAdd;
    6.57 -QAction *actionEditImportReplace;
    6.58 -QAction *actionEditSaveBranch;
    6.59 -QAction *actionEditSelectFirst;
    6.60 -QAction *actionEditSelectLast;
    6.61 -QAction *actionEditLoadImage;
    6.62 -
    6.63 -QAction *actionFormatColor;		
    6.64 -QAction *actionFormatPickColor;		
    6.65 -QAction *actionFormatColorBranch;
    6.66 -QAction *actionFormatColorSubtree;
    6.67 -QAction *actionFormatBackColor;
    6.68 -QAction *actionFormatLinkColorHint;
    6.69 -QAction *actionFormatLinkColor;		
    6.70 -
    6.71 -QActionGroup *actionGroupModModes;
    6.72 -QAction *actionModModeColor;
    6.73 -QAction *actionModModeLink;
    6.74 -QAction *actionModModeCopy;
    6.75 -
    6.76 -QActionGroup *actionGroupFormatFrameTypes;
    6.77 -QAction *actionFormatFrameNone;
    6.78 -QAction *actionFormatFrameRectangle;
    6.79 -
    6.80 -QActionGroup *actionGroupFormatLinkStyles;
    6.81 -QAction *actionFormatIncludeImagesVer;
    6.82 -QAction *actionFormatIncludeImagesHor;
    6.83 -QAction *actionFormatHideLinkUnselected;
    6.84 -QAction *actionFormatLinkStyleLine;
    6.85 -QAction *actionFormatLinkStyleParabel;
    6.86 -QAction *actionFormatLinkStylePolyLine;
    6.87 -QAction *actionFormatLinkStylePolyParabel;
    6.88 -
    6.89 -QAction *actionViewToggleNoteEditor;
    6.90 -QAction *actionViewToggleHistoryWindow;
    6.91 -
    6.92 -QAction *actionSettingsAutoselectHeading;
    6.93 -QAction *actionSettingsAutoselectText;
    6.94 -QAction *actionSettingsAutoedit;
    6.95 -QAction *actionSettingsUseDelKey;
    6.96 -QAction *actionSettingsUseFlagGroups;
    6.97 -QAction *actionSettingsUseHideExport;
    6.98 -
    6.99 -
   6.100 -QMenu* branchContextMenu;
   6.101 -QMenu* branchAddContextMenu;
   6.102 -QMenu* branchRemoveContextMenu;
   6.103 -QMenu* branchLinksContextMenu;
   6.104 -QMenu* branchXLinksContextMenuEdit;
   6.105 -QMenu* branchXLinksContextMenuFollow;
   6.106 -QMenu* floatimageContextMenu;
   6.107 -QMenu* canvasContextMenu;
   6.108 -QMenu* fileLastMapsMenu;
   6.109 -QMenu* fileImportMenu;
   6.110 -QMenu* fileExportMenu;
   6.111 -
   6.112  
   6.113  Settings settings ("InSilmaril","vym"); // Organization, Application name
   6.114  
   6.115 @@ -177,13 +83,18 @@
   6.116  	} else
   6.117  	// ok, let's find my way on my own
   6.118  	{
   6.119 -		vymBaseDir.setPath ("/usr/share/vym");
   6.120 -		if (!vymBaseDir.exists())
   6.121 -		{
   6.122 -			vymBaseDir.setPath ("/usr/local/share/vym");
   6.123 +		#if defined (Q_OS_MACX)
   6.124 +			vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents");
   6.125 +
   6.126 +		#else
   6.127 +			vymBaseDir.setPath ("/usr/share/vym");
   6.128  			if (!vymBaseDir.exists())
   6.129 -				vymBaseDir.setPath(vymBaseDir.currentDirPath() );
   6.130 -		}		
   6.131 +			{
   6.132 +				vymBaseDir.setPath ("/usr/local/share/vym");
   6.133 +				if (!vymBaseDir.exists())
   6.134 +					vymBaseDir.setPath(vymBaseDir.currentDirPath() );
   6.135 +			}		
   6.136 +		#endif
   6.137  	}
   6.138  
   6.139  	iconPath=vymBaseDir.path()+"/icons/";
     7.1 --- a/mainwindow.cpp	Thu Sep 21 13:48:05 2006 +0000
     7.2 +++ b/mainwindow.cpp	Mon Oct 16 12:42:54 2006 +0000
     7.3 @@ -1,24 +1,10 @@
     7.4  #include "mainwindow.h"
     7.5  
     7.6  #include <QtGui>
     7.7 -#include <QPainter>
     7.8 -#include <QPrinter>
     7.9 -#include <QFile>
    7.10 +
    7.11  #include <q3filedialog.h>
    7.12 -#include <QColor>
    7.13 -#include <QColorDialog>
    7.14 -#include <QBitmap>
    7.15 -#include <QInputDialog>
    7.16 -//Added by qt3to4:
    7.17  #include <Q3StrList>
    7.18 -#include <QPixmap>
    7.19 -#include <QCloseEvent>
    7.20 -#include <QShowEvent>
    7.21 -#include <QHideEvent>
    7.22 -#include <Q3PopupMenu>
    7.23 -#include <QActionGroup>
    7.24  #include <Q3PtrList>
    7.25 -//#include <qdatetime.h>			// for random seed
    7.26  
    7.27  #include <iostream>
    7.28  #include <cstdlib>
    7.29 @@ -49,94 +35,17 @@
    7.30  extern FlagRowObj* standardFlagsDefault;
    7.31  extern FlagRowObj* systemFlagsDefault;
    7.32  
    7.33 -extern Q3PtrList <QAction> actionListBranches;
    7.34 -
    7.35 -extern QAction* actionFileSave;
    7.36 -extern QAction* actionFilePrint;
    7.37 -extern QAction* actionEditUndo;
    7.38 -extern QAction* actionEditRedo;
    7.39 -extern QAction *actionEditCopy;
    7.40 -extern QAction *actionEditCut;
    7.41 -extern QAction *actionEditPaste;
    7.42 -extern QAction *actionEditMoveUp;
    7.43 -extern QAction *actionEditMoveDown;
    7.44 -extern QAction *actionEditToggleScroll;
    7.45 -extern QAction* actionEditOpenURL;
    7.46 -extern QAction* actionEditOpenURLTab;
    7.47 -extern QAction* actionEditOpenMultipleURLTabs;
    7.48 -extern QAction* actionEditURL;
    7.49 -extern QAction* actionEditHeading2URL;
    7.50 -extern QAction* actionEditBugzilla2URL;
    7.51 -extern QAction* actionEditFATE2URL;
    7.52 -extern QAction *actionEditOpenVymLink;
    7.53 -extern QAction *actionEditOpenMultipleVymLinks;
    7.54 -extern QAction *actionEditVymLink;
    7.55 -extern QAction *actionEditDeleteVymLink;
    7.56 -extern QAction *actionEditToggleHideExport;
    7.57 -extern QAction *actionEditMapInfo;
    7.58 -extern QAction *actionEditHeading;
    7.59 -extern QAction *actionEditDelete;
    7.60 -extern QAction *actionEditAddBranch;
    7.61 -extern QAction *actionEditAddBranchHere;
    7.62 -extern QAction *actionEditAddBranchAbove;
    7.63 -extern QAction *actionEditAddBranchBelow;
    7.64 -extern QAction *actionEditRemoveBranchKeepChilds;
    7.65 -extern QAction *actionEditRemoveChilds;
    7.66 -extern QAction *actionEditImportAdd;
    7.67 -extern QAction *actionEditImportReplace;
    7.68 -extern QAction *actionEditSaveBranch;
    7.69 -extern QAction *actionEditSelectFirst;
    7.70 -extern QAction *actionEditSelectLast;
    7.71 -extern QAction *actionEditLoadImage;
    7.72 -
    7.73 -extern QAction* actionFormatColor;
    7.74 -extern QAction* actionFormatPickColor;
    7.75 -extern QAction* actionFormatColorBranch;
    7.76 -extern QAction* actionFormatColorSubtree;
    7.77 -extern QAction* actionFormatLinkColorHint;
    7.78 -extern QAction* actionFormatBackColor;
    7.79 -extern QAction* actionFormatLinkColor;
    7.80 -extern QAction *actionFormatIncludeImagesVer;
    7.81 -extern QAction *actionFormatIncludeImagesHor;
    7.82 -
    7.83 -extern QActionGroup* actionGroupModModes;
    7.84 -extern QAction* actionModModeColor;
    7.85 -extern QAction* actionModModeLink;
    7.86 -extern QAction* actionModModeCopy;
    7.87 -
    7.88 -extern QActionGroup *actionGroupFormatFrameTypes;
    7.89 -extern QAction *actionFormatFrameNone;
    7.90 -extern QAction *actionFormatFrameRectangle;
    7.91 -
    7.92 -extern QActionGroup *actionGroupFormatLinkStyles;
    7.93 -extern QAction *actionFormatLinkStyleLine;
    7.94 -extern QAction *actionFormatLinkStyleParabel;
    7.95 -extern QAction *actionFormatLinkStylePolyLine;
    7.96 -extern QAction *actionFormatLinkStylePolyParabel;
    7.97 -extern QAction *actionFormatHideLinkUnselected;
    7.98 -
    7.99 -extern QAction *actionViewToggleNoteEditor;
   7.100 -extern QAction *actionViewToggleHistoryWindow;
   7.101 -
   7.102 -extern QAction* actionSettingsAutoedit;
   7.103 -extern QAction* actionSettingsAutoselectHeading;
   7.104 -extern QAction* actionSettingsAutoselectHeading;
   7.105 -extern QAction* actionSettingsAutoselectText;
   7.106 -extern QAction* actionSettingsUseDelKey;
   7.107 -extern QAction* actionSettingsUseFlagGroups;
   7.108 -extern QAction* actionSettingsUseHideExport;
   7.109 -
   7.110 -extern QMenu* branchContextMenu;
   7.111 -extern QMenu* branchAddContextMenu;
   7.112 -extern QMenu* branchRemoveContextMenu;
   7.113 -extern QMenu* branchLinksContextMenu;
   7.114 -extern QMenu* branchXLinksContextMenuEdit;
   7.115 -extern QMenu* branchXLinksContextMenuFollow;
   7.116 -extern QMenu* floatimageContextMenu;
   7.117 -extern QMenu* canvasContextMenu;
   7.118 -extern QMenu* fileLastMapsMenu;
   7.119 -extern QMenu* fileImportMenu;
   7.120 -extern QMenu* fileExportMenu;
   7.121 +QMenu* branchContextMenu;
   7.122 +QMenu* branchAddContextMenu;
   7.123 +QMenu* branchRemoveContextMenu;
   7.124 +QMenu* branchLinksContextMenu;
   7.125 +QMenu* branchXLinksContextMenuEdit;
   7.126 +QMenu* branchXLinksContextMenuFollow;
   7.127 +QMenu* floatimageContextMenu;
   7.128 +QMenu* canvasContextMenu;
   7.129 +QMenu* fileLastMapsMenu;
   7.130 +QMenu* fileImportMenu;
   7.131 +QMenu* fileExportMenu;
   7.132  
   7.133  
   7.134  extern Settings settings;
   7.135 @@ -252,6 +161,7 @@
   7.136  
   7.137  	// Connect TextEditor, so that we can update flags if text changes
   7.138  	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
   7.139 +	connect (textEditor, SIGNAL (textClosed() ), this, SLOT (updateActions()));
   7.140  
   7.141  	updateGeometry();
   7.142  }
   7.143 @@ -267,9 +177,9 @@
   7.144  	settings.setValue( "/version/version", __VYM_VERSION );
   7.145  	settings.setValue( "/version/builddate", __BUILD_DATE );
   7.146  
   7.147 -	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
   7.148 -	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
   7.149 -	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
   7.150 +	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
   7.151 +	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
   7.152 +	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
   7.153  	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
   7.154  	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
   7.155  	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
   7.156 @@ -957,19 +867,19 @@
   7.157      connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
   7.158  	actionFormatFrameRectangle=a;
   7.159  
   7.160 -    a = new QAction( tr( "Include images vertically" ),  actionFormatIncludeImagesVer);
   7.161 +    a = new QAction( tr( "Include images vertically" ),  this);
   7.162  	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
   7.163  	a->setToggleAction(true);
   7.164      connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
   7.165  	actionFormatIncludeImagesVer=a;
   7.166  
   7.167 -    a = new QAction( tr( "Include images horizontally" ),  actionFormatIncludeImagesHor );
   7.168 +    a = new QAction( tr( "Include images horizontally" ),  this);
   7.169  	a->setStatusTip ( tr ("Include left and right position of images into branch"));
   7.170  	a->setToggleAction(true);
   7.171      connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
   7.172  	actionFormatIncludeImagesHor=a;
   7.173  
   7.174 -    a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
   7.175 +    a = new QAction( tr( "Hide link if object is not selected" ), this);
   7.176  	a->setStatusTip (tr( "Hide link" ));
   7.177  	a->setToggleAction(true);
   7.178      connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
   7.179 @@ -1093,7 +1003,7 @@
   7.180      a->setStatusTip( tr( "Use modifier to draw xLinks" ));
   7.181  	a->setToggleAction(true);
   7.182  	a->addTo (tb);
   7.183 -	actionModModeLink=a;
   7.184 +	actionModModeXLink=a;
   7.185  }
   7.186  
   7.187  // Flag Actions
   7.188 @@ -1438,21 +1348,21 @@
   7.189  	a->setToggleAction(true);
   7.190  	a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
   7.191  	settingsMenu->addAction (a);
   7.192 -	actionSettingsAutoedit=a;
   7.193 +	actionSettingsAutoEdit=a;
   7.194  
   7.195      a= new QAction( tr( "Select branch after adding it" ), this );
   7.196      a->setStatusTip( tr( "Select branch after adding it" ));
   7.197  	a->setToggleAction(true);
   7.198  	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
   7.199  	settingsMenu->addAction (a);
   7.200 -	actionSettingsAutoselectHeading=a;
   7.201 +	actionSettingsAutoSelectHeading=a;
   7.202  	
   7.203      a= new QAction(tr( "Select existing heading" ), this);
   7.204      a->setStatusTip( tr( "Select heading before editing" ));
   7.205  	a->setToggleAction(true);
   7.206  	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
   7.207  	settingsMenu->addAction (a);
   7.208 -	actionSettingsAutoselectText=a;
   7.209 +	actionSettingsAutoSelectText=a;
   7.210  	
   7.211      a= new QAction( tr( "Delete key" ), this);
   7.212      a->setStatusTip( tr( "Delete key for deleting branches" ));
   7.213 @@ -1739,7 +1649,7 @@
   7.214  void Main::fileNew()
   7.215  {
   7.216  	QString fn="unnamed";
   7.217 -	MapEditor* medit = new MapEditor ( NULL,true);
   7.218 +	MapEditor* medit = new MapEditor ( NULL);
   7.219  	tabWidget->addTab (medit,fn);
   7.220  	tabWidget->showPage(medit);
   7.221  	medit->viewport()->setFocus();
   7.222 @@ -1807,7 +1717,7 @@
   7.223  		// create a new mapeditor in a new tab
   7.224  		if ( lmode==NewMap && (!me || !me->isDefault() ) )
   7.225  		{
   7.226 -			me= new MapEditor ( NULL,true);
   7.227 +			me= new MapEditor ( NULL);
   7.228  			tabWidget->addTab (me,fn);
   7.229  			tabIndex=tabWidget->indexOf (me);
   7.230  			tabWidget->setCurrentPage (tabIndex);
   7.231 @@ -2978,7 +2888,7 @@
   7.232  {
   7.233  	if (currentMapEditor())
   7.234  	{
   7.235 -		QColor col = QColorDialog::getColor( currentMapEditor()->color(), this );
   7.236 +		QColor col = QColorDialog::getColor( currentMapEditor()->getColor(), this );
   7.237  		if ( !col.isValid() ) return;
   7.238  		currentMapEditor()->setColor( col );
   7.239  		colorChanged( col );
   7.240 @@ -3117,14 +3027,6 @@
   7.241  	}	
   7.242  }
   7.243  
   7.244 -void Main::modModeColor()
   7.245 -{
   7.246 -}
   7.247 -
   7.248 -void Main::modModeLink()
   7.249 -{
   7.250 -}
   7.251 -
   7.252  bool Main::settingsPDF()
   7.253  {
   7.254  	// Default browser is set in constructor
   7.255 @@ -3182,6 +3084,222 @@
   7.256  		currentMapEditor()->updateNoteFlag();
   7.257  }
   7.258  
   7.259 +void Main::updateActions()
   7.260 +{
   7.261 +	MapEditor *me=currentMapEditor();
   7.262 +	if (!me) return;
   7.263 +
   7.264 +	// updateActions is also called when NoteEditor is closed
   7.265 +	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
   7.266 +
   7.267 +	QAction *a;
   7.268 +	if (me->getLinkColorHint()==HeadingColor) 
   7.269 +		actionFormatLinkColorHint->setOn(true);
   7.270 +	else	
   7.271 +		actionFormatLinkColorHint->setOn(false);
   7.272 +
   7.273 +	switch (me->getLinkStyle())
   7.274 +	{
   7.275 +		case StyleLine: 
   7.276 +			actionFormatLinkStyleLine->setOn(true);
   7.277 +			break;
   7.278 +		case StyleParabel:
   7.279 +			actionFormatLinkStyleParabel->setOn(true);
   7.280 +			break;
   7.281 +		case StylePolyLine:	
   7.282 +			actionFormatLinkStylePolyLine->setOn(true);
   7.283 +			break;
   7.284 +		case StylePolyParabel:	
   7.285 +			actionFormatLinkStylePolyParabel->setOn(true);
   7.286 +			break;
   7.287 +		default:
   7.288 +			break;
   7.289 +	}	
   7.290 +
   7.291 +	QPixmap pix( 16, 16 );
   7.292 +    pix.fill( me->getBackgroundColor() );
   7.293 +    actionFormatBackColor->setIconSet( pix );
   7.294 +    pix.fill( me->getDefLinkColor() );
   7.295 +    actionFormatLinkColor->setIconSet( pix );
   7.296 +
   7.297 +	actionFileSave->setEnabled( me->isUnsaved() );
   7.298 +	if (me->isUndoAvailable())
   7.299 +		actionEditUndo->setEnabled( true);
   7.300 +	else	
   7.301 +		actionEditUndo->setEnabled( false);
   7.302 +
   7.303 +	if (me->isRedoAvailable())
   7.304 +		actionEditRedo->setEnabled( true);
   7.305 +	else	
   7.306 +		actionEditRedo->setEnabled( false);
   7.307 +
   7.308 +	LinkableMapObj *selection=me->getSelection();
   7.309 +	if (selection)
   7.310 +	{
   7.311 +		if ( (typeid(*selection) == typeid(BranchObj)) || 
   7.312 +			(typeid(*selection) == typeid(MapCenterObj))  )
   7.313 +		{
   7.314 +			BranchObj *bo=(BranchObj*)selection;
   7.315 +			// Take care of links
   7.316 +			if (bo->countXLinks()==0)
   7.317 +			{
   7.318 +				branchXLinksContextMenuEdit->clear();
   7.319 +				branchXLinksContextMenuFollow->clear();
   7.320 +			} else
   7.321 +			{
   7.322 +				BranchObj *bot;
   7.323 +				QString s;
   7.324 +				branchXLinksContextMenuEdit->clear();
   7.325 +				branchXLinksContextMenuFollow->clear();
   7.326 +				for (int i=0; i<=bo->countXLinks();i++)
   7.327 +				{
   7.328 +					bot=bo->XLinkTargetAt(i);
   7.329 +					if (bot)
   7.330 +					{
   7.331 +						s=bot->getHeading();
   7.332 +						if (s.length()>25)
   7.333 +							s=s.left(25)+"...";
   7.334 +						branchXLinksContextMenuFollow->addAction (s);
   7.335 +						branchXLinksContextMenuEdit->addAction (s);
   7.336 +					}	
   7.337 +				}
   7.338 +			}
   7.339 +
   7.340 +			standardFlagsDefault->setEnabled (true);
   7.341 +
   7.342 +			actionEditToggleScroll->setEnabled (true);
   7.343 +			if ( bo->isScrolled() )
   7.344 +				actionEditToggleScroll->setOn(true);
   7.345 +			else	
   7.346 +				actionEditToggleScroll->setOn(false);
   7.347 +
   7.348 +			if ( bo->getURL().isEmpty() )
   7.349 +			{
   7.350 +				actionEditOpenURL->setEnabled (false);
   7.351 +				actionEditOpenURLTab->setEnabled (false);
   7.352 +			}	
   7.353 +			else	
   7.354 +			{
   7.355 +				actionEditOpenURL->setEnabled (true);
   7.356 +				actionEditOpenURLTab->setEnabled (true);
   7.357 +			}
   7.358 +			if ( bo->getVymLink().isEmpty() )
   7.359 +			{
   7.360 +				actionEditOpenVymLink->setEnabled (false);
   7.361 +				actionEditDeleteVymLink->setEnabled (false);
   7.362 +			} else	
   7.363 +			{
   7.364 +				actionEditOpenVymLink->setEnabled (true);
   7.365 +				actionEditDeleteVymLink->setEnabled (true);
   7.366 +			}	
   7.367 +
   7.368 +			if (bo->canMoveBranchUp()) 
   7.369 +				actionEditMoveUp->setEnabled (true);
   7.370 +			else	
   7.371 +				actionEditMoveUp->setEnabled (false);
   7.372 +			if (bo->canMoveBranchDown()) 
   7.373 +				actionEditMoveDown->setEnabled (true);
   7.374 +			else	
   7.375 +				actionEditMoveDown->setEnabled (false);
   7.376 +
   7.377 +
   7.378 +			actionEditToggleHideExport->setEnabled (true);	
   7.379 +			actionEditToggleHideExport->setOn (bo->hideInExport() );	
   7.380 +
   7.381 +			actionEditCopy->setEnabled (true);	
   7.382 +			actionEditCut->setEnabled (true);	
   7.383 +			if (!clipboardEmpty)
   7.384 +				actionEditPaste->setEnabled (true);	
   7.385 +			else	
   7.386 +				actionEditPaste->setEnabled (false);	
   7.387 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
   7.388 +				a->setEnabled(true);
   7.389 +			actionEditDelete->setEnabled (true);
   7.390 +			switch (selection->getFrameType())
   7.391 +			{
   7.392 +				case NoFrame: 
   7.393 +					actionFormatFrameNone->setOn(true);
   7.394 +					break;
   7.395 +				case Rectangle:
   7.396 +					actionFormatFrameRectangle->setOn(true);
   7.397 +					break;
   7.398 +				default:
   7.399 +					break;
   7.400 +			}	
   7.401 +			actionFormatIncludeImagesVer->setOn
   7.402 +				( ((BranchObj*)selection)->getIncludeImagesVer());
   7.403 +			actionFormatIncludeImagesHor->setOn
   7.404 +				( ((BranchObj*)selection)->getIncludeImagesHor());
   7.405 +			actionFormatHideLinkUnselected->setOn
   7.406 +				(selection->getHideLinkUnselected());
   7.407 +		}
   7.408 +		if ( (typeid(*selection) == typeid(FloatImageObj)) )
   7.409 +		{
   7.410 +			FloatObj *fo=(FloatImageObj*)selection;
   7.411 +//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
   7.412 +
   7.413 +			actionEditOpenURL->setEnabled (false);
   7.414 +			actionEditOpenVymLink->setEnabled (false);
   7.415 +			actionEditDeleteVymLink->setEnabled (false);	
   7.416 +			actionEditToggleHideExport->setEnabled (true);	
   7.417 +			actionEditToggleHideExport->setOn (fo->hideInExport() );	
   7.418 +
   7.419 +
   7.420 +			actionEditCopy->setEnabled (true);
   7.421 +			actionEditCut->setEnabled (true);	
   7.422 +			actionEditPaste->setEnabled (false);
   7.423 +			for (a=actionListBranches.first();a;a=actionListBranches.next())
   7.424 +				a->setEnabled(false);
   7.425 +			actionEditDelete->setEnabled (true);
   7.426 +			actionFormatHideLinkUnselected->setOn
   7.427 +				( selection->getHideLinkUnselected());
   7.428 +			actionEditMoveUp->setEnabled (false);
   7.429 +			actionEditMoveDown->setEnabled (false);
   7.430 +		}
   7.431 +
   7.432 +	} else
   7.433 +	{
   7.434 +		actionEditCopy->setEnabled (false);	
   7.435 +		actionEditCut->setEnabled (false);	
   7.436 +		actionEditPaste->setEnabled (false);	
   7.437 +		for (a=actionListBranches.first();a;a=actionListBranches.next())
   7.438 +			a->setEnabled(false);
   7.439 +
   7.440 +		actionEditToggleScroll->setEnabled (false);
   7.441 +		actionEditOpenURL->setEnabled (false);
   7.442 +		actionEditOpenVymLink->setEnabled (false);
   7.443 +		actionEditDeleteVymLink->setEnabled (false);	
   7.444 +		actionEditHeading2URL->setEnabled (false);	
   7.445 +		actionEditDelete->setEnabled (false);
   7.446 +		actionEditMoveUp->setEnabled (false);
   7.447 +		actionEditMoveDown->setEnabled (false);
   7.448 +		actionEditToggleHideExport->setEnabled (false);	
   7.449 +	}	
   7.450 +}
   7.451 +
   7.452 +ModMode Main::getModMode()
   7.453 +{
   7.454 +	if (actionModModeColor->isOn()) return ModModeColor;
   7.455 +	if (actionModModeCopy->isOn()) return ModModeCopy;
   7.456 +	if (actionModModeXLink->isOn()) return ModModeXLink;
   7.457 +	return ModModeNone;
   7.458 +}
   7.459 +
   7.460 +bool Main::autoEdit()
   7.461 +{
   7.462 +	return actionSettingsAutoEdit->isOn();
   7.463 +}
   7.464 +
   7.465 +bool Main::autoSelectHeading()
   7.466 +{
   7.467 +	return actionSettingsAutoSelectHeading->isOn();
   7.468 +}
   7.469 +
   7.470 +bool Main::useFlagGroups()
   7.471 +{
   7.472 +	return actionSettingsUseFlagGroups->isOn();
   7.473 +}
   7.474 +
   7.475  void Main::windowShowNoteEditor()
   7.476  {
   7.477  	textEditor->setShowWithMain(true);
     8.1 --- a/mainwindow.h	Thu Sep 21 13:48:05 2006 +0000
     8.2 +++ b/mainwindow.h	Mon Oct 16 12:42:54 2006 +0000
     8.3 @@ -1,16 +1,7 @@
     8.4  #ifndef MAINWINDOW_H 
     8.5  #define MAINWINDOW_H
     8.6  
     8.7 -#include <QAction>
     8.8 -#include <QCursor>
     8.9  #include <QMainWindow>
    8.10 -#include <QProcess>
    8.11 -#include <QToolBar>
    8.12 -#include <QTabWidget>
    8.13 -//Added by qt3to4:
    8.14 -#include <QCloseEvent>
    8.15 -#include <QShowEvent>
    8.16 -#include <QHideEvent>
    8.17  
    8.18  #include "file.h"
    8.19  #include "findwindow.h"
    8.20 @@ -18,6 +9,8 @@
    8.21  #include "texteditor.h"
    8.22  #include "xml.h"
    8.23  
    8.24 +enum ModMode {ModModeNone,ModModeColor,ModModeCopy,ModModeXLink};
    8.25 +
    8.26  class Main : public QMainWindow 
    8.27  {
    8.28      Q_OBJECT
    8.29 @@ -157,9 +150,6 @@
    8.30      void viewZoomIn();
    8.31      void viewZoomOut();
    8.32  
    8.33 -	void modModeColor();
    8.34 -	void modModeLink();
    8.35 -
    8.36  public slots:
    8.37  	bool settingsPDF();
    8.38  	bool settingsURL();
    8.39 @@ -168,6 +158,11 @@
    8.40  	void windowToggleNoteEditor();
    8.41  	void windowToggleHistory();
    8.42  	void updateNoteFlag();
    8.43 +	void updateActions();
    8.44 +	ModMode getModMode();
    8.45 +	bool autoEdit();
    8.46 +	bool autoSelectHeading();
    8.47 +	bool useFlagGroups();
    8.48  
    8.49  private slots:
    8.50  	void windowNextEditor();
    8.51 @@ -194,7 +189,82 @@
    8.52  
    8.53  	QLineEdit *lineedit;	// to enter headings of branches
    8.54  	QString editSel;
    8.55 -	
    8.56 +
    8.57 +	Q3PtrList <QAction> actionListBranches;
    8.58 +
    8.59 +	QAction* actionFileSave;
    8.60 +	QAction* actionFilePrint;
    8.61 +	QAction* actionEditUndo;
    8.62 +	QAction* actionEditRedo;
    8.63 +	QAction *actionEditCopy;
    8.64 +	QAction *actionEditCut;
    8.65 +	QAction *actionEditPaste;
    8.66 +	QAction *actionEditMoveUp;
    8.67 +	QAction *actionEditMoveDown;
    8.68 +	QAction *actionEditToggleScroll;
    8.69 +	QAction* actionEditOpenURL;
    8.70 +	QAction* actionEditOpenURLTab;
    8.71 +	QAction* actionEditOpenMultipleURLTabs;
    8.72 +	QAction* actionEditURL;
    8.73 +	QAction* actionEditHeading2URL;
    8.74 +	QAction* actionEditBugzilla2URL;
    8.75 +	QAction* actionEditFATE2URL;
    8.76 +	QAction *actionEditOpenVymLink;
    8.77 +	QAction *actionEditOpenMultipleVymLinks;
    8.78 +	QAction *actionEditVymLink;
    8.79 +	QAction *actionEditDeleteVymLink;
    8.80 +	QAction *actionEditToggleHideExport;
    8.81 +	QAction *actionEditMapInfo;
    8.82 +	QAction *actionEditHeading;
    8.83 +	QAction *actionEditDelete;
    8.84 +	QAction *actionEditAddBranch;
    8.85 +	QAction *actionEditAddBranchHere;
    8.86 +	QAction *actionEditAddBranchAbove;
    8.87 +	QAction *actionEditAddBranchBelow;
    8.88 +	QAction *actionEditRemoveBranchKeepChilds;
    8.89 +	QAction *actionEditRemoveChilds;
    8.90 +	QAction *actionEditImportAdd;
    8.91 +	QAction *actionEditImportReplace;
    8.92 +	QAction *actionEditSaveBranch;
    8.93 +	QAction *actionEditSelectFirst;
    8.94 +	QAction *actionEditSelectLast;
    8.95 +	QAction *actionEditLoadImage;
    8.96 +
    8.97 +	QAction* actionFormatColor;
    8.98 +	QAction* actionFormatPickColor;
    8.99 +	QAction* actionFormatColorBranch;
   8.100 +	QAction* actionFormatColorSubtree;
   8.101 +	QAction* actionFormatLinkColorHint;
   8.102 +	QAction* actionFormatBackColor;
   8.103 +	QAction* actionFormatLinkColor;
   8.104 +	QAction *actionFormatIncludeImagesVer;
   8.105 +	QAction *actionFormatIncludeImagesHor;
   8.106 +
   8.107 +	QActionGroup* actionGroupModModes;
   8.108 +	QAction* actionModModeColor;
   8.109 +	QAction* actionModModeXLink;
   8.110 +	QAction* actionModModeCopy;
   8.111 +
   8.112 +	QActionGroup *actionGroupFormatFrameTypes;
   8.113 +	QAction *actionFormatFrameNone;
   8.114 +	QAction *actionFormatFrameRectangle;
   8.115 +
   8.116 +	QActionGroup *actionGroupFormatLinkStyles;
   8.117 +	QAction *actionFormatLinkStyleLine;
   8.118 +	QAction *actionFormatLinkStyleParabel;
   8.119 +	QAction *actionFormatLinkStylePolyLine;
   8.120 +	QAction *actionFormatLinkStylePolyParabel;
   8.121 +	QAction *actionFormatHideLinkUnselected;
   8.122 +
   8.123 +	QAction *actionViewToggleNoteEditor;
   8.124 +	QAction *actionViewToggleHistoryWindow;
   8.125 +
   8.126 +	QAction* actionSettingsAutoEdit;
   8.127 +	QAction* actionSettingsAutoSelectHeading;
   8.128 +	QAction* actionSettingsAutoSelectText;
   8.129 +	QAction* actionSettingsUseDelKey;
   8.130 +	QAction* actionSettingsUseFlagGroups;
   8.131 +	QAction* actionSettingsUseHideExport;
   8.132  };
   8.133  
   8.134  
     9.1 --- a/mapeditor.cpp	Thu Sep 21 13:48:05 2006 +0000
     9.2 +++ b/mapeditor.cpp	Mon Oct 16 12:42:54 2006 +0000
     9.3 @@ -1,23 +1,5 @@
     9.4  #include "mapeditor.h"
     9.5  
     9.6 -#include <QActionGroup>
     9.7 -#include <QColor>
     9.8 -#include <QColorDialog>
     9.9 -#include <QContextMenuEvent>
    9.10 -#include <QDir>
    9.11 -#include <QDragEnterEvent>
    9.12 -#include <QDropEvent>
    9.13 -#include <QFile>
    9.14 -#include <QInputDialog>
    9.15 -#include <QMessageBox>
    9.16 -#include <QMouseEvent>
    9.17 -#include <QPainter>
    9.18 -#include <QPixmap>
    9.19 -#include <QPrinter>
    9.20 -#include <QResizeEvent>
    9.21 -#include <QTextStream>
    9.22 -
    9.23 -#include <Q3PtrList>
    9.24  #include <q3dragobject.h>
    9.25  #include <q3urloperator.h>
    9.26  #include <q3networkprotocol.h>
    9.27 @@ -49,76 +31,8 @@
    9.28  extern QString tmpVymDir;
    9.29  extern QString clipboardDir;
    9.30  extern bool clipboardEmpty;
    9.31 -extern FlagRowObj *systemFlagsDefault;
    9.32  extern FlagRowObj *standardFlagsDefault;
    9.33  
    9.34 -extern Q3PtrList <QAction> actionListBranches;
    9.35 -
    9.36 -extern QAction *actionFileSave;
    9.37 -extern QAction *actionEditUndo;
    9.38 -extern QAction *actionEditRedo;
    9.39 -extern QAction *actionEditCopy;
    9.40 -extern QAction *actionEditCut;
    9.41 -extern QAction *actionEditPaste;
    9.42 -extern QAction *actionEditMoveUp;
    9.43 -extern QAction *actionEditMoveDown;
    9.44 -extern QAction *actionEditToggleScroll;
    9.45 -extern QAction *actionEditOpenURL;
    9.46 -extern QAction *actionEditOpenURLTab;
    9.47 -extern QAction *actionEditURL;
    9.48 -extern QAction *actionEditHeading2URL;
    9.49 -extern QAction *actionEditBugzilla2URL;
    9.50 -extern QAction *actionEditFATE2URL;
    9.51 -extern QAction *actionEditOpenVymLink;
    9.52 -extern QAction *actionEditVymLink;
    9.53 -extern QAction *actionEditDeleteVymLink;
    9.54 -extern QAction *actionEditToggleHideExport;
    9.55 -extern QAction *actionEditHeading;
    9.56 -extern QAction *actionEditDelete;
    9.57 -extern QAction *actionEditAddBranch;
    9.58 -extern QAction *actionEditAddBranchAbove;
    9.59 -extern QAction *actionEditAddBranchBelow;
    9.60 -extern QAction *actionEditRemoveBranchHere;
    9.61 -extern QAction *actionEditRemoveChilds;
    9.62 -extern QAction *actionEditImportAdd;
    9.63 -extern QAction *actionEditImportReplace;
    9.64 -extern QAction *actionEditSaveBranch;
    9.65 -extern QAction *actionEditSelectFirst;
    9.66 -extern QAction *actionEditSelectLast;
    9.67 -extern QAction *actionEditLoadImage;
    9.68 -
    9.69 -extern QAction* actionFormatPickColor;
    9.70 -extern QAction* actionFormatColorBranch;
    9.71 -extern QAction* actionFormatColorSubtree;
    9.72 -extern QAction *actionFormatLinkColorHint;
    9.73 -extern QAction *actionFormatBackColor;
    9.74 -extern QAction *actionFormatLinkColor;
    9.75 -
    9.76 -extern QActionGroup* actionGroupModModes;
    9.77 -extern QAction* actionModModeColor;
    9.78 -extern QAction* actionModModeLink;
    9.79 -extern QAction* actionModModeCopy;
    9.80 -
    9.81 -extern QActionGroup *actionGroupFormatFrameTypes;
    9.82 -extern QAction *actionFormatFrameNone;
    9.83 -extern QAction *actionFormatFrameRectangle;
    9.84 -
    9.85 -extern QActionGroup *actionGroupFormatLinkStyles;
    9.86 -extern QAction *actionFormatIncludeImagesVer;
    9.87 -extern QAction *actionFormatIncludeImagesHor;
    9.88 -extern QAction *actionFormatHideLinkUnselected;
    9.89 -extern QAction *actionFormatLinkStyleLine;
    9.90 -extern QAction *actionFormatLinkStyleParabel;
    9.91 -extern QAction *actionFormatLinkStylePolyLine;
    9.92 -extern QAction *actionFormatLinkStylePolyParabel;
    9.93 -
    9.94 -extern QAction *actionViewToggleNoteEditor;
    9.95 -
    9.96 -extern QAction *actionSettingsAutoedit;
    9.97 -extern QAction *actionSettingsAutoselectHeading;
    9.98 -extern QAction *actionSettingsAutoselectText;
    9.99 -extern QAction *actionSettingsUseFlagGroups;
   9.100 -
   9.101  extern QMenu* branchContextMenu;
   9.102  extern QMenu* branchAddContextMenu;
   9.103  extern QMenu* branchRemoveContextMenu;
   9.104 @@ -145,7 +59,7 @@
   9.105  ///////////////////////////////////////////////////////////////////////
   9.106  ///////////////////////////////////////////////////////////////////////
   9.107  MapEditor::MapEditor(
   9.108 -	QWidget* parent, bool interactive, const char* name, Qt::WFlags f) :
   9.109 +	QWidget* parent, const char* name, Qt::WFlags f) :
   9.110    Q3CanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
   9.111  {
   9.112  	//cout << "Constructor ME "<<this<<endl;
   9.113 @@ -224,8 +138,6 @@
   9.114  
   9.115  	hidemode=HideNone;
   9.116  
   9.117 -	isInteractive=interactive;	// FIXME still needed?
   9.118 -
   9.119  	// Create temporary files
   9.120  	makeTmpDirs();
   9.121  
   9.122 @@ -249,18 +161,14 @@
   9.123    }
   9.124  
   9.125  	//cout <<"Destructor MapEditor\n";
   9.126 -
   9.127 -	// Save Settings
   9.128 -	//settings.writeEntry( "/mapeditor/editmode/autoselect",  );
   9.129 -
   9.130  }
   9.131  
   9.132 -QColor MapEditor::color()
   9.133 +QColor MapEditor::getColor()
   9.134  {
   9.135      return actColor;
   9.136  }
   9.137  
   9.138 -QColor MapEditor::backgroundColor()
   9.139 +QColor MapEditor::getBackgroundColor()
   9.140  {
   9.141      return mapCanvas->backgroundColor();
   9.142  }
   9.143 @@ -493,6 +401,7 @@
   9.144  		NULL);
   9.145  }
   9.146  
   9.147 +/* FIXME not used
   9.148  void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel) 
   9.149  {
   9.150  	QString redoSelection="";
   9.151 @@ -506,6 +415,7 @@
   9.152  		comment, 
   9.153  		saveSel);
   9.154  }
   9.155 +*/
   9.156  
   9.157  void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
   9.158  {
   9.159 @@ -833,8 +743,6 @@
   9.160  	mapChanged=true;
   9.161  	mapDefault=false;
   9.162  	mapUnsaved=true;
   9.163 -	actionEditUndo->setEnabled (true);
   9.164 -	actionFileSave->setEnabled (true);
   9.165  	findReset();
   9.166  }
   9.167  
   9.168 @@ -1000,7 +908,7 @@
   9.169  	{
   9.170  		mapChanged=false;
   9.171  		mapUnsaved=false;
   9.172 -		actionFileSave->setEnabled(false);
   9.173 +		updateActions();
   9.174  	}
   9.175  
   9.176  	return returnCode;
   9.177 @@ -1369,6 +1277,14 @@
   9.178  
   9.179  }
   9.180  
   9.181 +bool MapEditor::isRedoAvailable()
   9.182 +{
   9.183 +	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
   9.184 +		return true;
   9.185 +	else	
   9.186 +		return false;
   9.187 +}
   9.188 +
   9.189  void MapEditor::undo()
   9.190  {
   9.191  	blockSaveState=true;
   9.192 @@ -1434,6 +1350,14 @@
   9.193  	updateActions();
   9.194  }
   9.195  
   9.196 +bool MapEditor::isUndoAvailable()
   9.197 +{
   9.198 +	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
   9.199 +		return true;
   9.200 +	else	
   9.201 +		return false;
   9.202 +}
   9.203 +
   9.204  void MapEditor::gotoStep (int i)
   9.205  {
   9.206  	// Restore variables
   9.207 @@ -1744,15 +1668,15 @@
   9.208  			adjustCanvasSize();
   9.209  
   9.210  
   9.211 -			if (actionSettingsAutoedit->isOn() ||
   9.212 -				actionSettingsAutoselectHeading->isOn() )
   9.213 +			if (mainWindow->autoEdit() ||
   9.214 +				mainWindow->autoSelectHeading() )
   9.215  			{
   9.216  				selection->unselect();
   9.217  				selection=newbo;
   9.218  				selection->select();
   9.219 -				if (actionSettingsAutoedit->isOn() )
   9.220 +				if (mainWindow->autoEdit() )
   9.221  					mainWindow->editHeading();
   9.222 -				if (!actionSettingsAutoselectHeading->isOn()
   9.223 +				if (!mainWindow->autoSelectHeading()
   9.224  					)//&& !wasScrolled)  //FIXME wasScrolled was moved to addNewBranchInt
   9.225  				{
   9.226  					selection->unselect();
   9.227 @@ -1787,15 +1711,15 @@
   9.228  
   9.229  		mapCenter->reposition();
   9.230  		adjustCanvasSize();
   9.231 -		if (actionSettingsAutoedit->isOn() ||
   9.232 -			actionSettingsAutoselectHeading->isOn() )
   9.233 +		if (mainWindow->autoEdit() ||
   9.234 +			mainWindow->autoSelectHeading() )
   9.235  		{
   9.236  			selection->unselect();
   9.237  			selection=newbo;
   9.238  			selection->select();
   9.239 -			if (actionSettingsAutoedit->isOn() )
   9.240 +			if (mainWindow->autoEdit() )
   9.241  				mainWindow->editHeading();
   9.242 -			if (!actionSettingsAutoselectHeading->isOn()
   9.243 +			if (!mainWindow->autoSelectHeading()
   9.244  				&& !wasScrolled)
   9.245  			{
   9.246  				selection->unselect();
   9.247 @@ -2345,7 +2269,7 @@
   9.248  			saveStateConstSelection(QString("%1 (\"%2\")").arg(u).arg(f), 
   9.249  				QString("%1 (\"%2\")").arg(r).arg(f),
   9.250  				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
   9.251 -			bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
   9.252 +			bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
   9.253  			adjustCanvasSize();
   9.254  		}
   9.255  	}	
   9.256 @@ -2571,7 +2495,6 @@
   9.257  			s="Set";
   9.258  		}	
   9.259  		saveStateComplete(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
   9.260 -		actionEditToggleHideExport->setOn (oo->hideInExport());	
   9.261  		updateActions();
   9.262  		mapCenter->reposition();
   9.263  		adjustCanvasSize();
   9.264 @@ -2683,190 +2606,8 @@
   9.265  
   9.266  void MapEditor::updateActions()
   9.267  {
   9.268 -	QAction *a;
   9.269 -	if (getLinkColorHint()==HeadingColor) 
   9.270 -		actionFormatLinkColorHint->setOn(true);
   9.271 -	else	
   9.272 -		actionFormatLinkColorHint->setOn(false);
   9.273 -
   9.274 -	switch (linkstyle)
   9.275 -	{
   9.276 -		case StyleLine: 
   9.277 -			actionFormatLinkStyleLine->setOn(true);
   9.278 -			break;
   9.279 -		case StyleParabel:
   9.280 -			actionFormatLinkStyleParabel->setOn(true);
   9.281 -			break;
   9.282 -		case StylePolyLine:	
   9.283 -			actionFormatLinkStylePolyLine->setOn(true);
   9.284 -			break;
   9.285 -		case StylePolyParabel:	
   9.286 -			actionFormatLinkStylePolyParabel->setOn(true);
   9.287 -			break;
   9.288 -		default:
   9.289 -			break;
   9.290 -	}	
   9.291 -
   9.292 -	QPixmap pix( 16, 16 );
   9.293 -    pix.fill( mapCanvas->backgroundColor() );
   9.294 -    actionFormatBackColor->setIconSet( pix );
   9.295 -    pix.fill( defLinkColor );
   9.296 -    actionFormatLinkColor->setIconSet( pix );
   9.297 -
   9.298 -	actionFileSave->setEnabled( mapUnsaved );
   9.299 -	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
   9.300 -		actionEditUndo->setEnabled( true);
   9.301 -	else	
   9.302 -		actionEditUndo->setEnabled( false);
   9.303 -
   9.304 -	if (undoSet.readNumEntry("/history/redosAvail",0)>0)
   9.305 -		actionEditRedo->setEnabled( true);
   9.306 -	else	
   9.307 -		actionEditRedo->setEnabled( false);
   9.308 -
   9.309 -	if (selection)
   9.310 -	{
   9.311 -		if ( (typeid(*selection) == typeid(BranchObj)) || 
   9.312 -			(typeid(*selection) == typeid(MapCenterObj))  )
   9.313 -		{
   9.314 -			BranchObj *bo=(BranchObj*)selection;
   9.315 -			// Take care of links
   9.316 -			if (bo->countXLinks()==0)
   9.317 -			{
   9.318 -				branchXLinksContextMenuEdit->clear();
   9.319 -				branchXLinksContextMenuFollow->clear();
   9.320 -			} else
   9.321 -			{
   9.322 -				BranchObj *bot;
   9.323 -				QString s;
   9.324 -				branchXLinksContextMenuEdit->clear();
   9.325 -				branchXLinksContextMenuFollow->clear();
   9.326 -				for (int i=0; i<=bo->countXLinks();i++)
   9.327 -				{
   9.328 -					bot=bo->XLinkTargetAt(i);
   9.329 -					if (bot)
   9.330 -					{
   9.331 -						s=bot->getHeading();
   9.332 -						if (s.length()>25)
   9.333 -							s=s.left(25)+"...";
   9.334 -						branchXLinksContextMenuFollow->addAction (s);
   9.335 -						branchXLinksContextMenuEdit->addAction (s);
   9.336 -					}	
   9.337 -				}
   9.338 -			}
   9.339 -
   9.340 -			standardFlagsDefault->setEnabled (true);
   9.341 -
   9.342 -			actionEditToggleScroll->setEnabled (true);
   9.343 -			if ( bo->isScrolled() )
   9.344 -				actionEditToggleScroll->setOn(true);
   9.345 -			else	
   9.346 -				actionEditToggleScroll->setOn(false);
   9.347 -
   9.348 -			if ( bo->getURL().isEmpty() )
   9.349 -			{
   9.350 -				actionEditOpenURL->setEnabled (false);
   9.351 -				actionEditOpenURLTab->setEnabled (false);
   9.352 -			}	
   9.353 -			else	
   9.354 -			{
   9.355 -				actionEditOpenURL->setEnabled (true);
   9.356 -				actionEditOpenURLTab->setEnabled (true);
   9.357 -			}
   9.358 -			if ( bo->getVymLink().isEmpty() )
   9.359 -			{
   9.360 -				actionEditOpenVymLink->setEnabled (false);
   9.361 -				actionEditDeleteVymLink->setEnabled (false);
   9.362 -			} else	
   9.363 -			{
   9.364 -				actionEditOpenVymLink->setEnabled (true);
   9.365 -				actionEditDeleteVymLink->setEnabled (true);
   9.366 -			}	
   9.367 -
   9.368 -			if (bo->canMoveBranchUp()) 
   9.369 -				actionEditMoveUp->setEnabled (true);
   9.370 -			else	
   9.371 -				actionEditMoveUp->setEnabled (false);
   9.372 -			if (bo->canMoveBranchDown()) 
   9.373 -				actionEditMoveDown->setEnabled (true);
   9.374 -			else	
   9.375 -				actionEditMoveDown->setEnabled (false);
   9.376 -
   9.377 -
   9.378 -			actionEditToggleHideExport->setEnabled (true);	
   9.379 -			actionEditToggleHideExport->setOn (bo->hideInExport() );	
   9.380 -
   9.381 -			actionEditCopy->setEnabled (true);	
   9.382 -			actionEditCut->setEnabled (true);	
   9.383 -			if (!clipboardEmpty)
   9.384 -				actionEditPaste->setEnabled (true);	
   9.385 -			else	
   9.386 -				actionEditPaste->setEnabled (false);	
   9.387 -			for (a=actionListBranches.first();a;a=actionListBranches.next())
   9.388 -				a->setEnabled(true);
   9.389 -			actionEditDelete->setEnabled (true);
   9.390 -			switch (selection->getFrameType())
   9.391 -			{
   9.392 -				case NoFrame: 
   9.393 -					actionFormatFrameNone->setOn(true);
   9.394 -					break;
   9.395 -				case Rectangle:
   9.396 -					actionFormatFrameRectangle->setOn(true);
   9.397 -					break;
   9.398 -				default:
   9.399 -					break;
   9.400 -			}	
   9.401 -			actionFormatIncludeImagesVer->setOn
   9.402 -				( ((BranchObj*)selection)->getIncludeImagesVer());
   9.403 -			actionFormatIncludeImagesHor->setOn
   9.404 -				( ((BranchObj*)selection)->getIncludeImagesHor());
   9.405 -			actionFormatHideLinkUnselected->setOn
   9.406 -				(selection->getHideLinkUnselected());
   9.407 -		}
   9.408 -		if ( (typeid(*selection) == typeid(FloatImageObj)) )
   9.409 -		{
   9.410 -			FloatObj *fo=(FloatImageObj*)selection;
   9.411 -//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
   9.412 -
   9.413 -			actionEditOpenURL->setEnabled (false);
   9.414 -			actionEditOpenVymLink->setEnabled (false);
   9.415 -			actionEditDeleteVymLink->setEnabled (false);	
   9.416 -			actionEditToggleHideExport->setEnabled (true);	
   9.417 -			actionEditToggleHideExport->setOn (fo->hideInExport() );	
   9.418 -
   9.419 -
   9.420 -			actionEditCopy->setEnabled (true);
   9.421 -			actionEditCut->setEnabled (true);	
   9.422 -			actionEditPaste->setEnabled (false);
   9.423 -			for (a=actionListBranches.first();a;a=actionListBranches.next())
   9.424 -				a->setEnabled(false);
   9.425 -			actionEditDelete->setEnabled (true);
   9.426 -			actionFormatHideLinkUnselected->setOn
   9.427 -				( selection->getHideLinkUnselected());
   9.428 -			actionEditMoveUp->setEnabled (false);
   9.429 -			actionEditMoveDown->setEnabled (false);
   9.430 -		}
   9.431 -
   9.432 -	} else
   9.433 -	{
   9.434 -//FIXME do this in mainwindow				standardFlagsDefault->setEnabled (false);
   9.435 -
   9.436 -		actionEditCopy->setEnabled (false);	
   9.437 -		actionEditCut->setEnabled (false);	
   9.438 -		actionEditPaste->setEnabled (false);	
   9.439 -		for (a=actionListBranches.first();a;a=actionListBranches.next())
   9.440 -			a->setEnabled(false);
   9.441 -
   9.442 -		actionEditToggleScroll->setEnabled (false);
   9.443 -		actionEditOpenURL->setEnabled (false);
   9.444 -		actionEditOpenVymLink->setEnabled (false);
   9.445 -		actionEditDeleteVymLink->setEnabled (false);	
   9.446 -		actionEditHeading2URL->setEnabled (false);	
   9.447 -		actionEditDelete->setEnabled (false);
   9.448 -		actionEditMoveUp->setEnabled (false);
   9.449 -		actionEditMoveDown->setEnabled (false);
   9.450 -		actionEditToggleHideExport->setEnabled (false);	
   9.451 -	}	
   9.452 +	mainWindow->updateActions();
   9.453 +	// FIXME maybe don't update if blockReposition is set
   9.454  }
   9.455  
   9.456  void MapEditor::updateNoteFlag()
   9.457 @@ -3417,13 +3158,13 @@
   9.458  	// Special case: CTRL is pressed
   9.459  	if (e->state() & Qt::ControlModifier)
   9.460  	{
   9.461 -		if (actionModModeColor->isOn())
   9.462 +		if (mainWindow->getModMode()==ModModeColor)
   9.463  		{
   9.464  				pickingColor=true;
   9.465  				setCursor (pickColorCursor);
   9.466  				return;
   9.467  		} 
   9.468 -		if (actionModModeLink->isOn())
   9.469 +		if (mainWindow->getModMode()==ModModeXLink)
   9.470  		{	
   9.471  			BranchObj *bo_begin=NULL;
   9.472  			if (lmo)
   9.473 @@ -3462,7 +3203,7 @@
   9.474  
   9.475  			// If modMode==copy, then we want to "move" the _new_ object around
   9.476  			// then we need the offset from p to the _old_ selection, because of tmp
   9.477 -			if (actionModModeCopy->isOn() &&
   9.478 +			if (mainWindow->getModMode()==ModModeCopy &&
   9.479  				e->state() & Qt::ControlModifier)
   9.480  			{
   9.481  				if (typeid(*selection)==typeid(BranchObj) )
    10.1 --- a/mapeditor.h	Thu Sep 21 13:48:05 2006 +0000
    10.2 +++ b/mapeditor.h	Mon Oct 16 12:42:54 2006 +0000
    10.3 @@ -2,18 +2,7 @@
    10.4  #define MAPEDITOR_H
    10.5  
    10.6  #include <q3canvas.h>
    10.7 -//#include <q3filedialog.h>
    10.8 -//#include <q3process.h>
    10.9  #include <QBuffer>
   10.10 -#include <QContextMenuEvent>
   10.11 -#include <QCursor>
   10.12 -#include <QDragEnterEvent>
   10.13 -#include <QDropEvent>
   10.14 -#include <QEvent>
   10.15 -#include <QLineEdit>
   10.16 -#include <QMouseEvent>
   10.17 -#include <QPixmap>
   10.18 -#include <QResizeEvent>
   10.19  
   10.20  #include "mapcenterobj.h"
   10.21  #include "file.h"
   10.22 @@ -29,10 +18,10 @@
   10.23      Q_OBJECT
   10.24  
   10.25  public:
   10.26 -    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
   10.27 +    MapEditor(QWidget* parent=0,  const char* name=0, Qt::WFlags f=0);
   10.28  	~MapEditor();
   10.29 -    QColor color();
   10.30 -    QColor backgroundColor();
   10.31 +    QColor getColor();
   10.32 +    QColor getBackgroundColor();
   10.33      MapCenterObj* getMapCenter();
   10.34  	Q3Canvas* getCanvas();
   10.35  	void adjustCanvasSize();// adjust canvas size to map and scrollview
   10.36 @@ -45,7 +34,6 @@
   10.37      void saveStateComplete       (const QString &);					
   10.38      void saveStatePart           (LinkableMapObj *, const QString &);
   10.39      void saveStateConstSelection (const QString &, const QString &, const QString &);
   10.40 -    void saveStateComData		 (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
   10.41      void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
   10.42      void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
   10.43      void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
   10.44 @@ -90,7 +78,9 @@
   10.45      void clear();		// clear map
   10.46      void copy();		// copy branch to clipboard
   10.47      void redo();		// redo last action
   10.48 +	bool isRedoAvailable();
   10.49      void undo();		// undo last action
   10.50 +	bool isUndoAvailable();
   10.51  	void gotoStep (int);// goto a step in history
   10.52  private:	
   10.53      void undoXML(const QString &, const QString &);
   10.54 @@ -247,7 +237,6 @@
   10.55  	QString destPath;			// path to .vym file (needed for vymlinks)
   10.56  	QString mapName;			// fileName without ".vym"
   10.57  
   10.58 -	bool isInteractive;			// non interactive don't need tmpdirs
   10.59  	QString tmpMapDir;			// tmp directory with undo history
   10.60  	QString histPath;			// Path to history file
   10.61  	int stepsTotal;				// total number of steps (undos+redos) 
    11.1 --- a/texteditor.cpp	Thu Sep 21 13:48:05 2006 +0000
    11.2 +++ b/texteditor.cpp	Mon Oct 16 12:42:54 2006 +0000
    11.3 @@ -1,20 +1,5 @@
    11.4  #include "texteditor.h"
    11.5  
    11.6 -#include <QPainter>
    11.7 -#include <QPrinter>
    11.8 -#include <QFile>
    11.9 -#include <QFileDialog>
   11.10 -#include <qmenubar.h>
   11.11 -#include <qtextstream.h>
   11.12 -#include <QSettings>
   11.13 -#include <QFontDialog>
   11.14 -#include <QMessageBox>
   11.15 -#include <QColorDialog>
   11.16 -#include <QRegExp>
   11.17 -#include <QList>
   11.18 -#include <QPixmap>
   11.19 -#include <QCloseEvent>
   11.20 -
   11.21  #include <iostream>
   11.22  #include <cstdlib>
   11.23  #include <typeinfo>
   11.24 @@ -511,7 +496,8 @@
   11.25  void TextEditor::closeEvent( QCloseEvent* ce )
   11.26  {
   11.27      ce->accept();	// TextEditor can be reopened with show()
   11.28 -    actionViewToggleNoteEditor->setOn (false);
   11.29 +	emit (textEditorClosed() );
   11.30 +	cout << "TE closed\n";
   11.31      showwithmain=false;
   11.32      return;
   11.33  }
    12.1 --- a/texteditor.h	Thu Sep 21 13:48:05 2006 +0000
    12.2 +++ b/texteditor.h	Mon Oct 16 12:42:54 2006 +0000
    12.3 @@ -2,11 +2,6 @@
    12.4  #define TEXTEDITOR_H
    12.5  
    12.6  #include <QtGui>
    12.7 -#include <QTextEdit>
    12.8 -#include <QFontDatabase>
    12.9 -#include <QComboBox>
   12.10 -#include <QCloseEvent>
   12.11 -
   12.12  
   12.13  enum EditorState {inactiveEditor,emptyEditor,filledEditor};
   12.14  
   12.15 @@ -49,6 +44,7 @@
   12.16  
   12.17  signals:
   12.18  	void textHasChanged();
   12.19 +	void textEditorClosed();
   12.20  	void fontFamilyHasChanged();
   12.21  	void fontSizeHasChanged();
   12.22  	
    13.1 --- a/version.h	Thu Sep 21 13:48:05 2006 +0000
    13.2 +++ b/version.h	Mon Oct 16 12:42:54 2006 +0000
    13.3 @@ -3,6 +3,6 @@
    13.4  
    13.5  #define __VYM "VYM"
    13.6  #define __VYM_VERSION "1.8.57"
    13.7 -#define __BUILD_DATE "September 14, 2006"
    13.8 +#define __BUILD_DATE "October 13, 2006"
    13.9  
   13.10  #endif