fixed previewing in wxrcedit
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17374 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -494,8 +494,7 @@ void EditorFrame::OnTreeSel(wxTreeEvent& event)
|
|||||||
}
|
}
|
||||||
RecursivelyExpand(m_TreeCtrl, event.GetItem());
|
RecursivelyExpand(m_TreeCtrl, event.GetItem());
|
||||||
|
|
||||||
PreviewFrame::Get()->Preview(node,m_Resource->GetRoot()->GetPropVal(
|
PreviewFrame::Get()->Preview(node,m_Resource);
|
||||||
wxT("version"), wxT("0.0.0.0")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -509,8 +508,7 @@ void EditorFrame::OnToolbar(wxCommandEvent& event)
|
|||||||
{
|
{
|
||||||
XmlTreeData* dt = (XmlTreeData*)m_TreeCtrl->GetItemData(m_TreeCtrl->GetSelection());;
|
XmlTreeData* dt = (XmlTreeData*)m_TreeCtrl->GetItemData(m_TreeCtrl->GetSelection());;
|
||||||
if (dt != NULL && dt->Node != NULL)
|
if (dt != NULL && dt->Node != NULL)
|
||||||
PreviewFrame::Get()->Preview(dt->Node,m_Resource->GetRoot()->GetPropVal(
|
PreviewFrame::Get()->Preview(dt->Node, m_Resource);
|
||||||
wxT("version"), wxT("0.0.0.0")));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -140,8 +140,10 @@ void PreviewFrame::MakeDirty()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PreviewFrame::Preview(wxXmlNode *node,const wxString &version)
|
void PreviewFrame::Preview(wxXmlNode *node, wxXmlDocument *orig_doc)
|
||||||
{
|
{
|
||||||
|
wxString version = orig_doc->GetRoot()->GetPropVal(wxT("version"), wxT("0.0.0.0"));
|
||||||
|
|
||||||
while (node->GetParent()->GetParent() != NULL) node = node->GetParent();
|
while (node->GetParent()->GetParent() != NULL) node = node->GetParent();
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -150,6 +152,7 @@ void PreviewFrame::Preview(wxXmlNode *node,const wxString &version)
|
|||||||
root->AddProperty(new wxXmlProperty(wxT("version"),version,NULL));
|
root->AddProperty(new wxXmlProperty(wxT("version"),version,NULL));
|
||||||
doc.SetRoot(root);
|
doc.SetRoot(root);
|
||||||
doc.GetRoot()->AddChild(new wxXmlNode(*node));
|
doc.GetRoot()->AddChild(new wxXmlNode(*node));
|
||||||
|
doc.SetFileEncoding(orig_doc->GetFileEncoding());
|
||||||
|
|
||||||
if (XmlGetClass(doc.GetRoot()->GetChildren()) == _T("wxDialog"))
|
if (XmlGetClass(doc.GetRoot()->GetChildren()) == _T("wxDialog"))
|
||||||
XmlSetClass(doc.GetRoot()->GetChildren(), _T("wxPanel"));
|
XmlSetClass(doc.GetRoot()->GetChildren(), _T("wxPanel"));
|
||||||
@@ -168,7 +171,7 @@ void PreviewFrame::Preview(wxXmlNode *node,const wxString &version)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_Node = node;
|
m_Node = node;
|
||||||
m_Version = version;
|
m_Doc = orig_doc;
|
||||||
|
|
||||||
m_LogCtrl->Clear();
|
m_LogCtrl->Clear();
|
||||||
wxLogTextCtrl mylog(m_LogCtrl);
|
wxLogTextCtrl mylog(m_LogCtrl);
|
||||||
@@ -237,5 +240,5 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void PreviewFrame::OnMouseEnter(wxMouseEvent& event)
|
void PreviewFrame::OnMouseEnter(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
if (m_Dirty) Preview(m_Node,m_Version);
|
if (m_Dirty) Preview(m_Node,m_Doc);
|
||||||
}
|
}
|
||||||
|
@@ -31,7 +31,7 @@ class PreviewFrame : public wxFrame
|
|||||||
PreviewFrame();
|
PreviewFrame();
|
||||||
~PreviewFrame();
|
~PreviewFrame();
|
||||||
|
|
||||||
void Preview(wxXmlNode *node,const wxString &version);
|
void Preview(wxXmlNode *node,wxXmlDocument *doc);
|
||||||
void MakeDirty();
|
void MakeDirty();
|
||||||
// current node updated, needs preview refresh
|
// current node updated, needs preview refresh
|
||||||
// (will be done once mouse enters preview win)
|
// (will be done once mouse enters preview win)
|
||||||
@@ -47,7 +47,7 @@ class PreviewFrame : public wxFrame
|
|||||||
private:
|
private:
|
||||||
static PreviewFrame *ms_Instance;
|
static PreviewFrame *ms_Instance;
|
||||||
wxXmlNode *m_Node;
|
wxXmlNode *m_Node;
|
||||||
wxString m_Version;
|
wxXmlDocument *m_Doc;
|
||||||
wxScrolledWindow *m_ScrollWin;
|
wxScrolledWindow *m_ScrollWin;
|
||||||
wxTextCtrl *m_LogCtrl;
|
wxTextCtrl *m_LogCtrl;
|
||||||
wxSplitterWindow *m_Splitter;
|
wxSplitterWindow *m_Splitter;
|
||||||
|
Reference in New Issue
Block a user