Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "rgbpickertool.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tvectorimage.h"
Toshihiro Shimizu 890ddd
#include "ttoonzimage.h"
Toshihiro Shimizu 890ddd
#include "tools/cursors.h"
Toshihiro Shimizu 890ddd
#include "tcolorstyles.h"
Toshihiro Shimizu 890ddd
#include "toonz/cleanupcolorstyles.h"
Toshihiro Shimizu 890ddd
#include "trasterimage.h"
Toshihiro Shimizu 890ddd
#include "tgl.h"
Toshihiro Shimizu 890ddd
#include "tenv.h"
Toshihiro Shimizu 890ddd
#include "tstroke.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonz/palettecontroller.h"
Toshihiro Shimizu 890ddd
#include "toonz/tpalettehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/tscenehandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/txshlevelhandle.h"
Toshihiro Shimizu 890ddd
#include "toonz/stage2.h"
Toshihiro Shimizu 890ddd
#include "toonz/txshsimplelevel.h"
Toshihiro Shimizu 890ddd
#include "toonz/preferences.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "toonzqt/icongenerator.h"
Toshihiro Shimizu 890ddd
#include "toonzqt/dvdialog.h"
shun-iwasawa ad7711
#include "toonzqt/lutcalibrator.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#include "tools/toolhandle.h"
Toshihiro Shimizu 890ddd
#include "tools/stylepicker.h"
Toshihiro Shimizu 890ddd
#include "tools/toolutils.h"
Toshihiro Shimizu 890ddd
#include "tools/RGBpicker.h"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
#define NORMAL_PICK L"Normal"
Toshihiro Shimizu 890ddd
#define RECT_PICK L"Rectangular"
Toshihiro Shimizu 890ddd
#define FREEHAND_PICK L"Freehand"
Toshihiro Shimizu 890ddd
#define POLYLINE_PICK L"Polyline"
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TEnv::StringVar PickVectorType("InknpaintPickVectorType", "Normal");
Toshihiro Shimizu 890ddd
TEnv::IntVar PickPassive("InknpaintPickPassive", 0);
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
namespace RGBPicker {
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//============================================================
Toshihiro Shimizu 890ddd
// Pick RGB Tool
Toshihiro Shimizu 890ddd
//------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
class UndoPickRGBM final : public TUndo {
Shinya Kitaoka 120a6e
  TPaletteP m_palette;
Shinya Kitaoka 120a6e
  int m_styleId;
Shinya Kitaoka 120a6e
  int m_styleParamIndex;
Shinya Kitaoka 120a6e
  TPixel32 m_oldValue, m_newValue;
Shinya Kitaoka 120a6e
  TXshSimpleLevelP m_level;
Shinya Kitaoka 120a6e
  bool m_colorAutoApplyEnabled;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
public:
Shinya Kitaoka 120a6e
  UndoPickRGBM(TPalette *palette, int styleId, const TPixel32 newValue,
Shinya Kitaoka 120a6e
               const TXshSimpleLevelP &level)
Shinya Kitaoka 120a6e
      : m_palette(palette)
Shinya Kitaoka 120a6e
      , m_styleId(styleId)
Shinya Kitaoka 120a6e
      , m_newValue(newValue)
Shinya Kitaoka 120a6e
      , m_level(level)
Shinya Kitaoka 120a6e
      , m_colorAutoApplyEnabled(true) {
Shinya Kitaoka 120a6e
    PaletteController *controller =
Shinya Kitaoka 120a6e
        TTool::getApplication()->getPaletteController();
Shinya Kitaoka 120a6e
    m_colorAutoApplyEnabled = controller->isColorAutoApplyEnabled();
Shinya Kitaoka 120a6e
    m_styleParamIndex = controller->getCurrentPalette()->getStyleParamIndex();
Shinya Kitaoka 120a6e
    if (m_colorAutoApplyEnabled) {
Shinya Kitaoka 120a6e
      TColorStyle *cs = m_palette->getStyle(m_styleId);
Shinya Kitaoka 120a6e
      if (0 <= m_styleParamIndex &&
Shinya Kitaoka 120a6e
          m_styleParamIndex < cs->getColorParamCount())
Shinya Kitaoka 120a6e
        m_oldValue = cs->getColorParamValue(m_styleParamIndex);
Shinya Kitaoka 120a6e
      else
Shinya Kitaoka 120a6e
        m_oldValue = cs->getMainColor();
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      m_oldValue = controller->getColorSample();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  void setColor(const TPixel32 &color) const {
Shinya Kitaoka 120a6e
    PaletteController *controller =
Shinya Kitaoka 120a6e
        TTool::getApplication()->getPaletteController();
Shinya Kitaoka 120a6e
    if (m_colorAutoApplyEnabled) {
Shinya Kitaoka 120a6e
      TColorStyle *cs = m_palette->getStyle(m_styleId);
Shinya Kitaoka 120a6e
      if (0 <= m_styleParamIndex &&
Shinya Kitaoka 120a6e
          m_styleParamIndex < cs->getColorParamCount())
Shinya Kitaoka 120a6e
        cs->setColorParamValue(m_styleParamIndex, color);
Shinya Kitaoka 120a6e
      else
Shinya Kitaoka 120a6e
        cs->setMainColor(color);
Shinya Kitaoka 120a6e
      cs->invalidateIcon();
Shinya Kitaoka 120a6e
      controller->getCurrentPalette()->notifyColorStyleChanged();
Shinya Kitaoka 120a6e
      updateLevel();
Shinya Kitaoka 120a6e
    } else {
Shinya Kitaoka 120a6e
      controller->setColorSample(color);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void undo() const override { setColor(m_oldValue); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  void redo() const override { setColor(m_newValue); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  int getSize() const override { return sizeof(*this); }
Shinya Kitaoka 120a6e
Shinya Kitaoka 473e70
  QString getHistoryString() override {
Shinya Kitaoka 120a6e
    return QObject::tr("RGB Picker (R%1, G%2, B%3)")
Shinya Kitaoka 120a6e
        .arg(QString::number((int)m_newValue.r))
Shinya Kitaoka 120a6e
        .arg(QString::number((int)m_newValue.g))
Shinya Kitaoka 120a6e
        .arg(QString::number((int)m_newValue.b));
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
private:
Shinya Kitaoka 120a6e
  void updateLevel() const {
Shinya Kitaoka 120a6e
    std::vector<tframeid> fids;</tframeid>
Shinya Kitaoka 120a6e
    if (!m_level) return;
Shinya Kitaoka 120a6e
    m_level->getFids(fids);
Shinya Kitaoka 120a6e
    unsigned int i;
Shinya Kitaoka 120a6e
    for (i = 0; i < fids.size(); i++)
Shinya Kitaoka 120a6e
      IconGenerator::instance()->invalidate(m_level.getPointer(), fids[i]);
Shinya Kitaoka 120a6e
    IconGenerator::instance()->invalidateSceneIcon();
Shinya Kitaoka 120a6e
    TTool::getApplication()->getCurrentScene()->notifySceneChanged();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
};
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//----------------------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void setCurrentColor(const TPixel32 &color) {
Shinya Kitaoka 120a6e
  PaletteController *controller =
Shinya Kitaoka 120a6e
      TTool::getApplication()->getPaletteController();
Shinya Kitaoka 120a6e
  TPaletteHandle *ph = controller->getCurrentPalette();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TColorStyle *cs = ph->getStyle();
Shinya Kitaoka 120a6e
  if (!cs) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (controller->isColorAutoApplyEnabled()) {
Shinya Kitaoka 120a6e
    TCleanupStyle *ccs = dynamic_cast<tcleanupstyle *="">(cs);</tcleanupstyle>
Shinya Kitaoka 120a6e
    if (ccs) ccs->setCanUpdate(true);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    int index = ph->getStyleParamIndex();
Shinya Kitaoka 120a6e
    if (0 <= index && index < cs->getColorParamCount())
Shinya Kitaoka 120a6e
      cs->setColorParamValue(index, color);
Shinya Kitaoka 120a6e
    else
Shinya Kitaoka 120a6e
      cs->setMainColor(color);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    cs->invalidateIcon();
Shinya Kitaoka 120a6e
    ph->notifyColorStyleChanged();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    // per le palette animate
Shinya Kitaoka 120a6e
    int styleIndex    = ph->getStyleIndex();
Shinya Kitaoka 120a6e
    TPalette *palette = ph->getPalette();
Shinya Kitaoka 120a6e
    if (palette && palette->isKeyframe(styleIndex, palette->getFrame()))
Shinya Kitaoka 120a6e
      palette->setKeyframe(styleIndex, palette->getFrame());
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
    if (ccs) ccs->setCanUpdate(false);
Shinya Kitaoka 120a6e
  } else
Shinya Kitaoka 120a6e
    controller->setColorSample(color);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//----------------------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void setCurrentColorWithUndo(const TPixel32 &color) {
Shinya Kitaoka 120a6e
  TTool::Application *app = TTool::getApplication();
Shinya Kitaoka 120a6e
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
  int styleId             = ph->getStyleIndex();
Shinya Kitaoka 120a6e
  TPalette *palette       = ph->getPalette();
Shinya Kitaoka 120a6e
  TXshSimpleLevel *level  = app->getCurrentLevel()->getSimpleLevel();
Shinya Kitaoka 120a6e
  if (palette)
Shinya Kitaoka 120a6e
    TUndoManager::manager()->add(
Shinya Kitaoka 120a6e
        new UndoPickRGBM(palette, styleId, color, level));
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  setCurrentColor(color);
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (level) {
Shinya Kitaoka 120a6e
    std::vector<tframeid> fids;</tframeid>
Shinya Kitaoka 120a6e
    level->getFids(fids);
Shinya Kitaoka 120a6e
    invalidateIcons(level, fids);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
}  // namespace RGBPicker
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
using namespace RGBPicker;
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//----------------------------------------------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
RGBPickerTool::RGBPickerTool()
Shinya Kitaoka 120a6e
    : TTool("T_RGBPicker")
Shinya Kitaoka 120a6e
    , m_currentStyleId(0)
Shinya Kitaoka 120a6e
    , m_pickType("Type:")
Shinya Kitaoka 120a6e
    , m_drawingTrack()
Shinya Kitaoka 120a6e
    , m_workingTrack()
Shinya Kitaoka 120a6e
    , m_firstDrawingPos()
Shinya Kitaoka 120a6e
    , m_firstWorkingPos()
Shinya Kitaoka 120a6e
    , m_mousePosition()
Shinya Kitaoka 120a6e
    , m_thick(0.5)
Shinya Kitaoka 120a6e
    , m_stroke(0)
Shinya Kitaoka 120a6e
    , m_firstStroke(0)
Shinya Kitaoka 120a6e
    , m_makePick(false)
Shinya Kitaoka 120a6e
    , m_firstTime(true)
Shinya Kitaoka 120a6e
    , m_passivePick("Passive Pick", false)
shun_iwasawa ca7879
    , m_toolOptionsBox(0)
Shinya Kitaoka d1f6c4
    , m_mousePixelPosition() {
Shinya Kitaoka 120a6e
  bind(TTool::CommonLevels);
Shinya Kitaoka 120a6e
  m_prop.bind(m_pickType);
Shinya Kitaoka 120a6e
  m_pickType.addValue(NORMAL_PICK);
Shinya Kitaoka 120a6e
  m_pickType.addValue(RECT_PICK);
Shinya Kitaoka 120a6e
  m_pickType.addValue(FREEHAND_PICK);
Shinya Kitaoka 120a6e
  m_pickType.addValue(POLYLINE_PICK);
Shinya Kitaoka 120a6e
  m_pickType.setId("Type");
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  m_prop.bind(m_passivePick);
Shinya Kitaoka 120a6e
  m_passivePick.setId("PassivePick");
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::setToolOptionsBox(RGBPickerToolOptionsBox *toolOptionsBox) {
Shinya Kitaoka 120a6e
  m_toolOptionsBox.push_back(toolOptionsBox);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::updateTranslation() {
Shinya Kitaoka 120a6e
  m_pickType.setQStringName(tr("Type:"));
shun-iwasawa df7bb0
  m_pickType.setItemUIName(NORMAL_PICK, tr("Normal"));
shun-iwasawa df7bb0
  m_pickType.setItemUIName(RECT_PICK, tr("Rectangular"));
shun-iwasawa df7bb0
  m_pickType.setItemUIName(FREEHAND_PICK, tr("Freehand"));
shun-iwasawa df7bb0
  m_pickType.setItemUIName(POLYLINE_PICK, tr("Polyline"));
shun-iwasawa df7bb0
Shinya Kitaoka 120a6e
  m_passivePick.setQStringName(tr("Passive Pick"));
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
// 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
Toshihiro Shimizu 890ddd
// and the genaration of the icon inside the style editor (makeIcon()) which use
Toshihiro Shimizu 890ddd
// another glContext
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::onImageChanged() {
Shinya Kitaoka 120a6e
  if (m_currentStyleId != 0 && m_makePick &&
Shinya Kitaoka 120a6e
      (m_pickType.getValue() == POLYLINE_PICK ||
Shinya Kitaoka 120a6e
       m_pickType.getValue() == RECT_PICK)) {
Shinya Kitaoka 120a6e
    TTool::Application *app = TTool::getApplication();
Shinya Kitaoka 120a6e
    TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
    int styleId             = ph->getStyleIndex();
Shinya Kitaoka 120a6e
    TPalette *palette       = ph->getPalette();
Shinya Kitaoka 120a6e
    TXshSimpleLevel *level  = app->getCurrentLevel()->getSimpleLevel();
Shinya Kitaoka 120a6e
    if (palette)
Shinya Kitaoka 120a6e
      TUndoManager::manager()->add(
Shinya Kitaoka 120a6e
          new UndoPickRGBM(palette, styleId, m_currentValue, level));
Shinya Kitaoka 120a6e
    setCurrentColor(m_currentValue);
Shinya Kitaoka 120a6e
    if (level) {
Shinya Kitaoka 120a6e
      std::vector<tframeid> fids;</tframeid>
Shinya Kitaoka 120a6e
      level->getFids(fids);
Shinya Kitaoka 120a6e
      invalidateIcons(level, fids);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  m_makePick = false;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::draw() {
Shinya Kitaoka 120a6e
  double pixelSize2 = getPixelSize() * getPixelSize();
Shinya Kitaoka 120a6e
  m_thick           = sqrt(pixelSize2) / 2.0;
Shinya Kitaoka 120a6e
  if (m_makePick) {
Shinya Kitaoka 120a6e
    if (m_currentStyleId != 0) {
Shinya Kitaoka 120a6e
      // Il pick in modalita' polyline e rectangular deve essere fatto soltanto
Shinya Kitaoka 120a6e
      // dopo aver cancellato il
Shinya Kitaoka 120a6e
      //"disegno" della polyline altrimenti alcuni pixels neri delle spezzate
Shinya Kitaoka 38fd86
      // che la
Shinya Kitaoka 120a6e
      // compongono vengono presi in considerazione nel calcolo del "colore
Shinya Kitaoka 120a6e
      // medio"
Shinya Kitaoka 120a6e
      if (m_pickType.getValue() == POLYLINE_PICK && m_drawingPolyline.empty())
shun_iwasawa ca7879
        doPolylineFreehandPick();
Shinya Kitaoka 120a6e
      else if (m_pickType.getValue() == RECT_PICK && m_drawingRect.isEmpty())
Shinya Kitaoka 120a6e
        pickRect();
shun_iwasawa ca7879
      else if (m_pickType.getValue() == NORMAL_PICK)
shun_iwasawa ca7879
        pick();
shun_iwasawa ca7879
      else if (m_pickType.getValue() == FREEHAND_PICK && m_stroke)
shun_iwasawa ca7879
        doPolylineFreehandPick();
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  }
shun_iwasawa ca7879
  if (m_passivePick.getValue() == true) {
shun_iwasawa ca7879
    passivePick();
shun_iwasawa ca7879
  }
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == RECT_PICK && !m_makePick) {
Shinya Kitaoka 120a6e
    TPixel color = ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg
Shinya Kitaoka 120a6e
                       ? TPixel32::White
Shinya Kitaoka 120a6e
                       : TPixel32::Red;
Shinya Kitaoka 120a6e
    ToolUtils::drawRect(m_drawingRect, color, 0x3F33, true);
Shinya Kitaoka d1f6c4
  } else if (m_pickType.getValue() == POLYLINE_PICK &&
Shinya Kitaoka d1f6c4
             !m_drawingPolyline.empty()) {
Shinya Kitaoka 120a6e
    TPixel color = ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg
Shinya Kitaoka 120a6e
                       ? TPixel32::White
Shinya Kitaoka 120a6e
                       : TPixel32::Black;
Shinya Kitaoka 120a6e
    tglColor(color);
Shinya Kitaoka 120a6e
    tglDrawCircle(m_drawingPolyline[0], 2);
Shinya Kitaoka 120a6e
    glBegin(GL_LINE_STRIP);
Shinya Kitaoka 120a6e
    for (UINT i = 0; i < m_drawingPolyline.size(); i++)
Shinya Kitaoka 120a6e
      tglVertex(m_drawingPolyline[i]);
Shinya Kitaoka 120a6e
    tglVertex(m_mousePosition);
Shinya Kitaoka 120a6e
    glEnd();
Shinya Kitaoka d1f6c4
  } else if (m_pickType.getValue() == FREEHAND_PICK &&
Shinya Kitaoka d1f6c4
             !m_drawingTrack.isEmpty()) {
shun_iwasawa ca7879
    TPixel color = ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg
Shinya Kitaoka d1f6c4
                       ? TPixel32::White
Shinya Kitaoka d1f6c4
                       : TPixel32::Black;
shun_iwasawa ca7879
    tglColor(color);
shun_iwasawa ca7879
    m_drawingTrack.drawAllFragments();
shun_iwasawa ca7879
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {
Shinya Kitaoka 120a6e
  TTool::Application *app   = TTool::getApplication();
Shinya Kitaoka 120a6e
  TPaletteHandle *pltHandle = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
  m_currentStyleId          = pltHandle->getStyleIndex();
Shinya Kitaoka 120a6e
  if (m_currentStyleId == 0) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TColorStyle *colorStyle = pltHandle->getStyle();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (colorStyle) m_oldValue = colorStyle->getMainColor();
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == RECT_PICK) {
Shinya Kitaoka 120a6e
    m_selectingRect.x0 = e.m_pos.x;
Shinya Kitaoka 120a6e
    m_selectingRect.y0 = e.m_pos.y;
Shinya Kitaoka 120a6e
    m_selectingRect.x1 = e.m_pos.x;
Shinya Kitaoka 120a6e
    m_selectingRect.y1 = e.m_pos.y;
Shinya Kitaoka 120a6e
    m_drawingRect.x0   = pos.x;
Shinya Kitaoka 120a6e
    m_drawingRect.y0   = pos.y;
Shinya Kitaoka 120a6e
    m_drawingRect.x1   = pos.x;
Shinya Kitaoka 120a6e
    m_drawingRect.y1   = pos.y;
Shinya Kitaoka 120a6e
    invalidate();
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  } else if (m_pickType.getValue() == FREEHAND_PICK) {
shun_iwasawa bc352c
    startFreehand(pos, e.m_pos);
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka 120a6e
  } else if (m_pickType.getValue() == POLYLINE_PICK) {
shun_iwasawa bc352c
    addPointPolyline(pos, e.m_pos);
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka d1f6c4
  } else {  // NORMAL_PICK
shun_iwasawa ca7879
    m_mousePixelPosition = e.m_pos;
Shinya Kitaoka d1f6c4
    m_makePick           = true;
shun_iwasawa ca7879
    invalidate();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::leftButtonDrag(const TPointD &pos, const TMouseEvent &e) {
Shinya Kitaoka 120a6e
  if (m_currentStyleId == 0) return;
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == RECT_PICK) {
Shinya Kitaoka 120a6e
    m_selectingRect.x1 = e.m_pos.x;
Shinya Kitaoka 120a6e
    m_selectingRect.y1 = e.m_pos.y;
Shinya Kitaoka 120a6e
    m_drawingRect.x1   = pos.x;
Shinya Kitaoka 120a6e
    m_drawingRect.y1   = pos.y;
Shinya Kitaoka 120a6e
    invalidate();
Shinya Kitaoka 120a6e
    return;
Shinya Kitaoka d1f6c4
  } else if (m_pickType.getValue() == FREEHAND_PICK) {
shun_iwasawa bc352c
    freehandDrag(pos, e.m_pos);
shun_iwasawa ca7879
    invalidate();
shun_iwasawa ca7879
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::leftButtonUp(const TPointD &pos, const TMouseEvent &) {
Shinya Kitaoka 120a6e
  if (m_currentStyleId == 0) return;
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == RECT_PICK) {
Shinya Kitaoka 120a6e
    m_makePick = true;
Shinya Kitaoka 120a6e
    m_drawingRect.empty();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == FREEHAND_PICK) {
Shinya Kitaoka 120a6e
    closeFreehand();
Shinya Kitaoka d1f6c4
    if (m_currentStyleId != 0) m_makePick = true;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  invalidate();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::leftButtonDoubleClick(const TPointD &pos,
Shinya Kitaoka 120a6e
                                          const TMouseEvent &e) {
Shinya Kitaoka 120a6e
  if (m_currentStyleId == 0) return;
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == POLYLINE_PICK) {
shun_iwasawa bc352c
    closePolyline(pos, e.m_pos);
Shinya Kitaoka 120a6e
    std::vector<tthickpoint> strokePoints;</tthickpoint>
Shinya Kitaoka 120a6e
    for (UINT i = 0; i < m_workingPolyline.size() - 1; i++) {
Shinya Kitaoka 120a6e
      strokePoints.push_back(TThickPoint(m_workingPolyline[i], 1));
Shinya Kitaoka 120a6e
      strokePoints.push_back(TThickPoint(
Shinya Kitaoka 120a6e
          0.5 * (m_workingPolyline[i] + m_workingPolyline[i + 1]), 1));
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
    strokePoints.push_back(TThickPoint(m_workingPolyline.back(), 1));
Shinya Kitaoka 120a6e
    m_drawingPolyline.clear();
Shinya Kitaoka 120a6e
    m_workingPolyline.clear();
Shinya Kitaoka 120a6e
    m_stroke   = new TStroke(strokePoints);
Shinya Kitaoka 120a6e
    m_makePick = true;
Shinya Kitaoka 120a6e
    invalidate();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::mouseMove(const TPointD &pos, const TMouseEvent &e) {
shun_iwasawa ca7879
  /*--- Pick color passively and display in the tool option bar ---*/
Shinya Kitaoka 120a6e
  if (m_passivePick.getValue() == true) {
shun_iwasawa ca7879
    m_mousePixelPosition = e.m_pos;
shun_iwasawa ca7879
    invalidate();
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (m_pickType.getValue() == POLYLINE_PICK && !m_drawingPolyline.empty()) {
Shinya Kitaoka 120a6e
    m_mousePosition = pos;
Shinya Kitaoka 120a6e
    invalidate();
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka d1f6c4
void RGBPickerTool::passivePick() {
shun_iwasawa ca7879
  TImageP image = TImageP(getImage(false));
shun_iwasawa ca7879
  if (!image) return;
Shinya Kitaoka d1f6c4
  TRectD area = TRectD(m_mousePixelPosition.x, m_mousePixelPosition.y,
Shinya Kitaoka d1f6c4
                       m_mousePixelPosition.x, m_mousePixelPosition.y);
shun_iwasawa ca7879
shun_iwasawa ca7879
  StylePicker picker(image);
shun_iwasawa ca7879
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->bindFBO();
shun-iwasawa ad7711
shun_iwasawa ca7879
  TPixel32 pix = picker.pickColor(area);
shun_iwasawa ca7879
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->releaseFBO();
shun-iwasawa ad7711
shun_iwasawa ca7879
  QColor col((int)pix.r, (int)pix.g, (int)pix.b);
shun_iwasawa ca7879
shun_iwasawa ca7879
  PaletteController *controller =
Shinya Kitaoka d1f6c4
      TTool::getApplication()->getPaletteController();
shun_iwasawa ca7879
  controller->notifyColorPassivePicked(col);
shun_iwasawa ca7879
}
shun_iwasawa ca7879
shun_iwasawa ca7879
//---------------------------------------------------------
shun_iwasawa ca7879
shun_iwasawa ca7879
void RGBPickerTool::pick() {
Shinya Kitaoka 120a6e
  TImageP image = TImageP(getImage(false));
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TTool::Application *app = TTool::getApplication();
Shinya Kitaoka 120a6e
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
  int styleId             = ph->getStyleIndex();
Shinya Kitaoka 120a6e
  TPalette *palette       = ph->getPalette();
Shinya Kitaoka 120a6e
  if (!palette) return;
Shinya Kitaoka 120a6e
Shinya Kitaoka d1f6c4
  TRectD area = TRectD(m_mousePixelPosition.x - 1, m_mousePixelPosition.y - 1,
Shinya Kitaoka d1f6c4
                       m_mousePixelPosition.x + 1, m_mousePixelPosition.y + 1);
Shinya Kitaoka 120a6e
  StylePicker picker(image, palette);
Shinya Kitaoka 120a6e
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->bindFBO();
shun-iwasawa ad7711
Shinya Kitaoka 120a6e
  m_currentValue = picker.pickColor(area);
Shinya Kitaoka 120a6e
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->releaseFBO();
shun-iwasawa ad7711
Shinya Kitaoka 120a6e
  TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
Shinya Kitaoka 120a6e
  UndoPickRGBM *cmd = new UndoPickRGBM(palette, styleId, m_currentValue, level);
Shinya Kitaoka 120a6e
  TUndoManager::manager()->add(cmd);
Shinya Kitaoka 120a6e
  cmd->redo();
shun_iwasawa ca7879
shun_iwasawa ca7879
  m_makePick = false;
Shinya Kitaoka 120a6e
  /*
Shinya Kitaoka 120a6e
setCurrentColor(m_currentValue);
Shinya Kitaoka 120a6e
if(level)
Toshihiro Shimizu 890ddd
{
Shinya Kitaoka 120a6e
vector<tframeid> fids;</tframeid>
Shinya Kitaoka 120a6e
level->getFids(fids);
Shinya Kitaoka 120a6e
invalidateIcons(level,fids);
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
*/
Shinya Kitaoka 120a6e
}
Shinya Kitaoka 120a6e
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::pickRect() {
Shinya Kitaoka 120a6e
  TImageP image = TImageP(getImage(false));
Shinya Kitaoka 120a6e
Shinya Kitaoka 120a6e
  TTool::Application *app = TTool::getApplication();
Shinya Kitaoka 120a6e
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
  int styleId             = ph->getStyleIndex();
Shinya Kitaoka 120a6e
  TPalette *palette       = ph->getPalette();
Shinya Kitaoka 120a6e
  TRectD area             = m_selectingRect;
Shinya Kitaoka 120a6e
  if (!palette) return;
Shinya Kitaoka 120a6e
  if (m_selectingRect.x0 > m_selectingRect.x1) {
Shinya Kitaoka 120a6e
    area.x1 = m_selectingRect.x0;
Shinya Kitaoka 120a6e
    area.x0 = m_selectingRect.x1;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  if (m_selectingRect.y0 > m_selectingRect.y1) {
Shinya Kitaoka 120a6e
    area.y1 = m_selectingRect.y0;
Shinya Kitaoka 120a6e
    area.y0 = m_selectingRect.y1;
Shinya Kitaoka 120a6e
  }
Shinya Kitaoka 120a6e
  m_selectingRect.empty();
Shinya Kitaoka 120a6e
  if (area.getLx() <= 1 || area.getLy() <= 1) return;
Shinya Kitaoka 120a6e
  StylePicker picker(image, palette);
Shinya Kitaoka 120a6e
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->bindFBO();
shun-iwasawa ad7711
Shinya Kitaoka d1f6c4
  m_currentValue = picker.pickColor(area);
shun-iwasawa ad7711
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->releaseFBO();
Shinya Kitaoka 120a6e
}
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::pickStroke() {
Shinya Kitaoka 120a6e
  TImageP image = TImageP(getImage(false));
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  TTool::Application *app = TTool::getApplication();
Shinya Kitaoka 120a6e
  TPaletteHandle *ph      = app->getPaletteController()->getCurrentPalette();
Shinya Kitaoka 120a6e
  int styleId             = ph->getStyleIndex();
Shinya Kitaoka 120a6e
  TPalette *palette       = ph->getPalette();
Shinya Kitaoka 120a6e
  if (!palette) return;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  StylePicker picker(image, palette);
Shinya Kitaoka 120a6e
  TStroke *stroke = new TStroke(*m_stroke);
Shinya Kitaoka d1f6c4
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->bindFBO();
shun-iwasawa ad7711
Shinya Kitaoka 120a6e
  m_currentValue = picker.pickColor(stroke);
Shinya Kitaoka d1f6c4
shun-iwasawa 388550
  if (LutManager::instance()->isValid()) m_viewer->releaseFBO();
shun-iwasawa ad7711
Shinya Kitaoka 120a6e
  if (!(m_pickType.getValue() == POLYLINE_PICK)) {
Shinya Kitaoka 120a6e
    TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
Shinya Kitaoka 120a6e
    TUndoManager::manager()->add(
Shinya Kitaoka 120a6e
        new UndoPickRGBM(palette, styleId, m_currentValue, level));
Shinya Kitaoka 120a6e
    setCurrentColor(m_currentValue);
Shinya Kitaoka 120a6e
    if (level) {
Shinya Kitaoka 120a6e
      std::vector<tframeid> fids;</tframeid>
Shinya Kitaoka 120a6e
      level->getFids(fids);
Shinya Kitaoka 120a6e
      invalidateIcons(level, fids);
Shinya Kitaoka 120a6e
    }
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
bool RGBPickerTool::onPropertyChanged(std::string propertyName) {
Shinya Kitaoka 120a6e
  if (propertyName == m_pickType.getName())
Shinya Kitaoka 120a6e
    PickVectorType = ::to_string(m_pickType.getValue());
Shinya Kitaoka 120a6e
  else if (propertyName == m_passivePick.getName())
Shinya Kitaoka 120a6e
    PickPassive = m_passivePick.getValue();
Shinya Kitaoka 120a6e
  return true;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
void RGBPickerTool::onActivate() {
Shinya Kitaoka 120a6e
  if (m_firstTime) {
Shinya Kitaoka 120a6e
    m_pickType.setValue(::to_wstring(PickVectorType.getValue()));
Shinya Kitaoka 120a6e
    m_passivePick.setValue(PickPassive ? 1 : 0);
Shinya Kitaoka 120a6e
    m_firstTime = false;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
TPropertyGroup *RGBPickerTool::getProperties(int targetType) { return &m_prop; }
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
int RGBPickerTool::getCursorId() const {
Shinya Kitaoka 120a6e
  int currentStyleId = getApplication()
Shinya Kitaoka 120a6e
                           ->getPaletteController()
Shinya Kitaoka 120a6e
                           ->getCurrentPalette()
Shinya Kitaoka 120a6e
                           ->getStyleIndex();
Shinya Kitaoka 120a6e
  if (currentStyleId == 0) return ToolCursor::ForbiddenCursor;
Shinya Kitaoka 120a6e
  if (ToonzCheck::instance()->getChecks() & ToonzCheck::eBlackBg)
Shinya Kitaoka 120a6e
    return ToolCursor::PickerRGBWhite;
Shinya Kitaoka 120a6e
  else
Shinya Kitaoka 120a6e
    return ToolCursor::PickerRGB;
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
shun_iwasawa ca7879
void RGBPickerTool::doPolylineFreehandPick() {
Shinya Kitaoka d1f6c4
  if (m_stroke && (m_pickType.getValue() == POLYLINE_PICK ||
Shinya Kitaoka d1f6c4
                   m_pickType.getValue() == FREEHAND_PICK)) {
Shinya Kitaoka 120a6e
    pickStroke();
Shinya Kitaoka 120a6e
    delete m_stroke;
Shinya Kitaoka 120a6e
    m_stroke = 0;
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Viene aggiunto \b pos a \b m_track e disegnato il primo pezzetto del lazzo.
Shinya Kitaoka 120a6e
//! Viene inizializzato \b m_firstPos
Shinya Kitaoka 120a6e
void RGBPickerTool::startFreehand(const TPointD &drawingPos,
Shinya Kitaoka 120a6e
                                  const TPointD &workingPos) {
Shinya Kitaoka 120a6e
  m_drawingTrack.clear();
Shinya Kitaoka 120a6e
  m_workingTrack.clear();
Shinya Kitaoka 120a6e
  m_firstDrawingPos = drawingPos;
Shinya Kitaoka 120a6e
  m_firstWorkingPos = workingPos;
Shinya Kitaoka 120a6e
  double pixelSize2 = getPixelSize() * getPixelSize();
Shinya Kitaoka 120a6e
  m_drawingTrack.add(TThickPoint(drawingPos, m_thick), pixelSize2);
Shinya Kitaoka 120a6e
  m_workingTrack.add(TThickPoint(workingPos, m_thick), pixelSize2);
Toshihiro Shimizu 890ddd
#if defined(MACOSX)
Shinya Kitaoka 120a6e
// m_viewer->prepareForegroundDrawing();
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Viene aggiunto \b pos a \b m_track e disegnato un altro pezzetto del lazzo.
Shinya Kitaoka 120a6e
void RGBPickerTool::freehandDrag(const TPointD &drawingPos,
Shinya Kitaoka 120a6e
                                 const TPointD &workingPos) {
Toshihiro Shimizu 890ddd
#if defined(MACOSX)
Shinya Kitaoka 120a6e
// getViewer()->enableRedraw(false);
Toshihiro Shimizu 890ddd
#endif
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
  double pixelSize2 = getPixelSize() * getPixelSize();
Shinya Kitaoka 120a6e
  m_drawingTrack.add(TThickPoint(drawingPos, m_thick), pixelSize2);
shun_iwasawa ca7879
  m_workingTrack.add(TThickPoint(workingPos, m_thick), pixelSize2);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Viene chiuso il lazzo (si aggiunge l'ultimo punto ad m_track) e viene creato
Shinya Kitaoka 120a6e
//! lo stroke rappresentante il lazzo.
Shinya Kitaoka 120a6e
void RGBPickerTool::closeFreehand() {
Toshihiro Shimizu 890ddd
#if defined(MACOSX)
Shinya Kitaoka 120a6e
// getViewer()->enableRedraw(true);
Toshihiro Shimizu 890ddd
#endif
Shinya Kitaoka 120a6e
  if (m_drawingTrack.isEmpty() || m_workingTrack.isEmpty()) return;
Shinya Kitaoka 120a6e
  double pixelSize2 = getPixelSize() * getPixelSize();
Shinya Kitaoka 120a6e
  m_drawingTrack.add(TThickPoint(m_firstDrawingPos, m_thick), pixelSize2);
Shinya Kitaoka 120a6e
  m_workingTrack.add(TThickPoint(m_firstWorkingPos, m_thick), pixelSize2);
Shinya Kitaoka 120a6e
  m_workingTrack.filterPoints();
Shinya Kitaoka 120a6e
  double error = (30.0 / 11) * sqrt(pixelSize2);
Shinya Kitaoka 120a6e
  m_stroke     = m_workingTrack.makeStroke(error);
Shinya Kitaoka 120a6e
  m_stroke->setStyle(1);
shun_iwasawa ca7879
shun_iwasawa ca7879
  m_drawingTrack.clear();
shun_iwasawa ca7879
  m_workingTrack.clear();
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
//! Viene aggiunto un punto al vettore m_polyline.
Shinya Kitaoka 120a6e
void RGBPickerTool::addPointPolyline(const TPointD &drawingPos,
Shinya Kitaoka 120a6e
                                     const TPointD &workingPos) {
Shinya Kitaoka 120a6e
  m_mousePosition = drawingPos;
Shinya Kitaoka 120a6e
  /*---drawingPosは中心からの座標 workingPosは画面左下からの座標---*/
Shinya Kitaoka 120a6e
  m_drawingPolyline.push_back(drawingPos);
Shinya Kitaoka 120a6e
  m_workingPolyline.push_back(workingPos);
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
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 RGBPickerTool::closePolyline(const TPointD &drawingPos,
Shinya Kitaoka 120a6e
                                  const TPointD &workingPos) {
Shinya Kitaoka 120a6e
  if (m_drawingPolyline.size() <= 1 || m_workingPolyline.size() <= 1) return;
Shinya Kitaoka 120a6e
  if (m_drawingPolyline.back() != drawingPos)
Shinya Kitaoka 120a6e
    m_drawingPolyline.push_back(drawingPos);
Shinya Kitaoka 120a6e
  if (m_workingPolyline.back() != workingPos)
Shinya Kitaoka 120a6e
    m_workingPolyline.push_back(workingPos);
Shinya Kitaoka 120a6e
  if (m_drawingPolyline.back() != m_drawingPolyline.front())
Shinya Kitaoka 120a6e
    m_drawingPolyline.push_back(m_drawingPolyline.front());
Shinya Kitaoka 120a6e
  if (m_workingPolyline.back() != m_workingPolyline.front())
Shinya Kitaoka 120a6e
    m_workingPolyline.push_back(m_workingPolyline.front());
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
//---------------------------------------------------------
Toshihiro Shimizu 890ddd
/*! Flipbook上でPassive Pickを有効にする
Toshihiro Shimizu 890ddd
*/
Shinya Kitaoka 120a6e
void RGBPickerTool::showFlipPickedColor(const TPixel32 &pix) {
Shinya Kitaoka 120a6e
  if (m_passivePick.getValue()) {
Shinya Kitaoka 120a6e
    QColor col((int)pix.r, (int)pix.g, (int)pix.b);
Shinya Kitaoka 120a6e
    PaletteController *controller =
Shinya Kitaoka 120a6e
        TTool::getApplication()->getPaletteController();
Shinya Kitaoka 120a6e
    controller->notifyColorPassivePicked(col);
Shinya Kitaoka 120a6e
  }
Toshihiro Shimizu 890ddd
}
Toshihiro Shimizu 890ddd
Toshihiro Shimizu 890ddd
RGBPickerTool RGBpicktool;
Toshihiro Shimizu 890ddd
Shinya Kitaoka 120a6e
// TTool *getPickRGBMTool() {return &pickRBGMTool;}