Make project manager text aligned with icons, also make it scrollable.
This commit is contained in:
parent
41b30e6ac6
commit
20e2dddc0b
|
@ -46,7 +46,7 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
|
|||
{
|
||||
m_frame->SetPcmButton( nullptr );
|
||||
|
||||
if( m_toolsSizer->GetRows() > 0 )
|
||||
if( m_toolsSizer->GetEffectiveRowsCount() > 0 )
|
||||
{
|
||||
m_toolsSizer->Clear( true );
|
||||
m_toolsSizer->SetRows( 0 );
|
||||
|
@ -64,10 +64,10 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
|
|||
auto addLauncher = [&]( const TOOL_ACTION& aAction, BITMAPS aBitmaps,
|
||||
const wxString& aHelpText, bool enabled = true )
|
||||
{
|
||||
BITMAP_BUTTON* btn = new BITMAP_BUTTON( this, wxID_ANY );
|
||||
BITMAP_BUTTON* btn = new BITMAP_BUTTON( m_scrolledWindow, wxID_ANY );
|
||||
btn->SetBitmap( KiBitmapBundle( aBitmaps ) );
|
||||
btn->SetDisabledBitmap( KiDisabledBitmapBundle( aBitmaps ) );
|
||||
btn->SetPadding( 5 );
|
||||
btn->SetPadding( FromDIP( 4 ) );
|
||||
btn->SetToolTip( aAction.GetTooltip() );
|
||||
|
||||
auto handler =
|
||||
|
@ -85,14 +85,15 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
|
|||
m_toolManager->ProcessEvent( *evt );
|
||||
};
|
||||
|
||||
wxStaticText* label = new wxStaticText( this, wxID_ANY, aAction.GetFriendlyName() );
|
||||
wxStaticText* help;
|
||||
wxStaticText* label = new wxStaticText( m_scrolledWindow, wxID_ANY, wxEmptyString );
|
||||
wxStaticText* help = new wxStaticText( m_scrolledWindow, wxID_ANY, wxEmptyString );
|
||||
|
||||
label->SetToolTip( aAction.GetTooltip() );
|
||||
label->SetFont( titleFont );
|
||||
label->SetLabel( aAction.GetFriendlyName() );
|
||||
|
||||
help = new wxStaticText( this, wxID_ANY, aHelpText );
|
||||
help->SetFont( helpFont );
|
||||
help->SetLabel( aHelpText );
|
||||
|
||||
btn->Bind( wxEVT_BUTTON, handler );
|
||||
|
||||
|
@ -100,20 +101,14 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
|
|||
// any visual feedback that's a bit odd. Disabling for now.
|
||||
// label->Bind( wxEVT_LEFT_UP, handler );
|
||||
|
||||
int row = m_toolsSizer->GetRows();
|
||||
m_toolsSizer->Add( btn, 1, wxALIGN_CENTER_VERTICAL );
|
||||
|
||||
m_toolsSizer->Add( btn, wxGBPosition( row, 0 ), wxGBSpan( 2, 1 ), wxBOTTOM, 12 );
|
||||
wxBoxSizer* textSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
// Due to https://trac.wxwidgets.org/ticket/16088?cversion=0&cnum_hist=7 GTK fails to
|
||||
// correctly set the BestSize of non-default-size or styled text so we need to make
|
||||
// sure that the BestSize isn't needed by setting wxEXPAND. Unfortunately this makes
|
||||
// wxALIGN_BOTTOM non-functional, so we have to jump through a bunch more hoops to
|
||||
// try and align the title and help text in the middle of the icon.
|
||||
m_toolsSizer->Add( label, wxGBPosition( row, 1 ), wxGBSpan( 1, 1 ),
|
||||
wxTOP | wxEXPAND, 10 );
|
||||
textSizer->Add( label );
|
||||
textSizer->Add( help );
|
||||
|
||||
m_toolsSizer->Add( help, wxGBPosition( row + 1, 1 ), wxGBSpan( 1, 1 ),
|
||||
wxALIGN_TOP | wxTOP, 1 );
|
||||
m_toolsSizer->Add( textSizer, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL );
|
||||
|
||||
btn->Enable( enabled );
|
||||
if( !enabled )
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 4.1.0-0-g733bf3d)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -14,17 +14,17 @@ PANEL_KICAD_LAUNCHER_BASE::PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindow
|
|||
wxBoxSizer* bSizer2;
|
||||
bSizer2 = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_mainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_toolsSizer = new wxGridBagSizer( 0, 10 );
|
||||
m_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL|wxVSCROLL );
|
||||
m_scrolledWindow->SetScrollRate( 5, 5 );
|
||||
m_toolsSizer = new wxFlexGridSizer( 0, 2, 2, 10 );
|
||||
m_toolsSizer->SetFlexibleDirection( wxBOTH );
|
||||
m_toolsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
|
||||
m_toolsSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
|
||||
|
||||
|
||||
m_mainSizer->Add( m_toolsSizer, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
|
||||
bSizer2->Add( m_mainSizer, 1, wxALL|wxEXPAND, 5 );
|
||||
m_scrolledWindow->SetSizer( m_toolsSizer );
|
||||
m_scrolledWindow->Layout();
|
||||
m_toolsSizer->Fit( m_scrolledWindow );
|
||||
bSizer2->Add( m_scrolledWindow, 1, wxEXPAND | wxALL, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizer2 );
|
||||
|
|
|
@ -1,88 +1,137 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="15" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">panel_kicad_launcher_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">panel_kicad_launcher_base</property>
|
||||
<property name="namespace"></property>
|
||||
<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">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<FileVersion major="1" minor="17"/>
|
||||
<object class="Project" expanded="true">
|
||||
<property name="class_decoration">; </property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">panel_kicad_launcher_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">panel_kicad_launcher_base</property>
|
||||
<property name="namespace"></property>
|
||||
<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_array_enum">0</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="true">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_KICAD_LAUNCHER_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="two_step_creation">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<object class="wxBoxSizer" expanded="true">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer2</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND | wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxScrolledWindow" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="drag_accept_files">0</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">PANEL_KICAD_LAUNCHER_BASE</property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_scrolledWindow</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="scroll_rate_x">5</property>
|
||||
<property name="scroll_rate_y">5</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style">wxTAB_TRAVERSAL</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizer2</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_mainSizer</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">protected</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxGridBagSizer" expanded="1">
|
||||
<property name="empty_cell_size"></property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">10</property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="name">m_toolsSizer</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_NONE</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="vgap">0</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<property name="window_style">wxHSCROLL|wxVSCROLL</property>
|
||||
<object class="wxFlexGridSizer" expanded="true">
|
||||
<property name="cols">2</property>
|
||||
<property name="flexible_direction">wxBOTH</property>
|
||||
<property name="growablecols"></property>
|
||||
<property name="growablerows"></property>
|
||||
<property name="hgap">10</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">m_toolsSizer</property>
|
||||
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="rows">0</property>
|
||||
<property name="vgap">2</property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 4.1.0-0-g733bf3d)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -10,14 +10,14 @@
|
|||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/gbsizer.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/scrolwin.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/panel.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -30,12 +30,13 @@ class PANEL_KICAD_LAUNCHER_BASE : public wxPanel
|
|||
private:
|
||||
|
||||
protected:
|
||||
wxBoxSizer* m_mainSizer;
|
||||
wxGridBagSizer* m_toolsSizer;
|
||||
wxScrolledWindow* m_scrolledWindow;
|
||||
wxFlexGridSizer* m_toolsSizer;
|
||||
|
||||
public:
|
||||
|
||||
PANEL_KICAD_LAUNCHER_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
|
||||
|
||||
~PANEL_KICAD_LAUNCHER_BASE();
|
||||
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue