|
KiCad PCB EDA Suite
|
Base class for DRC rule editor panels that display input fields overlaid on a bitmap. More...
#include <drc_re_bitmap_overlay_panel.h>
Public Member Functions | |
| DRC_RE_BITMAP_OVERLAY_PANEL (wxWindow *aParent, wxWindowID aId=wxID_ANY) | |
| virtual | ~DRC_RE_BITMAP_OVERLAY_PANEL () |
| void | SetBackgroundBitmap (BITMAPS aBitmap) |
| Set the background bitmap for this panel. | |
| bool | TransferDataToWindow () override |
| bool | TransferDataFromWindow () override |
| void | ClearFieldErrors () |
| Clear error indicators from all fields. | |
| void | ShowFieldError (const wxString &aFieldId) |
| Show an error indicator on the specified field. | |
| virtual bool | ValidateInputs (int *aErrorCount, wxString *aValidationMessage)=0 |
| virtual wxString | GenerateRule (const RULE_GENERATION_CONTEXT &aContext)=0 |
Protected Member Functions | |
| template<typename T> | |
| DRC_RE_OVERLAY_FIELD * | AddField (const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, long aStyle=0) |
| Create and position a field control on the bitmap overlay. | |
| template<typename T> | |
| DRC_RE_OVERLAY_FIELD * | AddFieldWithUnits (const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, UNIT_BINDER *aUnitBinder, long aStyle=0) |
| Create and position a field control with unit binding. | |
| DRC_RE_OVERLAY_FIELD * | AddCheckbox (const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition) |
| Create and position a checkbox control on the bitmap overlay. | |
| void | LoadBitmap () |
| Load the appropriate bitmap variant for the current theme and DPI. | |
| void | PositionFields () |
| Position all fields based on the current scale factor. | |
| void | SetupFieldStyling (wxControl *aControl) |
| Apply transparent styling to a field control. | |
| wxString | buildRule (const RULE_GENERATION_CONTEXT &aContext, const std::vector< wxString > &aConstraintClauses) const |
Static Protected Member Functions | |
| static wxString | sanitizeRuleName (const wxString &aRuleName) |
| static wxString | escapeCondition (const wxString &aCondition) |
| static wxString | trimTrailingZeros (const wxString &aValue) |
| static wxString | formatDouble (double aValue, int aPrecision=6) |
Private Member Functions | |
| void | OnPaint (wxPaintEvent &aEvent) |
| void | OnDPIChanged (wxDPIChangedEvent &aEvent) |
| void | OnThemeChange (wxSysColourChangedEvent &aEvent) |
| void | OnFieldFocus (wxFocusEvent &aEvent) |
| void | OnFieldBlur (wxFocusEvent &aEvent) |
| void | PositionLabel (DRC_RE_OVERLAY_FIELD *aField) |
| Position a label relative to its field control based on the label position setting. | |
Private Attributes | |
| wxBitmap | m_bitmap |
| Current background bitmap. | |
| BITMAPS | m_bitmapId |
| BITMAPS enum value. | |
| wxSize | m_baseBitmapSize |
| Bitmap size at 1x scale. | |
| std::vector< std::unique_ptr< DRC_RE_OVERLAY_FIELD > > | m_fields |
| All overlay fields. | |
| std::map< wxString, DRC_RE_OVERLAY_FIELD * > | m_fieldIdMap |
| Field ID to field lookup. | |
Base class for DRC rule editor panels that display input fields overlaid on a bitmap.
This class provides infrastructure for creating constraint editor panels where input fields are precisely positioned over explanatory constraint diagrams. The bitmap serves as a visual guide showing what each field value represents.
Derived classes should:
Definition at line 60 of file drc_re_bitmap_overlay_panel.h.
| DRC_RE_BITMAP_OVERLAY_PANEL::DRC_RE_BITMAP_OVERLAY_PANEL | ( | wxWindow * | aParent, |
| wxWindowID | aId = wxID_ANY ) |
Definition at line 36 of file drc_re_bitmap_overlay_panel.cpp.
References INVALID_BITMAP, m_baseBitmapSize, m_bitmapId, OnDPIChanged(), OnPaint(), and OnThemeChange().
Referenced by DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL(), DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL::DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL(), DRC_RE_BOOL_INPUT_OVERLAY_PANEL::DRC_RE_BOOL_INPUT_OVERLAY_PANEL(), DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL::DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL(), DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL(), DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL::DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL(), DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL::DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL(), DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL::DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL(), and DRC_RE_VIA_STYLE_OVERLAY_PANEL::DRC_RE_VIA_STYLE_OVERLAY_PANEL().
|
virtual |
Definition at line 51 of file drc_re_bitmap_overlay_panel.cpp.
|
protected |
Create and position a checkbox control on the bitmap overlay.
| aId | String identifier for this checkbox. |
| aPosition | Position specification in 1x bitmap coordinates. |
Definition at line 248 of file drc_re_bitmap_overlay_panel.cpp.
References DRC_RE_OVERLAY_FIELD::CreateLabel(), DRC_RE_OVERLAY_FIELD::HasLabel(), m_fieldIdMap, m_fields, PositionLabel(), SetupFieldStyling(), DRC_RE_FIELD_POSITION::xStart, and DRC_RE_FIELD_POSITION::yTop.
Referenced by DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL::DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL(), DRC_RE_BOOL_INPUT_OVERLAY_PANEL::DRC_RE_BOOL_INPUT_OVERLAY_PANEL(), and DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL::DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL().
|
protected |
Create and position a field control on the bitmap overlay.
| T | The wxWindow-derived control type to create. |
| aId | String identifier for this field (used for error display and lookup). |
| aPosition | Position specification in 1x bitmap coordinates. |
| aStyle | Window style flags passed to the control constructor |
Definition at line 169 of file drc_re_bitmap_overlay_panel.h.
References DRC_RE_OVERLAY_FIELD::CreateLabel(), DRC_RE_OVERLAY_FIELD::HasLabel(), m_fieldIdMap, m_fields, PositionLabel(), SetupFieldStyling(), T, DRC_RE_FIELD_POSITION::xEnd, DRC_RE_FIELD_POSITION::xStart, and DRC_RE_FIELD_POSITION::yTop.
Referenced by AddFieldWithUnits(), DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL(), DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL::DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL(), DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL(), DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL::DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL(), DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL::DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL(), and DRC_RE_VIA_STYLE_OVERLAY_PANEL::DRC_RE_VIA_STYLE_OVERLAY_PANEL().
|
protected |
Create and position a field control with unit binding.
| T | The wxWindow-derived control type to create. |
| aId | String identifier for this field. |
| aPosition | Position specification in 1x bitmap coordinates. |
| aUnitBinder | UNIT_BINDER to associate with this field for unit conversion. |
| aStyle | Window style flags passed to the control constructor |
Definition at line 205 of file drc_re_bitmap_overlay_panel.h.
References AddField(), and DRC_RE_OVERLAY_FIELD::SetUnitBinder().
|
inlineprotectedinherited |
Definition at line 121 of file drc_re_content_panel_base.h.
References RULE_GENERATION_CONTEXT::comment, RULE_GENERATION_CONTEXT::conditionExpression, escapeCondition(), RULE_GENERATION_CONTEXT::layerClause, RULE_GENERATION_CONTEXT::ruleName, and sanitizeRuleName().
| void DRC_RE_BITMAP_OVERLAY_PANEL::ClearFieldErrors | ( | ) |
Clear error indicators from all fields.
Definition at line 232 of file drc_re_bitmap_overlay_panel.cpp.
References m_fields.
|
inlinestaticprotectedinherited |
Definition at line 94 of file drc_re_content_panel_base.h.
References CTX_QUOTED_STR, and EscapeString().
Referenced by buildRule().
|
inlinestaticprotectedinherited |
Definition at line 115 of file drc_re_content_panel_base.h.
References trimTrailingZeros().
|
pure virtualinherited |
Implemented in DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL, DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL, DRC_RE_BOOL_INPUT_OVERLAY_PANEL, DRC_RE_CUSTOM_RULE_PANEL, DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL, DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL, DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL, DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL, DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL, DRC_RE_VIA_STYLE_OVERLAY_PANEL, and PANEL_DRC_RULE_EDITOR.
|
protected |
Load the appropriate bitmap variant for the current theme and DPI.
Definition at line 110 of file drc_re_bitmap_overlay_panel.cpp.
References INVALID_BITMAP, KiBitmapBundle(), m_baseBitmapSize, m_bitmap, m_bitmapId, and Refresh().
Referenced by OnDPIChanged(), OnThemeChange(), and SetBackgroundBitmap().
|
private |
Definition at line 67 of file drc_re_bitmap_overlay_panel.cpp.
References LoadBitmap(), PositionFields(), and Refresh().
Referenced by DRC_RE_BITMAP_OVERLAY_PANEL().
|
private |
Definition at line 92 of file drc_re_bitmap_overlay_panel.cpp.
Referenced by SetupFieldStyling().
|
private |
Definition at line 84 of file drc_re_bitmap_overlay_panel.cpp.
Referenced by SetupFieldStyling().
|
private |
Definition at line 56 of file drc_re_bitmap_overlay_panel.cpp.
References m_bitmap.
Referenced by DRC_RE_BITMAP_OVERLAY_PANEL().
|
private |
Definition at line 76 of file drc_re_bitmap_overlay_panel.cpp.
References LoadBitmap(), and Refresh().
Referenced by DRC_RE_BITMAP_OVERLAY_PANEL().
|
protected |
Position all fields based on the current scale factor.
Definition at line 134 of file drc_re_bitmap_overlay_panel.cpp.
References m_bitmap, m_fields, PositionLabel(), DRC_RE_FIELD_POSITION::xEnd, DRC_RE_FIELD_POSITION::xStart, and DRC_RE_FIELD_POSITION::yTop.
Referenced by DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL(), DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL::DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL(), DRC_RE_BOOL_INPUT_OVERLAY_PANEL::DRC_RE_BOOL_INPUT_OVERLAY_PANEL(), DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL::DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL(), DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL(), DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL::DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL(), DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL::DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL(), DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL::DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL(), DRC_RE_VIA_STYLE_OVERLAY_PANEL::DRC_RE_VIA_STYLE_OVERLAY_PANEL(), and OnDPIChanged().
|
private |
Position a label relative to its field control based on the label position setting.
| aField | The overlay field containing the label to position. |
Definition at line 171 of file drc_re_bitmap_overlay_panel.cpp.
References BOTTOM, GAP, DRC_RE_OVERLAY_FIELD::GetControl(), DRC_RE_OVERLAY_FIELD::GetLabel(), DRC_RE_OVERLAY_FIELD::GetPosition(), DRC_RE_FIELD_POSITION::labelPosition, LEFT, NONE, RIGHT, and TOP.
Referenced by AddCheckbox(), AddField(), and PositionFields().
|
inlinestaticprotectedinherited |
Definition at line 63 of file drc_re_content_panel_base.h.
References result.
Referenced by buildRule().
| void DRC_RE_BITMAP_OVERLAY_PANEL::SetBackgroundBitmap | ( | BITMAPS | aBitmap | ) |
Set the background bitmap for this panel.
| aBitmap | The BITMAPS enum value identifying the constraint diagram. |
Definition at line 124 of file drc_re_bitmap_overlay_panel.cpp.
References LoadBitmap(), m_baseBitmapSize, m_bitmap, and m_bitmapId.
Referenced by DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL(), DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL::DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL(), DRC_RE_BOOL_INPUT_OVERLAY_PANEL::DRC_RE_BOOL_INPUT_OVERLAY_PANEL(), DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL::DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL(), DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL(), DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL::DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL(), DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL::DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL(), DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL::DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL(), and DRC_RE_VIA_STYLE_OVERLAY_PANEL::DRC_RE_VIA_STYLE_OVERLAY_PANEL().
|
protected |
Apply transparent styling to a field control.
| aControl | The control to style. |
Definition at line 99 of file drc_re_bitmap_overlay_panel.cpp.
References OnFieldBlur(), and OnFieldFocus().
Referenced by AddCheckbox(), and AddField().
| void DRC_RE_BITMAP_OVERLAY_PANEL::ShowFieldError | ( | const wxString & | aFieldId | ) |
Show an error indicator on the specified field.
| aFieldId | The string identifier of the field to highlight. |
Definition at line 239 of file drc_re_bitmap_overlay_panel.cpp.
References m_fieldIdMap.
|
overridevirtual |
Implements DRC_RULE_EDITOR_CONTENT_PANEL_BASE.
Reimplemented in DRC_RE_BOOL_INPUT_OVERLAY_PANEL, DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL, DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL, DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL, DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL, DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL, and DRC_RE_VIA_STYLE_OVERLAY_PANEL.
Definition at line 225 of file drc_re_bitmap_overlay_panel.cpp.
|
overridevirtual |
Implements DRC_RULE_EDITOR_CONTENT_PANEL_BASE.
Reimplemented in DRC_RE_BOOL_INPUT_OVERLAY_PANEL, DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL, DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL, DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL, DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL, DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL, and DRC_RE_VIA_STYLE_OVERLAY_PANEL.
Definition at line 218 of file drc_re_bitmap_overlay_panel.cpp.
|
inlinestaticprotectedinherited |
Definition at line 99 of file drc_re_content_panel_base.h.
References result.
Referenced by formatDouble().
|
pure virtualinherited |
Implemented in DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL, DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL, DRC_RE_BOOL_INPUT_OVERLAY_PANEL, DRC_RE_CUSTOM_RULE_PANEL, DRC_RE_MIN_TXT_HT_TH_OVERLAY_PANEL, DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL, DRC_RE_PERMITTED_LAYERS_OVERLAY_PANEL, DRC_RE_ROUTING_DIFF_PAIR_OVERLAY_PANEL, DRC_RE_ROUTING_WIDTH_OVERLAY_PANEL, DRC_RE_VIA_STYLE_OVERLAY_PANEL, and PANEL_DRC_RULE_EDITOR.
|
private |
Bitmap size at 1x scale.
Definition at line 162 of file drc_re_bitmap_overlay_panel.h.
Referenced by DRC_RE_BITMAP_OVERLAY_PANEL(), LoadBitmap(), and SetBackgroundBitmap().
|
private |
Current background bitmap.
Definition at line 160 of file drc_re_bitmap_overlay_panel.h.
Referenced by LoadBitmap(), OnPaint(), PositionFields(), and SetBackgroundBitmap().
|
private |
BITMAPS enum value.
Definition at line 161 of file drc_re_bitmap_overlay_panel.h.
Referenced by DRC_RE_BITMAP_OVERLAY_PANEL(), LoadBitmap(), and SetBackgroundBitmap().
|
private |
Field ID to field lookup.
Definition at line 164 of file drc_re_bitmap_overlay_panel.h.
Referenced by AddCheckbox(), AddField(), and ShowFieldError().
|
private |
All overlay fields.
Definition at line 163 of file drc_re_bitmap_overlay_panel.h.
Referenced by AddCheckbox(), AddField(), ClearFieldErrors(), and PositionFields().