@ -48,7 +48,7 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_ZoneFrame, wxDialog )
BEGIN_EVENT_TABLE ( WinEDA_ZoneFrame , wxDialog )
////@begin WinEDA_ZoneFrame event table entries
EVT_BUTTON ( ID_BUTTON , WinEDA_ZoneFrame : : ExecFillZone )
EVT_BUTTON ( wxID_OK , WinEDA_ZoneFrame : : OnOkClick )
EVT_BUTTON ( wxID_CANCEL , WinEDA_ZoneFrame : : OnCancelClick )
@ -75,7 +75,14 @@ WinEDA_ZoneFrame::WinEDA_ZoneFrame( WinEDA_PcbFrame* parent,
long style )
{
m_Parent = parent ;
if ( m_Parent - > m_Parent - > m_EDA_Config )
{
m_NetSorting = m_Parent - > m_Parent - > m_EDA_Config - > Read ( ZONE_NET_SORT_OPTION_KEY , ( long ) BOARD : : PAD_CNT_SORT ) ;
}
Create ( parent , id , caption , pos , size , style ) ;
SetReturnCode ( ZONE_ABORT ) ; // Will be changed on buttons click
}
@ -91,16 +98,18 @@ bool WinEDA_ZoneFrame::Create( wxWindow* parent,
long style )
{
////@begin WinEDA_ZoneFrame member initialisation
m_OutlinesOpt = 0 ;
m_GridCtrl = NULL ;
m_ClearanceValueTitle = NULL ;
m_ZoneClearanceCtrl = NULL ;
m_OutlineAppearanceCtrl = NULL ;
m_FillOpt = NULL ;
m_OrientEdgesOpt = NULL ;
m_NetSortingOption = NULL ;
m_ListNetNameSelection = NULL ;
m_LayerSelectionCtrl = NULL ;
////@end WinEDA_ZoneFrame member initialisation
////@begin WinEDA_ZoneFrame creation
SetExtraStyle ( wxWS_EX_BLOCK_EVENTS ) ;
wxDialog : : Create ( parent , id , caption , pos , size , style ) ;
@ -126,7 +135,7 @@ void WinEDA_ZoneFrame::CreateControls()
SetFont ( * g_DialogFont ) ;
////@begin WinEDA_ZoneFrame content construction
// Generated by DialogBlocks, 17/12/2007 20:46:19 (unregistered)
// Generated by DialogBlocks, 20/12/2007 15:46:22 (unregistered)
WinEDA_ZoneFrame * itemDialog1 = this ;
@ -143,8 +152,7 @@ void WinEDA_ZoneFrame::CreateControls()
m_GridCtrlStrings . Add ( _ ( " 0.00000 " ) ) ;
m_GridCtrlStrings . Add ( _ ( " 0.00000 " ) ) ;
m_GridCtrlStrings . Add ( _ ( " 0.00000 " ) ) ;
m_GridCtrlStrings . Add ( _ ( " 0.00000 " ) ) ;
m_GridCtrl = new wxRadioBox ( itemDialog1 , ID_RADIOBOX3 , _ ( " Grid Size for Filling: " ) , wxDefaultPosition , wxDefaultSize , m_GridCtrlStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_GridCtrl = new wxRadioBox ( itemDialog1 , ID_RADIOBOX_GRID_SELECTION , _ ( " Grid Size for Filling: " ) , wxDefaultPosition , wxDefaultSize , m_GridCtrlStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_GridCtrl - > SetSelection ( 0 ) ;
itemBoxSizer4 - > Add ( m_GridCtrl , 0 , wxGROW | wxALL , 5 ) ;
@ -154,10 +162,18 @@ void WinEDA_ZoneFrame::CreateControls()
m_ZoneClearanceCtrl = new wxTextCtrl ( itemDialog1 , ID_TEXTCTRL1 , _T ( " " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer4 - > Add ( m_ZoneClearanceCtrl , 0 , wxGROW | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
wxArrayString m_OutlineAppearanceCtrlStrings ;
m_OutlineAppearanceCtrlStrings . Add ( _ ( " Line " ) ) ;
m_OutlineAppearanceCtrlStrings . Add ( _ ( " Hatched Outline " ) ) ;
m_OutlineAppearanceCtrlStrings . Add ( _ ( " Full Hatched " ) ) ;
m_OutlineAppearanceCtrl = new wxRadioBox ( itemDialog1 , ID_RADIOBOX_OUTLINES_OPTION , _ ( " Outlines Appearance " ) , wxDefaultPosition , wxDefaultSize , m_OutlineAppearanceCtrlStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_OutlineAppearanceCtrl - > SetSelection ( 0 ) ;
itemBoxSizer4 - > Add ( m_OutlineAppearanceCtrl , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer3 - > Add ( 5 , 5 , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer9 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer3 - > Add ( itemBoxSizer9 , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer10 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer3 - > Add ( itemBoxSizer10 , 0 , wxGROW | wxALL , 5 ) ;
wxArrayString m_FillOptStrings ;
m_FillOptStrings . Add ( _ ( " Include Pads " ) ) ;
@ -165,57 +181,58 @@ void WinEDA_ZoneFrame::CreateControls()
m_FillOptStrings . Add ( _ ( " Exclude Pads " ) ) ;
m_FillOpt = new wxRadioBox ( itemDialog1 , ID_RADIOBOX4 , _ ( " Pad options: " ) , wxDefaultPosition , wxDefaultSize , m_FillOptStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_FillOpt - > SetSelection ( 0 ) ;
itemBoxSizer9 - > Add ( m_FillOpt , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer10 - > Add ( m_FillOpt , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer10 - > Add ( 5 , 5 , 1 , wxGROW | wxALL , 5 ) ;
wxArrayString m_OrientEdgesOptStrings ;
m_OrientEdgesOptStrings . Add ( _ ( " Any " ) ) ;
m_OrientEdgesOptStrings . Add ( _ ( " H , V and 45 deg " ) ) ;
m_OrientEdgesOpt = new wxRadioBox ( itemDialog1 , ID_RADIOBOX5 , _ ( " Zone edges orient: " ) , wxDefaultPosition , wxDefaultSize , m_OrientEdgesOptStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_OrientEdgesOpt - > SetSelection ( 0 ) ;
itemBoxSizer9 - > Add ( m_OrientEdgesOpt , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer10 - > Add ( m_OrientEdgesOpt , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer3 - > Add ( 5 , 5 , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer13 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer3 - > Add ( itemBoxSizer13 , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer15 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer3 - > Add ( itemBoxSizer15 , 0 , wxGROW | wxALL , 5 ) ;
wxButton * itemButton14 = new wxButton ( itemDialog1 , ID_BUTTON , _ ( " Fill " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemButton14 - > SetDefault ( ) ;
itemButton14 - > SetForegroundColour ( wxColour ( 204 , 0 , 0 ) ) ;
itemBoxSizer13 - > Add ( itemButton14 , 0 , wxGROW | wxALL , 5 ) ;
wxButton * itemButton16 = new wxButton ( itemDialog1 , wxID_OK , _ ( " OK " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer15 - > Add ( itemButton16 , 0 , wxGROW | wxALL , 5 ) ;
wxButton * itemButton15 = new wxButton ( itemDialog1 , wxID_CANCEL , _ ( " &Cancel " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemButton15 - > SetForegroundColour ( wxColour ( 0 , 0 , 255 ) ) ;
itemBoxSizer13 - > Add ( itemButton15 , 0 , wxGROW | wxALL , 5 ) ;
wxButton * itemButton17 = new wxButton ( itemDialog1 , wxID_CANCEL , _ ( " &Cancel " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemButton17 - > SetForegroundColour ( wxColour ( 0 , 0 , 255 ) ) ;
itemBoxSizer15 - > Add ( itemButton17 , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer13 - > Add ( 5 , 5 , 1 , wxGROW | wxALL , 5 ) ;
itemBoxSizer15 - > Add ( 5 , 5 , 1 , wxGROW | wxALL , 5 ) ;
wxArrayString m_NetSortingOptionStrings ;
m_NetSortingOptionStrings . Add ( _ ( " Alphabetic " ) ) ;
m_NetSortingOptionStrings . Add ( _ ( " Advanced " ) ) ;
m_NetSortingOption = new wxRadioBox ( itemDialog1 , ID_NET_SORTING_OPTION , _ ( " Net sorting: " ) , wxDefaultPosition , wxDefaultSize , m_NetSortingOptionStrings , 1 , wxRA_SPECIFY_COLS ) ;
m_NetSortingOption - > SetSelection ( 0 ) ;
itemBoxSizer13 - > Add ( m_NetSortingOption , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer15 - > Add ( m_NetSortingOption , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer18 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer2 - > Add ( itemBoxSizer18 , 0 , wxGROW | wxALL , 5 ) ;
wxBoxSizer * itemBoxSizer20 = new wxBoxSizer ( wxVERTICAL ) ;
itemBoxSizer2 - > Add ( itemBoxSizer20 , 0 , wxGROW | wxALL , 5 ) ;
wxStaticText * itemStaticText19 = new wxStaticText ( itemDialog1 , wxID_STATIC , _ ( " Net: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer18 - > Add ( itemStaticText19 , 0 , wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
wxStaticText * itemStaticText2 1 = new wxStaticText ( itemDialog1 , wxID_STATIC , _ ( " Net: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer20 - > Add ( itemStaticText2 1 , 0 , wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
wxArrayString m_ListNetNameSelectionStrings ;
m_ListNetNameSelection = new wxListBox ( itemDialog1 , ID_NETNAME_SELECTION , wxDefaultPosition , wxDefaultSize , m_ListNetNameSelectionStrings , wxLB_SINGLE | wxSUNKEN_BORDER ) ;
itemBoxSizer18 - > Add ( m_ListNetNameSelection , 0 , wxGROW | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
itemBoxSizer20 - > Add ( m_ListNetNameSelection , 0 , wxGROW | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
wxStaticText * itemStaticText21 = new wxStaticText ( itemDialog1 , wxID_LAYER_SELECTION , _ ( " Layer: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer18 - > Add ( itemStaticText21 , 0 , wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
wxStaticText * itemStaticText23 = new wxStaticText ( itemDialog1 , wxID_LAYER_SELECTION , _ ( " Layer: " ) , wxDefaultPosition , wxDefaultSize , 0 ) ;
itemBoxSizer20 - > Add ( itemStaticText23 , 0 , wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP , 5 ) ;
wxArrayString m_LayerSelectionCtrlStrings ;
m_LayerSelectionCtrl = new wxListBox ( itemDialog1 , ID_LAYER_CHOICE , wxDefaultPosition , wxDefaultSize , m_LayerSelectionCtrlStrings , wxLB_SINGLE ) ;
itemBoxSizer18 - > Add ( m_LayerSelectionCtrl , 0 , wxGROW | wxALL , 5 ) ;
itemBoxSizer20 - > Add ( m_LayerSelectionCtrl , 0 , wxGROW | wxALL , 5 ) ;
// Set validators
m_NetSortingOption - > SetValidator ( wxGenericValidator ( & s_NetSortingOpt ) ) ;
m_OutlineAppearanceCtrl - > SetValidator ( wxGenericValidator ( & m_OutlinesOpt ) ) ;
m_NetSortingOption - > SetValidator ( wxGenericValidator ( & m_NetSorting ) ) ;
////@end WinEDA_ZoneFrame content construction
wxString title = _ ( " Zone clearance value: " ) + ReturnUnitSymbol ( g_UnitMetric ) ;
m_ClearanceValueTitle - > SetLabel ( title ) ;
@ -233,7 +250,7 @@ void WinEDA_ZoneFrame::CreateControls()
if ( Zone_45_Only )
m_OrientEdgesOpt - > SetSelection ( 1 ) ;
static const int GridList [ 4 ] = { 50 , 100 , 250 , 500 } ;
static const int GridList [ 4 ] = { 50 , 100 , 250 } ;
int selection = 0 ;
for ( unsigned ii = 0 ; ii < ( unsigned ) m_GridCtrl - > GetCount ( ) ; ii + + )
@ -257,7 +274,7 @@ void WinEDA_ZoneFrame::CreateControls()
m_FillOpt - > SetSelection ( 2 ) ;
}
m_NetSortingOption - > SetSelection ( s_NetSortingOpt = = 0 ? : 1 ) ;
m_NetSortingOption - > SetSelection ( m_NetSorting = = 0 ? 0 : 1 ) ;
int layer_cnt = g_DesignSettings . m_CopperLayerCount ;
for ( int ii = 0 ; ii < g_DesignSettings . m_CopperLayerCount ; ii + + )
@ -277,7 +294,7 @@ void WinEDA_ZoneFrame::CreateControls()
wxArrayString ListNetName ;
m_Parent - > m_Pcb - > ReturnSortedNetnamesList ( ListNetName ,
s_NetSortingOpt = = 0 ? BOARD : : ALPHA_SORT : BOARD : : PAD_CNT_SORT ) ;
m_NetSorting = = 0 ? BOARD : : ALPHA_SORT : BOARD : : PAD_CNT_SORT ) ;
m_ListNetNameSelection - > InsertItems ( ListNetName , 0 ) ;
// Select net:
@ -343,19 +360,16 @@ wxIcon WinEDA_ZoneFrame::GetIconResource( const wxString& name )
void WinEDA_ZoneFrame : : OnCancelClick ( wxCommandEvent & event )
{
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_ZoneFrame.
// Before editing this code, remove the block markers.
event . Skip ( ) ;
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_ZoneFrame.
EndModal ( ZONE_ABORT ) ;
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2
/**********************************************************/
bool WinEDA_ZoneFrame : : AcceptOptions ( bool aPromptForErrors )
/**********************************************************/
/** Function WinEDA_ZoneFrame::AcceptOptions(
* @ return false if incorrect options , true if Ok .
*/
/***********************************************************/
void WinEDA_ZoneFrame : : ExecFillZone ( wxCommandEvent & event )
/***********************************************************/
{
switch ( m_FillOpt - > GetSelection ( ) )
{
@ -385,13 +399,10 @@ void WinEDA_ZoneFrame::ExecFillZone( wxCommandEvent& event )
g_GridRoutingSize = 100 ;
break ;
default :
case 2 :
g_GridRoutingSize = 250 ;
break ;
case 3 :
g_GridRoutingSize = 500 ;
break ;
}
wxString txtvalue = m_ZoneClearanceCtrl - > GetValue ( ) ;
@ -404,19 +415,19 @@ void WinEDA_ZoneFrame::ExecFillZone( wxCommandEvent& event )
/* Get the layer selection for this zone */
int ii = m_LayerSelectionCtrl - > GetSelection ( ) ;
if ( ii < 0 )
if ( ii < 0 & & aPromptForErrors )
{
DisplayError ( this , _ ( " Error : you must choose a layer " ) ) ;
return ;
return false ;
}
s_Zone_Layer = m_LayerId [ ii ] ;
/* Get the net name selection for this zone */
ii = m_ListNetNameSelection - > GetSelection ( ) ;
if ( ii < 0 )
if ( ii < 0 & & aPromptForErrors )
{
DisplayError ( this , _ ( " Error : you must choose a net name " ) ) ;
return ;
return false ;
}
wxString net_name = m_ListNetNameSelection - > GetString ( ii ) ;
@ -432,8 +443,8 @@ void WinEDA_ZoneFrame::ExecFillZone( wxCommandEvent& event )
break ;
}
}
EndModal ( 0 ) ;
return true ;
}
@ -444,10 +455,26 @@ void WinEDA_ZoneFrame::ExecFillZone( wxCommandEvent& event )
void WinEDA_ZoneFrame : : OnNetSortingOptionSelected ( wxCommandEvent & event )
{
wxArrayString ListNetName ;
s_NetSortingOpt = m_NetSortingOption - > GetSelection ( ) ;
m_NetSorting = m_NetSortingOption - > GetSelection ( ) ;
m_Parent - > m_Pcb - > ReturnSortedNetnamesList ( ListNetName ,
s_NetSortingOpt = = 0 ? BOARD : : ALPHA_SORT : BOARD : : PAD_CNT_SORT ) ;
m_NetSorting = = 0 ? BOARD : : ALPHA_SORT : BOARD : : PAD_CNT_SORT ) ;
m_ListNetNameSelection - > Clear ( ) ;
m_ListNetNameSelection - > InsertItems ( ListNetName , 0 ) ;
if ( m_Parent - > m_Parent - > m_EDA_Config )
{
m_Parent - > m_Parent - > m_EDA_Config - > Write ( ZONE_NET_SORT_OPTION_KEY , ( long ) m_NetSorting ) ;
}
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/
void WinEDA_ZoneFrame : : OnOkClick ( wxCommandEvent & event )
{
if ( AcceptOptions ( true ) )
EndModal ( ZONE_OK ) ;
}