From 98d26e77c95c6c46f4e9bd288e6ad32c57fc80dc Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 5 Mar 2024 08:38:46 -0500 Subject: [PATCH] Update a few more list/tree views for macOS (cherry picked from commit 1988aac2b311cf24d9f28887c7f5c4fe2774e046) --- common/dialog_about/dialog_about.cpp | 24 +++++++++++++++++++++++- common/dialogs/git/dialog_git_commit.cpp | 16 ++++++++++++++++ eeschema/widgets/hierarchy_pane.cpp | 8 ++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/common/dialog_about/dialog_about.cpp b/common/dialog_about/dialog_about.cpp index ead922d369..97017980c6 100644 --- a/common/dialog_about/dialog_about.cpp +++ b/common/dialog_about/dialog_about.cpp @@ -51,11 +51,30 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) - : DIALOG_ABOUT_BASE( aParent ), m_info( aAppInfo ) + : DIALOG_ABOUT_BASE( aParent ), + m_images( nullptr ), + m_info( aAppInfo ) { wxASSERT( aParent != nullptr ); SetEvtHandlerEnabled( false ); + +#ifdef __WXMAC__ + // HiDPI-aware API; will be generally available in wxWidgets 3.4 + wxVector images; + + images.push_back( KiBitmapBundle( BITMAPS::info ) ); // INFORMATION + images.push_back( KiBitmapBundle( BITMAPS::recent ) ); // VERSION + images.push_back( KiBitmapBundle( BITMAPS::preference ) ); // DEVELOPERS + images.push_back( KiBitmapBundle( BITMAPS::editor ) ); // DOCWRITERS + images.push_back( KiBitmapBundle( BITMAPS::library ) ); // LIBRARIANS + images.push_back( KiBitmapBundle( BITMAPS::color_materials ) ); // ARTISTS + images.push_back( KiBitmapBundle( BITMAPS::language ) ); // TRANSLATORS + images.push_back( KiBitmapBundle( BITMAPS::zip ) ); // PACKAGERS + images.push_back( KiBitmapBundle( BITMAPS::tools ) ); // LICENSE + + m_notebook->SetImages( images ); +#else // TODO: Change these to 16x16 versions when available m_images = new wxImageList( 24, 24, false, 9 ); @@ -70,6 +89,7 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) m_images->Add( KiBitmap( BITMAPS::tools ) ); // LICENSE m_notebook->SetImageList( m_images ); +#endif if( m_info.GetAppIcon().IsOk() ) { @@ -108,7 +128,9 @@ DIALOG_ABOUT::DIALOG_ABOUT( EDA_BASE_FRAME *aParent, ABOUT_APP_INFO& aAppInfo ) DIALOG_ABOUT::~DIALOG_ABOUT() { +#ifndef __WXMAC__ delete m_images; +#endif } diff --git a/common/dialogs/git/dialog_git_commit.cpp b/common/dialogs/git/dialog_git_commit.cpp index 5ad39e6599..64ba9c982e 100644 --- a/common/dialogs/git/dialog_git_commit.cpp +++ b/common/dialogs/git/dialog_git_commit.cpp @@ -57,6 +57,21 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo, m_listCtrl->SetColumnWidth( 1, 200 ); // Set up image list for icons +#ifdef __WXMAC__ + // HiDPI-aware API; will be generally available in wxWidgets 3.4 + wxVector stateImages; + stateImages.push_back( wxBitmapBundle() ); // GIT_STATUS_UNTRACKED + stateImages.push_back( KiBitmapBundle( BITMAPS::git_good_check ) ); // GIT_STATUS_CURRENT + stateImages.push_back( KiBitmapBundle( BITMAPS::git_modified ) ); // GIT_STATUS_MODIFIED + stateImages.push_back( KiBitmapBundle( BITMAPS::git_add ) ); // GIT_STATUS_ADDED + stateImages.push_back( KiBitmapBundle( BITMAPS::git_delete ) ); // GIT_STATUS_DELETED + stateImages.push_back( KiBitmapBundle( BITMAPS::git_out_of_date ) ); // GIT_STATUS_BEHIND + stateImages.push_back( KiBitmapBundle( BITMAPS::git_changed_ahead ) ); // GIT_STATUS_AHEAD + stateImages.push_back( KiBitmapBundle( BITMAPS::git_conflict ) ); // GIT_STATUS_CONFLICTED + + m_listCtrl->SetNormalImages( stateImages ); + m_listCtrl->SetSmallImages( stateImages ); +#else wxImageList* imageList = new wxImageList( 16, 16, true, static_cast( KIGIT_COMMON::GIT_STATUS::GIT_STATUS_LAST ) ); @@ -71,6 +86,7 @@ DIALOG_GIT_COMMIT::DIALOG_GIT_COMMIT( wxWindow* parent, git_repository* repo, // Assign the image list to the list control m_listCtrl->SetImageList( imageList, wxIMAGE_LIST_SMALL ); +#endif // Populate list control with items for( auto& [filename, status] : filesToCommit ) diff --git a/eeschema/widgets/hierarchy_pane.cpp b/eeschema/widgets/hierarchy_pane.cpp index 99c411296f..4606445cc0 100644 --- a/eeschema/widgets/hierarchy_pane.cpp +++ b/eeschema/widgets/hierarchy_pane.cpp @@ -80,6 +80,13 @@ HIERARCHY_PANE::HIERARCHY_PANE( SCH_EDIT_FRAME* aParent ) : SetSizer( sizer ); m_tree = new HIERARCHY_TREE( this ); +#ifdef __WXMAC__ + // HiDPI-aware API; will be generally available in wxWidgets 3.4 + wxVector images; + images.push_back( KiBitmapBundle( BITMAPS::tree_nosel ) ); + images.push_back( KiBitmapBundle( BITMAPS::tree_sel ) ); + m_tree->SetImages( images ); +#else // Make an image list containing small icons // All icons are expected having the same size. wxBitmap tree_nosel_bm( KiBitmap( BITMAPS::tree_nosel ) ); @@ -90,6 +97,7 @@ HIERARCHY_PANE::HIERARCHY_PANE( SCH_EDIT_FRAME* aParent ) : imageList->Add( KiBitmap( BITMAPS::tree_sel ) ); m_tree->AssignImageList( imageList ); +#endif sizer->Add( m_tree, 1, wxEXPAND, wxBORDER_NONE, 0 );