void MultiplesTangentes::draw()
{
    if(Dessinable())
    {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, Alpha() * 255);
        ofSetLineWidth(lineWidth());
        float distance(Tools::getDistance(*Origine(), *Destination()));
        float angle(Tools::getAngle(*Origine(), *Destination()));
        ofVec2f milieu(Origine()->getMiddle(*Destination()));
        tangente()->Origine(&milieu);
        tangente()->rayon(distance / 2.);
        tangente()->Dessinable(Dessinable());
        tangente()->Alpha(Alpha());
        tangente()->lineWidth(lineWidth());

        for(int i = 0; i < nombreDeTangentesMax(); i += _step)
        {
            tangente()->angle(angle * (1 + i / (float)nombreDeTangentesMax() * M_PI));
            tangente()->draw();
        }

        ofDisableAlphaBlending();
        ofPopStyle();
    }
}
Ejemplo n.º 2
0
/*!
  Draw the border of the canvas
  \param painter Painter
*/
void QwtPlotGLCanvas::drawBorder( QPainter *painter )
{
    const int fw = frameWidth();
    if ( fw <= 0 )
        return;

    if ( frameShadow() == QwtPlotGLCanvas::Plain )
    {
        qDrawPlainRect( painter, frameRect(), 
            palette().shadow().color(), lineWidth() );
    }
    else
    {
        if ( frameShape() == QwtPlotGLCanvas::Box )
        {
            qDrawShadeRect( painter, frameRect(), palette(),
                frameShadow() == Sunken, lineWidth(), midLineWidth() );
        }
        else
        {
            qDrawShadePanel( painter, frameRect(), palette(), 
                frameShadow() == Sunken, lineWidth() );
        }
    }
}
Ejemplo n.º 3
0
void BoardView::setCellsSize()
{
	if (!model_)
		return;
	int row_cnt = model()->rowCount() - 2;
	int col_cnt = model()->columnCount() - 2;
	int board_width = width() - verticalHeader()->width() - (lineWidth() + midLineWidth()) * 2;
	int board_height = height() - horizontalHeader()->height() - (lineWidth() + midLineWidth()) * 2;
	board_width -= 4; board_height -= 4; // Запас для гарантии отсутствия прокрутки
	int cell_width = board_width / (row_cnt) - 1;
	int cell_heigt = board_height / (col_cnt) - 1;
	int cell_size = qMin(cell_width, cell_heigt);
	int h_margin = board_width - cell_size * col_cnt;
	if (h_margin < 0)
		h_margin = 0;
	h_margin /= 2;
	int v_margin = board_height - cell_size * row_cnt;
	if (v_margin < 0)
		v_margin = 0;
	v_margin /= 2;
	horizontalHeader()->setDefaultSectionSize(cell_size);
	verticalHeader()->setDefaultSectionSize(cell_size);
	horizontalHeader()->resizeSection(0, h_margin);
	horizontalHeader()->resizeSection(col_cnt + 1, h_margin);
	verticalHeader()->resizeSection(0, v_margin);
	verticalHeader()->resizeSection(row_cnt + 1, v_margin);
}
Ejemplo n.º 4
0
int KexiDBImageBox::realLineWidth() const
{
    switch (frameShape()) {
    case QFrame::NoFrame:
        // shadow, line, midline unused
        return 0;
    case QFrame::Box:
        switch (frameShadow()) {
        case QFrame::Plain:
            // midline unused
            return lineWidth();
        default: // sunken, raised:
            return 2 * lineWidth() + midLineWidth();
        }
        break;
    case QFrame::Panel:
        // shadow, midline unused
        return lineWidth();
    case QFrame::WinPanel:
        // shadow, line, midline unused
        return 2;
    case QFrame::StyledPanel: {
        // shadow, line, midline unused
        QStyleOptionFrameV3 option;
        option.initFrom(this);
        return style()->pixelMetric(QStyle::PM_DefaultFrameWidth, &option, this);
    }
    default:
        return lineWidth();
    }
}
Ejemplo n.º 5
0
tikz::Value Style::penWidth() const
{
    if (!doubleLine()) {
        return lineWidth();
    } else {
        const Value width = lineWidth();
        const Value innerWidth = innerLineWidth();
        return 2.0 * width + innerWidth;
    }
}
Ejemplo n.º 6
0
//! @todo add more frame types
void ClassName::drawFrame(QPainter *p)
{
    if (frameShape() == QFrame::Box) {
        if (frameShadow() == Plain)
            qDrawPlainRect(p, frameRect(), d->frameColor, lineWidth());
        else
            qDrawShadeRect(p, frameRect(), palette(), frameShadow() == QFrame::Sunken,
                           lineWidth(), midLineWidth());
    } else {
        SuperClassName::drawFrame(p);
    }
}
Ejemplo n.º 7
0
/*!
  Draw the frame around the dial

  \param painter Painter
  \sa lineWidth(), frameShadow()
*/
void QwtDial::drawFrame( QPainter *painter )
{
    if ( lineWidth() <= 0 )
        return;

    const double lw2 = 0.5 * lineWidth();

    QRectF r = boundingRect();
    r.adjust( lw2, lw2, -lw2, -lw2 );

    QPen pen;

    switch ( d_data->frameShadow )
    {
        case QwtDial::Raised:
        case QwtDial::Sunken:
        {
            QColor c1 = palette().color( QPalette::Light );
            QColor c2 = palette().color( QPalette::Dark );

            if ( d_data->frameShadow == QwtDial::Sunken )
                qSwap( c1, c2 );

            QLinearGradient gradient( r.topLeft(), r.bottomRight() );
            gradient.setColorAt( 0.0, c1 );
#if 0
            gradient.setColorAt( 0.3, c1 );
            gradient.setColorAt( 0.7, c2 );
#endif
            gradient.setColorAt( 1.0, c2 );

            pen = QPen( gradient, lineWidth() );
            break;
        }
        default: // Plain
        {
            pen = QPen( palette().brush( QPalette::Dark ), lineWidth() );
        }
    }

    painter->save();

    painter->setPen( pen );
    painter->setBrush( Qt::NoBrush );
    painter->drawEllipse( r );

    painter->restore();
}
Ejemplo n.º 8
0
/*!
  Draw the frame around the dial

  \param painter Painter
  \sa QwtDial::lineWidth, QwtDial::frameShadow
*/
void QwtDial::drawFrame(QPainter *painter)
{
    const int lw = lineWidth();
    const int off = (lw + 1) % 2;

    QRect r = boundingRect();
    r.setRect(r.x() + lw / 2 - off, r.y() + lw / 2 - off,
        r.width() - lw + off + 1, r.height() - lw + off + 1);

    if ( lw > 0 )
    {
        switch(d_frameShadow)
        {
            case QwtDial::Raised:
                QwtPainter::drawRoundFrame(painter, r, 
                    lw, colorGroup(), FALSE);
                break;
            case QwtDial::Sunken:
                QwtPainter::drawRoundFrame(painter, r, 
                    lw, colorGroup(), TRUE);
                break;
            default: // Plain
            {
                painter->save();
                painter->setPen(QPen(Qt::black, lw));
                painter->setBrush(Qt::NoBrush);
                painter->drawEllipse(r);
                painter->restore();
            }
        }
    }
}
Ejemplo n.º 9
0
/**
 * Reimplemented form UMLWidget::paint to draw
 * ClassifierWidget.
 */
void ClassifierWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem*, QWidget *)
{
    QPen pen(lineColor(), lineWidth());

    if (shouldDrawAsCircle()) {
        painter->setPen(pen);
        painter->setBrush(brush());
        // m_classifierRect represents circle geometry when shouldDrawAsCircle is true.
        painter->drawEllipse(m_classifierRect);
    }
    else {
        // The elements not to be drawn will have null dimension and
        // hence it effectively is not drawn. (automatic ;) )
        painter->setPen(pen);
        painter->setBrush(brush());
        painter->drawRoundedRect(m_classifierRect, 2, 2);
        painter->drawLines(m_classifierLines, 2);

        painter->setPen(QPen(Qt::NoPen));
        painter->setBrush(awesomeHeaderBrush());
        Uml::Corners corners(Uml::corner_TopLeft | Uml::corner_TopRight);
        Widget_Utils::drawRoundedRect(painter, textItemGroupAt(HeaderGroupIndex)->groupGeometry(),
                                      2, 2, corners);

        pen.setStyle(Qt::DotLine);
        painter->setPen(pen);
        painter->setBrush(brush());
        painter->drawRect(m_templateRect);
    }
}
Ejemplo n.º 10
0
void
CGnuPlotVectorsStyleValue::
print(CGnuPlot *plot, std::ostream &os) const
{
  os << headStr();
  os << " " << filledStr();
  if (! border_) os << " noborder";
  os << " " << frontStr();

  if (lineStyle_.isValid())
    os <<" lt " << lineStyle_;
  else
    os <<" lt black";

  os << " linewidth " << lineWidth(plot);

  os << " dashtype " << dash_;

  if (length_.value() > 0.0 || angle_ >= 0.0 || backAngle_ >= 0.0) {
    os << " arrow head" << (fhead_ && thead_ ? "s" : "") << ": " << filledStr();
    os << ", length "; length_.print(os);
    os << ", angle " << (angle_ > 0 ? angle_ : 0.0);

    if (backAngle_ >= 0)
      os << ", backangle " << backAngle_;

    if (fixed_)
      os << " fixed";
  }
}
// virtual protected slot [base kpToolWidgetBase]
bool kpToolWidgetLineWidth::setSelected (int row, int col, bool saveAsDefault)
{
    const bool ret = kpToolWidgetBase::setSelected (row, col, saveAsDefault);
    if (ret)
        emit lineWidthChanged (lineWidth ());
    return ret;
}
Ejemplo n.º 12
0
// ****************************************************************************
void MolDraw2DSVG::drawPolygon(const std::vector<Point2D> &cds) {
  PRECONDITION(cds.size() >= 3, "must have at least three points");

  std::string col = DrawColourToSVG(colour());
  unsigned int width = lineWidth();
  std::string dashString = "";
  d_os << "<path ";
  if (d_activeClass != "") {
    d_os << "class='" << d_activeClass << "' ";
  }
  d_os << "d='M";
  Point2D c0 = getDrawCoords(cds[0]);
  d_os << " " << c0.x << "," << c0.y;
  for (unsigned int i = 1; i < cds.size(); ++i) {
    Point2D ci = getDrawCoords(cds[i]);
    d_os << " " << ci.x << "," << ci.y;
  }
  d_os << " " << c0.x << "," << c0.y;
  d_os << "' style='";
  if (fillPolys())
    d_os << "fill:" << col << ";fill-rule:evenodd;";
  else
    d_os << "fill:none;";

  d_os << "stroke:" << col << ";stroke-width:" << width
       << "px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       << dashString << "'";
  d_os << " />\n";
}
Ejemplo n.º 13
0
QVariant Ambitus::getProperty(Pid propertyId) const
      {
      switch(propertyId) {
            case Pid::HEAD_GROUP:
                  return int(noteHeadGroup());
            case Pid::HEAD_TYPE:
                  return int(noteHeadType());
            case Pid::MIRROR_HEAD:
                  return int(direction());
            case Pid::GHOST:                 // recycled property = _hasLine
                  return hasLine();
            case Pid::LINE_WIDTH:
                  return lineWidth();
            case Pid::TPC1:
                  return topTpc();
            case Pid::FBPARENTHESIS1:        // recycled property = _bottomTpc
                  return bottomTpc();
            case Pid::PITCH:
                  return topPitch();
            case Pid::FBPARENTHESIS2:        // recycled property = _bottomPitch
                  return bottomPitch();
            case Pid::FBPARENTHESIS3:        // recycled property = octave of _topPitch
                  return topOctave();
            case Pid::FBPARENTHESIS4:        // recycled property = octave of _bottomPitch
                  return bottomOctave();
            default:
                  return Element::getProperty(propertyId);
            }
      }
Ejemplo n.º 14
0
void MolDraw2DSVG::drawEllipse(const Point2D &cds1, const Point2D &cds2) {
  Point2D c1 = getDrawCoords(cds1);
  Point2D c2 = getDrawCoords(cds2);
  double w = c2.x - c1.x;
  double h = c2.y - c1.y;
  double cx = c1.x + w / 2;
  double cy = c1.y + h / 2;
  w = w > 0 ? w : -1 * w;
  h = h > 0 ? h : -1 * h;

  std::string col = DrawColourToSVG(colour());
  unsigned int width = lineWidth();
  std::string dashString = "";
  d_os << "<ellipse"
       << " cx='" << cx << "'"
       << " cy='" << cy << "'"
       << " rx='" << w / 2 << "'"
       << " ry='" << h / 2 << "'";

  if (d_activeClass != "") {
    d_os << " class='" << d_activeClass << "'";
  }
  d_os << " style='";
  if (fillPolys())
    d_os << "fill:" << col << ";fill-rule:evenodd;";
  else
    d_os << "fill:none;";

  d_os << "stroke:" << col << ";stroke-width:" << width
       << "px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       << dashString << "'";
  d_os << " />\n";
}
Ejemplo n.º 15
0
void MultiLineEdit::updateSizeHint()
{
    QFontMetrics fm(font());
    int minPixelHeight = fm.lineSpacing() * _minHeight;
    int maxPixelHeight = fm.lineSpacing() * _maxHeight;
    int scrollBarHeight = horizontalScrollBar()->isVisible() ? horizontalScrollBar()->height() : 0;

    // use the style to determine a decent size
    int h = qMin(qMax((int)document()->size().height() + scrollBarHeight, minPixelHeight), maxPixelHeight) + 2 * frameWidth();

    QStyleOptionFrame opt;
    opt.initFrom(this);
    opt.rect = QRect(0, 0, 100, h);
    opt.lineWidth = lineWidth();
    opt.midLineWidth = midLineWidth();
    opt.state |= QStyle::State_Sunken;
    QWidget* widget = this;
#ifdef Q_OS_MAC
    widget = 0;
#endif
    QSize s = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(100, h).expandedTo(QApplication::globalStrut()), widget);
    if (s != _sizeHint) {
        _sizeHint = s;
        updateGeometry();
    }
}
Ejemplo n.º 16
0
void Ambitus::draw(QPainter* p) const
      {
      qreal _spatium = spatium();
      qreal lw = lineWidth().val() * _spatium;
      p->setPen(QPen(curColor(), lw, Qt::SolidLine, Qt::RoundCap));
      drawSymbol(noteHead(), p, _topPos);
      drawSymbol(noteHead(), p, _bottomPos);
      if (_hasLine)
            p->drawLine(_line);

      // draw ledger lines (if not in a palette)
      if (segment() && track() > -1) {
            int tick          = segment()->tick();
            Staff* stf        = score()->staff(staffIdx());
            qreal lineDist    = stf->lineDistance(tick);
            int numOfLines    = stf->lines(tick);
            qreal step        = lineDist * _spatium;
            qreal stepTolerance = step * 0.1;
            qreal ledgerOffset = score()->styleS(Sid::ledgerLineLength).val() * 0.5 * _spatium;
            p->setPen(QPen(curColor(), score()->styleS(Sid::ledgerLineWidth).val() * _spatium,
                        Qt::SolidLine, Qt::RoundCap) );
            if (_topPos.y()-stepTolerance <= -step) {
                  qreal xMin = _topPos.x() - ledgerOffset;
                  qreal xMax = _topPos.x() + headWidth() + ledgerOffset;
                  for (qreal y = -step; y >= _topPos.y()-stepTolerance; y -= step)
                        p->drawLine(QPointF(xMin, y), QPointF(xMax, y));
                  }
            if (_bottomPos.y()+stepTolerance >= numOfLines * step) {
                  qreal xMin = _bottomPos.x() - ledgerOffset;
                  qreal xMax = _bottomPos.x() + headWidth() + ledgerOffset;
                  for (qreal y = numOfLines*step; y <= _bottomPos.y()+stepTolerance; y += step)
                        p->drawLine(QPointF(xMin, y), QPointF(xMax, y));
                  }
            }
      }
Ejemplo n.º 17
0
/**
 * Reimplemented from UMLWidget::paint. Draws a rectangle.
 */
void DatatypeWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    painter->setBrush(brush());
    painter->setPen(QPen(lineColor(), lineWidth()));

    painter->drawRect(rect());
}
Ejemplo n.º 18
0
/**
 * Draws a rectangle.
 */
void BoxWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *o, QWidget *)
{
    Q_UNUSED(o);
    painter->setPen(QPen(lineColor(), lineWidth()));
    painter->setBrush(Qt::NoBrush);
    painter->drawRect(rect());
}
Ejemplo n.º 19
0
// ****************************************************************************
void MolDraw2DSVG::drawLine(const Point2D &cds1, const Point2D &cds2) {
  Point2D c1 = getDrawCoords(cds1);
  Point2D c2 = getDrawCoords(cds2);
  std::string col = DrawColourToSVG(colour());
  unsigned int width = lineWidth();
  std::string dashString = "";
  const DashPattern &dashes = dash();
  if (dashes.size()) {
    std::stringstream dss;
    dss << ";stroke-dasharray:";
    std::copy(dashes.begin(), dashes.end() - 1,
              std::ostream_iterator<unsigned int>(dss, ","));
    dss << dashes.back();
    dashString = dss.str();
  }
  d_os << "<path ";
  if (d_activeClass != "") {
    d_os << "class='" << d_activeClass << "' ";
  }
  d_os << "d='M " << c1.x << "," << c1.y << " " << c2.x << "," << c2.y << "' ";
  d_os << "style='fill:none;fill-rule:evenodd;stroke:" << col
       << ";stroke-width:" << width
       << "px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
       << dashString << "'";
  d_os << " />\n";
}
Ejemplo n.º 20
0
/*!
  Draw the border of the plot canvas

  \param painter Painter
  \sa setBorderRadius()
*/
void QwtPlotCanvas::drawBorder( QPainter *painter )
{
    if ( d_data->borderRadius > 0 )
    {
        if ( frameWidth() > 0 )
        {
            QwtPainter::drawRoundedFrame( painter, QRectF( frameRect() ), 
                d_data->borderRadius, d_data->borderRadius,
                palette(), frameWidth(), frameStyle() );
        }
    }
    else
    {
#if QT_VERSION >= 0x040500
#if QT_VERSION < 0x050000
        QStyleOptionFrameV3 opt;
#else
        QStyleOptionFrame opt;
#endif
        opt.init(this);

        int frameShape  = frameStyle() & QFrame::Shape_Mask;
        int frameShadow = frameStyle() & QFrame::Shadow_Mask;

        opt.frameShape = QFrame::Shape( int( opt.frameShape ) | frameShape );
#if 0
        opt.rect = frameRect();
#endif

        switch (frameShape) 
        {
            case QFrame::Box:
            case QFrame::HLine:
            case QFrame::VLine:
            case QFrame::StyledPanel:
            case QFrame::Panel:
            {
                opt.lineWidth = lineWidth();
                opt.midLineWidth = midLineWidth();
                break; 
            }
            default: 
            {
                opt.lineWidth = frameWidth();
                break;
            }
        }
    
        if ( frameShadow == Sunken )
            opt.state |= QStyle::State_Sunken;
        else if ( frameShadow == Raised )
            opt.state |= QStyle::State_Raised;

        style()->drawControl(QStyle::CE_ShapedFrame, &opt, painter, this);
#else
        drawFrame( painter );
#endif
    }
}
void RatioLayoutedFrame::setInnerFrameMinimumSize(const QSize& size)
{
  int border = lineWidth();
  QSize new_size = size;
  new_size += QSize(2 * border, 2 * border);
  setMinimumSize(new_size);
  emit delayed_update();
}
Ejemplo n.º 22
0
/**
 * Implementation of paint.
 */
void NoteWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    painter->setPen(QPen(lineColor(), lineWidth()));
    painter->setBrush(brush());

    QSizeF triSize(10, 10);
    Widget_Utils::drawTriangledRect(painter, rect(), triSize);
}
Ejemplo n.º 23
0
QPointF Stem::hookPos() const
      {
      QPointF p(pos() + line.p2());

      qreal xoff = lineWidth() * .5;
      p.rx() += xoff;
      return p;
      }
Ejemplo n.º 24
0
/*!
  Sets the frame shadow value from the frame style.
  \param shadow Frame shadow
  \sa setLineWidth(), QFrame::setFrameShadow()
*/
void QwtDial::setFrameShadow( Shadow shadow )
{
    if ( shadow != d_data->frameShadow )
    {
        d_data->frameShadow = shadow;
        if ( lineWidth() > 0 )
            update();
    }
}
Ejemplo n.º 25
0
void KMenuBar::setTopLevelMenuInternal(bool top_level)
{
    if(d->forcedTopLevel)
        top_level = true;

    d->wasTopLevel = top_level;
    if(parentWidget() && parentWidget()->topLevelWidget()->isFullScreen())
        top_level = false;

    if(isTopLevelMenu() == top_level)
        return;
    d->topLevel = top_level;
    if(isTopLevelMenu())
    {
#ifdef Q_WS_X11
        d->selection = new KSelectionWatcher(KMenuBarPrivate::makeSelectionAtom(), DefaultScreen(qt_xdisplay()));
        connect(d->selection, SIGNAL(newOwner(Window)), this, SLOT(updateFallbackSize()));
        connect(d->selection, SIGNAL(lostOwner()), this, SLOT(updateFallbackSize()));
#endif
        d->frameStyle = frameStyle();
        d->lineWidth = lineWidth();
        d->margin = margin();
        d->fallback_mode = false;
        bool wasShown = !isHidden();
        reparent(parentWidget(), WType_TopLevel | WStyle_Tool | WStyle_Customize | WStyle_NoBorder, QPoint(0, 0), false);
#ifdef Q_WS_X11
        KWin::setType(winId(), NET::TopMenu);
        if(parentWidget())
            XSetTransientForHint(qt_xdisplay(), winId(), parentWidget()->topLevelWidget()->winId());
#endif
        QMenuBar::setFrameStyle(NoFrame);
        QMenuBar::setLineWidth(0);
        QMenuBar::setMargin(0);
        updateFallbackSize();
        d->min_size = QSize(0, 0);
        if(parentWidget() && !parentWidget()->isTopLevel())
            setShown(parentWidget()->isVisible());
        else if(wasShown)
            show();
    }
    else
    {
#ifdef Q_WS_X11
        delete d->selection;
        d->selection = NULL;
#endif
        setBackgroundMode(PaletteButton);
        setFrameStyle(d->frameStyle);
        setLineWidth(d->lineWidth);
        setMargin(d->margin);
        setMinimumSize(0, 0);
        setMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX);
        updateMenuBarSize();
        if(parentWidget())
            reparent(parentWidget(), QPoint(0, 0), !isHidden());
    }
}
Ejemplo n.º 26
0
/*! 
  \brief Return a minimum size hint
  \warning The return value of QwtDial::minimumSizeHint() depends on the
           font and the scale.
*/  
QSize QwtDial::minimumSizeHint() const
{   
    int sh = 0;
    if ( d_scaleDraw )
        sh = d_scaleDraw->minHeight( QPen(), fontMetrics() );

    const int d = 3 * sh + 2 * lineWidth();
    
    return QSize( d, d );
}
Ejemplo n.º 27
0
void ListView::setVisibleItem(int visibleItem, bool updateSize)
{
    mVisibleItem = QMAX(1, visibleItem);
    if(updateSize == true)
    {
        QSize s = sizeHint();
        setMinimumSize(s.width() + verticalScrollBar()->sizeHint().width() +
                       lineWidth() * 2, s.height());
    }
}
Ejemplo n.º 28
0
/*!
  \brief Return a minimum size hint
  \warning The return value of QwtDial::minimumSizeHint() depends on the
           font and the scale.
*/
QSize QwtDial::minimumSizeHint() const
{
    int sh = 0;
    if ( d_data->scaleDraw )
        sh = qCeil( d_data->scaleDraw->extent( font() ) );

    const int d = 3 * sh + 2 * lineWidth();

    return QSize( d, d );
}
void Perpendiculaire::draw()
{
    if(Dessinable())
    {
        ofPushStyle();
        ofEnableAlphaBlending();
        ofSetColor(255, 255, 255, Alpha() * 255);
        ofSetLineWidth(lineWidth());
        float angle(Tools::getAngle(*Origine(), *Destination()));
        ofVec2f AB(Destination()->x - Origine()->x, Destination()->y - Origine()->y);
        ofPushMatrix();
        ofTranslate(*Origine() + positionRelative * AB);
        ofRotateZ(angle);

        if(showSymbole)
        {
            float tailleSymbole(ofClamp(10 * lineWidth(), 15, 50));
            ofLine(0, tailleSymbole, tailleSymbole, tailleSymbole);
            ofLine(tailleSymbole, 0, tailleSymbole, tailleSymbole);
        }

        ofVec2f from(0, -ofGetHeight() * 2);
        ofVec2f to(0, ofGetHeight() * 2);

        if(typeTrace() == TRACE_POINTILLES)
        {
            SegmentDroite pointilles(ofxOscRouterBaseNode::getFirstOscNodeAlias() + "-segment", '@', &from, &to, TRACE_POINTILLES);
            pointilles.Alpha(Alpha());
            pointilles.Dessinable(Dessinable());
            pointilles.lineWidth(lineWidth());
            pointilles.offset(offset());
            pointilles.draw();
        }
        else
        {
            ofLine(from, to);
        }

        ofPopMatrix();
        ofDisableAlphaBlending();
        ofPopStyle();
    }
}
Ejemplo n.º 30
0
void ClsSubDiagram::paintEvent ( QPaintEvent * event ){
    QPainter painter(this);
    QColor qcolorFrame;
    if(bFocus){
	qcolorFrame = Qt::red;
    } else {
	qcolorFrame = paletteBackgroundColor ();
    }
    qDrawPlainRect( &painter, frameRect(), qcolorFrame, lineWidth());
}