Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 6437 → Rev 6438

/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwsetcolor.cpp
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/plugins/colorwheel/cwsetcolor.h
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/colorwheel/cwsetcolor.h (revision 6437)
+++ branches/Version13x/Scribus/scribus/plugins/colorwheel/cwsetcolor.h (nonexistent)
@@ -1,97 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-#ifndef CWSETCOLOR_H
-#define CWSETCOLOR_H
-
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QLabel;
-class QSpinBox;
-class QPushButton;
-class QGroupBox;
-class QGridLayout;
-class QVBoxLayout;
-class QColor;
-class QPixmap;
-
-
-/*! \brief A dialog to set color by exact numeric values.
-It provides GUI where the user can set color via its components.
-There are 3 ways to do it - CMYK, RGB and HSV models. Every model
-has its own small color sample too. Wou can access user chosen
-color at newColor public variable.
-\author Petr Vanek <petr@yarpen.cz>
-*/
-class CwSetColor: public QDialog
-{
- Q_OBJECT
-
- public:
- CwSetColor(QColor beginColor, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
- ~CwSetColor(){};
-
- /*! \brief This is the color which user created.
- It's available after exec()==accept() */
- QColor newColor;
-
- protected:
- /*! \brief Color sample, pixmaps. */
- QLabel* rgbSample;
- QLabel* cmykSample;
- QLabel* hsvSample;
-
- QLabel* hLabel;
- QLabel* sLabel;
- QLabel* vLabel;
- QLabel* rLabel;
- QLabel* gLabel;
- QLabel* bLabel;
- QLabel* cLabel;
- QLabel* mLabel;
- QLabel* yLabel;
- QLabel* kLabel;
- QSpinBox* hSpin;
- QSpinBox* sSpin;
- QSpinBox* vSpin;
- QSpinBox* rSpin;
- QSpinBox* gSpin;
- QSpinBox* bSpin;
- QSpinBox* cSpin;
- QSpinBox* mSpin;
- QSpinBox* ySpin;
- QSpinBox* kSpin;
- QPushButton* hsvButton;
- QPushButton* rgbButton;
- QPushButton* cmykButton;
- QGroupBox* rgbBox;
- QGridLayout* rgbBoxLayout;
- QGroupBox* hsvBox;
- QGridLayout* hsvBoxLayout;
- QGroupBox* cmykBox;
- QGridLayout* cmykBoxLayout;
- QVBoxLayout* mainLayout;
- QGridLayout* CwSetColorLayout;
- QPushButton* cancelButton;
-
- protected slots:
- virtual void languageChange();
- virtual void hsvButton_clicked();
- virtual void rgbButton_clicked();
- virtual void cmykButton_clicked();
-
- /*! \brief Fill spinboxes from given color.
- \param col QColor to get components */
- virtual void fillBeginComponents(QColor col);
-
- /*! \brief Draw a sample for specified model */
- virtual void sampleRGB();
- virtual void sampleHSV();
- virtual void sampleCMYK();
-};
-
-#endif
/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwsetcolor.h
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.h
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.h (revision 6437)
+++ branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.h (revision 6438)
@@ -4,7 +4,7 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
-/* $Id$ */
+
#ifndef CWDIALOG_H
#define CWDIALOG_H
@@ -12,6 +12,7 @@
#include <qdialog.h>
#include "colorwheelwidget.h"
#include "scribus.h"
+#include "cwdialogbase.h"
class QVBoxLayout;
class QHBoxLayout;
@@ -26,113 +27,95 @@
class QSlider;
class ColorListBox;
class ScribusDoc;
+class ScColor;
-/*! \brief GUI for colors from preferences/document.
-List all available colors in one dialog with samples.
-\author Petr Vanek; petr@yarpen.cz
-*/
-class ScribusColorList : public QDialog
-{
- Q_OBJECT
- public:
- ScribusColorList(ScribusDoc* doc, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
- ~ScribusColorList(){};
-
- ColorListBox* listView;
- QPushButton* okButton;
- QPushButton* cancelButton;
-
- /*! \brief Selected color when user press "OK" */
- QColor selectedColor;
-
- protected:
- ScribusDoc* m_Doc;
- QGridLayout* ScribusColorListLayout;
- QVBoxLayout* listLayout;
- QHBoxLayout* btnLayout;
- QSpacerItem* btnSpacer;
-
- protected slots:
- virtual void languageChange();
- virtual void okButton_clicked();
-};
-
/** \brief GUI dialog for Color Wheel Plugin.
Quite everything in this class is self explanatory (except few things ;)).
-\author Petr Vanek; petr@yarpen.cz
+\author Petr Vanek <petr@scribus.info>
\date April 2005
-*/
-class ColorWheelDialog : public QDialog
+ */
+class CWDialog : public CWDialogBase
{
Q_OBJECT
-
public:
- ColorWheelDialog( ScribusDoc* doc, QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
- ~ColorWheelDialog();
-
- QLabel* typeLabel;
- QComboBox* typeCombo;
- QListView* colorList;
- ColorWheel* colorWheel;
- QLabel* previewLabel;
- QLabel* angleLabel;
- QSpinBox* angleSpin;
- QPushButton* addButton;
- QPushButton* replaceButton;
- QPushButton* cancelButton;
- QLabel* defectLabel;
- QComboBox* defectCombo;
-
- protected:
- ScribusDoc* m_Doc;
- /** \brief It fills a colors into list view.
- It takes colors from ColorWheel widget. */
- void fillColorList();
-
- QGridLayout* formLayout;
- QHBoxLayout* mainLayout;
- QVBoxLayout* wheelLayout;
- QSpacerItem* spacer1;
- QHBoxLayout* angleLayout;
- QVBoxLayout* listLayout;
- QHBoxLayout* buttonLayout;
- QHBoxLayout* defectLayout;
-
+ CWDialog( QWidget* parent = 0, ScribusDoc* doc = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ ~CWDialog();
+ private:
/** \brief Configuration structure */
PrefsContext* prefs;
+ //! \brief a parent doc reference
+ ScribusDoc* m_Doc;
- /** \brief Draws a strange colorful things as preview of the color schema. */
+ /** \brief Draws a strange colorful things as preview of the color schema.
+ User can see what will see a person with selected kind of color blindness.
+ */
void setPreview();
/*! \brief Main color manipulator for preview.
+ It calls transformations for the other vision defects filters.
\param c input color. QColor from sample list.
- \retval QColor It returns c for normalVision. It calls transformations for other filters*/
+ \retval QColor It returns c for chosen defect filter.
+ */
QColor computeDefect(QColor c);
- /*! \brief Handling of the user requested colors via menus.
- \param c a color given by create/importColor */
- void userColorInput(QColor c);
+ /** \brief It fills colors into list view.
+ It takes colors from ColorWheel widget. */
+ void fillColorList();
- public slots:
- virtual void typeCombo_activated(int);
- virtual void defectCombo_activated(int);
- virtual void colorWheel_clicked(int, const QPoint &);
- virtual void addButton_clicked();
- virtual void replaceButton_clicked();
- virtual void cancelButton_clicked();
- virtual void angleSpin_valueChanged(int);
+ /*! \brief Set the spins with its color component value.
+ It fills recomputed components regarding chosen color model
+ and the changed channel. E.g. if user change R in RGB palette
+ all CMYK channels are recomputed calling setupCMYKComponent(). */
+ void setupColorComponents();
- protected slots:
- virtual void languageChange();
+ /*! \brief A GUI setter for RGB components when is one of CMYK changed.
+ \retval ScColor a color made from RGB channels. */
+ ScColor setupRGBComponent();
- /*! \brief Color from "new color" dialog. Via menu. */
- virtual void createColor();
- /*! \brief Color from "show existing colors" dialog. Via menu. */
- virtual void importColor();
- /*! \brief Create color by exact numeric values. */
- virtual void setColorComponents();
+ /*! \brief A GUI setter for CMYK components when is one of RGB changed.
+ \retval ScColor a color made from CMYK channels. */
+ ScColor setupCMYKComponent();
+ /*! \brief A GUI setter for CMYK and RGB components when there is a ScColor given.
+ It's used e.g. when user select one of the document's colors.
+ \param col A color which is used for RGB,CMYK GUI settings.
+ \retval ScColor a color made from CMYK channels. */
+ ScColor setupFromColor(ScColor col);
+
+ /*! \brief Connect or disconnect rgbcmyk spinboxes signals.
+ \param conn if true perform connect. Disconnect in the case of false
+ */
+ void connectSlots(bool conn=true);
+
+ /*! \brief Call main color calculation.
+ It calls a ColorWheel methods to get requested harmonious colors depending
+ on the dialog's settings.
+ \param index an index of the typeCombo (Color Scheme Method)
+ \param updateSpins if true call setupCMYKComponent() and setupRGBComponent() methods.
+ if false don't reset any of these component spins - it's used for colorWheel
+ mouse clicked/released events.
+ */
+ void processColors(int index, bool updateSpins=true);
+
+ private slots:
+ void colorspaceTab_currentChanged( QWidget * );
+ void angleSpin_valueChanged(int);
+ void colorWheel_clicked(int, const QPoint &);
+ void typeCombo_activated(int);
+ void documentColorList_currentChanged(QListBoxItem *);
+ void defectCombo_activated(int);
+ void addButton_clicked();
+ void replaceButton_clicked();
+ void cancelButton_clicked();
+
+ void cSpin_valueChanged( int );
+ void mSpin_valueChanged( int );
+ void ySpin_valueChanged( int );
+ void kSpin_valueChanged( int );
+ void rSpin_valueChanged( int );
+ void gSpin_valueChanged( int );
+ void bSpin_valueChanged( int );
};
#endif // CWDIALOG_H
/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialogbase.ui
0,0 → 1,782
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>CWDialogBase</class>
<comment>Base class for color wheel dialog</comment>
<author>Petr Vanek &lt;petr@scribus.info&gt;</author>
<widget class="QDialog">
<property name="name">
<cstring>CWDialogBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>575</width>
<height>622</height>
</rect>
</property>
<property name="caption">
<string>Color Wheel</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout51</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout50</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="ColorWheel">
<property name="name">
<cstring>colorWheel</cstring>
</property>
<property name="sizePolicy">
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="toolTip" stdset="0">
<string>Click the wheel to get the base color. Its color model depends on the chosen tab.</string>
</property>
</widget>
<widget class="QTabWidget">
<property name="name">
<cstring>colorspaceTab</cstring>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tabCMYK</cstring>
</property>
<attribute name="title">
<string>CMYK</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout21</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout9</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel4</cstring>
</property>
<property name="text">
<string>C:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>cSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout8</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel5</cstring>
</property>
<property name="text">
<string>M:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>mSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout7</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel6</cstring>
</property>
<property name="text">
<string>Y:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>ySpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout6</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel7</cstring>
</property>
<property name="text">
<string>K:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>kSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout20</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1_2</cstring>
</property>
<property name="text">
<string>RGB:</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>rgbLabel</cstring>
</property>
<property name="frameShape">
<enum>Box</enum>
</property>
<property name="frameShadow">
<enum>Plain</enum>
</property>
<property name="text">
<string></string>
</property>
</widget>
</hbox>
</widget>
<spacer>
<property name="name">
<cstring>spacer3</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabRGB</cstring>
</property>
<attribute name="title">
<string>RGB</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout23</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout11</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel8</cstring>
</property>
<property name="text">
<string>R:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>rSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout12</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel9</cstring>
</property>
<property name="text">
<string>G:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>gSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout16</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel10</cstring>
</property>
<property name="text">
<string>B:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>bSpin</cstring>
</property>
<property name="maxValue">
<number>255</number>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout22</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel3</cstring>
</property>
<property name="text">
<string>CMYK:</string>
</property>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>cmykLabel</cstring>
</property>
<property name="frameShape">
<enum>Box</enum>
</property>
<property name="text">
<string></string>
</property>
</widget>
</hbox>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Vertical</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>20</width>
<height>80</height>
</size>
</property>
</spacer>
</vbox>
</widget>
</grid>
</widget>
<widget class="QWidget">
<property name="name">
<cstring>tabDocument</cstring>
</property>
<attribute name="title">
<string>Document</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="ColorListBox" row="0" column="0">
<property name="name">
<cstring>documentColorList</cstring>
</property>
</widget>
</grid>
</widget>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout23</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout20</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout2</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>Color Scheme Method:</string>
</property>
</widget>
<widget class="QComboBox">
<property name="name">
<cstring>typeCombo</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Select one of the methods to create a color scheme. Refer to documentation for more information.</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout19</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>angleLabel</cstring>
</property>
<property name="text">
<string>Angle:</string>
</property>
</widget>
<widget class="QSpinBox">
<property name="name">
<cstring>angleSpin</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Difference between the selected value and the counted ones. Refer to documentation for more information.</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QGroupBox">
<property name="name">
<cstring>groupBox2</cstring>
</property>
<property name="title">
<string>Preview:</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget" row="0" column="0">
<property name="name">
<cstring>layout22</cstring>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout1</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel1</cstring>
</property>
<property name="text">
<string>Vision Defect Type:</string>
</property>
</widget>
<widget class="QComboBox">
<property name="name">
<cstring>defectCombo</cstring>
</property>
<property name="toolTip" stdset="0">
<string>imulate common vision defects here. Select type of the defect.</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLabel">
<property name="name">
<cstring>previewLabel</cstring>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>100</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>100</height>
</size>
</property>
<property name="frameShape">
<enum>Box</enum>
</property>
<property name="toolTip" stdset="0">
<string>Sample color scheme.</string>
</property>
</widget>
</vbox>
</widget>
</grid>
</widget>
</vbox>
</widget>
<widget class="ColorListBox">
<property name="name">
<cstring>colorList</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Colors of your chosen color scheme.</string>
</property>
</widget>
</hbox>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout5</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>addButton</cstring>
</property>
<property name="text">
<string>&amp;Merge</string>
</property>
<property name="accel">
<string>Alt+M</string>
</property>
<property name="toolTip" stdset="0">
<string>Merge created colors into the document colors</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>replaceButton</cstring>
</property>
<property name="text">
<string>&amp;Replace</string>
</property>
<property name="accel">
<string>Alt+R</string>
</property>
<property name="toolTip" stdset="0">
<string>Replace created colors in the document colors</string>
</property>
</widget>
<widget class="QPushButton">
<property name="name">
<cstring>cancelButton</cstring>
</property>
<property name="text">
<string>&amp;Cancel</string>
</property>
<property name="accel">
<string>Alt+C</string>
</property>
<property name="toolTip" stdset="0">
<string>Leave colors untouched</string>
</property>
</widget>
</hbox>
</widget>
</vbox>
</widget>
</grid>
</widget>
<customwidgets>
<customwidget>
<class>ColorWheel</class>
<header location="local">colorwheelwidget.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>5</hordata>
<verdata>5</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<pixmap>image0</pixmap>
</customwidget>
<customwidget>
<class>ColorListBox</class>
<header location="local">colorm.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
</sizehint>
<container>0</container>
<sizepolicy>
<hordata>5</hordata>
<verdata>5</verdata>
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<pixmap>image0</pixmap>
</customwidget>
</customwidgets>
<images>
<image name="image0">
<data format="PNG" length="1002">89504e470d0a1a0a0000000d4948445200000016000000160806000000c4b46c3b000003b149444154388dad945f4c5b551cc73fe7dc4b7b4bcba0762d45c43114323599ee6192609c51d883892ce083f1718b3ebb185f8dc91e972cf39d2d2a2f1af664b6f1e0fe3863a0718969700eb0c52142da0242a1bd6d696f7bcff101585203ceb8fd9ece39f99dcff9fe7edf939f88c562ec465f5f9fe609442c161362173c3e3eae7b7a7ac8e7f36432196cdbfe4f907c3e4f2291201e8fe338cec3737357e9e8e828aded1e229d650e1f2d51754b082110124c13a4dc5ea341eb9dc284c0558a853f3ce8cb0677ef500fde7d39d2596679e326597b8e9abb85d7a770ab16ab6983ec5a05b487a70e36f0f4e10afe408d6a558310980108478dba4a1e8233990c5d474b64ed39aa3a8fe5f3317fbf81dbd70bccfeb205947632fd74f6589c1c6ea2f70d03a58ba0c1f2c9bdc1b66de3b8256a6e11cbe7e3ee1d181b590124fe2693aeee08d223c82c3a2c24b7b874bec8f26288774f7bd054504aef0dde6e99c0eb83f9fb266323cb80a27fb0958141836044605a2ee5523393371cc646fee2da37195aa35d0c0c5b4859ac03d7e91712dcaac5adab3650a3ff9d08ef7dd8404bb48869e5d958b5b87dadc4c9a1464e9f0d0326df7ebd86bd2e310cb1bf62d384d59441f2d70a070e1c60e09489929b988681bdd9cc97170bcc4c65595f71f8e0e3301337fc24a7732467831875a47f289652b0be5e4151e6d07316c1b0c0340d8ab92023e76d66a6b2840e36d2fb7a13fee632475e6edc367ea98a90fb98b7dd6310ca0328a44761582e1bab41befabcc0ec940d28bc5e93b68e064cab84e1d9beaeb48934eac1f53b01c1b000fca496aa54b61a99fcde61662a4b4b4b23d1680be9d426173e4df3602a48ea411989a4fd590f52a8fd156b05ed9d350e3defe3cfdf4b4c7ce770ea7d3fb9f520afbe1620daeee5c26735d20b9b9cfb6811a754a439e4e5c5639a4caa1e5caf586bfc0197b78702005cb9b4cae4cd3267ce8638fe964bd72b393e39d74928d242617303a756a37f284447770dcdbffc6384a05a85de1306e9a52057c7527c7131c3c42d3f475eb2303c82d4fc3276d6811db37efeb148723082d9b08f79f97c1e5729109a9a28307cc622d2d6cdf52b2b24efe548dedb00142009862cfa879ee1a71f6cec928353511472fbf4389148b0b0e0c108081412458dfe21c9f11351e67e7358595468246d1d1e5e38a6e9e851bc39d84ab502a669331dafec0d8ec7e3e8cb06e1a881d727d1ae40180a434a8c9db129a54126ad48a7358c2b4c5352c8c374bcccdab2bb37d8719cba79fab8211f9df218e0582c261e95f8bfc04f1a1e8bc5c4dfe0a190172af6a9690000000049454e44ae426082</data>
</image>
</images>
<connections>
<connection>
<sender>colorspaceTab</sender>
<signal>currentChanged(QWidget*)</signal>
<receiver>CWDialogBase</receiver>
<slot>colorspaceTab_currentChanged(QWidget*)</slot>
</connection>
<connection>
<sender>angleSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>angleSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>typeCombo</sender>
<signal>activated(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>typeCombo_activated(int)</slot>
</connection>
<connection>
<sender>defectCombo</sender>
<signal>activated(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>defectCombo_activated(int)</slot>
</connection>
<connection>
<sender>addButton</sender>
<signal>clicked()</signal>
<receiver>CWDialogBase</receiver>
<slot>addButton_clicked()</slot>
</connection>
<connection>
<sender>replaceButton</sender>
<signal>clicked()</signal>
<receiver>CWDialogBase</receiver>
<slot>replaceButton_clicked()</slot>
</connection>
<connection>
<sender>cancelButton</sender>
<signal>clicked()</signal>
<receiver>CWDialogBase</receiver>
<slot>cancelButton_clicked()</slot>
</connection>
<connection>
<sender>cSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>cSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>mSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>mSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>ySpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>ySpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>kSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>kSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>rSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>rSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>gSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>gSpin_valueChanged(int)</slot>
</connection>
<connection>
<sender>bSpin</sender>
<signal>valueChanged(int)</signal>
<receiver>CWDialogBase</receiver>
<slot>bSpin_valueChanged(int)</slot>
</connection>
</connections>
<slots>
<slot>colorspaceTab_currentChanged( QWidget * )</slot>
<slot>angleSpin_valueChanged( int )</slot>
<slot>typeCombo_activated( int )</slot>
<slot>defectCombo_activated( int )</slot>
<slot>addButton_clicked()</slot>
<slot>replaceButton_clicked()</slot>
<slot>cancelButton_clicked()</slot>
<slot>cSpin_valueChanged( int )</slot>
<slot>mSpin_valueChanged( int )</slot>
<slot>ySpin_valueChanged( int )</slot>
<slot>kSpin_valueChanged( int )</slot>
<slot>rSpin_valueChanged( int )</slot>
<slot>gSpin_valueChanged( int )</slot>
<slot>bSpin_valueChanged( int )</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
<includehints>
<includehint>colorwheelwidget.h</includehint>
<includehint>colorm.h</includehint>
<includehint>colorm.h</includehint>
</includehints>
</UI>
Property changes:
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision
\ No newline at end of property
Index: branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.cpp (revision 6437)
+++ branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.cpp (revision 6438)
@@ -4,7 +4,7 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
-/* $Id$ */
+
#include "colorwheel.h"
#include "colorwheel.moc"
#include "cwdialog.h"
@@ -85,7 +85,7 @@
ScribusDoc* currDoc=doc;
if (currDoc==0)
currDoc=ScCore->primaryMainWindow()->doc;
- ColorWheelDialog *dlg = new ColorWheelDialog(currDoc, currDoc->scMW(), "dlg", true, 0);
+ CWDialog *dlg = new CWDialog(currDoc->scMW(), currDoc, "dlg", true, 0);
if (dlg)
{
dlg->exec();
Index: branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp
===================================================================
--- branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp (revision 6437)
+++ branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheelwidget.cpp (revision 6438)
@@ -4,7 +4,7 @@
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
-/* $Id$ */
+
#include "colorwheelwidget.h"
#include "colorwheelwidget.moc"
#include <qpainter.h>
@@ -17,6 +17,7 @@
ColorWheel::ColorWheel(QWidget * parent, const char * name) : QLabel(parent, name, WNoAutoErase)
{
+ currentColorSpace = colorModelRGB;
baseAngle = 0;
angleShift = 270;
widthH = heightH = 150;
@@ -28,8 +29,9 @@
{
QColor c;
c.setHsv(i, 255, 255);
- colorMap[mapIndex] = c;
- ++mapIndex;
+ ScColor col;
+ col.fromQColor(c);
+ colorMap[mapIndex++] = col;
if (mapIndex > 359)
mapIndex = 0;
}
@@ -49,6 +51,7 @@
{
baseAngle = valueFromPoint(e->pos());
actualColor = colorMap[baseAngle];
+ actualColor.setColorModel(currentColorSpace);
emit clicked(e->button(), e->pos());
}
@@ -56,6 +59,11 @@
{
paintWheel();
paintCenterSample();
+ makeColors();
+}
+
+void ColorWheel::makeColors()
+{
if (currentType == Monochromatic)
makeMonochromatic();
if (currentType == Analogous)
@@ -75,7 +83,7 @@
QPainter p;
p.begin(this);
p.setPen(QPen(Qt::black, 2));
- p.setBrush(actualColor);
+ p.setBrush(actualColor.getRGBColor());
p.drawEllipse(widthH - 20, heightH - 20, 40, 40);
p.end();
}
@@ -83,7 +91,8 @@
void ColorWheel::paintWheel()
{
int h, s, v;
- actualColor.hsv(&h, &s, &v);
+ QColor col(actualColor.getRGBColor());
+ col.hsv(&h, &s, &v);
int width = this->width();
int height = this->height();
QPainter p;
@@ -130,22 +139,20 @@
while (angle < 0)
angle += 359;
drawBorderPoint(angle);
- return cmykColor(colorMap[angle]);
+ return colorSpaceColor(colorMap[angle]);
}
-ScColor ColorWheel::cmykColor(QColor col)
+ScColor ColorWheel::colorSpaceColor(ScColor col)
{
- ScColor c = ScColor();
- /* Dirty Hack to avoid Color Managed RGB -> CMYK conversion */
- c.setSpotColor(true);
- int h, sm, vm, s, v;
- actualColor.getHsv(&h, &s, &v);
- col.getHsv(&h, &sm, &vm);
- col.setHsv(h, s, v);
- c.fromQColor(col);
- c.setColorModel(colorModelCMYK);
- c.setSpotColor(false);
- return c;
+ QColor newcol;
+ ScColor ret;
+ int h, s, v;
+
+ col.getRGBColor().getHsv(&h, &s, &v);
+ newcol.setHsv(h, s, v);
+ ret.fromQColor(newcol);
+ ret.setColorModel(currentColorSpace);
+ return ret;
}
void ColorWheel::baseColor()
@@ -154,18 +161,20 @@
drawBorderPoint(baseAngle, true);
paintCenterSample();
colorList.clear();
- colorList[ tr("Base Color")] = cmykColor(actualColor);
+ colorList[tr("Base Color")] = colorSpaceColor(actualColor);
}
void ColorWheel::makeMonochromatic()
{
baseColor();
- ScColor l = ScColor();
- l.fromQColor(actualColor.light());
- ScColor d = ScColor();
- d.fromQColor(actualColor.dark());
+ QColor col(actualColor.getRGBColor());
+ ScColor l;
+ l.fromQColor(col.light());
+ l.setColorModel(currentColorSpace);
colorList[tr("Monochromatic Light")] = l;
- colorList[tr("Monochromatic Dark")] = d;
+ l.fromQColor(col.dark());
+ l.setColorModel(currentColorSpace);
+ colorList[tr("Monochromatic Dark")] = l;
currentType = Monochromatic;
}
@@ -266,19 +275,24 @@
return val;
}
-bool ColorWheel::recomputeColor(QColor col)
+bool ColorWheel::recomputeColor(ScColor col)
{
int origh, origs, origv;
ColorMap::iterator it;
+ QColor c(col.getRGBColor());
+ QColor act(actualColor.getRGBColor());
- col.hsv(&origh, &origs, &origv);
+ c.hsv(&origh, &origs, &origv);
for (it = colorMap.begin(); it != colorMap.end(); ++it)
{
int tmph, tmps, tmpv;
- it.data().hsv(&tmph, &tmps, &tmpv);
+ QColor col(it.data().getRGBColor());
+ col.hsv(&tmph, &tmps, &tmpv);
if (origh == tmph)
{
- actualColor.setHsv(tmph, origs, origv);
+ act.setHsv(tmph, origs, origv);
+ actualColor.fromQColor(act);
+ actualColor.setColorModel(currentColorSpace);
baseAngle = it.key();
return true;
}
/branches/Version13x/Scribus/scribus/plugins/colorwheel/Makefile.am
6,9 → 6,9
 
libcolorwheel_la_LDFLAGS = -version-info 0:0:0
libcolorwheel_la_METASOURCES = AUTO
libcolorwheel_la_SOURCES = colorwheel.cpp colorwheelwidget.cpp cwdialog.cpp colorblind.cpp cwsetcolor.cpp
libcolorwheel_la_SOURCES = cwdialogbase.ui colorwheel.cpp colorwheelwidget.cpp cwdialog.cpp colorblind.cpp
 
EXTRA_DIST = colorwheel.cpp colorwheel.h colorwheelwidget.cpp colorwheelwidget.h cwdialog.cpp cwdialog.h colorblind.cpp colorblind.h cwsetcolor.cpp cwsetcolor.h
EXTRA_DIST = cwdialogbase.ui colorwheel.cpp colorwheel.h colorwheelwidget.cpp colorwheelwidget.h cwdialog.cpp cwdialog.h colorblind.cpp colorblind.h
 
KDE_OPTIONS = qtonly
AM_LDFLAGS = $(LIBFREETYPE_LIBS) $(MODULE_LINK_FLAGS)
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheel.h
4,7 → 4,7
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/* $Id$ */
 
#ifndef COLORWHEEL_H
#define COLORWHEEL_H
 
16,7 → 16,7
scheme that looks attractive; the color wheel can be used as a valuable
tool for determining harmonious colors.
More on: http://en.wikipedia.org/wiki/Color_wheel
\author Petr Vanek; petr@yarpen.cz
\author Petr Vanek <petr@scribus.info>
\date April 2005
*/
class PLUGIN_API ColorWheelPlugin : public ScActionPlugin
/branches/Version13x/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
4,9 → 4,10
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/* $Id$ */
 
#include "cwdialog.h"
#include "cwdialog.moc"
#include "cwdialogbase.moc"
 
#include <qvariant.h>
#include <qcombobox.h>
22,6 → 23,7
#include <qmenubar.h>
#include <qgroupbox.h>
#include <qslider.h>
#include <qtabwidget.h>
 
#include "prefsmanager.h"
#include "commonstrings.h"
29,145 → 31,15
#include "prefsfile.h"
#include "mpalette.h"
#include "colorblind.h"
#include "cwsetcolor.h"
#include "colorutil.h"
#include "colorm.h"
 
 
ScribusColorList::ScribusColorList(ScribusDoc* doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl),
m_Doc(doc)
CWDialog::CWDialog(QWidget* parent, ScribusDoc* doc, const char* name, bool modal, WFlags fl)
: CWDialogBase (parent, name, modal, fl),
m_Doc(doc)
{
if (!name)
setName("ScribusColorList");
ScribusColorListLayout = new QGridLayout(this, 1, 1, 11, 6, "ScribusColorListLayout");
 
listLayout = new QVBoxLayout(0, 0, 6, "listLayout");
 
listView = new ColorListBox(this, "listView");
listLayout->addWidget(listView);
listView->updateBox(m_Doc->PageColors, ColorListBox::fancyPixmap);
 
btnLayout = new QHBoxLayout(0, 0, 6, "btnLayout");
btnSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
btnLayout->addItem(btnSpacer);
 
okButton = new QPushButton(this, "okButton");
btnLayout->addWidget(okButton);
 
cancelButton = new QPushButton(this, "cancelButton");
btnLayout->addWidget(cancelButton);
listLayout->addLayout(btnLayout);
 
ScribusColorListLayout->addLayout(listLayout, 0, 0);
languageChange();
resize(QSize(288, 310).expandedTo(minimumSizeHint()));
clearWState(WState_Polished);
 
connect(listView, SIGNAL(doubleClicked(QListBoxItem *)), this, SLOT(okButton_clicked()));
connect(okButton, SIGNAL(clicked()), this, SLOT(okButton_clicked()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject()));
}
 
void ScribusColorList::languageChange()
{
setCaption( tr("Document Colors"));
okButton->setText(CommonStrings::tr_OK);
cancelButton->setText(CommonStrings::tr_Cancel);
}
 
void ScribusColorList::okButton_clicked()
{
ScColor c = m_Doc->PageColors[listView->currentText()];
selectedColor = c.getRGBColor();
accept();
}
 
 
ColorWheelDialog::ColorWheelDialog(ScribusDoc* doc, QWidget* parent, const char* name, bool modal, WFlags fl)
: QDialog(parent, name, modal, fl),
m_Doc(doc)
{
if (!name)
setName("ColorWheelDialog");
 
QMenuBar *menuBar = new QMenuBar(this, "menuBar");
QPopupMenu *colorMenu = new QPopupMenu(this);
colorMenu->insertItem( tr("Cr&eate color..."), this, SLOT(createColor()));
colorMenu->insertItem( tr("C&olor Components..."), this, SLOT(setColorComponents()));
colorMenu->insertItem( tr("&Import existing color..."), this, SLOT(importColor()));
colorMenu->insertSeparator();
colorMenu->insertItem( tr("&Merge colors"), this, SLOT(addButton_clicked()));
colorMenu->insertItem( tr("&Replace colors"), this, SLOT(replaceButton_clicked()));
colorMenu->insertItem( tr("E&xit"), this, SLOT(cancelButton_clicked()));
menuBar->insertItem( tr("C&olor"), colorMenu);
 
formLayout = new QGridLayout(this, 1, 1, 11, 6, "formLayout");
formLayout->setMenuBar(menuBar);
mainLayout = new QHBoxLayout(0, 0, 6, "mainLayout");
wheelLayout = new QVBoxLayout(0, 0, 6, "wheelLayout");
 
colorWheel = new ColorWheel(this, "colorWheel");
colorWheel->setFrameShape(QFrame::Box);
colorWheel->setMinimumSize(QSize(300, 300));
colorWheel->setMaximumSize(QSize(300, 300));
wheelLayout->addWidget(colorWheel);
 
typeLabel = new QLabel(this, "typeLabel");
wheelLayout->addWidget(typeLabel);
typeCombo = new QComboBox(false, this, "typeCombo");
wheelLayout->addWidget(typeCombo);
 
angleLabel = new QLabel(this, "angleLabel");
angleLayout = new QHBoxLayout(0, 0, 6, "angleLayout");
angleLayout->addWidget(angleLabel);
angleSpin = new QSpinBox(this, "angleSpin");
angleSpin->setMinValue(0);
angleSpin->setMaxValue(90);
angleLayout->addWidget(angleSpin);
wheelLayout->addLayout(angleLayout);
 
spacer1 = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
wheelLayout->addItem(spacer1);
mainLayout->addLayout(wheelLayout);
 
listLayout = new QVBoxLayout(0, 0, 6, "listLayout");
 
defectLayout = new QHBoxLayout(0, 0, 6, "defectLayout");
defectLabel = new QLabel(this, "defectLabel");
defectLayout->addWidget(defectLabel);
defectCombo = new QComboBox(false, this, "defectCombo");
defectLayout->addWidget(defectCombo);
listLayout->addLayout(defectLayout);
 
previewLabel = new QLabel(this, "previewLabel");
previewLabel->setFrameShape(QFrame::Box);
previewLabel->setMinimumSize(QSize(400, 160));
previewLabel->setMaximumSize(QSize(400, 160));
listLayout->addWidget(previewLabel);
 
colorList = new QListView(this, "colorList");
listLayout->addWidget(colorList);
 
buttonLayout = new QHBoxLayout(0, 0, 6, "buttonLayout");
addButton = new QPushButton(this, "addButton");
addButton->setAutoDefault(false);
buttonLayout->addWidget(addButton);
replaceButton = new QPushButton(this, "replaceButton");
replaceButton->setAutoDefault(false);
buttonLayout->addWidget(replaceButton);
cancelButton = new QPushButton(this, "cancelButton");
cancelButton->setAutoDefault(false);
buttonLayout->addWidget(cancelButton);
 
listLayout->addLayout(buttonLayout);
mainLayout->addLayout(listLayout);
formLayout->addLayout(mainLayout, 0, 0);
 
languageChange();
resize(QSize(600, 480).expandedTo(minimumSizeHint()));
clearWState(WState_Polished);
 
connectSlots(false);
// setup combobox
typeCombo->insertItem(colorWheel->getTypeDescription(colorWheel->Monochromatic), colorWheel->Monochromatic);
typeCombo->insertItem(colorWheel->getTypeDescription(colorWheel->Analogous), colorWheel->Analogous);
181,7 → 53,6
defectCombo->insertItem( tr("Deuteranopia (Green)"));
defectCombo->insertItem( tr("Tritanopia (Blue)"));
defectCombo->insertItem( tr("Full Color Blindness"));
 
// preferences
prefs = PrefsManager::instance()->prefsFile->getPluginContext("colorwheel");
typeCombo->setCurrentItem(prefs->getInt("cw_type", 0));
188,143 → 59,204
angleSpin->setValue(prefs->getInt("cw_angle", 15));
colorWheel->angle = angleSpin->value();
colorWheel->baseAngle = prefs->getInt("cw_baseangle", 0);
colorWheel->actualColor = QColor(prefs->getInt("cw_r", 0), prefs->getInt("cw_g", 0), prefs->getInt("cw_b", 0));
colorspaceTab->setCurrentPage(prefs->getInt("cw_space", 0));
colorWheel->actualColor.setColor(prefs->getInt("cw_c", 0),
prefs->getInt("cw_m", 0),
prefs->getInt("cw_y", 0),
prefs->getInt("cw_k", 0));
resize(QSize(prefs->getInt("cw_width", 640),
prefs->getInt("cw_height", 480)).expandedTo(minimumSizeHint()));
previewLabel->resize(prefs->getInt("cw_samplex", 300), prefs->getInt("cw_sampley", 100));
// document colors
documentColorList->updateBox(m_Doc->PageColors, ColorListBox::fancyPixmap);
// setup
colorspaceTab_currentChanged(colorspaceTab->currentPage());
 
// actions
typeCombo_activated(typeCombo->currentItem());
 
// signals and slots connections
connect(typeCombo, SIGNAL(activated(int)), this, SLOT(typeCombo_activated(int)));
connect(defectCombo, SIGNAL(activated(int)), this, SLOT(defectCombo_activated(int)));
connect(colorWheel, SIGNAL(clicked(int, const QPoint&)), this, SLOT(colorWheel_clicked(int, const QPoint&)));
colorWheel_clicked(0, QPoint(0, 0));
connect(angleSpin, SIGNAL(valueChanged(int)), this, SLOT(angleSpin_valueChanged(int)));
connect(addButton, SIGNAL(clicked()), this, SLOT(addButton_clicked()));
connect(replaceButton, SIGNAL(clicked()), this, SLOT(replaceButton_clicked()));
connect(cancelButton, SIGNAL(clicked()), this, SLOT(cancelButton_clicked()));
// signals and slots that cannot be in ui file
connect(colorWheel, SIGNAL(clicked(int, const QPoint&)),
this, SLOT(colorWheel_clicked(int, const QPoint&)));
connect(documentColorList, SIGNAL(currentChanged(QListBoxItem *)),
this, SLOT(documentColorList_currentChanged(QListBoxItem *)));
connectSlots(true);
}
 
/*
* Destroys the object and frees any allocated resources
*/
ColorWheelDialog::~ColorWheelDialog()
CWDialog::~CWDialog()
{
// no need to delete child widgets, Qt does it all for us
// preferences
prefs->set("cw_type", typeCombo->currentItem());
prefs->set("cw_angle", angleSpin->value());
prefs->set("cw_baseangle", colorWheel->baseAngle);
prefs->set("cw_r", colorWheel->actualColor.red());
prefs->set("cw_g", colorWheel->actualColor.green());
prefs->set("cw_b", colorWheel->actualColor.blue());
prefs->set("cw_r", rSpin->value());
prefs->set("cw_g", gSpin->value());
prefs->set("cw_b", bSpin->value());
prefs->set("cw_c", cSpin->value());
prefs->set("cw_m", mSpin->value());
prefs->set("cw_y", ySpin->value());
prefs->set("cw_k", kSpin->value());
prefs->set("cw_space", colorspaceTab->currentPageIndex());
// GUI settings
prefs->set("cw_width", width());
prefs->set("cw_height", height());
prefs->set("cw_samplex", previewLabel->width());
prefs->set("cw_sampley", previewLabel->height());
}
 
/*
* Sets the strings of the subwidgets using the current
* language.
*/
void ColorWheelDialog::languageChange()
void CWDialog::connectSlots(bool conn)
{
defectLabel->setText( tr("Vision Defect:"));
setCaption( tr("Color Wheel"));
colorList->addColumn( tr("Color"));
colorList->addColumn( tr("Name"));
colorList->addColumn( tr("C"));
colorList->addColumn( tr("M"));
colorList->addColumn( tr("Y"));
colorList->addColumn( tr("K"));
colorList->setSorting(1);
typeLabel->setText( tr("Select Method:"));
angleLabel->setText( tr("Angle (0 - 90 degrees):"));
addButton->setText( tr("&Merge Colors"));
replaceButton->setText( tr("&Replace Colors"));
cancelButton->setText(CommonStrings::tr_Cancel);
// tips
QToolTip::add(addButton, "<qt>" + tr("Merge created colors into the document colors") + "</qt>");
QToolTip::add(replaceButton, "<qt>" + tr("Replace created colors in the document colors") + "</qt>");
QToolTip::add(cancelButton, "<qt>" + tr("Leave colors untouched") + "</qt>");
QToolTip::add(angleSpin, "<qt>" + tr("Difference between the selected value and the counted ones. Refer to documentation for more information.") + "</qt>");
QToolTip::add(colorWheel, "<qt>" + tr("Click the wheel to get the base color. It is hue in HSV mode.") + "</qt>");
QToolTip::add(previewLabel, "<qt>" + tr("Sample color scheme") + "</qt>");
QToolTip::add(typeCombo, "<qt>" + tr("Select one of the methods to create a color scheme. Refer to documentation for more information.") + "</qt>");
QToolTip::add(colorList, "<qt>" + tr("Colors of your chosen color scheme") + "</qt>");
QToolTip::add(defectCombo, "<qt>" + tr("Simulate common vision defects here. Select type of the defect.") + "</qt>");
if (conn)
{
connect( cSpin, SIGNAL( valueChanged(int) ), this, SLOT( cSpin_valueChanged(int) ) );
connect( mSpin, SIGNAL( valueChanged(int) ), this, SLOT( mSpin_valueChanged(int) ) );
connect( ySpin, SIGNAL( valueChanged(int) ), this, SLOT( ySpin_valueChanged(int) ) );
connect( kSpin, SIGNAL( valueChanged(int) ), this, SLOT( kSpin_valueChanged(int) ) );
connect( rSpin, SIGNAL( valueChanged(int) ), this, SLOT( rSpin_valueChanged(int) ) );
connect( gSpin, SIGNAL( valueChanged(int) ), this, SLOT( gSpin_valueChanged(int) ) );
connect( bSpin, SIGNAL( valueChanged(int) ), this, SLOT( bSpin_valueChanged(int) ) );
}
else
{
disconnect( cSpin, SIGNAL( valueChanged(int) ), this, SLOT( cSpin_valueChanged(int) ) );
disconnect( mSpin, SIGNAL( valueChanged(int) ), this, SLOT( mSpin_valueChanged(int) ) );
disconnect( ySpin, SIGNAL( valueChanged(int) ), this, SLOT( ySpin_valueChanged(int) ) );
disconnect( kSpin, SIGNAL( valueChanged(int) ), this, SLOT( kSpin_valueChanged(int) ) );
disconnect( rSpin, SIGNAL( valueChanged(int) ), this, SLOT( rSpin_valueChanged(int) ) );
disconnect( gSpin, SIGNAL( valueChanged(int) ), this, SLOT( gSpin_valueChanged(int) ) );
disconnect( bSpin, SIGNAL( valueChanged(int) ), this, SLOT( bSpin_valueChanged(int) ) );
}
}
 
void ColorWheelDialog::fillColorList()
void CWDialog::documentColorList_currentChanged(QListBoxItem *item)
{
colorList->clear();
for (ColorList::iterator it = colorWheel->colorList.begin(); it != colorWheel->colorList.end(); ++it)
if (!item)
return;
ScColor c = m_Doc->PageColors[documentColorList->currentText()];
colorWheel->currentColorSpace = c.getColorModel();
setupColorComponents();
}
 
void CWDialog::colorspaceTab_currentChanged( QWidget * tab)
{
if (tab == tabCMYK)
colorWheel->currentColorSpace = colorModelCMYK;
if (tab == tabRGB)
colorWheel->currentColorSpace = colorModelRGB;
if (tab == tabDocument)
{
int c, m, y, k;
QListViewItem *item = new QListViewItem(colorList);
QPixmap *pm = getSmallPixmap(it.data().getRGBColor());
item->setPixmap(0, *pm);
item->setText(1, it.key());
it.data().getCMYK(&c, &m, &y, &k);
item->setText(2, QString("%1").arg(c));
item->setText(3, QString("%1").arg(m));
item->setText(4, QString("%1").arg(y));
item->setText(5, QString("%1").arg(k));
if (documentColorList->currentItem() == -1)
documentColorList->setSelected(0, true);
documentColorList_currentChanged(documentColorList->item(documentColorList->currentItem()));
}
processColors(typeCombo->currentItem(), true);
}
 
void ColorWheelDialog::typeCombo_activated(int index)
void CWDialog::typeCombo_activated(int index)
{
processColors(index, false);
}
 
void CWDialog::processColors(int index, bool updateSpins)
{
bool angEnable = false;
colorList->clear();
if (index == colorWheel->Monochromatic)
{
angleSpin->setEnabled(false);
angleLabel->setEnabled(false);
colorWheel->makeMonochromatic();
}
colorWheel->currentType = colorWheel->Monochromatic;
if (index == colorWheel->Analogous)
{
angleSpin->setEnabled(true);
angleLabel->setEnabled(true);
colorWheel->makeAnalogous();
angEnable = true;
colorWheel->currentType = colorWheel->Analogous;
}
if (index == colorWheel->Complementary)
{
angleSpin->setEnabled(false);
angleLabel->setEnabled(false);
colorWheel->makeComplementary();
}
colorWheel->currentType = colorWheel->Complementary;
if (index == colorWheel->Split)
{
angleSpin->setEnabled(true);
angleLabel->setEnabled(true);
colorWheel->makeSplit();
angEnable = true;
colorWheel->currentType = colorWheel->Split;
}
if (index == colorWheel->Triadic)
{
angleSpin->setEnabled(false);
angleLabel->setEnabled(false);
colorWheel->makeTriadic();
}
colorWheel->currentType = colorWheel->Triadic;
if (index == colorWheel->Tetradic)
{
angleSpin->setEnabled(true);
angleLabel->setEnabled(true);
colorWheel->makeTetradic();
angEnable = true;
colorWheel->currentType = colorWheel->Tetradic;
}
angleSpin->setEnabled(angEnable);
angleLabel->setEnabled(angEnable);
colorWheel->makeColors();
fillColorList();
setPreview();
if (updateSpins)
setupFromColor(colorWheel->actualColor);
cmykLabel->setText(colorWheel->actualColor.nameCMYK());
rgbLabel->setText(colorWheel->actualColor.nameRGB());
}
 
void ColorWheelDialog::colorWheel_clicked(int, const QPoint&)
void CWDialog::colorWheel_clicked(int, const QPoint&)
{
typeCombo_activated(typeCombo->currentItem());
processColors(typeCombo->currentItem(), true);
}
 
void ColorWheelDialog::angleSpin_valueChanged(int value)
void CWDialog::angleSpin_valueChanged(int value)
{
colorWheel->angle = value;
typeCombo_activated(typeCombo->currentItem());
processColors(typeCombo->currentItem(), false);
}
 
void ColorWheelDialog::addButton_clicked()
void CWDialog::setPreview()
{
int x = previewLabel->width();
int y = previewLabel->height();
QValueList<ScColor> cols = colorWheel->colorList.values();
int xstep = x / cols.count();
QPixmap pm = QPixmap(x, y);
QPainter *p = new QPainter(&pm);
QFontMetrics fm = p->fontMetrics();
 
pm.fill(Qt::white);
p->setPen(Qt::white);
p->drawRect(0, 0, x, y);
for (uint i = 0; i < cols.count(); ++i)
{
QColor c = computeDefect(cols[i].getRGBColor());
p->setPen(c);
p->setBrush(c);
p->drawRect(i * xstep, 0, xstep, y);
}
p->setPen(Qt::black);
p->setBrush(Qt::black);
p->drawText(15, 5 + fm.height(), "Lorem ipsum dolor sit amet");
p->setPen(Qt::white);
p->setBrush(Qt::white);
p->drawText(125, y - 5 - fm.height(), "Lorem ipsum dolor sit amet");
p->end();
delete(p);
previewLabel->clear();
previewLabel->setPixmap(pm);
}
 
QColor CWDialog::computeDefect(QColor c)
{
if (defectCombo->currentItem() == VisionDefectColor::normalVision)
return c;
VisionDefectColor *defect = new VisionDefectColor(c);
defect->deficiency = defectCombo->currentItem();
defect->convertDefect();
QColor nc = defect->getColor();
delete defect;
return nc;
}
 
void CWDialog::fillColorList()
{
colorList->updateBox(colorWheel->colorList, ColorListBox::fancyPixmap);
}
 
void CWDialog::defectCombo_activated(int)
{
setPreview();
}
 
void CWDialog::addButton_clicked()
{
QString status("<qt><h2>" + tr("Merging colors") + "</h2><p>");
bool err = false;
for (ColorList::iterator it = colorWheel->colorList.begin(); it != colorWheel->colorList.end(); ++it)
352,7 → 284,7
accept();
}
 
void ColorWheelDialog::replaceButton_clicked()
void CWDialog::replaceButton_clicked()
{
for (ColorList::iterator it = colorWheel->colorList.begin(); it != colorWheel->colorList.end(); ++it)
{
363,98 → 295,110
accept();
}
 
void ColorWheelDialog::cancelButton_clicked()
void CWDialog::cancelButton_clicked()
{
reject();
}
 
void ColorWheelDialog::defectCombo_activated(int /*index*/)
void CWDialog::cSpin_valueChanged( int )
{
setPreview();
setupColorComponents();
}
 
void ColorWheelDialog::setPreview()
void CWDialog::mSpin_valueChanged( int )
{
int x = previewLabel->width();
int y = previewLabel->height();
QValueList<ScColor> cols = colorWheel->colorList.values();
int xstep = x / cols.count();
QPixmap pm = QPixmap(x, y);
QPainter *p = new QPainter(&pm);
QFontMetrics fm = p->fontMetrics();
setupColorComponents();
}
 
pm.fill(Qt::white);
p->setPen(Qt::white);
p->drawRect(0, 0, x, y);
for (uint i = 0; i < cols.count(); ++i)
{
QColor c = computeDefect(cols[i].getRGBColor());
p->setPen(c);
p->setBrush(c);
p->drawRect(i * xstep, 0, xstep, y);
}
p->setPen(Qt::black);
p->setBrush(Qt::black);
p->drawText(15, 5 + fm.height(), "Lorem ipsum dolor sit amet");
p->setPen(Qt::white);
p->setBrush(Qt::white);
p->drawText(125, y - 5 - fm.height(), "Lorem ipsum dolor sit amet");
p->end();
delete(p);
previewLabel->clear();
previewLabel->setPixmap(pm);
void CWDialog::ySpin_valueChanged( int )
{
setupColorComponents();
}
 
QColor ColorWheelDialog::computeDefect(QColor c)
void CWDialog::kSpin_valueChanged( int )
{
if (defectCombo->currentItem() == VisionDefectColor::normalVision)
return c;
VisionDefectColor *defect = new VisionDefectColor(c);
defect->deficiency = defectCombo->currentItem();
defect->convertDefect();
QColor nc = defect->getColor();
delete defect;
return nc;
setupColorComponents();
}
 
void ColorWheelDialog::createColor()
void CWDialog::rSpin_valueChanged( int )
{
ScColor beginColor;
/* these 2 variables are defined for CMYKChoose constructor.
No other need to use them. */
ColorList tmpcl;
QStringList tmpsl;
setupColorComponents();
}
 
beginColor.fromQColor(colorWheel->actualColor);
CMYKChoose* dia = new CMYKChoose(this, m_Doc, beginColor, tr("New Color"), &tmpcl, tmpsl, true);
if (dia->exec())
userColorInput(dia->Farbe.getRGBColor());
delete dia;
void CWDialog::gSpin_valueChanged( int )
{
setupColorComponents();
}
 
void ColorWheelDialog::setColorComponents()
void CWDialog::bSpin_valueChanged( int )
{
CwSetColor *dia = new CwSetColor(colorWheel->actualColor, this);
if (dia->exec())
userColorInput(dia->newColor);
delete dia;
setupColorComponents();
}
 
void ColorWheelDialog::importColor()
ScColor CWDialog::setupRGBComponent()
{
ScribusColorList *dia = new ScribusColorList(m_Doc, this, "dia", true, 0);
if (dia->exec())
userColorInput(dia->selectedColor);
delete dia;
int r, g, b;
ScColor col(cSpin->value(), mSpin->value(), ySpin->value(), kSpin->value());
col.getRGB(&r, &g, &b);
connectSlots(false);
rSpin->setValue(r);
gSpin->setValue(g);
bSpin->setValue(b);
connectSlots(true);
return col;
}
 
void ColorWheelDialog::userColorInput(QColor c)
ScColor CWDialog::setupCMYKComponent()
{
int c, m, y, k;
ScColor col(rSpin->value(), gSpin->value(), bSpin->value());
col.getCMYK(&c, &m, &y, &k);
connectSlots(false);
cSpin->setValue(c);
mSpin->setValue(m);
ySpin->setValue(y);
kSpin->setValue(k);
connectSlots(true);
return col;
}
 
ScColor CWDialog::setupFromColor(ScColor col)
{
int r, g, b, c, m, y, k;
col.getRGB(&r, &g, &b);
col.getCMYK(&c, &m, &y, &k);
connectSlots(false);
rSpin->setValue(r);
gSpin->setValue(g);
bSpin->setValue(b);
cSpin->setValue(c);
mSpin->setValue(m);
ySpin->setValue(y);
kSpin->setValue(k);
connectSlots(true);
return col;
}
 
void CWDialog::setupColorComponents()
{
ScColor c;
if (colorspaceTab->currentPage() == tabCMYK)
c = setupRGBComponent();
if (colorspaceTab->currentPage() == tabRGB)
c = setupCMYKComponent();
if (colorspaceTab->currentPage() == tabDocument)
c = setupFromColor(m_Doc->PageColors[documentColorList->currentText()]);
 
if (colorWheel->recomputeColor(c))
typeCombo_activated(typeCombo->currentItem());
processColors(typeCombo->currentItem(), false);
else
{
colorList->clear();
QMessageBox::information(this, caption(),
"<qt>" + tr("Unable to find the requested color. "
"You have probably selected black, gray or white. "
"There is no way to process this color.") + "</qt>");
"<qt>" + tr("Unable to find the requested color. "
"You have probably selected black, gray or white. "
"There is no way to process this color.") + "</qt>");
}
cmykLabel->setText(colorWheel->actualColor.nameCMYK());
rgbLabel->setText(colorWheel->actualColor.nameRGB());
}
/branches/Version13x/Scribus/scribus/plugins/colorwheel/CMakeLists.txt
3,12 → 3,16
${CMAKE_SOURCE_DIR}/scribus
)
 
SET(COLORWHEEL_PLUGIN_UI_SRC
cwdialogbase.ui
)
 
SET(COLORWHEEL_PLUGIN_MOC_CLASSES
colorblind.h
colorwheel.h
colorwheelwidget.h
cwdialog.h
cwsetcolor.h
cwdialogbase.h
)
 
SET(COLORWHEEL_PLUGIN_SOURCES
16,10 → 20,15
colorwheel.cpp
colorwheelwidget.cpp
cwdialog.cpp
cwsetcolor.cpp
cwdialogbase.cxx
)
 
SET(SCRIBUS_COLORWHEEL_PLUGIN "colorwheel")
 
IF(QT_WRAP_UI)
QT_WRAP_UI(${SCRIBUS_COLORWHEEL_PLUGIN} COLORWHEEL_PLUGIN_UI_H COLORWHEEL_PLUGIN_UI_CPP ${COLORWHEEL_PLUGIN_UI_SRC})
ENDIF(QT_WRAP_UI)
 
IF(QT_WRAP_CPP)
SCRIBUS_QT_WRAP_CPP(COLORWHEEL_PLUGIN_MOC_SOURCES ${COLORWHEEL_PLUGIN_MOC_CLASSES})
ENDIF(QT_WRAP_CPP)
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorblind.h
11,8 → 11,6
#include <qcolor.h>
#include <qobject.h>
 
/* $Id$ */
 
/*! \brief This code is an implementation of an algorithm described by Hans Brettel,
Francoise Vienot and John Mollon in the Journal of the Optical Society of
America V14(10), pg 2647. (See http://vischeck.com/ for more info.).
24,7 → 22,7
This code is written using "Scribus coding standard" as a part of the
Scribus project (www.scribus.net).
 
\author Petr Vanek <petr@yarpen.cz>
\author Petr Vanek <petr@scribus.info>
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
45,7 → 43,7
{
Q_OBJECT
public:
/*! Enumerate Vision Defects for readable ComboBox access */
/*! \brief Enumerate Vision Defects for readable ComboBox access */
enum defectMode {
normalVision = 0,
protanopeVision = 1,
54,64 → 52,64
colorBlindnessVision = 4
};
 
/*! QColor like constructors. Setup the RGB parts, then init().
/*! \brief QColor like constructors. Setup the RGB parts, then init().
\param r red part of the color
\param g green part of the color
\param b blue part of the color
*/
VisionDefectColor(int r, int g, int b);
/*! QColor like constructors. Setup the RGB parts, then init().
/*! \brief QColor like constructors. Setup the RGB parts, then init().
\param c QColor object
*/
VisionDefectColor(QColor c);
 
/*! Actual defect type. One of the 'defectMode' */
/*! \brief Actual defect type. One of the 'defectMode' */
int deficiency;
 
/*! Perform conversion itself.
/*! \brief Perform conversion itself.
Gama removing, RGB2LSM, matrix operation for selected deficiency,
LSM2RGB, gama applying. */
void convertDefect();
 
/*! Return the color parts
/*! \brief Return the color parts
\retval uint red part
*/
uint getRed();
/*! Return the color parts
/*! \brief Return the color parts
\retval uint green part
*/
uint getGreen();
/*! Return the color parts
/*! \brief Return the color parts
\retval uint blue part
*/
uint getBlue();
/*! Return QColor
/*! \brief Return QColor
\retval QColor new QColor
*/
QColor getColor();
 
private:
/*! Convert matrix */
/*! \brief Convert matrix */
double rgb2lms[9];
/*! Convert matrix */
/*! \brief Convert matrix */
double lms2rgb[9];
/*! Gamma matrix */
/*! \brief Gamma matrix */
double gammaRGB[3];
 
/*! cross products with transform matrixes for actual defect */
/*! \brief cross products with transform matrixes for actual defect */
double a1, b1, c1;
/*! cross products with transform matrixes for actual defect */
/*! \brief cross products with transform matrixes for actual defect */
double a2, b2, c2;
/*! Inflection border line */
/*! \brief Inflection border line */
double inflection;
 
/*! Internal RGB color parts */
/*! \brief Internal RGB color parts */
double red, green, blue;
 
/*! original color */
/*! \brief original color */
QColor originalColor;
 
/*! Initialization of the internal values. rgb2lms, lms2rgb etc.
/*! \brief Initialization of the internal values. rgb2lms, lms2rgb etc.
For most modern Cathode-Ray Tube monitors (CRTs), the following
are good estimates of the RGB->LMS and LMS->RGB transform
matrices. They are based on spectra measured on a typical CRT
133,11 → 131,11
*/
void init();
 
/*! This function performs initialisations that are dependant
/*! \brief This function performs initialisations that are dependant
on the type of color deficiency (see defectMode). */
void setupDefect();
 
/*! Ensures that x is between the limits set by low and high.
/*! \brief Ensures that x is between the limits set by low and high.
Glib CLAMP() macro replacement for C++ speedup optimalization.
\param x value itself
\param low low border
/branches/Version13x/Scribus/scribus/plugins/colorwheel/colorwheelwidget.h
4,7 → 4,7
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
/* $Id$ */
 
#ifndef COLORWHEELWIDGET_H
#define COLORWHEELWIDGET_H
 
12,15 → 12,17
#include <qvaluevector.h>
#include <scribusstructs.h>
 
#include "sccolor.h"
 
 
/*! \brief Mapping angle - color in the color wheel */
typedef QMap<int,QColor> ColorMap;
typedef QMap<int,ScColor> ColorMap;
 
/**
\brief Widget ColorWheel graphicaly shows a color wheel for color theory.
\brief Widget ColorWheel graphically shows a color wheel for color theory.
Class ColorWheel is new widget inherited from the QLabel.
See e.g. http://en.wikipedia.org/wiki/Color_wheel for more info.
\author Petr Vanek; petr@yarpen.cz
\author Petr Vanek <petr@scribus.info>
\date April 2005
*/
class ColorWheel : public QLabel
31,7 → 33,7
ColorWheel(QWidget * parent, const char * name = 0);
~ColorWheel(){};
 
/** It can handle these color theory methods */
//! \brief It can handle these color theory methods
enum MethodType {
Monochromatic,
Analogous,
41,6 → 43,12
Tetradic
};
 
//! \brief Which color model is in use.
colorModel currentColorSpace;
 
//! \brief Actual type of color computing. See MethodType.
MethodType currentType;
 
/** \brief Difference between selected value and counted ones.
Let's set angle = 15 and base point e.g. 60 (everything in grades).
Now you will have Analogous angles 60 (base) and 75 (+15) and 45 (-15).
51,8 → 59,8
/*! \brief Angle of the base color */
int baseAngle;
 
/** \brief RGB interpretation of the leading point. */
QColor actualColor;
/** \brief RGB interpretation of the leading point in the wheel. */
ScColor actualColor;
 
/** \brief List of the colors created in this widget.
Colors can be added into Scribus color list later. */
63,40 → 71,14
\retval QString Translated method name. */
QString getTypeDescription(MethodType aType);
 
/** \brief Counts the monochromatic colors.
The monochromatic color scheme uses variations in lightness
and saturation of a single color. It's clean and elegant color
schema. I like it's minimalism ;) */
void makeMonochromatic();
//! \brief Call one of makeFoo() methods depending on the currentType value.
void makeColors();
 
/** \brief Counts the analogous colors.
The analogous color scheme uses colors that are changed by an angle
in the color wheel. It looks richer than mono scheme. */
void makeAnalogous();
 
/** \brief Counts the complementary colors.
It takes two opposite colors (180 deg). It looks great when you choose a warm
color against a cool one. E.g. dark green vs. wine red. Hmmm wine... */
void makeComplementary();
 
/** \brief Counts the split-complementary colors.
It's enthanced complementary method. It takes base and opposite colors
with applied angle differences. */
void makeSplit();
 
/** \brief Counts the triadic colors.
It takes three colors balanced on the wheel (by 120 grades). */
void makeTriadic();
 
/** \brief Counts the tetradic colors.
It's two times complementary. */
void makeTetradic();
 
/*! \brief Setup the values by given QColor.
It sets all options by given color (from input color dialogs).
\param col examined color
\retval true on color found, false when color not found - black or white etc.*/
bool recomputeColor(QColor col);
bool recomputeColor(ScColor col);
 
signals:
/** \brief Signal raised by mouse click on widget by user.
120,8 → 102,6
int widthH;
int heightH;
 
MethodType currentType;
 
/** \brief An event for mouse actions handling.
See \see clicked() for more info.
\param e Mouse properties. */
138,6 → 118,35
It prevents the bugs with another window moving over it */
void paintEvent(QPaintEvent *);
 
/** \brief Counts the monochromatic colors.
The monochromatic color scheme uses variations in lightness
and saturation of a single color. It's clean and elegant color
schema. I like it's minimalism ;) */
void makeMonochromatic();
 
/** \brief Counts the analogous colors.
The analogous color scheme uses colors that are changed by an angle
in the color wheel. It looks richer than mono scheme. */
void makeAnalogous();
 
/** \brief Counts the complementary colors.
It takes two opposite colors (180 deg). It looks great when you choose a warm
color against a cool one. E.g. dark green vs. wine red. Hmmm wine... */
void makeComplementary();
 
/** \brief Counts the split-complementary colors.
It's enthanced complementary method. It takes base and opposite colors
with applied angle differences. */
void makeSplit();
 
/** \brief Counts the triadic colors.
It takes three colors balanced on the wheel (by 120 grades). */
void makeTriadic();
 
/** \brief Counts the tetradic colors.
It's two times complementary. */
void makeTetradic();
 
/** \brief Draw center circle filled with base color */
void paintCenterSample();
/** \brief Draw a color wheel. */
154,9 → 163,10
void baseColor();
 
/** \brief Creates a Scribus ScColor from rgb value.
\param col a QColor to convert.
Its result depends on the currentColorSpace value.
\param col a ScColor to convert.
\retval ScColor Scribus color structure */
ScColor cmykColor(QColor col);
ScColor colorSpaceColor(ScColor col);
 
/** \brief Display user selection - selected colors.
Chosen colors are marked via bullets on the border of