Fix regression in user grid size.
Frame, dialog and config file couldn't agree on whether to use internal units or not. Frame now stores internal units, and they're now mapped on the way in/out of the config file. Dialog was already assuming they were stored in internal units (though they were previuosly not). Fixes: lp:1751435 * https://bugs.launchpad.net/kicad/+bug/1751435
This commit is contained in:
parent
3a73e775de
commit
821a411ac0
|
@ -68,7 +68,7 @@ class PCB_BASE_FRAME : public EDA_DRAW_FRAME
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PCB_DISPLAY_OPTIONS m_DisplayOptions;
|
PCB_DISPLAY_OPTIONS m_DisplayOptions;
|
||||||
wxRealPoint m_UserGridSize;
|
wxPoint m_UserGridSize;
|
||||||
|
|
||||||
int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
int m_FastGrid1; // 1st fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
||||||
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
int m_FastGrid2; // 2nd fast grid setting (index in EDA_DRAW_FRAME::m_gridSelectBox)
|
||||||
|
|
|
@ -72,8 +72,8 @@ private:
|
||||||
FinishDialogSettings();
|
FinishDialogSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setGridSize( const wxRealPoint& grid );
|
void setGridSize( const wxPoint& grid );
|
||||||
bool getGridSize( wxRealPoint& aGrisSize );
|
bool getGridSize( wxPoint& aGrisSize );
|
||||||
|
|
||||||
void setGridOrigin( const wxPoint& grid );
|
void setGridOrigin( const wxPoint& grid );
|
||||||
bool getGridOrigin( wxPoint& aGridOrigin );
|
bool getGridOrigin( wxPoint& aGridOrigin );
|
||||||
|
@ -112,7 +112,7 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRealPoint gridSize;
|
wxPoint gridSize;
|
||||||
|
|
||||||
if( !getGridSize( gridSize ) )
|
if( !getGridSize( gridSize ) )
|
||||||
{
|
{
|
||||||
|
@ -137,7 +137,7 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
|
||||||
|
|
||||||
// User grid
|
// User grid
|
||||||
BASE_SCREEN* screen = m_parent->GetScreen();
|
BASE_SCREEN* screen = m_parent->GetScreen();
|
||||||
screen->AddGrid( gridSize, g_UserUnit, ID_POPUP_GRID_USER );
|
screen->AddGrid( gridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
|
||||||
|
|
||||||
// If the user grid is the current option, recall SetGrid()
|
// If the user grid is the current option, recall SetGrid()
|
||||||
// to force new values put in list as current grid value
|
// to force new values put in list as current grid value
|
||||||
|
@ -171,7 +171,7 @@ bool DIALOG_SET_GRID::TransferDataToWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_SET_GRID::setGridSize( const wxRealPoint& grid )
|
void DIALOG_SET_GRID::setGridSize( const wxPoint& grid )
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ void DIALOG_SET_GRID::setGridSize( const wxRealPoint& grid )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGridSize )
|
bool DIALOG_SET_GRID::getGridSize( wxPoint& aGridSize )
|
||||||
{
|
{
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
|
@ -198,8 +198,6 @@ bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGridSize )
|
||||||
if( x < MIN_GRID_SIZE || x > MAX_GRID_SIZE )
|
if( x < MIN_GRID_SIZE || x > MAX_GRID_SIZE )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
aGridSize.x = x;
|
|
||||||
|
|
||||||
const wxString& y_str = m_OptGridSizeY->GetValue();
|
const wxString& y_str = m_OptGridSizeY->GetValue();
|
||||||
|
|
||||||
if( !y_str.ToDouble( &y ) )
|
if( !y_str.ToDouble( &y ) )
|
||||||
|
@ -211,7 +209,8 @@ bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGridSize )
|
||||||
if( y < MIN_GRID_SIZE || y > MAX_GRID_SIZE )
|
if( y < MIN_GRID_SIZE || y > MAX_GRID_SIZE )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
aGridSize.y = y;
|
aGridSize.x = KiROUND( x );
|
||||||
|
aGridSize.y = KiROUND( y );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,7 +278,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
|
||||||
GetScreen()->SetCurItem( NULL );
|
GetScreen()->SetCurItem( NULL );
|
||||||
|
|
||||||
GetScreen()->AddGrid( m_UserGridSize, g_UserUnit, ID_POPUP_GRID_USER );
|
GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
|
||||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||||
|
|
||||||
// In modedit, set the default paper size to A4:
|
// In modedit, set the default paper size to A4:
|
||||||
|
|
|
@ -109,7 +109,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
||||||
{
|
{
|
||||||
m_Pcb = NULL;
|
m_Pcb = NULL;
|
||||||
|
|
||||||
m_UserGridSize = wxRealPoint( 100.0, 100.0 );
|
m_UserGridSize = wxPoint( 10 * IU_PER_MILS, 10 * IU_PER_MILS );
|
||||||
m_Collector = new GENERAL_COLLECTOR();
|
m_Collector = new GENERAL_COLLECTOR();
|
||||||
|
|
||||||
m_FastGrid1 = 0;
|
m_FastGrid1 = 0;
|
||||||
|
@ -840,8 +840,15 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
wxString baseCfgName = GetName();
|
wxString baseCfgName = GetName();
|
||||||
|
|
||||||
aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
|
EDA_UNITS_T userGridUnits;
|
||||||
aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
|
aCfg->Read( baseCfgName + UserGridUnitsEntry, ( int* )&userGridUnits, ( int )INCHES );
|
||||||
|
|
||||||
|
double tmp;
|
||||||
|
aCfg->Read( baseCfgName + UserGridSizeXEntry, &tmp, 0.01 );
|
||||||
|
m_UserGridSize.x = From_User_Unit( userGridUnits, tmp );
|
||||||
|
|
||||||
|
aCfg->Read( baseCfgName + UserGridSizeYEntry, &tmp, 0.01 );
|
||||||
|
m_UserGridSize.y = From_User_Unit( userGridUnits, tmp );
|
||||||
|
|
||||||
aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
|
aCfg->Read( baseCfgName + DisplayPadFillEntry, &m_DisplayOptions.m_DisplayPadFill, true );
|
||||||
aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
|
aCfg->Read( baseCfgName + DisplayViaFillEntry, &m_DisplayOptions.m_DisplayViaFill, true );
|
||||||
|
@ -864,8 +871,9 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
|
||||||
|
|
||||||
wxString baseCfgName = GetName();
|
wxString baseCfgName = GetName();
|
||||||
|
|
||||||
aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
|
aCfg->Write( baseCfgName + UserGridSizeXEntry, To_User_Unit( g_UserUnit, m_UserGridSize.x ) );
|
||||||
aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
|
aCfg->Write( baseCfgName + UserGridSizeYEntry, To_User_Unit( g_UserUnit, m_UserGridSize.y ) );
|
||||||
|
aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )g_UserUnit );
|
||||||
aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
|
aCfg->Write( baseCfgName + DisplayPadFillEntry, m_DisplayOptions.m_DisplayPadFill );
|
||||||
aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
|
aCfg->Write( baseCfgName + DisplayViaFillEntry, m_DisplayOptions.m_DisplayViaFill );
|
||||||
aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
|
aCfg->Write( baseCfgName + DisplayPadNumberEntry, m_DisplayOptions.m_DisplayPadNum );
|
||||||
|
|
|
@ -378,7 +378,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
|
|
||||||
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
|
||||||
|
|
||||||
GetScreen()->AddGrid( m_UserGridSize, g_UserUnit, ID_POPUP_GRID_USER );
|
GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
|
||||||
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
|
||||||
|
|
||||||
if( m_canvas )
|
if( m_canvas )
|
||||||
|
|
Loading…
Reference in New Issue