|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TONECURVEFIELD_H
|
|
Toshihiro Shimizu |
890ddd |
#define TONECURVEFIELD_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tcommon.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tstroke.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/histogram.h"
|
|
Toshihiro Shimizu |
890ddd |
#include <qwidget></qwidget>
|
|
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 |
// forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class TStroke;
|
|
Toshihiro Shimizu |
890ddd |
class QPainterPath;
|
|
Toshihiro Shimizu |
890ddd |
class QStackedWidget;
|
|
Toshihiro Shimizu |
890ddd |
class FxHistogramRender;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Shinya Kitaoka |
120a6e |
namespace DVGui {
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// forward declaration
|
|
shun-iwasawa |
0ed559 |
class DoublePairField;
|
|
Toshihiro Shimizu |
890ddd |
class CheckBox;
|
|
shun-iwasawa |
0ed559 |
class DoubleLineEdit;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ChennelCurveEditor
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ChennelCurveEditor final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
HistogramView *m_histogramView;
|
|
Shinya Kitaoka |
120a6e |
ChannelBar *m_verticalChannelBar;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QList<qpointf> m_points;</qpointf>
|
|
Shinya Kitaoka |
120a6e |
int m_currentControlPointIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
Qt::MouseButton m_mouseButton;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_curveHeight;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int m_LeftRightMargin;
|
|
Shinya Kitaoka |
120a6e |
int m_TopMargin;
|
|
Shinya Kitaoka |
120a6e |
int m_BottomMargin;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_isLinear;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
0ed559 |
QPointF m_preMousePos;
|
|
shun-iwasawa |
0ed559 |
|
|
shun-iwasawa |
0ed559 |
bool m_isEnlarged;
|
|
shun-iwasawa |
0ed559 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ChennelCurveEditor(QWidget *parent = 0, HistogramView *histogramView = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setPoints(QList<tpointd> points);</tpointd>
|
|
Shinya Kitaoka |
120a6e |
QList<tpointd> getPoints();</tpointd>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int getCurrentControlPointIndex() { return m_currentControlPointIndex; };
|
|
Shinya Kitaoka |
120a6e |
void setCurrentControlPointIndex(int index) {
|
|
Shinya Kitaoka |
120a6e |
m_currentControlPointIndex = index;
|
|
Shinya Kitaoka |
120a6e |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
bool eventFilter(QObject *object, QEvent *event) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
0ed559 |
void setFirstLastXPosition(std::pair<double, double=""> values, bool isDragging);</double,>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setLinear(bool isLinear);
|
|
shun-iwasawa |
0ed559 |
void moveCurrentControlPoint(QPointF delta);
|
|
shun-iwasawa |
0ed559 |
|
|
shun-iwasawa |
0ed559 |
void setEnlarged(bool isEnlarged);
|
|
shun-iwasawa |
0ed559 |
void setLabelRange(ChannelBar::Range range);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
shun-iwasawa |
0ed559 |
QPointF viewToStrokePoint(const QPointF &p);
|
|
Shinya Kitaoka |
120a6e |
int getClosestPointIndex(const QPointF &pos, double &minDistance2) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
0ed559 |
bool isCentralControlPoint(const int index) const { return index % 3 == 0; }
|
|
shun-iwasawa |
0ed559 |
bool isLeftControlPoint(const int index) const { return index % 3 == 2; }
|
|
shun-iwasawa |
0ed559 |
bool isRightControlPoint(const int index) const { return index % 3 == 1; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setPoint(int index, const QPointF point);
|
|
shun-iwasawa |
0ed559 |
void movePoint(int index, const QPointF delta);
|
|
Shinya Kitaoka |
120a6e |
QPointF checkPoint(const QPointF p);
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
0ed559 |
QPointF getVisibleHandlePos(int index) const;
|
|
shun-iwasawa |
0ed559 |
|
|
shun-iwasawa |
0ed559 |
void moveCentralControlPoint(int index, QPointF delta);
|
|
Shinya Kitaoka |
120a6e |
// bool eraseControlPointWhileMove(int index, const QPointF delta);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void addControlPoint(double percent);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void removeControlPoint(int index);
|
|
Shinya Kitaoka |
120a6e |
void removeCurrentControlPoint();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Martin van Zijl |
9c0391 |
void selectNextControlPoint();
|
|
Martin van Zijl |
9c0391 |
void selectPreviousControlPoint();
|
|
Martin van Zijl |
9c0391 |
|
|
Shinya Kitaoka |
120a6e |
QPainterPath getPainterPath();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void paintEvent(QPaintEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseMoveEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mousePressEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void mouseReleaseEvent(QMouseEvent *) override;
|
|
Shinya Kitaoka |
473e70 |
void keyPressEvent(QKeyEvent *e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void focusInEvent(QFocusEvent *fe) override;
|
|
Shinya Kitaoka |
473e70 |
void focusOutEvent(QFocusEvent *fe) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void focusOut();
|
|
Shinya Kitaoka |
120a6e |
void controlPointChanged(bool isDragging);
|
|
Shinya Kitaoka |
120a6e |
void controlPointAdded(int index);
|
|
Shinya Kitaoka |
120a6e |
void controlPointRemoved(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun-iwasawa |
0ed559 |
void firstLastXPostionChanged(double, double);
|
|
shun-iwasawa |
0ed559 |
void updateCurrentPosition(int, QPointF);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//=============================================================================
|
|
Toshihiro Shimizu |
890ddd |
// ToneCurveField
|
|
Toshihiro Shimizu |
890ddd |
//-----------------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class DVAPI ToneCurveField final : public QWidget {
|
|
Shinya Kitaoka |
120a6e |
Q_OBJECT
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
QStackedWidget *m_toneCurveStackedWidget;
|
|
Shinya Kitaoka |
120a6e |
QStackedWidget *m_sliderStackedWidget;
|
|
Shinya Kitaoka |
120a6e |
QComboBox *m_channelListChooser;
|
|
shun-iwasawa |
0ed559 |
CheckBox *m_isLinearCheckBox, *m_isEnlargedCheckBox;
|
|
shun-iwasawa |
0ed559 |
|
|
shun-iwasawa |
0ed559 |
DoubleLineEdit *m_currentInput, *m_currentOutput;
|
|
shun-iwasawa |
0ed559 |
int m_currentPointIndex;
|
|
shun-iwasawa |
0ed559 |
QComboBox *m_rangeMode;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ToneCurveField(QWidget *parent = 0, FxHistogramRender *fxHistogramRender = 0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setCurrentChannel(int currentChannel);
|
|
Shinya Kitaoka |
120a6e |
ChennelCurveEditor *getChannelEditor(int channel) const;
|
|
Shinya Kitaoka |
120a6e |
ChennelCurveEditor *getCurrentChannelEditor() const;
|
|
shun-iwasawa |
0ed559 |
DoublePairField *getCurrentSlider() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int getChannelCount() { return m_toneCurveStackedWidget->count(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void setIsLinearCheckBox(bool isChecked);
|
|
shun-iwasawa |
0ed559 |
bool isEnlarged();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected slots:
|
|
Shinya Kitaoka |
120a6e |
void sliderValueChanged(bool);
|
|
shun-iwasawa |
0ed559 |
void onFirstLastXPostionChanged(double, double);
|
|
shun-iwasawa |
0ed559 |
void onUpdateCurrentPosition(int, QPointF);
|
|
shun-iwasawa |
0ed559 |
void onCurrentPointEditted();
|
|
shun-iwasawa |
0ed559 |
void onCurrentChannelSwitched(int);
|
|
shun-iwasawa |
0ed559 |
void onRangeModeSwitched(int);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public slots:
|
|
Shinya Kitaoka |
120a6e |
void setLinear(bool);
|
|
shun-iwasawa |
0ed559 |
void setEnlarged(bool);
|
|
Shinya Kitaoka |
120a6e |
void setLinearManually(bool);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
signals:
|
|
Shinya Kitaoka |
120a6e |
void currentChannelIndexChanged(int);
|
|
Shinya Kitaoka |
120a6e |
void isLinearChanged(bool);
|
|
shun-iwasawa |
0ed559 |
void sizeChanged();
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
shun-iwasawa |
0ed559 |
} // namespace DVGui
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // TONECURVEFIELD_H
|