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 <fstream>
#include <string_utils.h>
#include <kiface_base.h>
#include <mail_type.h>
#include <pcbnew_settings.h>
#include <refdes_utils.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 79 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 455 of file dialog_board_reannotate.cpp.

456 {
457  return ( StrNumCmp( aA.OldRefDesString, aB.OldRefDesString ) < 0 );
458 }
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 463 of file dialog_board_reannotate.cpp.

464 {
465  int X0 = aA.roundedx, X1 = aB.roundedx, Y0 = aA.roundedy, Y1 = aB.roundedy;
466 
467  if( SortYFirst ) //If sorting by Y then X, swap X and Y
468  {
469  std::swap( X0, Y0 );
470  std::swap( X1, Y1 );
471  }
472 
473  // If descending, same compare just swap directions
474  if( DescendingFirst )
475  std::swap( X0, X1 );
476 
477  if( DescendingSecond )
478  std::swap( Y0, Y1 );
479 
480  if( X0 < X1 )
481  return ( true ); // yes, its smaller
482 
483  if( X0 > X1 )
484  return ( false ); // No its not
485 
486  if( Y0 < Y1 )
487  return ( true ); // same but equal
488 
489  return ( false );
490 }
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 95 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 87 of file dialog_board_reannotate.cpp.

Referenced by DIALOG_BOARD_REANNOTATE::MakeSampleText().

◆ BackDirectionsArray

◆ DescendingFirst

bool DescendingFirst

Definition at line 46 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ DescendingSecond

bool DescendingSecond

Definition at line 47 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().

◆ FrontDirectionsArray

◆ SortYFirst

bool SortYFirst

Definition at line 45 of file dialog_board_reannotate.cpp.

Referenced by ModuleCompare().