diff --git a/include/gal/graphics_abstraction_layer.h b/include/gal/graphics_abstraction_layer.h index 4c42e8090e..8a2ecaa119 100644 --- a/include/gal/graphics_abstraction_layer.h +++ b/include/gal/graphics_abstraction_layer.h @@ -858,6 +858,14 @@ public: gridStyle = aGridStyle; } + /** + * @brief Returns the current grid drawing style. + */ + virtual GRID_STYLE GetGridStyle() const + { + return gridStyle; + } + /** * @brief Compute the point position in world coordinates from given screen coordinates. * diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index d894f541b2..703a76009c 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -1,11 +1,7 @@ -/** - * @file dialog_set_grid.cpp - * @brief Manage user grid. - */ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2016 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 @@ -25,49 +21,48 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include -#include -#include -#include -#include +/** + * @file dialog_set_grid.cpp + * @brief Manage user grid. + */ -#include -#include #include -#include + +#include +#include +#include + +#include +#include +#include #include -#include -#include #include +#include + +#include // Max values for grid size -#define MAX_GRID_SIZE ( 50.0 * IU_PER_MM ) -#define MIN_GRID_SIZE ( 0.001 * IU_PER_MM ) +static const double MAX_GRID_SIZE = 50.0 * IU_PER_MM; +static const double MIN_GRID_SIZE = 0.001 * IU_PER_MM; // Min/Max value for grid offset -#define MAX_GRID_OFFSET ((double)INT_MAX/2) +static const double MAX_GRID_OFFSET = INT_MAX / 2.0; class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE { public: - /// This has no dependencies on calling wxFrame derivative, such as PCB_BASE_FRAME. - DIALOG_SET_GRID( wxFrame* aCaller, EDA_UNITS_T* aGridUnits, EDA_UNITS_T aBoardUnits, - wxRealPoint* aUserSize, wxPoint* aOrigin, - int* aFastGrid1, int* aFastGrid2, const wxArrayString& aGridChoices ); + DIALOG_SET_GRID( PCB_BASE_FRAME* aParent, const wxArrayString& aGridChoices ); + + bool TransferDataFromWindow(); + bool TransferDataToWindow(); private: void OnResetGridOrgClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void OnOkClick( wxCommandEvent& event ); - EDA_UNITS_T& m_callers_grid_units; - EDA_UNITS_T m_callers_board_units; - wxRealPoint& m_callers_user_size; - wxPoint& m_callers_origin; - int& m_callers_fast_grid1; - int& m_callers_fast_grid2; + PCB_BASE_FRAME* m_parent; + wxArrayString m_fast_grid_opts; void setGridUnits( EDA_UNITS_T units ); EDA_UNITS_T getGridUnits(); @@ -80,28 +75,21 @@ private: void setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 ); void getGridForFastSwitching( int& aGrid1, int& aGrid2 ); + + void setGridStyle( KIGFX::GRID_STYLE aStyle ); + KIGFX::GRID_STYLE getGridStyle() const; }; -DIALOG_SET_GRID::DIALOG_SET_GRID( wxFrame* aCaller, EDA_UNITS_T* aGridUnits, EDA_UNITS_T aBoardUnits, - wxRealPoint* aUserSize, wxPoint* aOrigin, int* aFastGrid1, int* aFastGrid2, const wxArrayString& aGridChoices ): - DIALOG_SET_GRID_BASE( aCaller ), - m_callers_grid_units( *aGridUnits ), - m_callers_board_units( aBoardUnits ), - m_callers_user_size( *aUserSize ), - m_callers_origin( *aOrigin ), - m_callers_fast_grid1( *aFastGrid1 ), - m_callers_fast_grid2( *aFastGrid2 ) +DIALOG_SET_GRID::DIALOG_SET_GRID( PCB_BASE_FRAME* aParent, const wxArrayString& aGridChoices ): + DIALOG_SET_GRID_BASE( aParent ), + m_parent( aParent ), + m_fast_grid_opts( aGridChoices ) { - m_TextPosXUnits->SetLabel( GetUnitsLabel( m_callers_board_units ) ); - m_TextPosYUnits->SetLabel( GetUnitsLabel( m_callers_board_units ) ); - m_sdbSizer1OK->SetDefault(); // set OK button as default response to 'Enter' key - setGridUnits( m_callers_grid_units ); - setGridSize( m_callers_user_size ); - setGridOrigin( m_callers_origin ); - setGridForFastSwitching( aGridChoices, m_callers_fast_grid1, m_callers_fast_grid2 ); + m_TextPosXUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) ); + m_TextPosYUnits->SetLabel( GetUnitsLabel( m_parent->m_UserGridUnit ) ); GetSizer()->SetSizeHints( this ); Fit(); @@ -109,9 +97,88 @@ DIALOG_SET_GRID::DIALOG_SET_GRID( wxFrame* aCaller, EDA_UNITS_T* aGridUnits, EDA } +bool DIALOG_SET_GRID::TransferDataFromWindow() +{ + // 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; + if( !getGridOrigin( gridOrigin ) ) + { + wxMessageBox( wxString::Format( _( "Incorrect grid origin " + "(coordinates must be >= %.3f mm and <= %.3f mm)" ), + -MAX_GRID_OFFSET/IU_PER_MM, MAX_GRID_OFFSET/IU_PER_MM ) ); + + return false; + } + + int fastGrid1, fastGrid2; + getGridForFastSwitching( fastGrid1, fastGrid2 ); + + EDA_UNITS_T units = getGridUnits(); + + // Apply the new settings + + // Because grid origin is saved in board, show as modified + m_parent->OnModify(); + m_parent->SetGridOrigin( gridOrigin ); + m_parent->m_UserGridUnit = units; + m_parent->m_UserGridSize = gridSize; + m_parent->m_FastGrid1 = fastGrid1; + m_parent->m_FastGrid2 = fastGrid2; + + // User grid + BASE_SCREEN* screen = m_parent->GetScreen(); + screen->AddGrid( gridSize, units, ID_POPUP_GRID_USER ); + + // If the user grid is the current option, recall SetGrid() + // to force new values put in list as current grid value + if( screen->GetGridCmdId() == ID_POPUP_GRID_USER ) + screen->SetGrid( ID_POPUP_GRID_USER ); + + // Notify GAL + TOOL_MANAGER* mgr = m_parent->GetToolManager(); + + if( mgr && m_parent->IsGalCanvasActive() ) + { + mgr->RunAction( "common.Control.gridPreset", true, + screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 ); + + TOOL_EVENT gridOriginUpdate = COMMON_ACTIONS::gridSetOrigin.MakeEvent(); + gridOriginUpdate.SetParameter( new VECTOR2D( gridOrigin ) ); + mgr->ProcessEvent( gridOriginUpdate ); + } + + m_parent->GetGalCanvas()->GetGAL()->SetGridStyle( getGridStyle() ); + m_parent->GetCanvas()->Refresh(); + + return wxDialog::TransferDataFromWindow(); +} + + +bool DIALOG_SET_GRID::TransferDataToWindow() +{ + setGridUnits( m_parent->m_UserGridUnit ); + setGridSize( m_parent->m_UserGridSize ); + setGridOrigin( m_parent->GetGridOrigin() ); + setGridForFastSwitching( m_fast_grid_opts, m_parent->m_FastGrid1, m_parent->m_FastGrid2 ); + setGridStyle( m_parent->GetGalCanvas()->GetGAL()->GetGridStyle() ); + + return wxDialog::TransferDataToWindow(); +} + + void DIALOG_SET_GRID::setGridUnits( EDA_UNITS_T aUnits ) { - m_UnitGrid->SetSelection( aUnits != INCHES ); + m_UnitGrid->SetSelection( aUnits != INCHES ); } @@ -136,15 +203,12 @@ void DIALOG_SET_GRID::setGridSize( const wxRealPoint& grid ) bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGrisSize ) { wxRealPoint grid; - m_callers_grid_units = getGridUnits(); - double grid_unit_to_iu = m_callers_grid_units == INCHES ? IU_PER_MILS*1000 : IU_PER_MM; - 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 ) || - tmp*grid_unit_to_iu < MIN_GRID_SIZE || tmp*grid_unit_to_iu > MAX_GRID_SIZE ) + tmp * grid_unit_to_iu < MIN_GRID_SIZE || tmp * grid_unit_to_iu > MAX_GRID_SIZE ) { return false; } @@ -167,22 +231,33 @@ bool DIALOG_SET_GRID::getGridSize( wxRealPoint& aGrisSize ) bool DIALOG_SET_GRID::getGridOrigin( wxPoint& aGridOrigin ) { - double tmp; + double x, y; - tmp = DoubleValueFromString( g_UserUnit, m_GridOriginXCtrl->GetValue() ); + const wxString& x_str = m_GridOriginXCtrl->GetValue(); + + if( !x_str.ToDouble( &x ) ) + return false; + + x = DoubleValueFromString( g_UserUnit, x_str ); // Some error checking here is a good thing. - if( tmp < -MAX_GRID_OFFSET || tmp > MAX_GRID_OFFSET ) + if( x < -MAX_GRID_OFFSET || x > MAX_GRID_OFFSET ) return false; - aGridOrigin.x = KiROUND( tmp ); - tmp = DoubleValueFromString( g_UserUnit, m_GridOriginYCtrl->GetValue() ); + const wxString& y_str = m_GridOriginYCtrl->GetValue(); - if( tmp < -MAX_GRID_OFFSET || tmp > MAX_GRID_OFFSET ) + if( !y_str.ToDouble( &y ) ) return false; - aGridOrigin.y = KiROUND( tmp ); + y = DoubleValueFromString( g_UserUnit, y_str ); + + if( y < -MAX_GRID_OFFSET || y > MAX_GRID_OFFSET ) + return false; + + + aGridOrigin.x = KiROUND( x ); + aGridOrigin.y = KiROUND( y ); return true; } @@ -212,90 +287,26 @@ void DIALOG_SET_GRID::getGridForFastSwitching( int& aGrid1, int& aGrid2 ) } +void DIALOG_SET_GRID::setGridStyle( KIGFX::GRID_STYLE aStyle ) +{ + m_Style->SetSelection( aStyle != KIGFX::GRID_STYLE_DOTS ); +} + + +KIGFX::GRID_STYLE DIALOG_SET_GRID::getGridStyle() const +{ + return m_Style->GetSelection() == 0 ? KIGFX::GRID_STYLE_DOTS : KIGFX::GRID_STYLE_LINES; +} + + void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event ) { setGridOrigin( wxPoint( 0, 0 ) ); } -void DIALOG_SET_GRID::OnCancelClick( wxCommandEvent& event ) -{ - EndModal( wxID_CANCEL ); -} - - -void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event ) -{ - bool success = getGridSize( m_callers_user_size ); - - if( !success ) - { - 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; - } - - success = getGridOrigin( m_callers_origin ); - - if( !success ) - { - wxMessageBox( wxString::Format( _( "Incorrect grid origin (coordinates must be >= %.3f mm and <= %.3f mm)" ), - -MAX_GRID_OFFSET/IU_PER_MM, MAX_GRID_OFFSET/IU_PER_MM ) ); - return; - } - - getGridForFastSwitching( m_callers_fast_grid1, m_callers_fast_grid2 ); - - EndModal( wxID_OK ); -} - - -#include -#include - bool PCB_BASE_FRAME::InvokeDialogGrid() { - wxPoint grid_origin = GetGridOrigin(); - - DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize, - &grid_origin, &m_FastGrid1, &m_FastGrid2, - m_gridSelectBox->GetStrings() ); - - int ret = dlg.ShowModal(); - - if( ret == wxID_OK ) - { - if( GetGridOrigin() != grid_origin && IsType( FRAME_PCB ) ) - OnModify(); // because grid origin is saved in board, show as modified - - SetGridOrigin( grid_origin ); - - BASE_SCREEN* screen = GetScreen(); - - screen->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); - - // If the user grid is the current option, recall SetGrid() - // to force new values put in list as current grid value - if( screen->GetGridCmdId() == ID_POPUP_GRID_USER ) - screen->SetGrid( ID_POPUP_GRID_USER ); - - // Notify GAL - TOOL_MANAGER* mgr = GetToolManager(); - - if( mgr && IsGalCanvasActive() ) - { - mgr->RunAction( "common.Control.gridPreset", true, - screen->GetGridCmdId() - ID_POPUP_GRID_LEVEL_1000 ); - - TOOL_EVENT gridOriginUpdate = COMMON_ACTIONS::gridSetOrigin.MakeEvent(); - gridOriginUpdate.SetParameter( new VECTOR2D( grid_origin ) ); - mgr->ProcessEvent( gridOriginUpdate ); - } - - m_canvas->Refresh(); - - return true; - } - - return false; + DIALOG_SET_GRID dlg( this, m_gridSelectBox->GetStrings() ); + return dlg.ShowModal(); } diff --git a/pcbnew/dialogs/dialog_set_grid_base.cpp b/pcbnew/dialogs/dialog_set_grid_base.cpp index 1792e504e4..4d8fca1224 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.cpp +++ b/pcbnew/dialogs/dialog_set_grid_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 9 2015) +// C++ code generated with wxFormBuilder (version Apr 13 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -24,7 +24,7 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con wxString m_UnitGridChoices[] = { _("Inches"), _("Millimeters") }; int m_UnitGridNChoices = sizeof( m_UnitGridChoices ) / sizeof( wxString ); - m_UnitGrid = new wxRadioBox( this, wxID_ANY, _("Units"), wxDefaultPosition, wxDefaultSize, m_UnitGridNChoices, m_UnitGridChoices, 1, wxRA_SPECIFY_COLS ); + 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 ); @@ -34,20 +34,18 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con fgSizer31->SetFlexibleDirection( wxBOTH ); fgSizer31->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextSizeX = new wxStaticText( this, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 ); + 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( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptGridSizeX->SetMaxLength( 0 ); + 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( this, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + 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( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptGridSizeY->SetMaxLength( 0 ); + m_OptGridSizeY = new wxTextCtrl( sbLeftSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizer31->Add( m_OptGridSizeY, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); @@ -68,34 +66,32 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con fgSizerGridOrigin->SetFlexibleDirection( wxBOTH ); fgSizerGridOrigin->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextGridPosX = new wxStaticText( this, wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGridPosX = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("X:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosX->Wrap( -1 ); fgSizerGridOrigin->Add( m_staticTextGridPosX, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); - m_GridOriginXCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOriginXCtrl->SetMaxLength( 0 ); + m_GridOriginXCtrl = new wxTextCtrl( sbRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerGridOrigin->Add( m_GridOriginXCtrl, 0, wxEXPAND|wxLEFT|wxTOP, 5 ); - m_TextPosXUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextPosXUnits = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosXUnits->Wrap( -1 ); fgSizerGridOrigin->Add( m_TextPosXUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxLEFT|wxTOP, 5 ); - m_staticTextGridPosY = new wxStaticText( this, wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGridPosY = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Y:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGridPosY->Wrap( -1 ); fgSizerGridOrigin->Add( m_staticTextGridPosY, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_GridOriginYCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_GridOriginYCtrl->SetMaxLength( 0 ); + m_GridOriginYCtrl = new wxTextCtrl( sbRightSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); fgSizerGridOrigin->Add( m_GridOriginYCtrl, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); - m_TextPosYUnits = new wxStaticText( this, wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); + m_TextPosYUnits = new wxStaticText( sbRightSizer->GetStaticBox(), wxID_ANY, _("Inches"), wxDefaultPosition, wxDefaultSize, 0 ); m_TextPosYUnits->Wrap( -1 ); fgSizerGridOrigin->Add( m_TextPosYUnits, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_LEFT|wxALL, 5 ); sbRightSizer->Add( fgSizerGridOrigin, 0, wxALL|wxEXPAND, 5 ); - m_buttonReset = new wxButton( this, wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); + m_buttonReset = new wxButton( sbRightSizer->GetStaticBox(), wxID_ANY, _("Reset Grid Origin"), wxDefaultPosition, wxDefaultSize, 0 ); sbRightSizer->Add( m_buttonReset, 0, wxALL|wxEXPAND, 5 ); @@ -110,18 +106,18 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con fgSizer3->SetFlexibleDirection( wxBOTH ); fgSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED ); - m_staticTextGrid1 = new wxStaticText( this, wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid1 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Grid 1:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid1->Wrap( -1 ); fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); - m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + m_comboBoxGrid1 = new wxComboBox( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); fgSizer3->Add( m_comboBoxGrid1, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); - m_staticTextGrid2 = new wxStaticText( this, wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticTextGrid2 = new wxStaticText( sbSizer4->GetStaticBox(), wxID_ANY, _("Grid 2:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextGrid2->Wrap( -1 ); fgSizer3->Add( m_staticTextGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP, 5 ); - m_comboBoxGrid2 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); + m_comboBoxGrid2 = new wxComboBox( sbSizer4->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY ); fgSizer3->Add( m_comboBoxGrid2, 1, wxALL|wxEXPAND, 5 ); @@ -133,6 +129,12 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con bUpperSizer->Add( bSizer4, 1, wxEXPAND, 5 ); + wxString m_StyleChoices[] = { _("Dots"), _("Lines") }; + int m_StyleNChoices = sizeof( m_StyleChoices ) / sizeof( wxString ); + m_Style = new wxRadioBox( this, wxID_ANY, _("Style (OpenGL && Cairo)"), wxDefaultPosition, wxDefaultSize, m_StyleNChoices, m_StyleChoices, 1, wxRA_SPECIFY_COLS ); + m_Style->SetSelection( 0 ); + bUpperSizer->Add( m_Style, 0, wxALL|wxEXPAND, 5 ); + bSizerMain->Add( bUpperSizer, 1, wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_set_grid_base.fbp b/pcbnew/dialogs/dialog_set_grid_base.fbp index d27d6c167f..c25f86f1ca 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.fbp +++ b/pcbnew/dialogs/dialog_set_grid_base.fbp @@ -112,6 +112,7 @@ sbLeftSizer wxVERTICAL + 1 none @@ -204,11 +205,11 @@ - + 5 wxALL|wxEXPAND 0 - + 2 wxBOTH 1 @@ -581,16 +582,17 @@ bSizer4 wxVERTICAL none - + 5 wxEXPAND|wxALL 0 - + wxID_ANY Origin sbRightSizer wxVERTICAL + 1 none @@ -1215,23 +1217,24 @@ - + 5 wxALL|wxEXPAND 1 - + wxID_ANY Fast Switching sbSizer4 wxVERTICAL + 1 none - + 5 wxALL|wxEXPAND 1 - + 2 wxBOTH 1 @@ -1243,11 +1246,11 @@ none 2 0 - + 5 wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP 0 - + 1 1 1 @@ -1326,11 +1329,11 @@ - + 5 wxEXPAND|wxLEFT|wxRIGHT|wxTOP 1 - + 1 1 1 @@ -1417,11 +1420,11 @@ - + 5 wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxBOTTOM|wxLEFT|wxTOP 0 - + 1 1 1 @@ -1500,11 +1503,11 @@ - + 5 wxALL|wxEXPAND 1 - + 1 1 1 @@ -1597,6 +1600,96 @@ + + 5 + wxALL|wxEXPAND + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + "Dots" "Lines" + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Style (OpenGL && Cairo) + 1 + + 0 + + + 0 + + 1 + m_Style + 1 + + + protected + 1 + + Resizable + 0 + 1 + + wxRA_SPECIFY_COLS + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialogs/dialog_set_grid_base.h b/pcbnew/dialogs/dialog_set_grid_base.h index 4975430076..5e2b0d14f8 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.h +++ b/pcbnew/dialogs/dialog_set_grid_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Mar 9 2015) +// C++ code generated with wxFormBuilder (version Apr 13 2016) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -55,6 +55,7 @@ class DIALOG_SET_GRID_BASE : public DIALOG_SHIM wxComboBox* m_comboBoxGrid1; wxStaticText* m_staticTextGrid2; wxComboBox* m_comboBoxGrid2; + wxRadioBox* m_Style; wxStdDialogButtonSizer* m_sdbSizer1; wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1Cancel;