Fixed bug [ 749471 ] wxDocument with no command processor
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -964,22 +964,26 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
|
|||||||
#endif // wxUSE_PRINTING_ARCHITECTURE
|
#endif // wxUSE_PRINTING_ARCHITECTURE
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDocManager::OnUndo(wxCommandEvent& WXUNUSED(event))
|
void wxDocManager::OnUndo(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxDocument *doc = GetCurrentDocument();
|
wxDocument *doc = GetCurrentDocument();
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return;
|
return;
|
||||||
if (doc->GetCommandProcessor())
|
if (doc->GetCommandProcessor())
|
||||||
doc->GetCommandProcessor()->Undo();
|
doc->GetCommandProcessor()->Undo();
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDocManager::OnRedo(wxCommandEvent& WXUNUSED(event))
|
void wxDocManager::OnRedo(wxCommandEvent& event)
|
||||||
{
|
{
|
||||||
wxDocument *doc = GetCurrentDocument();
|
wxDocument *doc = GetCurrentDocument();
|
||||||
if (!doc)
|
if (!doc)
|
||||||
return;
|
return;
|
||||||
if (doc->GetCommandProcessor())
|
if (doc->GetCommandProcessor())
|
||||||
doc->GetCommandProcessor()->Redo();
|
doc->GetCommandProcessor()->Redo();
|
||||||
|
else
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handlers for UI update commands
|
// Handlers for UI update commands
|
||||||
@@ -1021,18 +1025,30 @@ void wxDocManager::OnUpdateFileSaveAs(wxUpdateUIEvent& event)
|
|||||||
void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event)
|
void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
wxDocument *doc = GetCurrentDocument();
|
wxDocument *doc = GetCurrentDocument();
|
||||||
event.Enable( (doc && doc->GetCommandProcessor() && doc->GetCommandProcessor()->CanUndo()) );
|
if (!doc)
|
||||||
if (doc && doc->GetCommandProcessor())
|
event.Enable(FALSE);
|
||||||
|
else if (!doc->GetCommandProcessor())
|
||||||
|
event.Skip();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Enable( doc->GetCommandProcessor()->CanUndo() );
|
||||||
doc->GetCommandProcessor()->SetMenuStrings();
|
doc->GetCommandProcessor()->SetMenuStrings();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxDocManager::OnUpdateRedo(wxUpdateUIEvent& event)
|
void wxDocManager::OnUpdateRedo(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
wxDocument *doc = GetCurrentDocument();
|
wxDocument *doc = GetCurrentDocument();
|
||||||
event.Enable( (doc && doc->GetCommandProcessor() && doc->GetCommandProcessor()->CanRedo()) );
|
if (!doc)
|
||||||
if (doc && doc->GetCommandProcessor())
|
event.Enable(FALSE);
|
||||||
|
else if (!doc->GetCommandProcessor())
|
||||||
|
event.Skip();
|
||||||
|
else
|
||||||
|
{
|
||||||
|
event.Enable( doc->GetCommandProcessor()->CanRedo() );
|
||||||
doc->GetCommandProcessor()->SetMenuStrings();
|
doc->GetCommandProcessor()->SetMenuStrings();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void wxDocManager::OnUpdatePrint(wxUpdateUIEvent& event)
|
void wxDocManager::OnUpdatePrint(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user