Fix processing of events for MRU entries #10 and more in docview.
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 commit is contained in:
@@ -371,6 +371,7 @@ public:
|
||||
void OnFileRevert(wxCommandEvent& event);
|
||||
void OnFileSave(wxCommandEvent& event);
|
||||
void OnFileSaveAs(wxCommandEvent& event);
|
||||
void OnMRUFile(wxCommandEvent& event);
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
void OnPrint(wxCommandEvent& event);
|
||||
void OnPreview(wxCommandEvent& event);
|
||||
@@ -484,6 +485,8 @@ public:
|
||||
|
||||
|
||||
protected:
|
||||
// Open the MRU file with the given index in our associated file history.
|
||||
void DoOpenMRUFile(unsigned n);
|
||||
#if wxUSE_PRINTING_ARCHITECTURE
|
||||
virtual wxPreviewFrame* CreatePreviewFrame(wxPrintPreviewBase* preview,
|
||||
wxWindow *parent,
|
||||
@@ -783,12 +786,6 @@ public:
|
||||
wxDocManager *GetDocumentManager() const { return m_docManager; }
|
||||
|
||||
protected:
|
||||
// Open the MRU file with the given index in our associated file history.
|
||||
//
|
||||
// This is called from the derived class event handler for the MRU menu
|
||||
// items.
|
||||
void DoOpenMRUFile(unsigned n);
|
||||
|
||||
wxDocManager *m_docManager;
|
||||
|
||||
wxDECLARE_NO_COPY_CLASS(wxDocParentFrameAnyBase);
|
||||
@@ -830,8 +827,6 @@ public:
|
||||
|
||||
this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
|
||||
wxCommandEventHandler(wxDocParentFrameAny::OnExit));
|
||||
this->Connect(wxID_FILE1, wxID_FILE9, wxEVT_COMMAND_MENU_SELECTED,
|
||||
wxCommandEventHandler(wxDocParentFrameAny::OnMRUFile));
|
||||
this->Connect(wxEVT_CLOSE_WINDOW,
|
||||
wxCloseEventHandler(wxDocParentFrameAny::OnCloseWindow));
|
||||
|
||||
@@ -854,11 +849,6 @@ private:
|
||||
this->Close();
|
||||
}
|
||||
|
||||
void OnMRUFile(wxCommandEvent& event)
|
||||
{
|
||||
DoOpenMRUFile(event.GetId() - wxID_FILE1);
|
||||
}
|
||||
|
||||
void OnCloseWindow(wxCloseEvent& event)
|
||||
{
|
||||
if ( m_docManager && !m_docManager->Clear(!event.CanVeto()) )
|
||||
|
Reference in New Issue
Block a user