static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { // create and initialize a WindowAccessor (including contained PropSet) PropSet ps; ps.SetMultiple(props); WindowAccessor wa(window, ps); // create and initialize WordList(s) int nWL = 0; for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs int i = 0; for (; i < nWL; i++) { wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) wl[i]->Set(words[i]); } wl[i] = 0; // call our "internal" folder/lexer (... then do Flush!) if (foldOrLex) FoldCamlDoc(startPos, length, initStyle, wl, wa); else ColouriseCamlDoc(startPos, length, initStyle, wl, wa); wa.Flush(); // clean up before leaving for (i = nWL - 1; i >= 0; i--) delete wl[i]; delete [] wl; }
//------------------------------------------------------------------------- bool MLogPropDataArr::LoadChildDataFromDb(std::shared_ptr<IModel>& child, std::shared_ptr<whTable>& table, const size_t pos) { bool ret = TTableDataArr<MLogPropItem>::LoadChildDataFromDb(child, table, pos); auto childModel = std::dynamic_pointer_cast<MLogPropItem>(child); if (!ret || !childModel) return false; ret = false; long prop_id = 0; long act_id = 0; long visible = !childModel->GetData().at(4).IsNull() ; if (childModel->GetData().at(0).ToLong(&prop_id) && childModel->GetData().at(3).ToLong(&act_id) && visible ) { auto it = mPropAct.find(prop_id); if (it == mPropAct.end()) ret = true; PropSet tmp = mPropAct[prop_id]; tmp.insert(std::make_pair(act_id, childModel)); mPropAct[prop_id] = tmp; } return ret; }
void read_stacking_cfg(ConfigFile& cf) { ConfigElem elem; if( cf.read( elem ) ) { if (elem.type_is( "Stacking" )) { string temp = elem.remove_string( "IgnoreCprops" ); ISTRINGSTREAM is( temp ); string cprop_name; while (is >> cprop_name) Global_Ignore_CProps.insert(cprop_name); } }
void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { PropSet ps; ps.SetMultiple(props); WindowAccessor wa(window, ps); int nWL = 0; for (; words[nWL]; nWL++) ; WordList** wl = new WordList* [nWL + 1]; int i = 0; for (; i<nWL; i++) { wl[i] = new WordList(); wl[i]->Set(words[i]); } wl[i] = 0; ColorizeHaskellDoc(startPos, length, initStyle, wl, wa); wa.Flush(); for (i=nWL-1;i>=0;i--) delete wl[i]; delete [] wl; }
// Scintilla lexer entry point. void LexOrFold(bool foldOrLex, unsigned int startPos, int length, int initStyle, char *words[], WindowID window, char *props) { // Create and initialize the WindowAccessor (including contained PropSet) PropSet ps; ps.SetMultiple(props); WindowAccessor wa(window, ps); // Create and initialize WordList(s). // If you have an extremely large word file, or lots of styling rules you may want to speed // up processing by storing the wordlists instead of reprocessing them on each call. int nWL = 0; for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs int i = 0; for (; i < nWL; i++) { wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) wl[i]->Set(words[i]); } wl[i] = 0; // Set the currView handle to update at least once per lexer call. npp_plugin::hCurrViewNeedsUpdate(); // Call the internal folding and styling functions. // foldOrLex is false for lex and true for fold if (foldOrLex) { // This is a nice helpful routine to back up a line to fix broken folds. int lineCurrent = wa.GetLine(startPos); if (lineCurrent > 0) { lineCurrent--; int newStartPos = wa.LineStart(lineCurrent); length += startPos - newStartPos; startPos = newStartPos; initStyle = 0; if (startPos > 0) { initStyle = wa.StyleAt(startPos - 1); } } Fold_Doc(startPos, length, initStyle, wl, wa); } else { // You may want to put a routine here to backtrack past leaking styles, typically // multiline styles, or just put such logic in the Colour_Doc function itself. Just // be sure to do it prior to creating your Style Context. Colourise_Doc(startPos, length, initStyle, wl, wa); } // The flush function is what actually finalizes settings the styles you just coloured. wa.Flush(); // Clean up the wordlists before leaving. for (i = nWL - 1; i >= 0; i--) delete wl[i]; delete [] wl; }