r16499 by craig - #5095: Allow undo/redo for layer locking

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 25 00:31:05 CET 2011


Author: craig
Date: Thu Mar 24 23:31:05 2011
New Revision: 16499

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16499
Log:
#5095: Allow undo/redo for layer locking

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/undomanager.cpp
    trunk/Scribus/scribus/undomanager.h

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16499&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Mar 24 23:31:05 2011
@@ -1469,6 +1469,12 @@
 		{
 			bool flow = ss->getBool("FLOW");
 			setLayerFlow(ss->getInt("ACTIVE"), isUndo ? !flow : flow);
+			layersUndo=true;
+		}
+		else if (ss->contains("LAYER_LOCK"))
+		{
+			bool lock = ss->getBool("LOCK");
+			setLayerLocked(ss->getInt("ACTIVE"), isUndo ? !lock : lock);
 			layersUndo=true;
 		}
 		else if (ss->contains("LAYER_TRANSPARENCY"))
@@ -2291,6 +2297,15 @@
 	{
 		if (it->ID == layerID)
 		{
+			// == because isEditable vs isLocked...
+			if (it->isEditable==isLocked && UndoManager::undoEnabled())
+			{
+				SimpleState *ss = new SimpleState(isLocked ? Um::SetLayerLocked : Um::SetLayerUnlocked, "", Um::ILayer);
+				ss->set("LAYER_LOCK", "layer_lock");
+				ss->set("ACTIVE", it->ID);
+				ss->set("LOCK", isLocked);
+				undoManager->action(this, ss, it->Name, Um::ILayer);
+			}
 			it->isEditable = !isLocked;
 			found=true;
 			break;

Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16499&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Thu Mar 24 23:31:05 2011
@@ -945,6 +945,8 @@
 	UndoManager::DisableFlowLayer	= tr("Disable text flow around for lower layers");
 	UndoManager::SetLayerBlendMode	= tr("Set layer blend mode");
 	UndoManager::SetLayerTransparency=tr("Set layer opacity");
+	UndoManager::SetLayerLocked     =tr("Lock layer");
+	UndoManager::SetLayerUnlocked   =tr("Unlock layer");
 	UndoManager::GetImage           = tr("Get image");
 	UndoManager::ChangeFormula      = tr("Change formula");
 	UndoManager::MultipleDuplicate  = tr("Multiple duplicate");
@@ -1152,6 +1154,8 @@
 QString UndoManager::DisableFlowLayer   = "";
 QString UndoManager::SetLayerBlendMode  = "";
 QString UndoManager::SetLayerTransparency="";
+QString UndoManager::SetLayerLocked     = "";
+QString UndoManager::SetLayerUnlocked   = "";
 QString UndoManager::GetImage           = "";
 QString UndoManager::ChangeFormula      = "";
 QString UndoManager::MultipleDuplicate  = "";

Modified: trunk/Scribus/scribus/undomanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16499&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Thu Mar 24 23:31:05 2011
@@ -573,6 +573,8 @@
 	static QString DisableFlowLayer;
 	static QString SetLayerBlendMode;
 	static QString SetLayerTransparency;
+	static QString SetLayerLocked;
+	static QString SetLayerUnlocked;
 	static QString GetImage;
 	static QString ChangeFormula;
 	static QString MultipleDuplicate;




More information about the scribus-commit mailing list