Pcbnew: fix rotation angle issue in rotate commands.
The value of this rotation was store in 2 places: the config and the editor frame. So after changing the rotation angle from the preferences, the value in editor frames were not updated, and the rotation angle not modified. Now only the config value is used.
This commit is contained in:
parent
3e7e35343a
commit
05c414c816
|
@ -588,6 +588,16 @@ void FOOTPRINT_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
|
||||
EDA_ANGLE FOOTPRINT_EDIT_FRAME::GetRotationAngle() const
|
||||
{
|
||||
FOOTPRINT_EDITOR_SETTINGS* cfg = GetSettings();
|
||||
|
||||
return cfg ? cfg->m_RotationAngle : ANGLE_90;
|
||||
}
|
||||
|
||||
|
||||
|
||||
COLOR_SETTINGS* FOOTPRINT_EDIT_FRAME::GetColorSettings( bool aForceRefresh ) const
|
||||
{
|
||||
wxString currentTheme = GetFootprintEditorSettings()->m_ColorTheme;
|
||||
|
|
|
@ -63,6 +63,11 @@ public:
|
|||
|
||||
FOOTPRINT_EDITOR_SETTINGS* GetSettings();
|
||||
|
||||
/**
|
||||
* Return the angle used for rotate operations.
|
||||
*/
|
||||
EDA_ANGLE GetRotationAngle() const override;
|
||||
|
||||
APP_SETTINGS_BASE* config() const override;
|
||||
|
||||
BOARD_DESIGN_SETTINGS& GetDesignSettings() const override;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2020-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -48,7 +48,6 @@ PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
|||
const wxPoint& aPos, const wxSize& aSize, long aStyle,
|
||||
const wxString& aFrameName ) :
|
||||
PCB_BASE_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
m_rotationAngle( ANGLE_90 ),
|
||||
m_undoRedoBlocked( false ),
|
||||
m_selectionFilterPanel( nullptr ),
|
||||
m_appearancePanel( nullptr )
|
||||
|
@ -159,13 +158,10 @@ bool PCB_BASE_EDIT_FRAME::TryBefore( wxEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void PCB_BASE_EDIT_FRAME::SetRotationAngle( EDA_ANGLE aRotationAngle )
|
||||
EDA_ANGLE PCB_BASE_EDIT_FRAME::GetRotationAngle() const
|
||||
{
|
||||
wxCHECK2_MSG( aRotationAngle > ANGLE_0 && aRotationAngle <= ANGLE_90,
|
||||
aRotationAngle = ANGLE_90,
|
||||
wxT( "Invalid rotation angle, defaulting to 90." ) );
|
||||
|
||||
m_rotationAngle = aRotationAngle;
|
||||
// Return a default angle (90 degrees) used for rotate operations.
|
||||
return ANGLE_90;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -159,12 +159,12 @@ public:
|
|||
/**
|
||||
* Return the angle used for rotate operations.
|
||||
*/
|
||||
EDA_ANGLE GetRotationAngle() const { return m_rotationAngle; }
|
||||
virtual EDA_ANGLE GetRotationAngle() const;
|
||||
|
||||
/**
|
||||
* Set the angle used for rotate operations.
|
||||
*/
|
||||
void SetRotationAngle( EDA_ANGLE aRotationAngle );
|
||||
//void SetRotationAngle( EDA_ANGLE aRotationAngle );
|
||||
|
||||
void ShowTextPropertiesDialog( BOARD_ITEM* aText );
|
||||
void ShowGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
|
||||
|
@ -226,7 +226,6 @@ protected:
|
|||
void unitsChangeRefresh() override;
|
||||
|
||||
protected:
|
||||
EDA_ANGLE m_rotationAngle; // Rotation step (in tenths of a degree)
|
||||
bool m_undoRedoBlocked;
|
||||
|
||||
PANEL_SELECTION_FILTER* m_selectionFilterPanel;
|
||||
|
|
|
@ -193,7 +193,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
|||
// assume dirty
|
||||
m_ZoneFillsDirty = true;
|
||||
|
||||
m_rotationAngle = ANGLE_90;
|
||||
m_aboutTitle = _( "KiCad PCB Editor" );
|
||||
|
||||
// Must be created before the menus are created.
|
||||
|
@ -1054,7 +1053,6 @@ void PCB_EDIT_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
if( cfg )
|
||||
{
|
||||
m_rotationAngle = cfg->m_RotationAngle;
|
||||
m_show_layer_manager_tools = cfg->m_AuiPanels.show_layer_manager;
|
||||
}
|
||||
}
|
||||
|
@ -1069,7 +1067,6 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
|
||||
if( cfg )
|
||||
{
|
||||
cfg->m_RotationAngle = m_rotationAngle;
|
||||
cfg->m_AuiPanels.show_layer_manager = m_show_layer_manager_tools;
|
||||
cfg->m_AuiPanels.right_panel_width = m_appearancePanel->GetSize().x;
|
||||
cfg->m_AuiPanels.appearance_panel_tab = m_appearancePanel->GetTabIndex();
|
||||
|
@ -1077,6 +1074,14 @@ void PCB_EDIT_FRAME::SaveSettings( APP_SETTINGS_BASE* aCfg )
|
|||
}
|
||||
|
||||
|
||||
EDA_ANGLE PCB_EDIT_FRAME::GetRotationAngle() const
|
||||
{
|
||||
PCBNEW_SETTINGS* cfg = dynamic_cast<PCBNEW_SETTINGS*>( config() );
|
||||
|
||||
return cfg ? cfg->m_RotationAngle : ANGLE_90;
|
||||
}
|
||||
|
||||
|
||||
COLOR4D PCB_EDIT_FRAME::GetGridColor()
|
||||
{
|
||||
return GetColorSettings()->GetColor( LAYER_GRID );
|
||||
|
|
|
@ -158,6 +158,11 @@ public:
|
|||
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit = true );
|
||||
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit = true );
|
||||
|
||||
/**
|
||||
* Return the angle used for rotate operations.
|
||||
*/
|
||||
EDA_ANGLE GetRotationAngle() const override;
|
||||
|
||||
/**
|
||||
* @return the color of the grid
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue