r19397 by jghali - #12578: "Replace Colors" gives wrong result if Properties > Colors tab is opened

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 2 16:12:00 UTC 2014


Author: jghali
Date: Sat Aug  2 16:12:00 2014
New Revision: 19397

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19397
Log:
#12578: "Replace Colors" gives wrong result if Properties > Colors tab is opened

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/ui/cpalette.cpp
    trunk/Scribus/scribus/ui/cpalette.h
    trunk/Scribus/scribus/ui/propertiespalette.cpp
    trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
    trunk/Scribus/scribus/ui/transparencypalette.cpp
    trunk/Scribus/scribus/ui/transparencypalette.h

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Sat Aug  2 16:12:00 2014
@@ -7764,6 +7764,16 @@
 				cstops.at(cst)->name = *it;
 		}
 	}
+	cstops = mask_gradient.colorStops();
+	for (uint cst = 0; cst < mask_gradient.Stops(); ++cst)
+	{
+		it = newNames.colors().find(cstops.at(cst)->name);
+		if (it != newNames.colors().end())
+		{
+			if (*it != CommonStrings::None)
+				cstops.at(cst)->name = *it;
+		}
+	}
 	if (effectsInUse.count() != 0)
 	{
 		QString col1 = CommonStrings::None;

Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp Sat Aug  2 16:12:00 2014
@@ -444,12 +444,18 @@
 
 void Cpalette::updateColorList()
 {
-	if (currentDoc)
-	{
-		this->setColors(currentDoc->PageColors);
-		this->setGradients(&currentDoc->docGradients);
-		this->setPatterns(&currentDoc->docPatterns);
-	}
+	if (!currentDoc)
+		return;
+	
+	if (currentItem)
+		disconnectSignals();
+
+	this->setColors(currentDoc->PageColors);
+	this->setGradients(&currentDoc->docGradients);
+	this->setPatterns(&currentDoc->docPatterns);
+
+	if (currentItem)
+		setCurrentItem(currentItem);
 }
 
 void Cpalette::updateCList()
@@ -621,26 +627,28 @@
 
 void Cpalette::selectColorS(QListWidgetItem *item)
 {
+	QString colorName;
 	ColorPixmapItem* c = dynamic_cast<ColorPixmapItem*>(item);
 	if (c != NULL)	
-		sFarbe = c->colorName();
+		colorName = c->colorName();
 	else if (! item->data(Qt::DisplayRole).toString().isEmpty()) 
-		sFarbe = item->data(Qt::DisplayRole).toString();
+		colorName = item->data(Qt::DisplayRole).toString();
 	else
 		return;
-	emit NewPen(sFarbe);
+	emit NewPen(colorName);
 }
 
 void Cpalette::selectColorF(QListWidgetItem *item)
 {
+	QString colorName;
 	ColorPixmapItem* c = dynamic_cast<ColorPixmapItem*>(item);
 	if (c != NULL)	
-		sFarbe = c->colorName();
+		colorName = c->colorName();
 	else if (! item->data(Qt::DisplayRole).toString().isEmpty()) 
-		sFarbe = item->data(Qt::DisplayRole).toString();
+		colorName = item->data(Qt::DisplayRole).toString();
 	else
 		return;
-	emit NewBrush(sFarbe);
+	emit NewBrush(colorName);
 }
 
 void Cpalette::setColors(ColorList newColorList)

Modified: trunk/Scribus/scribus/ui/cpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/cpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.h (original)
+++ trunk/Scribus/scribus/ui/cpalette.h Sat Aug  2 16:12:00 2014
@@ -150,7 +150,6 @@
 	GradientVectorDialog* CGradDia;
 	QPointer<ScribusDoc> currentDoc;
 	PageItem* currentItem;
-	QString sFarbe;
 	ColorList colorList;
 	QHash<QString, ScPattern> *patternList;
 	QHash<QString, VGradient> *gradientList;

Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Sat Aug  2 16:12:00 2014
@@ -387,7 +387,6 @@
 	tablePal->setItem(m_item);
 
 	Tpal->setCurrentItem(m_item);
-	Tpal->updateFromItem();
 
 	setTextFlowMode(m_item->textFlowMode());
 

Modified: trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp Sat Aug  2 16:12:00 2014
@@ -94,32 +94,33 @@
 		setDoc(item->doc());
 	if (item == NULL)
 		return;
-	if (item->isTable() || item->isTextFrame())
-	{
-		m_item = item;
-		disconnectSignals();
-		configureWidgets();
-		if (m_item)
-		{
-			PageItem_TextFrame *i2;
-			if (m_doc->appMode == modeEditTable)
-				i2 = m_item->asTable()->activeCell().textFrame();
-			else
-				i2 = m_item->asTextFrame();
-			if (i2 != 0)
-				revertButton->setChecked(i2->reversed());
-			if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
-			{
-				ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
-				if (m_doc->appMode == modeEdit)
-					m_item->currentTextProps(parStyle);
-				else if (m_doc->appMode == modeEditTable)
-					m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
-				updateStyle(parStyle);
-			}
-			connectSignals();
-		}
-	}
+	if (!item->isTable() && !item->isTextFrame())
+		return;
+
+	m_item = item;
+	disconnectSignals();
+	configureWidgets();
+
+	if (!m_item)
+		return;
+
+	PageItem_TextFrame *i2;
+	if (m_doc->appMode == modeEditTable)
+		i2 = m_item->asTable()->activeCell().textFrame();
+	else
+		i2 = m_item->asTextFrame();
+	if (i2 != 0)
+		revertButton->setChecked(i2->reversed());
+	if (m_item->asTextFrame() || m_item->asPathText() || m_item->asTable())
+	{
+		ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
+		if (m_doc->appMode == modeEdit)
+			m_item->currentTextProps(parStyle);
+		else if (m_doc->appMode == modeEditTable)
+			m_item->asTable()->activeCell().textFrame()->currentTextProps(parStyle);
+		updateStyle(parStyle);
+	}
+	connectSignals();
 }
 
 void PropertyWidget_TextColor::connectSignals()
@@ -197,10 +198,16 @@
 	if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
+	if (m_item)
+		disconnectSignals();
+
 	fillColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, true);
 	strokeColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, false);
 	fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width() + 24);
 	strokeColor->view()->setMinimumWidth(strokeColor->view()->maximumViewportSize().width() + 24);
+
+	if (m_item)
+		setCurrentItem(m_item);
 }
 
 void PropertyWidget_TextColor::updateCharStyle(const CharStyle& charStyle)

Modified: trunk/Scribus/scribus/ui/transparencypalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/transparencypalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/transparencypalette.cpp (original)
+++ trunk/Scribus/scribus/ui/transparencypalette.cpp Sat Aug  2 16:12:00 2014
@@ -64,78 +64,19 @@
 	connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
 }
 
-void Tpalette::setCurrentItem(PageItem* item)
-{
-	currentItem = item;
-}
-
-void Tpalette::setDocument(ScribusDoc* doc)
-{
-	disconnect(this, SIGNAL(NewTrans(double)), 0, 0);
-	disconnect(this, SIGNAL(NewTransS(double)), 0, 0);
-	disconnect(this, SIGNAL(NewGradient(int)), 0, 0);
-	disconnect(this, SIGNAL(NewBlend(int)), 0, 0);
-	disconnect(this, SIGNAL(NewBlendS(int)), 0, 0);
-	disconnect(this, SIGNAL(NewPattern(QString)), 0, 0);
-	disconnect(this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
-	
-	if (currentDoc)
-	{
-		disconnect(currentDoc->scMW(), SIGNAL(UpdateRequest(int)), this, 0);
-	}
-
-	currentDoc = doc;
-
-	if (doc != NULL)
-	{
-		gradEdit->setColors(doc->PageColors);
-		currentUnit = doc->unitIndex();
-
-		updateColorList();
-
-		connect(this, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double)));
-		connect(this, SIGNAL(NewTransS(double)), doc, SLOT(itemSelection_SetItemLineTransparency(double)));
-		connect(this, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int)));
-		connect(this, SIGNAL(NewBlendS(int)), doc, SLOT(itemSelection_SetItemLineBlend(int)));
-		connect(this, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradMask(int)));
-		connect(this, SIGNAL(NewPattern(QString)), doc, SLOT(itemSelection_SetItemPatternMask(QString)));
-		connect(this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemPatternMaskProps(double, double, double, double, double, double, double, bool, bool)));
-		connect(doc->scMW(), SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int)));
-	}
-}
-
-void Tpalette::handleUpdateRequest(int updateFlags)
-{
-	if (updateFlags & reqColorsUpdate)
-		updateColorList();
-}
-
-void Tpalette::updateColorList()
-{
-	if (currentDoc)
-	{
-		this->setColors(currentDoc->PageColors);
-		this->setPatterns(&currentDoc->docPatterns);
-		this->setGradients(&currentDoc->docGradients);
-	}
-}
-
-void Tpalette::hideSelectionButtons()
-{
-	editLineSelector->hide();
-	editLineSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
-	editFillSelector->hide();
-	editFillSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
-}
-
-void Tpalette::updateFromItem()
-{
-	if (currentItem == NULL)
-		return;
-	if (!currentDoc)
-		return;
-	setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency());
-	setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode());
+void Tpalette::connectSignals()
+{
+	connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+	connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
+	connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
+	connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
+	connect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode()));
+	connect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
+	connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
+}
+
+void Tpalette::disconnectSignals()
+{
 	disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
 	disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
 	disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
@@ -143,6 +84,18 @@
 	disconnect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode()));
 	disconnect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
 	disconnect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
+}
+
+void Tpalette::setCurrentItem(PageItem* item)
+{
+	currentItem = item;
+	disconnectSignals();
+
+	if (!currentItem || !currentDoc)
+		return;
+
+	setActTrans(currentItem->fillTransparency(), currentItem->lineTransparency());
+	setActBlend(currentItem->fillBlendmode(), currentItem->lineBlendmode());
 	gradEdit->setGradient(currentItem->mask_gradient);
 	if (!currentItem->gradientMask().isEmpty())
 	{
@@ -185,13 +138,77 @@
 	currentItem->maskFlip(mirrorX, mirrorY);
 	setActPattern(currentItem->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
 
-	connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
-	connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
-	connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
-	connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
-	connect(transpCalcGradient, SIGNAL(clicked()), this, SLOT(switchGradientMode()));
-	connect(transpCalcPattern, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
-	connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
+	connectSignals();
+}
+
+void Tpalette::setDocument(ScribusDoc* doc)
+{
+	disconnect(this, SIGNAL(NewTrans(double)), 0, 0);
+	disconnect(this, SIGNAL(NewTransS(double)), 0, 0);
+	disconnect(this, SIGNAL(NewGradient(int)), 0, 0);
+	disconnect(this, SIGNAL(NewBlend(int)), 0, 0);
+	disconnect(this, SIGNAL(NewBlendS(int)), 0, 0);
+	disconnect(this, SIGNAL(NewPattern(QString)), 0, 0);
+	disconnect(this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
+	
+	if (currentDoc)
+	{
+		disconnect(currentDoc->scMW(), SIGNAL(UpdateRequest(int)), this, 0);
+	}
+
+	currentDoc = doc;
+
+	if (doc != NULL)
+	{
+		gradEdit->setColors(doc->PageColors);
+		currentUnit = doc->unitIndex();
+
+		updateColorList();
+
+		connect(this, SIGNAL(NewTrans(double)), doc, SLOT(itemSelection_SetItemFillTransparency(double)));
+		connect(this, SIGNAL(NewTransS(double)), doc, SLOT(itemSelection_SetItemLineTransparency(double)));
+		connect(this, SIGNAL(NewBlend(int)), doc, SLOT(itemSelection_SetItemFillBlend(int)));
+		connect(this, SIGNAL(NewBlendS(int)), doc, SLOT(itemSelection_SetItemLineBlend(int)));
+		connect(this, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradMask(int)));
+		connect(this, SIGNAL(NewPattern(QString)), doc, SLOT(itemSelection_SetItemPatternMask(QString)));
+		connect(this, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemPatternMaskProps(double, double, double, double, double, double, double, bool, bool)));
+		connect(doc->scMW(), SIGNAL(UpdateRequest(int)), this, SLOT(handleUpdateRequest(int)));
+	}
+}
+
+void Tpalette::handleUpdateRequest(int updateFlags)
+{
+	if (updateFlags & reqColorsUpdate)
+		updateColorList();
+}
+
+void Tpalette::updateColorList()
+{
+	if (!currentDoc)
+		return;
+
+	if (currentItem)
+		disconnectSignals();
+
+	this->setColors(currentDoc->PageColors);
+	this->setPatterns(&currentDoc->docPatterns);
+	this->setGradients(&currentDoc->docGradients);
+
+	if (currentItem)
+		setCurrentItem(currentItem);
+}
+
+void Tpalette::hideSelectionButtons()
+{
+	editLineSelector->hide();
+	editLineSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
+	editFillSelector->hide();
+	editFillSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
+}
+
+void Tpalette::updateFromItem()
+{
+	setCurrentItem(currentItem);
 }
 
 void Tpalette::updateCList()

Modified: trunk/Scribus/scribus/ui/transparencypalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19397&path=/trunk/Scribus/scribus/ui/transparencypalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/transparencypalette.h (original)
+++ trunk/Scribus/scribus/ui/transparencypalette.h Sat Aug  2 16:12:00 2014
@@ -1,129 +1,132 @@
-/*
-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.
-*/
-/***************************************************************************
-                          transparencypalette.h  -  description
-                             -------------------
-    begin                : Tue Nov 17 2009
-    copyright            : (C) 2009 by Franz Schmid
-    email                : Franz.Schmid at altmuehlnet.de
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef TPALETTE_H
-#define TPALETTE_H
-
-#include <QWidget>
-#include <QPointer>
-#include <QGroupBox>
-#include <QPushButton>
-#include <QToolButton>
-#include "scribusapi.h"
-#include "gradienteditor.h"
-#include "scribusdoc.h"
-#include "ui/scrpalettebase.h"
-#include "ui_transparencypalette.h"
-#include "ui/gradientvectordialog.h"
-#include "ui/patternpropsdialog.h"
-
-class PageItem;
-class ColorListBox;
-class ScrSpinBox;
-class ScComboBox;
-class ScPattern;
-class LinkButton;
-
-/**
-  *@author Franz Schmid
-  */
-
-class SCRIBUS_API Tpalette : public QWidget, Ui::transparencyPalette
-{
-	Q_OBJECT
-
-	friend class PropertiesPalette;
-	friend class PropertiesPalette_Group;
-
-public:
-	Tpalette(QWidget* parent);
-	~Tpalette() {};
-
-	void setDocument(ScribusDoc* doc);
-	void setCurrentItem(PageItem* item);
-	void hideSelectionButtons();
-	void updateFromItem();
-
-	void updateColorList();
-
-	void setColors(ColorList newColorList);
-	void setGradients(QHash<QString, VGradient> *docGradients);
-	void setPatterns(QHash<QString, ScPattern> *docPatterns);
-
-public slots:
-	void handleUpdateRequest(int);
-
-	void editLineSelectorButton();
-	void editFillSelectorButton();
-	void updateCList();
-	void updateGradientList();
-	void slotGrad(int nr);
-	void slotGradType(int type);
-	void setNamedGradient(const QString &name);
-	void switchGradientMode();
-	void switchPatternMode();
-	void editGradientVector();
-	void setActiveGradDia(bool active);
-	void hideEditedPatterns(QStringList names);
-	void updatePatternList();
-	void selectPattern(QListWidgetItem *c);
-	void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
-	void changePatternProps();
-	void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
-	void setActTrans(double, double);
-	void setActBlend(int, int);
-	void slotTransS(double val);
-	void slotTransF(double val);
-	void unitChange(double, double, int unitIndex);
-
-signals:
-	void NewTrans(double);
-	void NewTransS(double);
-	void NewBlend(int);
-	void NewBlendS(int);
-	void gradientChanged();
-	void editGradient();
-	void NewGradient(int);
-	void NewSpecial(double, double, double, double, double, double, double, double, double, double);
-	void NewPattern(QString);
-	void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
-
-protected:
-	GradientVectorDialog* TGradDia;
-	QPointer<ScribusDoc> currentDoc;
-	PageItem* currentItem;
-	ColorList colorList;
-	int currentUnit;
-	QHash<QString, ScPattern> *patternList;
-	QHash<QString, VGradient> *gradientList;
-	double m_Pattern_scaleX;
-	double m_Pattern_scaleY;
-	double m_Pattern_offsetX;
-	double m_Pattern_offsetY;
-	double m_Pattern_rotation;
-	double m_Pattern_skewX;
-	double m_Pattern_skewY;
-	bool m_Pattern_mirrorX;
-	bool m_Pattern_mirrorY;
-};
-#endif
+/*
+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.
+*/
+/***************************************************************************
+                          transparencypalette.h  -  description
+                             -------------------
+    begin                : Tue Nov 17 2009
+    copyright            : (C) 2009 by Franz Schmid
+    email                : Franz.Schmid at altmuehlnet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef TPALETTE_H
+#define TPALETTE_H
+
+#include <QWidget>
+#include <QPointer>
+#include <QGroupBox>
+#include <QPushButton>
+#include <QToolButton>
+#include "scribusapi.h"
+#include "gradienteditor.h"
+#include "scribusdoc.h"
+#include "ui/scrpalettebase.h"
+#include "ui_transparencypalette.h"
+#include "ui/gradientvectordialog.h"
+#include "ui/patternpropsdialog.h"
+
+class PageItem;
+class ColorListBox;
+class ScrSpinBox;
+class ScComboBox;
+class ScPattern;
+class LinkButton;
+
+/**
+  *@author Franz Schmid
+  */
+
+class SCRIBUS_API Tpalette : public QWidget, Ui::transparencyPalette
+{
+	Q_OBJECT
+
+	friend class PropertiesPalette;
+	friend class PropertiesPalette_Group;
+
+public:
+	Tpalette(QWidget* parent);
+	~Tpalette() {};
+
+	void setDocument(ScribusDoc* doc);
+	void setCurrentItem(PageItem* item);
+	void hideSelectionButtons();
+	void updateFromItem();
+
+	void updateColorList();
+
+	void setColors(ColorList newColorList);
+	void setGradients(QHash<QString, VGradient> *docGradients);
+	void setPatterns(QHash<QString, ScPattern> *docPatterns);
+
+public slots:
+	void handleUpdateRequest(int);
+
+	void editLineSelectorButton();
+	void editFillSelectorButton();
+	void updateCList();
+	void updateGradientList();
+	void slotGrad(int nr);
+	void slotGradType(int type);
+	void setNamedGradient(const QString &name);
+	void switchGradientMode();
+	void switchPatternMode();
+	void editGradientVector();
+	void setActiveGradDia(bool active);
+	void hideEditedPatterns(QStringList names);
+	void updatePatternList();
+	void selectPattern(QListWidgetItem *c);
+	void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
+	void changePatternProps();
+	void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
+	void setActTrans(double, double);
+	void setActBlend(int, int);
+	void slotTransS(double val);
+	void slotTransF(double val);
+	void unitChange(double, double, int unitIndex);
+
+signals:
+	void NewTrans(double);
+	void NewTransS(double);
+	void NewBlend(int);
+	void NewBlendS(int);
+	void gradientChanged();
+	void editGradient();
+	void NewGradient(int);
+	void NewSpecial(double, double, double, double, double, double, double, double, double, double);
+	void NewPattern(QString);
+	void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
+
+protected:
+	GradientVectorDialog* TGradDia;
+	QPointer<ScribusDoc> currentDoc;
+	PageItem* currentItem;
+	ColorList colorList;
+	int currentUnit;
+	QHash<QString, ScPattern> *patternList;
+	QHash<QString, VGradient> *gradientList;
+	double m_Pattern_scaleX;
+	double m_Pattern_scaleY;
+	double m_Pattern_offsetX;
+	double m_Pattern_offsetY;
+	double m_Pattern_rotation;
+	double m_Pattern_skewX;
+	double m_Pattern_skewY;
+	bool m_Pattern_mirrorX;
+	bool m_Pattern_mirrorY;
+
+	void connectSignals();
+	void disconnectSignals();
+};
+#endif




More information about the scribus-commit mailing list