KiCad PCB EDA Suite
Loading...
Searching...
No Matches
dialog_sheet_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 (C) 2009 Wayne Stambaugh <[email protected]>
5 * Copyright The KiCad Developers, see CHANGELOG.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
22
23#include <kiface_base.h>
24#include <wx/string.h>
25#include <wx/log.h>
26#include <wx/tooltip.h>
27#include <common.h>
28#include <confirm.h>
29#include <kidialog.h>
30#include <validators.h>
31#include <wx_filename.h>
34#include <kiplatform/ui.h>
35#include <sch_commit.h>
36#include <sch_edit_frame.h>
37#include <sch_io/sch_io.h>
38#include <sch_sheet.h>
39#include <schematic.h>
42#include <template_fieldnames.h>
43#include <bitmaps.h>
44#include <eeschema_settings.h>
46#include <widgets/wx_infobar.h>
47#include <trace_helpers.h>
49#include "wx/dcclient.h"
50#include "string_utils.h"
51
53 bool* aIsUndoable, bool* aClearAnnotationNewItems,
54 bool* aUpdateHierarchyNavigator,
55 wxString* aSourceSheetFilename ) :
57 m_frame( aParent ),
58 m_isUndoable( aIsUndoable ),
59 m_clearAnnotationNewItems( aClearAnnotationNewItems ),
60 m_updateHierarchyNavigator( aUpdateHierarchyNavigator ),
61 m_sourceSheetFilename( aSourceSheetFilename ),
63 m_dummySheet( *aSheet ),
65{
66 m_sheet = aSheet;
67 m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_sheet );
70
71 m_grid->SetTable( m_fields );
72 m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this, { &aParent->Schematic() },
73 [&]( wxCommandEvent& aEvent )
74 {
75 OnAddField( aEvent );
76 } ) );
77 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
78 m_grid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
79 m_shownColumns = m_grid->GetShownColumns();
80
81 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
82 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
83
84 wxSize minSize = m_pageNumberTextCtrl->GetMinSize();
85 int minWidth = m_pageNumberTextCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
86
87 m_pageNumberTextCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
88
89 wxToolTip::Enable( true );
91
92 // Configure button logos
97
98 // Set font sizes
100 m_hierarchicalPath->SetFont( KIUI::GetSmallInfoFont( this ) );
101
102 // wxFormBuilder doesn't include this event...
103 m_grid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
104 nullptr, this );
105
107}
108
109
111{
112 // Prevents crash bug in wxGrid's d'tor
113 m_grid->DestroyTable( m_fields );
114
115 m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
116 nullptr, this );
117
118 // Delete the GRID_TRICKS.
119 m_grid->PopEventHandler( true );
120}
121
122
124{
125 if( !wxDialog::TransferDataToWindow() )
126 return false;
127
128 SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
129 wxString variantName = m_frame->Schematic().GetCurrentVariant();
130
131 // Push a copy of each field into m_updateFields
132 for( SCH_FIELD& field : m_sheet->GetFields() )
133 {
134 SCH_FIELD field_copy( field );
135
136#ifdef __WINDOWS__
137 // Filenames are stored using unix notation, so convert to Windows notation
138 if( field_copy.GetId() == FIELD_T::SHEET_FILENAME )
139 {
140 wxString filename = field_copy.GetText();
141 filename.Replace( wxT( "/" ), wxT( "\\" ) );
142 field_copy.SetText( filename );
143 }
144#endif
145
146 if( !field_copy.IsMandatory() )
147 field_copy.SetText( m_sheet->GetFieldText( field.GetName(), &instance, variantName ) );
148
149 // change offset to be symbol-relative
150 field_copy.Offset( -m_sheet->GetPosition() );
151
152 m_fields->push_back( field_copy );
153 }
154
155 // notify the grid
156 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->size() );
157 m_grid->ProcessTableMessage( msg );
158
159 // border width
160 m_borderWidth.SetValue( m_sheet->GetBorderWidth() );
161
162 // set up color swatches
163 KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
164 KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
165
166 m_borderSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
167 m_backgroundSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
168
169 m_borderSwatch->SetSwatchColor( borderColor, false );
170 m_backgroundSwatch->SetSwatchColor( backgroundColor, false );
171
172 KIGFX::COLOR4D canvas = m_frame->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
173 m_borderSwatch->SetSwatchBackground( canvas );
174 m_backgroundSwatch->SetSwatchBackground( canvas );
175
176 m_cbExcludeFromSim->SetValue( m_sheet->GetExcludedFromSim( &instance, variantName ) );
177 m_cbExcludeFromBom->SetValue( m_sheet->GetExcludedFromBOM( &instance, variantName ) );
178 m_cbExcludeFromBoard->SetValue( m_sheet->GetExcludedFromBoard( &instance, variantName ) );
179 m_cbDNP->SetValue( m_sheet->GetDNP( &instance, variantName ) );
180
181 instance.push_back( m_sheet );
182 m_pageNumberTextCtrl->ChangeValue( instance.GetPageNumber() );
183
184 // Recalculate the dialog size now that the grid is populated and controls
185 // have their real values. On first run, the dialog was sized before data
186 // was available, so the minimum size may not account for the actual content.
187 m_grid->Layout();
188 Layout();
189 GetSizer()->SetSizeHints( this );
190
191 wxSize minSize = GetMinSize();
192 wxSize curSize = GetSize();
193
194 if( curSize.x < minSize.x || curSize.y < minSize.y )
195 SetSize( wxSize( std::max( curSize.x, minSize.x ), std::max( curSize.y, minSize.y ) ) );
196
197 return true;
198}
199
200
202{
203 if( !m_grid->CommitPendingChanges() || !m_grid->Validate() )
204 return false;
205
206 // Check for missing field names.
207 for( size_t i = 0; i < m_fields->size(); ++i )
208 {
209 SCH_FIELD& field = m_fields->at( i );
210
211 if( field.IsMandatory() )
212 continue;
213
214 if( field.GetName( false ).empty() && !field.GetText().empty() )
215 {
216 DisplayErrorMessage( this, _( "Fields must have a name." ) );
217
219 m_delayedFocusRow = (int) i;
220
221 return false;
222 }
223 }
224
225 return true;
226}
227
228
229static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b )
230{
231 if( a.GetPosition() != b.GetPosition() )
232 return true;
233
234 if( a.GetHorizJustify() != b.GetHorizJustify() )
235 return true;
236
237 if( a.GetVertJustify() != b.GetVertJustify() )
238 return true;
239
240 if( a.GetTextAngle() != b.GetTextAngle() )
241 return true;
242
243 return false;
244}
245
246
248{
250 return true;
251
253 return true;
254
255 return false;
256}
257
258
260{
261 wxCHECK( m_sheet && m_frame, false );
262
263 if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
264 return false;
265
266 if( m_isUndoable )
267 *m_isUndoable = true;
268
269 // Sheet file names can be relative or absolute.
270 wxString sheetFileName = m_fields->GetField( FIELD_T::SHEET_FILENAME )->GetText();
271
272 // Ensure filepath is not empty. (In normal use will be caught by grid validators,
273 // but unedited data from existing files can be bad.)
274 if( sheetFileName.IsEmpty() )
275 {
276 DisplayError( this, _( "A sheet must have a valid file name." ) );
277 return false;
278 }
279
280 // Ensure the filename extension is OK. (In normal use will be caught by grid validators,
281 // but unedited data from existing files can be bad.)
282 sheetFileName = EnsureFileExtension( sheetFileName, FILEEXT::KiCadSchematicFileExtension );
283
284 // Ensure sheetFileName is legal
285 if( !IsFullFileNameValid( sheetFileName ) )
286 {
287 DisplayError( this, _( "A sheet must have a valid file name." ) );
288 return false;
289 }
290
291 wxFileName fn( sheetFileName );
292
293 wxString newRelativeFilename = fn.GetFullPath();
294
295 // Inside Eeschema, filenames are stored using unix notation
296 newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );
297
298 wxString oldFilename = m_sheet->GetField( FIELD_T::SHEET_FILENAME )->GetText();
299 oldFilename.Replace( wxT( "\\" ), wxT( "/" ) );
300
301 bool filename_changed = oldFilename != newRelativeFilename;
302
303 if( filename_changed || m_sheet->IsNew() )
304 {
305 SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
306
307 wxCHECK( currentScreen, false );
308
309 bool clearFileName = false;
310
311 // This can happen for the root sheet when opening Eeschema in the stand alone mode.
312 if( currentScreen->GetFileName().IsEmpty() )
313 {
314 clearFileName = true;
315 currentScreen->SetFileName( m_frame->Prj().AbsolutePath( wxT( "noname.kicad_sch" ) ) );
316 }
317
318 wxFileName tmp( fn );
319 wxFileName screenFileName = currentScreen->GetFileName();
320
321 if( fn.IsAbsolute() && fn.MakeRelativeTo( screenFileName.GetPath() ) )
322 {
323 KICAD_MESSAGE_DIALOG makeRelDlg( this, _( "Use relative path for sheet file?" ),
324 _( "Sheet File Path" ),
325 wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
326
327 makeRelDlg.SetExtendedMessage( _( "Using relative hierarchical sheet file name paths improves "
328 "schematic portability across systems and platforms. Using "
329 "absolute paths can result in portability issues." ) );
330 makeRelDlg.SetYesNoLabels( KICAD_MESSAGE_DIALOG::ButtonLabel( _( "Use Relative Path" ) ),
331 KICAD_MESSAGE_DIALOG::ButtonLabel( _( "Use Absolute Path" ) ) );
332
333 if( makeRelDlg.ShowModal() == wxID_YES )
334 {
335 wxLogTrace( tracePathsAndFiles, "\n Converted absolute path: '%s'"
336 "\n to relative path: '%s'",
337 tmp.GetPath(),
338 fn.GetPath() );
339 m_fields->GetField( FIELD_T::SHEET_FILENAME )->SetText( fn.GetFullPath() );
340 newRelativeFilename = fn.GetFullPath();
341 }
342 }
343
344 if( !onSheetFilenameChanged( newRelativeFilename ) )
345 {
346 if( clearFileName )
347 currentScreen->SetFileName( wxEmptyString );
348 else
350
351 return false;
352 }
354 {
356 }
357
358 if( clearFileName )
359 currentScreen->SetFileName( wxEmptyString );
360
361 // One last validity check (and potential repair) just to be sure to be sure
362 SCH_SHEET_LIST repairedList;
363 repairedList.BuildSheetList( &m_frame->Schematic().Root(), true );
364 }
365
366 wxString newSheetname = m_fields->GetField( FIELD_T::SHEET_NAME )->GetText();
367
368 if( ( newSheetname != m_sheet->GetName() ) && m_updateHierarchyNavigator )
370
371 if( newSheetname.IsEmpty() )
372 newSheetname = _( "Untitled Sheet" );
373
374 m_fields->GetField( FIELD_T::SHEET_NAME )->SetText( newSheetname );
375
376 // Net names embed the sheet path, so retarget netclass/color assignments on a rename.
377 SCH_SHEET_PATH renamedPath = m_frame->GetCurrentSheet();
378 renamedPath.push_back( m_sheet );
379 wxString oldNetPrefix = renamedPath.PathHumanReadable( true, false, true );
380
381 m_sheet->SetName( newSheetname );
382 m_sheet->SetFileName( newRelativeFilename );
383
384 wxString newNetPrefix = renamedPath.PathHumanReadable( true, false, true );
385
386 if( oldNetPrefix != newNetPrefix )
387 m_frame->Prj().GetProjectFile().NetSettings()->RenameNetPathPrefix( oldNetPrefix, newNetPrefix );
388
389 // change all field positions from relative to absolute
390 for( SCH_FIELD& m_field : *m_fields)
391 m_field.Offset( m_sheet->GetPosition() );
392
394 m_sheet->SetFieldsAutoplaced( AUTOPLACE_NONE );
395
396 SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
397 wxString variantName = m_frame->Schematic().GetCurrentVariant();
398
399 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
400
401 for( SCH_FIELD& field : *m_fields )
402 {
403 const wxString& fieldName = field.GetCanonicalName();
404
405 if( field.IsEmpty() )
406 continue;
407 else if( fieldName.IsEmpty() )
408 field.SetName( _( "untitled" ) );
409
410 SCH_FIELD* existingField = m_sheet->GetField( fieldName );
411 SCH_FIELD* tmp;
412
413 if( !existingField )
414 {
415 tmp = m_sheet->AddField( field );
416 tmp->SetParent( m_sheet );
417 }
418 else
419 {
420 wxString defaultText = m_sheet->Schematic()->ConvertRefsToKIIDs( existingField->GetText() );
421 tmp = const_cast<SCH_FIELD*>( existingField );
422
423 *tmp = field;
424
425 if( !variantName.IsEmpty() )
426 {
427 // Restore the default field text for existing fields.
428 tmp->SetText( defaultText, &instance );
429
430 wxString variantText = m_sheet->Schematic()->ConvertRefsToKIIDs( field.GetText() );
431 tmp->SetText( variantText, &instance, variantName );
432 }
433 }
434
435 if( !field.IsMandatory() )
436 field.SetOrdinal( ordinal++ );
437 }
438
439 for( int ii = (int) m_sheet->GetFields().size() - 1; ii >= 0; ii-- )
440 {
441 SCH_FIELD& sheetField = m_sheet->GetFields()[ii];
442
443 if( sheetField.IsMandatory() )
444 continue;
445
446 bool found = false;
447
448 for( const SCH_FIELD& editedField : *m_fields )
449 {
450 if( editedField.GetName() == sheetField.GetName() )
451 {
452 found = true;
453 break;
454 }
455 }
456
457 if( !found )
458 m_sheet->GetFields().erase( m_sheet->GetFields().begin() + ii );
459 }
460
461 m_sheet->SetBorderWidth( m_borderWidth.GetIntValue() );
462
463 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
464
465 if( colorSettings->GetOverrideSchItemColors()
466 && ( m_sheet->GetBorderColor() != m_borderSwatch->GetSwatchColor() ||
467 m_sheet->GetBackgroundColor() != m_backgroundSwatch->GetSwatchColor() ) )
468 {
469 wxPanel temp( this );
470 temp.Hide();
471 PANEL_EESCHEMA_COLOR_SETTINGS prefs( &temp );
472 wxString checkboxLabel = prefs.m_optOverrideColors->GetLabel();
473
474 KIDIALOG dlg( this, _( "Note: item colors are overridden in the current color theme." ),
476 dlg.ShowDetailedText( wxString::Format( _( "To see individual item colors uncheck '%s'\n"
477 "in Preferences > Schematic Editor > Colors." ),
478 checkboxLabel ) );
479 dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
480 dlg.ShowModal();
481 }
482
483 m_sheet->SetBorderColor( m_borderSwatch->GetSwatchColor() );
484 m_sheet->SetBackgroundColor( m_backgroundSwatch->GetSwatchColor() );
485
486 m_sheet->SetExcludedFromSim( m_cbExcludeFromSim->GetValue(), &instance, variantName );
487 m_sheet->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue(), &instance, variantName );
488 m_sheet->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
489 m_sheet->SetDNP( m_cbDNP->GetValue(), &instance, variantName );
490
491 instance.push_back( m_sheet );
492
493 instance.SetPageNumber( m_pageNumberTextCtrl->GetValue() );
494
495 m_frame->TestDanglingEnds();
496
497 // Refresh all sheets in case ordering changed.
498 for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_SHEET_T ) )
499 m_frame->UpdateItem( item );
500
501 return true;
502}
503
504
505bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilename )
506{
507 return m_frame->ChangeSheetFile( m_sheet, aNewFilename, m_clearAnnotationNewItems, m_isUndoable,
509}
510
511
513{
514 bool success = true;
515 wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
516 wxControl* control = editor->GetControl();
517
518 if( control && control->GetValidator() )
519 success = control->GetValidator()->Validate( control );
520
521 if( !success )
522 {
523 event.Veto();
524 m_delayedFocusRow = event.GetRow();
525 m_delayedFocusColumn = event.GetCol();
526 }
527 else if( event.GetCol() == FDC_NAME )
528 {
529 wxString newName = event.GetString();
530
531 for( int i = 0; i < m_grid->GetNumberRows(); ++i )
532 {
533 if( i == event.GetRow() )
534 continue;
535
536 if( FieldNamesAreDuplicates( newName, m_grid->GetCellValue( i, FDC_NAME ),
538 {
539 DisplayError( this, wxString::Format( _( "Field name '%s' already in use." ), newName ) );
540 event.Veto();
541 m_delayedFocusRow = event.GetRow();
542 m_delayedFocusColumn = event.GetCol();
543 break;
544 }
545 }
546 }
547
548 editor->DecRef();
549}
550
551
552void DIALOG_SHEET_PROPERTIES::OnAddField( wxCommandEvent& event )
553{
554 m_grid->OnAddRow(
555 [&]() -> std::pair<int, int>
556 {
558
559 newField.SetTextAngle( m_fields->GetField( FIELD_T::SHEET_NAME )->GetTextAngle() );
560 newField.SetVisible( false );
561 m_fields->push_back( newField );
562
563 // notify the grid
564 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
565 m_grid->ProcessTableMessage( msg );
566 return { m_fields->size() - 1, FDC_NAME };
567 } );
568}
569
570
571void DIALOG_SHEET_PROPERTIES::OnDeleteField( wxCommandEvent& event )
572{
573 m_grid->OnDeleteRows(
574 [&]( int row )
575 {
576 if( row < m_fields->GetMandatoryRowCount() )
577 {
578 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
579 m_fields->GetMandatoryRowCount() ) );
580 return false;
581 }
582
583 return true;
584 },
585 [&]( int row )
586 {
587 m_fields->erase( m_fields->begin() + row );
588
589 // notify the grid
590 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
591 m_grid->ProcessTableMessage( msg );
592 } );
593}
594
595
596void DIALOG_SHEET_PROPERTIES::OnMoveUp( wxCommandEvent& event )
597{
598 m_grid->OnMoveRowUp(
599 [&]( int row )
600 {
601 return row > m_fields->GetMandatoryRowCount();
602 },
603 [&]( int row )
604 {
605 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row - 1 ) );
606 m_grid->ForceRefresh();
607 } );
608}
609
610
611void DIALOG_SHEET_PROPERTIES::OnMoveDown( wxCommandEvent& event )
612{
613 m_grid->OnMoveRowUp(
614 [&]( int row )
615 {
616 return row >= m_fields->GetMandatoryRowCount();
617 },
618 [&]( int row )
619 {
620 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row + 1 ) );
621 m_grid->ForceRefresh();
622 } );
623}
624
625
626void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
627{
628 std::bitset<64> shownColumns = m_grid->GetShownColumns();
629
630 if( shownColumns != m_shownColumns )
631 {
632 m_shownColumns = shownColumns;
633
634 if( !m_grid->IsCellEditControlShown() )
635 m_grid->SetGridWidthsDirty();
636 }
637
638 // Propagate changes in sheetname to displayed hierarchical path
639 int sheetnameRow = m_fields->GetFieldRow( FIELD_T::SHEET_NAME );
640 wxString path = m_frame->GetCurrentSheet().PathHumanReadable( false );
641
642 if( path.Last() != '/' )
643 path.Append( '/' );
644
645 wxGridCellEditor* editor = m_grid->GetCellEditor( sheetnameRow, FDC_VALUE );
646 wxControl* control = editor->GetControl();
647 wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
648 wxString sheetName;
649
650 if( textControl )
651 sheetName = textControl->GetValue();
652 else
653 sheetName = m_grid->GetCellValue( sheetnameRow, FDC_VALUE );
654
655 m_dummySheet.SetFields( *m_fields );
656 m_dummySheetNameField.SetText( sheetName );
657 path += m_dummySheetNameField.GetShownText( false );
658
659 editor->DecRef();
660
661 wxClientDC dc( m_hierarchicalPathLabel );
662 int width = m_sizerBottom->GetSize().x - m_stdDialogButtonSizer->GetSize().x
663 - m_hierarchicalPathLabel->GetSize().x
664 - 30;
665
666 path = wxControl::Ellipsize( path, dc, wxELLIPSIZE_START, width, wxELLIPSIZE_FLAGS_NONE );
667
668 if( m_hierarchicalPath->GetLabel() != path )
669 m_hierarchicalPath->SetLabel( path );
670
671 // Handle a delayed focus
672 if( m_delayedFocusRow >= 0 )
673 {
674 m_grid->SetFocus();
675 m_grid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn );
677
678 m_grid->EnableCellEditControl( true );
679 m_grid->ShowCellEditControl();
680
683 }
684}
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:398
Color settings are a bit different than most of the settings objects in that there can be more than o...
bool GetOverrideSchItemColors() const
wxStdDialogButtonSizer * m_stdDialogButtonSizer
DIALOG_SHEET_PROPERTIES_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Sheet Properties"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU)
void OnAddField(wxCommandEvent &event) override
void OnMoveDown(wxCommandEvent &event) override
void OnGridCellChanging(wxGridEvent &event)
void OnDeleteField(wxCommandEvent &event) override
bool onSheetFilenameChanged(const wxString &aNewFilename)
void OnUpdateUI(wxUpdateUIEvent &event) override
void OnMoveUp(wxCommandEvent &event) override
DIALOG_SHEET_PROPERTIES(SCH_EDIT_FRAME *aParent, SCH_SHEET *aSheet, bool *aIsUndoable, bool *aClearAnnotationNewItems, bool *aUpdateHierarchyNavigator, wxString *aSourceSheetFilename)
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...
virtual void SetParent(EDA_ITEM *aParent)
Definition eda_item.cpp:89
virtual void Offset(const VECTOR2I &aOffset)
Definition eda_text.cpp:595
GR_TEXT_H_ALIGN_T GetHorizJustify() const
Definition eda_text.h:221
virtual void SetVisible(bool aVisible)
Definition eda_text.cpp:381
virtual EDA_ANGLE GetTextAngle() const
Definition eda_text.h:168
GR_TEXT_V_ALIGN_T GetVertJustify() const
Definition eda_text.h:224
virtual void SetTextAngle(const EDA_ANGLE &aAngle)
Definition eda_text.cpp:294
SCH_FIELD * GetField(FIELD_T aFieldId)
Helper class to create more flexible dialogs, including 'do not show again' checkbox handling.
Definition kidialog.h:38
@ KD_WARNING
Definition kidialog.h:43
void DoNotShowCheckbox(wxString file, int line)
Shows the 'do not show again' checkbox.
Definition kidialog.cpp:51
int ShowModal() override
Definition kidialog.cpp:89
A color representation with 4 components: red, green, blue, alpha.
Definition color4d.h:101
Schematic editor (Eeschema) main window.
SCHEMATIC & Schematic() const
void SetOrdinal(int aOrdinal)
Definition sch_field.h:138
bool IsMandatory() const
VECTOR2I GetPosition() const override
virtual const wxString & GetText() const override
Return the string associated with the text object.
Definition sch_field.h:128
FIELD_T GetId() const
Definition sch_field.h:132
wxString GetName(bool aUseDefaultName=true) const
Return the field name (not translated).
void SetText(const wxString &aText) override
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition sch_item.h:162
const wxString & GetFileName() const
Definition sch_screen.h:150
void SetFileName(const wxString &aFileName)
Set the file name for this screen to aFileName.
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
wxString GetPageNumber() const
wxString PathHumanReadable(bool aUseShortRootName=true, bool aStripTrailingSeparator=false, bool aEscapeSheetNames=false) const
Return the sheet path in a human readable form made from the sheet names.
void SetPageNumber(const wxString &aPageNumber)
Set the sheet instance user definable page number.
void push_back(SCH_SHEET *aSheet)
Forwarded method from std::vector.
Sheet symbol placed in a schematic, and is the entry point for a sub schematic.
Definition sch_sheet.h:44
SCH_FIELD * GetField(FIELD_T aFieldType)
Return a mandatory field in this sheet.
wxString EnsureFileExtension(const wxString &aFilename, const wxString &aExtension)
It's annoying to throw up nag dialogs when the extension isn't right.
Definition common.cpp:792
The common library.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
Definition confirm.cpp:217
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
Definition confirm.cpp:192
This file is part of the common library.
#define KICAD_MESSAGE_DIALOG
Definition confirm.h:48
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
static bool positioningChanged(const SCH_FIELD &a, const SCH_FIELD &b)
const int minSize
Push and Shove router track width and via size dialog.
#define _(s)
@ FDC_NAME
@ FDC_VALUE
static const std::string KiCadSchematicFileExtension
const wxChar *const tracePathsAndFiles
Flag to enable path and file name debug output.
@ LAYER_SCHEMATIC_BACKGROUND
Definition layer_ids.h:494
KICOMMON_API wxFont GetSmallInfoFont(wxWindow *aWindow)
const SCH_FIELD * FindField(const std::vector< SCH_FIELD > &aFields, FIELD_T aFieldId)
Definition sch_field.h:383
@ AUTOPLACE_NONE
Definition sch_item.h:66
bool IsFullFileNameValid(const wxString &aFullFilename)
Checks if a full filename is valid, i.e.
bool FieldNamesAreDuplicates(const wxString &aLhs, const wxString &aRhs, std::initializer_list< FIELD_T > aMandatoryFields)
Test whether two field names should be treated as duplicates for the purposes of field name uniquenes...
wxString GetUserFieldName(int aFieldNdx, bool aTranslateForHI)
#define DO_TRANSLATE
FIELD_T
The set of all field indices assuming an array like sequence that a SCH_COMPONENT or LIB_PART can hol...
#define SHEET_MANDATORY_FIELDS
std::string path
wxLogTrace helper definitions.
@ SCH_SHEET_T
Definition typeinfo.h:172
Custom text control validator definitions.
Definition of file extensions used in Kicad.