KiCad PCB EDA Suite
sch_component.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <kicad_string.h>
#include <sch_edit_frame.h>
#include <plotter.h>
#include <msgpanel.h>
#include <bitmaps.h>
#include <general.h>
#include <lib_rectangle.h>
#include <lib_pin.h>
#include <lib_text.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <sch_sheet_path.h>
#include <schematic.h>
#include <netlist_object.h>
#include <lib_item.h>
#include <dialogs/dialog_schematic_find.h>
#include <wx/tokenzr.h>
#include <iostream>
#include <cctype>
#include <eeschema_id.h>
#include <trace_helpers.h>

Go to the source code of this file.

Functions

std::string toUTFTildaText (const wxString &txt)
 Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is one of the first ASCII values up to ' ' 32d. More...
 
static LIB_PARTdummy ()
 Used to draw a dummy shape when a LIB_PART is not found in library. More...
 

Function Documentation

◆ dummy()

static LIB_PART* dummy ( )
static

Used to draw a dummy shape when a LIB_PART is not found in library.

This component is a 400 mils square with the text ?? DEF DUMMY U 0 40 Y Y 1 0 N F0 "U" 0 -350 60 H V F1 "DUMMY" 0 350 60 H V DRAW T 0 0 0 150 0 0 0 ?? S -200 200 200 -200 0 1 0 ENDDRAW ENDDEF

Definition at line 85 of file sch_component.cpp.

86 {
87  static LIB_PART* part;
88 
89  if( !part )
90  {
91  part = new LIB_PART( wxEmptyString );
92 
93  LIB_RECTANGLE* square = new LIB_RECTANGLE( part );
94 
95  square->MoveTo( wxPoint( Mils2iu( -200 ), Mils2iu( 200 ) ) );
96  square->SetEndPosition( wxPoint( Mils2iu( 200 ), Mils2iu( -200 ) ) );
97 
98  LIB_TEXT* text = new LIB_TEXT( part );
99 
100  text->SetTextSize( wxSize( Mils2iu( 150 ), Mils2iu( 150 ) ) );
101  text->SetText( wxString( wxT( "??" ) ) );
102 
103  part->AddDrawItem( square );
104  part->AddDrawItem( text );
105  }
106 
107  return part;
108 }
Define a symbol library graphical text item.
Definition: lib_text.h:40
double square(double x)
void SetTextSize(const wxSize &aNewSize)
Definition: eda_text.h:237
void AddDrawItem(LIB_ITEM *aItem)
Add a new draw aItem to the draw object list.
virtual void SetText(const wxString &aText)
Definition: eda_text.cpp:116
Define a library symbol object.

References LIB_PART::AddDrawItem(), EDA_TEXT::SetText(), EDA_TEXT::SetTextSize(), and square().

Referenced by SCH_EDITOR_CONTROL::Annotate(), GERBER_WRITER::createDrillFile(), EXCELLON_WRITER::createDrillFile(), BOARD_ADAPTER::createNewPadWithClearance(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), SCH_EDIT_FRAME::DisplayCurrentSheet(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), COMMON_TOOLS::doZoomToPreset(), PNS_PCBNEW_RULE_RESOLVER::DpCoupledNet(), PCB_EDIT_FRAME::Edit_Zone_Params(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), SCH_EDIT_FRAME::FocusOnItem(), GENDRILL_WRITER_BASE::genDrillMapFile(), C3D_RENDER_OGL_LEGACY::generate_3D_Vias_and_Pads(), PCB_EDITOR_CONTROL::GenerateFabFiles(), GERBVIEW_FRAME::GERBVIEW_FRAME(), SCH_COMPONENT::GetBodyBoundingBox(), WS_DRAW_ITEM_PAGE::GetBoundingBox(), FP_TREE_MODEL_ADAPTER::getFootprints(), MODULE::GetFpPadsLocalBbox(), SCHLIB_FILTER::GetLibSource(), SCH_COMPONENT::GetMsgPanelInfo(), NETINFO_ITEM::GetPosition(), X2_ATTRIBUTE::GetPrm(), DIALOG_DIELECTRIC_MATERIAL::GetSelectedSubstrate(), SCH_TEXT::GetShownText(), GRText(), highlightNet(), DRAWSEGMENT::HitTest(), ZONE_CONTAINER::HitTestForCorner(), ZONE_CONTAINER::HitTestForEdge(), DIALOG_PAGES_SETTINGS::initDialog(), DIALOG_GENDRILL::InitDisplayParams(), SHAPE_LINE_CHAIN::Intersects(), PCBNEW_CONTROL::LayerAlphaDec(), PCBNEW_CONTROL::LayerAlphaInc(), EXCELLON_IMAGE::LoadFile(), PCBNEW_PICKER_TOOL::Main(), LENGTH_TUNER_TOOL::MainLoop(), EDIT_POINTS_FACTORY::Make(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnBrowseLibrary(), DIALOG_SCH_FIND::OnCancel(), FOOTPRINT_VIEWER_FRAME::OnCharHook(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnCheckGithubList(), PNS::SHOVE::onCollidingSolid(), DIALOG_EXPORT_STEP::onExportButton(), PCB_EDIT_FRAME::OnExportIDF3(), PCB_EDIT_FRAME::OnExportVRML(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnFilterDClick(), COMMON_TOOLS::OnGridChanged(), DIALOG_EXCHANGE_FOOTPRINTS::OnOKClicked(), SIM_PLOT_FRAME::onPlotChanged(), SIM_PLOT_FRAME::onPlotClose(), PANEL_SELECTION_FILTER::onPopupSelection(), WIZARD_3DSHAPE_LIBS_DOWNLOADER::OnSelectAll3Dlibs(), EDA_DRAW_FRAME::OnSelectGrid(), DIALOG_NETLIST::OnTestFootprintsClick(), LIBEVAL::ParseFinalize(), DIALOG_SPICE_MODEL::parsePowerSource(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), LENGTH_TUNER_TOOL::performTuning(), DIALOG_PLOT::Plot(), PlotStandardLayer(), SCH_COMPONENT::Print(), SCH_PRINTOUT::PrintPage(), PANEL_SETUP_PINMAP::reBuildMatrixPanel(), GERBVIEW_FRAME::ReCreateAuxiliaryToolbar(), PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar(), DIALOG_INSPECTOR::ReCreateDesignList(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), PCB_EDIT_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), EDA_3D_VIEWER::ReCreateMainToolbar(), PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar(), PCB_EDIT_FRAME::ReCreateOptToolbar(), PCB_EDIT_FRAME::ReCreateVToolbar(), PCBNEW_CONTROL::Redo(), SIM_PLOT_FRAME::removePlot(), PL_EDITOR_FRAME::ReturnCoordOriginCorner(), FOOTPRINT_EDIT_FRAME::SaveLibraryAs(), JSON_SETTINGS::SaveToFile(), FOOTPRINT_VIEWER_FRAME::selectNext(), FOOTPRINT_VIEWER_FRAME::selectPrev(), WS_DATA_ITEM_TEXT::SetConstrainedTextSize(), DIALOG_EDIT_COMPONENTS_LIBID::setLibIdByBrowser(), LIB_CONTROL::ShowComponentTree(), SCH_EDITOR_CONTROL::ShowCvpcb(), SCH_EDITOR_CONTROL::ShowPcbNew(), SPICE_VALUE::SPICE_VALUE(), DIALOG_DIELECTRIC_MATERIAL::TransferDataFromWindow(), DIALOG_IMPORT_GFX::TransferDataFromWindow(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataFromWindow(), DIALOG_DIELECTRIC_MATERIAL::TransferDataToWindow(), DIALOG_PRINT_PCBNEW::TransferDataToWindow(), TREEPROJECTFILES::TREEPROJECTFILES(), PCB_CALCULATOR_FRAME::TW_Init(), PCBNEW_CONTROL::Undo(), FP_TREE_SYNCHRONIZING_ADAPTER::updateLibrary(), SCH_EDITOR_CONTROL::UpdatePCB(), EE_POINT_EDITOR::updatePoints(), LIB_ID_VALIDATOR::Validate(), and GERBER_JOBFILE_WRITER::WriteJSONJobFile().

◆ toUTFTildaText()

std::string toUTFTildaText ( const wxString &  txt)

Convert a wxString to UTF8 and replace any control characters with a ~, where a control character is one of the first ASCII values up to ' ' 32d.

Definition at line 59 of file sch_component.cpp.

60 {
61  std::string ret = TO_UTF8( txt );
62 
63  for( std::string::iterator it = ret.begin(); it!=ret.end(); ++it )
64  {
65  if( (unsigned char) *it <= ' ' )
66  *it = '~';
67  }
68  return ret;
69 }
#define TO_UTF8(wxstring)

References TO_UTF8.

Referenced by SCH_LEGACY_PLUGIN::saveComponent(), and SCH_SEXPR_PLUGIN::saveSymbol().