]> git.saurik.com Git - wxWidgets.git/commitdiff
change in XRC format
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 7 Oct 2000 21:56:37 +0000 (21:56 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 7 Oct 2000 21:56:37 +0000 (21:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

112 files changed:
contrib/include/wx/xml/xh_sizer.h
contrib/include/wx/xml/xmlres.h
contrib/src/xml/xh_bmp.cpp
contrib/src/xml/xh_bmpbt.cpp
contrib/src/xml/xh_bttn.cpp
contrib/src/xml/xh_cald.cpp
contrib/src/xml/xh_chckb.cpp
contrib/src/xml/xh_chckl.cpp
contrib/src/xml/xh_choic.cpp
contrib/src/xml/xh_combo.cpp
contrib/src/xml/xh_dlg.cpp
contrib/src/xml/xh_gauge.cpp
contrib/src/xml/xh_html.cpp
contrib/src/xml/xh_listb.cpp
contrib/src/xml/xh_listc.cpp
contrib/src/xml/xh_notbk.cpp
contrib/src/xml/xh_panel.cpp
contrib/src/xml/xh_radbt.cpp
contrib/src/xml/xh_radbx.cpp
contrib/src/xml/xh_scrol.cpp
contrib/src/xml/xh_sizer.cpp
contrib/src/xml/xh_slidr.cpp
contrib/src/xml/xh_spin.cpp
contrib/src/xml/xh_stbmp.cpp
contrib/src/xml/xh_stbox.cpp
contrib/src/xml/xh_stlin.cpp
contrib/src/xml/xh_sttxt.cpp
contrib/src/xml/xh_text.cpp
contrib/src/xml/xh_toolb.cpp
contrib/src/xml/xh_tree.cpp
contrib/src/xml/xh_unkwn.cpp
contrib/src/xml/xmlres.cpp
contrib/utils/convertrc/rc2xml.cpp
contrib/utils/convertrc/wxr2xml.cpp
contrib/utils/wxrc/wxrc.cpp
contrib/utils/wxrcedit/Makefile.in
contrib/utils/wxrcedit/df/bitmapbutton.df [deleted file]
contrib/utils/wxrcedit/df/boxsizer.df [deleted file]
contrib/utils/wxrcedit/df/button.df [deleted file]
contrib/utils/wxrcedit/df/calendarctrl.df [deleted file]
contrib/utils/wxrcedit/df/checkbox.df [deleted file]
contrib/utils/wxrcedit/df/checklist.df [deleted file]
contrib/utils/wxrcedit/df/choice.df [deleted file]
contrib/utils/wxrcedit/df/combobox.df [deleted file]
contrib/utils/wxrcedit/df/dialog.df [deleted file]
contrib/utils/wxrcedit/df/flexgridsizer.df [deleted file]
contrib/utils/wxrcedit/df/gauge.df [deleted file]
contrib/utils/wxrcedit/df/gridsizer.df [deleted file]
contrib/utils/wxrcedit/df/htmlwindow.df [deleted file]
contrib/utils/wxrcedit/df/listbox.df [deleted file]
contrib/utils/wxrcedit/df/listctrl.df [deleted file]
contrib/utils/wxrcedit/df/menu.df [deleted file]
contrib/utils/wxrcedit/df/menubar.df [deleted file]
contrib/utils/wxrcedit/df/menuitem.df [deleted file]
contrib/utils/wxrcedit/df/notebook.df [deleted file]
contrib/utils/wxrcedit/df/panel.df [deleted file]
contrib/utils/wxrcedit/df/radiobox.df [deleted file]
contrib/utils/wxrcedit/df/radiobutton.df [deleted file]
contrib/utils/wxrcedit/df/scrollbar.df [deleted file]
contrib/utils/wxrcedit/df/slider.df [deleted file]
contrib/utils/wxrcedit/df/spinbutton.df [deleted file]
contrib/utils/wxrcedit/df/spinctrl.df [deleted file]
contrib/utils/wxrcedit/df/staticbitmap.df [deleted file]
contrib/utils/wxrcedit/df/staticbox.df [deleted file]
contrib/utils/wxrcedit/df/staticboxsizer.df [deleted file]
contrib/utils/wxrcedit/df/staticline.df [deleted file]
contrib/utils/wxrcedit/df/statictext.df [deleted file]
contrib/utils/wxrcedit/df/textctrl.df [deleted file]
contrib/utils/wxrcedit/df/toolbar.df [deleted file]
contrib/utils/wxrcedit/df/treectrl.df [deleted file]
contrib/utils/wxrcedit/df/wxBitmapButton.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxBoxSizer.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxButton.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxCalendarCtrl.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxCheckBox.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxCheckList.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxChoice.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxComboBox.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxDialog.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxFlexGridSizer.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxGauge.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxGridSizer.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxHtmlWindow.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxListBox.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxListCtrl.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxMenu.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxMenuBar.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxMenuItem.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxNotebook.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxPanel.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxRadioBox.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxRadioButton.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxScrollBar.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxSlider.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxSpinButton.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxSpinCtrl.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxStaticBitmap.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxStaticBox.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxStaticBoxSizer.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxStaticLine.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxStaticText.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxTextCtrl.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxToolBar.df [new file with mode: 0644]
contrib/utils/wxrcedit/df/wxTreeCtrl.df [new file with mode: 0644]
contrib/utils/wxrcedit/editor.cpp
contrib/utils/wxrcedit/editor.h
contrib/utils/wxrcedit/nodehnd.cpp
contrib/utils/wxrcedit/preview.cpp [new file with mode: 0644]
contrib/utils/wxrcedit/preview.h [new file with mode: 0644]
contrib/utils/wxrcedit/xmlhelpr.cpp
contrib/utils/wxrcedit/xmlhelpr.h
utils/wxrc/wxrc.cpp

index 818946e76e0ce818ead5598b465f8d35b814b2f4..2c3d1e960c73baa99c2b6a66409e07dd357ba0a5 100644 (file)
@@ -30,6 +30,8 @@ class WXDLLEXPORT wxSizerXmlHandler : public wxXmlResourceHandler
     private:
         bool m_IsInside;
         wxSizer *m_ParentSizer;
+        
+        bool IsSizerNode(wxXmlNode *node);
 };
 
 
index fd012efd0ee4e201a0035ea42a2778850d731f3f..52c7f2a9abc3477a3583230e23b5db95c307e69b 100644 (file)
@@ -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. <object class="wxDialog">
+        bool IsOfClass(wxXmlNode *node, const wxString& classname)
+            { return node->GetPropVal(_T("class"), wxEmptyString) == classname; }
+
         // Gets node content from wxXML_ENTITY_NODE
         // (the problem is, <tag>content<tag> 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); }
 
index c83a264430c18b4476ef0168d88f2c72e4b822df..a5eb0341b5721f05ab06905e0379601ceba8b501 100644 (file)
@@ -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"));
 }
 
index 0fa81797ee69fe0a8548b6a3fd2cd64619e64e1d..a4230b1c74584f45111d7b0092437314e22bb67c 100644 (file)
@@ -60,7 +60,7 @@ wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
 
 bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("bitmapbutton");
+    return IsOfClass(node, _T("wxBitmapButton"));
 }
 
 
index 4fc936f4abf712f2b718ee7d5af9bddc6ff2ed47..c73b849310f4f38c3a9d565b7956eb028e1a0232 100644 (file)
@@ -49,7 +49,7 @@ wxObject *wxButtonXmlHandler::DoCreateResource()
 
 bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("button");
+    return IsOfClass(node, _T("wxButton"));
 }
 
 
index a17453184d8e1355bd1fb738b99adadc542eea40..723734d7c58788886bd9496188679a6a75840eb2 100644 (file)
@@ -54,7 +54,7 @@ wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
 
 bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("calendarctrl");
+    return IsOfClass(node, _T("wxCalendarCtrl"));
 }
 
 
index 9cfddeb63e52b66ba509f54fc3711fbd27e7a02a..0351054f8fff010b9c80263e547c9e63a5c304f7 100644 (file)
@@ -51,7 +51,7 @@ wxObject *wxCheckBoxXmlHandler::DoCreateResource()
 
 bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("checkbox");
+    return IsOfClass(node, _T("wxCheckBox"));
 }
 
 #endif
index 5e22232d4b5328e41c33915c3ad846054e911185..826709bc9c3c1c6430ab2f1ee9f88f18cdc9dde8 100644 (file)
@@ -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"))
+           );
 }
 
 
index 6ffec1f04d761874c08f5fce1f489e56b6bfbbb2..2e5918236d071669cdd2d6f7aa4a9290373a2a3b 100644 (file)
@@ -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"))
+           );
 }
 
 
index 54c029431bf75248a1d11b7665e91f4a1e72ae3d..9af99a795774ff27f7a010eb46827c004f4d2758 100644 (file)
@@ -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
index f95d9f41f83b791383f4bac37615f4f23aefba51..62b971a4e78abd0f3db112f7626908ee36ba2032 100644 (file)
@@ -74,7 +74,7 @@ wxObject *wxDialogXmlHandler::DoCreateResource()
 
 bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("dialog");
+    return IsOfClass(node, _T("wxDialog"));
 }
 
 
index cefe815ac69a5109b907e96dedd920d528097279..5989d2859f6611f1f98ecc436197818e0dd51b9d 100644 (file)
@@ -67,7 +67,7 @@ wxObject *wxGaugeXmlHandler::DoCreateResource()
 
 bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("gauge");
+    return IsOfClass(node, _T("wxGauge"));
 }
 
 
index e94e0c8f96e9124967dfc4f8d9be0451bb90ea63..23a5cb4c27ea6cc63667d3099e7758ae111bcdce 100644 (file)
@@ -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
index 9d4bae282d2ddf3e72b7ed4c530de338257cc66b..f99fb7ae3d01e25f563b190f2309ef610db8adf6 100644 (file)
@@ -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"))
+           );
 }
 
 
index 332d9655f4cd38fca35e3e07d0f979da347957b8..df2c2328c0b675dea4c784acff0b08bbc383defe 100644 (file)
@@ -63,5 +63,5 @@ wxObject *wxListCtrlXmlHandler::DoCreateResource()
 
 bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("listctrl");
+    return IsOfClass(node, _T("wxListCtrl"));
 }
index 3c7bed28f8187e90de3900dee62b8c30f8c78f13..fa8bec1b823d03b8f737ec4a437edff7c7551bdc 100644 (file)
@@ -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)
+        {
+            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
         {
-            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();
+            wxLogError(_T("Error in resource: no control within notebook's <page> tag."));
+            return NULL;
         }
-        wxLogError(_T("Error in resource: no control within notebook's <page> 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
index cc4cff021a1a74914f6e7b535f731bbc08ba2f72..6240cb96b10a1ec13a7b6a026a4095173db76377 100644 (file)
@@ -59,5 +59,5 @@ wxObject *wxPanelXmlHandler::DoCreateResource()
 
 bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("panel");
+    return IsOfClass(node, _T("wxPanel"));
 }
index f68de955188cc9619b37df8179593e8e2877dce9..d8306a034d2a82399ea6a9c275b93ecd493e406b 100644 (file)
@@ -59,7 +59,7 @@ wxObject *wxRadioButtonXmlHandler::DoCreateResource()
 
 bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("radiobutton");
+    return IsOfClass(node, _T("wxRadioButton"));
 }
 
 
index 17679b952fab109fc91d631504e4743664a9a42d..35db103fa25a3f8bc4c4e4a1297ed0d2ce480e37 100644 (file)
@@ -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
index 6e7e2b19dc46a5c702aa88152c921b1ce71de87c..e3c46c8b3f152e9b370b2314efb32c1ee5bedc79 100644 (file)
@@ -56,7 +56,7 @@ wxObject *wxScrollBarXmlHandler::DoCreateResource()
 
 bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("scrollbar");
+    return IsOfClass(node, _T("wxScrollBar"));
 }
 
 
index 51b29c80e6431ed214facbf000095c3efc7f6c43..5b9bd3d4364cff180f904b4c9b219ed83dd722d9 100644 (file)
 #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 <item> tag."));
+            return NULL;
         }
-        wxLogError(_T("Error in resource: no control/sizer within sizer's <item> 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"))));
 }
index 12afa0aabba18f9fff93509397b60956962e276d..ec99ffb413d7c635b1bb898076a06cbbbc96cbe1 100644 (file)
@@ -87,7 +87,7 @@ wxObject *wxSliderXmlHandler::DoCreateResource()
 
 bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("slider");
+    return IsOfClass(node, _T("wxSlider"));
 }
 
 
index 0a557f2eebd100f85fc747d91aec55a4fa0c6c17..24f046fd165e8f2178fb7678dccd40d221bc2c80 100644 (file)
@@ -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
index c3620d06c5bc5e0b5554923331dc1d97aa49ae95..4e654a4553fe6632be9e17117d9216691411886b 100644 (file)
@@ -46,7 +46,7 @@ wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
 
 bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("staticbitmap");
+    return IsOfClass(node, _T("wxStaticBitmap"));
 }
 
 
index 3613fbc671e0c080e98adac00aa5668237a8f0fb..1f49da12c1ed17774dd5a630bbdae37ed2d944d6 100644 (file)
@@ -46,7 +46,7 @@ wxObject *wxStaticBoxXmlHandler::DoCreateResource()
 
 bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("staticbox");
+    return IsOfClass(node, _T("wxStaticBox"));
 }
 
 
index 0ec560d52ce917c7e844d7c415354f47ddd7299f..546838654ca977c59c6bd3ca49b43be1df0d0f59 100644 (file)
@@ -49,7 +49,7 @@ wxObject *wxStaticLineXmlHandler::DoCreateResource()
 
 bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("staticline");
+    return IsOfClass(node, _T("wxStaticLine"));
 }
 
 #endif
index d4e4ff24f641ebc03dc06beb0d46f2173fabbbca..4627292fcb8979a170d9de288ee21b30b465a333 100644 (file)
@@ -47,7 +47,7 @@ wxObject *wxStaticTextXmlHandler::DoCreateResource()
 
 bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("statictext");
+    return IsOfClass(node, _T("wxStaticText"));
 }
 
 
index a1203536b3f6fd236f8d8b91522c99526fc0a977..59d9ba87b1fe79d19012596bce458c66a5032646 100644 (file)
@@ -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"));
 }
 
 
index 927642e64155b3cda0f26dc2d9d0bbe042b9b500..0460be690c07843ea281893c058bd9c257c87592 100644 (file)
@@ -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 /*<toolbar>*/
+    else /*<object class="wxToolBar">*/
     {
         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
index b10dc6ce94e88354ef0244ec9f02af4ee6f06646..941648be98978d096236eb1ac6c6dbde5325fd38 100644 (file)
@@ -51,7 +51,7 @@ wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
 
 bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node)
 {
-    return node->GetName() == _T("treectrl");
+    return IsOfClass(node, _T("wxTreeCtrl"));
 }
 
 
index d9a05b7c52cac52e28b40720311ab05ee6cfe98e..7c3f0834177e63d5205a5097686b4f60fd5fdbcd 100644 (file)
@@ -43,7 +43,7 @@ wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
         wnd = m_ParentAsWindow->FindWindow(name);
         
     if (wnd == NULL)
-        wxLogError(_T("Cannot find specified window for <unknown> (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"));
 }
 
index c2021c48aba89cfdae898efd7b901d046c03a0dd..7fb10475f0b664878c939b61a8f09df7e37e31ec 100644 (file)
@@ -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();
+    }
+}
+
+
 
 
 
index 795f45a9eb92c4aaa536b7fbe78342fd9aed1fac..be22c23737bd50d33ac770a4bf60a20e70f6e689 100644 (file)
@@ -123,7 +123,7 @@ microsoft reuses the keyword DIALOG for other things
     wxString title;
     wxString ptsize,face;
     
-    m_xmlfile.Write("\t<dialog");
+    m_xmlfile.Write("\t<object class=\"wxDialog\"");
     //Avoid duplicate names this way
     dlgname.Replace("IDD_","DLG_");
     WriteBasicInfo(x,y,width,height,dlgname);
@@ -152,10 +152,8 @@ microsoft reuses the keyword DIALOG for other things
     token=GetToken();
     }
 
-    m_xmlfile.Write("\t<children>\n");
     ParseControls();
-    m_xmlfile.Write("\t</children>\n");
-    m_xmlfile.Write("\t</dialog>\n");
+    m_xmlfile.Write("\t</object>\n");
 }
 
 /*
@@ -207,9 +205,9 @@ void rc2xml::ParseStaticText()
     int x,y,width,height;
     ReadRect(x,y,width,height);
 
-    m_xmlfile.Write("\t\t<statictext");
+    m_xmlfile.Write("\t\t<object class=\"wxStaticText\"");
     WriteBasicInfo(x,y,width,height,varname);WriteLabel(phrase);
-    m_xmlfile.Write("\t\t</statictext>\n");
+    m_xmlfile.Write("\t\t</object>\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<textctrl");
+    m_xmlfile.Write("\t\t<object class\"wxTextCtrl\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\t\t</textctrl>\n");
+    m_xmlfile.Write("\t\t</object>\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<button");
+    m_xmlfile.Write("\t\t<object class\"wxButton\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteLabel(phrase);
-    m_xmlfile.Write("\t\t</button>\n");
+    m_xmlfile.Write("\t\t</object>\n");
 
 }
 
@@ -271,10 +269,10 @@ void rc2xml::ParseGroupBox()
     int x,y,width,height;
     ReadRect(x,y,width,height);
 
-    m_xmlfile.Write("\t\t<staticbox");
+    m_xmlfile.Write("\t\t<object class=\"wxStaticBox\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteLabel(phrase);
-    m_xmlfile.Write("\t\t</staticbox>\n");
+    m_xmlfile.Write("\t\t</object>\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<combobox");
+    m_xmlfile.Write("\t\t<object class=\"wxComboBox\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\n\t\t</combobox>\n");
+    m_xmlfile.Write("\n\t\t</object>\n");
 
 }
 
@@ -386,12 +384,11 @@ void rc2xml::ParseMenu(wxString varname)
     wxString token="";
 
     //Write menubar to xml file
-    m_xmlfile.Write("\t<menubar");
+    m_xmlfile.Write("\t<object class=\"wxMenuBar\"");
     //Avoid duplicate names this way
     varname.Replace("IDR_","MB_");
     WriteName(varname);
     m_xmlfile.Write(">\n");
-    m_xmlfile.Write("\t\t<children>\n");
 
     while ((token!="BEGIN")&(token!="{"))
         token=GetToken();
@@ -404,8 +401,7 @@ void rc2xml::ParseMenu(wxString varname)
         ParsePopupMenu();
         }
     }
-    m_xmlfile.Write("\t\t</children>\n");
-    m_xmlfile.Write("\t</menubar>\n");
+    m_xmlfile.Write("\t</object>\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_"<<menucount;
-    m_xmlfile.Write("\t\t<menu");
+    m_xmlfile.Write("\t\t<object class=\"wxMenu\"");
     WriteName(name);
     m_xmlfile.Write(">\n");
     WriteLabel(token);
-    m_xmlfile.Write("\t\t\t<children>\n");
 
     while ((token!="BEGIN")&(token!="{"))
         token=GetToken();
@@ -441,8 +436,7 @@ void rc2xml::ParsePopupMenu()
     if (token=="MENUITEM")
         ParseMenuItem();
     }
-    m_xmlfile.Write("\t\t\t</children>\n");
-    m_xmlfile.Write("\t\t\t</menu>\n");
+    m_xmlfile.Write("\t\t\t</object>\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<slider");
+    m_xmlfile.Write("\t\t<object class=\"wxSlider\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteStyle(style);
-    m_xmlfile.Write("\n\t\t</slider>\n");
+    m_xmlfile.Write("\n\t\t</object>\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<gauge");
+    m_xmlfile.Write("\t\t<object class=\"wxGauge\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteStyle(style);
-    m_xmlfile.Write("\t\t</gauge>\n");
+    m_xmlfile.Write("\t\t</object>\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<checkbox");
+        m_xmlfile.Write("\t\t<object class=\"wxCheckBox\"");
         WriteBasicInfo(x,y,width,height,varname);
         WriteLabel(label);
-        m_xmlfile.Write("\t\t</checkbox>\n");
+        m_xmlfile.Write("\t\t</object>\n");
         }
 
     if (token.Find("BS_AUTORADIOBUTTON")!=-1)
         {
         ReadRect(x,y,width,height);
-        m_xmlfile.Write("\t\t<radiobutton");
+        m_xmlfile.Write("\t\t<object class=\"wxRadioButton\"");
         WriteBasicInfo(x,y,width,height,varname);
         WriteLabel(label);
-        m_xmlfile.Write("\t\t</radiobutton>\n");
+        m_xmlfile.Write("\t\t</object>\n");
         }
 
 }
@@ -654,9 +648,9 @@ void rc2xml::ParseListBox()
     int x,y,width,height;
     ReadRect(x,y,width,height);
 
-    m_xmlfile.Write("\t\t<listbox");
+    m_xmlfile.Write("\t\t<object class=\"wxListBox\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\n\t\t</listbox>\n");
+    m_xmlfile.Write("\n\t\t</object>\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<textctrl");
+    m_xmlfile.Write("\t\t<object class=\"wxTextCtrl\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteStyle(style);
-    m_xmlfile.Write("\t\t</textctrl>\n");
+    m_xmlfile.Write("\t\t</object>\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<spinbutton");
+    m_xmlfile.Write("\t\t<object class=\"wxSpinButton\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteStyle(style);
-    m_xmlfile.Write("\n\t\t</spinbutton>\n");
+    m_xmlfile.Write("\n\t\t</object>\n");
 
 }
 
@@ -770,7 +764,7 @@ void rc2xml::ParseToolBar(wxString varname)
         wxLogError("Unable to load bitmap:"+*bitmappath);
 
 //Write toolbar to xml file
-    m_xmlfile.Write("  <toolbar");
+    m_xmlfile.Write("  <object class=\"wxToolBar\"");
 //Avoid duplicate names this way
     varname.Replace("IDR_","TB_");
     WriteName(varname);
@@ -779,7 +773,6 @@ void rc2xml::ParseToolBar(wxString varname)
     style+="wxTB_FLAT";
     WriteStyle(style);
 
-    m_xmlfile.Write("\t\t<children>\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<tool");
+            m_xmlfile.Write("\t\t\t<object class=\"tool\"");
             WriteName(buttonname);
             m_xmlfile.Write(">\n");
     //Write tool tip if any
@@ -812,17 +805,16 @@ void rc2xml::ParseToolBar(wxString varname)
             buttonname+=".bmp";
             m_xmlfile.Write("\t\t\t\t<bitmap>"+buttonname+"</bitmap>\n");
         WriteToolButton(buttonname,c,width,height,bitmap);
-        m_xmlfile.Write("\t\t\t</tool>\n");
+        m_xmlfile.Write("\t\t\t</object>\n");
         c++;
         }
     else if (token=="SEPARATOR")
     {
-    m_xmlfile.Write("\t\t\t<separator/>\n");
+    m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\n");
     }
     token=GetToken();
     }
-    m_xmlfile.Write("\t</children>\n");
-    m_xmlfile.Write("\t</toolbar>\n");
+    m_xmlfile.Write("\t</object>\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<separator/>\n");
+        m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\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<menuitem");
+    m_xmlfile.Write("\t\t\t<object class=\"wxMenuItem\"");
     WriteName(name);
     m_xmlfile.Write(">\n");
     WriteLabel(token);
@@ -926,7 +918,7 @@ void rc2xml::ParseMenuItem()
         
         ptoken=PeekToken();
         }
-    m_xmlfile.Write("\t\t\t</menuitem>\n"); 
+    m_xmlfile.Write("\t\t\t</object>\n"); 
 
 }
 
@@ -942,11 +934,11 @@ void rc2xml::ParseIconStatic()
     int x,y,width,height;
     ReadRect(x,y,width,height);
 
-    m_xmlfile.Write("\t\t<staticbitmap");
+    m_xmlfile.Write("\t\t<object class=\"wxStaticBitmap\"");
     WriteBasicInfo(x,y,width,height,varname);
 //Save icon as a bitmap
     WriteIcon(iconname);
-    m_xmlfile.Write("\t\t</staticbitmap>\n");
+    m_xmlfile.Write("\t\t</object>\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<staticbitmap");
+    m_xmlfile.Write("\t\t<object class=\"wxStaticBitmap\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteBitmap(bitmapname);
-    m_xmlfile.Write("\t\t</staticbitmap>\n");
+    m_xmlfile.Write("\t\t</object>\n");
 
 }
 
@@ -1058,10 +1050,10 @@ if (token.Find("SBS_VERT")!=-1)
     else
         style=_T("wxSB_HORIZONTAL");
 
-    m_xmlfile.Write("\t\t<scrollbar");
+    m_xmlfile.Write("\t\t<object class=\"wxScrollBar\"");
     WriteBasicInfo(x,y,width,height,varname);
     WriteStyle(style);
-    m_xmlfile.Write("\n\t\t</scrollbar>\n");
+    m_xmlfile.Write("\n\t\t</object>\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<treectrl");
+    m_xmlfile.Write("\t\t<object class=\"wxTreeCtrl\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\t\t</treectrl>\n");
+    m_xmlfile.Write("\t\t</object>\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<calendarctrl");
+    m_xmlfile.Write("\t\t<object class=\"wxCalendarCtrl\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\t\t</calendarctrl>\n");
+    m_xmlfile.Write("\t\t</object>\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<listctrl");
+    m_xmlfile.Write("\t\t<object class=\"wxListCtrl\"");
     WriteBasicInfo(x,y,width,height,varname);
-    m_xmlfile.Write("\t\t</listctrl>\n");
+    m_xmlfile.Write("\t\t</object>\n");
 
 }
 
index 6aa5ad54f70e106656441ccfcbc6cbd23de7ec71..f2e331ec5c8390cdbaa1a23ad44e21127acc9b25 100644 (file)
@@ -92,28 +92,24 @@ bool wxr2xml::ParseResources()
 
 void wxr2xml::ParsePanel(wxItemResource * res)
 {
-    m_xmlfile.Write("\t<panel");
+    m_xmlfile.Write("\t<object class=\"wxPanel\"");
     PanelStuff(res);
     WriteControlInfo(res);
     m_xmlfile.Write("\n");
-    m_xmlfile.Write("\t\t<children>\n");
     ParseControls(res);
-    m_xmlfile.Write(" \t\t</children>\n");
-    m_xmlfile.Write("\t</panel>\n\n");
+    m_xmlfile.Write("\t</object>\n\n");
 }
 
 void wxr2xml::ParseDialog(wxItemResource * res)
 {
     PanelStuff(res);
-    m_xmlfile.Write("\t<dialog");
+    m_xmlfile.Write("\t<object class=\"wxDialog\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetTitle(res));
 
     m_xmlfile.Write("\n");
-    m_xmlfile.Write("\t\t<children>\n");
     ParseControls(res);
-    m_xmlfile.Write("\t\t</children>\n");
-    m_xmlfile.Write("\t</dialog>\n\n");
+    m_xmlfile.Write("\t</object>\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<button");
+    m_xmlfile.Write("\t\t\t<object class=\"wxButton\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
-    m_xmlfile.Write("\t\t\t</button>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseTextCtrl(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<textctrl");
+    m_xmlfile.Write("\t\t\t<object class=\"wxTextCtrl\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetValue4(res));
-    m_xmlfile.Write("\t\t\t</textctrl>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 
 }
 
@@ -225,11 +221,11 @@ wxString wxr2xml::GetValue4(wxItemResource * res)
 
 void wxr2xml::ParseCheckBox(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<checkbox");
+    m_xmlfile.Write("\t\t\t<object class=\"wxCheckBox\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
     m_xmlfile.Write(GetCheckStatus(res));
-    m_xmlfile.Write("\t\t\t</checkbox>\n");
+    m_xmlfile.Write("\t\t\t</object>\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<radiobox");
+    m_xmlfile.Write("\t\t\t<object class=\"wxRadioBox\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
     // Add radio box items
     WriteStringList(res);
     // Value1
     m_xmlfile.Write(GetDimension(res));
-    m_xmlfile.Write("\t\t\t</radiobox>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseListBox(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<listbox");
+    m_xmlfile.Write("\t\t\t<object class=\"wxListBox\"");
     WriteControlInfo(res);
     WriteStringList(res);
-    m_xmlfile.Write("\t\t\t</listbox>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseStaticText(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<statictext");
+    m_xmlfile.Write("\t\t\t<object class=\"wxStaticText\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
-    m_xmlfile.Write("\t\t\t</statictext>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseStaticBox(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<staticbox");
+    m_xmlfile.Write("\t\t\t<object class=\"wxStaticBox\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
-    m_xmlfile.Write("\t\t\t</staticbox>\n");
+    m_xmlfile.Write("\t\t\t</object>\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<choice");
+    m_xmlfile.Write("\t\t\t<object class=\"wxChoice\"");
     WriteControlInfo(res);
     // Add choice items
     WriteStringList(res);
-    m_xmlfile.Write("\t\t\t</choice>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseGauge(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<gauge");
+    m_xmlfile.Write("\t\t\t<object class=\"wxGauge\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetValue1(res));
     m_xmlfile.Write(GetRange(res));
-    m_xmlfile.Write("\n\t\t\t</gauge>\n");
+    m_xmlfile.Write("\n\t\t\t</object>\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<slider");
+    m_xmlfile.Write("\t\t\t<object class=\"wxSlider\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetValue1(res));
     m_xmlfile.Write(GetMax(res));
     m_xmlfile.Write(GetMin(res));
-    m_xmlfile.Write("\n\t\t\t</slider>\n");
+    m_xmlfile.Write("\n\t\t\t</object>\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<combobox");
+    m_xmlfile.Write("\t\t\t<object class=\"wxComboBox\"");
     WriteControlInfo(res);
     // Add combo items
     WriteStringList(res);
-    m_xmlfile.Write("\n\t\t\t</combobox>\n");
+    m_xmlfile.Write("\n\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseRadioButton(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<radiobutton");
+    m_xmlfile.Write("\t\t\t<object class=\"wxRadioButton\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetLabel(res));
 
     wxString msg;
     m_xmlfile.Write(GetValue1(res));
     m_xmlfile.Write(GetCheckStatus(res));
-    m_xmlfile.Write("\t\t\t</radiobutton>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
 }
 
 void wxr2xml::ParseScrollBar(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<scrollbar");
+    m_xmlfile.Write("\t\t\t<object class=\"wxScrollBar\"");
     WriteControlInfo(res);
     m_xmlfile.Write(GetValue1(res));
     m_xmlfile.Write("\t\t\t\t<thumbsize>"+GetValue2(res)+"</thumbsize>\n");
     m_xmlfile.Write("\t\t\t\t<range>"+GetValue3(res)+"</range>\n");
     m_xmlfile.Write("\t\t\t\t<pagesize>"+GetValue5(res)+"</pagesize>\n");
-    m_xmlfile.Write("\t\t\t</scrollbar>\n");
+    m_xmlfile.Write("\t\t\t</object>\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<menubar ");
+    m_xmlfile.Write("\t<object class=\"wxMenuBar\" ");
     m_xmlfile.Write(GenerateName(res));
     m_xmlfile.Write(">\n");
-    m_xmlfile.Write("\t\t<children>\n");
     while (node) {
         child = (wxItemResource *) node->Data();
         ParseMenu(child);
         node = node->Next();
     }
 
-    m_xmlfile.Write("\t\t</children>\n");
-    m_xmlfile.Write("\t</menubar> \n\n");
+    m_xmlfile.Write("\t</object> \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\t<menu ");
+    m_xmlfile.Write("\t\t\t<object class=\"wxMenu\" ");
     wxString menuname;
     menuname << "name = \"menu_" << res->GetValue1() << "\"";
     m_xmlfile.Write(menuname);
@@ -613,7 +607,6 @@ void wxr2xml::ParseMenu(wxItemResource * res)
     if (res->GetValue4() != "")
         m_xmlfile.Write("\t\t\t\t<help>" + res->GetValue4() +
         "</help>\n");
-        m_xmlfile.Write("\t\t\t<children>\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</children>\n");
-    m_xmlfile.Write("\t\t\t</menu> \n");
+    m_xmlfile.Write("\t\t\t</object> \n");
 }
 
 void wxr2xml::ParseMenuItem(wxItemResource * res)
 {
     // Get Menu Item or Separator
     if (res->GetTitle() == "") {
-        m_xmlfile.Write("\t\t\t<separator/>\n");
+        m_xmlfile.Write("\t\t\t<object class=\"separator\"/>\n");
     } else {
-        m_xmlfile.Write("\t\t\t\t<menuitem ");
+        m_xmlfile.Write("\t\t\t\t<object class=\"wxMenuItem\" ");
         wxString menuname;
         menuname << "name = \"menuitem_" << res->GetValue1() << "\"";
         m_xmlfile.Write(menuname);
@@ -645,7 +637,7 @@ void wxr2xml::ParseMenuItem(wxItemResource * res)
         res->GetValue4() + "</help>\n");
         if (res->GetValue2())
             m_xmlfile.Write("\t\t\t\t<checkable>1</checkable>\n");
-        m_xmlfile.Write("\t\t\t</menuitem> \n");
+        m_xmlfile.Write("\t\t\t</object> \n");
     }
 }
 
@@ -657,7 +649,7 @@ wxString wxr2xml::FixMenuString(wxString phrase)
 
 void wxr2xml::ParseStaticBitmap(wxItemResource * res)
 {
-    m_xmlfile.Write("\t\t\t<staticbitmap");
+    m_xmlfile.Write("\t\t\t<object class=\"wxStaticBitmap\"");
     WriteControlInfo(res);
     // value4 holds bitmap name
     wxString bitmapname;
@@ -667,13 +659,13 @@ void wxr2xml::ParseStaticBitmap(wxItemResource * res)
     bitmapname += _T(".bmp");
     bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
     m_xmlfile.Write("\n\t\t\t\t<bitmap>" + bitmapname + "</bitmap>");
-    m_xmlfile.Write("\t\t\t</staticbitmap>\n");
+    m_xmlfile.Write("\t\t\t</object>\n");
     // bitmap5
 }
 //Parse a bitmap resource
 void wxr2xml::ParseBitmap(wxItemResource * res)
 {
-    m_xmlfile.Write("\t<bitmap ");
+    m_xmlfile.Write("\t<object class=\"wxBitmap\" ");
     m_xmlfile.Write(GenerateName(res)+">");
     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("</bitmap>\n\n");
+    m_xmlfile.Write("</object>\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<bitmapbutton");
+    m_xmlfile.Write("\t\t\t<object class=\"wxBitmapButton\"");
     WriteControlInfo(res);
     // value4 holds bitmap name
     wxString bitmapname;
@@ -738,7 +730,7 @@ void wxr2xml::ParseBitmapButton(wxItemResource *res)
     bitmap.SaveFile(bitmapname, wxBITMAP_TYPE_BMP);
     m_xmlfile.Write("\t\t\t\t<bitmap>" + bitmapname + "</bitmap>\n");
     
-    m_xmlfile.Write("\t\t\t</bitmapbutton>\n");
+    m_xmlfile.Write("\t\t\t</object>\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\t<face>Decorative</face>\n");
+            m_xmlfile.Write("\t\t\t\t<face>decorative</face>\n");
             break;
         case wxROMAN:
-            m_xmlfile.Write("\t\t\t\t<face>Roman</face>\n");
+            m_xmlfile.Write("\t\t\t\t<face>roman</face>\n");
             break;
         case wxSCRIPT:
-            m_xmlfile.Write("\t\t\t\t<face>Script</face>\n");
+            m_xmlfile.Write("\t\t\t\t<face>script</face>\n");
             break;
         case wxSWISS:
-            m_xmlfile.Write("\t\t\t\t<face>Swiss</face>\n");
+            m_xmlfile.Write("\t\t\t\t<face>swiss</face>\n");
             break;
         case wxMODERN:
-            m_xmlfile.Write("\t\t\t\t<face>Modern</face>\n");
+            m_xmlfile.Write("\t\t\t\t<face>modern</face>\n");
             break;
         default:
             wxLogError("Unknown font face");
index ad0c3de2ad9fd0c9ab6a18c653bcad5debfba8f7..eacf6222b2030fddf01ddb023b3e47b302559d65 100644 (file)
@@ -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");
index 2a58488b7e891d64be44b78d463045f643a6ca15..d369563d09f2af30c7b5555fcd1ddcd6bfbf53f6 100644 (file)
@@ -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/bitmapbutton.df b/contrib/utils/wxrcedit/df/bitmapbutton.df
deleted file mode 100644 (file)
index 3dab7d7..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-node bitmapbutton
-var style of flags wxBU_AUTODRAW,wxBU_LEFT,wxBU_RIGHT,wxBU_TOP,wxBU_BOTTOM
-var default of bool
-var bitmap of text
-var selected of text
-var focus of text
-var disabled of text
-derived from control
diff --git a/contrib/utils/wxrcedit/df/boxsizer.df b/contrib/utils/wxrcedit/df/boxsizer.df
deleted file mode 100644 (file)
index a7845b1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-node boxsizer
-type sizer
-icon 0
-childtype sizer_item
-derived from panel_item
-var orient of flags wxHORIZONTAL,wxVERTICAL
-var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/button.df b/contrib/utils/wxrcedit/df/button.df
deleted file mode 100644 (file)
index 5322c96..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-node button
-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/calendarctrl.df
deleted file mode 100644 (file)
index 45eae54..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node calendarctrl
-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/checkbox.df
deleted file mode 100644 (file)
index c11d2cb..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-node checkbox
-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/checklist.df
deleted file mode 100644 (file)
index 3967507..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node checklist
-var content of not_implemented
-derived from control
diff --git a/contrib/utils/wxrcedit/df/choice.df b/contrib/utils/wxrcedit/df/choice.df
deleted file mode 100644 (file)
index 7abe6fa..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-node choice
-var style of flags wxCB_SORT
-var selection of integer
-var content of not_implemented
-derived from control
diff --git a/contrib/utils/wxrcedit/df/combobox.df b/contrib/utils/wxrcedit/df/combobox.df
deleted file mode 100644 (file)
index 93e19d3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-node combobox
-var style of flags wxCB_SIMPLE,wxCB_SORT,wxCB_READONLY,wxCB_DROPDOWN
-var value of string
-var selection of integer
-var content of not_implemented
-derived from control
diff --git a/contrib/utils/wxrcedit/df/dialog.df b/contrib/utils/wxrcedit/df/dialog.df
deleted file mode 100644 (file)
index cdc527d..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-node dialog
-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
-derived from panelbase
diff --git a/contrib/utils/wxrcedit/df/flexgridsizer.df b/contrib/utils/wxrcedit/df/flexgridsizer.df
deleted file mode 100644 (file)
index e0ceee1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-node flexgridsizer
-type sizer
-icon 4
-childtype sizer_item
-derived from panel_item
-var rows of integer
-var cols of integer
-var vgap of dimension
-var hgap of dimension
-var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/gauge.df b/contrib/utils/wxrcedit/df/gauge.df
deleted file mode 100644 (file)
index 44a57b4..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-node gauge
-var style of flags wxGA_HORIZONTAL,wxGA_VERTICAL,wxGA_PROGRESSBAR,wxGA_SMOOTH
-var range of integer
-var value of integer
-var shadow of dimension
-var bezel of dimension
-derived from control
diff --git a/contrib/utils/wxrcedit/df/gridsizer.df b/contrib/utils/wxrcedit/df/gridsizer.df
deleted file mode 100644 (file)
index 01fe2a2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-node gridsizer
-type sizer
-icon 4
-childtype sizer_item
-derived from panel_item
-var rows of integer
-var cols of integer
-var vgap of dimension
-var hgap of dimension
-var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/htmlwindow.df b/contrib/utils/wxrcedit/df/htmlwindow.df
deleted file mode 100644 (file)
index f727fcb..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-node htmlwindow
-var url of text
-var htmlcode of text
-var borders of dimension
-var style of flags wxHW_SCROLLBAR_NEVER,wxHW_SCROLLBAR_AUTO
-derived from control
diff --git a/contrib/utils/wxrcedit/df/listbox.df b/contrib/utils/wxrcedit/df/listbox.df
deleted file mode 100644 (file)
index 4ee817c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-node listbox
-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
-derived from control
diff --git a/contrib/utils/wxrcedit/df/listctrl.df b/contrib/utils/wxrcedit/df/listctrl.df
deleted file mode 100644 (file)
index aa63557..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node listctrl
-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/menu.df
deleted file mode 100644 (file)
index 641a045..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-node menu
-type panel
-icon 0
-childtype menu_item
-var label of text
-var style of flags wxMENU_TEAROFF
-var help of text
-derived from menu_item
diff --git a/contrib/utils/wxrcedit/df/menubar.df b/contrib/utils/wxrcedit/df/menubar.df
deleted file mode 100644 (file)
index 18c8397..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-node menubar
-type panel
-icon 0
-childtype menu
-var style of flags wxMB_DOCKABLE
diff --git a/contrib/utils/wxrcedit/df/menuitem.df b/contrib/utils/wxrcedit/df/menuitem.df
deleted file mode 100644 (file)
index 9e0f07f..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-node menuitem
-type normal
-icon 0
-var label of text
-var help of text
-var checkable of bool
-var checked of bool
-var enabled of bool
-derived from menu_item
diff --git a/contrib/utils/wxrcedit/df/notebook.df b/contrib/utils/wxrcedit/df/notebook.df
deleted file mode 100644 (file)
index f20edc5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-node notebook
-type notebook
-var style of flags wxNB_FIXEDWIDTH,wxNB_LEFT,wxNB_RIGHT,wxNB_BOTTOM
-var usenotebooksizer of bool
-childtype panel
-derived from control
diff --git a/contrib/utils/wxrcedit/df/panel.df b/contrib/utils/wxrcedit/df/panel.df
deleted file mode 100644 (file)
index 4d44076..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node panel
-derived from panel_item
-derived from panelbase
diff --git a/contrib/utils/wxrcedit/df/radiobox.df b/contrib/utils/wxrcedit/df/radiobox.df
deleted file mode 100644 (file)
index e31e60a..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-node radiobox
-var style of flags wxRA_SPECIFY_COLS,wxRA_HORIZONTAL,wxRA_SPECIFY_ROWS,wxRA_VERTICAL
-var label of text
-var dimension of integer
-var selection of integer
-var content of not_implemented
-derived from control
diff --git a/contrib/utils/wxrcedit/df/radiobutton.df b/contrib/utils/wxrcedit/df/radiobutton.df
deleted file mode 100644 (file)
index 19185fb..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-node radiobutton
-var label of text
-var value of bool
-var style of flags wxRB_GROUP
-derived from control
diff --git a/contrib/utils/wxrcedit/df/scrollbar.df b/contrib/utils/wxrcedit/df/scrollbar.df
deleted file mode 100644 (file)
index 5cc71e0..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-node scrollbar
-var style of flags wxSB_HORIZONTAL,wxSB_VERTICAL
-var value of integer
-var thumbsize of integer
-var range of integer
-var pagesize of integer
-derived from control
\ No newline at end of file
diff --git a/contrib/utils/wxrcedit/df/slider.df b/contrib/utils/wxrcedit/df/slider.df
deleted file mode 100644 (file)
index ee3866b..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-node slider
-var value of integer
-var min of integer
-var max of integer
-var style of flags wxSL_HORIZONTAL,wxSL_VERTICAL,wxSL_AUTOTICKS,wxSL_LABELS,wxSL_LEFT,wxSL_TOP,wxSL_RIGHT,wxSL_BOTTOM,wxSL_BOTH,wxSL_SELRANGE
-var tickfreq of integer
-var pagesize of integer
-var linesize of integer
-var thumb of integer
-var tick of integer
-var selmin of integer
-var selmax of integer
-derived from control
diff --git a/contrib/utils/wxrcedit/df/spinbutton.df b/contrib/utils/wxrcedit/df/spinbutton.df
deleted file mode 100644 (file)
index 5eed87a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-node spinbutton
-var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP
-var value of integer
-var min of integer
-var max of integer
-derived from control
diff --git a/contrib/utils/wxrcedit/df/spinctrl.df b/contrib/utils/wxrcedit/df/spinctrl.df
deleted file mode 100644 (file)
index 5fac60e..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-node spinctrl
-var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP
-var value of integer
-var min of integer
-var max of integer
-derived from control
diff --git a/contrib/utils/wxrcedit/df/staticbitmap.df b/contrib/utils/wxrcedit/df/staticbitmap.df
deleted file mode 100644 (file)
index 105691c..0000000
+++ /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/staticbox.df b/contrib/utils/wxrcedit/df/staticbox.df
deleted file mode 100644 (file)
index ddd135b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node staticbox
-var label of text
-derived from control
diff --git a/contrib/utils/wxrcedit/df/staticboxsizer.df b/contrib/utils/wxrcedit/df/staticboxsizer.df
deleted file mode 100644 (file)
index 40e62f8..0000000
+++ /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/staticline.df b/contrib/utils/wxrcedit/df/staticline.df
deleted file mode 100644 (file)
index 75995cf..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node staticline
-var style of flags wxLI_HORIZONTAL,wxLI_VERTICAL
-derived from control
diff --git a/contrib/utils/wxrcedit/df/statictext.df b/contrib/utils/wxrcedit/df/statictext.df
deleted file mode 100644 (file)
index 677c1f8..0000000
+++ /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/textctrl.df b/contrib/utils/wxrcedit/df/textctrl.df
deleted file mode 100644 (file)
index 706dcdf..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-node textctrl
-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/toolbar.df
deleted file mode 100644 (file)
index 0a8dbd9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-node toolbar
-type panel
-icon 0
-childtype toolbar_item
-var style of flags wxTB_FLAT,wxTB_DOCKABLE,wxTB_VERTICAL,wxTB_HORIZONTAL
-var bitmapsize of coord
-var pos of coord
-var size of coord
-var margins of coord
-var packing of integer
-var separation of integer
diff --git a/contrib/utils/wxrcedit/df/treectrl.df b/contrib/utils/wxrcedit/df/treectrl.df
deleted file mode 100644 (file)
index bee9db8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-node treectrl
-var style of flags wxTR_HAS_BUTTONS,wxTR_EDIT_LABELS,wxTR_MULTIPLE
-derived from control
diff --git a/contrib/utils/wxrcedit/df/wxBitmapButton.df b/contrib/utils/wxrcedit/df/wxBitmapButton.df
new file mode 100644 (file)
index 0000000..93af80a
--- /dev/null
@@ -0,0 +1,8 @@
+node wxBitmapButton
+var style of flags wxBU_AUTODRAW,wxBU_LEFT,wxBU_RIGHT,wxBU_TOP,wxBU_BOTTOM
+var default of bool
+var bitmap of text
+var selected of text
+var focus of text
+var disabled of text
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxBoxSizer.df b/contrib/utils/wxrcedit/df/wxBoxSizer.df
new file mode 100644 (file)
index 0000000..214ae7d
--- /dev/null
@@ -0,0 +1,7 @@
+node wxBoxSizer
+type sizer
+icon 0
+childtype sizer_item
+derived from panel_item
+var orient of flags wxHORIZONTAL,wxVERTICAL
+var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/wxButton.df b/contrib/utils/wxrcedit/df/wxButton.df
new file mode 100644 (file)
index 0000000..1cfc297
--- /dev/null
@@ -0,0 +1,4 @@
+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/wxCalendarCtrl.df b/contrib/utils/wxrcedit/df/wxCalendarCtrl.df
new file mode 100644 (file)
index 0000000..5b7ce1f
--- /dev/null
@@ -0,0 +1,3 @@
+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/wxCheckBox.df b/contrib/utils/wxrcedit/df/wxCheckBox.df
new file mode 100644 (file)
index 0000000..5edd23b
--- /dev/null
@@ -0,0 +1,4 @@
+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/wxCheckList.df b/contrib/utils/wxrcedit/df/wxCheckList.df
new file mode 100644 (file)
index 0000000..2962150
--- /dev/null
@@ -0,0 +1,3 @@
+node wxCheckList
+var content of not_implemented
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxChoice.df b/contrib/utils/wxrcedit/df/wxChoice.df
new file mode 100644 (file)
index 0000000..0273735
--- /dev/null
@@ -0,0 +1,5 @@
+node wxChoice
+var style of flags wxCB_SORT
+var selection of integer
+var content of not_implemented
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxComboBox.df b/contrib/utils/wxrcedit/df/wxComboBox.df
new file mode 100644 (file)
index 0000000..0e03009
--- /dev/null
@@ -0,0 +1,6 @@
+node wxComboBox
+var style of flags wxCB_SIMPLE,wxCB_SORT,wxCB_READONLY,wxCB_DROPDOWN
+var value of string
+var selection of integer
+var content of not_implemented
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxDialog.df b/contrib/utils/wxrcedit/df/wxDialog.df
new file mode 100644 (file)
index 0000000..35d213d
--- /dev/null
@@ -0,0 +1,5 @@
+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
+derived from panelbase
diff --git a/contrib/utils/wxrcedit/df/wxFlexGridSizer.df b/contrib/utils/wxrcedit/df/wxFlexGridSizer.df
new file mode 100644 (file)
index 0000000..dfb093d
--- /dev/null
@@ -0,0 +1,10 @@
+node wxFlexGridSizer
+type sizer
+icon 4
+childtype sizer_item
+derived from panel_item
+var rows of integer
+var cols of integer
+var vgap of dimension
+var hgap of dimension
+var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/wxGauge.df b/contrib/utils/wxrcedit/df/wxGauge.df
new file mode 100644 (file)
index 0000000..1f931ff
--- /dev/null
@@ -0,0 +1,7 @@
+node wxGauge
+var style of flags wxGA_HORIZONTAL,wxGA_VERTICAL,wxGA_PROGRESSBAR,wxGA_SMOOTH
+var range of integer
+var value of integer
+var shadow of dimension
+var bezel of dimension
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxGridSizer.df b/contrib/utils/wxrcedit/df/wxGridSizer.df
new file mode 100644 (file)
index 0000000..54afc97
--- /dev/null
@@ -0,0 +1,10 @@
+node wxGridSizer
+type sizer
+icon 4
+childtype sizer_item
+derived from panel_item
+var rows of integer
+var cols of integer
+var vgap of dimension
+var hgap of dimension
+var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/wxHtmlWindow.df b/contrib/utils/wxrcedit/df/wxHtmlWindow.df
new file mode 100644 (file)
index 0000000..c14e1bb
--- /dev/null
@@ -0,0 +1,6 @@
+node wxHtmlWindow
+var url of text
+var htmlcode of text
+var borders of dimension
+var style of flags wxHW_SCROLLBAR_NEVER,wxHW_SCROLLBAR_AUTO
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxListBox.df b/contrib/utils/wxrcedit/df/wxListBox.df
new file mode 100644 (file)
index 0000000..29d831e
--- /dev/null
@@ -0,0 +1,5 @@
+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
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxListCtrl.df b/contrib/utils/wxrcedit/df/wxListCtrl.df
new file mode 100644 (file)
index 0000000..00e0e96
--- /dev/null
@@ -0,0 +1,3 @@
+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/wxMenu.df b/contrib/utils/wxrcedit/df/wxMenu.df
new file mode 100644 (file)
index 0000000..86c0e21
--- /dev/null
@@ -0,0 +1,8 @@
+node wxMenu
+type panel
+icon 0
+childtype menu_item
+var label of text
+var style of flags wxMENU_TEAROFF
+var help of text
+derived from menu_item
diff --git a/contrib/utils/wxrcedit/df/wxMenuBar.df b/contrib/utils/wxrcedit/df/wxMenuBar.df
new file mode 100644 (file)
index 0000000..7879ab6
--- /dev/null
@@ -0,0 +1,5 @@
+node wxMenuBar
+type panel
+icon 0
+childtype wxMenu
+var style of flags wxMB_DOCKABLE
diff --git a/contrib/utils/wxrcedit/df/wxMenuItem.df b/contrib/utils/wxrcedit/df/wxMenuItem.df
new file mode 100644 (file)
index 0000000..2fc733e
--- /dev/null
@@ -0,0 +1,9 @@
+node wxMenuItem
+type normal
+icon 0
+var label of text
+var help of text
+var checkable of bool
+var checked of bool
+var enabled of bool
+derived from menu_item
diff --git a/contrib/utils/wxrcedit/df/wxNotebook.df b/contrib/utils/wxrcedit/df/wxNotebook.df
new file mode 100644 (file)
index 0000000..80b27f3
--- /dev/null
@@ -0,0 +1,6 @@
+node wxNotebook
+type notebook
+var style of flags wxNB_FIXEDWIDTH,wxNB_LEFT,wxNB_RIGHT,wxNB_BOTTOM
+var usenotebooksizer of bool
+childtype wxPanel
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxPanel.df b/contrib/utils/wxrcedit/df/wxPanel.df
new file mode 100644 (file)
index 0000000..948f510
--- /dev/null
@@ -0,0 +1,3 @@
+node wxPanel
+derived from panel_item
+derived from panelbase
diff --git a/contrib/utils/wxrcedit/df/wxRadioBox.df b/contrib/utils/wxrcedit/df/wxRadioBox.df
new file mode 100644 (file)
index 0000000..2ddec41
--- /dev/null
@@ -0,0 +1,7 @@
+node wxRadioBox
+var style of flags wxRA_SPECIFY_COLS,wxRA_HORIZONTAL,wxRA_SPECIFY_ROWS,wxRA_VERTICAL
+var label of text
+var dimension of integer
+var selection of integer
+var content of not_implemented
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxRadioButton.df b/contrib/utils/wxrcedit/df/wxRadioButton.df
new file mode 100644 (file)
index 0000000..cdc868e
--- /dev/null
@@ -0,0 +1,5 @@
+node wxRadioButton
+var label of text
+var value of bool
+var style of flags wxRB_GROUP
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxScrollBar.df b/contrib/utils/wxrcedit/df/wxScrollBar.df
new file mode 100644 (file)
index 0000000..7f19791
--- /dev/null
@@ -0,0 +1,7 @@
+node wxScrollBar
+var style of flags wxSB_HORIZONTAL,wxSB_VERTICAL
+var value of integer
+var thumbsize of integer
+var range of integer
+var pagesize of integer
+derived from control
\ No newline at end of file
diff --git a/contrib/utils/wxrcedit/df/wxSlider.df b/contrib/utils/wxrcedit/df/wxSlider.df
new file mode 100644 (file)
index 0000000..a97f24f
--- /dev/null
@@ -0,0 +1,13 @@
+node wxSlider
+var value of integer
+var min of integer
+var max of integer
+var style of flags wxSL_HORIZONTAL,wxSL_VERTICAL,wxSL_AUTOTICKS,wxSL_LABELS,wxSL_LEFT,wxSL_TOP,wxSL_RIGHT,wxSL_BOTTOM,wxSL_BOTH,wxSL_SELRANGE
+var tickfreq of integer
+var pagesize of integer
+var linesize of integer
+var thumb of integer
+var tick of integer
+var selmin of integer
+var selmax of integer
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxSpinButton.df b/contrib/utils/wxrcedit/df/wxSpinButton.df
new file mode 100644 (file)
index 0000000..d37c601
--- /dev/null
@@ -0,0 +1,6 @@
+node wxSpinButton
+var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP
+var value of integer
+var min of integer
+var max of integer
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxSpinCtrl.df b/contrib/utils/wxrcedit/df/wxSpinCtrl.df
new file mode 100644 (file)
index 0000000..68066a9
--- /dev/null
@@ -0,0 +1,6 @@
+node wxSpinCtrl
+var style of flags wxSP_HORIZONTAL,wxSP_VERTICAL,wxSP_ARROW_KEYS,wxSP_WRAP
+var value of integer
+var min of integer
+var max of integer
+derived from control
diff --git a/contrib/utils/wxrcedit/df/wxStaticBitmap.df b/contrib/utils/wxrcedit/df/wxStaticBitmap.df
new file mode 100644 (file)
index 0000000..d425d79
--- /dev/null
@@ -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/wxStaticBox.df b/contrib/utils/wxrcedit/df/wxStaticBox.df
new file mode 100644 (file)
index 0000000..2ecd453
--- /dev/null
@@ -0,0 +1,3 @@
+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 (file)
index 0000000..bea4290
--- /dev/null
@@ -0,0 +1,4 @@
+node wxStaticBoxSizer
+derived from wxBoxSizer
+var label of text
+var minsize of coord
diff --git a/contrib/utils/wxrcedit/df/wxStaticLine.df b/contrib/utils/wxrcedit/df/wxStaticLine.df
new file mode 100644 (file)
index 0000000..d674ebb
--- /dev/null
@@ -0,0 +1,3 @@
+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 (file)
index 0000000..d2f1f35
--- /dev/null
@@ -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/wxTextCtrl.df b/contrib/utils/wxrcedit/df/wxTextCtrl.df
new file mode 100644 (file)
index 0000000..95ef006
--- /dev/null
@@ -0,0 +1,4 @@
+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/wxToolBar.df b/contrib/utils/wxrcedit/df/wxToolBar.df
new file mode 100644 (file)
index 0000000..db4691b
--- /dev/null
@@ -0,0 +1,11 @@
+node wxToolBar
+type panel
+icon 0
+childtype toolbar_item
+var style of flags wxTB_FLAT,wxTB_DOCKABLE,wxTB_VERTICAL,wxTB_HORIZONTAL
+var bitmapsize of coord
+var pos of coord
+var size of coord
+var margins of coord
+var packing of integer
+var separation of integer
diff --git a/contrib/utils/wxrcedit/df/wxTreeCtrl.df b/contrib/utils/wxrcedit/df/wxTreeCtrl.df
new file mode 100644 (file)
index 0000000..26f8c4b
--- /dev/null
@@ -0,0 +1,3 @@
+node wxTreeCtrl
+var style of flags wxTR_HAS_BUTTONS,wxTR_EDIT_LABELS,wxTR_MULTIPLE
+derived from control
index 334b6f2b621a4578079cbf5c272aa80fd4d68ce3..c48887b89d2b0874e8b5e9b670957da2d4b2ddc2 100644 (file)
@@ -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);
index 4a734835bf20fa42f9d4fb331502186c5b307695..442e95f1b92d849ad3c25b1ffd8edc978c87dbf7 100644 (file)
@@ -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);
index 190cd00f4eea26cce8f6d573de9791d1ad972d8c..e584c498bce86ee3d49919e3a910e7f049404c62 100644 (file)
@@ -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 (file)
index 0000000..82729ec
--- /dev/null
@@ -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 (file)
index 0000000..ee7f86d
--- /dev/null
@@ -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
index c4c0f2ff17c3680064f92473e43d7f0711de7020..c920dad77cda6482ecd8207ff9ed68162433e438 100644 (file)
@@ -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);
+}
+
+
+
+
 
index 3ec3d934e6b21ee3354a71b004de1bf5d44e778a..e2f673543d3600abe502ecf004564cb95820a520 100644 (file)
@@ -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 
index ad0c3de2ad9fd0c9ab6a18c653bcad5debfba8f7..eacf6222b2030fddf01ddb023b3e47b302559d65 100644 (file)
@@ -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");