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