mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 11:21:41 +00:00
Remove some legacy cursor handling stuff.
This commit is contained in:
parent
edc8438ef0
commit
d2daab808c
common
cvpcb
eeschema
dialogs
edit_component_in_schematic.cppgetpart.cpplibedit
sch_base_frame.cppsch_draw_panel.cppsch_draw_panel.hsheet.cpptools
gerbview
clear_gbr_drawlayers.cpp
dialogs
events_called_functions.cppfiles.cppgerbview_frame.cppgerbview_frame.hgerbview_layer_widget.cppinclude
pagelayout_editor
pcbnew
dialogs
edit.cppedit_track_width.cppfootprint_edit_frame.cppfootprint_edit_frame.hfootprint_editor_utils.cppfootprint_viewer_frame.cppfootprint_wizard_frame.cppmicrowave.cpppcb_base_edit_frame.cpppcb_base_edit_frame.hpcb_base_frame.cpppcb_draw_panel_gal.cpppcb_edit_frame.cpppcb_edit_frame.hsel_layer.cppswig
zones_by_polygon.cpp@ -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,37 +575,33 @@ 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;
|
||||
|
||||
m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
|
||||
if( m_messagePanel )
|
||||
m_messagePanel->AppendMessage( textUpper, textLower, color, pad );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::ClearMsgPanel()
|
||||
{
|
||||
if( m_messagePanel == NULL )
|
||||
return;
|
||||
|
||||
m_messagePanel->EraseMsgBox();
|
||||
if( m_messagePanel )
|
||||
m_messagePanel->EraseMsgBox();
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList )
|
||||
{
|
||||
if( m_messagePanel == NULL )
|
||||
return;
|
||||
{
|
||||
m_messagePanel->EraseMsgBox();
|
||||
|
||||
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();
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,5 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
||||
if( m_CurrentText->IsNew() )
|
||||
SetDefaultTextSize( m_CurrentText->GetTextWidth() );
|
||||
|
||||
m_Parent->GetCanvas()->MoveCursorToCrossHair();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -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() );
|
||||
}
|
||||
|
@ -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 )
|
||||
|
@ -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 )
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
|
@ -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()
|
||||
|
@ -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();
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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() )
|
||||
|
@ -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 )
|
||||
{
|
||||
|
@ -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 );
|
||||
}
|
||||
|
@ -88,5 +88,5 @@ void GERBVIEW_FRAME::Erase_Current_DrawLayer( bool query )
|
||||
|
||||
ReFillLayerWidget();
|
||||
syncLayerBox();
|
||||
m_canvas->Refresh();
|
||||
GetGalCanvas()->Refresh();
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user