Gerbview: change shortcuts for next/prev layer, add for move layer
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/11909
This commit is contained in:
parent
be7104c24c
commit
23a4b1001f
|
@ -136,14 +136,26 @@ TOOL_ACTION GERBVIEW_ACTIONS::highlightDCode( "gerbview.Control.highlightDCode",
|
|||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::layerNext( "gerbview.Control.layerNext",
|
||||
AS_GLOBAL,
|
||||
'+', LEGACY_HK_NAME( "Switch to Next Layer" ),
|
||||
WXK_PAGEDOWN, LEGACY_HK_NAME( "Switch to Next Layer" ),
|
||||
_( "Next Layer" ), _( "Next Layer" ) );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( "gerbview.Control.layerPrev",
|
||||
AS_GLOBAL,
|
||||
'-', LEGACY_HK_NAME( "Switch to Previous Layer" ),
|
||||
WXK_PAGEUP, LEGACY_HK_NAME( "Switch to Previous Layer" ),
|
||||
_( "Previous Layer" ), _( "Previous Layer" ) );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::moveLayerUp( "gerbview.Control.moveLayerUp",
|
||||
AS_GLOBAL,
|
||||
'+', "",
|
||||
_( "Move Layer Up" ), _( "Move Current Layer Up" ),
|
||||
BITMAPS::up );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::moveLayerDown( "gerbview.Control.moveLayerDown",
|
||||
AS_GLOBAL,
|
||||
'-', "",
|
||||
_( "Move Layer Down" ), _( "Move Current Layer Down" ),
|
||||
BITMAPS::down );
|
||||
|
||||
TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( "gerbview.Control.linesDisplayOutlines",
|
||||
AS_GLOBAL,
|
||||
'L', LEGACY_HK_NAME( "Gbr Lines Display Mode" ),
|
||||
|
|
|
@ -69,6 +69,8 @@ public:
|
|||
// Layer control
|
||||
static TOOL_ACTION layerPrev;
|
||||
static TOOL_ACTION layerNext;
|
||||
static TOOL_ACTION moveLayerUp;
|
||||
static TOOL_ACTION moveLayerDown;
|
||||
static TOOL_ACTION clearLayer;
|
||||
static TOOL_ACTION clearAllLayers;
|
||||
static TOOL_ACTION reloadAllLayers;
|
||||
|
|
|
@ -345,6 +345,36 @@ int GERBVIEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::MoveLayerUp( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
int layer = m_frame->GetActiveLayer();
|
||||
|
||||
if( layer > 0 )
|
||||
{
|
||||
m_frame->RemapLayers(
|
||||
GERBER_FILE_IMAGE_LIST::GetImagesList().SwapImages( layer, layer - 1 ) );
|
||||
m_frame->SetActiveLayer( layer - 1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::MoveLayerDown( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
int layer = m_frame->GetActiveLayer();
|
||||
GERBER_FILE_IMAGE_LIST& list = GERBER_FILE_IMAGE_LIST::GetImagesList();
|
||||
|
||||
if( layer < ( (int) list.GetLoadedImageCount() - 1 ) )
|
||||
{
|
||||
m_frame->RemapLayers( list.SwapImages( layer, layer + 1 ) );
|
||||
m_frame->SetActiveLayer( layer + 1 );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int GERBVIEW_CONTROL::ClearLayer( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->Erase_Current_DrawLayer( true );
|
||||
|
@ -448,6 +478,8 @@ void GERBVIEW_CONTROL::setTransitions()
|
|||
|
||||
Go( &GERBVIEW_CONTROL::LayerNext, GERBVIEW_ACTIONS::layerNext.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::LayerPrev, GERBVIEW_ACTIONS::layerPrev.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::MoveLayerUp, GERBVIEW_ACTIONS::moveLayerUp.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::MoveLayerDown, GERBVIEW_ACTIONS::moveLayerDown.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ClearLayer, GERBVIEW_ACTIONS::clearLayer.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ClearAllLayers, GERBVIEW_ACTIONS::clearAllLayers.MakeEvent() );
|
||||
Go( &GERBVIEW_CONTROL::ReloadAllLayers, GERBVIEW_ACTIONS::reloadAllLayers.MakeEvent() );
|
||||
|
|
|
@ -45,6 +45,8 @@ public:
|
|||
// Layer control
|
||||
int LayerNext( const TOOL_EVENT& aEvent );
|
||||
int LayerPrev( const TOOL_EVENT& aEvent );
|
||||
int MoveLayerUp( const TOOL_EVENT& aEvent );
|
||||
int MoveLayerDown( const TOOL_EVENT& aEvent );
|
||||
int ClearLayer( const TOOL_EVENT& aEvent );
|
||||
int ClearAllLayers( const TOOL_EVENT& aEvent );
|
||||
int ReloadAllLayers( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <gerbview_painter.h>
|
||||
#include <gal/graphics_abstraction_layer.h>
|
||||
#include <settings/settings_manager.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/gerbview_actions.h>
|
||||
|
||||
#include "layer_widget.h"
|
||||
#include "gbr_layer_box_selector.h"
|
||||
|
@ -215,23 +217,11 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_LAYER_MOVE_UP:
|
||||
layer = m_frame->GetActiveLayer();
|
||||
|
||||
if( layer > 0 )
|
||||
{
|
||||
m_frame->RemapLayers( GetImagesList()->SwapImages( layer, layer - 1 ) );
|
||||
m_frame->SetActiveLayer( layer - 1 );
|
||||
}
|
||||
m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerUp, true );
|
||||
break;
|
||||
|
||||
case ID_LAYER_MOVE_DOWN:
|
||||
layer = m_frame->GetActiveLayer();
|
||||
|
||||
if( layer < ( (int)GetImagesList()->GetLoadedImageCount() - 1 ) )
|
||||
{
|
||||
m_frame->RemapLayers( GetImagesList()->SwapImages( layer, layer + 1 ) );
|
||||
m_frame->SetActiveLayer( layer + 1 );
|
||||
}
|
||||
m_frame->GetToolManager()->RunAction( GERBVIEW_ACTIONS::moveLayerDown, true );
|
||||
break;
|
||||
|
||||
case ID_LAYER_DELETE:
|
||||
|
|
Loading…
Reference in New Issue