pageitem_undo_scaletype.patch (1,727 bytes)
Index: Scribus/scribus/pageitem.cpp
===================================================================
--- Scribus/scribus/pageitem.cpp (wersja 16363)
+++ Scribus/scribus/pageitem.cpp (kopia robocza)
@@ -2702,7 +2704,18 @@
to += keepRatio ? Um::KeepRatio : Um::BreakRatio;
SimpleState *ss = new SimpleState(Um::ImageScaling, QString(Um::FromTo).arg(from).arg(to), Um::IImageScaling);
if (freeScale != ScaleType)
+ {
ss->set("SCALE_TYPE", freeScale);
+ if (!freeScale)
+ {
+ //if switching from free scaling to frame size
+ //in undo must be offset and scale saved
+ ss->set("OLD_IMAGEXOFFSET", LocalX);
+ ss->set("OLD_IMAGEYOFFSET", LocalY);
+ ss->set("OLD_IMAGEXSCALE", LocalScX);
+ ss->set("OLD_IMAGEYSCALE", LocalScY);
+ }
+ }
if (keepRatio != AspectRatio)
ss->set("ASPECT_RATIO", keepRatio);
undoManager->action(this, ss);
@@ -3525,6 +3592,19 @@
type = !state->getBool("SCALE_TYPE");
else
type = state->getBool("SCALE_TYPE");
+ //if restoring free scaling
+ //old offset and scale ratio must be restored
+ if (type)
+ {
+ double oscx = state->getDouble("OLD_IMAGEXSCALE");
+ double oscy = state->getDouble("OLD_IMAGEYSCALE");
+ double ox = state->getDouble("OLD_IMAGEXOFFSET");
+ double oy = state->getDouble("OLD_IMAGEYOFFSET");
+ Selection tempSelection(this, false);
+ tempSelection.addItem(this, true);
+ m_Doc->itemSelection_SetImageScale(oscx, oscy, &tempSelection);
+ m_Doc->itemSelection_SetImageOffset(ox, oy, &tempSelection);
+ }
}
bool ratio=AspectRatio;