Remove some legacy cursor handling stuff.

This commit is contained in:
Jeff Young 2019-05-30 13:25:08 +01:00
parent edc8438ef0
commit d2daab808c
52 changed files with 131 additions and 465 deletions

View File

@ -381,15 +381,57 @@ void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMod
}
/*
* Respond to selections in the toolbar grid popup
*/
void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
{
wxFAIL_MSG( "Obsolete! Should go through ToolManager." );
wxCHECK_RET( m_gridSelectBox, "m_gridSelectBox uninitialized" );
int id = m_gridSelectBox->GetCurrentSelection() + ID_POPUP_GRID_FIRST;
if( id == ID_POPUP_GRID_SEPARATOR )
{
// wxWidgets will check the separator, which we don't want.
// Re-check the current grid.
wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy );
}
else if( id == ID_POPUP_GRID_SETTINGS )
{
// wxWidgets will check the Grid Settings... entry, which we don't want.
// R-check the current grid.
wxUpdateUIEvent dummy;
OnUpdateSelectGrid( dummy );
// Now run the Grid Settings... dialog
wxCommandEvent dummy2;
OnGridSettings( dummy2 );
}
else if( id >= ID_POPUP_GRID_FIRST && id < ID_POPUP_GRID_SEPARATOR )
{
m_toolManager->RunAction( ACTIONS::gridPreset, true, id );
}
UpdateStatusBar();
m_galCanvas->Refresh();
}
/*
* Respond to selections in the toolbar zoom popup
*/
void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
{
wxFAIL_MSG( "Obsolete! Should go through ToolManager." );
wxCHECK_RET( m_zoomSelectBox, "m_zoomSelectBox uninitialized" );
int id = m_zoomSelectBox->GetCurrentSelection();
if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
return;
m_toolManager->RunAction( "common.Control.zoomPreset", true, id );
UpdateStatusBar();
m_galCanvas->Refresh();
}
@ -533,18 +575,14 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
COLOR4D color, int pad )
{
if( m_messagePanel == NULL )
return;
if( m_messagePanel )
m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
}
void EDA_DRAW_FRAME::ClearMsgPanel()
{
if( m_messagePanel == NULL )
return;
if( m_messagePanel )
m_messagePanel->EraseMsgBox();
}
@ -552,18 +590,18 @@ void EDA_DRAW_FRAME::ClearMsgPanel()
void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList )
{
if( m_messagePanel == NULL )
return;
{
m_messagePanel->EraseMsgBox();
for( unsigned i = 0; i < aList.size(); i++ )
m_messagePanel->AppendMessage( aList[i] );
for( const MSG_PANEL_ITEM& item : aList )
m_messagePanel->AppendMessage( item );
}
}
void EDA_DRAW_FRAME::SetMsgPanel( EDA_ITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
wxCHECK_RET( aItem, wxT( "Invalid EDA_ITEM pointer. Bad programmer." ) );
MSG_PANEL_ITEMS items;
aItem->GetMsgPanelInfo( m_UserUnits, items );
@ -577,7 +615,7 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
}
void EDA_DRAW_FRAME::UseGalCanvas()
void EDA_DRAW_FRAME::ActivateGalCanvas()
{
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
@ -594,7 +632,7 @@ void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
GetGalCanvas()->SwitchBackend( aCanvasType );
m_canvasType = GetGalCanvas()->GetBackend();
UseGalCanvas();
ActivateGalCanvas();
}
@ -731,103 +769,6 @@ void EDA_DRAW_FRAME::SetScrollCenterPosition( const wxPoint& aPoint )
//-----</BASE_SCREEN API moved here >--------------------------------------------
bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid )
{
bool key_handled = false;
// If requested snap the current position to the grid
if( aSnapToGrid )
*aPos = GetNearestGridPosition( *aPos );
switch( aHotKey )
{
// All these keys have almost the same treatment
case GR_KB_CTRL | WXK_NUMPAD8:
case GR_KB_CTRL | WXK_UP:
case GR_KB_CTRL | WXK_NUMPAD2:
case GR_KB_CTRL | WXK_DOWN:
case GR_KB_CTRL | WXK_NUMPAD4:
case GR_KB_CTRL | WXK_LEFT:
case GR_KB_CTRL | WXK_NUMPAD6:
case GR_KB_CTRL | WXK_RIGHT:
case WXK_NUMPAD8:
case WXK_UP:
case WXK_NUMPAD2:
case WXK_DOWN:
case WXK_NUMPAD4:
case WXK_LEFT:
case WXK_NUMPAD6:
case WXK_RIGHT:
key_handled = true;
{
/* Here's a tricky part: when doing cursor key movement, the
* 'previous' point should be taken from memory, *not* from the
* freshly computed position in the event. Otherwise you can't do
* sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
* the automatic motion event generated by cursor warping */
wxRealPoint gridSize = GetScreen()->GetGridSize();
*aPos = GetCrossHairPosition();
// Bonus: ^key moves faster (x10)
switch( aHotKey )
{
case GR_KB_CTRL|WXK_NUMPAD8:
case GR_KB_CTRL|WXK_UP:
aPos->y -= KiROUND( 10 * gridSize.y );
break;
case GR_KB_CTRL|WXK_NUMPAD2:
case GR_KB_CTRL|WXK_DOWN:
aPos->y += KiROUND( 10 * gridSize.y );
break;
case GR_KB_CTRL|WXK_NUMPAD4:
case GR_KB_CTRL|WXK_LEFT:
aPos->x -= KiROUND( 10 * gridSize.x );
break;
case GR_KB_CTRL|WXK_NUMPAD6:
case GR_KB_CTRL|WXK_RIGHT:
aPos->x += KiROUND( 10 * gridSize.x );
break;
case WXK_NUMPAD8:
case WXK_UP:
aPos->y -= KiROUND( gridSize.y );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
aPos->y += KiROUND( gridSize.y );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
aPos->x -= KiROUND( gridSize.x );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
aPos->x += KiROUND( gridSize.x );
break;
default: /* Can't happen since we entered the statement */
break;
}
m_canvas->MoveCursor( *aPos );
m_movingCursorWithKeyboard = true;
}
break;
default:
break;
}
return key_handled;
}
const BOX2I EDA_DRAW_FRAME::GetDocumentExtents() const
{
return BOX2I();

View File

@ -643,7 +643,7 @@ void EDA_DRAW_FRAME::UpdateMsgPanel()
}
void EDA_DRAW_FRAME::UseGalCanvas()
void EDA_DRAW_FRAME::ActivateGalCanvas()
{
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
@ -667,7 +667,7 @@ void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
GetGalCanvas()->SwitchBackend( aCanvasType );
m_canvasType = GetGalCanvas()->GetBackend();
UseGalCanvas();
ActivateGalCanvas();
}
@ -843,107 +843,10 @@ bool EDA_DRAW_FRAME::LibraryFileBrowser( bool doOpen, wxFileName& aFilename,
}
bool EDA_DRAW_FRAME::GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid )
{
bool key_handled = false;
// If requested snap the current position to the grid
if( aSnapToGrid )
*aPos = GetNearestGridPosition( *aPos );
switch( aHotKey )
{
// All these keys have almost the same treatment
case GR_KB_CTRL | WXK_NUMPAD8:
case GR_KB_CTRL | WXK_UP:
case GR_KB_CTRL | WXK_NUMPAD2:
case GR_KB_CTRL | WXK_DOWN:
case GR_KB_CTRL | WXK_NUMPAD4:
case GR_KB_CTRL | WXK_LEFT:
case GR_KB_CTRL | WXK_NUMPAD6:
case GR_KB_CTRL | WXK_RIGHT:
case WXK_NUMPAD8:
case WXK_UP:
case WXK_NUMPAD2:
case WXK_DOWN:
case WXK_NUMPAD4:
case WXK_LEFT:
case WXK_NUMPAD6:
case WXK_RIGHT:
key_handled = true;
{
/* Here's a tricky part: when doing cursor key movement, the
* 'previous' point should be taken from memory, *not* from the
* freshly computed position in the event. Otherwise you can't do
* sub-pixel movement. The m_movingCursorWithKeyboard oneshot 'eats'
* the automatic motion event generated by cursor warping */
wxRealPoint gridSize = GetScreen()->GetGridSize();
*aPos = GetCrossHairPosition();
// Bonus: ^key moves faster (x10)
switch( aHotKey )
{
case GR_KB_CTRL|WXK_NUMPAD8:
case GR_KB_CTRL|WXK_UP:
aPos->y -= KiROUND( 10 * gridSize.y );
break;
case GR_KB_CTRL|WXK_NUMPAD2:
case GR_KB_CTRL|WXK_DOWN:
aPos->y += KiROUND( 10 * gridSize.y );
break;
case GR_KB_CTRL|WXK_NUMPAD4:
case GR_KB_CTRL|WXK_LEFT:
aPos->x -= KiROUND( 10 * gridSize.x );
break;
case GR_KB_CTRL|WXK_NUMPAD6:
case GR_KB_CTRL|WXK_RIGHT:
aPos->x += KiROUND( 10 * gridSize.x );
break;
case WXK_NUMPAD8:
case WXK_UP:
aPos->y -= KiROUND( gridSize.y );
break;
case WXK_NUMPAD2:
case WXK_DOWN:
aPos->y += KiROUND( gridSize.y );
break;
case WXK_NUMPAD4:
case WXK_LEFT:
aPos->x -= KiROUND( gridSize.x );
break;
case WXK_NUMPAD6:
case WXK_RIGHT:
aPos->x += KiROUND( gridSize.x );
break;
default: /* Can't happen since we entered the statement */
break;
}
m_canvas->MoveCursor( *aPos );
m_movingCursorWithKeyboard = true;
}
break;
default:
break;
}
return key_handled;
}
void EDA_DRAW_FRAME::HardRedraw()
{
m_canvas->Refresh();
m_canvas->Update();
GetGalCanvas()->Refresh();
GetGalCanvas()->Update();
}

View File

@ -104,7 +104,6 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
m_ClipBox.SetX( 0 );
m_ClipBox.SetY( 0 );
m_canStartBlock = -1; // Command block can start if >= 0
m_ignoreMouseEvents = false;
// Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when
// launching a editor from a double click made in another frame)
@ -277,18 +276,6 @@ wxPoint EDA_DRAW_PANEL::GetScreenCenterLogicalPosition()
}
void EDA_DRAW_PANEL::MoveCursorToCrossHair()
{
MoveCursor( GetParent()->GetCrossHairPosition() );
}
void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition )
{
// JEY TODO: OBSOLETE
}
void EDA_DRAW_PANEL::OnActivate( wxActivateEvent& event )
{
m_canStartBlock = -1; // Block Command can't start

View File

@ -172,7 +172,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
@ -451,7 +451,7 @@ void DISPLAY_FOOTPRINTS_FRAME::InitDisplay()
UpdateStatusBar();
GetCanvas()->Refresh();
GetGalCanvas()->Refresh();
Update3DView();
}

View File

@ -350,7 +350,5 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
if( m_CurrentText->IsNew() )
SetDefaultTextSize( m_CurrentText->GetTextWidth() );
m_Parent->GetCanvas()->MoveCursorToCrossHair();
return true;
}

View File

@ -162,6 +162,9 @@ void DIALOG_SCH_FIND::OnOptions( wxCommandEvent& aEvent )
if( m_checkCurrentSheetOnly->GetValue() )
flags |= FR_CURRENT_SHEET_ONLY;
if( m_checkReplaceReferences->GetValue() )
flags |= FR_REPLACE_REFERENCES;
m_findReplaceData->SetFlags( flags );
m_editorControl->UpdateFind( ACTIONS::updateFind.MakeEvent() );
}

View File

@ -58,10 +58,6 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
if( aField->GetEditFlags() == 0 ) // i.e. not edited, or moved
SaveCopyInUndoList( component, UR_CHANGED );
// Don't use GetText() here. If the field is the reference designator and it's parent
// component has multiple parts, we don't want the part suffix added to the field.
m_canvas->SetIgnoreMouseEvents( true );
wxString title;
title.Printf( _( "Edit %s Field" ), GetChars( aField->GetName() ) );
@ -70,15 +66,9 @@ void SCH_EDIT_FRAME::EditComponentFieldText( SCH_FIELD* aField )
// The dialog may invoke a kiway player for footprint fields
// so we must use a quasimodal
if( dlg.ShowQuasiModal() != wxID_OK )
{
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
return;
}
dlg.UpdateField( aField, g_CurrentSheet );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
if( m_autoplaceFields )
component->AutoAutoplaceFields( GetScreen() );
@ -97,8 +87,6 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
wxCHECK_RET( aComponent != nullptr && aComponent->Type() == SCH_COMPONENT_T,
wxT( "Invalid component object pointer. Bad Programmer!" ) );
m_canvas->SetIgnoreMouseEvents( true );
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC dlg( this, aComponent );
// This dialog itself subsequently can invoke a KIWAY_PLAYER as a quasimodal
@ -107,9 +95,6 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
// the QUASIMODAL macros here.
int ret = dlg.ShowQuasiModal();
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->MoveCursorToCrossHair();
if( ret == wxID_OK )
{
if( m_autoplaceFields )

View File

@ -206,8 +206,6 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectCompFromLibTree(
void SCH_EDIT_FRAME::SelectUnit( SCH_COMPONENT* aComponent, int aUnit )
{
GetCanvas()->MoveCursorToCrossHair();
LIB_PART* part = GetLibPart( aComponent->GetLibId() );
if( !part )

View File

@ -607,7 +607,6 @@ void LIB_EDIT_FRAME::OnImportBody( wxCommandEvent& aEvent )
SetToolID( ID_LIBEDIT_IMPORT_BODY_BUTT, GetGalCanvas()->GetDefaultCursor(), _( "Import" ) );
LoadOneSymbol();
SetNoToolSelected();
m_canvas->SetIgnoreMouseEvents( false );
}
@ -617,7 +616,6 @@ void LIB_EDIT_FRAME::OnExportBody( wxCommandEvent& aEvent )
SetToolID( ID_LIBEDIT_EXPORT_BODY_BUTT, GetGalCanvas()->GetDefaultCursor(), _( "Export" ) );
SaveOneSymbol();
SetNoToolSelected();
m_canvas->SetIgnoreMouseEvents( false );
}

View File

@ -53,8 +53,6 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
PROJECT& prj = Prj();
SEARCH_STACK* search = prj.SchSearchS();
m_canvas->SetIgnoreMouseEvents( true );
wxString default_path = prj.GetRString( PROJECT::SCH_LIB_PATH );
if( !default_path )
@ -67,10 +65,6 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
if( dlg.ShowModal() == wxID_CANCEL )
return;
SetCrossHairPosition( wxPoint( 0, 0 ) );
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
wxString filename = dlg.GetPath();
prj.SetRString( PROJECT::SCH_LIB_PATH, filename );

View File

@ -400,13 +400,7 @@ void SCH_BASE_FRAME::createCanvas()
m_useSingleCanvasPane = true;
SetGalCanvas( static_cast<SCH_DRAW_PANEL*>( m_canvas ) );
// Set up viewport
KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
}

View File

@ -85,7 +85,6 @@ SCH_DRAW_PANEL::SCH_DRAW_PANEL( wxWindow* aParentWindow, wxWindowID aWindowId,
Connect( wxEVT_CHAR_HOOK, wxKeyEventHandler( SCH_DRAW_PANEL::OnCharHook ), NULL, this );
m_ignoreMouseEvents = false;
// Be sure a mouse release button event will be ignored when creating the canvas
// if the mouse click was not made inside the canvas (can happen sometimes, when
// launching a editor from a double click made in another frame)
@ -199,12 +198,6 @@ EDA_DRAW_FRAME* SCH_DRAW_PANEL::GetParent() const
}
void SCH_DRAW_PANEL::MoveCursorToCrossHair()
{
GetViewControls()->WarpCursor( GetParent()->GetCrossHairPosition(), true );
}
void SCH_DRAW_PANEL::Refresh( bool aEraseBackground, const wxRect* aRect )
{
EDA_DRAW_PANEL_GAL::Refresh( aEraseBackground, aRect );

View File

@ -46,8 +46,6 @@ public:
BASE_SCREEN* GetScreen() override;
virtual EDA_DRAW_FRAME* GetParent() const override;
virtual void MoveCursorToCrossHair() override;
KIGFX::SCH_VIEW* GetView() const { return view(); }
/// @copydoc wxWindow::Refresh()

View File

@ -182,8 +182,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
}
}
m_canvas->SetIgnoreMouseEvents( true );
if( isUndoable )
SaveCopyInUndoList( aSheet, UR_CHANGED );
@ -304,9 +302,6 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, SCH_SHEET_PATH* aHierarchy,
if( aClearAnnotationNewItems )
*aClearAnnotationNewItems = clearAnnotation;
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
GetCanvas()->GetView()->Update( aSheet );
OnModify();

View File

@ -173,7 +173,6 @@ int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_frame->GetCanvas()->SetIgnoreMouseEvents( true );
switch( aType )
{
@ -203,10 +202,8 @@ int LIB_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
}
m_frame->GetCanvas()->SetIgnoreMouseEvents( false );
// Restore cursor after dialog
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
if( item )
{

View File

@ -165,7 +165,6 @@ bool LIB_PIN_TOOL::PlacePin( LIB_PIN* aPin )
if( ask_for_pin && m_frame->SynchronizePins() )
{
m_frame->GetCanvas()->SetIgnoreMouseEvents( true );
wxString msg;
msg.Printf( _( "This position is already occupied by another pin, in unit %d." ),
test->GetUnit() );
@ -176,9 +175,6 @@ bool LIB_PIN_TOOL::PlacePin( LIB_PIN* aPin )
bool status = dlg.ShowModal() == wxID_OK;
m_frame->GetCanvas()->MoveCursorToCrossHair();
m_frame->GetCanvas()->SetIgnoreMouseEvents( false );
if( !status )
{
if( aPin->IsNew() )

View File

@ -185,7 +185,7 @@ int SCH_DRAWING_TOOLS::AddJunction( const TOOL_EVENT& aEvent )
m_frame->SetCrossHairPosition( (wxPoint) nearest, false );
}
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
SCH_JUNCTION* junction = m_frame->AddJunction( m_frame->GetCrossHairPosition() );
m_selectionTool->AddItemToSel( junction );
@ -321,15 +321,11 @@ int SCH_DRAWING_TOOLS::doPlaceComponent( SCH_COMPONENT* aComponent, SCHLIB_FILTE
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
// Pick the module to be placed
m_frame->GetCanvas()->SetIgnoreMouseEvents( true );
auto sel = m_frame->SelectCompFromLibTree( aFilter, aHistoryList, true, 1, 1,
m_frame->GetShowFootprintPreviews());
m_frame->GetCanvas()->SetIgnoreMouseEvents( false );
// Restore cursor after dialog
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
LIB_PART* part = sel.LibId.IsValid() ? m_frame->GetLibPart( sel.LibId ) : nullptr;
@ -446,19 +442,14 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
if( !image )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_frame->GetCanvas()->SetIgnoreMouseEvents( true );
wxFileDialog dlg( m_frame, _( "Choose Image" ), wxEmptyString, wxEmptyString,
_( "Image Files " ) + wxImage::GetImageExtWildcard(), wxFD_OPEN );
if( dlg.ShowModal() != wxID_OK )
continue;
m_frame->GetCanvas()->SetIgnoreMouseEvents( false );
// Restore cursor after dialog
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
wxString fullFilename = dlg.GetPath();
@ -695,7 +686,6 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( !item )
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_frame->GetCanvas()->SetIgnoreMouseEvents( true );
switch( aType )
{
@ -746,10 +736,8 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
wxFAIL_MSG( "doTwoClickPlace(): unknown type" );
}
m_frame->GetCanvas()->SetIgnoreMouseEvents( false );
// Restore cursor after dialog
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
if( item )
{

View File

@ -311,7 +311,7 @@ int SCH_WIRE_BUS_TOOL::StartWire( const TOOL_EVENT& aEvent )
Activate();
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
SCH_LINE* segment = startSegments( LAYER_WIRE, m_frame->GetCrossHairPosition() );
return doDrawSegments( LAYER_WIRE, segment );
}
@ -343,7 +343,7 @@ int SCH_WIRE_BUS_TOOL::StartBus( const TOOL_EVENT& aEvent )
Activate();
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
SCH_LINE* segment = startSegments( LAYER_BUS, m_frame->GetCrossHairPosition() );
return doDrawSegments( LAYER_BUS, segment );
}
@ -454,7 +454,7 @@ int SCH_WIRE_BUS_TOOL::StartLine( const TOOL_EVENT& aEvent)
{
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_frame->GetCanvas()->MoveCursorToCrossHair();
getViewControls()->WarpCursor( m_frame->GetCrossHairPosition(), true );
SCH_LINE* segment = startSegments( LAYER_NOTES, m_frame->GetCrossHairPosition() );
return doDrawSegments( LAYER_BUS, segment );
}

View File

@ -88,5 +88,5 @@ void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query )
ReFillLayerWidget();
syncLayerBox();
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}

View File

@ -102,7 +102,7 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow()
if( needs_repaint )
view->UpdateAllItems( KIGFX::REPAINT );
m_Parent->GetCanvas()->Refresh();
m_Parent->GetGalCanvas()->Refresh();
return true;
}

View File

@ -161,21 +161,15 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_HIGHLIGHT_CMP_ITEMS:
if( m_SelComponentBox->SetStringSelection( currItem->GetNetAttributes().m_Cmpref ) )
m_canvas->Refresh();
m_SelComponentBox->SetStringSelection( currItem->GetNetAttributes().m_Cmpref );
break;
case ID_HIGHLIGHT_NET_ITEMS:
if( m_SelNetnameBox->SetStringSelection( UnescapeString( currItem->GetNetAttributes().m_Netname ) ) )
m_canvas->Refresh();
m_SelNetnameBox->SetStringSelection( UnescapeString( currItem->GetNetAttributes().m_Netname ) );
break;
case ID_HIGHLIGHT_APER_ATTRIBUTE_ITEMS:
{
D_CODE* apertDescr = currItem->GetDcodeDescr();
if( m_SelAperAttributesBox->SetStringSelection( apertDescr->m_AperFunction ) )
m_canvas->Refresh();
}
m_SelAperAttributesBox->SetStringSelection( currItem->GetDcodeDescr()->m_AperFunction );
break;
case ID_HIGHLIGHT_REMOVE_ALL:
@ -185,14 +179,14 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( GetGbrImage( GetActiveLayer() ) )
GetGbrImage( GetActiveLayer() )->m_Selected_Tool = 0;
m_canvas->Refresh();
break;
default:
wxFAIL_MSG( wxT( "GERBVIEW_FRAME::Process_Special_Functions error" ) );
break;
}
GetGalCanvas()->Refresh();
}
@ -232,7 +226,7 @@ void GERBVIEW_FRAME::OnSelectActiveDCode( wxCommandEvent& event )
if( tool != gerber_image->m_Selected_Tool )
{
gerber_image->m_Selected_Tool = tool;
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}
}
}
@ -287,25 +281,14 @@ void GERBVIEW_FRAME::OnShowGerberSourceFile( wxCommandEvent& event )
void GERBVIEW_FRAME::OnSelectDisplayMode( wxCommandEvent& event )
{
int oldMode = GetDisplayMode();
switch( event.GetId() )
{
case ID_TB_OPTIONS_SHOW_GBR_MODE_0:
SetDisplayMode( 0 );
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1:
SetDisplayMode( 1 );
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2:
SetDisplayMode( 2 );
break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_0: SetDisplayMode( 0 ); break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_1: SetDisplayMode( 1 ); break;
case ID_TB_OPTIONS_SHOW_GBR_MODE_2: SetDisplayMode( 2 ); break;
}
if( GetDisplayMode() != oldMode )
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}

View File

@ -111,7 +111,7 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
case ID_GERBVIEW_ERASE_ALL:
Clear_DrawLayers( false );
Zoom_Automatique( false );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
ClearMsgPanel();
break;
@ -142,7 +142,7 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
// Clear all layers
Clear_DrawLayers( false );
Zoom_Automatique( false );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
ClearMsgPanel();
// Load the layers from stored paths
@ -153,17 +153,17 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
case ID_GERBVIEW_LOAD_DRILL_FILE:
LoadExcellonFiles( wxEmptyString );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
break;
case ID_GERBVIEW_LOAD_ZIP_ARCHIVE_FILE:
LoadZipArchiveFile( wxEmptyString );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
break;
case ID_GERBVIEW_LOAD_JOB_FILE:
LoadGerberJobFile( wxEmptyString );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
break;
default:

View File

@ -209,7 +209,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
}
GetGalCanvas()->SwitchBackend( canvasType );
UseGalCanvas();
ActivateGalCanvas();
// Enable the axes to match legacy draw style
auto& galOptions = GetGalDisplayOptions();
@ -622,7 +622,7 @@ void GERBVIEW_FRAME::SortLayersByX2Attributes()
}
GetGalCanvas()->GetView()->ReorderLayerData( view_remapping );
GetCanvas()->Refresh();
GetGalCanvas()->Refresh();
}
@ -690,8 +690,7 @@ void GERBVIEW_FRAME::UpdateDisplayOptions( const GBR_DISPLAY_OPTIONS& aOptions )
}
view->UpdateAllItems( KIGFX::COLOR );
m_canvas->Refresh( true );
GetGalCanvas()->Refresh();
}
@ -1112,9 +1111,9 @@ void GERBVIEW_FRAME::unitsChangeRefresh()
}
void GERBVIEW_FRAME::UseGalCanvas()
void GERBVIEW_FRAME::ActivateGalCanvas()
{
EDA_DRAW_FRAME::UseGalCanvas();
EDA_DRAW_FRAME::ActivateGalCanvas();
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();

View File

@ -586,7 +586,7 @@ public:
}
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
virtual void UseGalCanvas() override;
virtual void ActivateGalCanvas() override;
/**
* Allows Gerbview to install its preferences panels into the preferences dialog.

View File

@ -192,7 +192,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
}
myframe->SetVisibleLayers( visibleLayers );
myframe->GetCanvas()->Refresh();
myframe->GetGalCanvas()->Refresh();
break;
case ID_SORT_GBR_LAYERS:
@ -265,7 +265,7 @@ void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
view->GetPainter()->GetSettings()->ImportLegacyColors( myframe->m_colorsSettings );
view->UpdateLayerColor( GERBER_DRAW_LAYER( aLayer ) );
myframe->GetCanvas()->Refresh();
myframe->GetGalCanvas()->Refresh();
}
@ -281,7 +281,7 @@ bool GERBER_LAYER_WIDGET::OnLayerSelect( int aLayer )
if( layer != myframe->GetActiveLayer() )
{
if( ! OnLayerSelected() )
myframe->GetCanvas()->Refresh();
myframe->GetGalCanvas()->Refresh();
}
return true;
@ -297,7 +297,7 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
myframe->SetVisibleLayers( visibleLayers );
if( isFinal )
myframe->GetCanvas()->Refresh();
myframe->GetGalCanvas()->Refresh();
}

View File

@ -208,17 +208,6 @@ protected:
const wxString& wildcard, const wxString& ext,
bool isDirectory = false );
/**
* Handle the common part of GeneralControl dedicated to global
* cursor keys (i.e. cursor movement by keyboard)
*
* @param aHotKey is the hotkey code
* @param aPos is the position of the cursor (initial then new)
* @param aSnapToGrid = true to force the cursor position on grid
* @return true if the hotkey code is handled (captured).
*/
bool GeneralControlKeyMovement( int aHotKey, wxPoint *aPos, bool aSnapToGrid );
/**
* Stores the canvas type in the application settings.
*/
@ -736,7 +725,7 @@ public:
/**
* Use to start up the GAL drawing canvas.
*/
virtual void UseGalCanvas();
virtual void ActivateGalCanvas();
/**
* Changes the current rendering backend.

View File

@ -21,8 +21,6 @@ protected:
/// of the drawing in internal units.
EDA_RECT m_ClipBox;
bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
@ -43,7 +41,6 @@ public:
m_cursorLevel( 0 ),
m_scrollIncrementX( 1 ),
m_scrollIncrementY( 1 ),
m_ignoreMouseEvents( false ),
m_ignoreNextLeftButtonRelease( false ),
m_PrintIsMirrored( false ),
m_doubleClickInterval( 0 )
@ -68,8 +65,6 @@ public:
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
@ -130,12 +125,6 @@ public:
*/
virtual wxPoint GetScreenCenterLogicalPosition() { return wxPoint(0, 0); };;
/**
* Function MoveCursorToCrossHair
* warps the cursor to the current cross hair position.
*/
virtual void MoveCursorToCrossHair() { printf("EDA_DRAW_PANEL:Unimplemented14\n"); };;
/**
* Function ToDeviceXY
* transforms logical to device coordinates
@ -148,13 +137,6 @@ public:
*/
virtual wxPoint ToLogicalXY( const wxPoint& pos ) { printf("EDA_DRAW_PANEL:Unimplemented16\n"); return wxPoint(0, 0); };;
/**
* Function MoveCursor
* moves the mouse pointer to \a aPosition in logical (drawing) units.
* @param aPosition The position in logical units to move the cursor.
*/
virtual void MoveCursor( const wxPoint& aPosition ) { printf("EDA_DRAW_PANEL:Unimplemented17\n"); };;
virtual void Refresh( bool eraseBackground = true, const wxRect* rect = NULL ) {}
virtual wxWindow* GetWindow() = 0;

View File

@ -73,8 +73,6 @@ private:
/// of the drawing in internal units.
EDA_RECT m_ClipBox;
bool m_ignoreMouseEvents; ///< Ignore mouse events when true.
/* Used to inhibit a response to a mouse left button release, after a double click
* (when releasing the left button at the end of the second click. Used in Eeschema
* to inhibit a mouse left release command when switching between hierarchical sheets
@ -123,8 +121,6 @@ public:
void SetClipBox( const EDA_RECT& aRect ) { m_ClipBox = aRect; }
void SetIgnoreMouseEvents( bool aIgnore ) { m_ignoreMouseEvents = aIgnore; }
void SetIgnoreLeftButtonReleaseEvent( bool aIgnore ) { m_ignoreNextLeftButtonRelease = aIgnore; }
bool GetPrintMirrored() const { return m_PrintIsMirrored; }
@ -234,12 +230,6 @@ public:
*/
wxPoint GetScreenCenterLogicalPosition();
/**
* Function MoveCursorToCrossHair
* warps the cursor to the current cross hair position.
*/
void MoveCursorToCrossHair();
/**
* Function ToDeviceXY
* transforms logical to device coordinates
@ -252,13 +242,6 @@ public:
*/
wxPoint ToLogicalXY( const wxPoint& pos );
/**
* Function MoveCursor
* moves the mouse pointer to \a aPosition in logical (drawing) units.
* @param aPosition The position in logical units to move the cursor.
*/
void MoveCursor( const wxPoint& aPosition );
/* Cursor functions */
/**
* Function DrawCrossHair

View File

@ -469,7 +469,7 @@ public:
void SetFastGrid2();
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
virtual void UseGalCanvas() override;
virtual void ActivateGalCanvas() override;
PCB_GENERAL_SETTINGS& Settings()
{

View File

@ -128,7 +128,7 @@ void PL_EDITOR_FRAME::Files_io( wxCommandEvent& event )
else
{
GetScreen()->SetModify();
m_canvas->Refresh();
GetGalCanvas()->Refresh();
msg.Printf( _( "File \"%s\" inserted" ), GetChars( filename ) );
SetStatusText( msg );
}

View File

@ -179,7 +179,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
m_auimgr.Update();
@ -287,7 +287,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetLayerVisible( LAYER_WORKSHEET_PAGE1, m_pageSelectBox->GetSelection() == 0 );
view->SetLayerVisible( LAYER_WORKSHEET_PAGEn, m_pageSelectBox->GetSelection() == 1 );
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}
break;
@ -305,7 +305,7 @@ void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
{
m_originSelectChoice = m_originSelectBox->GetSelection();
UpdateStatusBar(); // Update grid origin
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}
@ -604,7 +604,7 @@ void PL_EDITOR_FRAME::HardRedraw()
m_propertiesPagelayout->CopyPrmsFromItemToPanel( item );
m_propertiesPagelayout->CopyPrmsFromGeneralToPanel();
m_canvas->Refresh();
GetGalCanvas()->Refresh();
}
@ -683,7 +683,6 @@ void PL_EDITOR_FRAME::OnNewPageLayout()
UpdateTitleAndInfo();
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
m_canvas->Refresh();
}

View File

@ -81,7 +81,9 @@ void PL_EDITOR_FRAME::GetLayoutFromRedoList()
HardRedraw(); // items based off of corners will need re-calculating
}
else
GetCanvas()->Refresh();
{
GetGalCanvas()->Refresh();
}
OnModify();
}

View File

@ -130,12 +130,8 @@ void PCB_BASE_EDIT_FRAME::InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem
{
wxCHECK_RET( aItem != NULL, wxT( "InstallGraphicItemPropertiesDialog() error: NULL item" ) );
m_canvas->SetIgnoreMouseEvents( true );
DIALOG_GRAPHIC_ITEM_PROPERTIES dlg( this, aItem );
dlg.ShowModal();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
m_canvas->Refresh();
}

View File

@ -188,14 +188,8 @@ DIALOG_TEXT_PROPERTIES::~DIALOG_TEXT_PROPERTIES()
*/
void PCB_BASE_EDIT_FRAME::InstallTextOptionsFrame( BOARD_ITEM* aText )
{
m_canvas->SetIgnoreMouseEvents( true );
DIALOG_TEXT_PROPERTIES dlg( this, aText );
dlg.ShowModal();
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
}

View File

@ -200,8 +200,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
wxLogDebug( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
break;
}
m_canvas->SetIgnoreMouseEvents( false );
}

View File

@ -195,7 +195,6 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
m_canvas->MoveCursorToCrossHair();
GetDesignSettings().m_UseConnectedTrackWidth = true;
break;
@ -215,7 +214,6 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_WIDTH14:
case ID_POPUP_PCB_SELECT_WIDTH15:
case ID_POPUP_PCB_SELECT_WIDTH16:
m_canvas->MoveCursorToCrossHair();
GetDesignSettings().m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetDesignSettings().SetTrackWidthIndex( ii );
@ -238,7 +236,6 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_VIASIZE15:
case ID_POPUP_PCB_SELECT_VIASIZE16:
// select the new current value for via size (via diameter)
m_canvas->MoveCursorToCrossHair();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetDesignSettings().SetViaSizeIndex( ii );
break;

View File

@ -240,7 +240,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();
// ReCreateMenuBar(); // UseGalCanvas() will do this for us.
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
@ -279,7 +279,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
m_auimgr.Update();
updateTitle();
@ -905,16 +905,14 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
}
void FOOTPRINT_EDIT_FRAME::UseGalCanvas()
void FOOTPRINT_EDIT_FRAME::ActivateGalCanvas()
{
PCB_BASE_EDIT_FRAME::UseGalCanvas();
PCB_BASE_EDIT_FRAME::ActivateGalCanvas();
// Be sure the axis are enabled:
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
updateView();
ReCreateMenuBar();
// Ensure the m_Layers settings are using the canvas type:
UpdateUserInterface();
}

View File

@ -315,7 +315,7 @@ public:
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas() override;
void ActivateGalCanvas() override;
/**
* Load a KiCad board (.kicad_pcb) from \a aFileName.

View File

@ -576,13 +576,11 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
{
case PCB_PAD_T:
InstallPadOptionsFrame( static_cast<D_PAD*>( aItem ) );
m_canvas->MoveCursorToCrossHair();
break;
case PCB_MODULE_T:
editFootprintProperties( (MODULE*) aItem );
m_canvas->MoveCursorToCrossHair();
m_canvas->Refresh();
GetGalCanvas()->Refresh();
break;
case PCB_MODULE_TEXT_T:

View File

@ -238,7 +238,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
GetGalCanvas()->GetView()->SetScale( m_lastZoom );

View File

@ -233,7 +233,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
updateView();
SetActiveLayer( F_Cu );

View File

@ -149,10 +149,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
WX_TEXT_ENTRY_DIALOG dlg( this, msg, _( "Create microwave module" ), value );
if( dlg.ShowModal() != wxID_OK )
{
m_canvas->MoveCursorToCrossHair();
return NULL; // cancelled by user
}
value = dlg.GetValue();
gap_size = ValueFromString( GetUserUnits(), value );
@ -167,10 +164,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
_( "Create microwave module" ), msg );
if( angledlg.ShowModal() != wxID_OK )
{
m_canvas->MoveCursorToCrossHair();
return NULL; // cancelled by user
}
msg = angledlg.GetValue();
@ -187,10 +181,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
}
if( abort )
{
m_canvas->MoveCursorToCrossHair();
return NULL;
}
module = CreateMuWaveBaseFootprint( cmp_name, text_size, pad_count );
pad = module->PadsList();
@ -465,8 +456,6 @@ MODULE* PCB_EDIT_FRAME::Create_MuWavePolygonShape()
int ret = dlg.ShowModal();
m_canvas->MoveCursorToCrossHair();
if( ret != wxID_OK )
{
PolyEdges.clear();

View File

@ -62,9 +62,9 @@ void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
}
void PCB_BASE_EDIT_FRAME::UseGalCanvas()
void PCB_BASE_EDIT_FRAME::ActivateGalCanvas()
{
PCB_BASE_FRAME::UseGalCanvas();
PCB_BASE_FRAME::ActivateGalCanvas();
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
}

View File

@ -173,7 +173,7 @@ public:
void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas() override;
void ActivateGalCanvas() override;
///> @copydoc PCB_BASE_FRAME::SetBoard()
virtual void SetBoard( BOARD* aBoard ) override;

View File

@ -912,9 +912,9 @@ void PCB_BASE_FRAME::SetFastGrid2()
}
void PCB_BASE_FRAME::UseGalCanvas()
void PCB_BASE_FRAME::ActivateGalCanvas()
{
EDA_DRAW_FRAME::UseGalCanvas();
EDA_DRAW_FRAME::ActivateGalCanvas();
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();

View File

@ -388,7 +388,7 @@ void PCB_DRAW_PANEL_GAL::OnShow()
SwitchBackend( GAL_TYPE_CAIRO );
if( frame )
frame->UseGalCanvas();
frame->ActivateGalCanvas();
}
if( frame )

View File

@ -403,7 +403,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetScreen()->GetZoom() );
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
UseGalCanvas();
ActivateGalCanvas();
// disable Export STEP item if kicad2step does not exist
wxString strK2S = Pgm().GetExecutablePath();
@ -618,9 +618,9 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
}
void PCB_EDIT_FRAME::UseGalCanvas()
void PCB_EDIT_FRAME::ActivateGalCanvas()
{
PCB_BASE_EDIT_FRAME::UseGalCanvas();
PCB_BASE_EDIT_FRAME::ActivateGalCanvas();
COLORS_DESIGN_SETTINGS& cds = Settings().Colors();
cds.SetLegacyMode( false );
@ -628,9 +628,6 @@ void PCB_EDIT_FRAME::UseGalCanvas()
auto view = GetGalCanvas()->GetView();
view->GetPainter()->GetSettings()->ImportLegacyColors( &cds );
GetGalCanvas()->Refresh();
// Re-create the layer manager to allow arbitrary colors when GAL is enabled
UpdateUserInterface();
}

View File

@ -572,7 +572,7 @@ public:
void Show3D_Frame( wxCommandEvent& event ) override;
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
void UseGalCanvas() override;
void ActivateGalCanvas() override;
/**
* Function ShowBoardSetupDialog

View File

@ -274,8 +274,6 @@ void PCB_BASE_FRAME::SelectCopperLayerPair()
if( screen->m_Route_Layer_TOP == screen->m_Route_Layer_BOTTOM )
DisplayInfoMessage( this, _( "Warning: top and bottom layers are same." ) );
}
m_canvas->MoveCursorToCrossHair();
}

View File

@ -380,7 +380,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
GetScreen()->PushCommandToUndoList( oldBuffer );
UseGalCanvas();
ActivateGalCanvas();
}

View File

@ -158,7 +158,7 @@ void Refresh()
auto gal_canvas = static_cast<PCB_DRAW_PANEL_GAL*>( s_PcbEditFrame->GetGalCanvas() );
// Reinit everything: this is the easy way to do that
s_PcbEditFrame->UseGalCanvas();
s_PcbEditFrame->ActivateGalCanvas();
gal_canvas->Refresh();
}
}

View File

@ -57,7 +57,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE_CONTAINER* aZone )
ZONE_SETTINGS zoneInfo = GetZoneSettings();
BOARD_COMMIT commit( this );
m_canvas->SetIgnoreMouseEvents( true );
// Save initial zones configuration, for undo/redo, before adding new zone
// note the net name and the layer can be changed, so we must save all zones
@ -83,9 +82,6 @@ void PCB_EDIT_FRAME::Edit_Zone_Params( ZONE_CONTAINER* aZone )
dialogResult = InvokeNonCopperZonesEditor( this, &zoneInfo );
}
m_canvas->MoveCursorToCrossHair();
m_canvas->SetIgnoreMouseEvents( false );
if( dialogResult == wxID_CANCEL )
{
s_AuxiliaryList.ClearListAndDeleteItems();