Use bitmap bundles in launcher panel.

This commit is contained in:
Alex Shvartzkop 2024-05-26 07:55:24 +03:00
parent 1afbcb04db
commit eff4b899bb
1 changed files with 13 additions and 22 deletions

View File

@ -61,12 +61,12 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
wxFont helpFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); wxFont helpFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
helpFont.SetStyle( wxFONTSTYLE_ITALIC ); helpFont.SetStyle( wxFONTSTYLE_ITALIC );
auto addLauncher = auto addLauncher = [&]( const TOOL_ACTION& aAction, BITMAPS aBitmaps,
[&]( const TOOL_ACTION& aAction, const wxBitmap& aBitmap, const wxString& aHelpText, bool enabled = true ) const wxString& aHelpText, bool enabled = true )
{ {
BITMAP_BUTTON* btn = new BITMAP_BUTTON( this, wxID_ANY ); BITMAP_BUTTON* btn = new BITMAP_BUTTON( this, wxID_ANY );
btn->SetBitmap( aBitmap ); btn->SetBitmap( KiBitmapBundle( aBitmaps ) );
btn->SetDisabledBitmap( wxBitmap( aBitmap.ConvertToImage().ConvertToGreyscale() ) ); btn->SetDisabledBitmap( KiDisabledBitmapBundle( aBitmaps ) );
btn->SetPadding( 5 ); btn->SetPadding( 5 );
btn->SetToolTip( aAction.GetTooltip() ); btn->SetToolTip( aAction.GetTooltip() );
@ -125,42 +125,33 @@ void PANEL_KICAD_LAUNCHER::CreateLaunchers()
return btn; return btn;
}; };
addLauncher( KICAD_MANAGER_ACTIONS::editSchematic, addLauncher( KICAD_MANAGER_ACTIONS::editSchematic, BITMAPS::icon_eeschema,
KiScaledBitmap( BITMAPS::icon_eeschema, this, 48, true ),
_( "Edit the project schematic" ) ); _( "Edit the project schematic" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editSymbols, addLauncher( KICAD_MANAGER_ACTIONS::editSymbols, BITMAPS::icon_libedit,
KiScaledBitmap( BITMAPS::icon_libedit, this, 48, true ),
_( "Edit global and/or project schematic symbol libraries" ) ); _( "Edit global and/or project schematic symbol libraries" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editPCB, addLauncher( KICAD_MANAGER_ACTIONS::editPCB, BITMAPS::icon_pcbnew,
KiScaledBitmap( BITMAPS::icon_pcbnew, this, 48, true ),
_( "Edit the project PCB design" ) ); _( "Edit the project PCB design" ) );
addLauncher( KICAD_MANAGER_ACTIONS::editFootprints, addLauncher( KICAD_MANAGER_ACTIONS::editFootprints, BITMAPS::icon_modedit,
KiScaledBitmap( BITMAPS::icon_modedit, this, 48, true ),
_( "Edit global and/or project PCB footprint libraries" ) ); _( "Edit global and/or project PCB footprint libraries" ) );
addLauncher( KICAD_MANAGER_ACTIONS::viewGerbers, addLauncher( KICAD_MANAGER_ACTIONS::viewGerbers, BITMAPS::icon_gerbview,
KiScaledBitmap( BITMAPS::icon_gerbview, this, 48, true ),
_( "Preview Gerber files" ) ); _( "Preview Gerber files" ) );
addLauncher( KICAD_MANAGER_ACTIONS::convertImage, addLauncher( KICAD_MANAGER_ACTIONS::convertImage, BITMAPS::icon_bitmap2component,
KiScaledBitmap( BITMAPS::icon_bitmap2component, this, 48, true ),
_( "Convert bitmap images to schematic symbols or PCB footprints" ) ); _( "Convert bitmap images to schematic symbols or PCB footprints" ) );
addLauncher( KICAD_MANAGER_ACTIONS::showCalculator, addLauncher( KICAD_MANAGER_ACTIONS::showCalculator, BITMAPS::icon_pcbcalculator,
KiScaledBitmap( BITMAPS::icon_pcbcalculator, this, 48, true ),
_( "Show tools for calculating resistance, current capacity, etc." ) ); _( "Show tools for calculating resistance, current capacity, etc." ) );
addLauncher( KICAD_MANAGER_ACTIONS::editDrawingSheet, addLauncher( KICAD_MANAGER_ACTIONS::editDrawingSheet, BITMAPS::icon_pagelayout_editor,
KiScaledBitmap( BITMAPS::icon_pagelayout_editor, this, 48, true ),
_( "Edit drawing sheet borders and title blocks for use in schematics and PCB " _( "Edit drawing sheet borders and title blocks for use in schematics and PCB "
"designs" ) ); "designs" ) );
BITMAP_BUTTON* bb = BITMAP_BUTTON* bb =
addLauncher( KICAD_MANAGER_ACTIONS::showPluginManager, addLauncher( KICAD_MANAGER_ACTIONS::showPluginManager, BITMAPS::icon_pcm,
KiScaledBitmap( BITMAPS::icon_pcm, this, 48, true ),
_( "Manage downloadable packages from KiCad and 3rd party repositories" ), _( "Manage downloadable packages from KiCad and 3rd party repositories" ),
( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM ) ( KIPLATFORM::POLICY::GetPolicyBool( POLICY_KEY_PCM )
!= KIPLATFORM::POLICY::PBOOL::DISABLED ) ); != KIPLATFORM::POLICY::PBOOL::DISABLED ) );