X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d2b354f9c9f1473b2d6ff0ab643ebf57dcbfb656..0425151023593cb31da0ee0a652da173ca9abfde:/src/common/prntbase.cpp?ds=sidebyside diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index ee3ec90dad..8ab4583a89 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -242,34 +242,42 @@ void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event) void wxPreviewCanvas::OnChar(wxKeyEvent &event) { + wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar(); if (event.GetKeyCode() == WXK_ESCAPE) { ((wxPreviewFrame*) GetParent())->Close(TRUE); return; + } + else if (event.GetKeyCode() == WXK_TAB) + { + controlBar->OnGoto(); + return; } - + else if (event.GetKeyCode() == WXK_RETURN) + { + controlBar->OnPrint(); + return; + } + if (!event.ControlDown()) { event.Skip(); return; } - - wxPreviewControlBar* controlBar = ((wxPreviewFrame*) GetParent())->GetControlBar(); - switch(event.GetKeyCode()) - { - case WXK_NEXT: - controlBar->OnNext(); break; - case WXK_PRIOR: - controlBar->OnPrevious(); break; - case WXK_HOME: - controlBar->OnFirst(); break; - case WXK_END: - controlBar->OnLast(); break; - case WXK_TAB: - controlBar->OnGoto(); break; - default: - event.Skip(); - } + + switch(event.GetKeyCode()) + { + case WXK_NEXT: + controlBar->OnNext(); break; + case WXK_PRIOR: + controlBar->OnPrevious(); break; + case WXK_HOME: + controlBar->OnFirst(); break; + case WXK_END: + controlBar->OnLast(); break; + default: + event.Skip(); + } } /* @@ -278,7 +286,7 @@ void wxPreviewCanvas::OnChar(wxKeyEvent &event) BEGIN_EVENT_TABLE(wxPreviewControlBar, wxPanel) EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnWindowClose) - EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint) + EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrintButton) EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPreviousButton) EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNextButton) EVT_BUTTON(wxID_PREVIEW_FIRST, wxPreviewControlBar::OnFirstButton) @@ -323,7 +331,7 @@ void wxPreviewControlBar::OnWindowClose(wxCommandEvent& WXUNUSED(event)) frame->Close(TRUE); } -void wxPreviewControlBar::OnPrint(wxCommandEvent& WXUNUSED(event)) +void wxPreviewControlBar::OnPrint(void) { wxPrintPreviewBase *preview = GetPrintPreview(); preview->Print(TRUE); @@ -737,8 +745,8 @@ void wxPrintPreviewBase::AdjustScrollbars(wxPreviewCanvas *canvas) double actualHeight = (zoomScale*m_pageHeight*m_previewScale); // Set the scrollbars appropriately - int totalWidth = actualWidth + 2*m_leftMargin; - int totalHeight = actualHeight + 2*m_topMargin; + int totalWidth = (int)(actualWidth + 2*m_leftMargin); + int totalHeight = (int)(actualHeight + 2*m_topMargin); int scrollUnitsX = totalWidth/10; int scrollUnitsY = totalHeight/10; wxSize virtualSize = canvas->GetVirtualSize();