Shinya Kitaoka 810553
#pragma once
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#ifndef TOOL_OPTIONS_CONTROLS_INCLUDED
Toshihiro Shimizu 890ddd
#define TOOL_OPTIONS_CONTROLS_INCLUDED
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzCore includes
Toshihiro Shimizu 890ddd
#include "tproperty.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzBase includes
Toshihiro Shimizu 890ddd
#include "tunit.h"
Toshihiro Shimizu 890ddd
#include "tdoubleparamrelayproperty.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// ToonzQt includes
Toshihiro Shimizu 890ddd
#include "toonzqt/doublepairfield.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/intpairfield.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/intfield.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/styleindexlineedit.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/checkbox.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/doublefield.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/popupbutton.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// TnzLib includes
Toshihiro Shimizu 890ddd
#include "toonz/txsheet.h"
Toshihiro Shimizu 890ddd
#include "toonz/tstageobject.h"
Jeremy Bullock 771290
#include "toonz/stageobjectutil.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// STD includes
Toshihiro Shimizu 890ddd
#include <string></string>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// Qt includes
Toshihiro Shimizu 890ddd
#include <qcombobox></qcombobox>
Toshihiro Shimizu 890ddd
#include <qtoolbutton></qtoolbutton>
Toshihiro Shimizu 890ddd
#include <qtimer></qtimer>
Jeremy Bullock 771290
#include <qlabel></qlabel>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#undef DVAPI
Toshihiro Shimizu 890ddd
#undef DVVAR
Toshihiro Shimizu 890ddd
#ifdef TNZTOOLS_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
class TTool;
Toshihiro Shimizu 890ddd
class TFrameHandle;
Toshihiro Shimizu 890ddd
class TObjectHandle;
Toshihiro Shimizu 890ddd
class TXsheetHandle;
Toshihiro Shimizu 890ddd
class SelectionTool;
Toshihiro Shimizu 890ddd
class ToolHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
//    ToolOptionControl  declaration
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! ToolOptionControl is the base class for tool property toolbar controls.
Toshihiro Shimizu 890ddd
/*!
Toshihiro Shimizu 890ddd
  This class implements the basic methods the allow toolbar controls to
Toshihiro Shimizu 890ddd
  interact with the tool properties.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
class ToolOptionControl : public TProperty::Listener {
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  std::string m_propertyName;
Shinya Kitaoka 120a6e
  TTool *m_tool;
Shinya Kitaoka 120a6e
  ToolHandle *m_toolHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionControl(TTool *tool, std::string propertyName,
Shinya Kitaoka 120a6e
                    ToolHandle *toolHandle = 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const std::string &propertyName() const { return m_propertyName; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void onPropertyChanged() override { updateStatus(); }
Jeremy Bullock e122a9
  void notifyTool(bool addToUndo = false);
Shinya Kitaoka 120a6e
  // return true if the control is belonging to the visible viewer
Shinya Kitaoka 120a6e
  bool isInVisibleViewer(QWidget *widget);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void updateStatus() = 0;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
//    ToolOptionControl derivative  declarations
Toshihiro Shimizu 890ddd
//***********************************************************************************
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionCheckbox final : public DVGui::CheckBox,
Shinya Kitaoka d1f6c4
                                 public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TBoolProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionCheckbox(TTool *tool, TBoolProperty *property,
Shinya Kitaoka 120a6e
                     ToolHandle *toolHandle = 0, QWidget *parent = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
public slots:
shun_iwasawa b366ef
  void doClick(bool);
shun_iwasawa a39cc7
shun_iwasawa a39cc7
protected:
shun_iwasawa a39cc7
  void nextCheckState() override;
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionSlider final : public DVGui::DoubleField,
Shinya Kitaoka d1f6c4
                               public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TDoubleProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionSlider(TTool *tool, TDoubleProperty *property,
Shinya Kitaoka 120a6e
                   ToolHandle *toolHandle = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValueChanged(bool isDragging);
Shinya Kitaoka 120a6e
  void increase();
Shinya Kitaoka 120a6e
  void decrease();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionPairSlider final : public DVGui::DoublePairField,
Shinya Kitaoka d1f6c4
                                   public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TDoublePairProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionPairSlider(TTool *tool, TDoublePairProperty *property,
Shinya Kitaoka 120a6e
                       const QString &leftName, const QString &rightName,
Shinya Kitaoka 120a6e
                       ToolHandle *toolHandle = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValuesChanged(bool isDragging);
Shinya Kitaoka 120a6e
  void increaseMaxValue();
Shinya Kitaoka 120a6e
  void decreaseMaxValue();
Shinya Kitaoka 120a6e
  void increaseMinValue();
Shinya Kitaoka 120a6e
  void decreaseMinValue();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionIntPairSlider final : public DVGui::IntPairField,
Shinya Kitaoka d1f6c4
                                      public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TIntPairProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionIntPairSlider(TTool *tool, TIntPairProperty *property,
Shinya Kitaoka 120a6e
                          const QString &leftName, const QString &rightName,
Shinya Kitaoka 120a6e
                          ToolHandle *toolHandle = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValuesChanged(bool isDragging);
Shinya Kitaoka 120a6e
  void increaseMaxValue();
Shinya Kitaoka 120a6e
  void decreaseMaxValue();
Shinya Kitaoka 120a6e
  void increaseMinValue();
Shinya Kitaoka 120a6e
  void decreaseMinValue();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionIntSlider final : public DVGui::IntField,
Shinya Kitaoka d1f6c4
                                  public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TIntProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionIntSlider(TTool *tool, TIntProperty *property,
Shinya Kitaoka 120a6e
                      ToolHandle *toolHandle = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValueChanged(bool isDragging);
Shinya Kitaoka 120a6e
  void increase();
Shinya Kitaoka 120a6e
  void decrease();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionCombo final : public QComboBox, public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TEnumProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionCombo(TTool *tool, TEnumProperty *property,
Shinya Kitaoka 120a6e
                  ToolHandle *toolHandle = 0);
Shinya Kitaoka 120a6e
  void loadEntries();
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onActivated(int);
Shinya Kitaoka 120a6e
  void doShowPopup();
Shinya Kitaoka 120a6e
  void doOnActivated(int);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionPopupButton final : public PopupButton,
Shinya Kitaoka d1f6c4
                                    public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TEnumProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionPopupButton(TTool *tool, TEnumProperty *property);
Shinya Kitaoka 473e70
  void updateStatus() override;
Shinya Kitaoka 120a6e
  TEnumProperty *getProperty() { return m_property; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onActivated(int);
Shinya Kitaoka 120a6e
  void doShowPopup();
Shinya Kitaoka 120a6e
  void doSetCurrentIndex(int);
Shinya Kitaoka 120a6e
  void doOnActivated(int);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ToolOptionTextField final : public DVGui::LineEdit,
Shinya Kitaoka d1f6c4
                                  public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TStringProperty *m_property;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionTextField(TTool *tool, TStringProperty *property);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValueChanged();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class StyleIndexFieldAndChip final : public DVGui::StyleIndexLineEdit,
Shinya Kitaoka d1f6c4
                                     public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TStyleIndexProperty *m_property;
Shinya Kitaoka 120a6e
  TPaletteHandle *m_pltHandle;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  StyleIndexFieldAndChip(TTool *tool, TStyleIndexProperty *property,
Shinya Kitaoka 120a6e
                         TPaletteHandle *pltHandle, ToolHandle *toolHandle = 0);
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onValueChanged(const QString &);
Shinya Kitaoka 120a6e
  void updateColor();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//! The ToolOptionMeasuredDoubleField class implements toolbar controls for
Toshihiro Shimizu 890ddd
//! double properties that need to be displayed with a measure.
Toshihiro Shimizu 890ddd
/*!
Shinya Kitaoka 120a6e
  This option control is useful to display function editor curves in the
Shinya Kitaoka 120a6e
  toolbar;
Toshihiro Shimizu 890ddd
  in particular, it deals with the following tasks:
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
  \li Setting the preference-based keyframe interpolation type
Shinya Kitaoka 120a6e
  \li Editing with global keyframes (ie affecting multiple parameters other than
Shinya Kitaoka 120a6e
  the edited one)
Toshihiro Shimizu 890ddd
  \li Undo/Redo of user interactions.
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka d1f6c4
class ToolOptionParamRelayField final : public DVGui::MeasuredDoubleLineEdit,
Shinya Kitaoka d1f6c4
                                        public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TDoubleParamP m_param;  //!< Cached property param
Shinya Kitaoka 120a6e
  TMeasure *m_measure;    //!< Cached property param measure
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  TDoubleParamRelayProperty
Shinya Kitaoka 120a6e
      *m_property;  //!< The TDoubleParam relaying property
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TBoolProperty *m_globalKey;     //!< The property enforcing global keys
Shinya Kitaoka 120a6e
  TPropertyGroup *m_globalGroup;  //!< The property group whose properties
Shinya Kitaoka 120a6e
                                  //!< are affected by m_globalKey
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ToolOptionParamRelayField(TTool *tool, TDoubleParamRelayProperty *property,
Shinya Kitaoka 120a6e
                            int decimals = 2);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setGlobalKey(TBoolProperty *globalKey, TPropertyGroup *globalGroup);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  virtual void onValueChanged();
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
// Widget specifici di ArrowTool (derivati da ToolOptionControl)
Toshihiro Shimizu 890ddd
//
Toshihiro Shimizu 890ddd
//=============================================================================
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
class DVAPI MeasuredValueField : public DVGui::LineEdit {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TMeasuredValue *m_value;
Shinya Kitaoka 120a6e
  bool m_modified;
Shinya Kitaoka 120a6e
  double m_errorHighlighting;
Shinya Kitaoka 120a6e
  QTimer m_errorHighlightingTimer;
Jeremy Bullock 771290
  int m_xMouse = -1;
Shinya Kitaoka 120a6e
  int m_precision;
Jeremy Bullock 771290
  bool m_mouseEdit    = false;
Jeremy Bullock 771290
  bool m_labelClicked = false;
Jeremy Bullock 771290
  double m_originalValue;
shun_iwasawa 23727d
  bool m_isTyping = false;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected:
Shinya Kitaoka 120a6e
  bool m_isGlobalKeyframe;
Toshihiro Shimizu 890ddd
Jeremy Bullock 771290
  // these are used for mouse dragging to edit a value
Jeremy Bullock 771290
  void mousePressEvent(QMouseEvent *) override;
Jeremy Bullock 771290
  void mouseMoveEvent(QMouseEvent *) override;
Jeremy Bullock 771290
  void mouseReleaseEvent(QMouseEvent *) override;
shun_iwasawa 23727d
  void focusOutEvent(QFocusEvent *) override;
Jeremy Bullock 771290
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  MeasuredValueField(QWidget *parent, QString name = "numfield");
Shinya Kitaoka 120a6e
  ~MeasuredValueField();
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setMeasure(std::string name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void enableGlobalKeyframe(bool isGlobalKeyframe) {
Shinya Kitaoka 120a6e
    m_isGlobalKeyframe = isGlobalKeyframe;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TMeasuredValue *getMeasuredValue() const { return m_value; }
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setValue(double v);
Shinya Kitaoka 120a6e
  double getValue() const;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void setPrecision(int precision);
Shinya Kitaoka 120a6e
  int getPrecision() { return m_precision; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void commit();
Shinya Kitaoka 120a6e
  void onTextChanged(const QString &);
Shinya Kitaoka 120a6e
  void errorHighlightingTick();
Toshihiro Shimizu 890ddd
Jeremy Bullock 771290
  // clicking on the label connected to a field
Jeremy Bullock 771290
  // can be used to drag and change the value
Jeremy Bullock 771290
  void receiveMouseMove(QMouseEvent *event);
Jeremy Bullock 771290
  void receiveMousePress(QMouseEvent *event);
Jeremy Bullock 771290
  void receiveMouseRelease(QMouseEvent *event);
Jeremy Bullock 771290
Toshihiro Shimizu 890ddd
signals:
Toshihiro Shimizu 890ddd
Jeremy Bullock 771290
  void measuredValueChanged(TMeasuredValue *value, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class PegbarChannelField final : public MeasuredValueField,
Shinya Kitaoka d1f6c4
                                 public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  const enum TStageObject::Channel m_actionId;
Shinya Kitaoka 120a6e
  TFrameHandle *m_frameHandle;
Shinya Kitaoka 120a6e
  TObjectHandle *m_objHandle;
Shinya Kitaoka 120a6e
  TXsheetHandle *m_xshHandle;
Shinya Kitaoka 120a6e
  enum ScaleType { eNone = 0, eAR = 1, eMass = 2 } m_scaleType;
Jeremy Bullock 771290
  TStageObjectValues m_before;
Jeremy Bullock 771290
  bool m_firstMouseDrag = false;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PegbarChannelField(TTool *tool, enum TStageObject::Channel actionId,
Shinya Kitaoka 120a6e
                     QString name, TFrameHandle *frameHandle,
Shinya Kitaoka 120a6e
                     TObjectHandle *objHandle, TXsheetHandle *xshHandle,
Shinya Kitaoka 120a6e
                     QWidget *parent = 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~PegbarChannelField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onScaleTypeChanged(int type);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class DVAPI PegbarCenterField final : public MeasuredValueField,
Shinya Kitaoka d1f6c4
                                      public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_index;  // 0 = x, 1 = y
Shinya Kitaoka 120a6e
  TObjectHandle *m_objHandle;
Shinya Kitaoka 120a6e
  TXsheetHandle *m_xshHandle;
Jeremy Bullock 771290
  TPointD m_oldCenter;
Jeremy Bullock 771290
  bool m_firstMouseDrag = false;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PegbarCenterField(TTool *tool, int index, QString name,
Shinya Kitaoka 120a6e
                    TObjectHandle *objHandle, TXsheetHandle *xshHandle,
Shinya Kitaoka 120a6e
                    QWidget *parent = 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~PegbarCenterField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class NoScaleField final : public MeasuredValueField, public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  NoScaleField(TTool *tool, QString name);
Shinya Kitaoka 120a6e
  ~NoScaleField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class PropertyMenuButton final : public QToolButton, public ToolOptionControl {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  QList<tboolproperty *=""> m_properties;</tboolproperty>
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  PropertyMenuButton(
Shinya Kitaoka 120a6e
      QWidget *parent = 0, TTool *tool = 0,
Shinya Kitaoka 120a6e
      QList<tboolproperty *=""> properties = QList<tboolproperty *="">(),</tboolproperty></tboolproperty>
Shinya Kitaoka 120a6e
      QIcon icon = QIcon(), QString tooltip = QString());
Shinya Kitaoka 120a6e
  ~PropertyMenuButton() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 473e70
  void updateStatus() override;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onActionTriggered(QAction *);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
signals:
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void onPropertyChanged(QString name);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class SelectionScaleField final : public MeasuredValueField {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_id;
Shinya Kitaoka 120a6e
  SelectionTool *m_tool;
Jeremy Bullock 771290
  double m_originalValue;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SelectionScaleField(SelectionTool *tool, int actionId, QString name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~SelectionScaleField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateStatus();
Jeremy Bullock 771290
  bool applyChange(bool addToUndo = true);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
signals:
Jeremy Bullock 771290
  void valueChange(bool addToUndo);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class SelectionRotationField final : public MeasuredValueField {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  SelectionTool *m_tool;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SelectionRotationField(SelectionTool *tool, QString name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~SelectionRotationField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateStatus();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class SelectionMoveField final : public MeasuredValueField {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  int m_id;
Shinya Kitaoka 120a6e
  SelectionTool *m_tool;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  SelectionMoveField(SelectionTool *tool, int id, QString name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~SelectionMoveField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateStatus();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  // add to undo is only false if mouse dragging to change the value
Jeremy Bullock 771290
  // on mouse release, add to undo is true
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//-----------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class ThickChangeField final : public MeasuredValueField {
Shinya Kitaoka 120a6e
  Q_OBJECT
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  SelectionTool *m_tool;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  ThickChangeField(SelectionTool *tool, QString name);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  ~ThickChangeField() {}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  void updateStatus();
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
protected slots:
Jeremy Bullock 771290
  void onChange(TMeasuredValue *fld, bool addToUndo = true);
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Jeremy Bullock 771290
//-----------------------------------------------------------------------------
Jeremy Bullock 771290
Jeremy Bullock 771290
// The ClickableLabel class is used to allow click and dragging
Jeremy Bullock 771290
// on a label to change the value of a linked field
Jeremy Bullock 771290
class ClickableLabel : public QLabel {
Jeremy Bullock 771290
  Q_OBJECT
Jeremy Bullock 771290
Jeremy Bullock 771290
protected:
Jeremy Bullock 771290
  void mousePressEvent(QMouseEvent *) override;
Jeremy Bullock 771290
  void mouseMoveEvent(QMouseEvent *) override;
Jeremy Bullock 771290
  void mouseReleaseEvent(QMouseEvent *) override;
Jeremy Bullock 771290
Jeremy Bullock 771290
public:
Jeremy Bullock 771290
  ClickableLabel(const QString &text, QWidget *parent = Q_NULLPTR,
Jeremy Bullock 771290
                 Qt::WindowFlags f = Qt::WindowFlags());
Jeremy Bullock 771290
  ~ClickableLabel();
Jeremy Bullock 771290
Jeremy Bullock 771290
signals:
Jeremy Bullock 771290
  void onMousePress(QMouseEvent *event);
Jeremy Bullock 771290
  void onMouseMove(QMouseEvent *event);
Jeremy Bullock 771290
  void onMouseRelease(QMouseEvent *event);
Jeremy Bullock 771290
};
Jeremy Bullock 771290
Jeremy Bullock 771290
//-----------------------------------------------------------------------------
Jeremy Bullock 771290
Toshihiro Shimizu 890ddd
#endif