]> git.saurik.com Git - wxWidgets.git/commitdiff
applied an extended version of patch 685795: clean up view [de]activation
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Jul 2003 09:32:35 +0000 (09:32 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Jul 2003 09:32:35 +0000 (09:32 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/docview.h
src/common/docview.cpp

index b5c29be800221a97016315d6a09d2f2c4e5c2a23..ad37b58939c68422676277650aee4692cde9e96e 100644 (file)
@@ -379,7 +379,7 @@ public:
 
     // Views or windows should inform the document manager
     // 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;
 
     wxList& GetDocuments() { return m_docs; }
index 0616423329a77173b1a90ca39ff8d507fefcbf0d..e0720053f1bc77213a6883ba3a7e2b7ba1fac46e 100644 (file)
@@ -568,16 +568,14 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
 
 wxView::wxView()
 {
-    //  SetDocument(doc);
     m_viewDocument = (wxDocument*) NULL;
 
-    m_viewTypeName = wxT("");
     m_viewFrame = (wxFrame *) NULL;
 }
 
 wxView::~wxView()
 {
-//    GetDocumentManager()->ActivateView(this, FALSE, TRUE);
+    GetDocumentManager()->ActivateView(this, FALSE);
     m_viewDocument->RemoveView(this);
 }
 
@@ -586,8 +584,8 @@ bool wxView::ProcessEvent(wxEvent& event)
 {
     if ( !GetDocument() || !GetDocument()->ProcessEvent(event) )
         return wxEvtHandler::ProcessEvent(event);
-    else
-        return TRUE;
+
+    return TRUE;
 }
 
 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
 // when a view is going in or out of focus
-void wxDocManager::ActivateView(wxView *view, bool activate, bool WXUNUSED(deleting))
-{
-    // If we're deactiving, and if we're not actually deleting the view, then
-    // 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;
-        else
+void wxDocManager::ActivateView(wxView *view, bool activate)
+{
+    if ( activate )
+    {
+        m_currentView = view;
+    }
+    else // deactivate
+    {
+        if ( m_currentView == view )
+        {
+            // don't keep stale pointer
             m_currentView = (wxView *) NULL;
+        }
     }
 }