Subversion Repositories Scribus

Rev

Rev 7478 | Rev 7747 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4430 cbradney 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
*/
3 paul 7
#ifndef FARBMANAGER_H
8
#define FARBMANAGER_H
9
 
10
#include <qdialog.h>
11
#include <qlayout.h>
12
#include <qlistbox.h>
13
#include <qpushbutton.h>
152 Franz 14
#include <qgroupbox.h>
15
#include <qtoolbutton.h>
16
#include <qlabel.h>
17
#include <qpopupmenu.h>
3 paul 18
#include <qcolor.h>
3131 fschmid 19
#include <qtooltip.h>
7478 jghali 20
#include <qguardedptr.h>
2969 craig 21
 
4606 cbradney 22
#include "colorsetmanager.h"
2969 craig 23
#include "scribusapi.h"
838 cbradney 24
#include "scribusstructs.h"
6576 jghali 25
#include "sclistboxpixmap.h"
3 paul 26
#include "query.h"
27
 
3137 fschmid 28
class DynamicTip;
5781 cbradney 29
class ScribusDoc;
7714 fschmid 30
class ColorListBox;
3131 fschmid 31
 
6576 jghali 32
class SCRIBUS_API ColorSmallPixmapItem : public ScListBoxPixmap<15,15>
4689 mrdocs 33
{
34
        protected:
7478 jghali 35
                ScColor m_color;
36
                QGuardedPtr<ScribusDoc> m_doc;
4689 mrdocs 37
        public:
7478 jghali 38
                ColorSmallPixmapItem( const ScColor& col, ScribusDoc* doc, const QString colName );
4689 mrdocs 39
                ~ColorSmallPixmapItem() {};
40
 
6576 jghali 41
                virtual void redraw(void);
4689 mrdocs 42
                virtual int rtti() const { return 654873547; };
43
};
44
 
6576 jghali 45
class SCRIBUS_API ColorWidePixmapItem : public ScListBoxPixmap<30,15>
4689 mrdocs 46
{
6576 jghali 47
        protected:
7478 jghali 48
                ScColor m_color;
49
                QGuardedPtr<ScribusDoc> m_doc;
4689 mrdocs 50
        public:
7478 jghali 51
                ColorWidePixmapItem( const ScColor& col, ScribusDoc* doc, const QString colName );
4689 mrdocs 52
                ~ColorWidePixmapItem() {};
53
 
6576 jghali 54
                virtual void redraw(void);
4689 mrdocs 55
                virtual int rtti() const { return 654873548; };
56
};
57
 
6576 jghali 58
class SCRIBUS_API ColorFancyPixmapItem : public ScListBoxPixmap<60,15>
4689 mrdocs 59
{
6576 jghali 60
        protected:
7478 jghali 61
                ScColor m_color;
62
                QGuardedPtr<ScribusDoc> m_doc;
4689 mrdocs 63
        public:
7478 jghali 64
                ColorFancyPixmapItem( const ScColor& col, ScribusDoc* doc, const QString colName );
4689 mrdocs 65
                ~ColorFancyPixmapItem() {};
66
 
6576 jghali 67
                virtual void redraw(void);
4689 mrdocs 68
                virtual int rtti() const { return 654873549; };
69
};
70
 
71
 
4312 subik 72
/*! \brief Very nice list box with color names and samples.
73
It's inherited from QListBox with all its methods and properties.
74
I create it as separate class because it's used now in ColorManager
75
and ColorWheel too. You can see it in Extras/Color Wheel or in
76
Edit/Colors dialogs in action.
77
\author Petr Vanek <petr@yarpen.cz>
78
*/
79
class SCRIBUS_API ColorListBox : public QListBox
80
{
188 Franz 81
        Q_OBJECT
3 paul 82
 
4312 subik 83
        public:
4689 mrdocs 84
 
85
                enum PixmapType
86
                {
87
                        smallPixmap,
88
                        widePixmap,
89
                        fancyPixmap
90
                };
91
 
4312 subik 92
                /*! \brief Standard QListBox like constructor.
93
                Just there are initialized pixmaps for icon drawing. */
94
                ColorListBox(QWidget * parent = 0, const char * name = 0, WFlags f = 0);
95
 
96
                /*! \brief Fill the list box with values taken from list.
97
                The list is cleared itself. Then is rendered an icon with
98
                color attributes (RGB/CMYK/Spot etc.).
4689 mrdocs 99
                \param list a ColorList to present.
100
                \param the pixmap type to use
101
                \param if the list should be cleared first */
6582 jghali 102
                void updateBox(ColorList& list, ColorListBox::PixmapType type, bool clearFirst = true);
103
 
104
                /*! \brief Insert ColorSmallPixmapItems into the list
105
                \param list a ColorList to present. */
106
                void insertSmallPixmapItems(ColorList& list);
107
 
108
                /*! \brief Insert ColorWidePixmapItems into the list
109
                \param list a ColorList to present. */
110
                void insertWidePixmapItems(ColorList& list);
111
 
112
                /*! \brief Insert ColorFancyPixmapItems into the list
113
                \param list a ColorList to present. */
114
                void insertFancyPixmapItems(ColorList& list);
4312 subik 115
};
116
 
117
 
118
/*! \brief Dialog to manage colors and colorsets.
119
It provides all operations - color creating, deleting, importing etc.
120
There are some predefined color sets for user and it is managed here too.
121
*/
122
class SCRIBUS_API ColorManager : public QDialog
123
{
124
        Q_OBJECT
125
 
3 paul 126
public:
5781 cbradney 127
        ColorManager( QWidget* parent, ColorList doco, ScribusDoc* doc, QString docColSet, QStringList custColSet);
4312 subik 128
        ~ColorManager() {};
129
        //! \brief A ColorList with all available colors after dialog closing.
1065 cbradney 130
        ColorList EditColors;
4312 subik 131
        //! \brief in doc used colors
1065 cbradney 132
        ColorList UsedC;
4312 subik 133
        //! \brief Color to color replacement mapping
134
        QMap<QString,QString> replaceMap;
135
        //! \brief Custom user's color set
136
        QStringList customColSet;
168 Franz 137
 
4312 subik 138
        /*! \brief Returns the name of the current/selected color set.
139
        \retval QString selected name. */
140
        QString getColorSetName();
141
 
3 paul 142
private:
4312 subik 143
        QToolButton* LoadColSet;
144
        ColorListBox* colorListBox;
188 Franz 145
        QGroupBox* ColorsGroup;
146
        QGroupBox* ColsSetGroup;
147
        QPushButton* LoadF;
148
        QPushButton* NewF;
149
        QPushButton* EditF;
150
        QPushButton* DupF;
151
        QPushButton* DelF;
152
        QPushButton* DelU;
153
        QPushButton* SaveF;
154
        QPushButton* CancF;
155
        QLabel* textLabel1;
156
        QPushButton* SaveColSet;
168 Franz 157
        QPopupMenu* CSets;
188 Franz 158
        QString sFarbe;
159
        QColor tmpFarbe;
168 Franz 160
        QStringList DontChange;
3137 fschmid 161
        DynamicTip* dynTip;
5781 cbradney 162
        ScribusDoc* m_Doc;
3 paul 163
 
164
private slots:
168 Franz 165
        void saveDefaults();
166
        void loadDefaults(int id);
4312 subik 167
        //! \brief Just note: Farbe is German word for Color...
168 Franz 168
        void loadFarben();
188 Franz 169
        void delFarbe();
170
        void delUnused();
171
        void duplFarbe();
172
        void neueFarbe();
173
        void editFarbe();
174
        void selFarbe(QListBoxItem*);
270 Franz 175
        void selEditFarbe(QListBoxItem*);
188 Franz 176
        void updateCList();
3 paul 177
 
178
protected:
188 Franz 179
        QVBoxLayout* Layout2;
180
        QHBoxLayout* layout5;
181
        QVBoxLayout* layout3;
182
        QVBoxLayout* ColsSetGroupLayout;
183
        QVBoxLayout* Layout1;
4606 cbradney 184
 
185
        ColorSetManager csm;   
186
        int customSetStartIndex;
3 paul 187
};
188
 
189
#endif // FARBMANAGER_H