KiCad PCB EDA Suite
dialog_edit_components_libid.cpp File Reference

Dialog to remap library id of components to another library id. More...

#include <fctsys.h>
#include <confirm.h>
#include <sch_edit_frame.h>
#include <sch_draw_panel.h>
#include <sch_component.h>
#include <sch_reference_list.h>
#include <schematic.h>
#include <pgm_base.h>
#include <symbol_lib_table.h>
#include <trace_helpers.h>
#include <widgets/wx_grid.h>
#include <dialog_edit_components_libid_base.h>
#include <wx/tokenzr.h>
#include <grid_tricks.h>
#include <widgets/grid_text_button_helpers.h>

Go to the source code of this file.

Classes

class  GRIDCELL_AUTOWRAP_STRINGRENDERER
 
class  CMP_CANDIDATE
 
class  DIALOG_EDIT_COMPONENTS_LIBID
 Dialog to globally edit the LIB_ID of groups if components having the same initial LIB_ID. More...
 

Macros

#define COL_REFS   0
 
#define COL_CURR_LIBID   1
 
#define COL_NEW_LIBID   2
 
#define GRID_CELL_MARGIN   4
 

Functions

static bool sort_by_libid (const CMP_CANDIDATE &cmp1, const CMP_CANDIDATE &cmp2)
 
bool InvokeDialogEditComponentsLibId (SCH_EDIT_FRAME *aCaller)
 Run a dialog to modify the LIB_ID of components for instance when a symbol has moved from a symbol library to another symbol library. More...
 

Detailed Description

Dialog to remap library id of components to another library id.

Definition in file dialog_edit_components_libid.cpp.

Macro Definition Documentation

◆ COL_CURR_LIBID

#define COL_CURR_LIBID   1

Definition at line 49 of file dialog_edit_components_libid.cpp.

◆ COL_NEW_LIBID

#define COL_NEW_LIBID   2

Definition at line 50 of file dialog_edit_components_libid.cpp.

◆ COL_REFS

#define COL_REFS   0

Definition at line 48 of file dialog_edit_components_libid.cpp.

◆ GRID_CELL_MARGIN

#define GRID_CELL_MARGIN   4

Definition at line 241 of file dialog_edit_components_libid.cpp.

Function Documentation

◆ InvokeDialogEditComponentsLibId()

bool InvokeDialogEditComponentsLibId ( SCH_EDIT_FRAME aCaller)

Run a dialog to modify the LIB_ID of components for instance when a symbol has moved from a symbol library to another symbol library.

Returns
true if changes are made, false if no change

Definition at line 918 of file dialog_edit_components_libid.cpp.

919 {
920  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
921  // frame. Therefore this dialog as a modal frame parent, MUST be run under
922  // quasimodal mode for the quasimodal frame support to work. So don't use
923  // the QUASIMODAL macros here.
924  DIALOG_EDIT_COMPONENTS_LIBID dlg( aCaller );
925  // DO NOT use ShowModal() here, otherwise the library browser will not work
926  // properly.
927  dlg.ShowQuasiModal();
928 
929  return dlg.IsSchematicModified();
930 }
Dialog to globally edit the LIB_ID of groups if components having the same initial LIB_ID.

References DIALOG_EDIT_COMPONENTS_LIBID::IsSchematicModified(), and DIALOG_SHIM::ShowQuasiModal().

Referenced by SCH_EDITOR_CONTROL::EditSymbolLibraryLinks().

◆ sort_by_libid()

static bool sort_by_libid ( const CMP_CANDIDATE cmp1,
const CMP_CANDIDATE cmp2 
)
static

Definition at line 407 of file dialog_edit_components_libid.cpp.

408 {
409  if( cmp1.m_Component->GetLibId() == cmp2.m_Component->GetLibId() )
410  return cmp1.m_Reference.Cmp( cmp2.m_Reference ) < 0;
411 
412  return cmp1.m_Component->GetLibId() < cmp2.m_Component->GetLibId();
413 }
const LIB_ID & GetLibId() const

References SCH_COMPONENT::GetLibId(), CMP_CANDIDATE::m_Component, and CMP_CANDIDATE::m_Reference.

Referenced by DIALOG_EDIT_COMPONENTS_LIBID::initDlg().