KiCad PCB EDA Suite
|
#include <units_provider.h>
Public Member Functions | |
UNITS_PROVIDER (const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits) | |
virtual | ~UNITS_PROVIDER () |
EDA_UNITS | GetUserUnits () const |
void | SetUserUnits (EDA_UNITS aUnits) |
virtual void | GetUnitPair (EDA_UNITS &aPrimaryUnit, EDA_UNITS &aSecondaryUnits) |
const EDA_IU_SCALE & | GetIuScale () const |
virtual ORIGIN_TRANSFORMS & | GetOriginTransforms () |
wxString | StringFromValue (double aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const |
Converts aValue in internal units into a united string. | |
wxString | StringFromOptionalValue (std::optional< int > aValue, bool aAddUnitLabel=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const |
Converts an optional aValue in internal units into a united string. | |
wxString | StringFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=false) const |
wxString | MessageTextFromValue (double aValue, bool aAddUnitLabel=true, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const |
A lower-precision version of StringFromValue(). | |
wxString | MessageTextFromValue (const EDA_ANGLE &aValue, bool aAddUnitLabel=true) const |
wxString | MessageTextFromMinOptMax (const MINOPTMAX< int > &aValue) const |
int | ValueFromString (const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const |
Converts aTextValue in aUnits to internal units used by the frame. | |
std::optional< int > | OptionalValueFromString (const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE) const |
Converts aTextValue in aUnits to internal units used by the frame. | |
EDA_ANGLE | AngleValueFromString (const wxString &aTextValue) const |
Static Public Attributes | |
static const wxString | NullUiString = "" |
The string that is used in the UI to represent a null value. | |
Private Attributes | |
const EDA_IU_SCALE & | m_iuScale |
EDA_UNITS | m_userUnits |
Definition at line 34 of file units_provider.h.
|
inline |
Definition at line 37 of file units_provider.h.
|
inlinevirtual |
Definition at line 42 of file units_provider.h.
|
inline |
Definition at line 188 of file units_provider.h.
References DEGREES_T, EDA_UNIT_UTILS::UI::DoubleValueFromString(), and GetIuScale().
Referenced by PROPERTIES_FRAME::CopyPrmsFromPanelToItem(), and PCB_FIELDS_GRID_TABLE::SetValue().
|
inline |
Definition at line 59 of file units_provider.h.
References m_iuScale.
Referenced by AngleValueFromString(), GRID_MENU::BuildChoiceList(), RC_ITEM::GetJsonViolation(), MessageTextFromMinOptMax(), MessageTextFromValue(), UNIT_BINDER::onUnitsChanged(), PANEL_SETUP_BOARD_STACKUP::onUnitsChanged(), OptionalValueFromString(), PANEL_GRID_SETTINGS::RebuildGridSizes(), COMMON_TOOLS::Reset(), StringFromOptionalValue(), StringFromValue(), DIALOG_GRID_SETTINGS::TransferDataFromWindow(), DIALOG_GRID_SETTINGS::TransferDataToWindow(), GRID::UserUnitsMessageText(), and ValueFromString().
|
inlinevirtual |
Reimplemented in EDA_BASE_FRAME, and PCB_BASE_FRAME.
Definition at line 62 of file units_provider.h.
|
inlinevirtual |
Reimplemented in EDA_DRAW_FRAME.
Definition at line 48 of file units_provider.h.
References GetUserUnits(), and EDA_UNIT_UTILS::IsImperialUnit().
Referenced by PANEL_GRID_SETTINGS::RebuildGridSizes().
|
inline |
Definition at line 45 of file units_provider.h.
References m_userUnits.
Referenced by DIALOG_BOOK_REPORTER::AddHTMLPage(), PANEL_SYMBOL_CHOOSER::constructRightPanel(), PG_UNIT_EDITOR::CreateControls(), PCB::IFACE::CreateKiWindow(), DIALOG_SHIM::DIALOG_SHIM(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PL_EDITOR_FRAME::DisplayGridMsg(), EDA_DRAW_FRAME::DisplayUnitsMsg(), DRAWING_TOOL::drawArc(), DRAWING_TOOL::drawOneBezier(), DRAWING_TOOL::drawShape(), DRAWING_TOOL::DrawSpecificationStackup(), EVT_GRID_CMD_CELL_CHANGED(), FOOTPRINT_PREVIEW_PANEL::FOOTPRINT_PREVIEW_PANEL(), PCB_NET_INSPECTOR_PANEL::generateReport(), RC_ITEM::GetJsonViolation(), GERBER_DRAW_ITEM::GetMsgPanelInfo(), WX_GRID::GetOptionalUnitValue(), GetUnitPair(), EDA_DRAW_FRAME::GetUnitPair(), WX_GRID::GetUnitValue(), GetUserUnits(), UNIT_BINDER::init(), FIELDS_GRID_TABLE::initGrid(), GERBVIEW_INSPECTION_TOOL::MeasureTool(), PCB_VIEWER_TOOLS::MeasureTool(), MessageTextFromMinOptMax(), MessageTextFromValue(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), WX_GRID::onCellEditorHidden(), PANEL_SETUP_BOARD_STACKUP::onExportToClipboard(), DIALOG_ERC::OnSaveReport(), PANEL_PREVIEW_3D_MODEL::onUnitsChanged(), PANEL_SETUP_NETCLASSES::onUnitsChanged(), UNIT_BINDER::onUnitsChanged(), DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged(), PANEL_SETUP_BOARD_STACKUP::onUnitsChanged(), DIALOG_GENERATORS::onUnitsChanged(), OptionalValueFromString(), PANEL_FOOTPRINT_CHOOSER::PANEL_FOOTPRINT_CHOOSER(), PANEL_PREVIEW_3D_MODEL::PANEL_PREVIEW_3D_MODEL(), PANEL_SETUP_NETCLASSES::PANEL_SETUP_NETCLASSES(), PCB_FIELDS_GRID_TABLE::PCB_FIELDS_GRID_TABLE(), PG_UNIT_EDITOR::PG_UNIT_EDITOR(), PIN_TABLE_DATA_MODEL::PIN_TABLE_DATA_MODEL(), POSITION_RELATIVE_TOOL::PositionRelative(), DRC_TOOL::RunTests(), EDA_DRAW_FRAME::SaveSettings(), PCB_BASE_FRAME::SetBoard(), WX_GRID::SetUnitsProvider(), PIN_TABLE_DATA_MODEL::SetValue(), FIELDS_GRID_TABLE::SetValue(), PCB_FIELDS_GRID_TABLE::SetValue(), GERBVIEW_INSPECTION_TOOL::ShowDCodes(), StringFromOptionalValue(), StringFromValue(), COMMON_TOOLS::ToggleUnits(), EDA_DRAW_FRAME::ToggleUserUnits(), PCB_BASE_FRAME::unitsChangeRefresh(), EDITOR_CONDITIONS::unitsFunc(), GERBVIEW_FRAME::updateDCodeSelectBox(), PG_UNIT_EDITOR::UpdateFrame(), PL_EDITOR_FRAME::UpdateStatusBar(), DRC_TOOL::userUnits(), GRID::UserUnitsMessageText(), and ValueFromString().
|
inline |
Definition at line 141 of file units_provider.h.
References GetIuScale(), GetUserUnits(), and EDA_UNIT_UTILS::UI::MessageTextFromMinOptMax().
Referenced by PCB_TUNING_PATTERN::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), and PCB_CONTROL::UpdateMessagePanel().
|
inline |
Definition at line 134 of file units_provider.h.
References EDA_ANGLE::AsDegrees(), EDA_UNIT_UTILS::UI::MessageTextFromValue(), and unityScale.
|
inline |
A lower-precision version of StringFromValue().
Should ONLY be used for status text and messages. Not suitable for dialogs, files, etc. where the loss of precision matters.
Definition at line 127 of file units_provider.h.
References GetIuScale(), GetUserUnits(), and EDA_UNIT_UTILS::UI::MessageTextFromValue().
Referenced by CheckDuplicatePins(), CheckLibSymbol(), CheckLibSymbolGraphics(), DRC_TEST_PROVIDER_MATCHED_LENGTH::checkSkews(), DIALOG_BOARD_REANNOTATE::CoordTowxString(), GERBVIEW_FRAME::DisplayGridMsg(), GERBER_FILE_IMAGE::DisplayImageInfo(), DRAWING_TOOL::DrawBoardCharacteristics(), DRC_ENGINE::EvalRules(), PCB_NET_INSPECTOR_PANEL::formatLength(), DRC_TEST_PROVIDER::formatMsg(), SCH_LINE::GetItemDescription(), SCH_SHAPE::GetItemDescription(), DS_DRAW_ITEM_LINE::GetItemDescription(), DS_DRAW_ITEM_RECT::GetItemDescription(), PCB_TRACK::GetItemDescription(), SCH_BITMAP::GetMsgPanelInfo(), SCH_FIELD::GetMsgPanelInfo(), SCH_JUNCTION::GetMsgPanelInfo(), SCH_LABEL_BASE::GetMsgPanelInfo(), SCH_PIN::GetMsgPanelInfo(), SCH_TABLECELL::GetMsgPanelInfo(), SCH_TEXT::GetMsgPanelInfo(), SCH_TEXTBOX::GetMsgPanelInfo(), DS_DRAW_ITEM_BASE::GetMsgPanelInfo(), PCB_TUNING_PATTERN::GetMsgPanelInfo(), NETINFO_ITEM::GetMsgPanelInfo(), PAD::GetMsgPanelInfo(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_ALIGNED::GetMsgPanelInfo(), PCB_DIM_LEADER::GetMsgPanelInfo(), PCB_REFERENCE_IMAGE::GetMsgPanelInfo(), PCB_TABLECELL::GetMsgPanelInfo(), PCB_TARGET::GetMsgPanelInfo(), PCB_TEXT::GetMsgPanelInfo(), PCB_TEXTBOX::GetMsgPanelInfo(), PCB_TRACK::GetMsgPanelInfo(), PCB_VIA::GetMsgPanelInfo(), ZONE::GetMsgPanelInfo(), STROKE_PARAMS::GetMsgPanelInfo(), GetNetNavigatorItemText(), SYMBOL_SEARCH_HANDLER::getResultCell(), POWER_SEARCH_HANDLER::getResultCell(), TEXT_SEARCH_HANDLER::getResultCell(), LABEL_SEARCH_HANDLER::getResultCell(), DIALOG_BOARD_REANNOTATE::MakeSampleText(), PCB_BASE_FRAME::MessageTextFromCoord(), test::DRC_TEST_PROVIDER_DIFF_PAIR_COUPLING::Run(), DRC_TEST_PROVIDER_MATCHED_LENGTH::runInternal(), DIALOG_BOARD_STATISTICS::saveReportClicked(), TUNING_STATUS_VIEW_ITEM::SetCurrent(), TUNING_STATUS_VIEW_ITEM::SetMinMax(), EDA_SHAPE::ShapeGetMsgPanelInfo(), showCoord(), TRACK_WIDTH_MENU::update(), DIFF_PAIR_MENU::update(), VIA_SIZE_MENU::update(), DIALOG_POSITION_RELATIVE::updateAnchorInfo(), BOARD_NETLIST_UPDATER::updateCopperZoneNets(), DIALOG_BOARD_STATISTICS::updateDrillGrid(), PCB_CONTROL::UpdateMessagePanel(), PL_EDITOR_FRAME::UpdateMsgPanelInfo(), SCH_BASE_FRAME::UpdateStatusBar(), GERBVIEW_FRAME::UpdateStatusBar(), PCB_BASE_FRAME::UpdateStatusBar(), and DIALOG_BOARD_STATISTICS::updateWidets().
|
inline |
Converts aTextValue in aUnits to internal units used by the frame.
Allows the return of an empty optional if the string represents a null value (currently empty string)
aType | is the type of this value, and controls the way the string is converted to a value |
aTextValue | A reference to a wxString object containing the string to convert. |
Definition at line 175 of file units_provider.h.
References EDA_UNIT_UTILS::UI::DoubleValueFromString(), GetIuScale(), GetUserUnits(), and NullUiString.
Referenced by WX_GRID::GetOptionalUnitValue(), and WX_GRID::onCellEditorHidden().
|
inline |
Definition at line 46 of file units_provider.h.
References m_userUnits.
Referenced by EDA_BASE_FRAME::ChangeUserUnits(), PCB::IFACE::CreateKiWindow(), PCB_DIMENSION_BASE::GetMsgPanelInfo(), PCB_DIM_ALIGNED::GetMsgPanelInfo(), EDA_DRAW_FRAME::LoadSettings(), DRC_TEST_PROVIDER::RunTests(), DRC_ENGINE::RunTests(), SaveFileAs(), and EDA_DRAW_FRAME::ToggleUserUnits().
|
inline |
Converts an optional aValue in internal units into a united string.
For readability, trailing 0s are removed if the mantissa has 3 or more digits. This function should be used to display values in dialogs because a value entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid truncation or rounding made just by the printf function.
aValue | = optional value in internal units |
aAddUnitLabel | = true to add symbol unit to the string value |
aType | is the type of this value, and controls the way the value is converted to a string, and the suitable unit |
Definition at line 104 of file units_provider.h.
References GetIuScale(), GetUserUnits(), NullUiString, and EDA_UNIT_UTILS::UI::StringFromValue().
Referenced by WX_GRID::onCellEditorHidden(), and WX_GRID::SetOptionalUnitValue().
|
inline |
Definition at line 114 of file units_provider.h.
References EDA_ANGLE::AsDegrees(), EDA_UNIT_UTILS::UI::StringFromValue(), and unityScale.
|
inline |
Converts aValue in internal units into a united string.
For readability, trailing 0s are removed if the mantissa has 3 or more digits. This function should be used to display values in dialogs because a value entered in mm (for instance 2.0 mm) could need up to 8 digits mantissa if displayed in inch to avoid truncation or rounding made just by the printf function.
aValue | = value in internal units |
aAddUnitLabel | = true to add symbol unit to the string value |
aType | is the type of this value, and controls the way the value is converted to a string, and the suitable unit |
Definition at line 83 of file units_provider.h.
References GetIuScale(), GetUserUnits(), and EDA_UNIT_UTILS::UI::StringFromValue().
Referenced by DIALOG_PLOT::applyPlotSettings(), PANEL_SETUP_BOARD_STACKUP::computeBoardThickness(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), PAD::doCheckPad(), DRAWING_TOOL::DrawSpecificationStackup(), VALIDATION_ERROR_TOO_LARGE< T >::Format(), VALIDATION_ERROR_TOO_SMALL< T >::Format(), DRC_TEST_PROVIDER::formatMsg(), PIN_TABLE_DATA_MODEL::GetValue(), FIELDS_GRID_TABLE::GetValue(), PCB_FIELDS_GRID_TABLE::GetValue(), BOARD_INSPECTION_TOOL::InspectClearance(), BOARD_INSPECTION_TOOL::InspectDRCError(), PANEL_SETUP_BOARD_STACKUP::lazyBuildRowUI(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), WX_GRID::onCellEditorHidden(), DIALOG_TRACK_VIA_PROPERTIES::onUnitsChanged(), reportMax(), reportMin(), reportOpt(), PANEL_SETUP_BOARD_STACKUP::setDefaultLayerWidths(), WX_GRID::SetUnitValue(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), PANEL_FP_EDITOR_DEFAULTS::TransferDataFromWindow(), PANEL_SETUP_TEXT_AND_GRAPHICS::TransferDataFromWindow(), PANEL_SETUP_CONSTRAINTS::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::Validate(), and DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Validate().
|
inline |
Converts aTextValue in aUnits to internal units used by the frame.
aType | is the type of this value, and controls the way the string is converted to a value |
aTextValue | A reference to a wxString object containing the string to convert. |
Definition at line 155 of file units_provider.h.
References EDA_UNIT_UTILS::UI::DoubleValueFromString(), GetIuScale(), and GetUserUnits().
Referenced by PIN_TABLE_DATA_MODEL::compare(), PANEL_SETUP_BOARD_STACKUP::computeBoardThickness(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), WX_GRID::GetUnitValue(), PANEL_SETUP_BOARD_STACKUP::onAdjustDielectricThickness(), WX_GRID::onCellEditorHidden(), PANEL_SETUP_BOARD_STACKUP::onCopperLayersSelCount(), PANEL_SETUP_TRACKS_AND_VIAS::OnSortDiffPairsClick(), PANEL_SETUP_TRACKS_AND_VIAS::OnSortTrackWidthsClick(), PANEL_SETUP_TRACKS_AND_VIAS::OnSortViaSizesClick(), PANEL_SETUP_BOARD_STACKUP::onThicknessChange(), PANEL_SETUP_BOARD_STACKUP::setDefaultLayerWidths(), PIN_TABLE_DATA_MODEL::SetValue(), FIELDS_GRID_TABLE::SetValue(), PCB_FIELDS_GRID_TABLE::SetValue(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), and DIALOG_FOOTPRINT_PROPERTIES::Validate().
|
private |
Definition at line 200 of file units_provider.h.
Referenced by GetIuScale().
|
private |
Definition at line 201 of file units_provider.h.
Referenced by GetUserUnits(), and SetUserUnits().
|
inlinestatic |
The string that is used in the UI to represent a null value.
Definition at line 197 of file units_provider.h.
Referenced by WX_GRID::GetOptionalUnitValue(), WX_GRID::onCellEditorHidden(), OptionalValueFromString(), and StringFromOptionalValue().