From: Julian Smart Date: Thu, 11 Apr 2002 16:50:55 +0000 (+0000) Subject: Added back the missing Undo/Redo accelerators that unaccountably X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6aa3ea889af9d1da98061a2ddad0550105703b73?ds=inline Added back the missing Undo/Redo accelerators that unaccountably went missing after 2.3.1 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/distrib/msw/zipdistinno.bat b/distrib/msw/zipdistinno.bat index 80e0910203..bb12a1c439 100755 --- a/distrib/msw/zipdistinno.bat +++ b/distrib/msw/zipdistinno.bat @@ -225,7 +225,9 @@ copy %src\bin\tex2rtf.exe bin copy %src\bin\dbgview.* bin copy %src\bin\widgets.exe bin copy %src\bin\widgets.exe.manifest bin -Rem copy %src\demos\life\breeder.lif bin +copy %src\bin\life.exe bin +copy %src\bin\life.exe.manifest bin +copy %src\demos\life\breeder.lif bin copy %src\docs\htmlhelp\dialoged.chm bin copy %src\docs\htmlhelp\tex2rtf.chm bin diff --git a/include/wx/cmdproc.h b/include/wx/cmdproc.h index faa053dc89..3b09e400bd 100644 --- a/include/wx/cmdproc.h +++ b/include/wx/cmdproc.h @@ -87,6 +87,13 @@ public: int GetMaxCommands() const { return m_maxNoCommands; } virtual void ClearCommands(); + // By default, the accelerators are "\tCtrl+Z" and "\tCtrl+Y" + const wxString& GetUndoAccelerator() const { return m_undoAccelerator; } + const wxString& GetRedoAccelerator() const { return m_redoAccelerator; } + + void SetUndoAccelerator(const wxString& accel) { m_undoAccelerator = accel; } + void SetRedoAccelerator(const wxString& accel) { m_redoAccelerator = accel; } + protected: // for further flexibility, command processor doesn't call wxCommand::Do() // and Undo() directly but uses these functions which can be overridden in @@ -102,6 +109,9 @@ protected: wxMenu* m_commandEditMenu; #endif // wxUSE_MENUS + wxString m_undoAccelerator; + wxString m_redoAccelerator; + private: DECLARE_DYNAMIC_CLASS(wxCommandProcessor) }; diff --git a/src/common/cmdproc.cpp b/src/common/cmdproc.cpp index 7466686e7a..afdc6fff29 100644 --- a/src/common/cmdproc.cpp +++ b/src/common/cmdproc.cpp @@ -68,6 +68,8 @@ wxCommandProcessor::wxCommandProcessor(int maxCommands) #if wxUSE_MENUS m_commandEditMenu = (wxMenu *) NULL; #endif // wxUSE_MENUS + m_undoAccelerator = wxT("\tCtrl+Z"); + m_redoAccelerator = wxT("\tCtrl+Y"); } wxCommandProcessor::~wxCommandProcessor() @@ -231,9 +233,9 @@ void wxCommandProcessor::SetMenuStrings() if (commandName == wxT("")) commandName = _("Unnamed command"); bool canUndo = command->CanUndo(); if (canUndo) - buf = wxString(_("&Undo ")) + commandName; + buf = wxString(_("&Undo ")) + commandName + m_undoAccelerator; else - buf = wxString(_("Can't &Undo ")) + commandName; + buf = wxString(_("Can't &Undo ")) + commandName + m_undoAccelerator; m_commandEditMenu->SetLabel(wxID_UNDO, buf); m_commandEditMenu->Enable(wxID_UNDO, canUndo); @@ -244,24 +246,24 @@ void wxCommandProcessor::SetMenuStrings() wxCommand *redoCommand = (wxCommand *)m_currentCommand->Next()->Data(); wxString redoCommandName(redoCommand->GetName()); if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command"); - buf = wxString(_("&Redo ")) + redoCommandName; + buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator; m_commandEditMenu->SetLabel(wxID_REDO, buf); m_commandEditMenu->Enable(wxID_REDO, TRUE); } else { - m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo")); + m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator); m_commandEditMenu->Enable(wxID_REDO, FALSE); } } else { - m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo")); + m_commandEditMenu->SetLabel(wxID_UNDO, _("&Undo") + m_undoAccelerator); m_commandEditMenu->Enable(wxID_UNDO, FALSE); if (m_commands.Number() == 0) { - m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo")); + m_commandEditMenu->SetLabel(wxID_REDO, _("&Redo") + m_redoAccelerator); m_commandEditMenu->Enable(wxID_REDO, FALSE); } else @@ -271,7 +273,7 @@ void wxCommandProcessor::SetMenuStrings() wxCommand *redoCommand = (wxCommand *)m_commands.First()->Data(); wxString redoCommandName(redoCommand->GetName()); if (redoCommandName == wxT("")) redoCommandName = _("Unnamed command"); - buf = wxString(_("&Redo ")) + redoCommandName; + buf = wxString(_("&Redo ")) + redoCommandName + m_redoAccelerator; m_commandEditMenu->SetLabel(wxID_REDO, buf); m_commandEditMenu->Enable(wxID_REDO, TRUE); }