Try to fix an issue on Ubuntu/Unity for some dialogs which are not displayed. Adding GetSizer()->Fit( this ) after last dialog "geometry" change (size for instance) or Raise() if the window is not a dialog fix it.

Partial fix. There are few cases where the frame is still not displayed.
Looks like a Unity issue, not a Kicad issue.
This commit is contained in:
jean-pierre charras 2014-11-19 20:13:10 +01:00
commit 1e5fa54d1a
21 changed files with 88 additions and 54 deletions

View File

@ -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 );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -41,10 +41,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">400,400</property>
<property name="name">EDA_LIST_DIALOG_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">400,400</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property>

View File

@ -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();
};

View File

@ -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();
}

View File

@ -199,7 +199,7 @@ DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
m_config = Kiface().KifaceSettings();
installPluginsList();
GetSizer()->SetSizeHints( this );
GetSizer()->Fit( this );
Centre();
}

View File

@ -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!

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_events">1</property>
<property name="skip_python_events">1</property>
<property name="ui_table">UI</property>
<property name="use_enum">1</property>
<property name="use_microsoft_bom">0</property>
<object class="Dialog" expanded="1">

View File

@ -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!

View File

@ -24,7 +24,6 @@
#include <dialog_choose_component.h>
#include <set>
#include <boost/foreach.hpp>
#include <wx/tokenzr.h>
#include <class_library.h>
@ -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();
}

View File

@ -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();

View File

@ -165,6 +165,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent
// Problems with modal on wx-2.9 - Anyway preview is standard for OSX
m_buttonPreview->Hide();
#endif
GetSizer()->Fit( this );
}
@ -274,6 +276,7 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
preview->SetZoom( 100 );
SCH_PREVIEW_FRAME* frame = new SCH_PREVIEW_FRAME( preview, this, title );
frame->SetMinSize( wxSize( 550, 350 ) );
// on first invocation in this runtime session, set to 2/3 size of my parent,
// but will be changed in Show() if not first time as will position.
@ -281,6 +284,8 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
frame->Center();
frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
}

View File

@ -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 );
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
@ -41,10 +41,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="minimum_size">500,150</property>
<property name="name">DIALOG_SCH_SHEET_PROPS_BASE</property>
<property name="pos"></property>
<property name="size">519,198</property>
<property name="size">519,187</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Schematic Sheet Properties</property>
@ -103,7 +103,7 @@
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
@ -1472,7 +1472,7 @@
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">12</property>
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">

View File

@ -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 );

View File

@ -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();
};

View File

@ -90,6 +90,8 @@ DIALOG_SCH_FIND::DIALOG_SCH_FIND( wxWindow* aParent, wxFindReplaceData* aData,
}
SetSize( size );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
}

View File

@ -62,10 +62,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
* column from being sized correctly. It doesn't cause any problems
* on win32 so it doesn't need to wrapped in ugly #ifdef __WXGTK__
* #endif.
* Still presen in wxWidgets 3.0.2
*/
dlg.Layout();
dlg.Fit();
dlg.SetMinSize( dlg.GetSize() );
dlg.GetSizer()->Fit( &dlg );
if( dlg.ShowModal() == wxID_CANCEL )
return false;

View File

@ -133,6 +133,8 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( GERBVIEW_FRAME* parent )
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
m_buttonPreview->Hide();
#endif
GetSizer()->Fit( this );
}
@ -368,8 +370,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
wxSize WSize = m_Parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
}

View File

@ -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;

View File

@ -25,7 +25,6 @@
/* File: dialog_print_for_modedit.cpp */
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <confirm.h>
@ -116,6 +115,7 @@ DIALOG_PRINT_FOR_MODEDIT::DIALOG_PRINT_FOR_MODEDIT( PCB_BASE_FRAME* parent ) :
m_buttonPrint->SetDefault();
GetSizer()->SetSizeHints( this );
GetSizer()->Fit( this ); // Needed on Ubuntu/Unity to display the dialog
}
@ -188,8 +188,11 @@ void DIALOG_PRINT_FOR_MODEDIT::OnPrintPreview( wxCommandEvent& event )
wxSize WSize = m_parent->GetSize();
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
}

View File

@ -26,7 +26,6 @@
//#define wxTEST_POSTSCRIPT_IN_MSW 1
#include <fctsys.h>
//#include <pgm_base.h>
#include <kiface_i.h>
#include <class_drawpanel.h>
#include <confirm.h>
@ -146,22 +145,18 @@ DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER( PCB_EDIT_FRAME* parent )
{
m_parent = parent;
m_config = Kiface().KifaceSettings();
memset( m_BoxSelectLayer, 0, sizeof( m_BoxSelectLayer ) );
initValues( );
if( GetSizer() )
{
GetSizer()->SetSizeHints( this );
}
GetSizer()->SetSizeHints( this );
Center();
#ifdef __WXMAC__
/* Problems with modal on wx-2.9 - Anyway preview is standard for OSX */
m_buttonPreview->Hide();
#endif
GetSizer()->Fit( this );
}
@ -469,8 +464,11 @@ void DIALOG_PRINT_USING_PRINTER::OnPrintPreview( wxCommandEvent& event )
preview->SetZoom( 100 );
wxPreviewFrame* frame = new wxPreviewFrame( preview, this, title, WPos, WSize );
frame->SetMinSize( wxSize( 550, 350 ) );
frame->Initialize();
frame->Raise(); // Needed on Ubuntu/Unity to display the frame
frame->Show( true );
}