Fix initial zoom to fit size in schematic and board editors.
This may affect other EDA_DRAW_FRAME objects as well but it doesn't seem to be as noticeable in the symbol, footprint, and worksheet editors. Fixes https://gitlab.com/kicad/code/kicad/issues/5248
This commit is contained in:
parent
ee5c991d2f
commit
c14065ee98
|
@ -276,6 +276,10 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
|||
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
|
||||
// This is used temporarily to fix a client size issue on GTK that causes zoom to fit
|
||||
// to calculate the wrong zoom size. See SCH_EDIT_FRAME::onSize().
|
||||
Bind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
|
||||
|
||||
if( GetCanvas() )
|
||||
{
|
||||
GetCanvas()->GetGAL()->SetAxesEnabled( false );
|
||||
|
@ -1342,3 +1346,18 @@ SELECTION& SCH_EDIT_FRAME::GetCurrentSelection()
|
|||
{
|
||||
return m_toolManager->GetTool<EE_SELECTION_TOOL>()->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
if( IsShown() )
|
||||
{
|
||||
// We only need this until the frame is done resizing and the final client size is
|
||||
// established.
|
||||
Unbind( wxEVT_SIZE, &SCH_EDIT_FRAME::onSize, this );
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
}
|
||||
|
||||
// Skip() is called in the base class.
|
||||
EDA_DRAW_FRAME::OnSize( aEvent );
|
||||
}
|
||||
|
|
|
@ -154,6 +154,8 @@ protected:
|
|||
*/
|
||||
void sendNetlistToCvpcb();
|
||||
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
|
||||
public:
|
||||
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
~SCH_EDIT_FRAME() override;
|
||||
|
|
|
@ -110,7 +110,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_CHOICE( ID_ON_GRID_SELECT, PCB_EDIT_FRAME::OnSelectGrid )
|
||||
|
||||
EVT_CLOSE( PCB_EDIT_FRAME::OnCloseWindow )
|
||||
EVT_SIZE( PCB_EDIT_FRAME::OnSize )
|
||||
|
||||
EVT_TOOL( ID_MENU_RECOVER_BOARD_AUTOSAVE, PCB_EDIT_FRAME::Files_io )
|
||||
|
||||
|
@ -296,6 +295,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, false );
|
||||
|
||||
// This is used temporarily to fix a client size issue on GTK that causes zoom to fit
|
||||
// to calculate the wrong zoom size. See PCB_EDIT_FRAME::onSize().
|
||||
Bind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
|
||||
|
||||
m_canvasType = LoadCanvasTypeSetting();
|
||||
|
||||
// Nudge user to switch to OpenGL if they are on Cairo
|
||||
|
@ -1624,3 +1627,18 @@ bool PCB_EDIT_FRAME::MicrowaveToolbarShown()
|
|||
{
|
||||
return m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown();
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::onSize( wxSizeEvent& aEvent )
|
||||
{
|
||||
if( IsShown() )
|
||||
{
|
||||
// We only need this until the frame is done resizing and the final client size is
|
||||
// established.
|
||||
Unbind( wxEVT_SIZE, &PCB_EDIT_FRAME::onSize, this );
|
||||
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
|
||||
}
|
||||
|
||||
// Skip() is called in the base class.
|
||||
EDA_DRAW_FRAME::OnSize( aEvent );
|
||||
}
|
||||
|
|
|
@ -243,6 +243,8 @@ protected:
|
|||
// protected so that PCB::IFACE::CreateWindow() is the only factory.
|
||||
PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
|
||||
|
||||
void onSize( wxSizeEvent& aEvent );
|
||||
|
||||
public:
|
||||
PCB_LAYER_BOX_SELECTOR* m_SelLayerBox; // a combo box to display and select active layer
|
||||
wxChoice* m_SelTrackWidthBox; // a choice box to display and select current track width
|
||||
|
|
Loading…
Reference in New Issue