Commit b1cd83c1 authored by Maciej Suminski's avatar Maciej Suminski

Icons in GAL context menus.

parent 6083f3b0
...@@ -26,14 +26,14 @@ ...@@ -26,14 +26,14 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tool_interactive.h> #include <tool/tool_interactive.h>
#include <tool/context_menu.h> #include <tool/context_menu.h>
#include <boost/bind.hpp> #include <boost/bind.hpp>
#include <cassert> #include <cassert>
CONTEXT_MENU::CONTEXT_MENU() : CONTEXT_MENU::CONTEXT_MENU() :
m_titleSet( false ), m_selected( -1 ), m_tool( NULL ) m_titleSet( false ), m_selected( -1 ), m_tool( NULL ), m_icon( NULL )
{ {
setCustomEventHandler( boost::bind( &CONTEXT_MENU::handleCustomEvent, this, _1 ) ); setCustomEventHandler( boost::bind( &CONTEXT_MENU::handleCustomEvent, this, _1 ) );
setupEvents(); setupEvents();
} }
...@@ -42,31 +42,7 @@ CONTEXT_MENU::CONTEXT_MENU( const CONTEXT_MENU& aMenu ) : ...@@ -42,31 +42,7 @@ CONTEXT_MENU::CONTEXT_MENU( const CONTEXT_MENU& aMenu ) :
m_titleSet( aMenu.m_titleSet ), m_selected( -1 ), m_tool( aMenu.m_tool ), m_titleSet( aMenu.m_titleSet ), m_selected( -1 ), m_tool( aMenu.m_tool ),
m_toolActions( aMenu.m_toolActions ), m_customHandler( aMenu.m_customHandler ) m_toolActions( aMenu.m_toolActions ), m_customHandler( aMenu.m_customHandler )
{ {
// Copy all the menu entries copyFrom( aMenu );
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i )
{
wxMenuItem* item = aMenu.FindItemByPosition( i );
if( item->IsSubMenu() )
{
#ifdef DEBUG
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
assert( dynamic_cast<CONTEXT_MENU*>( item->GetSubMenu() ) );
#endif
CONTEXT_MENU* menu = new CONTEXT_MENU( static_cast<const CONTEXT_MENU&>( *item->GetSubMenu() ) );
AppendSubMenu( menu, item->GetItemLabel(), wxEmptyString );
}
else
{
wxMenuItem* newItem = new wxMenuItem( this, item->GetId(), item->GetItemLabel(),
wxEmptyString, item->GetKind() );
Append( newItem );
copyItem( item, newItem );
}
}
setupEvents(); setupEvents();
} }
...@@ -81,31 +57,7 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu ) ...@@ -81,31 +57,7 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
m_toolActions = aMenu.m_toolActions; m_toolActions = aMenu.m_toolActions;
m_customHandler = aMenu.m_customHandler; m_customHandler = aMenu.m_customHandler;
// Copy all the menu entries copyFrom( aMenu );
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i )
{
wxMenuItem* item = aMenu.FindItemByPosition( i );
if( item->IsSubMenu() )
{
#ifdef DEBUG
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
assert( dynamic_cast<CONTEXT_MENU*>( item->GetSubMenu() ) );
#endif
CONTEXT_MENU* menu = new CONTEXT_MENU( static_cast<const CONTEXT_MENU&>( *item->GetSubMenu() ) );
AppendSubMenu( menu, item->GetItemLabel(), wxEmptyString );
}
else
{
wxMenuItem* newItem = new wxMenuItem( this, item->GetId(), item->GetItemLabel(),
wxEmptyString, item->GetKind() );
Append( newItem );
copyItem( item, newItem );
}
}
setupEvents(); setupEvents();
return *this; return *this;
...@@ -138,7 +90,7 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle ) ...@@ -138,7 +90,7 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle )
} }
void CONTEXT_MENU::Add( const wxString& aLabel, int aId ) void CONTEXT_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon )
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -146,7 +98,12 @@ void CONTEXT_MENU::Add( const wxString& aLabel, int aId ) ...@@ -146,7 +98,12 @@ void CONTEXT_MENU::Add( const wxString& aLabel, int aId )
wxLogWarning( wxT( "Adding more than one menu entry with the same ID may result in" wxLogWarning( wxT( "Adding more than one menu entry with the same ID may result in"
"undefined behaviour" ) ); "undefined behaviour" ) );
#endif #endif
Append( new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL ) ); wxMenuItem* item = new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL );
if( aIcon )
item->SetBitmap( KiBitmap( aIcon ) );
Append( item );
} }
...@@ -154,10 +111,14 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction ) ...@@ -154,10 +111,14 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
{ {
/// ID numbers for tool actions need to have a value higher than m_actionId /// ID numbers for tool actions need to have a value higher than m_actionId
int id = m_actionId + aAction.GetId(); int id = m_actionId + aAction.GetId();
const BITMAP_OPAQUE* icon = aAction.GetIcon();
wxMenuItem* item = new wxMenuItem( this, id, wxMenuItem* item = new wxMenuItem( this, id,
aAction.GetMenuItem(), aAction.GetDescription(), wxITEM_NORMAL ); aAction.GetMenuItem(), aAction.GetDescription(), wxITEM_NORMAL );
if( icon )
item->SetBitmap( KiBitmap( icon ) );
if( aAction.HasHotKey() ) if( aAction.HasHotKey() )
{ {
int key = aAction.GetHotKey() & ~MD_MODIFIER_MASK; int key = aAction.GetHotKey() & ~MD_MODIFIER_MASK;
...@@ -180,6 +141,22 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction ) ...@@ -180,6 +141,22 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
} }
void CONTEXT_MENU::Add( CONTEXT_MENU* aMenu, const wxString& aLabel )
{
if( aMenu->m_icon )
{
wxMenuItem* newItem = new wxMenuItem( this, -1, aLabel, wxEmptyString, wxITEM_NORMAL );
newItem->SetBitmap( KiBitmap( aMenu->m_icon ) );
newItem->SetSubMenu( aMenu );
Append( newItem );
}
else
{
AppendSubMenu( aMenu, aLabel );
}
}
void CONTEXT_MENU::Clear() void CONTEXT_MENU::Clear()
{ {
m_titleSet = false; m_titleSet = false;
...@@ -277,7 +254,39 @@ void CONTEXT_MENU::copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) cons ...@@ -277,7 +254,39 @@ void CONTEXT_MENU::copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) cons
if( aSource->IsCheckable() ) if( aSource->IsCheckable() )
aDest->Check( aSource->IsChecked() ); aDest->Check( aSource->IsChecked() );
}
if( aSource->GetKind() == wxITEM_NORMAL )
aDest->SetBitmap( aSource->GetBitmap() ); void CONTEXT_MENU::copyFrom( const CONTEXT_MENU& aMenu )
{
m_icon = aMenu.m_icon;
// Copy all the menu entries
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i )
{
wxMenuItem* item = aMenu.FindItemByPosition( i );
wxMenuItem* newItem = new wxMenuItem( this, item->GetId(), item->GetItemLabel(),
item->GetHelp(), item->GetKind() );
if( item->GetKind() == wxITEM_NORMAL )
newItem->SetBitmap( item->GetBitmap() );
if( item->IsSubMenu() )
{
#ifdef DEBUG
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
assert( dynamic_cast<CONTEXT_MENU*>( item->GetSubMenu() ) );
#endif
CONTEXT_MENU* menu = new CONTEXT_MENU( static_cast<const CONTEXT_MENU&>( *item->GetSubMenu() ) );
newItem->SetSubMenu( menu );
Append( newItem );
}
else
{
Append( newItem );
copyItem( item, newItem );
}
}
} }
...@@ -59,14 +59,25 @@ public: ...@@ -59,14 +59,25 @@ public:
*/ */
void SetTitle( const wxString& aTitle ); void SetTitle( const wxString& aTitle );
/**
* Function SetIcon()
* Assigns an icon for the entry.
* @param aIcon is the icon to be assigned. NULL is used to remove icon.
*/
void SetIcon( const BITMAP_OPAQUE* aIcon )
{
m_icon = aIcon;
}
/** /**
* Function Add() * Function Add()
* Adds an entry to the menu. After highlighting/selecting the entry, a TOOL_EVENT command is * Adds an entry to the menu. After highlighting/selecting the entry, a TOOL_EVENT command is
* sent that contains ID of the entry. * sent that contains ID of the entry.
* @param aLabel is the text label show in the menu. * @param aLabel is the text label show in the menu.
* @param aId is the ID that is sent in the TOOL_EVENT. It should be unique for every entry. * @param aId is the ID that is sent in the TOOL_EVENT. It should be unique for every entry.
* @param aIcon is an optional icon.
*/ */
void Add( const wxString& aLabel, int aId ); void Add( const wxString& aLabel, int aId, const BITMAP_OPAQUE* aIcon = NULL );
/** /**
* Function Add() * Function Add()
...@@ -76,6 +87,15 @@ public: ...@@ -76,6 +87,15 @@ public:
*/ */
void Add( const TOOL_ACTION& aAction ); void Add( const TOOL_ACTION& aAction );
/**
* Function Add()
* Adds a context menu as a submenu. The difference between this function and wxMenu::AppendSubMenu()
* is the capability to handle icons.
* @param aMenu is the submenu to be added.
* @param aLabel is the caption displayed for the menu entry.
*/
void Add( CONTEXT_MENU* aMenu, const wxString& aLabel );
/** /**
* Function Clear() * Function Clear()
* Removes all the entries from the menu (as well as its title). It leaves the menu in the * Removes all the entries from the menu (as well as its title). It leaves the menu in the
...@@ -112,6 +132,9 @@ private: ...@@ -112,6 +132,9 @@ private:
*/ */
void copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) const; void copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) const;
///> Common part of copy constructor and assignment operator.
void copyFrom( const CONTEXT_MENU& aMenu );
///> Initializes handlers for events. ///> Initializes handlers for events.
void setupEvents(); void setupEvents();
...@@ -146,6 +169,9 @@ private: ...@@ -146,6 +169,9 @@ private:
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs. /// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
boost::function<OPT_TOOL_EVENT(const wxMenuEvent& aEvent)> m_customHandler; boost::function<OPT_TOOL_EVENT(const wxMenuEvent& aEvent)> m_customHandler;
/// Optional icon
const BITMAP_OPAQUE* m_icon;
friend class TOOL_INTERACTIVE; friend class TOOL_INTERACTIVE;
}; };
......
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
struct BITMAP_OPAQUE;
/** /**
* Class TOOL_ACTION * Class TOOL_ACTION
* *
...@@ -46,10 +48,11 @@ class TOOL_ACTION ...@@ -46,10 +48,11 @@ class TOOL_ACTION
public: public:
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT, TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
int aDefaultHotKey = 0, const wxString aMenuItem = wxEmptyString, int aDefaultHotKey = 0, const wxString aMenuItem = wxEmptyString,
const wxString& aMenuDesc = wxEmptyString, TOOL_ACTION_FLAGS aFlags = AF_NONE ) : const wxString& aMenuDesc = wxEmptyString, const BITMAP_OPAQUE* aIcon = NULL,
TOOL_ACTION_FLAGS aFlags = AF_NONE ) :
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ), m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ), m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ),
m_menuDescription( aMenuDesc ), m_id( -1 ), m_flags( aFlags ) m_menuDescription( aMenuDesc ), m_icon( aIcon ), m_id( -1 ), m_flags( aFlags )
{ {
TOOL_MANAGER::GetActionList().push_back( this ); TOOL_MANAGER::GetActionList().push_back( this );
} }
...@@ -202,6 +205,14 @@ public: ...@@ -202,6 +205,14 @@ public:
return m_flags & AF_NOTIFY; return m_flags & AF_NOTIFY;
} }
/**
* Returns an icon associated with the action. It is used in context menu.
*/
const BITMAP_OPAQUE* GetIcon() const
{
return m_icon;
}
private: private:
friend class ACTION_MANAGER; friend class ACTION_MANAGER;
...@@ -224,7 +235,7 @@ private: ...@@ -224,7 +235,7 @@ private:
wxString m_menuDescription; wxString m_menuDescription;
// Icon for menu entry // Icon for menu entry
// KiBitmap m_bitmap; const BITMAP_OPAQUE* m_icon;
/// Unique ID for fast matching. Assigned by ACTION_MANAGER. /// Unique ID for fast matching. Assigned by ACTION_MANAGER.
int m_id; int m_id;
......
...@@ -57,7 +57,7 @@ using boost::optional; ...@@ -57,7 +57,7 @@ using boost::optional;
static TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", static TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack",
AS_CONTEXT, 'X', AS_CONTEXT, 'X',
_( "New Track" ), _( "Starts laying a new track." ) ); _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
static TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", static TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack",
AS_CONTEXT, WXK_END, AS_CONTEXT, WXK_END,
...@@ -69,7 +69,7 @@ static TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", ...@@ -69,7 +69,7 @@ static TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute",
static TOOL_ACTION ACT_Drag( "pcbnew.InteractiveRouter.Drag", static TOOL_ACTION ACT_Drag( "pcbnew.InteractiveRouter.Drag",
AS_CONTEXT, 'G', AS_CONTEXT, 'G',
_( "Drag Track/Via" ), _( "Drags a track or a via." ) ); _( "Drag Track/Via" ), _( "Drags a track or a via." ), drag_track_segment_xpm );
static TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia", static TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia",
AS_CONTEXT, 'V', AS_CONTEXT, 'V',
...@@ -93,7 +93,8 @@ static TOOL_ACTION ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions", ...@@ -93,7 +93,8 @@ static TOOL_ACTION ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
static TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", static TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture",
AS_CONTEXT, '/', AS_CONTEXT, '/',
_( "Switch Track Posture" ), _( "Switches posture of the currenly routed track." ) ); _( "Switch Track Posture" ), _( "Switches posture of the currenly routed track." ),
change_entry_orient_xpm );
static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions", static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions",
AS_CONTEXT, 'D', AS_CONTEXT, 'D',
...@@ -143,14 +144,22 @@ public: ...@@ -143,14 +144,22 @@ public:
wxString msg; wxString msg;
m_board = aBoard; m_board = aBoard;
Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ), wxMenuItem* custom_width = new wxMenu( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
wxEmptyString, wxITEM_CHECK ); _( "Allows to specify any track/via size" ), wxITEM_CHECK );
//custom->SetBitmap(); // TODO missing icon
Append( custom_width );
Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Use the starting track width" ), wxMenuItem* auto_width = new wxMenu( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
_( "Route using the width of the starting track." ), wxITEM_CHECK ); _( "Use the starting track width" ),
_( "Route using the width of the starting track" ), wxITEM_CHECK );
auto_width->SetBitmap( KiBitmap( auto_track_width_xpm ) );
Append( auto_width );
Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, _( "Use netclass values" ), wxMenuItem* net_width = new wxMenu( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use netclass values" ),
_( "Use track and via sizes from the net class" ), wxITEM_CHECK ); _( "Use track and via sizes from the net class" ), wxITEM_CHECK );
//net_width->SetBitmap(); // TODO missing icon
Append( net_width );
for( unsigned i = 0; i < bds.m_TrackWidthList.size(); i++ ) for( unsigned i = 0; i < bds.m_TrackWidthList.size(); i++ )
{ {
......
...@@ -53,19 +53,19 @@ using namespace KIGFX; ...@@ -53,19 +53,19 @@ using namespace KIGFX;
using boost::optional; using boost::optional;
static TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT, 'X', static TOOL_ACTION ACT_NewTrack( "pcbnew.InteractiveRouter.NewTrack", AS_CONTEXT, 'X',
_( "New Track" ), _( "Starts laying a new track." ) ); _( "New Track" ), _( "Starts laying a new track." ), add_tracks_xpm );
static TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END, static TOOL_ACTION ACT_EndTrack( "pcbnew.InteractiveRouter.EndTrack", AS_CONTEXT, WXK_END,
_( "End Track" ), _( "Stops laying the current track." ) ); _( "End Track" ), _( "Stops laying the current track." ), checked_ok_xpm );
static TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F', static TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute", AS_CONTEXT, 'F',
_( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) ); _( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
static TOOL_ACTION ACT_Drag( "pcbnew.InteractiveRouter.Drag", AS_CONTEXT, 'G', static TOOL_ACTION ACT_Drag( "pcbnew.InteractiveRouter.Drag", AS_CONTEXT, 'G',
_( "Drag Track/Via" ), _( "Drags a track or a via." ) ); _( "Drag Track/Via" ), _( "Drags a track or a via." ), drag_track_segment_xpm );
static TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia", AS_CONTEXT, 'V', static TOOL_ACTION ACT_PlaceThroughVia( "pcbnew.InteractiveRouter.PlaceVia", AS_CONTEXT, 'V',
_( "Place Through Via" ), _( "Adds a through-hole via at the end of currently routed track." ) ); _( "Place Through Via" ), _( "Adds a through-hole via at the end of currently routed track." ), via_xpm );
static TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, 'Z', static TOOL_ACTION ACT_PlaceBlindVia( "pcbnew.InteractiveRouter.PlaceBlindVia", AS_CONTEXT, 'Z',
_( "Place Blind/Buried Via" ), _( "Adds a blind or buried via at the end of currently routed track." ) ); _( "Place Blind/Buried Via" ), _( "Adds a blind or buried via at the end of currently routed track." ) );
...@@ -77,7 +77,7 @@ static TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackWi ...@@ -77,7 +77,7 @@ static TOOL_ACTION ACT_CustomTrackWidth( "pcbnew.InteractiveRouter.CustomTrackWi
_( "Custom Track Width" ), _( "Shows a dialog for changing the track width and via size." ) ); _( "Custom Track Width" ), _( "Shows a dialog for changing the track width and via size." ) );
static TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT, '/', static TOOL_ACTION ACT_SwitchPosture( "pcbnew.InteractiveRouter.SwitchPosture", AS_CONTEXT, '/',
_( "Switch Track Posture" ), _( "Switches posture of the currenly routed track." ) ); _( "Switch Track Posture" ), _( "Switches posture of the currenly routed track." ), change_entry_orient_xpm );
static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions", AS_CONTEXT, 'D', static TOOL_ACTION ACT_SetDpDimensions( "pcbnew.InteractiveRouter.SetDpDimensions", AS_CONTEXT, 'D',
_( "Differential Pair Dimensions..." ), _( "Sets the width and gap of the currently routed differential pair." ) ); _( "Differential Pair Dimensions..." ), _( "Sets the width and gap of the currently routed differential pair." ) );
...@@ -94,6 +94,7 @@ class CONTEXT_TRACK_WIDTH_MENU: public CONTEXT_MENU ...@@ -94,6 +94,7 @@ class CONTEXT_TRACK_WIDTH_MENU: public CONTEXT_MENU
public: public:
CONTEXT_TRACK_WIDTH_MENU() CONTEXT_TRACK_WIDTH_MENU()
{ {
SetIcon( width_track_via_xpm );
setCustomEventHandler( boost::bind( &CONTEXT_TRACK_WIDTH_MENU::handleCustomEvent, setCustomEventHandler( boost::bind( &CONTEXT_TRACK_WIDTH_MENU::handleCustomEvent,
this, _1 ) ); this, _1 ) );
} }
...@@ -224,7 +225,7 @@ public: ...@@ -224,7 +225,7 @@ public:
CONTEXT_TRACK_WIDTH_MENU* trackMenu = new CONTEXT_TRACK_WIDTH_MENU; CONTEXT_TRACK_WIDTH_MENU* trackMenu = new CONTEXT_TRACK_WIDTH_MENU;
trackMenu->SetBoard( aBoard ); trackMenu->SetBoard( aBoard );
AppendSubMenu( trackMenu, _( "Select Track Width" ) ); Add( trackMenu, _( "Select Track/Via Width" ) );
Add( ACT_CustomTrackWidth ); Add( ACT_CustomTrackWidth );
......
This diff is collapsed.
...@@ -47,6 +47,7 @@ class ZONE_CONTEXT_MENU : public CONTEXT_MENU ...@@ -47,6 +47,7 @@ class ZONE_CONTEXT_MENU : public CONTEXT_MENU
public: public:
ZONE_CONTEXT_MENU() ZONE_CONTEXT_MENU()
{ {
SetIcon( add_zone_xpm );
Add( COMMON_ACTIONS::zoneFill ); Add( COMMON_ACTIONS::zoneFill );
Add( COMMON_ACTIONS::zoneFillAll ); Add( COMMON_ACTIONS::zoneFillAll );
Add( COMMON_ACTIONS::zoneUnfill ); Add( COMMON_ACTIONS::zoneUnfill );
......
...@@ -251,9 +251,10 @@ void SELECTION_TOOL::AddMenuItem( const TOOL_ACTION& aAction, const SELECTION_CO ...@@ -251,9 +251,10 @@ void SELECTION_TOOL::AddMenuItem( const TOOL_ACTION& aAction, const SELECTION_CO
} }
void SELECTION_TOOL::AddSubMenu( CONTEXT_MENU* aMenu, const wxString& aLabel, const SELECTION_CONDITION& aCondition ) void SELECTION_TOOL::AddSubMenu( CONTEXT_MENU* aMenu, const wxString& aLabel,
const SELECTION_CONDITION& aCondition )
{ {
m_menu.AppendSubMenu( aMenu, aLabel ); m_menu.Add( aMenu, aLabel );
m_menuConditions.push_back( aCondition ); m_menuConditions.push_back( aCondition );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment