Icons in GAL context menus.
This commit is contained in:
parent
6083f3b011
commit
b1cd83c197
|
@ -26,14 +26,14 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/context_menu.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <cassert>
|
||||
|
||||
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 ) );
|
||||
|
||||
setupEvents();
|
||||
}
|
||||
|
||||
|
@ -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_toolActions( aMenu.m_toolActions ), m_customHandler( aMenu.m_customHandler )
|
||||
{
|
||||
// Copy all the menu entries
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
copyFrom( aMenu );
|
||||
setupEvents();
|
||||
}
|
||||
|
||||
|
@ -81,31 +57,7 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
|
|||
m_toolActions = aMenu.m_toolActions;
|
||||
m_customHandler = aMenu.m_customHandler;
|
||||
|
||||
// Copy all the menu entries
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
copyFrom( aMenu );
|
||||
setupEvents();
|
||||
|
||||
return *this;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
"undefined behaviour" ) );
|
||||
#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 )
|
|||
{
|
||||
/// ID numbers for tool actions need to have a value higher than m_actionId
|
||||
int id = m_actionId + aAction.GetId();
|
||||
const BITMAP_OPAQUE* icon = aAction.GetIcon();
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( this, id,
|
||||
aAction.GetMenuItem(), aAction.GetDescription(), wxITEM_NORMAL );
|
||||
|
||||
if( icon )
|
||||
item->SetBitmap( KiBitmap( icon ) );
|
||||
|
||||
if( aAction.HasHotKey() )
|
||||
{
|
||||
int key = aAction.GetHotKey() & ~MD_MODIFIER_MASK;
|
||||
|
@ -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()
|
||||
{
|
||||
m_titleSet = false;
|
||||
|
@ -277,7 +254,39 @@ void CONTEXT_MENU::copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) cons
|
|||
|
||||
if( aSource->IsCheckable() )
|
||||
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:
|
|||
*/
|
||||
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()
|
||||
* Adds an entry to the menu. After highlighting/selecting the entry, a TOOL_EVENT command is
|
||||
* sent that contains ID of the entry.
|
||||
* @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 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()
|
||||
|
@ -76,6 +87,15 @@ public:
|
|||
*/
|
||||
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()
|
||||
* Removes all the entries from the menu (as well as its title). It leaves the menu in the
|
||||
|
@ -112,6 +132,9 @@ private:
|
|||
*/
|
||||
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.
|
||||
void setupEvents();
|
||||
|
||||
|
@ -146,6 +169,9 @@ private:
|
|||
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
|
||||
boost::function<OPT_TOOL_EVENT(const wxMenuEvent& aEvent)> m_customHandler;
|
||||
|
||||
/// Optional icon
|
||||
const BITMAP_OPAQUE* m_icon;
|
||||
|
||||
friend class TOOL_INTERACTIVE;
|
||||
};
|
||||
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include <tool/tool_manager.h>
|
||||
|
||||
struct BITMAP_OPAQUE;
|
||||
|
||||
/**
|
||||
* Class TOOL_ACTION
|
||||
*
|
||||
|
@ -46,10 +48,11 @@ class TOOL_ACTION
|
|||
public:
|
||||
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
|
||||
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_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 );
|
||||
}
|
||||
|
@ -202,6 +205,14 @@ public:
|
|||
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:
|
||||
friend class ACTION_MANAGER;
|
||||
|
||||
|
@ -224,7 +235,7 @@ private:
|
|||
wxString m_menuDescription;
|
||||
|
||||
// Icon for menu entry
|
||||
// KiBitmap m_bitmap;
|
||||
const BITMAP_OPAQUE* m_icon;
|
||||
|
||||
/// Unique ID for fast matching. Assigned by ACTION_MANAGER.
|
||||
int m_id;
|
||||
|
|
|
@ -57,7 +57,7 @@ using boost::optional;
|
|||
|
||||
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,
|
||||
|
@ -69,7 +69,7 @@ static TOOL_ACTION ACT_AutoEndRoute( "pcbnew.InteractiveRouter.AutoEndRoute",
|
|||
|
||||
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',
|
||||
|
@ -93,7 +93,8 @@ static TOOL_ACTION ACT_RouterOptions( "pcbnew.InteractiveRouter.RouterOptions",
|
|||
|
||||
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',
|
||||
|
@ -143,14 +144,22 @@ public:
|
|||
wxString msg;
|
||||
m_board = aBoard;
|
||||
|
||||
Append( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
|
||||
wxEmptyString, wxITEM_CHECK );
|
||||
wxMenuItem* custom_width = new wxMenu( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH, _( "Custom size" ),
|
||||
_( "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" ),
|
||||
_( "Route using the width of the starting track." ), wxITEM_CHECK );
|
||||
wxMenuItem* auto_width = new wxMenu( ID_POPUP_PCB_SELECT_AUTO_WIDTH,
|
||||
_( "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 );
|
||||
//net_width->SetBitmap(); // TODO missing icon
|
||||
Append( net_width );
|
||||
|
||||
for( unsigned i = 0; i < bds.m_TrackWidthList.size(); i++ )
|
||||
{
|
||||
|
|
|
@ -53,19 +53,19 @@ using namespace KIGFX;
|
|||
using boost::optional;
|
||||
|
||||
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,
|
||||
_( "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',
|
||||
_( "Auto-end Track" ), _( "Automagically finishes currently routed track." ) );
|
||||
|
||||
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',
|
||||
_( "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',
|
||||
_( "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
|
|||
_( "Custom Track Width" ), _( "Shows a dialog for changing the track width and via size." ) );
|
||||
|
||||
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',
|
||||
_( "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
|
|||
public:
|
||||
CONTEXT_TRACK_WIDTH_MENU()
|
||||
{
|
||||
SetIcon( width_track_via_xpm );
|
||||
setCustomEventHandler( boost::bind( &CONTEXT_TRACK_WIDTH_MENU::handleCustomEvent,
|
||||
this, _1 ) );
|
||||
}
|
||||
|
@ -224,7 +225,7 @@ public:
|
|||
|
||||
CONTEXT_TRACK_WIDTH_MENU* trackMenu = new CONTEXT_TRACK_WIDTH_MENU;
|
||||
trackMenu->SetBoard( aBoard );
|
||||
AppendSubMenu( trackMenu, _( "Select Track Width" ) );
|
||||
Add( trackMenu, _( "Select Track/Via Width" ) );
|
||||
|
||||
Add( ACT_CustomTrackWidth );
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
// Selection tool actions
|
||||
TOOL_ACTION COMMON_ACTIONS::selectionActivate( "pcbnew.InteractiveSelection",
|
||||
AS_GLOBAL, 0,
|
||||
"", "", AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
|
||||
"", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::selectionCursor( "pcbnew.InteractiveSelection.Cursor",
|
||||
AS_GLOBAL, 0,
|
||||
|
@ -58,7 +58,7 @@ TOOL_ACTION COMMON_ACTIONS::selectNet( "pcbnew.InteractiveSelection.SelectNet",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::find( "pcbnew.InteractiveSelection.Find",
|
||||
AS_GLOBAL, 0, // it is handled by wxWidgets hotkey system
|
||||
_( "Find an item" ), _( "Searches the document for an item" ) );
|
||||
_( "Find an item" ), _( "Searches the document for an item" ), find_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::findDummy( "pcbnew.Find.Dummy", // only block the hotkey
|
||||
AS_GLOBAL, MD_CTRL + int( 'F' ) );
|
||||
|
@ -70,14 +70,15 @@ TOOL_ACTION COMMON_ACTIONS::findMove( "pcbnew.InteractiveSelection.FindMove",
|
|||
TOOL_ACTION COMMON_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
|
||||
AS_CONTEXT, MD_CTRL + 'E',
|
||||
_( "Open in Footprint Editor" ),
|
||||
_( "Opens the selected footprint in the Footprint Editor" ) );
|
||||
_( "Opens the selected footprint in the Footprint Editor" ),
|
||||
module_editor_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::copyPadToSettings ( "pcbnew.InteractiveEdit.copyPadToSettings",
|
||||
TOOL_ACTION COMMON_ACTIONS::copyPadToSettings( "pcbnew.InteractiveEdit.copyPadToSettings",
|
||||
AS_CONTEXT, 0,
|
||||
_( "Copy pad settings to Current Settings" ),
|
||||
_( "Copies the properties of selected pad to the current template pad settings." ) );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::copySettingsToPads ( "pcbnew.InteractiveEdit.copySettingsToPads",
|
||||
TOOL_ACTION COMMON_ACTIONS::copySettingsToPads( "pcbnew.InteractiveEdit.copySettingsToPads",
|
||||
AS_CONTEXT, 0,
|
||||
_( "Copy Current Settings to pads" ),
|
||||
_( "Copies the current template pad settings to the selected pad(s)." ) );
|
||||
|
@ -85,15 +86,15 @@ TOOL_ACTION COMMON_ACTIONS::copySettingsToPads ( "pcbnew.InteractiveEdit.copySet
|
|||
TOOL_ACTION COMMON_ACTIONS::globalEditPads ( "pcbnew.InteractiveEdit.globalPadEdit",
|
||||
AS_CONTEXT, 0,
|
||||
_( "Global Pad Edition" ),
|
||||
_( "Changes pad properties globally." ) );
|
||||
_( "Changes pad properties globally." ), global_options_pad_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::editActivate( "pcbnew.InteractiveEdit",
|
||||
AS_GLOBAL, 'M',
|
||||
_( "Move" ), _( "Moves the selected item(s)" ), AF_ACTIVATE );
|
||||
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::duplicate( "pcbnew.InteractiveEdit.duplicate",
|
||||
AS_GLOBAL, MD_CTRL + int( 'D' ),
|
||||
_( "Duplicate" ), _( "Duplicates the selected item(s)" ) );
|
||||
_( "Duplicate" ), _( "Duplicates the selected item(s)" ), duplicate_module_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicateIncrementPads",
|
||||
AS_GLOBAL, MD_CTRL + MD_SHIFT + int( 'D' ),
|
||||
|
@ -101,66 +102,67 @@ TOOL_ACTION COMMON_ACTIONS::duplicateIncrement( "pcbnew.InteractiveEdit.duplicat
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::moveExact( "pcbnew.InteractiveEdit.moveExact",
|
||||
AS_GLOBAL, MD_CTRL + int( 'M' ),
|
||||
_( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ) );
|
||||
_( "Move Exactly..." ), _( "Moves the selected item(s) by an exact amount" ),
|
||||
move_module_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::createArray( "pcbnew.InteractiveEdit.createArray",
|
||||
AS_GLOBAL, MD_CTRL + int( 'N' ),
|
||||
_( "Create array" ), _( "Create array" ), AF_ACTIVATE );
|
||||
_( "Create array" ), _( "Create array" ), array_module_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::rotate( "pcbnew.InteractiveEdit.rotate",
|
||||
AS_GLOBAL, 'R',
|
||||
_( "Rotate" ), _( "Rotates selected item(s)" ) );
|
||||
_( "Rotate" ), _( "Rotates selected item(s)" ), rotate_cw_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
|
||||
AS_GLOBAL, 'F',
|
||||
_( "Flip" ), _( "Flips selected item(s)" ) );
|
||||
_( "Flip" ), _( "Flips selected item(s)" ), swap_layer_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::remove( "pcbnew.InteractiveEdit.remove",
|
||||
AS_GLOBAL, WXK_DELETE,
|
||||
_( "Remove" ), _( "Deletes selected item(s)" ) );
|
||||
_( "Remove" ), _( "Deletes selected item(s)" ), delete_track_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
|
||||
AS_GLOBAL, 'E',
|
||||
_( "Properties..." ), _( "Displays properties window" ) );
|
||||
_( "Properties..." ), _( "Displays properties window" ), editor_xpm );
|
||||
|
||||
|
||||
// Drawing tool actions
|
||||
TOOL_ACTION COMMON_ACTIONS::drawLine( "pcbnew.InteractiveDrawing.line",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Draw a line" ), _( "Draw a line" ), AF_ACTIVATE );
|
||||
_( "Draw a line" ), _( "Draw a line" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::drawCircle( "pcbnew.InteractiveDrawing.circle",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Draw a circle" ), _( "Draw a circle" ), AF_ACTIVATE );
|
||||
_( "Draw a circle" ), _( "Draw a circle" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::drawArc( "pcbnew.InteractiveDrawing.arc",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Draw an arc" ), _( "Draw an arc" ), AF_ACTIVATE );
|
||||
_( "Draw an arc" ), _( "Draw an arc" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::placeText( "pcbnew.InteractiveDrawing.text",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add a text" ), _( "Add a text" ), AF_ACTIVATE );
|
||||
_( "Add a text" ), _( "Add a text" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::drawDimension( "pcbnew.InteractiveDrawing.dimension",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add a dimension" ), _( "Add a dimension" ), AF_ACTIVATE );
|
||||
_( "Add a dimension" ), _( "Add a dimension" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::drawZone( "pcbnew.InteractiveDrawing.zone",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add a filled zone" ), _( "Add a filled zone" ), AF_ACTIVATE );
|
||||
_( "Add a filled zone" ), _( "Add a filled zone" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::drawKeepout( "pcbnew.InteractiveDrawing.keepout",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add a keepout area" ), _( "Add a keepout area" ), AF_ACTIVATE );
|
||||
_( "Add a keepout area" ), _( "Add a keepout area" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::placeDXF( "pcbnew.InteractiveDrawing.placeDXF",
|
||||
AS_GLOBAL, 0,
|
||||
"", "", AF_ACTIVATE );
|
||||
"", "", NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Place the footprint anchor" ), _( "Place the footprint anchor" ),
|
||||
AF_ACTIVATE );
|
||||
NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::incWidth( "pcbnew.InteractiveDrawing.incWidth",
|
||||
AS_CONTEXT, '+',
|
||||
|
@ -290,7 +292,7 @@ TOOL_ACTION COMMON_ACTIONS::layerAlphaDec( "pcbnew.Control.layerAlphaDec",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
|
||||
AS_GLOBAL, 0,
|
||||
"", "", AF_NOTIFY );
|
||||
"", "", NULL, AF_NOTIFY );
|
||||
|
||||
|
||||
// Grid control
|
||||
|
@ -334,13 +336,13 @@ TOOL_ACTION COMMON_ACTIONS::viaSizeDec( "pcbnew.EditorControl.viaSizeDec",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::trackViaSizeChanged( "pcbnew.EditorControl.trackViaSizeChanged",
|
||||
AS_GLOBAL, 0,
|
||||
"", "", AF_NOTIFY );
|
||||
"", "", NULL, AF_NOTIFY );
|
||||
|
||||
|
||||
// Zone actions
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneFill( "pcbnew.EditorControl.zoneFill",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Fill" ), _( "Fill zone(s)" ) );
|
||||
_( "Fill" ), _( "Fill zone(s)" ), fill_zone_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
|
||||
AS_GLOBAL, int( 'B' ),
|
||||
|
@ -348,7 +350,7 @@ TOOL_ACTION COMMON_ACTIONS::zoneFillAll( "pcbnew.EditorControl.zoneFillAll",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneUnfill( "pcbnew.EditorControl.zoneUnfill",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Unfill" ), _( "Unfill zone(s)" ) );
|
||||
_( "Unfill" ), _( "Unfill zone(s)" ), zone_unfill_xpm );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
|
||||
AS_GLOBAL, int( 'N' ),
|
||||
|
@ -357,29 +359,29 @@ TOOL_ACTION COMMON_ACTIONS::zoneUnfillAll( "pcbnew.EditorControl.zoneUnfillAll",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::placeTarget( "pcbnew.EditorControl.placeTarget",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add layer alignment target" ), _( "Add layer alignment target" ), AF_ACTIVATE );
|
||||
_( "Add layer alignment target" ), _( "Add layer alignment target" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::placeModule( "pcbnew.EditorControl.placeModule",
|
||||
AS_GLOBAL, 'O',
|
||||
_( "Add modules" ), _( "Add modules" ), AF_ACTIVATE );
|
||||
_( "Add modules" ), _( "Add modules" ), NULL, AF_ACTIVATE );
|
||||
|
||||
|
||||
// Module editor tools
|
||||
TOOL_ACTION COMMON_ACTIONS::placePad( "pcbnew.ModuleEditor.placePad",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Add pads" ), _( "Add pads" ), AF_ACTIVATE );
|
||||
_( "Add pads" ), _( "Add pads" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::enumeratePads( "pcbnew.ModuleEditor.enumeratePads",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Enumerate pads" ), _( "Enumerate pads" ), AF_ACTIVATE );
|
||||
_( "Enumerate pads" ), _( "Enumerate pads" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::copyItems( "pcbnew.ModuleEditor.copyItems",
|
||||
AS_GLOBAL, MD_CTRL + int( 'C' ),
|
||||
_( "Copy items" ), _( "Copy items" ), AF_ACTIVATE );
|
||||
_( "Copy items" ), _( "Copy items" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::pasteItems( "pcbnew.ModuleEditor.pasteItems",
|
||||
AS_GLOBAL, MD_CTRL + int( 'V' ),
|
||||
_( "Paste items" ), _( "Paste items" ), AF_ACTIVATE );
|
||||
_( "Paste items" ), _( "Paste items" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::moduleEdgeOutlines( "pcbnew.ModuleEditor.graphicOutlines",
|
||||
AS_GLOBAL, 0,
|
||||
|
@ -393,7 +395,7 @@ TOOL_ACTION COMMON_ACTIONS::moduleTextOutlines( "pcbnew.ModuleEditor.textOutline
|
|||
// Miscellaneous
|
||||
TOOL_ACTION COMMON_ACTIONS::selectionTool( "pcbnew.Control.selectionTool",
|
||||
AS_GLOBAL, 0,
|
||||
"", "", AF_ACTIVATE );
|
||||
"", "", NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::resetCoords( "pcbnew.Control.resetCoords",
|
||||
AS_GLOBAL, ' ',
|
||||
|
@ -419,36 +421,36 @@ TOOL_ACTION COMMON_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
|
|||
TOOL_ACTION COMMON_ACTIONS::routerActivateSingle( "pcbnew.InteractiveRouter.SingleTrack",
|
||||
AS_GLOBAL, 'X',
|
||||
_( "Run push & shove router (single tracks)" ),
|
||||
_( "Run push & shove router (single tracks)" ), AF_ACTIVATE );
|
||||
_( "Run push & shove router (single tracks)" ), ps_router_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffPair",
|
||||
AS_GLOBAL, '6',
|
||||
_( "Run push & shove router (differential pairs)" ),
|
||||
_( "Run push & shove router (differential pairs)" ), AF_ACTIVATE );
|
||||
_( "Run push & shove router (differential pairs)" ), ps_diff_pair_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Open Interactive Router settings" ),
|
||||
_( "Open Interactive Router settings" ), AF_ACTIVATE );
|
||||
_( "Open Interactive Router settings" ), NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Open Differential Pair Dimension settings" ),
|
||||
_( "Open Differential Pair Dimension settings" ), AF_ACTIVATE );
|
||||
_( "Open Differential Pair Dimension settings" ), ps_diff_pair_gap_xpm, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
|
||||
AS_GLOBAL, '7',
|
||||
_( "Tune length of a single track" ), "", AF_ACTIVATE );
|
||||
_( "Tune length of a single track" ), "", ps_tune_length_xpm, AF_ACTIVATE );
|
||||
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
|
||||
AS_GLOBAL, '8',
|
||||
_( "Tune length of a differential pair" ), "", AF_ACTIVATE );
|
||||
_( "Tune length of a differential pair" ), "", NULL, AF_ACTIVATE );
|
||||
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
|
||||
AS_GLOBAL, '9',
|
||||
_( "Tune skew of a differential pair" ), "", AF_ACTIVATE );
|
||||
_( "Tune skew of a differential pair" ), "", NULL, AF_ACTIVATE );
|
||||
|
||||
TOOL_ACTION COMMON_ACTIONS::routerInlineDrag( "pcbnew.InteractiveRouter.InlineDrag",
|
||||
AS_GLOBAL, 0,
|
||||
|
@ -461,7 +463,7 @@ TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
|
|||
|
||||
TOOL_ACTION COMMON_ACTIONS::pointEditorBreakOutline( "pcbnew.PointEditor.breakOutline",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Create corner" ), _( "Create corner" ) );
|
||||
_( "Create corner" ), _( "Create corner" ), add_corner_xpm );
|
||||
|
||||
// Placement tool
|
||||
TOOL_ACTION COMMON_ACTIONS::alignTop( "pcbnew.Place.alignTop",
|
||||
|
|
|
@ -47,6 +47,7 @@ class ZONE_CONTEXT_MENU : public CONTEXT_MENU
|
|||
public:
|
||||
ZONE_CONTEXT_MENU()
|
||||
{
|
||||
SetIcon( add_zone_xpm );
|
||||
Add( COMMON_ACTIONS::zoneFill );
|
||||
Add( COMMON_ACTIONS::zoneFillAll );
|
||||
Add( COMMON_ACTIONS::zoneUnfill );
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue