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
20#include <bitmaps.h>
23#include <stroke_params.h>
24#include <sch_edit_frame.h>
25#include <symbol_edit_frame.h>
26#include <sch_shape.h>
27#include <sch_rule_area.h>
30#include <widgets/wx_infobar.h>
32#include <sch_commit.h>
33#include <string_utils.h>
34#include <line_ending.h>
35
36
38{
39 wxSizer* mainSizer = GetSizer();
40 wxCHECK_RET( mainSizer, wxT( "Shape properties dialog has no main sizer" ) );
41
42 wxGridBagSizer* gbSizerEndings = new wxGridBagSizer( 3, 0 );
43 gbSizerEndings->SetFlexibleDirection( wxBOTH );
44 gbSizerEndings->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
45 gbSizerEndings->SetEmptyCellSize( wxSize( 20, -1 ) );
46
47 m_startShapeLabel = new wxStaticText( this, wxID_ANY, _( "Start Shape:" ) );
48 gbSizerEndings->Add( m_startShapeLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ),
49 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
50
51 m_startShapeChoice = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
52 nullptr, wxCB_READONLY );
53 gbSizerEndings->Add( m_startShapeChoice, wxGBPosition( 0, 1 ), wxGBSpan( 1, 2 ),
54 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
55
56 m_endShapeLabel = new wxStaticText( this, wxID_ANY, _( "End Shape:" ) );
57 gbSizerEndings->Add( m_endShapeLabel, wxGBPosition( 0, 4 ), wxGBSpan( 1, 1 ),
58 wxALIGN_CENTER_VERTICAL | wxRIGHT, 5 );
59
60 m_endShapeChoice = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0,
61 nullptr, wxCB_READONLY );
62 gbSizerEndings->Add( m_endShapeChoice, wxGBPosition( 0, 5 ), wxGBSpan( 1, 2 ),
63 wxALIGN_CENTER_VERTICAL | wxEXPAND, 5 );
64
65 auto addEndingValue =
66 [&]( int aRow, int aCol, const wxString& aLabel, wxStaticText*& aLabelCtrl, wxTextCtrl*& aValueCtrl,
67 wxStaticText*& aUnitsCtrl, int aFlags )
68 {
69 aLabelCtrl = new wxStaticText( this, wxID_ANY, aLabel );
70 gbSizerEndings->Add( aLabelCtrl, wxGBPosition( aRow, aCol ), wxGBSpan( 1, 1 ),
71 wxALIGN_CENTER_VERTICAL | wxLEFT | aFlags, 15 );
72
73 aValueCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, -1 ), 0 );
74 gbSizerEndings->Add( aValueCtrl, wxGBPosition( aRow, aCol + 1 ), wxGBSpan( 1, 1 ),
75 wxALIGN_CENTER_VERTICAL | wxLEFT | wxEXPAND, 15 );
76
77 aUnitsCtrl = new wxStaticText( this, wxID_ANY, _( "unit" ) );
78 gbSizerEndings->Add( aUnitsCtrl, wxGBPosition( aRow, aCol + 2 ), wxGBSpan( 1, 1 ),
79 wxALIGN_CENTER_VERTICAL | wxLEFT, 3 );
80 };
81
82 addEndingValue( 1, 0, _( "Length:" ), m_startLengthLabel, m_startLengthCtrl, m_startLengthUnits, wxRIGHT );
83 addEndingValue( 1, 4, _( "Length:" ), m_endLengthLabel, m_endLengthCtrl, m_endLengthUnits, wxLEFT | wxRIGHT );
84 addEndingValue( 2, 0, _( "Width:" ), m_startWidthLabel, m_startWidthCtrl, m_startWidthUnits, wxRIGHT );
85 addEndingValue( 2, 4, _( "Width:" ), m_endWidthLabel, m_endWidthCtrl, m_endWidthUnits, wxLEFT | wxRIGHT );
86 addEndingValue( 3, 0, _( "Thickness:" ), m_startThicknessLabel, m_startThicknessCtrl, m_startThicknessUnits,
87 wxRIGHT );
88 addEndingValue( 3, 4, _( "Thickness:" ), m_endThicknessLabel, m_endThicknessCtrl, m_endThicknessUnits,
89 wxLEFT | wxRIGHT );
90
91 gbSizerEndings->AddGrowableCol( 1 );
92 gbSizerEndings->AddGrowableCol( 5 );
93
94 m_endingsSizer->Add( gbSizerEndings, 0, wxEXPAND | wxALL, 10 );
95
96 m_endingsHelpLabel = new wxStaticText( this, wxID_ANY, wxEmptyString );
97 m_endingsSizer->Add( m_endingsHelpLabel, 0, wxLEFT | wxRIGHT, 20 );
98
99 wxColour fg = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
100 wxSize iconSize = GetTextExtent( wxT( "XXXXXX" ) );
101
102 struct
103 {
104 wxString name;
105 LINE_ENDING_STYLE style;
106 } shapeItems[] = {
107 { _( "None" ), LINE_ENDING_STYLE::NONE },
108 { _( "Arrow" ), LINE_ENDING_STYLE::ARROW },
109 { _( "Open Arrow" ), LINE_ENDING_STYLE::ARROW_OPEN },
110 { _( "Circle" ), LINE_ENDING_STYLE::CIRCLE },
111 { _( "Square" ), LINE_ENDING_STYLE::SQUARE },
112 };
113
114 for( const auto& item : shapeItems )
115 {
116 wxBitmap startBmp = MakeLineEndingBitmap( item.style, iconSize, fg, this, false );
117 wxBitmap endBmp = MakeLineEndingBitmap( item.style, iconSize, fg, this, true );
118 m_startShapeChoice->Append( item.name, startBmp );
119 m_endShapeChoice->Append( item.name, endBmp );
120 }
121
122 m_startShapeChoice->SetSelection( 0 );
123 m_endShapeChoice->SetSelection( 0 );
124
125 m_startLength = std::make_unique<UNIT_BINDER>( aParent, m_startLengthLabel, m_startLengthCtrl, m_startLengthUnits,
126 true );
127 m_startWidth = std::make_unique<UNIT_BINDER>( aParent, m_startWidthLabel, m_startWidthCtrl, m_startWidthUnits,
128 true );
129 m_startThickness = std::make_unique<UNIT_BINDER>( aParent, m_startThicknessLabel, m_startThicknessCtrl,
130 m_startThicknessUnits, true );
131 m_endLength = std::make_unique<UNIT_BINDER>( aParent, m_endLengthLabel, m_endLengthCtrl, m_endLengthUnits, true );
132 m_endWidth = std::make_unique<UNIT_BINDER>( aParent, m_endWidthLabel, m_endWidthCtrl, m_endWidthUnits, true );
133 m_endThickness = std::make_unique<UNIT_BINDER>( aParent, m_endThicknessLabel, m_endThicknessCtrl,
134 m_endThicknessUnits, true );
135}
136
137
140 m_frame( aParent ),
141 m_shape( aShape ),
143{
144 SetTitle( wxString::Format( GetTitle(), aShape->GetFriendlyName() ) );
145
146 // DIALOG_SHIM needs a unique hash_key because classname is not sufficient because the
147 // different shapes (and even whether or not we're within the symbol editor) cause different
148 // dialog layouts.
149 m_hash_key = TO_UTF8( GetTitle() + aParent->GetName() );
150
151 createLineEndingControls( aParent );
152
153 m_helpLabel1->SetFont( KIUI::GetInfoFont( this ).Italic() );
154 m_helpLabel2->SetFont( KIUI::GetInfoFont( this ).Italic() );
155
156 m_endingsHelpLabel->SetFont( KIUI::GetInfoFont( this ).Italic() );
157 m_endingsHelpLabel->SetLabel( wxString::Format( _( "Set line ending sizes to 0 for automatic (%g\u00d7 line width)." ),
159
160 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
161 COLOR4D schematicBackground = colorSettings->GetColor( LAYER_SCHEMATIC_BACKGROUND );
162
163 m_borderColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
164 m_borderColorSwatch->SetSwatchBackground( schematicBackground );
165
166 for( const auto& [ lineStyle, lineStyleDesc ] : lineTypeNames )
167 m_borderStyleCombo->Append( lineStyleDesc.name, KiBitmapBundle( lineStyleDesc.bitmap ) );
168
169 m_fillColorSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
170 m_fillColorSwatch->SetSwatchBackground( schematicBackground );
171
172 KIGFX::COLOR4D canvas = m_frame->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
173 m_borderColorSwatch->SetSwatchBackground( canvas.ToColour() );
174 m_fillColorSwatch->SetSwatchBackground( canvas.ToColour() );
175
176 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
177 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
178
179 m_ruleAreaSizer->Show( dynamic_cast<SCH_RULE_AREA*>( aShape ) != nullptr );
180
181 // Only show line ending controls for open shapes
182 m_endingsSizer->Show( !aShape->IsClosed() );
183
185
186 // Required under wxGTK if we want to dismiss the dialog with the ESC key
187 SetFocus();
188
190
191 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
192 {
193 m_fillBook->SetSelection( 1 );
194
195 if( !symbolEditor->IsSymbolGraphicallyEditable() )
196 {
197 m_sdbSizerCancel->SetDefault();
198 m_sdbSizerOK->SetLabel( _( "Read Only" ) );
199 m_sdbSizerOK->Enable( false );
200 }
201 }
202 else
203 {
204 m_fillBook->SetSelection( 0 );
205 m_symbolEditorSizer->Show( false );
206 }
207
208 m_borderColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onBorderSwatch, this );
209 m_customColorSwatch->Bind( COLOR_SWATCH_CHANGED, &DIALOG_SHAPE_PROPERTIES::onCustomColorSwatch, this );
210
211 // Now all widgets have the size fixed, call FinishDialogSettings
213}
214
215
221
222
224{
225 if( !wxDialog::TransferDataToWindow() )
226 return false;
227
228 if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
229 {
230 m_cbExcludeFromSim->SetValue( ruleArea->GetExcludedFromSim() );
231 m_cbExcludeFromBom->SetValue( ruleArea->GetExcludedFromBOM() );
232 m_cbExcludeFromBoard->SetValue( ruleArea->GetExcludedFromBoard() );
233 m_cbDNP->SetValue( ruleArea->GetDNP() );
234 }
235
236 if( m_shape->GetWidth() >= 0 )
237 {
238 m_borderCheckbox->SetValue( true );
239 m_borderWidth.SetValue( m_shape->GetWidth() );
240 }
241 else
242 {
243 m_borderCheckbox->SetValue( false );
244
245 m_borderWidth.Enable( false );
246 m_borderColorLabel->Enable( false );
247 m_borderColorSwatch->Enable( false );
248 m_borderStyleLabel->Enable( false );
249 m_borderStyleCombo->Enable( false );
250 }
251
252 m_borderColorSwatch->SetSwatchColor( m_shape->GetStroke().GetColor(), false );
253
254 int style = static_cast<int>( m_shape->GetStroke().GetLineStyle() );
255
256 if( style == -1 )
257 m_borderStyleCombo->SetStringSelection( DEFAULT_LINE_STYLE_LABEL );
258 else if( style < (int) lineTypeNames.size() )
259 m_borderStyleCombo->SetSelection( style );
260 else
261 wxFAIL_MSG( wxT( "Line type not found in the type lookup map" ) );
262
263 if( dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
264 {
265 m_rbFillNone->Enable( true );
266 m_rbFillOutline->Enable( true );
267 m_rbFillBackground->Enable( true );
268 m_rbFillCustom->Enable( true );
269 m_customColorSwatch->Enable( true );
270
271 if( m_shape->GetFillMode() == FILL_T::FILLED_SHAPE )
272 {
273 m_rbFillOutline->SetValue( true );
274
275 COLOR4D color = m_shape->GetStroke().GetColor();
276
277 if( color == COLOR4D::UNSPECIFIED )
278 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
279
280 m_customColorSwatch->SetSwatchColor( color, false );
281 }
282 else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_BG_BODYCOLOR )
283 {
284 m_rbFillBackground->SetValue( true );
285
286 COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
287 m_customColorSwatch->SetSwatchColor( color, false );
288 }
289 else if( m_shape->GetFillMode() == FILL_T::FILLED_WITH_COLOR )
290 {
291 m_rbFillCustom->SetValue( true );
292 m_customColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
293 }
294 else
295 {
296 m_rbFillNone->SetValue( true );
297 m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
298 }
299
300 const SYMBOL* symbol = m_shape->GetParentSymbol();
301
302 m_privateCheckbox->SetValue( m_shape->IsPrivate() );
303 m_checkApplyToAllUnits->SetValue( symbol->IsMultiUnit() && m_shape->GetUnit() == ALL_UNITS );
304 m_checkApplyToAllUnits->Enable( symbol->IsMultiUnit() );
305 m_checkApplyToAllBodyStyles->SetValue( symbol->IsMultiBodyStyle() && m_shape->GetBodyStyle() == ALL_BODY_STYLES );
307 }
308 else
309 {
310 m_fillCtrl->SetSelection( m_shape->GetFillModeProp() );
311 m_fillColorSwatch->SetSwatchColor( m_shape->GetFillColor(), false );
312 }
313
314 m_fillColorLabel->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
315 m_fillColorSwatch->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
316
317 // Line endings (only populated for open shapes)
318 if( !m_shape->IsClosed() )
319 {
320 m_startShapeChoice->SetSelection( LINE_ENDING::StyleToChoiceIndex( m_shape->GetStartEndingStyle() ) );
321 m_endShapeChoice->SetSelection( LINE_ENDING::StyleToChoiceIndex( m_shape->GetEndEndingStyle() ) );
322 m_startLength->SetValue( m_shape->GetStartEndingLength() );
323 m_startWidth->SetValue( m_shape->GetStartEndingWidth() );
324 m_startThickness->SetValue( m_shape->GetStartEndingStrokeWidth() );
325 m_endLength->SetValue( m_shape->GetEndEndingLength() );
326 m_endWidth->SetValue( m_shape->GetEndEndingWidth() );
327 m_endThickness->SetValue( m_shape->GetEndEndingStrokeWidth() );
328 }
329
330 return true;
331}
332
333
334void DIALOG_SHAPE_PROPERTIES::onBorderChecked( wxCommandEvent& event )
335{
336 bool border = m_borderCheckbox->GetValue();
337
338 if( border && m_borderWidth.GetValue() < 0 )
339 {
340 int defaultInMils;
341
342 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
343 defaultInMils = symbolEditor->libeditconfig()->m_Defaults.line_width;
344 else
345 defaultInMils = m_frame->eeconfig()->m_Drawing.default_line_thickness;
346
347 m_borderWidth.SetValue( schIUScale.MilsToIU( defaultInMils ) );
348 }
349
350 m_borderWidth.Enable( border );
351 m_borderColorLabel->Enable( border );
352 m_borderColorSwatch->Enable( border );
353 m_borderStyleLabel->Enable( border );
354 m_borderStyleCombo->Enable( border );
355}
356
357
358void DIALOG_SHAPE_PROPERTIES::onFillChoice( wxCommandEvent& event )
359{
360 m_fillColorLabel->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
361 m_fillColorSwatch->Enable( m_fillCtrl->GetSelection() != UI_FILL_MODE::NONE );
362}
363
364
366{
367 if( event.GetId() == NO_FILL )
368 {
369 m_rbFillNone->SetValue( true );
370 m_customColorSwatch->SetSwatchColor( COLOR4D::UNSPECIFIED, false );
371 }
372 else if( event.GetId() == FILLED_SHAPE )
373 {
374 m_rbFillOutline->SetValue( true );
375
376 COLOR4D color = m_borderColorSwatch->GetSwatchColor();
377
378 if( color == COLOR4D::UNSPECIFIED || !m_rbFillOutline->GetValue() )
379 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
380
381 m_customColorSwatch->SetSwatchColor( color, false );
382 }
383 else if( event.GetId() == FILLED_WITH_BG_BODYCOLOR )
384 {
385 m_rbFillBackground->SetValue( true );
386
387 COLOR4D color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE_BACKGROUND );
388 m_customColorSwatch->SetSwatchColor( color, false );
389 }
390 else if( event.GetId() == FILLED_WITH_COLOR )
391 {
392 m_rbFillCustom->SetValue( true );
393 m_customColorSwatch->GetNewSwatchColor();
394 }
395}
396
397
398void DIALOG_SHAPE_PROPERTIES::onBorderSwatch( wxCommandEvent& aEvent )
399{
400 if( m_rbFillOutline->GetValue() )
401 m_fillColorSwatch->SetSwatchColor( m_borderColorSwatch->GetSwatchColor(), false );
402
403 if( m_rbFillOutline->IsEnabled() && m_rbFillOutline->GetValue() )
404 {
406
407 if( m_rbFillOutline->GetValue() )
408 color = m_fillColorSwatch->GetSwatchColor();
409
410 if( color == COLOR4D::UNSPECIFIED )
411 color = m_frame->GetRenderSettings()->GetLayerColor( LAYER_DEVICE );
412
413 m_customColorSwatch->SetSwatchColor( color, false );
414 }
415}
416
417
419{
420 m_rbFillCustom->SetValue( true );
421}
422
423
425{
426 if( !wxDialog::TransferDataFromWindow() )
427 return false;
428
429 SCH_COMMIT commit( m_frame );
430
431 if( !m_shape->IsNew() )
432 commit.Modify( m_shape, m_frame->GetScreen() );
433
434 if( SCH_RULE_AREA* ruleArea = dynamic_cast<SCH_RULE_AREA*>( m_shape ) )
435 {
436 ruleArea->SetExcludedFromSim( m_cbExcludeFromSim->GetValue() );
437 ruleArea->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue() );
438 ruleArea->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
439 ruleArea->SetDNP( m_cbDNP->GetValue() );
440 }
441
442 STROKE_PARAMS stroke = m_shape->GetStroke();
443
444 if( m_borderCheckbox->GetValue() )
445 {
446 if( !m_borderWidth.IsIndeterminate() )
447 stroke.SetWidth( std::max( 0, m_borderWidth.GetIntValue() ) );
448 }
449 else
450 {
451 stroke.SetWidth( -1 );
452 }
453
454 auto it = lineTypeNames.begin();
455 std::advance( it, m_borderStyleCombo->GetSelection() );
456
457 if( it == lineTypeNames.end() )
459 else
460 stroke.SetLineStyle( it->first );
461
462 stroke.SetColor( m_borderColorSwatch->GetSwatchColor() );
463
464 m_shape->SetStroke( stroke );
465
466 if( SYMBOL_EDIT_FRAME* symbolEditor = dynamic_cast<SYMBOL_EDIT_FRAME*>( m_frame ) )
467 {
468 if( m_rbFillOutline->GetValue() )
469 m_shape->SetFillMode( FILL_T::FILLED_SHAPE );
470 else if( m_rbFillBackground->GetValue() )
472 else if( m_rbFillCustom->GetValue() )
473 m_shape->SetFillMode( FILL_T::FILLED_WITH_COLOR );
474 else
475 m_shape->SetFillMode( FILL_T::NO_FILL );
476
477 m_shape->SetFillColor( m_customColorSwatch->GetSwatchColor() );
478
479 m_shape->SetPrivate( m_privateCheckbox->GetValue() );
480
481 if( m_checkApplyToAllBodyStyles->IsChecked() )
482 m_shape->SetBodyStyle( 0 );
483 else
484 m_shape->SetBodyStyle( symbolEditor->GetBodyStyle() );
485
486 if( m_checkApplyToAllUnits->IsChecked() )
487 m_shape->SetUnit( 0 );
488 else
489 m_shape->SetUnit( symbolEditor->GetUnit() );
490 }
491 else
492 {
493 m_shape->SetFillModeProp( (UI_FILL_MODE) m_fillCtrl->GetSelection() );
494 m_shape->SetFillColor( m_fillColorSwatch->GetSwatchColor() );
495 }
496
497 // Line endings (only for open shapes)
498 if( !m_shape->IsClosed() )
499 {
500 int startSel = m_startShapeChoice->GetSelection();
501
502 if( startSel >= 0 && startSel < LINE_ENDING::s_defaultChoiceCount )
503 m_shape->SetStartEndingStyle( LINE_ENDING::s_defaultChoiceOrder[startSel] );
504
505 int endSel = m_endShapeChoice->GetSelection();
506
507 if( endSel >= 0 && endSel < LINE_ENDING::s_defaultChoiceCount )
508 m_shape->SetEndEndingStyle( LINE_ENDING::s_defaultChoiceOrder[endSel] );
509
510 if( !m_startLength->IsIndeterminate() )
511 m_shape->SetStartEndingLength( std::max( 0, m_startLength->GetIntValue() ) );
512
513 if( !m_startWidth->IsIndeterminate() )
514 m_shape->SetStartEndingWidth( std::max( 0, m_startWidth->GetIntValue() ) );
515
516 if( !m_startThickness->IsIndeterminate() )
517 m_shape->SetStartEndingStrokeWidth( std::max( 0, m_startThickness->GetIntValue() ) );
518
519 if( !m_endLength->IsIndeterminate() )
520 m_shape->SetEndEndingLength( std::max( 0, m_endLength->GetIntValue() ) );
521
522 if( !m_endWidth->IsIndeterminate() )
523 m_shape->SetEndEndingWidth( std::max( 0, m_endWidth->GetIntValue() ) );
524
525 if( !m_endThickness->IsIndeterminate() )
526 m_shape->SetEndEndingStrokeWidth( std::max( 0, m_endThickness->GetIntValue() ) );
527 }
528
529 if( !commit.Empty() )
530 commit.Push( wxString::Format( _( "Edit %s" ), m_shape->GetFriendlyName() ) );
531
532 return true;
533}
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:40
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:494
@ LAYER_DEVICE_BACKGROUND
Definition layer_ids.h:512
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:516
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