KiCad PCB EDA Suite
Loading...
Searching...
No Matches
cleanup_item.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020-2022 KiCad Developers, see change_log.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may search the http://www.gnu.org website for the version 2 license,
20 * or you may write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22 */
23
24
25#include <cleanup_item.h>
26#include <pcb_base_frame.h>
27
28
30{
31 m_errorCode = aErrorCode;
32 m_errorTitle = GetErrorText( aErrorCode );
33}
34
35
36wxString CLEANUP_ITEM::GetErrorText( int aCode, bool aTranslate ) const
37{
38 wxString msg;
39
40 if( aCode < 0 )
41 aCode = m_errorCode;
42
43 switch( aCode )
44 {
45 // For cleanup tracks and vias:
46 case CLEANUP_SHORTING_TRACK: msg = _HKI( "Remove track shorting two nets" ); break;
47 case CLEANUP_SHORTING_VIA: msg = _HKI( "Remove via shorting two nets" ); break;
48 case CLEANUP_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break;
49 case CLEANUP_DUPLICATE_TRACK: msg = _HKI( "Remove duplicate track" ); break;
50 case CLEANUP_MERGE_TRACKS: msg = _HKI( "Merge co-linear tracks" ); break;
51 case CLEANUP_DANGLING_TRACK: msg = _HKI( "Remove track not connected at both ends" ); break;
52 case CLEANUP_DANGLING_VIA: msg = _HKI( "Remove via connected on less than 2 layers" ); break;
53 case CLEANUP_ZERO_LENGTH_TRACK: msg = _HKI( "Remove zero-length track" ); break;
54 case CLEANUP_TRACK_IN_PAD: msg = _HKI( "Remove track inside pad" ); break;
55
56 // For cleanup graphics:
57 case CLEANUP_NULL_GRAPHIC: msg = _HKI( "Remove zero-size graphic" ); break;
58 case CLEANUP_DUPLICATE_GRAPHIC: msg = _HKI( "Remove duplicated graphic" ); break;
59 case CLEANUP_LINES_TO_RECT: msg = _HKI( "Convert lines to rectangle" ); break;
60 case CLEANUP_MERGE_PAD: msg = _HKI( "Merge overlapping shapes into pad" ); break;
61
62 default:
63 wxFAIL_MSG( wxT( "Missing cleanup item description" ) );
64 msg = _HKI( "Unknown cleanup action" );
65 break;
66 }
67
68 if( aTranslate )
69 return wxGetTranslation( msg );
70 else
71 return msg;
72}
73
74
CLEANUP_ITEM(int aErrorCode)
int m_errorCode
The error code's numeric value.
Definition: rc_item.h:184
wxString GetErrorText() const
Definition: rc_item.h:166
wxString m_errorTitle
The string describing the type of error.
Definition: rc_item.h:186
@ CLEANUP_TRACK_IN_PAD
Definition: cleanup_item.h:42
@ CLEANUP_NULL_GRAPHIC
Definition: cleanup_item.h:43
@ CLEANUP_DANGLING_VIA
Definition: cleanup_item.h:40
@ CLEANUP_MERGE_TRACKS
Definition: cleanup_item.h:38
@ CLEANUP_DANGLING_TRACK
Definition: cleanup_item.h:39
@ CLEANUP_DUPLICATE_TRACK
Definition: cleanup_item.h:37
@ CLEANUP_MERGE_PAD
Definition: cleanup_item.h:46
@ CLEANUP_ZERO_LENGTH_TRACK
Definition: cleanup_item.h:41
@ CLEANUP_DUPLICATE_GRAPHIC
Definition: cleanup_item.h:44
@ CLEANUP_LINES_TO_RECT
Definition: cleanup_item.h:45
@ CLEANUP_SHORTING_VIA
Definition: cleanup_item.h:35
@ CLEANUP_REDUNDANT_VIA
Definition: cleanup_item.h:36
@ CLEANUP_SHORTING_TRACK
Definition: cleanup_item.h:34
#define _HKI(x)