Patch #1346 2006-08-16 20:41

andox

Auto-complete keywords. $(file) and $(date)
Download
1346-Auto_complete.patch (1.3 KB)
Category
Application::FeatureAdd
Status
Rejected
Close date
2007-04-12 11:37
Assigned to
 
Index: sdk/cbeditor.cpp
===================================================================
--- sdk/cbeditor.cpp    (revision 2864)
+++ sdk/cbeditor.cpp    (working copy)
@@ -1272,8 +1272,20 @@
 
                 wxString macroName = code.SubString(macroPos + 2, macroPosEnd - 1);
                 msgMan->DebugLog(_T("Found macro: %s"), macroName.c_str());
-                wxString macro = wxGetTextFromUser(_("Please enter the text for \"") + macroName + _T("\":"), _("Macro substitution"));
-                code.Replace(_T("$(") + macroName + _T(")"), macro);
+
+                if (macroName == _T("date"))
+                {
+                    code.Replace(_T("$(") + macroName + _T(")"), wxDateTime::Now().Format(_T("%c"), wxDateTime::Local));
+                }
+                else if (macroName == _T("file"))
+                {
+                    code.Replace(_T("$(") + macroName + _T(")"), Manager::Get()->GetEditorManager()->GetActiveEditor()->GetShortName().c_str());
+                }
+                else
+                {
+                    wxString macro = wxGetTextFromUser(_("Please enter the text for \"") + macroName + _T("\":"), _("Macro substitution"));
+                    code.Replace(_T("$(") + macroName + _T(")"), macro);
+                }
                 macroPos = code.Find(_T("$("));
             }
mandrav 2007-04-12 11:37

The auto-completed text is passed through MacrosManager for replacements before inserting it into the editor. This means you can use all MacrosManager-known macros, including $(ACTIVE_EDITOR_FILENAME) and $(TODAY).

Therefore this patch does not add anything. Thank you though.