Fixed: problem which could crash eeschema when a schematic file in a hierarchy was not found
This commit is contained in:
parent
879e1b5b72
commit
29ed370a27
|
@ -121,6 +121,7 @@ bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
|
|||
m_FileNameSize = NULL;
|
||||
m_SheetNameTextSize = NULL;
|
||||
m_SheetNameSize = NULL;
|
||||
|
||||
////@end WinEDA_SheetPropertiesFrame member initialisation
|
||||
|
||||
////@begin WinEDA_SheetPropertiesFrame creation
|
||||
|
@ -133,6 +134,7 @@ bool WinEDA_SheetPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
|
|||
GetSizer()->SetSizeHints( this );
|
||||
}
|
||||
Centre();
|
||||
|
||||
////@end WinEDA_SheetPropertiesFrame creation
|
||||
return true;
|
||||
}
|
||||
|
@ -160,31 +162,53 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
|
|||
wxBoxSizer* itemBoxSizer4 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer3->Add( itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _("Filename:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add(itemStaticText5, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
wxStaticText* itemStaticText5 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Filename:" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add( itemStaticText5,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_FileNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T(""), wxDefaultPosition, wxSize(300, -1), wxTE_PROCESS_ENTER );
|
||||
m_FileNameWin =
|
||||
new wxTextCtrl( itemDialog1, ID_TEXTCTRL1, _T( "" ), wxDefaultPosition, wxSize( 300,
|
||||
-1 ), wxTE_PROCESS_ENTER );
|
||||
itemBoxSizer4->Add( m_FileNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _("Sheetname:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add(itemStaticText7, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
wxStaticText* itemStaticText7 = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Sheetname:" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer4->Add( itemStaticText7,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_SheetNameWin = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(300, -1), 0 );
|
||||
m_SheetNameWin =
|
||||
new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T( "" ), wxDefaultPosition, wxSize( 300,
|
||||
-1 ), 0 );
|
||||
itemBoxSizer4->Add( m_SheetNameWin, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
wxBoxSizer* itemBoxSizer9 = new wxBoxSizer( wxVERTICAL );
|
||||
itemBoxSizer3->Add( itemBoxSizer9, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add(m_FileNameTextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
m_FileNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_FileNameTextSize,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_FileNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL2, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_FileNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add(m_SheetNameTextSize, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5);
|
||||
m_SheetNameTextSize = new wxStaticText( itemDialog1, wxID_STATIC, _(
|
||||
"Size" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_SheetNameTextSize,
|
||||
0,
|
||||
wxALIGN_LEFT | wxLEFT | wxRIGHT | wxTOP | wxADJUST_MINSIZE,
|
||||
5 );
|
||||
|
||||
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(""), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_SheetNameSize = new wxTextCtrl( itemDialog1, ID_TEXTCTRL3, _T(
|
||||
"" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemBoxSizer9->Add( m_SheetNameSize, 0, wxALIGN_LEFT | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
|
||||
itemBoxSizer2->Add( 5, 5, 1, wxGROW | wxALL, 5 );
|
||||
|
@ -192,16 +216,19 @@ void WinEDA_SheetPropertiesFrame::CreateControls()
|
|||
wxBoxSizer* itemBoxSizer15 = new wxBoxSizer( wxHORIZONTAL );
|
||||
itemBoxSizer2->Add( itemBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton* itemButton16 = new wxButton( itemDialog1, wxID_CANCEL, _(
|
||||
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton16->SetForegroundColour( wxColour( 0, 0, 255 ) );
|
||||
itemBoxSizer15->Add( itemButton16, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxButton* itemButton17 = new wxButton( itemDialog1, wxID_OK, _(
|
||||
"&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
itemButton17->SetForegroundColour( wxColour( 196, 0, 0 ) );
|
||||
itemBoxSizer15->Add( itemButton17, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
|
||||
|
||||
// Set validators
|
||||
m_SheetNameWin->SetValidator( wxTextValidator( wxFILTER_NONE, &m_CurrentSheet->m_SheetName ) );
|
||||
|
||||
////@end WinEDA_SheetPropertiesFrame content construction
|
||||
|
||||
m_FileNameWin->SetValue( m_CurrentSheet->GetFileName() );
|
||||
|
@ -228,6 +255,7 @@ wxBitmap WinEDA_SheetPropertiesFrame::GetBitmapResource( const wxString& name )
|
|||
////@begin WinEDA_SheetPropertiesFrame bitmap retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullBitmap;
|
||||
|
||||
////@end WinEDA_SheetPropertiesFrame bitmap retrieval
|
||||
}
|
||||
|
||||
|
@ -242,6 +270,7 @@ wxIcon WinEDA_SheetPropertiesFrame::GetIconResource( const wxString& name )
|
|||
////@begin WinEDA_SheetPropertiesFrame icon retrieval
|
||||
wxUnusedVar( name );
|
||||
return wxNullIcon;
|
||||
|
||||
////@end WinEDA_SheetPropertiesFrame icon retrieval
|
||||
}
|
||||
|
||||
|
@ -264,7 +293,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
|
|||
|
||||
ChangeFileNameExt( FileName, g_SchExtBuffer );
|
||||
|
||||
if( m_CurrentSheet->GetFileName() != FileName )
|
||||
if( (m_CurrentSheet->GetFileName() != FileName)
|
||||
|| (m_CurrentSheet->m_Flags & IS_NEW)
|
||||
|| !m_CurrentSheet->m_AssociatedScreen )
|
||||
{
|
||||
m_CurrentSheet->SetFileName( FileName );
|
||||
|
||||
|
@ -362,7 +393,7 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
|
|||
s_SheetMindy = SHEET_MIN_HEIGHT;
|
||||
|
||||
//need to check if this is being added to the EEDrawList.
|
||||
//also need to update the heirarchy, if we are adding
|
||||
//also need to update the hierarchy, if we are adding
|
||||
// a sheet to a screen that already has multiple instances (!)
|
||||
GetScreen()->SetCurItem( Sheet );
|
||||
|
||||
|
|
Loading…
Reference in New Issue