Patch #1347 2006-08-16 20:52

andox

Auto-complete keywords. $(file) and $(date)
Download
1347-Auto_complete.patch (1.3 KB)
Category
Application::FeatureAdd
Status
Closed
Close date
2006-10-06 14:31
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("$("));
             }
mortis 2006-08-28 17:41

this one is exactly similar to patch #1346

killerbot 2006-10-06 14:31

duplicate of 1346