Exemplo n.º 1
0
void ShiftTraceTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {
  m_gadget = m_highlightedGadget;
  m_oldPos = m_startPos = pos;

  if (m_gadget == NoGadget) {
    int row = getViewer()->posToRow(e.m_pos, 5 * getPixelSize(), false);
    if (row >= 0) {
      int currentRow = getFrame();
      int index      = -1;
      if (m_row[0] >= 0 && row <= currentRow)
        index = 0;
      else if (m_row[1] >= 0 && row > currentRow)
        index = 1;
      if (index >= 0) {
        m_ghostIndex = index;
        updateBox();
      }
    }

    if (!e.isCtrlPressed()) {
      m_gadget = TranslateGadget;
      // m_curveStatus = NoCurve;
    }
  }
  invalidate();
}
Exemplo n.º 2
0
void PinchTool::updateInterfaceStatus(const TMouseEvent &event)
{
	assert(getPixelSize() > 0 && "Pixel size is lower than 0!!!");

	m_status.isManual_ = m_autoOrManual.getValue();
	m_status.pixelSize_ = getPixelSize();
	m_status.cornerSize_ = (int)m_toolCornerSize.getValue();
	m_status.lengthOfAction_ = m_toolRange.getValue();
	m_status.deformerSensibility_ = 0.01 * getPixelSize();

	m_status.key_event_ = ContextStatus::NONE;

	// mutual exclusive
	if (event.isCtrlPressed())
		m_status.key_event_ = ContextStatus::CTRL;
	if (event.isShiftPressed())
		m_status.key_event_ = ContextStatus::SHIFT;

	// TODO:  **DEVE** essere fatto dentro la costruzione di TMouseEvent
	// nel codice di Toonz/Tab/ecc. **NON** ci devono essere ifdef MACOSX se e' possibile
	// evitarlo. Qua sotto ci deve essere solo if(event.isShiftPressed)
	/*#ifdef MACOSX
  if(event.isLockPressed() )
#else*/
	if (event.isAltPressed())
		//#endif
		m_status.key_event_ = ContextStatus::ALT;

	m_selector.setStroke(0);
	m_selector.setVisibility(m_status.isManual_ && m_showSelector);
	m_selector.setLength(m_status.lengthOfAction_);
}