KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eeschema/dialogs/dialog_shape_properties.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
22#include <stroke_params.h>
23#include <sch_edit_frame.h>
24#include <symbol_edit_frame.h>
25#include <sch_shape.h>
26#include <sch_rule_area.h>
29#include <widgets/wx_infobar.h>
31#include <sch_commit.h>
32#include <string_utils.h>
33#include <line_ending.h>
34
35
37{
38 wxSizer* mainSizer = GetSizer();
39 wxCHECK_RET( mainSizer, wxT( "Shape properties dialog has no main sizer" ) );
40
41 wxGridBagSizer* gbSizerEndings = new wxGridBagSizer( 3, 0 );
42 gbSizerEndings->SetFlexibleDirection( wxBOTH );
43 gbSizerEndings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
44 gbSizerEndings->SetEmptyCellSize( wxSize( 20, -1 ) );
45
46 m_startShapeLabel = new wxStaticText( this, wxID_ANY, _( "Start Shape:" ) );
47 gbSizerEndings->Add( m_startShapeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ),
48 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
49
50 m_startShapeChoice = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
51 nullptr, wxCB_READONLY );
52 gbSizerEndings->Add( m_startShapeChoice, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ),
53 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
54
55 m_endShapeLabel = new wxStaticText( this, wxID_ANY, _( "End Shape:" ) );
56 gbSizerEndings->Add( m_endShapeLabel, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ),
57 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
58
59 m_endShapeChoice = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
60 nullptr, wxCB_READONLY );
61 gbSizerEndings->Add( m_endShapeChoice, wxGBPosition( 0, 5 ), wxGBSpan( 1, 2 ),
62 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
63
64 auto addEndingValue =
65 [&]( int aRow, int aCol, const wxString& aLabel, wxStaticText*& aLabelCtrl, wxTextCtrl*& aValueCtrl,
66 wxStaticText*& aUnitsCtrl, int aFlags )
67 {
68 aLabelCtrl = new wxStaticText( this, wxID_ANY, aLabel );
69 gbSizerEndings->Add( aLabelCtrl, wxGBPosition( aRow, aCol ), wxGBSpan( 1, 1 ),
70 wxALIGN_CENTER_VERTICAL | wxLEFT | aFlags, 15 );
71
72 aValueCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, -1 ), 0 );
73 gbSizerEndings->Add( aValueCtrl, wxGBPosition( aRow, aCol + 1 ), wxGBSpan( 1, 1 ),
74 wxALIGN_CENTER_VERTICAL | wxLEFT | wxEXPAND, 15 );
75
76 aUnitsCtrl = new wxStaticText( this, wxID_ANY, _( "unit" ) );
77 gbSizerEndings->Add( aUnitsCtrl, wxGBPosition( aRow, aCol + 2 ), wxGBSpan( 1, 1 ),
78 wxALIGN_CENTER_VERTICAL | wxLEFT, 3 );
79 };
80
81 addEndingValue( 1, 0, _( "Length:" ), m_startLengthLabel, m_startLengthCtrl, m_startLengthUnits, wxRIGHT );
82 addEndingValue( 1, 4, _( "Length:" ), m_endLengthLabel, m_endLengthCtrl, m_endLengthUnits, wxLEFT | wxRIGHT );
83 addEndingValue( 2, 0, _( "Width:" ), m_startWidthLabel, m_startWidthCtrl, m_startWidthUnits, wxRIGHT );
84 addEndingValue( 2, 4, _( "Width:" ), m_endWidthLabel, m_endWidthCtrl, m_endWidthUnits, wxLEFT | wxRIGHT );
85 addEndingValue( 3, 0, _( "Thickness:" ), m_startThicknessLabel, m_startThicknessCtrl, m_startThicknessUnits,
86 wxRIGHT );
87 addEndingValue( 3, 4, _( "Thickness:" ), m_endThicknessLabel, m_endThicknessCtrl, m_endThicknessUnits,
88 wxLEFT | wxRIGHT );
89
90 gbSizerEndings->AddGrowableCol( 1 );
91 gbSizerEndings->AddGrowableCol( 5 );
92
93 m_endingsSizer->Add( gbSizerEndings, 0, wxEXPAND | wxALL, 10 );
94
95 m_endingsHelpLabel = new wxStaticText( this, wxID_ANY, wxEmptyString );
96 m_endingsSizer->Add( m_endingsHelpLabel, 0, wxLEFT | wxRIGHT, 20 );
97
98 wxColour fg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
99 wxSize iconSize = GetTextExtent( wxT( "XXXXXX" ) );
100
101 struct
102 {
103 wxString name;
104 LINE_ENDING_STYLE style;
105 } shapeItems[] = {
106 { _( "None" ), LINE_ENDING_STYLE::NONE },
107 { _( "Arrow" ), LINE_ENDING_STYLE::ARROW },
108 { _( "Open Arrow" ), LINE_ENDING_STYLE::ARROW_OPEN },
109 { _( "Circle" ), LINE_ENDING_STYLE::CIRCLE },
110 { _( "Square" ), LINE_ENDING_STYLE::SQUARE },
111 };
112
113 for( const auto& item : shapeItems )
114 {
115 wxBitmap startBmp = MakeLineEndingBitmap( item.style, iconSize, fg, this, false );
116 wxBitmap endBmp = MakeLineEndingBitmap( item.style, iconSize, fg, this, true );
117 m_startShapeChoice->Append( item.name, startBmp );
118 m_endShapeChoice->Append( item.name, endBmp );
119 }
120
121 m_startShapeChoice->SetSelection( 0 );
122 m_endShapeChoice->SetSelection( 0 );
123
124 m_startLength = std::make_unique<UNIT_BINDER>( aParent, m_startLengthLabel, m_startLengthCtrl, m_startLengthUnits,
125 true );
126 m_startWidth = std::make_unique<UNIT_BINDER>( aParent, m_startWidthLabel, m_startWidthCtrl, m_startWidthUnits,
127 true );
128 m_startThickness = std::make_unique<UNIT_BINDER>( aParent, m_startThicknessLabel, m_startThicknessCtrl,
129 m_startThicknessUnits, true );
130 m_endLength = std::make_unique<UNIT_BINDER>( aParent, m_endLengthLabel, m_endLengthCtrl, m_endLengthUnits, true );
131 m_endWidth = std::make_unique<UNIT_BINDER>( aParent, m_endWidthLabel, m_endWidthCtrl, m_endWidthUnits, true );
132 m_endThickness = std::make_unique<UNIT_BINDER>( aParent, m_endThicknessLabel, m_endThicknessCtrl,
133 m_endThicknessUnits, true );
134}
135
136
139 m_frame( aParent ),
140 m_shape( aShape ),
142{
143 SetTitle( wxString::Format( GetTitle(), aShape->GetFriendlyName() ) );
144
145 // DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
146 // different shapes (and even whether or not we're within the symbol editor) cause different
147 // dialog layouts.
148 m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
149
150 createLineEndingControls( aParent );
151
152 m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
153 m_helpLabel2->SetFont( KIUI::GetInfoFont( this ).Italic() );
154
155 m_endingsHelpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
156 m_endingsHelpLabel->SetLabel( wxString::Format( _( "Set line ending sizes to 0 for automatic (%g\u00d7 line width)." ),
158
159 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
160 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
161
162 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
163 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
164
165 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
166 m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
167
168 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
169 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
170
171 KIGFX::COLOR4D canvas = m_frame->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
172 m_borderColorSwatch->SetSwatchBackground( canvas.ToColour() );
173 m_fillColorSwatch->SetSwatchBackground( canvas.ToColour() );
174
175 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
176 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
177
178 m_ruleAreaSizer->Show( dynamic_cast<SCH_RULE_AREA*>( aShape ) != nullptr );
179
180 // Only show line ending controls for open shapes
181 m_endingsSizer->Show( !aShape->IsClosed() );
182
184
185 // Required under wxGTK if we want to dismiss the dialog with the ESC key
186 SetFocus();
187
189
190 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
191 {
192 m_fillBook->SetSelection( 1 );
193
194 if( !symbolEditor->IsSymbolGraphicallyEditable() )
195 {
196 m_sdbSizerCancel->SetDefault();
197 m_sdbSizerOK->SetLabel( _( "Read Only" ) );
198 m_sdbSizerOK->Enable( false );
199 }
200 }
201 else
202 {
203 m_fillBook->SetSelection( 0 );
204 m_symbolEditorSizer->Show( false );
205 }
206
207 m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch, this );
208 m_customColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch, this );
209
210 // Now all widgets have the size fixed, call FinishDialogSettings
212}
213
214
220
221
223{
224 if( !wxDialog::TransferDataToWindow() )
225 return false;
226
227 if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
228 {
229 m_cbExcludeFromSim->SetValue( ruleArea->GetExcludedFromSim() );
230 m_cbExcludeFromBom->SetValue( ruleArea->GetExcludedFromBOM() );
231 m_cbExcludeFromBoard->SetValue( ruleArea->GetExcludedFromBoard() );
232 m_cbDNP->SetValue( ruleArea->GetDNP() );
233 }
234
235 if( m_shape->GetWidth() >= 0 )
236 {
237 m_borderCheckbox->SetValue( true );
238 m_borderWidth.SetValue( m_shape->GetWidth() );
239 }
240 else
241 {
242 m_borderCheckbox->SetValue( false );
243
244 m_borderWidth.Enable( false );
245 m_borderColorLabel->Enable( false );
246 m_borderColorSwatch->Enable( false );
247 m_borderStyleLabel->Enable( false );
248 m_borderStyleCombo->Enable( false );
249 }
250
251 m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
252
253 int style = static_cast<int>( m_shape->GetStroke().GetLineStyle() );
254
255 if( style == -1 )
256 m_borderStyleCombo->SetStringSelection( DEFAULT_LINE_STYLE_LABEL );
257 else if( style < (int) lineTypeNames.size() )
258 m_borderStyleCombo->SetSelection( style );
259 else
260 wxFAIL_MSG( wxT( "Line type not found in the type lookup map" ) );
261
262 if( dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
263 {
264 m_rbFillNone->Enable( true );
265 m_rbFillOutline->Enable( true );
266 m_rbFillBackground->Enable( true );
267 m_rbFillCustom->Enable( true );
268 m_customColorSwatch->Enable( true );
269
270 if( m_shape->GetFillMode() == FILL_T::FILLED_SHAPE )
271 {
272 m_rbFillOutline->SetValue( true );
273
274 COLOR4D color = m_shape->GetStroke().GetColor();
275
276 if( color == COLOR4D::UNSPECIFIED )
277 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
278
279 m_customColorSwatch->SetSwatchColor( color, false );
280 }
281 else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
282 {
283 m_rbFillBackground->SetValue( true );
284
285 COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
286 m_customColorSwatch->SetSwatchColor( color, false );
287 }
288 else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
289 {
290 m_rbFillCustom->SetValue( true );
291 m_customColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
292 }
293 else
294 {
295 m_rbFillNone->SetValue( true );
296 m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
297 }
298
299 const SYMBOL* symbol = m_shape->GetParentSymbol();
300
301 m_privateCheckbox->SetValue( m_shape->IsPrivate() );
302 m_checkApplyToAllUnits->SetValue( symbol->IsMultiUnit() && m_shape->GetUnit() == ALL_UNITS );
303 m_checkApplyToAllUnits->Enable( symbol->IsMultiUnit() );
304 m_checkApplyToAllBodyStyles->SetValue( symbol->IsMultiBodyStyle() && m_shape->GetBodyStyle() == ALL_BODY_STYLES );
306 }
307 else
308 {
309 m_fillCtrl->SetSelection( m_shape->GetFillModeProp() );
310 m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
311 }
312
313 m_fillColorLabel->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
314 m_fillColorSwatch->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
315
316 // Line endings (only populated for open shapes)
317 if( !m_shape->IsClosed() )
318 {
319 m_startShapeChoice->SetSelection( LINE_ENDING::StyleToChoiceIndex( m_shape->GetStartEndingStyle() ) );
320 m_endShapeChoice->SetSelection( LINE_ENDING::StyleToChoiceIndex( m_shape->GetEndEndingStyle() ) );
321 m_startLength->SetValue( m_shape->GetStartEndingLength() );
322 m_startWidth->SetValue( m_shape->GetStartEndingWidth() );
323 m_startThickness->SetValue( m_shape->GetStartEndingStrokeWidth() );
324 m_endLength->SetValue( m_shape->GetEndEndingLength() );
325 m_endWidth->SetValue( m_shape->GetEndEndingWidth() );
326 m_endThickness->SetValue( m_shape->GetEndEndingStrokeWidth() );
327 }
328
329 return true;
330}
331
332
333void DIALOG_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
334{
335 bool border = m_borderCheckbox->GetValue();
336
337 if( border && m_borderWidth.GetValue() < 0 )
338 {
339 int defaultInMils;
340
341 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
342 defaultInMils = symbolEditor->libeditconfig()->m_Defaults.line_width;
343 else
344 defaultInMils = m_frame->eeconfig()->m_Drawing.default_line_thickness;
345
346 m_borderWidth.SetValue( schIUScale.MilsToIU( defaultInMils ) );
347 }
348
349 m_borderWidth.Enable( border );
350 m_borderColorLabel->Enable( border );
351 m_borderColorSwatch->Enable( border );
352 m_borderStyleLabel->Enable( border );
353 m_borderStyleCombo->Enable( border );
354}
355
356
357void DIALOG_SHAPE_PROPERTIES::onFillChoice( wxCommandEvent& event )
358{
359 m_fillColorLabel->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
360 m_fillColorSwatch->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
361}
362
363
365{
366 if( event.GetId() == NO_FILL )
367 {
368 m_rbFillNone->SetValue( true );
369 m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
370 }
371 else if( event.GetId() == FILLED_SHAPE )
372 {
373 m_rbFillOutline->SetValue( true );
374
375 COLOR4D color = m_borderColorSwatch->GetSwatchColor();
376
377 if( color == COLOR4D::UNSPECIFIED || !m_rbFillOutline->GetValue() )
378 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
379
380 m_customColorSwatch->SetSwatchColor( color, false );
381 }
382 else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR )
383 {
384 m_rbFillBackground->SetValue( true );
385
386 COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
387 m_customColorSwatch->SetSwatchColor( color, false );
388 }
389 else if( event.GetId() == FILLED_WITH_COLOR )
390 {
391 m_rbFillCustom->SetValue( true );
392 m_customColorSwatch->GetNewSwatchColor();
393 }
394}
395
396
397void DIALOG_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent )
398{
399 if( m_rbFillOutline->GetValue() )
400 m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false );
401
402 if( m_rbFillOutline->IsEnabled() && m_rbFillOutline->GetValue() )
403 {
405
406 if( m_rbFillOutline->GetValue() )
407 color = m_fillColorSwatch->GetSwatchColor();
408
409 if( color == COLOR4D::UNSPECIFIED )
410 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
411
412 m_customColorSwatch->SetSwatchColor( color, false );
413 }
414}
415
416
418{
419 m_rbFillCustom->SetValue( true );
420}
421
422
424{
425 if( !wxDialog::TransferDataFromWindow() )
426 return false;
427
428 SCH_COMMIT commit( m_frame );
429
430 if( !m_shape->IsNew() )
431 commit.Modify( m_shape, m_frame->GetScreen() );
432
433 if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
434 {
435 ruleArea->SetExcludedFromSim( m_cbExcludeFromSim->GetValue() );
436 ruleArea->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue() );
437 ruleArea->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
438 ruleArea->SetDNP( m_cbDNP->GetValue() );
439 }
440
441 STROKE_PARAMS stroke = m_shape->GetStroke();
442
443 if( m_borderCheckbox->GetValue() )
444 {
445 if( !m_borderWidth.IsIndeterminate() )
446 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
447 }
448 else
449 {
450 stroke.SetWidth( -1 );
451 }
452
453 auto it = lineTypeNames.begin();
454 std::advance( it, m_borderStyleCombo->GetSelection() );
455
456 if( it == lineTypeNames.end() )
458 else
459 stroke.SetLineStyle( it->first );
460
461 stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
462
463 m_shape->SetStroke( stroke );
464
465 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
466 {
467 if( m_rbFillOutline->GetValue() )
468 m_shape->SetFillMode( FILL_T::FILLED_SHAPE );
469 else if( m_rbFillBackground->GetValue() )
471 else if( m_rbFillCustom->GetValue() )
472 m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
473 else
474 m_shape->SetFillMode( FILL_T::NO_FILL );
475
476 m_shape->SetFillColor( m_customColorSwatch->GetSwatchColor() );
477
478 m_shape->SetPrivate( m_privateCheckbox->GetValue() );
479
480 if( m_checkApplyToAllBodyStyles->IsChecked() )
481 m_shape->SetBodyStyle( 0 );
482 else
483 m_shape->SetBodyStyle( symbolEditor->GetBodyStyle() );
484
485 if( m_checkApplyToAllUnits->IsChecked() )
486 m_shape->SetUnit( 0 );
487 else
488 m_shape->SetUnit( symbolEditor->GetUnit() );
489 }
490 else
491 {
492 m_shape->SetFillModeProp( (UI_FILL_MODE) m_fillCtrl->GetSelection() );
493 m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
494 }
495
496 // Line endings (only for open shapes)
497 if( !m_shape->IsClosed() )
498 {
499 int startSel = m_startShapeChoice->GetSelection();
500
501 if( startSel >= 0 && startSel < LINE_ENDING::s_defaultChoiceCount )
502 m_shape->SetStartEndingStyle( LINE_ENDING::s_defaultChoiceOrder[startSel] );
503
504 int endSel = m_endShapeChoice->GetSelection();
505
506 if( endSel >= 0 && endSel < LINE_ENDING::s_defaultChoiceCount )
507 m_shape->SetEndEndingStyle( LINE_ENDING::s_defaultChoiceOrder[endSel] );
508
509 if( !m_startLength->IsIndeterminate() )
510 m_shape->SetStartEndingLength( std::max( 0, m_startLength->GetIntValue() ) );
511
512 if( !m_startWidth->IsIndeterminate() )
513 m_shape->SetStartEndingWidth( std::max( 0, m_startWidth->GetIntValue() ) );
514
515 if( !m_startThickness->IsIndeterminate() )
516 m_shape->SetStartEndingStrokeWidth( std::max( 0, m_startThickness->GetIntValue() ) );
517
518 if( !m_endLength->IsIndeterminate() )
519 m_shape->SetEndEndingLength( std::max( 0, m_endLength->GetIntValue() ) );
520
521 if( !m_endWidth->IsIndeterminate() )
522 m_shape->SetEndEndingWidth( std::max( 0, m_endWidth->GetIntValue() ) );
523
524 if( !m_endThickness->IsIndeterminate() )
525 m_shape->SetEndEndingStrokeWidth( std::max( 0, m_endThickness->GetIntValue() ) );
526 }
527
528 if( !commit.Empty() )
529 commit.Push( wxString::Format( _( "Edit %s" ), m_shape->GetFriendlyName() ) );
530
531 return true;
532}
const char * name
constexpr EDA_IU_SCALE schIUScale
Definition base_units.h:130
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
Definition bitmap.cpp:106
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
Definition color4d.h:400
Color settings are a bit different than most of the settings objects in that there can be more than o...
COLOR4D GetColor(int aLayer) const
bool Empty() const
Definition commit.h:145
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr, RECURSE_MODE aRecurse=RECURSE_MODE::NO_RECURSE)
Modify a given item in the model.
Definition commit.h:102
DIALOG_SHAPE_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("%s Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
std::unique_ptr< UNIT_BINDER > m_endWidth
wxBitmapComboBox * m_startShapeChoice
std::unique_ptr< UNIT_BINDER > m_startWidth
void createLineEndingControls(SCH_BASE_FRAME *aParent)
wxBitmapComboBox * m_endShapeChoice
DIALOG_SHAPE_PROPERTIES(SCH_BASE_FRAME *aParent, SCH_SHAPE *aShape)
std::unique_ptr< UNIT_BINDER > m_startLength
std::unique_ptr< UNIT_BINDER > m_endLength
std::unique_ptr< UNIT_BINDER > m_startThickness
std::unique_ptr< UNIT_BINDER > m_endThickness
void onBorderChecked(wxCommandEvent &aEvent) override
void onFillChoice(wxCommandEvent &event) override
void onFillRadioButton(wxCommandEvent &aEvent) override
void SetInitialFocus(wxWindow *aWindow)
Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.
Definition dialog_shim.h:94
void SetupStandardButtons(std::map< int, wxString > aLabels={})
std::string m_hash_key
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
virtual wxString GetFriendlyName() const
Definition eda_item.cpp:565
bool IsClosed() const
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
wxColour ToColour() const
Definition color4d.cpp:221
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.
Definition line_ending.h:38
static int StyleToChoiceIndex(LINE_ENDING_STYLE aStyle)
Return the dropdown index for the given style, or 0 (NONE) if not found.
A shim class between EDA_DRAW_FRAME and several derived classes: SYMBOL_EDIT_FRAME,...
Commit for the schematic and symbol editors.
Definition sch_commit.h:54
void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Execute the changes.
Simple container to manage line stroke parameters.
void SetLineStyle(LINE_STYLE aLineStyle)
void SetWidth(int aWidth)
void SetColor(const KIGFX::COLOR4D &aColor)
The symbol library editor main window.
A base class for LIB_SYMBOL and SCH_SYMBOL.
Definition symbol.h:60
virtual bool IsMultiUnit() const =0
virtual bool IsMultiBodyStyle() const =0
#define _(s)
UI_FILL_MODE
Definition eda_fill.h:41
@ NONE
Definition eda_fill.h:42
@ FILLED_WITH_COLOR
Definition eda_fill.h:33
@ NO_FILL
Definition eda_fill.h:30
@ FILLED_WITH_BG_BODYCOLOR
Definition eda_fill.h:32
@ FILLED_SHAPE
Fill with object color.
Definition eda_fill.h:31
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
Definition idf_helpers.h:37
@ LAYER_DEVICE
Definition layer_ids.h:488
@ LAYER_DEVICE_BACKGROUND
Definition layer_ids.h:506
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:510
LINE_ENDING_STYLE
Line ending styles for graphic lines, arcs, and beziers.
Definition line_ending.h:44
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 DEFAULT_LINE_STYLE_LABEL
#define ALL_UNITS
Definition symbol.h:150
#define ALL_BODY_STYLES
Definition symbol.h:151