]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/utils/wxrcedit/editor.cpp
Applied patch [ 807164 ] fixes for core library
[wxWidgets.git] / contrib / utils / wxrcedit / editor.cpp
index 8b5a75951c3db678adf25f35e7e6284244fb6e59..a77da8d858e5f8c8f797319c32c609d31c424c83 100644 (file)
@@ -19,7 +19,7 @@
 #endif
 
 #include "wx/wx.h"
-#include "wx/xrc/xml.h"
+#include "wx/xml/xml.h"
 #include "wx/xrc/xmlres.h"
 #include "wx/splitter.h"
 #include "wx/config.h"
@@ -344,6 +344,9 @@ void EditorFrame::NewFile()
     m_Resource->SetRoot(new wxXmlNode(wxXML_ELEMENT_NODE, _("resource")));
        
        m_Resource->SetFileEncoding("utf-8");
+#if !wxUSE_UNICODE
+    m_Resource->SetEncoding(wxLocale::GetSystemEncodingName());
+#endif
     
        m_Resource->GetRoot()->AddProperty(_T("version"),
                                        WX_XMLRES_CURRENT_VERSION_STRING);
@@ -393,7 +396,7 @@ void EditorFrame::RefreshTree()
 static void RecursivelyExpand(wxTreeCtrl *t, wxTreeItemId item)
 {
     t->Expand(item);
-    long cookie;
+    void* cookie;
     wxTreeItemId id = t->GetFirstChild(item, cookie);
     while (id.IsOk())
     {
@@ -413,7 +416,7 @@ bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root)
     wxTreeItemId item;
     XmlTreeData *dt;
     wxXmlNode *nd;
-    long cookie;
+    void* cookie;
     
     item = m_TreeCtrl->GetFirstChild(*root, cookie);
     while (item.IsOk())
@@ -489,14 +492,14 @@ void EditorFrame::OnTreeSel(wxTreeEvent& event)
     if (node)
         PropertiesFrame::Get()->ShowProps(node);
 
-    if (m_TreeCtrl->GetParent(event.GetItem()) == m_TreeCtrl->GetRootItem())
+    if (m_TreeCtrl->GetItemParent(event.GetItem()) == m_TreeCtrl->GetRootItem())
     {
         wxTreeItemId it = event.GetOldItem();
 
         if (it.IsOk() && m_TreeCtrl->GetRootItem() != it)
         {
-            while (m_TreeCtrl->GetParent(it) != m_TreeCtrl->GetRootItem())
-                it = m_TreeCtrl->GetParent(it);
+            while (m_TreeCtrl->GetItemParent(it) != m_TreeCtrl->GetRootItem())
+                it = m_TreeCtrl->GetItemParent(it);
             m_TreeCtrl->Collapse(it);
         }
         RecursivelyExpand(m_TreeCtrl, event.GetItem());
@@ -564,7 +567,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event)
 void EditorFrame::DeleteSelectedNode()
 {
     XmlTreeData *dt = (XmlTreeData*)
-            (m_TreeCtrl->GetItemData(m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
+            (m_TreeCtrl->GetItemData(m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
     wxXmlNode *n = (dt) ? dt->Node : NULL;
 
     m_SelectedNode->GetParent()->RemoveChild(m_SelectedNode);
@@ -580,7 +583,7 @@ void EditorFrame::OnNewNode(wxCommandEvent& event)
     {
         XmlTreeData *pardt = 
             (XmlTreeData*)(m_TreeCtrl->GetItemData(
-                m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
+                m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
 
         if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
         {
@@ -686,7 +689,7 @@ void EditorFrame::OnRightClickTree(wxPoint pos)
 
         XmlTreeData *pardt = 
             (XmlTreeData*)(m_TreeCtrl->GetItemData(
-                m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
+                m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
         if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
         {
             wxXmlNode *nd = pardt->Node;
@@ -751,7 +754,7 @@ void EditorFrame::OnClipboardAction(wxCommandEvent& event)
             {
             XmlTreeData *pardt = 
                 (XmlTreeData*)(m_TreeCtrl->GetItemData(
-                    m_TreeCtrl->GetParent(m_TreeCtrl->GetSelection())));
+                    m_TreeCtrl->GetItemParent(m_TreeCtrl->GetSelection())));
 
             if (pardt && pardt->Node && pardt->Node != m_Resource->GetRoot())
             {