# HG changeset patch
# User insilmaril
# Date 1142430833 0
# Node ID 0e994bf2346b6f8a895065d0f7a539f2abbb6954
# Parent  e7acede0377c7ca024674c15ce711c743027fae0
hide export for floatimages.

diff -r e7acede0377c -r 0e994bf2346b linkablemapobj.cpp
--- a/linkablemapobj.cpp	Wed Mar 15 13:53:53 2006 +0000
+++ b/linkablemapobj.cpp	Wed Mar 15 13:53:53 2006 +0000
@@ -103,6 +103,7 @@
 
 	// Rel Positions
 	relPos=QPoint(0,0);
+	useRelPos=false;
 	useOrientation=true;
 }
 
diff -r e7acede0377c -r 0e994bf2346b main.cpp
--- a/main.cpp	Wed Mar 15 13:53:53 2006 +0000
+++ b/main.cpp	Wed Mar 15 13:53:53 2006 +0000
@@ -68,7 +68,6 @@
 QAction *actionEditSelectFirst;
 QAction *actionEditSelectLast;
 QAction *actionEditLoadImage;
-QAction *actionEditToggleFloatExport;
 
 QAction *actionFormatColor;		
 QAction *actionFormatPickColor;		
diff -r e7acede0377c -r 0e994bf2346b mainwindow.cpp
--- a/mainwindow.cpp	Wed Mar 15 13:53:53 2006 +0000
+++ b/mainwindow.cpp	Wed Mar 15 13:53:53 2006 +0000
@@ -123,7 +123,6 @@
 extern QAction *actionEditSelectFirst;
 extern QAction *actionEditSelectLast;
 extern QAction *actionEditLoadImage;
-extern QAction *actionEditToggleFloatExport;
 
 extern QAction* actionFormatColor;
 extern QAction* actionFormatPickColor;
@@ -494,6 +493,7 @@
 		actionEditToggleScroll=a;
 	#endif	
 	actionEditToggleScroll->setEnabled (false);
+	actionEditToggleScroll->setToggleAction(true);
     actionEditToggleScroll->addTo( tb );
     actionEditToggleScroll->addTo( menu );
 	actionListBranches.append(actionEditToggleScroll);
@@ -1175,12 +1175,14 @@
 	actionEditCopy->addTo( floatimageContextMenu );
 	actionEditCut->addTo( floatimageContextMenu );
 
+/* FIXME not needed any longer
 	floatimageContextMenu->insertSeparator();	
     a = new QAction( tr( "Use for Export" ), QPixmap(), tr( "Use for Export"), 0, this, "useForExport" );
 	a->setToggleAction(true);
     connect( a, SIGNAL( activated() ), this, SLOT( editToggleFloatExport() ) );
     a->addTo( floatimageContextMenu);
 	actionEditToggleFloatExport=a;
+	*/
 
 	floatimageContextMenu->insertSeparator();	
 	actionFormatHideLinkUnselected->addTo( floatimageContextMenu );
@@ -1711,11 +1713,9 @@
 		}
     }
 
-	if (me->saveZipped())
-	{
+	if (saveZipped && !tmpMapDir.isEmpty())
 		// Delete tmpDir
 		removeDir (QDir(tmpMapDir));
-	} 
 
 	if (err==success)
 	{
@@ -1737,7 +1737,6 @@
 
 void Main::fileSaveAs(const SaveMode& savemode)
 {
-	QString tmpMapDir;
 	QString fn;
 
 	if (currentMapEditor())
@@ -2225,7 +2224,7 @@
 void Main::editToggleHideExport()
 {
 	if (currentMapEditor())
-		currentMapEditor()->toggleHideExport();	
+		currentMapEditor()->setHideExport();	
 }
 
 void Main::editMapInfo()
@@ -2373,12 +2372,6 @@
 		currentMapEditor()->saveFloatImage(item);
 }
 
-void Main::editToggleFloatExport()
-{
-	if (currentMapEditor())
-		currentMapEditor()->toggleFloatExport();
-}
-
 void Main::editFollowXLink(int item)
 {
 	if (currentMapEditor())
diff -r e7acede0377c -r 0e994bf2346b mainwindow.h
--- a/mainwindow.h	Wed Mar 15 13:53:53 2006 +0000
+++ b/mainwindow.h	Wed Mar 15 13:53:53 2006 +0000
@@ -126,7 +126,6 @@
     void editLastBranch();
     void editLoadImage();
     void editSaveImage(int);
-    void editToggleFloatExport();
     void editFollowXLink (int);
     void editEditXLink (int);
 
diff -r e7acede0377c -r 0e994bf2346b mapeditor.cpp
--- a/mapeditor.cpp	Wed Mar 15 13:53:53 2006 +0000
+++ b/mapeditor.cpp	Wed Mar 15 13:53:53 2006 +0000
@@ -80,7 +80,6 @@
 extern QAction *actionEditSelectFirst;
 extern QAction *actionEditSelectLast;
 extern QAction *actionEditLoadImage;
-extern QAction *actionEditToggleFloatExport;
 
 extern QAction* actionFormatPickColor;
 extern QAction* actionFormatColorBranch;
@@ -339,11 +338,6 @@
 	d.mkdir (tmpMapDir,true);
 }
 
-void MapEditor::delTmpDirs()
-{
-	removeDir (QDir(tmpMapDir));
-}
-
 QString MapEditor::saveToDir(const QString &tmpdir, const QString &prefix, bool writeflags, const QPoint &offset, LinkableMapObj *saveSelection)
 {
 	// tmpdir		temporary directory to which data will be written
@@ -2297,16 +2291,37 @@
 	}
 }
 
+void MapEditor::setHideExport()
+{
+	if (selection && (typeid(*selection) == typeid(BranchObj) ||
+			typeid(*selection) == typeid(MapCenterObj)) ||
+			(typeid(*selection)==typeid(FloatImageObj))
+			)
+	{		
+		saveState();	//TODO undoCommand
+		OrnamentedObj *oo=(OrnamentedObj*)selection;
+		oo->setHideInExport(actionEditToggleHideExport->isOn());
+		updateActions();
+		mapCenter->reposition();
+		adjustCanvasSize();
+		canvas()->update();
+	}
+}
+
 void MapEditor::toggleHideExport()
 {
 	if (selection && (typeid(*selection) == typeid(BranchObj) ||
-			typeid(*selection) == typeid(MapCenterObj)) //||
-//			(typeid(*selection)==typeid(FloatImageObj))
+			typeid(*selection) == typeid(MapCenterObj)) ||
+			(typeid(*selection)==typeid(FloatImageObj))
 			)
 	{		
 		saveState();	//TODO undoCommand
-		BranchObj *bo=(BranchObj*)selection;
-		bo->setHideInExport(actionEditToggleHideExport->isOn());
+		OrnamentedObj *oo=(OrnamentedObj*)selection;
+		if (oo->hideInExport())
+			oo->setHideInExport(false);
+		else	
+			oo->setHideInExport(true);
+		actionEditToggleHideExport->setOn (oo->hideInExport());	
 		updateActions();
 		mapCenter->reposition();
 		adjustCanvasSize();
@@ -2468,6 +2483,12 @@
 
 			standardFlagsDefault->setEnabled (true);
 
+			actionEditToggleScroll->setEnabled (true);
+			if ( bo->isScrolled() )
+				actionEditToggleScroll->setOn(true);
+			else	
+				actionEditToggleScroll->setOn(false);
+
 			if ( bo->getURL().isEmpty() )
 				actionEditOpenURL->setEnabled (false);
 			else	
@@ -2494,7 +2515,6 @@
 			for (a=actionListBranches.first();a;a=actionListBranches.next())
 				a->setEnabled(true);
 			actionEditDelete->setEnabled (true);
-			actionEditToggleFloatExport->setEnabled (false);
 			switch (selection->getFrameType())
 			{
 				case NoFrame: 
@@ -2515,12 +2535,15 @@
 		}
 		if ( (typeid(*selection) == typeid(FloatImageObj)) )
 		{
+			FloatObj *fo=(FloatImageObj*)selection;
 			standardFlagsDefault->setEnabled (false);
 
 			actionEditOpenURL->setEnabled (false);
 			actionEditOpenVymLink->setEnabled (false);
 			actionEditDeleteVymLink->setEnabled (false);	
-			actionEditToggleHideExport->setEnabled (false);	
+			actionEditToggleHideExport->setEnabled (true);	
+			actionEditToggleHideExport->setOn (fo->hideInExport() );	
+
 
 			actionEditCopy->setEnabled (true);
 			actionEditCut->setEnabled (true);	
@@ -2528,8 +2551,6 @@
 			for (a=actionListBranches.first();a;a=actionListBranches.next())
 				a->setEnabled(false);
 			actionEditDelete->setEnabled (true);
-			actionEditToggleFloatExport->setOn
-				( ((FloatImageObj*)selection)->getFloatExport() );
 			actionFormatHideLinkUnselected->setOn
 				( selection->getHideLinkUnselected());
 		}
@@ -2544,12 +2565,12 @@
 		for (a=actionListBranches.first();a;a=actionListBranches.next())
 			a->setEnabled(false);
 
+		actionEditToggleScroll->setEnabled (true);
 		actionEditOpenURL->setEnabled (false);
 		actionEditOpenVymLink->setEnabled (false);
 		actionEditDeleteVymLink->setEnabled (false);	
 		actionEditHeading2URL->setEnabled (false);	
 		actionEditDelete->setEnabled (false);
-		actionEditToggleFloatExport->setEnabled (false);
 	}	
 }
 
@@ -2786,17 +2807,6 @@
 	}
 }
 
-void MapEditor::toggleFloatExport()
-{
-	if (selection && 
-		(typeid(*selection) == typeid(FloatImageObj))|| 
-		(typeid(*selection) == typeid(FloatObj)) )
-	{
-		FloatImageObj *fio=((FloatImageObj*)selection);
-		fio->setFloatExport (actionEditToggleFloatExport->isOn() );
-	}
-}
-
 void MapEditor::setFrame(const FrameType &t)
 {
 	if (selection && 
@@ -2960,6 +2970,7 @@
 void MapEditor::testFunction()
 {
 	cout << "MapEditor::testFunction() called\n";
+	mapCenter->reposition();
 	adjustCanvasSize();
 
 	/*
@@ -3106,18 +3117,16 @@
 				// Do not move, if systemFlag clicked
 				if (foname=="url") 
 					openURL();
-				else
-					if (foname=="vymLink")
-					{
-						mainWindow->editOpenVymLink();
-						// tabWidget may change, better return now
-						// before segfaulting...
-						return;
-					} else
-						if (foname=="note")
-							mainWindow->windowToggleNoteEditor();
-						else	
-							if (foname=="hideInExport") toggleHideExport();
+				else if (foname=="vymLink")
+				{
+					mainWindow->editOpenVymLink();
+					// tabWidget may change, better return now
+					// before segfaulting...
+					return;
+				} else if (foname=="note")
+					mainWindow->windowToggleNoteEditor();
+				else if (foname=="hideInExport")		
+					toggleHideExport();
 			}			
 		}	
 			
diff -r e7acede0377c -r 0e994bf2346b mapeditor.h
--- a/mapeditor.h	Wed Mar 15 13:53:53 2006 +0000
+++ b/mapeditor.h	Wed Mar 15 13:53:53 2006 +0000
@@ -31,7 +31,6 @@
 	
 private:
 	void makeTmpDirs();		// create temporary directories
-	void delTmpDirs();		// delete temporary directories
     QString saveToDir(const QString&,const QString &,bool, const QPoint &,LinkableMapObj*);
     void saveState();		// save actual state to backup
     void saveState(LinkableMapObj *);
@@ -128,7 +127,10 @@
 	void editVymLink();						// edit link to another map
 	void deleteVymLink();					// delete link to another map
 	QString getVymLink();					// return path to map
+	void setHideExport();					// toggle the export flag
+protected:	
 	void toggleHideExport();				// toggle the export flag
+public:	
 	void removeBranchHere();				// remove but keep childs
 	void removeChilds();					// remove childs
 	void editMapInfo();						// dialog to enter author, ...
@@ -151,7 +153,6 @@
     void unScrollAll();
 	void loadFloatImage ();
 	void saveFloatImage (int);
-	void toggleFloatExport();
 	void setFrame(const FrameType &);
 	void setIncludeImagesVer(bool);
 	void setIncludeImagesHor(bool);