From 5ed345b7edec3552c51b3cf9453a81b29568e946 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sun, 27 Jan 2002 23:42:16 +0000 Subject: [PATCH] XMLID->XRCID, XMLCTRL->XRCCTRL git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/xrc/xmlres.h | 31 ++++++++++---------- contrib/samples/xrc/xrcdemo.cpp | 8 +++--- contrib/src/xrc/xh_unkwn.cpp | 2 +- contrib/src/xrc/xmlres.cpp | 42 ++++++++++++++-------------- contrib/utils/wxrcedit/pe_basic.cpp | 16 +++++------ contrib/utils/wxrcedit/pe_basic.h | 4 +-- contrib/utils/wxrcedit/propframe.cpp | 4 +-- include/wx/xrc/xmlres.h | 31 ++++++++++---------- samples/xrc/xrcdemo.cpp | 8 +++--- src/xrc/xh_unkwn.cpp | 2 +- src/xrc/xmlres.cpp | 42 ++++++++++++++-------------- 11 files changed, 96 insertions(+), 94 deletions(-) diff --git a/contrib/include/wx/xrc/xmlres.h b/contrib/include/wx/xrc/xmlres.h index ca3bdd2a9c..77bc74433e 100644 --- a/contrib/include/wx/xrc/xmlres.h +++ b/contrib/include/wx/xrc/xmlres.h @@ -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_ diff --git a/contrib/samples/xrc/xrcdemo.cpp b/contrib/samples/xrc/xrcdemo.cpp index 91cc6b70a8..3c81bf2730 100644 --- a/contrib/samples/xrc/xrcdemo.cpp +++ b/contrib/samples/xrc/xrcdemo.cpp @@ -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 diff --git a/contrib/src/xrc/xh_unkwn.cpp b/contrib/src/xrc/xh_unkwn.cpp index ac97564018..5896ed5e0b 100644 --- a/contrib/src/xrc/xh_unkwn.cpp +++ b/contrib/src/xrc/xh_unkwn.cpp @@ -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); diff --git a/contrib/src/xrc/xmlres.cpp b/contrib/src/xrc/xmlres.cpp index 2da69a6491..ef68779356 100644 --- a/contrib/src/xrc/xmlres.cpp +++ b/contrib/src/xrc/xmlres.cpp @@ -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(); } }; diff --git a/contrib/utils/wxrcedit/pe_basic.cpp b/contrib/utils/wxrcedit/pe_basic.cpp index 31f9c17bea..876c4f80fe 100644 --- a/contrib/utils/wxrcedit/pe_basic.cpp +++ b/contrib/utils/wxrcedit/pe_basic.cpp @@ -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")); } diff --git a/contrib/utils/wxrcedit/pe_basic.h b/contrib/utils/wxrcedit/pe_basic.h index f646125c1e..b13d3cc1e9 100644 --- a/contrib/utils/wxrcedit/pe_basic.h +++ b/contrib/utils/wxrcedit/pe_basic.h @@ -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(); diff --git a/contrib/utils/wxrcedit/propframe.cpp b/contrib/utils/wxrcedit/propframe.cpp index 2909664c22..35022bd126 100644 --- a/contrib/utils/wxrcedit/propframe.cpp +++ b/contrib/utils/wxrcedit/propframe.cpp @@ -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()); diff --git a/include/wx/xrc/xmlres.h b/include/wx/xrc/xmlres.h index ca3bdd2a9c..77bc74433e 100644 --- a/include/wx/xrc/xmlres.h +++ b/include/wx/xrc/xmlres.h @@ -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_ diff --git a/samples/xrc/xrcdemo.cpp b/samples/xrc/xrcdemo.cpp index 91cc6b70a8..3c81bf2730 100644 --- a/samples/xrc/xrcdemo.cpp +++ b/samples/xrc/xrcdemo.cpp @@ -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 diff --git a/src/xrc/xh_unkwn.cpp b/src/xrc/xh_unkwn.cpp index ac97564018..5896ed5e0b 100644 --- a/src/xrc/xh_unkwn.cpp +++ b/src/xrc/xh_unkwn.cpp @@ -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); diff --git a/src/xrc/xmlres.cpp b/src/xrc/xmlres.cpp index 2da69a6491..ef68779356 100644 --- a/src/xrc/xmlres.cpp +++ b/src/xrc/xmlres.cpp @@ -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(); } }; -- 2.45.2