StyleRuleBase* BisonCSSParser::createFontFaceRule() { m_allowImportRules = m_allowNamespaceDeclarations = false; for (unsigned i = 0; i < m_parsedProperties.size(); ++i) { CSSProperty& property = m_parsedProperties[i]; if (property.id() == CSSPropertyFontVariant && property.value()->isPrimitiveValue()) property.wrapValueInCommaSeparatedList(); else if (property.id() == CSSPropertyFontFamily && (!property.value()->isValueList() || toCSSValueList(property.value())->length() != 1)) { // Unlike font-family property, font-family descriptor in @font-face rule // has to be a value list with exactly one family name. It cannot have a // have 'initial' value and cannot 'inherit' from parent. // See http://dev.w3.org/csswg/css3-fonts/#font-family-desc clearProperties(); return 0; } } RefPtrWillBeRawPtr<StyleRuleFontFace> rule = StyleRuleFontFace::create(); rule->setProperties(createStylePropertySet()); clearProperties(); StyleRuleFontFace* result = rule.get(); m_parsedRules.append(rule.release()); if (m_styleSheet) m_styleSheet->setHasFontFaceRule(true); return result; }
void InstrumentWidgetMaskTab::setProperties() { clearProperties(); m_userEditing = false; // bounding rect property QtProperty *boundingRectGroup = m_groupManager->addProperty("Bounding Rect"); m_browser->addProperty(boundingRectGroup); m_left = addDoubleProperty("left"); m_top = addDoubleProperty("top"); m_right = addDoubleProperty("right"); m_bottom = addDoubleProperty("bottom"); boundingRectGroup->addSubProperty(m_left); boundingRectGroup->addSubProperty(m_top); boundingRectGroup->addSubProperty(m_right); boundingRectGroup->addSubProperty(m_bottom); // point properties QStringList pointProperties = m_instrWidget->getSurface()->getCurrentPointNames(); foreach (QString name, pointProperties) { QtProperty *point = m_groupManager->addProperty(name); QtProperty *prop_x = addDoubleProperty("x"); QtProperty *prop_y = addDoubleProperty("y"); point->addSubProperty(prop_x); point->addSubProperty(prop_y); m_browser->addProperty(point); m_pointComponentsMap[prop_x] = name; m_pointComponentsMap[prop_y] = name; m_pointPropertyMap[name] = point; }
bool BisonCSSParser::parseDeclaration(MutableStylePropertySet* declaration, const String& string, CSSParserObserver* observer, StyleSheetContents* contextStyleSheet) { setStyleSheet(contextStyleSheet); TemporaryChange<CSSParserObserver*> scopedObsever(m_observer, observer); setupParser("@-internal-decls ", string, ""); if (m_observer) { m_observer->startRuleHeader(StyleRule::Style, 0); m_observer->endRuleHeader(1); m_observer->startRuleBody(0); } { StyleDeclarationScope scope(this, declaration); cssyyparse(this); } m_rule = nullptr; bool ok = false; if (!m_parsedProperties.isEmpty()) { ok = true; declaration->addParsedProperties(m_parsedProperties); clearProperties(); } if (m_observer) m_observer->endRuleBody(string.length(), false); return ok; }
bool BisonCSSParser::parseValue(MutableStylePropertySet* declaration, CSSPropertyID propertyID, const String& string, bool important) { if (m_context.useCounter()) m_context.useCounter()->count(m_context, propertyID); setupParser("@-internal-value ", string, ""); m_id = propertyID; m_important = important; { StyleDeclarationScope scope(this, declaration); cssyyparse(this); } m_rule = nullptr; m_id = CSSPropertyInvalid; bool ok = false; if (!m_parsedProperties.isEmpty()) { ok = true; declaration->addParsedProperties(m_parsedProperties); clearProperties(); } return ok; }
void SpriteInspector::onAppEvent(const ds::Event& in_e){ if(in_e.mWhat == InspectSpriteRequest::WHAT()){ const InspectSpriteRequest& e((const InspectSpriteRequest&)in_e); inspectSprite(e.mSprid); } else if(in_e.mWhat == RefreshLayoutRequest::WHAT() || in_e.mWhat == LoadLayoutRequest::WHAT()){ clearProperties(); } else if(in_e.mWhat == InputFieldTextInput::WHAT()){ if(mCurrentInputTreeItem && mLinkedSprite){ const InputFieldTextInput& e((const InputFieldTextInput&)in_e); std::string valueText = ds::utf8_from_wstr(e.mFullText); mCurrentInputTreeItem->setValueText(e.mFullText); ds::ui::XmlImporter::setSpriteProperty(*mLinkedSprite, mCurrentInputTreeItem->getPropertyName(), valueText, ""); mEngine.getNotifier().notify(LayoutLayoutRequest()); layout(); } } else if(in_e.mWhat == InputFieldCleared::WHAT()){ setInputField(nullptr); } else if (in_e.mWhat == MouseMoveEvent::WHAT()) { const MouseMoveEvent& e( (const MouseMoveEvent&)in_e ); if (this->contains(e.mMousePoint)) { mEngine.getNotifier().notify(ShowSpriteHighlightEvent(mLinkedSprite)); } } }
BisonCSSParser::~BisonCSSParser() { clearProperties(); deleteAllValues(m_floatingSelectors); deleteAllValues(m_floatingSelectorVectors); deleteAllValues(m_floatingValueLists); deleteAllValues(m_floatingFunctions); }
PassRefPtrWillBeRawPtr<ImmutableStylePropertySet> BisonCSSParser::parseDeclaration(const String& string, StyleSheetContents* contextStyleSheet) { setStyleSheet(contextStyleSheet); setupParser("@-internal-decls ", string, ""); cssyyparse(this); m_rule = nullptr; RefPtrWillBeRawPtr<ImmutableStylePropertySet> style = createStylePropertySet(); clearProperties(); return style.release(); }
void AbstractWorkflow::setCurrentStage(int stage) { int oldStage = _currentStage; _currentStage = stage; // update visible properties clearProperties(); Stage* s = _stages[_currentStage]; for (auto it = s->_visibleProperties.begin(); it != s->_visibleProperties.end(); ++it) { addProperty(**it); } // notify the outer world s_stageChanged.emitSignal(oldStage, _currentStage); }
StyleRuleBase* BisonCSSParser::createStyleRule(Vector<OwnPtr<CSSParserSelector>>* selectors) { StyleRule* result = 0; if (selectors) { m_allowImportRules = m_allowNamespaceDeclarations = false; RefPtrWillBeRawPtr<StyleRule> rule = StyleRule::create(); rule->parserAdoptSelectorVector(*selectors); rule->setProperties(createStylePropertySet()); result = rule.get(); m_parsedRules.append(rule.release()); CSSSelectorParser::recordSelectorStats(m_context, result->selectorList()); } clearProperties(); return result; }
StyleRuleKeyframe* BisonCSSParser::createKeyframe(CSSParserValueList* keys) { OwnPtr<Vector<double>> keyVector = StyleRuleKeyframe::createKeyList(keys); if (keyVector->isEmpty()) return 0; RefPtrWillBeRawPtr<StyleRuleKeyframe> keyframe = StyleRuleKeyframe::create(); keyframe->setKeys(keyVector.release()); keyframe->setProperties(createStylePropertySet()); clearProperties(); StyleRuleKeyframe* keyframePtr = keyframe.get(); m_parsedKeyframes.append(keyframe.release()); return keyframePtr; }
StyleRuleBase* BisonCSSParser::createPageRule(PassOwnPtr<CSSParserSelector> pageSelector) { // FIXME: Margin at-rules are ignored. m_allowImportRules = m_allowNamespaceDeclarations = false; StyleRulePage* pageRule = 0; if (pageSelector) { RefPtrWillBeRawPtr<StyleRulePage> rule = StyleRulePage::create(); Vector<OwnPtr<CSSParserSelector>> selectorVector; selectorVector.append(pageSelector); rule->parserAdoptSelectorVector(selectorVector); rule->setProperties(createStylePropertySet()); pageRule = rule.get(); m_parsedRules.append(rule.release()); } clearProperties(); return pageRule; }
StyleRuleBase* BisonCSSParser::createViewportRule() { // Allow @viewport rules from UA stylesheets even if the feature is disabled. if (!RuntimeEnabledFeatures::cssViewportEnabled() && !isUASheetBehavior(m_context.mode())) return 0; m_allowImportRules = m_allowNamespaceDeclarations = false; RefPtrWillBeRawPtr<StyleRuleViewport> rule = StyleRuleViewport::create(); rule->setProperties(createStylePropertySet()); clearProperties(); StyleRuleViewport* result = rule.get(); m_parsedRules.append(rule.release()); return result; }
/** * Slot responding on deselecting all masking shapes. */ void InstrumentWindowMaskTab::shapesDeselected() { clearProperties(); }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> MetaObject::~MetaObject() { clearProperties(); }
void SpriteInspector::inspectSprite(ds::ui::Sprite* sp) { clearProperties(); if(!sp) return; mLinkedSprite = sp; // todo: make this an xml mLayout = new ds::ui::LayoutSprite(mEngine); mLayout->setSpriteName(L"This layout"); mLayout->setLayoutType(ds::ui::LayoutSprite::kLayoutVFlow); //mLayout->setSpacing(5.0f); mLayout->setShrinkToChildren(ds::ui::LayoutSprite::kShrinkBoth); mLayout->setTransparent(false); mLayout->setColor(ci::Color(0.2f, 0.2f, 0.2f)); addChildPtr(mLayout); addSpriteProperty(L"name", sp->getSpriteName()); addSpriteProperty(L"type", ds::wstr_from_utf8(ds::ui::XmlImporter::getSpriteTypeForSprite(sp))); addSpriteProperty(L"size", sp->getSize()); addSpriteProperty(L"color", sp->getColor()); addSpriteProperty(L"opacity", sp->getOpacity()); addSpriteProperty(L"center", sp->getCenter()); addSpriteProperty(L"position", sp->getPosition()); addSpriteProperty(L"rotation", sp->getRotation()); addSpriteProperty(L"scale", sp->getScale()); addSpriteProperty(L"clipping", sp->getClipping()); addSpritePropertyBlend(L"blend_mode", sp->getBlendMode()); addSpriteProperty(L"enable", sp->isEnabled()); addSpriteProperty(L"multitouch", sp->getMultiTouchConstraints()); addSpriteProperty(L"transparent", sp->getTransparent()); addSpriteProperty(L"animate_on", ds::wstr_from_utf8(sp->getAnimateOnScript())); addSpriteProperty(L"t_pad", sp->mLayoutTPad); addSpriteProperty(L"l_pad", sp->mLayoutLPad); addSpriteProperty(L"b_pad", sp->mLayoutBPad); addSpriteProperty(L"r_pad", sp->mLayoutRPad); addSpriteProperty(L"layout_fudge", sp->mLayoutFudge); addSpriteProperty(L"layout_size", sp->mLayoutSize); addSpritePropertyLayoutSizeMode(L"layout_size_mode", sp->mLayoutUserType); addSpritePropertyLayoutVAlign(L"layout_v_align", sp->mLayoutVAlign); addSpritePropertyLayoutHAlign(L"layout_h_align", sp->mLayoutHAlign); ds::ui::LayoutSprite* ls = dynamic_cast<ds::ui::LayoutSprite*>(mLinkedSprite); if(ls){ addSpritePropertyLayoutType(L"layout_type", ls->getLayoutType()); addSpriteProperty(L"layout_spacing", ls->getSpacing()); addSpritePropertyLayoutShrink(L"shrink_to_children", ls->getShrinkToChildren()); addSpritePropertyLayoutVAlign(L"overall_alignment", ls->getOverallAlignment()); } ds::ui::Text* texty = dynamic_cast<ds::ui::Text*>(mLinkedSprite); if(texty){ addSpriteProperty(L"text", texty->getText()); addSpriteProperty(L"font", ds::wstr_from_utf8(texty->getConfigName())); // addSpriteProperty(L"font_size", texty->getFontSize()); } ds::ui::MultilineText* multitexty = dynamic_cast<ds::ui::MultilineText*>(mLinkedSprite); if(multitexty){ addSpriteProperty(L"resize_limit", ci::Vec2f(multitexty->getResizeLimitWidth(), multitexty->getResizeLimitHeight())); addSpritePropertyLayoutHAlign(L"text_align", multitexty->getAlignment()); } ds::ui::Gradient* grad = dynamic_cast<ds::ui::Gradient*>(mLinkedSprite); if(grad){ addSpriteProperty(L"gradientColors", ds::wstr_from_utf8(ds::ui::XmlImporter::getGradientColorsAsString(grad))); } ds::ui::Circle* circle = dynamic_cast<ds::ui::Circle*>(mLinkedSprite); if(circle){ addSpriteProperty(L"filled", circle->getFilled()); addSpriteProperty(L"radius", circle->getRadius()); } ds::ui::Border* border = dynamic_cast<ds::ui::Border*>(mLinkedSprite); if(border){ addSpriteProperty(L"border_width", border->getBorderWidth()); } ds::ui::Image* img = dynamic_cast<ds::ui::Image*>(mLinkedSprite); if(img){ addSpriteProperty(L"filename", ds::wstr_from_utf8(ds::Environment::contract(img->getImageFilename()))); addSpriteProperty(L"circle_crop", img->getCircleCrop()); } ds::ui::ImageButton* imgB = dynamic_cast<ds::ui::ImageButton*>(mLinkedSprite); if(imgB){ std::string normImgFile = ds::Environment::contract(imgB->getNormalImage().getImageFilename()); std::string highImgFile = ds::Environment::contract(imgB->getHighImage().getImageFilename()); if(normImgFile == highImgFile){ addSpriteProperty(L"filename", ds::wstr_from_utf8(normImgFile)); } else { addSpriteProperty(L"up_image", ds::wstr_from_utf8(normImgFile)); addSpriteProperty(L"down_image", ds::wstr_from_utf8(highImgFile)); } addSpriteProperty(L"btn_touch_padding", imgB->getPad()); addSpriteProperty(L"down_image_color", imgB->getHighImageColor()); } layout(); animateOn(); }