Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Two problems with r8232
ouch:
I suffered from the grey plague as well... :) Simply hitting the "Reset Defaults" button and saving the changes seemed to fix the conf file. The only thing I change from the defaults is changing the comment colors to grey. That grey-ish blue color messes with my brain... lol
oh, and I'm all for making progress on the lexers, so I say keep the changes even if it breaks everything.
Alpha:
This patch should fix (almost) all custom color scheme loading problems. It also adds evaluation of back-ticked expressions during define collection, and enables preprocessor interpretation by default (it is fine if this last part is left out, however, having tested it on both Windows and Linux now, I think most users would likely prefer it on).
--- Code: ---Index: src/sdk/cbeditor.cpp
===================================================================
--- src/sdk/cbeditor.cpp (revision 8236)
+++ src/sdk/cbeditor.cpp (working copy)
@@ -1576,7 +1576,7 @@
ConfigManager* mgr = Manager::Get()->GetConfigManager(_T("editor"));
// Interpret #if/#else/#endif to grey out code that is not active
- control->SetProperty(_T("lexer.cpp.track.preprocessor"), mgr->ReadBool(_T("/track_preprocessor"), false) ? _T("1") : _T("0"));
+ control->SetProperty(_T("lexer.cpp.track.preprocessor"), mgr->ReadBool(_T("/track_preprocessor"), true) ? _T("1") : _T("0"));
// code folding
if (mgr->ReadBool(_T("/folding/show_folds"), true))
Index: src/sdk/editormanager.cpp
===================================================================
--- src/sdk/editormanager.cpp (revision 8236)
+++ src/sdk/editormanager.cpp (working copy)
@@ -3045,8 +3045,8 @@
{
cbProject* prj = Manager::Get()->GetProjectManager()->GetActiveProject();
if ( !prj
- || !Manager::Get()->GetConfigManager(wxT("editor"))->ReadBool(wxT("/track_preprocessor"), false)
- || !Manager::Get()->GetConfigManager(wxT("editor"))->ReadBool(wxT("/collect_prj_defines"), false) )
+ || !Manager::Get()->GetConfigManager(wxT("editor"))->ReadBool(wxT("/track_preprocessor"), true)
+ || !Manager::Get()->GetConfigManager(wxT("editor"))->ReadBool(wxT("/collect_prj_defines"), true) )
{
event.Skip();
return;
@@ -3067,13 +3067,39 @@
lst = &prj->GetFilesList();
id = prj->GetCompilerID();
}
+ Compiler* comp = CompilerFactory::GetCompiler(id); // get global flags
+ if (comp)
+ AppendArray(comp->GetCompilerOptions(), compilerFlags);
wxArrayString defines;
for (size_t i = 0; i < compilerFlags.Count(); ++i)
{
- if ( (compilerFlags[i].Left(2) == wxT("-D"))
- || (compilerFlags[i].Left(2) == wxT("/D")) )
+ if ( compilerFlags[i].StartsWith(wxT("-D"))
+ || compilerFlags[i].StartsWith(wxT("/D")) )
+ {
defines.Add(compilerFlags[i].Mid(2));
+ }
+ else if ( compilerFlags[i].StartsWith(wxT("`"))
+ && compilerFlags[i].EndsWith(wxT("`")) )
+ {
+ wxArrayString out;
+ long ret = 0;
+ {
+ wxLogNull logNo; // no need to warn if execution fails
+ ret = wxExecute(compilerFlags[i].Mid(1, compilerFlags[i].Length() - 2), out);
+ }
+ if (ret == 0)
+ {
+ out = GetArrayFromString(out[0], wxT(" ")); // pkg-config gives only single line output
+ AppendArray(out, compilerFlags); // append for processing
+ }
+ }
+ else if ( compilerFlags[i] == wxT("-ansi")
+ || compilerFlags[i] == wxT("-std=c90")
+ || compilerFlags[i] == wxT("-std=c++98"))
+ {
+ defines.Add(wxT("__STRICT_ANSI__"));
+ }
}
defines.Add(wxT("__cplusplus"));
Index: src/sdk/editorcolourset.cpp
===================================================================
--- src/sdk/editorcolourset.cpp (revision 8236)
+++ src/sdk/editorcolourset.cpp (working copy)
@@ -658,7 +658,22 @@
tmpKey << key << _T("/style") << wxString::Format(_T("%d"), i);
if (cfg->Exists(tmpKey + _T("/name")))
- opt->name = cfg->Read(tmpKey + _T("/name"));
+ {
+ wxString name = cfg->Read(tmpKey + _T("/name"));
+ for (size_t j = 0; opt->name != name && i + j < it->second.m_Colours.GetCount(); ++j) // search forwards first
+ {
+ opt = it->second.m_Colours.Item(i + j);
+ }
+ for (int j = -1; opt->name != name && i + j >= 0; --j) // then search backwards if it was not found
+ {
+ opt = it->second.m_Colours.Item(i + j);
+ }
+ if (opt->name != name)
+ {
+ cfg->DeleteSubPath(tmpKey); // unknown key, clear it out
+ continue;
+ }
+ }
else
{
// make sure we didn't create it accidentally
Index: src/sdk/editorconfigurationdlg.cpp
===================================================================
--- src/sdk/editorconfigurationdlg.cpp (revision 8236)
+++ src/sdk/editorconfigurationdlg.cpp (working copy)
@@ -140,8 +140,8 @@
XRCCTRL(*this, "cmbViewWS", wxComboBox)->SetSelection(cfg->ReadInt(_T("/view_whitespace"), 0));
XRCCTRL(*this, "rbTabText", wxRadioBox)->SetSelection(cfg->ReadBool(_T("/tab_text_relative"), true)? 1 : 0);
- XRCCTRL(*this, "chkTrackPreprocessor", wxCheckBox)->SetValue(cfg->ReadBool(_T("/track_preprocessor"), false));
- XRCCTRL(*this, "chkCollectPrjDefines", wxCheckBox)->SetValue(cfg->ReadBool(_T("/collect_prj_defines"), false));
+ XRCCTRL(*this, "chkTrackPreprocessor", wxCheckBox)->SetValue(cfg->ReadBool(_T("/track_preprocessor"), true));
+ XRCCTRL(*this, "chkCollectPrjDefines", wxCheckBox)->SetValue(cfg->ReadBool(_T("/collect_prj_defines"), true));
XRCCTRL(*this, "chkPlatDefines", wxCheckBox)->SetValue(cfg->ReadBool(_T("/platform_defines"), false));
XRCCTRL(*this, "chkColoursWxSmith", wxCheckBox)->SetValue(cfg->ReadBool(_T("/highlight_wxsmith"), true));
--- End code ---
--- Quote from: oBFusCATed on August 15, 2012, 09:05:16 pm ---BTW: Is there any reason that the syntax highlight preview looks correct, so the code is different
--- End quote ---
I have no idea how this happens (and I cannot reproduce it).
MortenMacFly:
--- Quote from: Alpha on August 16, 2012, 03:32:40 am ---This patch should fix (almost) all custom color scheme loading problems. [...]
--- Code: ---+ ret = wxExecute(compilerFlags[i].Mid(1, compilerFlags[i].Length() - 2), out);
--- End code ---
--- End quote ---
An exec command every time? Couldn't this be at least cached? Maybe that should even be a function of the compiler... (not a specific one, but the compiler framework. Because the compile has to do it, too IIRC... (I want to avoid having duplicate code.)
oBFusCATed:
Alpha: it is considered a good style separating changes in different patches/commits as this makes reviewing it easier. And it they are committed separately the svn blame will be more useful at a later time.
MortenMacFly:
--- Quote from: oBFusCATed on August 16, 2012, 08:29:41 am ---Alpha: it is considered a good style separating changes in different patches/commits as this makes reviewing it easier. And it they are committed separately the svn blame will be more useful at a later time.
--- End quote ---
Huh? This patch is needed in one to work. There is nothing to separate, or what did you mean? Collecting preprocessor defines is needed fr the highlighting function to work correctly.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version