From 320d01f622cb503a2800251a19fb247465ea98cc Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Tue, 19 Apr 2011 18:30:28 +0200 Subject: [PATCH] fix bug 765355 --- .../dialog_edit_component_in_schematic.cpp | 27 +- .../dialog_edit_libentry_fields_in_lib.cpp | 8 +- eeschema/dialogs/dialog_lib_edit_text.cpp | 9 +- .../dialogs/dialog_lib_edit_text_base.cpp | 24 +- .../dialogs/dialog_lib_edit_text_base.fbp | 345 +++++++++++++++++- eeschema/dialogs/dialog_lib_edit_text_base.h | 10 +- 6 files changed, 378 insertions(+), 45 deletions(-) diff --git a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp index 95b38df561..7018f73313 100644 --- a/eeschema/dialogs/dialog_edit_component_in_schematic.cpp +++ b/eeschema/dialogs/dialog_edit_component_in_schematic.cpp @@ -22,8 +22,6 @@ int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow; - - wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize; @@ -36,37 +34,38 @@ void InstallCmpeditFrame( SCH_EDIT_FRAME* aParent, SCH_COMPONENT* aComponent ) if( aComponent->Type() != SCH_COMPONENT_T ) { - DisplayError( aParent, - wxT( "InstallCmpeditFrame() error: This item is not a component" ) ); + wxMessageBox( wxT( "InstallCmpeditFrame() error: This item is not a component" ) ); return; } - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dialog( aParent ); + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC * dlg = + new DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( aParent ); - dialog.InitBuffers( aComponent ); + dlg->InitBuffers( aComponent ); - wxSize sizeNow = dialog.GetSize(); + wxSize sizeNow = dlg->GetSize(); // this relies on wxDefaultSize being -1,-1, be careful here. if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth() || sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() ) { - dialog.SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize ); + dlg->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize ); } // make sure the chipnameTextCtrl is wide enough to hold any // unusually long chip names: - EnsureTextCtrlWidth( dialog.chipnameTextCtrl ); + EnsureTextCtrlWidth( dlg->chipnameTextCtrl ); - dialog.ShowModal(); + dlg->ShowModal(); // Some of the field values are long and are not always fully visible because the // window comes up too narrow. Remember user's manual window resizing efforts here // so it comes up wide enough next time. - DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dialog.GetSize(); + DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize(); aParent->DrawPanel->MoveCursorToCrossHair(); aParent->DrawPanel->m_IgnoreMouseEvents = false; + dlg->Destroy(); } @@ -153,15 +152,15 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions() newname.Replace( wxT( " " ), wxT( "_" ) ); if( newname.IsEmpty() ) - DisplayError( this, _( "No Component Name!" ) ); + DisplayError( NULL, _( "No Component Name!" ) ); else if( newname.CmpNoCase( m_Cmp->m_ChipName ) ) { if( CMP_LIBRARY::FindLibraryEntry( newname ) == NULL ) { wxString message; - message.Printf( _( "Component [%s] not found!" ), newname.GetData() ); - DisplayError( this, message ); + message.Printf( _( "Component [%s] not found!" ), GetChars( newname ) ); + DisplayError( NULL, message ); } else // Change component from lib! { diff --git a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp index 639bce5a62..6a359c27c7 100644 --- a/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp +++ b/eeschema/dialogs/dialog_edit_libentry_fields_in_lib.cpp @@ -135,6 +135,9 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( { m_Parent = aParent; m_LibEntry = aLibEntry; + + GetSizer()->SetSizeHints( this ); + Centre(); } @@ -176,11 +179,6 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog( wxInitDialogEvent& event InitBuffers(); copySelectedFieldToPanel(); - if( GetSizer() ) - { - GetSizer()->SetSizeHints( this ); - } - stdDialogButtonSizerOK->SetDefault(); } diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index f8555b83ee..9fbc0ea901 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -102,12 +102,11 @@ void DIALOG_LIB_EDIT_TEXT::InitDialog( ) msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol(); m_TextSizeText->SetLabel( msg ); - if (GetSizer()) - { - GetSizer()->SetSizeHints(this); - } + GetSizer()->SetSizeHints(this); - m_sdbSizer1OK->SetDefault(); + Centre(); + + m_sdbSizerButtonsOK->SetDefault(); } diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.cpp b/eeschema/dialogs/dialog_lib_edit_text_base.cpp index 34b28694f4..e412e96a40 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -97,27 +97,27 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow bMainSizer->Add( bPropertiesSizer, 1, wxEXPAND|wxLEFT|wxRIGHT|wxTOP, 6 ); - m_sdbSizer1 = new wxStdDialogButtonSizer(); - m_sdbSizer1OK = new wxButton( this, wxID_OK ); - m_sdbSizer1->AddButton( m_sdbSizer1OK ); - m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL ); - m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); - m_sdbSizer1->Realize(); - bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); + m_sdbSizerButtons = new wxStdDialogButtonSizer(); + m_sdbSizerButtonsOK = new wxButton( this, wxID_OK ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsOK ); + m_sdbSizerButtonsCancel = new wxButton( this, wxID_CANCEL ); + m_sdbSizerButtons->AddButton( m_sdbSizerButtonsCancel ); + m_sdbSizerButtons->Realize(); + bMainSizer->Add( m_sdbSizerButtons, 0, wxALL|wxEXPAND, 12 ); this->SetSizer( bMainSizer ); this->Layout(); bMainSizer->Fit( this ); // Connect Events - m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this ); + m_sdbSizerButtonsCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerButtonsOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this ); } DIALOG_LIB_EDIT_TEXT_BASE::~DIALOG_LIB_EDIT_TEXT_BASE() { // Disconnect Events - m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this ); - m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this ); + m_sdbSizerButtonsCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnCancelClick ), NULL, this ); + m_sdbSizerButtonsOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_LIB_EDIT_TEXT_BASE::OnOkClick ), NULL, this ); } diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.fbp b/eeschema/dialogs/dialog_lib_edit_text_base.fbp index 71aefbe7d6..f89979b0dc 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.fbp +++ b/eeschema/dialogs/dialog_lib_edit_text_base.fbp @@ -22,25 +22,54 @@ 1 0 + 1 + 1 + 1 + 1 + 0 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 impl_virtual + 1 + 0 0 wxID_ANY + + 0 + 0 + 1 DIALOG_LIB_EDIT_TEXT_BASE + 1 + + + 1 + + Resizable + + 1 -1,-1 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER Library Text Properties + 0 wxFILTER_NONE @@ -93,11 +122,11 @@ bPropertiesSizer wxVERTICAL none - + 5 wxEXPAND 0 - + bUpperBoxSizer wxHORIZONTAL @@ -116,23 +145,51 @@ wxTOP|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Text: + + 0 + 0 + 1 m_staticText1 + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -172,23 +229,51 @@ wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND 1 + 1 + 1 + 1 + 1 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY + + 0 0 + 0 200,-1 + 1 m_TextValue + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -243,23 +328,51 @@ wxTOP|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Size + + 0 + 0 + 1 m_TextSizeText + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -299,23 +412,51 @@ wxBOTTOM|wxRIGHT|wxLEFT 0 + 1 + 1 + 1 + 1 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY + + 0 0 + 0 + 1 m_TextSize + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -371,7 +512,7 @@ 5 wxALL|wxEXPAND 0 - + wxID_ANY Text Options : @@ -384,24 +525,52 @@ wxALL 0 + 1 + 1 + 1 + 1 + + + 1 + 0 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Vertical + + 0 + 0 + 1 m_Orient + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -441,22 +610,50 @@ wxEXPAND | wxALL 0 + 1 + 1 + 1 + 1 + + + 1 + 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY + + 0 + 0 + 1 m_staticline1 + 1 + + protected + 1 + + Resizable + + 1 wxLI_HORIZONTAL + 0 wxFILTER_NONE @@ -495,24 +692,52 @@ wxALL 0 + 1 + 1 + 1 + 1 + + + 1 + 0 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Common to Units + + 0 + 0 + 1 m_CommonUnit + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -552,24 +777,52 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + 1 + 0 0 + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Common to convert + + 0 + 0 + 1 m_CommonConvert + 1 + + protected + 1 + + Resizable + + 1 + 0 wxFILTER_NONE @@ -611,26 +864,54 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + 1 + 0 "Normal" "Italic" "Bold" "Bold Italic" + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Text Shape: + 1 + 0 + 0 + 1 m_TextShapeOpt + 1 + + protected + 1 + + Resizable + 0 + 1 wxRA_SPECIFY_COLS + 0 wxFILTER_NONE @@ -670,26 +951,54 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + 1 + 0 "Align left" "Align center" "Align right" + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Horiz. Justify + 1 + 0 + 0 + 1 m_TextHJustificationOpt + 1 + + protected + 1 + + Resizable + 1 + 1 wxRA_SPECIFY_COLS + 0 wxFILTER_NONE @@ -729,26 +1038,54 @@ wxALL|wxEXPAND 0 + 1 + 1 + 1 + 1 + + + 1 + 0 "Align bottom" "Align center" "Align top" + 1 1 + 0 + Dock + 0 + Left 1 + 1 + 0 0 wxID_ANY Vert. Justify + 1 + 0 + 0 + 1 m_TextVJustificationOpt + 1 + + protected + 1 + + Resizable + 1 + 1 wxRA_SPECIFY_COLS + 0 wxFILTER_NONE @@ -812,7 +1149,7 @@ 0 0 - m_sdbSizer1 + m_sdbSizerButtons protected OnCancelClick diff --git a/eeschema/dialogs/dialog_lib_edit_text_base.h b/eeschema/dialogs/dialog_lib_edit_text_base.h index 6f1cd7b654..493ee1bc28 100644 --- a/eeschema/dialogs/dialog_lib_edit_text_base.h +++ b/eeschema/dialogs/dialog_lib_edit_text_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Sep 8 2010) +// C++ code generated with wxFormBuilder (version Nov 17 2010) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -46,9 +46,9 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog wxRadioBox* m_TextShapeOpt; wxRadioBox* m_TextHJustificationOpt; wxRadioBox* m_TextVJustificationOpt; - wxStdDialogButtonSizer* m_sdbSizer1; - wxButton* m_sdbSizer1OK; - wxButton* m_sdbSizer1Cancel; + wxStdDialogButtonSizer* m_sdbSizerButtons; + wxButton* m_sdbSizerButtonsOK; + wxButton* m_sdbSizerButtonsCancel; // Virtual event handlers, overide them in your derived class virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); } @@ -57,7 +57,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog public: - DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Library Text Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_LIB_EDIT_TEXT_BASE(); };