From 1fb25193f78de4d21c64a24f545927fa31f3a06e Mon Sep 17 00:00:00 2001 From: CHARRAS Date: Sun, 6 Jan 2008 14:56:52 +0000 Subject: [PATCH] Block commands now works with zones. --- pcbnew/dialog_zones_by_polygon.cpp | 67 ++++++++++--- pcbnew/dialog_zones_by_polygon.h | 2 + pcbnew/dialog_zones_by_polygon.pjd | 154 ++++++++++++++++++++++++++++- pcbnew/edit.cpp | 1 + pcbnew/zones_by_polygon.cpp | 2 + 5 files changed, 213 insertions(+), 13 deletions(-) diff --git a/pcbnew/dialog_zones_by_polygon.cpp b/pcbnew/dialog_zones_by_polygon.cpp index 41db468485..202bcbc61a 100644 --- a/pcbnew/dialog_zones_by_polygon.cpp +++ b/pcbnew/dialog_zones_by_polygon.cpp @@ -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); - wxStaticText* itemStaticText21 = new wxStaticText( itemDialog1, wxID_STATIC, _("Net:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer20->Add(itemStaticText21, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 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* 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() ); } } diff --git a/pcbnew/dialog_zones_by_polygon.h b/pcbnew/dialog_zones_by_polygon.h index 21e213d154..3ee9b471ca 100644 --- a/pcbnew/dialog_zones_by_polygon.h +++ b/pcbnew/dialog_zones_by_polygon.h @@ -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 diff --git a/pcbnew/dialog_zones_by_polygon.pjd b/pcbnew/dialog_zones_by_polygon.pjd index 6aa04e9034..7123586e36 100644 --- a/pcbnew/dialog_zones_by_polygon.pjd +++ b/pcbnew/dialog_zones_by_polygon.pjd @@ -201,7 +201,7 @@ 0 1 - "Fill Zones Options" + "Zone Areas Options" "dialog-document" "" "dialog" @@ -1108,6 +1108,158 @@ "" "" + + "wxStaticText: wxID_STATIC" + "dialog-control-document" + "" + "statictext" + 0 + 1 + 0 + 0 + "6/1/2008" + "wbStaticTextProxy" + "wxID_STATIC" + 5105 + "" + "wxStaticText" + "wxStaticText" + 1 + 0 + "" + "" + "" + "Filter" + -1 + "" + "" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Left" + "Centre" + 0 + 5 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + "" + "" + + + "wxTextCtrl: ID_TEXTCTRL_NETNAMES_FILTER" + "dialog-control-document" + "" + "textctrl" + 0 + 1 + 0 + 0 + "6/1/2008" + "wbTextCtrlProxy" + "ID_TEXTCTRL_NETNAMES_FILTER" + 10010 + "" + "wxTextCtrl" + "wxTextCtrl" + 1 + 0 + "" + "" + "m_NetNameFilter" + "" + 0 + "" + "Do not list net names which match with this text, in advanced mode" + "" + "" + "" + 0 + 1 + "<Any platform>" + "" + "" + "" + "" + "" + "" + "" + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + "" + -1 + -1 + -1 + -1 + "Expand" + "Centre" + 0 + 5 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + "" + "" + diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index d4a54596c3..53cb37a260 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -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: diff --git a/pcbnew/zones_by_polygon.cpp b/pcbnew/zones_by_polygon.cpp index 9caacbf0fe..3cf6643cc5 100644 --- a/pcbnew/zones_by_polygon.cpp +++ b/pcbnew/zones_by_polygon.cpp @@ -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 ); }