39 m_cbLayerActual( m_cbLayer ),
40 m_txtValueActual( m_txtValue ),
41 m_textWidth( aParent, m_lblTextWidth, m_txtTextWidth, m_lblTextWidthUnits ),
42 m_textHeight( aParent, m_lblTextHeight, m_txtTextHeight, m_lblTextHeightUnits ),
43 m_textThickness( aParent, m_lblTextThickness, m_txtTextThickness, m_lblTextThicknessUnits ),
44 m_textPosX( aParent, m_lblTextPosX, m_txtTextPosX, m_lblTextPosXUnits ),
45 m_textPosY( aParent, m_lblTextPosY, m_txtTextPosY, m_lblTextPosYUnits ),
46 m_orientation( aParent, m_lblTextOrientation, m_cbTextOrientation, nullptr ),
47 m_lineThickness( aParent, m_lblLineThickness, m_txtLineThickness, m_lblLineThicknessUnits ),
48 m_arrowLength( aParent, m_lblArrowLength, m_txtArrowLength, m_lblArrowLengthUnits ),
49 m_extensionOffset( aParent, m_lblExtensionOffset, m_txtExtensionOffset, m_lblExtensionOffsetUnits ),
50 m_extensionOvershoot( aParent, m_lblExtensionOvershoot, m_txtExtensionOvershoot, m_lblExtensionOvershootUnits )
138 double rot_list[] = { 0.0, 90.0, -90.0, 180.0 };
144 [&]( wxCommandEvent& evt )
152 auto updateEventHandler =
153 [&]( wxCommandEvent& evt )
162 m_txtValue->Bind( wxEVT_TEXT, updateEventHandler );
163 m_txtPrefix->Bind( wxEVT_TEXT, updateEventHandler );
164 m_txtSuffix->Bind( wxEVT_TEXT, updateEventHandler );
166 m_cbUnits->Bind( wxEVT_CHOICE, updateEventHandler );
172 [&]( wxCommandEvent& aEvt )
182 [&]( wxCommandEvent& aEvt )
208 case DIM_UNITS_MODE::INCHES:
m_cbUnits->SetSelection( 0 );
break;
209 case DIM_UNITS_MODE::MILS:
m_cbUnits->SetSelection( 1 );
break;
210 case DIM_UNITS_MODE::MILLIMETRES:
m_cbUnits->SetSelection( 2 );
break;
211 case DIM_UNITS_MODE::AUTOMATIC:
m_cbUnits->SetSelection( 3 );
break;
222 wxMessageBox(
_(
"This item was on a non-existing layer.\n"
223 "It has been moved to the first defined layer." ) );
284 m_cbTextFrame->SetSelection(
static_cast<int>( leader->GetTextBorder() ) );
286 return DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataToWindow();
292 if( !DIALOG_DIMENSION_PROPERTIES_BASE::TransferDataFromWindow() )
312 commit.
Push(
_(
"Edit Dimension Properties" ) );
341 if( aEvent.IsChecked() )
354 if( btn->IsChecked() && btn != aEvent.GetEventObject() )
388 case 0: aTarget->
SetUnitsMode( DIM_UNITS_MODE::INCHES );
break;
389 case 1: aTarget->
SetUnitsMode( DIM_UNITS_MODE::MILS );
break;
390 case 2: aTarget->
SetUnitsMode( DIM_UNITS_MODE::MILLIMETRES );
break;
391 case 3: aTarget->
SetUnitsMode( DIM_UNITS_MODE::AUTOMATIC );
break;
401 if( tpm == DIM_TEXT_POSITION::MANUAL )
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap)
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
virtual PCB_LAYER_ID GetLayer() const
Return the primary layer this item is on.
virtual void SetLayer(PCB_LAYER_ID aLayer)
Set the layer this item is on.
Information pertinent to a Pcbnew printed circuit board.
bool IsLayerEnabled(PCB_LAYER_ID aLayer) const
A proxy function that calls the correspondent function in m_BoardSettings tests whether a given layer...
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)
Create an undo entry for an item that has been already modified.
Class DIALOG_DIMENSION_PROPERTIES_BASE.
wxCheckBox * m_cbSuppressZeroes
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_lblArrowLength
wxTextCtrl * m_txtTextPosX
wxTextCtrl * m_txtExtensionOffset
wxStaticText * m_staticTextPreview
wxChoice * m_cbUnitsFormat
wxTextCtrl * m_txtArrowLength
wxStaticBoxSizer * m_sizerText
wxStaticText * m_lblTextPositionMode
BITMAP_BUTTON * m_alignRight
wxCheckBox * m_cbKeepAligned
BITMAP_BUTTON * m_mirrored
wxTextCtrl * m_txtTextPosY
wxChoice * m_cbTextPositionMode
wxStaticBoxSizer * m_sizerLeader
wxStaticText * m_lblExtensionOffset
wxTextCtrl * m_txtLeaderValue
wxStaticText * m_lblExtensionOffsetUnits
wxStaticText * m_lblArrowLengthUnits
wxStaticBoxSizer * m_sizerFormat
BITMAP_BUTTON * m_separator1
BITMAP_BUTTON * m_alignLeft
BITMAP_BUTTON * m_separator0
wxCheckBox * m_cbOverrideValue
BITMAP_BUTTON * m_separator3
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 onBoldToggle(wxCommandEvent &aEvent) override
PCB_DIMENSION_BASE * m_dimension
wxTextCtrl * m_txtValueActual
void updateDimensionFromDialog(PCB_DIMENSION_BASE *aTarget)
DIALOG_DIMENSION_PROPERTIES(PCB_BASE_EDIT_FRAME *aParent, BOARD_ITEM *aItem)
UNIT_BINDER m_extensionOvershoot
UNIT_BINDER m_lineThickness
~DIALOG_DIMENSION_PROPERTIES()
void onAlignButton(wxCommandEvent &aEvent) override
UNIT_BINDER m_extensionOffset
PCB_DIMENSION_BASE * m_previewDimension
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...
EDA_ITEM_FLAGS GetEditFlags() const
void SetFlags(EDA_ITEM_FLAGS aMask)
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
const VECTOR2I & GetTextPos() const
const EDA_ANGLE & GetTextAngle() const
void SetTextPos(const VECTOR2I &aPoint)
KIFONT::FONT * GetFont() const
void SetMirrored(bool isMirrored)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetTextWidth(int aWidth)
void SetTextThickness(int aWidth)
The TextThickness is that set by the user.
void SetTextHeight(int aHeight)
void SetBold(bool aBold)
Set the text to be bold - this will also update the font if needed.
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
int GetTextThickness() const
void SetItalic(bool aItalic)
Set the text to be italic - this will also update the font if needed.
void SetFont(KIFONT::FONT *aFont)
VECTOR2I GetTextSize() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
KIFONT::FONT * GetFontSelection(bool aBold, bool aItalic, bool aForDrawingSheet=false) const
bool HaveFontSelection() const
void SetFontSelection(KIFONT::FONT *aFont)
virtual bool IsStroke() const
int GetLayerSelection() const
int SetLayerSelection(int layer)
bool SetLayersHotkeys(bool value)
Common, abstract interface for edit frames.
void Update()
Update the dimension's cached text and geometry.
wxString GetOverrideText() const
wxString GetSuffix() const
void SetUnitsFormat(const DIM_UNITS_FORMAT aFormat)
int GetLineThickness() const
void SetPrefix(const wxString &aPrefix)
void SetExtensionOffset(int aOffset)
void SetSuppressZeroes(bool aSuppress)
DIM_TEXT_POSITION GetTextPositionMode() const
bool GetKeepTextAligned() const
DIM_PRECISION GetPrecision() const
wxString GetPrefix() const
void SetOverrideTextEnabled(bool aOverride)
void SetSuffix(const wxString &aSuffix)
DIM_UNITS_MODE GetUnitsMode() const
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
DIM_UNITS_FORMAT GetUnitsFormat() const
void SetLineThickness(int aWidth)
void SetArrowLength(int aLength)
void SetPrecision(DIM_PRECISION aPrecision)
bool GetSuppressZeroes() const
void SetOverrideText(const wxString &aValue)
wxString GetValueText() const
int GetExtensionOffset() const
int GetArrowLength() const
bool GetOverrideTextEnabled() const
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 SetBoardFrame(PCB_BASE_FRAME *aFrame)
void ShowNonActivatedLayers(bool aShow)
wxString GetShownText(bool aAllowExtraText, int aDepth=0) const override
Return the string actually shown after processing of the base text.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
virtual long long int GetValue()
Return the current value in Internal Units.
virtual void SetPrecision(int aLength)
Normally not needed, but can be used to set the precision when using internal units that are floats (...
virtual void SetUnits(EDA_UNITS aUnits)
Normally not needed (as the UNIT_BINDER inherits from the parent frame), but can be used to set to DE...
virtual EDA_ANGLE GetAngleValue()
virtual void SetAngleValue(const EDA_ANGLE &aValue)
virtual void ChangeValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion WITHOUT trigger...
virtual void SetValue(long long int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
void Show(bool aShow, bool aResize=false)
Show/hide the label, widget and units label.
void SetCoordType(ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Set the current origin transform mode.
#define IN_EDIT
Item currently edited.
int GetPenSizeForBold(int aTextSize)
int GetPenSizeForNormal(int aTextSize)
PCB_LAYER_ID
A quick note on layer IDs:
DIM_TEXT_POSITION
Where to place the text on a dimension.
DIM_UNITS_FORMAT
How to display the units in a dimension's text.
DIM_TEXT_BORDER
Frame to show around dimension text.
@ GR_TEXT_H_ALIGN_INDETERMINATE
constexpr KICAD_T BaseType(const KICAD_T aType)
Return the underlying type of the given type.
@ 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_DIMENSION_T
class PCB_DIMENSION_BASE: abstract dimension meta-type