Move the menu helpers to ui_common instead of sitting in bitmap for some reason

This commit is contained in:
Marek Roszko 2023-10-16 19:40:46 -04:00
parent ba83e84b91
commit 584757f2df
12 changed files with 225 additions and 218 deletions

View File

@ -210,69 +210,3 @@ wxBitmap* KiBitmapNew( BITMAPS aBitmap )
return bitmap;
}
void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage )
{
// Retrieve the global application show icon option:
bool useImagesInMenus = Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus;
wxItemKind menu_type = aMenu->GetKind();
if( useImagesInMenus && menu_type != wxITEM_CHECK && menu_type != wxITEM_RADIO )
{
aMenu->SetBitmap( aImage );
}
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, wxEmptyString, aType );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage,
wxItemKind aType = wxITEM_NORMAL )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxBitmap& aImage )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText );
item->SetSubMenu( aSubMenu );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxString& aHelpText,
const wxBitmap& aImage )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText );
item->SetSubMenu( aSubMenu );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}

View File

@ -292,13 +292,13 @@ void PANEL_COLOR_SETTINGS::ShowColorContextMenu( wxMouseEvent& aEvent, int aLaye
wxMenu menu;
AddMenuItem( &menu, ID_COPY, _( "Copy color" ), KiBitmap( BITMAPS::copy ) );
KIUI::AddMenuItem( &menu, ID_COPY, _( "Copy color" ), KiBitmap( BITMAPS::copy ) );
if( !readOnly && m_copied != COLOR4D::UNSPECIFIED )
AddMenuItem( &menu, ID_PASTE, _( "Paste color" ), KiBitmap( BITMAPS::paste ) );
KIUI::AddMenuItem( &menu, ID_PASTE, _( "Paste color" ), KiBitmap( BITMAPS::paste ) );
if( !readOnly && current != saved )
AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ), KiBitmap( BITMAPS::undo ) );
KIUI::AddMenuItem( &menu, ID_REVERT, _( "Revert to saved color" ), KiBitmap( BITMAPS::undo ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
[&]( wxCommandEvent& aCmd )

View File

@ -40,6 +40,7 @@
#include <wx/stc/stc.h>
#include <textentry_tricks.h>
#include <wx/listctrl.h>
#include <widgets/ui_common.h>
using namespace std::placeholders;
@ -128,7 +129,7 @@ void ACTION_MENU::DisplayTitle( bool aDisplay )
Insert( 0, new wxMenuItem( this, wxID_NONE, m_title, wxEmptyString, wxITEM_NORMAL ) );
if( !!m_icon )
AddBitmapToMenuItem( FindItemByPosition( 0 ), KiBitmap( m_icon ) );
KIUI::AddBitmapToMenuItem( FindItemByPosition( 0 ), KiBitmap( m_icon ) );
m_titleDisplayed = true;
}
@ -143,7 +144,7 @@ wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, int aId, BITMAPS aIcon )
wxMenuItem* item = new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL );
if( !!aIcon )
AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
KIUI::AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
return Append( item );
}
@ -158,7 +159,7 @@ wxMenuItem* ACTION_MENU::Add( const wxString& aLabel, const wxString& aTooltip,
aIsCheckmarkEntry ? wxITEM_CHECK : wxITEM_NORMAL );
if( !!aIcon )
AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
KIUI::AddBitmapToMenuItem( item, KiBitmap( aIcon ) );
return Append( item );
}
@ -177,7 +178,7 @@ wxMenuItem* ACTION_MENU::Add( const TOOL_ACTION& aAction, bool aIsCheckmarkEntry
aAction.GetTooltip(),
aIsCheckmarkEntry ? wxITEM_CHECK : wxITEM_NORMAL );
if( !!icon )
AddBitmapToMenuItem( item, KiBitmap( icon ) );
KIUI::AddBitmapToMenuItem( item, KiBitmap( icon ) );
m_toolActions[aAction.GetUIId()] = &aAction;
@ -194,7 +195,7 @@ wxMenuItem* ACTION_MENU::Add( ACTION_MENU* aMenu )
if( !!aMenu->m_icon )
{
wxMenuItem* newItem = new wxMenuItem( this, -1, aMenu->m_title );
AddBitmapToMenuItem( newItem, KiBitmap( aMenu->m_icon ) );
KIUI::AddBitmapToMenuItem( newItem, KiBitmap( aMenu->m_icon ) );
newItem->SetSubMenu( aMenu );
return Append( newItem );
}
@ -658,7 +659,7 @@ wxMenuItem* ACTION_MENU::appendCopy( const wxMenuItem* aSource )
#endif
if( src_bitmap.IsOk() && src_bitmap.GetHeight() > 1 ) // a null bitmap has a 0 size
AddBitmapToMenuItem( newItem, src_bitmap );
KIUI::AddBitmapToMenuItem( newItem, src_bitmap );
if( aSource->IsSubMenu() )
{

View File

@ -28,6 +28,7 @@
#include <tool/action_menu.h>
#include <menus_helpers.h>
#include <kiface_base.h>
#include <widgets/ui_common.h>
CONDITIONAL_MENU::CONDITIONAL_MENU( TOOL_INTERACTIVE* aTool ) :
@ -67,7 +68,7 @@ void CONDITIONAL_MENU::AddItem( int aId, const wxString& aText, const wxString&
wxMenuItem item( nullptr, aId, aText, aTooltip, wxITEM_NORMAL );
if( !!aIcon )
AddBitmapToMenuItem( &item, KiBitmap( aIcon ) );
KIUI::AddBitmapToMenuItem( &item, KiBitmap( aIcon ) );
addEntry( ENTRY( item, aIcon, aCondition, aOrder, false ) );
}
@ -80,7 +81,7 @@ void CONDITIONAL_MENU::AddCheckItem( int aId, const wxString& aText, const wxStr
wxMenuItem item( nullptr, aId, aText, aTooltip, wxITEM_CHECK );
if( !!aIcon )
AddBitmapToMenuItem( &item, KiBitmap( aIcon ) );
KIUI::AddBitmapToMenuItem( &item, KiBitmap( aIcon ) );
addEntry( ENTRY( item, aIcon, aCondition, aOrder, true ) );
}
@ -170,7 +171,7 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
entry.wxItem()->GetKind() );
if( !!entry.GetIcon() )
AddBitmapToMenuItem( menuItem, KiBitmap( entry.GetIcon() ) );
KIUI::AddBitmapToMenuItem( menuItem, KiBitmap( entry.GetIcon() ) );
// the wxMenuItem must be append only after the bitmap is set:
Append( menuItem );

View File

@ -359,3 +359,67 @@ void KIUI::Disable( wxWindow* aWindow )
Disable( child );
}
}
void KIUI::AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage )
{
// Retrieve the global application show icon option:
bool useImagesInMenus = Pgm().GetCommonSettings()->m_Appearance.use_icons_in_menus;
wxItemKind menu_type = aMenu->GetKind();
if( useImagesInMenus && menu_type != wxITEM_CHECK && menu_type != wxITEM_RADIO )
{
aMenu->SetBitmap( aImage );
}
}
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxBitmap& aImage,
wxItemKind aType )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, wxEmptyString, aType );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxString& aHelpText,
const wxBitmap& aImage, wxItemKind aType )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText, aType );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxBitmap& aImage )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText );
item->SetSubMenu( aSubMenu );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}
wxMenuItem* KIUI::AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage )
{
wxMenuItem* item = new wxMenuItem( aMenu, aId, aText, aHelpText );
item->SetSubMenu( aSubMenu );
AddBitmapToMenuItem( item, aImage );
aMenu->Append( item );
return item;
}

View File

@ -158,42 +158,43 @@ void GERBER_LAYER_WIDGET::ReFillRender()
void GERBER_LAYER_WIDGET::AddRightClickMenuItems( wxMenu* aMenu )
{
// Remember: menu text is capitalized (see our rules_for_capitalization_in_Kicad_UI.txt)
AddMenuItem( aMenu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
KiBitmap( BITMAPS::show_all_layers ) );
KIUI::AddMenuItem( aMenu, ID_SHOW_ALL_LAYERS, _( "Show All Layers" ),
KiBitmap( BITMAPS::show_all_layers ) );
AddMenuItem( aMenu, ID_SHOW_NO_LAYERS_BUT_ACTIVE,
_( "Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
KIUI::AddMenuItem( aMenu, ID_SHOW_NO_LAYERS_BUT_ACTIVE, _( "Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
AddMenuItem( aMenu, ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE,
_( "Always Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
KIUI::AddMenuItem( aMenu, ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE,
_( "Always Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
AddMenuItem( aMenu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
KiBitmap( BITMAPS::show_no_layers ) );
KIUI::AddMenuItem( aMenu, ID_SHOW_NO_LAYERS, _( "Hide All Layers" ),
KiBitmap( BITMAPS::show_no_layers ) );
aMenu->AppendSeparator();
AddMenuItem( aMenu, ID_SORT_GBR_LAYERS_X2, _( "Sort Layers if X2 Mode" ),
KiBitmap( BITMAPS::reload ) );
KIUI::AddMenuItem( aMenu, ID_SORT_GBR_LAYERS_X2, _( "Sort Layers if X2 Mode" ),
KiBitmap( BITMAPS::reload ) );
AddMenuItem( aMenu, ID_SORT_GBR_LAYERS_FILE_EXT, _( "Sort Layers by File Extension" ),
KiBitmap( BITMAPS::reload ) );
KIUI::AddMenuItem( aMenu, ID_SORT_GBR_LAYERS_FILE_EXT, _( "Sort Layers by File Extension" ),
KiBitmap( BITMAPS::reload ) );
aMenu->AppendSeparator();
AddMenuItem( aMenu, ID_SET_GBR_LAYERS_DRAW_PRMS, _( "Layers Display Parameters: Offset and Rotation" ),
KiBitmap( BITMAPS::tools ) );
KIUI::AddMenuItem( aMenu, ID_SET_GBR_LAYERS_DRAW_PRMS,
_( "Layers Display Parameters: Offset and Rotation" ),
KiBitmap( BITMAPS::tools ) );
aMenu->AppendSeparator();
AddMenuItem( aMenu, ID_LAYER_MOVE_UP, _( "Move Current Layer Up" ), KiBitmap( BITMAPS::up ) );
KIUI::AddMenuItem( aMenu, ID_LAYER_MOVE_UP, _( "Move Current Layer Up" ),
KiBitmap( BITMAPS::up ) );
AddMenuItem( aMenu, ID_LAYER_MOVE_DOWN, _( "Move Current Layer Down" ),
KiBitmap( BITMAPS::down ) );
KIUI::AddMenuItem( aMenu, ID_LAYER_MOVE_DOWN, _( "Move Current Layer Down" ),
KiBitmap( BITMAPS::down ) );
AddMenuItem( aMenu, ID_LAYER_DELETE, _( "Clear Current Layer..." ),
KiBitmap( BITMAPS::delete_gerber ) );
KIUI::AddMenuItem( aMenu, ID_LAYER_DELETE, _( "Clear Current Layer..." ),
KiBitmap( BITMAPS::delete_gerber ) );
}

View File

@ -126,9 +126,9 @@ void LAYER_WIDGET::OnRightDownLayer( wxMouseEvent& aEvent, COLOR_SWATCH* aColorS
{
wxMenu menu;
AddMenuItem( &menu, ID_CHANGE_LAYER_COLOR,
_( "Change Layer Color for" ) + wxS( " " ) + aLayerName,
KiBitmap( BITMAPS::color_materials ) );
KIUI::AddMenuItem( &menu, ID_CHANGE_LAYER_COLOR,
_( "Change Layer Color for" ) + wxS( " " ) + aLayerName,
KiBitmap( BITMAPS::color_materials ) );
menu.AppendSeparator();
OnLayerRightClick( menu );
@ -182,9 +182,9 @@ void LAYER_WIDGET::OnRightDownRender( wxMouseEvent& aEvent, COLOR_SWATCH* aColor
{
wxMenu menu;
AddMenuItem( &menu, ID_CHANGE_RENDER_COLOR,
_( "Change Render Color for" ) + wxS( " " )+ aRenderName,
KiBitmap( BITMAPS::color_materials ) );
KIUI::AddMenuItem( &menu, ID_CHANGE_RENDER_COLOR,
_( "Change Render Color for" ) + wxS( " " )+ aRenderName,
KiBitmap( BITMAPS::color_materials ) );
menu.Bind( wxEVT_COMMAND_MENU_SELECTED,
[aColorSwatch]( wxCommandEvent& event )

View File

@ -38,77 +38,4 @@ class TOOL_INTERACTIVE;
void AddMenuLanguageList( ACTION_MENU* aMasterMenu, TOOL_INTERACTIVE* aControlTool );
/**
* Add a bitmap to a menuitem.
*
* It is added only if use images in menus config option allows it. For wxITEM_CHECK
* or wxITEM_RADIO menuitems, the bitmap is added only on Windows, other platforms do
* not support it
*
* @param aMenu is the menuitem.
* @param aImage is the icon to add to aMenu.
*/
void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage );
/**
* Create and insert a menu item with an icon into \a aMenu.
*
* @param aMenu is the menu to add the new item.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL );
/**
* Create and insert a menu item with an icon and a help message string into \a aMenu.
*
* @param aMenu is the menu to add the new item.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aHelpText is the help message string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage,
wxItemKind aType = wxITEM_NORMAL );
/**
* Create and insert a menu item with an icon into \a aSubMenu in \a aMenu.
*
* @param aMenu is the menu to add the new submenu item.
* @param aSubMenu is the submenu to add the new menu.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem,
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxBitmap& aImage );
/**
* Create and insert a menu item with an icon and a help message string into
* \a aSubMenu in \a aMenu.
*
* @param aMenu is the menu to add the new submenu item.
* @param aSubMenu is the submenu to add the new menu.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aHelpText is the help message string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId,
const wxString& aText, const wxString& aHelpText,
const wxBitmap& aImage );
#endif // MENUS_HELPERS_H_

View File

@ -34,6 +34,8 @@ class wxSize;
class wxTextCtrl;
class wxTextEntry;
class wxWindow;
class wxMenuItem;
class wxMenu;
/**
* Used for holding indeterminate values, such as with multiple selections
@ -125,6 +127,77 @@ void Disable( wxWindow* aWindow );
extern const wxString s_FocusStealableInputName;
/**
* Add a bitmap to a menuitem.
*
* It is added only if use images in menus config option allows it. For wxITEM_CHECK
* or wxITEM_RADIO menuitems, the bitmap is added only on Windows, other platforms do
* not support it
*
* @param aMenu is the menuitem.
* @param aImage is the icon to add to aMenu.
*/
void AddBitmapToMenuItem( wxMenuItem* aMenu, const wxBitmap& aImage );
/**
* Create and insert a menu item with an icon into \a aMenu.
*
* @param aMenu is the menu to add the new item.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxBitmap& aImage,
wxItemKind aType = wxITEM_NORMAL );
/**
* Create and insert a menu item with an icon and a help message string into \a aMenu.
*
* @param aMenu is the menu to add the new item.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aHelpText is the help message string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @param aType is the type of menu :wxITEM_NORMAL (default), wxITEM_CHECK ...
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, int aId, const wxString& aText, const wxString& aHelpText,
const wxBitmap& aImage, wxItemKind aType = wxITEM_NORMAL );
/**
* Create and insert a menu item with an icon into \a aSubMenu in \a aMenu.
*
* @param aMenu is the menu to add the new submenu item.
* @param aSubMenu is the submenu to add the new menu.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem,
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxBitmap& aImage );
/**
* Create and insert a menu item with an icon and a help message string into
* \a aSubMenu in \a aMenu.
*
* @param aMenu is the menu to add the new submenu item.
* @param aSubMenu is the submenu to add the new menu.
* @param aId is the command ID for the new menu item.
* @param aText is the string for the new menu item.
* @param aHelpText is the help message string for the new menu item.
* @param aImage is the icon to add to the new menu item.
* @return a pointer to the new created wxMenuItem.
*/
wxMenuItem* AddMenuItem( wxMenu* aMenu, wxMenu* aSubMenu, int aId, const wxString& aText,
const wxString& aHelpText, const wxBitmap& aImage );
}
SEVERITY SeverityFromString( const wxString& aSeverity );

View File

@ -678,17 +678,16 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
if( can_switch_to_project )
{
AddMenuItem( &popup_menu, ID_PROJECT_SWITCH_TO_OTHER,
_( "Switch to this Project" ),
_( "Close all editors, and switch to the selected project" ),
KiBitmap( BITMAPS::open_project ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_SWITCH_TO_OTHER, _( "Switch to this Project" ),
_( "Close all editors, and switch to the selected project" ),
KiBitmap( BITMAPS::open_project ) );
popup_menu.AppendSeparator();
}
if( can_create_new_directory )
{
AddMenuItem( &popup_menu, ID_PROJECT_NEWDIR, _( "New Directory..." ),
_( "Create a New Directory" ), KiBitmap( BITMAPS::directory ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_NEWDIR, _( "New Directory..." ),
_( "Create a New Directory" ), KiBitmap( BITMAPS::directory ) );
}
if( can_open_this_directory )
@ -714,8 +713,8 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
#endif
}
AddMenuItem( &popup_menu, ID_PROJECT_OPEN_DIR, text, help_text,
KiBitmap( BITMAPS::directory_browser ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_OPEN_DIR, text, help_text,
KiBitmap( BITMAPS::directory_browser ) );
}
if( can_edit )
@ -725,8 +724,8 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
else
help_text = _( "Open files in a Text Editor" );
AddMenuItem( &popup_menu, ID_PROJECT_TXTEDIT, _( "Edit in a Text Editor" ),
help_text, KiBitmap( BITMAPS::editor ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_TXTEDIT, _( "Edit in a Text Editor" ), help_text,
KiBitmap( BITMAPS::editor ) );
}
if( can_rename )
@ -742,7 +741,8 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
help_text = _( "Rename files" );
}
AddMenuItem( &popup_menu, ID_PROJECT_RENAME, text, help_text, KiBitmap( BITMAPS::right ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_RENAME, text, help_text,
KiBitmap( BITMAPS::right ) );
}
if( can_delete )
@ -762,11 +762,11 @@ void PROJECT_TREE_PANE::onRight( wxTreeEvent& Event )
}
#ifdef __WINDOWS__
AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Delete" ), help_text,
KiBitmap( BITMAPS::trash ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Delete" ), help_text,
KiBitmap( BITMAPS::trash ) );
#else
AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Move to Trash" ), help_text,
KiBitmap( BITMAPS::trash ) );
KIUI::AddMenuItem( &popup_menu, ID_PROJECT_DELETE, _( "Move to Trash" ), help_text,
KiBitmap( BITMAPS::trash ) );
#endif
}

View File

@ -482,7 +482,8 @@ void PCB_EDIT_FRAME::buildActionPluginMenus( ACTION_MENU* actionMenu )
const wxBitmap& bitmap = ap->iconBitmap.IsOk() ? ap->iconBitmap :
KiBitmap( BITMAPS::puzzle_piece );
item = AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(), bitmap );
item = KIUI::AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(),
bitmap );
Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
wxCommandEventHandler( PCB_EDIT_FRAME::OnActionPluginMenu ) );

View File

@ -1796,52 +1796,57 @@ void APPEARANCE_CONTROLS::rebuildLayerContextMenu()
delete m_layerContextMenu;
m_layerContextMenu = new wxMenu;
AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_COPPER_LAYERS, _( "Show All Copper Layers" ),
KiBitmap( BITMAPS::show_all_copper_layers ) );
AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_COPPER_LAYERS, _( "Hide All Copper Layers" ),
KiBitmap( BITMAPS::show_no_copper_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_COPPER_LAYERS, _( "Show All Copper Layers" ),
KiBitmap( BITMAPS::show_all_copper_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_COPPER_LAYERS, _( "Hide All Copper Layers" ),
KiBitmap( BITMAPS::show_no_copper_layers ) );
m_layerContextMenu->AppendSeparator();
AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_BUT_ACTIVE, _( "Hide All Layers But Active" ),
KiBitmap( BITMAPS::select_w_layer ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_BUT_ACTIVE,
_( "Hide All Layers But Active" ), KiBitmap( BITMAPS::select_w_layer ) );
m_layerContextMenu->AppendSeparator();
AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_NON_COPPER, _( "Show All Non Copper Layers" ),
KiBitmap( BITMAPS::show_no_copper_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_SHOW_ALL_NON_COPPER,
_( "Show All Non Copper Layers" ),
KiBitmap( BITMAPS::show_no_copper_layers ) );
AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_NON_COPPER, _( "Hide All Non Copper Layers" ),
KiBitmap( BITMAPS::show_all_copper_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_HIDE_ALL_NON_COPPER,
_( "Hide All Non Copper Layers" ),
KiBitmap( BITMAPS::show_all_copper_layers ) );
m_layerContextMenu->AppendSeparator();
AddMenuItem( m_layerContextMenu, ID_PRESET_ALL_LAYERS, _( "Show All Layers" ),
KiBitmap( BITMAPS::show_all_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_ALL_LAYERS, _( "Show All Layers" ),
KiBitmap( BITMAPS::show_all_layers ) );
AddMenuItem( m_layerContextMenu, ID_PRESET_NO_LAYERS, _( "Hide All Layers" ),
KiBitmap( BITMAPS::show_no_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_NO_LAYERS, _( "Hide All Layers" ),
KiBitmap( BITMAPS::show_no_layers ) );
m_layerContextMenu->AppendSeparator();
AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT_ASSEMBLY, _( "Show Only Front Assembly Layers" ),
KiBitmap( BITMAPS::show_front_assembly_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT_ASSEMBLY,
_( "Show Only Front Assembly Layers" ),
KiBitmap( BITMAPS::show_front_assembly_layers ) );
AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT, _( "Show Only Front Layers" ),
KiBitmap( BITMAPS::show_all_front_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_FRONT, _( "Show Only Front Layers" ),
KiBitmap( BITMAPS::show_all_front_layers ) );
// Only show the internal layer option if internal layers are enabled
if( m_frame->GetBoard()->GetCopperLayerCount() > 2 )
{
AddMenuItem( m_layerContextMenu, ID_PRESET_INNER_COPPER, _( "Show Only Inner Layers" ),
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_INNER_COPPER,
_( "Show Only Inner Layers" ),
KiBitmap( BITMAPS::show_all_copper_layers ) );
}
AddMenuItem( m_layerContextMenu, ID_PRESET_BACK, _( "Show Only Back Layers" ),
KiBitmap( BITMAPS::show_all_back_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_BACK, _( "Show Only Back Layers" ),
KiBitmap( BITMAPS::show_all_back_layers ) );
AddMenuItem( m_layerContextMenu, ID_PRESET_BACK_ASSEMBLY, _( "Show Only Back Assembly Layers" ),
KiBitmap( BITMAPS::show_back_assembly_layers ) );
KIUI::AddMenuItem( m_layerContextMenu, ID_PRESET_BACK_ASSEMBLY,
_( "Show Only Back Assembly Layers" ),
KiBitmap( BITMAPS::show_back_assembly_layers ) );
}