Grid dialog changes to go along with menu changes.

Removes the units from the grid dialog.  They're now set via
the view menu.
This commit is contained in:
Jeff Young 2018-02-15 15:12:10 +00:00 committed by Wayne Stambaugh
parent 8b4e8fcd26
commit e9e3134dab
8 changed files with 788 additions and 728 deletions

View File

@ -68,7 +68,6 @@ class PCB_BASE_FRAME : public EDA_DRAW_FRAME
{ {
public: public:
PCB_DISPLAY_OPTIONS m_DisplayOptions; PCB_DISPLAY_OPTIONS m_DisplayOptions;
EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint 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)

View File

@ -72,9 +72,6 @@ private:
FinishDialogSettings(); FinishDialogSettings();
} }
void setGridUnits( EDA_UNITS_T units );
EDA_UNITS_T getGridUnits();
void setGridSize( const wxRealPoint& grid ); void setGridSize( const wxRealPoint& grid );
bool getGridSize( wxRealPoint& aGrisSize ); bool getGridSize( wxRealPoint& aGrisSize );
@ -93,25 +90,17 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent, const wxArrayString&
{ {
m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key m_sdbSizerOK->SetDefault(); // set OK button as default response to 'Enter' key
m_TextPosXUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) ); m_TextPosXUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_TextPosYUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) ); m_TextPosYUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_TextSizeXUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_TextSizeYUnits->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
} }
bool DIALOG_SET_GRID::TransferDataFromWindow() bool DIALOG_SET_GRID::TransferDataFromWindow()
{ {
// Validate new settings // Validate new settings
wxRealPoint gridSize;
if( !getGridSize( gridSize ) )
{
wxMessageBox( wxString::Format( _( "Incorrect grid size "
"(size must be >= %.3f mm and <= %.3f mm)" ),
MIN_GRID_SIZE/IU_PER_MM, MAX_GRID_SIZE/IU_PER_MM ) );
return false;
}
wxPoint gridOrigin; wxPoint gridOrigin;
if( !getGridOrigin( gridOrigin ) ) if( !getGridOrigin( gridOrigin ) )
@ -123,24 +112,32 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
return false; return false;
} }
wxRealPoint gridSize;
if( !getGridSize( gridSize ) )
{
wxMessageBox( wxString::Format( _( "Incorrect grid size "
"(size must be >= %.3f mm and <= %.3f mm)" ),
MIN_GRID_SIZE/IU_PER_MM, MAX_GRID_SIZE/IU_PER_MM ) );
return false;
}
int fastGrid1, fastGrid2; int fastGrid1, fastGrid2;
getGridForFastSwitching( fastGrid1, fastGrid2 ); getGridForFastSwitching( fastGrid1, fastGrid2 );
EDA_UNITS_T units = getGridUnits();
// Apply the new settings // Apply the new settings
// Because grid origin is saved in board, show as modified // Because grid origin is saved in board, show as modified
m_parent->OnModify(); m_parent->OnModify();
m_parent->SetGridOrigin( gridOrigin ); m_parent->SetGridOrigin( gridOrigin );
m_parent->m_UserGridUnit = units;
m_parent->m_UserGridSize = gridSize; m_parent->m_UserGridSize = gridSize;
m_parent->m_FastGrid1 = fastGrid1; m_parent->m_FastGrid1 = fastGrid1;
m_parent->m_FastGrid2 = fastGrid2; m_parent->m_FastGrid2 = fastGrid2;
// User grid // User grid
BASE_SCREEN* screen = m_parent->GetScreen(); BASE_SCREEN* screen = m_parent->GetScreen();
screen->AddGrid( gridSize, units, ID_POPUP_GRID_USER ); screen->AddGrid( gridSize, g_UserUnit, 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
@ -166,7 +163,6 @@ bool DIALOG_SET_GRID::TransferDataFromWindow()
bool DIALOG_SET_GRID::TransferDataToWindow() bool DIALOG_SET_GRID::TransferDataToWindow()
{ {
setGridUnits( m_parent->m_UserGridUnit );
setGridSize( m_parent->m_UserGridSize ); setGridSize( m_parent->m_UserGridSize );
setGridOrigin( m_parent->GetGridOrigin() ); setGridOrigin( m_parent->GetGridOrigin() );
setGridForFastSwitching( m_fast_grid_opts, m_parent->m_FastGrid1, m_parent->m_FastGrid2 ); setGridForFastSwitching( m_fast_grid_opts, m_parent->m_FastGrid1, m_parent->m_FastGrid2 );
@ -175,54 +171,47 @@ bool DIALOG_SET_GRID::TransferDataToWindow()
} }
void DIALOG_SET_GRID::setGridUnits( EDA_UNITS_T aUnits )
{
m_UnitGrid->SetSelection( aUnits != INCHES );
}
EDA_UNITS_T DIALOG_SET_GRID::getGridUnits()
{
return m_UnitGrid->GetSelection() == 0 ? INCHES : MILLIMETRES;
}
void DIALOG_SET_GRID::setGridSize( const wxRealPoint& grid ) void DIALOG_SET_GRID::setGridSize( const wxRealPoint& grid )
{ {
wxString msg; wxString msg;
msg.Printf( wxT( "%.10g" ), grid.x ); msg.Printf( wxT( "%.10g" ), To_User_Unit( g_UserUnit, grid.x ) );
m_OptGridSizeX->SetValue( msg ); m_OptGridSizeX->SetValue( msg );
msg.Printf( wxT( "%.10g" ), grid.y ); msg.Printf( wxT( "%.10g" ), To_User_Unit( g_UserUnit, grid.y ) );
m_OptGridSizeY->SetValue( msg ); m_OptGridSizeY->SetValue( msg );
} }
bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGrisSize ) bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGridSize )
{ {
wxRealPoint grid; double x, y;
wxString val = m_OptGridSizeX->GetValue();
double grid_unit_to_iu = ( getGridUnits() == INCHES ? IU_PER_MILS * 1000 : IU_PER_MM );
double tmp;
if( !val.ToDouble( &tmp ) || const wxString& x_str = m_OptGridSizeX->GetValue();
tmp * grid_unit_to_iu < MIN_GRID_SIZE || tmp * grid_unit_to_iu > MAX_GRID_SIZE )
{ if( !x_str.ToDouble( &x ) )
return false; return false;
}
else
aGrisSize.x = tmp;
val = m_OptGridSizeY->GetValue(); x = DoubleValueFromString( g_UserUnit, x_str );
if( !val.ToDouble( &tmp ) || // Some error checking here is a good thing.
tmp*grid_unit_to_iu < MIN_GRID_SIZE || tmp*grid_unit_to_iu > MAX_GRID_SIZE ) if( x < MIN_GRID_SIZE || x > MAX_GRID_SIZE )
{
return false; return false;
}
else aGridSize.x = x;
aGrisSize.y = tmp;
const wxString& y_str = m_OptGridSizeY->GetValue();
if( !y_str.ToDouble( &y ) )
return false;
y = DoubleValueFromString( g_UserUnit, y_str );
// Some error checking here is a good thing.
if( y < MIN_GRID_SIZE || y > MAX_GRID_SIZE )
return false;
aGridSize.y = y;
return true; return true;
} }

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 9 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_set_grid_base.h" #include "dialog_set_grid_base.h"
@ -20,45 +20,7 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
bUpperSizer = new wxBoxSizer( wxHORIZONTAL ); bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLeftSizer; wxStaticBoxSizer* sbLeftSizer;
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Grid") ), wxVERTICAL ); sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Grid Origin") ), wxVERTICAL );
wxString m_UnitGridChoices[] = { _("Inches"), _("Millimeters") };
int m_UnitGridNChoices = sizeof( m_UnitGridChoices ) / sizeof( wxString );
m_UnitGrid = new wxRadioBox( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridNChoices, m_UnitGridChoices, 1, wxRA_SPECIFY_COLS );
m_UnitGrid->SetSelection( 0 );
sbLeftSizer->Add( m_UnitGrid, 0, wxALL|wxEXPAND, 5 );
wxFlexGridSizer* fgSizer31;
fgSizer31 = new wxFlexGridSizer( 2, 2, 0, 0 );
fgSizer31->AddGrowableCol( 1 );
fgSizer31->SetFlexibleDirection( wxBOTH );
fgSizer31->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextSizeX = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
fgSizer31->Add( m_staticTextSizeX, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptGridSizeX = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_OptGridSizeX, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_staticTextSizeY = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
fgSizer31->Add( m_staticTextSizeY, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptGridSizeY = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_OptGridSizeY, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
sbLeftSizer->Add( fgSizer31, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( sbLeftSizer, 1, wxALL|wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbRightSizer;
sbRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Origin") ), wxVERTICAL );
wxFlexGridSizer* fgSizerGridOrigin; wxFlexGridSizer* fgSizerGridOrigin;
fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 ); fgSizerGridOrigin = new wxFlexGridSizer( 2, 3, 0, 0 );
@ -66,39 +28,79 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); fgSizerGridOrigin->SetFlexibleDirection( wxBOTH );
fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGridPosX = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosX = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridPosX->Wrap( -1 ); m_staticTextGridPosX->Wrap( -1 );
fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 );
m_GridOriginXCtrl = new wxTextCtrl( sbRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_GridOriginXCtrl = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxLEFT|wxTOP, 5 ); fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_TextPosXUnits = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosXUnits = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPosXUnits->Wrap( -1 ); m_TextPosXUnits->Wrap( -1 );
fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT|wxTOP, 5 ); fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxTOP, 5 );
m_staticTextGridPosY = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosY = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGridPosY->Wrap( -1 ); m_staticTextGridPosY->Wrap( -1 );
fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 );
m_GridOriginYCtrl = new wxTextCtrl( sbRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_GridOriginYCtrl = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 );
m_TextPosYUnits = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosYUnits = new wxStaticText( sbLeftSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPosYUnits->Wrap( -1 ); m_TextPosYUnits->Wrap( -1 );
fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT, 5 );
sbRightSizer->Add( fgSizerGridOrigin, 0, wxALL|wxEXPAND, 5 ); sbLeftSizer->Add( fgSizerGridOrigin, 1, wxALL|wxEXPAND, 5 );
m_buttonReset = new wxButton( sbRightSizer->GetStaticBox(), wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonReset = new wxButton( sbLeftSizer->GetStaticBox(), wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 );
sbRightSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 ); sbLeftSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 );
bSizer4->Add( sbRightSizer, 0, wxEXPAND|wxALL, 5 ); bUpperSizer->Add( sbLeftSizer, 0, wxEXPAND|wxALL, 5 );
wxStaticBoxSizer* sbSizer4; wxBoxSizer* bRightSizer;
sbSizer4 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fast Switching") ), wxVERTICAL ); bRightSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbUserGridSizer;
sbUserGridSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Defined Grid") ), wxVERTICAL );
wxFlexGridSizer* fgSizer31;
fgSizer31 = new wxFlexGridSizer( 2, 3, 0, 0 );
fgSizer31->AddGrowableCol( 1 );
fgSizer31->SetFlexibleDirection( wxBOTH );
fgSizer31->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextSizeX = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
fgSizer31->Add( m_staticTextSizeX, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_OptGridSizeX = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_OptGridSizeX, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_TextSizeXUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeXUnits->Wrap( -1 );
fgSizer31->Add( m_TextSizeXUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextSizeY = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
fgSizer31->Add( m_staticTextSizeY, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 5 );
m_OptGridSizeY = new wxTextCtrl( sbUserGridSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer31->Add( m_OptGridSizeY, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_TextSizeYUnits = new wxStaticText( sbUserGridSizer->GetStaticBox(), wxID_ANY, _("mm"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextSizeYUnits->Wrap( -1 );
fgSizer31->Add( m_TextSizeYUnits, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbUserGridSizer->Add( fgSizer31, 0, wxALL|wxEXPAND, 5 );
bRightSizer->Add( sbUserGridSizer, 0, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbFastSwitchSizer;
sbFastSwitchSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Fast Switching") ), wxVERTICAL );
wxFlexGridSizer* fgSizer3; wxFlexGridSizer* fgSizer3;
fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 ); fgSizer3 = new wxFlexGridSizer( 2, 2, 0, 0 );
@ -106,28 +108,28 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetFlexibleDirection( wxBOTH );
fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticTextGrid1 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid1 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrid1->Wrap( -1 ); m_staticTextGrid1->Wrap( -1 );
fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT, 5 );
m_comboBoxGrid1 = new wxComboBox( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_comboBoxGrid1 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
fgSizer3->Add( m_comboBoxGrid1, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); fgSizer3->Add( m_comboBoxGrid1, 1, wxEXPAND|wxLEFT|wxRIGHT, 5 );
m_staticTextGrid2 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid2 = new wxStaticText( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextGrid2->Wrap( -1 ); m_staticTextGrid2->Wrap( -1 );
fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT, 5 );
m_comboBoxGrid2 = new wxComboBox( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); m_comboBoxGrid2 = new wxComboBox( sbFastSwitchSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
fgSizer3->Add( m_comboBoxGrid2, 1, wxALL|wxEXPAND, 5 ); fgSizer3->Add( m_comboBoxGrid2, 1, wxALL|wxEXPAND, 5 );
sbSizer4->Add( fgSizer3, 1, wxALL|wxEXPAND, 5 ); sbFastSwitchSizer->Add( fgSizer3, 0, wxEXPAND, 5 );
bSizer4->Add( sbSizer4, 1, wxALL|wxEXPAND, 5 ); bRightSizer->Add( sbFastSwitchSizer, 0, wxALL|wxEXPAND, 5 );
bUpperSizer->Add( bSizer4, 1, wxEXPAND, 5 ); bUpperSizer->Add( bRightSizer, 1, wxEXPAND, 5 );
bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 );
@ -139,7 +141,7 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND|wxTOP, 5 ); bSizerMain->Add( m_sdbSizer, 0, wxEXPAND, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jan 9 2017) // C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_SET_GRID_BASE_H__ #ifndef __DIALOG_SET_GRID_BASE_H__
@ -11,20 +11,17 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statbox.h>
#include <wx/combobox.h> #include <wx/combobox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -39,11 +36,6 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
private: private:
protected: protected:
wxRadioBox* m_UnitGrid;
wxStaticText* m_staticTextSizeX;
wxTextCtrl* m_OptGridSizeX;
wxStaticText* m_staticTextSizeY;
wxTextCtrl* m_OptGridSizeY;
wxStaticText* m_staticTextGridPosX; wxStaticText* m_staticTextGridPosX;
wxTextCtrl* m_GridOriginXCtrl; wxTextCtrl* m_GridOriginXCtrl;
wxStaticText* m_TextPosXUnits; wxStaticText* m_TextPosXUnits;
@ -51,6 +43,12 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
wxTextCtrl* m_GridOriginYCtrl; wxTextCtrl* m_GridOriginYCtrl;
wxStaticText* m_TextPosYUnits; wxStaticText* m_TextPosYUnits;
wxButton* m_buttonReset; wxButton* m_buttonReset;
wxStaticText* m_staticTextSizeX;
wxTextCtrl* m_OptGridSizeX;
wxStaticText* m_TextSizeXUnits;
wxStaticText* m_staticTextSizeY;
wxTextCtrl* m_OptGridSizeY;
wxStaticText* m_TextSizeYUnits;
wxStaticText* m_staticTextGrid1; wxStaticText* m_staticTextGrid1;
wxComboBox* m_comboBoxGrid1; wxComboBox* m_comboBoxGrid1;
wxStaticText* m_staticTextGrid2; wxStaticText* m_staticTextGrid2;
@ -68,7 +66,7 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM
public: public:
DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Grid Settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_SET_GRID_BASE(); ~DIALOG_SET_GRID_BASE();
}; };

View File

@ -276,7 +276,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, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, g_UserUnit, 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:

View File

@ -110,7 +110,6 @@ 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 = wxRealPoint( 100.0, 100.0 );
m_UserGridUnit = INCHES;
m_Collector = new GENERAL_COLLECTOR(); m_Collector = new GENERAL_COLLECTOR();
m_FastGrid1 = 0; m_FastGrid1 = 0;
@ -843,14 +842,12 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 ); aCfg->Read( baseCfgName + UserGridSizeXEntry, &m_UserGridSize.x, 0.01 );
aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 ); aCfg->Read( baseCfgName + UserGridSizeYEntry, &m_UserGridSize.y, 0.01 );
long itmp;
aCfg->Read( baseCfgName + UserGridUnitsEntry, &itmp, ( long )INCHES );
m_UserGridUnit = (EDA_UNITS_T) itmp;
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 );
aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true ); aCfg->Read( baseCfgName + DisplayPadNumberEntry, &m_DisplayOptions.m_DisplayPadNum, true );
aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true ); aCfg->Read( baseCfgName + DisplayModuleEdgeEntry, &m_DisplayOptions.m_DisplayModEdgeFill, true );
long itmp;
aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0); aCfg->Read( baseCfgName + FastGrid1Entry, &itmp, ( long )0);
m_FastGrid1 = itmp; m_FastGrid1 = itmp;
aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0); aCfg->Read( baseCfgName + FastGrid2Entry, &itmp, ( long )0);
@ -868,7 +865,6 @@ void PCB_BASE_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x ); aCfg->Write( baseCfgName + UserGridSizeXEntry, m_UserGridSize.x );
aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y ); aCfg->Write( baseCfgName + UserGridSizeYEntry, m_UserGridSize.y );
aCfg->Write( baseCfgName + UserGridUnitsEntry, ( long )m_UserGridUnit );
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 );

View File

@ -377,7 +377,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, m_UserGridUnit, ID_POPUP_GRID_USER ); GetScreen()->AddGrid( m_UserGridSize, g_UserUnit, 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 )