r16497 by craig - #4930: Allow undo/redo for layer transparency and blend mode
scribus-commit
scribus-commit at lists.scribus.net
Thu Mar 24 23:53:58 CET 2011
Author: craig
Date: Thu Mar 24 22:53:58 2011
New Revision: 16497
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16497
Log:
#4930: Allow undo/redo for layer transparency and blend mode
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=16497&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Mar 24 22:53:58 2011
@@ -1465,10 +1465,24 @@
setLayerPrintable(ss->getInt("ACTIVE"), isUndo ? !print : print);
layersUndo=true;
}
- else if (ss->contains("FLOW_LAYER"))
+ else if (ss->contains("LAYER_FLOW"))
{
bool flow = ss->getBool("FLOW");
setLayerFlow(ss->getInt("ACTIVE"), isUndo ? !flow : flow);
+ layersUndo=true;
+ }
+ else if (ss->contains("LAYER_TRANSPARENCY"))
+ {
+ double old_trans = ss->getDouble("OLD_TRANS");
+ double new_trans = ss->getDouble("NEW_TRANS");
+ setLayerTransparency(ss->getInt("ACTIVE"), isUndo ? old_trans : new_trans);
+ layersUndo=true;
+ }
+ else if (ss->contains("LAYER_BLENDMODE"))
+ {
+ int old_blend = ss->getInt("OLD_BLENDMODE");
+ int new_blend = ss->getInt("NEW_BLENDMODE");
+ setLayerBlendMode(ss->getInt("ACTIVE"), isUndo ? old_blend : new_blend);
layersUndo=true;
}
else if (ss->contains("ADD_LAYER"))
@@ -2203,18 +2217,15 @@
{
if (it->ID == layerID)
{
- bool oldPrintable = (*it).isPrintable;
+ if (it->isPrintable!=isPrintable && UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(isPrintable ? Um::PrintLayer : Um::DoNotPrintLayer, "", Um::IPrint);
+ ss->set("PRINT_LAYER", "print_layer");
+ ss->set("ACTIVE", it->ID);
+ ss->set("PRINT", isPrintable);
+ undoManager->action(this, ss, it->Name, Um::ILayer);
+ }
it->isPrintable = isPrintable;
-
- if (oldPrintable!=isPrintable && UndoManager::undoEnabled())
- {
- SimpleState *ss = new SimpleState(isPrintable ? Um::PrintLayer : Um::DoNotPrintLayer,
- "", Um::IPrint);
- ss->set("PRINT_LAYER", "print_layer");
- ss->set("ACTIVE", (*it).ID);
- ss->set("PRINT", isPrintable);
- undoManager->action(this, ss, it->Name, Um::IDocument);
- }
found=true;
break;
}
@@ -2313,18 +2324,15 @@
{
if (it->ID == layerID)
{
- bool oldFlow = it->flowControl;
+ if (it->flowControl!=flow && UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(flow ? Um::FlowLayer : Um::DisableFlowLayer, "", Um::ITextFrame);
+ ss->set("LAYER_FLOW", "layer_flow");
+ ss->set("ACTIVE", it->ID);
+ ss->set("FLOW", flow);
+ undoManager->action(this, ss, it->Name, Um::ILayer);
+ }
it->flowControl = flow;
-
- if (oldFlow!=flow && UndoManager::undoEnabled())
- {
- SimpleState *ss = new SimpleState(flow ? Um::FlowLayer : Um::DisableFlowLayer,"", Um::ITextFrame);
- ss->set("FLOW_LAYER", "flow_layer");
- ss->set("ACTIVE", (*it).ID);
- ss->set("FLOW", flow);
- undoManager->action(this, ss, it->Name, Um::IDocument);
- }
-
found=true;
break;
}
@@ -2366,6 +2374,15 @@
{
if (it->ID == layerID)
{
+ if (it->transparency!=trans && UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::SetLayerTransparency, "", Um::ILayer);
+ ss->set("LAYER_TRANSPARENCY", "layer_transparency");
+ ss->set("ACTIVE", it->ID);
+ ss->set("OLD_TRANS", it->transparency);
+ ss->set("NEW_TRANS", trans);
+ undoManager->action(this, ss, it->Name, Um::ILayer);
+ }
it->transparency = trans;
found=true;
break;
@@ -2399,6 +2416,15 @@
{
if (it->ID == layerID)
{
+ if (it->blendMode!=blend && UndoManager::undoEnabled())
+ {
+ SimpleState *ss = new SimpleState(Um::SetLayerBlendMode, "", Um::ILayer);
+ ss->set("LAYER_BLENDMODE", "layer_blendmode");
+ ss->set("ACTIVE", it->ID);
+ ss->set("OLD_BLENDMODE", it->blendMode);
+ ss->set("NEW_BLENDMODE", blend);
+ undoManager->action(this, ss, it->Name, Um::ILayer);
+ }
it->blendMode = blend;
found=true;
break;
Modified: trunk/Scribus/scribus/undomanager.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16497&path=/trunk/Scribus/scribus/undomanager.cpp
==============================================================================
--- trunk/Scribus/scribus/undomanager.cpp (original)
+++ trunk/Scribus/scribus/undomanager.cpp Thu Mar 24 22:53:58 2011
@@ -943,6 +943,8 @@
UndoManager::SetLayerName = tr("Change name of the layer");
UndoManager::FlowLayer = tr("Enable text flow around for lower layers");
UndoManager::DisableFlowLayer = tr("Disable text flow around for lower layers");
+ UndoManager::SetLayerBlendMode = tr("Set layer blend mode");
+ UndoManager::SetLayerTransparency=tr("Set layer opacity");
UndoManager::GetImage = tr("Get image");
UndoManager::ChangeFormula = tr("Change formula");
UndoManager::MultipleDuplicate = tr("Multiple duplicate");
@@ -1114,11 +1116,10 @@
QString UndoManager::ImportXfig = "";
QString UndoManager::ImportWMF = "";
QString UndoManager::ScratchSpace = "";
-//QString UndoManager::TextFlow = "";
QString UndoManager::ObjectFrame = "";
QString UndoManager::BoundingBox = "";
QString UndoManager::ContourLine = "";
-QString UndoManager::ImageClip = "";
+QString UndoManager::ImageClip = "";
QString UndoManager::NoTextFlow = "";
QString UndoManager::NoObjectFrame = "";
QString UndoManager::NoBoundingBox = "";
@@ -1149,6 +1150,8 @@
QString UndoManager::SetLayerName = "";
QString UndoManager::FlowLayer = "";
QString UndoManager::DisableFlowLayer = "";
+QString UndoManager::SetLayerBlendMode = "";
+QString UndoManager::SetLayerTransparency="";
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=16497&path=/trunk/Scribus/scribus/undomanager.h
==============================================================================
--- trunk/Scribus/scribus/undomanager.h (original)
+++ trunk/Scribus/scribus/undomanager.h Thu Mar 24 22:53:58 2011
@@ -571,6 +571,8 @@
static QString SetLayerName;
static QString FlowLayer;
static QString DisableFlowLayer;
+ static QString SetLayerBlendMode;
+ static QString SetLayerTransparency;
static QString GetImage;
static QString ChangeFormula;
static QString MultipleDuplicate;
More information about the scribus-commit
mailing list