void CodeFormatterDlg::OnCheckBox( wxCommandEvent& event ) { size_t flag(0); wxObject *obj = event.GetEventObject(); if (obj == m_checkBoxFormatBreakBlocks) { flag = AS_BREAK_BLOCKS; } else if (obj == m_checkBoxFormatBreakBlocksAll) { flag = AS_BREAK_BLOCKS_ALL; } else if (obj == m_checkBoxFormatBreakElseif) { flag = AS_BREAK_ELSEIF; } else if (obj == m_checkBoxFormatFillEmptyLines) { flag = AS_FILL_EMPTY_LINES; } else if (obj == m_checkBoxFormatOneLineKeepBlocks) { flag = AS_ONE_LINE_KEEP_BLOCKS; } else if (obj == m_checkBoxFormatOneLineKeepStmnt) { flag = AS_ONE_LINE_KEEP_STATEMENT; } else if (obj == m_checkBoxFormatPadOperators) { flag = AS_PAD_OPER; } else if (obj == m_checkBoxFormatPadParenth) { flag = AS_PAD_PARENTHESIS; } else if (obj == m_checkBoxFormatPadParentIn) { flag = AS_PAD_PARENTHESIS_IN; } else if (obj == m_checkBoxFormatPadParentOut) { flag = AS_PAD_PARENTHESIS_OUT; } else if (obj == m_checkBoxFormatUnPadParent) { flag = AS_UNPAD_PARENTHESIS; } else if (obj == m_checkBoxIndentBrackets) { flag = AS_INDENT_BRACKETS; } else if (obj == m_checkBoxIndentLabels) { flag = AS_INDENT_LABELS; } else if (obj == m_checkBoxIndentMaxInst) { flag = AS_MAX_INSTATEMENT_INDENT; } else if (obj == m_checkBoxIndentMinCond) { flag = AS_MIN_COND_INDENT; } else if (obj == m_checkBoxIndentNamespaces) { flag = AS_INDENT_NAMESPACES; } else if (obj == m_checkBoxIndentPreprocessors) { flag = AS_INDENT_PREPROCESSORS; } else if (obj == m_checkBoxIndetBlocks) { flag = AS_INDENT_BLOCKS; } else if (obj == m_checkBoxIndetCase) { flag = AS_INDENT_CASE; } else if (obj == m_checkBoxIndetClass) { flag = AS_INDENT_CLASS; } else if (obj == m_checkBoxIndetSwitch) { flag = AS_INDENT_SWITCHES; } size_t options = m_options.GetOptions(); EnableFlag(options, flag, event.IsChecked()); m_options.SetOption(options); UpdatePreview(); }
void SpectatorAddonMsg::CreateAura(uint32 _caster, uint32 _spellId, bool _isDebuff, uint8 _type, int32 _duration, int32 _expire, uint16 _stack, bool _isRemove) { if (!CanSandAura(_spellId)) return; aCaster = _caster; aSpellId = _spellId; aIsDebuff = _isDebuff; aType = _type; aDuration = _duration; aExpire = _expire; aStack = _stack; aRemove = _isRemove; EnableFlag(SPECTATOR_PREFIX_AURA); }
void LexerConf::FromXml(wxXmlNode* element) { if(element) { m_flags = 0; m_name = element->GetPropVal(wxT("Name"), wxEmptyString); m_name.MakeLower(); m_lexerId = XmlUtils::ReadLong(element, wxT("Id"), 0); m_themeName = XmlUtils::ReadString(element, "Theme", "Default"); EnableFlag(kIsActive, XmlUtils::ReadBool(element, "IsActive", false)); EnableFlag(kUseCustomTextSelectionFgColour, XmlUtils::ReadBool(element, "UseCustomTextSelFgColour", false)); EnableFlag(kStyleInPP, element->GetPropVal(wxT("StylingWithinPreProcessor"), wxT("yes")) == wxT("yes") ? true : false); // load key words wxXmlNode* node = NULL; for(int i = 0; i < 10; ++i) { wxString tagName = "KeyWords"; tagName << i; node = XmlUtils::FindFirstByTagName(element, tagName); if(node) { wxString content = node->GetNodeContent(); content.Replace("\r", ""); content.Replace("\n", " "); content.Replace("\\", " "); m_keyWords[i] = content; } } // load extensions node = XmlUtils::FindFirstByTagName(element, wxT("Extensions")); if(node) { m_extension = node->GetNodeContent(); // Make sure that CMake includes the CMakeLists.txt file if(m_lexerId == wxSTC_LEX_CMAKE) { if(!m_extension.Contains("CMakeLists.txt")) { m_extension = "*.cmake;*.CMAKE;*CMakeLists.txt"; } } } // Hack: add RawString property to the lexers if not exist // By default, we use the settings defined for the wxSTC_C_STRING // property bool isCxxLexer = (m_lexerId == wxSTC_LEX_CPP); bool hasRawString = false; // Keey NULL property StyleProperty stringProp; stringProp.SetId(STYLE_PROPERTY_NULL_ID); // load properties // Search for <properties> node = XmlUtils::FindFirstByTagName(element, wxT("Properties")); if(node) { // We found the element, read the attributes wxXmlNode* prop = node->GetChildren(); while(prop) { if(prop->GetName() == wxT("Property")) { // Read the font attributes wxString Name = XmlUtils::ReadString(prop, wxT("Name"), wxT("DEFAULT")); wxString bold = XmlUtils::ReadString(prop, wxT("Bold"), wxT("no")); wxString italic = XmlUtils::ReadString(prop, wxT("Italic"), wxT("no")); wxString eolFill = XmlUtils::ReadString(prop, wxT("EolFilled"), wxT("no")); wxString underline = XmlUtils::ReadString(prop, wxT("Underline"), wxT("no")); wxString strikeout = XmlUtils::ReadString(prop, wxT("Strikeout"), wxT("no")); wxString face = XmlUtils::ReadString(prop, wxT("Face"), wxT("Courier")); wxString colour = XmlUtils::ReadString(prop, wxT("Colour"), wxT("black")); wxString bgcolour = XmlUtils::ReadString(prop, wxT("BgColour"), wxT("white")); long fontSize = XmlUtils::ReadLong(prop, wxT("Size"), 10); long propId = XmlUtils::ReadLong(prop, wxT("Id"), 0); long alpha = XmlUtils::ReadLong(prop, wxT("Alpha"), 50); // Mainly for upgrade purposes: check if already read // the StringRaw propery if(isCxxLexer && !hasRawString && propId == wxSTC_C_STRINGRAW) { hasRawString = true; } StyleProperty property = StyleProperty(propId, colour, bgcolour, fontSize, Name, face, StringTolBool(bold), StringTolBool(italic), StringTolBool(underline), StringTolBool(eolFill), alpha); if(isCxxLexer && propId == wxSTC_C_STRING) { stringProp = property; } m_properties.insert(std::make_pair(propId, property)); } prop = prop->GetNext(); } // If we don't have the raw string style property, // copy the string property and add it if(isCxxLexer && !hasRawString && !stringProp.IsNull()) { stringProp.SetId(wxSTC_C_STRINGRAW); stringProp.SetName("Raw String"); m_properties.insert(std::make_pair(wxSTC_C_STRINGRAW, stringProp)); } } } }