]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
fixes to allow dragging in multiselection tree ctrl (patch 759421)
[wxWidgets.git] / src / common / docview.cpp
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;
+        }
     }
 }