shun_iwasawa 06bcc2
#pragma once
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
#ifndef STYLEPICKERTOOL_H
shun_iwasawa 06bcc2
#define STYLEPICKERTOOL_H
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
#include "tools/tool.h"
shun_iwasawa 06bcc2
#include "tproperty.h"
shun_iwasawa 06bcc2
#include <qobject></qobject>
shun-iwasawa 031c3b
// For Qt translation support
shun-iwasawa 031c3b
#include <qcoreapplication></qcoreapplication>
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
class StylePickerTool final : public TTool, public QObject {
shun-iwasawa 031c3b
  Q_DECLARE_TR_FUNCTIONS(StylePickerTool)
shun-iwasawa 031c3b
shun_iwasawa 06bcc2
  int m_oldStyleId, m_currentStyleId;
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  TEnumProperty m_colorType;
shun_iwasawa 06bcc2
  TPropertyGroup m_prop;
shun_iwasawa 06bcc2
  TBoolProperty m_passivePick;
shun_iwasawa e897af
shun_iwasawa 06bcc2
  TBoolProperty m_organizePalette;
shun_iwasawa e897af
  TPalette *m_paletteToBeOrganized;
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  bool startOrganizePalette();
shun_iwasawa e897af
shun_iwasawa 06bcc2
public:
shun_iwasawa 06bcc2
  TPropertyGroup *getProperties(int targetType) override { return &m_prop; }
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  StylePickerTool();
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  ToolType getToolType() const override { return TTool::LevelReadTool; }
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  void draw() override {}
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  void leftButtonDown(const TPointD &pos, const TMouseEvent &e) override;
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  void leftButtonDrag(const TPointD &pos, const TMouseEvent &e) override;
shun_iwasawa 06bcc2
shun-iwasawa 558228
  void pick(const TPointD &pos, const TMouseEvent &e, bool isDragging = true);
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  void mouseMove(const TPointD &pos, const TMouseEvent &e) override;
shun_iwasawa e897af
shun_iwasawa 06bcc2
  int getCursorId() const override;
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  bool onPropertyChanged(std::string propertyName);
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
  bool isOrganizePaletteActive() { return m_organizePalette.getValue(); }
shun_iwasawa 06bcc2
shun_iwasawa e897af
  /*
shun_iwasawa e897af
     This function is called when either frame/column/level/scene is switched or
shun_iwasawa 06bcc2
     either scene/level/object is changed (see tapp.cpp).
shun_iwasawa e897af
     If the working palette is changed, then deactivate the "organize palette"
shun_iwasawa e897af
     toggle.
shun_iwasawa 06bcc2
  */
shun_iwasawa 06bcc2
  void onImageChanged() override;
shun-iwasawa 031c3b
shun-iwasawa 031c3b
  void updateTranslation() override;
shun_iwasawa 06bcc2
};
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
#endif