52 for (OptionSetsMap::const_iterator it = other.
m_Sets.begin(); it != other.
m_Sets.end(); ++it)
56 mset.
m_Langs = it->second.m_Langs;
69 mset.
comment = it->second.comment;
71 const OptionColours& value = it->second.m_Colours;
72 for (
unsigned int i = 0; i < value.GetCount(); ++i)
86 for (OptionSetsMap::iterator map_it =
m_Sets.begin();
87 map_it !=
m_Sets.end(); ++map_it)
89 for (OptionColours::iterator vec_it = (*map_it).second.m_Colours.begin();
90 vec_it != (*map_it).second.m_Colours.end(); ++vec_it)
107 std::list<LoaderBase*> loaders;
118 loaders.push_back(fm->
Load(path + filename));
134 loaders.push_back(fm->
Load(path + filename));
142 for (std::list<LoaderBase*>::iterator it = loaders.begin(); it != loaders.end(); ++it)
148 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
157 it->second.m_originalKeywords[i] = it->second.m_Keywords[i];
159 it->second.m_originalFileMasks = it->second.m_FileMasks;
163 while (i < it->second.m_Colours.GetCount())
167 if (opt->
value < 0 &&
171 it->second.m_Colours.Remove(opt);
192 while (pos < name.
Length())
209 m_Sets[newID].m_Langs = name;
210 m_Sets[newID].m_Lexers = lexer;
220 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
222 if (it->second.m_Langs.CmpNoCase(name) == 0)
232 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
234 if (it->second.m_Lexers == lexer)
249 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
254 ret.
Add(it->second.m_Langs);
267 for (
unsigned int i = 0; i < mset.
m_Colours.GetCount(); ++i)
280 for (
unsigned int i = 0; i < mset.
m_Colours.GetCount(); ++i)
303 OptionColours& colours =
m_Sets[lang].m_Colours;
348 for (
unsigned int i = 0; i < mset.
m_Colours.GetCount(); ++i)
351 if (opt->
name == name)
363 for (
unsigned int i = 0; i < mset.
m_Colours.GetCount(); ++i)
366 if (opt->
value == value)
376 return m_Sets[lang].m_Colours.Item(index);
382 return m_Sets[lang].m_Colours.GetCount();
397 for (
size_t i = 0; i < mset.
m_Colours.GetCount(); ++i)
400 if (opt->
name ==
wxT(
"Default"))
415 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
417 for (
unsigned int x = 0; x < it->second.m_FileMasks.GetCount(); ++x)
419 if (lfname.
Matches(it->second.m_FileMasks.Item(x)))
429 if (input.
IsOk() && !input.Eof() )
433 wxRegEx reSheBang(
wxT(
"#![ \t]*([a-zA-Z/]+)[ \t]*([a-zA-Z/]*)"));
441 if (prog ==
wxT(
"sh"))
453 "algorithm|" "atomic|" "array|" "bitset|" 454 "chrono|" "complex|" "condition_variable|" "deque|" 455 "exception|" "fstream|" "forward_list|" "future|" 456 "functional|" "hash_map|" "hash_set|" "initializer_list|" 457 "iomanip|" "ios|" "iostream|" "istream|" 458 "iterator|" "limits|" "list|" "locale|" 459 "map|" "memory|" "mutex|" "new|" 460 "numeric|" "ostream|" "queue|" "random|" 461 "ratio|" "regex|" "set|" "sstream|" 462 "stack|" "stdexcept|" "streambuf|" "string|" 463 "strstream|" "system_error|" "thread|" "tuple|" 464 "typeinfo|" "type_traits|" "unordered_map|" "unordered_set|" 465 "utility|" "valarray|" "vector|" 467 "cassert|" "cctype|" "cerrno|" "cfenv|" "cfloat|" 468 "cinttypes|" "ciso646|" "climits|" "clocale|" "cmath|" 469 "csetjmp|" "csignal|" "cstdarg|" "cstdbool|" "cstddef|" 470 "cstdint|" "cstdio|" "cstdlib|" "cstring|" "ctgmath|" 471 "ctime|" "cuchar|" "cwchar|" "cwctype|" );
487 return _(
"Plain text");
529 for (
size_t i = 0; i < mset.
m_Colours.GetCount(); ++i)
532 if (opt->
name ==
wxT(
"Default"))
558 control->SetStyleBits(control->GetStyleBitsNeeded());
561 int countStyles = 1 << control->GetStyleBits();
564 for (
int i = 0; i <= countStyles; ++i)
576 for (
unsigned int i = 0; i < mset.
m_Colours.GetCount(); ++i)
641 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
650 key <<
_T(
"/colour_sets/") <<
m_Name <<
_T(
'/') << lang;
651 for (
unsigned int i = 0; i < it->second.m_Colours.GetCount(); ++i)
699 if (it->second.m_Keywords[i] != it->second.m_originalKeywords[i])
701 tmpkey.
Printf(
_T(
"%s/editor/keywords/set%d"), key.
c_str(), i);
702 cfg->
Write(tmpkey, it->second.m_Keywords[i]);
709 if (tmparr != tmparrorig)
711 cfg->
Write(tmpkey, tmparr);
716 cfg->
Write(key +
_T(
"/name"), it->second.m_Langs);
726 static bool s_notifiedUser =
false;
735 for (OptionSetsMap::iterator it =
m_Sets.begin(); it !=
m_Sets.end(); ++it)
750 cbMessageBox(
_(
"The way editor syntax highlighting configuration is saved, has changed.\n" 751 "Syntax highlighting for all supported languages will revert to defaults now.\n" 752 "We 're sorry for the inconvenience..."),
755 s_notifiedUser =
true;
764 key <<
_T(
"/colour_sets/") <<
m_Name <<
_T(
'/') << it->first;
765 if (!cfg->
Exists(key +
_T(
"/name")))
772 for (
unsigned int i = 0; i < it->second.m_Colours.GetCount(); ++i)
776 if (!cfg->
Exists(tmpKey +
_T(
"/name")))
783 for (
size_t j = 0; j < it->second.m_Colours.GetCount(); ++j)
786 if (!opt || opt->
name != name)
789 if (cfg->
Exists(tmpKey +
_T(
"/fore")))
791 if (cfg->
Exists(tmpKey +
_T(
"/back")))
793 if (cfg->
Exists(tmpKey +
_T(
"/bold")))
795 if (cfg->
Exists(tmpKey +
_T(
"/italics")))
797 if (cfg->
Exists(tmpKey +
_T(
"/underlined")))
799 if (cfg->
Exists(tmpKey +
_T(
"/isStyle")))
806 tmpkey.
Printf(
_T(
"%s/editor/keywords/set%d"), key.
c_str(), i);
823 key <<
_T(
"/colour_sets/") <<
m_Name <<
_T(
'/') << lang;
824 if (
Manager::Get()->GetConfigManager(
_T(
"editor"))->Exists(key +
_T(
"/name")))
836 return m_Sets[lang].m_Keywords[idx];
846 #if wxCHECK_VERSION(3, 0, 0) 862 while (*src && *src <
_T(
' '))
879 return m_Sets[lang].m_FileMasks;
907 shortname =
_T(
"lexer_") + lang +
_T(
".sample");
914 return path + shortname;
920 return path + shortname;
941 m_Sets[lang].comment = token;
958 com =
m_Sets[lang].comment;
968 m_Sets[lang].m_CaseSensitive = CaseSensitive;
976 return m_Sets[lang].m_CaseSensitive;
void SetSampleCode(HighlightLanguage lang, const wxString &sample, int breakLine, int debugLine, int errorLine)
wxString AfterLast(wxUniChar ch) const
wxString F(const wxChar *msg,...)
sprintf-like function
DLLIMPORT wxArrayString GetArrayFromString(const wxString &text, const wxString &separator=DEFAULT_ARRAY_SEP, bool trimSpaces=true)
DLLIMPORT bool Add(const wxString &name, const wxString &mask)
Add a new extension filter.
wxString GetLanguageName(HighlightLanguage lang)
static wxString GetFolder(SearchDirs dir)
Access one of Code::Blocks' folders.
bool Matches(const wxString &mask) const
Data folder in user's dir.
void SetSelForeground(bool useSetting, const wxColour &fore)
Set the foreground colour of the main and additional selections and whether to use this setting...
void StyleClearAll()
Clear all the styles and make equivalent to the global default style.
bool wxIsspace(const wxUniChar &c)
void Delete(std::vector< T > &s)
ConfigManager * GetConfigManager(const wxString &name_space) const
static Manager * Get()
Use Manager::Get() to get a pointer to its instance Manager::Get() is guaranteed to never return an i...
void DoApplyStyle(cbStyledTextCtrl *control, int value, OptionColour *option)
bool GetFirst(wxString *filename, const wxString &filespec=wxEmptyString, int flags=wxDIR_DEFAULT) const
bool wxFileExists(const wxString &filename)
HighlightLanguage GetLanguageForFilename(const wxString &filename)
bool ReadBool(const wxString &name, bool defaultVal=false)
wxColour ReadColour(const wxString &name, const wxColour &defaultVal= *wxBLACK)
OptionColour * GetDefaultOption(HighlightLanguage lang)
bool Open(const wxString &dir)
bool wxDirExists(const wxString &dirname)
bool Matches(const wxString &text, int flags=0) const
static FileManager * Get()
bool wxIsdigit(const wxUniChar &c)
const wxArrayString & GetFileMasks(HighlightLanguage lang)
wxString & GetKeywords(HighlightLanguage lang, int idx)
void AddOption(HighlightLanguage lang, const wxString &name, int value, wxColour fore=wxNullColour, wxColour back=wxNullColour, bool bold=false, bool italics=false, bool underlined=false, bool isStyle=true)
wxString m_PlainTextLexerID
Stores the id of the plain text file lexer (see lexer_plain.xml).
void SetCharacterLexerStyles(HighlightLanguage lang, const std::set< int > &styles)
DLLIMPORT wxString GetStringFromArray(const wxArrayString &array, const wxString &separator=DEFAULT_ARRAY_SEP, bool SeparatorAtEnd=true)
cbStyledTextCtrl * GetLeftSplitViewControl() const
Returns a pointer to the left (or top) split-view cbStyledTextCtrl.
#define wxICON_INFORMATION
void StyleSetBackground(int style, const wxColour &back)
Set the background colour of a style.
void ClearAllOptionColours()
int CmpNoCase(const wxString &s) const
wxUSE_UNICODE_dependent wxChar
static std::map< int, std::set< int > > & GetCharacterLexerStyles()
void StyleSetUnderline(int style, bool underline)
Set a style to be underlined or not.
#define wxSCI_STYLE_LINENUMBER
void Write(const wxString &name, const wxString &value, bool ignoreEmpty=false)
void SetCaretLineBackground(const wxColour &back)
Set the colour of the background of the line containing the caret.
virtual const wxString & GetFilename() const
Get the editor's filename (if applicable).
wxColour GetColour(const wxString &id) const
wxString GetSampleCode(HighlightLanguage lang, int *breakLine, int *debugLine, int *errorLine)
bool Exists(const wxString &name)
void SetSelBackground(bool useSetting, const wxColour &back)
Set the background colour of the main and additional selections and whether to use this setting...
void Load(LoaderBase *loader)
void SetPreprocessorLexerStyles(HighlightLanguage lang, const std::set< int > &styles)
void SetFileMasks(HighlightLanguage lang, const wxString &masks, const wxString &=_(","))
void StyleSetForeground(int style, const wxColour &fore)
Set the foreground colour of a style.
wxUSE_UNICODE_WCHAR_dependent wxStringCharType
void SetKeywords(HighlightLanguage lang, int idx, const wxString &keywords)
void SetCaseSensitivity(HighlightLanguage lang, bool CaseSensitive)
static bool IsBatchBuild()
bool GetMatch(size_t *start, size_t *len, size_t index=0) const
static std::map< int, std::set< int > > & GetStringLexerStyles()
LogManager * GetLogManager() const
wxString Read(const wxString &key, const wxString &defaultVal=wxEmptyString)
static std::map< int, std::set< int > > & GetPreprocessorLexerStyles()
wxArrayString GetAllHighlightLanguages()
const wxStringCharType * wx_str() const
const int cbHIGHLIGHT_LINE
int GetOptionCount(HighlightLanguage lang)
const wxString & _(const wxString &string)
wxString & Trim(bool fromRight=true)
OptionColour * GetOptionByName(HighlightLanguage lang, const wxString &name)
wxString m_Keywords[wxSCI_KEYWORDSET_MAX+1]
#define wxSCI_KEYWORDSET_MAX
Maximum value of keywordSet parameter of SetKeyWords.
cb_must_consume_result LoaderBase * Load(const wxString &file, bool reuseEditors=false)
Loads a file, once this function is called, the actually loading process is done in the worker thread...
void SetLexer(int lexer)
Set the lexing language of the document.
bool wxIsalnum(const wxUniChar &c)
wxArrayString m_originalFileMasks
void Colourise(int start, int end)
Colourise a segment of the document using the current lexing language.
void StyleSetItalic(int style, bool italic)
Set a style to be italic or not.
ColourManager * GetColourManager() const
void SetKeyWords(int keyWordSet, const wxString &keyWords)
Set up the key words used by the lexer.
wxString & Append(const char *psz)
void Reset(HighlightLanguage lang)
bool GetNext(wxString *filename) const
void DeleteSubPath(const wxString &strPath)
bool GetCaseSensitivity(HighlightLanguage lang)
void Log(const wxString &msg, int i=app_log, Logger::level lv=Logger::info)
OptionColour * GetOptionByIndex(HighlightLanguage lang, int index)
static int CompareStringNoCase(const wxString &first, const wxString &second)
bool EndsWith(const wxString &suffix, wxString *rest=NULL) const
void UpdateOptionsWithSameName(HighlightLanguage lang, OptionColour *base)
HighlightLanguage AddHighlightLanguage(int lexer, const wxString &name)
wxString & Prepend(const wxString &str)
size_t Add(const wxString &str, size_t copies=1)
bool StartsWith(const wxString &prefix, wxString *rest=NULL) const
void StyleSetBold(int style, bool bold)
Set a style to be bold or not.
void Sort(bool reverseOrder=false)
wxArrayString m_FileMasks
int Find(wxUniChar ch, bool fromEnd=false) const
wxUniChar GetChar(size_t n) const
HighlightLanguage Apply(cbEditor *editor, HighlightLanguage lang, bool colourise)
void SetStringLexerStyles(HighlightLanguage lang, const std::set< int > &styles)
cbStyledTextCtrl * GetRightSplitViewControl() const
Returns a pointer to the right (or bottom) split-view cbStyledTextCtrl.
int Printf(const wxString &pszFormat,...)
EditorColourSet(const wxString &setName=COLORSET_DEFAULT)
static wxString Format(const wxString &format,...)
wxString m_originalKeywords[wxSCI_KEYWORDSET_MAX+1]
DLLIMPORT int cbMessageBox(const wxString &message, const wxString &caption=wxEmptyString, int style=wxOK, wxWindow *parent=NULL, int x=-1, int y=-1)
wxMessageBox wrapper.
HighlightLanguage GetHighlightLanguage(int lexer)
OptionColour * GetOptionByValue(HighlightLanguage lang, int value)