]> git.saurik.com Git - wxWidgets.git/commitdiff
Added back the missing Undo/Redo accelerators that unaccountably
authorJulian Smart <julian@anthemion.co.uk>
Thu, 11 Apr 2002 16:50:55 +0000 (16:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 11 Apr 2002 16:50:55 +0000 (16:50 +0000)
went missing after 2.3.1

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15096 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

distrib/msw/zipdistinno.bat
include/wx/cmdproc.h
src/common/cmdproc.cpp

index 80e0910203720c3b8a6ecdced0eb82f29b4c462b..bb12a1c4392577b777096ca2d7cb6352f54215bc 100755 (executable)
@@ -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
 
index faa053dc8974514b23f13cf249825f69e787e324..3b09e400bdcaa6f78dce111524730d9aea84d652 100644 (file)
@@ -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)
 };
index 7466686e7a5c848ea292f1c7efcaf7d3b74c7c8f..afdc6fff29acf7ef07a2e56433f60513c0b99888 100644 (file)
@@ -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);
             }