From e066e2566a4e5db3510fe6a204d66850eaeceade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 7 Oct 2000 21:56:37 +0000 Subject: [PATCH] change in XRC format git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/include/wx/xml/xh_sizer.h | 2 + contrib/include/wx/xml/xmlres.h | 13 +- contrib/src/xml/xh_bmp.cpp | 4 +- contrib/src/xml/xh_bmpbt.cpp | 2 +- contrib/src/xml/xh_bttn.cpp | 2 +- contrib/src/xml/xh_cald.cpp | 2 +- contrib/src/xml/xh_chckb.cpp | 2 +- contrib/src/xml/xh_chckl.cpp | 14 +- contrib/src/xml/xh_choic.cpp | 12 +- contrib/src/xml/xh_combo.cpp | 12 +- contrib/src/xml/xh_dlg.cpp | 2 +- contrib/src/xml/xh_gauge.cpp | 2 +- contrib/src/xml/xh_html.cpp | 2 +- contrib/src/xml/xh_listb.cpp | 12 +- contrib/src/xml/xh_listc.cpp | 2 +- contrib/src/xml/xh_notbk.cpp | 46 ++--- contrib/src/xml/xh_panel.cpp | 2 +- contrib/src/xml/xh_radbt.cpp | 2 +- contrib/src/xml/xh_radbx.cpp | 11 +- contrib/src/xml/xh_scrol.cpp | 2 +- contrib/src/xml/xh_sizer.cpp | 105 +++++----- contrib/src/xml/xh_slidr.cpp | 2 +- contrib/src/xml/xh_spin.cpp | 2 +- contrib/src/xml/xh_stbmp.cpp | 2 +- contrib/src/xml/xh_stbox.cpp | 2 +- contrib/src/xml/xh_stlin.cpp | 2 +- contrib/src/xml/xh_sttxt.cpp | 2 +- contrib/src/xml/xh_text.cpp | 6 +- contrib/src/xml/xh_toolb.cpp | 23 ++- contrib/src/xml/xh_tree.cpp | 2 +- contrib/src/xml/xh_unkwn.cpp | 4 +- contrib/src/xml/xmlres.cpp | 76 ++++--- contrib/utils/convertrc/rc2xml.cpp | 108 +++++----- contrib/utils/convertrc/wxr2xml.cpp | 104 +++++----- contrib/utils/wxrc/wxrc.cpp | 36 ++-- contrib/utils/wxrcedit/Makefile.in | 65 ++---- contrib/utils/wxrcedit/df/staticbitmap.df | 3 - contrib/utils/wxrcedit/df/staticboxsizer.df | 4 - contrib/utils/wxrcedit/df/statictext.df | 3 - .../df/{bitmapbutton.df => wxBitmapButton.df} | 2 +- .../df/{boxsizer.df => wxBoxSizer.df} | 2 +- .../wxrcedit/df/{button.df => wxButton.df} | 2 +- .../df/{calendarctrl.df => wxCalendarCtrl.df} | 2 +- .../df/{checkbox.df => wxCheckBox.df} | 2 +- .../df/{checklist.df => wxCheckList.df} | 2 +- .../wxrcedit/df/{choice.df => wxChoice.df} | 2 +- .../df/{combobox.df => wxComboBox.df} | 2 +- .../wxrcedit/df/{dialog.df => wxDialog.df} | 2 +- .../{flexgridsizer.df => wxFlexGridSizer.df} | 2 +- .../wxrcedit/df/{gauge.df => wxGauge.df} | 2 +- .../df/{gridsizer.df => wxGridSizer.df} | 2 +- .../df/{htmlwindow.df => wxHtmlWindow.df} | 2 +- .../wxrcedit/df/{listbox.df => wxListBox.df} | 2 +- .../df/{listctrl.df => wxListCtrl.df} | 2 +- .../utils/wxrcedit/df/{menu.df => wxMenu.df} | 2 +- .../wxrcedit/df/{menubar.df => wxMenuBar.df} | 4 +- .../df/{menuitem.df => wxMenuItem.df} | 2 +- .../df/{notebook.df => wxNotebook.df} | 4 +- .../wxrcedit/df/{panel.df => wxPanel.df} | 2 +- .../df/{radiobox.df => wxRadioBox.df} | 2 +- .../df/{radiobutton.df => wxRadioButton.df} | 2 +- .../df/{scrollbar.df => wxScrollBar.df} | 2 +- .../wxrcedit/df/{slider.df => wxSlider.df} | 2 +- .../df/{spinctrl.df => wxSpinButton.df} | 2 +- .../df/{spinbutton.df => wxSpinCtrl.df} | 2 +- contrib/utils/wxrcedit/df/wxStaticBitmap.df | 3 + .../df/{staticbox.df => wxStaticBox.df} | 2 +- contrib/utils/wxrcedit/df/wxStaticBoxSizer.df | 4 + .../df/{staticline.df => wxStaticLine.df} | 2 +- contrib/utils/wxrcedit/df/wxStaticText.df | 3 + .../df/{textctrl.df => wxTextCtrl.df} | 2 +- .../wxrcedit/df/{toolbar.df => wxToolBar.df} | 2 +- .../df/{treectrl.df => wxTreeCtrl.df} | 2 +- contrib/utils/wxrcedit/editor.cpp | 170 +++++---------- contrib/utils/wxrcedit/editor.h | 3 +- contrib/utils/wxrcedit/nodehnd.cpp | 92 +++------ contrib/utils/wxrcedit/preview.cpp | 195 ++++++++++++++++++ contrib/utils/wxrcedit/preview.h | 55 +++++ contrib/utils/wxrcedit/xmlhelpr.cpp | 16 ++ contrib/utils/wxrcedit/xmlhelpr.h | 2 + utils/wxrc/wxrc.cpp | 36 ++-- 81 files changed, 734 insertions(+), 610 deletions(-) delete mode 100644 contrib/utils/wxrcedit/df/staticbitmap.df delete mode 100644 contrib/utils/wxrcedit/df/staticboxsizer.df delete mode 100644 contrib/utils/wxrcedit/df/statictext.df rename contrib/utils/wxrcedit/df/{bitmapbutton.df => wxBitmapButton.df} (90%) rename contrib/utils/wxrcedit/df/{boxsizer.df => wxBoxSizer.df} (88%) rename contrib/utils/wxrcedit/df/{button.df => wxButton.df} (52%) rename contrib/utils/wxrcedit/df/{calendarctrl.df => wxCalendarCtrl.df} (87%) rename contrib/utils/wxrcedit/df/{checkbox.df => wxCheckBox.df} (51%) rename contrib/utils/wxrcedit/df/{checklist.df => wxCheckList.df} (75%) rename contrib/utils/wxrcedit/df/{choice.df => wxChoice.df} (88%) rename contrib/utils/wxrcedit/df/{combobox.df => wxComboBox.df} (91%) rename contrib/utils/wxrcedit/df/{dialog.df => wxDialog.df} (93%) rename contrib/utils/wxrcedit/df/{flexgridsizer.df => wxFlexGridSizer.df} (88%) rename contrib/utils/wxrcedit/df/{gauge.df => wxGauge.df} (93%) rename contrib/utils/wxrcedit/df/{gridsizer.df => wxGridSizer.df} (90%) rename contrib/utils/wxrcedit/df/{htmlwindow.df => wxHtmlWindow.df} (88%) rename contrib/utils/wxrcedit/df/{listbox.df => wxListBox.df} (92%) rename contrib/utils/wxrcedit/df/{listctrl.df => wxListCtrl.df} (94%) rename contrib/utils/wxrcedit/df/{menu.df => wxMenu.df} (91%) rename contrib/utils/wxrcedit/df/{menubar.df => wxMenuBar.df} (61%) rename contrib/utils/wxrcedit/df/{menuitem.df => wxMenuItem.df} (89%) rename contrib/utils/wxrcedit/df/{notebook.df => wxNotebook.df} (79%) rename contrib/utils/wxrcedit/df/{panel.df => wxPanel.df} (78%) rename contrib/utils/wxrcedit/df/{radiobox.df => wxRadioBox.df} (92%) rename contrib/utils/wxrcedit/df/{radiobutton.df => wxRadioButton.df} (82%) rename contrib/utils/wxrcedit/df/{scrollbar.df => wxScrollBar.df} (79%) rename contrib/utils/wxrcedit/df/{slider.df => wxSlider.df} (96%) rename contrib/utils/wxrcedit/df/{spinctrl.df => wxSpinButton.df} (89%) rename contrib/utils/wxrcedit/df/{spinbutton.df => wxSpinCtrl.df} (90%) create mode 100644 contrib/utils/wxrcedit/df/wxStaticBitmap.df rename contrib/utils/wxrcedit/df/{staticbox.df => wxStaticBox.df} (69%) create mode 100644 contrib/utils/wxrcedit/df/wxStaticBoxSizer.df rename contrib/utils/wxrcedit/df/{staticline.df => wxStaticLine.df} (79%) create mode 100644 contrib/utils/wxrcedit/df/wxStaticText.df rename contrib/utils/wxrcedit/df/{textctrl.df => wxTextCtrl.df} (90%) rename contrib/utils/wxrcedit/df/{toolbar.df => wxToolBar.df} (94%) rename contrib/utils/wxrcedit/df/{treectrl.df => wxTreeCtrl.df} (84%) create mode 100644 contrib/utils/wxrcedit/preview.cpp create mode 100644 contrib/utils/wxrcedit/preview.h diff --git a/contrib/include/wx/xml/xh_sizer.h b/contrib/include/wx/xml/xh_sizer.h index 818946e76e..2c3d1e960c 100644 --- a/contrib/include/wx/xml/xh_sizer.h +++ b/contrib/include/wx/xml/xh_sizer.h @@ -30,6 +30,8 @@ class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler private: bool m_IsInside; wxSizer *m_ParentSizer; + + bool IsSizerNode(wxXmlNode *node); }; diff --git a/contrib/include/wx/xml/xmlres.h b/contrib/include/wx/xml/xmlres.h index fd012efd0e..52c7f2a9ab 100644 --- a/contrib/include/wx/xml/xmlres.h +++ b/contrib/include/wx/xml/xmlres.h @@ -124,7 +124,7 @@ class WXDLLEXPORT wxXmlResource : public wxObject void UpdateResources(); // Finds resource (calls UpdateResources) and returns node containing it - wxXmlNode *FindResource(const wxString& name, const wxString& type); + wxXmlNode *FindResource(const wxString& name, const wxString& classname); // Creates resource from info in given node: wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL); @@ -212,11 +212,17 @@ class WXDLLEXPORT wxXmlResourceHandler : public wxObject // Variables (filled by CreateResource) wxXmlNode *m_Node; + wxString m_Class; wxObject *m_Parent, *m_Instance; wxWindow *m_ParentAsWindow, *m_InstanceAsWindow; // --- Handy methods: + // Returns true if the node has property class equal to classname, + // e.g. + bool IsOfClass(wxXmlNode *node, const wxString& classname) + { return node->GetPropVal(_T("class"), wxEmptyString) == classname; } + // Gets node content from wxXML_ENTITY_NODE // (the problem is, content is represented as // wxXML_ENTITY_NODE name="tag", content="" @@ -278,9 +284,8 @@ class WXDLLEXPORT wxXmlResourceHandler : public wxObject // Sets common window options: void SetupWindow(wxWindow *wnd); - void CreateChildren(wxObject *parent, bool only_this_handler = FALSE, - wxXmlNode *children_node = NULL /*stands for - GetParamNode("children")*/); + void CreateChildren(wxObject *parent, bool this_hnd_only = FALSE); + void CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL); wxObject *CreateResFromNode(wxXmlNode *node, wxObject *parent, wxObject *instance = NULL) { return m_Resource->CreateResFromNode(node, parent, instance); } diff --git a/contrib/src/xml/xh_bmp.cpp b/contrib/src/xml/xh_bmp.cpp index c83a264430..a5eb0341b5 100644 --- a/contrib/src/xml/xh_bmp.cpp +++ b/contrib/src/xml/xh_bmp.cpp @@ -37,7 +37,7 @@ wxObject *wxBitmapXmlHandler::DoCreateResource() bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("bitmap"); + return IsOfClass(node, _T("wxBitmap")); } @@ -55,6 +55,6 @@ wxObject *wxIconXmlHandler::DoCreateResource() bool wxIconXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("icon"); + return IsOfClass(node, _T("wxIcon")); } diff --git a/contrib/src/xml/xh_bmpbt.cpp b/contrib/src/xml/xh_bmpbt.cpp index 0fa81797ee..a4230b1c74 100644 --- a/contrib/src/xml/xh_bmpbt.cpp +++ b/contrib/src/xml/xh_bmpbt.cpp @@ -60,7 +60,7 @@ wxObject *wxBitmapButtonXmlHandler::DoCreateResource() bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("bitmapbutton"); + return IsOfClass(node, _T("wxBitmapButton")); } diff --git a/contrib/src/xml/xh_bttn.cpp b/contrib/src/xml/xh_bttn.cpp index 4fc936f4ab..c73b849310 100644 --- a/contrib/src/xml/xh_bttn.cpp +++ b/contrib/src/xml/xh_bttn.cpp @@ -49,7 +49,7 @@ wxObject *wxButtonXmlHandler::DoCreateResource() bool wxButtonXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("button"); + return IsOfClass(node, _T("wxButton")); } diff --git a/contrib/src/xml/xh_cald.cpp b/contrib/src/xml/xh_cald.cpp index a17453184d..723734d7c5 100644 --- a/contrib/src/xml/xh_cald.cpp +++ b/contrib/src/xml/xh_cald.cpp @@ -54,7 +54,7 @@ wxObject *wxCalendarCtrlXmlHandler::DoCreateResource() bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("calendarctrl"); + return IsOfClass(node, _T("wxCalendarCtrl")); } diff --git a/contrib/src/xml/xh_chckb.cpp b/contrib/src/xml/xh_chckb.cpp index 9cfddeb63e..0351054f8f 100644 --- a/contrib/src/xml/xh_chckb.cpp +++ b/contrib/src/xml/xh_chckb.cpp @@ -51,7 +51,7 @@ wxObject *wxCheckBoxXmlHandler::DoCreateResource() bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("checkbox"); + return IsOfClass(node, _T("wxCheckBox")); } #endif diff --git a/contrib/src/xml/xh_chckl.cpp b/contrib/src/xml/xh_chckl.cpp index 5e22232d4b..826709bc9c 100644 --- a/contrib/src/xml/xh_chckl.cpp +++ b/contrib/src/xml/xh_chckl.cpp @@ -31,12 +31,11 @@ wxCheckListXmlHandler::wxCheckListXmlHandler() wxObject *wxCheckListXmlHandler::DoCreateResource() { - if( m_Node->GetName() == _T("checklist")) + if (m_Class == _T("wxCheckList")) { // need to build the list of strings from children m_InsideBox = TRUE; - CreateChildren( NULL, TRUE /* only this handler */, - GetParamNode(_T("content"))); + CreateChildrenPrivately(NULL, GetParamNode(_T("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { @@ -64,7 +63,7 @@ wxObject *wxCheckListXmlHandler::DoCreateResource() while (n) { if (n->GetType() != wxXML_ELEMENT_NODE || - n->GetName() != _T("item" )) + n->GetName() != _T("item")) { n = n->GetNext(); continue; } // checking boolean is a bit ugly here (see GetBool() ) @@ -102,10 +101,9 @@ wxObject *wxCheckListXmlHandler::DoCreateResource() bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node) { - return( node->GetName() == _T("checklist") || - ( m_InsideBox && - node->GetName() == _T("item" )) - ); + return (IsOfClass(node, _T("wxCheckList")) || + (m_InsideBox && node->GetName() == _T("item")) + ); } diff --git a/contrib/src/xml/xh_choic.cpp b/contrib/src/xml/xh_choic.cpp index 6ffec1f04d..2e5918236d 100644 --- a/contrib/src/xml/xh_choic.cpp +++ b/contrib/src/xml/xh_choic.cpp @@ -31,15 +31,14 @@ wxChoiceXmlHandler::wxChoiceXmlHandler() wxObject *wxChoiceXmlHandler::DoCreateResource() { - if( m_Node->GetName() == _T("choice")) + if( m_Class == _T("wxChoice")) { // find the selection long selection = GetLong( _T("selection"), -1 ); // need to build the list of strings from children m_InsideBox = TRUE; - CreateChildren( NULL, TRUE /* only this handler */, - GetParamNode(_T("content"))); + CreateChildrenPrivately( NULL, GetParamNode(_T("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { @@ -88,10 +87,9 @@ wxObject *wxChoiceXmlHandler::DoCreateResource() bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node) { - return( node->GetName() == _T("choice") || - ( m_InsideBox && - node->GetName() == _T("item" )) - ); + return (IsOfClass(node, _T("wxChoice")) || + (m_InsideBox && node->GetName() == _T("item")) + ); } diff --git a/contrib/src/xml/xh_combo.cpp b/contrib/src/xml/xh_combo.cpp index 54c029431b..9af99a7957 100644 --- a/contrib/src/xml/xh_combo.cpp +++ b/contrib/src/xml/xh_combo.cpp @@ -36,15 +36,14 @@ wxComboBoxXmlHandler::wxComboBoxXmlHandler() wxObject *wxComboBoxXmlHandler::DoCreateResource() { - if( m_Node->GetName() == _T("combobox")) + if( m_Class == _T("wxComboBox")) { // find the selection long selection = GetLong( _T("selection"), -1 ); // need to build the list of strings from children m_InsideBox = TRUE; - CreateChildren( NULL, TRUE /* only this handler */, - GetParamNode(_T("content"))); + CreateChildrenPrivately( NULL, GetParamNode(_T("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { @@ -94,10 +93,9 @@ wxObject *wxComboBoxXmlHandler::DoCreateResource() bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node) { - return( node->GetName() == _T("combobox") || - ( m_InsideBox && - node->GetName() == _T("item" )) - ); + return (IsOfClass(node, _T("wxComboBox")) || + (m_InsideBox && node->GetName() == _T("item")) + ); } #endif diff --git a/contrib/src/xml/xh_dlg.cpp b/contrib/src/xml/xh_dlg.cpp index f95d9f41f8..62b971a4e7 100644 --- a/contrib/src/xml/xh_dlg.cpp +++ b/contrib/src/xml/xh_dlg.cpp @@ -74,7 +74,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource() bool wxDialogXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("dialog"); + return IsOfClass(node, _T("wxDialog")); } diff --git a/contrib/src/xml/xh_gauge.cpp b/contrib/src/xml/xh_gauge.cpp index cefe815ac6..5989d2859f 100644 --- a/contrib/src/xml/xh_gauge.cpp +++ b/contrib/src/xml/xh_gauge.cpp @@ -67,7 +67,7 @@ wxObject *wxGaugeXmlHandler::DoCreateResource() bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("gauge"); + return IsOfClass(node, _T("wxGauge")); } diff --git a/contrib/src/xml/xh_html.cpp b/contrib/src/xml/xh_html.cpp index e94e0c8f96..23a5cb4c27 100644 --- a/contrib/src/xml/xh_html.cpp +++ b/contrib/src/xml/xh_html.cpp @@ -66,7 +66,7 @@ wxObject *wxHtmlWindowXmlHandler::DoCreateResource() bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("htmlwindow"); + return IsOfClass(node, _T("wxHtmlWindow")); } #endif // wxUSE_HTML diff --git a/contrib/src/xml/xh_listb.cpp b/contrib/src/xml/xh_listb.cpp index 9d4bae282d..f99fb7ae3d 100644 --- a/contrib/src/xml/xh_listb.cpp +++ b/contrib/src/xml/xh_listb.cpp @@ -37,15 +37,14 @@ wxListBoxXmlHandler::wxListBoxXmlHandler() wxObject *wxListBoxXmlHandler::DoCreateResource() { - if( m_Node->GetName() == _T("listbox")) + if( m_Class == _T("wxListBox")) { // find the selection long selection = GetLong( _T("selection"), -1 ); // need to build the list of strings from children m_InsideBox = TRUE; - CreateChildren( NULL, TRUE /* only this handler */, - GetParamNode(_T("content"))); + CreateChildrenPrivately( NULL, GetParamNode(_T("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { @@ -94,10 +93,9 @@ wxObject *wxListBoxXmlHandler::DoCreateResource() bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node) { - return( node->GetName() == _T("listbox") || - ( m_InsideBox && - node->GetName() == _T("item" )) - ); + return (IsOfClass(node, _T("wxListBox")) || + (m_InsideBox && node->GetName() == _T("item")) + ); } diff --git a/contrib/src/xml/xh_listc.cpp b/contrib/src/xml/xh_listc.cpp index 332d9655f4..df2c2328c0 100644 --- a/contrib/src/xml/xh_listc.cpp +++ b/contrib/src/xml/xh_listc.cpp @@ -63,5 +63,5 @@ wxObject *wxListCtrlXmlHandler::DoCreateResource() bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("listctrl"); + return IsOfClass(node, _T("wxListCtrl")); } diff --git a/contrib/src/xml/xh_notbk.cpp b/contrib/src/xml/xh_notbk.cpp index 3c7bed28f8..fa8bec1b82 100644 --- a/contrib/src/xml/xh_notbk.cpp +++ b/contrib/src/xml/xh_notbk.cpp @@ -41,30 +41,30 @@ wxNotebookXmlHandler::wxNotebookXmlHandler() wxObject *wxNotebookXmlHandler::DoCreateResource() { - if (m_Node->GetName() == _T("notebookpage")) + if (m_Class == _T("notebookpage")) { - wxXmlNode *n = GetParamNode(_T("window"))->GetChildren(); - while (n) + wxXmlNode *n = GetParamNode(_T("object")); + + if (n) { - if (n->GetType() == wxXML_ELEMENT_NODE) - { - bool old_ins = m_IsInside; - m_IsInside = FALSE; - m_IsInside = old_ins; - wxObject *item = CreateResFromNode(n, m_Notebook, NULL); - wxWindow *wnd = wxDynamicCast(item, wxWindow); - - if (wnd) - m_Notebook->AddPage(wnd, GetText(_T("label")), - GetBool(_T("selected"), 0)); - else - wxLogError(_T("Error in resource.")); - return wnd; - } - n = n->GetNext(); + bool old_ins = m_IsInside; + m_IsInside = FALSE; + m_IsInside = old_ins; + wxObject *item = CreateResFromNode(n, m_Notebook, NULL); + wxWindow *wnd = wxDynamicCast(item, wxWindow); + + if (wnd) + m_Notebook->AddPage(wnd, GetText(_T("label")), + GetBool(_T("selected"), 0)); + else + wxLogError(_T("Error in resource.")); + return wnd; + } + else + { + wxLogError(_T("Error in resource: no control within notebook's tag.")); + return NULL; } - wxLogError(_T("Error in resource: no control within notebook's tag.")); - return NULL; } else { @@ -93,8 +93,8 @@ wxObject *wxNotebookXmlHandler::DoCreateResource() bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node) { - return ((!m_IsInside && node->GetName() == _T("notebook")) || - (m_IsInside && node->GetName() == _T("notebookpage"))); + return ((!m_IsInside && IsOfClass(node, _T("wxNotebook"))) || + (m_IsInside && IsOfClass(node, _T("notebookpage")))); } #endif diff --git a/contrib/src/xml/xh_panel.cpp b/contrib/src/xml/xh_panel.cpp index cc4cff021a..6240cb96b1 100644 --- a/contrib/src/xml/xh_panel.cpp +++ b/contrib/src/xml/xh_panel.cpp @@ -59,5 +59,5 @@ wxObject *wxPanelXmlHandler::DoCreateResource() bool wxPanelXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("panel"); + return IsOfClass(node, _T("wxPanel")); } diff --git a/contrib/src/xml/xh_radbt.cpp b/contrib/src/xml/xh_radbt.cpp index f68de95518..d8306a034d 100644 --- a/contrib/src/xml/xh_radbt.cpp +++ b/contrib/src/xml/xh_radbt.cpp @@ -59,7 +59,7 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource() bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("radiobutton"); + return IsOfClass(node, _T("wxRadioButton")); } diff --git a/contrib/src/xml/xh_radbx.cpp b/contrib/src/xml/xh_radbx.cpp index 17679b952f..35db103fa2 100644 --- a/contrib/src/xml/xh_radbx.cpp +++ b/contrib/src/xml/xh_radbx.cpp @@ -36,14 +36,14 @@ wxRadioBoxXmlHandler::wxRadioBoxXmlHandler() wxObject *wxRadioBoxXmlHandler::DoCreateResource() { - if( m_Node->GetName() == _T("radiobox")) + if( m_Class == _T("wxRadioBox")) { // find the selection long selection = GetLong( _T("selection"), -1 ); // need to build the list of strings from children m_InsideBox = TRUE; - CreateChildren( NULL, TRUE /* only this handler */, GetParamNode(_T("content"))); + CreateChildrenPrivately( NULL, GetParamNode(_T("content"))); wxString *strings = (wxString *) NULL; if( strList.GetCount() > 0 ) { @@ -94,10 +94,9 @@ wxObject *wxRadioBoxXmlHandler::DoCreateResource() bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode *node) { - return( node->GetName() == _T("radiobox") || - ( m_InsideBox && - node->GetName() == _T("item" )) - ); + return (IsOfClass(node, _T("wxRadioBox")) || + (m_InsideBox && node->GetName() == _T("item")) + ); } #endif diff --git a/contrib/src/xml/xh_scrol.cpp b/contrib/src/xml/xh_scrol.cpp index 6e7e2b19dc..e3c46c8b3f 100644 --- a/contrib/src/xml/xh_scrol.cpp +++ b/contrib/src/xml/xh_scrol.cpp @@ -56,7 +56,7 @@ wxObject *wxScrollBarXmlHandler::DoCreateResource() bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("scrollbar"); + return IsOfClass(node, _T("wxScrollBar")); } diff --git a/contrib/src/xml/xh_sizer.cpp b/contrib/src/xml/xh_sizer.cpp index 51b29c80e6..5b9bd3d436 100644 --- a/contrib/src/xml/xh_sizer.cpp +++ b/contrib/src/xml/xh_sizer.cpp @@ -25,12 +25,12 @@ #include "wx/statbox.h" #include "wx/notebook.h" -static bool IsSizerNode(wxXmlNode *node) +bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node) { - return (node->GetName() == _T("boxsizer")) || - (node->GetName() == _T("staticboxsizer")) || - (node->GetName() == _T("gridsizer")) || - (node->GetName() == _T("flexgridsizer")); + return (IsOfClass(node, _T("wxBoxSizer"))) || + (IsOfClass(node, _T("wxStaticBoxSizer"))) || + (IsOfClass(node, _T("wxGridSizer"))) || + (IsOfClass(node, _T("wxFlexGridSizer"))); } @@ -73,51 +73,50 @@ wxSizerXmlHandler::wxSizerXmlHandler() wxObject *wxSizerXmlHandler::DoCreateResource() { - if (m_Node->GetName() == _T("sizeritem")) + if (m_Class == _T("sizeritem")) { - wxXmlNode *n = GetParamNode(_T("window"))->GetChildren(); + wxXmlNode *n = GetParamNode(_T("object")); - while (n) + if (n) { - if (n->GetType() == wxXML_ELEMENT_NODE) - { - bool old_ins = m_IsInside; - wxSizer *old_par = m_ParentSizer; - m_IsInside = FALSE; - if (!IsSizerNode(n)) m_ParentSizer = NULL; - wxObject *item = CreateResFromNode(n, m_Parent, NULL); - m_IsInside = old_ins; - m_ParentSizer = old_par; - wxSizer *sizer = wxDynamicCast(item, wxSizer); - wxWindow *wnd = wxDynamicCast(item, wxWindow); - wxSize minsize = GetSize(_T("minsize")); - - if (sizer) - { - m_ParentSizer->Add(sizer, GetLong(_T("option")), - GetStyle(_T("flag")), GetDimension(_T("border"))); - if (!(minsize == wxDefaultSize)) - m_ParentSizer->SetItemMinSize(sizer, minsize.x, minsize.y); - } - else if (wnd) - { - m_ParentSizer->Add(wnd, GetLong(_T("option")), - GetStyle(_T("flag")), GetDimension(_T("border"))); - if (!(minsize == wxDefaultSize)) - m_ParentSizer->SetItemMinSize(wnd, minsize.x, minsize.y); - } - else - wxLogError(_T("Error in resource.")); - - return item; + bool old_ins = m_IsInside; + wxSizer *old_par = m_ParentSizer; + m_IsInside = FALSE; + if (!IsSizerNode(n)) m_ParentSizer = NULL; + wxObject *item = CreateResFromNode(n, m_Parent, NULL); + m_IsInside = old_ins; + m_ParentSizer = old_par; + wxSizer *sizer = wxDynamicCast(item, wxSizer); + wxWindow *wnd = wxDynamicCast(item, wxWindow); + wxSize minsize = GetSize(_T("minsize")); + + if (sizer) + { + m_ParentSizer->Add(sizer, GetLong(_T("option")), + GetStyle(_T("flag")), GetDimension(_T("border"))); + if (!(minsize == wxDefaultSize)) + m_ParentSizer->SetItemMinSize(sizer, minsize.x, minsize.y); } - n = n->GetNext(); + else if (wnd) + { + m_ParentSizer->Add(wnd, GetLong(_T("option")), + GetStyle(_T("flag")), GetDimension(_T("border"))); + if (!(minsize == wxDefaultSize)) + m_ParentSizer->SetItemMinSize(wnd, minsize.x, minsize.y); + } + else + wxLogError(_T("Error in resource.")); + + return item; + } + else /*n == NULL*/ + { + wxLogError(_T("Error in resource: no control/sizer within sizer's tag.")); + return NULL; } - wxLogError(_T("Error in resource: no control/sizer within sizer's tag.")); - return NULL; } - else if (m_Node->GetName() == _T("spacer")) + else if (m_Class == _T("spacer")) { wxCHECK_MSG(m_ParentSizer, NULL, _T("Incorrect syntax of XML resource: spacer not within sizer!")); wxSize sz = GetSize(); @@ -130,29 +129,29 @@ wxObject *wxSizerXmlHandler::DoCreateResource() else { wxSizer *sizer = NULL; - wxXmlNode *parentNode = m_Node->GetParent()->GetParent(); + wxXmlNode *parentNode = m_Node->GetParent(); wxCHECK_MSG(m_ParentSizer != NULL || - ((parentNode->GetName() == _T("panel") || - parentNode->GetName() == _T("dialog")) && + ((IsOfClass(parentNode, _T("wxPanel")) || + IsOfClass(parentNode, _T("wxDialog"))) && parentNode->GetType() == wxXML_ELEMENT_NODE), NULL, - _T("Incorrect use of sizer: parent is not 'dialog' or 'panel'.")); + _T("Incorrect use of sizer: parent is not 'wxDialog' or 'wxPanel'.")); - if (m_Node->GetName() == _T("boxsizer")) + if (m_Class == _T("wxBoxSizer")) sizer = new wxBoxSizer(GetStyle(_T("orient"), wxHORIZONTAL)); - else if (m_Node->GetName() == _T("staticboxsizer")) + else if (m_Class == _T("wxStaticBoxSizer")) { sizer = new wxStaticBoxSizer( new wxStaticBox(m_ParentAsWindow, -1, GetText(_T("label"))), GetStyle(_T("orient"), wxHORIZONTAL)); } - else if (m_Node->GetName() == _T("gridsizer")) + else if (m_Class == _T("wxGridSizer")) sizer = new wxGridSizer(GetLong(_T("rows")), GetLong(_T("cols")), GetDimension(_T("vgap")), GetDimension(_T("hgap"))); - else if (m_Node->GetName() == _T("flexgridsizer")) + else if (m_Class == _T("wxFlexGridSizer")) sizer = new wxFlexGridSizer(GetLong(_T("rows")), GetLong(_T("cols")), GetDimension(_T("vgap")), GetDimension(_T("hgap"))); @@ -193,6 +192,6 @@ wxObject *wxSizerXmlHandler::DoCreateResource() bool wxSizerXmlHandler::CanHandle(wxXmlNode *node) { return ((!m_IsInside && IsSizerNode(node)) || - (m_IsInside && node->GetName() == _T("sizeritem")) || - (m_IsInside && node->GetName() == _T("spacer"))); + (m_IsInside && IsOfClass(node, _T("sizeritem"))) || + (m_IsInside && IsOfClass(node, _T("spacer")))); } diff --git a/contrib/src/xml/xh_slidr.cpp b/contrib/src/xml/xh_slidr.cpp index 12afa0aabb..ec99ffb413 100644 --- a/contrib/src/xml/xh_slidr.cpp +++ b/contrib/src/xml/xh_slidr.cpp @@ -87,7 +87,7 @@ wxObject *wxSliderXmlHandler::DoCreateResource() bool wxSliderXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("slider"); + return IsOfClass(node, _T("wxSlider")); } diff --git a/contrib/src/xml/xh_spin.cpp b/contrib/src/xml/xh_spin.cpp index 0a557f2eeb..24f046fd16 100644 --- a/contrib/src/xml/xh_spin.cpp +++ b/contrib/src/xml/xh_spin.cpp @@ -93,7 +93,7 @@ wxObject *wxSpinCtrlXmlHandler::DoCreateResource() bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("spinctrl"); + return IsOfClass(node, _T("wxSpinCtrl")); } #endif // wxUSE_SPINCTRL diff --git a/contrib/src/xml/xh_stbmp.cpp b/contrib/src/xml/xh_stbmp.cpp index c3620d06c5..4e654a4553 100644 --- a/contrib/src/xml/xh_stbmp.cpp +++ b/contrib/src/xml/xh_stbmp.cpp @@ -46,7 +46,7 @@ wxObject *wxStaticBitmapXmlHandler::DoCreateResource() bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("staticbitmap"); + return IsOfClass(node, _T("wxStaticBitmap")); } diff --git a/contrib/src/xml/xh_stbox.cpp b/contrib/src/xml/xh_stbox.cpp index 3613fbc671..1f49da12c1 100644 --- a/contrib/src/xml/xh_stbox.cpp +++ b/contrib/src/xml/xh_stbox.cpp @@ -46,7 +46,7 @@ wxObject *wxStaticBoxXmlHandler::DoCreateResource() bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("staticbox"); + return IsOfClass(node, _T("wxStaticBox")); } diff --git a/contrib/src/xml/xh_stlin.cpp b/contrib/src/xml/xh_stlin.cpp index 0ec560d52c..546838654c 100644 --- a/contrib/src/xml/xh_stlin.cpp +++ b/contrib/src/xml/xh_stlin.cpp @@ -49,7 +49,7 @@ wxObject *wxStaticLineXmlHandler::DoCreateResource() bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("staticline"); + return IsOfClass(node, _T("wxStaticLine")); } #endif diff --git a/contrib/src/xml/xh_sttxt.cpp b/contrib/src/xml/xh_sttxt.cpp index d4e4ff24f6..4627292fcb 100644 --- a/contrib/src/xml/xh_sttxt.cpp +++ b/contrib/src/xml/xh_sttxt.cpp @@ -47,7 +47,7 @@ wxObject *wxStaticTextXmlHandler::DoCreateResource() bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("statictext"); + return IsOfClass(node, _T("wxStaticText")); } diff --git a/contrib/src/xml/xh_text.cpp b/contrib/src/xml/xh_text.cpp index a1203536b3..59d9ba87b1 100644 --- a/contrib/src/xml/xh_text.cpp +++ b/contrib/src/xml/xh_text.cpp @@ -40,8 +40,8 @@ wxObject *wxTextCtrlXmlHandler::DoCreateResource() GetText(_T("value")), GetPosition(), GetSize(), GetStyle(), - wxDefaultValidator, - GetText(_T("name")) + wxDefaultValidator, + GetName() ); SetupWindow(text); @@ -52,7 +52,7 @@ wxObject *wxTextCtrlXmlHandler::DoCreateResource() bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("textctrl"); + return IsOfClass(node, _T("wxTextCtrl")); } diff --git a/contrib/src/xml/xh_toolb.cpp b/contrib/src/xml/xh_toolb.cpp index 927642e641..0460be690c 100644 --- a/contrib/src/xml/xh_toolb.cpp +++ b/contrib/src/xml/xh_toolb.cpp @@ -38,7 +38,7 @@ wxToolBarXmlHandler::wxToolBarXmlHandler() wxObject *wxToolBarXmlHandler::DoCreateResource() { - if (m_Node->GetName() == _T("tool")) + if (m_Class == _T("tool")) { wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: tool not within a toolbar!")); m_Toolbar->AddTool(GetID(), @@ -53,14 +53,14 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() return m_Toolbar; // must return non-NULL } - else if (m_Node->GetName() == _T("separator")) + else if (m_Class == _T("separator")) { wxCHECK_MSG(m_Toolbar, NULL, _T("Incorrect syntax of XML resource: separator not within a toolbar!")); m_Toolbar->AddSeparator(); return m_Toolbar; // must return non-NULL } - else /**/ + else /**/ { int style = GetStyle(_T("style"), wxNO_BORDER | wxTB_HORIZONTAL); #ifdef __WXMSW__ @@ -86,22 +86,23 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() if (separation != -1) toolbar->SetToolSeparation(separation); - wxXmlNode *children_node = GetParamNode(_T("children")); + wxXmlNode *children_node = GetParamNode(_T("object")); if (children_node == NULL) return toolbar; m_IsInside = TRUE; m_Toolbar = toolbar; - wxXmlNode *n = children_node->GetChildren(); + wxXmlNode *n = children_node; while (n) { - if (n->GetType() == wxXML_ELEMENT_NODE) + if (n->GetType() == wxXML_ELEMENT_NODE && + n->GetName() == _T("object")) { wxObject *created = CreateResFromNode(n, toolbar, NULL); wxControl *control = wxDynamicCast(created, wxControl); - if (n->GetName() != _T("tool") && - n->GetName() != _T("separator") && + if (IsOfClass(n, _T("tool")) && + IsOfClass(n, _T("separator")) && control != NULL) toolbar->AddControl(control); } @@ -120,9 +121,9 @@ wxObject *wxToolBarXmlHandler::DoCreateResource() bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node) { - return ((!m_IsInside && node->GetName() == _T("toolbar")) || - (m_IsInside && node->GetName() == _T("tool")) || - (m_IsInside && node->GetName() == _T("separator"))); + return ((!m_IsInside && IsOfClass(node, _T("wxToolBar"))) || + (m_IsInside && IsOfClass(node, _T("tool"))) || + (m_IsInside && IsOfClass(node, _T("separator")))); } #endif diff --git a/contrib/src/xml/xh_tree.cpp b/contrib/src/xml/xh_tree.cpp index b10dc6ce94..941648be98 100644 --- a/contrib/src/xml/xh_tree.cpp +++ b/contrib/src/xml/xh_tree.cpp @@ -51,7 +51,7 @@ wxObject *wxTreeCtrlXmlHandler::DoCreateResource() bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("treectrl"); + return IsOfClass(node, _T("wxTreeCtrl")); } diff --git a/contrib/src/xml/xh_unkwn.cpp b/contrib/src/xml/xh_unkwn.cpp index d9a05b7c52..7c3f083417 100644 --- a/contrib/src/xml/xh_unkwn.cpp +++ b/contrib/src/xml/xh_unkwn.cpp @@ -43,7 +43,7 @@ wxObject *wxUnknownWidgetXmlHandler::DoCreateResource() wnd = m_ParentAsWindow->FindWindow(name); if (wnd == NULL) - wxLogError(_T("Cannot find specified window for (id=%li, name='%s')."), id, name.mb_str()); + wxLogError(_T("Cannot find specified window for class 'unknown' (id=%li, name='%s')."), id, name.mb_str()); else { if (wnd->GetParent() != m_ParentAsWindow) @@ -56,6 +56,6 @@ wxObject *wxUnknownWidgetXmlHandler::DoCreateResource() bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node) { - return node->GetName() == _T("unknown"); + return IsOfClass(node, _T("unknown")); } diff --git a/contrib/src/xml/xmlres.cpp b/contrib/src/xml/xmlres.cpp index c2021c48ab..7fb10475f0 100644 --- a/contrib/src/xml/xmlres.cpp +++ b/contrib/src/xml/xmlres.cpp @@ -131,21 +131,21 @@ void wxXmlResource::ClearHandlers() wxMenu *wxXmlResource::LoadMenu(const wxString& name) { - return (wxMenu*)CreateResFromNode(FindResource(name, wxT("menu")), NULL, NULL); + return (wxMenu*)CreateResFromNode(FindResource(name, wxT("wxMenu")), NULL, NULL); } wxMenuBar *wxXmlResource::LoadMenuBar(const wxString& name) { - return (wxMenuBar*)CreateResFromNode(FindResource(name, wxT("menubar")), NULL, NULL); + return (wxMenuBar*)CreateResFromNode(FindResource(name, wxT("wxMenuBar")), NULL, NULL); } wxToolBar *wxXmlResource::LoadToolBar(wxWindow *parent, const wxString& name) { - return (wxToolBar*)CreateResFromNode(FindResource(name, wxT("toolbar")), parent, NULL); + return (wxToolBar*)CreateResFromNode(FindResource(name, wxT("wxToolBar")), parent, NULL); } @@ -160,19 +160,19 @@ wxDialog *wxXmlResource::LoadDialog(wxWindow *parent, const wxString& name) bool wxXmlResource::LoadDialog(wxDialog *dlg, wxWindow *parent, const wxString& name) { - return CreateResFromNode(FindResource(name, wxT("dialog")), parent, dlg) != NULL; + return CreateResFromNode(FindResource(name, wxT("wxDialog")), parent, dlg) != NULL; } wxPanel *wxXmlResource::LoadPanel(wxWindow *parent, const wxString& name) { - return (wxPanel*)CreateResFromNode(FindResource(name, wxT("panel")), parent, NULL); + return (wxPanel*)CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, NULL); } bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& name) { - return CreateResFromNode(FindResource(name, wxT("panel")), parent, panel) != NULL; + return CreateResFromNode(FindResource(name, wxT("wxPanel")), parent, panel) != NULL; } @@ -180,7 +180,7 @@ bool wxXmlResource::LoadPanel(wxPanel *panel, wxWindow *parent, const wxString& wxBitmap wxXmlResource::LoadBitmap(const wxString& name) { wxBitmap *bmp = (wxBitmap*)CreateResFromNode( - FindResource(name, wxT("bitmap")), NULL, NULL); + FindResource(name, wxT("wxBitmap")), NULL, NULL); wxBitmap rt; if (bmp) { rt = *bmp; delete bmp; } @@ -190,7 +190,7 @@ wxBitmap wxXmlResource::LoadBitmap(const wxString& name) wxIcon wxXmlResource::LoadIcon(const wxString& name) { wxIcon *icon = (wxIcon*)CreateResFromNode( - FindResource(name, wxT("icon")), NULL, NULL); + FindResource(name, wxT("wxIcon")), NULL, NULL); wxIcon rt; if (icon) { rt = *icon; delete icon; } @@ -314,7 +314,7 @@ void wxXmlResource::UpdateResources() -wxXmlNode *wxXmlResource::FindResource(const wxString& name, const wxString& type) +wxXmlNode *wxXmlResource::FindResource(const wxString& name, const wxString& classname) { UpdateResources(); //ensure everything is up-to-date @@ -324,10 +324,12 @@ wxXmlNode *wxXmlResource::FindResource(const wxString& name, const wxString& typ if (m_Data[f].Doc == NULL || m_Data[f].Doc->GetRoot() == NULL) continue; for (wxXmlNode *node = m_Data[f].Doc->GetRoot()->GetChildren(); node; node = node->GetNext()) - if ( node->GetType() == wxXML_ELEMENT_NODE && - (!type || node->GetName() == type) && - node->GetPropVal(wxT("name"), &dummy) && - dummy == name) + if (node->GetType() == wxXML_ELEMENT_NODE && + (!classname || + node->GetPropVal(wxT("class"), wxEmptyString) == classname) && + node->GetName() == wxT("object") && + node->GetPropVal(wxT("name"), &dummy) && + dummy == name) { #if wxUSE_FILESYSTEM m_CurFileSystem.ChangePathTo(m_Data[f].File); @@ -336,8 +338,8 @@ wxXmlNode *wxXmlResource::FindResource(const wxString& name, const wxString& typ } } - wxLogError(_("XML resource '%s' (type '%s') not found!"), - name.c_str(), type.c_str()); + wxLogError(_("XML resource '%s' (class '%s') not found!"), + name.c_str(), classname.c_str()); return NULL; } @@ -353,7 +355,7 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wx while (ND) { handler = (wxXmlResourceHandler*)ND->GetData(); - if (handler->CanHandle(node)) + if (node->GetName() == _T("object") && handler->CanHandle(node)) { ret = handler->CreateResource(node, parent, instance); if (ret) return ret; @@ -361,7 +363,9 @@ wxObject *wxXmlResource::CreateResFromNode(wxXmlNode *node, wxObject *parent, wx ND = ND->GetNext(); } - wxLogError(_("No handler found for XML node '%s'!"), node->GetName().c_str()); + wxLogError(_("No handler found for XML node '%s', class '%s'!"), + node->GetName().c_str(), + node->GetPropVal(_T("class"), wxEmptyString).c_str()); return NULL; } @@ -383,10 +387,12 @@ wxXmlResourceHandler::wxXmlResourceHandler() wxObject *wxXmlResourceHandler::CreateResource(wxXmlNode *node, wxObject *parent, wxObject *instance) { wxXmlNode *myNode = m_Node; + wxString myClass = m_Class; wxObject *myParent = m_Parent, *myInstance = m_Instance; wxWindow *myParentAW = m_ParentAsWindow, *myInstanceAW = m_InstanceAsWindow; m_Node = node; + m_Class = node->GetPropVal(_T("class"), wxEmptyString); m_Parent = parent; m_Instance = instance; m_ParentAsWindow = wxDynamicCast(m_Parent, wxWindow); @@ -395,6 +401,7 @@ wxObject *wxXmlResourceHandler::CreateResource(wxXmlNode *node, wxObject *parent wxObject *returned = DoCreateResource(); m_Node = myNode; + m_Class = myClass; m_Parent = myParent; m_ParentAsWindow = myParentAW; m_Instance = myInstance; m_InstanceAsWindow = myInstanceAW; @@ -810,23 +817,17 @@ void wxXmlResourceHandler::SetupWindow(wxWindow *wnd) } -void wxXmlResourceHandler::CreateChildren(wxObject *parent, - bool only_this_handler, wxXmlNode *children_node) +void wxXmlResourceHandler::CreateChildren(wxObject *parent, bool this_hnd_only) { - if (children_node == NULL) children_node = GetParamNode(_T("children")); - if (children_node == NULL) return; - - wxXmlNode *n = children_node->GetChildren(); + wxXmlNode *n = m_Node->GetChildren(); while (n) { - if (n->GetType() == wxXML_ELEMENT_NODE) + if (n->GetType() == wxXML_ELEMENT_NODE && + n->GetName() == _T("object")) { - if (only_this_handler) - { - if (CanHandle(n)) - CreateResource(n, parent, NULL); - } + if (this_hnd_only && CanHandle(n)) + CreateResource(n, parent, NULL); else m_Resource->CreateResFromNode(n, parent, NULL); } @@ -835,6 +836,23 @@ void wxXmlResourceHandler::CreateChildren(wxObject *parent, } +void wxXmlResourceHandler::CreateChildrenPrivately(wxObject *parent, wxXmlNode *rootnode = NULL) +{ + wxXmlNode *root; + if (rootnode == NULL) root = m_Node; else root = rootnode; + wxXmlNode *n = root->GetChildren(); + + while (n) + { + if (n->GetType() == wxXML_ELEMENT_NODE && CanHandle(n)) + { + CreateResource(n, parent, NULL); + } + n = n->GetNext(); + } +} + + diff --git a/contrib/utils/convertrc/rc2xml.cpp b/contrib/utils/convertrc/rc2xml.cpp index 795f45a9eb..be22c23737 100644 --- a/contrib/utils/convertrc/rc2xml.cpp +++ b/contrib/utils/convertrc/rc2xml.cpp @@ -123,7 +123,7 @@ microsoft reuses the keyword DIALOG for other things wxString title; wxString ptsize,face; - m_xmlfile.Write("\t\n"); ParseControls(); - m_xmlfile.Write("\t\n"); - m_xmlfile.Write("\t\n"); + m_xmlfile.Write("\t\n"); } /* @@ -207,9 +205,9 @@ void rc2xml::ParseStaticText() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } //EDITTEXT IDC_RADIUS,36,65,40,14,ES_AUTOHSCROLL @@ -222,9 +220,9 @@ void rc2xml::ParseTextCtrl() ReadRect(x,y,width,height); //TODO //style=GetToken(); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } //PUSHBUTTON "Create/Update",IDC_CREATE,15,25,53,13,NOT WS_TABSTOP @@ -238,10 +236,10 @@ void rc2xml::ParsePushButton() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } @@ -271,10 +269,10 @@ void rc2xml::ParseGroupBox() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } void rc2xml::ReadRect(int & x, int & y, int & width, int & height) @@ -375,9 +373,9 @@ void rc2xml::ParseComboBox() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\n\t\t\n"); } @@ -386,12 +384,11 @@ void rc2xml::ParseMenu(wxString varname) wxString token=""; //Write menubar to xml file - m_xmlfile.Write("\t\n"); - m_xmlfile.Write("\t\t\n"); while ((token!="BEGIN")&(token!="{")) token=GetToken(); @@ -404,8 +401,7 @@ void rc2xml::ParseMenu(wxString varname) ParsePopupMenu(); } } - m_xmlfile.Write("\t\t\n"); - m_xmlfile.Write("\t\n"); + m_xmlfile.Write("\t\n"); } void rc2xml::ParsePopupMenu() @@ -423,11 +419,10 @@ void rc2xml::ParsePopupMenu() //Write Menu item //Generate a fake name since RC menus don't have one name<<"Menu_"<\n"); WriteLabel(token); - m_xmlfile.Write("\t\t\t\n"); while ((token!="BEGIN")&(token!="{")) token=GetToken(); @@ -441,8 +436,7 @@ void rc2xml::ParsePopupMenu() if (token=="MENUITEM") ParseMenuItem(); } - m_xmlfile.Write("\t\t\t\n"); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } wxString rc2xml::PeekToken() @@ -484,10 +478,10 @@ void rc2xml::ParseSlider(wxString label, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\n\t\t\n"); } /* @@ -503,10 +497,10 @@ void rc2xml::ParseProgressBar(wxString label, wxString varname) ReadRect(x,y,width,height); //Always horizontal in MFC - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } bool rc2xml::ReadOrs(wxString & orstring) @@ -538,19 +532,19 @@ void rc2xml::ParseCtrlButton(wxString label, wxString varname) if (token.Find("BS_AUTOCHECKBOX")!=-1) { ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } if (token.Find("BS_AUTORADIOBUTTON")!=-1) { ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } } @@ -654,9 +648,9 @@ void rc2xml::ParseListBox() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\n\t\t\n"); } /* @@ -673,10 +667,10 @@ void rc2xml::ParseRichEdit(wxString label, wxString varname) wxString style; //Make it a rich text control style+="wxTE_MULTILINE "; - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } /* @@ -696,10 +690,10 @@ void rc2xml::ParseSpinCtrl(wxString label, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\n\t\t\n"); } @@ -770,7 +764,7 @@ void rc2xml::ParseToolBar(wxString varname) wxLogError("Unable to load bitmap:"+*bitmappath); //Write toolbar to xml file - m_xmlfile.Write(" \n"); //Grab width and height int width,height; @@ -797,7 +790,7 @@ void rc2xml::ParseToolBar(wxString varname) if (token=="BUTTON") { buttonname=GetToken(); - m_xmlfile.Write("\t\t\t\n"); //Write tool tip if any @@ -812,17 +805,16 @@ void rc2xml::ParseToolBar(wxString varname) buttonname+=".bmp"; m_xmlfile.Write("\t\t\t\t"+buttonname+"\n"); WriteToolButton(buttonname,c,width,height,bitmap); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); c++; } else if (token=="SEPARATOR") { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } token=GetToken(); } - m_xmlfile.Write("\t\n"); - m_xmlfile.Write("\t\n"); + m_xmlfile.Write("\t\n"); } //Extract bitmaps from larger toolbar bitmap @@ -890,7 +882,7 @@ void rc2xml::ParseMenuItem() //int spot; if (PeekToken()=="SEPARATOR") { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); return; } @@ -899,7 +891,7 @@ void rc2xml::ParseMenuItem() //Remove \t because it causes problems //spot=token.First("\\t"); //token=token.Left(spot); - m_xmlfile.Write("\t\t\t\n"); WriteLabel(token); @@ -926,7 +918,7 @@ void rc2xml::ParseMenuItem() ptoken=PeekToken(); } - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } @@ -942,11 +934,11 @@ void rc2xml::ParseIconStatic() int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } //IDR_MAINFRAME ICON DISCARDABLE "res\\mfcexample.ico" @@ -984,10 +976,10 @@ void rc2xml::ParseStaticBitmap(wxString bitmapname, wxString varname) int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } @@ -1058,10 +1050,10 @@ if (token.Find("SBS_VERT")!=-1) else style=_T("wxSB_HORIZONTAL"); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\n\t\t\n"); } // CONTROL "Tree1",IDC_TREE1,"SysTreeView32",WS_BORDER | WS_TABSTOP, @@ -1074,9 +1066,9 @@ void rc2xml::ParseTreeCtrl(wxString label, wxString varname) ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } // CONTROL "MonthCalendar1",IDC_MONTHCALENDAR1,"SysMonthCal32", @@ -1089,9 +1081,9 @@ void rc2xml::ParseCalendar(wxString label, wxString varname) ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } // CONTROL "List1",IDC_LIST1,"SysListView32",WS_BORDER | WS_TABSTOP, // 7,89,68,71 @@ -1103,9 +1095,9 @@ void rc2xml::ParseListCtrl(wxString label, wxString varname) ReadOrs(token); int x,y,width,height; ReadRect(x,y,width,height); - m_xmlfile.Write("\t\t\n"); + m_xmlfile.Write("\t\t\n"); } diff --git a/contrib/utils/convertrc/wxr2xml.cpp b/contrib/utils/convertrc/wxr2xml.cpp index 6aa5ad54f7..f2e331ec5c 100644 --- a/contrib/utils/convertrc/wxr2xml.cpp +++ b/contrib/utils/convertrc/wxr2xml.cpp @@ -92,28 +92,24 @@ bool wxr2xml::ParseResources() void wxr2xml::ParsePanel(wxItemResource * res) { - m_xmlfile.Write("\t\n"); ParseControls(res); - m_xmlfile.Write(" \t\t\n"); - m_xmlfile.Write("\t\n\n"); + m_xmlfile.Write("\t\n\n"); } void wxr2xml::ParseDialog(wxItemResource * res) { PanelStuff(res); - m_xmlfile.Write("\t\n"); ParseControls(res); - m_xmlfile.Write("\t\t\n"); - m_xmlfile.Write("\t\n\n"); + m_xmlfile.Write("\t\n\n"); } void wxr2xml::ParseControls(wxItemResource * res) @@ -194,18 +190,18 @@ wxString wxr2xml::GetPosition(wxItemResource * res) void wxr2xml::ParseButton(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseTextCtrl(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } @@ -225,11 +221,11 @@ wxString wxr2xml::GetValue4(wxItemResource * res) void wxr2xml::ParseCheckBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } wxString wxr2xml::GetLabel(wxItemResource * res) @@ -239,38 +235,38 @@ wxString wxr2xml::GetLabel(wxItemResource * res) void wxr2xml::ParseRadioBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseListBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseStaticText(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseStaticBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::WriteStringList(wxItemResource * res) @@ -286,20 +282,20 @@ void wxr2xml::WriteStringList(wxItemResource * res) void wxr2xml::ParseChoice(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseGauge(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\n\t\t\t\n"); } wxString wxr2xml::GetValue1(wxItemResource * res) @@ -318,12 +314,12 @@ wxString wxr2xml::GetRange(wxItemResource * res) void wxr2xml::ParseSlider(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\n\t\t\t\n"); } wxString wxr2xml::GetMax(wxItemResource * res) @@ -342,34 +338,34 @@ wxString wxr2xml::GetMin(wxItemResource * res) void wxr2xml::ParseComboBox(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\n\t\t\t\n"); } void wxr2xml::ParseRadioButton(wxItemResource * res) { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::ParseScrollBar(wxItemResource * res) { - m_xmlfile.Write("\t\t\t"+GetValue2(res)+"\n"); m_xmlfile.Write("\t\t\t\t"+GetValue3(res)+"\n"); m_xmlfile.Write("\t\t\t\t"+GetValue5(res)+"\n"); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } wxString wxr2xml::GetCheckStatus(wxItemResource * res) @@ -584,18 +580,16 @@ void wxr2xml::ParseMenuBar(wxItemResource * res) wxItemResource *child; wxNode *node = res->GetChildren().First(); // Get Menu Bar Name - m_xmlfile.Write("\t\n"); - m_xmlfile.Write("\t\t\n"); while (node) { child = (wxItemResource *) node->Data(); ParseMenu(child); node = node->Next(); } - m_xmlfile.Write("\t\t\n"); - m_xmlfile.Write("\t \n\n"); + m_xmlfile.Write("\t \n\n"); } void wxr2xml::ParseMenu(wxItemResource * res) @@ -603,7 +597,7 @@ void wxr2xml::ParseMenu(wxItemResource * res) wxItemResource *child; wxNode *node = res->GetChildren().First(); // Get Menu - m_xmlfile.Write("\t\t\tGetValue1() << "\""; m_xmlfile.Write(menuname); @@ -613,7 +607,6 @@ void wxr2xml::ParseMenu(wxItemResource * res) if (res->GetValue4() != "") m_xmlfile.Write("\t\t\t\t" + res->GetValue4() + "\n"); - m_xmlfile.Write("\t\t\t\n"); // Read in menu items and additional menus while (node) { child = (wxItemResource *) node->Data(); @@ -623,17 +616,16 @@ void wxr2xml::ParseMenu(wxItemResource * res) ParseMenu(child); node = node->Next(); } - m_xmlfile.Write("\t\t\t\n"); - m_xmlfile.Write("\t\t\t \n"); + m_xmlfile.Write("\t\t\t \n"); } void wxr2xml::ParseMenuItem(wxItemResource * res) { // Get Menu Item or Separator if (res->GetTitle() == "") { - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } else { - m_xmlfile.Write("\t\t\t\tGetValue1() << "\""; m_xmlfile.Write(menuname); @@ -645,7 +637,7 @@ void wxr2xml::ParseMenuItem(wxItemResource * res) res->GetValue4() + "\n"); if (res->GetValue2()) m_xmlfile.Write("\t\t\t\t1\n"); - m_xmlfile.Write("\t\t\t \n"); + m_xmlfile.Write("\t\t\t \n"); } } @@ -657,7 +649,7 @@ wxString wxr2xml::FixMenuString(wxString phrase) void wxr2xml::ParseStaticBitmap(wxItemResource * res) { - m_xmlfile.Write("\t\t\t" + bitmapname + ""); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); // bitmap5 } //Parse a bitmap resource void wxr2xml::ParseBitmap(wxItemResource * res) { - m_xmlfile.Write("\t"); wxString bitmapname; bitmapname = res->GetName(); @@ -682,7 +674,7 @@ void wxr2xml::ParseBitmap(wxItemResource * res) bitmapname += _T(".bmp"); bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP); m_xmlfile.Write(bitmapname); - m_xmlfile.Write("\n\n"); + m_xmlfile.Write("\n\n"); } void wxr2xml::PanelStuff(wxItemResource * res) @@ -727,7 +719,7 @@ wxString wxr2xml::GetValue5(wxItemResource *res) void wxr2xml::ParseBitmapButton(wxItemResource *res) { - m_xmlfile.Write("\t\t\t" + bitmapname + "\n"); - m_xmlfile.Write("\t\t\t\n"); + m_xmlfile.Write("\t\t\t\n"); } void wxr2xml::WriteFontInfo(wxItemResource *res) @@ -779,19 +771,19 @@ void wxr2xml::GetFontFace(wxFont font) case wxDEFAULT: break; case wxDECORATIVE: - m_xmlfile.Write("\t\t\t\tDecorative\n"); + m_xmlfile.Write("\t\t\t\tdecorative\n"); break; case wxROMAN: - m_xmlfile.Write("\t\t\t\tRoman\n"); + m_xmlfile.Write("\t\t\t\troman\n"); break; case wxSCRIPT: - m_xmlfile.Write("\t\t\t\tScript\n"); + m_xmlfile.Write("\t\t\t\tscript\n"); break; case wxSWISS: - m_xmlfile.Write("\t\t\t\tSwiss\n"); + m_xmlfile.Write("\t\t\t\tswiss\n"); break; case wxMODERN: - m_xmlfile.Write("\t\t\t\tModern\n"); + m_xmlfile.Write("\t\t\t\tmodern\n"); break; default: wxLogError("Unknown font face"); diff --git a/contrib/utils/wxrc/wxrc.cpp b/contrib/utils/wxrc/wxrc.cpp index ad0c3de2ad..eacf6222b2 100644 --- a/contrib/utils/wxrc/wxrc.cpp +++ b/contrib/utils/wxrc/wxrc.cpp @@ -83,7 +83,7 @@ int XmlResApp::OnRun() { wxCMD_LINE_SWITCH, "c", "cpp-code", "output C++ source rather than .rsc file" }, { wxCMD_LINE_SWITCH, "u", "uncompressed", "do not compress .xml files (C++ only)" }, { wxCMD_LINE_OPTION, "n", "function", "C++ function name (with -c) [InitXmlResource]" }, - { wxCMD_LINE_OPTION, "o", "output", "output file [resource.rsc/cpp]" }, + { wxCMD_LINE_OPTION, "o", "output", "output file [resource.xrs/cpp]" }, { wxCMD_LINE_OPTION, "l", "list-of-handlers", "output list of neccessary handlers to this file" }, { wxCMD_LINE_PARAM, NULL, NULL, "input file", @@ -133,7 +133,7 @@ void XmlResApp::ParseParams(const wxCmdLineParser& cmdline) flagCompress = flagCPP && !cmdline.Found("u"); if (!cmdline.Found("o", &parOutput)) - parOutput = flagCPP ? "resource.cpp" : "resource.rsc"; + parOutput = flagCPP ? "resource.cpp" : "resource.xrs"; parOutputPath = wxPathOnly(parOutput); if (!parOutputPath) parOutputPath = "."; @@ -189,8 +189,8 @@ wxArrayString XmlResApp::PrepareTempFiles() FindFilesInXML(doc.GetRoot(), flist, path); - doc.Save(parOutputPath + "/" + name + ".xmb", flagCompress ? wxXML_IO_BINZ : wxXML_IO_BIN); - flist.Add(name + ".xmb"); + doc.Save(parOutputPath + "/" + name + ".xrc", flagCompress ? wxXML_IO_BINZ : wxXML_IO_BIN); + flist.Add(name + ".xrc"); } return flist; @@ -285,38 +285,32 @@ static wxString FileToCppArray(wxString filename, int num) wxString snum; wxFFile file(filename, "rb"); size_t lng = file.Length(); - int linelng; snum.Printf("%i", num); output.Printf("static size_t xml_res_size_" + snum + " = %i;\n", lng); - output += "static unsigned char xml_res_file_" + snum + "[] = \"\\\n"; + output += "static unsigned char xml_res_file_" + snum + "[] = {\n"; + // we cannot use string literals because MSVC is dumb wannabe compiler + // with arbitrary limitation to 2048 strings :( unsigned char *buffer = new unsigned char[lng]; file.Read(buffer, lng); for (size_t i = 0, linelng = 0; i < lng; i++) { - if (linelng > 70) + tmp.Printf("%i", buffer[i]); + if (i != 0) output << ','; + if (linelng > 70) { linelng = 0; - output += "\\\n"; - } - if (buffer[i] < 32 || buffer[i] == '"' || buffer[i] == '\\') - { - tmp.Printf("\\%03o", buffer[i]); - output += tmp; - linelng += 4; - } - else - { - output << (wxChar)buffer[i]; - linelng++; + output << "\n"; } + output << tmp; + linelng += tmp.Length()+1; } delete[] buffer; - output += "\"\n;\n\n"; + output += "};\n\n"; return output; } @@ -378,7 +372,7 @@ void " + parFuncname + "()\n\ wxString name, ext, path; wxSplitPath(parFiles[i], &path, &name, &ext); file.Write(" wxTheXmlResource->Load(\"memory:xml_resource/" + - name + ".xmb" + "\");\n"); + name + ".xrc" + "\");\n"); } file.Write("\n}\n"); diff --git a/contrib/utils/wxrcedit/Makefile.in b/contrib/utils/wxrcedit/Makefile.in index 2a58488b7e..d369563d09 100644 --- a/contrib/utils/wxrcedit/Makefile.in +++ b/contrib/utils/wxrcedit/Makefile.in @@ -6,57 +6,24 @@ program_dir = contrib/utils/wxrcedit PROGRAM=wxrcedit -OBJECTS=edapp.o editor.o nodehnd.o prophnd.o xmlhelpr.o +OBJECTS=edapp.o editor.o nodehnd.o prophnd.o xmlhelpr.o preview.o DATADIRS = df -DATAFILES = \ - df/boxsizer.df \ - df/break.df \ - df/button.df \ - df/checkbox.df \ - df/checklist.df \ - df/choice.df \ - df/combobox.df \ - df/control.df \ - df/dialog.df \ - df/flexgridsizer.df \ - df/gauge.df \ - df/gridsizer.df \ - df/htmlwindow.df \ - df/menu.df \ - df/menu_item.df \ - df/menubar.df \ - df/menuitem.df \ - df/notebook.df \ - df/notebookpage.df \ - df/panel.df \ - df/panel_item.df \ - df/panelbase.df \ - df/radiobox.df \ - df/radiobutton.df \ - df/separator.df \ - df/sizer_item.df \ - df/sizeritem.df \ - df/slider.df \ - df/spacer.df \ - df/spinbutton.df \ - df/spinctrl.df \ - df/staticbitmap.df \ - df/staticboxsizer.df \ - df/statictext.df \ - df/textctrl.df \ - df/toolbar_item.df \ - df/tool.df \ - df/toolbar.df \ - df/window.df \ - df/listbox.df \ - df/bitmapbutton.df \ - df/calendarctrl.df \ - df/listctrl.df \ - df/scrollbar.df \ - df/staticbox.df \ - df/treectrl.df - +DATAFILES = df/break.df df/control.df df/menu_item.df df/notebookpage.df \ + df/panel_item.df df/panelbase.df df/separator.df df/sizer_item.df \ + df/sizeritem.df df/spacer.df df/tool.df df/toolbar_item.df \ + df/unknown.df df/window.df df/wxBitmapButton.df df/wxBoxSizer.df \ + df/wxButton.df df/wxCalendarCtrl.df df/wxCheckBox.df \ + df/wxCheckList.df df/wxChoice.df df/wxComboBox.df df/wxDialog.df \ + df/wxFlexGridSizer.df df/wxGauge.df df/wxGridSizer.df \ + df/wxHtmlWindow.df df/wxListBox.df df/wxListCtrl.df df/wxMenu.df \ + df/wxMenuBar.df df/wxMenuItem.df df/wxNotebook.df df/wxPanel.df \ + df/wxRadioBox.df df/wxRadioButton.df df/wxScrollBar.df \ + df/wxSlider.df df/wxSpinButton.df df/wxSpinCtrl.df \ + df/wxStaticBitmap.df df/wxStaticBox.df df/wxStaticBoxSizer.df \ + df/wxStaticLine.df df/wxStaticText.df df/wxTextCtrl.df \ + df/wxToolBar.df df/wxTreeCtrl.df + APPEXTRALIBS=$(top_builddir)/lib/libwxxml.@WX_TARGET_LIBRARY_TYPE@ APPEXTRADEFS=-I$(top_srcdir)/contrib/include diff --git a/contrib/utils/wxrcedit/df/staticbitmap.df b/contrib/utils/wxrcedit/df/staticbitmap.df deleted file mode 100644 index 105691cb6c..0000000000 --- a/contrib/utils/wxrcedit/df/staticbitmap.df +++ /dev/null @@ -1,3 +0,0 @@ -node staticbitmap -var bitmap of text -derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/staticboxsizer.df b/contrib/utils/wxrcedit/df/staticboxsizer.df deleted file mode 100644 index 40e62f8b7e..0000000000 --- a/contrib/utils/wxrcedit/df/staticboxsizer.df +++ /dev/null @@ -1,4 +0,0 @@ -node staticboxsizer -derived from boxsizer -var label of text -var minsize of coord diff --git a/contrib/utils/wxrcedit/df/statictext.df b/contrib/utils/wxrcedit/df/statictext.df deleted file mode 100644 index 677c1f8632..0000000000 --- a/contrib/utils/wxrcedit/df/statictext.df +++ /dev/null @@ -1,3 +0,0 @@ -node statictext -var label of text -derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/bitmapbutton.df b/contrib/utils/wxrcedit/df/wxBitmapButton.df similarity index 90% rename from contrib/utils/wxrcedit/df/bitmapbutton.df rename to contrib/utils/wxrcedit/df/wxBitmapButton.df index 3dab7d76e2..93af80ad03 100644 --- a/contrib/utils/wxrcedit/df/bitmapbutton.df +++ b/contrib/utils/wxrcedit/df/wxBitmapButton.df @@ -1,4 +1,4 @@ -node bitmapbutton +node wxBitmapButton var style of flags wxBU_AUTODRAW,wxBU_LEFT,wxBU_RIGHT,wxBU_TOP,wxBU_BOTTOM var default of bool var bitmap of text diff --git a/contrib/utils/wxrcedit/df/boxsizer.df b/contrib/utils/wxrcedit/df/wxBoxSizer.df similarity index 88% rename from contrib/utils/wxrcedit/df/boxsizer.df rename to contrib/utils/wxrcedit/df/wxBoxSizer.df index a7845b1e55..214ae7dcd9 100644 --- a/contrib/utils/wxrcedit/df/boxsizer.df +++ b/contrib/utils/wxrcedit/df/wxBoxSizer.df @@ -1,4 +1,4 @@ -node boxsizer +node wxBoxSizer type sizer icon 0 childtype sizer_item diff --git a/contrib/utils/wxrcedit/df/button.df b/contrib/utils/wxrcedit/df/wxButton.df similarity index 52% rename from contrib/utils/wxrcedit/df/button.df rename to contrib/utils/wxrcedit/df/wxButton.df index 5322c96991..1cfc29711b 100644 --- a/contrib/utils/wxrcedit/df/button.df +++ b/contrib/utils/wxrcedit/df/wxButton.df @@ -1,4 +1,4 @@ -node button +node wxButton var label of text var default of bool derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/calendarctrl.df b/contrib/utils/wxrcedit/df/wxCalendarCtrl.df similarity index 87% rename from contrib/utils/wxrcedit/df/calendarctrl.df rename to contrib/utils/wxrcedit/df/wxCalendarCtrl.df index 45eae54d9f..5b7ce1fa10 100644 --- a/contrib/utils/wxrcedit/df/calendarctrl.df +++ b/contrib/utils/wxrcedit/df/wxCalendarCtrl.df @@ -1,3 +1,3 @@ -node calendarctrl +node wxCalendarCtrl var style of flags wxCAL_SUNDAY_FIRST,wxCAL_MONDAY_FIRST,wxCAL_SHOW_HOLIDAYS,wxCAL_NO_YEAR_CHANGE,wxCAL_NO_MONTH_CHANGE derived from control diff --git a/contrib/utils/wxrcedit/df/checkbox.df b/contrib/utils/wxrcedit/df/wxCheckBox.df similarity index 51% rename from contrib/utils/wxrcedit/df/checkbox.df rename to contrib/utils/wxrcedit/df/wxCheckBox.df index c11d2cb559..5edd23ba9d 100644 --- a/contrib/utils/wxrcedit/df/checkbox.df +++ b/contrib/utils/wxrcedit/df/wxCheckBox.df @@ -1,4 +1,4 @@ -node checkbox +node wxCheckBox var label of text var checked of bool derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/checklist.df b/contrib/utils/wxrcedit/df/wxCheckList.df similarity index 75% rename from contrib/utils/wxrcedit/df/checklist.df rename to contrib/utils/wxrcedit/df/wxCheckList.df index 3967507308..29621508c0 100644 --- a/contrib/utils/wxrcedit/df/checklist.df +++ b/contrib/utils/wxrcedit/df/wxCheckList.df @@ -1,3 +1,3 @@ -node checklist +node wxCheckList var content of not_implemented derived from control diff --git a/contrib/utils/wxrcedit/df/choice.df b/contrib/utils/wxrcedit/df/wxChoice.df similarity index 88% rename from contrib/utils/wxrcedit/df/choice.df rename to contrib/utils/wxrcedit/df/wxChoice.df index 7abe6fa256..027373513f 100644 --- a/contrib/utils/wxrcedit/df/choice.df +++ b/contrib/utils/wxrcedit/df/wxChoice.df @@ -1,4 +1,4 @@ -node choice +node wxChoice var style of flags wxCB_SORT var selection of integer var content of not_implemented diff --git a/contrib/utils/wxrcedit/df/combobox.df b/contrib/utils/wxrcedit/df/wxComboBox.df similarity index 91% rename from contrib/utils/wxrcedit/df/combobox.df rename to contrib/utils/wxrcedit/df/wxComboBox.df index 93e19d3b30..0e030092c5 100644 --- a/contrib/utils/wxrcedit/df/combobox.df +++ b/contrib/utils/wxrcedit/df/wxComboBox.df @@ -1,4 +1,4 @@ -node combobox +node wxComboBox var style of flags wxCB_SIMPLE,wxCB_SORT,wxCB_READONLY,wxCB_DROPDOWN var value of string var selection of integer diff --git a/contrib/utils/wxrcedit/df/dialog.df b/contrib/utils/wxrcedit/df/wxDialog.df similarity index 93% rename from contrib/utils/wxrcedit/df/dialog.df rename to contrib/utils/wxrcedit/df/wxDialog.df index cdc527dfd0..35d213dcc9 100644 --- a/contrib/utils/wxrcedit/df/dialog.df +++ b/contrib/utils/wxrcedit/df/wxDialog.df @@ -1,4 +1,4 @@ -node dialog +node wxDialog var title of text var style of flags wxSTAY_ON_TOP,wxCAPTION,wxDEFAULT_DIALOG_STYLE,wxTHICK_FRAME,wxSYSTEM_MENU,wxRESIZE_BORDER,wxRESIZE_BOX,wxDIALOG_MODAL,wxDIALOG_MODELESS var centered of bool diff --git a/contrib/utils/wxrcedit/df/flexgridsizer.df b/contrib/utils/wxrcedit/df/wxFlexGridSizer.df similarity index 88% rename from contrib/utils/wxrcedit/df/flexgridsizer.df rename to contrib/utils/wxrcedit/df/wxFlexGridSizer.df index e0ceee11ae..dfb093dd54 100644 --- a/contrib/utils/wxrcedit/df/flexgridsizer.df +++ b/contrib/utils/wxrcedit/df/wxFlexGridSizer.df @@ -1,4 +1,4 @@ -node flexgridsizer +node wxFlexGridSizer type sizer icon 4 childtype sizer_item diff --git a/contrib/utils/wxrcedit/df/gauge.df b/contrib/utils/wxrcedit/df/wxGauge.df similarity index 93% rename from contrib/utils/wxrcedit/df/gauge.df rename to contrib/utils/wxrcedit/df/wxGauge.df index 44a57b45b8..1f931ff30c 100644 --- a/contrib/utils/wxrcedit/df/gauge.df +++ b/contrib/utils/wxrcedit/df/wxGauge.df @@ -1,4 +1,4 @@ -node gauge +node wxGauge var style of flags wxGA_HORIZONTAL,wxGA_VERTICAL,wxGA_PROGRESSBAR,wxGA_SMOOTH var range of integer var value of integer diff --git a/contrib/utils/wxrcedit/df/gridsizer.df b/contrib/utils/wxrcedit/df/wxGridSizer.df similarity index 90% rename from contrib/utils/wxrcedit/df/gridsizer.df rename to contrib/utils/wxrcedit/df/wxGridSizer.df index 01fe2a2877..54afc9783d 100644 --- a/contrib/utils/wxrcedit/df/gridsizer.df +++ b/contrib/utils/wxrcedit/df/wxGridSizer.df @@ -1,4 +1,4 @@ -node gridsizer +node wxGridSizer type sizer icon 4 childtype sizer_item diff --git a/contrib/utils/wxrcedit/df/htmlwindow.df b/contrib/utils/wxrcedit/df/wxHtmlWindow.df similarity index 88% rename from contrib/utils/wxrcedit/df/htmlwindow.df rename to contrib/utils/wxrcedit/df/wxHtmlWindow.df index f727fcbcec..c14e1bbe9d 100644 --- a/contrib/utils/wxrcedit/df/htmlwindow.df +++ b/contrib/utils/wxrcedit/df/wxHtmlWindow.df @@ -1,4 +1,4 @@ -node htmlwindow +node wxHtmlWindow var url of text var htmlcode of text var borders of dimension diff --git a/contrib/utils/wxrcedit/df/listbox.df b/contrib/utils/wxrcedit/df/wxListBox.df similarity index 92% rename from contrib/utils/wxrcedit/df/listbox.df rename to contrib/utils/wxrcedit/df/wxListBox.df index 4ee817c384..29d831e64b 100644 --- a/contrib/utils/wxrcedit/df/listbox.df +++ b/contrib/utils/wxrcedit/df/wxListBox.df @@ -1,4 +1,4 @@ -node listbox +node wxListBox var style of flags wxLB_SINGLE,wxLB_MULTIPLE,wxLB_EXTENDED,wxLB_HSCROLL,wxLB_ALWAYS_SB,wxLB_NEEDED_SB,wxLB_SORT var selection of integer var content of not_implemented diff --git a/contrib/utils/wxrcedit/df/listctrl.df b/contrib/utils/wxrcedit/df/wxListCtrl.df similarity index 94% rename from contrib/utils/wxrcedit/df/listctrl.df rename to contrib/utils/wxrcedit/df/wxListCtrl.df index aa635575c1..00e0e96f6c 100644 --- a/contrib/utils/wxrcedit/df/listctrl.df +++ b/contrib/utils/wxrcedit/df/wxListCtrl.df @@ -1,3 +1,3 @@ -node listctrl +node wxListCtrl var style of flags wxLC_LIST,wxLC_REPORT,wxLC_REPORT,wxLC_ICON,wxLC_SMALL_ICON,wxLC_ALIGN_TOP,wxLC_ALIGN_LEFT,wxLC_AUTOARRANGE,wxLC_USER_TEXT,wxLC_EDIT_LABELS,wxLC_NO_HEADER,wxLC_SINGLE_SEL,wxLC_SORT_ASCENDING,wxLC_SORT_DESCENDING derived from control diff --git a/contrib/utils/wxrcedit/df/menu.df b/contrib/utils/wxrcedit/df/wxMenu.df similarity index 91% rename from contrib/utils/wxrcedit/df/menu.df rename to contrib/utils/wxrcedit/df/wxMenu.df index 641a0451a4..86c0e21e14 100644 --- a/contrib/utils/wxrcedit/df/menu.df +++ b/contrib/utils/wxrcedit/df/wxMenu.df @@ -1,4 +1,4 @@ -node menu +node wxMenu type panel icon 0 childtype menu_item diff --git a/contrib/utils/wxrcedit/df/menubar.df b/contrib/utils/wxrcedit/df/wxMenuBar.df similarity index 61% rename from contrib/utils/wxrcedit/df/menubar.df rename to contrib/utils/wxrcedit/df/wxMenuBar.df index 18c8397dee..7879ab6731 100644 --- a/contrib/utils/wxrcedit/df/menubar.df +++ b/contrib/utils/wxrcedit/df/wxMenuBar.df @@ -1,5 +1,5 @@ -node menubar +node wxMenuBar type panel icon 0 -childtype menu +childtype wxMenu var style of flags wxMB_DOCKABLE diff --git a/contrib/utils/wxrcedit/df/menuitem.df b/contrib/utils/wxrcedit/df/wxMenuItem.df similarity index 89% rename from contrib/utils/wxrcedit/df/menuitem.df rename to contrib/utils/wxrcedit/df/wxMenuItem.df index 9e0f07fa3e..2fc733e338 100644 --- a/contrib/utils/wxrcedit/df/menuitem.df +++ b/contrib/utils/wxrcedit/df/wxMenuItem.df @@ -1,4 +1,4 @@ -node menuitem +node wxMenuItem type normal icon 0 var label of text diff --git a/contrib/utils/wxrcedit/df/notebook.df b/contrib/utils/wxrcedit/df/wxNotebook.df similarity index 79% rename from contrib/utils/wxrcedit/df/notebook.df rename to contrib/utils/wxrcedit/df/wxNotebook.df index f20edc59f8..80b27f3b34 100644 --- a/contrib/utils/wxrcedit/df/notebook.df +++ b/contrib/utils/wxrcedit/df/wxNotebook.df @@ -1,6 +1,6 @@ -node notebook +node wxNotebook type notebook var style of flags wxNB_FIXEDWIDTH,wxNB_LEFT,wxNB_RIGHT,wxNB_BOTTOM var usenotebooksizer of bool -childtype panel +childtype wxPanel derived from control diff --git a/contrib/utils/wxrcedit/df/panel.df b/contrib/utils/wxrcedit/df/wxPanel.df similarity index 78% rename from contrib/utils/wxrcedit/df/panel.df rename to contrib/utils/wxrcedit/df/wxPanel.df index 4d44076b0e..948f510a6c 100644 --- a/contrib/utils/wxrcedit/df/panel.df +++ b/contrib/utils/wxrcedit/df/wxPanel.df @@ -1,3 +1,3 @@ -node panel +node wxPanel derived from panel_item derived from panelbase diff --git a/contrib/utils/wxrcedit/df/radiobox.df b/contrib/utils/wxrcedit/df/wxRadioBox.df similarity index 92% rename from contrib/utils/wxrcedit/df/radiobox.df rename to contrib/utils/wxrcedit/df/wxRadioBox.df index e31e60ae1a..2ddec41f4e 100644 --- a/contrib/utils/wxrcedit/df/radiobox.df +++ b/contrib/utils/wxrcedit/df/wxRadioBox.df @@ -1,4 +1,4 @@ -node radiobox +node wxRadioBox var style of flags wxRA_SPECIFY_COLS,wxRA_HORIZONTAL,wxRA_SPECIFY_ROWS,wxRA_VERTICAL var label of text var dimension of integer diff --git a/contrib/utils/wxrcedit/df/radiobutton.df b/contrib/utils/wxrcedit/df/wxRadioButton.df similarity index 82% rename from contrib/utils/wxrcedit/df/radiobutton.df rename to contrib/utils/wxrcedit/df/wxRadioButton.df index 19185fb0b3..cdc868e0c1 100644 --- a/contrib/utils/wxrcedit/df/radiobutton.df +++ b/contrib/utils/wxrcedit/df/wxRadioButton.df @@ -1,4 +1,4 @@ -node radiobutton +node wxRadioButton var label of text var value of bool var style of flags wxRB_GROUP diff --git a/contrib/utils/wxrcedit/df/scrollbar.df b/contrib/utils/wxrcedit/df/wxScrollBar.df similarity index 79% rename from contrib/utils/wxrcedit/df/scrollbar.df rename to contrib/utils/wxrcedit/df/wxScrollBar.df index 5cc71e0c72..7f19791064 100644 --- a/contrib/utils/wxrcedit/df/scrollbar.df +++ b/contrib/utils/wxrcedit/df/wxScrollBar.df @@ -1,4 +1,4 @@ -node scrollbar +node wxScrollBar var style of flags wxSB_HORIZONTAL,wxSB_VERTICAL var value of integer var thumbsize of integer diff --git a/contrib/utils/wxrcedit/df/slider.df b/contrib/utils/wxrcedit/df/wxSlider.df similarity index 96% rename from contrib/utils/wxrcedit/df/slider.df rename to contrib/utils/wxrcedit/df/wxSlider.df index ee3866b970..a97f24f667 100644 --- a/contrib/utils/wxrcedit/df/slider.df +++ b/contrib/utils/wxrcedit/df/wxSlider.df @@ -1,4 +1,4 @@ -node slider +node wxSlider var value of integer var min of integer var max of integer diff --git a/contrib/utils/wxrcedit/df/spinctrl.df b/contrib/utils/wxrcedit/df/wxSpinButton.df similarity index 89% rename from contrib/utils/wxrcedit/df/spinctrl.df rename to contrib/utils/wxrcedit/df/wxSpinButton.df index 5fac60e24f..d37c6016fb 100644 --- a/contrib/utils/wxrcedit/df/spinctrl.df +++ b/contrib/utils/wxrcedit/df/wxSpinButton.df @@ -1,4 +1,4 @@ -node spinctrl +node wxSpinButton var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP var value of integer var min of integer diff --git a/contrib/utils/wxrcedit/df/spinbutton.df b/contrib/utils/wxrcedit/df/wxSpinCtrl.df similarity index 90% rename from contrib/utils/wxrcedit/df/spinbutton.df rename to contrib/utils/wxrcedit/df/wxSpinCtrl.df index 5eed87a049..68066a9f93 100644 --- a/contrib/utils/wxrcedit/df/spinbutton.df +++ b/contrib/utils/wxrcedit/df/wxSpinCtrl.df @@ -1,4 +1,4 @@ -node spinbutton +node wxSpinCtrl var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP var value of integer var min of integer diff --git a/contrib/utils/wxrcedit/df/wxStaticBitmap.df b/contrib/utils/wxrcedit/df/wxStaticBitmap.df new file mode 100644 index 0000000000..d425d79e18 --- /dev/null +++ b/contrib/utils/wxrcedit/df/wxStaticBitmap.df @@ -0,0 +1,3 @@ +node wxStaticBitmap +var bitmap of text +derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/staticbox.df b/contrib/utils/wxrcedit/df/wxStaticBox.df similarity index 69% rename from contrib/utils/wxrcedit/df/staticbox.df rename to contrib/utils/wxrcedit/df/wxStaticBox.df index ddd135b2b8..2ecd453d50 100644 --- a/contrib/utils/wxrcedit/df/staticbox.df +++ b/contrib/utils/wxrcedit/df/wxStaticBox.df @@ -1,3 +1,3 @@ -node staticbox +node wxStaticBox var label of text derived from control diff --git a/contrib/utils/wxrcedit/df/wxStaticBoxSizer.df b/contrib/utils/wxrcedit/df/wxStaticBoxSizer.df new file mode 100644 index 0000000000..bea429049d --- /dev/null +++ b/contrib/utils/wxrcedit/df/wxStaticBoxSizer.df @@ -0,0 +1,4 @@ +node wxStaticBoxSizer +derived from wxBoxSizer +var label of text +var minsize of coord diff --git a/contrib/utils/wxrcedit/df/staticline.df b/contrib/utils/wxrcedit/df/wxStaticLine.df similarity index 79% rename from contrib/utils/wxrcedit/df/staticline.df rename to contrib/utils/wxrcedit/df/wxStaticLine.df index 75995cfb46..d674ebbcc7 100644 --- a/contrib/utils/wxrcedit/df/staticline.df +++ b/contrib/utils/wxrcedit/df/wxStaticLine.df @@ -1,3 +1,3 @@ -node staticline +node wxStaticLine var style of flags wxLI_HORIZONTAL,wxLI_VERTICAL derived from control diff --git a/contrib/utils/wxrcedit/df/wxStaticText.df b/contrib/utils/wxrcedit/df/wxStaticText.df new file mode 100644 index 0000000000..d2f1f35d5b --- /dev/null +++ b/contrib/utils/wxrcedit/df/wxStaticText.df @@ -0,0 +1,3 @@ +node wxStaticText +var label of text +derived from control \ No newline at end of file diff --git a/contrib/utils/wxrcedit/df/textctrl.df b/contrib/utils/wxrcedit/df/wxTextCtrl.df similarity index 90% rename from contrib/utils/wxrcedit/df/textctrl.df rename to contrib/utils/wxrcedit/df/wxTextCtrl.df index 706dcdf004..95ef006a33 100644 --- a/contrib/utils/wxrcedit/df/textctrl.df +++ b/contrib/utils/wxrcedit/df/wxTextCtrl.df @@ -1,4 +1,4 @@ -node textctrl +node wxTextCtrl var value of text var style of flags wxTE_PROCESS_ENTER,wxTE_PROCESS_TAB,wxTE_MULTILINE,wxTE_PASSWORD,wxTE_READONLY,wxHSCROLL derived from control diff --git a/contrib/utils/wxrcedit/df/toolbar.df b/contrib/utils/wxrcedit/df/wxToolBar.df similarity index 94% rename from contrib/utils/wxrcedit/df/toolbar.df rename to contrib/utils/wxrcedit/df/wxToolBar.df index 0a8dbd919a..db4691ba97 100644 --- a/contrib/utils/wxrcedit/df/toolbar.df +++ b/contrib/utils/wxrcedit/df/wxToolBar.df @@ -1,4 +1,4 @@ -node toolbar +node wxToolBar type panel icon 0 childtype toolbar_item diff --git a/contrib/utils/wxrcedit/df/treectrl.df b/contrib/utils/wxrcedit/df/wxTreeCtrl.df similarity index 84% rename from contrib/utils/wxrcedit/df/treectrl.df rename to contrib/utils/wxrcedit/df/wxTreeCtrl.df index bee9db8674..26f8c4b299 100644 --- a/contrib/utils/wxrcedit/df/treectrl.df +++ b/contrib/utils/wxrcedit/df/wxTreeCtrl.df @@ -1,3 +1,3 @@ -node treectrl +node wxTreeCtrl var style of flags wxTR_HAS_BUTTONS,wxTR_EDIT_LABELS,wxTR_MULTIPLE derived from control diff --git a/contrib/utils/wxrcedit/editor.cpp b/contrib/utils/wxrcedit/editor.cpp index 334b6f2b62..c48887b89d 100644 --- a/contrib/utils/wxrcedit/editor.cpp +++ b/contrib/utils/wxrcedit/editor.cpp @@ -31,6 +31,7 @@ #include "editor.h" #include "nodehnd.h" #include "xmlhelpr.h" +#include "preview.h" @@ -146,7 +147,6 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename) m_SelectedNode = NULL; m_Resource = NULL; m_FileName = wxEmptyString; - m_Preview = NULL; m_SelectedProp = -1; wxMenu *menuFile = new wxMenu; @@ -187,7 +187,6 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename) #endif // must stay last: m_Handlers.Append(new NodeHandlerUnknown(this)); - // Create toolbar: wxToolBar *toolBar = CreateToolBar(wxNO_BORDER | wxTB_HORIZONTAL | wxTB_FLAT); @@ -295,6 +294,8 @@ EditorFrame::EditorFrame(wxFrame *parent, const wxString& filename) EditorFrame::~EditorFrame() { + PreviewFrame::Get()->Close(); + wxConfigBase *cfg = wxConfigBase::Get(); cfg->Write("editor_x", (long)GetPosition().x); @@ -400,102 +401,6 @@ void EditorFrame::NewFile() -void EditorFrame::RefreshPreview(wxXmlNode *node) -{ - wxConfigBase *cfg = wxConfigBase::Get(); - - wxBusyCursor bcur; - wxXmlResource *res = new wxXmlResource; - wxString tempfile; - wxPoint pos = wxPoint(cfg->Read("preview_x", -1), cfg->Read("preview_y", -1)); - wxSize size = wxSize(cfg->Read("preview_w", 50), cfg->Read("preview_h", 300)); - - while (node->GetParent() != m_Resource->GetRoot()) - node = node->GetParent(); - - m_Preview = wxFindWindowByName("preview_window"); - if (m_Preview) - { - pos = m_Preview->GetPosition(); - size = m_Preview->GetSize(); - - cfg->Write("preview_x", (long)pos.x); - cfg->Write("preview_y", (long)pos.y); - cfg->Write("preview_w", (long)size.x); - cfg->Write("preview_h", (long)size.y); - } - - res->InitAllHandlers(); - - wxGetTempFileName("xmleditor", tempfile); - m_Resource->Save(tempfile, wxXML_IO_BIN); - res->Load(tempfile); - - if (node->GetName() == "dialog") - { - wxDialog *dlg = new wxDialog; - if (res->LoadDialog(dlg, NULL, node->GetPropVal("name", "-1"))) - { - if (pos.x != -1) dlg->Move(pos); - dlg->Show(TRUE); - if (m_Preview) m_Preview->Close(TRUE); - m_Preview = dlg; - m_Preview->SetName("preview_window"); - m_Preview->SetFocus(); - } - else - { - delete dlg; - wxLogError(_("Cannot preview the dialog -- XML resource corrupted.")); - } - } - - else if (node->GetName() == "menubar" || node->GetName() == "menu") - { - wxMenuBar *mbar; - - if (node->GetName() == "menubar") - mbar = res->LoadMenuBar(node->GetPropVal("name", "-1")); - else - { - mbar = new wxMenuBar; - wxMenu *m = res->LoadMenu(node->GetPropVal("name", "-1")); - if (m != NULL) mbar->Append(m, node->GetPropVal("name", "-1")); - else { delete mbar; mbar = NULL; } - } - if (mbar == NULL) - wxLogError(_("Cannot preview the menu -- XML resource corrupted.")); - else - { - wxFrame *frame = new wxFrame(NULL, -1, _("Menu preview"), pos, size); - frame->SetMenuBar(mbar); - frame->CreateStatusBar(); - if (m_Preview) m_Preview->Close(TRUE); - m_Preview = frame; - m_Preview->SetName("preview_window"); - m_Preview->Show(TRUE); - m_Preview->SetFocus(); - } - } - - else if (node->GetName() == "toolbar") - { - wxFrame *frame = new wxFrame(NULL, -1, _("Menu preview"), pos, size); - frame->SetToolBar(res->LoadToolBar(frame, node->GetPropVal("name", "-1"))); - frame->CreateStatusBar(); - if (m_Preview) m_Preview->Close(TRUE); - m_Preview = frame; - m_Preview->SetName("preview_window"); - m_Preview->Show(TRUE); - m_Preview->SetFocus(); - } - - delete res; - wxRemoveFile(tempfile); -} - - - void EditorFrame::RefreshTree() { wxXmlNode *sel = m_SelectedNode; @@ -802,7 +707,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event) { XmlTreeData* dt = (XmlTreeData*)m_TreeCtrl->GetItemData(m_TreeCtrl->GetSelection());; if (dt != NULL && dt->Node != NULL) - RefreshPreview(dt->Node); + PreviewFrame::Get()->Preview(dt->Node); break; } @@ -873,7 +778,9 @@ void EditorFrame::OnNewNode(wxCommandEvent& event) NodeHandler *hnd = FindHandler(realnode); wxString name = hnd->GetChildTypes()[event.GetId()-ID_NEWSYBNODE]; - wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, name); + wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, _T("object")); + node->AddProperty(_T("class"), name); + hnd->InsertNode(realnode, node, m_SelectedNode); wxTreeItemId root = m_TreeCtrl->GetSelection(); SelectNode(node, &root); @@ -887,7 +794,9 @@ void EditorFrame::OnNewNode(wxCommandEvent& event) NodeHandler *hnd = FindHandler(realnode); wxString name = hnd->GetChildTypes()[event.GetId()-ID_NEWNODE]; - wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, name); + wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, _T("object")); + node->AddProperty(_T("class"), name); + hnd->InsertNode(realnode, node); wxTreeItemId root = m_TreeCtrl->GetSelection(); SelectNode(node, &root); @@ -898,15 +807,16 @@ void EditorFrame::OnNewNode(wxCommandEvent& event) wxString name; switch (event.GetId()) { - case ID_NEWDIALOG : name = "dialog"; break; - case ID_NEWPANEL : name = "panel"; break; - case ID_NEWMENU : name = "menu"; break; - case ID_NEWMENUBAR : name = "menubar"; break; - case ID_NEWTOOLBAR : name = "toolbar"; break; + case ID_NEWDIALOG : name = _T("wxDialog"); break; + case ID_NEWPANEL : name = _T("wxPanel"); break; + case ID_NEWMENU : name = _T("wxMenu"); break; + case ID_NEWMENUBAR : name = _T("wxMenuBar"); break; + case ID_NEWTOOLBAR : name = _T("wxToolBar"); break; default : return; // never occurs } - wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, name); + wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, _T("object")); + node->AddProperty(_T("class"), name); m_Resource->GetRoot()->AddChild(node); NotifyChanged(CHANGED_TREE); SelectNode(node); @@ -921,11 +831,11 @@ void EditorFrame::OnRightClickTree(wxPoint pos) if (m_SelectedNode == NULL || m_SelectedNode == m_Resource->GetRoot()) { - popup->Append(ID_NEWDIALOG, _("New dialog")); - popup->Append(ID_NEWPANEL, _("New panel")); - popup->Append(ID_NEWMENU, _("New menu")); - popup->Append(ID_NEWMENUBAR, _("New menubar")); - popup->Append(ID_NEWTOOLBAR, _("New toolbar")); + popup->Append(ID_NEWDIALOG, _("New wxDialog")); + popup->Append(ID_NEWPANEL, _("New wxPanel")); + popup->Append(ID_NEWMENU, _("New wxMenu")); + popup->Append(ID_NEWMENUBAR, _("New wxMenuBar")); + popup->Append(ID_NEWTOOLBAR, _("New wxToolBar")); } else @@ -940,10 +850,20 @@ void EditorFrame::OnRightClickTree(wxPoint pos) if (!arr.IsEmpty()) { wxMenu *news = new wxMenu; + wxMenu *news2 = news; for (size_t i = 0; i < arr.GetCount(); i++) { - news->Append(i + ID_NEWNODE, arr[i]); - if (i % 16 == 15) news->Break(); + news2->Append(i + ID_NEWNODE, arr[i]); +#ifdef __WXGTK__ // doesn't support Break + if (i % 20 == 19) + { + wxMenu *m = new wxMenu; + news2->Append(ID_NEWNODE+arr.GetCount(), _("More..."), m); + news2 = m; + } +#else + if (i % 16 == 15) news2->Break(); +#endif } popup->Append(ID_NEWNODE-1, _("New child"), news); } @@ -963,10 +883,20 @@ void EditorFrame::OnRightClickTree(wxPoint pos) if (!arr.IsEmpty()) { wxMenu *news = new wxMenu; + wxMenu *news2 = news; for (size_t i = 0; i < arr.GetCount(); i++) { - news->Append(i + ID_NEWSYBNODE, arr[i]); - if (i % 16 == 15) news->Break(); + news2->Append(i + ID_NEWSYBNODE, arr[i]); +#ifdef __WXGTK__ // doesn't support Break + if (i % 20 == 19) + { + wxMenu *m = new wxMenu; + news2->Append(ID_NEWSYBNODE+arr.GetCount(), _("More..."), m); + news2 = m; + } +#else + if (i % 16 == 15) news2->Break(); +#endif } popup->Append(ID_NEWSYBNODE-1, _("New sybling"), news); } @@ -974,10 +904,10 @@ void EditorFrame::OnRightClickTree(wxPoint pos) popup->AppendSeparator(); - popup->Append(ID_CUT, "Cut"); - popup->Append(ID_COPY, "Copy"); - popup->Append(ID_PASTE_SYBLING, "Paste as sybling"); - popup->Append(ID_PASTE_CHILD, "Paste as child"); + popup->Append(ID_CUT, _("Cut")); + popup->Append(ID_COPY, _("Copy")); + popup->Append(ID_PASTE_SYBLING, _("Paste as sybling")); + popup->Append(ID_PASTE_CHILD, _("Paste as child")); popup->AppendSeparator(); popup->Append(ID_DELETE_NODE, _("Delete")); popup->Enable(ID_PASTE_SYBLING, m_Clipboard != NULL); diff --git a/contrib/utils/wxrcedit/editor.h b/contrib/utils/wxrcedit/editor.h index 4a734835bf..442e95f1b9 100644 --- a/contrib/utils/wxrcedit/editor.h +++ b/contrib/utils/wxrcedit/editor.h @@ -58,9 +58,9 @@ class EditorFrame : public wxFrame void LoadFile(const wxString& filename); void NewFile(); void SaveFile(const wxString& filename); + wxString GetFileName() { return m_FileName; } void RefreshTree(); - void RefreshPreview(wxXmlNode *node); void RefreshProps(wxXmlNode *node); void RefreshPropsEdit(); bool SelectNode(wxXmlNode *node, wxTreeItemId *root = NULL); @@ -96,7 +96,6 @@ class EditorFrame : public wxFrame wxString m_FileName; wxXmlDocument *m_Resource; - wxWindow *m_Preview; DECLARE_EVENT_TABLE() void OnTreeSel(wxTreeEvent& event); diff --git a/contrib/utils/wxrcedit/nodehnd.cpp b/contrib/utils/wxrcedit/nodehnd.cpp index 190cd00f4e..e584c498bc 100644 --- a/contrib/utils/wxrcedit/nodehnd.cpp +++ b/contrib/utils/wxrcedit/nodehnd.cpp @@ -149,6 +149,11 @@ NodeHandler *NodeHandler::CreateFromFile(const wxString& filename, EditorFrame * ni->Type = HANDLER_NONE; ni->Icon = 0; ni->Read(filename); + + // maybe we already parsed it? + for (size_t i = 0; i < s_AllNodes->GetCount(); i++) + if ((*s_AllNodes)[i].Node == ni->Node) return NULL; + s_AllNodes->Add(*ni); // add a copy if (ni->Type == HANDLER_NONE || ni->Node.IsEmpty() || ni->Abstract) @@ -226,7 +231,7 @@ NodeHandler::~NodeHandler() bool NodeHandler::CanHandle(wxXmlNode *node) { - return (m_NodeInfo->Node == node->GetName()); + return (m_NodeInfo->Node == XmlGetClass(node)); } @@ -248,11 +253,11 @@ wxTreeItemId NodeHandler::CreateTreeNode(wxTreeCtrl *treectrl, wxString NodeHandler::GetTreeString(wxXmlNode *node) { - wxString xmlid = node->GetPropVal("name", ""); + wxString xmlid = node->GetPropVal(_T("name"), wxEmptyString); if (xmlid.IsEmpty()) - return node->GetName(); + return XmlGetClass(node); else - return (node->GetName() + " '" + xmlid + "'"); + return XmlGetClass(node) + _T(" '") + xmlid + _T("'"); } @@ -325,13 +330,12 @@ wxTreeItemId NodeHandlerPanel::CreateTreeNode(wxTreeCtrl *treectrl, { wxTreeItemId root = NodeHandler::CreateTreeNode(treectrl, parent, node); - wxXmlNode *n = XmlFindNode(node, "children"); + wxXmlNode *n = XmlFindNode(node, "object"); - if (n) n = n->GetChildren(); - while (n) { - if (n->GetType() == wxXML_ELEMENT_NODE) + if (n->GetType() == wxXML_ELEMENT_NODE && + n->GetName() == _T("object")) EditorFrame::Get()->CreateTreeNode(treectrl, root, n); n = n->GetNext(); } @@ -343,16 +347,10 @@ wxTreeItemId NodeHandlerPanel::CreateTreeNode(wxTreeCtrl *treectrl, void NodeHandlerPanel::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before) { - wxXmlNode *cnd = XmlFindNode(parent, "children"); - if (cnd == NULL) - { - cnd = new wxXmlNode(wxXML_ELEMENT_NODE, "children"); - parent->AddChild(cnd); - } if (insert_before) - cnd->InsertChild(node, insert_before); + parent->InsertChild(node, insert_before); else - cnd->AddChild(node); + parent->AddChild(node); EditorFrame::Get()->NotifyChanged(CHANGED_TREE); } @@ -361,32 +359,24 @@ void NodeHandlerPanel::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode void NodeHandlerSizer::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before) -{ - wxXmlNode *cnd = XmlFindNode(parent, "children"); - if (cnd == NULL) - { - cnd = new wxXmlNode(wxXML_ELEMENT_NODE, "children"); - parent->AddChild(cnd); - } - - if (node->GetName() == "spacer" || node->GetName() == "sizeritem") +{ + if (XmlGetClass(node) == _T("spacer") || XmlGetClass(node) == _T("sizeritem")) { if (insert_before) - cnd->InsertChild(node, insert_before); + parent->InsertChild(node, insert_before); else - cnd->AddChild(node); + parent->AddChild(node); } else { - wxXmlNode *itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, "sizeritem"); - wxXmlNode *winnode = new wxXmlNode(wxXML_ELEMENT_NODE, "window"); - itemnode->AddChild(winnode); - winnode->AddChild(node); + wxXmlNode *itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, _T("object")); + itemnode->AddProperty(_T("class"), _T("sizeritem")); + itemnode->AddChild(node); if (insert_before) - cnd->InsertChild(itemnode, insert_before); + parent->InsertChild(itemnode, insert_before); else - cnd->AddChild(itemnode); + parent->AddChild(itemnode); } EditorFrame::Get()->NotifyChanged(CHANGED_TREE); } @@ -398,7 +388,7 @@ int NodeHandlerSizer::GetTreeIcon(wxXmlNode *node) int orig = NodeHandler::GetTreeIcon(node); if (orig == 0) { - if (XmlReadValue(node, "orient") == "wxVERTICAL") return 2; + if (XmlReadValue(node, _T("orient")) == _T("wxVERTICAL")) return 2; else return 3; } else return orig; @@ -450,17 +440,7 @@ int NodeHandlerSizerItem::GetTreeIcon(wxXmlNode *node) wxXmlNode *NodeHandlerSizerItem::GetRealNode(wxXmlNode *node) { - wxXmlNode *n = XmlFindNode(node, "window"); - - if (n) n = n->GetChildren(); - - while (n) - { - if (n->GetType() == wxXML_ELEMENT_NODE) - return n; - n = n->GetNext(); - } - return NULL; + return XmlFindNode(node, _T("object")); } @@ -469,31 +449,23 @@ wxXmlNode *NodeHandlerSizerItem::GetRealNode(wxXmlNode *node) void NodeHandlerNotebook::InsertNode(wxXmlNode *parent, wxXmlNode *node, wxXmlNode *insert_before) -{ - wxXmlNode *cnd = XmlFindNode(parent, "children"); - if (cnd == NULL) - { - cnd = new wxXmlNode(wxXML_ELEMENT_NODE, "children"); - parent->AddChild(cnd); - } - +{ { wxXmlNode *itemnode; - if (node->GetName() == "notebookpage") + if (XmlGetClass(node) == _T("notebookpage")) itemnode = node; else { - itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, "notebookpage"); - wxXmlNode *winnode = new wxXmlNode(wxXML_ELEMENT_NODE, "window"); - itemnode->AddChild(winnode); - winnode->AddChild(node); + itemnode = new wxXmlNode(wxXML_ELEMENT_NODE, _T("object")); + itemnode->AddProperty(_T("class"), _T("notebookpage")); + itemnode->AddChild(node); } if (insert_before) - cnd->InsertChild(itemnode, insert_before); + parent->InsertChild(itemnode, insert_before); else - cnd->AddChild(itemnode); + parent->AddChild(itemnode); } EditorFrame::Get()->NotifyChanged(CHANGED_TREE); } diff --git a/contrib/utils/wxrcedit/preview.cpp b/contrib/utils/wxrcedit/preview.cpp new file mode 100644 index 0000000000..82729ec307 --- /dev/null +++ b/contrib/utils/wxrcedit/preview.cpp @@ -0,0 +1,195 @@ +///////////////////////////////////////////////////////////////////////////// +// Author: Vaclav Slavik +// Created: 2000/05/05 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ + #pragma implementation "preview.h" +#endif + +// For compilers that support precompilation, includes "wx/wx.h". +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#include "wx/wx.h" +#include "wx/xml/xml.h" +#include "wx/xml/xmlres.h" +#include "wx/config.h" +#include "wx/log.h" +#include "wx/splitter.h" +#include "preview.h" +#include "xmlhelpr.h" +#include "editor.h" + +#include "wx/xml/xh_menu.h" + +class MyMenubarHandler : public wxMenuBarXmlHandler +{ + public: + MyMenubarHandler(wxMenuBar *mbar) : m_MenuBar(mbar) {} + + wxObject *DoCreateResource() + { + //wxMenuBar *menubar = new wxMenuBar(GetStyle()); + CreateChildren(m_MenuBar); + return m_MenuBar; + } + + private: + wxMenuBar *m_MenuBar; +}; + + + + +PreviewFrame* PreviewFrame::ms_Instance = NULL; + +PreviewFrame *PreviewFrame::Get() +{ + if (ms_Instance == NULL) + { + (void)new PreviewFrame; + ms_Instance->Show(TRUE); + } + return ms_Instance; +} + +PreviewFrame::PreviewFrame() + : wxFrame(NULL, -1, _("Preview")) +{ + ms_Instance = this; + m_Node = NULL; + + SetMenuBar(new wxMenuBar()); + + m_RC = new wxXmlResource; + // these handlers take precedence over std. ones: + m_RC->AddHandler(new MyMenubarHandler(GetMenuBar())); + // std handlers: + m_RC->InitAllHandlers(); + m_TmpFile = wxGetTempFileName(_T("wxrcedit")); + m_RC->Load(m_TmpFile); + + wxConfigBase *cfg = wxConfigBase::Get(); + SetSize(wxRect(wxPoint(cfg->Read(_T("previewframe_x"), -1), cfg->Read(_T("previewframe_y"), -1)), + wxSize(cfg->Read(_T("previewframe_w"), 400), cfg->Read(_T("previewframe_h"), 400)))); + + m_Splitter = new wxSplitterWindow(this, -1); + m_LogCtrl = new wxTextCtrl(m_Splitter, -1, wxEmptyString, wxDefaultPosition, + wxDefaultSize, wxTE_MULTILINE); + m_ScrollWin = new wxScrolledWindow(m_Splitter, -1); + m_ScrollWin->SetBackgroundColour(_T("light steel blue")); + m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300)); + + CreateStatusBar(); +} + + + +PreviewFrame::~PreviewFrame() +{ + wxConfigBase *cfg = wxConfigBase::Get(); + cfg->Write(_T("previewframe_x"), (long)GetPosition().x); + cfg->Write(_T("previewframe_y"), (long)GetPosition().y); + cfg->Write(_T("previewframe_w"), (long)GetSize().x); + cfg->Write(_T("previewframe_h"), (long)GetSize().y); + cfg->Write(_T("previewframe_sash"), (long)m_Splitter->GetSashPosition()); + + ms_Instance = NULL; + + delete m_RC; + wxRemoveFile(m_TmpFile); +} + + + +void PreviewFrame::Preview(wxXmlNode *node) +{ + while (node->GetParent()->GetParent() != NULL) node = node->GetParent(); + + { + wxXmlDocument doc; + doc.SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _T("resource"))); + doc.GetRoot()->AddChild(new wxXmlNode(*node)); + + if (XmlGetClass(doc.GetRoot()->GetChildren()) == _T("wxDialog")) + XmlSetClass(doc.GetRoot()->GetChildren(), _T("wxPanel")); + + doc.Save(m_TmpFile, wxXML_IO_BIN); + // wxXmlResource will detect change automatically + } + + + //if (m_Node != node) + { + SetToolBar(NULL); + for (int i = (int)(GetMenuBar()->GetMenuCount())-1; i >= 0; i--) + delete GetMenuBar()->Remove(i); + m_ScrollWin->DestroyChildren(); + } + + m_Node = node; + + m_LogCtrl->Clear(); + wxLogTextCtrl mylog(m_LogCtrl); + wxLog *oldlog = wxLog::SetActiveTarget(&mylog); + + wxString oldcwd = wxGetCwd(); + wxSetWorkingDirectory(wxPathOnly(EditorFrame::Get()->GetFileName())); + + if (XmlGetClass(node) == _T("wxMenuBar") || XmlGetClass(node) == _T("wxMenu")) + PreviewMenu(); + else if (XmlGetClass(node) == _T("wxToolBar")) + PreviewToolbar(); + else if (XmlGetClass(node) == _T("wxPanel") || XmlGetClass(node) == _T("wxDialog")) + PreviewPanel(); + + wxSetWorkingDirectory(oldcwd); + wxLog::SetActiveTarget(oldlog); +} + + + +void PreviewFrame::PreviewMenu() +{ + wxMenuBar *mbar; + + if (XmlGetClass(m_Node) == _T("wxMenuBar")) + mbar = m_RC->LoadMenuBar(m_Node->GetPropVal(_T("name"), _T("-1"))); + else + { + wxMenu *m = m_RC->LoadMenu(m_Node->GetPropVal(_T("name"), _T("-1"))); + if (m != NULL) GetMenuBar()->Append(m, _("(menu)")); + } + + if (mbar == NULL) + wxLogError(_("Cannot preview the menu -- XML resource corrupted.")); +} + + + +void PreviewFrame::PreviewToolbar() +{ + SetToolBar(m_RC->LoadToolBar(this, m_Node->GetPropVal(_T("name"), _T("-1")))); +} + + + +void PreviewFrame::PreviewPanel() +{ + wxPanel *panel = m_RC->LoadPanel(m_ScrollWin, m_Node->GetPropVal(_T("name"), _T("-1"))); + + if (panel == NULL) + wxLogError(_("Cannot preview the panel -- XML resource corrupted.")); + else + { + m_ScrollWin->SetScrollbars(1, 1, panel->GetSize().x, panel->GetSize().y, + 0, 0, TRUE); + } +} diff --git a/contrib/utils/wxrcedit/preview.h b/contrib/utils/wxrcedit/preview.h new file mode 100644 index 0000000000..ee7f86d763 --- /dev/null +++ b/contrib/utils/wxrcedit/preview.h @@ -0,0 +1,55 @@ +///////////////////////////////////////////////////////////////////////////// +// Purpose: XML resources editor +// Author: Vaclav Slavik +// Created: 2000/05/05 +// RCS-ID: $Id$ +// Copyright: (c) 2000 Vaclav Slavik +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + +#ifdef __GNUG__ + #pragma interface "preview.h" +#endif + +#ifndef _PREVIEW_H_ +#define _PREVIEW_H_ + + + +class WXDLLEXPORT wxXmlNode; +class WXDLLEXPORT wxScrolledWindow; +class WXDLLEXPORT wxTextCtrl; +class WXDLLEXPORT wxSplitterWindow; +class WXDLLEXPORT wxXmlResource; +class WXDLLEXPORT wxXmlDocument; +#include "wx/frame.h" + + +class PreviewFrame : public wxFrame +{ + public: + PreviewFrame(); + ~PreviewFrame(); + + void Preview(wxXmlNode *node); + + static PreviewFrame *Get(); + + private: + void PreviewMenu(); + void PreviewToolbar(); + void PreviewPanel(); + + private: + static PreviewFrame *ms_Instance; + wxXmlNode *m_Node; + wxScrolledWindow *m_ScrollWin; + wxTextCtrl *m_LogCtrl; + wxSplitterWindow *m_Splitter; + + wxXmlResource *m_RC; + wxString m_TmpFile; +}; + + +#endif diff --git a/contrib/utils/wxrcedit/xmlhelpr.cpp b/contrib/utils/wxrcedit/xmlhelpr.cpp index c4c0f2ff17..c920dad77c 100644 --- a/contrib/utils/wxrcedit/xmlhelpr.cpp +++ b/contrib/utils/wxrcedit/xmlhelpr.cpp @@ -81,4 +81,20 @@ wxString XmlReadValue(wxXmlNode *parent, const wxString& name) +wxString XmlGetClass(wxXmlNode *parent) +{ + return parent->GetPropVal(_T("class"), wxEmptyString); +} + + + +void XmlSetClass(wxXmlNode *parent, const wxString& classname) +{ + parent->DeleteProperty(_T("class")); + parent->AddProperty(_T("class"), classname); +} + + + + diff --git a/contrib/utils/wxrcedit/xmlhelpr.h b/contrib/utils/wxrcedit/xmlhelpr.h index 3ec3d934e6..e2f673543d 100644 --- a/contrib/utils/wxrcedit/xmlhelpr.h +++ b/contrib/utils/wxrcedit/xmlhelpr.h @@ -19,5 +19,7 @@ void XmlWriteValue(wxXmlNode *parent, const wxString& name, const wxString& value); wxString XmlReadValue(wxXmlNode *parent, const wxString& name); wxXmlNode *XmlFindNode(wxXmlNode *parent, const wxString& name); +wxString XmlGetClass(wxXmlNode *parent); +void XmlSetClass(wxXmlNode *parent, const wxString& classname); #endif diff --git a/utils/wxrc/wxrc.cpp b/utils/wxrc/wxrc.cpp index ad0c3de2ad..eacf6222b2 100644 --- a/utils/wxrc/wxrc.cpp +++ b/utils/wxrc/wxrc.cpp @@ -83,7 +83,7 @@ int XmlResApp::OnRun() { wxCMD_LINE_SWITCH, "c", "cpp-code", "output C++ source rather than .rsc file" }, { wxCMD_LINE_SWITCH, "u", "uncompressed", "do not compress .xml files (C++ only)" }, { wxCMD_LINE_OPTION, "n", "function", "C++ function name (with -c) [InitXmlResource]" }, - { wxCMD_LINE_OPTION, "o", "output", "output file [resource.rsc/cpp]" }, + { wxCMD_LINE_OPTION, "o", "output", "output file [resource.xrs/cpp]" }, { wxCMD_LINE_OPTION, "l", "list-of-handlers", "output list of neccessary handlers to this file" }, { wxCMD_LINE_PARAM, NULL, NULL, "input file", @@ -133,7 +133,7 @@ void XmlResApp::ParseParams(const wxCmdLineParser& cmdline) flagCompress = flagCPP && !cmdline.Found("u"); if (!cmdline.Found("o", &parOutput)) - parOutput = flagCPP ? "resource.cpp" : "resource.rsc"; + parOutput = flagCPP ? "resource.cpp" : "resource.xrs"; parOutputPath = wxPathOnly(parOutput); if (!parOutputPath) parOutputPath = "."; @@ -189,8 +189,8 @@ wxArrayString XmlResApp::PrepareTempFiles() FindFilesInXML(doc.GetRoot(), flist, path); - doc.Save(parOutputPath + "/" + name + ".xmb", flagCompress ? wxXML_IO_BINZ : wxXML_IO_BIN); - flist.Add(name + ".xmb"); + doc.Save(parOutputPath + "/" + name + ".xrc", flagCompress ? wxXML_IO_BINZ : wxXML_IO_BIN); + flist.Add(name + ".xrc"); } return flist; @@ -285,38 +285,32 @@ static wxString FileToCppArray(wxString filename, int num) wxString snum; wxFFile file(filename, "rb"); size_t lng = file.Length(); - int linelng; snum.Printf("%i", num); output.Printf("static size_t xml_res_size_" + snum + " = %i;\n", lng); - output += "static unsigned char xml_res_file_" + snum + "[] = \"\\\n"; + output += "static unsigned char xml_res_file_" + snum + "[] = {\n"; + // we cannot use string literals because MSVC is dumb wannabe compiler + // with arbitrary limitation to 2048 strings :( unsigned char *buffer = new unsigned char[lng]; file.Read(buffer, lng); for (size_t i = 0, linelng = 0; i < lng; i++) { - if (linelng > 70) + tmp.Printf("%i", buffer[i]); + if (i != 0) output << ','; + if (linelng > 70) { linelng = 0; - output += "\\\n"; - } - if (buffer[i] < 32 || buffer[i] == '"' || buffer[i] == '\\') - { - tmp.Printf("\\%03o", buffer[i]); - output += tmp; - linelng += 4; - } - else - { - output << (wxChar)buffer[i]; - linelng++; + output << "\n"; } + output << tmp; + linelng += tmp.Length()+1; } delete[] buffer; - output += "\"\n;\n\n"; + output += "};\n\n"; return output; } @@ -378,7 +372,7 @@ void " + parFuncname + "()\n\ wxString name, ext, path; wxSplitPath(parFiles[i], &path, &name, &ext); file.Write(" wxTheXmlResource->Load(\"memory:xml_resource/" + - name + ".xmb" + "\");\n"); + name + ".xrc" + "\");\n"); } file.Write("\n}\n");