r23133 by craig - Clean up Properties Palettes Colour and Transparency Palettes code
scribus-commit
scribus-commit at lists.scribus.net
Fri Aug 16 15:35:31 UTC 2019
Author: craig
Date: Fri Aug 16 15:35:31 2019
New Revision: 23133
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23133
Log:
Clean up Properties Palettes Colour and Transparency Palettes code
Modified:
trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/ui/cpalette.cpp
trunk/Scribus/scribus/ui/cpalette.h
trunk/Scribus/scribus/ui/propertiespalette.cpp
trunk/Scribus/scribus/ui/propertiespalette.h
trunk/Scribus/scribus/ui/transparencypalette.cpp
trunk/Scribus/scribus/ui/transparencypalette.h
Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp Fri Aug 16 15:35:31 2019
@@ -69,24 +69,23 @@
void RawPainterPres::endDocument()
{
painter->endDocument();
- if (pageElements.count() > 1)
- {
- for (int a = 1; a < pageElements.count(); ++a)
- {
- if (a < mDoc->Pages->count())
+ if (pageElements.isEmpty())
+ return;
+ for (int i = 1; i < pageElements.count(); ++i)
+ {
+ if (i < mDoc->Pages->count())
+ {
+ double bX = mDoc->Pages->at(i)->xOffset();
+ double bY = mDoc->Pages->at(i)->yOffset();
+ for (int j = 0; j < pageElements[i].count(); ++j)
{
- double bX = mDoc->Pages->at(a)->xOffset();
- double bY = mDoc->Pages->at(a)->yOffset();
- for (int b = 0; b < pageElements[a].count(); ++b)
- {
- PageItem *item = pageElements[a][b];
- item->setXYPos(item->xPos() + bX, item->yPos() + bY, true);
- if (item->isGroup())
- mDoc->GroupOnPage(item);
- else
- item->OwnPage = mDoc->OnPage(item);
- item->setRedrawBounding();
- }
+ PageItem *item = pageElements[i][j];
+ item->setXYPos(item->xPos() + bX, item->yPos() + bY, true);
+ if (item->isGroup())
+ mDoc->GroupOnPage(item);
+ else
+ item->OwnPage = mDoc->OnPage(item);
+ item->setRedrawBounding();
}
}
}
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Fri Aug 16 15:35:31 2019
@@ -7542,8 +7542,8 @@
}
patternsDependingOnThis.prepend(temp);
symbolPalette->editingStart(patternsDependingOnThis);
- propertiesPalette->Cpal->hideEditedPatterns(patternsDependingOnThis);
- propertiesPalette->Tpal->hideEditedPatterns(patternsDependingOnThis);
+ propertiesPalette->colorPalette->hideEditedPatterns(patternsDependingOnThis);
+ propertiesPalette->transparencyPalette->hideEditedPatterns(patternsDependingOnThis);
if (outlinePalette->isVisible())
outlinePalette->BuildTree(false);
updateActiveWindowCaption( tr("Editing Symbol: %1").arg(temp));
@@ -9295,7 +9295,7 @@
// Update tools colors if needed
m_prefsManager.replaceToolColors(dia->replaceColorMap);
m_prefsManager.setColorSet(dia->m_colorList);
- propertiesPalette->Cpal->setColors(m_prefsManager.colorSet());
+ propertiesPalette->colorPalette->setColors(m_prefsManager.colorSet());
m_prefsManager.appPrefs.defaultGradients = dia->dialogGradients;
m_prefsManager.appPrefs.defaultPatterns = dia->dialogPatterns;
QString Cpfad = QDir::toNativeSeparators(ScPaths::applicationDataDir())+"DefaultColors.xml";
Modified: trunk/Scribus/scribus/ui/cpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/cpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/cpalette.cpp Fri Aug 16 15:35:31 2019
@@ -66,13 +66,9 @@
#include "util.h"
#include "util_math.h"
-Cpalette::Cpalette(QWidget* parent) : QWidget(parent)
+ColorPalette::ColorPalette(QWidget* parent) : QWidget(parent)
{
undoManager = UndoManager::instance();
- m_blockUpdates = 0;
- currentItem = nullptr;
- patternList = nullptr;
- CGradDia = nullptr;
CGradDia = new GradientVectorDialog(this->parentWidget());
CGradDia->hide();
@@ -127,7 +123,7 @@
editFillColorSelectorButton();*/
}
-void Cpalette::connectSignals()
+void ColorPalette::connectSignals()
{
connect(CGradDia, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)));
connect(CGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool)));
@@ -187,7 +183,7 @@
connect(GradientExtendS , SIGNAL(activated(int)), this, SLOT(handleStrokeGradientExtend(int)));
}
-void Cpalette::disconnectSignals()
+void ColorPalette::disconnectSignals()
{
disconnect(CGradDia, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)));
disconnect(CGradDia, SIGNAL(paletteShown(bool)), this, SLOT(setActiveGradDia(bool)));
@@ -247,7 +243,7 @@
disconnect(GradientExtendS , SIGNAL(activated(int)), this, SLOT(handleStrokeGradientExtend(int)));
}
-void Cpalette::setCurrentItem(PageItem* item)
+void ColorPalette::setCurrentItem(PageItem* item)
{
if ((item == nullptr) || (currentItem != item))
{
@@ -343,12 +339,12 @@
connectSignals();
}
-void Cpalette::updateFromItem()
+void ColorPalette::updateFromItem()
{
setCurrentItem(currentItem);
}
-void Cpalette::setDocument(ScribusDoc* doc)
+void ColorPalette::setDocument(ScribusDoc* doc)
{
this->disconnect(SIGNAL(NewPen(QString)));
this->disconnect(SIGNAL(NewBrush(QString)));
@@ -415,7 +411,7 @@
}
}
-PageItem* Cpalette::currentItemFromSelection()
+PageItem* ColorPalette::currentItemFromSelection()
{
PageItem *currentItem = nullptr;
if (currentDoc)
@@ -423,7 +419,7 @@
return currentItem;
}
-void Cpalette::enablePatterns(bool enable)
+void ColorPalette::enablePatterns(bool enable)
{
if (enable)
{
@@ -441,7 +437,7 @@
}
}
-void Cpalette::handleSelectionChanged()
+void ColorPalette::handleSelectionChanged()
{
if (currentDoc && !updatesBlocked())
{
@@ -450,13 +446,13 @@
}
}
-void Cpalette::handleUpdateRequest(int updateFlags)
+void ColorPalette::handleUpdateRequest(int updateFlags)
{
if (updateFlags & reqColorsUpdate)
updateColorList();
}
-void Cpalette::updateColorList()
+void ColorPalette::updateColorList()
{
if (!currentDoc)
return;
@@ -472,7 +468,7 @@
setCurrentItem(currentItem);
}
-void Cpalette::updateCList()
+void ColorPalette::updateCList()
{
bool sigBlocked1 = colorListStroke->blockSignals(true);
bool sigBlocked2 = colorListFill->blockSignals(true);
@@ -500,108 +496,100 @@
colorListFill->blockSignals(sigBlocked2);
}
-void Cpalette::toggleColorDisplay()
-{
- if (currentDoc != nullptr)
- {
- colorListStroke->cList = ¤tDoc->PageColors;
- colorListFill->cList = ¤tDoc->PageColors;
- colorList = currentDoc->PageColors;
- updateColorList();
- }
-}
-
-void Cpalette::showOverprint(int val)
+void ColorPalette::toggleColorDisplay()
+{
+ if (!currentDoc)
+ return;
+ colorListStroke->cList = ¤tDoc->PageColors;
+ colorListFill->cList = ¤tDoc->PageColors;
+ colorList = currentDoc->PageColors;
+ updateColorList();
+}
+
+void ColorPalette::showOverprint(int val)
{
bool sigBlocked = overPrintCombo->blockSignals(true);
overPrintCombo->setCurrentIndex(val);
overPrintCombo->blockSignals(sigBlocked);
}
-void Cpalette::handleFillShade(double val)
-{
- if (currentDoc)
- {
- blockUpdates(true);
- currentDoc->itemSelection_SetItemBrushShade(static_cast<int>(val));
- blockUpdates(false);
- }
-}
-
-void Cpalette::handleStrokeShade(double val)
-{
- if (currentDoc)
- {
- blockUpdates(true);
- currentDoc->itemSelection_SetItemPenShade(static_cast<int>(val));
- blockUpdates(false);
- }
-}
-
-void Cpalette::handleOverprint(int val)
-{
- if (currentDoc)
- {
- bool setter = true;
- if (val == 0)
- setter = false;
- currentDoc->itemSelection_SetOverprint(setter);
- }
-}
-
-void Cpalette::handleFillGradient()
-{
- if (currentDoc)
- {
- VGradient gradient(gradEdit->gradient());
- blockUpdates(true);
- currentDoc->updateManager()->setUpdatesDisabled();
- currentDoc->itemSelection_SetFillGradient(gradient);
- currentDoc->updateManager()->setUpdatesEnabled();
- blockUpdates(false);
- }
-}
-
-void Cpalette::handleStrokeGradient()
-{
- if (currentDoc)
- {
- VGradient gradient(gradEditStroke->gradient());
- blockUpdates(true);
- currentDoc->updateManager()->setUpdatesDisabled();
- currentDoc->itemSelection_SetLineGradient(gradient);
- currentDoc->updateManager()->setUpdatesEnabled();
- blockUpdates(false);
- }
-}
-
-void Cpalette::handleStrokeGradientExtend(int val)
-{
- if (currentDoc)
- {
- if (val == 0)
- currentItem->setStrokeGradientExtend(VGradient::none);
- else
- currentItem->setStrokeGradientExtend(VGradient::pad);
- currentItem->update();
- currentDoc->regionsChanged()->update(QRect());
- }
-}
-
-void Cpalette::handleGradientExtend(int val)
-{
- if (currentDoc)
- {
- if (val == 0)
- currentItem->setGradientExtend(VGradient::none);
- else
- currentItem->setGradientExtend(VGradient::pad);
- currentItem->update();
- currentDoc->regionsChanged()->update(QRect());
- }
-}
-
-void Cpalette::showColorValues(const QString& stroke, const QString& fill, int sShade, int fShade)
+void ColorPalette::handleFillShade(double val)
+{
+ if (!currentDoc)
+ return;
+ blockUpdates(true);
+ currentDoc->itemSelection_SetItemBrushShade(static_cast<int>(val));
+ blockUpdates(false);
+}
+
+void ColorPalette::handleStrokeShade(double val)
+{
+ if (!currentDoc)
+ return;
+ blockUpdates(true);
+ currentDoc->itemSelection_SetItemPenShade(static_cast<int>(val));
+ blockUpdates(false);
+}
+
+void ColorPalette::handleOverprint(int val)
+{
+ if (!currentDoc)
+ return;
+ bool setter = true;
+ if (val == 0)
+ setter = false;
+ currentDoc->itemSelection_SetOverprint(setter);
+}
+
+void ColorPalette::handleFillGradient()
+{
+ if (!currentDoc)
+ return;
+ VGradient gradient(gradEdit->gradient());
+ blockUpdates(true);
+ currentDoc->updateManager()->setUpdatesDisabled();
+ currentDoc->itemSelection_SetFillGradient(gradient);
+ currentDoc->updateManager()->setUpdatesEnabled();
+ blockUpdates(false);
+}
+
+void ColorPalette::handleStrokeGradient()
+{
+ if (!currentDoc)
+ return;
+ VGradient gradient(gradEditStroke->gradient());
+ blockUpdates(true);
+ currentDoc->updateManager()->setUpdatesDisabled();
+ currentDoc->itemSelection_SetLineGradient(gradient);
+ currentDoc->updateManager()->setUpdatesEnabled();
+ blockUpdates(false);
+}
+
+void ColorPalette::handleStrokeGradientExtend(int val)
+{
+ if (!currentDoc)
+ return;
+ if (val == 0)
+ currentItem->setStrokeGradientExtend(VGradient::none);
+ else
+ currentItem->setStrokeGradientExtend(VGradient::pad);
+ currentItem->update();
+ currentDoc->regionsChanged()->update(QRect());
+}
+
+void ColorPalette::handleGradientExtend(int val)
+{
+ if (!currentDoc)
+ return;
+ if (val == 0)
+ currentItem->setGradientExtend(VGradient::none);
+ else
+ currentItem->setGradientExtend(VGradient::pad);
+ currentItem->update();
+ currentDoc->regionsChanged()->update(QRect());
+}
+
+void ColorPalette::showColorValues(const QString& stroke, const QString& fill, int sShade, int fShade)
{
bool sigBlocked1 = fillShade->blockSignals(true);
bool sigBlocked2 = strokeShade->blockSignals(true);
@@ -625,7 +613,7 @@
colorListFill->blockSignals(sigBlocked4);
}
-void Cpalette::selectColorS(int row)
+void ColorPalette::selectColorS(int row)
{
QString colorName;
QVariant varValue = colorListStroke->data(row, Qt::UserRole);
@@ -643,7 +631,7 @@
emit NewPen(colorName);
}
-void Cpalette::selectColorF(int row)
+void ColorPalette::selectColorF(int row)
{
QString colorName;
QVariant varValue = colorListFill->data(row, Qt::UserRole);
@@ -661,14 +649,14 @@
emit NewBrush(colorName);
}
-void Cpalette::setColors(const ColorList& newColorList)
+void ColorPalette::setColors(const ColorList& newColorList)
{
colorList.clear();
colorList = newColorList;
updateCList();
}
-void Cpalette::fillStrokeSelector(int /*index*/)
+void ColorPalette::fillStrokeSelector(int /*index*/)
{
if (gradEditButton->isChecked() || editMeshColors->isChecked())
{
@@ -703,7 +691,7 @@
updateFromItem();
}*/
-void Cpalette::updateGradientList()
+void ColorPalette::updateGradientList()
{
bool sigBlocked1 = namedGradient->blockSignals(true);
bool sigBlocked2 = namedGradientStroke->blockSignals(true);
@@ -742,13 +730,13 @@
namedGradientStroke->blockSignals(sigBlocked2);
}
-void Cpalette::setGradients(QHash<QString, VGradient> *docGradients)
+void ColorPalette::setGradients(QHash<QString, VGradient> *docGradients)
{
gradientList = docGradients;
updateGradientList();
}
-void Cpalette::setGradientColors()
+void ColorPalette::setGradientColors()
{
QString color1 = colorPoint1->currentText();
if (color1 == CommonStrings::tr_NoneColor)
@@ -777,7 +765,7 @@
currentItem->update();
}
-void Cpalette::setNamedGradient(const QString &name)
+void ColorPalette::setNamedGradient(const QString &name)
{
if (namedGradient->currentIndex() == 0)
{
@@ -808,7 +796,7 @@
emit NewGradient(11);
}
-void Cpalette::setNamedGradientStroke(const QString &name)
+void ColorPalette::setNamedGradientStroke(const QString &name)
{
if (namedGradientStroke->currentIndex() == 0)
{
@@ -828,7 +816,7 @@
emit NewGradientS(7);
}
-void Cpalette::updatePatternList()
+void ColorPalette::updatePatternList()
{
disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
patternBox->clear();
@@ -861,40 +849,40 @@
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
-void Cpalette::hideEditedPatterns(QStringList names)
-{
- for (int a = 0; a < names.count(); a++)
- {
- QList<QListWidgetItem*> items = patternBox->findItems(names[a], Qt::MatchExactly);
+void ColorPalette::hideEditedPatterns(QStringList names)
+{
+ for (int i = 0; i < names.count(); i++)
+ {
+ QList<QListWidgetItem*> items = patternBox->findItems(names[i], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setHidden(true);
- items = patternBoxStroke->findItems(names[a], Qt::MatchExactly);
+ items = patternBoxStroke->findItems(names[i], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setHidden(true);
}
}
-void Cpalette::setPatterns(QHash<QString, ScPattern> *docPatterns)
+void ColorPalette::setPatterns(QHash<QString, ScPattern> *docPatterns)
{
patternList = docPatterns;
updatePatternList();
}
-void Cpalette::selectPattern(QListWidgetItem *c)
+void ColorPalette::selectPattern(QListWidgetItem *c)
{
if (c == nullptr)
return;
emit NewPattern(c->text());
}
-void Cpalette::selectPatternS(QListWidgetItem *c)
+void ColorPalette::selectPatternS(QListWidgetItem *c)
{
if (c == nullptr)
return;
emit NewPatternS(c->text());
}
-void Cpalette::setActPatternStroke(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY, double space, bool pathF)
+void ColorPalette::setActPatternStroke(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY, double space, bool pathF)
{
bool sigBlocked = patternBoxStroke->blockSignals(true);
QList<QListWidgetItem*> itl = patternBoxStroke->findItems(pattern, Qt::MatchExactly);
@@ -919,7 +907,7 @@
patternBoxStroke->blockSignals(sigBlocked);
}
-void Cpalette::setActPattern(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
+void ColorPalette::setActPattern(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
bool sigBlocked = patternBox->blockSignals(true);
QList<QListWidgetItem*> itl = patternBox->findItems(pattern, Qt::MatchExactly);
@@ -942,7 +930,7 @@
patternBox->blockSignals(sigBlocked);
}
-void Cpalette::slotGradStroke(int number)
+void ColorPalette::slotGradStroke(int number)
{
if (number == 1)
{
@@ -980,7 +968,7 @@
strokeModeStack->setCurrentIndex(number);
}
-void Cpalette::showGradient(int number)
+void ColorPalette::showGradient(int number)
{
bool sigBlocked = fillModeCombo->blockSignals(true);
if (number==-1)
@@ -1091,7 +1079,7 @@
fillModeCombo->blockSignals(sigBlocked);
}
-void Cpalette::showGradientStroke(int number)
+void ColorPalette::showGradientStroke(int number)
{
bool sigBlocked = strokeModeCombo->blockSignals(true);
if (number==-1 || number == 0)
@@ -1122,7 +1110,7 @@
strokeModeCombo->blockSignals(sigBlocked);
}
-void Cpalette::slotGrad(int number)
+void ColorPalette::slotGrad(int number)
{
if (number == 1)
{
@@ -1234,7 +1222,7 @@
fillModeStack->setCurrentIndex(number);
}
-void Cpalette::slotGradType(int type)
+void ColorPalette::slotGradType(int type)
{
if (type == 0)
{
@@ -1304,7 +1292,7 @@
}
}
-void Cpalette::slotGradTypeStroke(int type)
+void ColorPalette::slotGradTypeStroke(int type)
{
if (type == 0)
emit NewGradientS(6);
@@ -1312,7 +1300,7 @@
emit NewGradientS(7);
}
-void Cpalette::editMeshPointColor()
+void ColorPalette::editMeshPointColor()
{
if (editMeshColors->isChecked())
{
@@ -1336,7 +1324,7 @@
emit editGradient(editStrokeGradient);
}
-void Cpalette::createNewMeshGradient()
+void ColorPalette::createNewMeshGradient()
{
InsertTable* dia = new InsertTable(this, 255, 255);
dia->setWindowTitle( tr( "Create Mesh" ) );
@@ -1349,21 +1337,21 @@
delete dia;
}
-void Cpalette::resetMeshGradient()
+void ColorPalette::resetMeshGradient()
{
currentItem->resetGradientMesh();
currentItem->update();
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::meshGradientToShape()
+void ColorPalette::meshGradientToShape()
{
currentItem->meshToShape();
currentItem->update();
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::resetOneControlPoint()
+void ColorPalette::resetOneControlPoint()
{
int grow = currentItem->selectedMeshPointX;
int gcol = currentItem->selectedMeshPointY;
@@ -1459,7 +1447,7 @@
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::resetAllControlPoints()
+void ColorPalette::resetAllControlPoints()
{
int grow = currentItem->selectedMeshPointX;
int gcol = currentItem->selectedMeshPointY;
@@ -1548,7 +1536,7 @@
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::editGradientVector()
+void ColorPalette::editGradientVector()
{
if (gradEditButton->isChecked())
{
@@ -1575,7 +1563,7 @@
emit editGradient(editStrokeGradient);
}
-void Cpalette::editGradientVectorStroke()
+void ColorPalette::editGradientVectorStroke()
{
if (gradEditButtonStroke->isChecked())
{
@@ -1592,78 +1580,75 @@
emit editGradient(editStrokeGradient);
}
-void Cpalette::setGradientVectorValues()
-{
- if (gradEditButton->isChecked())
- {
- CGradDia->unitChange(currentDoc->unitIndex());
- CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
- if (currentItem->gradientType() == 6)
- CGradDia->selectLinear();
- else if (currentItem->gradientType() == 7)
- CGradDia->selectRadial();
- else if (currentItem->gradientType() == 9)
- {
- CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), 0, 0);
- CGradDia->selectFourColor();
- }
- else if (currentItem->gradientType() == 10)
- {
- CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), currentItem->GrControl5.x(), currentItem->GrControl5.y());
- CGradDia->selectDiamond();
- }
- else if (currentItem->gradientType() == 11)
- {
- CGradDia->selectMesh();
- editMeshColors->setEnabled(false);
- }
- else if (currentItem->gradientType() == 12)
- {
- CGradDia->selectPatchMesh();
- editMeshColors->setEnabled(false);
- }
- else if (currentItem->gradientType() == 13)
- CGradDia->selectConical();
- }
-}
-
-void Cpalette::setGradientVectorStrokeValues()
-{
- if (gradEditButtonStroke->isChecked())
- {
- CGradDia->unitChange(currentDoc->unitIndex());
- CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0);
- if (currentItem->strokeGradientType() == 6)
- CGradDia->selectLinear();
- else
- CGradDia->selectRadial();
- }
-}
-
-void Cpalette::setActiveGradDia(bool active)
-{
- if (!active)
- {
- if (editStrokeGradient == 1)
- gradEditButtonStroke->setChecked(false);
- else
- gradEditButton->setChecked(false);
- emit editGradient(editStrokeGradient);
- fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked());
- gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked());
- strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked());
- gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked());
- editMeshColors->setEnabled(true);
- }
-}
-
-void Cpalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy)
+void ColorPalette::setGradientVectorValues()
+{
+ if (!gradEditButton->isChecked())
+ return;
+ CGradDia->unitChange(currentDoc->unitIndex());
+ CGradDia->setValues(currentItem->gradientStartX(), currentItem->gradientStartY(), currentItem->gradientEndX(), currentItem->gradientEndY(), currentItem->GrFocalX, currentItem->GrFocalY, currentItem->GrScale, currentItem->GrSkew, 0, 0);
+ if (currentItem->gradientType() == 6)
+ CGradDia->selectLinear();
+ else if (currentItem->gradientType() == 7)
+ CGradDia->selectRadial();
+ else if (currentItem->gradientType() == 9)
+ {
+ CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), 0, 0);
+ CGradDia->selectFourColor();
+ }
+ else if (currentItem->gradientType() == 10)
+ {
+ CGradDia->setValues(currentItem->GrControl1.x(), currentItem->GrControl1.y(), currentItem->GrControl2.x(), currentItem->GrControl2.y(), currentItem->GrControl3.x(), currentItem->GrControl3.y(), currentItem->GrControl4.x(), currentItem->GrControl4.y(), currentItem->GrControl5.x(), currentItem->GrControl5.y());
+ CGradDia->selectDiamond();
+ }
+ else if (currentItem->gradientType() == 11)
+ {
+ CGradDia->selectMesh();
+ editMeshColors->setEnabled(false);
+ }
+ else if (currentItem->gradientType() == 12)
+ {
+ CGradDia->selectPatchMesh();
+ editMeshColors->setEnabled(false);
+ }
+ else if (currentItem->gradientType() == 13)
+ CGradDia->selectConical();
+}
+
+void ColorPalette::setGradientVectorStrokeValues()
+{
+ if (!gradEditButtonStroke->isChecked())
+ return;
+ CGradDia->unitChange(currentDoc->unitIndex());
+ CGradDia->setValues(currentItem->GrStrokeStartX, currentItem->GrStrokeStartY, currentItem->GrStrokeEndX, currentItem->GrStrokeEndY, currentItem->GrStrokeFocalX, currentItem->GrStrokeFocalY, currentItem->GrStrokeScale, currentItem->GrStrokeSkew, 0, 0);
+ if (currentItem->strokeGradientType() == 6)
+ CGradDia->selectLinear();
+ else
+ CGradDia->selectRadial();
+}
+
+void ColorPalette::setActiveGradDia(bool active)
+{
+ if (active)
+ return;
+ if (editStrokeGradient == 1)
+ gradEditButtonStroke->setChecked(false);
+ else
+ gradEditButton->setChecked(false);
+ emit editGradient(editStrokeGradient);
+ fillModeCombo->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked());
+ gradientType->setEnabled(!gradEditButton->isChecked() && !editMeshColors->isChecked());
+ strokeModeCombo->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked());
+ gradientTypeStroke->setEnabled(!gradEditButtonStroke->isChecked() && !editMeshColors->isChecked());
+ editMeshColors->setEnabled(true);
+}
+
+void ColorPalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy)
{
if (CGradDia)
CGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk, cx, cy);
}
-void Cpalette::setMeshPoint()
+void ColorPalette::setMeshPoint()
{
if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > -1))
{
@@ -1683,17 +1668,17 @@
}
}
-void Cpalette::endPatchAdd()
+void ColorPalette::endPatchAdd()
{
CGradDia->endPAddButton();
}
-void Cpalette::snapToPatchGrid(bool val)
+void ColorPalette::snapToPatchGrid(bool val)
{
currentItem->setSnapToPatchGrid(val);
}
-void Cpalette::handleRemovePatch()
+void ColorPalette::handleRemovePatch()
{
if ((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1))
{
@@ -1714,7 +1699,7 @@
}
}
-void Cpalette::updateMeshPoint()
+void ColorPalette::updateMeshPoint()
{
QString color = colorMeshPoint->currentText();
if (color == CommonStrings::tr_NoneColor)
@@ -1725,7 +1710,7 @@
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::setMeshPatchPoint()
+void ColorPalette::setMeshPatchPoint()
{
if ((currentItem->selectedMeshPointX > -1) && (currentItem->selectedMeshPointY > 0))
{
@@ -1761,12 +1746,12 @@
}
}
-void Cpalette::setMeshPatch()
+void ColorPalette::setMeshPatch()
{
CGradDia->changebuttonRemovePatch((currentItem->selectedMeshPointX > -1) && (currentItem->meshGradientPatches.count() > 1));
}
-void Cpalette::changePatternProps()
+void ColorPalette::changePatternProps()
{
PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false);
dia->spinXscaling->setValue(m_Pattern_scaleX);
@@ -1821,7 +1806,7 @@
emit NewGradient(8);
}
-void Cpalette::changePatternPropsStroke()
+void ColorPalette::changePatternPropsStroke()
{
PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, true);
dia->spinXscaling->setValue(m_Pattern_scaleXS);
@@ -1876,7 +1861,7 @@
delete dia;
}
-void Cpalette::changeHatchProps()
+void ColorPalette::changeHatchProps()
{
QString color1 = hatchLineColor->currentText();
if (color1 == CommonStrings::tr_NoneColor)
@@ -1892,12 +1877,12 @@
currentDoc->regionsChanged()->update(QRect());
}
-void Cpalette::toggleStrokePattern()
+void ColorPalette::toggleStrokePattern()
{
emit NewPatternTypeS(followsPath->isChecked());
}
-void Cpalette::unitChange(double, double, int unitIndex)
+void ColorPalette::unitChange(double, double, int unitIndex)
{
if (CGradDia)
CGradDia->unitChange(unitIndex);
@@ -1905,7 +1890,7 @@
currentUnit = unitIndex;
}
-void Cpalette::languageChange()
+void ColorPalette::languageChange()
{
// Needed to avoid issues if an item is selected and patterns are available
if (currentItem)
Modified: trunk/Scribus/scribus/ui/cpalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/cpalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/cpalette.h (original)
+++ trunk/Scribus/scribus/ui/cpalette.h Fri Aug 16 15:35:31 2019
@@ -48,15 +48,15 @@
*@author Franz Schmid
*/
-class SCRIBUS_API Cpalette : public QWidget, Ui::colorPalette
+class SCRIBUS_API ColorPalette : public QWidget, Ui::colorPalette
{
Q_OBJECT
friend class PropertiesPalette;
public:
- Cpalette(QWidget* parent);
- ~Cpalette() {};
+ ColorPalette(QWidget* parent);
+ ~ColorPalette() = default;
void setDocument(ScribusDoc* doc);
@@ -69,7 +69,7 @@
private:
PageItem* currentItemFromSelection();
- UndoManager * undoManager;
+ UndoManager* undoManager {nullptr};
public slots:
@@ -145,33 +145,33 @@
void editGradient(int);
protected:
- GradientVectorDialog* CGradDia;
+ ColorList colorList;
+ GradientVectorDialog* CGradDia {nullptr};
+ PageItem* currentItem {nullptr};
+ QHash<QString, ScPattern> *patternList {nullptr};
+ QHash<QString, VGradient> *gradientList {nullptr};
QPointer<ScribusDoc> currentDoc;
- PageItem* currentItem;
- ColorList colorList;
- 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;
- double m_Pattern_scaleXS;
- double m_Pattern_scaleYS;
- double m_Pattern_offsetXS;
- double m_Pattern_offsetYS;
- double m_Pattern_rotationS;
- double m_Pattern_skewXS;
- double m_Pattern_skewYS;
- double m_Pattern_spaceS;
- bool m_Pattern_mirrorXS;
- bool m_Pattern_mirrorYS;
- int currentUnit;
- int editStrokeGradient;
+ bool m_Pattern_mirrorX {false};
+ bool m_Pattern_mirrorXS {false};
+ bool m_Pattern_mirrorY {false};
+ bool m_Pattern_mirrorYS {false};
+ double m_Pattern_offsetX {0.0};
+ double m_Pattern_offsetXS {0.0};
+ double m_Pattern_offsetY {0.0};
+ double m_Pattern_offsetYS {0.0};
+ double m_Pattern_rotation {0.0};
+ double m_Pattern_rotationS {0.0};
+ double m_Pattern_scaleX {0.0};
+ double m_Pattern_scaleXS {0.0};
+ double m_Pattern_scaleY {0.0};
+ double m_Pattern_scaleYS {0.0};
+ double m_Pattern_skewX {0.0};
+ double m_Pattern_skewXS {0.0};
+ double m_Pattern_skewY {0.0};
+ double m_Pattern_skewYS {0.0};
+ double m_Pattern_spaceS {0.0};
+ int currentUnit {0};
+ int editStrokeGradient {0};
void connectSignals();
void disconnectSignals();
@@ -182,7 +182,7 @@
void setGradientVectorValues();
void setGradientVectorStrokeValues();
- int m_blockUpdates;
+ int m_blockUpdates {0};
void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; }
bool updatesBlocked() { return (m_blockUpdates > 0); }
Modified: trunk/Scribus/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/propertiespalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.cpp Fri Aug 16 15:35:31 2019
@@ -60,11 +60,6 @@
PropertiesPalette::PropertiesPalette( QWidget* parent) : ScDockPalette( parent, "PropertiesPalette", nullptr)
{
undoManager = UndoManager::instance();
- m_ScMW=nullptr;
- m_doc=nullptr;
- m_haveDoc = false;
- m_haveItem = false;
- m_unitRatio = 1.0;
setObjectName(QString::fromLocal8Bit("PropertiesPalette"));
setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
@@ -95,11 +90,11 @@
linePal = new PropertiesPalette_Line(this);
idLineItem=TabStack->addItem( linePal, "&Line" );
- Cpal = new Cpalette(this);
- idColorsItem = TabStack->addItem(Cpal, "&Colors" );
-
- Tpal = new Tpalette(this);
- idTransparencyItem = TabStack->addItem(Tpal, "&Transparency" );
+ colorPalette = new ColorPalette(this);
+ idColorsItem = TabStack->addItem(colorPalette, "&Colors" );
+
+ transparencyPalette = new TransparencyPalette(this);
+ idTransparencyItem = TabStack->addItem(transparencyPalette, "&Transparency" );
tablePal = new PropertiesPalette_Table(this);
idTableItem = TabStack->addItem(tablePal, "T&able" );
@@ -109,16 +104,14 @@
languageChange();
connect(linePal, SIGNAL(lineModeChanged(int)), this, SLOT(NewLineMode(int)));
-
connect(groupPal, SIGNAL(shapeChanged(int)) , this, SLOT(handleNewShape(int)));
connect(groupPal, SIGNAL(shapeEditStarted()), this, SLOT(handleShapeEdit()));
-
connect(TabStack, SIGNAL(currentChanged2(int)), this, SLOT(SelTab(int)));
- connect(Cpal, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(NewSpGradient(double,double,double,double,double,double,double,double,double,double )));
- connect(Cpal, SIGNAL(editGradient(int)), this, SLOT(toggleGradientEdit(int)));
- connect(Tpal, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(NewSpGradientM(double,double,double,double,double,double,double,double )));
- connect(Tpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
+ connect(colorPalette, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(NewSpGradient(double,double,double,double,double,double,double,double,double,double )));
+ connect(colorPalette, SIGNAL(editGradient(int)), this, SLOT(toggleGradientEdit(int)));
+ connect(transparencyPalette, SIGNAL(NewSpecial(double,double,double,double,double,double,double,double,double,double)), this, SLOT(NewSpGradientM(double,double,double,double,double,double,double,double )));
+ connect(transparencyPalette, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
m_haveItem = false;
for (int i = 1; i < 10; ++i)
@@ -132,13 +125,10 @@
{
if (m_ScMW && !m_ScMW->scriptIsRunning())
{
- if ((m_haveDoc) && (m_haveItem))
- {
- if (Cpal->gradEditButton->isChecked())
- {
- m_ScMW->view->requestMode(modeNormal);
- m_ScMW->view->RefreshGradient(m_item);
- }
+ if (m_haveDoc && m_haveItem && colorPalette->gradEditButton->isChecked())
+ {
+ m_ScMW->view->requestMode(modeNormal);
+ m_ScMW->view->RefreshGradient(m_item);
}
}
ScDockPalette::closeEvent(closeEvent);
@@ -167,7 +157,7 @@
//connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
//connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
- connect(this->Tpal, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged()));
+ connect(this->transparencyPalette, SIGNAL(gradientChanged()), this, SLOT(handleGradientChanged()));
connect(m_ScMW->appModeHelper, SIGNAL(AppModeChanged(int,int)), this, SLOT(AppModeChanged()));
}
@@ -212,16 +202,16 @@
if (m_doc)
{
disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged()));
}
m_doc = d;
m_item = nullptr;
setEnabled(!m_doc->drawAsPreview);
- Cpal->setDocument(m_doc);
- Cpal->setCurrentItem(nullptr);
- Tpal->setDocument(m_doc);
- Tpal->setCurrentItem(nullptr);
+ colorPalette->setDocument(m_doc);
+ colorPalette->setCurrentItem(nullptr);
+ transparencyPalette->setDocument(m_doc);
+ transparencyPalette->setCurrentItem(nullptr);
m_unitRatio = m_doc->unitRatio();
m_unitIndex = m_doc->unitIndex();
@@ -239,7 +229,7 @@
updateColorList();
connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ connect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged()));
// Handle properties update when switching document
handleSelectionChanged();
@@ -250,7 +240,7 @@
if (m_doc)
{
disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
- disconnect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ disconnect(m_doc, SIGNAL(docChanged()), this, SLOT(handleSelectionChanged()));
}
setEnabled(true);
m_haveDoc = false;
@@ -273,10 +263,10 @@
tablePal->unsetItem();
tablePal->unsetDocument();
- Cpal->setCurrentItem(nullptr);
- Cpal->setDocument(nullptr);
- Tpal->setCurrentItem(nullptr);
- Tpal->setDocument(nullptr);
+ colorPalette->setCurrentItem(nullptr);
+ colorPalette->setDocument(nullptr);
+ transparencyPalette->setCurrentItem(nullptr);
+ transparencyPalette->setDocument(nullptr);
m_haveItem = false;
for (int ws = 1; ws < 10; ++ws)
@@ -288,9 +278,9 @@
void PropertiesPalette::unsetItem()
{
m_haveItem = false;
- m_item = nullptr;
- Cpal->setCurrentItem(nullptr);
- Tpal->setCurrentItem(nullptr);
+ m_item = nullptr;
+ colorPalette->setCurrentItem(nullptr);
+ transparencyPalette->setCurrentItem(nullptr);
imagePal->unsetItem();
tablePal->unsetItem();
shapePal->unsetItem();
@@ -381,8 +371,7 @@
m_item = i;
tablePal->setItem(m_item);
-
- Tpal->setCurrentItem(m_item);
+ transparencyPalette->setCurrentItem(m_item);
setTextFlowMode(m_item->textFlowMode());
@@ -423,7 +412,7 @@
imagePal->handleSelectionChanged();
linePal->handleSelectionChanged();
tablePal->handleSelectionChanged();
- Cpal->handleSelectionChanged();
+ colorPalette->handleSelectionChanged();
}
if (m_item->asOSGFrame())
@@ -498,7 +487,7 @@
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(false);
TabStack->setItemEnabled(idXYZItem, false);
- Cpal->showGradient(0);
+ colorPalette->showGradient(0);
break;
case PageItem::ImageFrame:
case PageItem::LatexFrame:
@@ -609,8 +598,8 @@
imagePal->unitChange();
linePal->unitChange();
- Cpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
- Tpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
+ colorPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
+ transparencyPalette->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
m_haveItem = tmp;
}
@@ -749,14 +738,14 @@
m_ScMW->view->editStrokeGradient = stroke;
if (stroke == 1)
{
- if (Cpal->gradEditButtonStroke->isChecked())
+ if (colorPalette->gradEditButtonStroke->isChecked())
m_ScMW->view->requestMode(modeEditGradientVectors);
else
m_ScMW->view->requestMode(modeNormal);
}
else
{
- if ((Cpal->gradEditButton->isChecked()) || (Cpal->editMeshColors->isChecked()))
+ if ((colorPalette->gradEditButton->isChecked()) || (colorPalette->editMeshColors->isChecked()))
{
if ((stroke == 5) || (stroke == 6) || (stroke == 7))
m_ScMW->view->requestMode(modeEditMeshGradient);
@@ -823,7 +812,7 @@
if ((m_haveDoc) && (m_haveItem))
{
m_ScMW->view->editStrokeGradient = 2;
- if (Tpal->gradEditButton->isChecked())
+ if (transparencyPalette->gradEditButton->isChecked())
m_ScMW->view->requestMode(modeEditGradientVectors);
else
m_ScMW->view->requestMode(modeNormal);
@@ -837,8 +826,8 @@
groupPal->updateColorList();
tablePal->updateColorList();
- Cpal->updateColorList();
- Tpal->updateColorList();
+ colorPalette->updateColorList();
+ transparencyPalette->updateColorList();
shadowPal->updateColorList();
assert (m_doc->PageColors.document());
@@ -881,19 +870,19 @@
shapePal->languageChange();
groupPal->languageChange();
imagePal->languageChange();
- Cpal->languageChange();
+ colorPalette->languageChange();
linePal->languageChange();
tablePal->languageChange();
}
void PropertiesPalette::setGradientEditMode(bool on)
{
- Cpal->gradEditButton->setChecked(on);
+ colorPalette->gradEditButton->setChecked(on);
}
void PropertiesPalette::endPatchAdd()
{
- Cpal->endPatchAdd();
+ colorPalette->endPatchAdd();
}
void PropertiesPalette::updateColorSpecialGradient()
@@ -909,21 +898,21 @@
if (currItem)
{
if (m_ScMW->view->editStrokeGradient == 0)
- Cpal->setSpecialGradient(currItem->GrStartX, currItem->GrStartY, currItem->GrEndX, currItem->GrEndY, currItem->GrFocalX, currItem->GrFocalY, currItem->GrScale, currItem->GrSkew, 0, 0);
+ colorPalette->setSpecialGradient(currItem->GrStartX, currItem->GrStartY, currItem->GrEndX, currItem->GrEndY, currItem->GrFocalX, currItem->GrFocalY, currItem->GrScale, currItem->GrSkew, 0, 0);
else if (m_ScMW->view->editStrokeGradient == 1)
- Cpal->setSpecialGradient(currItem->GrStrokeStartX, currItem->GrStrokeStartY, currItem->GrStrokeEndX, currItem->GrStrokeEndY, currItem->GrStrokeFocalX, currItem->GrStrokeFocalY, currItem->GrStrokeScale, currItem->GrStrokeSkew, 0, 0);
+ colorPalette->setSpecialGradient(currItem->GrStrokeStartX, currItem->GrStrokeStartY, currItem->GrStrokeEndX, currItem->GrStrokeEndY, currItem->GrStrokeFocalX, currItem->GrStrokeFocalY, currItem->GrStrokeScale, currItem->GrStrokeSkew, 0, 0);
else if (m_ScMW->view->editStrokeGradient == 3)
- Cpal->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), 0, 0);
+ colorPalette->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), 0, 0);
else if (m_ScMW->view->editStrokeGradient == 4)
- Cpal->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), currItem->GrControl5.x(), currItem->GrControl5.y());
+ colorPalette->setSpecialGradient(currItem->GrControl1.x(), currItem->GrControl1.y(), currItem->GrControl2.x(), currItem->GrControl2.y(), currItem->GrControl3.x(), currItem->GrControl3.y(), currItem->GrControl4.x(), currItem->GrControl4.y(), currItem->GrControl5.x(), currItem->GrControl5.y());
else if ((m_ScMW->view->editStrokeGradient == 5) || (m_ScMW->view->editStrokeGradient == 6))
- Cpal->setMeshPoint();
+ colorPalette->setMeshPoint();
else if (m_ScMW->view->editStrokeGradient == 8)
- Cpal->setMeshPatchPoint();
+ colorPalette->setMeshPatchPoint();
else if (m_ScMW->view->editStrokeGradient == 9)
- Cpal->setMeshPatch();
+ colorPalette->setMeshPatch();
else if (!currItem->isGroup())
- Tpal->setSpecialGradient(currItem->GrMaskStartX, currItem->GrMaskStartY, currItem->GrMaskEndX, currItem->GrMaskEndY, currItem->GrMaskFocalX, currItem->GrMaskFocalY, currItem->GrMaskScale, currItem->GrMaskSkew);
+ transparencyPalette->setSpecialGradient(currItem->GrMaskStartX, currItem->GrMaskStartY, currItem->GrMaskEndX, currItem->GrMaskEndY, currItem->GrMaskFocalX, currItem->GrMaskFocalY, currItem->GrMaskScale, currItem->GrMaskSkew);
}
}
@@ -946,7 +935,7 @@
return;
if ((m_haveDoc) && (m_haveItem))
{
- VGradient vg(Tpal->gradEdit->gradient());
+ VGradient vg(transparencyPalette->gradEdit->gradient());
m_doc->itemSelection_SetMaskGradient(vg);
}
}
Modified: trunk/Scribus/scribus/ui/propertiespalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/propertiespalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette.h (original)
+++ trunk/Scribus/scribus/ui/propertiespalette.h Fri Aug 16 15:35:31 2019
@@ -31,7 +31,7 @@
#include "sctreewidget.h"
class ColorCombo;
-class Cpalette;
+class ColorPalette;
class NameWidget;
class PropertiesPalette_Group;
class PropertiesPalette_Image;
@@ -45,7 +45,7 @@
class ScribusMainWindow;
class Selection;
class UndoManager;
-class Tpalette;
+class TransparencyPalette;
class SCRIBUS_API PropertiesPalette : public ScDockPalette
{
@@ -70,18 +70,17 @@
// and if in ScribusView a groupTransaction has been started it must be also
// commmited
- PropertiesPalette_Group* groupPal;
- PropertiesPalette_Image* imagePal;
- PropertiesPalette_Line* linePal;
- PropertiesPalette_Shadow* shadowPal;
- PropertiesPalette_Shape* shapePal;
- PropertiesPalette_Table* tablePal;
- PropertiesPalette_XYZ* xyzPal;
- Cpalette *Cpal;
- Tpalette *Tpal;
+ PropertiesPalette_Group* groupPal {nullptr};
+ PropertiesPalette_Image* imagePal {nullptr};
+ PropertiesPalette_Line* linePal {nullptr};
+ PropertiesPalette_Shadow* shadowPal {nullptr};
+ PropertiesPalette_Shape* shapePal {nullptr};
+ PropertiesPalette_Table* tablePal {nullptr};
+ PropertiesPalette_XYZ* xyzPal {nullptr};
+ ColorPalette *colorPalette {nullptr};
+ TransparencyPalette *transparencyPalette {nullptr};
private:
-
PageItem* currentItemFromSelection();
public slots:
@@ -113,28 +112,27 @@
void handleShapeEdit();
protected:
- ScribusMainWindow *m_ScMW;
- ScTreeWidget* TabStack;
+ ScribusMainWindow *m_ScMW {nullptr};
+ ScTreeWidget* TabStack {nullptr};
- bool m_haveDoc;
- bool m_haveItem;
- double m_unitRatio;
- int m_unitIndex;
- PageItem* m_item;
- UndoManager *undoManager;
+ bool m_haveDoc {false};
+ bool m_haveItem {false};
+ double m_unitRatio {1.0};
+ int m_unitIndex {0};
+ PageItem* m_item {nullptr};
+ UndoManager *undoManager {nullptr};
ScGuardedPtr<ScribusDoc> m_doc;
-
-
- int idXYZItem;
- int idShapeItem;
- int idTableItem;
- int idImageItem;
- int idLineItem;
- int idColorsItem;
- int idTransparencyItem;
- int idGroupItem;
- int idShadowItem;
+
+ int idXYZItem {0};
+ int idShapeItem {0};
+ int idTableItem {0};
+ int idImageItem {0};
+ int idLineItem {0};
+ int idColorsItem {0};
+ int idTransparencyItem {0};
+ int idGroupItem {0};
+ int idShadowItem {0};
};
#endif
Modified: trunk/Scribus/scribus/ui/transparencypalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/transparencypalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/transparencypalette.cpp (original)
+++ trunk/Scribus/scribus/ui/transparencypalette.cpp Fri Aug 16 15:35:31 2019
@@ -30,11 +30,8 @@
#include "util.h"
#include "util_math.h"
-Tpalette::Tpalette(QWidget* parent) : QWidget(parent)
-{
- currentItem = nullptr;
- patternList = nullptr;
- TGradDia = nullptr;
+TransparencyPalette::TransparencyPalette(QWidget* parent) : QWidget(parent)
+{
TGradDia = new GradientVectorDialog(this->parentWidget());
TGradDia->hide();
setupUi(this);
@@ -44,6 +41,7 @@
strokeOpacity->setDecimals(0);
fillOpacity->setDecimals(0);
editFillSelectorButton();
+
connect(editLineSelector, SIGNAL(clicked()), this, SLOT(editLineSelectorButton()));
connect(editFillSelector, SIGNAL(clicked()), this, SLOT(editFillSelectorButton()));
connect(strokeOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransS(double)));
@@ -64,7 +62,7 @@
connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
}
-void Tpalette::connectSignals()
+void TransparencyPalette::connectSignals()
{
connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
@@ -75,7 +73,7 @@
connect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
}
-void Tpalette::disconnectSignals()
+void TransparencyPalette::disconnectSignals()
{
disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
@@ -86,7 +84,7 @@
disconnect(usePatternInverted, SIGNAL(clicked()), this, SLOT(switchPatternMode()));
}
-void Tpalette::setCurrentItem(PageItem* item)
+void TransparencyPalette::setCurrentItem(PageItem* item)
{
currentItem = item;
disconnectSignals();
@@ -113,7 +111,7 @@
tabWidget->setCurrentIndex(1);
else
tabWidget->setCurrentIndex(2);
- if (patternList->count() == 0)
+ if (patternList->isEmpty())
tabWidget->setTabEnabled(2, false);
else
tabWidget->setTabEnabled(2, true);
@@ -141,7 +139,7 @@
connectSignals();
}
-void Tpalette::setDocument(ScribusDoc* doc)
+void TransparencyPalette::setDocument(ScribusDoc* doc)
{
this->disconnect(SIGNAL(NewTrans(double)));
this->disconnect(SIGNAL(NewTransS(double)));
@@ -176,13 +174,13 @@
}
}
-void Tpalette::handleUpdateRequest(int updateFlags)
+void TransparencyPalette::handleUpdateRequest(int updateFlags)
{
if (updateFlags & reqColorsUpdate)
updateColorList();
}
-void Tpalette::updateColorList()
+void TransparencyPalette::updateColorList()
{
if (!currentDoc)
return;
@@ -198,7 +196,7 @@
setCurrentItem(currentItem);
}
-void Tpalette::hideSelectionButtons()
+void TransparencyPalette::hideSelectionButtons()
{
editLineSelector->hide();
editLineSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
@@ -206,17 +204,17 @@
editFillSelector->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
}
-void Tpalette::updateFromItem()
+void TransparencyPalette::updateFromItem()
{
setCurrentItem(currentItem);
}
-void Tpalette::updateCList()
+void TransparencyPalette::updateCList()
{
gradEdit->setColors(colorList);
}
-void Tpalette::updateGradientList()
+void TransparencyPalette::updateGradientList()
{
disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
namedGradient->clear();
@@ -224,9 +222,9 @@
namedGradient->addItem( tr("Custom"));
QStringList patK = gradientList->keys();
qSort(patK);
- for (int a = 0; a < patK.count(); a++)
- {
- VGradient gr = gradientList->value(patK[a]);
+ for (int i = 0; i < patK.count(); i++)
+ {
+ VGradient gr = gradientList->value(patK[i]);
QImage pixm(48, 12, QImage::Format_ARGB32_Premultiplied);
QPainter pb;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
@@ -243,25 +241,25 @@
delete p;
QPixmap pm;
pm = QPixmap::fromImage(pixm);
- namedGradient->addItem(pm, patK[a]);
+ namedGradient->addItem(pm, patK[i]);
}
connect(namedGradient, SIGNAL(activated(const QString&)), this, SLOT(setNamedGradient(const QString&)));
}
-void Tpalette::setGradients(QHash<QString, VGradient> *docGradients)
+void TransparencyPalette::setGradients(QHash<QString, VGradient> *docGradients)
{
gradientList = docGradients;
updateGradientList();
}
-void Tpalette::setColors(const ColorList& newColorList)
+void TransparencyPalette::setColors(const ColorList& newColorList)
{
colorList.clear();
colorList = newColorList;
updateCList();
}
-void Tpalette::slotGrad(int number)
+void TransparencyPalette::slotGrad(int number)
{
if (number == 1)
{
@@ -315,7 +313,7 @@
emit NewGradient(0);
}
-void Tpalette::slotGradType(int type)
+void TransparencyPalette::slotGradType(int type)
{
if (type == 0)
{
@@ -333,7 +331,7 @@
}
}
-void Tpalette::setNamedGradient(const QString &name)
+void TransparencyPalette::setNamedGradient(const QString &name)
{
if (namedGradient->currentIndex() == 0)
{
@@ -363,7 +361,7 @@
}
}
-void Tpalette::switchGradientMode()
+void TransparencyPalette::switchGradientMode()
{
if (gradientType->currentIndex() == 0)
{
@@ -381,7 +379,7 @@
}
}
-void Tpalette::switchPatternMode()
+void TransparencyPalette::switchPatternMode()
{
if (transpCalcPattern->isChecked())
{
@@ -399,7 +397,7 @@
}
}
-void Tpalette::editGradientVector()
+void TransparencyPalette::editGradientVector()
{
if (gradEditButton->isChecked())
{
@@ -418,7 +416,7 @@
emit editGradient();
}
-void Tpalette::setActiveGradDia(bool active)
+void TransparencyPalette::setActiveGradDia(bool active)
{
if (!active)
{
@@ -427,13 +425,13 @@
}
}
-void Tpalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
+void TransparencyPalette::setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk)
{
if (TGradDia)
TGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk, 0, 0);
}
-void Tpalette::hideEditedPatterns(QStringList names)
+void TransparencyPalette::hideEditedPatterns(QStringList names)
{
for (int a = 0; a < names.count(); a++)
{
@@ -443,7 +441,7 @@
}
}
-void Tpalette::updatePatternList()
+void TransparencyPalette::updatePatternList()
{
disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
patternBox->clear();
@@ -471,20 +469,20 @@
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
-void Tpalette::setPatterns(QHash<QString, ScPattern> *docPatterns)
+void TransparencyPalette::setPatterns(QHash<QString, ScPattern> *docPatterns)
{
patternList = docPatterns;
updatePatternList();
}
-void Tpalette::selectPattern(QListWidgetItem *c)
+void TransparencyPalette::selectPattern(QListWidgetItem *c)
{
if (c == nullptr)
return;
emit NewPattern(c->text());
}
-void Tpalette::setActPattern(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
+void TransparencyPalette::setActPattern(const QString& pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
{
disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
QList<QListWidgetItem*> itl = patternBox->findItems(pattern, Qt::MatchExactly);
@@ -507,7 +505,7 @@
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
-void Tpalette::changePatternProps()
+void TransparencyPalette::changePatternProps()
{
PatternPropsDialog *dia = new PatternPropsDialog(this, currentUnit, false);
dia->spinXscaling->setValue(m_Pattern_scaleX);
@@ -541,7 +539,7 @@
delete dia;
}
-void Tpalette::setActTrans(double val, double val2)
+void TransparencyPalette::setActTrans(double val, double val2)
{
disconnect(strokeOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransS(double)));
disconnect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double)));
@@ -551,7 +549,7 @@
connect(fillOpacity, SIGNAL(valueChanged(double)), this, SLOT(slotTransF(double)));
}
-void Tpalette::setActBlend(int val, int val2)
+void TransparencyPalette::setActBlend(int val, int val2)
{
disconnect(blendModeFill, SIGNAL(activated(int)), this, SIGNAL(NewBlend(int)));
disconnect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
@@ -561,17 +559,17 @@
connect(blendModeStroke, SIGNAL(activated(int)), this, SIGNAL(NewBlendS(int)));
}
-void Tpalette::slotTransS(double val)
+void TransparencyPalette::slotTransS(double val)
{
emit NewTransS((100 - val) / 100.0);
}
-void Tpalette::slotTransF(double val)
+void TransparencyPalette::slotTransF(double val)
{
emit NewTrans((100 - val) / 100.0);
}
-void Tpalette::editLineSelectorButton()
+void TransparencyPalette::editLineSelectorButton()
{
if (editLineSelector->isChecked())
{
@@ -581,7 +579,7 @@
updateFromItem();
}
-void Tpalette::editFillSelectorButton()
+void TransparencyPalette::editFillSelectorButton()
{
if (editFillSelector->isChecked())
{
@@ -591,7 +589,7 @@
updateFromItem();
}
-void Tpalette::unitChange(double, double, int unitIndex)
+void TransparencyPalette::unitChange(double, double, int unitIndex)
{
if (TGradDia)
TGradDia->unitChange(unitIndex);
Modified: trunk/Scribus/scribus/ui/transparencypalette.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23133&path=/trunk/Scribus/scribus/ui/transparencypalette.h
==============================================================================
--- trunk/Scribus/scribus/ui/transparencypalette.h (original)
+++ trunk/Scribus/scribus/ui/transparencypalette.h Fri Aug 16 15:35:31 2019
@@ -48,7 +48,7 @@
*@author Franz Schmid
*/
-class SCRIBUS_API Tpalette : public QWidget, Ui::transparencyPalette
+class SCRIBUS_API TransparencyPalette : public QWidget, Ui::transparencyPalette
{
Q_OBJECT
@@ -56,8 +56,8 @@
friend class PropertiesPalette_Group;
public:
- Tpalette(QWidget* parent);
- ~Tpalette() {};
+ TransparencyPalette(QWidget* parent);
+ ~TransparencyPalette() = default;
void setDocument(ScribusDoc* doc);
void setCurrentItem(PageItem* item);
@@ -106,26 +106,25 @@
void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
protected:
- GradientVectorDialog* TGradDia;
+ GradientVectorDialog* TGradDia {nullptr};
QPointer<ScribusDoc> currentDoc;
- PageItem* currentItem;
+ PageItem* currentItem {nullptr};
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;
+ int currentUnit {0};
+ QHash<QString, ScPattern> *patternList {nullptr};
+ QHash<QString, VGradient> *gradientList {nullptr};
+ double m_Pattern_scaleX {0.0};
+ double m_Pattern_scaleY {0.0};
+ double m_Pattern_offsetX {0.0};
+ double m_Pattern_offsetY {0.0};
+ double m_Pattern_rotation {0.0};
+ double m_Pattern_skewX {0.0};
+ double m_Pattern_skewY {0.0};
+ bool m_Pattern_mirrorX {false};
+ bool m_Pattern_mirrorY {false};
void connectSignals();
void disconnectSignals();
-
void updateCList();
void updateGradientList();
void updatePatternList();
More information about the scribus-commit
mailing list