View Issue Details

IDProjectCategoryView StatusLast Update
0009805ScribusGraphics / Image Framespublic2011-03-07 19:07
Reportercezaryece Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformAll 
Product Version1.4.0svn 
Target Version1.4.0svn 
Summary0009805: [FIX] patch for undo scaling type of image frames - restoring free scale settings
DescriptionThis patch change information saved in undo state when scale type is changed.
When you change scale type from free scale mode to frame size scaling, image offset and scale factor should be saved in undo state for restoring this values during undoing this change.
TagsNo tags attached.
Patch

Relationships

duplicate of 0009811 closedcbradney [FIX] undo for changing image scaling type, undo for clear contents of image frame and fix undo loading new image 

Activities

cezaryece

2011-03-07 08:27

updater  

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;
pageitem_undo_scaletype.patch (1,727 bytes)   

Issue History

Date Modified Username Field Change
2011-03-07 08:27 cezaryece New Issue
2011-03-07 08:27 cezaryece File Added: pageitem_undo_scaletype.patch
2011-03-07 13:28 cbradney Assigned To => cbradney
2011-03-07 13:28 cbradney Status new => assigned
2011-03-07 13:29 cbradney Target Version => 1.4.0svn
2011-03-07 16:36 cbradney Relationship added duplicate of 0009811
2011-03-07 16:36 cbradney Status assigned => resolved
2011-03-07 16:36 cbradney Resolution open => duplicate
2011-03-07 19:07 cbradney Status resolved => closed
2015-09-17 20:10 Kunda Category Graphics / Image Frames => Graphics/Img Frames
2015-09-17 20:11 Kunda Category Graphics/Img Frames => Graphics / Image Frames