|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef STYLEEDITOR_H
|
|
Toshihiro Shimizu |
890ddd |
#define STYLEEDITOR_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzCore includes
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tfilepath.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpixel.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tpalette.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tpalettehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevelhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevel.h"
|
|
Toshihiro Shimizu |
890ddd |
//#include "toonz/preferences.h" //iwsw commented out temporarily
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/checkbox.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/intfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/doublefield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/colorfield.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/tabbar.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Toonz includes
|
|
Toshihiro Shimizu |
890ddd |
//#include "../toonz/tapp.h" //iwsw commented out temporarily
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qwidget></qwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qframe></qframe>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtabbar></qtabbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qslider></qslider>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbutton></qtoolbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qscrollarea></qscrollarea>
|
|
Toshihiro Shimizu |
890ddd |
#include <qglwidget></qglwidget>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmouseevent></qmouseevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpointf></qpointf>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//iwsw commented out temporarily
|
|
Toshihiro Shimizu |
890ddd |
//#include "ghibli_3dlut_util.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#undef DVAPI
|
|
Toshihiro Shimizu |
890ddd |
#undef DVVAR
|
|
Toshihiro Shimizu |
890ddd |
#ifdef TOONZQT_EXPORTS
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_EXPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_EXPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
#define DVAPI DV_IMPORT_API
|
|
Toshihiro Shimizu |
890ddd |
#define DVVAR DV_IMPORT_VAR
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Forward declarations
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TColorStyle;
|
|
Toshihiro Shimizu |
890ddd |
class TPalette;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TXshLevelHandle;
|
|
Toshihiro Shimizu |
890ddd |
class PaletteController;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class QGridLayout;
|
|
Toshihiro Shimizu |
890ddd |
class QLabel;
|
|
Toshihiro Shimizu |
890ddd |
class QStackedWidget;
|
|
Toshihiro Shimizu |
890ddd |
class QSlider;
|
|
Toshihiro Shimizu |
890ddd |
class QRadioButton;
|
|
Toshihiro Shimizu |
890ddd |
class QButtonGroup;
|
|
Toshihiro Shimizu |
890ddd |
class QPushButton;
|
|
Toshihiro Shimizu |
890ddd |
class QTabWidget;
|
|
Toshihiro Shimizu |
890ddd |
class QToolBar;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ColorSquaredWheel;
|
|
Toshihiro Shimizu |
890ddd |
class TabBarContainter;
|
|
Toshihiro Shimizu |
890ddd |
class StyleChooser;
|
|
Toshihiro Shimizu |
890ddd |
class StyleEditor;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace DVGui;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
namespace StyleEditorGUI
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum ColorChannel {
|
|
Toshihiro Shimizu |
890ddd |
eRed = 0,
|
|
Toshihiro Shimizu |
890ddd |
eGreen,
|
|
Toshihiro Shimizu |
890ddd |
eBlue,
|
|
Toshihiro Shimizu |
890ddd |
eAlpha,
|
|
Toshihiro Shimizu |
890ddd |
eHue,
|
|
Toshihiro Shimizu |
890ddd |
eSaturation,
|
|
Toshihiro Shimizu |
890ddd |
eValue
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ColorModel provides an object to manage color change and
|
|
Toshihiro Shimizu |
890ddd |
its transformation from rgb value to hsv value and vice versa.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
This object change color using its rgb channel or its hsv channel;
|
|
Toshihiro Shimizu |
890ddd |
if you change a color channel class assure you that other channel not change.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI ColorModel
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int m_channels[7];
|
|
Toshihiro Shimizu |
890ddd |
void rgb2hsv();
|
|
Toshihiro Shimizu |
890ddd |
void hsv2rgb();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ColorModel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setTPixel(const TPixel32 &color);
|
|
Toshihiro Shimizu |
890ddd |
TPixel32 getTPixel() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setValue(ColorChannel channel, int value);
|
|
Toshihiro Shimizu |
890ddd |
void setValues(ColorChannel channel, int u, int v);
|
|
Toshihiro Shimizu |
890ddd |
int getValue(ColorChannel channel) const;
|
|
Toshihiro Shimizu |
890ddd |
void getValues(ColorChannel channel, int &u, int &v);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
inline int r() const { return m_channels[0]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int g() const { return m_channels[1]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int b() const { return m_channels[2]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int a() const { return m_channels[3]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int h() const { return m_channels[4]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int s() const { return m_channels[5]; }
|
|
Toshihiro Shimizu |
890ddd |
inline int v() const { return m_channels[6]; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool operator==(const ColorModel &cm)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < 7; i++)
|
|
Toshihiro Shimizu |
890ddd |
if (m_channels[i] != cm.getValue(ColorChannel(i)))
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum CurrentWheel {
|
|
Toshihiro Shimizu |
890ddd |
none,
|
|
Toshihiro Shimizu |
890ddd |
leftWheel,
|
|
Toshihiro Shimizu |
890ddd |
rightTriangle
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI HexagonalColorWheel : public QGLWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// backgoround color (R160, G160, B160)
|
|
Toshihiro Shimizu |
890ddd |
QColor m_bgColor;
|
|
Toshihiro Shimizu |
890ddd |
Q_PROPERTY(QColor BGColor READ getBGColor WRITE setBGColor)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
QPointF m_wheelPosition;
|
|
Toshihiro Shimizu |
890ddd |
float m_triEdgeLen;
|
|
Toshihiro Shimizu |
890ddd |
float m_triHeight;
|
|
Toshihiro Shimizu |
890ddd |
QPointF m_wp[7], m_leftp[3];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
CurrentWheel m_currentWheel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//iwsw commented out temporarily about 3DLUT
|
|
Toshihiro Shimizu |
890ddd |
//Ghibli3DLutUtil * m_ghibli3DLutUtil;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
void drawCurrentColorMark();
|
|
Toshihiro Shimizu |
890ddd |
void clickLeftWheel(const QPoint &pos);
|
|
Toshihiro Shimizu |
890ddd |
void clickRightTriangle(const QPoint &pos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
HexagonalColorWheel(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const ColorModel &color) { m_color = color; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
~HexagonalColorWheel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setBGColor(const QColor &color) { m_bgColor = color; }
|
|
Toshihiro Shimizu |
890ddd |
QColor getBGColor() const { return m_bgColor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void initializeGL();
|
|
Toshihiro Shimizu |
890ddd |
void resizeGL(int width, int height);
|
|
Toshihiro Shimizu |
890ddd |
void paintGL();
|
|
Toshihiro Shimizu |
890ddd |
QSize SizeHint() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return QSize(300, 200);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseMoveEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseReleaseEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void colorChanged(const ColorModel &color, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The SquaredColorWheel is a squared color to change color.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
This object show a square faded from one color channel to another color channel,
|
|
Toshihiro Shimizu |
890ddd |
the two channel represent x and y axis of square.
|
|
Toshihiro Shimizu |
890ddd |
It's possible to choose viewed shade using \b setChannel().
|
|
Toshihiro Shimizu |
890ddd |
Click in square change current SquaredColorWheel.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI SquaredColorWheel : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
ColorChannel m_channel;
|
|
Toshihiro Shimizu |
890ddd |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SquaredColorWheel(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Doesn't call update(). */
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void click(const QPoint &pos);
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseMoveEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseReleaseEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
/*! Connect channels to the two square axes:
|
|
Toshihiro Shimizu |
890ddd |
\li eRed : connect x-axis to eGreen and y-axis to eBlue;
|
|
Toshihiro Shimizu |
890ddd |
\li eGreen : connect x-axis to eRed and y-axis to eBlue;
|
|
Toshihiro Shimizu |
890ddd |
\li eBlue : connect x-axis to eRed and y-axis to eGreen;
|
|
Toshihiro Shimizu |
890ddd |
\li eHue : connect x-axis to eSaturation and y-axis to eValue;
|
|
Toshihiro Shimizu |
890ddd |
\li eSaturation : connect x-axis to eHue and y-axis to eValue;
|
|
Toshihiro Shimizu |
890ddd |
\li eValue : connect x-axis to eHue and y-axis to eSaturation; */
|
|
Toshihiro Shimizu |
890ddd |
void setChannel(int channel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void colorChanged(const ColorModel &color, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ColorSlider is used to set a color channel.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QSlider.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
This object show a bar which colors differ from minimum to maximum channel color
|
|
Toshihiro Shimizu |
890ddd |
value.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI ColorSlider : public QSlider
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ColorSlider(Qt::Orientation orientation, QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! set channel and color. doesn't call update(). */
|
|
Toshihiro Shimizu |
890ddd |
void setChannel(ColorChannel channel);
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorChannel getChannel() const { return m_channel; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseReleaseEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// QIcon getFirstArrowIcon();
|
|
Toshihiro Shimizu |
890ddd |
// QIcon getLastArrowIcon();
|
|
Toshihiro Shimizu |
890ddd |
// QRect getFirstArrowRect();
|
|
Toshihiro Shimizu |
890ddd |
// QRect getLastArrowRect();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
ColorChannel m_channel;
|
|
Toshihiro Shimizu |
890ddd |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ArrowButton
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ArrowButton : public QToolButton
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Qt::Orientation m_orientaion;
|
|
Toshihiro Shimizu |
890ddd |
bool m_isFirstArrow;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_timerId;
|
|
Toshihiro Shimizu |
890ddd |
int m_firstTimerId;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ArrowButton(QWidget *parent = 0, Qt::Orientation orientation = Qt::Horizontal, bool m_isFirstArrow = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void stopTime(int timerId);
|
|
Toshihiro Shimizu |
890ddd |
void timerEvent(QTimerEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void notifyChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void onPressed();
|
|
Toshihiro Shimizu |
890ddd |
void onRelease();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void add();
|
|
Toshihiro Shimizu |
890ddd |
void remove();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ColorSliderBar is a colorSlider with two arrow to add or remove one to current value.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QToolBar.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI ColorSliderBar : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorSlider *m_colorSlider;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ColorSliderBar(QWidget *parent = 0, Qt::Orientation orientation = Qt::Vertical);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setValue(int value) { m_colorSlider->setValue(value); }
|
|
Toshihiro Shimizu |
890ddd |
void setRange(int minValue, int maxValue) { m_colorSlider->setRange(minValue, maxValue); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setChannel(ColorChannel channel) { return m_colorSlider->setChannel(channel); }
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const ColorModel &color) { return m_colorSlider->setColor(color); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorChannel getChannel() const { return m_colorSlider->getChannel(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void onRemove();
|
|
Toshihiro Shimizu |
890ddd |
void onAdd();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void valueChanged(int);
|
|
Toshihiro Shimizu |
890ddd |
void valueChanged();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ChannelLineEdit is a cutomized version of IntLineEdit for channel value.
|
|
Toshihiro Shimizu |
890ddd |
It calls selectAll() at the moment of the first click.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class ChannelLineEdit : public IntLineEdit
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_isEditing;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ChannelLineEdit(QWidget *parent, int value, int minValue, int maxValue)
|
|
Toshihiro Shimizu |
890ddd |
: IntLineEdit(parent, value, minValue, maxValue), m_isEditing(false)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *);
|
|
Toshihiro Shimizu |
890ddd |
void focusOutEvent(QFocusEvent *);
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief ColorChannelControl is the widget used to show/edit a channel
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
The ColorChannelControl is composed of three object: a label \b QLabel
|
|
Toshihiro Shimizu |
890ddd |
to show the channel name, and an \b IntLineEdit and a ColorSlider to show/edit the
|
|
Toshihiro Shimizu |
890ddd |
channel value.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI ColorChannelControl : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
QLabel *m_label;
|
|
Toshihiro Shimizu |
890ddd |
ChannelLineEdit *m_field;
|
|
Toshihiro Shimizu |
890ddd |
ColorSlider *m_slider;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorChannel m_channel;
|
|
Toshihiro Shimizu |
890ddd |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int m_value;
|
|
Toshihiro Shimizu |
890ddd |
bool m_signalEnabled;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ColorChannelControl(ColorChannel channel, QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void onFieldChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onSliderChanged(int value);
|
|
Toshihiro Shimizu |
890ddd |
void onSliderReleased();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onAddButtonClicked();
|
|
Toshihiro Shimizu |
890ddd |
void onSubButtonClicked();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void colorChanged(const ColorModel &color, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The StyleEditorPage is the base class of StyleEditor pages.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QFrame.
|
|
Toshihiro Shimizu |
890ddd |
Inherited by \b PlainColorPage and \b StyleChooserPage.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class StyleEditorPage : public QFrame
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
StyleEditorPage(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ColorParameterSelector is used for styles having more
|
|
Toshihiro Shimizu |
890ddd |
than one color parameter to select the current one.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class ColorParameterSelector : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
std::vector<qcolor> m_colors;</qcolor>
|
|
Toshihiro Shimizu |
890ddd |
int m_index;
|
|
Toshihiro Shimizu |
890ddd |
const QSize m_chipSize;
|
|
Toshihiro Shimizu |
890ddd |
const QPoint m_chipOrigin, m_chipDelta;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
ColorParameterSelector(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
int getSelected() const { return m_index; }
|
|
Toshihiro Shimizu |
890ddd |
void setStyle(const TColorStyle &style);
|
|
Toshihiro Shimizu |
890ddd |
void clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void colorParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *);
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The PlainColorPage is used to control the color parameter.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b StyleEditorPage.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
The PlainColorPage is made of a \b SquaredColorWheel and a \b ColorSlider,
|
|
Toshihiro Shimizu |
890ddd |
a collection of \b ColorChannelControl, and a number of radio button (to control
|
|
Toshihiro Shimizu |
890ddd |
the ColorWheel behaviour).
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class PlainColorPage : public StyleEditorPage
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//ColorSliderBar *m_verticalSlider;
|
|
Toshihiro Shimizu |
890ddd |
//QRadioButton *m_modeButtons[7];
|
|
Toshihiro Shimizu |
890ddd |
ColorChannelControl *m_channelControls[7];
|
|
Toshihiro Shimizu |
890ddd |
//SquaredColorWheel *m_squaredColorWheel; //iwsw not used
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
HexagonalColorWheel *m_hexagonalColorWheel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
bool m_signalEnabled;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void updateControls();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
PlainColorPage(QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
~PlainColorPage() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setColor(const TColorStyle &style, int colorParameterIndex);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void resizeEvent(QResizeEvent *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void colorChanged(const ColorModel &, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void onWheelChanged(const ColorModel &color, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
//void onWheelSliderChanged(int value);
|
|
Toshihiro Shimizu |
890ddd |
//void onWheelSliderReleased();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Toshihiro Shimizu |
890ddd |
//void setWheelChannel(int channel);
|
|
Toshihiro Shimizu |
890ddd |
void onControlChanged(const ColorModel &color, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The StyleChooserPage is the base class of pages with texture,
|
|
Toshihiro Shimizu |
890ddd |
special style and custom style. It features a collection of selectable 'chips'.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
Inherits \b StyleEditorPage.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
class StyleChooserPage : public StyleEditorPage
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
QPoint m_chipOrigin;
|
|
Toshihiro Shimizu |
890ddd |
QSize m_chipSize;
|
|
Toshihiro Shimizu |
890ddd |
int m_chipPerRow;
|
|
Toshihiro Shimizu |
890ddd |
static TFilePath m_rootPath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
StyleChooserPage(QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QSize getChipSize() const { return m_chipSize; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual bool loadIfNeeded() = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual int getChipCount() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
virtual void drawChip(QPainter &p, QRect rect, int index) = 0;
|
|
Toshihiro Shimizu |
890ddd |
virtual void onSelect(int index) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//! \see StyleEditor::setRootPath()
|
|
Toshihiro Shimizu |
890ddd |
//TOGLIERE
|
|
Toshihiro Shimizu |
890ddd |
static void setRootPath(const TFilePath &rootPath);
|
|
Toshihiro Shimizu |
890ddd |
static TFilePath getRootPath() { return m_rootPath; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
int m_currentIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
int posToIndex(const QPoint &pos) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void paintEvent(QPaintEvent *);
|
|
Toshihiro Shimizu |
890ddd |
void resizeEvent(QResizeEvent *) { computeSize(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void mousePressEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
void mouseMoveEvent(QMouseEvent *event) {}
|
|
Toshihiro Shimizu |
890ddd |
void mouseReleaseEvent(QMouseEvent *event);
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
void computeSize();
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
void styleSelected(const TColorStyle &style);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*!
|
|
Toshihiro Shimizu |
890ddd |
\brief The SettingsPage is used to show/edit style parameters.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
\details This class stores the GUI for editing a \a copy of the
|
|
Toshihiro Shimizu |
890ddd |
current color style. Updates of the actual current color
|
|
Toshihiro Shimizu |
890ddd |
style are \a not performed directly by this class.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SettingsPage : public QScrollArea
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QGridLayout *m_paramsLayout;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QCheckBox *m_autoFillCheckBox;
|
|
Toshihiro Shimizu |
890ddd |
QWidget *m_autopaintToggleBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TColorStyleP m_editedStyle; //!< A copy of the current style being edited by the Style Editor.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool m_updating; //!< Whether the page is copying style content to its widget,
|
|
Toshihiro Shimizu |
890ddd |
//! to be displayed.
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SettingsPage(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setStyle(const TColorStyleP &editedStyle);
|
|
Toshihiro Shimizu |
890ddd |
void updateValues();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void enableAutopaintToggle(bool enabled);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void paramStyleChanged(bool isDragging); //!< Signals that the edited style has changed.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onAutofillChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onValueChanged(bool isDragging = false);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
} // namespace StyleEditorGUI
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
using namespace StyleEditorGUI;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// StyleEditor
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class DVAPI StyleEditor : public QWidget
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PaletteController *m_paletteController;
|
|
Toshihiro Shimizu |
890ddd |
TPaletteHandle *m_paletteHandle;
|
|
Toshihiro Shimizu |
890ddd |
TPaletteHandle *m_cleanupPaletteHandle;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TXshLevelHandle *m_levelHandle; //!< for clearing the level cache when the color changed
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TabBar *m_styleBar;
|
|
Toshihiro Shimizu |
890ddd |
QStackedWidget *m_styleChooser;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
StyleSample *m_newColor; //!< New style viewer (lower-right panel side).
|
|
Toshihiro Shimizu |
890ddd |
StyleSample *m_oldColor; //!< Old style viewer (lower-right panel side).
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef STUDENT
|
|
Toshihiro Shimizu |
890ddd |
QPushButton *m_autoButton; //!< "Auto Apply" checkbox on the right panel side.
|
|
Toshihiro Shimizu |
890ddd |
QPushButton *m_applyButton; //!< "Apply" button on the right panel side.
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QToolBar *m_toolBar; //!< Lower toolbar.
|
|
Toshihiro Shimizu |
890ddd |
ColorParameterSelector *m_colorParameterSelector; //!< Secondary color parameter selector in the lower toolbar.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TabBarContainter *m_tabBarContainer; //!< Tabs container for style types.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QLabel *m_statusLabel; //!< showing the information of the current palette and style.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
PlainColorPage *m_plainColorPage;
|
|
Toshihiro Shimizu |
890ddd |
StyleChooserPage *m_textureStylePage;
|
|
Toshihiro Shimizu |
890ddd |
StyleEditorPage *m_specialStylePage;
|
|
Toshihiro Shimizu |
890ddd |
StyleChooserPage *m_customStylePage;
|
|
Toshihiro Shimizu |
890ddd |
StyleChooserPage *m_vectorBrushesStylePage;
|
|
Toshihiro Shimizu |
890ddd |
SettingsPage *m_settingsPage;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TColorStyleP m_oldStyle; //!< A copy of current style \a before the last change.
|
|
Toshihiro Shimizu |
890ddd |
TColorStyleP m_editedStyle; //!< The currently edited style. Please observe that this is
|
|
Toshihiro Shimizu |
890ddd |
//! a \b copy of currently selected style, since style edits
|
|
Toshihiro Shimizu |
890ddd |
//! may be not automatically applied.
|
|
Toshihiro Shimizu |
890ddd |
bool m_enabled;
|
|
Toshihiro Shimizu |
890ddd |
bool m_enabledOnlyFirstTab;
|
|
Toshihiro Shimizu |
890ddd |
bool m_enabledFirstAndLastTab;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
StyleEditor(PaletteController *, QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
~StyleEditor();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setPaletteHandle(TPaletteHandle *paletteHandle);
|
|
Toshihiro Shimizu |
890ddd |
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setLevelHandle(TXshLevelHandle *levelHandle) { m_levelHandle = levelHandle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
TPalette *getPalette() { return m_paletteHandle->getPalette(); }
|
|
Toshihiro Shimizu |
890ddd |
int getStyleIndex() { return m_paletteHandle->getStyleIndex(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! rootPath generally is STUFFDIR/Library. Contains directories 'textures' and
|
|
Toshihiro Shimizu |
890ddd |
'custom styles' */
|
|
Toshihiro Shimizu |
890ddd |
//TOGLIERE
|
|
Toshihiro Shimizu |
890ddd |
void setRootPath(const TFilePath &rootPath);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void enableAutopaintToggle(bool enabled)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_settingsPage->enableAutopaintToggle(enabled);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
/*! Return false if style is linked and style must be set to null.*/
|
|
Toshihiro Shimizu |
890ddd |
bool setStyle(TColorStyle *currentStyle);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setEditedStyleToStyle(const TColorStyle *style); //!< Clones the supplied style and considers that as the edited one.
|
|
Toshihiro Shimizu |
890ddd |
void setOldStyleToStyle(const TColorStyle *style); //!< Clones the supplied style and considers that as the previously current one.
|
|
Toshihiro Shimizu |
890ddd |
//! \todo Why is this not assimilated to setCurrentStyleToStyle()?
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Return style parameter index selected in \b ColorParameterSelector. */
|
|
Toshihiro Shimizu |
890ddd |
int getColorParam() const
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
return m_colorParameterSelector->getSelected();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Set StyleEditor view to \b enabled. If \b enabledOnlyFirstTab or if \b enabledFirstAndLastTab
|
|
Toshihiro Shimizu |
890ddd |
is true hide other tab, pay attention \b enabled must be true or StyleEditor is disabled. */
|
|
Toshihiro Shimizu |
890ddd |
void enable(bool enabled, bool enabledOnlyFirstTab = false, bool enabledFirstAndLastTab = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Toshihiro Shimizu |
890ddd |
void showEvent(QShowEvent *);
|
|
Toshihiro Shimizu |
890ddd |
void hideEvent(QHideEvent *);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onStyleSwitched();
|
|
Toshihiro Shimizu |
890ddd |
void onStyleChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onCleanupStyleChanged();
|
|
Toshihiro Shimizu |
890ddd |
void onOldStyleClicked(const TColorStyle &);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// called (e.g.) by PaletteController when an other StyleEditor change the toggle
|
|
Toshihiro Shimizu |
890ddd |
void enableColorAutoApply(bool enabled);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// when colorAutoApply==false this slot is called when the current color changes
|
|
Toshihiro Shimizu |
890ddd |
void setColorSample(const TPixel32 &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// chiamato quando viene modificato uno slider o la color wheel
|
|
Toshihiro Shimizu |
890ddd |
void onColorChanged(const ColorModel &, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void selectStyle(const TColorStyle &style);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void applyButtonClicked();
|
|
Toshihiro Shimizu |
890ddd |
void autoCheckChanged(bool value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void setPage(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onColorParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void onParamStyleChanged(bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Toshihiro Shimizu |
890ddd |
QFrame *createBottomWidget();
|
|
Toshihiro Shimizu |
890ddd |
void updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void copyEditedStyleToPalette(bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif // STYLEEDITOR_H
|