2016-07-11 21:55:17 +12:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifndef STYLEPICKERTOOL_H
|
|
|
|
#define STYLEPICKERTOOL_H
|
|
|
|
|
|
|
|
#include "tools/tool.h"
|
|
|
|
#include "tproperty.h"
|
|
|
|
#include <QObject>
|
2017-08-25 21:18:46 +12:00
|
|
|
// For Qt translation support
|
|
|
|
#include <QCoreApplication>
|
2016-07-11 21:55:17 +12:00
|
|
|
|
|
|
|
class StylePickerTool final : public TTool, public QObject {
|
2017-08-25 21:18:46 +12:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(StylePickerTool)
|
|
|
|
|
2016-07-11 21:55:17 +12:00
|
|
|
int m_oldStyleId, m_currentStyleId;
|
|
|
|
|
|
|
|
TEnumProperty m_colorType;
|
|
|
|
TPropertyGroup m_prop;
|
|
|
|
TBoolProperty m_passivePick;
|
2016-08-18 23:25:44 +12:00
|
|
|
|
2016-07-11 21:55:17 +12:00
|
|
|
TBoolProperty m_organizePalette;
|
2016-08-18 23:25:44 +12:00
|
|
|
TPalette *m_paletteToBeOrganized;
|
2016-07-11 21:55:17 +12:00
|
|
|
|
|
|
|
bool startOrganizePalette();
|
2016-08-18 23:25:44 +12:00
|
|
|
|
2016-07-11 21:55:17 +12:00
|
|
|
public:
|
|
|
|
TPropertyGroup *getProperties(int targetType) override { return &m_prop; }
|
|
|
|
|
|
|
|
StylePickerTool();
|
|
|
|
|
|
|
|
ToolType getToolType() const override { return TTool::LevelReadTool; }
|
|
|
|
|
|
|
|
void draw() override {}
|
|
|
|
|
|
|
|
void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
|
|
|
|
void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
|
|
|
|
|
2019-08-02 21:06:02 +12:00
|
|
|
void pick(const TPointD &pos, const TMouseEvent &e, bool isDragging = true);
|
2016-07-11 21:55:17 +12:00
|
|
|
|
|
|
|
void mouseMove(const TPointD &pos, const TMouseEvent &e) override;
|
2016-08-18 23:25:44 +12:00
|
|
|
|
2016-07-11 21:55:17 +12:00
|
|
|
int getCursorId() const override;
|
|
|
|
|
2020-09-16 09:49:57 +12:00
|
|
|
bool onPropertyChanged(std::string propertyName) override;
|
2016-07-11 21:55:17 +12:00
|
|
|
|
|
|
|
bool isOrganizePaletteActive() { return m_organizePalette.getValue(); }
|
|
|
|
|
2016-08-18 23:25:44 +12:00
|
|
|
/*
|
|
|
|
This function is called when either frame/column/level/scene is switched or
|
2016-07-11 21:55:17 +12:00
|
|
|
either scene/level/object is changed (see tapp.cpp).
|
2016-08-18 23:25:44 +12:00
|
|
|
If the working palette is changed, then deactivate the "organize palette"
|
|
|
|
toggle.
|
2016-07-11 21:55:17 +12:00
|
|
|
*/
|
|
|
|
void onImageChanged() override;
|
2017-08-25 21:18:46 +12:00
|
|
|
|
|
|
|
void updateTranslation() override;
|
2016-07-11 21:55:17 +12:00
|
|
|
};
|
|
|
|
|
2020-09-16 09:49:57 +12:00
|
|
|
#endif
|