void KStart::windowAdd(Window w){ if (window) { QString t = KWM::title(w); QRegExp r = window; if (r.match(t) != -1){ applyStyle( w ); ::exit(0); } } else { // not window specified, just take the first one applyStyle( w ); ::exit(0); } }
/*! */ void DiaOutputDev::_fill (GfxState *state, bool winding) { GArray *points = g_array_new (FALSE, FALSE, sizeof(BezPoint)); DiaObject *obj = NULL; GfxPath *path = state->getPath(); bool haveClose = true; if (doPath (points, state, path, haveClose) && points->len > 2) { if (path->getNumSubpaths() == 1 && haveClose) obj = create_standard_beziergon (points->len, &g_array_index (points, BezPoint, 0)); else obj = create_standard_path (points->len, &g_array_index (points, BezPoint, 0)); applyStyle (obj, true); if (this->pattern) { ObjectChange *change = dia_object_set_pattern (obj, this->pattern); if (change) { change->free (change); g_free (change); } } } g_array_free (points, TRUE); if (obj) { // Useful for debugging but high performance penalty // dia_object_set_meta (obj, "fill-rule", winding ? "winding" : "even-odd"); addObject (obj); } }
void QSvgPath::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); m_path.setFillRule(states.fillRule); QT_SVG_DRAW_SHAPE(p->drawPath(m_path)); revertStyle(p, states); }
QRectF QSvgNode::transformedBounds(QPainter *p, QSvgExtraStates &states) const { applyStyle(p, states); QRectF rect = bounds(p, states); revertStyle(p, states); return rect; }
void QSvgTinyDocument::draw(QPainter *p, const QRectF &bounds) { if (m_time.isNull()) { m_time.start(); } if (displayMode() == QSvgNode::NoneMode) return; p->save(); //sets default style on the painter //### not the most optimal way mapSourceToTarget(p, bounds); QPen pen(Qt::NoBrush, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin); pen.setMiterLimit(4); p->setPen(pen); p->setBrush(Qt::black); p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::SmoothPixmapTransform); QList<QSvgNode*>::iterator itr = m_renderers.begin(); applyStyle(p, m_states); while (itr != m_renderers.end()) { QSvgNode *node = *itr; if ((node->isVisible()) && (node->displayMode() != QSvgNode::NoneMode)) node->draw(p, m_states); ++itr; } revertStyle(p, m_states); p->restore(); }
void QSvgTinyDocument::draw(QPainter *p, const QRectF &bounds) { if (m_time.isNull()) { m_time.start(); } if (m_viewBox.isNull()) { QMatrix matx = QMatrix(); m_viewBox = transformedBounds(matx); } p->save(); //sets default style on the painter //### not the most optimal way adjustWindowBounds(p, bounds, m_viewBox); p->setPen(Qt::NoPen); p->setBrush(Qt::black); p->setRenderHint(QPainter::Antialiasing); p->setRenderHint(QPainter::SmoothPixmapTransform); QList<QSvgNode*>::iterator itr = m_renderers.begin(); applyStyle(p); while (itr != m_renderers.end()) { QSvgNode *node = *itr; if (node->isVisible()) node->draw(p); ++itr; } revertStyle(p); p->restore(); }
void UIWidget::updateStyle() { if(m_destroyed) return; if(m_loadingStyle && !m_updateStyleScheduled) { UIWidgetPtr self = static_self_cast<UIWidget>(); g_dispatcher.addEvent([self] { self->m_updateStyleScheduled = false; self->updateStyle(); }); m_updateStyleScheduled = true; return; } if(!m_style) return; OTMLNodePtr newStateStyle = OTMLNode::create(); // copy only the changed styles from default style if(m_stateStyle) { for(OTMLNodePtr node : m_stateStyle->children()) { if(OTMLNodePtr otherNode = m_style->get(node->tag())) newStateStyle->addChild(otherNode->clone()); } } // checks for states combination for(const OTMLNodePtr& style : m_style->children()) { if(stdext::starts_with(style->tag(), "$")) { std::string statesStr = style->tag().substr(1); std::vector<std::string> statesSplit = stdext::split(statesStr, " "); bool match = true; for(std::string stateStr : statesSplit) { if(stateStr.length() == 0) continue; bool notstate = (stateStr[0] == '!'); if(notstate) stateStr = stateStr.substr(1); bool stateOn = hasState(Fw::translateState(stateStr)); if((!notstate && !stateOn) || (notstate && stateOn)) match = false; } // merge states styles if(match) { newStateStyle->merge(style); } } } //TODO: prevent setting already set proprieties applyStyle(newStateStyle); m_stateStyle = newStateStyle; }
QgsSGGeometry::QgsSGGeometry( const QgsGeometry& geom, const QColor& color , int width ) { //TODO: Fix const-correcteness upstream QgsGeometry& gg = const_cast<QgsGeometry&>( geom ); mMaterial.setColor( color ); switch ( gg.type() ) { case QgsWkbTypes::PointGeometry: if ( gg.isMultipart() ) { const QgsMultiPoint& points = gg.asMultiPoint(); Q_FOREACH( const QgsPoint& point, points ) { QSGGeometryNode* geomNode = new QSGGeometryNode; geomNode->setGeometry( qgsPointToQSGGeometry ( point, width ) ); geomNode->setFlag( QSGNode::OwnsGeometry ); applyStyle( geomNode ); appendChildNode( geomNode ); } } else {
void InsertTextCommand::input(const String &text, bool selectInsertedText) { assert(text.find('\n') == -1); if (endingSelection().isNone()) return; // Delete the current selection. if (endingSelection().isRange()) deleteSelection(false, true, true); // Insert the character at the leftmost candidate. Position startPosition = endingSelection().start().upstream(); deleteInsignificantText(startPosition.upstream(), startPosition.downstream()); if (!startPosition.inRenderedContent()) startPosition = startPosition.downstream(); startPosition = positionAvoidingSpecialElementBoundary(startPosition); Position endPosition; if (text == "\t") { endPosition = insertTab(startPosition); startPosition = endPosition.previous(); removeBlockPlaceholder(VisiblePosition(startPosition)); m_charactersAdded += 1; } else { // Make sure the document is set up to receive text startPosition = prepareForTextInsertion(startPosition); removeBlockPlaceholder(VisiblePosition(startPosition)); Text *textNode = static_cast<Text *>(startPosition.node()); int offset = startPosition.offset(); insertTextIntoNode(textNode, offset, text); endPosition = Position(textNode, offset + text.length()); // The insertion may require adjusting adjacent whitespace, if it is present. rebalanceWhitespaceAt(endPosition); // Rebalancing on both sides isn't necessary if we've inserted a space. if (text != " ") rebalanceWhitespaceAt(startPosition); m_charactersAdded += text.length(); } setEndingSelection(Selection(startPosition, endPosition, DOWNSTREAM)); // Handle the case where there is a typing style. // FIXME: Improve typing style. // See this bug: <rdar://problem/3769899> Implementation of typing style needs improvement CSSMutableStyleDeclaration* typingStyle = document()->frame()->typingStyle(); RefPtr<CSSComputedStyleDeclaration> endingStyle = endPosition.computedStyle(); endingStyle->diff(typingStyle); if (typingStyle && typingStyle->length() > 0) applyStyle(typingStyle); if (!selectInsertedText) setEndingSelection(endingSelection().end(), endingSelection().affinity()); }
void MAbstractLayoutPolicy::unsetContentsMargins() { Q_D(MAbstractLayoutPolicy); if (!d->userSetContentsMargins) return; //already unset d->userSetContentsMargins = false; (void)style(); //Force the style to be loaded applyStyle(); }
void ofxFontStash2::getVerticalMetrics(const ofxFontStashStyle & style, float* ascender, float* descender, float* lineH){ applyStyle(style); fonsVertMetrics(fs, ascender, descender, lineH); if( pixelDensity != 1 ){ *ascender /= pixelDensity; *descender /= pixelDensity; *lineH /= pixelDensity; } }
void UIWidget::mergeStyle(const OTMLNodePtr& styleNode) { applyStyle(styleNode); std::string name = m_style->tag(); std::string source = m_style->source(); m_style->merge(styleNode); m_style->setTag(name); m_style->setSource(source); updateStyle(); }
void QSvgRect::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); if (m_rx || m_ry) { QT_SVG_DRAW_SHAPE(p->drawRoundedRect(m_rect, m_rx, m_ry, Qt::RelativeSize)); } else { QT_SVG_DRAW_SHAPE(p->drawRect(m_rect)); } revertStyle(p, states); }
void QSvgLine::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); if (p->pen().widthF() != 0) { qreal oldOpacity = p->opacity(); p->setOpacity(oldOpacity * states.strokeOpacity); p->drawLine(m_line); p->setOpacity(oldOpacity); } revertStyle(p, states); }
float ofxFontStash2::draw(const string& text, const ofxFontStashStyle& style, float x, float y){ FONT_STASH_PRE_DRAW; ofPushMatrix(); ofScale(1/pixelDensity, 1/pixelDensity); applyStyle(style); float dx = fonsDrawText(fs, x*pixelDensity, y*pixelDensity, text.c_str(), NULL)/pixelDensity; ofPopMatrix(); FONT_STASH_POST_DRAW; return dx; }
void UIWidget::setStyle(const std::string& styleName) { OTMLNodePtr styleNode = g_ui.getStyle(styleName); if(!styleNode) { logTraceError("unable to retrive style '", styleName, "': not a defined style"); return; } applyStyle(styleNode); m_style = styleNode; updateStyle(); }
void MButtonView::notifyItemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { MWidgetView::notifyItemChange(change, value); if (change == QGraphicsItem::ItemEnabledHasChanged) { Q_D(MButtonView); if (!d->controller->isEnabled() && model()->checked()) { style().setModeDisabledSelected(); applyStyle(); } } }
void UIWidget::setStyle(const std::string& styleName) { OTMLNodePtr styleNode = g_ui.getStyle(styleName); if(!styleNode) { g_logger.traceError(stdext::format("unable to retrieve style '%s': not a defined style", styleName)); return; } styleNode = styleNode->clone(); applyStyle(styleNode); m_style = styleNode; updateStyle(); }
void QSvgPolyline::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); if (p->brush().style() != Qt::NoBrush) { QPen save = p->pen(); p->setPen(QPen(Qt::NoPen)); p->drawPolygon(m_poly); p->setPen(save); } p->drawPolyline(m_poly); revertStyle(p, states); }
DeviceDetailViewFrame::DeviceDetailViewFrame(QWidget* content,QWidget *parent) : QWidget(parent), m_logoLabel(0), m_frameTitleLabel(0), m_contentWidget(content), m_frameContainer(0) { prepareUi(); initFrame(); applyStyle(); }
void QSvgG::draw(QPainter *p, QSvgExtraStates &states) { QList<QSvgNode*>::iterator itr = m_renderers.begin(); applyStyle(p, states); while (itr != m_renderers.end()) { QSvgNode *node = *itr; if ((node->isVisible()) && (node->displayMode() != QSvgNode::NoneMode)) node->draw(p, states); ++itr; } revertStyle(p, states); }
ofRectangle ofxFontStash2::getTextBounds( const string &text, const ofxFontStashStyle &style, const float x, const float y ){ applyStyle(style); float bounds[4]={0,0,0,0}; int advance = fonsTextBounds( fs, x*pixelDensity, y*pixelDensity, text.c_str(), NULL, bounds ); advance/=pixelDensity; bounds[0]/=pixelDensity; bounds[1]/=pixelDensity; bounds[2]/=pixelDensity; bounds[3]/=pixelDensity; // here we use the "text advance" instead of the width of the rectangle, // because this includes spaces at the end correctly (the text bounds "x" and "x " are the same, // the text advance isn't). return ofRectangle(bounds[0],bounds[1],advance,bounds[3]-bounds[1]); }
void QSvgUse::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); if (!m_start.isNull()) { p->translate(m_start); } m_link->draw(p, states); if (!m_start.isNull()) { p->translate(-m_start); } revertStyle(p, states); }
void MixerTrackPart::setSelected(bool sel) { if (_selected == sel) return; _selected = sel; emit(selectedChanged(sel)); if (_selected && _group) _group->notifyTrackSelected(this); applyStyle(); }
void QSvgPolyline::draw(QPainter *p, QSvgExtraStates &states) { applyStyle(p, states); qreal oldOpacity = p->opacity(); if (p->brush().style() != Qt::NoBrush) { QPen save = p->pen(); p->setPen(QPen(Qt::NoPen)); p->setOpacity(oldOpacity * states.fillOpacity); p->drawPolygon(m_poly, states.fillRule); p->setPen(save); } if (p->pen().widthF() != 0) { p->setOpacity(oldOpacity * states.strokeOpacity); p->drawPolyline(m_poly); } p->setOpacity(oldOpacity); revertStyle(p, states); }
void MAbstractLayoutPolicy::updateStyle() { Q_D(MAbstractLayoutPolicy); M::Orientation orientation = d->layout->d_ptr->orientation(); const MAbstractLayoutPolicyStyle *style = static_cast<const MAbstractLayoutPolicyStyle *>(MTheme::style( "MAbstractLayoutPolicyStyle", d->styleName, "", "", orientation)); if (d->style != style) { MTheme::releaseStyle(d->style); d->style = style; applyStyle(); } else { MTheme::releaseStyle(style); } }
void Buffer::setColorScheme(const ColorScheme *colorScheme) { // Set the common features of all styles. if (colorScheme->foreground() != -1) { styleSetFore(STYLE_DEFAULT, colorScheme->foreground()); } if (colorScheme->background() != -1) { styleSetBack(STYLE_DEFAULT, colorScheme->background()); } if (colorScheme->caret() != -1) { setCaretFore(colorScheme->caret()); } if (colorScheme->caretLine() != -1) { setCaretLineBack(colorScheme->caretLine()); } if (colorScheme->selection() == -1) { setSelBack(false, 0); } else { setSelBack(true, colorScheme->selection()); } // Copy common features of all styles. styleClearAll(); // Set styles for the current language. if (m_language) { // Set the foreground of whitespace when there is no style defined by // the lexer. setWhitespaceFore(false, 0); styleSetFore(0, colorScheme->whitespaceForeground()); // Set up the lexer styles QHash<int, StyleInfo> styles = colorScheme->stylesForLanguage( m_language->langId()); QHashIterator<int, StyleInfo> styleIter(styles); while (styleIter.hasNext()) { styleIter.next(); applyStyle(styleIter.key(), styleIter.value()); } } else { setWhitespaceFore(true, colorScheme->whitespaceForeground()); } }
/*! */ void DiaOutputDev::_fill (GfxState *state, bool winding) { GArray *points = g_array_new (FALSE, FALSE, sizeof(BezPoint)); DiaObject *obj = NULL; GfxPath *path = state->getPath(); bool haveClose = true; if (doPath (points, state, path, haveClose)) { if (path->getNumSubpaths() == 1 && haveClose) obj = create_standard_beziergon (points->len, &g_array_index (points, BezPoint, 0)); else obj = create_standard_path (points->len, &g_array_index (points, BezPoint, 0)); applyStyle (obj, true); } g_array_free (points, TRUE); if (obj) { dia_object_set_meta (obj, "fill-rule", winding ? "winding" : "even-odd"); addObject (obj); } }
/*! * \brief create a _Bezierline or _StdPath from the graphics state */ void DiaOutputDev::stroke (GfxState *state) { GArray *points = g_array_new (FALSE, FALSE, sizeof(BezPoint)); DiaObject *obj = NULL; GfxPath *path = state->getPath(); bool haveClose = false; if (doPath (points, state, path, haveClose) && points->len > 1) { if (path->getNumSubpaths() == 1) { if (!haveClose) obj = create_standard_bezierline (points->len, &g_array_index (points, BezPoint, 0), NULL, NULL); else obj = create_standard_beziergon (points->len, &g_array_index (points, BezPoint, 0)); } else { obj = create_standard_path (points->len, &g_array_index (points, BezPoint, 0)); } applyStyle (obj, false); } g_array_free (points, TRUE); if (obj) addObject (obj); }
Static void applyStyles(void) { short n1, n2, sn; Char s[256]; Char STR2[256]; *voices = '\0'; *clefs = '\0'; ninstr = 0; while (*cline[(long)style] != '\0') { n1 = voiceCount(voices) + 1; n2 = wordCount(voices) + 1; GetNextWord(s, cline[(long)style], blank_, comma_); curtail(s, comma_); sn = findStyle(s); if (sn == 0) { sprintf(STR2, "Style %s unknown", s); error(STR2, print); } line_no = orig_style_line[sn-1]; applyStyle(known_style[sn-1], s, n1, n2); style_used[sn-1] = true; } }