|
Shinya Kitaoka |
810553 |
#pragma once
|
|
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"
|
|
Jeremy Bullock |
4bf672 |
#include "saveloadqsettings.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"
|
|
justburner |
981d46 |
#include "toonz/stylemanager.h"
|
|
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"
|
|
shun_iwasawa |
7c988d |
#include "toonzqt/glwidget_for_highdpi.h"
|
|
justburner |
a72214 |
#include "toonzqt/hexcolornames.h"
|
|
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 <qmouseevent></qmouseevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qpointf></qpointf>
|
|
Jeremy Bullock |
4bf672 |
#include <qsettings></qsettings>
|
|
Jeremy Bullock |
4bf672 |
#include <qsplitter></qsplitter>
|
|
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;
|
|
shun-iwasawa |
ad7711 |
class QOpenGLFramebufferObject;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class ColorSquaredWheel;
|
|
Toshihiro Shimizu |
890ddd |
class TabBarContainter;
|
|
Toshihiro Shimizu |
890ddd |
class StyleChooser;
|
|
Toshihiro Shimizu |
890ddd |
class StyleEditor;
|
|
shun-iwasawa |
388550 |
class LutCalibrator;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
namespace StyleEditorGUI {
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
enum ColorChannel {
|
|
Shinya Kitaoka |
120a6e |
eRed = 0,
|
|
Shinya Kitaoka |
120a6e |
eGreen,
|
|
Shinya Kitaoka |
120a6e |
eBlue,
|
|
Shinya Kitaoka |
120a6e |
eAlpha,
|
|
Shinya Kitaoka |
120a6e |
eHue,
|
|
Shinya Kitaoka |
120a6e |
eSaturation,
|
|
Shinya Kitaoka |
120a6e |
eValue
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
/*! \brief The ColorModel provides an object to manage color change and
|
|
Shinya Kitaoka |
120a6e |
its transformation from rgb value to hsv value and vice versa.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
This object change color using its rgb channel or its hsv
|
|
Shinya Kitaoka |
120a6e |
channel;
|
|
Shinya Kitaoka |
120a6e |
if you change a color channel class assure you that other
|
|
Shinya Kitaoka |
120a6e |
channel not change.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
class DVAPI ColorModel {
|
|
Shinya Kitaoka |
120a6e |
int m_channels[7];
|
|
Shinya Kitaoka |
120a6e |
void rgb2hsv();
|
|
Shinya Kitaoka |
120a6e |
void hsv2rgb();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ColorModel();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setTPixel(const TPixel32 &color);
|
|
Shinya Kitaoka |
120a6e |
TPixel32 getTPixel() const;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setValue(ColorChannel channel, int value);
|
|
Shinya Kitaoka |
120a6e |
void setValues(ColorChannel channel, int u, int v);
|
|
Shinya Kitaoka |
120a6e |
int getValue(ColorChannel channel) const;
|
|
Shinya Kitaoka |
120a6e |
void getValues(ColorChannel channel, int &u, int &v);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
inline int r() const { return m_channels[0]; }
|
|
Shinya Kitaoka |
120a6e |
inline int g() const { return m_channels[1]; }
|
|
Shinya Kitaoka |
120a6e |
inline int b() const { return m_channels[2]; }
|
|
Shinya Kitaoka |
120a6e |
inline int a() const { return m_channels[3]; }
|
|
Shinya Kitaoka |
120a6e |
inline int h() const { return m_channels[4]; }
|
|
Shinya Kitaoka |
120a6e |
inline int s() const { return m_channels[5]; }
|
|
Shinya Kitaoka |
120a6e |
inline int v() const { return m_channels[6]; }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool operator==(const ColorModel &cm) {
|
|
Shinya Kitaoka |
120a6e |
int i;
|
|
Shinya Kitaoka |
120a6e |
for (i = 0; i < 7; i++)
|
|
Shinya Kitaoka |
120a6e |
if (m_channels[i] != cm.getValue(ColorChannel(i))) return false;
|
|
Shinya Kitaoka |
120a6e |
return true;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
enum CurrentWheel { none, leftWheel, rightTriangle };
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun_iwasawa |
7c988d |
class DVAPI HexagonalColorWheel final : public GLWidgetForHighDpi {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// backgoround color (R160, G160, B160)
|
|
Shinya Kitaoka |
120a6e |
QColor m_bgColor;
|
|
Shinya Kitaoka |
120a6e |
Q_PROPERTY(QColor BGColor READ getBGColor WRITE setBGColor)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorModel m_color;
|
|
Shinya Kitaoka |
120a6e |
QPointF m_wheelPosition;
|
|
Shinya Kitaoka |
120a6e |
float m_triEdgeLen;
|
|
Shinya Kitaoka |
120a6e |
float m_triHeight;
|
|
Shinya Kitaoka |
120a6e |
QPointF m_wp[7], m_leftp[3];
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
CurrentWheel m_currentWheel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
ad7711 |
// used for color calibration with 3DLUT
|
|
shun-iwasawa |
ad7711 |
QOpenGLFramebufferObject *m_fbo = NULL;
|
|
shun-iwasawa |
388550 |
LutCalibrator *m_lutCalibrator = NULL;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
567f65 |
bool m_firstInitialized = true;
|
|
shun-iwasawa |
567f65 |
bool m_cuedCalibrationUpdate = false;
|
|
shun-iwasawa |
e40777 |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
void drawCurrentColorMark();
|
|
Shinya Kitaoka |
120a6e |
void clickLeftWheel(const QPoint &pos);
|
|
Shinya Kitaoka |
120a6e |
void clickRightTriangle(const QPoint &pos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
HexagonalColorWheel(QWidget *parent);
|
|
Shinya Kitaoka |
120a6e |
void setColor(const ColorModel &color) { m_color = color; };
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
~HexagonalColorWheel();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setBGColor(const QColor &color) { m_bgColor = color; }
|
|
Shinya Kitaoka |
120a6e |
QColor getBGColor() const { return m_bgColor; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
a8f111 |
void updateColorCalibration();
|
|
shun-iwasawa |
567f65 |
void cueCalibrationUpdate() { m_cuedCalibrationUpdate = true; }
|
|
shun-iwasawa |
a8f111 |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void initializeGL() override;
|
|
Shinya Kitaoka |
473e70 |
void resizeGL(int width, int height) override;
|
|
Shinya Kitaoka |
473e70 |
void paintGL() override;
|
|
Shinya Kitaoka |
120a6e |
QSize SizeHint() const { return QSize(300, 200); };
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
567f65 |
void showEvent(QShowEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void colorChanged(const ColorModel &color, bool isDragging);
|
|
shun-iwasawa |
388550 |
|
|
shun-iwasawa |
388550 |
public slots:
|
|
shun-iwasawa |
388550 |
void onContextAboutToBeDestroyed();
|
|
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 |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
This object show a square faded from one color channel to
|
|
Shinya Kitaoka |
120a6e |
another color channel,
|
|
Shinya Kitaoka |
120a6e |
the two channel represent x and y axis of square.
|
|
Shinya Kitaoka |
120a6e |
It's possible to choose viewed shade using \b setChannel().
|
|
Shinya Kitaoka |
120a6e |
Click in square change current SquaredColorWheel.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI SquaredColorWheel final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Shinya Kitaoka |
120a6e |
ColorChannel m_channel;
|
|
Shinya Kitaoka |
120a6e |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SquaredColorWheel(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*! Doesn't call update(). */
|
|
Shinya Kitaoka |
120a6e |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void click(const QPoint &pos);
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Shinya Kitaoka |
120a6e |
/*! Connect channels to the two square axes:
|
|
Shinya Kitaoka |
120a6e |
\li eRed : connect x-axis to eGreen and y-axis to eBlue;
|
|
Shinya Kitaoka |
120a6e |
\li eGreen : connect x-axis to eRed and y-axis to eBlue;
|
|
Shinya Kitaoka |
120a6e |
\li eBlue : connect x-axis to eRed and y-axis to eGreen;
|
|
Shinya Kitaoka |
120a6e |
\li eHue : connect x-axis to eSaturation and y-axis to eValue;
|
|
Shinya Kitaoka |
120a6e |
\li eSaturation : connect x-axis to eHue and y-axis to eValue;
|
|
Shinya Kitaoka |
120a6e |
\li eValue : connect x-axis to eHue and y-axis to eSaturation;
|
|
Shinya Kitaoka |
120a6e |
*/
|
|
Shinya Kitaoka |
120a6e |
void setChannel(int channel);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
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 |
|
|
justburner |
a13da2 |
Inherits \b QAbstractSlider.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
This object show a bar which colors differ from minimum to
|
|
Shinya Kitaoka |
120a6e |
maximum channel color
|
|
Shinya Kitaoka |
120a6e |
value.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
justburner |
a13da2 |
class DVAPI ColorSlider final : public QAbstractSlider {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
shun-iwasawa |
c18bfa |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ColorSlider(Qt::Orientation orientation, QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*! set channel and color. doesn't call update(). */
|
|
Shinya Kitaoka |
120a6e |
void setChannel(ColorChannel channel);
|
|
Shinya Kitaoka |
120a6e |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorChannel getChannel() const { return m_channel; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
justburner |
a13da2 |
void mouseMoveEvent(QMouseEvent *event) override;
|
|
justburner |
a13da2 |
|
|
justburner |
a13da2 |
void chandleMouse(int x, int y);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// QIcon getFirstArrowIcon();
|
|
Shinya Kitaoka |
120a6e |
// QIcon getLastArrowIcon();
|
|
Shinya Kitaoka |
120a6e |
// QRect getFirstArrowRect();
|
|
Shinya Kitaoka |
120a6e |
// QRect getLastArrowRect();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
ColorChannel m_channel;
|
|
Shinya Kitaoka |
120a6e |
ColorModel m_color;
|
|
justburner |
a13da2 |
static int s_chandle_size;
|
|
justburner |
a13da2 |
static int s_chandle_tall;
|
|
shun-iwasawa |
c18bfa |
|
|
shun-iwasawa |
c18bfa |
public:
|
|
shun-iwasawa |
c18bfa |
static int s_slider_appearance;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ArrowButton
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class ArrowButton final : public QToolButton {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Qt::Orientation m_orientaion;
|
|
Shinya Kitaoka |
120a6e |
bool m_isFirstArrow;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_timerId;
|
|
Shinya Kitaoka |
120a6e |
int m_firstTimerId;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ArrowButton(QWidget *parent = 0, Qt::Orientation orientation = Qt::Horizontal,
|
|
Shinya Kitaoka |
120a6e |
bool m_isFirstArrow = true);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
void stopTime(int timerId);
|
|
Shinya Kitaoka |
473e70 |
void timerEvent(QTimerEvent *event) override;
|
|
Shinya Kitaoka |
120a6e |
void notifyChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void onPressed();
|
|
Shinya Kitaoka |
120a6e |
void onRelease();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void add();
|
|
Shinya Kitaoka |
120a6e |
void remove();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
/*! \brief The ColorSliderBar is a colorSlider with two arrow to add or remove
|
|
Shinya Kitaoka |
120a6e |
one to current value.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QToolBar.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ColorSliderBar final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorSlider *m_colorSlider;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ColorSliderBar(QWidget *parent = 0,
|
|
Shinya Kitaoka |
120a6e |
Qt::Orientation orientation = Qt::Vertical);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setValue(int value) { m_colorSlider->setValue(value); }
|
|
Shinya Kitaoka |
120a6e |
void setRange(int minValue, int maxValue) {
|
|
Shinya Kitaoka |
120a6e |
m_colorSlider->setRange(minValue, maxValue);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setChannel(ColorChannel channel) {
|
|
Shinya Kitaoka |
120a6e |
return m_colorSlider->setChannel(channel);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
120a6e |
void setColor(const ColorModel &color) {
|
|
Shinya Kitaoka |
120a6e |
return m_colorSlider->setColor(color);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorChannel getChannel() const { return m_colorSlider->getChannel(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void onRemove();
|
|
Shinya Kitaoka |
120a6e |
void onAdd();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void valueChanged(int);
|
|
Shinya Kitaoka |
120a6e |
void valueChanged();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
/*! \brief The ChannelLineEdit is a cutomized version of IntLineEdit for channel
|
|
Shinya Kitaoka |
120a6e |
value.
|
|
Toshihiro Shimizu |
890ddd |
It calls selectAll() at the moment of the first click.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class ChannelLineEdit final : public DVGui::IntLineEdit {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_isEditing;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ChannelLineEdit(QWidget *parent, int value, int minValue, int maxValue)
|
|
Shinya Kitaoka |
120a6e |
: IntLineEdit(parent, value, minValue, maxValue), m_isEditing(false) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void focusOutEvent(QFocusEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *) override;
|
|
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 |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
The ColorChannelControl is composed of three object: a label \b
|
|
Shinya Kitaoka |
120a6e |
QLabel
|
|
Shinya Kitaoka |
120a6e |
to show the channel name, and an \b IntLineEdit and a
|
|
Shinya Kitaoka |
120a6e |
ColorSlider to show/edit the
|
|
Shinya Kitaoka |
120a6e |
channel value.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ColorChannelControl final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Shinya Kitaoka |
120a6e |
QLabel *m_label;
|
|
Shinya Kitaoka |
120a6e |
ChannelLineEdit *m_field;
|
|
Shinya Kitaoka |
120a6e |
ColorSlider *m_slider;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorChannel m_channel;
|
|
Shinya Kitaoka |
120a6e |
ColorModel m_color;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_value;
|
|
Shinya Kitaoka |
120a6e |
bool m_signalEnabled;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ColorChannelControl(ColorChannel channel, QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
void setColor(const ColorModel &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void onFieldChanged();
|
|
Shinya Kitaoka |
120a6e |
void onSliderChanged(int value);
|
|
Shinya Kitaoka |
120a6e |
void onSliderReleased();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onAddButtonClicked();
|
|
Shinya Kitaoka |
120a6e |
void onSubButtonClicked();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
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.
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QFrame.
|
|
Shinya Kitaoka |
120a6e |
Inherited by \b PlainColorPage and \b StyleChooserPage.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
class StyleEditorPage : public QFrame {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
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 |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b QWidget.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class ColorParameterSelector final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
std::vector<qcolor> m_colors;</qcolor>
|
|
Shinya Kitaoka |
120a6e |
int m_index;
|
|
Shinya Kitaoka |
120a6e |
const QSize m_chipSize;
|
|
Shinya Kitaoka |
120a6e |
const QPoint m_chipOrigin, m_chipDelta;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ColorParameterSelector(QWidget *parent);
|
|
Shinya Kitaoka |
120a6e |
int getSelected() const { return m_index; }
|
|
Shinya Kitaoka |
120a6e |
void setStyle(const TColorStyle &style);
|
|
Shinya Kitaoka |
120a6e |
void clear();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void colorParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
shun-iwasawa |
6ef4d0 |
|
|
shun-iwasawa |
6ef4d0 |
QSize sizeHint() const override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
/*! \brief The PlainColorPage is used to control the color parameter.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b StyleEditorPage.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
The PlainColorPage is made of a \b SquaredColorWheel and a \b
|
|
Shinya Kitaoka |
120a6e |
ColorSlider,
|
|
Shinya Kitaoka |
120a6e |
a collection of \b ColorChannelControl, and a number of radio
|
|
Shinya Kitaoka |
120a6e |
button (to control
|
|
Shinya Kitaoka |
120a6e |
the ColorWheel behaviour).
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
d1f6c4 |
class PlainColorPage final : public StyleEditorPage {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// ColorSliderBar *m_verticalSlider;
|
|
Shinya Kitaoka |
120a6e |
// QRadioButton *m_modeButtons[7];
|
|
Shinya Kitaoka |
120a6e |
ColorChannelControl *m_channelControls[7];
|
|
Shinya Kitaoka |
120a6e |
// SquaredColorWheel *m_squaredColorWheel; //iwsw not used
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
HexagonalColorWheel *m_hexagonalColorWheel;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
ColorModel m_color;
|
|
Shinya Kitaoka |
120a6e |
bool m_signalEnabled;
|
|
Jeremy Bullock |
4bf672 |
bool m_isVertical = true;
|
|
Jeremy Bullock |
4bf672 |
int m_visibleParts;
|
|
Shinya Kitaoka |
120a6e |
void updateControls();
|
|
Jeremy Bullock |
0a2e55 |
|
|
Jeremy Bullock |
4bf672 |
// QGridLayout *m_mainLayout;
|
|
Jeremy Bullock |
4bf672 |
QFrame *m_slidersContainer;
|
|
Jeremy Bullock |
4bf672 |
QSplitter *m_vSplitter;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
PlainColorPage(QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~PlainColorPage() {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Jeremy Bullock |
0a2e55 |
QFrame *m_wheelFrame;
|
|
Jeremy Bullock |
0a2e55 |
QFrame *m_hsvFrame;
|
|
Jeremy Bullock |
0a2e55 |
QFrame *m_alphaFrame;
|
|
Jeremy Bullock |
0a2e55 |
QFrame *m_rgbFrame;
|
|
Shinya Kitaoka |
120a6e |
void setColor(const TColorStyle &style, int colorParameterIndex);
|
|
Jeremy Bullock |
0a2e55 |
|
|
Jeremy Bullock |
4bf672 |
void setIsVertical(bool isVertical);
|
|
Jeremy Bullock |
4bf672 |
bool getIsVertical() { return m_isVertical; }
|
|
Jeremy Bullock |
4bf672 |
QByteArray getSplitterState();
|
|
Jeremy Bullock |
4bf672 |
void setSplitterState(QByteArray state);
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
a8f111 |
void updateColorCalibration();
|
|
shun-iwasawa |
a8f111 |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void resizeEvent(QResizeEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void colorChanged(const ColorModel &, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void onWheelChanged(const ColorModel &color, bool isDragging);
|
|
Shinya Kitaoka |
120a6e |
// void onWheelSliderChanged(int value);
|
|
Shinya Kitaoka |
120a6e |
// void onWheelSliderReleased();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Shinya Kitaoka |
120a6e |
// void setWheelChannel(int channel);
|
|
Shinya Kitaoka |
120a6e |
void onControlChanged(const ColorModel &color, bool isDragging);
|
|
Jeremy Bullock |
0a2e55 |
void toggleOrientation();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
/*! \brief The StyleChooserPage is the base class of pages with texture,
|
|
Shinya Kitaoka |
120a6e |
special style and custom style. It features a collection of selectable
|
|
Shinya Kitaoka |
120a6e |
'chips'.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Inherits \b StyleEditorPage.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Shinya Kitaoka |
120a6e |
class StyleChooserPage : public StyleEditorPage {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
QPoint m_chipOrigin;
|
|
Shinya Kitaoka |
120a6e |
QSize m_chipSize;
|
|
Shinya Kitaoka |
120a6e |
int m_chipPerRow;
|
|
Shinya Kitaoka |
120a6e |
static TFilePath m_rootPath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
volatile bool m_pinsToTopDirty;
|
|
justburner |
981d46 |
BaseStyleManager *m_manager;
|
|
justburner |
981d46 |
StyleEditor *m_styleEditor;
|
|
justburner |
981d46 |
QAction *m_pinToTopAct;
|
|
justburner |
981d46 |
QAction *m_setPinsToTopAct;
|
|
justburner |
981d46 |
QAction *m_clrPinsToTopAct;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
enum ChipType {
|
|
justburner |
981d46 |
COMMONCHIP = 0, // Common chip
|
|
justburner |
981d46 |
PINNEDCHIP = 1, // Pin-to-top chip
|
|
justburner |
981d46 |
SOLIDCHIP = 2 // Solid/Nobrush chip
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QColor m_commonChipBoxColor;
|
|
justburner |
981d46 |
QColor m_pinnedChipBoxColor;
|
|
justburner |
981d46 |
QColor m_solidChipBoxColor;
|
|
justburner |
981d46 |
QColor m_selectedChipBoxColor;
|
|
justburner |
981d46 |
QColor m_selectedChipBox2Color;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
Q_PROPERTY(QColor CommonChipBoxColor READ getCommonChipBoxColor WRITE
|
|
justburner |
981d46 |
setCommonChipBoxColor)
|
|
justburner |
981d46 |
Q_PROPERTY(QColor PinnedChipBoxColor READ getPinnedChipBoxColor WRITE
|
|
justburner |
981d46 |
setPinnedChipBoxColor)
|
|
justburner |
981d46 |
Q_PROPERTY(QColor SolidChipBoxColor READ getSolidChipBoxColor WRITE
|
|
justburner |
981d46 |
setSolidChipBoxColor)
|
|
justburner |
981d46 |
Q_PROPERTY(QColor SelectedChipBoxColor READ getSelectedChipBoxColor WRITE
|
|
justburner |
981d46 |
setSelectedChipBoxColor)
|
|
justburner |
981d46 |
Q_PROPERTY(QColor SelectedChipBox2Color READ getSelectedChipBox2Color WRITE
|
|
justburner |
981d46 |
setSelectedChipBox2Color)
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QColor getCommonChipBoxColor() const { return m_commonChipBoxColor; }
|
|
justburner |
981d46 |
QColor getPinnedChipBoxColor() const { return m_pinnedChipBoxColor; }
|
|
justburner |
981d46 |
QColor getSolidChipBoxColor() const { return m_solidChipBoxColor; }
|
|
justburner |
981d46 |
QColor getSelectedChipBoxColor() const { return m_selectedChipBoxColor; }
|
|
justburner |
981d46 |
QColor getSelectedChipBox2Color() const { return m_selectedChipBox2Color; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
void setSolidChipBoxColor(const QColor &color) {
|
|
justburner |
981d46 |
m_solidChipBoxColor = color;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void setPinnedChipBoxColor(const QColor &color) {
|
|
justburner |
981d46 |
m_pinnedChipBoxColor = color;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void setCommonChipBoxColor(const QColor &color) {
|
|
justburner |
981d46 |
m_commonChipBoxColor = color;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void setSelectedChipBoxColor(const QColor &color) {
|
|
justburner |
981d46 |
m_selectedChipBoxColor = color;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void setSelectedChipBox2Color(const QColor &color) {
|
|
justburner |
981d46 |
m_selectedChipBox2Color = color;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
justburner |
981d46 |
StyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
void setChipSize(QSize chipSize);
|
|
Shinya Kitaoka |
120a6e |
QSize getChipSize() const { return m_chipSize; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
void applyFilter();
|
|
justburner |
981d46 |
void applyFilter(const QString text);
|
|
justburner |
981d46 |
|
|
Shinya Kitaoka |
120a6e |
virtual bool loadIfNeeded() = 0;
|
|
Shinya Kitaoka |
120a6e |
virtual int getChipCount() const = 0;
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
virtual int drawChip(QPainter &p, QRect rect, int index) = 0;
|
|
Shinya Kitaoka |
120a6e |
virtual void onSelect(int index) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
virtual bool isSameStyle(const TColorStyleP style, int index) = 0;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
virtual QString getChipDescription(int index) = 0;
|
|
justburner |
981d46 |
|
|
Shinya Kitaoka |
120a6e |
//! \see StyleEditor::setRootPath()
|
|
Shinya Kitaoka |
120a6e |
// TOGLIERE
|
|
Shinya Kitaoka |
120a6e |
static void setRootPath(const TFilePath &rootPath);
|
|
Shinya Kitaoka |
120a6e |
static TFilePath getRootPath() { return m_rootPath; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
justburner |
981d46 |
// int m_currentIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int posToIndex(const QPoint &pos) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void resizeEvent(QResizeEvent *) override { computeSize(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *event) override;
|
|
justburner |
981d46 |
void mouseMoveEvent(QMouseEvent *event) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
justburner |
981d46 |
void contextMenuEvent(QContextMenuEvent *event) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
bool event(QEvent *e) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
public slots:
|
|
justburner |
981d46 |
void patternAdded();
|
|
Shinya Kitaoka |
120a6e |
void computeSize();
|
|
justburner |
981d46 |
void togglePinToTop();
|
|
justburner |
981d46 |
void doSetPinsToTop();
|
|
justburner |
981d46 |
void doClrPinsToTop();
|
|
justburner |
981d46 |
void doPinsToTopChange();
|
|
justburner |
981d46 |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void styleSelected(const TColorStyle &style);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
// CustomStyleChooser definition
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
class CustomStyleChooserPage final : public StyleChooserPage {
|
|
justburner |
981d46 |
public:
|
|
justburner |
981d46 |
CustomStyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0)
|
|
justburner |
981d46 |
: StyleChooserPage(styleEditor, parent) {
|
|
justburner |
981d46 |
static const QString filters(
|
|
justburner |
981d46 |
"*.pli *.tif *.png *.tga *.tiff *.sgi *.rgb *.pct *.pic *.exr");
|
|
justburner |
981d46 |
static CustomStyleManager theManager(
|
|
justburner |
981d46 |
"RasterImagePatternStrokeStyle:", "VectorImagePatternStrokeStyle:",
|
|
justburner |
981d46 |
TFilePath("custom styles"), filters, m_chipSize);
|
|
justburner |
981d46 |
m_manager = &theManager;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
void showEvent(QShowEvent *) override {
|
|
justburner |
981d46 |
connect(m_manager, SIGNAL(patternAdded()), this, SLOT(patternAdded()));
|
|
justburner |
981d46 |
m_manager->loadItems();
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void hideEvent(QHideEvent *) override {
|
|
justburner |
981d46 |
disconnect(m_manager, SIGNAL(patternAdded()), this, SLOT(patternAdded()));
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
bool loadIfNeeded() override { return false; } // serve?
|
|
justburner |
981d46 |
/*
|
|
justburner |
981d46 |
if(!m_loaded) {loadItems(); m_loaded=true;return true;}
|
|
justburner |
981d46 |
else return false;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
*/
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int getChipCount() const override { return m_manager->countData(); }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int drawChip(QPainter &p, QRect rect, int index) override;
|
|
justburner |
981d46 |
void onSelect(int index) override;
|
|
justburner |
981d46 |
bool isSameStyle(const TColorStyleP style, int index) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QString getChipDescription(int index) override;
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
// VectorBrushStyleChooser definition
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
class VectorBrushStyleChooserPage final : public StyleChooserPage {
|
|
justburner |
981d46 |
public:
|
|
justburner |
981d46 |
VectorBrushStyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0)
|
|
justburner |
981d46 |
: StyleChooserPage(styleEditor, parent) {
|
|
justburner |
981d46 |
m_chipSize = QSize(60, 25);
|
|
justburner |
981d46 |
static CustomStyleManager theManager(
|
|
justburner |
981d46 |
"InvalidStyle", "VectorBrushStyle:", TFilePath("vector brushes"),
|
|
justburner |
981d46 |
"*.pli", m_chipSize);
|
|
justburner |
981d46 |
m_manager = &theManager;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
void showEvent(QShowEvent *) override {
|
|
justburner |
981d46 |
bool ret =
|
|
justburner |
981d46 |
connect(m_manager, SIGNAL(patternAdded()), this, SLOT(patternAdded()));
|
|
justburner |
981d46 |
if (!ret) throw "!";
|
|
justburner |
981d46 |
m_manager->loadItems();
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
void hideEvent(QHideEvent *) override {
|
|
justburner |
981d46 |
disconnect(m_manager, SIGNAL(patternAdded()), this, SLOT(patternAdded()));
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
bool loadIfNeeded() override { return false; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int getChipCount() const override { return m_manager->countData() + 1; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int drawChip(QPainter &p, QRect rect, int index) override;
|
|
justburner |
981d46 |
void onSelect(int index) override;
|
|
justburner |
981d46 |
bool isSameStyle(const TColorStyleP style, int index) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QString getChipDescription(int index) override;
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
// TextureStyleChooser definition
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
class TextureStyleChooserPage final : public StyleChooserPage {
|
|
justburner |
981d46 |
public:
|
|
justburner |
981d46 |
TextureStyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0)
|
|
justburner |
981d46 |
: StyleChooserPage(styleEditor, parent) {
|
|
justburner |
981d46 |
m_chipSize = QSize(25, 25);
|
|
justburner |
981d46 |
static TextureStyleManager theManager(TFilePath("textures"), m_chipSize);
|
|
justburner |
981d46 |
m_manager = &theManager;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
bool loadIfNeeded() override {
|
|
justburner |
981d46 |
if (!m_manager->isLoaded()) {
|
|
justburner |
981d46 |
m_manager->loadItems();
|
|
justburner |
981d46 |
return true;
|
|
justburner |
981d46 |
} else
|
|
justburner |
981d46 |
return false;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int getChipCount() const override { return m_manager->countData() + 1; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int drawChip(QPainter &p, QRect rect, int index) override;
|
|
justburner |
981d46 |
void onSelect(int index) override;
|
|
justburner |
981d46 |
bool isSameStyle(const TColorStyleP style, int index) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QString getChipDescription(int index) override;
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
// MyPaintBrushStyleChooserPage definition
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
class MyPaintBrushStyleChooserPage final : public StyleChooserPage {
|
|
justburner |
981d46 |
MyPaintBrushStyleManager *m_mypManager;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
public:
|
|
justburner |
981d46 |
MyPaintBrushStyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0)
|
|
justburner |
981d46 |
: StyleChooserPage(styleEditor, parent) {
|
|
justburner |
981d46 |
m_chipSize = QSize(64, 64);
|
|
justburner |
981d46 |
static MyPaintBrushStyleManager theManager(m_chipSize);
|
|
justburner |
981d46 |
m_manager = &theManager;
|
|
justburner |
981d46 |
m_mypManager = &theManager;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
bool loadIfNeeded() override {
|
|
justburner |
981d46 |
if (!m_manager->isLoaded()) {
|
|
justburner |
981d46 |
m_manager->loadItems();
|
|
justburner |
981d46 |
return true;
|
|
justburner |
981d46 |
} else
|
|
justburner |
981d46 |
return false;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
TMyPaintBrushStyle &getBrush(int index) {
|
|
justburner |
981d46 |
return m_mypManager->getBrush(index);
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
int getChipCount() const override { return m_manager->countData() + 1; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int drawChip(QPainter &p, QRect rect, int index) override;
|
|
justburner |
981d46 |
void onSelect(int index) override;
|
|
justburner |
981d46 |
bool isSameStyle(const TColorStyleP style, int index) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QString getChipDescription(int index) override;
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
// SpecialStyleChooser definition
|
|
justburner |
981d46 |
//*****************************************************************************
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
class SpecialStyleChooserPage final : public StyleChooserPage {
|
|
justburner |
981d46 |
public:
|
|
justburner |
981d46 |
SpecialStyleChooserPage(StyleEditor *styleEditor, QWidget *parent = 0,
|
|
justburner |
981d46 |
const TFilePath &rootDir = TFilePath())
|
|
justburner |
981d46 |
: StyleChooserPage(styleEditor, parent) {
|
|
justburner |
981d46 |
static SpecialStyleManager theManager(m_chipSize);
|
|
justburner |
981d46 |
m_manager = &theManager;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
bool loadIfNeeded() override {
|
|
justburner |
981d46 |
if (!m_manager->isLoaded()) {
|
|
justburner |
981d46 |
m_manager->loadItems();
|
|
justburner |
981d46 |
return true;
|
|
justburner |
981d46 |
} else
|
|
justburner |
981d46 |
return false;
|
|
justburner |
981d46 |
}
|
|
justburner |
981d46 |
int getChipCount() const override { return m_manager->countData() + 1; }
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
int drawChip(QPainter &p, QRect rect, int index) override;
|
|
justburner |
981d46 |
void onSelect(int index) override;
|
|
justburner |
981d46 |
bool isSameStyle(const TColorStyleP style, int index) override;
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
QString getChipDescription(int index) override;
|
|
justburner |
981d46 |
};
|
|
justburner |
981d46 |
|
|
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 |
|
|
Shinya Kitaoka |
d1f6c4 |
class SettingsPage final : public QScrollArea {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QGridLayout *m_paramsLayout;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QCheckBox *m_autoFillCheckBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TColorStyleP m_editedStyle; //!< A copy of the current style being edited by
|
|
Shinya Kitaoka |
38fd86 |
//! the Style Editor.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool
|
|
Shinya Kitaoka |
120a6e |
m_updating; //!< Whether the page is copying style content to its widget,
|
|
Shinya Kitaoka |
120a6e |
//! to be displayed.
|
|
|
bf1d82 |
private:
|
|
|
bf1d82 |
int getParamIndex(const QWidget *widget);
|
|
|
bf1d82 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
SettingsPage(QWidget *parent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setStyle(const TColorStyleP &editedStyle);
|
|
Shinya Kitaoka |
120a6e |
void updateValues();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void enableAutopaintToggle(bool enabled);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void paramStyleChanged(
|
|
Shinya Kitaoka |
120a6e |
bool isDragging); //!< Signals that the edited style has changed.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onAutofillChanged();
|
|
Shinya Kitaoka |
120a6e |
void onValueChanged(bool isDragging = false);
|
|
|
bf1d82 |
void onValueReset();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
} // 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 |
|
|
Jeremy Bullock |
4bf672 |
class DVAPI StyleEditor final : public QWidget, public SaveLoadQSettings {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PaletteController *m_paletteController;
|
|
Shinya Kitaoka |
120a6e |
TPaletteHandle *m_paletteHandle;
|
|
Shinya Kitaoka |
120a6e |
TPaletteHandle *m_cleanupPaletteHandle;
|
|
justburner |
a72214 |
DVGui::HexLineEdit *m_hexLineEdit;
|
|
justburner |
a72214 |
DVGui::HexColorNamesEditor *m_hexColorNamesEditor;
|
|
Jeremy Bullock |
0a2e55 |
QWidget *m_parent;
|
|
Shinya Kitaoka |
120a6e |
TXshLevelHandle
|
|
Shinya Kitaoka |
120a6e |
*m_levelHandle; //!< for clearing the level cache when the color changed
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DVGui::TabBar *m_styleBar;
|
|
Shinya Kitaoka |
120a6e |
QStackedWidget *m_styleChooser;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
DVGui::StyleSample
|
|
Shinya Kitaoka |
120a6e |
*m_newColor; //!< New style viewer (lower-right panel side).
|
|
Shinya Kitaoka |
120a6e |
DVGui::StyleSample
|
|
Shinya Kitaoka |
120a6e |
*m_oldColor; //!< Old style viewer (lower-right panel side).
|
|
shun-iwasawa |
2a343c |
QAction *m_toggleOrientationAction;
|
|
Shinya Kitaoka |
120a6e |
QPushButton
|
|
Shinya Kitaoka |
120a6e |
*m_autoButton; //!< "Auto Apply" checkbox on the right panel side.
|
|
Shinya Kitaoka |
120a6e |
QPushButton *m_applyButton; //!< "Apply" button on the right panel side.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QToolBar *m_toolBar; //!< Lower toolbar.
|
|
Shinya Kitaoka |
120a6e |
ColorParameterSelector *m_colorParameterSelector; //!< Secondary color
|
|
Shinya Kitaoka |
38fd86 |
//! parameter selector in
|
|
Shinya Kitaoka |
38fd86 |
//! the lower toolbar.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TabBarContainter *m_tabBarContainer; //!< Tabs container for style types.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Jeremy Bullock |
0a2e55 |
// QLabel *m_statusLabel; //!< showing the information of the current palette
|
|
Jeremy Bullock |
0a2e55 |
//! and style.
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
PlainColorPage *m_plainColorPage;
|
|
Shinya Kitaoka |
120a6e |
StyleChooserPage *m_textureStylePage;
|
|
justburner |
981d46 |
StyleChooserPage *m_specialStylePage;
|
|
Shinya Kitaoka |
120a6e |
StyleChooserPage *m_customStylePage;
|
|
Shinya Kitaoka |
120a6e |
StyleChooserPage *m_vectorBrushesStylePage;
|
|
|
bf1d82 |
StyleChooserPage *m_mypaintBrushesStylePage;
|
|
Shinya Kitaoka |
120a6e |
SettingsPage *m_settingsPage;
|
|
justburner |
981d46 |
QScrollArea *m_textureArea;
|
|
justburner |
981d46 |
QScrollArea *m_vectorsArea;
|
|
justburner |
981d46 |
QScrollArea *m_mypaintArea;
|
|
Jeremy Bullock |
0a2e55 |
QAction *m_wheelAction;
|
|
Jeremy Bullock |
0a2e55 |
QAction *m_hsvAction;
|
|
Jeremy Bullock |
0a2e55 |
QAction *m_alphaAction;
|
|
Jeremy Bullock |
0a2e55 |
QAction *m_rgbAction;
|
|
justburner |
a13da2 |
QAction *m_hexAction;
|
|
justburner |
981d46 |
QAction *m_searchAction;
|
|
shun-iwasawa |
c18bfa |
QActionGroup *m_sliderAppearanceAG;
|
|
justburner |
a72214 |
QAction *m_hexEditorAction;
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
QFrame *m_textureSearchFrame;
|
|
justburner |
981d46 |
QFrame *m_vectorsSearchFrame;
|
|
justburner |
981d46 |
QFrame *m_mypaintSearchFrame;
|
|
justburner |
981d46 |
QLineEdit *m_textureSearchText;
|
|
justburner |
981d46 |
QLineEdit *m_vectorsSearchText;
|
|
justburner |
981d46 |
QLineEdit *m_mypaintSearchText;
|
|
justburner |
981d46 |
QPushButton *m_textureSearchClear;
|
|
justburner |
981d46 |
QPushButton *m_vectorsSearchClear;
|
|
justburner |
981d46 |
QPushButton *m_mypaintSearchClear;
|
|
justburner |
981d46 |
|
|
Shinya Kitaoka |
120a6e |
TColorStyleP
|
|
Shinya Kitaoka |
120a6e |
m_oldStyle; //!< A copy of current style \a before the last change.
|
|
Shinya Kitaoka |
120a6e |
TColorStyleP m_editedStyle; //!< The currently edited style. Please observe
|
|
Shinya Kitaoka |
38fd86 |
//! that this is
|
|
Shinya Kitaoka |
120a6e |
//! a \b copy of currently selected style, since style edits
|
|
Shinya Kitaoka |
120a6e |
//! may be not automatically applied.
|
|
Shinya Kitaoka |
120a6e |
bool m_enabled;
|
|
Shinya Kitaoka |
120a6e |
bool m_enabledOnlyFirstTab;
|
|
Shinya Kitaoka |
120a6e |
bool m_enabledFirstAndLastTab;
|
|
Jeremy Bullock |
4bf672 |
bool m_colorPageIsVertical = true;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
StyleEditor(PaletteController *, QWidget *parent = 0);
|
|
Shinya Kitaoka |
120a6e |
~StyleEditor();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setPaletteHandle(TPaletteHandle *paletteHandle);
|
|
Shinya Kitaoka |
120a6e |
TPaletteHandle *getPaletteHandle() const { return m_paletteHandle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setLevelHandle(TXshLevelHandle *levelHandle) {
|
|
Shinya Kitaoka |
120a6e |
m_levelHandle = levelHandle;
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPalette *getPalette() { return m_paletteHandle->getPalette(); }
|
|
Shinya Kitaoka |
120a6e |
int getStyleIndex() { return m_paletteHandle->getStyleIndex(); }
|
|
justburner |
981d46 |
const TColorStyleP getEditedStyle() const { return m_editedStyle; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*! rootPath generally is STUFFDIR/Library. Contains directories 'textures'
|
|
Shinya Kitaoka |
120a6e |
and
|
|
Shinya Kitaoka |
120a6e |
'custom styles' */
|
|
Shinya Kitaoka |
120a6e |
// TOGLIERE
|
|
Shinya Kitaoka |
120a6e |
void setRootPath(const TFilePath &rootPath);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void enableAutopaintToggle(bool enabled) {
|
|
Shinya Kitaoka |
120a6e |
m_settingsPage->enableAutopaintToggle(enabled);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Jeremy Bullock |
4bf672 |
// SaveLoadQSettings
|
|
Jeremy Bullock |
4bf672 |
virtual void save(QSettings &settings) const override;
|
|
Jeremy Bullock |
4bf672 |
virtual void load(QSettings &settings) override;
|
|
Jeremy Bullock |
4bf672 |
|
|
shun-iwasawa |
a8f111 |
void updateColorCalibration();
|
|
shun-iwasawa |
a8f111 |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
/*! Return false if style is linked and style must be set to null.*/
|
|
Shinya Kitaoka |
120a6e |
bool setStyle(TColorStyle *currentStyle);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void setEditedStyleToStyle(const TColorStyle *style); //!< Clones the
|
|
Shinya Kitaoka |
38fd86 |
//! supplied style and
|
|
Shinya Kitaoka |
38fd86 |
//! considers that as
|
|
Shinya Kitaoka |
38fd86 |
//! the edited one.
|
|
Shinya Kitaoka |
120a6e |
void setOldStyleToStyle(const TColorStyle *style); //!< Clones the supplied
|
|
Shinya Kitaoka |
38fd86 |
//! style and considers
|
|
Shinya Kitaoka |
38fd86 |
//! that as the previously
|
|
Shinya Kitaoka |
38fd86 |
//! current one.
|
|
Shinya Kitaoka |
120a6e |
//! \todo Why is this not assimilated to setCurrentStyleToStyle()?
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! Return style parameter index selected in \b ColorParameterSelector. */
|
|
Shinya Kitaoka |
120a6e |
int getColorParam() const { return m_colorParameterSelector->getSelected(); }
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*! Set StyleEditor view to \b enabled. If \b enabledOnlyFirstTab or if \b
|
|
Shinya Kitaoka |
120a6e |
enabledFirstAndLastTab
|
|
Shinya Kitaoka |
120a6e |
is true hide other tab, pay attention \b enabled must be true
|
|
Shinya Kitaoka |
120a6e |
or StyleEditor is disabled. */
|
|
Shinya Kitaoka |
120a6e |
void enable(bool enabled, bool enabledOnlyFirstTab = false,
|
|
Shinya Kitaoka |
120a6e |
bool enabledFirstAndLastTab = false);
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
981d46 |
void updateStylePages();
|
|
justburner |
981d46 |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
473e70 |
void showEvent(QShowEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void hideEvent(QHideEvent *) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onStyleSwitched();
|
|
shun_iwasawa |
e553fc |
void onStyleChanged(bool isDragging);
|
|
shun_iwasawa |
e553fc |
void onCleanupStyleChanged(bool isDragging);
|
|
justburner |
a13da2 |
void onOldStyleClicked();
|
|
justburner |
a13da2 |
void onNewStyleClicked();
|
|
Jeremy Bullock |
0a2e55 |
void updateOrientationButton();
|
|
shun-iwasawa |
2888cd |
void checkPaletteLock();
|
|
Shinya Kitaoka |
120a6e |
// called (e.g.) by PaletteController when an other StyleEditor change the
|
|
Shinya Kitaoka |
120a6e |
// toggle
|
|
Shinya Kitaoka |
120a6e |
void enableColorAutoApply(bool enabled);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// when colorAutoApply==false this slot is called when the current color
|
|
Shinya Kitaoka |
120a6e |
// changes
|
|
Shinya Kitaoka |
120a6e |
void setColorSample(const TPixel32 &color);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// chiamato quando viene modificato uno slider o la color wheel
|
|
Shinya Kitaoka |
120a6e |
void onColorChanged(const ColorModel &, bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void selectStyle(const TColorStyle &style);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void applyButtonClicked();
|
|
Shinya Kitaoka |
120a6e |
void autoCheckChanged(bool value);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setPage(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onColorParamChanged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onParamStyleChanged(bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
|
|
justburner |
a13da2 |
void onHexChanged();
|
|
justburner |
a72214 |
void onHexEditor();
|
|
justburner |
a13da2 |
|
|
justburner |
981d46 |
void onSearchVisible(bool on);
|
|
justburner |
981d46 |
|
|
Jeremy Bullock |
4bf672 |
void onSpecialButtonToggled(bool on);
|
|
Jeremy Bullock |
4bf672 |
void onCustomButtonToggled(bool on);
|
|
Jeremy Bullock |
4bf672 |
void onVectorBrushButtonToggled(bool on);
|
|
Jeremy Bullock |
4bf672 |
|
|
shun-iwasawa |
c18bfa |
void onSliderAppearanceSelected(QAction *);
|
|
shun-iwasawa |
c18bfa |
void onPopupMenuAboutToShow();
|
|
shun-iwasawa |
c18bfa |
|
|
justburner |
981d46 |
void onTextureSearch(const QString &);
|
|
justburner |
981d46 |
void onTextureClearSearch();
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
void onVectorsSearch(const QString &);
|
|
justburner |
981d46 |
void onVectorsClearSearch();
|
|
justburner |
981d46 |
|
|
justburner |
981d46 |
void onMyPaintSearch(const QString &);
|
|
justburner |
981d46 |
void onMyPaintClearSearch();
|
|
justburner |
981d46 |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
QFrame *createBottomWidget();
|
|
justburner |
981d46 |
QFrame *createTexturePage();
|
|
shun-iwasawa |
dfea21 |
QFrame *createVectorPage();
|
|
justburner |
981d46 |
QFrame *createMyPaintPage();
|
|
Shinya Kitaoka |
120a6e |
void updateTabBar();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void copyEditedStyleToPalette(bool isDragging);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // STYLEEDITOR_H
|