applied an extended version of patch 685795: clean up view [de]activation
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -379,7 +379,7 @@ public:
|
|||||||
|
|
||||||
// Views or windows should inform the document manager
|
// Views or windows should inform the document manager
|
||||||
// when a view is going in or out of focus
|
// when a view is going in or out of focus
|
||||||
virtual void ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
|
virtual void ActivateView(wxView *view, bool activate = TRUE);
|
||||||
virtual wxView *GetCurrentView() const;
|
virtual wxView *GetCurrentView() const;
|
||||||
|
|
||||||
wxList& GetDocuments() { return m_docs; }
|
wxList& GetDocuments() { return m_docs; }
|
||||||
|
@@ -568,16 +568,14 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
|
|||||||
|
|
||||||
wxView::wxView()
|
wxView::wxView()
|
||||||
{
|
{
|
||||||
// SetDocument(doc);
|
|
||||||
m_viewDocument = (wxDocument*) NULL;
|
m_viewDocument = (wxDocument*) NULL;
|
||||||
|
|
||||||
m_viewTypeName = wxT("");
|
|
||||||
m_viewFrame = (wxFrame *) NULL;
|
m_viewFrame = (wxFrame *) NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxView::~wxView()
|
wxView::~wxView()
|
||||||
{
|
{
|
||||||
// GetDocumentManager()->ActivateView(this, FALSE, TRUE);
|
GetDocumentManager()->ActivateView(this, FALSE);
|
||||||
m_viewDocument->RemoveView(this);
|
m_viewDocument->RemoveView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,8 +584,8 @@ bool wxView::ProcessEvent(wxEvent& event)
|
|||||||
{
|
{
|
||||||
if ( !GetDocument() || !GetDocument()->ProcessEvent(event) )
|
if ( !GetDocument() || !GetDocument()->ProcessEvent(event) )
|
||||||
return wxEvtHandler::ProcessEvent(event);
|
return wxEvtHandler::ProcessEvent(event);
|
||||||
else
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxView::OnActivateView(bool WXUNUSED(activate), wxView *WXUNUSED(activeView), wxView *WXUNUSED(deactiveView))
|
void wxView::OnActivateView(bool WXUNUSED(activate), wxView *WXUNUSED(activeView), wxView *WXUNUSED(deactiveView))
|
||||||
@@ -1710,25 +1708,19 @@ void wxDocManager::RemoveDocument(wxDocument *doc)
|
|||||||
|
|
||||||
// Views or windows should inform the document manager
|
// Views or windows should inform the document manager
|
||||||
// when a view is going in or out of focus
|
// when a view is going in or out of focus
|
||||||
void wxDocManager::ActivateView(wxView *view, bool activate, bool WXUNUSED(deleting))
|
void wxDocManager::ActivateView(wxView *view, bool activate)
|
||||||
{
|
{
|
||||||
// If we're deactiving, and if we're not actually deleting the view, then
|
if ( activate )
|
||||||
// don't reset the current view because we may be going to
|
|
||||||
// a window without a view.
|
|
||||||
// WHAT DID I MEAN BY THAT EXACTLY?
|
|
||||||
/*
|
|
||||||
if (deleting)
|
|
||||||
{
|
|
||||||
if (m_currentView == view)
|
|
||||||
m_currentView = NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
if (activate)
|
m_currentView = view;
|
||||||
m_currentView = view;
|
}
|
||||||
else
|
else // deactivate
|
||||||
|
{
|
||||||
|
if ( m_currentView == view )
|
||||||
|
{
|
||||||
|
// don't keep stale pointer
|
||||||
m_currentView = (wxView *) NULL;
|
m_currentView = (wxView *) NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user