Make via cleaning options clearer.

Fixes https://gitlab.com/kicad/code/kicad/issues/5253
This commit is contained in:
Jeff Young 2020-08-18 19:32:43 +01:00
parent c8917a0951
commit 01bf395cc2
12 changed files with 744 additions and 21 deletions

View File

@ -0,0 +1,217 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <macros.h>
#include <eda_draw_frame.h>
#include <kicad_string.h>
#include <dialog_helpers.h>
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
// Use default column widths instead.
static int DEFAULT_COL_WIDTHS[] = { 200, 600 };
EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemHeaders,
const std::vector<wxArrayString>& aItemList,
const wxString& aSelection ) :
EDA_LIST_DIALOG_BASE( aParent, wxID_ANY, aTitle )
{
m_itemsList = &aItemList;
m_filterBox->SetHint( _( "Filter" ) );
initDialog( aItemHeaders, aSelection );
// DIALOG_SHIM needs a unique hash_key because classname is not sufficient
// because so many dialogs share this same class, with different numbers of
// columns, different column names, and column widths.
m_hash_key = TO_UTF8( aTitle );
m_sdbSizerOK->SetDefault();
// this line fixes an issue on Linux Ubuntu using Unity (dialog not shown),
// and works fine on all systems
GetSizer()->Fit( this );
Centre();
}
void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, const wxString& aSelection )
{
for( unsigned i = 0; i < aItemHeaders.Count(); i++ )
{
m_listBox->InsertColumn( i, aItemHeaders.Item( i ),
wxLIST_FORMAT_LEFT, DEFAULT_COL_WIDTHS[ i ] );
}
InsertItems( *m_itemsList, 0 );
if( !aSelection.IsEmpty() )
{
long sel = m_listBox->FindItem( -1, aSelection );
if( sel != wxNOT_FOUND )
{
m_listBox->SetItemState( sel, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED );
// Set to a small size so EnsureVisible() won't be foiled by later additions.
// ListBox will expand to fit later.
m_listBox->SetSize( m_listBox->GetSize().GetX(), 100 );
m_listBox->EnsureVisible( sel );
}
}
}
void EDA_LIST_DIALOG::SetListLabel( const wxString& aLabel )
{
m_listLabel->SetLabel( aLabel );
m_listBox->SetSingleStyle( wxLC_NO_HEADER, true );
}
void EDA_LIST_DIALOG::SetOKLabel( const wxString& aLabel )
{
m_sdbSizerOK->SetLabel( aLabel );
}
void EDA_LIST_DIALOG::textChangeInFilterBox( wxCommandEvent& event )
{
wxString filter;
wxString itemName;
filter = wxT( "*" ) + m_filterBox->GetLineText( 0 ).MakeLower() + wxT( "*" );
m_listBox->DeleteAllItems();
for( const wxArrayString& row : *m_itemsList )
{
itemName = row.Item( 0 );
if( itemName.MakeLower().Matches( filter ) )
Append( row );
}
sortList();
}
wxString EDA_LIST_DIALOG::GetTextSelection( int aColumn )
{
wxCHECK_MSG( unsigned( aColumn ) < unsigned( m_listBox->GetColumnCount() ), wxEmptyString,
wxT( "Invalid list control column." ) );
long item = m_listBox->GetNextItem( -1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED );
if( item >= 0 ) // if something is selected.
{
wxListItem info;
info.m_mask = wxLIST_MASK_TEXT;
info.m_itemId = item;
info.m_col = aColumn;
if( m_listBox->GetItem( info ) )
return info.m_text;
}
return wxEmptyString;
}
void EDA_LIST_DIALOG::Append( const wxArrayString& itemList )
{
long itemIndex = m_listBox->InsertItem( m_listBox->GetItemCount(), itemList[0] );
m_listBox->SetItemPtrData( itemIndex, wxUIntPtr( &itemList[0] ) );
// Adding the next columns content
for( unsigned i = 1; i < itemList.size(); i++ )
m_listBox->SetItem( itemIndex, i, itemList[i] );
}
void EDA_LIST_DIALOG::InsertItems( const std::vector< wxArrayString >& itemList, int position )
{
for( unsigned row = 0; row < itemList.size(); row++ )
{
wxASSERT( (int) itemList[row].GetCount() == m_listBox->GetColumnCount() );
for( unsigned col = 0; col < itemList[row].GetCount(); col++ )
{
wxListItem info;
info.m_itemId = row + position;
info.m_col = col;
info.m_text = itemList[row].Item( col );
info.m_width = DEFAULT_COL_WIDTHS[ col ];
info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_WIDTH;
if( col == 0 )
{
info.m_data = wxUIntPtr( &itemList[row].Item( col ) );
info.m_mask |= wxLIST_MASK_DATA;
m_listBox->InsertItem( info );
}
else
{
m_listBox->SetItem( info );
}
}
}
sortList();
}
void EDA_LIST_DIALOG::onListItemActivated( wxListEvent& event )
{
EndModal( wxID_OK );
}
/* Sort alphabetically, case insensitive.
*/
static int wxCALLBACK myCompareFunction( wxIntPtr aItem1, wxIntPtr aItem2,
wxIntPtr WXUNUSED( aSortData ) )
{
wxString* component1Name = (wxString*) aItem1;
wxString* component2Name = (wxString*) aItem2;
return StrNumCmp( *component1Name, *component2Name, true );
}
void EDA_LIST_DIALOG::sortList()
{
m_listBox->SortItems( myCompareFunction, 0 );
}

View File

@ -0,0 +1,130 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EDA_VIEW_SWITCHER_H
#define EDA_VIEW_SWITCHER_H
#include <eda_view_switcher_base.h>
class EDA_DRAW_FRAME;
/**
* EDA_LIST_DIALOG
*
* A dialog which shows:
* a list of elements for selection,
* a text control to display help or info about the selected item.
* 2 buttons (OK and Cancel)
*
*/
class EDA_VIEW_SWITCHER : public EDA_VIEW_SWITCHER_BASE
{
public:
/**
* Constructor:
* @param aParent Pointer to the parent window.
* @param aTitle = The title shown on top.
* @param aItemHeaders an optional array containing the column header names for the dialog.
* @param aItemList = A wxArrayString of the list of elements.
* @param aRefText = An item name if an item must be preselected.
*/
EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitle,
const wxArrayString& aItemHeaders,
const std::vector<wxArrayString>& aItemList,
const wxString& aRefText );
// ~EDA_LIST_DIALOG() {}
void SetListLabel( const wxString& aLabel );
void SetOKLabel( const wxString& aLabel );
void Append( const wxArrayString& aItemStr );
void InsertItems( const std::vector<wxArrayString>& aItemList, int aPosition = 0 );
/**
* Function GetTextSelection
* return the selected text from \a aColumn in the wxListCtrl in the dialog.
*
* @param aColumn is the column to return the text from.
* @return a wxString object containing the selected text from \a aColumn.
*/
wxString GetTextSelection( int aColumn = 0 );
private:
void onListItemActivated( wxListEvent& event ) override;
void textChangeInFilterBox(wxCommandEvent& event) override;
void initDialog( const wxArrayString& aItemHeaders, const wxString& aSelection);
void sortList();
private:
const std::vector<wxArrayString>* m_itemsList;
};
/**************************************************************************/
/* Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in */
/* dialog boxes, */
/**************************************************************************/
class EDA_POSITION_CTRL
{
public:
EDA_UNITS m_UserUnit;
wxTextCtrl* m_FramePosX;
wxTextCtrl* m_FramePosY;
private:
wxStaticText* m_TextX, * m_TextY;
public:
EDA_POSITION_CTRL( wxWindow* parent, const wxString& title, const wxPoint& pos_to_edit,
EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
~EDA_POSITION_CTRL();
void Enable( bool x_win_on, bool y_win_on );
void SetValue( int x_value, int y_value );
wxPoint GetValue();
};
/*************************************************************
* Class to edit/enter a size (pair of values for X and Y size)
* ( INCHES or MM ) in dialog boxes
***************************************************************/
class EDA_SIZE_CTRL : public EDA_POSITION_CTRL
{
public:
EDA_SIZE_CTRL( wxWindow* parent, const wxString& title, const wxSize& size_to_edit,
EDA_UNITS user_unit, wxBoxSizer* BoxSizer );
~EDA_SIZE_CTRL() { }
wxSize GetValue();
};
#endif // EDA_VIEW_SWITCHER_H

View File

@ -0,0 +1,36 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "eda_view_switcher_base.h"
///////////////////////////////////////////////////////////////////////////
EDA_VIEW_SWITCHER_BASE::EDA_VIEW_SWITCHER_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bSizerMain;
bSizerMain = new wxBoxSizer( wxVERTICAL );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("View Preset Switcher"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizerMain->Add( m_staticText2, 0, wxALL, 5 );
m_listBox = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
bSizerMain->Add( m_listBox, 1, wxEXPAND, 5 );
this->SetSizer( bSizerMain );
this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH );
}
EDA_VIEW_SWITCHER_BASE::~EDA_VIEW_SWITCHER_BASE()
{
}

View File

@ -0,0 +1,282 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="15" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
<property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property>
<property name="disconnect_php_events">0</property>
<property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">eda_list_dialog_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="indent_with_spaces"></property>
<property name="internationalize">1</property>
<property name="name">eda_list_dialog_base</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">0</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
<property name="aui_managed">0</property>
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
<property name="bg"></property>
<property name="center">wxBOTH</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="enabled">1</property>
<property name="event_handler">decl_pure_virtual</property>
<property name="extra_style"></property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">EDA_LIST_DIALOG_BASE</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerMain</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMargins</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Items:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_listLabel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">3</property>
<object class="wxListCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size">-1,200</property>
<property name="moveable">1</property>
<property name="name">m_listBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VRULES</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxALWAYS_SHOW_SB|wxBORDER_SIMPLE|wxVSCROLL</property>
<event name="OnListItemActivated">onListItemActivated</event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_filterBox</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnText">textChangeInFilterBox</event>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
</object>
</object>
</object>
</object>
</object>
</wxFormBuilder_Project>

View File

@ -0,0 +1,44 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#pragma once
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/listbox.h>
#include <wx/sizer.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class EDA_VIEW_SWITCHER_BASE
///////////////////////////////////////////////////////////////////////////////
class EDA_VIEW_SWITCHER_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_staticText2;
wxListBox* m_listBox;
public:
EDA_VIEW_SWITCHER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("View Preset Switcher"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxSTAY_ON_TOP );
~EDA_VIEW_SWITCHER_BASE();
};

View File

@ -44,12 +44,13 @@ wxString CLEANUP_ITEM::GetErrorText( int aCode, bool aTranslate ) const
switch( aCode )
{
// For cleanup tracks and vias:
case CLEANUP_SHORT: msg = _HKI( "Remove track shorting two nets" ); break;
case CLEANUP_SHORTING_TRACK: msg = _HKI( "Remove track shorting two nets" ); break;
case CLEANUP_SHORTING_VIA: msg = _HKI( "Remove via shorting two nets" ); break;
case CLEANUP_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break;
case CLEANUP_DUPLICATE_TRACK: msg = _HKI( "Remove duplicate track" ); break;
case CLEANUP_MERGE_TRACKS: msg = _HKI( "Merge co-linear tracks" ); break;
case CLEANUP_DANGLING_TRACK: msg = _HKI( "Remove dangling track" ); break;
case CLEANUP_DANGLING_VIA: msg = _HKI( "Remove dangling via" ); break;
case CLEANUP_DANGLING_TRACK: msg = _HKI( "Remove track not connected at both ends" ); break;
case CLEANUP_DANGLING_VIA: msg = _HKI( "Remove via connected on fewer than two layers" ); break;
case CLEANUP_ZERO_LENGTH_TRACK: msg = _HKI( "Remove zero-length track" ); break;
case CLEANUP_TRACK_IN_PAD: msg = _HKI( "Remove track inside pad" ); break;

View File

@ -32,7 +32,8 @@ class PCB_BASE_FRAME;
enum CLEANUP_RC_CODE {
CLEANUP_FIRST = DRCE_LAST + 1,
CLEANUP_SHORT = CLEANUP_FIRST,
CLEANUP_SHORTING_TRACK = CLEANUP_FIRST,
CLEANUP_SHORTING_VIA,
CLEANUP_REDUNDANT_VIA,
CLEANUP_DUPLICATE_TRACK,
CLEANUP_MERGE_TRACKS,

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -27,15 +27,15 @@ DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE::DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( wxWind
m_cleanViasOpt = new wxCheckBox( this, wxID_ANY, _("&Delete redundant vias"), wxDefaultPosition, wxDefaultSize, 0 );
m_cleanViasOpt->SetToolTip( _("remove vias on through hole pads and superimposed vias") );
bSizerUpper->Add( m_cleanViasOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerUpper->Add( m_cleanViasOpt, 0, wxALL, 5 );
m_deleteDanglingViasOpt = new wxCheckBox( this, wxID_ANY, _("Delete vias connected only on one layer"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerUpper->Add( m_deleteDanglingViasOpt, 0, wxALL, 5 );
m_deleteDanglingViasOpt = new wxCheckBox( this, wxID_ANY, _("Delete vias connected on only one layer"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerUpper->Add( m_deleteDanglingViasOpt, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_mergeSegmOpt = new wxCheckBox( this, wxID_ANY, _("&Merge co-linear tracks"), wxDefaultPosition, wxDefaultSize, 0 );
m_mergeSegmOpt->SetToolTip( _("merge aligned track segments, and remove null segments") );
bSizerUpper->Add( m_mergeSegmOpt, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
bSizerUpper->Add( m_mergeSegmOpt, 0, wxALL, 5 );
m_deleteUnconnectedOpt = new wxCheckBox( this, wxID_ANY, _("Delete tracks unconnected at one end"), wxDefaultPosition, wxDefaultSize, 0 );
m_deleteUnconnectedOpt->SetToolTip( _("delete tracks having at least one dangling end") );

View File

@ -134,7 +134,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
@ -199,7 +199,7 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -230,7 +230,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Delete vias connected only on one layer</property>
<property name="label">Delete vias connected on only one layer</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
@ -264,7 +264,7 @@
</object>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.9.0 Jul 27 2020)
// C++ code generated with wxFormBuilder (version Oct 26 2018)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!

View File

@ -75,7 +75,7 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
deleteNullSegments( m_brd->Tracks() );
if( aRemoveMisConnected )
removeBadTrackSegments();
removeShortingTrackSegments();
if( aDeleteTracksinPad )
deleteTracksInPads();
@ -97,7 +97,7 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
}
void TRACKS_CLEANER::removeBadTrackSegments()
void TRACKS_CLEANER::removeShortingTrackSegments()
{
std::shared_ptr<CONNECTIVITY_DATA> connectivity = m_brd->GetConnectivity();
@ -109,7 +109,13 @@ void TRACKS_CLEANER::removeBadTrackSegments()
{
if( segment->GetNetCode() != testedPad->GetNetCode() )
{
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_SHORT ) );
std::shared_ptr<CLEANUP_ITEM> item;
if( segment->Type() == PCB_VIA_T )
item = std::make_shared<CLEANUP_ITEM>( CLEANUP_SHORTING_VIA );
else
item = std::make_shared<CLEANUP_ITEM>( CLEANUP_SHORTING_TRACK );
item->SetItems( segment );
m_itemsList->push_back( item );
@ -121,7 +127,13 @@ void TRACKS_CLEANER::removeBadTrackSegments()
{
if( segment->GetNetCode() != testedTrack->GetNetCode() )
{
std::shared_ptr<CLEANUP_ITEM> item( new CLEANUP_ITEM( CLEANUP_SHORT ) );
std::shared_ptr<CLEANUP_ITEM> item;
if( segment->Type() == PCB_VIA_T )
item = std::make_shared<CLEANUP_ITEM>( CLEANUP_SHORTING_VIA );
else
item = std::make_shared<CLEANUP_ITEM>( CLEANUP_SHORTING_TRACK );
item->SetItems( segment );
m_itemsList->push_back( item );
@ -142,8 +154,8 @@ void TRACKS_CLEANER::cleanupVias()
for( TRACK* track : m_brd->Tracks() )
{
if( auto via = dyn_cast<VIA*>( track ) )
vias.push_back( via );
if( track->Type() == PCB_VIA_T )
vias.push_back( static_cast<VIA*>( track ) );
}
for( auto via1_it = vias.begin(); via1_it != vias.end(); via1_it++ )

View File

@ -55,7 +55,7 @@ private:
/*
* Removes track segments which are connected to more than one net (short circuits).
*/
void removeBadTrackSegments();
void removeShortingTrackSegments();
/**
* Removes redundant vias like vias at same location or on pad through.