KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DRC_RE_BITMAP_OVERLAY_PANEL Class Referenceabstract

Base class for DRC rule editor panels that display input fields overlaid on a bitmap. More...

#include <drc_re_bitmap_overlay_panel.h>

Inheritance diagram for DRC_RE_BITMAP_OVERLAY_PANEL:
DRC_RULE_EDITOR_CONTENT_PANEL_BASE DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL DRC_RE_ALLOWED_ORIENTATION_OVERLAY_PANEL DRC_RE_BOOL_INPUT_OVERLAY_PANEL DRC_RE_MATCHED_LENGTH_DIFF_PAIR_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 DRC_RE_VIAS_UNDER_SMD_OVERLAY_PANEL DRC_RE_VIA_STYLE_OVERLAY_PANEL

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, const wxString &aMessage)
 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 * AddControl (const wxString &aId, const DRC_RE_FIELD_POSITION &aPosition, T *aControl)
 Position a control on the bitmap overlay.
 
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 SetMinimumHeightDIP (int aHeight)
 Asks for a panel taller than its illustration.
 
void SetupFieldStyling (wxControl *aControl)
 Apply transparent styling to a field control.
 

Protected Attributes

wxBitmap m_bitmap
 Current background bitmap.
 
BITMAPS m_bitmapId
 BITMAPS enum value.
 
wxSize m_logicalBitmapSize
 Bitmap size in logical pixels.
 
int m_minHeightDIP = 0
 Height a subclass asks for, in DIP.
 
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.
 

Private Member Functions

void OnPaint (wxPaintEvent &aEvent)
 
void OnDPIChanged (wxDPIChangedEvent &aEvent)
 
void OnThemeChange (wxSysColourChangedEvent &aEvent)
 
wxColour pageBackground () const
 
std::optional< int > roomBeforeNextField (const DRC_RE_OVERLAY_FIELD *aField) const
 
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.
 
void PositionPrefixLabel (DRC_RE_OVERLAY_FIELD *aField)
 Position a prefix label to the left of its field control.
 

Detailed Description

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 57 of file drc_re_bitmap_overlay_panel.h.

Constructor & Destructor Documentation

◆ DRC_RE_BITMAP_OVERLAY_PANEL()

◆ ~DRC_RE_BITMAP_OVERLAY_PANEL()

DRC_RE_BITMAP_OVERLAY_PANEL::~DRC_RE_BITMAP_OVERLAY_PANEL ( )
virtual

Definition at line 56 of file drc_re_bitmap_overlay_panel.cpp.

Member Function Documentation

◆ AddCheckbox()

DRC_RE_OVERLAY_FIELD * DRC_RE_BITMAP_OVERLAY_PANEL::AddCheckbox ( const wxString & aId,
const DRC_RE_FIELD_POSITION & aPosition )
protected

◆ AddControl()

template<typename T>
DRC_RE_OVERLAY_FIELD * DRC_RE_BITMAP_OVERLAY_PANEL::AddControl ( const wxString & aId,
const DRC_RE_FIELD_POSITION & aPosition,
T * aControl )
protected

Position a control on the bitmap overlay.

Parameters
aIdString identifier for this field (used for error display and lookup).
aPositionPosition specification in 1x bitmap coordinates.
aControlThe control to use
Returns
Pointer to the created field wrapper.

Definition at line 199 of file drc_re_bitmap_overlay_panel.h.

References DRC_RE_OVERLAY_FIELD::CreateLabels(), DRC_RE_OVERLAY_FIELD::HasLabel(), DRC_RE_OVERLAY_FIELD::HasPrefixLabel(), m_fieldIdMap, m_fields, PositionLabel(), PositionPrefixLabel(), SetupFieldStyling(), T, DRC_RE_FIELD_POSITION::tooltipText, DRC_RE_FIELD_POSITION::xEnd, DRC_RE_FIELD_POSITION::xStart, and DRC_RE_FIELD_POSITION::yCenter.

Referenced by AddCheckbox(), AddField(), and DRC_RE_VIA_STYLE_OVERLAY_PANEL::DRC_RE_VIA_STYLE_OVERLAY_PANEL().

◆ AddField()

template<typename T>
DRC_RE_OVERLAY_FIELD * DRC_RE_BITMAP_OVERLAY_PANEL::AddField ( const wxString & aId,
const DRC_RE_FIELD_POSITION & aPosition,
long aStyle = 0 )
protected

Create and position a field control on the bitmap overlay.

Template Parameters
TThe wxWindow-derived control type to create.
Parameters
aIdString identifier for this field (used for error display and lookup).
aPositionPosition specification in 1x bitmap coordinates.
aStyleWindow style flags passed to the control constructor
Returns
Pointer to the created field wrapper.

Definition at line 238 of file drc_re_bitmap_overlay_panel.h.

References AddControl(), and T.

Referenced by AddFieldWithUnits(), DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL(), DRC_RE_MATCHED_LENGTH_DIFF_PAIR_OVERLAY_PANEL::DRC_RE_MATCHED_LENGTH_DIFF_PAIR_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().

◆ AddFieldWithUnits()

template<typename T>
DRC_RE_OVERLAY_FIELD * DRC_RE_BITMAP_OVERLAY_PANEL::AddFieldWithUnits ( const wxString & aId,
const DRC_RE_FIELD_POSITION & aPosition,
UNIT_BINDER * aUnitBinder,
long aStyle = 0 )
protected

Create and position a field control with unit binding.

Template Parameters
TThe wxWindow-derived control type to create.
Parameters
aIdString identifier for this field.
aPositionPosition specification in 1x bitmap coordinates.
aUnitBinderUNIT_BINDER to associate with this field for unit conversion.
aStyleWindow style flags passed to the control constructor
Returns
Pointer to the created field wrapper.

Definition at line 249 of file drc_re_bitmap_overlay_panel.h.

References AddField(), and DRC_RE_OVERLAY_FIELD::SetUnitBinder().

◆ ClearFieldErrors()

void DRC_RE_BITMAP_OVERLAY_PANEL::ClearFieldErrors ( )

Clear error indicators from all fields.

Definition at line 349 of file drc_re_bitmap_overlay_panel.cpp.

References m_fields.

Referenced by DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::ValidateInputs().

◆ GenerateRule()

◆ LoadBitmap()

void DRC_RE_BITMAP_OVERLAY_PANEL::LoadBitmap ( )
protected

Load the appropriate bitmap variant for the current theme and DPI.

Definition at line 138 of file drc_re_bitmap_overlay_panel.cpp.

References INVALID_BITMAP, KiBitmapBundle(), m_bitmap, m_bitmapId, and m_logicalBitmapSize.

Referenced by OnDPIChanged(), OnThemeChange(), and SetBackgroundBitmap().

◆ OnDPIChanged()

void DRC_RE_BITMAP_OVERLAY_PANEL::OnDPIChanged ( wxDPIChangedEvent & aEvent)
private

◆ OnFieldBlur()

void DRC_RE_BITMAP_OVERLAY_PANEL::OnFieldBlur ( wxFocusEvent & aEvent)
private

Definition at line 120 of file drc_re_bitmap_overlay_panel.cpp.

Referenced by SetupFieldStyling().

◆ OnFieldFocus()

void DRC_RE_BITMAP_OVERLAY_PANEL::OnFieldFocus ( wxFocusEvent & aEvent)
private

Definition at line 112 of file drc_re_bitmap_overlay_panel.cpp.

Referenced by SetupFieldStyling().

◆ OnPaint()

void DRC_RE_BITMAP_OVERLAY_PANEL::OnPaint ( wxPaintEvent & aEvent)
private

Definition at line 61 of file drc_re_bitmap_overlay_panel.cpp.

References dc, m_bitmap, and pageBackground().

Referenced by DRC_RE_BITMAP_OVERLAY_PANEL().

◆ OnThemeChange()

void DRC_RE_BITMAP_OVERLAY_PANEL::OnThemeChange ( wxSysColourChangedEvent & aEvent)
private

Definition at line 104 of file drc_re_bitmap_overlay_panel.cpp.

References LoadBitmap().

Referenced by DRC_RE_BITMAP_OVERLAY_PANEL().

◆ pageBackground()

wxColour DRC_RE_BITMAP_OVERLAY_PANEL::pageBackground ( ) const
private

Definition at line 90 of file drc_re_bitmap_overlay_panel.cpp.

Referenced by OnPaint().

◆ PositionFields()

◆ PositionLabel()

void DRC_RE_BITMAP_OVERLAY_PANEL::PositionLabel ( DRC_RE_OVERLAY_FIELD * aField)
private

Position a label relative to its field control based on the label position setting.

Parameters
aFieldThe overlay field containing the label to position.

Definition at line 264 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(), LABEL_GAP, DRC_RE_FIELD_POSITION::labelPosition, LEFT, NONE, RIGHT, and TOP.

Referenced by AddControl(), and PositionFields().

◆ PositionPrefixLabel()

void DRC_RE_BITMAP_OVERLAY_PANEL::PositionPrefixLabel ( DRC_RE_OVERLAY_FIELD * aField)
private

Position a prefix label to the left of its field control.

Parameters
aFieldThe overlay field containing the prefix label to position.

Definition at line 312 of file drc_re_bitmap_overlay_panel.cpp.

References GAP, DRC_RE_OVERLAY_FIELD::GetControl(), DRC_RE_OVERLAY_FIELD::GetPrefixLabel(), and LABEL_GAP.

Referenced by AddControl(), and PositionFields().

◆ roomBeforeNextField()

◆ SetBackgroundBitmap()

◆ SetMinimumHeightDIP()

void DRC_RE_BITMAP_OVERLAY_PANEL::SetMinimumHeightDIP ( int aHeight)
inlineprotected

Asks for a panel taller than its illustration.

The height is kept in DIP so it follows the display the panel is shown on.

Definition at line 153 of file drc_re_bitmap_overlay_panel.h.

References m_minHeightDIP.

Referenced by DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL::DRC_RE_ABS_LENGTH_TWO_OVERLAY_PANEL().

◆ SetupFieldStyling()

void DRC_RE_BITMAP_OVERLAY_PANEL::SetupFieldStyling ( wxControl * aControl)
protected

Apply transparent styling to a field control.

Parameters
aControlThe control to style.

Definition at line 127 of file drc_re_bitmap_overlay_panel.cpp.

References OnFieldBlur(), and OnFieldFocus().

Referenced by AddControl().

◆ ShowFieldError()

void DRC_RE_BITMAP_OVERLAY_PANEL::ShowFieldError ( const wxString & aFieldId,
const wxString & aMessage )

Show an error indicator on the specified field.

Parameters
aFieldIdThe string identifier of the field to highlight.
aMessageThe reason the field is invalid, shown as the icon's tooltip.

Definition at line 356 of file drc_re_bitmap_overlay_panel.cpp.

References m_fieldIdMap.

Referenced by DRC_RE_NUMERIC_INPUT_OVERLAY_PANEL::ValidateInputs().

◆ TransferDataFromWindow()

◆ TransferDataToWindow()

◆ ValidateInputs()

Member Data Documentation

◆ m_bitmap

wxBitmap DRC_RE_BITMAP_OVERLAY_PANEL::m_bitmap
protected

Current background bitmap.

Definition at line 188 of file drc_re_bitmap_overlay_panel.h.

Referenced by LoadBitmap(), OnPaint(), and SetBackgroundBitmap().

◆ m_bitmapId

BITMAPS DRC_RE_BITMAP_OVERLAY_PANEL::m_bitmapId
protected

BITMAPS enum value.

Definition at line 189 of file drc_re_bitmap_overlay_panel.h.

Referenced by DRC_RE_BITMAP_OVERLAY_PANEL(), LoadBitmap(), and SetBackgroundBitmap().

◆ m_fieldIdMap

std::map<wxString, DRC_RE_OVERLAY_FIELD*> DRC_RE_BITMAP_OVERLAY_PANEL::m_fieldIdMap
protected

Field ID to field lookup.

Definition at line 194 of file drc_re_bitmap_overlay_panel.h.

Referenced by AddControl(), and ShowFieldError().

◆ m_fields

◆ m_logicalBitmapSize

wxSize DRC_RE_BITMAP_OVERLAY_PANEL::m_logicalBitmapSize
protected

Bitmap size in logical pixels.

Definition at line 190 of file drc_re_bitmap_overlay_panel.h.

Referenced by DRC_RE_BITMAP_OVERLAY_PANEL(), LoadBitmap(), PositionFields(), and SetBackgroundBitmap().

◆ m_minHeightDIP

int DRC_RE_BITMAP_OVERLAY_PANEL::m_minHeightDIP = 0
protected

Height a subclass asks for, in DIP.

Definition at line 191 of file drc_re_bitmap_overlay_panel.h.

Referenced by PositionFields(), and SetMinimumHeightDIP().


The documentation for this class was generated from the following files: