Example #1
0
//==============================================================================
void FileListComponent::changeListenerCallback (ChangeBroadcaster*)
{
    updateContent();

    if (lastDirectory != fileList.getDirectory())
    {
        lastDirectory = fileList.getDirectory();
        deselectAllRows();
    }
}
Example #2
0
void Label::setColor(const Color3B& color)
{
    _fontDefinition._fontFillColor = color;
    if (_textSprite)
    {
        updateContent();
    }
    _reusedLetter->setColor(color);
    SpriteBatchNode::setColor(color);
}
Example #3
0
void Label::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
{
    if (! _visible || _originalUTF8String.empty())
    {
        return;
    }
    if (_systemFontDirty)
    {
        updateFont();
    }
    if (_contentDirty)
    {
        updateContent();
    }

    uint32_t flags = processParentFlags(parentTransform, parentFlags);

    if (_shadowEnabled && _shadowBlurRadius <= 0 && (_shadowDirty || (flags & FLAGS_DIRTY_MASK)))
    {
        _position.x += _shadowOffset.width;
        _position.y += _shadowOffset.height;
        _transformDirty = _inverseDirty = true;

        _shadowTransform = transform(parentTransform);

        _position.x -= _shadowOffset.width;
        _position.y -= _shadowOffset.height;
        _transformDirty = _inverseDirty = true;

        _shadowDirty = false;
    }

    // IMPORTANT:
    // To ease the migration to v3.0, we still support the Mat4 stack,
    // but it is deprecated and your code should not rely on it
    Director* director = Director::getInstance();
    CCASSERT(nullptr != director, "Director is null when seting matrix stack");
    
    director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
    director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
    

    if (_textSprite)
    {
        drawTextSprite(renderer, flags);
    }
    else
    {
        draw(renderer, _modelViewTransform, flags);
    }

    director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
    
    setOrderOfArrival(0);
}
Example #4
0
void TimeLine::updateLayerView()
{
    int pageStep = ( height() - mTracks->getOffsetY() - mHScrollbar->height() )
                   / mTracks->getLayerHeight() - 2;
    
    mVScrollbar->setPageStep( pageStep );
    mVScrollbar->setMinimum( 0 );
    mVScrollbar->setMaximum( qMax(0, mNumLayers - mVScrollbar->pageStep()) );
    update();
    updateContent();
}
Example #5
0
    //==============================================================================
    void syncSelectedItemsWithDeviceList (const ReferenceCountedArray<MidiDeviceListEntry>& midiDevices)
    {
        SparseSet<int> selectedRows;
        for (int i = 0; i < midiDevices.size(); ++i)
            if (midiDevices[i]->inDevice != nullptr || midiDevices[i]->outDevice != nullptr)
                selectedRows.addRange (Range<int> (i, i+1));

        lastSelectedItems = selectedRows;
        updateContent();
        setSelectedRows (selectedRows, dontSendNotification);
    }
    //==============================================================================
    void disconnectedDeviceClicked (int row)
    {
        stopTimer();

        AndroidBluetoothMidiDevice& device = devices.getReference (row);
        device.connectionStatus = AndroidBluetoothMidiDevice::connecting;
        updateContent();
        repaint();

        new PairDeviceThread (device.bluetoothAddress, *this);
    }
void JavaClassDeclarationBlock::init (JavaClassifierCodeDocument *parentDoc, const QString &comment)
{

    setComment(new JavaCodeDocumentation(parentDoc));
    getComment()->setText(comment);

    setEndText("}");

    updateContent();

}
void XMLElementCodeBlock::init (CodeDocument *parentDoc, const QString &nodeName, const QString &comment)
{

    setComment(new XMLCodeComment(parentDoc));
    getComment()->setText(comment);

    m_nodeName = nodeName;

    updateContent();

}
AudioLayerTimeline::AudioLayerTimeline(AudioLayer * layer) :
	SequenceLayerTimeline(layer),
	audioLayer(layer)
{
	bgColor = AUDIO_COLOR.withSaturation(.2f).darker(1);

	cmMUI = new AudioLayerClipManagerUI(this,&layer->clipManager);
	addAndMakeVisible(cmMUI);

	updateContent();
}
void URLNavigator::goBack()
{
    updateHistoryElem();

    const int count = m_history.count();
    if (m_historyIndex < count - 1) {
        ++m_historyIndex;
        updateContent();
        emit urlChanged(url());
        emit historyChanged();
    }
}
bool FunctionHintProposalWidget::updateAndCheck(const QString &prefix)
{
    const int activeArgument = d->m_model->activeArgument(prefix);
    if (activeArgument == -1) {
        abort();
        return false;
    } else if (activeArgument != d->m_currentArgument) {
        d->m_currentArgument = activeArgument;
        updateContent();
    }

    return true;
}
Example #12
0
void TimeLine::forceUpdateLength(QString newLength)
{
    bool ok;
    int dec = newLength.toInt(&ok, 10);

    if ( dec > getFrameLength())
    {
        updateLength(dec);
        updateContent();
        QSettings settings("Pencil","Pencil");
        settings.setValue("length", dec);
    }
}
Example #13
0
void DockItem::removeClient(Client* client)
{
	m_clients.remove(m_clients.indexOf(client));
	if(m_clients.isEmpty())
	{
		// TODO: Stub. Item may be a launcher.
		delete this;
	}
	else
	{
		updateContent();
	}
}
void
RoutingStatsScene::reloadContent(bool force)
{
    if(m_nodeIdProxyWidgets.empty())
    {
        return;
    }

    m_lastX = 0;
    m_lastY = 0;
    m_bottomY = 0;
    qreal currentTime = StatsMode::getInstance()->getCurrentTime();

    qreal currentMaxHeight = 0;
    for(NodeIdProxyWidgetMap_t::const_iterator i = m_nodeIdProxyWidgets.begin();
        i != m_nodeIdProxyWidgets.end();
        ++i)
    {
        QGraphicsProxyWidget * pw = i->second;

        if((force) || (!m_lastTime) || (m_lastTime != currentTime))
        {
            updateContent(i->first, pw);
        }


        bool nodeIsActive = StatsMode::getInstance()->isNodeActive(i->first);
        pw->setVisible(nodeIsActive);
        if(nodeIsActive)
        {
            qreal newX = m_lastX + pw->size().width();
            currentMaxHeight = qMax(currentMaxHeight, pw->size().height());
            if(newX >= sceneRect().right())
            {
                m_lastX = 0;
                m_lastY += currentMaxHeight + INTERSTATS_SPACE;
                currentMaxHeight = 0;
            }
            pw->setPos(m_lastX, m_lastY);
            m_lastX = pw->pos().x() + pw->size().width() + INTERSTATS_SPACE;
            m_lastY = pw->pos().y();
            m_bottomY = m_lastY + currentMaxHeight;
            adjustRect();
        }

    }

    m_lastTime = currentTime;


}
Example #15
0
RubyCodeOperation::RubyCodeOperation ( RubyClassifierCodeDocument * doc, UMLOperation *parent, const QString & body, const QString & comment )
        : CodeOperation (doc, parent, body, comment)
{
    // lets not go with the default comment and instead use
    // full-blown ruby documentation object instead
    setComment(new RubyCodeDocumentation(doc));

    // these things never change..
    setOverallIndentationLevel(1);

    updateMethodDeclaration();
    updateContent();

}
void Bubble::setEntity(NotificationEntity *entity)
{
    if (!entity) return;

    m_entity = entity;

    m_outTimer->stop();

    updateContent();

    show();

    m_outTimer->start();
}
Example #17
0
void MyTextField::deleteBackward(){
    TextFieldTTF::deleteBackward();
    
    if(m_orientation == TextFieldOrientation::VERTICAL){
        //删非\n的字符
        if(_inputText.length() > 0 && _inputText.at(_inputText.length() - 1) != '\n'){
            TextFieldTTF::deleteBackward();
        }
    }
    
    if(_charCount == 0){
        updateContent();
    }
}
Example #18
0
void MainWindow::addProxy(Communication **pport, const char *device,
        BaudRateType bandrate, quint16 offset, const char *desc)
{
    *pport = new Communication(device, bandrate, 20000+offset);
    (*pport)->start();
    addRow();
    updateContent(*pport, offset);
    deviceDescription->item(offset, 0)->setText((*pport)->portName());
    deviceDescription->item(offset, 1)->setText(desc);
    (*pport)->setPrivData(offset);
    connect(*pport, SIGNAL(statisticsUpdate(Communication *, int)),
            this, SLOT(updateContent(Communication *, int)));
    connect(resetButton, SIGNAL(clicked()), *pport, SLOT(restart()));
}
Example #19
0
int Label::getStringNumLines()
{
    if (_contentDirty)
    {
        updateContent();
    }

    if (_currentLabelType == LabelType::STRING_TEXTURE)
    {
        computeStringNumLines();
    }

    return _numberOfLines;
}
//==============================================================================
void FileListComponent::changeListenerCallback (ChangeBroadcaster*)
{
    updateContent();

    if (lastDirectory != directoryContentsList.getDirectory())
    {
        fileWaitingToBeSelected = File();
        lastDirectory = directoryContentsList.getDirectory();
        deselectAllRows();
    }

    if (fileWaitingToBeSelected != File())
        setSelectedFile (fileWaitingToBeSelected);
}
Example #21
0
void WdmChMapComponent::handleAsyncUpdate()
{
	if (m_update & updt_unmount)
	{
		// bus is no longer available, disable gui components
		m_update = 0;
		setEnabled(false);
	}
	else if (m_bus)
	{
		// this object has just been attached, enable and populate component values
		if (m_update & updt_mount)
		{
			setEnabled(true);

			updateContent();

			m_update &= ~updt_mount;
		}

		// the speaker setup has changed
		if (m_update & updt_speaker)
		{
			updateContent();

			m_update &= ~updt_speaker;
		}
		
		// the speaker map has changed
		if (m_update & updt_speaker_map)
		{
			updateContent();

			m_update &= ~updt_speaker_map;
		}
	}
}
Example #22
0
void FileContentTracker::setFile(const QUrl &file)
{
    if (m_watcher) {
        delete m_watcher;
        m_watcher = 0;
        killTimer(m_timer);
        m_timer = 0;
    }

    m_fileName = file.toLocalFile();

    QFileInfo info(m_fileName);
    if (!info.exists()) {
        qDebug() << "FileContentTracker: file does not exist:" << m_fileName;
        return;
    }

    if (!info.isFile()) {
        qDebug() << "FileContentTracker: not a file:" << m_fileName;
        return;
    }

    m_watcher = new QFileSystemWatcher(this);
    if (!m_watcher->addPath(m_fileName)) {
        qDebug() << "FileContentTracker: failed to track file" << m_fileName;
        delete m_watcher;
        m_watcher = 0;
        return;
    }

    qDebug() << "FileContentTracker: now tracking" << m_fileName;

    connect(m_watcher, SIGNAL(fileChanged(QString)), this, SLOT(updateContent(QString)));
    updateContent(m_fileName);
    m_timer = startTimer(1000); // Need this because it doesn't seem to track on Mac OS X.
}
Example #23
0
bool UrlNavigator::setHistoryIndex(int index)
{
    if (index < 0 || index > m_history.size() - 1)
    {
        return false;
    }
    if (index == m_historyIndex)
    {
        return true;
    }

    m_historyIndex = index;
    updateContent();
    emit historyChanged();

    return true;
}
void GlobalRouterStatisticsWidget::wheelEvent(QWheelEvent *e)
{
    if(e->x() < mMinWheelZoneX || e->x() > mMaxWheelZoneX || e->y() < mMinWheelZoneY || e->y() > mMaxWheelZoneY)
    {
        QWidget::wheelEvent(e) ;
        return ;
    }
    
    if(e->delta() > 0 && mCurrentN+PARTIAL_VIEW_SIZE/2+1 < mNumberOfKnownKeys)
	    mCurrentN++ ;
    
    if(e->delta() < 0 && mCurrentN > PARTIAL_VIEW_SIZE/2+1)
	    mCurrentN-- ;
    
    updateContent();
    update();
}
Example #25
0
void VAttachmentList::init()
{
    if (m_initialized) {
        return;
    }

    m_initialized = true;

    setupUI();

    QShortcut *infoShortcut = new QShortcut(QKeySequence(c_infoShortcutSequence), this);
    infoShortcut->setContext(Qt::WidgetWithChildrenShortcut);
    connect(infoShortcut, &QShortcut::activated,
            this, &VAttachmentList::attachmentInfo);

    updateContent();
}
Example #26
0
void Label::visit(Renderer *renderer, const kmMat4 &parentTransform, bool parentTransformUpdated)
{
    if (! _visible || _originalUTF8String.empty())
    {
        return;
    }
    if (_contentDirty)
    {
        updateContent();
    }

    if (! _textSprite && _currLabelEffect == LabelEffect::SHADOW && _shadowBlurRadius <= 0)
    {
        _parentTransform = parentTransform;
        draw(renderer, _modelViewTransform, true);
    }
    else
    {
        bool dirty = parentTransformUpdated || _transformUpdated;
        
        if(dirty)
            _modelViewTransform = transform(parentTransform);
        _transformUpdated = false;

        // IMPORTANT:
        // To ease the migration to v3.0, we still support the kmGL stack,
        // but it is deprecated and your code should not rely on it
        kmGLPushMatrix();
        kmGLLoadMatrix(&_modelViewTransform);

        if (_textSprite)
        {
            _textSprite->visit();
        }
        else
        {
            draw(renderer, _modelViewTransform, dirty);
        }

        kmGLPopMatrix();
    }
    
    setOrderOfArrival(0);
}
Example #27
0
///// PROTOCOL STUFF
Sprite * Label::getLetter(int letterIndex)
{
    if (_fontDirty)
    {
        updateFont();
        return nullptr;
    }

    if (_contentDirty)
    {
        updateContent();
    }
    
    if (! _textSprite && letterIndex < _limitShowCount)
    {
        const auto &letter = _lettersInfo[letterIndex];

        if(! letter.def.validDefinition)
            return nullptr;

        Sprite* sp = static_cast<Sprite*>(this->getChildByTag(letterIndex));

        if (!sp)
        {
            Rect uvRect;
            uvRect.size.height = letter.def.height;
            uvRect.size.width  = letter.def.width;
            uvRect.origin.x    = letter.def.U;
            uvRect.origin.y    = letter.def.V;

            sp = Sprite::createWithTexture(_fontAtlas->getTexture(letter.def.textureID),uvRect);
            sp->setBatchNode(_batchNodes[letter.def.textureID]);
            sp->setPosition(Point(letter.position.x + uvRect.size.width / 2, 
                letter.position.y - uvRect.size.height / 2));
            sp->setOpacity(_realOpacity);

            _batchNodes[letter.def.textureID]->addSpriteWithoutQuad(sp, letter.atlasIndex, letterIndex);
        }
        return sp;
    }

    return nullptr;
}
URLNavigator::URLNavigator(const KURL& url,
                           DolphinView* dolphinView) :
    QHBox(dolphinView),
    m_historyIndex(0),
    m_dolphinView(dolphinView)
{
    m_history.prepend(HistoryElem(url));

    QFontMetrics fontMetrics(font());
    setMinimumHeight(fontMetrics.height() + 8);

    m_toggleButton = new QPushButton(SmallIcon("editurl"), 0, this);
    m_toggleButton->setFlat(true);
    m_toggleButton->setToggleButton(true);
    m_toggleButton->setFocusPolicy(QWidget::NoFocus);
    m_toggleButton->setMinimumHeight(minimumHeight());
    connect(m_toggleButton, SIGNAL(clicked()),
            this, SLOT(slotClicked()));
    if (DolphinSettings::instance().isURLEditable()) {
        m_toggleButton->toggle();
    }

    m_bookmarkSelector = new BookmarkSelector(this);
    connect(m_bookmarkSelector, SIGNAL(bookmarkActivated(int)),
            this, SLOT(slotBookmarkActivated(int)));

    m_pathBox = new KURLComboBox(KURLComboBox::Directories, true, this);

    KURLCompletion* kurlCompletion = new KURLCompletion(KURLCompletion::DirCompletion);
    m_pathBox->setCompletionObject(kurlCompletion);
    m_pathBox->setAutoDeleteCompletionObject(true);

    connect(m_pathBox, SIGNAL(returnPressed(const QString&)),
            this, SLOT(slotReturnPressed(const QString&)));
    connect(m_pathBox, SIGNAL(urlActivated(const KURL&)),
            this, SLOT(slotURLActivated(const KURL&)));

    connect(dolphinView, SIGNAL(contentsMoved(int, int)),
            this, SLOT(slotContentsMoved(int, int)));
    updateContent();
}
    //==============================================================================
    void updateDeviceList()
    {
        StringArray bluetoothAddresses = AndroidBluetoothMidiInterface::getBluetoothMidiDevicesNearby();

        Array<AndroidBluetoothMidiDevice> newDevices;

        for (String* address = bluetoothAddresses.begin();
             address != bluetoothAddresses.end(); ++address)
        {
            String name = AndroidBluetoothMidiInterface::getHumanReadableStringForBluetoothAddress (*address);
            DeviceStatus status =  AndroidBluetoothMidiInterface::isBluetoothDevicePaired (*address)
                                      ? AndroidBluetoothMidiDevice::connected
                                      : AndroidBluetoothMidiDevice::disconnected;

            newDevices.add (AndroidBluetoothMidiDevice (name, *address, status));
        }

        devices.swapWith (newDevices);
        updateContent();
        repaint();
    }
Example #30
0
void LayoutListMarker::computePreferredLogicalWidths() {
  ASSERT(preferredLogicalWidthsDirty());
  updateContent();

  if (isImage()) {
    LayoutSize imageSize(imageBulletSize());
    m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth =
        style()->isHorizontalWritingMode() ? imageSize.width()
                                           : imageSize.height();
    clearPreferredLogicalWidthsDirty();
    updateMargins();
    return;
  }

  const Font& font = style()->font();
  const SimpleFontData* fontData = font.primaryFont();
  DCHECK(fontData);
  if (!fontData)
    return;

  LayoutUnit logicalWidth;
  switch (getListStyleCategory()) {
    case ListStyleCategory::None:
      break;
    case ListStyleCategory::Symbol:
      logicalWidth =
          LayoutUnit((fontData->getFontMetrics().ascent() * 2 / 3 + 1) / 2 + 2);
      break;
    case ListStyleCategory::Language:
      logicalWidth = getWidthOfTextWithSuffix();
      break;
  }

  m_minPreferredLogicalWidth = logicalWidth;
  m_maxPreferredLogicalWidth = logicalWidth;

  clearPreferredLogicalWidthsDirty();

  updateMargins();
}