From 2ab98f76c1febda5d32ec760eaf84fa2cf2b3ffb Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Wed, 19 Nov 2014 15:22:47 +0100 Subject: [PATCH] Try to fix an issue on Ubuntu/Unity for some dialogs which are not displayed. For most, adding GetSizer()->Fit( this ) in dialog constructor fix the issue, but at least one dialog still is not displayed. --- common/dialogs/dialog_list_selector_base.cpp | 5 +-- common/dialogs/dialog_list_selector_base.fbp | 6 +-- common/dialogs/dialog_list_selector_base.h | 4 +- common/displlst.cpp | 37 ++++++++++++------- eeschema/dialogs/dialog_bom.cpp | 2 +- eeschema/dialogs/dialog_bom_base.cpp | 2 +- eeschema/dialogs/dialog_bom_base.fbp | 4 +- eeschema/dialogs/dialog_bom_base.h | 2 +- eeschema/dialogs/dialog_choose_component.cpp | 17 +++++---- eeschema/dialogs/dialog_choose_component.h | 4 +- eeschema/dialogs/dialog_sch_sheet_props.cpp | 2 + eeschema/dialogs/dialog_sch_sheet_props.fbp | 10 ++--- .../dialogs/dialog_sch_sheet_props_base.cpp | 8 ++-- .../dialogs/dialog_sch_sheet_props_base.h | 4 +- include/dialog_helpers.h | 4 +- 15 files changed, 65 insertions(+), 46 deletions(-) diff --git a/common/dialogs/dialog_list_selector_base.cpp b/common/dialogs/dialog_list_selector_base.cpp index d8598769b2..d38d417487 100644 --- a/common/dialogs/dialog_list_selector_base.cpp +++ b/common/dialogs/dialog_list_selector_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 5 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,7 +11,7 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( 400,400 ), wxDefaultSize ); wxBoxSizer* bSizerMain; bSizerMain = new wxBoxSizer( wxVERTICAL ); @@ -55,7 +55,6 @@ EDA_LIST_DIALOG_BASE::EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id, con this->SetSizer( bSizerMain ); this->Layout(); - bSizerMain->Fit( this ); this->Centre( wxBOTH ); diff --git a/common/dialogs/dialog_list_selector_base.fbp b/common/dialogs/dialog_list_selector_base.fbp index 7e13578477..1d1d0e229e 100644 --- a/common/dialogs/dialog_list_selector_base.fbp +++ b/common/dialogs/dialog_list_selector_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -41,10 +41,10 @@ 0 wxID_ANY - + 400,400 EDA_LIST_DIALOG_BASE - -1,-1 + 400,400 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h diff --git a/common/dialogs/dialog_list_selector_base.h b/common/dialogs/dialog_list_selector_base.h index 162e43785d..c274c2c9b4 100644 --- a/common/dialogs/dialog_list_selector_base.h +++ b/common/dialogs/dialog_list_selector_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 5 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -58,7 +58,7 @@ class EDA_LIST_DIALOG_BASE : public DIALOG_SHIM public: - EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + EDA_LIST_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 400,400 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~EDA_LIST_DIALOG_BASE(); }; diff --git a/common/displlst.cpp b/common/displlst.cpp index e41081de63..0201ce345f 100644 --- a/common/displlst.cpp +++ b/common/displlst.cpp @@ -47,6 +47,27 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl m_cb_data = aCallBackFunctionData; m_itemsListCp = &aItemList; + initDialog( aItemHeaders, aSelection ); + + // DIALOG_SHIM needs a unique hash_key because classname is not sufficient + // because so many dialogs share this same class, with different numbers of + // columns, different column names, and column widths. + m_hash_key = TO_UTF8( aTitle ); + + m_filterBox->SetFocus(); + + // this line fixes an issue on Linux Ubuntu using Unity (dialog not shown), + // and works fine on all systems + GetSizer()->Fit( this ); + + Centre(); +} + + +void EDA_LIST_DIALOG::initDialog( const wxArrayString& aItemHeaders, + const wxString& aSelection) +{ + for( unsigned i = 0; i < aItemHeaders.Count(); i++ ) { wxListItem column; @@ -57,7 +78,7 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl m_listBox->InsertColumn( i, column ); } - InsertItems( aItemList, 0 ); + InsertItems( *m_itemsListCp, 0 ); if( m_cb_func == NULL ) { @@ -112,14 +133,11 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl } #endif - Fit(); - Centre(); - if( !!aSelection ) { - for( unsigned row = 0; row < aItemList.size(); ++row ) + for( unsigned row = 0; row < m_itemsListCp->size(); ++row ) { - if( aItemList[row][0] == aSelection ) + if( (*m_itemsListCp)[row][0] == aSelection ) { m_listBox->SetItemState( row, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED ); m_listBox->EnsureVisible( row ); @@ -127,13 +145,6 @@ EDA_LIST_DIALOG::EDA_LIST_DIALOG( EDA_DRAW_FRAME* aParent, const wxString& aTitl } } } - - // DIALOG_SHIM needs a unique hash_key because classname is not sufficient - // because so many dialogs share this same class, with different numbers of - // columns, different column names, and column widths. - m_hash_key = TO_UTF8( aTitle ); - - m_filterBox->SetFocus(); } diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index dbfbab4e60..6a3bbe66dd 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -199,7 +199,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) : m_config = Kiface().KifaceSettings(); installPluginsList(); - GetSizer()->SetSizeHints( this ); + GetSizer()->Fit( this ); Centre(); } diff --git a/eeschema/dialogs/dialog_bom_base.cpp b/eeschema/dialogs/dialog_bom_base.cpp index 03151f1232..e8888467a5 100644 --- a/eeschema/dialogs/dialog_bom_base.cpp +++ b/eeschema/dialogs/dialog_bom_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/eeschema/dialogs/dialog_bom_base.fbp b/eeschema/dialogs/dialog_bom_base.fbp index 2174dc853f..49b6273625 100644 --- a/eeschema/dialogs/dialog_bom_base.fbp +++ b/eeschema/dialogs/dialog_bom_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 1 0 diff --git a/eeschema/dialogs/dialog_bom_base.h b/eeschema/dialogs/dialog_bom_base.h index 7d4579e81b..2ba54c81f9 100644 --- a/eeschema/dialogs/dialog_bom_base.h +++ b/eeschema/dialogs/dialog_bom_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index f491e4f9cd..9229944388 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -24,7 +24,6 @@ #include #include -#include #include #include @@ -36,15 +35,14 @@ static wxTreeItemId GetPrevItem( const wxTreeCtrl& tree, const wxTreeItemId& ite static wxTreeItemId GetNextItem( const wxTreeCtrl& tree, const wxTreeItemId& item ); DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, - COMPONENT_TREE_SEARCH_CONTAINER* aContainer, + COMPONENT_TREE_SEARCH_CONTAINER* const aContainer, int aDeMorganConvert ) - : DIALOG_CHOOSE_COMPONENT_BASE( aParent, wxID_ANY, aTitle ), - m_search_container( aContainer ), - m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ), - m_external_browser_requested( false ), - m_received_doubleclick_in_tree( false ) + : DIALOG_CHOOSE_COMPONENT_BASE( aParent, wxID_ANY, aTitle ), m_search_container( aContainer ) { m_parent = aParent; + m_deMorganConvert = aDeMorganConvert >= 0 ? aDeMorganConvert : 0; + m_external_browser_requested = false; + m_received_doubleclick_in_tree = false; m_search_container->SetTree( m_libraryComponentTree ); m_searchBox->SetFocus(); m_componentDetails->SetEditable( false ); @@ -59,6 +57,11 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxFont font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); m_libraryComponentTree->SetFont( wxFont( font.GetPointSize(), wxFONTFAMILY_MODERN, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL ) ); + + // this line fixes an issue on Linux Ubuntu using Unity (dialog not shown), + // and works fine on all systems + GetSizer()->Fit( this ); + Centre(); } diff --git a/eeschema/dialogs/dialog_choose_component.h b/eeschema/dialogs/dialog_choose_component.h index 2cd5af4f32..8d8ac24edb 100644 --- a/eeschema/dialogs/dialog_choose_component.h +++ b/eeschema/dialogs/dialog_choose_component.h @@ -36,7 +36,7 @@ class DIALOG_CHOOSE_COMPONENT : public DIALOG_CHOOSE_COMPONENT_BASE { SCH_BASE_FRAME* m_parent; COMPONENT_TREE_SEARCH_CONTAINER* const m_search_container; - const int m_deMorganConvert; + int m_deMorganConvert; bool m_external_browser_requested; bool m_received_doubleclick_in_tree; @@ -51,7 +51,7 @@ public: * @param aDeMorganConvert preferred deMorgan conversion (TODO: should happen in dialog) */ DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const wxString& aTitle, - COMPONENT_TREE_SEARCH_CONTAINER* aSearchContainer, + COMPONENT_TREE_SEARCH_CONTAINER* const aSearchContainer, int aDeMorganConvert ); virtual ~DIALOG_CHOOSE_COMPONENT(); diff --git a/eeschema/dialogs/dialog_sch_sheet_props.cpp b/eeschema/dialogs/dialog_sch_sheet_props.cpp index 83ab8d4b89..8de6984bd6 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props.cpp @@ -33,6 +33,8 @@ DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS( wxWindow* parent ) : m_textFileName->SetValidator( FILE_NAME_WITH_PATH_CHAR_VALIDATOR() ); m_textFileName->SetFocus(); m_sdbSizer1OK->SetDefault(); + + GetSizer()->Fit( this ); } diff --git a/eeschema/dialogs/dialog_sch_sheet_props.fbp b/eeschema/dialogs/dialog_sch_sheet_props.fbp index a2f5db4cc0..3b8b661cd8 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props.fbp +++ b/eeschema/dialogs/dialog_sch_sheet_props.fbp @@ -1,6 +1,6 @@ - + C++ @@ -41,10 +41,10 @@ 0 wxID_ANY - + 500,150 DIALOG_SCH_SHEET_PROPS_BASE - 519,198 + 519,187 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Schematic Sheet Properties @@ -103,7 +103,7 @@ wxVERTICAL none - 12 + 5 wxALL|wxEXPAND 1 @@ -1472,7 +1472,7 @@ - 12 + 5 wxALL|wxEXPAND 0 diff --git a/eeschema/dialogs/dialog_sch_sheet_props_base.cpp b/eeschema/dialogs/dialog_sch_sheet_props_base.cpp index f8096707ee..60608965cb 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props_base.cpp +++ b/eeschema/dialogs/dialog_sch_sheet_props_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -11,7 +11,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) { - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); + this->SetSizeHints( wxSize( 500,150 ), wxDefaultSize ); wxBoxSizer* mainSizer; mainSizer = new wxBoxSizer( wxVERTICAL ); @@ -99,7 +99,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi fgSizer1->Add( m_textCtrlTimeStamp, 0, wxEXPAND|wxTOP|wxBOTTOM|wxALIGN_CENTER_VERTICAL, 5 ); - bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 12 ); + bupperSizer->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 ); mainSizer->Add( bupperSizer, 0, wxEXPAND, 5 ); @@ -117,7 +117,7 @@ DIALOG_SCH_SHEET_PROPS_BASE::DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWi m_sdbSizer1->AddButton( m_sdbSizer1Cancel ); m_sdbSizer1->Realize(); - mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 12 ); + mainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 ); this->SetSizer( mainSizer ); diff --git a/eeschema/dialogs/dialog_sch_sheet_props_base.h b/eeschema/dialogs/dialog_sch_sheet_props_base.h index 2260e9fc77..1b96203ddc 100644 --- a/eeschema/dialogs/dialog_sch_sheet_props_base.h +++ b/eeschema/dialogs/dialog_sch_sheet_props_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Nov 6 2013) +// C++ code generated with wxFormBuilder (version Jun 5 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -57,7 +57,7 @@ class DIALOG_SCH_SHEET_PROPS_BASE : public DIALOG_SHIM public: - DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,198 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + DIALOG_SCH_SHEET_PROPS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Schematic Sheet Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 519,187 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~DIALOG_SCH_SHEET_PROPS_BASE(); }; diff --git a/include/dialog_helpers.h b/include/dialog_helpers.h index a6c1cf9777..657470a466 100644 --- a/include/dialog_helpers.h +++ b/include/dialog_helpers.h @@ -94,8 +94,10 @@ private: void onListItemSelected( wxListEvent& event ); void onListItemActivated( wxListEvent& event ); void textChangeInFilterBox(wxCommandEvent& event); - void sortList(); + void initDialog( const wxArrayString& aItemHeaders, + const wxString& aSelection); + void sortList(); bool m_sortList; void (* m_cb_func)( wxString& text, void* data ); void* m_cb_data;