Scribus
Open source desktop publishing at your fingertips
cpalette.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  cpalette.h - description
9  -------------------
10  begin : Wed Apr 25 2001
11  copyright : (C) 2001 by Franz Schmid
12  email : Franz.Schmid@altmuehlnet.de
13  ***************************************************************************/
14 
15 /***************************************************************************
16  * *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or *
20  * (at your option) any later version. *
21  * *
22  ***************************************************************************/
23 
24 #ifndef CPALETTE_H
25 #define CPALETTE_H
26 
27 #include <QWidget>
28 #include <QPointer>
29 #include <QGroupBox>
30 #include <QPushButton>
31 #include <QToolButton>
32 #include "scribusapi.h"
33 #include "gradienteditor.h"
34 #include "scribusdoc.h"
35 #include "ui/scrpalettebase.h"
36 #include "ui_colorpalette.h"
37 #include "ui/gradientvectordialog.h"
38 #include "ui/patternpropsdialog.h"
39 
40 class PageItem;
41 class ColorListBox;
42 class ScrSpinBox;
43 class ScComboBox;
44 class ScPattern;
45 class UndoManager;
46 
51 class SCRIBUS_API Cpalette : public QWidget, Ui::colorPalette
52 {
53  Q_OBJECT
54 
55  friend class PropertiesPalette;
56 
57 public:
58  Cpalette(QWidget* parent);
59  ~Cpalette() {};
60 
61  void setDocument(ScribusDoc* doc);
62 
63  void updateColorList();
64 
65  void setColors(ColorList newColorList);
66  void setGradients(QHash<QString, VGradient> *docGradients);
67  void setPatterns(QHash<QString, ScPattern> *docPatterns);
68 
69 private:
70 
71  PageItem* currentItemFromSelection();
72  UndoManager * undoManager;
73 
74 public slots:
75 
76  void handleSelectionChanged();
77  void handleUpdateRequest(int);
78 
79  /*void editLineColorSelectorButton();
80  void editFillColorSelectorButton();*/
81  void fillStrokeSelector(int /*index*/);
82  void handleFillShade(double);
83  void handleStrokeShade(double);
84  void handleOverprint(int);
85  void handleFillGradient();
86  void handleStrokeGradient();
87  void handleStrokeGradientExtend(int val);
88  void handleGradientExtend(int val);
89  void showColorValues(QString stroke, QString fille, int sShade, int fShade);
90  void showGradient(int nr);
91  void showGradientStroke(int nr);
92  void showOverprint(int);
93  void toggleColorDisplay();
94  void setNamedGradient(const QString &name);
95  void setNamedGradientStroke(const QString &name);
96  void selectPattern(QListWidgetItem *c);
97  void selectPatternS(QListWidgetItem *c);
98  void hideEditedPatterns(QStringList names);
99  void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
100  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);
101  void selectColorS(QListWidgetItem *c);
102  void selectColorF(QListWidgetItem *c);
103  void slotGradStroke(int number);
104  void slotGrad(int nr);
105  void slotGradType(int type);
106  void slotGradTypeStroke(int type);
107  void setGradientColors();
108  void editMeshPointColor();
109  void createNewMeshGradient();
110  void resetMeshGradient();
111  void meshGradientToShape();
112  void resetOneControlPoint();
113  void resetAllControlPoints();
114  void editGradientVector();
115  void editGradientVectorStroke();
116  void setActiveGradDia(bool active);
117  void setSpecialGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy);
118  void setMeshPoint();
119  void endPatchAdd();
120  void snapToPatchGrid(bool val);
121  void handleRemovePatch();
122  void setMeshPatch();
123  void setMeshPatchPoint();
124  void updateMeshPoint();
125  void changePatternProps();
126  void changePatternPropsStroke();
127  void toggleStrokePattern();
128  void changeHatchProps();
129  void unitChange(double, double, int unitIndex);
130 signals:
131  void NewPen(QString);
132  void NewBrush(QString);
133  void NewPenShade(double);
134  void NewBrushShade(double);
135  void NewGradient(int);
136  void NewGradientS(int);
137  void NewPattern(QString);
138  void NewPatternProps(double, double, double, double, double, double, double, bool, bool);
139  void NewPatternS(QString);
140  void NewPatternTypeS(bool);
141  void NewPatternPropsS(double, double, double, double, double, double, double, double, bool, bool);
142  void NewSpecial(double, double, double, double, double, double, double, double, double, double);
143  void NewOverprint(int);
144  void editGradient(int);
145 
146 protected:
147  GradientVectorDialog* CGradDia;
148  QPointer<ScribusDoc> currentDoc;
149  PageItem* currentItem;
150  ColorList colorList;
151  QHash<QString, ScPattern> *patternList;
152  QHash<QString, VGradient> *gradientList;
153  double m_Pattern_scaleX;
154  double m_Pattern_scaleY;
155  double m_Pattern_offsetX;
156  double m_Pattern_offsetY;
157  double m_Pattern_rotation;
158  double m_Pattern_skewX;
159  double m_Pattern_skewY;
160  bool m_Pattern_mirrorX;
161  bool m_Pattern_mirrorY;
162  double m_Pattern_scaleXS;
163  double m_Pattern_scaleYS;
164  double m_Pattern_offsetXS;
165  double m_Pattern_offsetYS;
166  double m_Pattern_rotationS;
167  double m_Pattern_skewXS;
168  double m_Pattern_skewYS;
169  double m_Pattern_spaceS;
170  bool m_Pattern_mirrorXS;
171  bool m_Pattern_mirrorYS;
172  int currentUnit;
173  int editStrokeGradient;
174 
175  void connectSignals();
176  void disconnectSignals();
177 
178  void setCurrentItem(PageItem* item);
179  void updateFromItem();
180 
181  void setGradientVectorValues();
182  void setGradientVectorStrokeValues();
183 
184  int m_blockUpdates;
185  void blockUpdates(bool block) { if (block) ++m_blockUpdates; else --m_blockUpdates; }
186  bool updatesBlocked() { return (m_blockUpdates > 0); }
187 
188  void enablePatterns(bool enable);
189 
190  void updateCList();
191  void updateGradientList();
192  void updatePatternList();
193 };
194 
195 #endif
Definition: cpalette.h:51
Very nice list box with color names and samples. It's inherited from QListBox with all its methods an...
Definition: colorlistbox.h:67
Definition: scpattern.h:36
Definition: sccolor.h:155
The ScComboBox widget always uses a listbox instead of a popup, independent of any QStyle...
Definition: sccombobox.h:26
the Document Class
Definition: scribusdoc.h:90
ScrSpinBox is a Qt4 replacement for our old ScrSpinBox using Qt3.
Definition: scrspinbox.h:21
Definition: propertiespalette.h:51
Definition: gradientvectordialog.h:40
Definition: pageitem.h:92
UndoManager handles the undo stack.
Definition: undomanager.h:81