113 m_bold->SetIsCheckButton();
155 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
161 [&]( wxCommandEvent& evt )
184 auto updateEventHandler =
185 [&]( wxCommandEvent& evt )
194 m_txtValue->Bind( wxEVT_TEXT, updateEventHandler );
195 m_txtPrefix->Bind( wxEVT_TEXT, updateEventHandler );
196 m_txtSuffix->Bind( wxEVT_TEXT, updateEventHandler );
198 m_cbUnits->Bind( wxEVT_CHOICE, updateEventHandler );
204 [&]( wxCommandEvent& aEvt )
214 [&]( wxCommandEvent& aEvt )
266 wxMessageBox(
_(
"This item was on a non-existing layer.\n"
267 "It has been moved to the first defined layer." ) );
321 std::optional<double> value = lengthConstraint ? lengthConstraint->
GetValue() : std::nullopt;
340 m_cbTextFrame->SetSelection(
static_cast<int>( leader->GetTextBorder() ) );
342 return DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataToWindow();
348 if( !DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataFromWindow() )
358 wxMessageBox(
_(
"Enter a positive length for a driving dimension." ),
359 _(
"Invalid Value" ), wxOK | wxICON_ERROR,
this );
369 bool pushCommit = (
m_dimension->GetEditFlags() == 0 );
382 wxT(
"value dimension edited without owning its commit; value mode would be lost" ) );
387 commit.
Push(
_(
"Edit Dimension Properties" ) );
389 if( drivingConstraint )
480 std::optional<int> length;
493 [&](
BOARD_ITEM* aItem ) { aCommit.Modify( aItem ); },
494 [&](
BOARD_ITEM* aItem ) { aCommit.Add( aItem ); },
495 [&](
BOARD_ITEM* aItem ) { aCommit.Remove( aItem ); } );
516 std::vector<PCB_SHAPE*> modified;
523 commit.Modify( aItem );
527 if( !commit.
Empty() )
555 if( aEvent.IsChecked() )
568 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
constexpr EDA_IU_SCALE pcbIUScale
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
CONSTRAINT_DIAGNOSIS ApplyConstraintImmediately(BOARD *aBoard, const PCB_CONSTRAINT *aConstraint, std::vector< PCB_SHAPE * > *aModified, const std::function< void(BOARD_ITEM *)> &aBeforeModify, const std::set< KIID > &aFixedShapes)
Solve a just-created constraint's cluster so the geometry snaps to satisfy it (SolidWorks-style),...
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
wxString ConvertCrossReferencesToKIIDs(const wxString &aSource) const
Convert cross-references back and forth between ${refDes:field} and ${kiid:field}.
wxString ConvertKIIDsToCrossReferences(const wxString &aSource) const
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
wxStaticText * m_lblTextThickness
wxCheckBox * m_cbSuppressZeroes
wxTextCtrl * m_txtLineThickness
PCB_LAYER_BOX_SELECTOR * m_cbLeaderLayer
BITMAP_BUTTON * m_separator2
wxStaticBoxSizer * m_sizerCenter
BITMAP_BUTTON * m_alignCenter
wxComboBox * m_cbTextOrientation
PCB_LAYER_BOX_SELECTOR * m_cbCenterLayer
wxStaticText * m_lblTextPosXUnits
wxChoice * m_choiceValueMode
wxStaticText * m_lblTextPosYUnits
wxStaticText * m_lblTextThicknessUnits
wxStaticText * m_lblArrowLength
wxTextCtrl * m_txtTextPosX
wxStaticText * m_lblExtensionOvershootUnits
wxStaticText * m_lblTextPosX
wxTextCtrl * m_txtExtensionOffset
wxStaticText * m_staticTextPreview
wxChoice * m_cbUnitsFormat
wxStaticText * m_lblTextHeight
wxTextCtrl * m_txtArrowLength
wxStaticText * m_lblTextWidthUnits
wxStaticBoxSizer * m_sizerText
wxStaticText * m_lblTextPositionMode
BITMAP_BUTTON * m_alignRight
wxCheckBox * m_cbKeepAligned
BITMAP_BUTTON * m_mirrored
wxTextCtrl * m_txtTextPosY
wxStaticText * m_lblTextPosY
wxStaticText * m_lblTextWidth
wxChoice * m_cbTextPositionMode
wxTextCtrl * m_txtTextHeight
wxTextCtrl * m_txtTextThickness
DIALOG_DIMENSION_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Dimension Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU)
wxTextCtrl * m_txtTextWidth
wxStaticBoxSizer * m_sizerLeader
wxStaticText * m_lblExtensionOffset
wxTextCtrl * m_txtLeaderValue
wxStaticText * m_lblExtensionOffsetUnits
wxStaticText * m_lblLineThickness
wxStaticText * m_lblArrowLengthUnits
wxStaticBoxSizer * m_sizerFormat
BITMAP_BUTTON * m_separator1
wxStaticText * m_lblExtensionOvershoot
BITMAP_BUTTON * m_alignLeft
BITMAP_BUTTON * m_separator0
PCB_LAYER_BOX_SELECTOR * m_cbLayer
wxStaticText * m_lblLineThicknessUnits
BITMAP_BUTTON * m_separator3
wxStaticText * m_lblTextHeightUnits
wxChoice * m_cbArrowDirection
wxTextCtrl * m_txtExtensionOvershoot
wxStaticText * m_lblTextOrientation
UNIT_BINDER m_orientation
bool TransferDataFromWindow() override
void onFontSelected(wxCommandEvent &aEvent) override
PCB_BASE_EDIT_FRAME * m_frame
UNIT_BINDER m_textThickness
PCB_LAYER_BOX_SELECTOR * m_cbLayerActual
bool TransferDataToWindow() override
void buildValueModeChoice()
Populate the value-mode choice, offering the Driving entry only when DimensionCanDrive.
void onBoldToggle(wxCommandEvent &aEvent) override
PCB_DIMENSION_BASE * m_dimension
PCB_CONSTRAINT * stageValueModeConstraint(BOARD_COMMIT &aCommit)
Stages FIXED_LENGTH constraint for the mode on aCommit Returns live driving constraint to re solve or...
DIM_VALUE_MODE selectedValueMode() const
The value mode the current choice selection represents.
bool parseDrivingLength(int &aLengthIU) const
Parses value field as Driving length into aLengthIU in internal units Returns false for non positive ...
wxTextCtrl * m_txtValueActual
void updateDimensionFromDialog(PCB_DIMENSION_BASE *aTarget)
DIALOG_DIMENSION_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, BOARD_ITEM *aItem)
void setValueModeSelection(DIM_VALUE_MODE aMode)
Select the choice entry for aMode, falling back to Driven when Driving is not offered.
UNIT_BINDER m_extensionOvershoot
EDA_UNITS m_valueFieldUnits
UNIT_BINDER m_lineThickness
~DIALOG_DIMENSION_PROPERTIES()
bool m_valueModeHasDriving
bool valueFieldTracksMeasurement() const
True when field mirrors geometry in Driven mode refreshable by other edits.
void onAlignButton(wxCommandEvent &aEvent) override
UNIT_BINDER m_extensionOffset
PCB_DIMENSION_BASE * m_previewDimension
void resolveDrivingConstraint(PCB_CONSTRAINT *aConstraint)
Re-solve so the geometry bound to a now-driving dimension follows its entered length.
bool hasValueModeChoice() const
True for value bearing dims aligned orthogonal or radial centre and leader have no value.
void onThickness(wxCommandEvent &aEvent) override
UNIT_BINDER m_arrowLength
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
KICAD_T Type() const
Returns the type of object.
virtual void SetTextPos(const VECTOR2I &aPoint)
void SetMirrored(bool isMirrored)
virtual void SetTextWidth(int aWidth)
virtual void SetTextHeight(int aHeight)
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
virtual bool IsStroke() const
Common, abstract interface for edit frames.
A geometric constraint between board items (issue #2329).
std::optional< double > GetValue() const
void Update()
Update the dimension's cached text and geometry.
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
void SetPrefix(const wxString &aPrefix)
void SetExtensionOffset(int aOffset)
void SetSuppressZeroes(bool aSuppress)
void SetOverrideTextEnabled(bool aOverride)
void SetSuffix(const wxString &aSuffix)
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
void SetLineThickness(int aWidth)
void SetArrowLength(int aLength)
void SetPrecision(DIM_PRECISION aPrecision)
void SetArrowDirection(const DIM_ARROW_DIRECTION &aDirection)
void SetOverrideText(const wxString &aValue)
void SetUnitsMode(DIM_UNITS_MODE aMode)
void SetKeepTextAligned(bool aKeepAligned)
For better understanding of the points that make a dimension:
A leader is a dimension-like object pointing to a specific point.
void SetTextThickness(int aWidth) override
The TextThickness is that set by the user.
void SetTextAngle(const EDA_ANGLE &aAngle) override
DIM_VALUE_MODE DimensionValueMode(BOARD *aBoard, const PCB_DIMENSION_BASE *aDimension)
The value mode aDimension is in, derived from state: a self driving length means Driving,...
PCB_CONSTRAINT * FindDimensionLengthConstraint(BOARD *aBoard, const PCB_DIMENSION_BASE *aDimension)
Self FIXED_LENGTH constraint whose members are exactly aDimension START and END or nullptr the drivin...
bool DimensionCanDrive(BOARD *aBoard, const PCB_DIMENSION_BASE *aDimension)
True when Driving mode may be offered for aDimension needs both endpoints bound via DimensionEndpoint...
PCB_CONSTRAINT * SetDimensionValueMode(BOARD *aBoard, PCB_DIMENSION_BASE *aDimension, DIM_VALUE_MODE aMode, std::optional< int > aDrivingLengthIU, const std::optional< wxString > &aOverrideText, const std::function< void(BOARD_ITEM *)> &aBeforeModify, const std::function< void(BOARD_ITEM *)> &aStageAdd, const std::function< void(BOARD_ITEM *)> &aBeforeRemove)
Apply a value mode transition to aDimension Driving creates or updates the driving length with aDrivi...
DIM_VALUE_MODE
Mode a value bearing dimension value is in Driven mirrors measured geometry Driving forces geometry t...
#define IN_EDIT
Item currently edited.
int GetPenSizeForBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
PCB_LAYER_ID
A quick note on layer IDs:
KICOMMON_API wxString StringFromValue(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, double aValue, bool aAddUnitsText=false, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Return the string from aValue according to aUnits (inch, mm ...) for display.
KICOMMON_API double DoubleValueFromString(const EDA_IU_SCALE &aIuScale, EDA_UNITS aUnits, const wxString &aTextValue, EDA_DATA_TYPE aType=EDA_DATA_TYPE::DISTANCE)
Convert aTextValue to a double.
DIM_TEXT_POSITION
Where to place the text on a dimension.
@ MANUAL
Text placement is manually set by the user.
DIM_UNITS_FORMAT
How to display the units in a dimension's text.
DIM_TEXT_BORDER
Frame to show around dimension text.
static const long long MM
@ GR_TEXT_H_ALIGN_INDETERMINATE
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
VECTOR2< int32_t > VECTOR2I