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 The KiCad Developers, see AUTHORS.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, see <https://www.gnu.org/licenses/>.
18 */
19
20
21#include <cleanup_item.h>
22#include <pcb_base_frame.h>
23
24
26{
27 m_errorCode = aErrorCode;
28 m_errorTitle = GetErrorText( aErrorCode );
29}
30
31
32wxString CLEANUP_ITEM::GetErrorText( int aCode, bool aTranslate ) const
33{
34 wxString msg;
35
36 if( aCode < 0 )
37 aCode = m_errorCode;
38
39 switch( aCode )
40 {
41 // For cleanup tracks and vias:
42 case CLEANUP_SHORTING_TRACK: msg = _HKI( "Remove track shorting two nets" ); break;
43 case CLEANUP_SHORTING_VIA: msg = _HKI( "Remove via shorting two nets" ); break;
44 case CLEANUP_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break;
45 case CLEANUP_DUPLICATE_TRACK: msg = _HKI( "Remove duplicate track" ); break;
46 case CLEANUP_MERGE_TRACKS: msg = _HKI( "Merge co-linear tracks" ); break;
47 case CLEANUP_DANGLING_TRACK: msg = _HKI( "Remove track not connected at both ends" ); break;
48 case CLEANUP_DANGLING_VIA: msg = _HKI( "Remove via connected on less than 2 layers" ); break;
49 case CLEANUP_ZERO_LENGTH_TRACK: msg = _HKI( "Remove zero-length track" ); break;
50 case CLEANUP_TRACK_IN_PAD: msg = _HKI( "Remove track inside pad" ); break;
51
52 // For cleanup graphics:
53 case CLEANUP_NULL_GRAPHIC: msg = _HKI( "Remove zero-size graphic" ); break;
54 case CLEANUP_DUPLICATE_GRAPHIC: msg = _HKI( "Remove duplicated graphic" ); break;
55 case CLEANUP_LINES_TO_RECT: msg = _HKI( "Convert lines to rectangle" ); break;
56 case CLEANUP_MERGE_PAD: msg = _HKI( "Merge overlapping shapes into pad" ); break;
57
58 default:
59 wxFAIL_MSG( wxT( "Missing cleanup item description" ) );
60 msg = _HKI( "Unknown cleanup action" );
61 break;
62 }
63
64 if( aTranslate )
65 return wxGetTranslation( msg );
66 else
67 return msg;
68}
69
70
CLEANUP_ITEM(int aErrorCode)
wxString GetErrorText(int aErrorCode=-1, bool aTranslate=true) const
Return the string form of a drc error code.
int m_errorCode
The error code's numeric value.
Definition rc_item.h:203
wxString m_errorTitle
The string describing the type of error.
Definition rc_item.h:205
@ CLEANUP_TRACK_IN_PAD
@ CLEANUP_NULL_GRAPHIC
@ CLEANUP_DANGLING_VIA
@ CLEANUP_MERGE_TRACKS
@ CLEANUP_DANGLING_TRACK
@ CLEANUP_DUPLICATE_TRACK
@ CLEANUP_MERGE_PAD
@ CLEANUP_ZERO_LENGTH_TRACK
@ CLEANUP_DUPLICATE_GRAPHIC
@ CLEANUP_LINES_TO_RECT
@ CLEANUP_SHORTING_VIA
@ CLEANUP_REDUNDANT_VIA
@ CLEANUP_SHORTING_TRACK
#define _HKI(x)
Definition page_info.cpp:40