KiCad PCB EDA Suite
dialog_exchange_footprints.cpp File Reference
#include <fctsys.h>
#include <kicad_string.h>
#include <pcb_edit_frame.h>
#include <macros.h>
#include <board_commit.h>
#include <bitmaps.h>
#include <class_board.h>
#include <class_module.h>
#include <project.h>
#include <wx_html_report_panel.h>
#include <kiway.h>
#include <dialog_exchange_footprints.h>

Go to the source code of this file.

Macros

#define ID_MATCH_FP_ALL   4200
 
#define ID_MATCH_FP_SELECTED   4201
 
#define ID_MATCH_FP_REF   4202
 
#define ID_MATCH_FP_VAL   4203
 
#define ID_MATCH_FP_ID   4204
 

Functions

void processTextItem (const TEXTE_MODULE &aSrc, TEXTE_MODULE &aDest, bool resetText, bool resetTextLayers, bool resetTextEffects)
 
TEXTE_MODULEgetMatchingTextItem (TEXTE_MODULE *aRefItem, MODULE *aModule)
 

Variables

int g_matchModeForUpdate = ID_MATCH_FP_ALL
 
int g_matchModeForUpdateSelected = ID_MATCH_FP_SELECTED
 
int g_matchModeForExchange = ID_MATCH_FP_REF
 
int g_matchModeForExchangeSelected = ID_MATCH_FP_SELECTED
 

Macro Definition Documentation

◆ ID_MATCH_FP_ALL

#define ID_MATCH_FP_ALL   4200

Definition at line 41 of file dialog_exchange_footprints.cpp.

◆ ID_MATCH_FP_ID

#define ID_MATCH_FP_ID   4204

Definition at line 45 of file dialog_exchange_footprints.cpp.

◆ ID_MATCH_FP_REF

#define ID_MATCH_FP_REF   4202

Definition at line 43 of file dialog_exchange_footprints.cpp.

◆ ID_MATCH_FP_SELECTED

#define ID_MATCH_FP_SELECTED   4201

Definition at line 42 of file dialog_exchange_footprints.cpp.

◆ ID_MATCH_FP_VAL

#define ID_MATCH_FP_VAL   4203

Definition at line 44 of file dialog_exchange_footprints.cpp.

Function Documentation

◆ getMatchingTextItem()

TEXTE_MODULE* getMatchingTextItem ( TEXTE_MODULE aRefItem,
MODULE aModule 
)

Definition at line 386 of file dialog_exchange_footprints.cpp.

387 {
388  for( auto item : aModule->GraphicalItems() )
389  {
390  TEXTE_MODULE* candidate = dyn_cast<TEXTE_MODULE*>( item );
391 
392  if( candidate && candidate->GetText() == aRefItem->GetText() )
393  return candidate;
394  }
395 
396  return nullptr;
397 }
DRAWINGS & GraphicalItems()
Definition: class_module.h:173
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124

References EDA_TEXT::GetText(), and MODULE::GraphicalItems().

Referenced by PCB_EDIT_FRAME::Exchange_Module().

◆ processTextItem()

void processTextItem ( const TEXTE_MODULE aSrc,
TEXTE_MODULE aDest,
bool  resetText,
bool  resetTextLayers,
bool  resetTextEffects 
)

Definition at line 364 of file dialog_exchange_footprints.cpp.

366 {
367  if( !resetText )
368  aDest.SetText( aSrc.GetText() );
369 
370  if( !resetTextLayers )
371  {
372  aDest.SetLayer( aSrc.GetLayer() );
373  aDest.SetVisible( aSrc.IsVisible() );
374  }
375 
376  if( !resetTextEffects )
377  {
378  // Careful: the visible bit is also in Effects
379  bool visible = aDest.IsVisible();
380  aDest.SetEffects( aSrc );
381  aDest.SetVisible( visible );
382  }
383 }
virtual void SetLayer(PCB_LAYER_ID aLayer)
Function SetLayer sets the layer this item is on.
bool IsVisible() const
Definition: eda_text.h:170
void SetVisible(bool aVisible)
Definition: eda_text.h:169
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:112
void SetEffects(const TEXTE_MODULE &aSrc)
Function SetEffects sets the text effects from another instance.
virtual PCB_LAYER_ID GetLayer() const
Function GetLayer returns the primary layer this item is on.
virtual const wxString & GetText() const
Function GetText returns the string associated with the text object.
Definition: eda_text.h:124

References BOARD_ITEM::GetLayer(), EDA_TEXT::GetText(), EDA_TEXT::IsVisible(), TEXTE_MODULE::SetEffects(), BOARD_ITEM::SetLayer(), EDA_TEXT::SetText(), and EDA_TEXT::SetVisible().

Referenced by PCB_EDIT_FRAME::Exchange_Module().

Variable Documentation

◆ g_matchModeForExchange

int g_matchModeForExchange = ID_MATCH_FP_REF

◆ g_matchModeForExchangeSelected

int g_matchModeForExchangeSelected = ID_MATCH_FP_SELECTED

◆ g_matchModeForUpdate

int g_matchModeForUpdate = ID_MATCH_FP_ALL

◆ g_matchModeForUpdateSelected

int g_matchModeForUpdateSelected = ID_MATCH_FP_SELECTED