diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index 35ff69b65c..41ce66221c 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -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 ); diff --git a/common/tool/common_tools.cpp b/common/tool/common_tools.cpp index d550e7365b..bd0d594b07 100644 --- a/common/tool/common_tools.cpp +++ b/common/tool/common_tools.cpp @@ -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() ); diff --git a/eeschema/libedit/lib_edit_frame.cpp b/eeschema/libedit/lib_edit_frame.cpp index 8d83efd972..303f5811fc 100644 --- a/eeschema/libedit/lib_edit_frame.cpp +++ b/eeschema/libedit/lib_edit_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * 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 #include #include @@ -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(); } diff --git a/eeschema/libedit/tool_lib.cpp b/eeschema/libedit/tool_lib.cpp index f27c438327..ee4892e03c 100644 --- a/eeschema/libedit/tool_lib.cpp +++ b/eeschema/libedit/tool_lib.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008 Wayne Stambaugh - * 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 #include #include @@ -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 ), diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp index 5c323470a4..5421a7c76c 100644 --- a/eeschema/sch_base_frame.cpp +++ b/eeschema/sch_base_frame.cpp @@ -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 - * 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(); } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 58a3c42a51..564a8fd41e 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -610,7 +610,7 @@ void SCH_EDIT_FRAME::SetCurrentSheet( const SCH_SHEET_PATH& aSheet ) void SCH_EDIT_FRAME::HardRedraw() { static_cast( m_canvas )->DisplaySheet( g_CurrentSheet->LastScreen() ); - GetCanvas()->Refresh(); + GetGalCanvas()->ForceRefresh(); } diff --git a/include/tool/actions.h b/include/tool/actions.h index 4e9c0564ba..ffa7c64109 100644 --- a/include/tool/actions.h +++ b/include/tool/actions.h @@ -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; diff --git a/include/tool/common_tools.h b/include/tool/common_tools.h index d18649cec9..ced8464682 100644 --- a/include/tool/common_tools.h +++ b/include/tool/common_tools.h @@ -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 ); diff --git a/pcbnew/footprint_edit_frame.cpp b/pcbnew/footprint_edit_frame.cpp index c97fda8718..7ceb1e34de 100644 --- a/pcbnew/footprint_edit_frame.cpp +++ b/pcbnew/footprint_edit_frame.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2015-2016 Wayne Stambaugh - * 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 . */ -/** - * @file moduleframe.cpp - * @brief Footprint (module) editor main window. - */ - #include #include #include @@ -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 ); diff --git a/pcbnew/footprint_edit_frame.h b/pcbnew/footprint_edit_frame.h index 1f821b3f5f..ca549b7511 100644 --- a/pcbnew/footprint_edit_frame.h +++ b/pcbnew/footprint_edit_frame.h @@ -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 . */ -/** - * @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& aFileSet, int aCtl = 0 ) override; diff --git a/pcbnew/tool_footprint_editor.cpp b/pcbnew/tool_footprint_editor.cpp index cb6a37518d..be226db1ef 100644 --- a/pcbnew/tool_footprint_editor.cpp +++ b/pcbnew/tool_footprint_editor.cpp @@ -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 ); diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 29cdc3bd5b..7c53917c0b 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -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 * * This program is free software; you can redistribute it and/or @@ -103,6 +103,11 @@ OPT 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();