Beispiel #1
0
    void ListBox::setCoord(const IntCoord& _coord)
    {
        Base::setCoord(_coord);

        updateScroll();
        updateLine();
    }
Beispiel #2
0
bool ListDnd::dragMoveEvent( QDragMoveEvent * event )
{
    if ( dragInside && dMode && !( dMode & NullDrop ) ) {
	updateLine( event->pos() );
    }
    return TRUE;
}
Beispiel #3
0
    void ListBox::setSize(const IntSize& _size)
    {
        Base::setSize(_size);

        updateScroll();
        updateLine();
    }
void picrossSolver::passSide(int side)
{
	for(int i = 0; i < boardDefinition[side].size(); ++i)
	{
		updateLine(side, i);
	}
}
 void SimpleCircleFacingVisualizer::setSize(double size)
 {
   FacingObject::setSize(size);
   updateLine();
   updateText();
   updateTextUnderLine();
 }
 SimpleCircleFacingVisualizer::SimpleCircleFacingVisualizer(
   Ogre::SceneManager* manager,
   Ogre::SceneNode* parent,
   rviz::DisplayContext* context,
   double size,
   std::string text):
   FacingObject(manager, parent, size)
 {
   line_ = new rviz::BillboardLine(
     context->getSceneManager(),
     node_);
   text_under_line_ = new rviz::BillboardLine(
     context->getSceneManager(),
     node_);
   target_text_node_ = node_->createChildSceneNode();
   msg_ = new rviz::MovableText("not initialized", "Arial", 0.05);
   msg_->setVisible(false);
   msg_->setTextAlignment(rviz::MovableText::H_LEFT,
                          rviz::MovableText::V_ABOVE);
   target_text_node_->attachObject(msg_);
   createArrows(context);
   updateLine();
   updateTextUnderLine();
   updateText();
   setEnable(false);
 }
Beispiel #7
0
Edge::Edge(QPointF p1, QPointF p2) :
    pheromone(defaultPheromone),
    onBestTour(false)
{
    length = dist(p1, p2);
    line = new QGraphicsLineItem(p1.x(), p1.y(), p2.x(), p2.y());
    line->setZValue(PHEROMONE_Z);
    updateLine(0.0);
}
Beispiel #8
0
void Bubble::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
    if ((event->buttons() & Qt::LeftButton) == Qt::LeftButton) {
        QPointF delta = event->scenePos() - event->lastScenePos();
        _rectangle->setPos(_rectangle->pos() + delta);
        _text->setPos(_text->pos() + delta);

        updateLine();
    }
}
  void DiagnosticsDisplay::update(float wall_dt, float ros_dt)
  {
    if (line_update_required_) {
      updateLine();
    }

    if (!isEnabled()) {
      return;
    }

    msg_->setCharacterHeight(font_size_);
    
    const float round_trip = 10.0;
    Ogre::Quaternion orientation;
    Ogre::Vector3 position;
    std::string frame_id = frame_id_property_->getFrame().toStdString();
    if( !context_->getFrameManager()->getTransform( frame_id,
                                                    ros::Time(0.0),
                                                    position, orientation ))
    {
      ROS_WARN( "Error transforming from frame '%s' to frame '%s'",
                frame_id.c_str(), qPrintable( fixed_frame_ ));
      return;
    }
    scene_node_->setPosition(position);
    scene_node_->setOrientation(orientation);
    Ogre::Vector3 orbit_position;
    orbit_theta_ = ros_dt / round_trip * M_PI * 2.0 + orbit_theta_;
    while (orbit_theta_ > M_PI * 2) {
      orbit_theta_ -= M_PI*2;
    }
    if (axis_ == 0) {           // x
      orbit_position.x = radius_ * cos(orbit_theta_);
      orbit_position.y = radius_ * sin(orbit_theta_);
      orbit_position.z = 0;
    }
    else if (axis_ == 1) {      // y
      orbit_position.y = radius_ * cos(orbit_theta_);
      orbit_position.z = radius_ * sin(orbit_theta_);
      orbit_position.x = 0;
    }
    else if (axis_ == 2) {      // z
      orbit_position.z = radius_ * cos(orbit_theta_);
      orbit_position.x = radius_ * sin(orbit_theta_);
      orbit_position.y = 0;
    }
    
    orbit_node_->setPosition(orbit_position);
    if (!isEnabled()) {
      return;
    }
    context_->queueRender();
  }
Beispiel #10
0
void Bubble::setText(const QString &text)
{
    _text->setHtml(text);
    QRectF rect = _text->boundingRect();
    QPointF center = _rectangle->pos();

    _text->setPos(center.x() - rect.width() / 2.0, center.y() - rect.height() / 2.0);

    rect.setWidth(rect.width() * 1.1);
    rect.setHeight(rect.height() * 1.1);
    rect.moveCenter(QPointF(0, 0));
    _rectangle->setRect(rect);

    updateLine();
}
void
BinClockWidget::updateState()
{
    QTime t = QTime::currentTime();
    int data[2];
    data[1] = t.minute();
    data[0] = (t.hour()-1) % 12 + 1;
    int i;
    for (i = 1; i >= 0; i--) {
        if (data[i] != displayData[i]) {
            displayData[i] = data[i];
            updateLine(i);
        } else {
            break;
        }
    }
}
Beispiel #12
0
void MainWindow::interprete(OP o)
{
    findFirstOperand();
    findSecondOperand();

    //printf("%f\t%f\n", operand_1, operand_2);

    if (op2 == true)
    {
        compute();
        updateLine();
        appendLineOperator(o);
    }
    else
        replaceOperator(o);

    current_op = o;
}
Beispiel #13
0
void State::update()
{
    _attackables.clear();
    //vertical
    for (size_t i = 0; i < _size; ++i) {
        auto v = getVertical(Position(0, i));
        updateLine(v);
    }
    //horizontal
    for (size_t i = 0; i < _size; ++i) {
        auto v = getHorizontal(Position(i, 0));
        updateLine(v);
    }
    //diagonalA
    for (size_t i = 4; i < _size-1; ++i) {
        auto v = getDiagonalA(Position(i, _size-1));
        updateLine(v);
    }
    {
        auto v = getDiagonalA(Position(_size - 1, _size - 1));
        updateLine(v);
    }
    for (size_t i = 1; i < _size - 4; ++i) {
        auto v = getDiagonalA(Position(i, 0));
        updateLine(v);
    }
    //diagonalB
    for (size_t i = 4; i < _size - 1; ++i) {
        auto v = getDiagonalB(Position(i, 0));
        updateLine(v);
    }
    {
        auto v = getDiagonalB(Position(_size - 1, 0));
        updateLine(v);
    }
    for (size_t i = 1; i < _size - 4; ++i) {
        auto v = getDiagonalB(Position(i, _size - 1));
        updateLine(v);
    }
    updated = true;
}
Beispiel #14
0
bool ListDnd::dragEnterEvent( QDragEnterEvent * event )
{
    if ( dMode == None ) {
	return TRUE;
    }

    bool ok = ( ( ( dMode & Both ) == Both ) ||
		( ( dMode & Internal ) && ( event->source() == src ) ) ||
		( ( dMode & External ) && ( event->source() != src ) ) );

    if ( ok && canDecode( event ) ) {
	event->accept();
	dragInside = TRUE;
	if ( !( dMode & NullDrop ) ) {
	    updateLine( event->pos() );
	    line->show();
	}
    }
    return TRUE;
}
Beispiel #15
0
    void ListBox::initialiseOverride()
    {
        Base::initialiseOverride();

        // FIXME нам нужен фокус клавы
        setNeedKeyFocus(true);

        // парсим свойства
        if (isUserString("SkinLine"))
            mSkinLine = getUserString("SkinLine");

        if (isUserString("HeightLine"))
            mHeightLine = utility::parseInt(getUserString("HeightLine"));

        if (mHeightLine < 1)
            mHeightLine = 1;

        assignWidget(mClient, "Client");
        if (mClient != nullptr)
        {
            mClient->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed);
            setWidgetClient(mClient);
        }

        assignWidget(mWidgetScroll, "VScroll");
        if (mWidgetScroll != nullptr)
        {
            mWidgetScroll->eventScrollChangePosition += newDelegate(this, &ListBox::notifyScrollChangePosition);
            mWidgetScroll->eventMouseButtonPressed += newDelegate(this, &ListBox::notifyMousePressed);
            mWidgetScroll->setScrollPage((size_t)mHeightLine);
            mWidgetScroll->setScrollViewPage((size_t)mHeightLine);
        }

        updateScroll();
        updateLine();
    }
Beispiel #16
0
    void ListBox::removeAllItems()
    {
        mTopIndex = 0;
        mIndexSelect = ITEM_NONE;
        mOffsetTop = 0;

        mItemsInfo.clear();

        int offset = 0;
        for (size_t pos = 0; pos < mWidgetLines.size(); pos++)
        {
            mWidgetLines[pos]->setVisible(false);
            mWidgetLines[pos]->setPosition(0, offset);
            offset += mHeightLine;
        }

        // обновляем все
        updateScroll();
        updateLine(true);

#if MYGUI_DEBUG_MODE == 1
        _checkMapping("ListBox::removeAllItems");
#endif
    }
void
BinClockWidget::updateView()
{
    updateLine(0);
    updateLine(1);
}
void ScrollingTextRenderer::renderLines(GameWindow& window, float percBehind)
{
	auto updateFunc = [&window, percBehind, this](std::shared_ptr<GameObject> go) {updateLine(window, percBehind, go);};
	auto remFunc = [this](std::shared_ptr<GameObject> go) {return remPred(go);};
	util::vector::update_or_remove <std::shared_ptr<GameObject>>(lines_, remFunc, updateFunc);
}
Beispiel #19
0
void Edge::reset()
{
    pheromone = defaultPheromone;
    onBestTour = false;
    updateLine(0.0);
}
Beispiel #20
0
    void ListBox::insertItemAt(size_t _index, const UString& _name, Any _data)
    {
        MYGUI_ASSERT_RANGE_INSERT(_index, mItemsInfo.size(), "ListBox::insertItemAt");
        if (_index == ITEM_NONE)
            _index = mItemsInfo.size();

        // вставляем физически
        mItemsInfo.insert(mItemsInfo.begin() + _index, PairItem(_name, _data));

        // если надо, то меняем выделенный элемент
        if ((mIndexSelect != ITEM_NONE) && (_index <= mIndexSelect))
            mIndexSelect++;

        // строка, до первого видимого элемента
        if ((_index <= (size_t)mTopIndex) && (mRangeIndex > 0))
        {
            mTopIndex ++;
            // просчитываем положение скролла
            if (mWidgetScroll != nullptr)
            {
                mWidgetScroll->setScrollRange(mWidgetScroll->getScrollRange() + mHeightLine);
                if (!mItemsInfo.empty())
                    mWidgetScroll->setTrackSize( mWidgetScroll->getLineSize() * _getClientWidget()->getHeight() / mHeightLine / (int)mItemsInfo.size() );
                mWidgetScroll->setScrollPosition(mTopIndex * mHeightLine + mOffsetTop);
            }
            mRangeIndex += mHeightLine;
        }
        else
        {
            // высчитывам положение строки
            int offset = ((int)_index - mTopIndex) * mHeightLine - mOffsetTop;

            // строка, после последнего видимого элемента, плюс одна строка (потому что для прокрутки нужно на одну строчку больше)
            if (_getClientWidget()->getHeight() < (offset - mHeightLine))
            {
                // просчитываем положение скролла
                if (mWidgetScroll != nullptr)
                {
                    mWidgetScroll->setScrollRange(mWidgetScroll->getScrollRange() + mHeightLine);
                    if (!mItemsInfo.empty())
                        mWidgetScroll->setTrackSize( mWidgetScroll->getLineSize() * _getClientWidget()->getHeight() / mHeightLine / (int)mItemsInfo.size() );
                    mWidgetScroll->setScrollPosition(mTopIndex * mHeightLine + mOffsetTop);
                }
                mRangeIndex += mHeightLine;

                // строка в видимой области
            }
            else
            {
                // обновляем все
                updateScroll();
                updateLine(true);

                // позже сюда еще оптимизацию по колличеству перерисовок
            }
        }

#if MYGUI_DEBUG_MODE == 1
        _checkMapping("ListBox::insertItemAt");
#endif
    }
Beispiel #21
0
/**
 * Block class contructor, that creates a block from a specified element
 * as a child of a specified parent to the specified block group
 * @param el specified TreeElement
 * @param parentBlock parent block of a created block
 * @param blockGroup group of a created block
 */
Block::Block(TreeElement *el, Block *parentBlock, BlockGroup *blockGroup)
    : QGraphicsRectItem(parentBlock)
{
    repaintNeeded = false;

    if (parentBlock == 0) //! adding directly to group, no parent block
    {
        Q_ASSERT(blockGroup != 0);
        setParentItem(blockGroup);
        group = blockGroup;
        parent = 0;
        prevSib = 0;
    }
    else
    {
        parent = parentBlock;

        // destroy text item if needed
        if (parent->isTextBlock())
        {
            delete parent->myTextItem;
            parent->myTextItem = 0;
        }

        group = parent->group;

        // set links
        QList<Block*> siblings = parent->childBlocks();

        if (siblings.size() > 1) //! this block is in siblings already!
        {
            prevSib = siblings.at(siblings.size() - 2);
            prevSib->nextSib = this;
        }
        else
        {
            parent->firstChild = this;
            prevSib = 0;
        }

        if (el->getParent() == 0)
        {
            parentBlock->element->appendChild(el);
        }
    }

    firstChild = 0;
    nextSib = 0;

    // set line
    updateLine();

    // set element
    element = el;

    while (!element->isImportant())     //! skip unimportant
        element = (*element)[0];

    element->setBlock(this);

    // process rest of the AST
    if (element->isLeaf()) //! leaf - create text area
    {
        myTextItem = new TextItem(element->getType(), this, element->allowsParagraphs(), element->isPaired());
    }
    else //! non-leaf - create rest of the tree
    {
        myTextItem = 0;
        setToolTip(element->getType().replace("_", " "));

        // zistime pocet deti tabulky, tolkokrat spravime next();

        for (int i = 0; i < element->childCount(); i++)
        {
            TreeElement *childEl = element->getChildren()[i];

            if (!childEl->isFloating()) //! create block from child element
            {
                new Block(childEl, this);
            }
            else //! create docblock form child element
            {
                QString text = childEl->getText();
                childEl->deleteAllChildren();
                new DocBlock(text, childEl, this, group);
            }
        }
    }

    // set highlighting
    assignHighlighting(element);

    // set flags
    setAcceptedMouseButtons(Qt::LeftButton);
    setAcceptDrops(true);
    folded = false;
    edited = false;
    showing = false;
    moreSpace = false;
    moveStarted = false;
    pointed = false;
    isSearchResult = false;
    foldButton = 0;
    level = 0;

    animation = new QPropertyAnimation(this, "geometry");
    animation->setDuration(200);

    if (element->isSelectable())
    {
        setPen(QPen(QBrush(Qt::black), 2));
        setAcceptHoverEvents(true);
        timer = new QTimer(this);
        timer->setSingleShot(true);
        connect(timer, SIGNAL(timeout()), this, SLOT(acceptHover()));
    }
    else
    {
        timer = 0;
    }

    // set size
    updateGeometry(true);

//    updateFoldButton();

    if (parent == 0)
        setVisible(false);
}
Beispiel #22
0
void PRawRows::observeUpdateLine(size_t r, const std::string &s)
{
    emit updateLine(r, QString::fromStdString(s));
}
Beispiel #23
0
    void ListBox::removeItemAt(size_t _index)
    {
        MYGUI_ASSERT_RANGE(_index, mItemsInfo.size(), "ListBox::removeItemAt");

        // удяляем физически строку
        mItemsInfo.erase(mItemsInfo.begin() + _index);

        // если надо, то меняем выделенный элемент
        if (mItemsInfo.empty()) mIndexSelect = ITEM_NONE;
        else if (mIndexSelect != ITEM_NONE)
        {
            if (_index < mIndexSelect)
                mIndexSelect--;
            else if ((_index == mIndexSelect) && (mIndexSelect == (mItemsInfo.size())))
                mIndexSelect--;
        }

        // если виджетов стало больше , то скрываем крайний
        if (mWidgetLines.size() > mItemsInfo.size())
        {
            mWidgetLines[mItemsInfo.size()]->setVisible(false);
        }

        // строка, до первого видимого элемента
        if (_index < (size_t)mTopIndex)
        {
            mTopIndex --;
            // просчитываем положение скролла
            if (mWidgetScroll != nullptr)
            {
                mWidgetScroll->setScrollRange(mWidgetScroll->getScrollRange() - mHeightLine);
                if (!mItemsInfo.empty())
                    mWidgetScroll->setTrackSize( mWidgetScroll->getLineSize() * _getClientWidget()->getHeight() / mHeightLine / (int)mItemsInfo.size() );
                mWidgetScroll->setScrollPosition(mTopIndex * mHeightLine + mOffsetTop);
            }
            mRangeIndex -= mHeightLine;
        }
        else
        {
            // высчитывам положение удаляемой строки
            int offset = ((int)_index - mTopIndex) * mHeightLine - mOffsetTop;

            // строка, после последнего видимого элемента
            if (_getClientWidget()->getHeight() < offset)
            {
                // просчитываем положение скролла
                if (mWidgetScroll != nullptr)
                {
                    mWidgetScroll->setScrollRange(mWidgetScroll->getScrollRange() - mHeightLine);
                    if (!mItemsInfo.empty())
                        mWidgetScroll->setTrackSize( mWidgetScroll->getLineSize() * _getClientWidget()->getHeight() / mHeightLine / (int)mItemsInfo.size() );
                    mWidgetScroll->setScrollPosition(mTopIndex * mHeightLine + mOffsetTop);
                }
                mRangeIndex -= mHeightLine;

                // строка в видимой области
            }
            else
            {
                // обновляем все
                updateScroll();
                updateLine(true);

                // позже сюда еще оптимизацию по колличеству перерисовок
            }
        }

#if MYGUI_DEBUG_MODE == 1
        _checkMapping("ListBox::removeItemAt");
#endif
    }
Beispiel #24
0
void GroupBox::setSize(const sf::Vector2u& size)
{
    box.setSize(sf::Vector2f(size.x, size.y));
    updateTextPosition();
    updateLine();
}
Beispiel #25
0
void GroupBox::setPosition(const sf::Vector2f& pos)
{
    box.setPosition(pos);
    updateTextPosition();
    updateLine();
}
Beispiel #26
0
//--------------------------------------------------------------------------------
//
//    update_screen
//
//--------------------------------------------------------------------------------
void EmacsView::update_screen( int slow_update )
{
    t_update_begin();

#if !MEMMAP
    check_for_input = 999;
#endif
    if( screen_garbaged )
    {
        t_reset();
        screen_garbaged = 0;
        for( int n=0; n<=t_length; n++ )
        {
            t_phys_screen[n].releaseLine();
        }
    }

    if( current_line >= 0
    && t_desired_screen[ current_line ]->line_length <= t_width - columns_left )
        t_desired_screen[ current_line ]->line_length =
            (columns_left > 0 ?
                t_width - columns_left
            :
                t_width);
    current_line = -1;

    if( t_il_ov == MISSINGFEATURE )
        slow_update = 0;

    if( slow_update )
    {
        int n;
        for( n=1; n<=t_length; n++ )
        {
            if( t_desired_screen[n].isNull() )
                t_desired_screen[n] = t_phys_screen[n];
        }

        int c = 0;
        n = t_length;
        while( n >= 1 && c <= 2 )
        {
            if( t_phys_screen[n] != t_desired_screen[n]
            && !t_phys_screen[n].isNull()
            && t_desired_screen[n]->lineHash() != t_phys_screen[n]->lineHash()  )
                c++;
            n--;
        }
        if( c <= 2 )
            slow_update = 0;
        else
        {
#if !MEMMAP
            check_for_input = 1;    // baud_rate / 2400;
#endif
            executeInsertDelete();
        }
    }

    if( !slow_update )    // fast update
    {
        int n;
        for( n=1; n<=t_length; n++ )
            if( !t_desired_screen[n].isNull() )
            {
                updateLine( t_phys_screen[n], t_desired_screen[n], n );
                t_phys_screen[n] = t_desired_screen[n];
                t_desired_screen[n].releaseLine();
            }
    }

    if( input_pending == 0 )
        t_topos( curs_y, curs_x );

    t_update_end();
}
Beispiel #27
0
void main(void) {
	//_delay_ms(1000);
	setup();

	while(1) {
    
#ifdef GPS_ENABLED
    if(UCSR0A & (1<<RXC0)) {
      decodeGpsData(UDR0);
    }
#endif //GPS_ENABLED
    
#ifndef DEBUG
		if((PIND & KEY) != KEY) {
			gKeyPressed = 1;
			if(gKeyPressTime > 50) {
				gKeyPressTime = 0;
				PORTD |= LED; // long press!
#ifdef GPS_ENABLED
#ifdef HOME_SET_WITH_BUTTON
      if (gGpsLastData.checksumValid != 0 && gGpsLastData.fix != 0) { // (Improved thanks to Yury Smirnov)
				setHomePos();
#ifdef TIME_ENABLED
        resetTime();
#endif //TIME_ENABLED
			}
#endif //HOME_SET_WITH_BUTTON
#endif //GPS_ENABLED
			}
		}
		else {
			if (gKeyPressed) {
				PORTD &= ~LED;  // led off
			}				
			gKeyPressed = 0;
			gKeyPressTime = 0;
		}
#endif //!DEBUG

#ifdef DEBUG
		gUpdateScreenData = 2;
#endif //DEBUG

#ifdef TEXT_ENABLED
    if (gUpdateScreenData == 2) {
		  gUpdateScreenData = 0;
#ifdef TEXT_INVERTED_ENABLED
	    clearTextInverted();
#endif //TEXT_INVERTED_ENABLED
		//DDRB |= OUT1;
		updateTextCharStartPos(gActiveTextId);
	    updateTextPixmap(gActiveTextId);
		  //DDRB &= ~OUT1;
	  }
	  else if (gUpdateScreenData == 1) {
#else
    if (gUpdateScreenData == 1) {
#endif //TEXTENABLED
			gUpdateScreenData = 0;
			//DDRB |= OUT1;
			updateOnceEveryFrame();
			//DDRB &= ~OUT1;
		}
	}
}

ISR(INT0_vect) {
	TCNT1 = 0; // Reset sync lost timeout.
	updateLine();
}

ISR(TIMER1_OVF_vect)
{
	static uint8_t lastLine = 0;
	if (lastLine == gActiveLine) {
		PORTD ^= LED; // Toggle the LED
	}
	lastLine = gActiveLine;
}