]> git.saurik.com Git - wxWidgets.git/commitdiff
XMLID->XRCID, XMLCTRL->XRCCTRL
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 27 Jan 2002 23:42:16 +0000 (23:42 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 27 Jan 2002 23:42:16 +0000 (23:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

contrib/include/wx/xrc/xmlres.h
contrib/samples/xrc/xrcdemo.cpp
contrib/src/xrc/xh_unkwn.cpp
contrib/src/xrc/xmlres.cpp
contrib/utils/wxrcedit/pe_basic.cpp
contrib/utils/wxrcedit/pe_basic.h
contrib/utils/wxrcedit/propframe.cpp
include/wx/xrc/xmlres.h
samples/xrc/xrcdemo.cpp
src/xrc/xh_unkwn.cpp
src/xrc/xmlres.cpp

index ca3bdd2a9c345eb8560e54912f232c51d7350b74..77bc74433e783f9d2101927fa758068ff91af2db 100644 (file)
@@ -179,8 +179,8 @@ public:
 
     // Returns a numeric ID that is equivalent to the string id used in an XML
     // resource. To be used in event tables.
-    // Macro XMLID is provided for convenience
-    static int GetXMLID(const wxChar *str_id);
+    // Macro XRCID is provided for convenience
+    static int GetXRCID(const wxChar *str_id);
 
     // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a).
     long GetVersion() const { return m_version; }
@@ -239,14 +239,14 @@ private:
 // wxWindows event tables.
 // Example:
 //    BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-//       EVT_MENU(XMLID("quit"), MyFrame::OnQuit)
-//       EVT_MENU(XMLID("about"), MyFrame::OnAbout)
-//       EVT_MENU(XMLID("new"), MyFrame::OnNew)
-//       EVT_MENU(XMLID("open"), MyFrame::OnOpen)
+//       EVT_MENU(XRCID("quit"), MyFrame::OnQuit)
+//       EVT_MENU(XRCID("about"), MyFrame::OnAbout)
+//       EVT_MENU(XRCID("new"), MyFrame::OnNew)
+//       EVT_MENU(XRCID("open"), MyFrame::OnOpen)
 //    END_EVENT_TABLE()
 
-#define XMLID(str_id) \
-    wxXmlResource::GetXMLID(wxT(str_id))
+#define XRCID(str_id) \
+    wxXmlResource::GetXRCID(wxT(str_id))
 
 
 // This macro returns pointer to particular control in dialog
@@ -255,14 +255,14 @@ private:
 // Example:
 //    wxDialog dlg;
 //    wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
-//    XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
+//    XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
 
 #ifdef __WXDEBUG__
-#define XMLCTRL(window, id, type) \
-    (wxDynamicCast((window).FindWindow(XMLID(id)), type))
+#define XRCCTRL(window, id, type) \
+    (wxDynamicCast((window).FindWindow(XRCID(id)), type))
 #else
-#define XMLCTRL(window, id, type) \
-    ((type*)((window).FindWindow(XMLID(id))))
+#define XRCCTRL(window, id, type) \
+    ((type*)((window).FindWindow(XRCID(id))))
 #endif
 
 // wxXmlResourceHandler is an abstract base class for resource handlers
@@ -348,7 +348,7 @@ protected:
     // - calls wxGetTranslations (unless disabled in wxXmlResource)
     wxString GetText(const wxString& param);
 
-    // Returns the XMLID.
+    // Returns the XRCID.
     int GetID();
 
     // Returns the resource name.
@@ -426,7 +426,8 @@ void wxXmlInitResourceModule();
    ------------------------------------------------------------------------- */
 #define ADD_STYLE         XRC_ADD_STYLE
 #define wxTheXmlResource  wxXmlResource::Get()
-
+#define XMLID             XRCID
+#define XMLCTRL           XRCCTRL
 
 
 #endif // _WX_XMLRES_H_
index 91cc6b70a8602a668ec73ebd77190ff7511add28..3c81bf27304edfce858aa693f20b714318c12922 100644 (file)
@@ -86,10 +86,10 @@ private:
 // handlers) which process them. It can be also done at run-time, but for the
 // simple menu events like this the static method is much simpler.
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(XMLID("menu_quit"),  MyFrame::OnQuit)
-    EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout)
-    EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1)
-    EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2)
+    EVT_MENU(XRCID("menu_quit"),  MyFrame::OnQuit)
+    EVT_MENU(XRCID("menu_about"), MyFrame::OnAbout)
+    EVT_MENU(XRCID("menu_dlg1"), MyFrame::OnDlg1)
+    EVT_MENU(XRCID("menu_dlg2"), MyFrame::OnDlg2)
 END_EVENT_TABLE()
 
 // Create a new application object: this macro will allow wxWindows to create
index ac97564018d897fccc15ee3c028f96fe48eb8d9f..5896ed5e0b35f3333a2ba29988f49b2e32759385 100644 (file)
@@ -58,7 +58,7 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child)
 
     SetBackgroundColour(m_bg);
     child->SetName(m_controlName);
-    child->SetId(wxXmlResource::GetXMLID(m_controlName));
+    child->SetId(wxXmlResource::GetXRCID(m_controlName));
     m_controlAdded = TRUE;
 
     wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
index 2da69a6491770a99704b653c1933358abe2ebae2..ef687793569a2cd40de2d60d09dc680a101491b7 100644 (file)
@@ -713,7 +713,7 @@ int wxXmlResourceHandler::GetID()
     stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
     stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
 #undef stdID
-    else return wxXmlResource::GetXMLID(sid);
+    else return wxXmlResource::GetXRCID(sid);
 }
 
 
@@ -1042,32 +1042,32 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
 
 
 
-// --------------- XMLID implementation -----------------------------
+// --------------- XRCID implementation -----------------------------
 
-#define XMLID_TABLE_SIZE     1024
+#define XRCID_TABLE_SIZE     1024
 
 
-struct XMLID_record
+struct XRCID_record
 {
     int id;
     wxChar *key;
-    XMLID_record *next;
+    XRCID_record *next;
 };
 
-static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
+static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL};
 
-/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
+/*static*/ int wxXmlResource::GetXRCID(const wxChar *str_id)
 {
-    static int XMLID_LastID = wxID_HIGHEST;
+    static int XRCID_LastID = wxID_HIGHEST;
 
     int index = 0;
 
     for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
-    index %= XMLID_TABLE_SIZE;
+    index %= XRCID_TABLE_SIZE;
 
-    XMLID_record *oldrec = NULL;
+    XRCID_record *oldrec = NULL;
     int matchcnt = 0;
-    for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
+    for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
     {
         if (wxStrcmp(rec->key, str_id) == 0)
         {
@@ -1077,10 +1077,10 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
         oldrec = rec;
     }
 
-    XMLID_record **rec_var = (oldrec == NULL) ?
-                              &XMLID_Records[index] : &oldrec->next;
-    *rec_var = new XMLID_record;
-    (*rec_var)->id = ++XMLID_LastID;
+    XRCID_record **rec_var = (oldrec == NULL) ?
+                              &XRCID_Records[index] : &oldrec->next;
+    *rec_var = new XRCID_record;
+    (*rec_var)->id = ++XRCID_LastID;
     (*rec_var)->key = wxStrdup(str_id);
     (*rec_var)->next = NULL;
 
@@ -1088,20 +1088,20 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
 }
 
 
-static void CleanXMLID_Record(XMLID_record *rec)
+static void CleanXRCID_Record(XRCID_record *rec)
 {
     if (rec)
     {
-        CleanXMLID_Record(rec->next);
+        CleanXRCID_Record(rec->next);
         free(rec->key);
         delete rec;
     }
 }
 
-static void CleanXMLID_Records()
+static void CleanXRCID_Records()
 {
-    for (int i = 0; i < XMLID_TABLE_SIZE; i++)
-        CleanXMLID_Record(XMLID_Records[i]);
+    for (int i = 0; i < XRCID_TABLE_SIZE; i++)
+        CleanXRCID_Record(XRCID_Records[i]);
 }
 
 
@@ -1125,7 +1125,7 @@ public:
     void OnExit()
     {
         delete wxXmlResource::Set(NULL);
-        CleanXMLID_Records();
+        CleanXRCID_Records();
     }
 };
 
index 31f9c17bea29d084e0386690826de66c5d80332b..876c4f80fe5a36ef93eac867fabf833231e62a57 100644 (file)
@@ -359,19 +359,19 @@ wxTreeItemId PropEditCtrlDim::CreateTreeEntry(wxTreeItemId parent, const Propert
 
 
 
-// --------------------- PropEditCtrlXMLID -----------------------------
+// --------------------- PropEditCtrlXRCID -----------------------------
 
 #define REAL_NODE (NodeHandler::Find(GetNode())->GetRealNode(GetNode()))
 
 
-void PropEditCtrlXMLID::ReadValue()
+void PropEditCtrlXRCID::ReadValue()
 {
     m_TextCtrl->SetValue(REAL_NODE->GetPropVal(_T("name"), wxEmptyString));
 }
 
 
 
-void PropEditCtrlXMLID::WriteValue()
+void PropEditCtrlXRCID::WriteValue()
 {
     wxString s =m_TextCtrl->GetValue();
     if (s.IsEmpty()) s = _T("-1");
@@ -385,7 +385,7 @@ void PropEditCtrlXMLID::WriteValue()
 
 
 
-void PropEditCtrlXMLID::Clear()
+void PropEditCtrlXRCID::Clear()
 {
     EndEdit();
     REAL_NODE->DeleteProperty(_T("name"));
@@ -395,7 +395,7 @@ void PropEditCtrlXMLID::Clear()
 
 
 
-void PropEditCtrlXMLID::OnDetails()
+void PropEditCtrlXRCID::OnDetails()
 {
     wxString choices[] = {wxString(_T("-1"))
       #define stdID(id) , wxString(#id)
@@ -420,7 +420,7 @@ void PropEditCtrlXMLID::OnDetails()
       };
 
     wxString s = 
-        wxGetSingleChoice(_("Choose from predefined IDs:"), _("XMLID"), 
+        wxGetSingleChoice(_("Choose from predefined IDs:"), _("XRCID"), 
                           38/*sizeof choices*/, choices);
     if (!s) return;
     m_TextCtrl->SetValue(s);
@@ -430,14 +430,14 @@ void PropEditCtrlXMLID::OnDetails()
 
 
 
-wxString PropEditCtrlXMLID::GetValueAsText(wxTreeItemId ti)
+wxString PropEditCtrlXRCID::GetValueAsText(wxTreeItemId ti)
 {
     return REAL_NODE->GetPropVal(_T("name"), wxEmptyString);
 }
 
 
 
-bool PropEditCtrlXMLID::IsPresent(const PropertyInfo& pinfo)
+bool PropEditCtrlXRCID::IsPresent(const PropertyInfo& pinfo)
 {
     return REAL_NODE->HasProp(_T("name"));
 }
index f646125c1e8be627526bbc482ae8b334a53c9350..b13d3cc1e9fbe502f842d1857133f4d54db52d92 100644 (file)
@@ -116,10 +116,10 @@ class PropEditCtrlDim : public PropEditCtrlTxt
 
 
 
-class PropEditCtrlXMLID : public PropEditCtrlTxt
+class PropEditCtrlXRCID : public PropEditCtrlTxt
 {
     public:
-        PropEditCtrlXMLID(PropertiesFrame *propFrame)
+        PropEditCtrlXRCID(PropertiesFrame *propFrame)
            : PropEditCtrlTxt(propFrame) {}
                 
         virtual void ReadValue();
index 2909664c2294fe28f921fc9420e36af2208c217e..35022bd1267579179f2f528f4e10d76ea0a9e461 100644 (file)
@@ -246,7 +246,7 @@ PropertiesFrame::PropertiesFrame()
     m_EditCtrls.Put(_T("integer"), new PropEditCtrlInt(this));
     m_EditCtrls.Put(_T("not_implemented"), new PropEditCtrlNull(this));
     m_EditCtrls.Put(_T("text"), new PropEditCtrlTxt(this));
-    m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXMLID(this));
+    m_EditCtrls.Put(_T("xmlid"), new PropEditCtrlXRCID(this));
     m_EditCtrls.Put(_T("font"), new PropEditCtrlFont(this));
     m_EditCtrls.Put(_T("choice"), new PropEditCtrlChoice(this));
     m_EditCtrls.Put(_T("file"), new PropEditCtrlFile(this));
@@ -277,7 +277,7 @@ void PropertiesFrame::ShowProps(wxXmlNode *node)
    m_Node = node;
    
    ClearProps();
-   AddSingleProp(PropertyInfo(_T("xmlid"), _T("XMLID"), wxEmptyString));
+   AddSingleProp(PropertyInfo(_T("xmlid"), _T("XRCID"), wxEmptyString));
    AddProps(NodeHandler::Find(node)->GetPropsList(node));
    
    m_tree->Expand(m_tree->GetRootItem());
index ca3bdd2a9c345eb8560e54912f232c51d7350b74..77bc74433e783f9d2101927fa758068ff91af2db 100644 (file)
@@ -179,8 +179,8 @@ public:
 
     // Returns a numeric ID that is equivalent to the string id used in an XML
     // resource. To be used in event tables.
-    // Macro XMLID is provided for convenience
-    static int GetXMLID(const wxChar *str_id);
+    // Macro XRCID is provided for convenience
+    static int GetXRCID(const wxChar *str_id);
 
     // Returns version information (a.b.c.d = d+ 256*c + 256^2*b + 256^3*a).
     long GetVersion() const { return m_version; }
@@ -239,14 +239,14 @@ private:
 // wxWindows event tables.
 // Example:
 //    BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-//       EVT_MENU(XMLID("quit"), MyFrame::OnQuit)
-//       EVT_MENU(XMLID("about"), MyFrame::OnAbout)
-//       EVT_MENU(XMLID("new"), MyFrame::OnNew)
-//       EVT_MENU(XMLID("open"), MyFrame::OnOpen)
+//       EVT_MENU(XRCID("quit"), MyFrame::OnQuit)
+//       EVT_MENU(XRCID("about"), MyFrame::OnAbout)
+//       EVT_MENU(XRCID("new"), MyFrame::OnNew)
+//       EVT_MENU(XRCID("open"), MyFrame::OnOpen)
 //    END_EVENT_TABLE()
 
-#define XMLID(str_id) \
-    wxXmlResource::GetXMLID(wxT(str_id))
+#define XRCID(str_id) \
+    wxXmlResource::GetXRCID(wxT(str_id))
 
 
 // This macro returns pointer to particular control in dialog
@@ -255,14 +255,14 @@ private:
 // Example:
 //    wxDialog dlg;
 //    wxXmlResource::Get()->LoadDialog(&dlg, mainFrame, "my_dialog");
-//    XMLCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
+//    XRCCTRL(dlg, "my_textctrl", wxTextCtrl)->SetValue(wxT("default value"));
 
 #ifdef __WXDEBUG__
-#define XMLCTRL(window, id, type) \
-    (wxDynamicCast((window).FindWindow(XMLID(id)), type))
+#define XRCCTRL(window, id, type) \
+    (wxDynamicCast((window).FindWindow(XRCID(id)), type))
 #else
-#define XMLCTRL(window, id, type) \
-    ((type*)((window).FindWindow(XMLID(id))))
+#define XRCCTRL(window, id, type) \
+    ((type*)((window).FindWindow(XRCID(id))))
 #endif
 
 // wxXmlResourceHandler is an abstract base class for resource handlers
@@ -348,7 +348,7 @@ protected:
     // - calls wxGetTranslations (unless disabled in wxXmlResource)
     wxString GetText(const wxString& param);
 
-    // Returns the XMLID.
+    // Returns the XRCID.
     int GetID();
 
     // Returns the resource name.
@@ -426,7 +426,8 @@ void wxXmlInitResourceModule();
    ------------------------------------------------------------------------- */
 #define ADD_STYLE         XRC_ADD_STYLE
 #define wxTheXmlResource  wxXmlResource::Get()
-
+#define XMLID             XRCID
+#define XMLCTRL           XRCCTRL
 
 
 #endif // _WX_XMLRES_H_
index 91cc6b70a8602a668ec73ebd77190ff7511add28..3c81bf27304edfce858aa693f20b714318c12922 100644 (file)
@@ -86,10 +86,10 @@ private:
 // handlers) which process them. It can be also done at run-time, but for the
 // simple menu events like this the static method is much simpler.
 BEGIN_EVENT_TABLE(MyFrame, wxFrame)
-    EVT_MENU(XMLID("menu_quit"),  MyFrame::OnQuit)
-    EVT_MENU(XMLID("menu_about"), MyFrame::OnAbout)
-    EVT_MENU(XMLID("menu_dlg1"), MyFrame::OnDlg1)
-    EVT_MENU(XMLID("menu_dlg2"), MyFrame::OnDlg2)
+    EVT_MENU(XRCID("menu_quit"),  MyFrame::OnQuit)
+    EVT_MENU(XRCID("menu_about"), MyFrame::OnAbout)
+    EVT_MENU(XRCID("menu_dlg1"), MyFrame::OnDlg1)
+    EVT_MENU(XRCID("menu_dlg2"), MyFrame::OnDlg2)
 END_EVENT_TABLE()
 
 // Create a new application object: this macro will allow wxWindows to create
index ac97564018d897fccc15ee3c028f96fe48eb8d9f..5896ed5e0b35f3333a2ba29988f49b2e32759385 100644 (file)
@@ -58,7 +58,7 @@ void wxUnknownControlContainer::AddChild(wxWindowBase *child)
 
     SetBackgroundColour(m_bg);
     child->SetName(m_controlName);
-    child->SetId(wxXmlResource::GetXMLID(m_controlName));
+    child->SetId(wxXmlResource::GetXRCID(m_controlName));
     m_controlAdded = TRUE;
 
     wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
index 2da69a6491770a99704b653c1933358abe2ebae2..ef687793569a2cd40de2d60d09dc680a101491b7 100644 (file)
@@ -713,7 +713,7 @@ int wxXmlResourceHandler::GetID()
     stdID(wxID_DEFAULT); stdID(wxID_MORE); stdID(wxID_SETUP);
     stdID(wxID_RESET); stdID(wxID_HELP_CONTEXT);
 #undef stdID
-    else return wxXmlResource::GetXMLID(sid);
+    else return wxXmlResource::GetXRCID(sid);
 }
 
 
@@ -1042,32 +1042,32 @@ void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *
 
 
 
-// --------------- XMLID implementation -----------------------------
+// --------------- XRCID implementation -----------------------------
 
-#define XMLID_TABLE_SIZE     1024
+#define XRCID_TABLE_SIZE     1024
 
 
-struct XMLID_record
+struct XRCID_record
 {
     int id;
     wxChar *key;
-    XMLID_record *next;
+    XRCID_record *next;
 };
 
-static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
+static XRCID_record *XRCID_Records[XRCID_TABLE_SIZE] = {NULL};
 
-/*static*/ int wxXmlResource::GetXMLID(const wxChar *str_id)
+/*static*/ int wxXmlResource::GetXRCID(const wxChar *str_id)
 {
-    static int XMLID_LastID = wxID_HIGHEST;
+    static int XRCID_LastID = wxID_HIGHEST;
 
     int index = 0;
 
     for (const wxChar *c = str_id; *c != wxT('\0'); c++) index += (int)*c;
-    index %= XMLID_TABLE_SIZE;
+    index %= XRCID_TABLE_SIZE;
 
-    XMLID_record *oldrec = NULL;
+    XRCID_record *oldrec = NULL;
     int matchcnt = 0;
-    for (XMLID_record *rec = XMLID_Records[index]; rec; rec = rec->next)
+    for (XRCID_record *rec = XRCID_Records[index]; rec; rec = rec->next)
     {
         if (wxStrcmp(rec->key, str_id) == 0)
         {
@@ -1077,10 +1077,10 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
         oldrec = rec;
     }
 
-    XMLID_record **rec_var = (oldrec == NULL) ?
-                              &XMLID_Records[index] : &oldrec->next;
-    *rec_var = new XMLID_record;
-    (*rec_var)->id = ++XMLID_LastID;
+    XRCID_record **rec_var = (oldrec == NULL) ?
+                              &XRCID_Records[index] : &oldrec->next;
+    *rec_var = new XRCID_record;
+    (*rec_var)->id = ++XRCID_LastID;
     (*rec_var)->key = wxStrdup(str_id);
     (*rec_var)->next = NULL;
 
@@ -1088,20 +1088,20 @@ static XMLID_record *XMLID_Records[XMLID_TABLE_SIZE] = {NULL};
 }
 
 
-static void CleanXMLID_Record(XMLID_record *rec)
+static void CleanXRCID_Record(XRCID_record *rec)
 {
     if (rec)
     {
-        CleanXMLID_Record(rec->next);
+        CleanXRCID_Record(rec->next);
         free(rec->key);
         delete rec;
     }
 }
 
-static void CleanXMLID_Records()
+static void CleanXRCID_Records()
 {
-    for (int i = 0; i < XMLID_TABLE_SIZE; i++)
-        CleanXMLID_Record(XMLID_Records[i]);
+    for (int i = 0; i < XRCID_TABLE_SIZE; i++)
+        CleanXRCID_Record(XRCID_Records[i]);
 }
 
 
@@ -1125,7 +1125,7 @@ public:
     void OnExit()
     {
         delete wxXmlResource::Set(NULL);
-        CleanXMLID_Records();
+        CleanXRCID_Records();
     }
 };