Use reasonable size for wxPreviewFrame by default

Give a reasonable default size to wxPreviewCanvas and fit wxPreviewFrame
to its contents.

Remove the useless call to Fit() from SizerWithButtons: the size set
inside it was just ignored anyhow.

This also allows to stop hardcoding the size in the sample, so don't do
this any more.

See #22439.
This commit is contained in:
Vadim Zeitlin
2022-05-19 17:57:03 +02:00
parent 93a6784c5f
commit f0de5a93f8
2 changed files with 7 additions and 5 deletions

View File

@@ -390,8 +390,7 @@ void MyFrame::OnPrintPreview(wxCommandEvent& WXUNUSED(event))
return;
}
wxPreviewFrame *frame =
new wxPreviewFrame(preview, this, "Demo Print Preview", wxDefaultPosition, FromDIP(wxSize(600, 700)));
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview");
frame->Centre(wxBOTH);
frame->InitializeWithModality(m_previewModality);
frame->Show();
@@ -425,8 +424,7 @@ void MyFrame::OnPrintPreviewPS(wxCommandEvent& WXUNUSED(event))
// Pass two printout objects: for preview, and possible printing.
wxPrintDialogData printDialogData(* g_printData);
wxPrintPreview *preview = new wxPrintPreview(new MyPrintout(this), new MyPrintout(this), &printDialogData);
wxPreviewFrame *frame =
new wxPreviewFrame(preview, this, "Demo Print Preview", wxDefaultPosition, FromDIP(wxSize(600, 700)));
wxPreviewFrame *frame = new wxPreviewFrame(preview, this, "Demo Print Preview");
frame->Centre(wxBOTH);
frame->Initialize();
frame->Show();