dialog information hiding, initial Fit()
This commit is contained in:
parent
8c2d3d12fc
commit
34e6314a3e
|
@ -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() );
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="name">DIALOG_PAD_PROPERTIES_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">745,725</property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||
<property name="title">Pad Properties</property>
|
||||
|
@ -268,8 +268,8 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="proportion">3</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_LeftBoxSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
|
@ -3821,11 +3821,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Parent footprint orientation</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -3833,11 +3833,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag"></property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<object class="wxFlexGridSizer" expanded="0">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
|
@ -4190,17 +4190,17 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="proportion">2</property>
|
||||
<object class="wxBoxSizer" expanded="0">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer10</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Drill</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -4208,11 +4208,11 @@
|
|||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxFlexGridSizer" expanded="1">
|
||||
<object class="wxFlexGridSizer" expanded="0">
|
||||
<property name="cols">3</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols">1</property>
|
||||
|
@ -4563,7 +4563,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -4820,7 +4820,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxLEFT|wxTOP</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxBOTTOM|wxEXPAND|wxLEFT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -4996,11 +4996,11 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<object class="wxStaticBoxSizer" expanded="0">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Layers</property>
|
||||
<property name="minimum_size"></property>
|
||||
|
@ -5102,7 +5102,7 @@
|
|||
</object>
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxChoice" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
|
@ -8233,7 +8233,7 @@
|
|||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxRIGHT|wxTOP|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<property name="proportion">4</property>
|
||||
<object class="wxPanel" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
|
|
@ -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();
|
||||
|
||||
};
|
||||
|
|
|
@ -26,81 +26,90 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <macros.h>
|
||||
#include <common.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <wxBasePcbFrame.h>
|
||||
#include <base_units.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <dialog_set_grid_base.h>
|
||||
#include <invoke_pcb_dialog.h>
|
||||
|
||||
|
||||
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 <class_drawpanel.h>
|
||||
#include <wxBasePcbFrame.h>
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -1327,7 +1327,7 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxLEFT|wxRIGHT|wxTOP</property>
|
||||
<property name="proportion">0</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxComboBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -1383,7 +1383,7 @@
|
|||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">Combo!</property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
@ -1501,7 +1501,7 @@
|
|||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxComboBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
|
@ -1557,7 +1557,7 @@
|
|||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="value">Combo!</property>
|
||||
<property name="value"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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_
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <wxPcbStruct.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <dialog_design_rules.h>
|
||||
|
||||
#include <pcbnew_id.h>
|
||||
|
||||
|
||||
|
@ -71,7 +70,7 @@ void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_PCB_PLACE_GRID_COORD_BUTT:
|
||||
InstallGridFrame( wxDefaultPosition );
|
||||
InvokeDialogGrid();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Reference in New Issue