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 <bitmaps.h>
43#include <eeschema_settings.h>
45#include <widgets/wx_infobar.h>
46#include <trace_helpers.h>
48#include "wx/dcclient.h"
49#include "string_utils.h"
50
52 bool* aIsUndoable, bool* aClearAnnotationNewItems,
53 bool* aUpdateHierarchyNavigator,
54 wxString* aSourceSheetFilename ) :
56 m_frame( aParent ),
57 m_isUndoable( aIsUndoable ),
58 m_clearAnnotationNewItems( aClearAnnotationNewItems ),
59 m_updateHierarchyNavigator( aUpdateHierarchyNavigator ),
60 m_sourceSheetFilename( aSourceSheetFilename ),
62 m_dummySheet( *aSheet ),
64{
65 m_sheet = aSheet;
66 m_fields = new FIELDS_GRID_TABLE( this, aParent, m_grid, m_sheet );
69
70 m_grid->SetTable( m_fields );
71 m_grid->PushEventHandler( new FIELDS_GRID_TRICKS( m_grid, this, { &aParent->Schematic() },
72 [&]( wxCommandEvent& aEvent )
73 {
74 OnAddField( aEvent );
75 } ) );
76 m_grid->SetSelectionMode( wxGrid::wxGridSelectRows );
77 m_grid->ShowHideColumns( "0 1 2 3 4 5 6 7" );
78 m_shownColumns = m_grid->GetShownColumns();
79
80 if( m_frame->GetColorSettings()->GetOverrideSchItemColors() )
81 m_infoBar->ShowMessage( _( "Note: individual item colors overridden in Preferences." ) );
82
83 wxSize minSize = m_pageNumberTextCtrl->GetMinSize();
84 int minWidth = m_pageNumberTextCtrl->GetTextExtent( wxT( "XXX.XXX" ) ).GetWidth();
85
86 m_pageNumberTextCtrl->SetMinSize( wxSize( minWidth, minSize.GetHeight() ) );
87
88 wxToolTip::Enable( true );
90
91 // Configure button logos
96
97 // Set font sizes
100
101 // wxFormBuilder doesn't include this event...
102 m_grid->Connect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
103 nullptr, this );
104
106}
107
108
110{
111 // Prevents crash bug in wxGrid's d'tor
112 m_grid->DestroyTable( m_fields );
113
114 m_grid->Disconnect( wxEVT_GRID_CELL_CHANGING, wxGridEventHandler( DIALOG_SHEET_PROPERTIES::OnGridCellChanging ),
115 nullptr, this );
116
117 // Delete the GRID_TRICKS.
118 m_grid->PopEventHandler( true );
119}
120
121
123{
124 if( !wxDialog::TransferDataToWindow() )
125 return false;
126
127 SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
128 wxString variantName = m_frame->Schematic().GetCurrentVariant();
129
130 // Push a copy of each field into m_updateFields
131 for( SCH_FIELD& field : m_sheet->GetFields() )
132 {
133 SCH_FIELD field_copy( field );
134
135#ifdef __WINDOWS__
136 // Filenames are stored using unix notation, so convert to Windows notation
137 if( field_copy.GetId() == FIELD_T::SHEET_FILENAME )
138 {
139 wxString filename = field_copy.GetText();
140 filename.Replace( wxT( "/" ), wxT( "\\" ) );
141 field_copy.SetText( filename );
142 }
143#endif
144
145 if( !field_copy.IsMandatory() )
146 field_copy.SetText( m_sheet->GetFieldText( field.GetName(), &instance, variantName ) );
147
148 // change offset to be symbol-relative
149 field_copy.Offset( -m_sheet->GetPosition() );
150
151 m_fields->push_back( field_copy );
152 }
153
154 // notify the grid
155 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, m_fields->size() );
156 m_grid->ProcessTableMessage( msg );
157
158 // border width
159 m_borderWidth.SetValue( m_sheet->GetBorderWidth() );
160
161 // set up color swatches
162 KIGFX::COLOR4D borderColor = m_sheet->GetBorderColor();
163 KIGFX::COLOR4D backgroundColor = m_sheet->GetBackgroundColor();
164
165 m_borderSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
166 m_backgroundSwatch->SetDefaultColor( COLOR4D::UNSPECIFIED );
167
168 m_borderSwatch->SetSwatchColor( borderColor, false );
169 m_backgroundSwatch->SetSwatchColor( backgroundColor, false );
170
171 KIGFX::COLOR4D canvas = m_frame->GetColorSettings()->GetColor( LAYER_SCHEMATIC_BACKGROUND );
172 m_borderSwatch->SetSwatchBackground( canvas );
173 m_backgroundSwatch->SetSwatchBackground( canvas );
174
175 m_cbExcludeFromSim->SetValue( m_sheet->GetExcludedFromSim( &instance, variantName ) );
176 m_cbExcludeFromBom->SetValue( m_sheet->GetExcludedFromBOM( &instance, variantName ) );
177 m_cbExcludeFromBoard->SetValue( m_sheet->GetExcludedFromBoard( &instance, variantName ) );
178 m_cbDNP->SetValue( m_sheet->GetDNP( &instance, variantName ) );
179
180 instance.push_back( m_sheet );
181 m_pageNumberTextCtrl->ChangeValue( instance.GetPageNumber() );
182
183 // Recalculate the dialog size now that the grid is populated and controls
184 // have their real values. On first run, the dialog was sized before data
185 // was available, so the minimum size may not account for the actual content.
186 m_grid->Layout();
187 Layout();
188 GetSizer()->SetSizeHints( this );
189
190 wxSize minSize = GetMinSize();
191 wxSize curSize = GetSize();
192
193 if( curSize.x < minSize.x || curSize.y < minSize.y )
194 SetSize( wxSize( std::max( curSize.x, minSize.x ), std::max( curSize.y, minSize.y ) ) );
195
196 return true;
197}
198
199
201{
202 if( !m_grid->CommitPendingChanges() || !m_grid->Validate() )
203 return false;
204
205 // Check for missing field names.
206 for( size_t i = 0; i < m_fields->size(); ++i )
207 {
208 SCH_FIELD& field = m_fields->at( i );
209
210 if( field.IsMandatory() )
211 continue;
212
213 if( field.GetName( false ).empty() && !field.GetText().empty() )
214 {
215 DisplayErrorMessage( this, _( "Fields must have a name." ) );
216
218 m_delayedFocusRow = (int) i;
219
220 return false;
221 }
222 }
223
224 return true;
225}
226
227
228static bool positioningChanged( const SCH_FIELD& a, const SCH_FIELD& b )
229{
230 if( a.GetPosition() != b.GetPosition() )
231 return true;
232
233 if( a.GetHorizJustify() != b.GetHorizJustify() )
234 return true;
235
236 if( a.GetVertJustify() != b.GetVertJustify() )
237 return true;
238
239 if( a.GetTextAngle() != b.GetTextAngle() )
240 return true;
241
242 return false;
243}
244
245
247{
249 return true;
250
252 return true;
253
254 return false;
255}
256
257
259{
260 wxCHECK( m_sheet && m_frame, false );
261
262 if( !wxDialog::TransferDataFromWindow() ) // Calls our Validate() method.
263 return false;
264
265 if( m_isUndoable )
266 *m_isUndoable = true;
267
268 // Sheet file names can be relative or absolute.
269 wxString sheetFileName = m_fields->GetField( FIELD_T::SHEET_FILENAME )->GetText();
270
271 // Ensure filepath is not empty. (In normal use will be caught by grid validators,
272 // but unedited data from existing files can be bad.)
273 if( sheetFileName.IsEmpty() )
274 {
275 DisplayError( this, _( "A sheet must have a valid file name." ) );
276 return false;
277 }
278
279 // Ensure the filename extension is OK. (In normal use will be caught by grid validators,
280 // but unedited data from existing files can be bad.)
281 sheetFileName = EnsureFileExtension( sheetFileName, FILEEXT::KiCadSchematicFileExtension );
282
283 // Ensure sheetFileName is legal
284 if( !IsFullFileNameValid( sheetFileName ) )
285 {
286 DisplayError( this, _( "A sheet must have a valid file name." ) );
287 return false;
288 }
289
290 wxFileName fn( sheetFileName );
291
292 wxString newRelativeFilename = fn.GetFullPath();
293
294 // Inside Eeschema, filenames are stored using unix notation
295 newRelativeFilename.Replace( wxT( "\\" ), wxT( "/" ) );
296
297 wxString oldFilename = m_sheet->GetField( FIELD_T::SHEET_FILENAME )->GetText();
298 oldFilename.Replace( wxT( "\\" ), wxT( "/" ) );
299
300 bool filename_changed = oldFilename != newRelativeFilename;
301
302 if( filename_changed || m_sheet->IsNew() )
303 {
304 SCH_SCREEN* currentScreen = m_frame->GetCurrentSheet().LastScreen();
305
306 wxCHECK( currentScreen, false );
307
308 bool clearFileName = false;
309
310 // This can happen for the root sheet when opening Eeschema in the stand alone mode.
311 if( currentScreen->GetFileName().IsEmpty() )
312 {
313 clearFileName = true;
314 currentScreen->SetFileName( m_frame->Prj().AbsolutePath( wxT( "noname.kicad_sch" ) ) );
315 }
316
317 wxFileName tmp( fn );
318 wxFileName screenFileName = currentScreen->GetFileName();
319
320 if( fn.IsAbsolute() && fn.MakeRelativeTo( screenFileName.GetPath() ) )
321 {
322 KICAD_MESSAGE_DIALOG makeRelDlg( this, _( "Use relative path for sheet file?" ),
323 _( "Sheet File Path" ),
324 wxYES_NO | wxYES_DEFAULT | wxICON_QUESTION | wxCENTER );
325
326 makeRelDlg.SetExtendedMessage( _( "Using relative hierarchical sheet file name paths improves "
327 "schematic portability across systems and platforms. Using "
328 "absolute paths can result in portability issues." ) );
329 makeRelDlg.SetYesNoLabels( KICAD_MESSAGE_DIALOG::ButtonLabel( _( "Use Relative Path" ) ),
330 KICAD_MESSAGE_DIALOG::ButtonLabel( _( "Use Absolute Path" ) ) );
331
332 if( makeRelDlg.ShowModal() == wxID_YES )
333 {
334 wxLogTrace( tracePathsAndFiles, "\n Converted absolute path: '%s'"
335 "\n to relative path: '%s'",
336 tmp.GetPath(),
337 fn.GetPath() );
338 m_fields->GetField( FIELD_T::SHEET_FILENAME )->SetText( fn.GetFullPath() );
339 newRelativeFilename = fn.GetFullPath();
340 }
341 }
342
343 if( !onSheetFilenameChanged( newRelativeFilename ) )
344 {
345 if( clearFileName )
346 currentScreen->SetFileName( wxEmptyString );
347 else
349
350 return false;
351 }
353 {
355 }
356
357 if( clearFileName )
358 currentScreen->SetFileName( wxEmptyString );
359
360 // One last validity check (and potential repair) just to be sure to be sure
361 SCH_SHEET_LIST repairedList;
362 repairedList.BuildSheetList( &m_frame->Schematic().Root(), true );
363 }
364
365 wxString newSheetname = m_fields->GetField( FIELD_T::SHEET_NAME )->GetText();
366
367 if( ( newSheetname != m_sheet->GetName() ) && m_updateHierarchyNavigator )
369
370 if( newSheetname.IsEmpty() )
371 newSheetname = _( "Untitled Sheet" );
372
373 m_fields->GetField( FIELD_T::SHEET_NAME )->SetText( newSheetname );
374
375 // Net names embed the sheet path, so retarget netclass/color assignments on a rename.
376 SCH_SHEET_PATH renamedPath = m_frame->GetCurrentSheet();
377 renamedPath.push_back( m_sheet );
378 wxString oldNetPrefix = renamedPath.PathHumanReadable( true, false, true );
379
380 m_sheet->SetName( newSheetname );
381 m_sheet->SetFileName( newRelativeFilename );
382
383 wxString newNetPrefix = renamedPath.PathHumanReadable( true, false, true );
384
385 if( oldNetPrefix != newNetPrefix )
386 m_frame->Prj().GetProjectFile().NetSettings()->RenameNetPathPrefix( oldNetPrefix, newNetPrefix );
387
388 // change all field positions from relative to absolute
389 for( SCH_FIELD& m_field : *m_fields)
390 m_field.Offset( m_sheet->GetPosition() );
391
393 m_sheet->SetFieldsAutoplaced( AUTOPLACE_NONE );
394
395 SCH_SHEET_PATH instance = m_frame->GetCurrentSheet();
396 wxString variantName = m_frame->Schematic().GetCurrentVariant();
397
398 int ordinal = 42; // Arbitrarily larger than any mandatory FIELD_T ids.
399
400 for( SCH_FIELD& field : *m_fields )
401 {
402 const wxString& fieldName = field.GetCanonicalName();
403
404 if( field.IsEmpty() )
405 continue;
406 else if( fieldName.IsEmpty() )
407 field.SetName( _( "untitled" ) );
408
409 SCH_FIELD* existingField = m_sheet->GetField( fieldName );
410 SCH_FIELD* tmp;
411
412 if( !existingField )
413 {
414 tmp = m_sheet->AddField( field );
415 tmp->SetParent( m_sheet );
416 }
417 else
418 {
419 wxString defaultText = m_sheet->Schematic()->ConvertRefsToKIIDs( existingField->GetText() );
420 tmp = const_cast<SCH_FIELD*>( existingField );
421
422 *tmp = field;
423
424 if( !variantName.IsEmpty() )
425 {
426 // Restore the default field text for existing fields.
427 tmp->SetText( defaultText, &instance );
428
429 wxString variantText = m_sheet->Schematic()->ConvertRefsToKIIDs( field.GetText() );
430 tmp->SetText( variantText, &instance, variantName );
431 }
432 }
433
434 if( !field.IsMandatory() )
435 field.SetOrdinal( ordinal++ );
436 }
437
438 for( int ii = (int) m_sheet->GetFields().size() - 1; ii >= 0; ii-- )
439 {
440 SCH_FIELD& sheetField = m_sheet->GetFields()[ii];
441
442 if( sheetField.IsMandatory() )
443 continue;
444
445 bool found = false;
446
447 for( const SCH_FIELD& editedField : *m_fields )
448 {
449 if( editedField.GetName() == sheetField.GetName() )
450 {
451 found = true;
452 break;
453 }
454 }
455
456 if( !found )
457 m_sheet->GetFields().erase( m_sheet->GetFields().begin() + ii );
458 }
459
460 m_sheet->SetBorderWidth( m_borderWidth.GetIntValue() );
461
462 COLOR_SETTINGS* colorSettings = m_frame->GetColorSettings();
463
464 if( colorSettings->GetOverrideSchItemColors()
465 && ( m_sheet->GetBorderColor() != m_borderSwatch->GetSwatchColor() ||
466 m_sheet->GetBackgroundColor() != m_backgroundSwatch->GetSwatchColor() ) )
467 {
468 wxPanel temp( this );
469 temp.Hide();
470 PANEL_EESCHEMA_COLOR_SETTINGS prefs( &temp );
471 wxString checkboxLabel = prefs.m_optOverrideColors->GetLabel();
472
473 KIDIALOG dlg( this, _( "Note: item colors are overridden in the current color theme." ),
475 dlg.ShowDetailedText( wxString::Format( _( "To see individual item colors uncheck '%s'\n"
476 "in Preferences > Schematic Editor > Colors." ),
477 checkboxLabel ) );
478 dlg.DoNotShowCheckbox( __FILE__, __LINE__ );
479 dlg.ShowModal();
480 }
481
482 m_sheet->SetBorderColor( m_borderSwatch->GetSwatchColor() );
483 m_sheet->SetBackgroundColor( m_backgroundSwatch->GetSwatchColor() );
484
485 m_sheet->SetExcludedFromSim( m_cbExcludeFromSim->GetValue(), &instance, variantName );
486 m_sheet->SetExcludedFromBOM( m_cbExcludeFromBom->GetValue(), &instance, variantName );
487 m_sheet->SetExcludedFromBoard( m_cbExcludeFromBoard->GetValue() );
488 m_sheet->SetDNP( m_cbDNP->GetValue(), &instance, variantName );
489
490 instance.push_back( m_sheet );
491
492 instance.SetPageNumber( m_pageNumberTextCtrl->GetValue() );
493
494 m_frame->TestDanglingEnds();
495
496 // Refresh all sheets in case ordering changed.
497 for( SCH_ITEM* item : m_frame->GetScreen()->Items().OfType( SCH_SHEET_T ) )
498 m_frame->UpdateItem( item );
499
500 return true;
501}
502
503
504bool DIALOG_SHEET_PROPERTIES::onSheetFilenameChanged( const wxString& aNewFilename )
505{
506 return m_frame->ChangeSheetFile( m_sheet, aNewFilename, m_clearAnnotationNewItems, m_isUndoable,
508}
509
510
512{
513 bool success = true;
514 wxGridCellEditor* editor = m_grid->GetCellEditor( event.GetRow(), event.GetCol() );
515 wxControl* control = editor->GetControl();
516
517 if( control && control->GetValidator() )
518 success = control->GetValidator()->Validate( control );
519
520 if( !success )
521 {
522 event.Veto();
523 m_delayedFocusRow = event.GetRow();
524 m_delayedFocusColumn = event.GetCol();
525 }
526 else if( event.GetCol() == FDC_NAME )
527 {
528 wxString newName = event.GetString();
529
530 for( int i = 0; i < m_grid->GetNumberRows(); ++i )
531 {
532 if( i == event.GetRow() )
533 continue;
534
535 if( newName.CmpNoCase( m_grid->GetCellValue( i, FDC_NAME ) ) == 0 )
536 {
537 DisplayError( this, wxString::Format( _( "Field name '%s' already in use." ), newName ) );
538 event.Veto();
539 m_delayedFocusRow = event.GetRow();
540 m_delayedFocusColumn = event.GetCol();
541 break;
542 }
543 }
544 }
545
546 editor->DecRef();
547}
548
549
550void DIALOG_SHEET_PROPERTIES::OnAddField( wxCommandEvent& event )
551{
552 m_grid->OnAddRow(
553 [&]() -> std::pair<int, int>
554 {
556
557 newField.SetTextAngle( m_fields->GetField( FIELD_T::SHEET_NAME )->GetTextAngle() );
558 newField.SetVisible( false );
559 m_fields->push_back( newField );
560
561 // notify the grid
562 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_APPENDED, 1 );
563 m_grid->ProcessTableMessage( msg );
564 return { m_fields->size() - 1, FDC_NAME };
565 } );
566}
567
568
569void DIALOG_SHEET_PROPERTIES::OnDeleteField( wxCommandEvent& event )
570{
571 m_grid->OnDeleteRows(
572 [&]( int row )
573 {
574 if( row < m_fields->GetMandatoryRowCount() )
575 {
576 DisplayError( this, wxString::Format( _( "The first %d fields are mandatory." ),
577 m_fields->GetMandatoryRowCount() ) );
578 return false;
579 }
580
581 return true;
582 },
583 [&]( int row )
584 {
585 m_fields->erase( m_fields->begin() + row );
586
587 // notify the grid
588 wxGridTableMessage msg( m_fields, wxGRIDTABLE_NOTIFY_ROWS_DELETED, row, 1 );
589 m_grid->ProcessTableMessage( msg );
590 } );
591}
592
593
594void DIALOG_SHEET_PROPERTIES::OnMoveUp( wxCommandEvent& event )
595{
596 m_grid->OnMoveRowUp(
597 [&]( int row )
598 {
599 return row > m_fields->GetMandatoryRowCount();
600 },
601 [&]( int row )
602 {
603 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row - 1 ) );
604 m_grid->ForceRefresh();
605 } );
606}
607
608
609void DIALOG_SHEET_PROPERTIES::OnMoveDown( wxCommandEvent& event )
610{
611 m_grid->OnMoveRowUp(
612 [&]( int row )
613 {
614 return row >= m_fields->GetMandatoryRowCount();
615 },
616 [&]( int row )
617 {
618 std::swap( *( m_fields->begin() + row ), *( m_fields->begin() + row + 1 ) );
619 m_grid->ForceRefresh();
620 } );
621}
622
623
624void DIALOG_SHEET_PROPERTIES::OnUpdateUI( wxUpdateUIEvent& event )
625{
626 std::bitset<64> shownColumns = m_grid->GetShownColumns();
627
628 if( shownColumns != m_shownColumns )
629 {
630 m_shownColumns = shownColumns;
631
632 if( !m_grid->IsCellEditControlShown() )
633 m_grid->SetGridWidthsDirty();
634 }
635
636 // Propagate changes in sheetname to displayed hierarchical path
637 int sheetnameRow = m_fields->GetFieldRow( FIELD_T::SHEET_NAME );
638 wxString path = m_frame->GetCurrentSheet().PathHumanReadable( false );
639
640 if( path.Last() != '/' )
641 path.Append( '/' );
642
643 wxGridCellEditor* editor = m_grid->GetCellEditor( sheetnameRow, FDC_VALUE );
644 wxControl* control = editor->GetControl();
645 wxTextEntry* textControl = dynamic_cast<wxTextEntry*>( control );
646 wxString sheetName;
647
648 if( textControl )
649 sheetName = textControl->GetValue();
650 else
651 sheetName = m_grid->GetCellValue( sheetnameRow, FDC_VALUE );
652
653 m_dummySheet.SetFields( *m_fields );
654 m_dummySheetNameField.SetText( sheetName );
655 path += m_dummySheetNameField.GetShownText( false );
656
657 editor->DecRef();
658
659 wxClientDC dc( m_hierarchicalPathLabel );
660 int width = m_sizerBottom->GetSize().x - m_stdDialogButtonSizer->GetSize().x
661 - m_hierarchicalPathLabel->GetSize().x
662 - 30;
663
664 path = wxControl::Ellipsize( path, dc, wxELLIPSIZE_START, width, wxELLIPSIZE_FLAGS_NONE );
665
666 if( m_hierarchicalPath->GetLabel() != path )
667 m_hierarchicalPath->SetLabel( path );
668
669 // Handle a delayed focus
670 if( m_delayedFocusRow >= 0 )
671 {
672 m_grid->SetFocus();
673 m_grid->MakeCellVisible( m_delayedFocusRow, m_delayedFocusColumn );
675
676 m_grid->EnableCellEditControl( true );
677 m_grid->ShowCellEditControl();
678
681 }
682}
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:486
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.
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...
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.