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

scribus-commit scribus-commit at lists.scribus.net
Fri Mar 25 00:30:58 CET 2011


Author: craig
Date: Thu Mar 24 23:30:58 2011
New Revision: 16498

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

Modified:
    branches/Version135/Scribus/scribus/scribusdoc.cpp
    branches/Version135/Scribus/scribus/undomanager.cpp
    branches/Version135/Scribus/scribus/undomanager.h

Modified: branches/Version135/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16498&path=/branches/Version135/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.cpp Thu Mar 24 23:30:58 2011
@@ -1300,6 +1300,12 @@
 			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"))
 		{
 			double old_trans = ss->getDouble("OLD_TRANS");
@@ -2163,6 +2169,15 @@
 	{
 		if (it->LNr == layerNumber)
 		{
+			// == 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->LNr);
+				ss->set("LOCK", isLocked);
+				undoManager->action(this, ss, it->Name, Um::ILayer);
+			}
 			it->isEditable = !isLocked;
 			found=true;
 			break;

Modified: branches/Version135/Scribus/scribus/undomanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16498&path=/branches/Version135/Scribus/scribus/undomanager.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/undomanager.cpp (original)
+++ branches/Version135/Scribus/scribus/undomanager.cpp Thu Mar 24 23:30:58 2011
@@ -949,6 +949,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");
@@ -1158,6 +1160,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: branches/Version135/Scribus/scribus/undomanager.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16498&path=/branches/Version135/Scribus/scribus/undomanager.h
==============================================================================
--- branches/Version135/Scribus/scribus/undomanager.h (original)
+++ branches/Version135/Scribus/scribus/undomanager.h Thu Mar 24 23:30:58 2011
@@ -575,6 +575,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