21
Help / Re: Different handling of placeholders
« Last post by blauzahn on November 03, 2025, 07:55:50 pm »Maybe because macro expansion is better used reluctantly? Like minimizing the usage of the c-preprocessor. Currently, I do not use default-code but I would be fine with how it is as you described.
I briefly searched cb-source for default-code. The function that expands placeholders is in trunk/src/sdk/editormanager.cpp:495
see the lines:
Apart from that snippet, at first glance, I did not find in the source code any further rationale for the decision you asked for.
The code entered into the settings dialog can be found in ~/.config/codeblocks/default.con. Please search for default_code within that file.
Why do you want the creation date of a source file in the first place? I'd rather look up in version control when it was added. With that username, do you do that for legal reasons?
I briefly searched cb-source for default-code. The function that expands placeholders is in trunk/src/sdk/editormanager.cpp:495
Code
cbEditor* EditorManager::New(const wxString& newFileName)
{
// wxString old_title = Manager::Get()->GetAppWindow()->GetTitle(); // Fix for Bug #1389450
// create a dummy file
if (!newFileName.IsEmpty() && !wxFileExists(newFileName) && wxDirExists(wxPathOnly(newFileName)))
{
wxFile f(newFileName, wxFile::write);
if (!f.IsOpened())
return nullptr;
}
cbEditor* ed = new cbEditor(m_pNotebook, newFileName, m_Theme);
// if ((newFileName.IsEmpty() && !ed->SaveAs()) || !ed->Save())
// {
// //DeletePage(ed->GetPageIndex());
// ed->Destroy();
// Manager::Get()->GetAppWindow()->SetTitle(old_title); // Though I can't reproduce the bug, this does no harm
// return 0;
// }
// add default text
wxString key;
key.Printf(_T("/default_code/set%d"), (int)FileTypeOf(ed->GetFilename()));
wxString code = Manager::Get()->GetConfigManager(_T("editor"))->Read(key, wxEmptyString);
// Allow usage of macros
// TODO (Morten#5#): Is it worth making this configurable?!
Manager::Get()->GetMacrosManager()->ReplaceMacros(code);
ed->GetControl()->SetText(code);
ed->SetColourSet(m_Theme);
AddEditorBase(ed);
ed->Show(true);
SetActiveEditor(ed);
CodeBlocksEvent evt(cbEVT_EDITOR_OPEN, -1, nullptr, ed);
Manager::Get()->GetPluginManager()->NotifyPlugins(evt);
return ed;
}
see the lines:
Code
// Allow usage of macros
// TODO (Morten#5#): Is it worth making this configurable?!
Manager::Get()->GetMacrosManager()->ReplaceMacros(code);
Apart from that snippet, at first glance, I did not find in the source code any further rationale for the decision you asked for.
The code entered into the settings dialog can be found in ~/.config/codeblocks/default.con. Please search for default_code within that file.
Why do you want the creation date of a source file in the first place? I'd rather look up in version control when it was added. With that username, do you do that for legal reasons?
Recent Posts