X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e066e2566a4e5db3510fe6a204d66850eaeceade..f0ce3409421a7c5c800a2255295274187220e8de:/contrib/utils/wxrcedit/preview.cpp diff --git a/contrib/utils/wxrcedit/preview.cpp b/contrib/utils/wxrcedit/preview.cpp index 82729ec307..b1085bee8a 100644 --- a/contrib/utils/wxrcedit/preview.cpp +++ b/contrib/utils/wxrcedit/preview.cpp @@ -61,8 +61,11 @@ PreviewFrame *PreviewFrame::Get() } PreviewFrame::PreviewFrame() - : wxFrame(NULL, -1, _("Preview")) + : wxFrame(EditorFrame::Get(), -1, _("Preview"), + wxDefaultPosition, wxDefaultSize, + wxDEFAULT_FRAME_STYLE | wxFRAME_NO_TASKBAR | wxFRAME_TOOL_WINDOW) { + m_Dirty = FALSE; ms_Instance = this; m_Node = NULL; @@ -88,6 +91,8 @@ PreviewFrame::PreviewFrame() m_Splitter->SplitHorizontally(m_ScrollWin, m_LogCtrl, cfg->Read(_T("previewframe_sash"), 300)); CreateStatusBar(); + + SetSize(GetSize()); // refresh: MSW needs it } @@ -109,6 +114,18 @@ PreviewFrame::~PreviewFrame() +void PreviewFrame::MakeDirty() +{ + if (m_Node == NULL) return; + if (m_Dirty) return; + m_Dirty = TRUE; + m_LogCtrl->Clear(); + m_LogCtrl->SetValue(_("Resource modified.\n" + "Move mouse cursor over the preview window to refresh it.")); +} + + + void PreviewFrame::Preview(wxXmlNode *node) { while (node->GetParent()->GetParent() != NULL) node = node->GetParent(); @@ -152,6 +169,8 @@ void PreviewFrame::Preview(wxXmlNode *node) wxSetWorkingDirectory(oldcwd); wxLog::SetActiveTarget(oldlog); + + m_Dirty = FALSE; } @@ -193,3 +212,14 @@ void PreviewFrame::PreviewPanel() 0, 0, TRUE); } } + + + +BEGIN_EVENT_TABLE(PreviewFrame, wxFrame) + EVT_ENTER_WINDOW(PreviewFrame::OnMouseEnter) +END_EVENT_TABLE() + +void PreviewFrame::OnMouseEnter(wxMouseEvent& event) +{ + if (m_Dirty) Preview(m_Node); +}