Add visibility flags for sheet names and sheet filenames.

This commit is contained in:
Jeff Young 2020-02-20 21:29:21 +00:00
parent 48874a7f19
commit e033e394e7
11 changed files with 362 additions and 411 deletions

View File

@ -50,9 +50,13 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( SCH_EDIT_FRAME* parent, SCH_SHEE
m_tabOrder = { m_tabOrder = {
m_textFileName, m_textFileName,
m_browseButton, m_browseButton,
m_textSheetName, m_filenameVisible,
m_filenameSizeCtrl, m_filenameSizeCtrl,
m_textSheetName,
m_sheetnameSizeCtrl, m_sheetnameSizeCtrl,
m_sheetnameVisible,
m_sdbSizer1OK, m_sdbSizer1OK,
m_sdbSizer1Cancel m_sdbSizer1Cancel
}; };
@ -84,14 +88,14 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataToWindow()
fname.Replace( wxT("/"), wxT("\\") ); fname.Replace( wxT("/"), wxT("\\") );
#endif #endif
m_textFileName->SetValue( fname ); m_textFileName->SetValue( fname );
m_filenameVisible->SetValue( m_sheet->GetShowFileName() );
m_textSheetName->SetValue( m_sheet->GetName() ); m_textSheetName->SetValue( m_sheet->GetName() );
m_sheetnameVisible->SetValue( m_sheet->GetShowSheetName() );
m_filenameTextSize.SetValue( m_sheet->GetFileNameSize() ); m_filenameTextSize.SetValue( m_sheet->GetFileNameSize() );
m_sheetnameTextSize.SetValue( m_sheet->GetSheetNameSize() ); m_sheetnameTextSize.SetValue( m_sheet->GetSheetNameSize() );
m_textCtrlTimeStamp->SetValue( m_sheet->m_Uuid.AsString() );
return true; return true;
} }
@ -118,6 +122,11 @@ bool DIALOG_SCH_SHEET_PROPS::TransferDataFromWindow()
return false; return false;
} }
m_sheet->SetShowFileName( m_filenameVisible->GetValue() );
m_sheet->SetFileNameSize( m_filenameTextSize.GetValue() );
m_sheet->SetShowSheetName( m_sheetnameVisible->GetValue() );
m_sheet->SetSheetNameSize( m_sheetnameTextSize.GetValue() );
return true; return true;
} }

View File

@ -52,8 +52,6 @@ public:
const wxString GetFileName(); const wxString GetFileName();
wxString GetSheetName() { return m_textSheetName->GetValue(); } wxString GetSheetName() { return m_textSheetName->GetValue(); }
int GetFileNameTextSize() { return m_filenameTextSize.GetValue(); }
int GetSheetNameTextSize() { return m_sheetnameTextSize.GetValue(); }
}; };
#endif // __dialog_sch_sheet_props__ #endif // __dialog_sch_sheet_props__

View File

@ -23,100 +23,87 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi
wxBoxSizer* bupperSizer; wxBoxSizer* bupperSizer;
bupperSizer = new wxBoxSizer( wxVERTICAL ); bupperSizer = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizer1; wxBoxSizer* bSizer3;
fgSizer1 = new wxFlexGridSizer( 0, 7, 0, 0 ); bSizer3 = new wxBoxSizer( wxHORIZONTAL );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_filenameLabel = new wxStaticText( this, wxID_ANY, _("&File name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_filenameLabel = new wxStaticText( this, wxID_ANY, _("&File name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameLabel->Wrap( -1 ); m_filenameLabel->Wrap( -1 );
fgSizer1->Add( m_filenameLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer3->Add( m_filenameLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_textFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textFileName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_textFileName->SetMinSize( wxSize( 240,-1 ) ); m_textFileName->SetMinSize( wxSize( 360,-1 ) );
fgSizer1->Add( m_textFileName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 5 ); bSizer3->Add( m_textFileName, 1, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_browseButton = new wxBitmapButton( this, ID_BUTTON_BROWSE_SHEET, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 ); m_browseButton = new wxBitmapButton( this, ID_BUTTON_BROWSE_SHEET, wxNullBitmap, wxDefaultPosition, wxDefaultSize, wxBU_AUTODRAW|0 );
m_browseButton->SetMinSize( wxSize( 30,28 ) ); m_browseButton->SetMinSize( wxSize( 30,28 ) );
fgSizer1->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 2 ); bSizer3->Add( m_browseButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
fgSizer1->Add( 0, 0, 0, wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT, 10 ); bupperSizer->Add( bSizer3, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
m_filenameVisible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_filenameVisible, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 36 );
m_filenameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_filenameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameSizeLabel->Wrap( -1 ); m_filenameSizeLabel->Wrap( -1 );
fgSizer1->Add( m_filenameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer4->Add( m_filenameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_filenameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_filenameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_filenameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); bSizer4->Add( m_filenameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_filenameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_filenameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_filenameSizeUnits->Wrap( -1 ); m_filenameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_filenameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer4->Add( m_filenameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
bupperSizer->Add( bSizer4, 0, wxEXPAND, 5 );
bupperSizer->Add( 0, 15, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxHORIZONTAL );
m_sheetnameLabel = new wxStaticText( this, wxID_ANY, _("&Sheet name:"), wxDefaultPosition, wxDefaultSize, 0 ); m_sheetnameLabel = new wxStaticText( this, wxID_ANY, _("&Sheet name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameLabel->Wrap( -1 ); m_sheetnameLabel->Wrap( -1 );
fgSizer1->Add( m_sheetnameLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer5->Add( m_sheetnameLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_textSheetName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_textSheetName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_textSheetName, 5, wxEXPAND|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); bSizer5->Add( m_textSheetName, 5, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT, 5 );
fgSizer1->Add( 0, 0, 0, wxALIGN_CENTER_VERTICAL|wxALL, 10 ); bupperSizer->Add( bSizer5, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); m_sheetnameVisible = new wxCheckBox( this, wxID_ANY, _("Visible"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer6->Add( m_sheetnameVisible, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 36 );
m_sheetnameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 ); m_sheetnameSizeLabel = new wxStaticText( this, wxID_ANY, _("Text size:"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameSizeLabel->Wrap( -1 ); m_sheetnameSizeLabel->Wrap( -1 );
fgSizer1->Add( m_sheetnameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer6->Add( m_sheetnameSizeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
m_sheetnameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_sheetnameSizeCtrl = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_sheetnameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5 ); bSizer6->Add( m_sheetnameSizeCtrl, 0, wxALIGN_CENTER_VERTICAL, 5 );
m_sheetnameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 ); m_sheetnameSizeUnits = new wxStaticText( this, wxID_ANY, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
m_sheetnameSizeUnits->Wrap( -1 ); m_sheetnameSizeUnits->Wrap( -1 );
fgSizer1->Add( m_sheetnameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 ); bSizer6->Add( m_sheetnameSizeUnits, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 ); bupperSizer->Add( bSizer6, 0, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 ); mainSizer->Add( bupperSizer, 0, wxEXPAND|wxALL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_staticTextTimeStamp = new wxStaticText( this, wxID_ANY, _("Unique timestamp:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextTimeStamp->Wrap( -1 );
fgSizer1->Add( m_staticTextTimeStamp, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_textCtrlTimeStamp = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY );
fgSizer1->Add( m_textCtrlTimeStamp, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
mainSizer->Add( bupperSizer, 0, wxEXPAND|wxTOP, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 ); mainSizer->Add( m_staticline1, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 10 );
m_sdbSizer1 = new wxStdDialogButtonSizer(); m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK ); m_sdbSizer1OK = new wxButton( this, wxID_OK );

View File

@ -60,7 +60,7 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP</property> <property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -69,23 +69,16 @@
<property name="permission">none</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">1</property> <property name="proportion">0</property>
<object class="wxFlexGridSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="cols">7</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">fgSizer1</property> <property name="name">bSizer3</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property> <property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property> <property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -146,8 +139,8 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM</property> <property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -182,7 +175,7 @@
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="min_size"></property> <property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">240,-1</property> <property name="minimum_size">360,-1</property>
<property name="moveable">1</property> <property name="moveable">1</property>
<property name="name">m_textFileName</property> <property name="name">m_textFileName</property>
<property name="pane_border">1</property> <property name="pane_border">1</property>
@ -209,8 +202,8 @@
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">2</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBitmapButton" expanded="1"> <object class="wxBitmapButton" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -281,19 +274,84 @@
<event name="OnButtonClick">OnBrowseClicked</event> <event name="OnButtonClick">OnBrowseClicked</event>
</object> </object>
</object> </object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer4</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">36</property>
<property name="flag">wxALIGN_CENTER_HORIZONTAL|wxRIGHT|wxLEFT</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="height">0</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Visible</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_filenameVisible</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -354,7 +412,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property> <property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -418,7 +476,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -477,6 +535,27 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">15</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer5</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
@ -540,7 +619,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL</property> <property name="flag">wxEXPAND|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
<property name="proportion">5</property> <property name="proportion">5</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -602,29 +681,84 @@
<property name="window_style"></property> <property name="window_style"></property>
</object> </object>
</object> </object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer6</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">10</property> <property name="border">36</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="wxCheckBox" expanded="1">
<property name="height">0</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Visible</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_sheetnameVisible</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="width">0</property> <property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -685,7 +819,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM</property> <property name="flag">wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1"> <object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -749,7 +883,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property> <property name="flag">wxALIGN_CENTER_VERTICAL|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticText" expanded="1"> <object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
@ -808,207 +942,12 @@
<property name="wrap">-1</property> <property name="wrap">-1</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property>
<property name="proportion">0</property>
<object class="wxStaticText" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Unique timestamp:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticTextTimeStamp</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="maxlength"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_textCtrlTimeStamp</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxTE_READONLY</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">10</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxStaticLine" expanded="1"> <object class="wxStaticLine" expanded="1">

View File

@ -24,6 +24,7 @@
#include <wx/icon.h> #include <wx/icon.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/checkbox.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -50,16 +51,16 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM
wxStaticText* m_filenameLabel; wxStaticText* m_filenameLabel;
wxTextCtrl* m_textFileName; wxTextCtrl* m_textFileName;
wxBitmapButton* m_browseButton; wxBitmapButton* m_browseButton;
wxCheckBox* m_filenameVisible;
wxStaticText* m_filenameSizeLabel; wxStaticText* m_filenameSizeLabel;
wxTextCtrl* m_filenameSizeCtrl; wxTextCtrl* m_filenameSizeCtrl;
wxStaticText* m_filenameSizeUnits; wxStaticText* m_filenameSizeUnits;
wxStaticText* m_sheetnameLabel; wxStaticText* m_sheetnameLabel;
wxTextCtrl* m_textSheetName; wxTextCtrl* m_textSheetName;
wxCheckBox* m_sheetnameVisible;
wxStaticText* m_sheetnameSizeLabel; wxStaticText* m_sheetnameSizeLabel;
wxTextCtrl* m_sheetnameSizeCtrl; wxTextCtrl* m_sheetnameSizeCtrl;
wxStaticText* m_sheetnameSizeUnits; wxStaticText* m_sheetnameSizeUnits;
wxStaticText* m_staticTextTimeStamp;
wxTextCtrl* m_textCtrlTimeStamp;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;

View File

@ -726,12 +726,6 @@ private:
*/ */
void UpdateTitle(); void UpdateTitle();
/**
* Perform all cleanup and normalization steps so that the whole schematic
* is in a good state. This should only be called when loading a file.
*/
void NormalizeSchematicOnFirstLoad( bool recalculateConnections );
/** /**
* Verify that \a aSheet will not cause a recursion error in \a aHierarchy. * Verify that \a aSheet will not cause a recursion error in \a aHierarchy.
* *

View File

@ -993,19 +993,27 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
wxString text; wxString text;
int size; int size;
int fieldId = parseInt( aReader, line, &line ); int fieldId = parseInt( aReader, line, &line );
bool visible = true;
if( fieldId == 0 || fieldId == 1 ) // Sheet name and file name. if( fieldId == 0 || fieldId == 1 ) // Sheet name and file name.
{ {
parseQuotedString( text, aReader, line, &line ); parseQuotedString( text, aReader, line, &line );
size = Mils2Iu( parseInt( aReader, line, &line ) ); size = Mils2Iu( parseInt( aReader, line, &line ) );
if( strCompare( "V", line, &line ) )
visible = true;
else if( strCompare( "I", line, &line ) )
visible = false;
if( fieldId == 0 ) if( fieldId == 0 )
{ {
sheet->SetShowSheetName( visible );
sheet->SetName( text ); sheet->SetName( text );
sheet->SetSheetNameSize( size ); sheet->SetSheetNameSize( size );
} }
else else
{ {
sheet->SetShowFileName( visible );
sheet->SetFileName( text ); sheet->SetFileName( text );
sheet->SetFileNameSize( size ); sheet->SetFileNameSize( size );
} }
@ -1027,27 +1035,12 @@ SCH_SHEET* SCH_LEGACY_PLUGIN::loadSheet( LINE_READER& aReader )
switch( parseChar( aReader, line, &line ) ) switch( parseChar( aReader, line, &line ) )
{ {
case 'I': case 'I': sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_INPUT ); break;
sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_INPUT ); case 'O': sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_OUTPUT ); break;
break; case 'B': sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_BIDI ); break;
case 'T': sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_TRISTATE ); break;
case 'O': case 'U': sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_UNSPECIFIED ); break;
sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_OUTPUT ); default: SCH_PARSE_ERROR( "invalid sheet pin type", aReader, line );
break;
case 'B':
sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_BIDI );
break;
case 'T':
sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_TRISTATE );
break;
case 'U':
sheetPin->SetShape( PINSHEETLABEL_SHAPE::PS_UNSPECIFIED );
break;
default:
SCH_PARSE_ERROR( "invalid sheet pin type", aReader, line );
} }
switch( parseChar( aReader, line, &line ) ) switch( parseChar( aReader, line, &line ) )
@ -2171,14 +2164,16 @@ void SCH_LEGACY_PLUGIN::saveSheet( SCH_SHEET* aSheet )
m_out->Print( 0, "U %s\n", TO_UTF8( aSheet->m_Uuid.AsString() ) ); m_out->Print( 0, "U %s\n", TO_UTF8( aSheet->m_Uuid.AsString() ) );
if( !aSheet->GetName().IsEmpty() ) if( !aSheet->GetName().IsEmpty() )
m_out->Print( 0, "F0 %s %d\n", m_out->Print( 0, "F0 %s %d %c\n",
EscapedUTF8( aSheet->GetName() ).c_str(), EscapedUTF8( aSheet->GetName() ).c_str(),
Iu2Mils( aSheet->GetSheetNameSize() ) ); Iu2Mils( aSheet->GetSheetNameSize() ),
aSheet->GetShowSheetName() ? 'V' : 'I' );
if( !aSheet->GetFileName().IsEmpty() ) if( !aSheet->GetFileName().IsEmpty() )
m_out->Print( 0, "F1 %s %d\n", m_out->Print( 0, "F1 %s %d %c\n",
EscapedUTF8( aSheet->GetFileName() ).c_str(), EscapedUTF8( aSheet->GetFileName() ).c_str(),
Iu2Mils( aSheet->GetFileNameSize() ) ); Iu2Mils( aSheet->GetFileNameSize() ),
aSheet->GetShowFileName() ? 'V' : 'I' );
for( const SCH_SHEET_PIN* pin : aSheet->GetPins() ) for( const SCH_SHEET_PIN* pin : aSheet->GetPins() )
{ {

View File

@ -1609,28 +1609,36 @@ void SCH_PAINTER::draw( SCH_SHEET *aSheet, int aLayer )
} }
} }
m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEETNAME, drawingShadows ) ); if( aSheet->GetShowSheetName() )
{
wxString text = wxT( "Sheet: " ) + aSheet->GetName();
auto text = wxT( "Sheet: " ) + aSheet->GetName(); m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEETNAME, drawingShadows ) );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM );
m_gal->SetHorizontalJustify( GR_TEXT_HJUSTIFY_LEFT ); int txtSize = aSheet->GetSheetNameSize();
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_BOTTOM ); m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
m_gal->SetFontBold( false );
m_gal->SetFontItalic( false );
auto txtSize = aSheet->GetSheetNameSize(); strokeText( text, pos_sheetname, nameAngle );
}
m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) ); if( aSheet->GetShowFileName() )
m_gal->SetFontBold( false ); {
m_gal->SetFontItalic( false ); wxString text = wxT( "File: " ) + aSheet->GetFileName();
strokeText( text, pos_sheetname, nameAngle ); m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEETFILENAME, drawingShadows ) );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP );
txtSize = aSheet->GetFileNameSize(); int txtSize = aSheet->GetFileNameSize();
m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) ); m_gal->SetGlyphSize( VECTOR2D( txtSize, txtSize ) );
m_gal->SetStrokeColor( getRenderColor( aSheet, LAYER_SHEETFILENAME, drawingShadows ) ); m_gal->SetFontBold( false );
m_gal->SetVerticalJustify( GR_TEXT_VJUSTIFY_TOP ); m_gal->SetFontItalic( false );
text = wxT( "File: " ) + aSheet->GetFileName(); strokeText( text, pos_filename, nameAngle );
strokeText( text, pos_filename, nameAngle ); }
} }
} }

View File

@ -22,22 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file sch_sheet.cpp
* @brief Implementation of SCH_SHEET class.
*/
#include <fctsys.h> #include <fctsys.h>
#include <sch_draw_panel.h> #include <sch_draw_panel.h>
#include <gr_text.h> #include <gr_text.h>
#include <trigo.h> #include <trigo.h>
#include <richio.h>
#include <sch_edit_frame.h> #include <sch_edit_frame.h>
#include <plotter.h> #include <plotter.h>
#include <kicad_string.h> #include <kicad_string.h>
#include <msgpanel.h> #include <msgpanel.h>
#include <math/util.h> // for KiROUND #include <math/util.h> // for KiROUND
#include <sch_sheet.h> #include <sch_sheet.h>
#include <sch_sheet_path.h> #include <sch_sheet_path.h>
#include <sch_component.h> #include <sch_component.h>
@ -51,7 +44,9 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_pos = pos; m_pos = pos;
m_size = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) ); m_size = wxSize( Mils2iu( MIN_SHEET_WIDTH ), Mils2iu( MIN_SHEET_HEIGHT ) );
m_showSheetName = true;
m_sheetNameSize = GetDefaultTextSize(); m_sheetNameSize = GetDefaultTextSize();
m_showFileName = true;
m_fileNameSize = GetDefaultTextSize(); m_fileNameSize = GetDefaultTextSize();
m_screen = NULL; m_screen = NULL;
m_name.Printf( wxT( "Sheet%s" ), m_Uuid.AsString() ); m_name.Printf( wxT( "Sheet%s" ), m_Uuid.AsString() );
@ -66,7 +61,9 @@ SCH_SHEET::SCH_SHEET( const SCH_SHEET& aSheet ) :
m_size = aSheet.m_size; m_size = aSheet.m_size;
m_Layer = aSheet.m_Layer; m_Layer = aSheet.m_Layer;
const_cast<UUID&>( m_Uuid ) = aSheet.m_Uuid; const_cast<UUID&>( m_Uuid ) = aSheet.m_Uuid;
m_showSheetName = aSheet.m_showSheetName;
m_sheetNameSize = aSheet.m_sheetNameSize; m_sheetNameSize = aSheet.m_sheetNameSize;
m_showFileName = aSheet.m_showFileName;
m_fileNameSize = aSheet.m_fileNameSize; m_fileNameSize = aSheet.m_fileNameSize;
m_screen = aSheet.m_screen; m_screen = aSheet.m_screen;
m_name = aSheet.m_name; m_name = aSheet.m_name;
@ -162,7 +159,9 @@ void SCH_SHEET::SwapData( SCH_ITEM* aItem )
std::swap( m_pos, sheet->m_pos ); std::swap( m_pos, sheet->m_pos );
std::swap( m_size, sheet->m_size ); std::swap( m_size, sheet->m_size );
std::swap( m_name, sheet->m_name ); std::swap( m_name, sheet->m_name );
std::swap( m_showSheetName, sheet->m_showSheetName );
std::swap( m_sheetNameSize, sheet->m_sheetNameSize ); std::swap( m_sheetNameSize, sheet->m_sheetNameSize );
std::swap( m_showFileName, sheet->m_showFileName );
std::swap( m_fileNameSize, sheet->m_fileNameSize ); std::swap( m_fileNameSize, sheet->m_fileNameSize );
m_pins.swap( sheet->m_pins ); m_pins.swap( sheet->m_pins );
@ -466,18 +465,24 @@ void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
name_orientation = TEXT_ANGLE_HORIZ; name_orientation = TEXT_ANGLE_HORIZ;
/* Draw text : SheetName */ /* Draw text : SheetName */
Text = wxT( "Sheet: " ) + m_name; if( m_showSheetName )
textSize = wxSize( m_sheetNameSize, m_sheetNameSize ); {
textWidth = Clamp_Text_PenSize( lineWidth, textSize, false ); Text = wxT( "Sheet: " ) + m_name;
GRText( aDC, pos_sheetname, GetLayerColor( LAYER_SHEETNAME ), Text, name_orientation, textSize = wxSize( m_sheetNameSize, m_sheetNameSize );
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, textWidth, false, false ); textWidth = Clamp_Text_PenSize( lineWidth, textSize, false );
GRText( aDC, pos_sheetname, GetLayerColor( LAYER_SHEETNAME ), Text, name_orientation,
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, textWidth, false, false );
}
/* Draw text : FileName */ /* Draw text : FileName */
Text = wxT( "File: " ) + m_fileName; if( m_showFileName )
textSize = wxSize( m_fileNameSize, m_fileNameSize ); {
textWidth = Clamp_Text_PenSize( lineWidth, textSize, false ); Text = wxT( "File: " ) + m_fileName;
GRText( aDC, pos_filename, GetLayerColor( LAYER_SHEETFILENAME ), Text, name_orientation, textSize = wxSize( m_fileNameSize, m_fileNameSize );
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, textWidth, false, false ); textWidth = Clamp_Text_PenSize( lineWidth, textSize, false );
GRText( aDC, pos_filename, GetLayerColor( LAYER_SHEETFILENAME ), Text, name_orientation,
textSize, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, textWidth, false, false );
}
/* Draw text : SheetLabel */ /* Draw text : SheetLabel */
for( SCH_SHEET_PIN* sheetPin : m_pins ) for( SCH_SHEET_PIN* sheetPin : m_pins )
@ -487,22 +492,30 @@ void SCH_SHEET::Print( wxDC* aDC, const wxPoint& aOffset )
const EDA_RECT SCH_SHEET::GetBoundingBox() const const EDA_RECT SCH_SHEET::GetBoundingBox() const
{ {
wxPoint end; wxPoint end;
EDA_RECT box( m_pos, m_size ); EDA_RECT box( m_pos, m_size );
int lineWidth = GetPenSize(); int lineWidth = GetPenSize();
int textLength = 0;
// Determine length of texts // Determine length of texts
wxString text = wxT( "Sheet: " ) + m_name; if( m_showSheetName )
int textlen = GraphicTextWidth( text, wxSize( m_sheetNameSize, m_sheetNameSize ), {
false, false ); wxString text = wxT( "Sheet: " ) + m_name;
int textlen = GraphicTextWidth( text, wxSize( m_sheetNameSize, m_sheetNameSize ),
false, false );
textLength = std::max( textLength, textlen );
}
text = wxT( "File: " ) + m_fileName; if( m_showFileName )
int textlen2 = GraphicTextWidth( text, wxSize( m_fileNameSize, m_fileNameSize ), {
false, false ); wxString text = wxT( "File: " ) + m_fileName;
int textlen = GraphicTextWidth( text, wxSize( m_fileNameSize, m_fileNameSize ),
false, false );
textLength = std::max( textLength, textlen );
}
// Calculate bounding box X size: // Calculate bounding box X size:
textlen = std::max( textlen, textlen2 ); end.x = std::max( m_size.x, textLength );
end.x = std::max( m_size.x, textlen );
// Calculate bounding box pos: // Calculate bounding box pos:
end.y = m_size.y; end.y = m_size.y;
@ -636,9 +649,7 @@ void SCH_SHEET::GetMsgPanelInfo( EDA_UNITS aUnits, MSG_PANEL_ITEMS& aList )
aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) ); aList.push_back( MSG_PANEL_ITEM( _( "File Name" ), m_fileName, BROWN ) );
#if 0 // Set to 1 to display the sheet time stamp (mainly for test) #if 0 // Set to 1 to display the sheet time stamp (mainly for test)
wxString msg; aList.push_back( MSG_PANEL_ITEM( _( "UUID" ), m_Uuid.AsString(), BLUE ) );
msg.Printf( wxT( "%.8X" ), m_TimeStamp );
aList.push_back( MSG_PANEL_ITEM( _( "Time Stamp" ), msg, BLUE ) );
#endif #endif
} }
@ -904,32 +915,39 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
name_orientation = TEXT_ANGLE_HORIZ; name_orientation = TEXT_ANGLE_HORIZ;
} }
/* Draw texts: SheetName */
Text = m_name;
size = wxSize( m_sheetNameSize, m_sheetNameSize );
//pos = m_pos; pos.y -= 4;
thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
bool italic = false; bool italic = false;
aPlotter->Text( pos_sheetname, txtcolor, wxT( "Sheet: " ) + Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, /* Draw texts: SheetName */
thickness, italic, false ); if( m_showSheetName )
{
Text = m_name;
size = wxSize( m_sheetNameSize, m_sheetNameSize );
//pos = m_pos; pos.y -= 4;
thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( GetLayerColor( LAYER_SHEETNAME ) );
aPlotter->Text( pos_sheetname, txtcolor, wxT( "Sheet: " ) + Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM,
thickness, false, false );
}
/*Draw texts : FileName */ /*Draw texts : FileName */
Text = GetFileName(); if( m_showFileName )
size = wxSize( m_fileNameSize, m_fileNameSize ); {
thickness = GetDefaultLineThickness(); Text = GetFileName();
thickness = Clamp_Text_PenSize( thickness, size, false ); size = wxSize( m_fileNameSize, m_fileNameSize );
thickness = GetDefaultLineThickness();
thickness = Clamp_Text_PenSize( thickness, size, false );
aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) ); aPlotter->SetColor( GetLayerColor( LAYER_SHEETFILENAME ) );
aPlotter->Text( pos_filename, txtcolor, wxT( "File: " ) + Text, name_orientation, size, aPlotter->Text( pos_filename, txtcolor, wxT( "File: " ) + Text, name_orientation, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP,
thickness, italic, false ); thickness, italic, false );
}
aPlotter->SetColor( GetLayerColor( GetLayer() ) ); aPlotter->SetColor( GetLayerColor( GetLayer() ) );

View File

@ -219,22 +219,17 @@ class SCH_SHEET : public SCH_ITEM
/// The file name is also in the #SCH_SCREEN object associated with the sheet. It is /// The file name is also in the #SCH_SCREEN object associated with the sheet. It is
/// also needed here for loading after reading the sheet description from file. /// also needed here for loading after reading the sheet description from file.
wxString m_fileName; wxString m_fileName;
bool m_showFileName; // Indicates filename should be drawn on schematic.
int m_fileNameSize; // The height of the text used to draw the file name.
/// This is equivalent to the reference designator for components and is stored in F0 /// This is equivalent to the reference designator for components and is stored in F0
/// sheet pin in the schematic file. /// sheet pin in the schematic file.
wxString m_name; wxString m_name;
bool m_showSheetName; // Indicates sheet name should be drawn on schematic.
int m_sheetNameSize; // The height of the text used to draw the sheet name.
/// The height of the text used to draw the sheet name. wxPoint m_pos; // The position of the sheet.
int m_sheetNameSize; wxSize m_size; // The size of the sheet.
/// The height of the text used to draw the file name.
int m_fileNameSize;
/// The position of the sheet.
wxPoint m_pos;
/// The size of the sheet.
wxSize m_size;
public: public:
SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_SHEET( const wxPoint& pos = wxPoint( 0, 0 ) );
@ -271,9 +266,15 @@ public:
wxString GetName() const { return m_name; } wxString GetName() const { return m_name; }
void SetName( const wxString& aName ) { m_name = aName; } void SetName( const wxString& aName ) { m_name = aName; }
bool GetShowSheetName() const { return m_showSheetName; }
void SetShowSheetName( bool show ) { m_showSheetName = show; }
int GetSheetNameSize() const { return m_sheetNameSize; } int GetSheetNameSize() const { return m_sheetNameSize; }
void SetSheetNameSize( int aSize ) { m_sheetNameSize = aSize; } void SetSheetNameSize( int aSize ) { m_sheetNameSize = aSize; }
bool GetShowFileName() const { return m_showFileName; }
void SetShowFileName( bool show ) { m_showFileName = show; }
int GetFileNameSize() const { return m_fileNameSize; } int GetFileNameSize() const { return m_fileNameSize; }
void SetFileNameSize( int aSize ) { m_fileNameSize = aSize; } void SetFileNameSize( int aSize ) { m_fileNameSize = aSize; }

View File

@ -600,9 +600,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
// and can be not always undoable. // and can be not always undoable.
// So prepare messages for user notifications: // So prepare messages for user notifications:
replaceMsg.Printf( _( "Change \"%s\" link from \"%s\" to \"%s\"?" ), replaceMsg.Printf( _( "Change \"%s\" link from \"%s\" to \"%s\"?" ),
dlg.GetSheetName(), aSheet->GetFileName(), fileName.GetFullName() ); dlg.GetSheetName(),
aSheet->GetFileName(),
fileName.GetFullName() );
newMsg.Printf( _( "Create new file \"%s\" with contents of \"%s\"?" ), newMsg.Printf( _( "Create new file \"%s\" with contents of \"%s\"?" ),
fileName.GetFullName(), aSheet->GetFileName() ); fileName.GetFullName(),
aSheet->GetFileName() );
noUndoMsg = _( "This action cannot be undone." ); noUndoMsg = _( "This action cannot be undone." );
// We are always using here a case insensitive comparison // We are always using here a case insensitive comparison
@ -741,9 +744,7 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
tmpFn.Replace( "\\", "/" ); tmpFn.Replace( "\\", "/" );
aSheet->SetFileName( tmpFn ); aSheet->SetFileName( tmpFn );
aSheet->SetFileNameSize( dlg.GetFileNameTextSize() );
aSheet->SetName( dlg.GetSheetName() ); aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( dlg.GetSheetNameTextSize() );
if( aSheet->GetName().IsEmpty() ) if( aSheet->GetName().IsEmpty() )
aSheet->SetName( wxString::Format( wxT( "Sheet%s" ), aSheet->m_Uuid.AsString() ) ); aSheet->SetName( wxString::Format( wxT( "Sheet%s" ), aSheet->m_Uuid.AsString() ) );