]> git.saurik.com Git - wxWidgets.git/blobdiff - contrib/utils/wxrcedit/pe_basic.cpp
compilation fix
[wxWidgets.git] / contrib / utils / wxrcedit / pe_basic.cpp
index 7bef53dc7aa465c193469bd733e06a4a9a6d3db3..31f9c17bea29d084e0386690826de66c5d80332b 100644 (file)
 #endif
 
 #include "wx/wx.h"
 #endif
 
 #include "wx/wx.h"
-#include "wx/xml/xml.h"
+#include "wx/xrc/xml.h"
 #include "wx/tokenzr.h"
 #include "pe_basic.h"
 #include "xmlhelpr.h"
 #include "editor.h"
 #include "preview.h"
 #include "wx/tokenzr.h"
 #include "pe_basic.h"
 #include "xmlhelpr.h"
 #include "editor.h"
 #include "preview.h"
+#include "nodehnd.h"
 
 
 BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl)
 
 
 BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl)
@@ -40,7 +41,11 @@ wxWindow *PropEditCtrlTxt::CreateEditCtrl()
 
 void PropEditCtrlTxt::OnText(wxCommandEvent& event)
 {
 
 void PropEditCtrlTxt::OnText(wxCommandEvent& event)
 {
-    if (CanSave()) WriteValue();
+    if (CanSave()) 
+    {
+        WriteValue();
+        EditorFrame::Get()->NotifyChanged(CHANGED_PROPS);
+    }
 }
 
 
 }
 
 
@@ -64,7 +69,9 @@ void PropEditCtrlTxt::WriteValue()
 wxWindow *PropEditCtrlInt::CreateEditCtrl()
 {
     PropEditCtrlTxt::CreateEditCtrl();
 wxWindow *PropEditCtrlInt::CreateEditCtrl()
 {
     PropEditCtrlTxt::CreateEditCtrl();
+#if wxUSE_VALIDATORS
     m_TextCtrl->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
     m_TextCtrl->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
+#endif
     return m_TextCtrl;
 }
 
     return m_TextCtrl;
 }
 
@@ -121,7 +128,11 @@ wxString PropEditCtrlBool::GetValueAsText(wxTreeItemId ti)
 
 void PropEditCtrlBool::OnChoice(wxCommandEvent& event)
 {
 
 void PropEditCtrlBool::OnChoice(wxCommandEvent& event)
 {
-    if (CanSave()) WriteValue();
+    if (CanSave()) 
+    {
+        WriteValue();
+        EditorFrame::Get()->NotifyChanged(CHANGED_PROPS);
+    }
 }
 
 
 }
 
 
@@ -158,7 +169,8 @@ class PropEditCtrlCoordXY : public PropEditCtrlInt
             if (m_c[1].IsEmpty()) m_c[1] = _T("-1");
             wxString s;
             s << m_c[0] << _T(',') << m_c[1];
             if (m_c[1].IsEmpty()) m_c[1] = _T("-1");
             wxString s;
             s << m_c[0] << _T(',') << m_c[1];
-            if (m_dlg) s << _T('d');
+            wxString prev = XmlReadValue(GetNode(), m_PropInfo->Name);
+            if (prev[prev.Len()-1] == _T('d')) s << _T('d');
             XmlWriteValue(GetNode(), m_PropInfo->Name, s);
             m_TreeCtrl->SetItemBold(m_TreeCtrl->GetParent(m_TreeItem), TRUE);
         }
             XmlWriteValue(GetNode(), m_PropInfo->Name, s);
             m_TreeCtrl->SetItemBold(m_TreeCtrl->GetParent(m_TreeItem), TRUE);
         }
@@ -191,7 +203,6 @@ class PropEditCtrlCoordXY : public PropEditCtrlInt
     
     protected:
         wxString m_c[2];
     
     protected:
         wxString m_c[2];
-        bool m_dlg;
         int m_which;
 };
 
         int m_which;
 };
 
@@ -205,7 +216,7 @@ class PropEditCtrlCoordDlg : public PropEditCtrlBool
         virtual void ReadValue()
         {
             wxString s = XmlReadValue(GetNode(), m_PropInfo->Name);
         virtual void ReadValue()
         {
             wxString s = XmlReadValue(GetNode(), m_PropInfo->Name);
-            if (s.IsEmpty()) m_Choice->SetSelection(0);
+            if (s.IsEmpty()) m_Choice->SetSelection(1);
             else if (s[s.Length()-1] == _T('d'))
                 m_Choice->SetSelection(1);
             else
             else if (s[s.Length()-1] == _T('d'))
                 m_Choice->SetSelection(1);
             else
@@ -224,7 +235,9 @@ class PropEditCtrlCoordDlg : public PropEditCtrlBool
         {
             PropertyInfo *pi = &(((PETreeData*)m_TreeCtrl->GetItemData(ti))->PropInfo);
             wxString s = XmlReadValue(GetNode(), pi->Name);
         {
             PropertyInfo *pi = &(((PETreeData*)m_TreeCtrl->GetItemData(ti))->PropInfo);
             wxString s = XmlReadValue(GetNode(), pi->Name);
-            if (s.IsEmpty() || s[s.Length()-1] != _T('d'))
+            if (s.IsEmpty())
+                return _("true");
+            else if (s[s.Length()-1] != _T('d'))
                 return _("false");
             else
                 return _("true");
                 return _("false");
             else
                 return _("true");
@@ -348,10 +361,12 @@ wxTreeItemId PropEditCtrlDim::CreateTreeEntry(wxTreeItemId parent, const Propert
 
 // --------------------- PropEditCtrlXMLID -----------------------------
 
 
 // --------------------- PropEditCtrlXMLID -----------------------------
 
+#define REAL_NODE (NodeHandler::Find(GetNode())->GetRealNode(GetNode()))
+
 
 void PropEditCtrlXMLID::ReadValue()
 {
 
 void PropEditCtrlXMLID::ReadValue()
 {
-    m_TextCtrl->SetValue(GetNode()->GetPropVal(_T("name"), wxEmptyString));
+    m_TextCtrl->SetValue(REAL_NODE->GetPropVal(_T("name"), wxEmptyString));
 }
 
 
 }
 
 
@@ -361,8 +376,8 @@ void PropEditCtrlXMLID::WriteValue()
     wxString s =m_TextCtrl->GetValue();
     if (s.IsEmpty()) s = _T("-1");
 
     wxString s =m_TextCtrl->GetValue();
     if (s.IsEmpty()) s = _T("-1");
 
-    GetNode()->DeleteProperty(_T("name"));
-    GetNode()->AddProperty(_T("name"), s);
+    REAL_NODE->DeleteProperty(_T("name"));
+    REAL_NODE->AddProperty(_T("name"), s);
 
     m_TreeCtrl->SetItemBold(m_TreeItem, TRUE);
     EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
 
     m_TreeCtrl->SetItemBold(m_TreeItem, TRUE);
     EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
@@ -373,7 +388,7 @@ void PropEditCtrlXMLID::WriteValue()
 void PropEditCtrlXMLID::Clear()
 {
     EndEdit();
 void PropEditCtrlXMLID::Clear()
 {
     EndEdit();
-    GetNode()->DeleteProperty(_T("name"));
+    REAL_NODE->DeleteProperty(_T("name"));
     m_TreeCtrl->SetItemBold(m_TreeItem, FALSE);
     EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
 }
     m_TreeCtrl->SetItemBold(m_TreeItem, FALSE);
     EditorFrame::Get()->NotifyChanged(CHANGED_TREE_SELECTED);
 }
@@ -410,22 +425,22 @@ void PropEditCtrlXMLID::OnDetails()
     if (!s) return;
     m_TextCtrl->SetValue(s);
     WriteValue();
     if (!s) return;
     m_TextCtrl->SetValue(s);
     WriteValue();
+    EditorFrame::Get()->NotifyChanged(CHANGED_PROPS);    
 }
 
 
 
 wxString PropEditCtrlXMLID::GetValueAsText(wxTreeItemId ti)
 {
 }
 
 
 
 wxString PropEditCtrlXMLID::GetValueAsText(wxTreeItemId ti)
 {
-    return GetNode()->GetPropVal(_T("name"), wxEmptyString);
+    return REAL_NODE->GetPropVal(_T("name"), wxEmptyString);
 }
 
 
 
 bool PropEditCtrlXMLID::IsPresent(const PropertyInfo& pinfo)
 {
 }
 
 
 
 bool PropEditCtrlXMLID::IsPresent(const PropertyInfo& pinfo)
 {
-    return GetNode()->HasProp(_T("name"));
+    return REAL_NODE->HasProp(_T("name"));
 }
 
 }
 
-
-
+#undef REAL_NODE