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 <sch_edit_frame.h>
#include <sch_draw_panel.h>
#include <sch_component.h>
#include <sch_reference_list.h>
#include <pgm_base.h>
#include <symbol_lib_table.h>
#include <widgets/wx_grid.h>
#include <dialog_edit_components_libid_base.h>
#include <wx/tokenzr.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_EDIT_COMPONENTS_LIBID is a 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   3
 

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

#define GRID_CELL_MARGIN   3

Function Documentation

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 872 of file dialog_edit_components_libid.cpp.

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

Referenced by SCH_EDIT_FRAME::OnEditComponentSymbolsId().

873 {
874  // This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
875  // frame. Therefore this dialog as a modal frame parent, MUST be run under
876  // quasimodal mode for the quasimodal frame support to work. So don't use
877  // the QUASIMODAL macros here.
878  DIALOG_EDIT_COMPONENTS_LIBID dlg( aCaller );
879  // DO NOT use ShowModal() here, otherwise the library browser will not work
880  // properly.
881  dlg.ShowQuasiModal();
882 
883  return dlg.IsSchematicModified();
884 }
DIALOG_EDIT_COMPONENTS_LIBID is a dialog to globally edit the LIB_ID of groups if components having t...
static bool sort_by_libid ( const CMP_CANDIDATE cmp1,
const CMP_CANDIDATE cmp2 
)
static

Definition at line 398 of file dialog_edit_components_libid.cpp.

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

Referenced by DIALOG_EDIT_COMPONENTS_LIBID::initDlg().

399 {
400  if( cmp1.m_Component->GetLibId() == cmp2.m_Component->GetLibId() )
401  return cmp1.m_Reference.Cmp( cmp2.m_Reference ) < 0;
402 
403  return cmp1.m_Component->GetLibId() < cmp2.m_Component->GetLibId();
404 }
const LIB_ID & GetLibId() const