KiCad PCB EDA Suite
|
The common library. More...
#include <vector>
#include <wx/wx.h>
#include <wx/confbase.h>
#include <wx/fileconf.h>
#include <base_struct.h>
#include <richio.h>
#include <gal/color4d.h>
#include <atomic>
#include "make_unique.h"
Go to the source code of this file.
Classes | |
class | LOCALE_IO |
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting exceptions to be thrown. More... | |
struct | std::hash< wxString > |
struct | std::less< wxPoint > |
Namespaces | |
std | |
| |
Macros | |
#define | EDA_KEY_C UINT32_C |
#define | GR_KB_RIGHTSHIFT ( EDA_KEY_C( 0x01000000 ) ) |
#define | GR_KB_LEFTSHIFT ( EDA_KEY_C( 0x02000000 ) ) |
#define | GR_KB_CTRL ( EDA_KEY_C( 0x04000000 ) ) |
#define | GR_KB_ALT ( EDA_KEY_C( 0x08000000 ) ) |
#define | GR_KB_SHIFT ( GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT ) |
#define | GR_KB_SHIFTCTRL ( GR_KB_SHIFT | GR_KB_CTRL ) |
#define | MOUSE_MIDDLE ( EDA_KEY_C( 0x10000000 ) ) |
#define | GR_KEY_INVALID ( EDA_KEY_C( 0x80000000 ) ) |
#define | GR_KEY_NONE ( EDA_KEY_C( 0 ) ) |
#define | NAMELESS_PROJECT wxT( "noname" ) |
default name for nameless projects More... | |
#define | ESC 27 |
#define | TEXT_ANGLE_HORIZ 0 |
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to degrees eventually. More... | |
#define | TEXT_ANGLE_VERT 900 |
#define | KIROUND(v) int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 ) |
KIROUND: a macro so compiler can pre-compute constants. More... | |
#define | USE_KICAD_WXSTRING_HASH |
#define | USE_KICAD_WXPOINT_LESS |
Required to use wxPoint as key type in maps. More... | |
Typedefs | |
typedef uint32_t | EDA_KEY |
Enumerations | |
enum | pseudokeys { EDA_PANNING_UP_KEY = 1, EDA_PANNING_DOWN_KEY, EDA_PANNING_LEFT_KEY, EDA_PANNING_RIGHT_KEY, EDA_ZOOM_IN_FROM_MOUSE, EDA_ZOOM_OUT_FROM_MOUSE, EDA_ZOOM_CENTER_FROM_MOUSE } |
Pseudo key codes for command panning. More... | |
enum | EDA_UNITS_T { INCHES = 0, MILLIMETRES = 1, UNSCALED_UNITS = 2, DEGREES = 3 } |
Functions | |
static int | KiROUND (double v) |
KiROUND rounds a floating point number to an int using "round halfway cases away from zero". More... | |
wxSize | GetTextSize (const wxString &aSingleLine, wxWindow *aWindow) |
Function GetTextSize returns the size of aSingleLine of text when it is rendered in aWindow using whatever font is currently set in that window. More... | |
bool | EnsureTextCtrlWidth (wxTextCtrl *aCtrl, const wxString *aString=NULL) |
Function EnsureTextCtrlWidth sets the minimum pixel width on a text control in order to make a text string be fully visible within it. More... | |
int | ProcessExecute (const wxString &aCommandLine, int aFlags=wxEXEC_ASYNC, wxProcess *callback=NULL) |
Function ProcessExecute runs a child process. More... | |
timestamp_t | GetNewTimeStamp () |
int | GetCommandOptions (const int argc, const char **argv, const char *stringtst, const char **optarg, int *optind) |
double | RoundTo0 (double x, double precision) |
Round to the nearest precision. More... | |
void | wxStringSplit (const wxString &aText, wxArrayString &aStrings, wxChar aSplitter) |
Function wxStringSplit splits aString to a string list separated at aSplitter. More... | |
wxString | SearchHelpFileFullPath (const SEARCH_STACK &aSearchStack, const wxString &aBaseName) |
Function SearchHelpFileFullPath returns the help file's full path. More... | |
bool | EnsureFileDirectoryExists (wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter=NULL) |
Helper function EnsureFileDirectoryExists make aTargetFullFileName absolute and creates the path of this file if it doesn't yet exist. More... | |
const wxString | PrePendPath (const wxString &aEnvVar, const wxString &aPriorityPath) |
Put aPriorityPath in front of all paths in the value of aEnvVar. More... | |
wxConfigBase * | GetNewConfig (const wxString &aProgName) |
Function GetNewConfig. More... | |
wxString | GetKicadConfigPath () |
Function GetKicadConfigPath. More... | |
const wxString | ExpandEnvVarSubstitutions (const wxString &aString) |
Function ExpandEnvVarSubstitutions replaces any environment variable references with their values. More... | |
const wxString | ResolveUriByEnvVars (const wxString &aUri) |
Function ResolveUriByEnvVars replaces any environment variables in file-path uris (leaving network-path uris alone). More... | |
Variables | |
EDA_UNITS_T | g_UserUnit |
display units More... | |
KIGFX::COLOR4D | g_GhostColor |
Draw color for moving objects. More... | |
The common library.
Definition in file common.h.
#define EDA_KEY_C UINT32_C |
Definition at line 60 of file common.h.
Referenced by FOOTPRINT_EDIT_FRAME::BlockCommand(), and LIB_EDIT_FRAME::BlockCommand().
#define ESC 27 |
Definition at line 87 of file common.h.
Referenced by PCB_EDIT_FRAME::AutoPlaceModule(), and getOptimalModulePlacement().
#define GR_KB_ALT ( EDA_KEY_C( 0x08000000 ) ) |
Definition at line 65 of file common.h.
Referenced by PL_EDITOR_FRAME::BlockCommand(), FOOTPRINT_EDIT_FRAME::BlockCommand(), GERBVIEW_FRAME::BlockCommand(), LIB_EDIT_FRAME::BlockCommand(), PCB_EDIT_FRAME::BlockCommand(), SCH_EDIT_FRAME::BlockCommand(), DISPLAY_FOOTPRINTS_FRAME::GeneralControl(), KeyCodeFromKeyName(), KeyNameFromKeyCode(), WIDGET_HOTKEY_LIST::MapKeypressToKeycode(), EDA_3D_CANVAS::OnKeyEvent(), EDA_DRAW_PANEL::OnKeyEvent(), EDA_DRAW_PANEL::OnMouseEvent(), and ACTION_MANAGER::processHotKey().
#define GR_KB_CTRL ( EDA_KEY_C( 0x04000000 ) ) |
Definition at line 64 of file common.h.
Referenced by PL_EDITOR_FRAME::BlockCommand(), FOOTPRINT_EDIT_FRAME::BlockCommand(), GERBVIEW_FRAME::BlockCommand(), LIB_EDIT_FRAME::BlockCommand(), PCB_EDIT_FRAME::BlockCommand(), SCH_EDIT_FRAME::BlockCommand(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), KeyCodeFromKeyName(), KeyNameFromKeyCode(), WIDGET_HOTKEY_LIST::MapKeypressToKeycode(), EDA_3D_CANVAS::OnKeyEvent(), EDA_DRAW_PANEL::OnKeyEvent(), EDA_DRAW_PANEL::OnMouseEvent(), and ACTION_MANAGER::processHotKey().
#define GR_KB_SHIFT ( GR_KB_LEFTSHIFT | GR_KB_RIGHTSHIFT ) |
Definition at line 66 of file common.h.
Referenced by PL_EDITOR_FRAME::BlockCommand(), FOOTPRINT_EDIT_FRAME::BlockCommand(), GERBVIEW_FRAME::BlockCommand(), LIB_EDIT_FRAME::BlockCommand(), PCB_EDIT_FRAME::BlockCommand(), SCH_EDIT_FRAME::BlockCommand(), KeyCodeFromKeyName(), KeyNameFromKeyCode(), WIDGET_HOTKEY_LIST::MapKeypressToKeycode(), EDA_3D_CANVAS::OnKeyEvent(), EDA_DRAW_PANEL::OnKeyEvent(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_3D_CANVAS::OnPopUpMenu(), ACTION_MANAGER::processHotKey(), EDA_3D_CANVAS::SetView3D(), PANEL_PREV_3D::View3DBack(), PANEL_PREV_3D::View3DBottom(), and PANEL_PREV_3D::View3DLeft().
#define GR_KB_SHIFTCTRL ( GR_KB_SHIFT | GR_KB_CTRL ) |
Definition at line 67 of file common.h.
Referenced by PL_EDITOR_FRAME::BlockCommand(), FOOTPRINT_EDIT_FRAME::BlockCommand(), GERBVIEW_FRAME::BlockCommand(), LIB_EDIT_FRAME::BlockCommand(), PCB_EDIT_FRAME::BlockCommand(), and SCH_EDIT_FRAME::BlockCommand().
#define GR_KEY_INVALID ( EDA_KEY_C( 0x80000000 ) ) |
Definition at line 69 of file common.h.
Referenced by FOOTPRINT_EDIT_FRAME::BlockCommand(), and LIB_EDIT_FRAME::BlockCommand().
#define GR_KEY_NONE ( EDA_KEY_C( 0 ) ) |
Definition at line 70 of file common.h.
Referenced by LIB_EDIT_FRAME::BlockCommand().
#define KIROUND | ( | v | ) | int( (v) < 0 ? (v) - 0.5 : (v) + 0.5 ) |
#define MOUSE_MIDDLE ( EDA_KEY_C( 0x10000000 ) ) |
Definition at line 68 of file common.h.
Referenced by PL_EDITOR_FRAME::BlockCommand(), FOOTPRINT_EDIT_FRAME::BlockCommand(), GERBVIEW_FRAME::BlockCommand(), LIB_EDIT_FRAME::BlockCommand(), PCB_EDIT_FRAME::BlockCommand(), and SCH_EDIT_FRAME::BlockCommand().
#define NAMELESS_PROJECT wxT( "noname" ) |
default name for nameless projects
Definition at line 73 of file common.h.
Referenced by SCH_EDIT_FRAME::OnPrint(), TREE_PROJECT_FRAME::ReCreateTreePrj(), and SCH_EDIT_FRAME::SCH_EDIT_FRAME().
#define TEXT_ANGLE_HORIZ 0 |
Frequent text rotations, used with {Set,Get}TextAngle(), in 0.1 degrees for now, hoping to migrate to degrees eventually.
Definition at line 91 of file common.h.
Referenced by LIB_TEXT::calcEdit(), LIB_FIELD::calcEdit(), AUTOPLACER::ComputeFBoxSize(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), SCH_FIELD::Draw(), SCH_SHEET::Draw(), LIB_TEXT::drawGraphic(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinTexts(), GERBER_DRAW_ITEM::GetTextD_CodePrms(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), LIB_FIELD::Init(), SCH_LEGACY_PLUGIN::loadComponent(), SCH_LEGACY_PLUGIN_CACHE::loadField(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), LIB_FIELD::Plot(), SCH_SHEET::Plot(), LIB_PIN::PlotPinTexts(), LIB_TEXT::Rotate(), LIB_FIELD::Rotate(), SCH_EDIT_FRAME::RotateField(), SCH_LEGACY_PLUGIN::saveField(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), and DIALOG_EDIT_ONE_FIELD::updateText().
#define TEXT_ANGLE_VERT 900 |
Definition at line 92 of file common.h.
Referenced by LIB_TEXT::calcEdit(), LIB_FIELD::calcEdit(), AUTOPLACER::ComputeFBoxSize(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), DIALOG_EDIT_ONE_FIELD::DIALOG_EDIT_ONE_FIELD(), SCH_FIELD::Draw(), SCH_SHEET::Draw(), LIB_TEXT::drawGraphic(), LIB_PIN::DrawPinElectricalTypeName(), LIB_PIN::DrawPinTexts(), LIB_TEXT::HitTest(), LIB_FIELD::HitTest(), DIALOG_LIB_EDIT_TEXT::initDlg(), SCH_LEGACY_PLUGIN::loadComponent(), SCH_LEGACY_PLUGIN_CACHE::loadField(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), LIB_TEXT::Plot(), SCH_FIELD::Plot(), LIB_FIELD::Plot(), SCH_SHEET::Plot(), LIB_PIN::PlotPinTexts(), LIB_TEXT::Rotate(), LIB_FIELD::Rotate(), SCH_EDIT_FRAME::RotateField(), SCH_TEXT::SetLabelSpinStyle(), SCH_GLOBALLABEL::SetLabelSpinStyle(), SCH_HIERLABEL::SetLabelSpinStyle(), DIALOG_SCH_EDIT_ONE_FIELD::UpdateField(), and DIALOG_EDIT_ONE_FIELD::updateText().
#define USE_KICAD_WXPOINT_LESS |
enum EDA_UNITS_T |
Enumerator | |
---|---|
INCHES | |
MILLIMETRES | |
UNSCALED_UNITS | |
DEGREES |
enum pseudokeys |
Pseudo key codes for command panning.
Enumerator | |
---|---|
EDA_PANNING_UP_KEY | |
EDA_PANNING_DOWN_KEY | |
EDA_PANNING_LEFT_KEY | |
EDA_PANNING_RIGHT_KEY | |
EDA_ZOOM_IN_FROM_MOUSE | |
EDA_ZOOM_OUT_FROM_MOUSE | |
EDA_ZOOM_CENTER_FROM_MOUSE |
Definition at line 77 of file common.h.
bool EnsureFileDirectoryExists | ( | wxFileName * | aTargetFullFileName, |
const wxString & | aBaseFilename, | ||
REPORTER * | aReporter = NULL |
||
) |
Helper function EnsureFileDirectoryExists make aTargetFullFileName absolute and creates the path of this file if it doesn't yet exist.
aTargetFullFileName | the wxFileName containing the full path and file name to modify. The path may be absolute or relative to aBaseFilename . |
aBaseFilename | a full filename. Only its path is used to set the aTargetFullFileName path. |
aReporter | a point to a REPORTER object use to show messages (can be NULL) |
Definition at line 282 of file common.cpp.
References GetChars(), REPORTER::Report(), REPORTER::RPT_ERROR, and REPORTER::RPT_INFO.
Referenced by DIALOG_GEN_FOOTPRINT_POSITION::CreateFiles(), DIALOG_PLOT_SCHEMATIC::createPlotFileName(), DIALOG_SVG_PRINT::ExportSVGFile(), DIALOG_GENDRILL::GenDrillAndMapFiles(), PLOT_CONTROLLER::OpenPlotfile(), and DIALOG_PLOT::Plot().
bool EnsureTextCtrlWidth | ( | wxTextCtrl * | aCtrl, |
const wxString * | aString = NULL |
||
) |
Function EnsureTextCtrlWidth sets the minimum pixel width on a text control in order to make a text string be fully visible within it.
The current font within the text control is considered. The text can come either from the control or be given as an argument. If the text control is larger than needed, then nothing is done.
aCtrl | the text control to potentially make wider. |
aString | the text that is used in sizing the control's pixel width. If NULL, then the text already within the control is used. |
Definition at line 109 of file common.cpp.
References GetTextSize().
Referenced by SCH_EDIT_FRAME::EditComponent(), DIALOG_LABEL_EDITOR::InitDialog(), and GERBVIEW_FRAME::UpdateTitleAndInfo().
const wxString ExpandEnvVarSubstitutions | ( | const wxString & | aString | ) |
Function ExpandEnvVarSubstitutions replaces any environment variable references with their values.
aString | = a string containing (perhaps) references to env var |
Definition at line 255 of file common.cpp.
Referenced by S3D_FILENAME_RESOLVER::addPath(), S3D_FILENAME_RESOLVER::checkEnvVarPath(), S3D_PLUGIN_MANAGER::checkPluginName(), S3D_PLUGIN_MANAGER::checkPluginPath(), S3D_FILENAME_RESOLVER::createPathList(), LIB_TABLE::ExpandSubstitutions(), S3D_CACHE::Get3DConfigDir(), WORKSHEET_LAYOUT::MakeFullFileName(), S3D_FILENAME_RESOLVER::ResolvePath(), ResolveUriByEnvVars(), S3D_FILENAME_RESOLVER::Set3DConfigDir(), S3D_CACHE::Set3DConfigDir(), S3D_FILENAME_RESOLVER::SetProjectDir(), S3D_FILENAME_RESOLVER::ShortenPath(), and DLG_3D_PATH_CONFIG::updateEnvVars().
int GetCommandOptions | ( | const int | argc, |
const char ** | argv, | ||
const char * | stringtst, | ||
const char ** | optarg, | ||
int * | optind | ||
) |
wxString GetKicadConfigPath | ( | ) |
Function GetKicadConfigPath.
Definition at line 218 of file common.cpp.
Referenced by FP_LIB_TABLE::GetGlobalTableFileName(), SYMBOL_LIB_TABLE::GetGlobalTableFileName(), GetNewConfig(), and CACHE_WRAPPER::~CACHE_WRAPPER().
wxConfigBase* GetNewConfig | ( | const wxString & | aProgName | ) |
Function GetNewConfig.
Use this function instead of creating a new wxConfig so we can put config files in a more proper place for each platform. This is generally $HOME/.config/kicad/ in Linux according to the FreeDesktop specification at http://standards.freedesktop.org/basedir-spec/basedir-spec-0.6.html The config object created here should be destroyed by the caller.
aProgName | is the name of the program calling this function - can be obtained by calling Pgm().App().GetAppName(). This will be the actual file name of the config file. |
Definition at line 206 of file common.cpp.
References GetKicadConfigPath().
Referenced by BIN_MOD::Init(), PGM_BASE::InitPgm(), ReadHotkeyConfig(), and EDA_BASE_FRAME::WriteHotkeyConfig().
timestamp_t GetNewTimeStamp | ( | ) |
Definition at line 167 of file common.cpp.
Referenced by PCB_BASE_FRAME::AddModuleToBoard(), BOARD_NETLIST_UPDATER::addNewComponent(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::Begin_Zone(), SCH_EDIT_FRAME::CreateSheet(), Diagnose(), DuplicateItemsInList(), EDIT_TOOL::editFootprintInFpEditor(), DIALOG_FOOTPRINT_BOARD_EDITOR::GotoModuleEditor(), BOARD::InsertArea(), COLLECTOR::IsSimilarPointAndTime(), SCH_EAGLE_PLUGIN::loadSchematic(), SCH_LEGACY_PLUGIN::loadSheet(), SCH_EDIT_FRAME::OnCopySchematicItemRequest(), EDA_ITEM::operator=(), SCH_EDIT_FRAME::PasteListOfItems(), FOOTPRINT_EDIT_FRAME::Process_Special_Functions(), PCB_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::RepeatDrawItem(), SCH_SCREENS::ReplaceDuplicateTimeStamps(), BOARD::ReplaceNetlist(), SCH_COMPONENT::SCH_COMPONENT(), SCH_SHEET::SCH_SHEET(), COLLECTOR::SetTimeNow(), SimilarLabelsDiagnose(), TestDuplicateSheetNames(), DIALOG_ERC::TestErc(), and TestMultiunitFootprints().
wxSize GetTextSize | ( | const wxString & | aSingleLine, |
wxWindow * | aWindow | ||
) |
Function GetTextSize returns the size of aSingleLine of text when it is rendered in aWindow using whatever font is currently set in that window.
Definition at line 94 of file common.cpp.
Referenced by EDA_DRAW_FRAME::EDA_DRAW_FRAME(), EnsureTextCtrlWidth(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), DIALOG_COPPER_ZONE::initDialog(), PL_EDITOR_FRAME::PL_EDITOR_FRAME(), DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::recalculateColumns(), PL_EDITOR_FRAME::ReCreateHToolbar(), and TEXTE_PCB::TransformShapeWithClearanceToPolygonSet().
|
inlinestatic |
KiROUND rounds a floating point number to an int using "round halfway cases away from zero".
In Debug build an assert fires if will not fit into an int.KiROUND: a function so v is not evaluated twice. Unfortunately, compiler is unable to pre-compute constants using this.
Definition at line 107 of file common.h.
Referenced by PCB_EDIT_FRAME::Add45DegreeSegment(), PCAD2KICAD::PCB_POLYGON::AddToBoard(), DIMENSION::AdjustDimensionDetails(), EDA_DRAW_FRAME::AdjustScrollBars(), GRID_HELPER::Align(), GRID_HELPER::AlignToSegment(), CPolyLine::AppendArc(), EC_45DEGREE::Apply(), PLOTTER::Arc(), HPGL_PLOTTER::Arc(), PDF_PLOTTER::Arc(), GERBER_PLOTTER::Arc(), PCB_EDIT_FRAME::Begin_Zone(), LEGACY_PLUGIN::biuParse(), D_PAD::boundingRadius(), build_pad_testpoints(), BuildCornersList_S_Shape(), D_PAD::BuildPadPolygon(), ZONE_FILLER::buildUnconnectedThermalStubsPolygonList(), WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(), ZONE_FILLER::buildZoneFeatureHoleList(), LIB_CIRCLE::calcEdit(), LIB_ARC::CalcRadiusAngles(), PCAD2KICAD::CalculateTextLengthSize(), KIGFX::WX_VIEW_CONTROLS::CenterOnCursor(), CPolyLine::Chamfer(), SHAPE_POLY_SET::chamferFilletPolygon(), DRC::checkClearancePadToPad(), Clamp_Text_PenSize(), ClipAndDrawPoly(), Collect_TrackSegmentsToDrag(), ConfigureHPGLPenSizes(), AM_PRIMITIVE::ConvertShapeToPolygon(), D_CODE::ConvertShapeToPolygon(), PCAD2KICAD::CorrectTextPosition(), PCB_EDIT_FRAME::Create_MuWaveComponent(), PCB_EDIT_FRAME::Create_MuWavePolygonShape(), SCH_GLOBALLABEL::CreateGraphicShape(), BOARD::CreateLockPoint(), MWAVE::CreateMicrowaveInductor(), CreateThermalReliefPadPolygon(), CPolyLine::Distance(), EDGE_MODULE::Draw(), DRAWSEGMENT::Draw(), GERBER_DRAW_ITEM::Draw(), AM_PRIMITIVE::DrawBasicShape(), BITMAP_BASE::DrawBitmap(), KIGFX::OPENGL_GAL::DrawGrid(), EDA_DRAW_PANEL::DrawGrid(), KIGFX::GAL::DrawGrid(), BOARD_PRINTOUT_CONTROLLER::DrawPage(), TRACK::DrawShortNetname(), GERBER_PLOTTER::emitDcode(), GERBER_FILE_IMAGE::ExecuteRS274XCommand(), CPolyLine::Fillet(), FindBestGridPointOnTrack(), HPGL_PLOTTER::FlashPadCircle(), HPGL_PLOTTER::FlashPadOval(), HPGL_PLOTTER::FlashPadRect(), HPGL_PLOTTER::FlashPadRoundRect(), FootprintWriteShape(), DSN::SPECCTRA_DB::FromSESSION(), gen_arc(), GENDRILL_WRITER_BASE::genDrillMapFile(), PCB_EDIT_FRAME::GeneralControl(), EDA_DRAW_FRAME::GeneralControlKeyMovement(), C3D_RENDER_OGL_LEGACY::generate_new_3DGrid(), geom_transf(), GERBER_DRAW_ITEM::GetABPosition(), GetArcToSegmentCount(), LIB_PIN::GetBoundingBox(), SCH_SHEET::GetBoundingBox(), GetClearanceBetweenSegments(), BASE_SCREEN::getCrossHairScreenPosition(), DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog(), WORKSHEET_DATAITEM::GetEndPosUi(), GRID_HELPER::GetGrid(), DIALOG_SET_GRID::getGridOrigin(), KIGFX::GAL::GetGridPoint(), DIALOG_SET_GRID::getGridSize(), KIGFX::STROKE_FONT::getInterline(), EDA_TEXT::GetInterline(), WORKSHEET_DATAITEM::GetMarkerSizeUi(), BASE_SCREEN::getNearestGridPosition(), GetPenSizeForBold(), WORKSHEET_DATAITEM::GetPenSizeUi(), WORKSHEET_DATAITEM_POLYPOLYGON::GetPenSizeUi(), WORKSHEET_DATAITEM_TEXT::GetPenSizeUi(), DRAWSEGMENT::GetRadius(), BITMAP_BASE::GetSize(), D_PAD::GetSolderPasteMargin(), WORKSHEET_DATAITEM::GetStartPosUi(), EDA_TEXT::GetTextBox(), GERBER_DRAW_ITEM::GetXYPosition(), GraphicTextWidth(), GRArc1(), CPolyLine::Hatch(), ZONE_CONTAINER::Hatch(), LIB_CIRCLE::HitTest(), LIB_ARC::HitTest(), DRAWSEGMENT::HitTest(), D_PAD::HitTest(), CPolyLine::HitTestForEdge(), DIALOG_PLOT::init_Dialog(), initializePlotter(), TRACK::IsPointOnEnds(), iu_to_d356(), Join(), EDA_TEXT::LenSize(), EAGLE_PLUGIN::Load(), EAGLE_PLUGIN::loadSignals(), DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), TRANSFORM::MapAngles(), PLOTTER::markerSquare(), Mils2mm(), Mm2mils(), EDA_DRAW_PANEL::OnMouseEvent(), EDA_DRAW_PANEL::OnMouseWheel(), EDA_DRAW_PANEL::OnPan(), DIALOG_POSITION_RELATIVE::OnPolarChanged(), DIALOG_MOVE_EXACT::OnPolarChanged(), EDA_DRAW_PANEL::OnScroll(), EAGLE_PLUGIN::packagePad(), EAGLE_PLUGIN::packagePolygon(), PCB_PLOT_PARAMS_PARSER::Parse(), PCAD2KICAD::PCB_ARC::Parse(), PCB_PARSER::parseBoardUnits(), parseInt(), GPCB_FPL_CACHE::parseMODULE(), BRDITEMS_PLOTTER::Plot_1_EdgeModule(), BRDITEMS_PLOTTER::PlotDrawSegment(), PSLIKE_PLOTTER::postscriptOverlinePositions(), PushTrack(), GERBER_FILE_IMAGE::ReadIJCoord(), PARAM_CFG_INT_WITH_SCALE::ReadParam(), EXCELLON_IMAGE::readToolInformation(), GERBER_FILE_IMAGE::ReadXYCoord(), resizeSheetWithMouseCursor(), PSLIKE_PLOTTER::returnPostscriptTextWidth(), RotatePoint(), RoundTo0(), DSN::scale(), scaletoIU(), PLOTTER::segmentAsOval(), EDA_3D_VIEWER::Set3DColorFromUser(), EDA_DRAW_PANEL::SetClipBox(), WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize(), KIGFX::PREVIEW::TWO_POINT_GEOMETRY_MANAGER::SetEnd(), PCAD2KICAD::SetTextSizeFromStrokeFontHeight(), PCAD2KICAD::SetTextSizeFromTrueTypeFontHeight(), Show_Drag_Track_Segment_With_Cte_Slope(), ShowBoundingBoxMicroWaveInductor(), snapAngle(), PS_PLOTTER::StartPlot(), PCAD2KICAD::StrToInt1Units(), PCAD2KICAD::StrToIntUnits(), TestForIntersectionOfStraightLineSegments(), PS_PLOTTER::Text(), PDF_PLOTTER::Text(), TraceArc(), TraceCircle(), TraceFilledRectangle(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform(), TransformOvalClearanceToPolygon(), TransformRoundedEndsSegmentToPolygon(), TRACK::TransformShapeWithClearanceToPolygon(), D_PAD::TransformShapeWithClearanceToPolygon(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), USCALE(), ValueFromString(), and EXCELLON_WRITER::writeCoordinates().
const wxString PrePendPath | ( | const wxString & | aEnvVar, |
const wxString & | aPriorityPath | ||
) |
Put aPriorityPath in front of all paths in the value of aEnvVar.
Definition at line 32 of file prependpath.cpp.
int ProcessExecute | ( | const wxString & | aCommandLine, |
int | aFlags = wxEXEC_ASYNC , |
||
wxProcess * | callback = NULL |
||
) |
Function ProcessExecute runs a child process.
aCommandLine | The process and any arguments to it all in a single string. |
aFlags | The same args as allowed for wxExecute() |
callback | wxProcess implementing OnTerminate to be run when the child process finishes |
Definition at line 161 of file common.cpp.
Referenced by ExecuteFile(), GetAssociatedDocument(), DIALOG_FREEROUTE::OnLaunchButtonClick(), OpenFile(), OpenPDF(), and SCH_EDIT_FRAME::WriteNetListFile().
const wxString ResolveUriByEnvVars | ( | const wxString & | aUri | ) |
Function ResolveUriByEnvVars replaces any environment variables in file-path uris (leaving network-path uris alone).
Definition at line 269 of file common.cpp.
References ExpandEnvVarSubstitutions().
Referenced by SCH_EDIT_FRAME::Process_Special_Functions(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), and DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler().
double RoundTo0 | ( | double | x, |
double | precision | ||
) |
Round to the nearest precision.
Try to approximate a coordinate using a given precision to prevent rounding errors when converting from inches to mm.
ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
Definition at line 183 of file common.cpp.
References KiROUND().
Referenced by SCH_BASE_FRAME::UpdateStatusBar().
wxString SearchHelpFileFullPath | ( | const SEARCH_STACK & | aSearchStack, |
const wxString & | aBaseName | ||
) |
Function SearchHelpFileFullPath returns the help file's full path.
Return the KiCad help file with path and extension. Help files can be html (.html ext) or pdf (.pdf ext) files. A <BaseName>.html file is searched and if not found, <BaseName>.pdf file is searched in the same path. If the help file for the current locale is not found, an attempt to find the English version of the help file is made. Help file is searched in directories in this order: help/<canonical name> like help/en_GB help/<short name> like help/en help/en
aSearchStack | contains some possible base dirs that may be above the the one actually holding aBaseName. These are starting points for nested searches. |
aBaseName | is the name of the help file to search for, |
without extension
.
Definition at line 66 of file searchhelpfilefullpath.cpp.
References SEARCH_STACK::AddPaths(), FindFileInSearchPaths(), GetChars(), PGM_BASE::GetLocale(), and Pgm().
Referenced by EDA_BASE_FRAME::GetKicadHelp().
void wxStringSplit | ( | const wxString & | aText, |
wxArrayString & | aStrings, | ||
wxChar | aSplitter | ||
) |
Function wxStringSplit splits aString to a string list separated at aSplitter.
aText | is the text to split |
aStrings | will contain the splitted lines |
aSplitter | is the 'split' character |
Definition at line 138 of file common.cpp.
Referenced by CINFO3D_VISU::AddShapeWithClearanceToContainer(), EDA_TEXT::Draw(), export_vrml_pcbtext(), EDA_TEXT::GetTextBox(), HTML_MESSAGE_BOX::ListSet(), DIALOG_FOOTPRINT_WIZARD_LIST::onShowTrace(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotTextePcb(), TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(), and EDA_TEXT::TransformTextShapeToSegmentList().
KIGFX::COLOR4D g_GhostColor |
Draw color for moving objects.
Definition at line 58 of file common.cpp.
Referenced by SCH_EDIT_FRAME::ConvertPart(), DrawMovingBlockOutlines(), DrawMovingItems(), SCH_EDIT_FRAME::OnSelectUnit(), and EDA_DRAW_PANEL::ReDraw().
EDA_UNITS_T g_UserUnit |
display units
display units
TODO: All of these variables should be moved into the class were they are defined and used. Most of them probably belong in the application class.
Definition at line 57 of file common.cpp.
Referenced by DIALOG_COPPER_ZONE::AcceptOptions(), EDA_DRAW_FRAME::AddMenuZoomAndGrid(), Append_Track_Width_List(), DIALOG_PLOT::applyPlotSettings(), DIALOG_CREATE_ARRAY::calculateCircularArrayProperties(), class2gridRow(), DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel(), PCB_EDIT_FRAME::Create_MuWaveComponent(), MWAVE::CreateMicrowaveInductor(), DIALOG_CREATE_ARRAY::DIALOG_CREATE_ARRAY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_DRC_CONTROL::DisplayDRCValues(), GERBER_FILE_IMAGE::DisplayImageInfo(), EDA_DRAW_FRAME::DisplayUnitsMsg(), drawCursorStrings(), drawTicksAlongLine(), PCB_EDIT_FRAME::Edit_Gap(), LIB_EDIT_FRAME::EditGraphicSymbol(), SCH_EDIT_FRAME::EditLine(), SCH_EDIT_FRAME::EditSheet(), SCH_EDIT_FRAME::EditSheetPin(), FOOTPRINT_EDIT_FRAME::Enter_Edge_Width(), PCB_EDIT_FRAME::GenFootprintsReport(), FOOTPRINT_EDIT_FRAME::GetConfigurationSettings(), PL_EDITOR_FRAME::GetConfigurationSettings(), SCH_EDIT_FRAME::GetConfigurationSettings(), PCB_EDIT_FRAME::GetConfigurationSettings(), GERBVIEW_FRAME::GetConfigurationSettings(), DIALOG_PAGES_SETTINGS::GetCustomSizeMilsFromDialog(), DIALOG_SET_GRID::getGridOrigin(), DIALOG_SET_GRID::getGridSize(), LIB_CIRCLE::GetMsgPanelInfo(), LIB_RECTANGLE::GetMsgPanelInfo(), LIB_POLYLINE::GetMsgPanelInfo(), LIB_TEXT::GetMsgPanelInfo(), LIB_ARC::GetMsgPanelInfo(), LIB_BEZIER::GetMsgPanelInfo(), LIB_PIN::GetMsgPanelInfo(), LIB_FIELD::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), LIB_PIN::getMsgPanelInfoBase(), PANEL_PREV_3D::getOrientationVars(), getTickFormatForScale(), TRACK_VIA_SIZE_MENU::getTrackDescription(), TRACK_VIA_SIZE_MENU::getViaDescription(), GRID_MENU::GRID_MENU(), DIALOG_GENERALOPTIONS::init(), DIALOG_NON_COPPER_ZONES_EDITOR::Init(), DIALOG_PLOT::init_Dialog(), DIALOG_FOOTPRINT_BOARD_EDITOR::InitBoardProperties(), DIALOG_SVG_PRINT::initDialog(), DIALOG_GLOBAL_FOOTPRINTS_FIELDS_EDITION::initDialog(), DIALOG_PAGES_SETTINGS::initDialog(), DIALOG_LABEL_EDITOR::InitDialog(), DIALOG_COPPER_ZONE::initDialog(), DIALOG_DESIGN_RULES::InitDimensionsLists(), DIALOG_LIB_EDIT_TEXT::initDlg(), DIALOG_PLOT_SCHEMATIC::initDlg(), DIALOG_DESIGN_RULES::InitGlobalRules(), DIALOG_FOOTPRINT_FP_EDITOR::initModeditProperties(), DIALOG_DISPLAY_OPTIONS::initOptDialog(), PANEL_PREV_3D::initPanel(), DIALOG_MODEDIT_OPTIONS::initValues(), DIALOG_PAD_PROPERTIES::initValues(), DIALOG_PRINT_USING_PRINTER::initValues(), LengthDoubleToString(), GERBVIEW_FRAME::Liste_D_Codes(), Mils2mm(), MWAVE_POLYGONAL_SHAPE_DLG::MWAVE_POLYGONAL_SHAPE_DLG(), DIALOG_PADS_MASK_CLEARANCE::myInit(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onCellChanging(), DIALOG_PAD_PROPERTIES::onCornerSizePercentChange(), DIALOG_COPPER_ZONE::OnCornerSmoothingModeChoice(), PANEL_PREV_3D::onDecrementOffset(), LIB_EDIT_FRAME::OnEditPin(), SCH_EDIT_FRAME::OnFindDrcMarker(), FOOTPRINT_VIEWER_FRAME::OnHotKey(), FOOTPRINT_EDIT_FRAME::OnHotKey(), PCB_EDIT_FRAME::OnHotKey(), GERBVIEW_FRAME::OnHotKey(), PANEL_PREV_3D::onIncrementOffset(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), PGE::IFACE::OnKifaceStart(), PANEL_PREV_3D::onMouseWheelOffset(), DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick(), DIALOG_GENERALOPTIONS::OnOkClick(), DIALOG_LIB_EDIT_TEXT::OnOkClick(), DIALOG_NON_COPPER_ZONES_EDITOR::OnOkClick(), TARGET_PROPERTIES_DIALOG_EDITOR::OnOkClick(), DIALOG_DIMENSION_EDITOR::OnOKClick(), SCH_EDIT_FRAME::OnPreferencesOptions(), DIALOG_LIB_EDIT_PIN::OnPropertiesChange(), EDA_DRAW_FRAME::OnSelectUnits(), EDA_DRAW_FRAME::OnUpdateUnits(), DIALOG_TRACK_VIA_PROPERTIES::onViaSelect(), DIALOG_PAD_PROPERTIES::padValuesOK(), PutValueInLocalUnits(), DIALOG_PAGES_SETTINGS::SavePageSettings(), PCB_BASE_FRAME::SaveSettings(), DIALOG_DESIGN_RULES::SetDataValidators(), DIALOG_SET_GRID::setGridSize(), PANEL_PREV_3D::SetModelDataIdx(), DIALOG_SVG_PRINT::SetPenWidth(), DIALOG_PRINT_USING_PRINTER::SetPenWidth(), GERBVIEW_CONTROL::SwitchUnits(), PCBNEW_CONTROL::SwitchUnits(), PCB_EDIT_FRAME::SyncMenusAndToolbars(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), DIALOG_DESIGN_RULES::TestDataValidity(), DIALOG_LABEL_EDITOR::TextPropertiesAccept(), DIALOG_EDIT_FPTEXT::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow(), DIALOG_PCB_TEXT_PROPERTIES::TransferDataFromWindow(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_GRAPHIC_ITEM_PROPERTIES::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVES_PROPERTIES::TransferDataFromWindow(), DIALOG_LAYERS_SETUP::TransferDataFromWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataFromWindow(), DIALOG_CREATE_ARRAY::TransferDataFromWindow(), DIALOG_EDIT_ONE_FIELD::TransferDataToWindow(), DIALOG_LAYERS_SETUP::TransferDataToWindow(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::TransferDataToWindow(), DIALOG_PAD_PRIMITIVES_TRANSFORM::Transform(), GERBVIEW_FRAME::updateDCodeSelectBox(), DIALOG_POSITION_RELATIVE::updateDlgTexts(), DIALOG_MOVE_EXACT::updateDlgTexts(), PCB_BASE_FRAME::updateGridSelectBox(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::updateNetInfo(), DIALOG_PAD_PROPERTIES::updateRoundRectCornerValues(), PL_EDITOR_FRAME::UpdateStatusBar(), SCH_BASE_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_EDIT_FRAME::updateTraceWidthSelectBox(), PCB_EDIT_FRAME::updateViaSizeSelectBox(), DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::Validate(), DIALOG_GRAPHIC_ITEM_PROPERTIES::Validate(), ValueFromString(), ValueFromTextCtrl(), and KIGFX::PREVIEW::ARC_ASSISTANT::ViewDraw().