# HG changeset patch
# User insilmaril
# Date 1161002574 0
# Node ID 0e1aeb21cb780cf4607de5f6d8050da3f7c3a88c
# Parent  bb94eec7c8f319e407061cbf892f03bd7e184197
Code simplifications

diff -r bb94eec7c8f3 -r 0e1aeb21cb78 aboutdialog.cpp
--- a/aboutdialog.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/aboutdialog.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -5,10 +5,8 @@
 #include "aboutdialog.h"
 #include "version.h"
 #include "settings.h"
-#include "mainwindow.h"
 
 
-extern Main *mainWindow;
 extern Settings settings;
 extern QString iconPath;
 
@@ -191,5 +189,11 @@
 {
 	QProcess *proc= new QProcess ();
 	proc->start( settings.value("/mainwindow/readerURL").toString(),QStringList ()<<url.toString());
-	if (!proc->waitForStarted() &&mainWindow->settingsURL() ) setSource(url);
+	//if (!proc->waitForStarted() &&mainWindow->settingsURL() ) setSource(url);
+	if (!proc->waitForStarted() )
+		QMessageBox::warning(0, 
+		tr("Warning"),
+		tr("Couldn't find a viewer to open %1.\n").arg(url)+
+		tr("Please use Settings->")+tr("Set application to open an URL"));
+
 }
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 aboutdialog.h
--- a/aboutdialog.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/aboutdialog.h	Mon Oct 16 12:42:54 2006 +0000
@@ -7,6 +7,7 @@
 #include <QDialog>
 #include <QPushButton>
 #include <QString>
+#include <QMessageBox>
 
 class AboutTextBrowser;
 /////////////////////////////////////////////////////////////////////////////
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 branchobj.cpp
--- a/branchobj.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/branchobj.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -6,7 +6,6 @@
 extern TextEditor *textEditor;
 extern Main *mainWindow;
 extern FlagRowObj *standardFlagsDefault;
-extern QAction *actionEditOpenURL;
 
 
 /////////////////////////////////////////////////////////////////
@@ -1169,7 +1168,6 @@
 {
 	savePosInAngle();
     int i=branch.find(bo1);
-	cout << "BO: i="<<i<<endl;
     if (i>0) 
 	{	// -1 if bo1 not found 
 		branch.at(i)->angle--;
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 branchobj.h
--- a/branchobj.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/branchobj.h	Mon Oct 16 12:42:54 2006 +0000
@@ -1,12 +1,13 @@
 #ifndef BRANCHOBJ_H
 #define BRANCHOBJ_H
 
+#include <Q3PtrList>
+
 #include "floatimageobj.h"
 #include "linkablemapobj.h"
 #include "ornamentedobj.h"
 #include "xlinkobj.h"
-//Added by qt3to4:
-#include <Q3PtrList>
+
 
 class BranchObjPtrList : public Q3PtrList<BranchObj>
 {
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 demos/todo.vym
Binary file demos/todo.vym has changed
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 main.cpp
--- a/main.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/main.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -2,11 +2,9 @@
 #include <QPixmap>
 #include <QTranslator>
 #include <QDir>
-#include <q3ptrlist.h>
 #include <QTextCodec>
 #include <q3network.h>
-#include <QMenu>
-#include <QActionGroup>
+//#include <QActionGroup>
 
 #include "settings.h"
 #include "options.h"
@@ -29,98 +27,6 @@
 FlagRowObj *systemFlagsDefault;	// used to copy from in LinkableMapObj
 FlagRowObj *standardFlagsDefault;
 
-// Lists of actions
-// (QActionGroup could not be "enabled")
-Q3PtrList <QAction> actionListBranches;
-
-// Actions which change sometimes
-QAction *actionFileSave;
-QAction *actionFilePrint;
-QAction *actionEditUndo;
-QAction *actionEditRedo;
-QAction *actionEditCopy;
-QAction *actionEditCut;
-QAction *actionEditPaste;
-QAction *actionEditMoveUp;
-QAction *actionEditMoveDown;
-QAction *actionEditToggleScroll;
-QAction *actionEditOpenURL;
-QAction *actionEditOpenURLTab;
-QAction *actionEditOpenMultipleURLTabs;
-QAction *actionEditURL;
-QAction *actionEditHeading2URL;
-QAction *actionEditBugzilla2URL;
-QAction *actionEditFATE2URL;
-QAction *actionEditOpenVymLink;
-QAction *actionEditOpenMultipleVymLinks;
-QAction *actionEditVymLink;
-QAction *actionEditToggleHideExport;
-QAction *actionEditDeleteVymLink;
-QAction *actionEditMapInfo;
-QAction *actionEditHeading;
-QAction *actionEditDelete;
-QAction *actionEditAddBranch;
-QAction *actionEditAddBranchHere;
-QAction *actionEditAddBranchAbove;
-QAction *actionEditAddBranchBelow;
-QAction *actionEditRemoveBranchKeepChilds;
-QAction *actionEditRemoveChilds;
-QAction *actionEditImportAdd;
-QAction *actionEditImportReplace;
-QAction *actionEditSaveBranch;
-QAction *actionEditSelectFirst;
-QAction *actionEditSelectLast;
-QAction *actionEditLoadImage;
-
-QAction *actionFormatColor;		
-QAction *actionFormatPickColor;		
-QAction *actionFormatColorBranch;
-QAction *actionFormatColorSubtree;
-QAction *actionFormatBackColor;
-QAction *actionFormatLinkColorHint;
-QAction *actionFormatLinkColor;		
-
-QActionGroup *actionGroupModModes;
-QAction *actionModModeColor;
-QAction *actionModModeLink;
-QAction *actionModModeCopy;
-
-QActionGroup *actionGroupFormatFrameTypes;
-QAction *actionFormatFrameNone;
-QAction *actionFormatFrameRectangle;
-
-QActionGroup *actionGroupFormatLinkStyles;
-QAction *actionFormatIncludeImagesVer;
-QAction *actionFormatIncludeImagesHor;
-QAction *actionFormatHideLinkUnselected;
-QAction *actionFormatLinkStyleLine;
-QAction *actionFormatLinkStyleParabel;
-QAction *actionFormatLinkStylePolyLine;
-QAction *actionFormatLinkStylePolyParabel;
-
-QAction *actionViewToggleNoteEditor;
-QAction *actionViewToggleHistoryWindow;
-
-QAction *actionSettingsAutoselectHeading;
-QAction *actionSettingsAutoselectText;
-QAction *actionSettingsAutoedit;
-QAction *actionSettingsUseDelKey;
-QAction *actionSettingsUseFlagGroups;
-QAction *actionSettingsUseHideExport;
-
-
-QMenu* branchContextMenu;
-QMenu* branchAddContextMenu;
-QMenu* branchRemoveContextMenu;
-QMenu* branchLinksContextMenu;
-QMenu* branchXLinksContextMenuEdit;
-QMenu* branchXLinksContextMenuFollow;
-QMenu* floatimageContextMenu;
-QMenu* canvasContextMenu;
-QMenu* fileLastMapsMenu;
-QMenu* fileImportMenu;
-QMenu* fileExportMenu;
-
 
 Settings settings ("InSilmaril","vym"); // Organization, Application name
 
@@ -177,13 +83,18 @@
 	} else
 	// ok, let's find my way on my own
 	{
-		vymBaseDir.setPath ("/usr/share/vym");
-		if (!vymBaseDir.exists())
-		{
-			vymBaseDir.setPath ("/usr/local/share/vym");
+		#if defined (Q_OS_MACX)
+			vymBaseDir.setPath(vymBaseDir.currentDirPath() +"/vym.app/Contents");
+
+		#else
+			vymBaseDir.setPath ("/usr/share/vym");
 			if (!vymBaseDir.exists())
-				vymBaseDir.setPath(vymBaseDir.currentDirPath() );
-		}		
+			{
+				vymBaseDir.setPath ("/usr/local/share/vym");
+				if (!vymBaseDir.exists())
+					vymBaseDir.setPath(vymBaseDir.currentDirPath() );
+			}		
+		#endif
 	}
 
 	iconPath=vymBaseDir.path()+"/icons/";
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 mainwindow.cpp
--- a/mainwindow.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/mainwindow.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -1,24 +1,10 @@
 #include "mainwindow.h"
 
 #include <QtGui>
-#include <QPainter>
-#include <QPrinter>
-#include <QFile>
+
 #include <q3filedialog.h>
-#include <QColor>
-#include <QColorDialog>
-#include <QBitmap>
-#include <QInputDialog>
-//Added by qt3to4:
 #include <Q3StrList>
-#include <QPixmap>
-#include <QCloseEvent>
-#include <QShowEvent>
-#include <QHideEvent>
-#include <Q3PopupMenu>
-#include <QActionGroup>
 #include <Q3PtrList>
-//#include <qdatetime.h>			// for random seed
 
 #include <iostream>
 #include <cstdlib>
@@ -49,94 +35,17 @@
 extern FlagRowObj* standardFlagsDefault;
 extern FlagRowObj* systemFlagsDefault;
 
-extern Q3PtrList <QAction> actionListBranches;
-
-extern QAction* actionFileSave;
-extern QAction* actionFilePrint;
-extern QAction* actionEditUndo;
-extern QAction* actionEditRedo;
-extern QAction *actionEditCopy;
-extern QAction *actionEditCut;
-extern QAction *actionEditPaste;
-extern QAction *actionEditMoveUp;
-extern QAction *actionEditMoveDown;
-extern QAction *actionEditToggleScroll;
-extern QAction* actionEditOpenURL;
-extern QAction* actionEditOpenURLTab;
-extern QAction* actionEditOpenMultipleURLTabs;
-extern QAction* actionEditURL;
-extern QAction* actionEditHeading2URL;
-extern QAction* actionEditBugzilla2URL;
-extern QAction* actionEditFATE2URL;
-extern QAction *actionEditOpenVymLink;
-extern QAction *actionEditOpenMultipleVymLinks;
-extern QAction *actionEditVymLink;
-extern QAction *actionEditDeleteVymLink;
-extern QAction *actionEditToggleHideExport;
-extern QAction *actionEditMapInfo;
-extern QAction *actionEditHeading;
-extern QAction *actionEditDelete;
-extern QAction *actionEditAddBranch;
-extern QAction *actionEditAddBranchHere;
-extern QAction *actionEditAddBranchAbove;
-extern QAction *actionEditAddBranchBelow;
-extern QAction *actionEditRemoveBranchKeepChilds;
-extern QAction *actionEditRemoveChilds;
-extern QAction *actionEditImportAdd;
-extern QAction *actionEditImportReplace;
-extern QAction *actionEditSaveBranch;
-extern QAction *actionEditSelectFirst;
-extern QAction *actionEditSelectLast;
-extern QAction *actionEditLoadImage;
-
-extern QAction* actionFormatColor;
-extern QAction* actionFormatPickColor;
-extern QAction* actionFormatColorBranch;
-extern QAction* actionFormatColorSubtree;
-extern QAction* actionFormatLinkColorHint;
-extern QAction* actionFormatBackColor;
-extern QAction* actionFormatLinkColor;
-extern QAction *actionFormatIncludeImagesVer;
-extern QAction *actionFormatIncludeImagesHor;
-
-extern QActionGroup* actionGroupModModes;
-extern QAction* actionModModeColor;
-extern QAction* actionModModeLink;
-extern QAction* actionModModeCopy;
-
-extern QActionGroup *actionGroupFormatFrameTypes;
-extern QAction *actionFormatFrameNone;
-extern QAction *actionFormatFrameRectangle;
-
-extern QActionGroup *actionGroupFormatLinkStyles;
-extern QAction *actionFormatLinkStyleLine;
-extern QAction *actionFormatLinkStyleParabel;
-extern QAction *actionFormatLinkStylePolyLine;
-extern QAction *actionFormatLinkStylePolyParabel;
-extern QAction *actionFormatHideLinkUnselected;
-
-extern QAction *actionViewToggleNoteEditor;
-extern QAction *actionViewToggleHistoryWindow;
-
-extern QAction* actionSettingsAutoedit;
-extern QAction* actionSettingsAutoselectHeading;
-extern QAction* actionSettingsAutoselectHeading;
-extern QAction* actionSettingsAutoselectText;
-extern QAction* actionSettingsUseDelKey;
-extern QAction* actionSettingsUseFlagGroups;
-extern QAction* actionSettingsUseHideExport;
-
-extern QMenu* branchContextMenu;
-extern QMenu* branchAddContextMenu;
-extern QMenu* branchRemoveContextMenu;
-extern QMenu* branchLinksContextMenu;
-extern QMenu* branchXLinksContextMenuEdit;
-extern QMenu* branchXLinksContextMenuFollow;
-extern QMenu* floatimageContextMenu;
-extern QMenu* canvasContextMenu;
-extern QMenu* fileLastMapsMenu;
-extern QMenu* fileImportMenu;
-extern QMenu* fileExportMenu;
+QMenu* branchContextMenu;
+QMenu* branchAddContextMenu;
+QMenu* branchRemoveContextMenu;
+QMenu* branchLinksContextMenu;
+QMenu* branchXLinksContextMenuEdit;
+QMenu* branchXLinksContextMenuFollow;
+QMenu* floatimageContextMenu;
+QMenu* canvasContextMenu;
+QMenu* fileLastMapsMenu;
+QMenu* fileImportMenu;
+QMenu* fileExportMenu;
 
 
 extern Settings settings;
@@ -252,6 +161,7 @@
 
 	// Connect TextEditor, so that we can update flags if text changes
 	connect (textEditor, SIGNAL (textHasChanged() ), this, SLOT (updateNoteFlag()));
+	connect (textEditor, SIGNAL (textClosed() ), this, SLOT (updateActions()));
 
 	updateGeometry();
 }
@@ -267,9 +177,9 @@
 	settings.setValue( "/version/version", __VYM_VERSION );
 	settings.setValue( "/version/builddate", __BUILD_DATE );
 
-	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoselectHeading->isOn() );
-	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoselectText->isOn() );
-	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoedit->isOn() );
+	settings.setValue( "/mapeditor/editmode/autoSelectHeading",actionSettingsAutoSelectHeading->isOn() );
+	settings.setValue( "/mapeditor/editmode/autoSelectText",actionSettingsAutoSelectText->isOn() );
+	settings.setValue( "/mapeditor/editmode/autoEdit",actionSettingsAutoEdit->isOn() );
 	settings.setValue( "/mapeditor/editmode/useDelKey",actionSettingsUseDelKey->isOn() );
 	settings.setValue( "/mapeditor/editmode/useFlagGroups",actionSettingsUseFlagGroups->isOn() );
 	settings.setValue( "/export/useHideExport",actionSettingsUseHideExport->isOn() );
@@ -957,19 +867,19 @@
     connect( a, SIGNAL( triggered() ), this, SLOT( formatFrameRectangle() ) );
 	actionFormatFrameRectangle=a;
 
-    a = new QAction( tr( "Include images vertically" ),  actionFormatIncludeImagesVer);
+    a = new QAction( tr( "Include images vertically" ),  this);
 	a->setStatusTip ( tr ("Include top and bottom position of images into branch"));
 	a->setToggleAction(true);
     connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesVer() ) );
 	actionFormatIncludeImagesVer=a;
 
-    a = new QAction( tr( "Include images horizontally" ),  actionFormatIncludeImagesHor );
+    a = new QAction( tr( "Include images horizontally" ),  this);
 	a->setStatusTip ( tr ("Include left and right position of images into branch"));
 	a->setToggleAction(true);
     connect( a, SIGNAL( triggered() ), this, SLOT( formatIncludeImagesHor() ) );
 	actionFormatIncludeImagesHor=a;
 
-    a = new QAction( tr( "Hide link if object is not selected" ), actionFormatHideLinkUnselected);
+    a = new QAction( tr( "Hide link if object is not selected" ), this);
 	a->setStatusTip (tr( "Hide link" ));
 	a->setToggleAction(true);
     connect( a, SIGNAL( triggered() ), this, SLOT( formatHideLinkUnselected() ) );
@@ -1093,7 +1003,7 @@
     a->setStatusTip( tr( "Use modifier to draw xLinks" ));
 	a->setToggleAction(true);
 	a->addTo (tb);
-	actionModModeLink=a;
+	actionModModeXLink=a;
 }
 
 // Flag Actions
@@ -1438,21 +1348,21 @@
 	a->setToggleAction(true);
 	a->setOn ( settings.value ("/mapeditor/editmode/autoEdit",true).toBool());
 	settingsMenu->addAction (a);
-	actionSettingsAutoedit=a;
+	actionSettingsAutoEdit=a;
 
     a= new QAction( tr( "Select branch after adding it" ), this );
     a->setStatusTip( tr( "Select branch after adding it" ));
 	a->setToggleAction(true);
 	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectHeading",false).toBool() );
 	settingsMenu->addAction (a);
-	actionSettingsAutoselectHeading=a;
+	actionSettingsAutoSelectHeading=a;
 	
     a= new QAction(tr( "Select existing heading" ), this);
     a->setStatusTip( tr( "Select heading before editing" ));
 	a->setToggleAction(true);
 	a->setOn ( settings.value ("/mapeditor/editmode/autoSelectText",true).toBool() );
 	settingsMenu->addAction (a);
-	actionSettingsAutoselectText=a;
+	actionSettingsAutoSelectText=a;
 	
     a= new QAction( tr( "Delete key" ), this);
     a->setStatusTip( tr( "Delete key for deleting branches" ));
@@ -1739,7 +1649,7 @@
 void Main::fileNew()
 {
 	QString fn="unnamed";
-	MapEditor* medit = new MapEditor ( NULL,true);
+	MapEditor* medit = new MapEditor ( NULL);
 	tabWidget->addTab (medit,fn);
 	tabWidget->showPage(medit);
 	medit->viewport()->setFocus();
@@ -1807,7 +1717,7 @@
 		// create a new mapeditor in a new tab
 		if ( lmode==NewMap && (!me || !me->isDefault() ) )
 		{
-			me= new MapEditor ( NULL,true);
+			me= new MapEditor ( NULL);
 			tabWidget->addTab (me,fn);
 			tabIndex=tabWidget->indexOf (me);
 			tabWidget->setCurrentPage (tabIndex);
@@ -2978,7 +2888,7 @@
 {
 	if (currentMapEditor())
 	{
-		QColor col = QColorDialog::getColor( currentMapEditor()->color(), this );
+		QColor col = QColorDialog::getColor( currentMapEditor()->getColor(), this );
 		if ( !col.isValid() ) return;
 		currentMapEditor()->setColor( col );
 		colorChanged( col );
@@ -3117,14 +3027,6 @@
 	}	
 }
 
-void Main::modModeColor()
-{
-}
-
-void Main::modModeLink()
-{
-}
-
 bool Main::settingsPDF()
 {
 	// Default browser is set in constructor
@@ -3182,6 +3084,222 @@
 		currentMapEditor()->updateNoteFlag();
 }
 
+void Main::updateActions()
+{
+	MapEditor *me=currentMapEditor();
+	if (!me) return;
+
+	// updateActions is also called when NoteEditor is closed
+	actionViewToggleNoteEditor->setOn (textEditor->isVisible());
+
+	QAction *a;
+	if (me->getLinkColorHint()==HeadingColor) 
+		actionFormatLinkColorHint->setOn(true);
+	else	
+		actionFormatLinkColorHint->setOn(false);
+
+	switch (me->getLinkStyle())
+	{
+		case StyleLine: 
+			actionFormatLinkStyleLine->setOn(true);
+			break;
+		case StyleParabel:
+			actionFormatLinkStyleParabel->setOn(true);
+			break;
+		case StylePolyLine:	
+			actionFormatLinkStylePolyLine->setOn(true);
+			break;
+		case StylePolyParabel:	
+			actionFormatLinkStylePolyParabel->setOn(true);
+			break;
+		default:
+			break;
+	}	
+
+	QPixmap pix( 16, 16 );
+    pix.fill( me->getBackgroundColor() );
+    actionFormatBackColor->setIconSet( pix );
+    pix.fill( me->getDefLinkColor() );
+    actionFormatLinkColor->setIconSet( pix );
+
+	actionFileSave->setEnabled( me->isUnsaved() );
+	if (me->isUndoAvailable())
+		actionEditUndo->setEnabled( true);
+	else	
+		actionEditUndo->setEnabled( false);
+
+	if (me->isRedoAvailable())
+		actionEditRedo->setEnabled( true);
+	else	
+		actionEditRedo->setEnabled( false);
+
+	LinkableMapObj *selection=me->getSelection();
+	if (selection)
+	{
+		if ( (typeid(*selection) == typeid(BranchObj)) || 
+			(typeid(*selection) == typeid(MapCenterObj))  )
+		{
+			BranchObj *bo=(BranchObj*)selection;
+			// Take care of links
+			if (bo->countXLinks()==0)
+			{
+				branchXLinksContextMenuEdit->clear();
+				branchXLinksContextMenuFollow->clear();
+			} else
+			{
+				BranchObj *bot;
+				QString s;
+				branchXLinksContextMenuEdit->clear();
+				branchXLinksContextMenuFollow->clear();
+				for (int i=0; i<=bo->countXLinks();i++)
+				{
+					bot=bo->XLinkTargetAt(i);
+					if (bot)
+					{
+						s=bot->getHeading();
+						if (s.length()>25)
+							s=s.left(25)+"...";
+						branchXLinksContextMenuFollow->addAction (s);
+						branchXLinksContextMenuEdit->addAction (s);
+					}	
+				}
+			}
+
+			standardFlagsDefault->setEnabled (true);
+
+			actionEditToggleScroll->setEnabled (true);
+			if ( bo->isScrolled() )
+				actionEditToggleScroll->setOn(true);
+			else	
+				actionEditToggleScroll->setOn(false);
+
+			if ( bo->getURL().isEmpty() )
+			{
+				actionEditOpenURL->setEnabled (false);
+				actionEditOpenURLTab->setEnabled (false);
+			}	
+			else	
+			{
+				actionEditOpenURL->setEnabled (true);
+				actionEditOpenURLTab->setEnabled (true);
+			}
+			if ( bo->getVymLink().isEmpty() )
+			{
+				actionEditOpenVymLink->setEnabled (false);
+				actionEditDeleteVymLink->setEnabled (false);
+			} else	
+			{
+				actionEditOpenVymLink->setEnabled (true);
+				actionEditDeleteVymLink->setEnabled (true);
+			}	
+
+			if (bo->canMoveBranchUp()) 
+				actionEditMoveUp->setEnabled (true);
+			else	
+				actionEditMoveUp->setEnabled (false);
+			if (bo->canMoveBranchDown()) 
+				actionEditMoveDown->setEnabled (true);
+			else	
+				actionEditMoveDown->setEnabled (false);
+
+
+			actionEditToggleHideExport->setEnabled (true);	
+			actionEditToggleHideExport->setOn (bo->hideInExport() );	
+
+			actionEditCopy->setEnabled (true);	
+			actionEditCut->setEnabled (true);	
+			if (!clipboardEmpty)
+				actionEditPaste->setEnabled (true);	
+			else	
+				actionEditPaste->setEnabled (false);	
+			for (a=actionListBranches.first();a;a=actionListBranches.next())
+				a->setEnabled(true);
+			actionEditDelete->setEnabled (true);
+			switch (selection->getFrameType())
+			{
+				case NoFrame: 
+					actionFormatFrameNone->setOn(true);
+					break;
+				case Rectangle:
+					actionFormatFrameRectangle->setOn(true);
+					break;
+				default:
+					break;
+			}	
+			actionFormatIncludeImagesVer->setOn
+				( ((BranchObj*)selection)->getIncludeImagesVer());
+			actionFormatIncludeImagesHor->setOn
+				( ((BranchObj*)selection)->getIncludeImagesHor());
+			actionFormatHideLinkUnselected->setOn
+				(selection->getHideLinkUnselected());
+		}
+		if ( (typeid(*selection) == typeid(FloatImageObj)) )
+		{
+			FloatObj *fo=(FloatImageObj*)selection;
+//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
+
+			actionEditOpenURL->setEnabled (false);
+			actionEditOpenVymLink->setEnabled (false);
+			actionEditDeleteVymLink->setEnabled (false);	
+			actionEditToggleHideExport->setEnabled (true);	
+			actionEditToggleHideExport->setOn (fo->hideInExport() );	
+
+
+			actionEditCopy->setEnabled (true);
+			actionEditCut->setEnabled (true);	
+			actionEditPaste->setEnabled (false);
+			for (a=actionListBranches.first();a;a=actionListBranches.next())
+				a->setEnabled(false);
+			actionEditDelete->setEnabled (true);
+			actionFormatHideLinkUnselected->setOn
+				( selection->getHideLinkUnselected());
+			actionEditMoveUp->setEnabled (false);
+			actionEditMoveDown->setEnabled (false);
+		}
+
+	} else
+	{
+		actionEditCopy->setEnabled (false);	
+		actionEditCut->setEnabled (false);	
+		actionEditPaste->setEnabled (false);	
+		for (a=actionListBranches.first();a;a=actionListBranches.next())
+			a->setEnabled(false);
+
+		actionEditToggleScroll->setEnabled (false);
+		actionEditOpenURL->setEnabled (false);
+		actionEditOpenVymLink->setEnabled (false);
+		actionEditDeleteVymLink->setEnabled (false);	
+		actionEditHeading2URL->setEnabled (false);	
+		actionEditDelete->setEnabled (false);
+		actionEditMoveUp->setEnabled (false);
+		actionEditMoveDown->setEnabled (false);
+		actionEditToggleHideExport->setEnabled (false);	
+	}	
+}
+
+ModMode Main::getModMode()
+{
+	if (actionModModeColor->isOn()) return ModModeColor;
+	if (actionModModeCopy->isOn()) return ModModeCopy;
+	if (actionModModeXLink->isOn()) return ModModeXLink;
+	return ModModeNone;
+}
+
+bool Main::autoEdit()
+{
+	return actionSettingsAutoEdit->isOn();
+}
+
+bool Main::autoSelectHeading()
+{
+	return actionSettingsAutoSelectHeading->isOn();
+}
+
+bool Main::useFlagGroups()
+{
+	return actionSettingsUseFlagGroups->isOn();
+}
+
 void Main::windowShowNoteEditor()
 {
 	textEditor->setShowWithMain(true);
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 mainwindow.h
--- a/mainwindow.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/mainwindow.h	Mon Oct 16 12:42:54 2006 +0000
@@ -1,16 +1,7 @@
 #ifndef MAINWINDOW_H 
 #define MAINWINDOW_H
 
-#include <QAction>
-#include <QCursor>
 #include <QMainWindow>
-#include <QProcess>
-#include <QToolBar>
-#include <QTabWidget>
-//Added by qt3to4:
-#include <QCloseEvent>
-#include <QShowEvent>
-#include <QHideEvent>
 
 #include "file.h"
 #include "findwindow.h"
@@ -18,6 +9,8 @@
 #include "texteditor.h"
 #include "xml.h"
 
+enum ModMode {ModModeNone,ModModeColor,ModModeCopy,ModModeXLink};
+
 class Main : public QMainWindow 
 {
     Q_OBJECT
@@ -157,9 +150,6 @@
     void viewZoomIn();
     void viewZoomOut();
 
-	void modModeColor();
-	void modModeLink();
-
 public slots:
 	bool settingsPDF();
 	bool settingsURL();
@@ -168,6 +158,11 @@
 	void windowToggleNoteEditor();
 	void windowToggleHistory();
 	void updateNoteFlag();
+	void updateActions();
+	ModMode getModMode();
+	bool autoEdit();
+	bool autoSelectHeading();
+	bool useFlagGroups();
 
 private slots:
 	void windowNextEditor();
@@ -194,7 +189,82 @@
 
 	QLineEdit *lineedit;	// to enter headings of branches
 	QString editSel;
-	
+
+	Q3PtrList <QAction> actionListBranches;
+
+	QAction* actionFileSave;
+	QAction* actionFilePrint;
+	QAction* actionEditUndo;
+	QAction* actionEditRedo;
+	QAction *actionEditCopy;
+	QAction *actionEditCut;
+	QAction *actionEditPaste;
+	QAction *actionEditMoveUp;
+	QAction *actionEditMoveDown;
+	QAction *actionEditToggleScroll;
+	QAction* actionEditOpenURL;
+	QAction* actionEditOpenURLTab;
+	QAction* actionEditOpenMultipleURLTabs;
+	QAction* actionEditURL;
+	QAction* actionEditHeading2URL;
+	QAction* actionEditBugzilla2URL;
+	QAction* actionEditFATE2URL;
+	QAction *actionEditOpenVymLink;
+	QAction *actionEditOpenMultipleVymLinks;
+	QAction *actionEditVymLink;
+	QAction *actionEditDeleteVymLink;
+	QAction *actionEditToggleHideExport;
+	QAction *actionEditMapInfo;
+	QAction *actionEditHeading;
+	QAction *actionEditDelete;
+	QAction *actionEditAddBranch;
+	QAction *actionEditAddBranchHere;
+	QAction *actionEditAddBranchAbove;
+	QAction *actionEditAddBranchBelow;
+	QAction *actionEditRemoveBranchKeepChilds;
+	QAction *actionEditRemoveChilds;
+	QAction *actionEditImportAdd;
+	QAction *actionEditImportReplace;
+	QAction *actionEditSaveBranch;
+	QAction *actionEditSelectFirst;
+	QAction *actionEditSelectLast;
+	QAction *actionEditLoadImage;
+
+	QAction* actionFormatColor;
+	QAction* actionFormatPickColor;
+	QAction* actionFormatColorBranch;
+	QAction* actionFormatColorSubtree;
+	QAction* actionFormatLinkColorHint;
+	QAction* actionFormatBackColor;
+	QAction* actionFormatLinkColor;
+	QAction *actionFormatIncludeImagesVer;
+	QAction *actionFormatIncludeImagesHor;
+
+	QActionGroup* actionGroupModModes;
+	QAction* actionModModeColor;
+	QAction* actionModModeXLink;
+	QAction* actionModModeCopy;
+
+	QActionGroup *actionGroupFormatFrameTypes;
+	QAction *actionFormatFrameNone;
+	QAction *actionFormatFrameRectangle;
+
+	QActionGroup *actionGroupFormatLinkStyles;
+	QAction *actionFormatLinkStyleLine;
+	QAction *actionFormatLinkStyleParabel;
+	QAction *actionFormatLinkStylePolyLine;
+	QAction *actionFormatLinkStylePolyParabel;
+	QAction *actionFormatHideLinkUnselected;
+
+	QAction *actionViewToggleNoteEditor;
+	QAction *actionViewToggleHistoryWindow;
+
+	QAction* actionSettingsAutoEdit;
+	QAction* actionSettingsAutoSelectHeading;
+	QAction* actionSettingsAutoSelectText;
+	QAction* actionSettingsUseDelKey;
+	QAction* actionSettingsUseFlagGroups;
+	QAction* actionSettingsUseHideExport;
 };
 
 
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 mapeditor.cpp
--- a/mapeditor.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/mapeditor.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -1,23 +1,5 @@
 #include "mapeditor.h"
 
-#include <QActionGroup>
-#include <QColor>
-#include <QColorDialog>
-#include <QContextMenuEvent>
-#include <QDir>
-#include <QDragEnterEvent>
-#include <QDropEvent>
-#include <QFile>
-#include <QInputDialog>
-#include <QMessageBox>
-#include <QMouseEvent>
-#include <QPainter>
-#include <QPixmap>
-#include <QPrinter>
-#include <QResizeEvent>
-#include <QTextStream>
-
-#include <Q3PtrList>
 #include <q3dragobject.h>
 #include <q3urloperator.h>
 #include <q3networkprotocol.h>
@@ -49,76 +31,8 @@
 extern QString tmpVymDir;
 extern QString clipboardDir;
 extern bool clipboardEmpty;
-extern FlagRowObj *systemFlagsDefault;
 extern FlagRowObj *standardFlagsDefault;
 
-extern Q3PtrList <QAction> actionListBranches;
-
-extern QAction *actionFileSave;
-extern QAction *actionEditUndo;
-extern QAction *actionEditRedo;
-extern QAction *actionEditCopy;
-extern QAction *actionEditCut;
-extern QAction *actionEditPaste;
-extern QAction *actionEditMoveUp;
-extern QAction *actionEditMoveDown;
-extern QAction *actionEditToggleScroll;
-extern QAction *actionEditOpenURL;
-extern QAction *actionEditOpenURLTab;
-extern QAction *actionEditURL;
-extern QAction *actionEditHeading2URL;
-extern QAction *actionEditBugzilla2URL;
-extern QAction *actionEditFATE2URL;
-extern QAction *actionEditOpenVymLink;
-extern QAction *actionEditVymLink;
-extern QAction *actionEditDeleteVymLink;
-extern QAction *actionEditToggleHideExport;
-extern QAction *actionEditHeading;
-extern QAction *actionEditDelete;
-extern QAction *actionEditAddBranch;
-extern QAction *actionEditAddBranchAbove;
-extern QAction *actionEditAddBranchBelow;
-extern QAction *actionEditRemoveBranchHere;
-extern QAction *actionEditRemoveChilds;
-extern QAction *actionEditImportAdd;
-extern QAction *actionEditImportReplace;
-extern QAction *actionEditSaveBranch;
-extern QAction *actionEditSelectFirst;
-extern QAction *actionEditSelectLast;
-extern QAction *actionEditLoadImage;
-
-extern QAction* actionFormatPickColor;
-extern QAction* actionFormatColorBranch;
-extern QAction* actionFormatColorSubtree;
-extern QAction *actionFormatLinkColorHint;
-extern QAction *actionFormatBackColor;
-extern QAction *actionFormatLinkColor;
-
-extern QActionGroup* actionGroupModModes;
-extern QAction* actionModModeColor;
-extern QAction* actionModModeLink;
-extern QAction* actionModModeCopy;
-
-extern QActionGroup *actionGroupFormatFrameTypes;
-extern QAction *actionFormatFrameNone;
-extern QAction *actionFormatFrameRectangle;
-
-extern QActionGroup *actionGroupFormatLinkStyles;
-extern QAction *actionFormatIncludeImagesVer;
-extern QAction *actionFormatIncludeImagesHor;
-extern QAction *actionFormatHideLinkUnselected;
-extern QAction *actionFormatLinkStyleLine;
-extern QAction *actionFormatLinkStyleParabel;
-extern QAction *actionFormatLinkStylePolyLine;
-extern QAction *actionFormatLinkStylePolyParabel;
-
-extern QAction *actionViewToggleNoteEditor;
-
-extern QAction *actionSettingsAutoedit;
-extern QAction *actionSettingsAutoselectHeading;
-extern QAction *actionSettingsAutoselectText;
-extern QAction *actionSettingsUseFlagGroups;
-
 extern QMenu* branchContextMenu;
 extern QMenu* branchAddContextMenu;
 extern QMenu* branchRemoveContextMenu;
@@ -145,7 +59,7 @@
 ///////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////
 MapEditor::MapEditor(
-	QWidget* parent, bool interactive, const char* name, Qt::WFlags f) :
+	QWidget* parent, const char* name, Qt::WFlags f) :
   Q3CanvasView(parent,name,f), urlOperator(0), imageBuffer(0)
 {
 	//cout << "Constructor ME "<<this<<endl;
@@ -224,8 +138,6 @@
 
 	hidemode=HideNone;
 
-	isInteractive=interactive;	// FIXME still needed?
-
 	// Create temporary files
 	makeTmpDirs();
 
@@ -249,18 +161,14 @@
   }
 
 	//cout <<"Destructor MapEditor\n";
-
-	// Save Settings
-	//settings.writeEntry( "/mapeditor/editmode/autoselect",  );
-
 }
 
-QColor MapEditor::color()
+QColor MapEditor::getColor()
 {
     return actColor;
 }
 
-QColor MapEditor::backgroundColor()
+QColor MapEditor::getBackgroundColor()
 {
     return mapCanvas->backgroundColor();
 }
@@ -493,6 +401,7 @@
 		NULL);
 }
 
+/* FIXME not used
 void MapEditor::saveStateComData(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment, LinkableMapObj *saveSel) 
 {
 	QString redoSelection="";
@@ -506,6 +415,7 @@
 		comment, 
 		saveSel);
 }
+*/
 
 void MapEditor::saveState(LinkableMapObj *undoSel, const QString &uc, LinkableMapObj *redoSel, const QString &rc, const QString &comment) 
 {
@@ -833,8 +743,6 @@
 	mapChanged=true;
 	mapDefault=false;
 	mapUnsaved=true;
-	actionEditUndo->setEnabled (true);
-	actionFileSave->setEnabled (true);
 	findReset();
 }
 
@@ -1000,7 +908,7 @@
 	{
 		mapChanged=false;
 		mapUnsaved=false;
-		actionFileSave->setEnabled(false);
+		updateActions();
 	}
 
 	return returnCode;
@@ -1369,6 +1277,14 @@
 
 }
 
+bool MapEditor::isRedoAvailable()
+{
+	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
+		return true;
+	else	
+		return false;
+}
+
 void MapEditor::undo()
 {
 	blockSaveState=true;
@@ -1434,6 +1350,14 @@
 	updateActions();
 }
 
+bool MapEditor::isUndoAvailable()
+{
+	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
+		return true;
+	else	
+		return false;
+}
+
 void MapEditor::gotoStep (int i)
 {
 	// Restore variables
@@ -1744,15 +1668,15 @@
 			adjustCanvasSize();
 
 
-			if (actionSettingsAutoedit->isOn() ||
-				actionSettingsAutoselectHeading->isOn() )
+			if (mainWindow->autoEdit() ||
+				mainWindow->autoSelectHeading() )
 			{
 				selection->unselect();
 				selection=newbo;
 				selection->select();
-				if (actionSettingsAutoedit->isOn() )
+				if (mainWindow->autoEdit() )
 					mainWindow->editHeading();
-				if (!actionSettingsAutoselectHeading->isOn()
+				if (!mainWindow->autoSelectHeading()
 					)//&& !wasScrolled)  //FIXME wasScrolled was moved to addNewBranchInt
 				{
 					selection->unselect();
@@ -1787,15 +1711,15 @@
 
 		mapCenter->reposition();
 		adjustCanvasSize();
-		if (actionSettingsAutoedit->isOn() ||
-			actionSettingsAutoselectHeading->isOn() )
+		if (mainWindow->autoEdit() ||
+			mainWindow->autoSelectHeading() )
 		{
 			selection->unselect();
 			selection=newbo;
 			selection->select();
-			if (actionSettingsAutoedit->isOn() )
+			if (mainWindow->autoEdit() )
 				mainWindow->editHeading();
-			if (!actionSettingsAutoselectHeading->isOn()
+			if (!mainWindow->autoSelectHeading()
 				&& !wasScrolled)
 			{
 				selection->unselect();
@@ -2345,7 +2269,7 @@
 			saveStateConstSelection(QString("%1 (\"%2\")").arg(u).arg(f), 
 				QString("%1 (\"%2\")").arg(r).arg(f),
 				QString("Toggling standard flag \"%1\" of %2").arg(f).arg(getName(bo)));
-			bo->toggleStandardFlag (f,actionSettingsUseFlagGroups->isOn());
+			bo->toggleStandardFlag (f,mainWindow->useFlagGroups());
 			adjustCanvasSize();
 		}
 	}	
@@ -2571,7 +2495,6 @@
 			s="Set";
 		}	
 		saveStateComplete(QString ("%1 hide export flag of %2").arg(s).arg(getName(selection)));	//TODO undoCommand
-		actionEditToggleHideExport->setOn (oo->hideInExport());	
 		updateActions();
 		mapCenter->reposition();
 		adjustCanvasSize();
@@ -2683,190 +2606,8 @@
 
 void MapEditor::updateActions()
 {
-	QAction *a;
-	if (getLinkColorHint()==HeadingColor) 
-		actionFormatLinkColorHint->setOn(true);
-	else	
-		actionFormatLinkColorHint->setOn(false);
-
-	switch (linkstyle)
-	{
-		case StyleLine: 
-			actionFormatLinkStyleLine->setOn(true);
-			break;
-		case StyleParabel:
-			actionFormatLinkStyleParabel->setOn(true);
-			break;
-		case StylePolyLine:	
-			actionFormatLinkStylePolyLine->setOn(true);
-			break;
-		case StylePolyParabel:	
-			actionFormatLinkStylePolyParabel->setOn(true);
-			break;
-		default:
-			break;
-	}	
-
-	QPixmap pix( 16, 16 );
-    pix.fill( mapCanvas->backgroundColor() );
-    actionFormatBackColor->setIconSet( pix );
-    pix.fill( defLinkColor );
-    actionFormatLinkColor->setIconSet( pix );
-
-	actionFileSave->setEnabled( mapUnsaved );
-	if (undoSet.readNumEntry("/history/undosAvail",0)>0)
-		actionEditUndo->setEnabled( true);
-	else	
-		actionEditUndo->setEnabled( false);
-
-	if (undoSet.readNumEntry("/history/redosAvail",0)>0)
-		actionEditRedo->setEnabled( true);
-	else	
-		actionEditRedo->setEnabled( false);
-
-	if (selection)
-	{
-		if ( (typeid(*selection) == typeid(BranchObj)) || 
-			(typeid(*selection) == typeid(MapCenterObj))  )
-		{
-			BranchObj *bo=(BranchObj*)selection;
-			// Take care of links
-			if (bo->countXLinks()==0)
-			{
-				branchXLinksContextMenuEdit->clear();
-				branchXLinksContextMenuFollow->clear();
-			} else
-			{
-				BranchObj *bot;
-				QString s;
-				branchXLinksContextMenuEdit->clear();
-				branchXLinksContextMenuFollow->clear();
-				for (int i=0; i<=bo->countXLinks();i++)
-				{
-					bot=bo->XLinkTargetAt(i);
-					if (bot)
-					{
-						s=bot->getHeading();
-						if (s.length()>25)
-							s=s.left(25)+"...";
-						branchXLinksContextMenuFollow->addAction (s);
-						branchXLinksContextMenuEdit->addAction (s);
-					}	
-				}
-			}
-
-			standardFlagsDefault->setEnabled (true);
-
-			actionEditToggleScroll->setEnabled (true);
-			if ( bo->isScrolled() )
-				actionEditToggleScroll->setOn(true);
-			else	
-				actionEditToggleScroll->setOn(false);
-
-			if ( bo->getURL().isEmpty() )
-			{
-				actionEditOpenURL->setEnabled (false);
-				actionEditOpenURLTab->setEnabled (false);
-			}	
-			else	
-			{
-				actionEditOpenURL->setEnabled (true);
-				actionEditOpenURLTab->setEnabled (true);
-			}
-			if ( bo->getVymLink().isEmpty() )
-			{
-				actionEditOpenVymLink->setEnabled (false);
-				actionEditDeleteVymLink->setEnabled (false);
-			} else	
-			{
-				actionEditOpenVymLink->setEnabled (true);
-				actionEditDeleteVymLink->setEnabled (true);
-			}	
-
-			if (bo->canMoveBranchUp()) 
-				actionEditMoveUp->setEnabled (true);
-			else	
-				actionEditMoveUp->setEnabled (false);
-			if (bo->canMoveBranchDown()) 
-				actionEditMoveDown->setEnabled (true);
-			else	
-				actionEditMoveDown->setEnabled (false);
-
-
-			actionEditToggleHideExport->setEnabled (true);	
-			actionEditToggleHideExport->setOn (bo->hideInExport() );	
-
-			actionEditCopy->setEnabled (true);	
-			actionEditCut->setEnabled (true);	
-			if (!clipboardEmpty)
-				actionEditPaste->setEnabled (true);	
-			else	
-				actionEditPaste->setEnabled (false);	
-			for (a=actionListBranches.first();a;a=actionListBranches.next())
-				a->setEnabled(true);
-			actionEditDelete->setEnabled (true);
-			switch (selection->getFrameType())
-			{
-				case NoFrame: 
-					actionFormatFrameNone->setOn(true);
-					break;
-				case Rectangle:
-					actionFormatFrameRectangle->setOn(true);
-					break;
-				default:
-					break;
-			}	
-			actionFormatIncludeImagesVer->setOn
-				( ((BranchObj*)selection)->getIncludeImagesVer());
-			actionFormatIncludeImagesHor->setOn
-				( ((BranchObj*)selection)->getIncludeImagesHor());
-			actionFormatHideLinkUnselected->setOn
-				(selection->getHideLinkUnselected());
-		}
-		if ( (typeid(*selection) == typeid(FloatImageObj)) )
-		{
-			FloatObj *fo=(FloatImageObj*)selection;
-//FIXME do this in mainwindow					standardFlagsDefault->setEnabled (false);
-
-			actionEditOpenURL->setEnabled (false);
-			actionEditOpenVymLink->setEnabled (false);
-			actionEditDeleteVymLink->setEnabled (false);	
-			actionEditToggleHideExport->setEnabled (true);	
-			actionEditToggleHideExport->setOn (fo->hideInExport() );	
-
-
-			actionEditCopy->setEnabled (true);
-			actionEditCut->setEnabled (true);	
-			actionEditPaste->setEnabled (false);
-			for (a=actionListBranches.first();a;a=actionListBranches.next())
-				a->setEnabled(false);
-			actionEditDelete->setEnabled (true);
-			actionFormatHideLinkUnselected->setOn
-				( selection->getHideLinkUnselected());
-			actionEditMoveUp->setEnabled (false);
-			actionEditMoveDown->setEnabled (false);
-		}
-
-	} else
-	{
-//FIXME do this in mainwindow				standardFlagsDefault->setEnabled (false);
-
-		actionEditCopy->setEnabled (false);	
-		actionEditCut->setEnabled (false);	
-		actionEditPaste->setEnabled (false);	
-		for (a=actionListBranches.first();a;a=actionListBranches.next())
-			a->setEnabled(false);
-
-		actionEditToggleScroll->setEnabled (false);
-		actionEditOpenURL->setEnabled (false);
-		actionEditOpenVymLink->setEnabled (false);
-		actionEditDeleteVymLink->setEnabled (false);	
-		actionEditHeading2URL->setEnabled (false);	
-		actionEditDelete->setEnabled (false);
-		actionEditMoveUp->setEnabled (false);
-		actionEditMoveDown->setEnabled (false);
-		actionEditToggleHideExport->setEnabled (false);	
-	}	
+	mainWindow->updateActions();
+	// FIXME maybe don't update if blockReposition is set
 }
 
 void MapEditor::updateNoteFlag()
@@ -3417,13 +3158,13 @@
 	// Special case: CTRL is pressed
 	if (e->state() & Qt::ControlModifier)
 	{
-		if (actionModModeColor->isOn())
+		if (mainWindow->getModMode()==ModModeColor)
 		{
 				pickingColor=true;
 				setCursor (pickColorCursor);
 				return;
 		} 
-		if (actionModModeLink->isOn())
+		if (mainWindow->getModMode()==ModModeXLink)
 		{	
 			BranchObj *bo_begin=NULL;
 			if (lmo)
@@ -3462,7 +3203,7 @@
 
 			// If modMode==copy, then we want to "move" the _new_ object around
 			// then we need the offset from p to the _old_ selection, because of tmp
-			if (actionModModeCopy->isOn() &&
+			if (mainWindow->getModMode()==ModModeCopy &&
 				e->state() & Qt::ControlModifier)
 			{
 				if (typeid(*selection)==typeid(BranchObj) )
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 mapeditor.h
--- a/mapeditor.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/mapeditor.h	Mon Oct 16 12:42:54 2006 +0000
@@ -2,18 +2,7 @@
 #define MAPEDITOR_H
 
 #include <q3canvas.h>
-//#include <q3filedialog.h>
-//#include <q3process.h>
 #include <QBuffer>
-#include <QContextMenuEvent>
-#include <QCursor>
-#include <QDragEnterEvent>
-#include <QDropEvent>
-#include <QEvent>
-#include <QLineEdit>
-#include <QMouseEvent>
-#include <QPixmap>
-#include <QResizeEvent>
 
 #include "mapcenterobj.h"
 #include "file.h"
@@ -29,10 +18,10 @@
     Q_OBJECT
 
 public:
-    MapEditor(QWidget* parent=0, bool interactive=false, const char* name=0, Qt::WFlags f=0);
+    MapEditor(QWidget* parent=0,  const char* name=0, Qt::WFlags f=0);
 	~MapEditor();
-    QColor color();
-    QColor backgroundColor();
+    QColor getColor();
+    QColor getBackgroundColor();
     MapCenterObj* getMapCenter();
 	Q3Canvas* getCanvas();
 	void adjustCanvasSize();// adjust canvas size to map and scrollview
@@ -45,7 +34,6 @@
     void saveStateComplete       (const QString &);					
     void saveStatePart           (LinkableMapObj *, const QString &);
     void saveStateConstSelection (const QString &, const QString &, const QString &);
-    void saveStateComData		 (LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &, LinkableMapObj *);
     void saveState(LinkableMapObj *, const QString &, LinkableMapObj *, const QString &, const QString &);
     void saveState(const QString &, const QString &, const QString &, const QString &, const QString &);
     void saveState(const SaveMode&, const QString &, const QString &, const QString &, const QString &, const QString &, LinkableMapObj *);
@@ -90,7 +78,9 @@
     void clear();		// clear map
     void copy();		// copy branch to clipboard
     void redo();		// redo last action
+	bool isRedoAvailable();
     void undo();		// undo last action
+	bool isUndoAvailable();
 	void gotoStep (int);// goto a step in history
 private:	
     void undoXML(const QString &, const QString &);
@@ -247,7 +237,6 @@
 	QString destPath;			// path to .vym file (needed for vymlinks)
 	QString mapName;			// fileName without ".vym"
 
-	bool isInteractive;			// non interactive don't need tmpdirs
 	QString tmpMapDir;			// tmp directory with undo history
 	QString histPath;			// Path to history file
 	int stepsTotal;				// total number of steps (undos+redos) 
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 texteditor.cpp
--- a/texteditor.cpp	Thu Sep 21 13:48:05 2006 +0000
+++ b/texteditor.cpp	Mon Oct 16 12:42:54 2006 +0000
@@ -1,20 +1,5 @@
 #include "texteditor.h"
 
-#include <QPainter>
-#include <QPrinter>
-#include <QFile>
-#include <QFileDialog>
-#include <qmenubar.h>
-#include <qtextstream.h>
-#include <QSettings>
-#include <QFontDialog>
-#include <QMessageBox>
-#include <QColorDialog>
-#include <QRegExp>
-#include <QList>
-#include <QPixmap>
-#include <QCloseEvent>
-
 #include <iostream>
 #include <cstdlib>
 #include <typeinfo>
@@ -511,7 +496,8 @@
 void TextEditor::closeEvent( QCloseEvent* ce )
 {
     ce->accept();	// TextEditor can be reopened with show()
-    actionViewToggleNoteEditor->setOn (false);
+	emit (textEditorClosed() );
+	cout << "TE closed\n";
     showwithmain=false;
     return;
 }
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 texteditor.h
--- a/texteditor.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/texteditor.h	Mon Oct 16 12:42:54 2006 +0000
@@ -2,11 +2,6 @@
 #define TEXTEDITOR_H
 
 #include <QtGui>
-#include <QTextEdit>
-#include <QFontDatabase>
-#include <QComboBox>
-#include <QCloseEvent>
-
 
 enum EditorState {inactiveEditor,emptyEditor,filledEditor};
 
@@ -49,6 +44,7 @@
 
 signals:
 	void textHasChanged();
+	void textEditorClosed();
 	void fontFamilyHasChanged();
 	void fontSizeHasChanged();
 	
diff -r bb94eec7c8f3 -r 0e1aeb21cb78 version.h
--- a/version.h	Thu Sep 21 13:48:05 2006 +0000
+++ b/version.h	Mon Oct 16 12:42:54 2006 +0000
@@ -3,6 +3,6 @@
 
 #define __VYM "VYM"
 #define __VYM_VERSION "1.8.57"
-#define __BUILD_DATE "September 14, 2006"
+#define __BUILD_DATE "October 13, 2006"
 
 #endif