View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001616 | Scribus | Internal | public | 2005-02-01 18:34 | 2005-07-11 17:32 |
Reporter | Assigned To | cbradney | |||
Priority | normal | Severity | tweak | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | x86 Linux | OS | Fedora Core | OS Version | 1 |
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0001616: PATCH: add getters and properties for all existing setters in PageItem | ||||
Description | This patch adds getters, and property definitions, for all setters that currently exist in PageItem. A patch will follow (later, and once this is applied) that makes the attributes related to these getters protected, documents them, and fixes up all references to them from other code. This patch hasn't had much testing, but doesn't touch anything that might break. | ||||
Tags | No tags attached. | ||||
Patch | |||||
2005-02-01 18:34
|
properties_and_getters13.diff (10,288 bytes)
? Makefile ? Makefile.in ? acinclude.m4 ? aclocal.m4 ? autom4te.cache ? config.h ? config.log ? config.status ? configure ? configure.files ? libtool ? stamp-h1 ? scribus/.pageitem.cpp.swp ? scribus/.pageitem.h.swp ? scribus/doc/en/tutorials/Makefile ? scribus/doc/en/tutorials/Makefile.in ? scribus/icons/Makefile ? scribus/icons/Makefile.in ? scribus/plugins/Makefile ? scribus/plugins/Makefile.in ? scribus/plugins/scriptplugin/samples/Makefile ? scribus/plugins/scriptplugin/samples/Makefile.in ? scribus/plugins/scriptplugin/scripts/Makefile ? scribus/plugins/scriptplugin/scripts/Makefile.in Index: scribus/pageitem.cpp =================================================================== RCS file: /cvs/Scribus/scribus/pageitem.cpp,v retrieving revision 1.121.2.44 diff -u -r1.121.2.44 pageitem.cpp --- scribus/pageitem.cpp 1 Feb 2005 18:34:19 -0000 1.121.2.44 +++ scribus/pageitem.cpp 1 Feb 2005 19:28:45 -0000 @@ -2271,6 +2271,11 @@ setUName(newName); // set the name for the UndoObject too } +QString PageItem::fillColor() const +{ + return Pcolor; +} + void PageItem::setFillColor(const QString &newColor) { if (UndoManager::undoEnabled()) @@ -2286,6 +2291,11 @@ Pcolor = newColor; } +int PageItem::fillShade() const +{ + return Shade; +} + void PageItem::setFillShade(int newShade) { if (UndoManager::undoEnabled()) @@ -2301,6 +2311,11 @@ Shade = newShade; } +double PageItem::fillTransparency() const +{ + return Transparency; +} + void PageItem::setFillTransparency(double newTransparency) { if (UndoManager::undoEnabled()) @@ -2316,6 +2331,11 @@ Transparency = newTransparency; } +QString PageItem::lineColor() const +{ + return Pcolor2; +} + void PageItem::setLineColor(const QString &newColor) { if (UndoManager::undoEnabled()) @@ -2331,6 +2351,11 @@ Pcolor2 = newColor; } +int PageItem::lineShade() const +{ + return Shade2; +} + void PageItem::setLineShade(int newShade) { if (UndoManager::undoEnabled()) @@ -2346,6 +2371,12 @@ Shade2 = newShade; } + +double PageItem::lineTransparency() const +{ + return TranspStroke; +} + void PageItem::setLineTransparency(double newTransparency) { if (UndoManager::undoEnabled()) @@ -2398,6 +2429,11 @@ Locked = !Locked; } +bool PageItem::locked() const +{ + return Locked; +} + void PageItem::setLocked(bool isLocked) { if (isLocked != Locked) @@ -2417,6 +2453,11 @@ undoManager->action(this, ss); } LockRes = !LockRes; +} + +bool PageItem::sizeLocked() const +{ + return LockRes; } void PageItem::setSizeLocked(bool isLocked) Index: scribus/pageitem.h =================================================================== RCS file: /cvs/Scribus/scribus/pageitem.h,v retrieving revision 1.26.2.21 diff -u -r1.26.2.21 pageitem.h --- scribus/pageitem.h 1 Feb 2005 18:34:19 -0000 1.26.2.21 +++ scribus/pageitem.h 1 Feb 2005 19:28:45 -0000 @@ -39,7 +39,16 @@ { Q_OBJECT // Properties - see http://doc.trolltech.com/3.3/properties.html + // See the getters and setters of these properties for details on their use. Q_PROPERTY(QString itemName READ itemName WRITE setItemName DESIGNABLE false) + Q_PROPERTY(QString fillColor READ fillColor WRITE setFillColor DESIGNABLE false) + Q_PROPERTY(int fillShade READ fillShade WRITE setFillShade DESIGNABLE false) + Q_PROPERTY(double fillTransparency READ fillTransparency WRITE setFillTransparency DESIGNABLE false) + Q_PROPERTY(QString lineColor READ lineColor WRITE setLineColor DESIGNABLE false) + Q_PROPERTY(int lineShade READ lineShade WRITE setLineShade DESIGNABLE false) + Q_PROPERTY(double lineTransparency READ lineTransparency WRITE setLineTransparency DESIGNABLE false) + Q_PROPERTY(bool locked READ locked WRITE setLocked DESIGNABLE false) + Q_PROPERTY(bool sizeLocked READ sizeLocked WRITE setSizeLocked DESIGNABLE false) public: PageItem(ScribusDoc *pa, int art, double x, double y, double w, double h, double w2, QString fill, QString outline); ~PageItem() {}; @@ -321,48 +330,74 @@ * See also PageItem::itemName() */ void setItemName(const QString& newName); + + /** @brief Get the (name of the) fill color of the object */ + QString fillColor() const; /** * @brief Set the fill color of the object. * @param newColor fill color for the object */ void setFillColor(const QString &newColor); + + /** @brief Get the shade of the fill color */ + int fillShade() const; /** * @brief Set the fill color shade. * @param newShade shade for the fill color */ void setFillShade(int newShade); + + /** @brief Get the transparency of the fill color */ + double fillTransparency() const; /** * @brief Set the transparency of the fill color. * @param newTransparency transparency of the fill color */ void setFillTransparency(double newTransparency); + + /** @brief Get the line color of the object */ + QString lineColor() const; /** * @brief Set the line color of the object. * @param newFill line color for the object */ void setLineColor(const QString &newColor); + + /** @brief Get the line color shade */ + int lineShade() const; /** * @brief Set the line color shade. * @param newColor shade for the line color */ void setLineShade(int newShade); + + /** @brief Get the line transparency */ + double lineTransparency() const; /** * @brief Set the transparency of the line color. * @param newTransparency transparency of the line color */ void setLineTransparency(double newTransparency); + /** @brief Flip an image horizontally. */ void flipImageH(); /** @brief Flip an image vertically */ void flipImageV(); + /** @brief Lock or unlock this pageitem. */ void toggleLock(); + /** @brief is the item locked ? */ + bool locked() const; /** @brief Lock or unlock this pageitem */ void setLocked(bool isLocked); + /** @brief Toggle lock for resizing */ void toggleSizeLock(); - /** @brief Toggle lock for resizing */ + /** @brief Is the item's size locked? */ + bool sizeLocked() const; + /** @brief set lock for resizing */ void setSizeLocked(bool isLocked); + /** * @brief Check the changes to the item and add undo actions for them. * @param force Force the check. Do not care if mouse button or arrow key is down Index: scribus/plugins/scriptplugin/cmdmani.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v retrieving revision 1.7.2.16 diff -u -r1.7.2.16 cmdmani.cpp --- scribus/plugins/scriptplugin/cmdmani.cpp 1 Feb 2005 10:41:40 -0000 1.7.2.16 +++ scribus/plugins/scriptplugin/cmdmani.cpp 1 Feb 2005 19:28:46 -0000 @@ -298,3 +298,36 @@ return PyBool_FromLong(1); return PyBool_FromLong(0); } + +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kw) +{ + char *name = const_cast<char*>(""); + long int scaleToFrame = 0; + long int proportional = 1; + char* kwargs[] = {"scaletoframe", "proportional", "name", NULL}; + if (!PyArg_ParseTupleAndKeywords(args, kw, "i|ies", kwargs, &scaleToFrame, &proportional, "utf-8", &name)) + return NULL; + if(!checkHaveDocument()) + return NULL; + PageItem *item = GetUniqueItem(QString::fromUtf8(name)); + if (item == NULL) + return NULL; + if (item->PType != FRAME_IMAGE) + { + PyErr_SetString(ScribusException, QObject::tr("Specified item not an image frame","python error")); + return NULL; + } + // Set the item to scale if appropriate. ScaleType 1 is free + // scale, 0 is scale to frame. + item->ScaleType = scaleToFrame == 0; + // Now, if the user has chosen to set the proportional mode, + // set it. 1 is proportional, 0 is free aspect. + if (proportional != -1) + item->AspectRatio = proportional > 0; + // Force the braindead app to notice the changes + Carrier->view->AdjustPictScale(item); + Carrier->view->AdjustPreview(item, false); + Carrier->view->RefreshItem(item); + Py_INCREF(Py_None); + return Py_None; +} Index: scribus/plugins/scriptplugin/cmdmani.h =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.h,v retrieving revision 1.3.2.6 diff -u -r1.3.2.6 cmdmani.h --- scribus/plugins/scriptplugin/cmdmani.h 20 Dec 2004 13:10:00 -0000 1.3.2.6 +++ scribus/plugins/scriptplugin/cmdmani.h 1 Feb 2005 19:28:46 -0000 @@ -182,4 +182,15 @@ /*! Status of locking 2004/7/10 pv.*/ PyObject *scribus_islocked(PyObject */*self*/, PyObject* args); +PyDoc_STRVAR(scribus_setscaleimagetoframe__doc__, +QT_TR_NOOP("setScaleImageToFrame(scaletoframe, proportional=None, name=<selection>)\n\ +\n\ +Sets the scale to frame on the selected or specified image frame to `scaletoframe'.\n\ +If `proportional' is specified, set fixed aspect ratio scaling to `proportional'.\n\ +Both `scaletoframe' and `proportional' are boolean.\n\ +\n\ +May raise WrongFrameTypeError.\n\ +")); +PyObject *scribus_setscaleimagetoframe(PyObject */*self*/, PyObject* args, PyObject* kwargs); + #endif Index: scribus/plugins/scriptplugin/scriptplugin.cpp =================================================================== RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp,v retrieving revision 1.33.2.33 diff -u -r1.33.2.33 scriptplugin.cpp --- scribus/plugins/scriptplugin/scriptplugin.cpp 31 Jan 2005 19:26:34 -0000 1.33.2.33 +++ scribus/plugins/scriptplugin/scriptplugin.cpp 1 Feb 2005 19:28:47 -0000 @@ -762,6 +762,7 @@ // duplicity? {"setMultiLine", scribus_setmultiline, METH_VARARGS, "TODO: docstring"}, {const_cast<char*>("setRedraw"), scribus_setredraw, METH_VARARGS, tr(scribus_setredraw__doc__)}, // missing? {"setSelectedObject", scribus_setselobjnam, METH_VARARGS, "Returns the Name of the selecteted Object. \"nr\" if given indicates the Number of the selected Object, e.g. 0 means the first selected Object, 1 means the second selected Object and so on."}, + {const_cast<char*>("setScaleImageToFrame"), (PyCFunction)scribus_setscaleimagetoframe, METH_KEYWORDS, tr(scribus_setscaleimagetoframe__doc__)}, {const_cast<char*>("setStyle"), scribus_setstyle, METH_VARARGS, tr(scribus_setstyle__doc__)}, {const_cast<char*>("setTextAlignment"), scribus_setalign, METH_VARARGS, tr(scribus_setalign__doc__)}, {const_cast<char*>("setTextColor"), scribus_settextfill, METH_VARARGS, tr(scribus_settextfill__doc__)}, |
|
Applied by cbradney. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-02-01 18:34 |
|
New Issue | |
2005-02-01 18:34 |
|
File Added: properties_and_getters13.diff | |
2005-02-02 08:14 | cbradney | Status | new => assigned |
2005-02-02 08:14 | cbradney | Assigned To | => cbradney |
2005-02-02 08:19 | cbradney | Status | assigned => resolved |
2005-02-02 08:19 | cbradney | Fixed in Version | => 1.3.0cvs |
2005-02-02 08:19 | cbradney | Resolution | open => fixed |
2005-02-02 08:36 |
|
Status | resolved => closed |
2005-02-02 08:36 |
|
Note Added: 0003583 | |
2005-02-04 16:47 |
|
Relationship added | related to 0001632 |
2005-02-09 05:58 |
|
Relationship added | child of 0001653 |
2005-06-28 18:19 | cbradney | Category | - => Internal |
2005-07-11 17:32 | cbradney | View Status | private => public |