Author: jghali
Date: Sun Oct 14 10:31:03 2018
New Revision: 22731

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22731
Log:
#15441: Text vertical alignment not accessible from python/scripter

Modified:
    trunk/Scribus/doc/en/scripterapi-textframes.html
    trunk/Scribus/doc/fr/scripterapi-textframes.html
    trunk/Scribus/scribus/plugins/scripter/api_item.cpp
    trunk/Scribus/scribus/plugins/scripter/api_item.h
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
    trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp

Modified: trunk/Scribus/doc/en/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/doc/en/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/en/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/en/scripterapi-textframes.html    Sun Oct 14 10:31:03 2018
@@ -67,8 +67,12 @@
 <p>Returns the number of lines of the text in the text frame "name". If "name" 
is not given the currently selected item is used.</p></dd>
 
 <dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
-<dd><code>getLineShade(["name"]) -&gt; integer</code>
+<dd><code>getTextShade(["name"]) -&gt; integer</code>
 <p>Returns the shading value of the line color of the object "name". If "name" 
is not given the currently selected item is used.</p></dd>
+
+<dt><a 
name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
+<dd><code>getTextVerticalAlignment(["name"]) -&gt; integer</code>
+<p>Gets the vertical alignment of text inside text frame "name". If "name" is 
not given the currently selected item is used.</p></dd>
 
 <dt><a name="-hyphenateText"><strong>hyphenateText</strong></a>(...)</dt>
 <dd><code>hyphenateText(["name"]) -&gt; bool</code>
@@ -173,6 +177,13 @@
 <dd><code>setTextStroke("color", ["name"])</code>
 <p>Set "color" of the text stroke. If "name" is not given the currently 
selected item is used.</p></dd>
 
+<dt><a 
name="-setTextVerticalAlignment"><strong>setTextVerticalAlignment</strong></a>(...)</dt>
+<dd>
+<code>setTextVerticalAlignment(align, ["name"])</code>
+<p>Sets the vertical alignment of text inside text frame "name" to the 
specified alignment. If "name" is not given the currently selected item is 
used. "align" should be one of the ALIGNV_ constants defined in this module - 
see dir(scribus).</p>
+<p>May throw ValueError for an invalid alignment constant.</p>
+</dd>
+
 <dt><a name="-textOverflows"><strong>textOverflows</strong></a>(...)</dt>
 <dd><code>textOverflows(["name", nolinks]) -&gt; integer</code>
 <p>Returns 1 if there are overflowing characters in text frame "name", 0 if 
not. If is nolinks set to non zero value it takes only one frame - it doesn't 
use text frame linking. Without this parameter it search all linking chain.</p>

Modified: trunk/Scribus/doc/fr/scripterapi-textframes.html
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/doc/fr/scripterapi-textframes.html
==============================================================================
--- trunk/Scribus/doc/fr/scripterapi-textframes.html    (original)
+++ trunk/Scribus/doc/fr/scripterapi-textframes.html    Sun Oct 14 10:31:03 2018
@@ -53,8 +53,12 @@
 <p>Retourne la longueur du texte dans le cadre de texte "nom". Si "nom" n'est 
pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
 
 <dt><a name="-getTextShade"><strong>getTextShade</strong></a>(...)</dt>
-<dd><code><a href="#-getLineShade">getLineShade</a>(["nom"]) -&gt; nombre 
entier</code>
+<dd><code><a href="#-getTextShade">getTextShade</a>(["nom"]) -&gt; nombre 
entier</code>
 <p>Retourne la valeur de la teinte de la couleur de filet de l'objet "nom". Si 
"nom" n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
+
+<dt><a 
name="-getTextVerticalAlignment"><strong>getTextVerticalAlignment</strong></a>(...)</dt>
+<dd><code><a 
href="#-getTextVerticalAlignment">getTextVerticalAlignment</a>(["nom"]) -&gt; 
nombre entier</code>
+<p>Retourne l'alignement vertical utilisé pour le texte &agrave; 
l'int&eacute;rieur de l'objet "nom". Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. </p></dd>
 
 <dt><a name="-insertText"><strong>insertText</strong></a>(...)</dt>
 <dd><code><a href="#-insertText">insertText</a>("texte", pos, ["nom"])</code>
@@ -71,13 +75,13 @@
 
 <dt><a name="-setColumns"><strong>setColumns</strong></a>(...)</dt>
 <dd><code><a href="#-setColumns">setColumns</a>(nr, ["nom"])</code>
-<p>&Eacute;tablit le nombre de colonnes du cadre de texte "nom" &agrave; la 
valeur enti&egrave;re "nr". Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
+<p>D&eacute;finit le nombre de colonnes du cadre de texte "nom" &agrave; la 
valeur enti&egrave;re "nr". Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
 <p>Peut g&eacute;n&eacute;rer ValueError si le nombre de colonnes n'est pas au
 moins &eacute;gal &agrave; un.</p></dd>
 
 <dt><a name="-setColumnGap"><strong>setColumnGap</strong></a>(...)</dt>
 <dd><code><a href="#-setColumnGap">setColumnGap</a>(taille, ["nom"])</code>
-<p>&Eacute;tablit la goutti&egrave;re de colonne du cadre de texte "nom" 
&agrave; la valeur "taille". Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
+<p>D&eacute;finit la goutti&egrave;re de colonne du cadre de texte "nom" 
&agrave; la valeur "taille". Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
 <p>Peut g&eacute;n&eacute;rer ValueError si la goutti&egrave;re de colonne est 
hors
 limites (elle doit &ecirc;tre positive).</p></dd>
 
@@ -88,35 +92,40 @@
 
 <dt><a name="-setFontSize"><strong>setFontSize</strong></a>(...)</dt>
 <dd><code><a href="#-setFontSize">setFontSize</a>(taille, ["nom"])</code>
-<p>&Eacute;tablit la taille de police du cadre de texte "nom" &agrave; la 
valeur "taille". La "taille" est trait&eacute;e comme une valeur en points. 
S'il y a du texte s&eacute;lectionn&eacute;, seul ce texte  sera 
modifi&eacute;. La "taille" doit &ecirc;tre r&eacute;gl&eacute;e entre 1 et 
512. Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
+<p>D&eacute;finit la taille de police du cadre de texte "nom" &agrave; la 
valeur "taille". La "taille" est trait&eacute;e comme une valeur en points. 
S'il y a du texte s&eacute;lectionn&eacute;, seul ce texte  sera 
modifi&eacute;. La "taille" doit &ecirc;tre r&eacute;gl&eacute;e entre 1 et 
512. Si "nom" n'est pas fourni, l'&eacute;l&eacute;ment 
s&eacute;lectionn&eacute; est utilis&eacute;. </p>
 <p>Peut g&eacute;n&eacute;rer ValueError pour une taille de police qui est 
hors limites.</p></dd>
 
 <dt><a name="-setLineSpacing"><strong>setLineSpacing</strong></a>(...)</dt>
 <dd><code><a href="#-setLineSpacing">setLineSpacing</a>(taille, ["nom"])</code>
-<p>&Eacute;tablit la valeur "taille" pour l'interlignage ("leading") du cadre 
de texte "nom". La "taille" est une valeur en points. Si "nom" n'est pas 
fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. 
</p>
+<p>D&eacute;finit l'interlignage ("leading") du cadre de texte "nom" &agrave; 
la valeur "taille". La "taille" est une valeur en points. Si "nom" n'est pas 
fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. 
</p>
 <p>Peut g&eacute;n&eacute;rer ValueError si l'interlignage est hors 
limites.</p></dd>
 
 <dt><a name="-setText"><strong>setText</strong></a>(...)</dt>
 <dd><code><a href="#-setText">setText</a>("texte", ["nom"])</code>
-<p>&Eacute;tablit la cha&icirc;ne "texte" pour contenu du cadre de texte 
"nom". Le texte doit &ecirc;tre encod&eacute; en UTF8 - utilisez par exemple 
unicode(texte, 'iso-8859-2'). 
+<p>D&eacute;finit le contenu du cadre de texte "nom" &agrave; la cha&icirc;ne 
"texte". Le texte doit &ecirc;tre encod&eacute; en UTF8 - utilisez par exemple 
unicode(texte, 'iso-8859-2'). 
 Voir les FAQ pour plus de d&eacute;tails. Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. </p></dd>
 
 <dt><a name="-setTextAlignment"><strong>setTextAlignment</strong></a>(...)</dt>
 <dd><code><a href="#-setTextAlignment">setTextAlignment</a>(alignement, 
["nom"])</code>
-<p>&Eacute;tablit la valeur sp&eacute;cifi&eacute;e pour l'alignement du 
contenu du cadre de texte "nom". Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute;est utilis&eacute;. La valeur 
"alignement" doit &ecirc;tre une des constantes ALIGN_ d&eacute;finies dans ce 
module - voir dir(scribus).</p>
+<p>D&eacute;finit l'alignement du contenu du cadre de texte "nom" &agrave; la 
valeur sp&eacute;cifi&eacute;e. Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. La valeur 
"alignement" doit &ecirc;tre une des constantes ALIGN_ d&eacute;finies dans ce 
module - voir dir(scribus).</p>
 <p>Peut g&eacute;n&eacute;rer ValueError si la constante d'alignement n'est 
pas valide.</p></dd>
 
 <dt><a name="-setTextColor"><strong>setTextColor</strong></a>(...)</dt>
 <dd><code><a href="#-setTextColor">setTextColor</a>("couleur", ["nom"])</code>
-<p>&Eacute;tablit la "couleur" du contenu du cadre de texte "nom". S'il y a du 
texte s&eacute;lectionn&eacute;, seul ce texte  sera modifi&eacute;. Si "nom" 
n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
+<p>D&eacute;finit la "couleur" du contenu du cadre de texte "nom". S'il y a du 
texte s&eacute;lectionn&eacute;, seul ce texte  sera modifi&eacute;. Si "nom" 
n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
 
 <dt><a name="-setTextShade"><strong>setTextShade</strong></a>(...)</dt>
 <dd><code><a href="#-setTextShade">setTextShade</a>(teinte, ["nom"])</code>
-<p>&Eacute;tablit la valeur "teinte" pour la couleur du texte de l'objet 
"nom". S'il y a du texte s&eacute;lectionn&eacute;, seul ce texte sera 
modifi&eacute;. La valeur "teinte" doit &ecirc;tre un nombre entier compris 
entre 0 (p&acirc;le) et 100 (intensit&eacute; maximale). Si "nom" n'est pas 
fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. 
</p></dd>
+<p>D&eacute;finit la valeur "teinte" de la couleur du texte de l'objet "nom". 
S'il y a du texte s&eacute;lectionn&eacute;, seul ce texte sera modifi&eacute;. 
La valeur "teinte" doit &ecirc;tre un nombre entier compris entre 0 
(p&acirc;le) et 100 (intensit&eacute; maximale). Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. </p></dd>
 
 <dt><a name="-setTextStroke"><strong>setTextStroke</strong></a>(...)</dt>
 <dd><code><a href="#-setTextStroke">setTextStroke</a>("couleur", 
["nom"])</code>
-<p>&Eacute;tablit la "couleur" au contour des caract&egrave;res. Si "nom" 
n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
+<p>D&eacute;finit la "couleur" du contour des caract&egrave;res. Si "nom" 
n'est pas fourni, l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est 
utilis&eacute;. </p></dd>
+
+<dt><a 
name="-setTextVerticalAlignment"><strong>setTextVerticalAlignment</strong></a>(...)</dt>
+<dd><code><a 
href="#-setTextVerticalAlignment">setTextVerticalAlignment</a>(alignement, 
["nom"])</code>
+<p>D&eacute;finit l'alignement vertical du contenu du cadre de texte "nom" 
&agrave; la valeur sp&eacute;cifi&eacute;e. Si "nom" n'est pas fourni, 
l'&eacute;l&eacute;ment s&eacute;lectionn&eacute; est utilis&eacute;. La valeur 
"alignement" doit &ecirc;tre une des constantes ALIGNV_ d&eacute;finies dans ce 
module - voir dir(scribus).</p>
+<p>Peut g&eacute;n&eacute;rer ValueError si la constante d'alignement n'est 
pas valide.</p></dd>
 
 <dt><a name="-textOverflows"><strong>textOverflows</strong></a>(...)</dt>
 <dd><code><a href="#-textOverflows">textOverflows</a>(["nom",

Modified: trunk/Scribus/scribus/plugins/scripter/api_item.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/scribus/plugins/scripter/api_item.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_item.cpp (original)
+++ trunk/Scribus/scribus/plugins/scripter/api_item.cpp Sun Oct 14 10:31:03 2018
@@ -1,389 +1,401 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#include "api_item.h"
-#include "utils.h"
-#include "undomanager.h"
-#include "selection.h"
-#include "scribusview.h"
-
-ItemAPI::ItemAPI(PageItem* it) : QObject(COLLECTOR)
-{
-       qDebug() << "ItemAPI loaded";
-    setObjectName("ItemAPI");
-       item = it;
-}
-
-QString ItemAPI::name()
-{
-       return item->itemName();
-}
-
-void ItemAPI::setName(QString name)
-{
-       item->setItemName(name);
-}
-
-
-QString ItemAPI::fillColor()
-{
-       return item->fillColor();
-}
-
-void ItemAPI::setFillColor(QString color)
-{
-       item->setFillColor(color);
-}
-
-QString ItemAPI::lineColor()
-{
-       return item->lineColor();
-}
-
-void ItemAPI::setLineColor(QString color)
-{
-       item->setLineColor(color);
-}
-
-
-double ItemAPI::fillShade()
-{
-       return item->fillShade();
-}
-
-void ItemAPI::setFillShade(double value)
-{
-       item->setFillShade(value);
-}
-
-double ItemAPI::lineShade()
-{
-       return item->lineShade();
-}
-
-void ItemAPI::setLineShade(double value)
-{
-       item->setLineShade(value);
-}
-
-double ItemAPI::fillTransparency()
-{
-       return item->fillTransparency();
-}
-
-void ItemAPI::setFillTransparency(double value)
-{
-       item->setFillTransparency(value);
-}
-
-
-double ItemAPI::lineTransparency()
-{
-       return item->lineTransparency();
-}
-
-void ItemAPI::setLineTransparency(double value)
-{
-       item->setLineTransparency(value);
-}
-
-bool ItemAPI::locked()
-{
-       return item->locked();
-}
-
-void ItemAPI::setLocked(bool value)
-{
-       item->setLocked(value);
-}
-
-bool ItemAPI::sizeLocked()
-{
-       return item->sizeLocked();
-}
-
-void ItemAPI::setSizeLocked(bool value)
-{
-       item->setSizeLocked(value);
-}
-
-bool ItemAPI::imageFlippedV()
-{
-       return item->imageFlippedV();
-}
-
-void ItemAPI::setImageFlippedV(bool value)
-{
-       item->setImageFlippedV(value);
-}
-
-bool ItemAPI::imageFlippedH()
-{
-       return item->imageFlippedH();
-}
-
-void ItemAPI::setImageFlippedH(bool value)
-{
-       item->setImageFlippedH(value);
-}
-
-double ItemAPI::lineWidth()
-{
-       return item->lineWidth();
-}
-
-void ItemAPI::setLineWidth(double value)
-{
-       item->setLineWidth(value);
-}
-
-QString ItemAPI::customLineStyle()
-{
-       return item->customLineStyle();
-}
-
-void ItemAPI::setCustomLineStyle(QString name)
-{
-       item->setCustomLineStyle(name);
-}
-
-int ItemAPI::startArrowIndex()
-{
-       return item->startArrowIndex();
-}
-
-void ItemAPI::setStartArrowIndex(int value)
-{
-       item->setStartArrowIndex(value);
-}
-
-int ItemAPI::endArrowIndex()
-{
-       return item->endArrowIndex();
-}
-
-void ItemAPI::setEndArrowIndex(int value)
-{
-       item->setEndArrowIndex(value);
-}
-
-bool ItemAPI::printEnabled()
-{
-       return item->printEnabled();
-}
-
-void ItemAPI::setPrintEnabled(bool value)
-{
-       item->setPrintEnabled(value);
-}
-
-double ItemAPI::xPos()
-{
-       return item->xPos();
-}
-
-void ItemAPI::setXPos(double value)
-{
-       item->setXPos(value);
-}
-
-double ItemAPI::yPos()
-{
-       return item->yPos();
-}
-
-void ItemAPI::setYPos(double value)
-{
-       item->setYPos(value);
-}
-
-double ItemAPI::width()
-{
-       return item->width();
-}
-
-void ItemAPI::setWidth(double value)
-{
-       item->setWidth(value);
-}
-
-double ItemAPI::height()
-{
-       return item->height();
-}
-
-void ItemAPI::setHeight(double value)
-{
-       item->setHeight(value);
-}
-
-double ItemAPI::rotation()
-{
-       return item->rotation();
-}
-
-void ItemAPI::setRotation(double rotation)
-{
-       item->setRotation(rotation);
-}
-
-bool ItemAPI::reversed()
-{
-       return false; // item->reversed(); FIXME
-}
-
-void ItemAPI::setReversed(bool value)
-{
-       // item->setReversed(value); FIXME
-}
-
-double ItemAPI::cornerRadius()
-{
-       return item->cornerRadius();
-}
-
-void ItemAPI::setCornerRadius(double value)
-{
-       item->setCornerRadius(value);
-}
-
-double ItemAPI::columnGap()
-{
-       return item->columnGap();
-}
-
-void ItemAPI::setColumnGap(double value)
-{
-       if (!checkHaveDocument())
-               RAISE("No document open");
-       if (value < 0.0)
-       {
-               RAISE("Column gap out of bounds, must be positive.");
-       }
-       item->ColGap = ValueToPoint(value);
-}
-
-int ItemAPI::columns()
-{
-       return item->columns();
-}
-
-void ItemAPI::setColumns(int value)
-{
-       if (!checkHaveDocument())
-               RAISE("No document open");
-       if (value < 1)
-       {
-               RAISE("Column count out of bounds, must be > 1.");
-       }
-       item->Cols = value;
-}
-
-
-/**
- * Methods
- */
-
-void ItemAPI::move(double dx, double dy)
-{
-       if (!checkHaveDocument())
-               return;
-       if (item==nullptr)
-               return;
-       // Grab the old selection - but use it only where is there any
-       Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
-       bool hadOrigSelection = (tempSelection.count() != 0);
-
-       ScCore->primaryMainWindow()->doc->m_Selection->clear();
-       // Clear the selection
-       ScCore->primaryMainWindow()->view->Deselect();
-       // Select the item, which will also select its group if
-       // there is one.
-       ScCore->primaryMainWindow()->view->SelectItem(item);
-       // Move the item, or items
-       if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
-       {
-               
ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", 
Um::IMove);
-               ScCore->primaryMainWindow()->doc->moveGroup(ValueToPoint(dx), 
ValueToPoint(dy));
-               ScCore->primaryMainWindow()->view->endGroupTransaction();
-       }
-       else
-       {
-               ScCore->primaryMainWindow()->doc->moveItem(ValueToPoint(dx), 
ValueToPoint(dy), item);
-       }
-       // Now restore the selection.
-       ScCore->primaryMainWindow()->view->Deselect();
-       if (hadOrigSelection)
-               *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
-
-}
-
-void ItemAPI::moveAbs(double x, double y)
-{
-       if (!checkHaveDocument())
-               return;
-       if (item == nullptr)
-               return;
-       // Grab the old selection - but use it only where is there any
-       Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
-       bool hadOrigSelection = (tempSelection.count() != 0);
-
-       // Clear the selection
-       ScCore->primaryMainWindow()->view->Deselect();
-       // Select the item, which will also select its group if
-       // there is one.
-       ScCore->primaryMainWindow()->view->SelectItem(item);
-       // Move the item, or items
-       if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
-       {
-               
ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", 
Um::IMove);
-               double x2, y2, w, h;
-               
ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
-               ScCore->primaryMainWindow()->doc->moveGroup(pageUnitXToDocX(x) 
- x2, pageUnitYToDocY(y) - y2);
-               ScCore->primaryMainWindow()->view->endGroupTransaction();
-       }
-       else
-               ScCore->primaryMainWindow()->doc->moveItem(pageUnitXToDocX(x) - 
item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
-       // Now restore the selection.
-       ScCore->primaryMainWindow()->view->Deselect();
-       if (hadOrigSelection)
-               *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
-}
-
-void ItemAPI::resize(double width, double height)
-{
-       if (!checkHaveDocument())
-               return;
-       if (item == nullptr)
-               return;
-       ScCore->primaryMainWindow()->doc->sizeItem(ValueToPoint(width), 
ValueToPoint(height), item);
-}
-
-void ItemAPI::rotate(double rot)
-{
-       if (!checkHaveDocument())
-               return;
-       if (item == nullptr)
-               return;
-       ScCore->primaryMainWindow()->doc->rotateItem(item->rotation() - rot, 
item);
-
-}
-void ItemAPI::rotateAbs(double rot)
-{
-       if (!checkHaveDocument())
-               return;
-       if (item == nullptr)
-               return;
-       ScCore->primaryMainWindow()->doc->rotateItem(rot * -1.0, item);
-}
-
-
-ItemAPI::~ItemAPI()
-{
-       qDebug() << "ItemAPI deleted";
-}
-
-
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include "api_item.h"
+#include "utils.h"
+#include "undomanager.h"
+#include "selection.h"
+#include "scribusview.h"
+
+ItemAPI::ItemAPI(PageItem* it) : QObject(COLLECTOR)
+{
+       qDebug() << "ItemAPI loaded";
+    setObjectName("ItemAPI");
+       item = it;
+}
+
+QString ItemAPI::name()
+{
+       return item->itemName();
+}
+
+void ItemAPI::setName(QString name)
+{
+       item->setItemName(name);
+}
+
+
+QString ItemAPI::fillColor()
+{
+       return item->fillColor();
+}
+
+void ItemAPI::setFillColor(QString color)
+{
+       item->setFillColor(color);
+}
+
+QString ItemAPI::lineColor()
+{
+       return item->lineColor();
+}
+
+void ItemAPI::setLineColor(QString color)
+{
+       item->setLineColor(color);
+}
+
+
+double ItemAPI::fillShade()
+{
+       return item->fillShade();
+}
+
+void ItemAPI::setFillShade(double value)
+{
+       item->setFillShade(value);
+}
+
+double ItemAPI::lineShade()
+{
+       return item->lineShade();
+}
+
+void ItemAPI::setLineShade(double value)
+{
+       item->setLineShade(value);
+}
+
+double ItemAPI::fillTransparency()
+{
+       return item->fillTransparency();
+}
+
+void ItemAPI::setFillTransparency(double value)
+{
+       item->setFillTransparency(value);
+}
+
+
+double ItemAPI::lineTransparency()
+{
+       return item->lineTransparency();
+}
+
+void ItemAPI::setLineTransparency(double value)
+{
+       item->setLineTransparency(value);
+}
+
+bool ItemAPI::locked()
+{
+       return item->locked();
+}
+
+void ItemAPI::setLocked(bool value)
+{
+       item->setLocked(value);
+}
+
+bool ItemAPI::sizeLocked()
+{
+       return item->sizeLocked();
+}
+
+void ItemAPI::setSizeLocked(bool value)
+{
+       item->setSizeLocked(value);
+}
+
+bool ItemAPI::imageFlippedV()
+{
+       return item->imageFlippedV();
+}
+
+void ItemAPI::setImageFlippedV(bool value)
+{
+       item->setImageFlippedV(value);
+}
+
+bool ItemAPI::imageFlippedH()
+{
+       return item->imageFlippedH();
+}
+
+void ItemAPI::setImageFlippedH(bool value)
+{
+       item->setImageFlippedH(value);
+}
+
+double ItemAPI::lineWidth()
+{
+       return item->lineWidth();
+}
+
+void ItemAPI::setLineWidth(double value)
+{
+       item->setLineWidth(value);
+}
+
+QString ItemAPI::customLineStyle()
+{
+       return item->customLineStyle();
+}
+
+void ItemAPI::setCustomLineStyle(QString name)
+{
+       item->setCustomLineStyle(name);
+}
+
+int ItemAPI::startArrowIndex()
+{
+       return item->startArrowIndex();
+}
+
+void ItemAPI::setStartArrowIndex(int value)
+{
+       item->setStartArrowIndex(value);
+}
+
+int ItemAPI::endArrowIndex()
+{
+       return item->endArrowIndex();
+}
+
+void ItemAPI::setEndArrowIndex(int value)
+{
+       item->setEndArrowIndex(value);
+}
+
+bool ItemAPI::printEnabled()
+{
+       return item->printEnabled();
+}
+
+void ItemAPI::setPrintEnabled(bool value)
+{
+       item->setPrintEnabled(value);
+}
+
+double ItemAPI::xPos()
+{
+       return item->xPos();
+}
+
+void ItemAPI::setXPos(double value)
+{
+       item->setXPos(value);
+}
+
+double ItemAPI::yPos()
+{
+       return item->yPos();
+}
+
+void ItemAPI::setYPos(double value)
+{
+       item->setYPos(value);
+}
+
+double ItemAPI::width()
+{
+       return item->width();
+}
+
+void ItemAPI::setWidth(double value)
+{
+       item->setWidth(value);
+}
+
+double ItemAPI::height()
+{
+       return item->height();
+}
+
+void ItemAPI::setHeight(double value)
+{
+       item->setHeight(value);
+}
+
+double ItemAPI::rotation()
+{
+       return item->rotation();
+}
+
+void ItemAPI::setRotation(double rotation)
+{
+       item->setRotation(rotation);
+}
+
+bool ItemAPI::reversed()
+{
+       return false; // item->reversed(); FIXME
+}
+
+void ItemAPI::setReversed(bool value)
+{
+       // item->setReversed(value); FIXME
+}
+
+double ItemAPI::cornerRadius()
+{
+       return item->cornerRadius();
+}
+
+void ItemAPI::setCornerRadius(double value)
+{
+       item->setCornerRadius(value);
+}
+
+double ItemAPI::columnGap()
+{
+       return item->columnGap();
+}
+
+void ItemAPI::setColumnGap(double value)
+{
+       if (!checkHaveDocument())
+               RAISE("No document open");
+       if (value < 0.0)
+       {
+               RAISE("Column gap out of bounds, must be positive.");
+       }
+       item->ColGap = ValueToPoint(value);
+}
+
+int ItemAPI::columns()
+{
+       return item->columns();
+}
+
+void ItemAPI::setColumns(int value)
+{
+       if (!checkHaveDocument())
+               RAISE("No document open");
+       if (value < 1)
+       {
+               RAISE("Column count out of bounds, must be > 1.");
+       }
+       item->Cols = value;
+}
+
+int ItemAPI::verticalAlignment()
+{
+       return item->verticalAlignment();
+}
+
+void ItemAPI::setVerticalAlignment(int value)
+{
+       if (!checkHaveDocument())
+               RAISE("No document open");
+       item->setVerticalAlignment(value);
+}
+
+
+/**
+ * Methods
+ */
+
+void ItemAPI::move(double dx, double dy)
+{
+       if (!checkHaveDocument())
+               return;
+       if (item==nullptr)
+               return;
+       // Grab the old selection - but use it only where is there any
+       Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
+       bool hadOrigSelection = (tempSelection.count() != 0);
+
+       ScCore->primaryMainWindow()->doc->m_Selection->clear();
+       // Clear the selection
+       ScCore->primaryMainWindow()->view->Deselect();
+       // Select the item, which will also select its group if
+       // there is one.
+       ScCore->primaryMainWindow()->view->SelectItem(item);
+       // Move the item, or items
+       if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
+       {
+               
ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", 
Um::IMove);
+               ScCore->primaryMainWindow()->doc->moveGroup(ValueToPoint(dx), 
ValueToPoint(dy));
+               ScCore->primaryMainWindow()->view->endGroupTransaction();
+       }
+       else
+       {
+               ScCore->primaryMainWindow()->doc->moveItem(ValueToPoint(dx), 
ValueToPoint(dy), item);
+       }
+       // Now restore the selection.
+       ScCore->primaryMainWindow()->view->Deselect();
+       if (hadOrigSelection)
+               *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
+
+}
+
+void ItemAPI::moveAbs(double x, double y)
+{
+       if (!checkHaveDocument())
+               return;
+       if (item == nullptr)
+               return;
+       // Grab the old selection - but use it only where is there any
+       Selection tempSelection(*ScCore->primaryMainWindow()->doc->m_Selection);
+       bool hadOrigSelection = (tempSelection.count() != 0);
+
+       // Clear the selection
+       ScCore->primaryMainWindow()->view->Deselect();
+       // Select the item, which will also select its group if
+       // there is one.
+       ScCore->primaryMainWindow()->view->SelectItem(item);
+       // Move the item, or items
+       if (ScCore->primaryMainWindow()->doc->m_Selection->count() > 1)
+       {
+               
ScCore->primaryMainWindow()->view->startGroupTransaction(Um::Move, "", 
Um::IMove);
+               double x2, y2, w, h;
+               
ScCore->primaryMainWindow()->doc->m_Selection->getGroupRect(&x2, &y2, &w, &h);
+               ScCore->primaryMainWindow()->doc->moveGroup(pageUnitXToDocX(x) 
- x2, pageUnitYToDocY(y) - y2);
+               ScCore->primaryMainWindow()->view->endGroupTransaction();
+       }
+       else
+               ScCore->primaryMainWindow()->doc->moveItem(pageUnitXToDocX(x) - 
item->xPos(), pageUnitYToDocY(y) - item->yPos(), item);
+       // Now restore the selection.
+       ScCore->primaryMainWindow()->view->Deselect();
+       if (hadOrigSelection)
+               *ScCore->primaryMainWindow()->doc->m_Selection=tempSelection;
+}
+
+void ItemAPI::resize(double width, double height)
+{
+       if (!checkHaveDocument())
+               return;
+       if (item == nullptr)
+               return;
+       ScCore->primaryMainWindow()->doc->sizeItem(ValueToPoint(width), 
ValueToPoint(height), item);
+}
+
+void ItemAPI::rotate(double rot)
+{
+       if (!checkHaveDocument())
+               return;
+       if (item == nullptr)
+               return;
+       ScCore->primaryMainWindow()->doc->rotateItem(item->rotation() - rot, 
item);
+
+}
+void ItemAPI::rotateAbs(double rot)
+{
+       if (!checkHaveDocument())
+               return;
+       if (item == nullptr)
+               return;
+       ScCore->primaryMainWindow()->doc->rotateItem(rot * -1.0, item);
+}
+
+
+ItemAPI::~ItemAPI()
+{
+       qDebug() << "ItemAPI deleted";
+}
+
+

Modified: trunk/Scribus/scribus/plugins/scripter/api_item.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/scribus/plugins/scripter/api_item.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scripter/api_item.h   (original)
+++ trunk/Scribus/scribus/plugins/scripter/api_item.h   Sun Oct 14 10:31:03 2018
@@ -1,139 +1,143 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#ifndef API_ITEM_H_
-#define API_ITEM_H_
-
-#include <QObject>
-#include <QtDebug>
-#include <QApplication>
-
-#include "scripterimpl.h"
-
-class ItemAPI : public QObject
-{
-       Q_OBJECT
-    Q_PROPERTY(QString name READ name WRITE setName)
-       Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor)
-       Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor)
-       Q_PROPERTY(double fillShade READ fillShade WRITE setFillShade)
-       Q_PROPERTY(double lineShade READ lineShade WRITE setLineShade)
-       Q_PROPERTY(double fillTransparency READ fillTransparency WRITE 
setFillTransparency)
-       Q_PROPERTY(double lineTransparency READ lineTransparency WRITE 
setLineTransparency)
-       Q_PROPERTY(bool locked READ locked WRITE setLocked)
-       Q_PROPERTY(bool sizeLocked READ sizeLocked WRITE setSizeLocked)
-       Q_PROPERTY(bool flipVertical READ imageFlippedV WRITE setImageFlippedV)
-       Q_PROPERTY(bool flipHorizontal READ imageFlippedH WRITE 
setImageFlippedH)
-       Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth)
-       Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE 
setCustomLineStyle)
-       Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE 
setStartArrowIndex)
-       Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex)
-
-       Q_PROPERTY(bool printEnabled READ printEnabled WRITE setPrintEnabled)
-       Q_PROPERTY(double xPos READ xPos WRITE setXPos)
-       Q_PROPERTY(double yPos READ yPos WRITE setYPos)
-       Q_PROPERTY(double width READ width WRITE setWidth)
-       Q_PROPERTY(double height READ height WRITE setHeight)
-       Q_PROPERTY(double rotation READ rotation WRITE setRotation)
-       Q_PROPERTY(bool reversed READ reversed WRITE setReversed)
-       Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius)
-       Q_PROPERTY(double columnGap READ columnGap WRITE setColumnGap)
-       Q_PROPERTY(int columns READ columns WRITE setColumns)
-
-public:
-    ItemAPI(PageItem *it);
-    virtual ~ItemAPI();
-
-public slots:
-       void move(double dx, double dy);
-       void moveAbs(double x, double y);
-       void rotate(double rot);
-       void rotateAbs(double rot);
-       void resize(double width, double height);
-
-private:
-       PageItem *item;
-       
-       /**
-        * Properties
-        */
-    QString name();
-    void setName(QString name);
-       
-       QString fillColor();
-       void setFillColor(QString color);
-       
-       QString lineColor();
-       void setLineColor(QString color);
-       
-       double fillShade();
-       void setFillShade(double value);
-       
-       double lineShade();
-       void setLineShade(double value);
-       
-       double fillTransparency();
-       void setFillTransparency(double value);
-       
-       double lineTransparency();
-       void setLineTransparency(double value);
-       
-       bool locked();
-       void setLocked(bool value);
-       
-       bool sizeLocked();
-       void setSizeLocked(bool value);
-       
-       bool imageFlippedV();
-       void setImageFlippedV(bool value);
-       
-       bool imageFlippedH();
-       void setImageFlippedH(bool value);
-       
-       double lineWidth();
-       void setLineWidth(double value);
-       
-       QString customLineStyle();
-       void setCustomLineStyle(QString name);
-       
-       int startArrowIndex();
-       void setStartArrowIndex(int value);
-       
-       int endArrowIndex();
-       void setEndArrowIndex(int value);
-       
-       bool printEnabled();
-       void setPrintEnabled(bool value);
-       
-       double xPos();
-       void setXPos(double value);
-       
-       double yPos();
-       void setYPos(double value);
-       
-       double width();
-       void setWidth(double value);
-
-       double height();
-       void setHeight(double value);
-       
-       double rotation();
-       void setRotation(double rotation);
-       
-       bool reversed();
-       void setReversed(bool value);
-       
-       double cornerRadius();
-       void setCornerRadius(double value);
-       
-       double columnGap();
-       void setColumnGap(double value);
-       
-       int columns();
-       void setColumns(int value);
-};
-
-#endif /*API_ITEM_H_*/
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#ifndef API_ITEM_H_
+#define API_ITEM_H_
+
+#include <QObject>
+#include <QtDebug>
+#include <QApplication>
+
+#include "scripterimpl.h"
+
+class ItemAPI : public QObject
+{
+       Q_OBJECT
+    Q_PROPERTY(QString name READ name WRITE setName)
+       Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor)
+       Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor)
+       Q_PROPERTY(double fillShade READ fillShade WRITE setFillShade)
+       Q_PROPERTY(double lineShade READ lineShade WRITE setLineShade)
+       Q_PROPERTY(double fillTransparency READ fillTransparency WRITE 
setFillTransparency)
+       Q_PROPERTY(double lineTransparency READ lineTransparency WRITE 
setLineTransparency)
+       Q_PROPERTY(bool locked READ locked WRITE setLocked)
+       Q_PROPERTY(bool sizeLocked READ sizeLocked WRITE setSizeLocked)
+       Q_PROPERTY(bool flipVertical READ imageFlippedV WRITE setImageFlippedV)
+       Q_PROPERTY(bool flipHorizontal READ imageFlippedH WRITE 
setImageFlippedH)
+       Q_PROPERTY(double lineWidth READ lineWidth WRITE setLineWidth)
+       Q_PROPERTY(QString customLineStyle READ customLineStyle WRITE 
setCustomLineStyle)
+       Q_PROPERTY(int startArrowIndex READ startArrowIndex WRITE 
setStartArrowIndex)
+       Q_PROPERTY(int endArrowIndex READ endArrowIndex WRITE setEndArrowIndex)
+
+       Q_PROPERTY(bool printEnabled READ printEnabled WRITE setPrintEnabled)
+       Q_PROPERTY(double xPos READ xPos WRITE setXPos)
+       Q_PROPERTY(double yPos READ yPos WRITE setYPos)
+       Q_PROPERTY(double width READ width WRITE setWidth)
+       Q_PROPERTY(double height READ height WRITE setHeight)
+       Q_PROPERTY(double rotation READ rotation WRITE setRotation)
+       Q_PROPERTY(bool reversed READ reversed WRITE setReversed)
+       Q_PROPERTY(double cornerRadius READ cornerRadius WRITE setCornerRadius)
+       Q_PROPERTY(double columnGap READ columnGap WRITE setColumnGap)
+       Q_PROPERTY(int columns READ columns WRITE setColumns)
+       Q_PROPERTY(int verticalAlignment READ verticalAlignment WRITE 
setVerticalAlignment)
+
+public:
+    ItemAPI(PageItem *it);
+    virtual ~ItemAPI();
+
+public slots:
+       void move(double dx, double dy);
+       void moveAbs(double x, double y);
+       void rotate(double rot);
+       void rotateAbs(double rot);
+       void resize(double width, double height);
+
+private:
+       PageItem *item;
+       
+       /**
+        * Properties
+        */
+    QString name();
+    void setName(QString name);
+       
+       QString fillColor();
+       void setFillColor(QString color);
+       
+       QString lineColor();
+       void setLineColor(QString color);
+       
+       double fillShade();
+       void setFillShade(double value);
+       
+       double lineShade();
+       void setLineShade(double value);
+       
+       double fillTransparency();
+       void setFillTransparency(double value);
+       
+       double lineTransparency();
+       void setLineTransparency(double value);
+       
+       bool locked();
+       void setLocked(bool value);
+       
+       bool sizeLocked();
+       void setSizeLocked(bool value);
+       
+       bool imageFlippedV();
+       void setImageFlippedV(bool value);
+       
+       bool imageFlippedH();
+       void setImageFlippedH(bool value);
+       
+       double lineWidth();
+       void setLineWidth(double value);
+       
+       QString customLineStyle();
+       void setCustomLineStyle(QString name);
+       
+       int startArrowIndex();
+       void setStartArrowIndex(int value);
+       
+       int endArrowIndex();
+       void setEndArrowIndex(int value);
+       
+       bool printEnabled();
+       void setPrintEnabled(bool value);
+       
+       double xPos();
+       void setXPos(double value);
+       
+       double yPos();
+       void setYPos(double value);
+       
+       double width();
+       void setWidth(double value);
+
+       double height();
+       void setHeight(double value);
+       
+       double rotation();
+       void setRotation(double rotation);
+       
+       bool reversed();
+       void setReversed(bool value);
+       
+       double cornerRadius();
+       void setCornerRadius(double value);
+       
+       double columnGap();
+       void setColumnGap(double value);
+       
+       int columns();
+       void setColumns(int value);
+
+       int verticalAlignment();
+       void setVerticalAlignment(int value);
+};
+
+#endif /*API_ITEM_H_*/

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp      (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.cpp      Sun Oct 14 
10:31:03 2018
@@ -132,6 +132,24 @@
        return PyInt_FromLong(static_cast<long>(i->textLayout.lines()));
 }
 
+PyObject *scribus_gettextverticalalignment(PyObject* /* self */, PyObject* 
args)
+{
+       char *Name = const_cast<char*>("");
+       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
+               return nullptr;
+       if (!checkHaveDocument())
+               return nullptr;
+       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+       if (i == nullptr)
+               return nullptr;
+       if (!i->isTextFrame())
+       {
+               PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get 
vertical alignment of non-text frame.", "python 
error").toLocal8Bit().constData());
+               return nullptr;
+       }
+       return PyInt_FromLong(static_cast<long>(i->verticalAlignment()));
+}
+
 PyObject *scribus_getcolumns(PyObject* /* self */, PyObject* args)
 {
        char *Name = const_cast<char*>("");
@@ -148,6 +166,24 @@
                return nullptr;
        }
        return PyInt_FromLong(static_cast<long>(i->Cols));
+}
+
+PyObject *scribus_getcolumngap(PyObject* /* self */, PyObject* args)
+{
+       char *Name = const_cast<char*>("");
+       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
+               return nullptr;
+       if (!checkHaveDocument())
+               return nullptr;
+       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
+       if (i == nullptr)
+               return nullptr;
+       if (!i->isTextFrame())
+       {
+               PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get 
column gap of non-text frame.", "python error").toLocal8Bit().constData());
+               return nullptr;
+       }
+       return PyFloat_FromDouble(PointToValue(static_cast<double>(i->ColGap)));
 }
 
 PyObject *scribus_getfontfeatures(PyObject* /* self */, PyObject* args)
@@ -213,24 +249,6 @@
             PointToValue(i->textToFrameDistRight()),
             PointToValue(i->textToFrameDistTop()),
             PointToValue(i->textToFrameDistBottom()));
-}
-
-PyObject *scribus_getcolumngap(PyObject* /* self */, PyObject* args)
-{
-       char *Name = const_cast<char*>("");
-       if (!PyArg_ParseTuple(args, "|es", "utf-8", &Name))
-               return nullptr;
-       if (!checkHaveDocument())
-               return nullptr;
-       PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
-       if (i == nullptr)
-               return nullptr;
-       if (!i->isTextFrame())
-       {
-               PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get 
column gap of non-text frame.","python error").toLocal8Bit().constData());
-               return nullptr;
-       }
-       return PyFloat_FromDouble(PointToValue(static_cast<double>(i->ColGap)));
 }
 
 PyObject *scribus_getframetext(PyObject* /* self */, PyObject* args)
@@ -397,7 +415,7 @@
        Py_RETURN_NONE;
 }
 
-PyObject *scribus_setalign(PyObject* /* self */, PyObject* args)
+PyObject *scribus_setalignment(PyObject* /* self */, PyObject* args)
 {
        char *Name = const_cast<char*>("");
        int alignment;
@@ -407,7 +425,7 @@
                return nullptr;
        if ((alignment > 4) || (alignment < 0))
        {
-               PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of 
range. Use one of the scribus.ALIGN* constants.","python 
error").toLocal8Bit().constData());
+               PyErr_SetString(PyExc_ValueError, QObject::tr("Alignment out of 
range. Use one of the scribus.ALIGN_* constants.","python 
error").toLocal8Bit().constData());
                return nullptr;
        }
        PageItem *i = GetUniqueItem(QString::fromUtf8(Name));
@@ -705,6 +723,33 @@
                return nullptr;
        }
        i->Cols = w;
+
+       Py_RETURN_NONE;
+}
+
+PyObject *scribus_settextverticalalignment(PyObject* /* self */, PyObject* 
args)
+{
+       char *Name = const_cast<char*>("");
+       int alignment;
+       if (!PyArg_ParseTuple(args, "i|es", &alignment, "utf-8", &Name))
+               return nullptr;
+       if (!checkHaveDocument())
+               return nullptr;
+       if (alignment < 0 || alignment > 2)
+       {
+               PyErr_SetString(PyExc_ValueError, QObject::tr("Vertical 
alignment out of bounds, Use one of the scribus.ALIGNV_* constants.", "python 
error").toLocal8Bit().constData());
+               return nullptr;
+       }
+       PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
+       if (item == nullptr)
+               return nullptr;
+       if (!item->isTextFrame())
+       {
+               PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot set 
vertical alignment on a non-text frame.", "python 
error").toLocal8Bit().constData());
+               return nullptr;
+       }
+       item->setVerticalAlignment(alignment);
+       item->update();
 
        Py_RETURN_NONE;
 }
@@ -1243,9 +1288,11 @@
          << scribus_getframetext__doc__   << scribus_gettext__doc__
          << scribus_getlinespace__doc__   << scribus_getcolumngap__doc__
          << scribus_getcolumns__doc__     << scribus_setboxtext__doc__
+         << scribus_gettextverticalalignment__doc__
          << scribus_inserttext__doc__     << scribus_inserthtmltext__doc__<< 
scribus_setfont__doc__
          << scribus_setfontsize__doc__    << scribus_setlinespace__doc__
          << scribus_setcolumngap__doc__   << scribus_setcolumns__doc__
+         << scribus_settextverticalalignment__doc__
          << scribus_setalign__doc__       << scribus_selecttext__doc__
          << scribus_deletetext__doc__     << scribus_settextfill__doc__
          << scribus_settextstroke__doc__  << scribus_settextshade__doc__

Modified: trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h        (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/cmdtext.h        Sun Oct 14 
10:31:03 2018
@@ -115,6 +115,16 @@
 PyObject *scribus_gettextdistances(PyObject */*self*/, PyObject* args);
 
 /*! docstring */
+PyDoc_STRVAR(scribus_gettextverticalalignment__doc__,
+       QT_TR_NOOP("getTextVerticalAlignment([\"name\"]) -> integer\n\
+\n\
+Gets the vertical alignment of text inside text frame \"name\". If \"name\" is 
not\n\
+given the currently selected item is used.\n\
+"));
+/*! Get columns */
+PyObject *scribus_gettextverticalalignment(PyObject * /*self*/, PyObject* 
args);
+
+/*! docstring */
 PyDoc_STRVAR(scribus_getcolumngap__doc__,
 QT_TR_NOOP("getColumnGap([\"name\"]) -> float\n\
 \n\
@@ -286,7 +296,20 @@
 May throw ValueError for an invalid alignment constant.\n\
 "));
 /*! Set alignt */
-PyObject *scribus_setalign(PyObject * /*self*/, PyObject* args);
+PyObject *scribus_setalignment(PyObject * /*self*/, PyObject* args);
+
+/*! docstring */
+PyDoc_STRVAR(scribus_settextverticalalignment__doc__,
+       QT_TR_NOOP("setTextVerticalAlignment(align, [\"name\"])\n\
+\n\
+Sets the vertical alignment of text inside text frame \"name\" to the 
specified\n\
+alignment. If \"name\" is not given the currently selected item is used. 
\"align\" \n\
+should be one of the ALIGNV constants defined in this module - see 
dir(scribus).\n\
+\n\
+May throw ValueError for an invalid alignment constant.\n\
+"));
+/*! Set vertical alignment */
+PyObject *scribus_settextverticalalignment(PyObject * /*self*/, PyObject* 
args);
 
 /*! docstring */
 PyDoc_STRVAR(scribus_setdirection__doc__,

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
URL: 
http://scribus.net/websvn/diff.php?repname=Scribus&rev=22731&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp Sun Oct 14 
10:31:03 2018
@@ -414,6 +414,7 @@
        {const_cast<char*>("getTextLines"), scribus_gettextlines, METH_VARARGS, 
tr(scribus_gettextlines__doc__)},
        {const_cast<char*>("getText"), scribus_getframetext, METH_VARARGS, 
tr(scribus_getframetext__doc__)},
        {const_cast<char*>("getTextShade"), scribus_getlineshade, METH_VARARGS, 
tr(scribus_getlineshade__doc__)},
+       {const_cast<char*>("getTextVerticalAlignment"), 
scribus_gettextverticalalignment, METH_VARARGS, 
tr(scribus_gettextverticalalignment__doc__)},
        {const_cast<char*>("getUnit"), (PyCFunction)scribus_getunit, 
METH_NOARGS, tr(scribus_getunit__doc__)},
        {const_cast<char*>("getVGuides"), (PyCFunction)scribus_getVguides, 
METH_NOARGS, tr(scribus_getVguides__doc__)},
        {const_cast<char*>("getXFontNames"), (PyCFunction)scribus_xfontnames, 
METH_NOARGS, tr(scribus_xfontnames__doc__)},
@@ -554,14 +555,15 @@
        {const_cast<char*>("setTableTopBorder"), scribus_settabletopborder, 
METH_VARARGS, tr(scribus_settabletopborder__doc__)},
        {const_cast<char*>("setTableBottomBorder"), 
scribus_settablebottomborder, METH_VARARGS, 
tr(scribus_settablebottomborder__doc__)},
        {const_cast<char*>("setTableFillColor"), scribus_settablefillcolor, 
METH_VARARGS, tr(scribus_settablefillcolor__doc__)},
-       {const_cast<char*>("setTextAlignment"), scribus_setalign, METH_VARARGS, 
tr(scribus_setalign__doc__)},
+       {const_cast<char*>("setText"), scribus_setboxtext, METH_VARARGS, 
tr(scribus_setboxtext__doc__)},
+       {const_cast<char*>("setTextAlignment"), scribus_setalignment, 
METH_VARARGS, tr(scribus_setalign__doc__)},
        {const_cast<char*>("setTextDirection"), scribus_setdirection, 
METH_VARARGS, tr(scribus_setdirection__doc__)},
        {const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, 
tr(scribus_settextfill__doc__)},
-       {const_cast<char*>("setText"), scribus_setboxtext, METH_VARARGS, 
tr(scribus_setboxtext__doc__)},
        {const_cast<char*>("setTextScalingH"), scribus_settextscalingh, 
METH_VARARGS, tr(scribus_settextscalingh__doc__)},
        {const_cast<char*>("setTextScalingV"), scribus_settextscalingv, 
METH_VARARGS, tr(scribus_settextscalingv__doc__)},
        {const_cast<char*>("setTextShade"), scribus_settextshade, METH_VARARGS, 
tr(scribus_settextshade__doc__)},
        {const_cast<char*>("setTextStroke"), scribus_settextstroke, 
METH_VARARGS, tr(scribus_settextstroke__doc__)},
+       {const_cast<char*>("setTextVerticalAlignment"), 
scribus_settextverticalalignment, METH_VARARGS, 
tr(scribus_settextverticalalignment__doc__)},
        {const_cast<char*>("setUnit"), scribus_setunit, METH_VARARGS, 
tr(scribus_setunit__doc__)},
        {const_cast<char*>("setVGuides"), scribus_setVguides, METH_VARARGS, 
tr(scribus_setVguides__doc__)},
        {const_cast<char*>("sizeObject"), scribus_sizeobjabs, METH_VARARGS, 
tr(scribus_sizeobjabs__doc__)},
@@ -676,6 +678,9 @@
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_CENTERED"), 
Py_BuildValue(const_cast<char*>("i"), 1));
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_BLOCK"), 
Py_BuildValue(const_cast<char*>("i"), 3));
        PyDict_SetItemString(d, const_cast<char*>("ALIGN_FORCED"), 
Py_BuildValue(const_cast<char*>("i"), 4));
+       PyDict_SetItemString(d, const_cast<char*>("ALIGNV_TOP"), 
Py_BuildValue(const_cast<char*>("i"), 0));
+       PyDict_SetItemString(d, const_cast<char*>("ALIGNV_CENTERED"), 
Py_BuildValue(const_cast<char*>("i"), 1));
+       PyDict_SetItemString(d, const_cast<char*>("ALIGNV_BOTTOM"), 
Py_BuildValue(const_cast<char*>("i"), 2));
        PyDict_SetItemString(d, const_cast<char*>("DIRECTION_LTR"), 
Py_BuildValue(const_cast<char*>("i"), 0));
        PyDict_SetItemString(d, const_cast<char*>("DIRECTION_RTL"), 
Py_BuildValue(const_cast<char*>("i"), 1));
        PyDict_SetItemString(d, const_cast<char*>("FILL_NOG"), 
Py_BuildValue(const_cast<char*>("i"), 0));


_______________________________________________
scribus-commit mailing list
[email protected]
http://lists.scribus.net/mailman/listinfo/scribus-commit

Reply via email to