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 06bcc2
shun_iwasawa 06bcc2
class StylePickerTool final : public TTool, public QObject {
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 06bcc2
  void pick(const TPointD &pos, const TMouseEvent &e);
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 06bcc2
};
shun_iwasawa 06bcc2
shun_iwasawa 06bcc2
#endif