From aa36e15d66dbe49bbbde2bb05b81f10ff8004fab Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 17 Oct 2022 10:49:28 +0200 Subject: [PATCH] Eeschema, Print preview: fix a incorrect initial size on wx 3.1.7 (and later) Due to internal changes in wxWidgets, the initial size of the frame was not taken in account. --- eeschema/dialogs/dialog_print_using_printer.cpp | 13 +++++++------ .../dialogs/dialog_print_using_printer_base.fbp | 6 +++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 25bed9e5f8..f95f973863 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -285,12 +285,6 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) preview->SetZoom( 100 ); SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title ); - frame->SetMinSize( wxSize( 550, 350 ) ); - - // on first invocation in this runtime session, set to 2/3 size of my parent, - // but will be changed in Show() if not first time as will position. - frame->SetSize( (m_parent->GetSize() * 2) / 3 ); - frame->Center(); // On wxGTK, set the flag wxTOPLEVEL_EX_DIALOG is mandatory, if we want // close the frame using the X box in caption, when the preview frame is run @@ -305,6 +299,13 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event ) // Reenabling all top level frames should be made by the parent dialog. frame->InitializeWithModality( wxPreviewFrame_WindowModal ); + // on first invocation in this runtime session, set to 3/4 size of parent, + // but will be changed in Show() if not first time as will position. + // Must be called after InitializeWithModality because otherwise in some wxWidget + // versions it is not always taken in account + frame->SetMinSize( wxSize( 650, 500 ) ); + frame->SetSize( (m_parent->GetSize() * 3) / 4 ); + frame->Raise(); // Needed on Ubuntu/Unity to display the frame frame->Show( true ); } diff --git a/eeschema/dialogs/dialog_print_using_printer_base.fbp b/eeschema/dialogs/dialog_print_using_printer_base.fbp index 805426ca19..6d2cefbd37 100644 --- a/eeschema/dialogs/dialog_print_using_printer_base.fbp +++ b/eeschema/dialogs/dialog_print_using_printer_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -14,6 +14,7 @@ dialog_print_using_printer_base 1000 none + 1 dialog_print_schematic @@ -25,6 +26,7 @@ 1 1 UI + 0 1 0 @@ -50,6 +52,7 @@ DIALOG_SHIM; dialog_shim.h Print + 0 @@ -483,6 +486,7 @@ + 0