Switch gerview actions to new tool action arg constructors

This commit is contained in:
Ian McInerney 2023-07-12 22:58:48 +01:00
parent e82a58a12e
commit a98e25d4df
1 changed files with 214 additions and 154 deletions

View File

@ -18,10 +18,10 @@
* with this program. If not, see <http://www.gnu.org/licenses/>. * with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <tool/tool_manager.h>
#include <gerbview_id.h>
#include <bitmaps.h> #include <bitmaps.h>
#include "gerbview_actions.h" #include <tool/tool_action.h>
#include <tool/tool_manager.h>
#include <tools/gerbview_actions.h>
// Actions, being statically-defined, require specialized I18N handling. We continue to // Actions, being statically-defined, require specialized I18N handling. We continue to
@ -34,195 +34,255 @@
// GERBVIEW_CONTROL // GERBVIEW_CONTROL
// //
TOOL_ACTION GERBVIEW_ACTIONS::openAutodetected( "gerbview.Control.openAutodetected", TOOL_ACTION GERBVIEW_ACTIONS::openAutodetected( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.openAutodetected" )
_( "Open Autodetected File(s)..." ), .Scope( AS_GLOBAL )
_( "Open Autodetected file(s) on a new layer." ), .MenuText( _( "Open Autodetected File(s)..." ) )
BITMAPS::load_gerber ); .Tooltip( _( "Open Autodetected file(s) on a new layer." ) )
.Icon( BITMAPS::load_gerber ) );
TOOL_ACTION GERBVIEW_ACTIONS::openGerber( "gerbview.Control.openGerber", TOOL_ACTION GERBVIEW_ACTIONS::openGerber( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.openGerber" )
_( "Open Gerber Plot File(s)..." ), .Scope( AS_GLOBAL )
_( "Open Gerber plot file(s) on a new layer." ), .MenuText( _( "Open Gerber Plot File(s)..." ) )
BITMAPS::load_gerber ); .Tooltip( _( "Open Gerber plot file(s) on a new layer." ) )
.Icon( BITMAPS::load_gerber ) );
TOOL_ACTION GERBVIEW_ACTIONS::openDrillFile( "gerbview.Control.openDrillFile", TOOL_ACTION GERBVIEW_ACTIONS::openDrillFile( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.openDrillFile" )
_( "Open Excellon Drill File(s)..." ), .Scope( AS_GLOBAL )
_( "Open Excellon drill file(s) on a new layer." ), .MenuText( _( "Open Excellon Drill File(s)..." ) )
BITMAPS::load_drill ); .Tooltip( _( "Open Excellon drill file(s) on a new layer." ) )
.Icon( BITMAPS::load_drill ) );
TOOL_ACTION GERBVIEW_ACTIONS::openJobFile( "gerbview.Control.openJobFile", TOOL_ACTION GERBVIEW_ACTIONS::openJobFile( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.openJobFile" )
_( "Open Gerber Job File..." ), .Scope( AS_GLOBAL )
_( "Open a Gerber job file and its associated gerber plot files" ), .MenuText( _( "Open Gerber Job File..." ) )
BITMAPS::file_gerber_job ); .Tooltip( _( "Open a Gerber job file and its associated gerber plot files" ) )
.Icon( BITMAPS::file_gerber_job ) );
TOOL_ACTION GERBVIEW_ACTIONS::openZipFile( "gerbview.Control.openZipFile", TOOL_ACTION GERBVIEW_ACTIONS::openZipFile( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.openZipFile" )
_( "Open Zip Archive File..." ), .Scope( AS_GLOBAL )
_( "Open a zipped archive (Gerber and Drill) file" ), .MenuText( _( "Open Zip Archive File..." ) )
BITMAPS::zip ); .Tooltip( _( "Open a zipped archive (Gerber and Drill) file" ) )
.Icon( BITMAPS::zip ) );
TOOL_ACTION GERBVIEW_ACTIONS::toggleLayerManager( "gerbview.Control.toggleLayerManager", TOOL_ACTION GERBVIEW_ACTIONS::toggleLayerManager( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.toggleLayerManager" )
_( "Show Layers Manager" ), .Scope( AS_GLOBAL )
_( "Show or hide the layer manager" ), .MenuText( _( "Show Layers Manager" ) )
BITMAPS::layers_manager ); .Tooltip( _( "Show or hide the layer manager" ) )
.Icon( BITMAPS::layers_manager ) );
TOOL_ACTION GERBVIEW_ACTIONS::showDCodes( "gerbview.Inspection.showDCodes", TOOL_ACTION GERBVIEW_ACTIONS::showDCodes( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Inspection.showDCodes" )
_( "List DCodes..." ), .Scope( AS_GLOBAL )
_( "List D-codes defined in Gerber files" ), .MenuText( _( "List DCodes..." ) )
BITMAPS::show_dcodenumber ); .Tooltip( _( "List D-codes defined in Gerber files" ) )
.Icon( BITMAPS::show_dcodenumber ) );
TOOL_ACTION GERBVIEW_ACTIONS::showSource( "gerbview.Inspection.showSource", TOOL_ACTION GERBVIEW_ACTIONS::showSource( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Inspection.showSource" )
_( "Show Source..." ), .Scope( AS_GLOBAL )
_( "Show source file for the current layer" ), .MenuText( _( "Show Source..." ) )
BITMAPS::tools ); .Tooltip( _( "Show source file for the current layer" ) )
.Icon( BITMAPS::tools ) );
TOOL_ACTION GERBVIEW_ACTIONS::exportToPcbnew( "gerbview.Control.exportToPcbnew", TOOL_ACTION GERBVIEW_ACTIONS::exportToPcbnew( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.exportToPcbnew" )
_( "Export to PCB Editor..." ), .Scope( AS_GLOBAL )
_( "Export data as a KiCad PCB file" ), .MenuText( _( "Export to PCB Editor..." ) )
BITMAPS::export_to_pcbnew ); .Tooltip( _( "Export data as a KiCad PCB file" ) )
.Icon( BITMAPS::export_to_pcbnew ) );
TOOL_ACTION GERBVIEW_ACTIONS::clearLayer( "gerbview.Control.clearLayer", TOOL_ACTION GERBVIEW_ACTIONS::clearLayer( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.clearLayer" )
_( "Clear Current Layer..." ), _( "Clear the selected graphic layer" ), .Scope( AS_GLOBAL )
BITMAPS::delete_sheet ); .MenuText( _( "Clear Current Layer..." ) )
.Tooltip( _( "Clear the selected graphic layer" ) )
.Icon( BITMAPS::delete_sheet ) );
TOOL_ACTION GERBVIEW_ACTIONS::clearAllLayers( "gerbview.Control.clearAllLayers", TOOL_ACTION GERBVIEW_ACTIONS::clearAllLayers( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.clearAllLayers" )
_( "Clear All Layers" ), .Scope( AS_GLOBAL )
_( "Clear all layers. All data will be deleted" ), .MenuText( _( "Clear All Layers" ) )
BITMAPS::delete_gerber ); .Tooltip( _( "Clear all layers. All data will be deleted" ) )
.Icon( BITMAPS::delete_gerber ) );
TOOL_ACTION GERBVIEW_ACTIONS::reloadAllLayers( "gerbview.Control.reloadAllLayers", TOOL_ACTION GERBVIEW_ACTIONS::reloadAllLayers( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.reloadAllLayers" )
_( "Reload All Layers" ), .Scope( AS_GLOBAL )
_( "Reload all layers. All data will be reloaded" ), .MenuText( _( "Reload All Layers" ) )
BITMAPS::reload ); .Tooltip( _( "Reload all layers. All data will be reloaded" ) )
.Icon( BITMAPS::reload ) );
TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged", TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", "", "", .Name( "gerbview.Control.layerChanged" )
BITMAPS::INVALID_BITMAP, AF_NOTIFY ); .Scope( AS_GLOBAL )
.Flags( AF_NOTIFY ) );
TOOL_ACTION GERBVIEW_ACTIONS::highlightClear( "gerbview.Control.highlightClear", TOOL_ACTION GERBVIEW_ACTIONS::highlightClear( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.highlightClear" )
_( "Clear Highlight" ), _( "Clear Highlight" ), .Scope( AS_GLOBAL )
BITMAPS::cancel ); .MenuText( _( "Clear Highlight" ) )
.Tooltip( _( "Clear Highlight" ) )
.Icon( BITMAPS::cancel ) );
TOOL_ACTION GERBVIEW_ACTIONS::highlightNet( "gerbview.Control.highlightNet", TOOL_ACTION GERBVIEW_ACTIONS::highlightNet( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.highlightNet" )
_( "Highlight Net" ), _( "Highlight Net" ), .Scope( AS_GLOBAL )
BITMAPS::general_ratsnest ); .MenuText( _( "Highlight Net" ) )
.Tooltip( _( "Highlight Net" ) )
.Icon( BITMAPS::general_ratsnest ) );
TOOL_ACTION GERBVIEW_ACTIONS::highlightComponent( "gerbview.Control.highlightComponent", TOOL_ACTION GERBVIEW_ACTIONS::highlightComponent( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.highlightComponent" )
_( "Highlight Component" ), _( "Highlight Component" ), .Scope( AS_GLOBAL )
BITMAPS::module ); .MenuText( _( "Highlight Component" ) )
.Tooltip( _( "Highlight Component" ) )
.Icon( BITMAPS::module ) );
TOOL_ACTION GERBVIEW_ACTIONS::highlightAttribute( "gerbview.Control.highlightAttribute", TOOL_ACTION GERBVIEW_ACTIONS::highlightAttribute( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.highlightAttribute" )
_( "Highlight Attribute" ), _( "Highlight Attribute" ), .Scope( AS_GLOBAL )
BITMAPS::flag ); .MenuText( _( "Highlight Attribute" ) )
.Tooltip( _( "Highlight Attribute" ) )
.Icon( BITMAPS::flag ) );
TOOL_ACTION GERBVIEW_ACTIONS::highlightDCode( "gerbview.Control.highlightDCode", TOOL_ACTION GERBVIEW_ACTIONS::highlightDCode( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.highlightDCode" )
_( "Highlight DCode" ), _( "Highlight DCode" ), .Scope( AS_GLOBAL )
BITMAPS::show_dcodenumber ); .MenuText( _( "Highlight DCode" ) )
.Tooltip( _( "Highlight DCode" ) )
.Icon( BITMAPS::show_dcodenumber ) );
TOOL_ACTION GERBVIEW_ACTIONS::layerNext( "gerbview.Control.layerNext", TOOL_ACTION GERBVIEW_ACTIONS::layerNext( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.layerNext" )
WXK_PAGEDOWN, LEGACY_HK_NAME( "Switch to Next Layer" ), .Scope( AS_GLOBAL )
_( "Next Layer" ), _( "Next Layer" ) ); .DefaultHotkey( WXK_PAGEDOWN )
.LegacyHotkeyName( "Switch to Next Layer" )
.MenuText( _( "Next Layer" ) )
.Tooltip( _( "Next Layer" ) ) );
TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( "gerbview.Control.layerPrev", TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.layerPrev" )
WXK_PAGEUP, LEGACY_HK_NAME( "Switch to Previous Layer" ), .Scope( AS_GLOBAL )
_( "Previous Layer" ), _( "Previous Layer" ) ); .DefaultHotkey( WXK_PAGEUP )
.LegacyHotkeyName( "Switch to Previous Layer" )
.MenuText( _( "Previous Layer" ) )
.Tooltip( _( "Previous Layer" ) ) );
TOOL_ACTION GERBVIEW_ACTIONS::moveLayerUp( "gerbview.Control.moveLayerUp", TOOL_ACTION GERBVIEW_ACTIONS::moveLayerUp( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.moveLayerUp" )
'+', "", .Scope( AS_GLOBAL )
_( "Move Layer Up" ), _( "Move Current Layer Up" ), .DefaultHotkey( '+' )
BITMAPS::up ); .MenuText( _( "Move Layer Up" ) )
.Tooltip( _( "Move Current Layer up" ) )
.Icon( BITMAPS::up ) );
TOOL_ACTION GERBVIEW_ACTIONS::moveLayerDown( "gerbview.Control.moveLayerDown", TOOL_ACTION GERBVIEW_ACTIONS::moveLayerDown( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.moveLayerDown" )
'-', "", .Scope( AS_GLOBAL )
_( "Move Layer Down" ), _( "Move Current Layer Down" ), .DefaultHotkey( '-' )
BITMAPS::down ); .MenuText( _( "Move Layer Down" ) )
.Tooltip( _( "Move Current Layer Down" ) )
.Icon( BITMAPS::down ) );
TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( "gerbview.Control.linesDisplayOutlines", TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.linesDisplayOutlines" )
'L', LEGACY_HK_NAME( "Gbr Lines Display Mode" ), .Scope( AS_GLOBAL )
_( "Sketch Lines" ), _( "Show lines in outline mode" ), .DefaultHotkey( 'L' )
BITMAPS::showtrack ); .LegacyHotkeyName( "Gbr Lines Display Mode" )
.MenuText( _( "Sketch Lines" ) )
.Tooltip( _( "Show lines in outline mode" ) )
.Icon( BITMAPS::showtrack ) );
TOOL_ACTION GERBVIEW_ACTIONS::flashedDisplayOutlines( "gerbview.Control.flashedDisplayOutlines", TOOL_ACTION GERBVIEW_ACTIONS::flashedDisplayOutlines( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.flashedDisplayOutlines" )
'F', LEGACY_HK_NAME( "Gbr Flashed Display Mode" ), .Scope( AS_GLOBAL )
_( "Sketch Flashed Items" ), _( "Show flashed items in outline mode" ), .DefaultHotkey( 'F' )
BITMAPS::pad_sketch ); .LegacyHotkeyName( "Gbr Flashed Display Mode" )
.MenuText( _( "Sketch Flashed Items" ) )
.Tooltip( _( "Show flashed items in outline mode" ) )
.Icon( BITMAPS::pad_sketch ) );
TOOL_ACTION GERBVIEW_ACTIONS::polygonsDisplayOutlines( "gerbview.Control.polygonsDisplayOutlines", TOOL_ACTION GERBVIEW_ACTIONS::polygonsDisplayOutlines( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.polygonsDisplayOutlines" )
'P', LEGACY_HK_NAME( "Gbr Polygons Display Mode" ), .Scope( AS_GLOBAL )
_( "Sketch Polygons" ), _( "Show polygons in outline mode" ), .DefaultHotkey( 'P' )
BITMAPS::opt_show_polygon ); .LegacyHotkeyName( "Gbr Polygons Display Mode" )
.MenuText( _( "Sketch Polygons" ) )
.Tooltip( _( "Show polygons in outline mode" ) )
.Icon( BITMAPS::opt_show_polygon ) );
TOOL_ACTION GERBVIEW_ACTIONS::negativeObjectDisplay( "gerbview.Control.negativeObjectDisplay", TOOL_ACTION GERBVIEW_ACTIONS::negativeObjectDisplay( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.negativeObjectDisplay" )
'N', LEGACY_HK_NAME( "Gbr Negative Obj Display Mode" ), .Scope( AS_GLOBAL )
_( "Ghost Negative Objects" ), _( "Show negative objects in ghost color" ), .DefaultHotkey( 'N' )
BITMAPS::gerbview_show_negative_objects ); .LegacyHotkeyName( "Gbr Negative Obj Display Mode" )
.MenuText( _( "Ghost Negative Objects" ) )
.Tooltip( _( "Show negative objects in ghost color" ) )
.Icon( BITMAPS::gerbview_show_negative_objects ) );
TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay", TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( TOOL_ACTION_ARGS()
AS_GLOBAL, .Name( "gerbview.Control.dcodeDisplay" )
'D', LEGACY_HK_NAME( "DCodes Display Mode" ), .Scope( AS_GLOBAL )
_( "Show DCodes" ), _( "Show dcode number" ), .DefaultHotkey( 'D' )
BITMAPS::show_dcodenumber ); .LegacyHotkeyName( "DCodes Display Mode" )
.MenuText( _( "Show DCodes" ) )
.Tooltip( _( "Show dcode number" ) )
.Icon( BITMAPS::show_dcodenumber ) );
TOOL_ACTION GERBVIEW_ACTIONS::toggleDiffMode( "gerbview.Control.toggleDiffMode", TOOL_ACTION GERBVIEW_ACTIONS::toggleDiffMode( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.toggleDiffMode" )
_( "Show in Differential Mode" ), _( "Show layers in differential compare mode" ), .Scope( AS_GLOBAL )
BITMAPS::gbr_select_mode1 ); .MenuText( _( "Show in Differential Mode" ) )
.Tooltip( _( "Show layers in differential compare mode" ) )
.Icon( BITMAPS::gbr_select_mode1 ) );
TOOL_ACTION GERBVIEW_ACTIONS::toggleXORMode( "gerbview.Control.toggleXORMode", TOOL_ACTION GERBVIEW_ACTIONS::toggleXORMode( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.toggleXORMode" )
_( "Show in XOR Mode" ), _( "Show layers in exclusive-or compare mode" ), .Scope( AS_GLOBAL )
BITMAPS::gbr_select_mode2 ); .MenuText( _( "Show in XOR Mode" ) )
.Tooltip( _( "Show layers in exclusive-or compare mode" ) )
.Icon( BITMAPS::gbr_select_mode2 ) );
TOOL_ACTION GERBVIEW_ACTIONS::flipGerberView( "gerbview.Control.flipGerberView", TOOL_ACTION GERBVIEW_ACTIONS::flipGerberView( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.Control.flipGerberView" )
_( "Flip Gerber View" ), _( "Show as mirror image" ), .Scope( AS_GLOBAL )
BITMAPS::flip_board ); .MenuText( _( "Flip Gerber View" ) )
.Tooltip( _( "Show as mirror image" ) )
.Icon( BITMAPS::flip_board ) );
// GERBVIEW_SELECTION_TOOL // GERBVIEW_SELECTION_TOOL
// //
TOOL_ACTION GERBVIEW_ACTIONS::selectionActivate( "gerbview.InteractiveSelection", TOOL_ACTION GERBVIEW_ACTIONS::selectionActivate( TOOL_ACTION_ARGS()
AS_GLOBAL, 0, "", .Name( "gerbview.InteractiveSelection" )
"", "", // No description, it is not supposed to be shown anywhere .Scope( AS_GLOBAL )
BITMAPS::INVALID_BITMAP, AF_ACTIVATE ); .Flags( AF_ACTIVATE ) );
TOOL_ACTION GERBVIEW_ACTIONS::selectItem( "gerbview.InteractiveSelection.SelectItem", TOOL_ACTION GERBVIEW_ACTIONS::selectItem( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "gerbview.InteractiveSelection.SelectItem" )
.Scope( AS_GLOBAL ) );
TOOL_ACTION GERBVIEW_ACTIONS::unselectItem( "gerbview.InteractiveSelection.UnselectItem", TOOL_ACTION GERBVIEW_ACTIONS::unselectItem( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "gerbview.InteractiveSelection.UnselectItem" )
.Scope( AS_GLOBAL ) );
TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( "gerbview.InteractiveSelection.Clear", TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "gerbview.InteractiveSelection.Clear" )
.Scope( AS_GLOBAL ) );
// Drag and drop // Drag and drop
// //
TOOL_ACTION GERBVIEW_ACTIONS::loadZipFile( "gerbview.Control.loadZipFile", TOOL_ACTION GERBVIEW_ACTIONS::loadZipFile( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "gerbview.Control.loadZipFile" )
.Scope( AS_GLOBAL ) );
TOOL_ACTION GERBVIEW_ACTIONS::loadGerbFiles( "gerbview.Control.loadGerbFiles", TOOL_ACTION GERBVIEW_ACTIONS::loadGerbFiles( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "gerbview.Control.loadGerbFiles" )
.Scope( AS_GLOBAL ) );