r14980 by jghali - scripter : modify setImageOffset() to use values similar to those shown in PP for consistency with setImageScale()

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 17 01:11:01 CEST 2010


Revision: 14980
Author: jghali
Date: 2010-04-16T23:08:22.337234Z
Commit message: scripter : modify setImageOffset() to use values similar to those shown in PP for consistency with setImageScale()

Changeset: 
M  /trunk/Scribus/doc/en/scripterapi-setobjprop.html
M  /trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp
M  /trunk/Scribus/doc/fr/scripterapi-setobjprop.html
M  /trunk/Scribus/scribus/plugins/scriptplugin/cmdmani.h

Diffs:
Index: doc/en/scripterapi-setobjprop.html
===================================================================
--- doc/en/scripterapi-setobjprop.html	(revision 14979)
+++ doc/en/scripterapi-setobjprop.html	(revision 14980)
@@ -99,7 +99,7 @@
 
 <dt><a name="-setImageOffset"><strong>setImageOffset</strong></a>(...)</dt>
 <dd><code>setImageOffset(x, y [, "name"])</code>
-<p>Sets the internal offset of the picture in the image frame "name". If "name" is not given the currently selected item is used. Internal offsets are different from the values shown on properties palette.</p>
+<p>Sets the position of the picture in the image frame "name". If "name" is not given the currently selected item is used. The specified offset values are equal to the values shown on properties palette when point unit is used.</p>
 <p>May raise <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> if the target frame is not an image frame</p></dd>
 
 <dt><a name="-traceText"><strong>traceText</strong></a>(...)</dt>
Index: doc/fr/scripterapi-setobjprop.html
===================================================================
--- doc/fr/scripterapi-setobjprop.html	(revision 14979)
+++ doc/fr/scripterapi-setobjprop.html	(revision 14980)
@@ -30,7 +30,7 @@
 
 <dt><a name="-setImageOffset"><strong>setImageOffset</strong></a>(...)</dt>
 <dd><code><a href="#-setImageOffset">setImageOffset</a>(x, y [, "nom"])</code>
-<p>D&eacute;finit les coordonn&eacute;es de position internes de l'image dans le cadre d'image "nom". Si le "nom" n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;.  Les coordonn&eacute;es de position internes sont diff&eacute;rentes des valeurs indiqu&eacute;es dans la palette des propri&eacute;t&eacute;s.</p>
+<p>D&eacute;finit la position de l'image dans le cadre d'image "nom". Si le "nom" n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;.  Les coordonn&eacute;es sp&eacute;cifi&eacute;es sont &eacute;gales aux valeurs indiqu&eacute;es dans la palette des propri&eacute;t&eacute;s lorsque l'unit&eacute; utilis&eacute;e est le point.</p>
 <p>Peut g&eacute;n&eacute;rer <a href="scripterapi.html#WrongFrameTypeError">WrongFrameTypeError</a> si le cadre cible n'est pas un cadre d'image</p></dd>
 
 <dt><a name="-setCornerRadius"><strong>setCornerRadius</strong></a>(...)</dt>
Index: scribus/plugins/scriptplugin/cmdmani.cpp
===================================================================
--- scribus/plugins/scriptplugin/cmdmani.cpp	(revision 14979)
+++ scribus/plugins/scriptplugin/cmdmani.cpp	(revision 14980)
@@ -149,7 +149,9 @@
 	ScCore->primaryMainWindow()->view->SelectItemNr(item->ItemNr);
 
 	// offset
-	ScCore->primaryMainWindow()->doc->itemSelection_SetImageOffset(x, y); //CB why when this is done above?
+	double newOffsetX = x / ((item->imageXScale() != 0.0) ? item->imageXScale() : 1);
+	double newOffsetY = y / ((item->imageYScale() != 0.0) ? item->imageYScale() : 1);
+	ScCore->primaryMainWindow()->doc->itemSelection_SetImageOffset(newOffsetX, newOffsetY); //CB why when this is done above?
 	ScCore->primaryMainWindow()->doc->updatePic();
 
 	// Now restore the selection.
Index: scribus/plugins/scriptplugin/cmdmani.h
===================================================================
--- scribus/plugins/scriptplugin/cmdmani.h	(revision 14979)
+++ scribus/plugins/scriptplugin/cmdmani.h	(revision 14980)
@@ -172,8 +172,10 @@
 PyDoc_STRVAR(scribus_setimageoffset__doc__,
 QT_TR_NOOP("setImageOffset(x, y [, \"name\"])\n\
 \n\
-Sets the internal offset of the picture in the image frame \"name\".\n\
+Sets the position of the picture in the image frame \"name\".\n\
 If \"name\" is not given the currently selected item is used.\n\
+The specified offset values are equal to the values shown on \n\
+properties palette when point unit is used.\n\
 \n\
 May raise WrongFrameTypeError if the target frame is not an image frame\n\
 "));




More information about the scribus-commit mailing list