KiCad PCB EDA Suite
dialog_board_reannotate.cpp File Reference
#include <base_units.h>
#include <bitmaps.h>
#include <board_commit.h>
#include <confirm.h>
#include <ctype.h>
#include <dialog_board_reannotate.h>
#include <fstream>
#include <kicad_string.h>
#include <kiface_i.h>
#include <mail_type.h>
#include <pcbnew_settings.h>
#include <sstream>
#include <tool/tool_manager.h>
#include <tool/grid_menu.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 SORTYFIRST
#define DESCENDINGSECOND
#define DESCENDINGFIRST

Definition at line 77 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 423 of file dialog_board_reannotate.cpp.

424 {
425  return ( StrNumCmp( aA.OldRefDesString, aB.OldRefDesString ) < 0 );
426 }
int StrNumCmp(const wxString &aString1, const wxString &aString2, bool aIgnoreCase)
Compare two strings with alphanumerical content.
Definition: string.cpp:507

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 431 of file dialog_board_reannotate.cpp.

432 {
433  int X0 = aA.roundedx, X1 = aB.roundedx, Y0 = aA.roundedy, Y1 = aB.roundedy;
434 
435  if( SortYFirst ) //If sorting by Y then X, swap X and Y
436  {
437  std::swap( X0, Y0 );
438  std::swap( X1, Y1 );
439  }
440 
441  // If descending, same compare just swap directions
442  if( DescendingFirst )
443  std::swap( X0, X1 );
444 
445  if( DescendingSecond )
446  std::swap( Y0, Y1 );
447 
448  if( X0 < X1 )
449  return ( true ); // yes, its smaller
450 
451  if( X0 > X1 )
452  return ( false ); // No its not
453 
454  if( Y0 < Y1 )
455  return ( true ); // same but equal
456 
457  return ( false );
458 }
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 93 of file dialog_board_reannotate.cpp.

Referenced by DIALOG_BOARD_REANNOTATE::LogChangePlan().

◆ AnnotateString

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

Definition at line 85 of file dialog_board_reannotate.cpp.

Referenced by DIALOG_BOARD_REANNOTATE::MakeSampleText().

◆ BackDirectionsArray

◆ DescendingFirst

bool DescendingFirst

Definition at line 44 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ DescendingSecond

bool DescendingSecond

Definition at line 45 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ FrontDirectionsArray

◆ SortYFirst

bool SortYFirst

Definition at line 43 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().