The code trying to avoid forwarding duplicate events to wxDocManager was over
eager and in some situations filtered out the events which hadn't been sent to
it yet and were, in fact, not handled at all. This could be seen, for example,
by running the docview sample with "--sdi" command line option, creating one
child frame and then trying to create another one from the parent frame menu:
this failed because the existence of a valid child was considered to be enough
for the event to have been already processed in it which was false in this case.
Unfortunately there is no obvious fix to this problem, notably because of the
very roundabout way the toolbar events are processed in MDI windows: the
toolbar itself is a child of the parent frame but the events from it are still
sent to the currently active child frame by wxMDIParentFrameBase. So we can't
rely on any kind of parent-of-originating-window checks.
Instead, remember the last event handled in the child and avoid processing the
same event in wxDocManager again. This should at least avoid the false
positives (like the one fixed by this commit), although it could still result
in false negatives (i.e. some duplicated events) if an event handler generated
other events while skipping the original one. This is a lesser evil though and
should be relatively rare in practice, so live with this ugliness until
someone comes with another idea of fixing the bug described above.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74919 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This keyword is not expanded by Git which means it's not replaced with the
correct revision value in the releases made using git-based scripts and it's
confusing to have lines with unexpanded "$Id$" in the released files. As
expanding them with Git is not that simple (it could be done with git archive
and export-subst attribute) and there are not many benefits in having them in
the first place, just remove all these lines.
If nothing else, this will make an eventual transition to Git simpler.
Closes#14487.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Ensure that the events are always (provided there is an open document)
processed in the following order:
1. wxDocument
2. wxView
3. wxDocManager
4. wxDocChildFrame
5. wxDocParentFrame
6. wxApp
Do this by forwarding the events from wxDocParentFrame to wxDocChildFrame
first and forward them from there to wxDocManager which -- and this part
remains unchanged -- in turn forwards them to the active wxView which finally
forwards them to wxDocument. This requires another condition in the event
handling code as we still must forward from wxDocParentFrame to wxDocManager
itself if there are no active children at all, but this is the only way to
have the same event order in all cases, whether the event is originally
received by wxDocChildFrame or wxDocParentFrame.
Document this and add a unit test verifying that things indeed work like this.
See #14314.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method tries to find the current view harder than GetCurrentView() and
always returns a non-NULL view if there are any open documents at all.
This is used by wxDocManager internally to find the view to apply the user
commands to and will also be needed in the upcoming changes outside of
wxDocManager, so just make this method public, as it seems that it could be
useful in user code too, especially if we could use some better fallback than
the first opened document (e.g. the last document the user interacted with
would be better).
This also clarifies the confusion between GetCurrentView() and GetActiveView(),
see #13296.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use the same short names as are used by the event table macros for the event
type constants themselves. This makes them much more comfortable to use, e.g.
Bind(wxEVT_BUTTON) compared to Bind(wxEVT_COMMAND_BUTTON_CLICKED).
The old long names are still kept for backwards compatibility and shouldn't be
removed as it doesn't really cost anything to continue providing them, but all
new event types should only use the short versions.
Closes#10661.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73850 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Define GetXXXVector() methods after all the classes are fully declared to
ensure that static_cast<> inside wxList::AsVector() they use compiles with the
OpenVMS compiler.
See #14814.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73048 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add accessors returning more convenient wxVectors to supplement the existing
ones giving access to internally used wxLists.
Closes#14814.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73004 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method can be overridden to customize the previously hard-coded handling
of the case when a file selected from the MRU menu doesn't exist any more: we
used to always remove it from the file history completely. This may, however,
be inappropriate and, in fact, probably never, or very rarely, is the right
thing to do when the file that we failed to open still exists.
So never remove the file from the MRU if we failed to open an existing file
(also don't give an error about it as it should have been already given by
CreateDocument()) and, while we still do it for the non-existent files, allow
to override this behaviour by overriding the new OnMRUFileNotExist() method.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Child documents are virtual documents corresponding to parts of their parent
document which can't be saved nor loaded independently of their parent and are
closed when the parent is closed.
This finally makes some use of wxDocument::m_documentParent field which was
always present in the docview code but never used before.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Applied patch by snowleopard2 fixing a bunch of typos such as misspellings and double words in the documentation. Combined the patch with some local queued typos waiting to be committed as well as adding new typo fixes inspired by the patch.
Function names with American spelling were not changed nor was third-party code touched. The only code changes involve some changes in strings that are translated ("Can not" -> "Cannot").
Closes#13063 (again).
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67280 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
We only handled events for wxID_FILE1..wxID_FILE9 range but there can be more
than 9 entries in the MRU list. Handle events for as many of them as there are
correctly.
This required adding a fallback handler for all menu events and checking if
the id of the menu item is in the MRU range inside it. Also move this to
wxDocManager itself from wxDocParentFrameAnyBase as it's common for all kinds
of frames anyhow.
Closes#12141.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64569 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This appears to be necessary under Mac where views are top level windows and
should do no harm elsewhere.
Also factor out the activation code in a new wxDocManager::ActivateDocument()
method to avoid duplicating it.
Closes#11417.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64440 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Printing of documents from wxDocManager always used default page setup data,
allow the user to configure it now.
Add wxDocManager::m_pageSetupDialogData and add a handler for wxID_PRINT_SETUP
command to it.
Closes#11394.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This method purpose was not quite clear as it was only mentioned in passing in
documentation of OnCloseDocument() but not really documented itself.
Also don't call it from wxDocument dtor as this is useless: the user-defined
overridden version will never be called from here and the base class version
does nothing.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64299 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use the same approach as for the child frames: add a base template class which
allows wxDocParentFrame to inherit from wxFrame and wxDocMDIParentFrame from
wxMDIParentFrame while still allowing to reuse the common code.
This reduces code duplication and should make implementing parent AUI document
frame easier as well, see #8945.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64295 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Use wxEvtHandler::ProcessEventLocally() instead of ProcessEventHere() when
forwarding events in the docview code. This ensures that any event handlers
chained with the objects involved (document manager, document, view) will be
used.
Incidentally the old code didn't work at all as ProcessEventHere() didn't even
call TryBefore() where the (further) forwarding was implemented.
Closes#10640.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64263 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
Add a virtual wxDocManager::CreatePreviewFrame() which can be overridden to
customize the print preview used by docview framework.
Closes#11390.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
wxDocument::Revert() method existed but didn't do anything, provide a
default implementation for it. Also document it and show it in the sample.
Closes#11849.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775