Commit 1fb25193 authored by CHARRAS's avatar CHARRAS

Block commands now works with zones.

parent fba479cf
......@@ -77,7 +77,6 @@ WinEDA_ZoneFrame::WinEDA_ZoneFrame( WinEDA_PcbFrame* parent,
{
m_Parent = parent;
m_Zone_Container = zone_container;
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 );
......@@ -107,6 +106,7 @@ bool WinEDA_ZoneFrame::Create( wxWindow* parent,
m_FillOpt = NULL;
m_OrientEdgesOpt = NULL;
m_NetSortingOption = NULL;
m_NetNameFilter = NULL;
m_ListNetNameSelection = NULL;
m_LayerSelectionCtrl = NULL;
////@end WinEDA_ZoneFrame member initialisation
......@@ -136,7 +136,7 @@ void WinEDA_ZoneFrame::CreateControls()
SetFont( *g_DialogFont );
////@begin WinEDA_ZoneFrame content construction
// Generated by DialogBlocks, 29/12/2007 14:29:53 (unregistered)
// Generated by DialogBlocks, 06/01/2008 15:03:35 (unregistered)
WinEDA_ZoneFrame* itemDialog1 = this;
......@@ -214,22 +214,30 @@ void WinEDA_ZoneFrame::CreateControls()
m_NetSortingOption->SetSelection(0);
itemBoxSizer15->Add(m_NetSortingOption, 0, wxGROW|wxALL, 5);
wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer20, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText20 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filter"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer15->Add(itemStaticText20, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT, 5);
m_NetNameFilter = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_NETNAMES_FILTER, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
if (WinEDA_ZoneFrame::ShowToolTips())
m_NetNameFilter->SetToolTip(_("Do not list net names which match with this text, in advanced mode"));
itemBoxSizer15->Add(m_NetNameFilter, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxVERTICAL);
itemBoxSizer2->Add(itemBoxSizer22, 0, wxGROW|wxALL, 5);
wxStaticText* itemStaticText21 = new wxStaticText( itemDialog1, wxID_STATIC, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
wxStaticText* itemStaticText23 = new wxStaticText( itemDialog1, wxID_STATIC, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer22->Add(itemStaticText23, 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 );
itemBoxSizer20->Add(m_ListNetNameSelection, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
itemBoxSizer22->Add(m_ListNetNameSelection, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5);
wxStaticText* itemStaticText23 = new wxStaticText( itemDialog1, wxID_LAYER_SELECTION, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer20->Add(itemStaticText23, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
wxStaticText* itemStaticText25 = new wxStaticText( itemDialog1, wxID_LAYER_SELECTION, _("Layer:"), wxDefaultPosition, wxDefaultSize, 0 );
itemBoxSizer22->Add(itemStaticText25, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5);
wxArrayString m_LayerSelectionCtrlStrings;
m_LayerSelectionCtrl = new wxListBox( itemDialog1, ID_LAYER_CHOICE, wxDefaultPosition, wxDefaultSize, m_LayerSelectionCtrlStrings, wxLB_SINGLE );
itemBoxSizer20->Add(m_LayerSelectionCtrl, 0, wxGROW|wxALL, 5);
itemBoxSizer22->Add(m_LayerSelectionCtrl, 0, wxGROW|wxALL, 5);
// Set validators
m_NetSortingOption->SetValidator( wxGenericValidator(& m_NetSorting) );
......@@ -297,8 +305,6 @@ void WinEDA_ZoneFrame::CreateControls()
break;
}
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++ )
{
......@@ -312,16 +318,40 @@ void WinEDA_ZoneFrame::CreateControls()
msg = ReturnPcbLayerName( layer_number ).Trim();
m_LayerSelectionCtrl->InsertItems( 1, &msg, ii );
if ( m_Zone_Container )
{
if( m_Zone_Container->GetLayer() == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
else
{
if( m_Parent->GetScreen()->m_Active_Layer == layer_number )
m_LayerSelectionCtrl->SetSelection( ii );
}
}
m_NetSortingOption->SetSelection(m_NetSorting == BOARD::ALPHA_SORT ? 0 : 1 );
wxString NetNameFilter;
if( m_Parent->m_Parent->m_EDA_Config )
{
NetNameFilter = m_Parent->m_Parent->m_EDA_Config->Read( ZONE_NET_FILTER_STRING_KEY, wxT("N_0*") );
}
m_NetNameFilter->SetValue(NetNameFilter);
wxArrayString ListNetName;
m_Parent->m_Pcb->ReturnSortedNetnamesList( ListNetName,
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if ( m_NetSorting != 0 )
{
wxString Filter = m_NetNameFilter->GetValue();
for (unsigned ii = 0; ii < ListNetName.GetCount(); ii ++ )
{
if ( ListNetName[ii].Matches(Filter.GetData() ) )
{
ListNetName. RemoveAt(ii);
ii--;
}
}
}
m_ListNetNameSelection->InsertItems( ListNetName, 0 );
// Select net:
......@@ -500,11 +530,24 @@ void WinEDA_ZoneFrame::OnNetSortingOptionSelected( wxCommandEvent& event )
m_NetSorting = m_NetSortingOption->GetSelection();
m_Parent->m_Pcb->ReturnSortedNetnamesList( ListNetName,
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if ( m_NetSorting != 0 )
{
wxString Filter = m_NetNameFilter->GetValue();
for (unsigned ii = 0; ii < ListNetName.GetCount(); ii ++ )
{
if ( ListNetName[ii].Matches(Filter.GetData() ) )
{
ListNetName. RemoveAt(ii);
ii--;
}
}
}
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 );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_FILTER_STRING_KEY, m_NetNameFilter->GetValue() );
}
}
......
......@@ -45,6 +45,7 @@
#define ID_RADIOBOX4 10008
#define ID_RADIOBOX5 10009
#define ID_NET_SORTING_OPTION 10005
#define ID_TEXTCTRL_NETNAMES_FILTER 10010
#define ID_NETNAME_SELECTION 10001
#define wxID_LAYER_SELECTION 10004
#define ID_LAYER_CHOICE 10002
......@@ -126,6 +127,7 @@ public:
wxRadioBox* m_FillOpt;
wxRadioBox* m_OrientEdgesOpt;
wxRadioBox* m_NetSortingOption;
wxTextCtrl* m_NetNameFilter;
wxListBox* m_ListNetNameSelection;
wxListBox* m_LayerSelectionCtrl;
////@end WinEDA_ZoneFrame member variables
......
This diff is collapsed.
......@@ -447,6 +447,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_EDIT_ZONE_PARAMS:
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) GetCurItem() );
SetCurItem( NULL ); // Outlines can have changed
break;
case ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE:
......
......@@ -56,6 +56,7 @@ static ZONE_CONTAINER* s_CurrentZone; // if != NULL, t
// key used to store net sort option in config file :
#define ZONE_NET_SORT_OPTION_KEY wxT( "Zone_NetSort_Opt" )
#define ZONE_NET_FILTER_STRING_KEY wxT( "Zone_Filter_Opt" )
enum zone_cmd {
ZONE_ABORT,
......@@ -734,6 +735,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
for( unsigned ii = 0; ii < m_Pcb->m_ZoneDescriptorList.size(); ii++ )
{
ZONE_CONTAINER* edge_zone = m_Pcb->m_ZoneDescriptorList[ii];
edge_zone->m_Flags = 0;
edge_zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_OR );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment