git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@8823
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+
+static void RecursivelyExpand(wxTreeCtrl *t, wxTreeItemId item)
+{
+ t->Expand(item);
+ long cookie;
+ wxTreeItemId id = t->GetFirstChild(item, cookie);
+ while (id.IsOk())
+ {
+ RecursivelyExpand(t, id);
+ id = t->GetNextChild(item, cookie);
+ }
+}
+
bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root)
{
if (root == NULL)
bool EditorFrame::SelectNode(wxXmlNode *node, wxTreeItemId *root)
{
if (root == NULL)
nd = (dt) ? dt->Node : NULL;
if (nd == node)
{
nd = (dt) ? dt->Node : NULL;
if (nd == node)
{
+ RecursivelyExpand(m_TreeCtrl, *root);
m_TreeCtrl->SelectItem(item);
m_TreeCtrl->EnsureVisible(item);
m_TreeCtrl->SelectItem(item);
m_TreeCtrl->EnsureVisible(item);
}
if (m_TreeCtrl->ItemHasChildren(item) && SelectNode(node, &item))
}
if (m_TreeCtrl->ItemHasChildren(item) && SelectNode(node, &item))
item = m_TreeCtrl->GetNextChild(*root, cookie);
}
item = m_TreeCtrl->GetNextChild(*root, cookie);
}
-static void RecursivelyExpand(wxTreeCtrl *t, wxTreeItemId item)
-{
- t->Expand(item);
- long cookie;
- wxTreeItemId id = t->GetFirstChild(item, cookie);
- while (id.IsOk())
- {
- RecursivelyExpand(t, id);
- id = t->GetNextChild(item, cookie);
- }
-}
-
void EditorFrame::OnTreeSel(wxTreeEvent& event)
{
XmlTreeData *dt = (XmlTreeData*)(m_TreeCtrl->GetItemData(event.GetItem()));
void EditorFrame::OnTreeSel(wxTreeEvent& event)
{
XmlTreeData *dt = (XmlTreeData*)(m_TreeCtrl->GetItemData(event.GetItem()));
#include "xmlhelpr.h"
#include "editor.h"
#include "preview.h"
#include "xmlhelpr.h"
#include "editor.h"
#include "preview.h"
BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl)
BEGIN_EVENT_TABLE(PropEditCtrlTxt, PropEditCtrl)
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);
}
protected:
wxString m_c[2];
protected:
wxString m_c[2];
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
{
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");
// --------------------- 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));
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);
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);
}
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"));