# HG changeset patch
# User insilmaril
# Date 1171272527 0
# Node ID fb74fa7bfb4cbbc2dfc7632fcce1e1359b2a2b2a
# Parent  e0a3449f4458c937c72a42e8ae224b105c88bf0f
1.8.66 Various fixes

diff -r e0a3449f4458 -r fb74fa7bfb4c demos/todo.vym
Binary file demos/todo.vym has changed
diff -r e0a3449f4458 -r fb74fa7bfb4c linkablemapobj.cpp
--- a/linkablemapobj.cpp	Mon Feb 12 09:28:46 2007 +0000
+++ b/linkablemapobj.cpp	Mon Feb 12 09:28:47 2007 +0000
@@ -500,6 +500,7 @@
 	double vy=p2y - p1y;
 
 	// Draw the horizontal line below heading (from ChildPos to ParPos)
+	//bottomline->prepareGeometryChange();
 	bottomline->setLine (QLine (qRound(childPos.x()),
 		qRound(childPos.y()),
 		qRound(p1x),
@@ -517,6 +518,7 @@
 	switch (style)
 	{
 		case StyleLine:
+			//l->prepareGeometryChange();
 			l->setLine( QLine(qRound (parPos.x()),
 				qRound(parPos.y()),
 				qRound(p2x),
@@ -525,13 +527,17 @@
 		case StyleParabel:	
 			parabel (pa0, p1x,p1y,p2x,p2y);
 			for (int i=0; i<segment.size(); ++i)
+			{
+				//segment.at(i)->prepareGeometryChange();
 				segment.at(i)->setLine(QLineF( pa0.at(i).x(), pa0.at(i).y(),pa0.at(i+1).x(),pa0.at(i+1).y()));
+			}	
 			break;
 		case StylePolyLine:
 			pa0.clear();
 			pa0<<QPointF (qRound(p2x+tp.x()), qRound(p2y+tp.y()));
 			pa0<<QPointF (qRound(p2x-tp.x()), qRound(p2y-tp.y()));
 			pa0<<QPointF (qRound (parPos.x()), qRound(parPos.y()) );
+			//p->prepareGeometryChange();
 			p->setPolygon(QPolygonF (pa0));
 			break;
 		case StylePolyParabel:	
@@ -542,6 +548,7 @@
 				pa0 << QPointF (pa1.at(i));
 			for (int i=0;i<=arcsegs;i++)
 				pa0 << QPointF (pa2.at(arcsegs-i));
+			//p->prepareGeometryChange();
 			p->setPolygon(QPolygonF (pa0));
 			break;
 		default:
@@ -682,6 +689,7 @@
 
 void LinkableMapObj::setSelBox()
 {
+	//selbox->prepareGeometryChange();
 	selbox->setRect (clickBox);
 }
 
diff -r e0a3449f4458 -r fb74fa7bfb4c mainwindow.cpp
--- a/mainwindow.cpp	Mon Feb 12 09:28:46 2007 +0000
+++ b/mainwindow.cpp	Mon Feb 12 09:28:47 2007 +0000
@@ -3424,7 +3424,8 @@
 	if(currentMapEditor())
 	{
 		LinkableMapObj *sel=currentMapEditor()->getSelection();
-		if (sel && typeid(*sel) == typeid(BranchObj))
+		if (sel && (typeid(*sel) == typeid(BranchObj) ||
+		           typeid(*sel) == typeid(MapCenterObj)))
 		{
 			branchPropertyWindow->show();
 			branchPropertyWindow->setMapEditor(currentMapEditor());
diff -r e0a3449f4458 -r fb74fa7bfb4c mapeditor.cpp
--- a/mapeditor.cpp	Mon Feb 12 09:28:46 2007 +0000
+++ b/mapeditor.cpp	Mon Feb 12 09:28:47 2007 +0000
@@ -710,6 +710,19 @@
 		{	
 			paste();
 		}	
+	} else if (com=="scroll")
+	{
+		if (xelection.isEmpty() )
+		{
+			api.setError (Aborted,"Nothing selected");
+		} else if (! selb )
+		{				  
+			api.setError (Aborted,"Type of selection is not a branch");
+		} else if (api.checkParamCount(0))
+		{	
+			if (!scrollBranch ())	
+				api.setError (Aborted,"Could not scroll branch");
+		}	
 	} else if (com=="select")
 	{
 		if (api.checkParamCount(1))
@@ -835,8 +848,20 @@
 				selb->updateFlagsToolbar();
 			}	
 		}
-	}	
-	else if (com=="unsetFlag")
+	} else if (com=="unscroll")
+	{
+		if (xelection.isEmpty() )
+		{
+			api.setError (Aborted,"Nothing selected");
+		} else if (! selb )
+		{				  
+			api.setError (Aborted,"Type of selection is not a branch");
+		} else if (api.checkParamCount(0))
+		{	
+			if (!unscrollBranch ())	
+				api.setError (Aborted,"Could not unscroll branch");
+		}	
+	} else if (com=="unsetFlag")
 	{
 		if (xelection.isEmpty() )
 		{
@@ -2765,8 +2790,13 @@
 
 void MapEditor::updateNoteFlag()
 {
+	setChanged();
 	BranchObj *bo=xelection.getBranch();
-	if (bo) bo->updateNoteFlag();
+	if (bo) 
+	{
+		bo->updateNoteFlag();
+		mainWindow->updateActions();
+	}	
 }
 
 void MapEditor::setMapAuthor (const QString &s)
@@ -2911,24 +2941,17 @@
 
 }
 
-void MapEditor::toggleScroll()
+bool MapEditor::scrollBranch()
 {
 	BranchObj *bo=xelection.getBranch();
-	if (xelection.type()==Branch )
+	if (bo)
 	{
-		if (bo->countBranches()==0) return;
-		if (bo->getDepth()==0) return;
+		if (bo->isScrolled()) return false;
+		if (bo->countBranches()==0) return false;
+		if (bo->getDepth()==0) return false;
 		QString u,r;
-		if (bo->isScrolled())
-		{
-			r="unscroll";
-			u="scroll";
-		}	
-		else	
-		{
-			u="scroll";
-			r="unscroll";
-		}	
+		r="scroll";
+		u="unscroll";
 		saveState(
 			bo,
 			QString ("%1 ()").arg(u),
@@ -2938,6 +2961,45 @@
 		);
 		bo->toggleScroll();
 		scene()->update();
+		return true;
+	}	
+	return false;
+}
+
+bool MapEditor::unscrollBranch()
+{
+	BranchObj *bo=xelection.getBranch();
+	if (bo)
+	{
+		if (!bo->isScrolled()) return false;
+		if (bo->countBranches()==0) return false;
+		if (bo->getDepth()==0) return false;
+		QString u,r;
+		u="scroll";
+		r="unscroll";
+		saveState(
+			bo,
+			QString ("%1 ()").arg(u),
+			bo,
+			QString ("%1 ()").arg(r),
+			QString ("%1 %2").arg(r).arg(getName(bo))
+		);
+		bo->toggleScroll();
+		scene()->update();
+		return true;
+	}	
+	return false;
+}
+
+void MapEditor::toggleScroll()
+{
+	BranchObj *bo=xelection.getBranch();
+	if (xelection.type()==Branch )
+	{
+		if (bo->isScrolled())
+			unscrollBranch ();
+		else
+			scrollBranch ();
 	}
 }
 
diff -r e0a3449f4458 -r fb74fa7bfb4c mapeditor.h
--- a/mapeditor.h	Mon Feb 12 09:28:46 2007 +0000
+++ b/mapeditor.h	Mon Feb 12 09:28:47 2007 +0000
@@ -158,6 +158,8 @@
 	int getMapDefXLinkWidth();
 	void toggleMapLinkColorHint();			// after changing linkStyles
     void selectMapLinkColor();
+	bool scrollBranch();
+	bool unscrollBranch();
     void toggleScroll();
     void unScrollAll();
 	void loadFloatImage ();
diff -r e0a3449f4458 -r fb74fa7bfb4c tex/vym.changelog
--- a/tex/vym.changelog	Mon Feb 12 09:28:46 2007 +0000
+++ b/tex/vym.changelog	Mon Feb 12 09:28:47 2007 +0000
@@ -1,9 +1,12 @@
 -------------------------------------------------------------------
-Wed Jan 29 17:27:31 CET 2007 - uwedr
+Wed Feb 07 17:27:31 CET 2007 - uwedr
 
 - Version: 1.8.66
 - Feature: Using a new class to select objects
 - Bugfix: Remember last directory before  ASCII/LaTeX export
+- Bugfix: Editing in NoteEditor now updates actions (save) again
+- Bugfix: Deleting last branch automatically unscrolls parent now
+- Bugfix: Scroll/Unscroll has undo/redo now
 
 -------------------------------------------------------------------
 Fri Jan 19 22:53:27 CET 2007 - uwe
diff -r e0a3449f4458 -r fb74fa7bfb4c texteditor.cpp
--- a/texteditor.cpp	Mon Feb 12 09:28:46 2007 +0000
+++ b/texteditor.cpp	Mon Feb 12 09:28:47 2007 +0000
@@ -52,6 +52,7 @@
 	setupSettingsActions();
 	
 	// Various states
+	blockChangedSignal=false;
 	setInactive();
 
 	// Load Settings
@@ -523,15 +524,17 @@
 		else
 			setState (filledEditor);
 	// SLOT is LinkableMapObj, which will update systemFlag
-	emit (textHasChanged() );
+	if (!blockChangedSignal) emit (textHasChanged() );
 }
 
 
 void TextEditor::setText(QString t)
 {
+	blockChangedSignal=true;
 	e->setReadOnly(false);
 	e->setText(t);
 	enableActions();
+	blockChangedSignal=false;
 }
 
 void TextEditor::setInactive()
diff -r e0a3449f4458 -r fb74fa7bfb4c texteditor.h
--- a/texteditor.h	Mon Feb 12 09:28:46 2007 +0000
+++ b/texteditor.h	Mon Feb 12 09:28:47 2007 +0000
@@ -87,6 +87,7 @@
 	QBrush inactivePaper;	// depending on the state
 	EditorState state;
 	bool showwithmain;		// same visibility as mainwindow?
+	bool blockChangedSignal;
 
 	QFont varFont;
 	QFont fixedFont;
diff -r e0a3449f4458 -r fb74fa7bfb4c version.h
--- a/version.h	Mon Feb 12 09:28:46 2007 +0000
+++ b/version.h	Mon Feb 12 09:28:47 2007 +0000
@@ -5,7 +5,7 @@
 
 #define __VYM_NAME "VYM"
 #define __VYM_VERSION "1.8.66"
-#define __VYM_BUILD_DATE "January 29, 2007"
+#define __VYM_BUILD_DATE "February 07, 2007"
 
 
 bool checkVersion(const QString &);