r15840 by jghali - - make color palette work again or almost
scribus-commit
scribus-commit at lists.scribus.net
Fri Nov 12 00:48:47 CET 2010
Author: jghali
Date: Thu Nov 11 23:48:47 2010
New Revision: 15840
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15840
Log:
- make color palette work again or almost
- some refactoring
Modified:
branches/ScribusOIF/scribus/pageitem.cpp
branches/ScribusOIF/scribus/scribus.cpp
branches/ScribusOIF/scribus/ui/cpalette.cpp
branches/ScribusOIF/scribus/ui/cpalette.h
branches/ScribusOIF/scribus/ui/gradienteditor.cpp
branches/ScribusOIF/scribus/ui/gradienteditor.h
branches/ScribusOIF/scribus/ui/propertiespalette.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
branches/ScribusOIF/scribus/ui/transparencypalette.cpp
branches/ScribusOIF/scribus/ui/transparencypalette.h
Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Thu Nov 11 23:48:47 2010
@@ -6794,7 +6794,7 @@
if (!m_Doc->m_Selection->primarySelectionIs(this))
return false;
PropertiesPalette* pp=m_Doc->scMW()->propertiesPalette;
- connect(this, SIGNAL(myself(PageItem *)), pp, SLOT(setCurrentItem(PageItem *)));
+ //connect(this, SIGNAL(myself(PageItem *)), pp, SLOT(setCurrentItem(PageItem *)));
connect(this, SIGNAL(frameType(int)), m_Doc->scMW(), SLOT(HaveNewSel(int)));
connect(this, SIGNAL(frameType(int)), m_Doc->view(), SLOT(selectionChanged()));
//connect(this, SIGNAL(frameType(int)), pp, SLOT(handleSelectionChanged()));
Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Thu Nov 11 23:48:47 2010
@@ -481,7 +481,7 @@
connect( propertiesPalette, SIGNAL(paletteShown(bool)), scrActions["toolsProperties"], SLOT(setChecked(bool)));
//CB dont need this until we have a doc...
- //propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
+ //propertiesPalette->Cpal->setColors(prefsManager->colorSet());
propertiesPalette->textPal->Fonts->RebuildList(0);
propertiesPalette->installEventFilter(this);
nodePalette = new NodePalette(this);
@@ -2204,7 +2204,7 @@
updateActiveWindowCaption(doc->DocName);
// scrActions["shade100"]->setChecked(true);
propertiesPalette->setDoc(doc);
- propertiesPalette->Cpal->ChooseGrad(0);
+ //propertiesPalette->Cpal->displayGradient(0);
pagePalette->setView(view);
propertiesPalette->textPal->Fonts->RebuildList(doc);
layerPalette->setDoc(doc);
@@ -2398,7 +2398,7 @@
// scrActions["shade100"]->setChecked(true);
propertiesPalette->setDoc(doc);
symbolPalette->setDoc(doc);
- propertiesPalette->Cpal->ChooseGrad(0);
+// propertiesPalette->Cpal->displayGradient(0);
// propertiesPalette->updateColorList();
pagePalette->setView(view);
layerPalette->setDoc(doc);
@@ -2426,13 +2426,13 @@
connect(view, SIGNAL(ItemGeom()), propertiesPalette->xyzPal, SLOT(handleSelectionChanged()), Qt::UniqueConnection);
connect(view, SIGNAL(ChBMText(PageItem *)), this, SLOT(BookMarkTxT(PageItem *)), Qt::UniqueConnection);
connect(view, SIGNAL(HaveSel(int)), this, SLOT(HaveNewSel(int)), Qt::UniqueConnection);
- connect(view, SIGNAL(SetAngle(double)), propertiesPalette, SLOT(setR(double)), Qt::UniqueConnection);
- connect(view, SIGNAL(SetSizeValue(double)), propertiesPalette, SLOT(setLineWidth(double)), Qt::UniqueConnection);
- connect(view, SIGNAL(SetLocalValues(double, double, double, double)), propertiesPalette, SLOT(setScaleAndOffset(double, double, double, double)), Qt::UniqueConnection);
- connect(view, SIGNAL(SetLineArt(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), propertiesPalette, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), Qt::UniqueConnection);
- connect(view, SIGNAL(ItemTextAttr(double)), propertiesPalette, SLOT(setLsp(double)), Qt::UniqueConnection);
+// connect(view, SIGNAL(SetAngle(double)), propertiesPalette, SLOT(setR(double)), Qt::UniqueConnection);
+// connect(view, SIGNAL(SetSizeValue(double)), propertiesPalette, SLOT(setLineWidth(double)), Qt::UniqueConnection);
+// connect(view, SIGNAL(SetLocalValues(double, double, double, double)), propertiesPalette, SLOT(setScaleAndOffset(double, double, double, double)), Qt::UniqueConnection);
+// connect(view, SIGNAL(SetLineArt(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), propertiesPalette, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), Qt::UniqueConnection);
+// connect(view, SIGNAL(ItemTextAttr(double)), propertiesPalette, SLOT(setLsp(double)), Qt::UniqueConnection);
// connect(view, SIGNAL(ItemTextCols(int, double)), propertiesPalette, SLOT(setCols(int, double)), Qt::UniqueConnection);
- connect(view, SIGNAL(SetDistValues(double, double, double, double)), propertiesPalette, SLOT(setTextToFrameDistances(double, double, double, double)), Qt::UniqueConnection);
+// connect(view, SIGNAL(SetDistValues(double, double, double, double)), propertiesPalette, SLOT(setTextToFrameDistances(double, double, double, double)), Qt::UniqueConnection);
//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)), Qt::UniqueConnection);
// connect(view, SIGNAL(Amode(int)), this, SLOT(setAppMode(int)), Qt::UniqueConnection);
connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()), Qt::UniqueConnection);
@@ -2441,7 +2441,7 @@
connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setStatusBarMousePosition(double, double)), Qt::UniqueConnection);
//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)), Qt::UniqueConnection);
connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), propertiesPalette->textPal, SLOT(updateCharStyle(const CharStyle&)), Qt::UniqueConnection);
- connect(view, SIGNAL(ItemTextEffects(int)), propertiesPalette, SLOT(setStil(int)), Qt::UniqueConnection);
+// connect(view, SIGNAL(ItemTextEffects(int)), propertiesPalette, SLOT(setStil(int)), Qt::UniqueConnection);
connect(view, SIGNAL(ItemTextEffects(int)), this, SLOT(setStyleEffects(int)), Qt::UniqueConnection);
connect(view, SIGNAL(ItemTextAlign(int)) , this, SLOT(setAlignmentValue(int)), Qt::UniqueConnection);
connect(view, SIGNAL(HasTextSel()), this, SLOT(EnableTxEdit()), Qt::UniqueConnection);
@@ -2457,7 +2457,7 @@
connect(view, SIGNAL(DelBM(PageItem *)), this, SLOT(DelBookMark(PageItem *)), Qt::UniqueConnection);
connect(view, SIGNAL(DoGroup()), this, SLOT(GroupObj()), Qt::UniqueConnection);
// connect(view, SIGNAL(EndNodeEdit()), this, SLOT(ToggleFrameEdit()), Qt::UniqueConnection);
- connect(view, SIGNAL(LevelChanged(uint )), propertiesPalette, SLOT(setLevel(uint)), Qt::UniqueConnection);
+// connect(view, SIGNAL(LevelChanged(uint )), propertiesPalette, SLOT(setLevel(uint)), Qt::UniqueConnection);
connect(view, SIGNAL(callGimp()), this, SLOT(callImageEditor()), Qt::UniqueConnection);
}
@@ -3843,7 +3843,7 @@
doc->cmsSettings().CMSinUse = false;
}
// propertiesPalette->updateColorList();
-// propertiesPalette->Cpal->ChooseGrad(0);
+// propertiesPalette->Cpal->displayGradient(0);
if (fileLoader->FileType > FORMATID_NATIVEIMPORTEND)
{
doc->setName(FName+ tr("(converted)"));
@@ -3855,7 +3855,7 @@
doc->setMasterPageMode(false);
doc->setHyphLanguage(GetLang(doc->hyphLanguage()));
HaveNewDoc();
-// propertiesPalette->Cpal->ChooseGrad(0);
+// propertiesPalette->Cpal->displayGradient(0);
// propertiesPalette->updateCList();
doc->hasName = true;
if (doc->MasterPages.count() == 0)
@@ -4527,8 +4527,7 @@
scrActions["toolsPDFAnnot3D"]->setEnabled(false);
#endif
//CB dont need this until we have a doc...
- //propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
- propertiesPalette->Cpal->ChooseGrad(0);
+ //propertiesPalette->Cpal->setColors(prefsManager->colorSet());
mainWindowStatusLabel->setText( tr("Ready"));
PrinterUsed = false;
}
@@ -9921,7 +9920,7 @@
// Update tools colors if needed
prefsManager->replaceToolColors(dia->replaceColorMap);
prefsManager->setColorSet(dia->m_colorList);
- propertiesPalette->Cpal->SetColors(prefsManager->colorSet());
+ propertiesPalette->Cpal->setColors(prefsManager->colorSet());
prefsManager->appPrefs.defaultGradients = dia->dialogGradients;
prefsManager->setColorSetName(dia->getColorSetName());
}
Modified: branches/ScribusOIF/scribus/ui/cpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/cpalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/cpalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/cpalette.cpp Thu Nov 11 23:48:47 2010
@@ -58,11 +58,13 @@
#include "sccolorengine.h"
#include "scpainter.h"
#include "scpattern.h"
+#include "selection.h"
#include "util.h"
#include "util_math.h"
Cpalette::Cpalette(QWidget* parent) : QWidget(parent)
{
+ m_blockUpdates = 0;
currentItem = NULL;
patternList = NULL;
CGradDia = NULL;
@@ -81,7 +83,7 @@
connect(colorListFill, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(selectColorF(QListWidgetItem*)));
connect(gradEditButton, SIGNAL(clicked()), this, SLOT(editGradientVector()));
connect(editMeshColors, SIGNAL(clicked()), this, SLOT(editMeshPointColor()));
- connect(displayAllColors, SIGNAL(clicked()), this, SLOT(ToggleColorDisplay()));
+ connect(displayAllColors, SIGNAL(clicked()), this, SLOT(toggleColorDisplay()));
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
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)));
@@ -150,7 +152,15 @@
disconnect(this, SIGNAL(NewPatternTypeS(bool)), 0, 0);
disconnect(this, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)), 0, 0);
+ if (currentDoc)
+ {
+ disconnect(currentDoc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+ disconnect(currentDoc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ }
+
+ ScribusDoc* oldDoc = currentDoc;
currentDoc = doc;
+
if (doc == NULL)
{
colorListStroke->cList = NULL;
@@ -167,8 +177,8 @@
connect(this, SIGNAL(NewPen(QString)) , doc, SLOT(itemSelection_SetItemPen(QString)));
connect(this, SIGNAL(NewBrush(QString)) , doc, SLOT(itemSelection_SetItemBrush(QString)));
- connect(this, SIGNAL(NewPenShade(int)) , doc, SLOT(itemSelection_SetItemPenShade(int)));
- connect(this, SIGNAL(NewBrushShade(int)) , doc, SLOT(itemSelection_SetItemBrushShade(int)));
+ connect(this, SIGNAL(NewPenShade(int)) , this, SLOT(handleStrokeShade(int)));
+ connect(this, SIGNAL(NewBrushShade(int)) , this, SLOT(handleFillShade(int)));
connect(this, SIGNAL(NewGradient(int)) , doc, SLOT(itemSelection_SetItemGradFill(int)));
connect(this, SIGNAL(NewGradientS(int)) , doc, SLOT(itemSelection_SetItemGradStroke(int)));
connect(this, SIGNAL(NewPattern(QString)) , doc, SLOT(itemSelection_SetItemPatternFill(QString)));
@@ -177,6 +187,14 @@
connect(this, SIGNAL(NewPatternS(QString)) , doc, SLOT(itemSelection_SetItemStrokePattern(QString)));
connect(this, SIGNAL(NewPatternTypeS(bool)), doc, SLOT(itemSelection_SetItemStrokePatternType(bool)));
connect(this, SIGNAL(NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemStrokePatternProps(double, double, double, double, double, double, double, double, bool, bool)));
+
+ connect(currentDoc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+ connect(currentDoc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ }
+
+ if (oldDoc != currentDoc)
+ {
+ displayGradient(0);
}
}
@@ -209,12 +227,9 @@
disconnect(shadeMeshPoint, SIGNAL(valueChanged(int)), this, SLOT(updateMeshPoint()));
disconnect(transparencyMeshPoint, SIGNAL(valueChanged(int)), this, SLOT(updateMeshPoint()));
updateCList();
- if (currentItem->doOverprint)
- setActOverprint(1);
- else
- setActOverprint(0);
- setActFarben(currentItem->lineColor(), currentItem->fillColor(), currentItem->lineShade(), currentItem->fillShade());
- ChooseGrad(currentItem->GrType);
+ displayOverprint(currentItem->doOverprint ? 1 : 0);
+ displayColorValues(currentItem->lineColor(), currentItem->fillColor(), currentItem->lineShade(), currentItem->fillShade());
+ displayGradient(currentItem->GrType);
gradEdit->setGradient(currentItem->fill_gradient);
gradEditStroke->setGradient(currentItem->stroke_gradient);
if (!currentItem->gradient().isEmpty())
@@ -263,6 +278,16 @@
setMeshPoint();
editMeshColors->setEnabled(true);
gradEditButton->setEnabled(true);
+
+ double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
+ bool mirrorX, mirrorY;
+ currentItem->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ currentItem->patternFlip(mirrorX, mirrorY);
+ setActPattern(currentItem->pattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
+ currentItem->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
+ currentItem->strokePatternFlip(mirrorX, mirrorY);
+ setActPatternStroke(currentItem->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY, patternSpace, currentItem->isStrokePatternToPath());
+
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
connect(namedGradientStroke, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradientStroke(const QString &)));
connect(tabWidgetStroke, SIGNAL(currentChanged(int)), this, SLOT(slotGradStroke(int)));
@@ -287,13 +312,48 @@
connect(transparencyMeshPoint, SIGNAL(valueChanged(int)), this, SLOT(updateMeshPoint()));
}
+PageItem* Cpalette::currentItemFromSelection()
+{
+ PageItem *currentItem = NULL;
+
+ if (currentDoc)
+ {
+ if (currentDoc->m_Selection->count() > 1)
+ {
+ uint lowestItem = 999999;
+ for (int a=0; a < currentDoc->m_Selection->count(); ++a)
+ {
+ currentItem = currentDoc->m_Selection->itemAt(a);
+ lowestItem = qMin(lowestItem, currentItem->ItemNr);
+ }
+ currentItem = currentDoc->Items->at(lowestItem);
+ }
+ else if (currentDoc->m_Selection->count() == 1)
+ {
+ currentItem = currentDoc->m_Selection->itemAt(0);
+ }
+ }
+
+ return currentItem;
+}
+
+void Cpalette::handleSelectionChanged()
+{
+ if (currentDoc && !updatesBlocked())
+ {
+ PageItem* currentItem = currentItemFromSelection();
+ setCurrentItem(currentItem);
+ updateFromItem();
+ }
+}
+
void Cpalette::updateColorList()
{
if (currentDoc)
{
- this->SetColors(currentDoc->PageColors);
- this->SetPatterns(¤tDoc->docPatterns);
- this->SetGradients(¤tDoc->docGradients);
+ this->setColors(currentDoc->PageColors);
+ this->setGradients(¤tDoc->docGradients);
+ this->setPatterns(¤tDoc->docPatterns);
}
}
@@ -327,7 +387,7 @@
connect(colorListFill, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(selectColorF(QListWidgetItem*)));
}
-void Cpalette::ToggleColorDisplay()
+void Cpalette::toggleColorDisplay()
{
if (currentDoc != NULL)
{
@@ -338,11 +398,31 @@
}
}
-void Cpalette::setActOverprint(int val)
+void Cpalette::displayOverprint(int val)
{
disconnect(overPrintCombo, SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int)));
overPrintCombo->setCurrentIndex(val);
connect(overPrintCombo, SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int)));
+}
+
+void Cpalette::handleFillShade(int val)
+{
+ if (currentDoc)
+ {
+ blockUpdates(true);
+ currentDoc->itemSelection_SetItemBrushShade(val);
+ blockUpdates(false);
+ }
+}
+
+void Cpalette::handleStrokeShade(int val)
+{
+ if (currentDoc)
+ {
+ blockUpdates(true);
+ currentDoc->itemSelection_SetItemPenShade(val);
+ blockUpdates(false);
+ }
}
void Cpalette::handleOverprint(int val)
@@ -361,9 +441,11 @@
if (currentDoc)
{
VGradient gradient(gradEdit->gradient());
+ blockUpdates(true);
currentDoc->updateManager()->setUpdatesDisabled();
currentDoc->itemSelection_SetFillGradient(gradient);
currentDoc->updateManager()->setUpdatesEnabled();
+ blockUpdates(false);
}
}
@@ -372,31 +454,33 @@
if (currentDoc)
{
VGradient gradient(gradEditStroke->gradient());
+ blockUpdates(true);
currentDoc->updateManager()->setUpdatesDisabled();
currentDoc->itemSelection_SetLineGradient(gradient);
currentDoc->updateManager()->setUpdatesEnabled();
- }
-}
-
-void Cpalette::setActFarben(QString p, QString b, int shp, int shb)
+ blockUpdates(false);
+ }
+}
+
+void Cpalette::displayColorValues(QString stroke, QString fill, int sShade, int fShade)
{
disconnect(fillShade, SIGNAL(valueChanged(int)), this, SIGNAL(NewBrushShade(int)));
disconnect(strokeShade, SIGNAL(valueChanged(int)), this, SIGNAL(NewPenShade(int)));
disconnect(colorListStroke, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(selectColorS(QListWidgetItem*)));
disconnect(colorListFill, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(selectColorF(QListWidgetItem*)));
- strokeShade->setValue(shp);
- fillShade->setValue(shp);
- if ((p != CommonStrings::None) && (!p.isEmpty()))
- {
- QList<QListWidgetItem *> cCol = colorListStroke->findItems(p, Qt::MatchExactly);
+ strokeShade->setValue(sShade);
+ fillShade->setValue(fShade);
+ if ((stroke != CommonStrings::None) && (!stroke.isEmpty()))
+ {
+ QList<QListWidgetItem *> cCol = colorListStroke->findItems(stroke, Qt::MatchExactly);
if (cCol.count() != 0)
colorListStroke->setCurrentItem(cCol[0]);
}
else
colorListStroke->setCurrentRow(0);
- if ((b != CommonStrings::None) && (!b.isEmpty()))
- {
- QList<QListWidgetItem *> cCol = colorListFill->findItems(b, Qt::MatchExactly);
+ if ((fill != CommonStrings::None) && (!fill.isEmpty()))
+ {
+ QList<QListWidgetItem *> cCol = colorListFill->findItems(fill, Qt::MatchExactly);
if (cCol.count() != 0)
colorListFill->setCurrentItem(cCol[0]);
}
@@ -432,7 +516,7 @@
emit NewBrush(sFarbe);
}
-void Cpalette::SetColors(ColorList newColorList)
+void Cpalette::setColors(ColorList newColorList)
{
colorList.clear();
colorList = newColorList;
@@ -495,7 +579,7 @@
connect(namedGradientStroke, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradientStroke(const QString &)));
}
-void Cpalette::SetGradients(QMap<QString, VGradient> *docGradients)
+void Cpalette::setGradients(QMap<QString, VGradient> *docGradients)
{
gradientList = docGradients;
updateGradientList();
@@ -604,7 +688,7 @@
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
-void Cpalette::SetPatterns(QMap<QString, ScPattern> *docPatterns)
+void Cpalette::setPatterns(QMap<QString, ScPattern> *docPatterns)
{
patternList = docPatterns;
updatePatternList();
@@ -709,7 +793,7 @@
}
}
-void Cpalette::ChooseGrad(int number)
+void Cpalette::displayGradient(int number)
{
disconnect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
if (number==-1)
@@ -788,6 +872,7 @@
else
tabWidget->setCurrentIndex(2);
}
+
connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(slotGrad(int)));
}
@@ -942,11 +1027,6 @@
emit NewGradientS(6);
else
emit NewGradientS(7);
-}
-
-void Cpalette::setActGradient(int typ)
-{
- ChooseGrad(typ);
}
void Cpalette::editMeshPointColor()
Modified: branches/ScribusOIF/scribus/ui/cpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/cpalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/cpalette.h (original)
+++ branches/ScribusOIF/scribus/ui/cpalette.h Thu Nov 11 23:48:47 2010
@@ -65,18 +65,30 @@
void updateColorList();
+ void setColors(ColorList newColorList);
+ void setGradients(QMap<QString, VGradient> *docGradients);
+ void setPatterns(QMap<QString, ScPattern> *docPatterns);
+
+private:
+
+ PageItem* currentItemFromSelection();
+
public slots:
+
+ void handleSelectionChanged();
+
void editLineColorSelectorButton();
void editFillColorSelectorButton();
- void SetColors(ColorList newColorList);
- void setActOverprint(int);
+ void displayColorValues(QString stroke, QString fille, int sShade, int fShade);
+ void displayGradient(int nr);
+ void displayOverprint(int);
+ void handleFillShade(int);
+ void handleStrokeShade(int);
void handleOverprint(int);
void handleFillGradient();
void handleStrokeGradient();
void updateCList();
- void ToggleColorDisplay();
- void SetPatterns(QMap<QString, ScPattern> *docPatterns);
- void SetGradients(QMap<QString, VGradient> *docGradients);
+ void toggleColorDisplay();
void setNamedGradient(const QString &name);
void setNamedGradientStroke(const QString &name);
void selectPattern(QListWidgetItem *c);
@@ -85,15 +97,12 @@
void updateGradientList();
void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
void setActPatternStroke(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 setActFarben(QString p, QString b, int shp, int shb);
void selectColorS(QListWidgetItem *c);
void selectColorF(QListWidgetItem *c);
void slotGradStroke(int number);
- void ChooseGrad(int nr);
void slotGrad(int nr);
void slotGradType(int type);
void slotGradTypeStroke(int type);
- void setActGradient(int typ);
void setGradientColors();
void editMeshPointColor();
void createNewMeshGradient();
@@ -143,8 +152,8 @@
double m_Pattern_rotation;
double m_Pattern_skewX;
double m_Pattern_skewY;
- bool m_Pattern_mirrorX;
- bool m_Pattern_mirrorY;
+ bool m_Pattern_mirrorX;
+ bool m_Pattern_mirrorY;
double m_Pattern_scaleXS;
double m_Pattern_scaleYS;
double m_Pattern_offsetXS;
@@ -153,10 +162,14 @@
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_mirrorXS;
+ bool m_Pattern_mirrorYS;
+ int currentUnit;
+ int editStrokeGradient;
+
+ int m_blockUpdates;
+ void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; }
+ bool updatesBlocked() { return (m_blockUpdates > 0); }
};
#endif
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/gradienteditor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.cpp Thu Nov 11 23:48:47 2010
@@ -34,10 +34,10 @@
GradientEditor::GradientEditor(QWidget *pa) : QFrame(pa)
{
setupUi(this);
- connect(stopPos, SIGNAL(editingFinished()), this, SLOT(changePos()));
+ connect(stopPos , SIGNAL(valueChanged(int)), this, SLOT(changePos(int)));
connect(stopColor , SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- connect(stopOpacity, SIGNAL(editingFinished()), this, SLOT(setStopTrans()));
- connect(stopShade , SIGNAL(editingFinished()), this, SLOT(setStopShade()));
+ connect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
+ connect(stopShade , SIGNAL(valueChanged(int)), this, SLOT(setStopShade(int)));
connect(Preview, SIGNAL(selectedStop(VColorStop*)), this, SLOT(slotDisplayStop(VColorStop*)));
connect(Preview, SIGNAL(currStep(double)), this, SLOT(setPos(double)));
connect(Preview, SIGNAL(currStep(double)), this, SIGNAL(gradientChanged()));
@@ -62,16 +62,16 @@
void GradientEditor::setPos(double p)
{
- disconnect(stopPos, SIGNAL(editingFinished(int)), this, SLOT(changePos()));
+ stopPos->blockSignals(true);
stopPos->setValue(qRound(p * 100));
- connect(stopPos, SIGNAL(editingFinished(int)), this, SLOT(changePos()));
+ stopPos->blockSignals(false);
}
void GradientEditor::setGradTrans(double val)
{
- disconnect(stopOpacity, SIGNAL(editingFinished(int)), this, SLOT(setStopTrans()));
+ stopOpacity->blockSignals(true);
stopOpacity->setValue(qRound(val * 100));
- connect(stopOpacity, SIGNAL(editingFinished(int)), this, SLOT(setStopTrans()));
+ stopOpacity->blockSignals(false);
}
void GradientEditor::slotDisplayStop(VColorStop* stop)
@@ -83,8 +83,8 @@
void GradientEditor::slotColor(QString name, int shade)
{
- disconnect(stopColor, SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- disconnect(stopShade, SIGNAL(editingFinished()), this, SLOT(setStopShade()));
+ stopColor->blockSignals(true);
+ stopShade->blockSignals(true);
stopShade->setValue(shade);
QString nam = name;
if (name == CommonStrings::None)
@@ -99,8 +99,8 @@
stopOpacity->setEnabled(true);
}
setCurrentComboItem(stopColor, nam);
- connect(stopColor, SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- connect(stopShade, SIGNAL(editingFinished()), this, SLOT(setStopShade()));
+ stopColor->blockSignals(false);
+ stopShade->blockSignals(false);
}
void GradientEditor::setGradientEditable(bool val)
@@ -112,9 +112,8 @@
Preview->setGradientEditable(val);
}
-void GradientEditor::changePos(/*int v*/)
+void GradientEditor::changePos(int v)
{
- int v = stopPos->value();
Preview->setActStep(static_cast<double>(v) / 100.0);
emit gradientChanged();
}
@@ -144,16 +143,14 @@
emit gradientChanged();
}
-void GradientEditor::setStopTrans(/*int val*/)
+void GradientEditor::setStopTrans(int val)
{
- int val = stopOpacity->value();
Preview->setActTrans(static_cast<double>(val) / 100.0);
emit gradientChanged();
}
-void GradientEditor::setStopShade(/*int val*/)
+void GradientEditor::setStopShade(int val)
{
- int val = stopShade->value();
Preview->setActColor(setColor(stopColor->currentText(), val), stopColor->currentText(), val);
emit gradientChanged();
}
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/gradienteditor.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.h (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.h Thu Nov 11 23:48:47 2010
@@ -54,13 +54,13 @@
public slots:
void setPos(double);
- void changePos(/*int*/);
+ void changePos(int);
void slotColor(QString name, int shade);
void slotDisplayStop(VColorStop* stop);
void setGradTrans(double val);
void setStopColor(const QString &);
- void setStopTrans(/*int val*/);
- void setStopShade(/*int val*/);
+ void setStopTrans(int val);
+ void setStopShade(int val);
void languageChange();
signals:
Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Thu Nov 11 23:48:47 2010
@@ -352,7 +352,6 @@
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(false);
TabStack->setItemEnabled(idXYZItem, false);
- Cpal->ChooseGrad(0);
}
void PropertiesPalette::unsetItem()
@@ -414,6 +413,8 @@
return;
}
+ int oldTabIndex = TabStack->currentIndex();
+
if (!m_doc)
setDoc(i->doc());
@@ -423,15 +424,15 @@
m_haveItem = false;
m_item = i;
- xyzPal->handleSelectionChanged();
+ /*xyzPal->handleSelectionChanged();
shapePal->handleSelectionChanged();
groupPal->handleSelectionChanged();
imagePal->handleSelectionChanged();
linePal->handleSelectionChanged();
- textPal->handleSelectionChanged();
-
- Cpal->setCurrentItem(m_item);
- Cpal->updateFromItem();
+ textPal->handleSelectionChanged();*/
+
+ /*Cpal->setCurrentItem(m_item);
+ Cpal->updateFromItem();*/
Tpal->setCurrentItem(m_item);
Tpal->updateFromItem();
@@ -444,12 +445,12 @@
double patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace;
bool mirrorX, mirrorY;
- i->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
+ /*i->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
i->patternFlip(mirrorX, mirrorY);
Cpal->setActPattern(i->pattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
i->strokePatternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, patternSpace);
i->strokePatternFlip(mirrorX, mirrorY);
- Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY, patternSpace, i->isStrokePatternToPath());
+ Cpal->setActPatternStroke(i->strokePattern(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY, patternSpace, i->isStrokePatternToPath());*/
i->maskTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY);
i->maskFlip(mirrorX, mirrorY);
@@ -469,13 +470,14 @@
else
TabStack->setItemEnabled(idGroupItem, false);
- if (m_item->doOverprint)
- Cpal->setActOverprint(1);
- else
- Cpal->setActOverprint(0);
-
m_haveItem = true;
- SelTab(TabStack->currentIndex());
+
+ if (oldTabIndex != TabStack->currentIndex())
+ {
+ //Must be called only when necessary : cause focus problem
+ //in spinboxes when processing valueChanged() signals
+ SelTab(TabStack->currentIndex());
+ }
xyzPal->handleSelectionChanged();
shapePal->handleSelectionChanged();
@@ -559,7 +561,7 @@
TabStack->setItemEnabled(ws, false);
TabStack->widget(0)->setEnabled(false);
TabStack->setItemEnabled(idXYZItem, false);
- Cpal->ChooseGrad(0);
+ Cpal->displayGradient(0);
break;
case PageItem::ImageFrame:
case PageItem::LatexFrame:
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp Thu Nov 11 23:48:47 2010
@@ -423,9 +423,9 @@
{
if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
return;
- TpalGroup->SetColors(m_doc->PageColors);
- TpalGroup->SetPatterns(&m_doc->docPatterns);
- TpalGroup->SetGradients(&m_doc->docGradients);
+ TpalGroup->setColors(m_doc->PageColors);
+ TpalGroup->setPatterns(&m_doc->docPatterns);
+ TpalGroup->setGradients(&m_doc->docGradients);
}
void PropertiesPalette_Group::updateColorSpecialGradient()
Modified: branches/ScribusOIF/scribus/ui/transparencypalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/transparencypalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/transparencypalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/transparencypalette.cpp Thu Nov 11 23:48:47 2010
@@ -98,9 +98,9 @@
{
if (currentDoc)
{
- this->SetColors(currentDoc->PageColors);
- this->SetPatterns(¤tDoc->docPatterns);
- this->SetGradients(¤tDoc->docGradients);
+ this->setColors(currentDoc->PageColors);
+ this->setPatterns(¤tDoc->docPatterns);
+ this->setGradients(¤tDoc->docGradients);
}
}
@@ -200,13 +200,13 @@
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
}
-void Tpalette::SetGradients(QMap<QString, VGradient> *docGradients)
+void Tpalette::setGradients(QMap<QString, VGradient> *docGradients)
{
gradientList = docGradients;
updateGradientList();
}
-void Tpalette::SetColors(ColorList newColorList)
+void Tpalette::setColors(ColorList newColorList)
{
colorList.clear();
colorList = newColorList;
@@ -391,7 +391,7 @@
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
-void Tpalette::SetPatterns(QMap<QString, ScPattern> *docPatterns)
+void Tpalette::setPatterns(QMap<QString, ScPattern> *docPatterns)
{
patternList = docPatterns;
updatePatternList();
Modified: branches/ScribusOIF/scribus/ui/transparencypalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15840&path=/branches/ScribusOIF/scribus/ui/transparencypalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/transparencypalette.h (original)
+++ branches/ScribusOIF/scribus/ui/transparencypalette.h Thu Nov 11 23:48:47 2010
@@ -68,13 +68,15 @@
void updateColorList();
+ void setColors(ColorList newColorList);
+ void setGradients(QMap<QString, VGradient> *docGradients);
+ void setPatterns(QMap<QString, ScPattern> *docPatterns);
+
public slots:
void editLineSelectorButton();
void editFillSelectorButton();
void updateCList();
void updateGradientList();
- void SetGradients(QMap<QString, VGradient> *docGradients);
- void SetColors(ColorList newColorList);
void slotGrad(int nr);
void slotGradType(int type);
void setNamedGradient(const QString &name);
@@ -83,7 +85,6 @@
void editGradientVector();
void setActiveGradDia(bool active);
void updatePatternList();
- void SetPatterns(QMap<QString, ScPattern> *docPatterns);
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();
More information about the scribus-commit
mailing list