|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef RGBPICKERTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
#define RGBPICKERTOOL_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tool.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tproperty.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/strokegenerator.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tools/tooloptions.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include <qcoreapplication></qcoreapplication>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
d1f6c4 |
class RGBPickerTool final : public TTool {
|
|
Shinya Kitaoka |
120a6e |
Q_DECLARE_TR_FUNCTIONS(RGBPickerTool)
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
bool m_firstTime;
|
|
Shinya Kitaoka |
120a6e |
int m_currentStyleId;
|
|
Shinya Kitaoka |
120a6e |
TPixel32 m_oldValue, m_currentValue;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TRectD m_selectingRect;
|
|
Shinya Kitaoka |
120a6e |
TRectD m_drawingRect;
|
|
Shinya Kitaoka |
120a6e |
TPropertyGroup m_prop;
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_pickType;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TBoolProperty m_passivePick;
|
|
Shinya Kitaoka |
120a6e |
std::vector<rgbpickertooloptionsbox *=""> m_toolOptionsBox;</rgbpickertooloptionsbox>
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
// Aggiunte per disegnare il lazzo a la polyline
|
|
Shinya Kitaoka |
120a6e |
StrokeGenerator m_drawingTrack;
|
|
Shinya Kitaoka |
120a6e |
StrokeGenerator m_workingTrack;
|
|
Shinya Kitaoka |
120a6e |
TPointD m_firstDrawingPos, m_firstWorkingPos;
|
|
Shinya Kitaoka |
120a6e |
TPointD m_mousePosition;
|
|
Shinya Kitaoka |
120a6e |
double m_thick;
|
|
Shinya Kitaoka |
120a6e |
TStroke *m_stroke;
|
|
Shinya Kitaoka |
120a6e |
TStroke *m_firstStroke;
|
|
Shinya Kitaoka |
120a6e |
std::vector<tpointd> m_drawingPolyline;</tpointd>
|
|
Shinya Kitaoka |
120a6e |
std::vector<tpointd> m_workingPolyline;</tpointd>
|
|
Shinya Kitaoka |
120a6e |
bool m_makePick;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun_iwasawa |
bc352c |
TPointD m_mousePixelPosition;
|
|
shun_iwasawa |
ca7879 |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
RGBPickerTool();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*-- ToolOptionBox上にPassiveに拾った色を表示するため --*/
|
|
Shinya Kitaoka |
120a6e |
void setToolOptionsBox(RGBPickerToolOptionsBox *toolOptionsBox);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
ToolType getToolType() const override { return TTool::LevelReadTool; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void updateTranslation() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// Used to notify and set the currentColor outside the draw() methods:
|
|
Shinya Kitaoka |
120a6e |
// using special style there was a conflict between the draw() methods of the
|
|
Shinya Kitaoka |
120a6e |
// tool
|
|
Shinya Kitaoka |
120a6e |
// and the genaration of the icon inside the style editor (makeIcon()) which
|
|
Shinya Kitaoka |
120a6e |
// use
|
|
Shinya Kitaoka |
120a6e |
// another glContext
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onImageChanged() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void draw() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonUp(const TPointD &pos, const TMouseEvent &) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void leftButtonDoubleClick(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void mouseMove(const TPointD &pos, const TMouseEvent &e) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun_iwasawa |
ca7879 |
void pick();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void pickRect();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void pickStroke();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
bool onPropertyChanged(std::string propertyName) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void onActivate() override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
TPropertyGroup *getProperties(int targetType) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
int getCursorId() const override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun_iwasawa |
ca7879 |
void doPolylineFreehandPick();
|
|
shun_iwasawa |
ca7879 |
|
|
shun_iwasawa |
ca7879 |
void passivePick();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Viene aggiunto \b pos a \b m_track e disegnato il primo pezzetto del
|
|
Shinya Kitaoka |
120a6e |
//! lazzo. Viene inizializzato \b m_firstPos
|
|
Shinya Kitaoka |
120a6e |
void startFreehand(const TPointD &drawingPos, const TPointD &workingPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Viene aggiunto \b pos a \b m_track e disegnato un altro pezzetto del
|
|
Shinya Kitaoka |
120a6e |
//! lazzo.
|
|
Shinya Kitaoka |
120a6e |
void freehandDrag(const TPointD &drawingPos, const TPointD &workingPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Viene chiuso il lazzo (si aggiunge l'ultimo punto ad m_track) e viene
|
|
Shinya Kitaoka |
120a6e |
//! creato lo stroke rappresentante il lazzo.
|
|
Shinya Kitaoka |
120a6e |
void closeFreehand();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Viene aggiunto un punto al vettore m_polyline.
|
|
Shinya Kitaoka |
120a6e |
void addPointPolyline(const TPointD &drawingPos, const TPointD &workingPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! Agginge l'ultimo pos a \b m_polyline e chiude la spezzata (aggiunge \b
|
|
Shinya Kitaoka |
120a6e |
//! m_polyline.front() alla fine del vettore)
|
|
Shinya Kitaoka |
120a6e |
void closePolyline(const TPointD &drawingPos, const TPointD &workingPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
/*--- RGBPickerToolをFlipbookで有効にする ---*/
|
|
Shinya Kitaoka |
120a6e |
void showFlipPickedColor(const TPixel32 &pix);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|