KiCad PCB EDA Suite
dialog_board_reannotate.cpp File Reference
#include <algorithm>
#include <base_units.h>
#include <bitmaps.h>
#include <board_commit.h>
#include <confirm.h>
#include <ctype.h>
#include <dialog_board_reannotate.h>
#include <string_utils.h>
#include <kiface_base.h>
#include <pcbnew_settings.h>
#include <refdes_utils.h>
#include <tool/grid_menu.h>
#include <widgets/wx_html_report_panel.h>
#include <wx/valtext.h>

Go to the source code of this file.

Macros

#define SetSortCodes(DirArray, Code)
 

Functions

static bool ChangeArrayCompare (const RefDesChange &aA, const RefDesChange &aB)
 Compare function used to compare ChangeArray element for sort. More...
 
static bool ModuleCompare (const RefDesInfo &aA, const RefDesInfo &aB)
 Compare function to sort footprints. More...
 

Variables

bool SortYFirst
 
bool DescendingFirst
 
bool DescendingSecond
 
int FrontDirectionsArray []
 
int BackDirectionsArray []
 
wxString AnnotateString []
 
wxString ActionMessage []
 

Macro Definition Documentation

◆ SetSortCodes

#define SetSortCodes (   DirArray,
  Code 
)
Value:
{ \
SortYFirst = ( ( DirArray[Code] & SORTYFIRST ) != 0 ); \
DescendingFirst = ( ( DirArray[Code] & DESCENDINGFIRST ) != 0 ); \
DescendingSecond = ( ( DirArray[Code] & DESCENDINGSECOND ) != 0 ); \
}
#define DESCENDINGFIRST
#define DESCENDINGSECOND
#define SORTYFIRST

Definition at line 76 of file dialog_board_reannotate.cpp.

Function Documentation

◆ ChangeArrayCompare()

static bool ChangeArrayCompare ( const RefDesChange aA,
const RefDesChange aB 
)
static

Compare function used to compare ChangeArray element for sort.

Returns
true is A < B

Definition at line 444 of file dialog_board_reannotate.cpp.

445{
446 return ( StrNumCmp( aA.OldRefDesString, aB.OldRefDesString ) < 0 );
447}
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.

References RefDesChange::OldRefDesString, and StrNumCmp().

Referenced by DIALOG_BOARD_REANNOTATE::BuildFootprintList().

◆ ModuleCompare()

static bool ModuleCompare ( const RefDesInfo aA,
const RefDesInfo aB 
)
static

Compare function to sort footprints.

Returns
true if the first coordinate should be before the second coordinate

Definition at line 452 of file dialog_board_reannotate.cpp.

453{
454 int X0 = aA.roundedx, X1 = aB.roundedx, Y0 = aA.roundedy, Y1 = aB.roundedy;
455
456 if( SortYFirst ) //If sorting by Y then X, swap X and Y
457 {
458 std::swap( X0, Y0 );
459 std::swap( X1, Y1 );
460 }
461
462 // If descending, same compare just swap directions
463 if( DescendingFirst )
464 std::swap( X0, X1 );
465
466 if( DescendingSecond )
467 std::swap( Y0, Y1 );
468
469 if( X0 < X1 )
470 return ( true ); // yes, its smaller
471
472 if( X0 > X1 )
473 return ( false ); // No its not
474
475 if( Y0 < Y1 )
476 return ( true ); // same but equal
477
478 return ( false );
479}
bool DescendingSecond
bool DescendingFirst
bool SortYFirst

References DescendingFirst, DescendingSecond, RefDesInfo::roundedx, RefDesInfo::roundedy, and SortYFirst.

Referenced by DIALOG_BOARD_REANNOTATE::BuildFootprintList().

Variable Documentation

◆ ActionMessage

wxString ActionMessage[]
Initial value:
= {
"",
_( "Empty" ),
_( "Invalid" ),
_( "Excluded" )
}
#define _(s)

Definition at line 92 of file dialog_board_reannotate.cpp.

Referenced by DIALOG_BOARD_REANNOTATE::LogChangePlan().

◆ AnnotateString

wxString AnnotateString[]
Initial value:
= {
_( "All" ),
_( "Only front" ),
_( "Only back" ),
_( "Only selected" )
}

Definition at line 84 of file dialog_board_reannotate.cpp.

Referenced by DIALOG_BOARD_REANNOTATE::MakeSampleText().

◆ BackDirectionsArray

◆ DescendingFirst

bool DescendingFirst

Definition at line 43 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ DescendingSecond

bool DescendingSecond

Definition at line 44 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ FrontDirectionsArray

◆ SortYFirst

bool SortYFirst

Definition at line 42 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().