From 34e6314a3e33ef43d9188f576cec207b284231a8 Mon Sep 17 00:00:00 2001 From: Dick Hollenbeck Date: Tue, 9 Jul 2013 00:48:26 -0500 Subject: [PATCH] dialog information hiding, initial Fit() --- common/base_units.cpp | 10 +- include/wxBasePcbFrame.h | 4 +- pcbnew/dialogs/dialog_pad_properties.cpp | 2 +- pcbnew/dialogs/dialog_pad_properties_base.cpp | 15 +- pcbnew/dialogs/dialog_pad_properties_base.fbp | 38 ++-- pcbnew/dialogs/dialog_pad_properties_base.h | 4 +- pcbnew/dialogs/dialog_set_grid.cpp | 179 ++++++++++-------- pcbnew/dialogs/dialog_set_grid_base.cpp | 8 +- pcbnew/dialogs/dialog_set_grid_base.fbp | 8 +- pcbnew/edit.cpp | 43 ++--- pcbnew/invoke_pcb_dialog.h | 6 +- pcbnew/modedit.cpp | 2 +- pcbnew/tool_onrightclick.cpp | 3 +- 13 files changed, 178 insertions(+), 144 deletions(-) diff --git a/common/base_units.cpp b/common/base_units.cpp index 9f9dddad2a..b8def5da99 100644 --- a/common/base_units.cpp +++ b/common/base_units.cpp @@ -226,7 +226,6 @@ double From_User_Unit( EDA_UNITS_T aUnit, double aValue ) default: case UNSCALED_UNITS: - value = aValue; } @@ -243,8 +242,9 @@ int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ) // Acquire the 'right' decimal point separator const struct lconv* lc = localeconv(); - wxChar decimal_point = lc->decimal_point[0]; - wxString buf( aTextValue.Strip( wxString::both ) ); + + wxChar decimal_point = lc->decimal_point[0]; + wxString buf( aTextValue.Strip( wxString::both ) ); // Convert the period in decimal point buf.Replace( wxT( "." ), wxString( decimal_point, 1 ) ); @@ -270,7 +270,9 @@ int ReturnValueFromString( EDA_UNITS_T aUnits, const wxString& aTextValue ) } // Extract the numeric part - buf.Left( brk_point ).ToDouble( &dtmp ); + buf.Left( brk_point ); + + buf.ToDouble( &dtmp ); // Check the optional unit designator (2 ch significant) wxString unit( buf.Mid( brk_point ).Strip( wxString::leading ).Left( 2 ).Lower() ); diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 842b9059d6..2b15bfa611 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -632,8 +632,6 @@ public: void SelectLayerPair(); virtual void SwitchLayer( wxDC* DC, LAYER_NUM layer ); - void InstallGridFrame( const wxPoint& pos ); - /** * Load applications settings common to PCB draw frame objects. * @@ -646,6 +644,8 @@ public: */ virtual void LoadSettings(); + bool InvokeDialogGrid(); + /** * Save applications settings common to PCB draw frame objects. * diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 798bf3f47d..6b284eb1c7 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -85,7 +85,7 @@ static const LAYER_MSK Std_Pad_Layers[] = { * class DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE, * created by wxFormBuilder */ - class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE +class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE { public: DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, D_PAD* aPad ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.cpp b/pcbnew/dialogs/dialog_pad_properties_base.cpp index 5319845ff4..6da97464e5 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.cpp +++ b/pcbnew/dialogs/dialog_pad_properties_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Apr 30 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -253,7 +253,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_LeftBoxSizer->Add( sbSizeModuleInfo, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - bGeneralSizer->Add( m_LeftBoxSizer, 1, wxALL|wxEXPAND, 5 ); + bGeneralSizer->Add( m_LeftBoxSizer, 3, wxALL|wxEXPAND, 5 ); wxBoxSizer* bSizer10; bSizer10 = new wxBoxSizer( wxVERTICAL ); @@ -287,7 +287,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_PadDrill_X_Ctrl = new wxTextCtrl( m_panelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_PadDrill_X_Ctrl->SetMaxLength( 0 ); - fgSizerGeometry->Add( m_PadDrill_X_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP, 5 ); + fgSizerGeometry->Add( m_PadDrill_X_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxTOP, 5 ); m_PadDrill_X_Unit = new wxStaticText( m_panelGeneral, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 ); m_PadDrill_X_Unit->Wrap( -1 ); @@ -299,7 +299,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_PadDrill_Y_Ctrl = new wxTextCtrl( m_panelGeneral, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_PadDrill_Y_Ctrl->SetMaxLength( 0 ); - fgSizerGeometry->Add( m_PadDrill_Y_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP, 5 ); + fgSizerGeometry->Add( m_PadDrill_Y_Ctrl, 0, wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 5 ); m_PadDrill_Y_Unit = new wxStaticText( m_panelGeneral, wxID_ANY, _("Inch"), wxDefaultPosition, wxDefaultSize, 0 ); m_PadDrill_Y_Unit->Wrap( -1 ); @@ -325,7 +325,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind int m_rbCopperLayersSelNChoices = sizeof( m_rbCopperLayersSelChoices ) / sizeof( wxString ); m_rbCopperLayersSel = new wxChoice( m_panelGeneral, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_rbCopperLayersSelNChoices, m_rbCopperLayersSelChoices, 0 ); m_rbCopperLayersSel->SetSelection( 0 ); - bSizer11->Add( m_rbCopperLayersSel, 1, wxALL, 5 ); + bSizer11->Add( m_rbCopperLayersSel, 1, wxALL|wxEXPAND, 5 ); m_LayersSizer->Add( bSizer11, 0, wxEXPAND, 5 ); @@ -373,7 +373,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind bSizer10->Add( m_LayersSizer, 0, wxALL|wxEXPAND, 5 ); - bGeneralSizer->Add( bSizer10, 0, wxALL|wxEXPAND, 5 ); + bGeneralSizer->Add( bSizer10, 2, wxALL|wxEXPAND, 5 ); m_panelGeneral->SetSizer( bGeneralSizer ); @@ -534,7 +534,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind m_panelShowPad = new wxPanel( this, wxID_ANY, wxDefaultPosition, wxSize( 200,200 ), wxFULL_REPAINT_ON_RESIZE|wxSIMPLE_BORDER ); m_panelShowPad->SetBackgroundColour( wxColour( 0, 0, 0 ) ); - bSizerDisplayPad->Add( m_panelShowPad, 1, wxRIGHT|wxTOP|wxEXPAND, 5 ); + bSizerDisplayPad->Add( m_panelShowPad, 4, wxRIGHT|wxTOP|wxEXPAND, 5 ); bSizerUpper->Add( bSizerDisplayPad, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); @@ -560,6 +560,7 @@ DIALOG_PAD_PROPERTIES_BASE::DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWind this->SetSizer( m_MainSizer ); this->Layout(); + m_MainSizer->Fit( this ); this->Centre( wxBOTH ); diff --git a/pcbnew/dialogs/dialog_pad_properties_base.fbp b/pcbnew/dialogs/dialog_pad_properties_base.fbp index 345a9b0ba3..cb8df4557b 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.fbp +++ b/pcbnew/dialogs/dialog_pad_properties_base.fbp @@ -42,7 +42,7 @@ -1,-1 DIALOG_PAD_PROPERTIES_BASE - 745,725 + -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Pad Properties @@ -268,8 +268,8 @@ 5 wxALL|wxEXPAND - 1 - + 3 + m_LeftBoxSizer wxVERTICAL @@ -3821,11 +3821,11 @@ - + 5 wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 0 - + wxID_ANY Parent footprint orientation @@ -3833,11 +3833,11 @@ wxVERTICAL none - + 5 0 - + 2 wxBOTH 1 @@ -4190,17 +4190,17 @@ 5 wxALL|wxEXPAND - 0 - + 2 + bSizer10 wxVERTICAL none - + 5 wxALL|wxEXPAND 0 - + wxID_ANY Drill @@ -4208,11 +4208,11 @@ wxVERTICAL none - + 5 wxEXPAND 0 - + 3 wxBOTH 1 @@ -4563,7 +4563,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxTOP 0 1 @@ -4820,7 +4820,7 @@ 5 - wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP + wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP 0 1 @@ -4996,11 +4996,11 @@ - + 5 wxALL|wxEXPAND 0 - + wxID_ANY Layers @@ -5102,7 +5102,7 @@ 5 - wxALL + wxALL|wxEXPAND 1 1 @@ -8233,7 +8233,7 @@ 5 wxRIGHT|wxTOP|wxEXPAND - 1 + 4 1 1 diff --git a/pcbnew/dialogs/dialog_pad_properties_base.h b/pcbnew/dialogs/dialog_pad_properties_base.h index ad9f285cbd..8a6ffd636d 100644 --- a/pcbnew/dialogs/dialog_pad_properties_base.h +++ b/pcbnew/dialogs/dialog_pad_properties_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Apr 30 2013) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -162,7 +162,7 @@ class DIALOG_PAD_PROPERTIES_BASE : public DIALOG_SHIM public: - DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 745,725 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); + DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); ~DIALOG_PAD_PROPERTIES_BASE(); }; diff --git a/pcbnew/dialogs/dialog_set_grid.cpp b/pcbnew/dialogs/dialog_set_grid.cpp index 5b2e288dbc..36527c6df6 100644 --- a/pcbnew/dialogs/dialog_set_grid.cpp +++ b/pcbnew/dialogs/dialog_set_grid.cpp @@ -26,81 +26,90 @@ */ #include +#include #include -#include -#include #include #include #include #include +#include class DIALOG_SET_GRID : public DIALOG_SET_GRID_BASE { public: - DIALOG_SET_GRID( wxWindow* parent, const wxPoint& pos ); - void SetGridSize( const wxRealPoint& grid ); - wxRealPoint GetGridSize(); - void SetGridUnits( int units ); - int GetGridUnits(); - void SetGridOrigin( const wxPoint& grid ); - wxPoint GetGridOrigin(); - void SetGridForFastSwitching( wxArrayString aGrids, int aGrid1, int aGrid2 ); - void GetGridForFastSwitching( int& aGrid1, int& aGrid2 ); + /// 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 ); private: - void OnResetGridOrgClick( wxCommandEvent& event ); - void OnCancelClick( wxCommandEvent& event ); - void OnOkClick( wxCommandEvent& event ); + 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; + + void setGridUnits( EDA_UNITS_T units ); + EDA_UNITS_T getGridUnits(); + + void setGridSize( const wxRealPoint& grid ); + wxRealPoint getGridSize(); + + void setGridOrigin( const wxPoint& grid ); + wxPoint getGridOrigin(); + + void setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 ); + void getGridForFastSwitching( int& aGrid1, int& aGrid2 ); }; -void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) +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 dlg( this, pos ); + m_TextPosXUnits->SetLabel( GetUnitsLabel( m_callers_board_units ) ); + m_TextPosYUnits->SetLabel( GetUnitsLabel( m_callers_board_units ) ); - dlg.SetGridUnits( m_UserGridUnit ); - dlg.SetGridSize( m_UserGridSize ); - dlg.SetGridOrigin( GetScreen()->m_GridOrigin ); + m_sdbSizer1OK->SetDefault(); // set OK button as default response to 'Enter' key - if( m_gridSelectBox ) - dlg.SetGridForFastSwitching( m_gridSelectBox->GetStrings(), m_FastGrid1, m_FastGrid2 ); + setGridUnits( m_callers_grid_units ); + setGridSize( m_callers_user_size ); + setGridOrigin( m_callers_origin ); + setGridForFastSwitching( aGridChoices, m_callers_fast_grid1, m_callers_fast_grid2 ); - if( dlg.ShowModal() == wxID_CANCEL ) - return; - - m_UserGridSize = dlg.GetGridSize(); - m_UserGridUnit = (EDA_UNITS_T) dlg.GetGridUnits(); - GetScreen()->m_GridOrigin = dlg.GetGridOrigin(); - - GetScreen()->AddGrid( m_UserGridSize, m_UserGridUnit, ID_POPUP_GRID_USER ); - - dlg.GetGridForFastSwitching( m_FastGrid1, m_FastGrid2 ); - - // If the user grid is the current option, recall SetGrid() - // to force new values put in list as current grid value - if( GetScreen()->GetGridId() == ID_POPUP_GRID_USER ) - GetScreen()->SetGrid( ID_POPUP_GRID_USER ); - - m_canvas->Refresh(); -} - - -DIALOG_SET_GRID::DIALOG_SET_GRID( wxWindow* parent, const wxPoint& pos ) : - DIALOG_SET_GRID_BASE( parent ) -{ - m_TextPosXUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); - m_TextPosYUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); - - m_sdbSizer1OK->SetDefault(); GetSizer()->SetSizeHints( this ); + Fit(); Centre(); } -void DIALOG_SET_GRID::SetGridSize( const wxRealPoint& grid ) +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 ) { wxString msg; @@ -112,37 +121,26 @@ void DIALOG_SET_GRID::SetGridSize( const wxRealPoint& grid ) } -wxRealPoint DIALOG_SET_GRID::GetGridSize() +wxRealPoint DIALOG_SET_GRID::getGridSize() { wxRealPoint grid; + // @todo: Some error checking here would be a good thing. + wxString x = m_OptGridSizeX->GetValue(); + wxString y = m_OptGridSizeY->GetValue(); - /* TODO: Some error checking here would be a good thing. */ - m_OptGridSizeX->GetValue().ToDouble( &grid.x ); - m_OptGridSizeY->GetValue().ToDouble( &grid.y ); + x.ToDouble( &grid.x ); + y.ToDouble( &grid.y ); return grid; } -void DIALOG_SET_GRID::SetGridUnits( int units ) -{ - if( units != INCHES ) - m_UnitGrid->SetSelection( 1 ); -} - - -int DIALOG_SET_GRID::GetGridUnits() -{ - return m_UnitGrid->GetSelection(); -} - - -wxPoint DIALOG_SET_GRID::GetGridOrigin() +wxPoint DIALOG_SET_GRID::getGridOrigin() { wxPoint grid; - /* TODO: Some error checking here would be a good thing. */ + // @todo Some error checking here would be a good thing. grid.x = ReturnValueFromTextCtrl( *m_GridOriginXCtrl ); grid.y = ReturnValueFromTextCtrl( *m_GridOriginYCtrl ); @@ -150,16 +148,14 @@ wxPoint DIALOG_SET_GRID::GetGridOrigin() } -void DIALOG_SET_GRID::SetGridOrigin( const wxPoint& grid ) +void DIALOG_SET_GRID::setGridOrigin( const wxPoint& grid ) { - wxString msg; - PutValueInLocalUnits( *m_GridOriginXCtrl, grid.x ); PutValueInLocalUnits( *m_GridOriginYCtrl, grid.y ); } -void DIALOG_SET_GRID::SetGridForFastSwitching( wxArrayString aGrids, int aGrid1, int aGrid2 ) +void DIALOG_SET_GRID::setGridForFastSwitching( const wxArrayString& aGrids, int aGrid1, int aGrid2 ) { m_comboBoxGrid1->Append( aGrids ); m_comboBoxGrid2->Append( aGrids ); @@ -169,7 +165,7 @@ void DIALOG_SET_GRID::SetGridForFastSwitching( wxArrayString aGrids, int aGrid1, } -void DIALOG_SET_GRID::GetGridForFastSwitching( int& aGrid1, int& aGrid2 ) +void DIALOG_SET_GRID::getGridForFastSwitching( int& aGrid1, int& aGrid2 ) { aGrid1 = m_comboBoxGrid1->GetSelection(); aGrid2 = m_comboBoxGrid2->GetSelection(); @@ -178,7 +174,7 @@ void DIALOG_SET_GRID::GetGridForFastSwitching( int& aGrid1, int& aGrid2 ) void DIALOG_SET_GRID::OnResetGridOrgClick( wxCommandEvent& event ) { - SetGridOrigin( wxPoint(0,0) ); + setGridOrigin( wxPoint( 0, 0 ) ); } @@ -190,5 +186,40 @@ void DIALOG_SET_GRID::OnCancelClick( wxCommandEvent& event ) void DIALOG_SET_GRID::OnOkClick( wxCommandEvent& event ) { + m_callers_grid_units = getGridUnits(); + m_callers_user_size = getGridSize(); + m_callers_origin = getGridOrigin(); + + getGridForFastSwitching( m_callers_fast_grid1, m_callers_fast_grid2 ); + EndModal( wxID_OK ); } + + +#include +#include + +bool PCB_BASE_FRAME::InvokeDialogGrid() +{ + DIALOG_SET_GRID dlg( this, &m_UserGridUnit, g_UserUnit, &m_UserGridSize, + &GetScreen()->m_GridOrigin, &m_FastGrid1, &m_FastGrid2, + m_gridSelectBox->GetStrings() ); + + int ret = dlg.ShowModal(); + + if( ret == wxID_OK ) + { + GetScreen()->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( GetScreen()->GetGridId() == ID_POPUP_GRID_USER ) + GetScreen()->SetGrid( ID_POPUP_GRID_USER ); + + m_canvas->Refresh(); + + return true; + } + + return false; +} diff --git a/pcbnew/dialogs/dialog_set_grid_base.cpp b/pcbnew/dialogs/dialog_set_grid_base.cpp index 306566344d..d28f7b7d8c 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.cpp +++ b/pcbnew/dialogs/dialog_set_grid_base.cpp @@ -114,15 +114,15 @@ DIALOG_SET_GRID_BASE::DIALOG_SET_GRID_BASE( wxWindow* parent, wxWindowID id, con m_staticTextGrid1->Wrap( -1 ); fgSizer3->Add( m_staticTextGrid1, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxLEFT|wxTOP, 5 ); - m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgSizer3->Add( m_comboBoxGrid1, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); + m_comboBoxGrid1 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + fgSizer3->Add( m_comboBoxGrid1, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 5 ); m_staticTextGrid2 = new wxStaticText( this, 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, _("Combo!"), wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); - fgSizer3->Add( m_comboBoxGrid2, 0, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); + m_comboBoxGrid2 = new wxComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 ); + fgSizer3->Add( m_comboBoxGrid2, 1, wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5 ); sbSizer4->Add( fgSizer3, 1, wxALL|wxEXPAND, 5 ); diff --git a/pcbnew/dialogs/dialog_set_grid_base.fbp b/pcbnew/dialogs/dialog_set_grid_base.fbp index f409d50996..e03ad55b27 100644 --- a/pcbnew/dialogs/dialog_set_grid_base.fbp +++ b/pcbnew/dialogs/dialog_set_grid_base.fbp @@ -1327,7 +1327,7 @@ 5 wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP - 0 + 1 1 1 @@ -1383,7 +1383,7 @@ wxFILTER_NONE wxDefaultValidator - Combo! + @@ -1501,7 +1501,7 @@ 5 wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND - 0 + 1 1 1 @@ -1557,7 +1557,7 @@ wxFILTER_NONE wxDefaultValidator - Combo! + diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index c89dfc68dc..0a2fb5434f 100755 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -1129,16 +1129,16 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_PCB_USER_GRID_SETUP: - InstallGridFrame( pos ); + InvokeDialogGrid(); break; case ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC: - { - wxConfig* cfg = wxGetApp().GetCommonSettings(); - cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName ); - GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() ); - } - break; + { + wxConfig* cfg = wxGetApp().GetCommonSettings(); + cfg->Read( wxT( "module_doc_file" ), g_DocModulesFileName ); + GetAssociatedDocument( this, g_DocModulesFileName, &wxGetApp().GetLibraryPathList() ); + } + break; case ID_MENU_ARCHIVE_NEW_MODULES: ArchiveModulesOnBoard( wxEmptyString, true ); @@ -1201,15 +1201,14 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) break; case PCB_ZONE_AREA_T: - { - SetCurItem( NULL ); - int netcode = ( (ZONE_CONTAINER*) Item )->GetNet(); - Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item ); - TestNetConnection( NULL, netcode ); - SetMsgPanel( GetBoard() ); - } - - break; + { + SetCurItem( NULL ); + int netcode = ( (ZONE_CONTAINER*) Item )->GetNet(); + Delete_Zone_Contour( DC, (ZONE_CONTAINER*) Item ); + TestNetConnection( NULL, netcode ); + SetMsgPanel( GetBoard() ); + } + break; case PCB_MARKER_T: if( Item == GetCurItem() ) @@ -1229,12 +1228,12 @@ void PCB_EDIT_FRAME::RemoveStruct( BOARD_ITEM* Item, wxDC* DC ) case TYPE_NOT_INIT: case PCB_T: default: - { - wxString Line; - Line.Printf( wxT( "Remove: item type %d unknown." ), Item->Type() ); - DisplayError( this, Line ); - } - break; + { + wxString msg = wxString::Format( + wxT( "Remove: item type %d unknown." ), Item->Type() ); + DisplayError( this, msg ); + } + break; } } diff --git a/pcbnew/invoke_pcb_dialog.h b/pcbnew/invoke_pcb_dialog.h index c6736ae981..273fd5417b 100644 --- a/pcbnew/invoke_pcb_dialog.h +++ b/pcbnew/invoke_pcb_dialog.h @@ -43,6 +43,10 @@ class wxFrame; class wxDialog; +class wxPoint; +class wxSize; +class wxRealPoint; + // Often this is not used in the prototypes, since wxFrame is good enough and would // represent maximum information hiding. @@ -64,6 +68,4 @@ wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller ); int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller ); */ - - #endif // INVOKE_A_DIALOG_H_ diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp index dc3c6b5e25..fb1b5f1035 100644 --- a/pcbnew/modedit.cpp +++ b/pcbnew/modedit.cpp @@ -728,7 +728,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_PCB_USER_GRID_SETUP: - InstallGridFrame( pos ); + InvokeDialogGrid(); break; case ID_POPUP_PLACE_BLOCK: diff --git a/pcbnew/tool_onrightclick.cpp b/pcbnew/tool_onrightclick.cpp index 0ec61d8d74..80ffdb7938 100644 --- a/pcbnew/tool_onrightclick.cpp +++ b/pcbnew/tool_onrightclick.cpp @@ -33,7 +33,6 @@ #include #include #include - #include @@ -71,7 +70,7 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event ) break; case ID_PCB_PLACE_GRID_COORD_BUTT: - InstallGridFrame( wxDefaultPosition ); + InvokeDialogGrid(); break; default: