Exemple #1
0
int
MarkerSell::create (PluginData *pd)
{
  if (! pd->data)
    return 0;
  
  Marker *sell = (Marker *) pd->data;
  
  pd->status = PlotStatus::_MOVE;
  sell->setSelected(TRUE);
  emit signalMessage(QObject::tr("Place Sell marker"));
  return 1;
}
int
MarkerRetracement::create (PluginData *pd)
{
  if (! pd->data)
    return 0;
  
  Marker *m = (Marker *) pd->data;
  
  pd->status = PlotStatus::_CREATE_MOVE;
  m->setSelected(TRUE);
  emit signalMessage(tr("Select highest starting point..."));
  return 1;
}
int
MarkerTLine::create (PluginData *pd)
{
  if (! pd->data)
    return 0;
  
  Marker *tline = (Marker *) pd->data;
  
  pd->status = PlotStatus::_CREATE_MOVE;
  tline->setSelected(TRUE);
  emit signalMessage(tr("Place TLine marker..."));
  return 1;
}
Exemple #4
0
int
MarkerSell::click (PluginData *pd)
{
  if (! pd->data)
    return 0;
  
  Marker *sell = (Marker *) pd->data;
  
  switch ((PlotStatus::Key) pd->status)
  {
    case PlotStatus::_SELECTED:
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
          if (sell->isGrabSelected(pd->point))
          {
            pd->status = PlotStatus::_MOVE;
            return 1;
          }

          if (! sell->isSelected(pd->point))
          {
            pd->status = PlotStatus::_NONE;
            sell->setSelected(FALSE);

            Plot *tplot = (Plot *) sell->plot();
            tplot->unselectMarker();

            sell->plot()->replot();
            return 1;
          }
          break;
        case Qt::RightButton:
        {
          Plot *p = (Plot *) sell->plot();
          p->showMarkerMenu();
          break;
        }
        default:
          break;
      }

      break;
    }
    case PlotStatus::_MOVE:
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
          pd->status = PlotStatus::_SELECTED;
          return 1;
        default:
          break;
      }

      break;
    }
    default: // _None
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
        {
          if (sell->isSelected(pd->point))
          {
            pd->status = PlotStatus::_SELECTED;
            sell->setSelected(TRUE);

            Plot *tplot = (Plot *) sell->plot();
            tplot->selectMarker(sell->ID());

            sell->plot()->replot();
            return 1;
          }
          break;
        }
        default:
          break;
      }

      break;
    }
  }
  
  return 1;
}
int
MarkerRetracement::click (PluginData *pd)
{
  if (! pd->data)
    return 0;
  
  Marker *m = (Marker *) pd->data;
  
  switch (pd->status)
  {
    case PlotStatus::_SELECTED:
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
        {
          int grab = m->isGrabSelected(pd->point);
          if (grab)
          {
            pd->status = PlotStatus::_MOVE;
            if (grab == 2)
              pd->status = PlotStatus::_MOVE2;
            return 1;
          }

          if (! m->isSelected(pd->point))
          {
            pd->status = PlotStatus::_NONE;
            m->setSelected(FALSE);
            Plot *tplot = (Plot *) m->plot();
            tplot->unselectMarker();
            m->plot()->replot();
            return 1;
          }
          break;
        }
        case Qt::RightButton:
        {
          Plot *p = (Plot *) m->plot();
          p->showMarkerMenu();
          break;
        }
        default:
          break;
      }

      break;
    }
    case PlotStatus::_MOVE:
    case PlotStatus::_CREATE_MOVE:
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
          if (pd->status == PlotStatus::_CREATE_MOVE)
          {
            pd->status = PlotStatus::_MOVE2;
            emit signalMessage(tr("Select lowest ending point..."));
            return 1;
          }

          pd->status = PlotStatus::_SELECTED;
          return 1;
        default:
          break;
      }

      break;
    }
    case PlotStatus::_MOVE2:
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
          pd->status = PlotStatus::_SELECTED;
          return 1;
        default:
          break;
      }

      break;
    }
    default: // _None
    {
      switch (pd->button)
      {
        case Qt::LeftButton:
        {
          if (m->isSelected(pd->point))
          {
            pd->status = PlotStatus::_SELECTED;
            m->setSelected(TRUE);

            Plot *tplot = (Plot *) m->plot();
            
            tplot->selectMarker(m->ID());

            m->plot()->replot();
            return 1;
          }
          break;
        }
        default:
          break;
      }
      break;
    }
  }
  
  return 1;
}