36 wxSizer* mainSizer = GetSizer();
37 wxCHECK_RET( mainSizer, wxT(
"Line properties dialog has no main sizer" ) );
39 wxGridBagSizer* gbSizerEndings =
new wxGridBagSizer( 3, 0 );
40 gbSizerEndings->SetFlexibleDirection( wxBOTH );
41 gbSizerEndings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
42 gbSizerEndings->SetEmptyCellSize( wxSize( 20, -1 ) );
46 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
48 m_startShapeChoice =
new wxBitmapComboBox(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
49 nullptr, wxCB_READONLY );
51 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
54 gbSizerEndings->Add(
m_endShapeLabel, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ),
55 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
57 m_endShapeChoice =
new wxBitmapComboBox(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
58 nullptr, wxCB_READONLY );
59 gbSizerEndings->Add(
m_endShapeChoice, wxGBPosition( 0, 5 ), wxGBSpan( 1, 2 ),
60 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
63 [&](
int aRow,
int aCol,
const wxString& aLabel, wxStaticText*& aLabelCtrl, wxTextCtrl*& aValueCtrl,
64 wxStaticText*& aUnitsCtrl,
int aFlags )
66 aLabelCtrl =
new wxStaticText(
this, wxID_ANY, aLabel );
67 gbSizerEndings->Add( aLabelCtrl, wxGBPosition( aRow, aCol ), wxGBSpan( 1, 1 ),
68 wxALIGN_CENTER_VERTICAL | wxLEFT | aFlags, 15 );
70 aValueCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, -1 ), 0 );
71 gbSizerEndings->Add( aValueCtrl, wxGBPosition( aRow, aCol + 1 ), wxGBSpan( 1, 1 ),
72 wxALIGN_CENTER_VERTICAL | wxLEFT | wxEXPAND, 15 );
74 aUnitsCtrl =
new wxStaticText(
this, wxID_ANY,
_(
"unit" ) );
75 gbSizerEndings->Add( aUnitsCtrl, wxGBPosition( aRow, aCol + 2 ), wxGBSpan( 1, 1 ),
76 wxALIGN_CENTER_VERTICAL | wxLEFT, 3 );
88 gbSizerEndings->AddGrowableCol( 1 );
89 gbSizerEndings->AddGrowableCol( 5 );
96 wxColour fg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
97 wxSize iconSize = GetTextExtent( wxT(
"XXXXXX" ) );
111 for(
const auto& item : shapeItems )
152 m_endingsHelpLabel->SetLabel( wxString::Format(
_(
"Set line ending sizes to 0 for automatic (%g\u00d7 line width)." ),
157 for(
const auto& [ lineStyle, lineStyleDesc ] :
lineTypeNames )
174 return r->GetStroke().GetWidth() == first_stroke_item->GetStroke().GetWidth();
187 return r->GetStroke().GetColor() == first_stroke_item->GetStroke().GetColor();
200 return r->GetStroke().GetLineStyle() == first_stroke_item->GetStroke().GetLineStyle();
203 int style =
static_cast<int>( first_stroke_item->
GetStroke().GetLineStyle() );
220 return r->GetStartEndingStyle() == first_stroke_item->GetStartEndingStyle();
235 return r->GetEndEndingStyle() == first_stroke_item->GetEndEndingStyle();
250 return r->GetStartEndingLength() == first_stroke_item->GetStartEndingLength();
264 return r->GetStartEndingWidth() == first_stroke_item->GetStartEndingWidth();
278 return r->GetStartEndingStrokeWidth() == first_stroke_item->GetStartEndingStrokeWidth();
292 return r->GetEndEndingLength() == first_stroke_item->GetEndEndingLength();
306 return r->GetEndEndingWidth() == first_stroke_item->GetEndEndingWidth();
320 return r->GetEndEndingStrokeWidth() == first_stroke_item->GetEndEndingStrokeWidth();
362 if( !line->HasFlag(
IS_NEW ) )
365 if( !
m_width.IsIndeterminate() )
366 line->SetLineWidth( std::max( 0,
m_width.GetIntValue() ) );
376 line->SetLineStyle( it->first );
400 line->SetStartEndingLength( std::max( 0,
m_startLength->GetIntValue() ) );
403 line->SetStartEndingWidth( std::max( 0,
m_startWidth->GetIntValue() ) );
406 line->SetStartEndingStrokeWidth( std::max( 0,
m_startThickness->GetIntValue() ) );
409 line->SetEndEndingLength( std::max( 0,
m_endLength->GetIntValue() ) );
412 line->SetEndEndingWidth( std::max( 0,
m_endWidth->GetIntValue() ) );
415 line->SetEndEndingStrokeWidth( std::max( 0,
m_endThickness->GetIntValue() ) );
418 commit.
Push(
m_lines.size() == 1 ?
_(
"Edit Line" ) :
_(
"Edit Lines" ) );
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
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_helpLabel2
wxBitmapComboBox * m_typeCombo
wxBoxSizer * m_endingsSizer
wxStaticText * m_staticTextWidth
COLOR_SWATCH * m_colorSwatch
wxStaticText * m_staticWidthUnits
wxStaticText * m_helpLabel1
DIALOG_LINE_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Line Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxStaticText * m_endLengthUnits
wxStaticText * m_endThicknessLabel
std::unique_ptr< UNIT_BINDER > m_endLength
std::unique_ptr< UNIT_BINDER > m_endThickness
std::deque< SCH_LINE * > m_lines
wxStaticText * m_endWidthLabel
wxTextCtrl * m_startWidthCtrl
wxStaticText * m_endingsHelpLabel
DIALOG_LINE_PROPERTIES(SCH_EDIT_FRAME *aParent, std::deque< SCH_LINE * > &aLines)
wxStaticText * m_endShapeLabel
wxStaticText * m_startShapeLabel
bool TransferDataToWindow() override
wxStaticText * m_endThicknessUnits
wxStaticText * m_endWidthUnits
void resetDefaults(wxCommandEvent &event) override
std::unique_ptr< UNIT_BINDER > m_endWidth
void createLineEndingControls(SCH_EDIT_FRAME *aParent)
wxTextCtrl * m_startLengthCtrl
wxStaticText * m_startWidthLabel
wxTextCtrl * m_endWidthCtrl
wxStaticText * m_endLengthLabel
std::unique_ptr< UNIT_BINDER > m_startLength
bool TransferDataFromWindow() override
wxBitmapComboBox * m_endShapeChoice
wxStaticText * m_startLengthLabel
wxTextCtrl * m_startThicknessCtrl
wxStaticText * m_startWidthUnits
wxStaticText * m_startLengthUnits
std::unique_ptr< UNIT_BINDER > m_startWidth
wxStaticText * m_startThicknessUnits
std::unique_ptr< UNIT_BINDER > m_startThickness
wxTextCtrl * m_endLengthCtrl
wxBitmapComboBox * m_startShapeChoice
wxTextCtrl * m_endThicknessCtrl
wxStaticText * m_startThicknessLabel
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
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...
A color representation with 4 components: red, green, blue, alpha.
wxColour ToColour() const
static constexpr double DEFAULT_RATIO_LENGTH
static const int s_defaultChoiceCount
static const LINE_ENDING_STYLE s_defaultChoiceOrder[]
Dropdown display order for line ending style choosers.
static int StyleToChoiceIndex(LINE_ENDING_STYLE aStyle)
Return the dropdown index for the given style, or 0 (NONE) if not found.
Commit for the schematic and symbol editors.
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Schematic editor (Eeschema) main window.
Segment description base class to describe items which have 2 end points (track, wire,...
int GetStartEndingStrokeWidth() const
int GetEndEndingLength() const
virtual STROKE_PARAMS GetStroke() const override
int GetEndEndingWidth() const
int GetStartEndingWidth() const
LINE_ENDING_STYLE GetEndEndingStyle() const
int GetEndEndingStrokeWidth() const
LINE_ENDING_STYLE GetStartEndingStyle() const
int GetStartEndingLength() const
KIGFX::COLOR4D GetColor() const
#define IS_NEW
New item, just created.
@ LAYER_SCHEMATIC_BACKGROUND
LINE_ENDING_STYLE
Line ending styles for graphic lines, arcs, and beziers.
wxBitmap MakeLineEndingBitmap(LINE_ENDING_STYLE aStyle, const wxSize &aSize, const wxColour &aForeground, wxWindow *aWindow, bool aShapeOnRight)
Generate a DPI-aware bitmap icon showing a line ending style.
KICOMMON_API wxFont GetInfoFont(wxWindow *aWindow)
const std::map< LINE_STYLE, struct LINE_STYLE_DESC > lineTypeNames
Conversion map between LINE_STYLE values and style names displayed.
#define INDETERMINATE_STYLE
#define DEFAULT_LINE_STYLE_LABEL
#define INDETERMINATE_ACTION