]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
wxMessageBox off the main thread lost result code.
[wxWidgets.git] / src / common / docview.cpp
index b1d2971fcbf167f89edfbda2d9047306441d8952..b646d9efe21b1a88b6b21df89d8e432b384906c2 100644 (file)
@@ -4,7 +4,6 @@
 // Author:      Julian Smart
 // Modified by: Vadim Zeitlin
 // Created:     01/02/97
-// RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
@@ -1512,7 +1511,6 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags)
         return NULL;
 
     docNew->SetDocumentName(temp->GetDocumentName());
-    docNew->SetDocumentTemplate(temp);
 
     wxTRY
     {
@@ -2029,11 +2027,16 @@ bool wxDocChildFrameAnyBase::TryProcessEvent(wxEvent& event)
         return false;
     }
 
+    // Store a (non-owning) pointer to the last processed event here to be able
+    // to recognize this event again if it bubbles up to the parent frame, see
+    // the code in wxDocParentFrameAnyBase::TryProcessEvent().
+    m_lastEvent = &event;
+
     // Forward the event to the document manager which will, in turn, forward
     // it to its active view which must be our m_childView.
     //
     // Notice that we do things in this roundabout way to guarantee the correct
-    // event handlers call order: first the document, then the new and then the
+    // event handlers call order: first the document, then the view and then the
     // document manager itself. And if we forwarded the event directly to the
     // view, then the document manager would do it once again when we forwarded
     // it to it.
@@ -2081,28 +2084,13 @@ bool wxDocParentFrameAnyBase::TryProcessEvent(wxEvent& event)
     // already forwarded the event to wxDocManager, check for this:
     if ( wxView* const view = m_docManager->GetAnyUsableView() )
     {
-        wxWindow* win = view->GetFrame();
-        if ( win && win != m_frame )
-        {
-            // Notice that we intentionally don't use wxGetTopLevelParent()
-            // here because we want to check both for the case of a child
-            // "frame" (e.g. MDI child frame or notebook page) inside this TLW
-            // and a separate child TLW frame (as used in the SDI mode) here.
-            for ( win = win->GetParent(); win; win = win->GetParent() )
-            {
-                if ( win == m_frame )
-                    return false;
-            }
-        }
-        //else: This view is directly associated with the parent frame (which
-        //      can happen in the so called "single" mode in which only one
-        //      document can be opened and so is managed by the parent frame
-        //      itself), there can be no child frame in play so we must forward
-        //      the event to wxDocManager ourselves.
+        wxDocChildFrameAnyBase* const childFrame = view->GetDocChildFrame();
+        if ( childFrame && childFrame->HasAlreadyProcessed(event) )
+            return false;
     }
 
     // But forward the event to wxDocManager ourselves if there are no views at
-    // all or if we are the frame's view ourselves.
+    // all or if this event hadn't been sent to the child frame previously.
     return m_docManager->ProcessEventLocally(event);
 }