diff --git a/common/dialogs/panel_image_editor.cpp b/common/dialogs/panel_image_editor.cpp index 472dc58600..1195689d9f 100644 --- a/common/dialogs/panel_image_editor.cpp +++ b/common/dialogs/panel_image_editor.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2018 jean-pierre.charras - * Copyright (C) 2011-2020 Kicad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2011-2023 Kicad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -110,12 +110,19 @@ bool PANEL_IMAGE_EDITOR::TransferDataFromWindow() void PANEL_IMAGE_EDITOR::OnRedrawPanel( wxPaintEvent& event ) { wxPaintDC dc( m_panelDraw ); - wxSize size = m_panelDraw->GetClientSize(); - dc.SetDeviceOrigin( size.x / 2, size.y / 2 ); + wxSize display_size = m_panelDraw->GetClientSize(); - double scale = 1.0 / m_workingImage->GetScalingFactor(); - dc.SetUserScale( scale, scale ); - m_workingImage->DrawBitmap( &dc, wxPoint( 0, 0 ) ); + double img_scale = 1.0 / m_workingImage->GetScalingFactor(); + VECTOR2I img_size_pixels = m_workingImage->GetSizePixels(); + + // Adjust the display scale to use the full available display area + double scale_X = (double)display_size.x/img_size_pixels.x; + double scale_Y = (double)display_size.y/img_size_pixels.y; + + double display_scale = img_scale * std::min( scale_X, scale_Y ); + + dc.SetUserScale( display_scale, display_scale ); + m_workingImage->DrawBitmap( &dc, VECTOR2I( m_workingImage->GetSize()/2 ) ); } diff --git a/common/dialogs/panel_image_editor_base.cpp b/common/dialogs/panel_image_editor_base.cpp index 2c48575358..812a2eb763 100644 --- a/common/dialogs/panel_image_editor_base.cpp +++ b/common/dialogs/panel_image_editor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/common/dialogs/panel_image_editor_base.fbp b/common/dialogs/panel_image_editor_base.fbp new file mode 100644 index 0000000000..223d4aec90 --- /dev/null +++ b/common/dialogs/panel_image_editor_base.fbp @@ -0,0 +1,368 @@ + + + + + + C++ + 1 + source_name + 0 + 0 + res + UTF-8 + connect + panel_image_editor_base + 1000 + none + + + 1 + panel_image_editor_base + + . + + 1 + 1 + 1 + 1 + UI + 0 + 0 + 0 + + 0 + wxAUI_MGR_DEFAULT + + + 1 + 0 + 1 + impl_virtual + + + 0 + wxID_ANY + + + PANEL_IMAGE_EDITOR_BASE + + 500,300 + ; ; forward_declare + + 0 + + + wxTAB_TRAVERSAL + + + bSizerMain + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bUpperSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bSizerLeft + wxHORIZONTAL + none + + 5 + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + 256,256 + 1 + m_panelDraw + 1 + + + protected + 1 + + Resizable + 1 + + + 0 + + + + wxFULL_REPAINT_ON_RESIZE|wxTAB_TRAVERSAL|wxBORDER_SIMPLE + OnRedrawPanel + + + + 5 + wxEXPAND|wxALL + 0 + + + bSizerRight + wxVERTICAL + none + + 5 + wxEXPAND|wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + 0 + + + + + 1 + 0 + 1 + + 1 + + 0 + 0 + + Dock + 0 + Left + 0 + 1 + + 1 + + + 0 + 0 + wxID_ANY + Grey + + 0 + + 0 + + + 0 + + 1 + m_buttonGrey + 1 + + + protected + 1 + + + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + OnGreyScaleConvert + + + + 10 + wxEXPAND|wxTOP|wxBOTTOM + 0 + + 0 + protected + 0 + + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + Image Scale: + 0 + + 0 + + + 0 + + 1 + m_staticTextScale + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 0 + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + 0 + + 0 + + 1 + m_textCtrlScale + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + diff --git a/common/dialogs/panel_image_editor_base.h b/common/dialogs/panel_image_editor_base.h index 7c4bcc9882..827e4c935d 100644 --- a/common/dialogs/panel_image_editor_base.h +++ b/common/dialogs/panel_image_editor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-133-g388db8e4) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! diff --git a/eeschema/dialogs/dialog_image_properties_base.cpp b/eeschema/dialogs/dialog_image_properties_base.cpp index ca106077e3..163c1760e5 100644 --- a/eeschema/dialogs/dialog_image_properties_base.cpp +++ b/eeschema/dialogs/dialog_image_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -79,7 +79,6 @@ DIALOG_IMAGE_PROPERTIES_BASE::DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wx this->SetSizer( m_GeneralBoxSizer ); this->Layout(); - m_GeneralBoxSizer->Fit( this ); this->Centre( wxBOTH ); } diff --git a/eeschema/dialogs/dialog_image_properties_base.fbp b/eeschema/dialogs/dialog_image_properties_base.fbp index 12aac7b0b3..ea64d374bc 100644 --- a/eeschema/dialogs/dialog_image_properties_base.fbp +++ b/eeschema/dialogs/dialog_image_properties_base.fbp @@ -36,6 +36,7 @@ wxBOTH 1 + 0 1 impl_virtual @@ -47,8 +48,8 @@ DIALOG_IMAGE_PROPERTIES_BASE - - wxDEFAULT_DIALOG_STYLE + 363,281 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h; forward_declare @@ -87,6 +88,7 @@ Dock 0 Left + 0 1 1 @@ -143,6 +145,7 @@ Dock 0 Left + 0 1 1 @@ -231,6 +234,7 @@ Dock 0 Left + 0 1 1 @@ -292,6 +296,7 @@ Dock 0 Left + 0 1 1 @@ -356,6 +361,7 @@ Dock 0 Left + 0 1 1 @@ -417,6 +423,7 @@ Dock 0 Left + 0 1 1 @@ -478,6 +485,7 @@ Dock 0 Left + 0 1 1 @@ -542,6 +550,7 @@ Dock 0 Left + 0 1 1 diff --git a/eeschema/dialogs/dialog_image_properties_base.h b/eeschema/dialogs/dialog_image_properties_base.h index 999c46ec22..96c1a0b12a 100644 --- a/eeschema/dialogs/dialog_image_properties_base.h +++ b/eeschema/dialogs/dialog_image_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) +// C++ code generated with wxFormBuilder (version 3.10.1-282-g1fa54006) // http://www.wxformbuilder.org/ // // PLEASE DO *NOT* EDIT THIS FILE! @@ -52,7 +52,7 @@ class DIALOG_IMAGE_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE ); + DIALOG_IMAGE_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 363,281 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_IMAGE_PROPERTIES_BASE();