Dialog spacing cleanup.
This commit is contained in:
parent
f3983cc47f
commit
b5634b1d08
|
@ -55,7 +55,7 @@ FOOTPRINT_SELECT_WIDGET::FOOTPRINT_SELECT_WIDGET( wxWindow* aParent,
|
||||||
m_zero_filter = true;
|
m_zero_filter = true;
|
||||||
m_sizer = new wxBoxSizer( wxVERTICAL );
|
m_sizer = new wxBoxSizer( wxVERTICAL );
|
||||||
m_fp_sel_ctrl = new FOOTPRINT_CHOICE( this, wxID_ANY );
|
m_fp_sel_ctrl = new FOOTPRINT_CHOICE( this, wxID_ANY );
|
||||||
m_sizer->Add( m_fp_sel_ctrl, 1, wxEXPAND | wxALL, 5 );
|
m_sizer->Add( m_fp_sel_ctrl, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
SetSizer( m_sizer );
|
SetSizer( m_sizer );
|
||||||
Layout();
|
Layout();
|
||||||
|
|
|
@ -46,7 +46,8 @@
|
||||||
|
|
||||||
|
|
||||||
wxSize DIALOG_CHOOSE_COMPONENT::m_last_dlg_size( -1, -1 );
|
wxSize DIALOG_CHOOSE_COMPONENT::m_last_dlg_size( -1, -1 );
|
||||||
int DIALOG_CHOOSE_COMPONENT::m_tree_canvas_sash_position = 0;
|
int DIALOG_CHOOSE_COMPONENT::m_h_sash_pos = 0;
|
||||||
|
int DIALOG_CHOOSE_COMPONENT::m_v_sash_pos = 0;
|
||||||
|
|
||||||
std::mutex DIALOG_CHOOSE_COMPONENT::g_Mutex;
|
std::mutex DIALOG_CHOOSE_COMPONENT::g_Mutex;
|
||||||
|
|
||||||
|
@ -62,41 +63,70 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
|
m_deMorganConvert( aDeMorganConvert >= 0 ? aDeMorganConvert : 0 ),
|
||||||
m_allow_field_edits( aAllowFieldEdits ),
|
m_allow_field_edits( aAllowFieldEdits ),
|
||||||
m_show_footprints( aShowFootprints ),
|
m_show_footprints( aShowFootprints ),
|
||||||
m_external_browser_requested( false )
|
m_external_browser_requested( false ),
|
||||||
|
m_hsplitter( nullptr ),
|
||||||
|
m_vsplitter( nullptr )
|
||||||
{
|
{
|
||||||
auto sizer = new wxBoxSizer( wxVERTICAL );
|
auto sizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
wxHtmlWindow* details = nullptr;
|
||||||
|
|
||||||
// Use a slightly different layout, with a details pane spanning the entire window,
|
// Use a slightly different layout, with a details pane spanning the entire window,
|
||||||
// if we're not showing footprints.
|
// if we're not showing footprints.
|
||||||
auto vsplitter = aShowFootprints ? nullptr : new wxSplitterWindow(
|
if( aShowFootprints )
|
||||||
this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3DSASH );
|
{
|
||||||
|
m_hsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSP_LIVE_UPDATE | wxSP_3DSASH );
|
||||||
|
|
||||||
m_splitter_tree_canvas = new wxSplitterWindow(
|
//Avoid the splitter window being assigned as the Parent to additional windows
|
||||||
vsplitter ? static_cast<wxWindow *>( vsplitter ) : static_cast<wxWindow *>( this ),
|
m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
|
||||||
wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_LIVE_UPDATE | wxSP_3DSASH );
|
|
||||||
|
|
||||||
//Avoid the splitter window being assigned as the Parent to additional windows
|
sizer->Add( m_hsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
m_splitter_tree_canvas->SetExtraStyle( wxWS_EX_TRANSIENT );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_vsplitter = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxSP_LIVE_UPDATE | wxSP_3DSASH );
|
||||||
|
|
||||||
auto details = aShowFootprints ? nullptr : new wxHtmlWindow(
|
m_hsplitter = new wxSplitterWindow( m_vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
vsplitter, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO );
|
wxSP_LIVE_UPDATE | wxSP_3DSASH );
|
||||||
|
|
||||||
|
//Avoid the splitter window being assigned as the Parent to additional windows
|
||||||
|
m_hsplitter->SetExtraStyle( wxWS_EX_TRANSIENT );
|
||||||
|
|
||||||
|
auto detailsPanel = new wxPanel( m_vsplitter );
|
||||||
|
auto detailsSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
detailsPanel->SetSizer( detailsSizer );
|
||||||
|
|
||||||
|
details = new wxHtmlWindow( detailsPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
|
wxHW_SCROLLBAR_AUTO | wxRAISED_BORDER );
|
||||||
|
detailsSizer->Add( details, 1, wxEXPAND | wxLEFT | wxRIGHT, 5 );
|
||||||
|
detailsPanel->Layout();
|
||||||
|
detailsSizer->Fit( detailsPanel );
|
||||||
|
|
||||||
|
m_vsplitter->SetSashGravity( 0.5 );
|
||||||
|
m_vsplitter->SetMinimumPaneSize( 20 );
|
||||||
|
m_vsplitter->SplitHorizontally( m_hsplitter, detailsPanel );
|
||||||
|
|
||||||
|
sizer->Add( m_vsplitter, 1, wxEXPAND | wxLEFT | wxRIGHT | wxTOP, 5 );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_tree = new COMPONENT_TREE( m_hsplitter, Prj().SchSymbolLibTable(), aAdapter,
|
||||||
|
COMPONENT_TREE::WIDGETS::ALL, details );
|
||||||
|
|
||||||
|
m_symbol_view_panel = ConstructRightPanel( m_hsplitter );
|
||||||
|
|
||||||
|
m_hsplitter->SetSashGravity( 0.8 );
|
||||||
|
m_hsplitter->SetMinimumPaneSize( 20 );
|
||||||
|
m_hsplitter->SplitVertically( m_tree, m_symbol_view_panel );
|
||||||
|
|
||||||
m_tree = new COMPONENT_TREE( m_splitter_tree_canvas, Prj().SchSymbolLibTable(),
|
|
||||||
aAdapter, COMPONENT_TREE::WIDGETS::ALL, details );
|
|
||||||
m_symbol_view_panel = ConstructRightPanel( m_splitter_tree_canvas );
|
|
||||||
auto buttons = new wxStdDialogButtonSizer();
|
|
||||||
m_dbl_click_timer = new wxTimer( this );
|
m_dbl_click_timer = new wxTimer( this );
|
||||||
|
|
||||||
if( vsplitter )
|
auto buttons = new wxStdDialogButtonSizer();
|
||||||
sizer->Add( vsplitter, 1, wxEXPAND | wxALL, 5 );
|
|
||||||
else
|
|
||||||
sizer->Add( m_splitter_tree_canvas, 1, wxEXPAND | wxALL, 5 );
|
|
||||||
|
|
||||||
buttons->AddButton( new wxButton( this, wxID_OK ) );
|
buttons->AddButton( new wxButton( this, wxID_OK ) );
|
||||||
buttons->AddButton( new wxButton( this, wxID_CANCEL ) );
|
buttons->AddButton( new wxButton( this, wxID_CANCEL ) );
|
||||||
buttons->Realize();
|
buttons->Realize();
|
||||||
|
|
||||||
sizer->Add( buttons, 0, wxEXPAND | wxBOTTOM, 10 );
|
sizer->Add( buttons, 0, wxEXPAND | wxALL, 5 );
|
||||||
SetSizer( sizer );
|
SetSizer( sizer );
|
||||||
|
|
||||||
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
|
Bind( wxEVT_INIT_DIALOG, &DIALOG_CHOOSE_COMPONENT::OnInitDialog, this );
|
||||||
|
@ -113,25 +143,17 @@ DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT( SCH_BASE_FRAME* aParent, const
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
if( m_last_dlg_size == wxSize( -1, -1 ) )
|
|
||||||
SetSizeInDU( 320, 256 );
|
|
||||||
else
|
|
||||||
SetSize( m_last_dlg_size );
|
|
||||||
|
|
||||||
m_splitter_tree_canvas->SetSashGravity( 0.8 );
|
|
||||||
m_splitter_tree_canvas->SetMinimumPaneSize( 20 );
|
|
||||||
// We specify the width of the right window (m_symbol_view_panel), because specify
|
// We specify the width of the right window (m_symbol_view_panel), because specify
|
||||||
// the width of the left window does not work as expected when SetSashGravity() is called
|
// the width of the left window does not work as expected when SetSashGravity() is called
|
||||||
m_splitter_tree_canvas->SplitVertically( m_tree, m_symbol_view_panel,
|
m_hsplitter->SetSashPosition( m_h_sash_pos ? m_h_sash_pos : HorizPixelsFromDU( 240 ) );
|
||||||
m_tree_canvas_sash_position ? -m_tree_canvas_sash_position
|
|
||||||
: HorizPixelsFromDU( -100 ) );
|
|
||||||
|
|
||||||
if( vsplitter )
|
if( m_vsplitter )
|
||||||
{
|
m_vsplitter->SetSashPosition( m_v_sash_pos ? m_v_sash_pos : VertPixelsFromDU( 170 ) );
|
||||||
vsplitter->SetSashGravity( 0.5 );
|
|
||||||
vsplitter->SetMinimumPaneSize( 20 );
|
if( m_last_dlg_size == wxSize( -1, -1 ) )
|
||||||
vsplitter->SplitHorizontally( m_splitter_tree_canvas, details, VertPixelsFromDU( -80 ) );
|
SetSizeInDU( 360, 280 );
|
||||||
}
|
else
|
||||||
|
SetSize( m_last_dlg_size );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -155,8 +177,10 @@ DIALOG_CHOOSE_COMPONENT::~DIALOG_CHOOSE_COMPONENT()
|
||||||
delete m_dbl_click_timer;
|
delete m_dbl_click_timer;
|
||||||
|
|
||||||
m_last_dlg_size = GetSize();
|
m_last_dlg_size = GetSize();
|
||||||
m_tree_canvas_sash_position = m_splitter_tree_canvas->GetClientSize().x
|
m_h_sash_pos = m_hsplitter->GetSashPosition();
|
||||||
- m_splitter_tree_canvas->GetSashPosition();
|
|
||||||
|
if( m_vsplitter )
|
||||||
|
m_v_sash_pos = m_vsplitter->GetSashPosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,7 +190,7 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
|
||||||
auto sizer = new wxBoxSizer( wxVERTICAL );
|
auto sizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
m_sch_view_ctrl = new wxPanel( panel, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
|
m_sch_view_ctrl = new wxPanel( panel, wxID_ANY, wxDefaultPosition, wxSize( -1, -1 ),
|
||||||
wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL );
|
wxFULL_REPAINT_ON_RESIZE | wxTAB_TRAVERSAL | wxRAISED_BORDER );
|
||||||
m_sch_view_ctrl->SetLayoutDirection( wxLayout_LeftToRight );
|
m_sch_view_ctrl->SetLayoutDirection( wxLayout_LeftToRight );
|
||||||
|
|
||||||
if( m_show_footprints )
|
if( m_show_footprints )
|
||||||
|
@ -179,16 +203,16 @@ wxPanel* DIALOG_CHOOSE_COMPONENT::ConstructRightPanel( wxWindow* aParent )
|
||||||
m_fp_view_ctrl = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() );
|
m_fp_view_ctrl = new FOOTPRINT_PREVIEW_WIDGET( panel, Kiway() );
|
||||||
|
|
||||||
|
|
||||||
sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 );
|
sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxTOP | wxBOTTOM | wxRIGHT, 5 );
|
||||||
|
|
||||||
if( m_fp_sel_ctrl )
|
if( m_fp_sel_ctrl )
|
||||||
sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxALL, 5 );
|
sizer->Add( m_fp_sel_ctrl, 0, wxEXPAND | wxTOP | wxRIGHT, 5 );
|
||||||
|
|
||||||
sizer->Add( m_fp_view_ctrl, 1, wxEXPAND | wxALL, 5 );
|
sizer->Add( m_fp_view_ctrl, 1, wxEXPAND | wxBOTTOM | wxRIGHT, 5 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxALL, 5 );
|
sizer->Add( m_sch_view_ctrl, 1, wxEXPAND | wxTOP | wxRIGHT, 5 );
|
||||||
}
|
}
|
||||||
|
|
||||||
panel->SetSizer( sizer );
|
panel->SetSizer( sizer );
|
||||||
|
|
|
@ -189,15 +189,17 @@ protected:
|
||||||
*/
|
*/
|
||||||
void RenderPreview( LIB_PART* aComponent, int aUnit );
|
void RenderPreview( LIB_PART* aComponent, int aUnit );
|
||||||
|
|
||||||
wxTimer* m_dbl_click_timer;
|
wxTimer* m_dbl_click_timer;
|
||||||
wxPanel* m_sch_view_ctrl;
|
wxPanel* m_sch_view_ctrl;
|
||||||
// the wxSplitterWindow that manages the symbol tree and symbol canvas viewer
|
// the wxSplitterWindow that manages the symbol tree and symbol canvas viewer
|
||||||
wxSplitterWindow* m_splitter_tree_canvas;
|
wxSplitterWindow* m_hsplitter;
|
||||||
|
wxSplitterWindow* m_vsplitter;
|
||||||
// the symbol canvas viewer
|
// the symbol canvas viewer
|
||||||
wxPanel* m_symbol_view_panel;
|
wxPanel* m_symbol_view_panel;
|
||||||
// the sash position separation between symbol tree and symbol canvas viewer
|
// the sash position separation between symbol tree and symbol canvas viewer
|
||||||
// (remember the sash position during a session)
|
// (remember the sash position during a session)
|
||||||
static int m_tree_canvas_sash_position;
|
static int m_h_sash_pos;
|
||||||
|
static int m_v_sash_pos;
|
||||||
|
|
||||||
FOOTPRINT_SELECT_WIDGET* m_fp_sel_ctrl;
|
FOOTPRINT_SELECT_WIDGET* m_fp_sel_ctrl;
|
||||||
FOOTPRINT_PREVIEW_WIDGET* m_fp_view_ctrl;
|
FOOTPRINT_PREVIEW_WIDGET* m_fp_view_ctrl;
|
||||||
|
|
|
@ -73,11 +73,11 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl
|
||||||
}
|
}
|
||||||
|
|
||||||
// Component tree
|
// Component tree
|
||||||
m_tree_ctrl =
|
m_tree_ctrl = new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
|
||||||
new wxDataViewCtrl( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDV_SINGLE );
|
wxDV_SINGLE | wxRAISED_BORDER );
|
||||||
m_adapter->AttachTo( m_tree_ctrl );
|
m_adapter->AttachTo( m_tree_ctrl );
|
||||||
|
|
||||||
sizer->Add( m_tree_ctrl, 1, wxLEFT | wxTOP | wxEXPAND, 5 );
|
sizer->Add( m_tree_ctrl, 5, wxLEFT | wxTOP | wxEXPAND, 5 );
|
||||||
|
|
||||||
// Description panel
|
// Description panel
|
||||||
if( aWidgets & DETAILS )
|
if( aWidgets & DETAILS )
|
||||||
|
@ -88,9 +88,9 @@ COMPONENT_TREE::COMPONENT_TREE( wxWindow* aParent, SYMBOL_LIB_TABLE* aSymLibTabl
|
||||||
|
|
||||||
m_details_ctrl = new wxHtmlWindow(
|
m_details_ctrl = new wxHtmlWindow(
|
||||||
this, wxID_ANY, wxDefaultPosition, wxSize( html_sz.x, html_sz.y ),
|
this, wxID_ANY, wxDefaultPosition, wxSize( html_sz.x, html_sz.y ),
|
||||||
wxHW_SCROLLBAR_AUTO );
|
wxHW_SCROLLBAR_AUTO | wxRAISED_BORDER );
|
||||||
|
|
||||||
sizer->Add( m_details_ctrl, 1, wxALL | wxEXPAND, 5 );
|
sizer->Add( m_details_ctrl, 2, wxLEFT | wxTOP | wxBOTTOM | wxEXPAND, 5 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue