Improve bullets on Mac & GTK; improve scrollbar behaviour on MSW.

This commit is contained in:
Jeff Young 2021-11-11 11:33:28 +00:00
parent 78bedbed93
commit c3c2af9cd0
8 changed files with 43 additions and 22 deletions

View File

@ -13,7 +13,7 @@
DIALOG_PCM_BASE::DIALOG_PCM_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( wxSize( 650,500 ), wxDefaultSize );
this->SetSizeHints( wxSize( 900,560 ), wxDefaultSize );
wxBoxSizer* m_MainSizer;
m_MainSizer = new wxBoxSizer( wxVERTICAL );
@ -48,7 +48,7 @@ DIALOG_PCM_BASE::DIALOG_PCM_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_panelRepository->SetSizer( bSizer4 );
m_panelRepository->Layout();
bSizer4->Fit( m_panelRepository );
m_dialogNotebook->AddPage( m_panelRepository, _("Repository (%d)"), false );
m_dialogNotebook->AddPage( m_panelRepository, _("Repository (%d)"), true );
m_panelInstalledHolder = new wxPanel( m_dialogNotebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxVERTICAL );
@ -116,7 +116,7 @@ DIALOG_PCM_BASE::DIALOG_PCM_BASE( wxWindow* parent, wxWindowID id, const wxStrin
m_panelPending->SetSizer( bSizer8 );
m_panelPending->Layout();
bSizer8->Fit( m_panelPending );
m_dialogNotebook->AddPage( m_panelPending, _("Pending (%d)"), true );
m_dialogNotebook->AddPage( m_panelPending, _("Pending (%d)"), false );
m_TopSizer->Add( m_dialogNotebook, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );

View File

@ -42,10 +42,10 @@
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size">650,500</property>
<property name="minimum_size">900,560</property>
<property name="name">DIALOG_PCM_BASE</property>
<property name="pos"></property>
<property name="size">860,620</property>
<property name="size">900,560</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h; forward_declare</property>
<property name="title">Plugin And Content Manager</property>
@ -127,7 +127,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Repository (%d)</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -461,7 +461,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Pending (%d)</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>

View File

@ -71,7 +71,7 @@ class DIALOG_PCM_BASE : public DIALOG_SHIM
public:
DIALOG_PCM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin And Content Manager"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 860,620 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_PCM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plugin And Content Manager"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 900,560 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PCM_BASE();
};

View File

@ -164,7 +164,7 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
m_infoText->EndFontSize();
m_infoText->BeginParagraphSpacing( 0, 10 );
m_infoText->BeginSymbolBullet( wxString::FromUTF8( u8"\u25CF" ), 30, 40 );
m_infoText->BeginSymbolBullet( wxString::FromUTF8( u8"\u2022" ), 30, 40 );
m_infoText->WriteText( wxString::Format( _( "Package identifier: %s\n" ),
package.identifier ) );
m_infoText->WriteText( wxString::Format( _( "License: %s\n" ), package.license ) );
@ -217,13 +217,8 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
m_infoText->EndSymbolBullet();
m_infoText->EndParagraphSpacing();
m_infoText->LayoutContent();
wxSize minSize = m_infoText->GetSize();
minSize.y = m_infoText->GetBuffer().GetCachedSize().y + m_infoText->GetBuffer().GetTopMargin();
minSize.y *= m_infoText->GetScale();
m_infoText->SetMinSize( minSize );
m_infoText->SetSize( minSize );
wxSizeEvent dummy;
OnSizeInfoBox( dummy );
// Versions table
m_gridVersions->Freeze();
@ -269,8 +264,8 @@ void PANEL_PACKAGES_VIEW::setPackageDetails( const PACKAGE_VIEW_DATA& aPackageDa
for( int col = 0; col < m_gridVersions->GetNumberCols(); col++ )
{
// Set the width to see the full contents
m_gridVersions->SetColSize( col,
m_gridVersions->GetVisibleWidth( col, true, true, false ) );
m_gridVersions->SetColSize( col, m_gridVersions->GetVisibleWidth( col, true, true,
false ) );
}
m_gridVersions->Thaw();
@ -535,3 +530,21 @@ void PANEL_PACKAGES_VIEW::updatePackageList()
m_packageListWindow->SetScrollRate( 0, 15 );
m_packageListWindow->Layout();
}
void PANEL_PACKAGES_VIEW::OnSizeInfoBox( wxSizeEvent& event )
{
wxSize infoSize = m_infoText->GetParent()->GetClientSize();
m_infoText->SetMinSize( infoSize );
m_infoText->SetMaxSize( infoSize );
m_infoText->SetSize( infoSize );
m_infoText->LayoutContent();
infoSize.y = m_infoText->GetBuffer().GetCachedSize().y + m_infoText->GetBuffer().GetTopMargin();
infoSize.y *= m_infoText->GetScale();
m_infoText->SetMinSize( infoSize );
m_infoText->SetMaxSize( infoSize );
m_infoText->SetSize( infoSize );
m_infoText->Layout();
}

View File

@ -72,6 +72,8 @@ public:
///< Ranks packages for entered search term and rearranges/hides panels according to their rank
void OnSearchTextChanged( wxCommandEvent& event );
void OnSizeInfoBox( wxSizeEvent& event ) override;
private:
///< Updates package listing according to search term
void updatePackageList();
@ -85,6 +87,7 @@ private:
///< Bytes to Kb/Mb/Gb string or "-" if absent
wxString toHumanReadableSize( const boost::optional<uint64_t> size ) const;
private:
ActionCallback m_actionCallback;
std::unordered_map<wxString, PANEL_PACKAGE*> m_packagePanels;
std::vector<wxString> m_packageInitialOrder;

View File

@ -17,7 +17,7 @@ PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE( wxWindow* parent, wxWindowID
m_splitter1 = new wxSplitterWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSP_3DSASH|wxSP_LIVE_UPDATE );
m_splitter1->SetSashGravity( 0.5 );
m_splitter1->Connect( wxEVT_IDLE, wxIdleEventHandler( PANEL_PACKAGES_VIEW_BASE::m_splitter1OnIdle ), NULL, this );
m_splitter1->SetMinimumPaneSize( 380 );
m_splitter1->SetMinimumPaneSize( 400 );
m_panelList = new wxPanel( m_splitter1, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bPanelListSizer;
@ -131,8 +131,10 @@ PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE( wxWindow* parent, wxWindowID
this->SetSizer( bSizer1 );
this->Layout();
bSizer1->Fit( this );
// Connect Events
m_scrolledWindow5->Connect( wxEVT_SIZE, wxSizeEventHandler( PANEL_PACKAGES_VIEW_BASE::OnSizeInfoBox ), NULL, this );
m_gridVersions->Connect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( PANEL_PACKAGES_VIEW_BASE::OnVersionsCellClicked ), NULL, this );
m_showAllVersions->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_PACKAGES_VIEW_BASE::OnShowAllVersionsClicked ), NULL, this );
m_buttonDownload->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PACKAGES_VIEW_BASE::OnDownloadVersionClicked ), NULL, this );
@ -142,6 +144,7 @@ PANEL_PACKAGES_VIEW_BASE::PANEL_PACKAGES_VIEW_BASE( wxWindow* parent, wxWindowID
PANEL_PACKAGES_VIEW_BASE::~PANEL_PACKAGES_VIEW_BASE()
{
// Disconnect Events
m_scrolledWindow5->Disconnect( wxEVT_SIZE, wxSizeEventHandler( PANEL_PACKAGES_VIEW_BASE::OnSizeInfoBox ), NULL, this );
m_gridVersions->Disconnect( wxEVT_GRID_CELL_LEFT_CLICK, wxGridEventHandler( PANEL_PACKAGES_VIEW_BASE::OnVersionsCellClicked ), NULL, this );
m_showAllVersions->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( PANEL_PACKAGES_VIEW_BASE::OnShowAllVersionsClicked ), NULL, this );
m_buttonDownload->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( PANEL_PACKAGES_VIEW_BASE::OnDownloadVersionClicked ), NULL, this );

View File

@ -43,7 +43,7 @@
<property name="minimum_size"></property>
<property name="name">PANEL_PACKAGES_VIEW_BASE</property>
<property name="pos"></property>
<property name="size">840,400</property>
<property name="size">-1,-1</property>
<property name="subclass">; ; forward_declare</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
@ -89,7 +89,7 @@
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_pane_size">380</property>
<property name="min_pane_size">400</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
@ -419,6 +419,7 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxVSCROLL</property>
<event name="OnSize">OnSizeInfoBox</event>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerScrolledWindow</property>

View File

@ -54,6 +54,7 @@ class PANEL_PACKAGES_VIEW_BASE : public wxPanel
wxButton* m_buttonInstall;
// Virtual event handlers, overide them in your derived class
virtual void OnSizeInfoBox( wxSizeEvent& event ) { event.Skip(); }
virtual void OnVersionsCellClicked( wxGridEvent& event ) { event.Skip(); }
virtual void OnShowAllVersionsClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDownloadVersionClicked( wxCommandEvent& event ) { event.Skip(); }
@ -62,7 +63,7 @@ class PANEL_PACKAGES_VIEW_BASE : public wxPanel
public:
PANEL_PACKAGES_VIEW_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 840,400 ), long style = wxTAB_TRAVERSAL, const wxString& name = wxEmptyString );
PANEL_PACKAGES_VIEW_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_PACKAGES_VIEW_BASE();
void m_splitter1OnIdle( wxIdleEvent& )