Hook up refresh buttons to library tree synchronisation.
Fixes: lp:1820057 * https://bugs.launchpad.net/kicad/+bug/1820057
This commit is contained in:
parent
63db3f7c17
commit
3c11b89e4c
|
@ -11,6 +11,10 @@ TOOL_ACTION ACTIONS::cancelInteractive( "common.Interactive.cancel",
|
|||
cancel_xpm, AF_NONE );
|
||||
|
||||
// View Controls
|
||||
TOOL_ACTION ACTIONS::zoomRedraw( "common.Control.zoomRedraw",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_REDRAW ),
|
||||
_( "Refresh View" ), "", zoom_redraw_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::zoomIn( "common.Control.zoomIn",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
|
||||
_( "Zoom In" ), "", zoom_in_xpm );
|
||||
|
|
|
@ -74,46 +74,46 @@ int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( type )
|
||||
{
|
||||
case ACTIONS::CURSOR_UP:
|
||||
cursor -= VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_DOWN:
|
||||
cursor += VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_LEFT:
|
||||
cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_RIGHT:
|
||||
cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_CLICK: // fall through
|
||||
case ACTIONS::CURSOR_DBL_CLICK:
|
||||
{
|
||||
TOOL_ACTIONS action = TA_NONE;
|
||||
int modifiers = 0;
|
||||
|
||||
modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
|
||||
modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
|
||||
modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
|
||||
|
||||
if( type == ACTIONS::CURSOR_CLICK )
|
||||
action = TA_MOUSE_CLICK;
|
||||
else if( type == ACTIONS::CURSOR_DBL_CLICK )
|
||||
action = TA_MOUSE_DBLCLICK;
|
||||
else
|
||||
wxFAIL;
|
||||
|
||||
TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
|
||||
evt.SetMousePosition( getViewControls()->GetCursorPosition() );
|
||||
m_toolMgr->ProcessEvent( evt );
|
||||
|
||||
return 0;
|
||||
}
|
||||
case ACTIONS::CURSOR_UP:
|
||||
cursor -= VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_DOWN:
|
||||
cursor += VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_LEFT:
|
||||
cursor -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_RIGHT:
|
||||
cursor += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_CLICK: // fall through
|
||||
case ACTIONS::CURSOR_DBL_CLICK:
|
||||
{
|
||||
TOOL_ACTIONS action = TA_NONE;
|
||||
int modifiers = 0;
|
||||
|
||||
modifiers |= wxGetKeyState( WXK_SHIFT ) ? MD_SHIFT : 0;
|
||||
modifiers |= wxGetKeyState( WXK_CONTROL ) ? MD_CTRL : 0;
|
||||
modifiers |= wxGetKeyState( WXK_ALT ) ? MD_ALT : 0;
|
||||
|
||||
if( type == ACTIONS::CURSOR_CLICK )
|
||||
action = TA_MOUSE_CLICK;
|
||||
else if( type == ACTIONS::CURSOR_DBL_CLICK )
|
||||
action = TA_MOUSE_DBLCLICK;
|
||||
else
|
||||
wxFAIL;
|
||||
|
||||
TOOL_EVENT evt( TC_MOUSE, action, BUT_LEFT | modifiers );
|
||||
evt.SetMousePosition( getViewControls()->GetCursorPosition() );
|
||||
m_toolMgr->ProcessEvent( evt );
|
||||
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
getViewControls()->SetCursorPosition( cursor, true, true );
|
||||
|
@ -132,25 +132,25 @@ int COMMON_TOOLS::PanControl( const TOOL_EVENT& aEvent )
|
|||
|
||||
switch( type )
|
||||
{
|
||||
case ACTIONS::CURSOR_UP:
|
||||
center -= VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
case ACTIONS::CURSOR_UP:
|
||||
center -= VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_DOWN:
|
||||
center += VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
case ACTIONS::CURSOR_DOWN:
|
||||
center += VECTOR2D( 0, gridSize.y );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_LEFT:
|
||||
center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
case ACTIONS::CURSOR_LEFT:
|
||||
center -= VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
case ACTIONS::CURSOR_RIGHT:
|
||||
center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
case ACTIONS::CURSOR_RIGHT:
|
||||
center += VECTOR2D( mirroredX ? -gridSize.x : gridSize.x, 0 );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL;
|
||||
break;
|
||||
default:
|
||||
wxFAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
view->SetCenter( center );
|
||||
|
@ -159,6 +159,13 @@ int COMMON_TOOLS::PanControl( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::ZoomRedraw( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
m_frame->HardRedraw();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::ZoomInOut( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
bool direction = aEvent.IsAction( &ACTIONS::zoomIn );
|
||||
|
@ -389,6 +396,7 @@ void COMMON_TOOLS::setTransitions()
|
|||
Go( &COMMON_TOOLS::PanControl, ACTIONS::panRight.MakeEvent() );
|
||||
|
||||
// Zoom control
|
||||
Go( &COMMON_TOOLS::ZoomRedraw, ACTIONS::zoomRedraw.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomIn.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::ZoomInOut, ACTIONS::zoomOut.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::ZoomInOutCenter, ACTIONS::zoomInCenter.MakeEvent() );
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,11 +23,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file lib_edit_frame.cpp
|
||||
* @brief LIB_EDIT_FRAME class is the symbol library editor frame.
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
|
@ -745,14 +740,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
STATUS_FLAGS oldFlags = item->GetFlags();
|
||||
item->ClearFlags();
|
||||
/* item->Draw( m_canvas, &dc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
|
||||
DefaultTransform );
|
||||
( (LIB_POLYLINE*) item )->DeleteSegment( GetCrossHairPosition( true ) );
|
||||
item->Draw( m_canvas, &dc, wxPoint( 0, 0 ), COLOR4D::UNSPECIFIED, g_XorMode, NULL,
|
||||
DefaultTransform );*/
|
||||
item->SetFlags( oldFlags );
|
||||
m_lastDrawItem = NULL;
|
||||
}
|
||||
break;
|
||||
|
@ -768,13 +756,10 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
if( item->Type() == LIB_PIN_T )
|
||||
{
|
||||
StartMovePin( item );
|
||||
}
|
||||
else
|
||||
{
|
||||
StartMoveDrawSymbol( nullptr, item );
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case ID_POPUP_LIBEDIT_MODIFY_ITEM:
|
||||
|
@ -801,9 +786,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
m_canvas->CrossHairOff( nullptr );
|
||||
|
||||
if( item->Type() == LIB_FIELD_T )
|
||||
{
|
||||
EditField( (LIB_FIELD*) item );
|
||||
}
|
||||
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
m_canvas->CrossHairOn( );
|
||||
|
@ -1772,6 +1755,7 @@ void LIB_EDIT_FRAME::RebuildView()
|
|||
|
||||
void LIB_EDIT_FRAME::HardRedraw()
|
||||
{
|
||||
SyncLibraries( true );
|
||||
RebuildView();
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -23,10 +23,6 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file tool_lib.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <hotkeys.h>
|
||||
#include <eeschema_id.h>
|
||||
|
@ -129,7 +125,8 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
|
|||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
|
||||
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Libedit_Hotkeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
|
||||
msg = AddHotkeyName( _( "Refresh libraries and redraw view" ), g_Libedit_Hotkeys_Descr,
|
||||
HK_ZOOM_REDRAW, IS_COMMENT );
|
||||
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
||||
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
|
||||
|
||||
|
@ -218,16 +215,9 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
|
|||
KiScaledBitmap( unit_mm_xpm, this ),
|
||||
_( "Set units to millimeters" ), wxITEM_CHECK );
|
||||
|
||||
#ifndef __APPLE__
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
||||
KiScaledBitmap( cursor_shape_xpm, this ),
|
||||
_( "Change cursor shape" ), wxITEM_CHECK );
|
||||
#else
|
||||
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
||||
KiScaledBitmap( cursor_shape_xpm, this ),
|
||||
_( "Change cursor shape (not supported in Legacy Toolset)" ),
|
||||
wxITEM_CHECK );
|
||||
#endif
|
||||
|
||||
m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, wxEmptyString,
|
||||
KiScaledBitmap( pin_show_etype_xpm, this ),
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2015-2019 KiCad Developers, see change_log.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -477,8 +477,8 @@ void SCH_BASE_FRAME::CenterScreen( const wxPoint& aCenterPoint, bool aWarpPointe
|
|||
|
||||
void SCH_BASE_FRAME::HardRedraw()
|
||||
{
|
||||
// Currently: just refresh the screen
|
||||
GetCanvas()->Refresh();
|
||||
GetGalCanvas()->GetView()->UpdateAllItems( KIGFX::ALL );
|
||||
GetGalCanvas()->ForceRefresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -610,7 +610,7 @@ void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet )
|
|||
void SCH_EDIT_FRAME::HardRedraw()
|
||||
{
|
||||
static_cast<SCH_DRAW_PANEL*>( m_canvas )->DisplaySheet( g_CurrentSheet->LastScreen() );
|
||||
GetCanvas()->Refresh();
|
||||
GetGalCanvas()->ForceRefresh();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
static TOOL_ACTION cancelInteractive;
|
||||
|
||||
// View controls
|
||||
static TOOL_ACTION zoomRedraw;
|
||||
static TOOL_ACTION zoomIn;
|
||||
static TOOL_ACTION zoomOut;
|
||||
static TOOL_ACTION zoomInCenter;
|
||||
|
|
|
@ -45,6 +45,7 @@ public:
|
|||
void Reset( RESET_REASON aReason ) override;
|
||||
|
||||
// View controls
|
||||
int ZoomRedraw( const TOOL_EVENT& aEvent );
|
||||
int ZoomInOut( const TOOL_EVENT& aEvent );
|
||||
int ZoomInOutCenter( const TOOL_EVENT& aEvent );
|
||||
int ZoomCenter( const TOOL_EVENT& aEvent );
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -20,11 +20,6 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file moduleframe.cpp
|
||||
* @brief Footprint (module) editor main window.
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <kiface_i.h>
|
||||
#include <kiway.h>
|
||||
|
@ -360,6 +355,13 @@ void FOOTPRINT_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
|||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::HardRedraw()
|
||||
{
|
||||
SyncLibraryTree( true );
|
||||
GetGalCanvas()->ForceRefresh();
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
|
||||
{
|
||||
auto& treePane = m_auimgr.GetPane( m_treePane );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
|
@ -17,11 +17,6 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file footprint_edit_frame.h
|
||||
* @brief Definition of class FOOTPRINT_EDIT_FRAME.
|
||||
*/
|
||||
|
||||
#ifndef FOOTPRINT_EDIT_FRAME_H
|
||||
#define FOOTPRINT_EDIT_FRAME_H
|
||||
|
||||
|
@ -117,6 +112,11 @@ public:
|
|||
*/
|
||||
void RedrawActiveWindow( wxDC* DC, bool EraseBg ) override;
|
||||
|
||||
/**
|
||||
* Refresh the library tree and redraw the window
|
||||
*/
|
||||
void HardRedraw() override;
|
||||
|
||||
/**
|
||||
* Create the main horizontal toolbar for the footprint editor.
|
||||
*/
|
||||
|
@ -401,8 +401,6 @@ public:
|
|||
/**
|
||||
* Test whether a given element category is visible.
|
||||
*
|
||||
* Keep this as an inline function.
|
||||
*
|
||||
* @param aElement is from the enum by the same name
|
||||
* @return bool - true if the element is visible.
|
||||
* @see enum PCB_LAYER_ID
|
||||
|
@ -448,14 +446,10 @@ public:
|
|||
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
||||
*
|
||||
* @param aFileSet - hold the BOARD file to load, a vector of one element.
|
||||
*
|
||||
* @param aCtl - KICTL_ bits, one to indicate that an append of the board file
|
||||
* aFileName to the currently loaded file is desired.
|
||||
* @see #KIWAY_PLAYER for bit defines.
|
||||
*
|
||||
* @return bool - false if file load fails, otherwise true.
|
||||
bool LoadOnePcbFile( const wxString& aFileName, bool aAppend = false,
|
||||
bool aForceFileDialog = false );
|
||||
*/
|
||||
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
|
||||
|
||||
|
|
|
@ -88,7 +88,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
|
|||
_( "Redo last undo command" ) );
|
||||
|
||||
KiScaledSeparator( m_mainToolBar, this );
|
||||
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hotkeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
|
||||
msg = AddHotkeyName( _( "Refresh libraries and redraw view" ), g_Module_Editor_Hotkeys_Descr,
|
||||
HK_ZOOM_REDRAW, IS_COMMENT );
|
||||
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
|
||||
|
||||
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -103,6 +103,11 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
|
|||
case ID_MODEDIT_PLACE_GRID_COORD:
|
||||
return ACTIONS::gridSetOrigin.MakeEvent();
|
||||
|
||||
case ID_ZOOM_REDRAW:
|
||||
case ID_POPUP_ZOOM_REDRAW:
|
||||
case ID_VIEWER_ZOOM_REDRAW:
|
||||
return ACTIONS::zoomRedraw.MakeEvent();
|
||||
|
||||
case ID_ZOOM_IN: // toolbar button "Zoom In"
|
||||
case ID_VIEWER_ZOOM_IN:
|
||||
return ACTIONS::zoomInCenter.MakeEvent();
|
||||
|
|
Loading…
Reference in New Issue