Move Flip board view to a shared tool (for FP Editor).

Fixes https://gitlab.com/kicad/code/kicad/issues/6687
This commit is contained in:
Jeff Young 2021-02-10 17:05:47 +00:00
parent a30ae6a237
commit 20338c92e8
4 changed files with 14 additions and 14 deletions

View File

@ -1356,16 +1356,6 @@ int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
}
int BOARD_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
{
view()->SetMirror( !view()->IsMirroredX(), false );
view()->RecacheAllItems();
frame()->GetCanvas()->ForceRefresh();
frame()->OnDisplayOptionsChanged();
return 0;
}
void BOARD_EDITOR_CONTROL::setTransitions()
{
Go( &BOARD_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
@ -1414,7 +1404,6 @@ void BOARD_EDITOR_CONTROL::setTransitions()
Go( &BOARD_EDITOR_CONTROL::ShowEeschema, PCB_ACTIONS::showEeschema.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::ToggleLayersManager, PCB_ACTIONS::showLayersManager.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
Go( &BOARD_EDITOR_CONTROL::RepairBoard, PCB_ACTIONS::repairBoard.MakeEvent() );
}

View File

@ -114,8 +114,6 @@ public:
static void DoSetDrillOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
EDA_ITEM* aItem, const VECTOR2D& aPoint );
int FlipPcbView( const TOOL_EVENT& aEvent );
private:
///< How to modify a property for selected items.
enum MODIFY_MODE { ON, OFF, TOGGLE };

View File

@ -1112,6 +1112,16 @@ int PCB_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
}
int PCB_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
{
view()->SetMirror( !view()->IsMirroredX(), false );
view()->RecacheAllItems();
frame()->GetCanvas()->ForceRefresh();
frame()->OnDisplayOptionsChanged();
return 0;
}
void PCB_CONTROL::setTransitions()
{
Go( &PCB_CONTROL::AddLibrary, ACTIONS::newLibrary.MakeEvent() );
@ -1130,6 +1140,7 @@ void PCB_CONTROL::setTransitions()
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() );
Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCB_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() );
Go( &PCB_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
// Layer control
Go( &PCB_CONTROL::LayerSwitch, PCB_ACTIONS::layerTop.MakeEvent() );

View File

@ -93,10 +93,12 @@ public:
int AppendBoard( PLUGIN& pi, wxString& fileName );
int UpdateMessagePanel( const TOOL_EVENT& aEvent );
int FlipPcbView( const TOOL_EVENT& aEvent );
private:
///< Sets up handlers for various events.
void setTransitions() override;
private:
/**
* Add and select or just select for move/place command a list of board items.
*