r15788 by jghali - make color palette work a bit better, still some bugs to fix tho
scribus-commit
scribus-commit at lists.scribus.net
Sun Nov 7 01:11:18 CET 2010
Author: jghali
Date: Sun Nov 7 00:11:18 2010
New Revision: 15788
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15788
Log:
make color palette work a bit better, still some bugs to fix tho
Modified:
branches/ScribusOIF/scribus/scribus.cpp
branches/ScribusOIF/scribus/scribus.h
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/gradientpreview.cpp
branches/ScribusOIF/scribus/ui/gradientpreview.h
branches/ScribusOIF/scribus/ui/propertiespalette.cpp
branches/ScribusOIF/scribus/ui/propertiespalette.h
branches/ScribusOIF/scribus/ui/propertiespalette_line.h
branches/ScribusOIF/scribus/ui/propertiespalette_text.h
Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Sun Nov 7 00:11:18 2010
@@ -7263,22 +7263,6 @@
}
}
-void ScribusMainWindow::updtGradFill()
-{
- if (!HaveDoc)
- return;
- VGradient vg(propertiesPalette->getFillGradient());
- doc->itemSelection_SetFillGradient(vg);
-}
-
-void ScribusMainWindow::updtGradStroke()
-{
- if (!HaveDoc)
- return;
- VGradient vg(propertiesPalette->getStrokeGradient());
- doc->itemSelection_SetLineGradient(vg);
-}
-
void ScribusMainWindow::updtGradMask()
{
if (!HaveDoc)
@@ -7294,18 +7278,7 @@
VGradient vg(propertiesPalette->getMaskGradientGroup());
doc->itemSelection_SetMaskGradient(vg);
}
-/*
-//CB-->Doc
-void ScribusMainWindow::GetBrushPen()
-{
- //What? we come back here from mpalette and then go to the view.. someones kidding
- if (!HaveDoc)
- return;
- view->QueryFarben();
- //CB We dont need to set the doc changed just to find the colour values...
- //slotDocCh();
-}
-*/
+
//CB-->??
void ScribusMainWindow::MakeFrame(int f, int c, double *vals)
{
Modified: branches/ScribusOIF/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/scribus.h
==============================================================================
--- branches/ScribusOIF/scribus/scribus.h (original)
+++ branches/ScribusOIF/scribus/scribus.h Sun Nov 7 00:11:18 2010
@@ -459,8 +459,6 @@
void setBrushShade(int sh);
void setGradFill(int typ);
*/
- void updtGradFill();
- void updtGradStroke();
void updtGradMask();
void updtGradMaskGroup();
/*
@@ -470,8 +468,6 @@
void setBrushFarbe(QString farbe);
*/
//CB: void setCSMenu();
- /** Fragt nach den Farben */
-// void GetBrushPen();
/** Erzeugt einen Rahmen */
void MakeFrame(int f, int c, double *vals);
//** Loescht ein Element */
Modified: branches/ScribusOIF/scribus/ui/cpalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/cpalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/cpalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/cpalette.cpp Sun Nov 7 00:11:18 2010
@@ -92,8 +92,8 @@
connect(CGradDia, SIGNAL(reset1Control()), this, SLOT(resetOneControlPoint()));
connect(CGradDia, SIGNAL(resetAllControl()), this, SLOT(resetAllControlPoints()));
connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
- connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
- connect(editPatternProps, SIGNAL(clicked()), this, SLOT(changePatternProps()));
+ connect(gradEdit, SIGNAL(gradientChanged()) , this, SLOT(handleFillGradient()));
+ connect(editPatternProps, SIGNAL(clicked()) , this, SLOT(changePatternProps()));
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
connect(overPrintCombo, SIGNAL(activated(int)), this, SIGNAL(NewOverprint(int)));
connect(patternBoxStroke, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPatternS(QListWidgetItem*)));
@@ -101,7 +101,7 @@
connect(editPatternPropsStroke, SIGNAL(clicked()), this, SLOT(changePatternPropsStroke()));
connect(namedGradientStroke, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradientStroke(const QString &)));
connect(gradientTypeStroke, SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int)));
- connect(gradEditStroke, SIGNAL(gradientChanged()), this, SIGNAL(strokeGradientChanged()));
+ connect(gradEditStroke, SIGNAL(gradientChanged()) , this, SLOT(handleStrokeGradient()));
connect(gradEditButtonStroke, SIGNAL(clicked()), this, SLOT(editGradientVectorStroke()));
connect(followsPath, SIGNAL(clicked()), this, SLOT(toggleStrokePattern()));
connect(colorPoint1, SIGNAL(activated(int)), this, SLOT(setGradientColors()));
@@ -190,8 +190,8 @@
disconnect(namedGradientStroke, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradientStroke(const QString &)));
disconnect(tabWidgetStroke, SIGNAL(currentChanged(int)), this, SLOT(slotGradStroke(int)));
disconnect(gradientTypeStroke, SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int)));
- disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
- disconnect(gradEditStroke, SIGNAL(gradientChanged()), this, SIGNAL(strokeGradientChanged()));
+ disconnect(gradEdit , SIGNAL(gradientChanged()), this, SLOT(handleFillGradient()));
+ disconnect(gradEditStroke, SIGNAL(gradientChanged()), this, SLOT(handleStrokeGradient()));
disconnect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
disconnect(colorPoint1, SIGNAL(activated(int)), this, SLOT(setGradientColors()));
disconnect(colorPoint2, SIGNAL(activated(int)), this, SLOT(setGradientColors()));
@@ -267,8 +267,8 @@
connect(namedGradientStroke, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradientStroke(const QString &)));
connect(tabWidgetStroke, SIGNAL(currentChanged(int)), this, SLOT(slotGradStroke(int)));
connect(gradientTypeStroke, SIGNAL(activated(int)), this, SLOT(slotGradTypeStroke(int)));
- connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
- connect(gradEditStroke, SIGNAL(gradientChanged()), this, SIGNAL(strokeGradientChanged()));
+ connect(gradEdit , SIGNAL(gradientChanged()), this, SLOT(handleFillGradient()));
+ connect(gradEditStroke, SIGNAL(gradientChanged()), this, SLOT(handleStrokeGradient()));
connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
connect(colorPoint1, SIGNAL(activated(int)), this, SLOT(setGradientColors()));
connect(colorPoint2, SIGNAL(activated(int)), this, SLOT(setGradientColors()));
@@ -353,6 +353,24 @@
if (val == 0)
setter = false;
currentDoc->itemSelection_SetOverprint(setter);
+ }
+}
+
+void Cpalette::handleFillGradient()
+{
+ if (currentDoc)
+ {
+ VGradient gradient(gradEdit->gradient());
+ currentDoc->itemSelection_SetFillGradient(gradient);
+ }
+}
+
+void Cpalette::handleStrokeGradient()
+{
+ if (currentDoc)
+ {
+ VGradient gradient(gradEditStroke->gradient());
+ currentDoc->itemSelection_SetLineGradient(gradient);
}
}
@@ -775,7 +793,7 @@
{
disconnect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
disconnect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
- disconnect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+ disconnect(gradEdit, SIGNAL(gradientChanged()) , this, SLOT(handleFillGradient()));
if (!currentItem->gradient().isEmpty())
{
setCurrentComboItem(namedGradient, currentItem->gradient());
@@ -846,7 +864,7 @@
}
connect(namedGradient, SIGNAL(activated(const QString &)), this, SLOT(setNamedGradient(const QString &)));
connect(gradientType, SIGNAL(activated(int)), this, SLOT(slotGradType(int)));
- connect(gradEdit, SIGNAL(gradientChanged()), this, SIGNAL(gradientChanged()));
+ connect(gradEdit, SIGNAL(gradientChanged()) , this, SLOT(handleFillGradient()));
}
else if (number == 2)
emit NewGradient(8);
Modified: branches/ScribusOIF/scribus/ui/cpalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/cpalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/cpalette.h (original)
+++ branches/ScribusOIF/scribus/ui/cpalette.h Sun Nov 7 00:11:18 2010
@@ -71,6 +71,8 @@
void SetColors(ColorList newColorList);
void setActOverprint(int);
void handleOverprint(int);
+ void handleFillGradient();
+ void handleStrokeGradient();
void updateCList();
void ToggleColorDisplay();
void SetPatterns(QMap<QString, ScPattern> *docPatterns);
@@ -124,8 +126,6 @@
void NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool);
void NewSpecial(double, double, double, double, double, double, double, double, double, double);
void NewOverprint(int);
- void gradientChanged();
- void strokeGradientChanged();
void editGradient(int);
protected:
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/gradienteditor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.cpp Sun Nov 7 00:11:18 2010
@@ -32,24 +32,23 @@
{
setupUi(this);
connect(Position, SIGNAL(valueChanged(int)), this, SLOT(changePos(int)));
+ connect(stopColor , SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
+ 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()));
- connect(stopColor, SIGNAL(activated(const QString &)), this, SLOT(setStopColor(const QString &)));
- connect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
- connect(stopShade, SIGNAL(valueChanged(int)), this, SLOT(setStopShade(int)));
- connect(Preview, SIGNAL(currTrans(double )), this, SLOT(setGradTrans(double )));
- connect(Preview, SIGNAL(selectedColor(QString, int )), this, SLOT(slotColor(QString, int )));
}
void GradientEditor::setGradient(VGradient grad)
{
- Preview->fill_gradient = grad;
+ Preview->setGradient(grad);
Preview->updateDisplay();
}
const VGradient GradientEditor::gradient()
{
- return Preview->fill_gradient;
+ return Preview->gradient();
}
void GradientEditor::setColors(ColorList &colorList)
@@ -70,6 +69,13 @@
disconnect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
stopOpacity->setValue(qRound(val * 100));
connect(stopOpacity, SIGNAL(valueChanged(int)), this, SLOT(setStopTrans(int)));
+}
+
+void GradientEditor::slotDisplayStop(VColorStop* stop)
+{
+ setPos(stop->rampPoint);
+ slotColor(stop->name, stop->shade);
+ setGradTrans(stop->opacity);
}
void GradientEditor::slotColor(QString name, int shade)
Modified: branches/ScribusOIF/scribus/ui/gradienteditor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/gradienteditor.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradienteditor.h (original)
+++ branches/ScribusOIF/scribus/ui/gradienteditor.h Sun Nov 7 00:11:18 2010
@@ -56,6 +56,7 @@
void setPos(double);
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);
Modified: branches/ScribusOIF/scribus/ui/gradientpreview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/gradientpreview.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradientpreview.cpp (original)
+++ branches/ScribusOIF/scribus/ui/gradientpreview.cpp Sun Nov 7 00:11:18 2010
@@ -132,9 +132,7 @@
ActStop = 0;
repaint();
QList<VColorStop*> cstops = fill_gradient.colorStops();
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
}
}
}
@@ -154,9 +152,7 @@
if (fpo.contains(m->pos()))
{
ActStop = yg;
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
repaint();
onlyselect = true;
return;
@@ -179,9 +175,7 @@
ActStop = 0;
repaint();
QList<VColorStop*> cstops = fill_gradient.colorStops();
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
}
if ((m->y() < height()) && (m->y() > 43) && (m->x() > 0) && (m->x() < width()) && (ActStop == -1))
{
@@ -200,9 +194,7 @@
if (fpo.contains(m->pos()))
{
ActStop = yg;
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
repaint();
break;
}
@@ -322,9 +314,7 @@
if (fpo.contains(mPos))
{
ActStop = yg;
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
repaint();
break;
}
@@ -340,22 +330,17 @@
ActStop = 0;
repaint();
QList<VColorStop*> cstops = fill_gradient.colorStops();
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
}
}
void GradientPreview::updateDisplay()
{
- ActStop = 0;
repaint();
if (!fill_gradient.colorStops().isEmpty())
{
QList<VColorStop*> cstops = fill_gradient.colorStops();
- emit selectedColor(cstops.at(ActStop)->name, cstops.at(ActStop)->shade);
- emit currTrans(cstops.at(ActStop)->opacity);
- emit currStep(cstops.at(ActStop)->rampPoint);
+ emit selectedStop(cstops.at(ActStop));
}
}
@@ -388,6 +373,30 @@
repaint();
}
+void GradientPreview::setGradient(const VGradient& gradient)
+{
+ if ((gradient.colorStops().count() == fill_gradient.colorStops().count()) && (ActStop >= 0))
+ {
+ int diffStops = 0;
+ for (int i = 0; i < fill_gradient.colorStops().count(); ++i)
+ {
+ VColorStop* stop1 = gradient.colorStops().at(i);
+ VColorStop* stop2 = fill_gradient.colorStops().at(i);
+ if ((stop1->color != stop2->color) || (stop1->midPoint != stop2->midPoint) ||
+ (stop1->name != stop2->name) || (stop1->opacity != stop2->opacity) ||
+ (stop1->rampPoint != stop2->rampPoint) || (stop1->shade != stop2->shade))
+ {
+ ++diffStops;
+ }
+ }
+ if (diffStops > 1)
+ ActStop = 0;
+ }
+ if ((ActStop < 0) && (gradient.colorStops().count() > 0))
+ ActStop = 0;
+ fill_gradient = gradient;
+}
+
void GradientPreview::setGradientEditable(bool val)
{
isEditable = val;
Modified: branches/ScribusOIF/scribus/ui/gradientpreview.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/gradientpreview.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/gradientpreview.h (original)
+++ branches/ScribusOIF/scribus/ui/gradientpreview.h Sun Nov 7 00:11:18 2010
@@ -55,8 +55,11 @@
void setActColor(QColor c, QString n, int s);
void setActTrans(double t);
void setActStep(double t);
+ void setGradient(const VGradient& gradient);
void setGradientEditable(bool val);
- VGradient fill_gradient;
+
+ const VGradient& gradient() { return fill_gradient; }
+
QList<int> StopM;
bool Mpressed;
bool outside;
@@ -66,12 +69,17 @@
int contextStop;
QPoint mPos;
+private:
+
+ VGradient fill_gradient;
+
private slots:
void addStop();
void removeStop();
signals:
void selectedColor(QString, int);
+ void selectedStop(VColorStop*);
void currTrans(double);
void currStep(double);
void gradientChanged();
Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Sun Nov 7 00:11:18 2010
@@ -247,8 +247,8 @@
connect(this, SIGNAL(DocChanged()), m_ScMW, SLOT(slotDocCh()));
connect(this, SIGNAL(UpdtGui(int)), m_ScMW, SLOT(HaveNewSel(int)));
- connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
- connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
+ //connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
+ //connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
connect(this->Tpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradMask()));
}
@@ -929,17 +929,6 @@
textPal->languageChange();
}
-
-const VGradient PropertiesPalette::getFillGradient()
-{
- return Cpal->gradEdit->gradient();
-}
-
-const VGradient PropertiesPalette::getStrokeGradient()
-{
- return Cpal->gradEditStroke->gradient();
-}
-
const VGradient PropertiesPalette::getMaskGradient()
{
return Tpal->gradEdit->gradient();
Modified: branches/ScribusOIF/scribus/ui/propertiespalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/propertiespalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.h Sun Nov 7 00:11:18 2010
@@ -72,8 +72,6 @@
virtual void closeEvent(QCloseEvent *closeEvent);
void updateColorSpecialGradient();
- const VGradient getFillGradient();
- const VGradient getStrokeGradient();
const VGradient getMaskGradient();
const VGradient getMaskGradientGroup();
void updateColorList();
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_line.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/propertiespalette_line.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_line.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_line.h Sun Nov 7 00:11:18 2010
@@ -51,7 +51,6 @@
class Autoforms;
class BasePointWidget;
class ColorCombo;
-class Cpalette;
class DashEditor;
class FontComboH;
class NameWidget;
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15788&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.h Sun Nov 7 00:11:18 2010
@@ -51,7 +51,6 @@
class Autoforms;
class BasePointWidget;
class ColorCombo;
-class Cpalette;
class DashEditor;
class FontComboH;
class NameWidget;
More information about the scribus-commit
mailing list