mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-20 18:01:41 +00:00
Move some more menu commands to ACTIONs.
This commit is contained in:
parent
01326d1304
commit
a27e4246e0
common
cvpcb
eeschema
gerbview
include
pagelayout_editor
pcbnew
CMakeLists.txtfootprint_edit_frame.cppfootprint_edit_frame.hfootprint_viewer_frame.cppfootprint_wizard_frame.cppmenubar_footprint_editor.cppmenubar_pcb_editor.cpppcb_base_edit_frame.cpppcb_base_edit_frame.hpcb_base_frame.cpppcb_draw_panel_gal.cpppcb_edit_frame.cpppcb_edit_frame.h
swig
toolbar_onrightclick.cpp@ -375,11 +375,6 @@ int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
|
||||
{
|
||||
}
|
||||
@ -618,12 +613,7 @@ void EDA_DRAW_FRAME::PushPreferences( const EDA_DRAW_PANEL* aParentCanvas )
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
void EDA_DRAW_FRAME::UseGalCanvas()
|
||||
{
|
||||
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
||||
|
||||
@ -633,7 +623,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
||||
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
||||
|
||||
galCanvas->SetEvtHandlerEnabled( aEnable );
|
||||
galCanvas->SetEvtHandlerEnabled( true );
|
||||
galCanvas->StartDrawing();
|
||||
|
||||
// Reset current tool on switch();
|
||||
@ -641,17 +631,12 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
}
|
||||
|
||||
|
||||
bool EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
{
|
||||
// JEY TODO: unravel this...
|
||||
auto galCanvas = GetGalCanvas();
|
||||
wxCHECK( galCanvas, false );
|
||||
bool use_gal = galCanvas->SwitchBackend( aCanvasType );
|
||||
use_gal &= aCanvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
UseGalCanvas( use_gal );
|
||||
m_canvasType = use_gal ? aCanvasType : EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
GetGalCanvas()->SwitchBackend( aCanvasType );
|
||||
m_canvasType = GetGalCanvas()->GetBackend();
|
||||
|
||||
return use_gal;
|
||||
UseGalCanvas();
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,10 +23,6 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file draw_frame.cpp
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
@ -396,11 +392,6 @@ int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||
return result;
|
||||
}
|
||||
|
||||
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
|
||||
{
|
||||
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
|
||||
@ -784,219 +775,7 @@ static const double MAX_AXIS = INT_MAX - 100;
|
||||
#define VIRT_MAX (MAX_AXIS/2.0) ///< max X or Y coordinate in virtual space
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
||||
{
|
||||
BASE_SCREEN* screen = GetScreen();
|
||||
|
||||
if( !screen || !m_canvas )
|
||||
return;
|
||||
|
||||
double scale = screen->GetScalingFactor();
|
||||
|
||||
wxLogTrace( traceScrollSettings, wxT( "Center Position = ( %d, %d ), scale = %.10g" ),
|
||||
aCenterPositionIU.x, aCenterPositionIU.y, scale );
|
||||
|
||||
// Calculate the portion of the drawing that can be displayed in the
|
||||
// client area at the current zoom level.
|
||||
|
||||
// visible viewport in device units ~ pixels
|
||||
wxSize clientSizeDU = m_canvas->GetClientSize();
|
||||
|
||||
// Size of the client window in IU
|
||||
DSIZE clientSizeIU( clientSizeDU.x / scale, clientSizeDU.y / scale );
|
||||
|
||||
// Full drawing or "page" rectangle in internal units
|
||||
DBOX pageRectIU( wxPoint( 0, 0 ), wxSize( GetPageSizeIU().x, GetPageSizeIU().y ) );
|
||||
|
||||
// Remark: if something is modified here, perhaps EDA_DRAW_FRAME::RedrawScreen2()
|
||||
// will need changes accordint to the way the center is computed
|
||||
// Account for scrollbars
|
||||
wxSize scrollbarSizeDU = m_canvas->GetSize() - m_canvas->GetClientSize();
|
||||
wxSize scrollbarSizeIU = scrollbarSizeDU * (1 / scale);
|
||||
wxPoint centerAdjustedIU = aCenterPositionIU + scrollbarSizeIU / 2;
|
||||
|
||||
// The upper left corner of the client rectangle in internal units.
|
||||
double xIU = centerAdjustedIU.x - clientSizeIU.x / 2.0;
|
||||
double yIU = centerAdjustedIU.y - clientSizeIU.y / 2.0;
|
||||
|
||||
// If drawn around the center, adjust the client rectangle accordingly.
|
||||
if( screen->m_Center )
|
||||
{
|
||||
// half page offset.
|
||||
xIU += pageRectIU.GetWidth() / 2.0;
|
||||
yIU += pageRectIU.GetHeight() / 2.0;
|
||||
}
|
||||
|
||||
DBOX clientRectIU( wxPoint( xIU, yIU ), wxSize( clientSizeIU.x, clientSizeIU.y ) );
|
||||
wxPoint centerPositionIU;
|
||||
|
||||
// put "int" limits on the clientRect
|
||||
if( clientRectIU.GetLeft() < VIRT_MIN )
|
||||
clientRectIU.MoveLeftTo( VIRT_MIN );
|
||||
if( clientRectIU.GetTop() < VIRT_MIN )
|
||||
clientRectIU.MoveTopTo( VIRT_MIN );
|
||||
if( clientRectIU.GetRight() > VIRT_MAX )
|
||||
clientRectIU.MoveRightTo( VIRT_MAX );
|
||||
if( clientRectIU.GetBottom() > VIRT_MAX )
|
||||
clientRectIU.MoveBottomTo( VIRT_MAX );
|
||||
|
||||
centerPositionIU.x = KiROUND( clientRectIU.GetX() + clientRectIU.GetWidth() / 2 );
|
||||
centerPositionIU.y = KiROUND( clientRectIU.GetY() + clientRectIU.GetHeight() / 2 );
|
||||
|
||||
if( screen->m_Center )
|
||||
{
|
||||
centerPositionIU.x -= KiROUND( pageRectIU.GetWidth() / 2.0 );
|
||||
centerPositionIU.y -= KiROUND( pageRectIU.GetHeight() / 2.0 );
|
||||
}
|
||||
|
||||
DSIZE virtualSizeIU;
|
||||
|
||||
if( pageRectIU.GetLeft() < clientRectIU.GetLeft() && pageRectIU.GetRight() > clientRectIU.GetRight() )
|
||||
{
|
||||
virtualSizeIU.x = pageRectIU.GetSize().x;
|
||||
}
|
||||
else
|
||||
{
|
||||
double pageCenterX = pageRectIU.GetX() + ( pageRectIU.GetWidth() / 2 );
|
||||
double clientCenterX = clientRectIU.GetX() + ( clientRectIU.GetWidth() / 2 );
|
||||
|
||||
if( clientRectIU.GetWidth() > pageRectIU.GetWidth() )
|
||||
{
|
||||
if( pageCenterX > clientCenterX )
|
||||
virtualSizeIU.x = ( pageCenterX - clientRectIU.GetLeft() ) * 2;
|
||||
else if( pageCenterX < clientCenterX )
|
||||
virtualSizeIU.x = ( clientRectIU.GetRight() - pageCenterX ) * 2;
|
||||
else
|
||||
virtualSizeIU.x = clientRectIU.GetWidth();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pageCenterX > clientCenterX )
|
||||
virtualSizeIU.x = pageRectIU.GetWidth() + ( (pageRectIU.GetLeft() - clientRectIU.GetLeft() ) * 2 );
|
||||
else if( pageCenterX < clientCenterX )
|
||||
virtualSizeIU.x = pageRectIU.GetWidth() + ( (clientRectIU.GetRight() - pageRectIU.GetRight() ) * 2 );
|
||||
else
|
||||
virtualSizeIU.x = pageRectIU.GetWidth();
|
||||
}
|
||||
}
|
||||
|
||||
if( pageRectIU.GetTop() < clientRectIU.GetTop() && pageRectIU.GetBottom() > clientRectIU.GetBottom() )
|
||||
{
|
||||
virtualSizeIU.y = pageRectIU.GetSize().y;
|
||||
}
|
||||
else
|
||||
{
|
||||
double pageCenterY = pageRectIU.GetY() + ( pageRectIU.GetHeight() / 2 );
|
||||
double clientCenterY = clientRectIU.GetY() + ( clientRectIU.GetHeight() / 2 );
|
||||
|
||||
if( clientRectIU.GetHeight() > pageRectIU.GetHeight() )
|
||||
{
|
||||
if( pageCenterY > clientCenterY )
|
||||
virtualSizeIU.y = ( pageCenterY - clientRectIU.GetTop() ) * 2;
|
||||
else if( pageCenterY < clientCenterY )
|
||||
virtualSizeIU.y = ( clientRectIU.GetBottom() - pageCenterY ) * 2;
|
||||
else
|
||||
virtualSizeIU.y = clientRectIU.GetHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
if( pageCenterY > clientCenterY )
|
||||
virtualSizeIU.y = pageRectIU.GetHeight() +
|
||||
( ( pageRectIU.GetTop() - clientRectIU.GetTop() ) * 2 );
|
||||
else if( pageCenterY < clientCenterY )
|
||||
virtualSizeIU.y = pageRectIU.GetHeight() +
|
||||
( ( clientRectIU.GetBottom() - pageRectIU.GetBottom() ) * 2 );
|
||||
else
|
||||
virtualSizeIU.y = pageRectIU.GetHeight();
|
||||
}
|
||||
}
|
||||
|
||||
// put "int" limits on the virtualSizeIU
|
||||
virtualSizeIU.x = std::min( virtualSizeIU.x, MAX_AXIS );
|
||||
virtualSizeIU.y = std::min( virtualSizeIU.y, MAX_AXIS );
|
||||
|
||||
if( screen->m_Center )
|
||||
{
|
||||
screen->m_DrawOrg.x = -KiROUND( virtualSizeIU.x / 2.0 );
|
||||
screen->m_DrawOrg.y = -KiROUND( virtualSizeIU.y / 2.0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
screen->m_DrawOrg.x = -KiROUND( ( virtualSizeIU.x - pageRectIU.GetWidth() ) / 2.0 );
|
||||
screen->m_DrawOrg.y = -KiROUND( ( virtualSizeIU.y - pageRectIU.GetHeight() ) / 2.0 );
|
||||
}
|
||||
|
||||
/* Always set scrollbar pixels per unit to 1 unless you want the zoom
|
||||
* around cursor to jump around. This reported problem occurs when the
|
||||
* zoom point is not on a pixel per unit increment. If you set the
|
||||
* pixels per unit to 10, you have potential for the zoom point to
|
||||
* jump around +/-5 pixels from the nearest grid point.
|
||||
*/
|
||||
screen->m_ScrollPixelsPerUnitX = screen->m_ScrollPixelsPerUnitY = 1;
|
||||
|
||||
// Number of scroll bar units for the given zoom level in device units.
|
||||
double unitsX = virtualSizeIU.x * scale;
|
||||
double unitsY = virtualSizeIU.y * scale;
|
||||
|
||||
// Store the requested center position for later use
|
||||
SetScrollCenterPosition( aCenterPositionIU );
|
||||
|
||||
// Calculate the scroll bar position in internal units to place the
|
||||
// center position at the center of client rectangle.
|
||||
double posX = centerPositionIU.x - clientRectIU.GetWidth() / 2.0 - screen->m_DrawOrg.x;
|
||||
double posY = centerPositionIU.y - clientRectIU.GetHeight() / 2.0 - screen->m_DrawOrg.y;
|
||||
|
||||
// Convert scroll bar position to device units.
|
||||
posX = KiROUND( posX * scale );
|
||||
posY = KiROUND( posY * scale );
|
||||
|
||||
if( posX < 0 )
|
||||
{
|
||||
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
|
||||
posX = 0;
|
||||
}
|
||||
|
||||
if( posX > unitsX )
|
||||
{
|
||||
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar X position %.10g" ), posX );
|
||||
posX = unitsX;
|
||||
}
|
||||
|
||||
if( posY < 0 )
|
||||
{
|
||||
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
|
||||
posY = 0;
|
||||
}
|
||||
|
||||
if( posY > unitsY )
|
||||
{
|
||||
wxLogTrace( traceScrollSettings, wxT( "Required scroll bar Y position %.10g" ), posY );
|
||||
posY = unitsY;
|
||||
}
|
||||
|
||||
screen->m_ScrollbarPos = wxPoint( KiROUND( posX ), KiROUND( posY ) );
|
||||
screen->m_ScrollbarNumber = wxSize( KiROUND( unitsX ), KiROUND( unitsY ) );
|
||||
|
||||
wxLogTrace( traceScrollSettings,
|
||||
wxT( "Drawing = (%.10g, %.10g), Client = (%.10g, %.10g), Offset = (%d, %d), SetScrollbars(%d, %d, %d, %d, %d, %d)" ),
|
||||
virtualSizeIU.x, virtualSizeIU.y, clientSizeIU.x, clientSizeIU.y,
|
||||
screen->m_DrawOrg.x, screen->m_DrawOrg.y,
|
||||
screen->m_ScrollPixelsPerUnitX, screen->m_ScrollPixelsPerUnitY,
|
||||
screen->m_ScrollbarNumber.x, screen->m_ScrollbarNumber.y,
|
||||
screen->m_ScrollbarPos.x, screen->m_ScrollbarPos.y );
|
||||
|
||||
bool noRefresh = true;
|
||||
|
||||
m_canvas->SetScrollbars( screen->m_ScrollPixelsPerUnitX,
|
||||
screen->m_ScrollPixelsPerUnitY,
|
||||
screen->m_ScrollbarNumber.x,
|
||||
screen->m_ScrollbarNumber.y,
|
||||
screen->m_ScrollbarPos.x,
|
||||
screen->m_ScrollbarPos.y, noRefresh );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
void EDA_DRAW_FRAME::UseGalCanvas()
|
||||
{
|
||||
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||
|
||||
@ -1011,8 +790,8 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
||||
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
||||
|
||||
m_canvas->SetEvtHandlerEnabled( !aEnable );
|
||||
GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
|
||||
m_canvas->SetEvtHandlerEnabled( false );
|
||||
GetGalCanvas()->SetEvtHandlerEnabled( true );
|
||||
|
||||
GetGalCanvas()->StartDrawing();
|
||||
|
||||
@ -1027,16 +806,12 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||
}
|
||||
|
||||
|
||||
bool EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
void EDA_DRAW_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
{
|
||||
auto galCanvas = GetGalCanvas();
|
||||
wxCHECK( galCanvas, false );
|
||||
bool use_gal = galCanvas->SwitchBackend( aCanvasType );
|
||||
use_gal &= aCanvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
UseGalCanvas( use_gal );
|
||||
m_canvasType = use_gal ? aCanvasType : EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
||||
GetGalCanvas()->SwitchBackend( aCanvasType );
|
||||
m_canvasType = GetGalCanvas()->GetBackend();
|
||||
|
||||
return use_gal;
|
||||
UseGalCanvas();
|
||||
}
|
||||
|
||||
|
||||
|
@ -9,6 +9,11 @@ TOOL_ACTION ACTIONS::doNew( "common.Control.new",
|
||||
_( "New..." ), _( "Create a new document in the editor" ),
|
||||
new_generic_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::newLibrary( "common.Control.newLibrary",
|
||||
AS_GLOBAL, 0,
|
||||
_( "New Library..." ), _( "Create a new library folder" ),
|
||||
new_generic_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::open( "common.Control.open",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
|
||||
_( "Open..." ), _( "Open existing document" ),
|
||||
@ -34,6 +39,11 @@ TOOL_ACTION ACTIONS::saveAll( "common.Control.saveAll",
|
||||
_( "Save All" ), _( "Save all changes" ),
|
||||
save_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::revert( "common.Control.revert",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Revert" ), _( "Throw away changes" ),
|
||||
undo_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::pageSettings( "common.Control.pageSettings",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Page Settings..." ), _( "Settings for paper size and frame references" ),
|
||||
@ -297,7 +307,6 @@ TOOL_ACTION ACTIONS::toggleUnits( "common.Control.toggleUnits",
|
||||
_( "Switch units" ), _( "Switch between inches and millimeters" ),
|
||||
unit_mm_xpm );
|
||||
|
||||
|
||||
TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Polar Coordinates" ), _( "Switch between polar and cartesian coordinate systems" ),
|
||||
@ -308,12 +317,21 @@ TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor",
|
||||
_( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ),
|
||||
cursor_xpm );
|
||||
|
||||
|
||||
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
|
||||
AS_GLOBAL, 0,
|
||||
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
|
||||
cursor_shape_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_OPENGL ),
|
||||
_( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ),
|
||||
tools_xpm );
|
||||
|
||||
TOOL_ACTION ACTIONS::standardGraphics( "common.Control.standardGraphics",
|
||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_CAIRO ),
|
||||
_( "Standard Graphics" ), _( "Use software graphics (fall-back)" ),
|
||||
tools_xpm );
|
||||
|
||||
|
||||
// System-wide selection Events
|
||||
|
||||
|
@ -484,6 +484,19 @@ int COMMON_TOOLS::ToggleCursorStyle( const TOOL_EVENT& aEvent )
|
||||
}
|
||||
|
||||
|
||||
int COMMON_TOOLS::SwitchCanvas( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
|
||||
m_frame->SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
||||
else if( aEvent.IsAction( &ACTIONS::standardGraphics ) )
|
||||
m_frame->SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
else
|
||||
wxFAIL_MSG( "Unknown canvas type" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void COMMON_TOOLS::setTransitions()
|
||||
{
|
||||
// Cursor control
|
||||
@ -530,6 +543,9 @@ void COMMON_TOOLS::setTransitions()
|
||||
|
||||
Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.MakeEvent() );
|
||||
|
||||
Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::acceleratedGraphics.MakeEvent() );
|
||||
Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::acceleratedGraphics.MakeEvent() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,7 +173,7 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas( true );
|
||||
UseGalCanvas();
|
||||
|
||||
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
||||
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
||||
|
@ -121,8 +121,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
|
||||
EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
|
||||
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, LIB_EDIT_FRAME::OnSwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, LIB_EDIT_FRAME::OnSwitchCanvas )
|
||||
|
||||
EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions )
|
||||
|
||||
@ -139,8 +137,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
|
||||
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||
LIB_EDIT_FRAME::OnUpdateEditingPart )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, LIB_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, LIB_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@ -1025,10 +1021,10 @@ void LIB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
|
||||
}
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
||||
void LIB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
{
|
||||
// switches currently used canvas ( Cairo / OpenGL):
|
||||
SCH_BASE_FRAME::OnSwitchCanvas( aEvent );
|
||||
SCH_BASE_FRAME::SwitchCanvas( aCanvasType );
|
||||
|
||||
// Set options specific to symbol editor (axies are always enabled):
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
|
@ -129,7 +129,7 @@ public:
|
||||
/**
|
||||
* switches currently used canvas ( Cairo / OpenGL).
|
||||
*/
|
||||
void OnSwitchCanvas( wxCommandEvent& aEvent ) override;
|
||||
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
||||
|
||||
/** The nickname of the current library being edited and empty string if none. */
|
||||
wxString GetCurLib() const;
|
||||
|
@ -44,7 +44,6 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
wxString text;
|
||||
|
||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||
LIB_ID libId = getTargetLibId();
|
||||
@ -58,8 +57,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
||||
};
|
||||
|
||||
//
|
||||
// Menu File:
|
||||
//-- File menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -113,8 +111,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
//
|
||||
// Edit menu
|
||||
//-- Edit menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -141,8 +138,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
editMenu->AddItem( EE_ACTIONS::symbolProperties, havePartCondition );
|
||||
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
||||
|
||||
//
|
||||
// Menu View:
|
||||
//-- View menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -188,8 +184,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
viewMenu->AddSeparator();
|
||||
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
||||
|
||||
//
|
||||
// Menu Place:
|
||||
//-- Place menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -200,15 +195,13 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolArc, EE_CONDITIONS::ShowAlways );
|
||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
//
|
||||
// Menu Inspect:
|
||||
//-- Inspect menu -----------------------------------------------
|
||||
//
|
||||
wxMenu* inspectMenu = new wxMenu;
|
||||
|
||||
text = AddHotkeyName( _( "Show Datasheet" ), g_Libedit_Hotkeys_Descr, HK_LIBEDIT_VIEW_DOC );
|
||||
AddMenuItem( inspectMenu,
|
||||
ID_LIBEDIT_VIEW_DOC,
|
||||
text,
|
||||
AddHotkeyName( _( "Show Datasheet" ), g_Libedit_Hotkeys_Descr, HK_LIBEDIT_VIEW_DOC ),
|
||||
_( "Open associated datasheet in web browser" ),
|
||||
KiBitmap( datasheet_xpm ) );
|
||||
|
||||
@ -218,47 +211,36 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
_( "Check duplicate and off grid pins" ),
|
||||
KiBitmap( erc_xpm ) );
|
||||
|
||||
// Menu Preferences:
|
||||
wxMenu* preferencesMenu = new wxMenu;
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
// Environment varialbes
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
||||
_( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
};
|
||||
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
};
|
||||
|
||||
// Library list
|
||||
AddMenuItem( preferencesMenu,
|
||||
ID_EDIT_SYM_LIB_TABLE,
|
||||
_( "Manage &Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library tables." ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
path_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
prefsMenu->AddItem( ID_EDIT_SYM_LIB_TABLE, _( "Manage &Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library tables." ),
|
||||
library_table_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
// Default values and options
|
||||
text = AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES );
|
||||
AddMenuItem( preferencesMenu, wxID_PREFERENCES, text,
|
||||
_( "Show preferences for all open tools" ),
|
||||
KiBitmap( preference_xpm ) );
|
||||
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||
AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ),
|
||||
_( "Show preferences for all open tools" ),
|
||||
preference_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
// Language submenu
|
||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||
prefsMenu->AddSeparator();
|
||||
Pgm().AddMenuLanguageList( prefsMenu );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Libedit_Hotkeys_Descr,
|
||||
HK_CANVAS_OPENGL );
|
||||
AddMenuItem( preferencesMenu, ID_MENU_CANVAS_OPENGL, text,
|
||||
_( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
|
||||
text = AddHotkeyName( _( "Modern Toolset (Fallba&ck)" ), g_Libedit_Hotkeys_Descr,
|
||||
HK_CANVAS_CAIRO );
|
||||
AddMenuItem( preferencesMenu, ID_MENU_CANVAS_CAIRO, text,
|
||||
_( "Use Modern Toolset with software graphics (fall-back)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
prefsMenu->AddSeparator();
|
||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||
|
||||
//
|
||||
// Create the menubar and append all submenus
|
||||
@ -268,7 +250,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
||||
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||
AddStandardHelpMenu( menuBar );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
|
@ -45,9 +45,6 @@ class CONDITIONAL_MENU;
|
||||
// Build the tools menu
|
||||
static void prepareToolsMenu( wxMenu* aParentMenu );
|
||||
|
||||
// Build the preferences menu
|
||||
static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
|
||||
|
||||
|
||||
void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
{
|
||||
@ -56,15 +53,13 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
// we always have to start from scratch with a new wxMenuBar.
|
||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||
wxMenuBar* menuBar = new wxMenuBar();
|
||||
wxString text;
|
||||
|
||||
auto modifiedDocumentCondition = [] ( const SELECTION& sel ) {
|
||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||
return sheetList.IsModified();
|
||||
};
|
||||
|
||||
//
|
||||
// Menu File:
|
||||
//-- File menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
static ACTION_MENU* openRecentMenu;
|
||||
@ -141,8 +136,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
//
|
||||
// Menu Edit:
|
||||
//-- Edit menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -176,8 +170,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
_( "Sets symbol fields to original library values" ),
|
||||
update_fields_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
//
|
||||
// Menu View:
|
||||
//-- View menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -232,8 +225,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
viewMenu->AppendSeparator();
|
||||
#endif
|
||||
|
||||
//
|
||||
// Menu place:
|
||||
//-- Place menu -----------------------------------------------------------
|
||||
//
|
||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
@ -259,33 +251,57 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||
placeMenu->AddItem( EE_ACTIONS::placeSchematicText, EE_CONDITIONS::ShowAlways );
|
||||
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
//
|
||||
// Menu Inspect:
|
||||
//-- Inspect menu -----------------------------------------------
|
||||
//
|
||||
wxMenu* inspectMenu = new wxMenu;
|
||||
AddMenuItem( inspectMenu, ID_GET_ERC, _( "Electrical Rules &Checker" ),
|
||||
_( "Perform electrical rules check" ), KiBitmap( erc_xpm ) );
|
||||
|
||||
//
|
||||
// Menu Tools:
|
||||
//-- Tools menu -----------------------------------------------
|
||||
//
|
||||
wxMenu* toolsMenu = new wxMenu;
|
||||
prepareToolsMenu( toolsMenu );
|
||||
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
// Menu Preferences:
|
||||
//
|
||||
wxMenu* preferencesMenu = new wxMenu;
|
||||
preparePreferencesMenu( this, preferencesMenu );
|
||||
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
// Create the menubar and append all submenus
|
||||
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
};
|
||||
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
};
|
||||
|
||||
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
path_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddItem( ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library lists" ),
|
||||
library_table_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||
AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ),
|
||||
_( "Show preferences for all open tools" ),
|
||||
preference_xpm, EE_CONDITIONS::ShowAlways );
|
||||
|
||||
prefsMenu->AddSeparator();
|
||||
Pgm().AddMenuLanguageList( prefsMenu );
|
||||
|
||||
prefsMenu->AddSeparator();
|
||||
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||
|
||||
//-- Menubar -----------------------------------------------
|
||||
//
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
||||
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
||||
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||
AddStandardHelpMenu( menuBar );
|
||||
|
||||
SetMenuBar( menuBar );
|
||||
@ -366,52 +382,3 @@ void prepareToolsMenu( wxMenu* aParentMenu )
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
|
||||
{
|
||||
// Path configuration edit dialog.
|
||||
AddMenuItem( aParentMenu, ID_PREFERENCES_CONFIGURE_PATHS, _( "Configure Pa&ths..." ),
|
||||
_( "Edit path configuration environment variables" ),
|
||||
KiBitmap( path_xpm ) );
|
||||
|
||||
// Library
|
||||
AddMenuItem( aParentMenu, ID_EDIT_SYM_LIB_TABLE, _( "Manage Symbol Libraries..." ),
|
||||
_( "Edit the global and project symbol library lists" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
// Options (Preferences on WXMAC)
|
||||
wxString text = AddHotkeyName( _( "&Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES );
|
||||
AddMenuItem( aParentMenu, wxID_PREFERENCES, text,
|
||||
_( "Show preferences for all open tools" ),
|
||||
KiBitmap( preference_xpm ) );
|
||||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
// Language submenu
|
||||
Pgm().AddMenuLanguageList( aParentMenu );
|
||||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Eeschema_Hotkeys_Descr,
|
||||
HK_CANVAS_OPENGL );
|
||||
AddMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL, text,
|
||||
_( "Use Modern Toolset with hardware-accelerated graphics (recommended)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
|
||||
text = AddHotkeyName( _( "Modern Toolset (Fallba&ck)" ), g_Eeschema_Hotkeys_Descr,
|
||||
HK_CANVAS_CAIRO );
|
||||
AddMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, text,
|
||||
_( "Use Modern Toolset with software graphics (fall-back)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
|
||||
aParentMenu->AppendSeparator();
|
||||
|
||||
// Import/export
|
||||
AddMenuItem( aParentMenu, ID_CONFIG_SAVE, _( "&Save Project File..." ),
|
||||
_( "Save project preferences into a project file" ),
|
||||
KiBitmap( save_setup_xpm ) );
|
||||
|
||||
AddMenuItem( aParentMenu, ID_CONFIG_READ, _( "Load P&roject File..." ),
|
||||
_( "Load project preferences from a project file" ),
|
||||
KiBitmap( import_setup_xpm ) );
|
||||
}
|
||||
|
@ -108,42 +108,6 @@ SCH_BASE_FRAME::~SCH_BASE_FRAME()
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = gal_canvas->GetBackend();
|
||||
|
||||
struct { int menuId; int galType; } menuList[] =
|
||||
{
|
||||
{ ID_MENU_CANVAS_OPENGL, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL },
|
||||
{ ID_MENU_CANVAS_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO },
|
||||
};
|
||||
|
||||
for( auto ii: menuList )
|
||||
{
|
||||
wxMenuItem* item = menuBar->FindItem( ii.menuId );
|
||||
if( ii.galType == canvasType )
|
||||
item->Check( true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
||||
{
|
||||
auto new_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
|
||||
if( aEvent.GetId() == ID_MENU_CANVAS_CAIRO )
|
||||
new_type = EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
|
||||
if( m_canvasType == new_type )
|
||||
return;
|
||||
|
||||
GetGalCanvas()->SwitchBackend( new_type );
|
||||
m_canvasType = new_type;
|
||||
}
|
||||
|
||||
|
||||
void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||
{
|
||||
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
|
||||
@ -451,14 +415,14 @@ void SCH_BASE_FRAME::createCanvas()
|
||||
|
||||
m_useSingleCanvasPane = true;
|
||||
|
||||
SetGalCanvas( static_cast<SCH_DRAW_PANEL*> (m_canvas) );
|
||||
SetGalCanvas( static_cast<SCH_DRAW_PANEL*>( m_canvas ) );
|
||||
|
||||
// Set up viewport
|
||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas( true );
|
||||
UseGalCanvas();
|
||||
}
|
||||
|
||||
|
||||
|
@ -125,16 +125,6 @@ public:
|
||||
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
|
||||
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
|
||||
|
||||
/**
|
||||
* switches currently used canvas ( Cairo / OpenGL).
|
||||
*/
|
||||
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Update UI called when switches currently used canvas (Cairo / OpenGL).
|
||||
*/
|
||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
||||
|
||||
/**
|
||||
* @return the increment value of the position of an item
|
||||
* for the repeat command
|
||||
|
@ -256,13 +256,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate )
|
||||
#endif /* KICAD_SPICE */
|
||||
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnSwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnSwitchCanvas )
|
||||
|
||||
/* Handle user interface update events. */
|
||||
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, SCH_EDIT_FRAME::OnUpdateSwitchCanvas )
|
||||
|
||||
END_EVENT_TABLE()
|
||||
|
||||
|
@ -85,10 +85,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
|
||||
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, GERBVIEW_FRAME::Process_Config )
|
||||
|
||||
EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::Process_Config )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
|
||||
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnUpdateSwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, GERBVIEW_FRAME::OnSwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, GERBVIEW_FRAME::OnSwitchCanvas )
|
||||
|
||||
// menu Postprocess
|
||||
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
|
||||
@ -142,6 +138,7 @@ END_EVENT_TABLE()
|
||||
*/
|
||||
void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
{
|
||||
// JEY TODO: OBSOLETE?
|
||||
int id = event.GetId();
|
||||
|
||||
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
||||
@ -372,40 +369,3 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||
if( needs_refresh )
|
||||
UpdateDisplayOptions( options );
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
||||
{
|
||||
switch( aEvent.GetId() )
|
||||
{
|
||||
case ID_MENU_CANVAS_CAIRO:
|
||||
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
|
||||
break;
|
||||
|
||||
case ID_MENU_CANVAS_OPENGL:
|
||||
SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
wxMenuBar* menuBar = GetMenuBar();
|
||||
EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = gal_canvas->GetBackend();
|
||||
|
||||
struct { int menuId; int galType; } menuList[] =
|
||||
{
|
||||
{ ID_MENU_CANVAS_OPENGL, EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL },
|
||||
{ ID_MENU_CANVAS_CAIRO, EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO },
|
||||
};
|
||||
|
||||
for( auto ii : menuList )
|
||||
{
|
||||
wxMenuItem* item = menuBar->FindItem( ii.menuId );
|
||||
|
||||
if( item && ii.galType == canvasType )
|
||||
item->Check( true );
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
|
||||
}
|
||||
|
||||
GetGalCanvas()->SwitchBackend( canvasType );
|
||||
UseGalCanvas( true );
|
||||
UseGalCanvas();
|
||||
|
||||
// Enable the axes to match legacy draw style
|
||||
auto& galOptions = GetGalDisplayOptions();
|
||||
@ -1136,44 +1136,28 @@ void GERBVIEW_FRAME::unitsChangeRefresh()
|
||||
}
|
||||
|
||||
|
||||
void GERBVIEW_FRAME::UseGalCanvas( bool aEnable )
|
||||
void GERBVIEW_FRAME::UseGalCanvas()
|
||||
{
|
||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
||||
EDA_DRAW_FRAME::UseGalCanvas();
|
||||
|
||||
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
||||
|
||||
if( m_toolManager )
|
||||
{
|
||||
m_toolManager->SetEnvironment( m_gerberLayout, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
if( m_toolManager )
|
||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
|
||||
m_colorsSettings->SetLegacyMode( false );
|
||||
|
||||
galCanvas->GetGAL()->SetGridColor( GetLayerColor( LAYER_GERBVIEW_GRID ) );
|
||||
|
||||
SetPageSettings( GetPageSettings() );
|
||||
|
||||
galCanvas->GetView()->RecacheAllItems();
|
||||
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
||||
galCanvas->StartDrawing();
|
||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
}
|
||||
else
|
||||
{
|
||||
if( m_toolManager )
|
||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
|
||||
galCanvas->StopDrawing();
|
||||
m_colorsSettings->SetLegacyMode( false );
|
||||
|
||||
// Redirect all events to the legacy canvas
|
||||
galCanvas->SetEventDispatcher( NULL );
|
||||
galCanvas->GetGAL()->SetGridColor( GetLayerColor( LAYER_GERBVIEW_GRID ) );
|
||||
|
||||
m_colorsSettings->SetLegacyMode( true );
|
||||
m_canvas->Refresh();
|
||||
}
|
||||
SetPageSettings( GetPageSettings() );
|
||||
|
||||
galCanvas->GetView()->RecacheAllItems();
|
||||
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
||||
galCanvas->StartDrawing();
|
||||
|
||||
m_LayersManager->ReFill();
|
||||
m_LayersManager->ReFillRender();
|
||||
|
@ -599,17 +599,7 @@ public:
|
||||
}
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||
virtual void UseGalCanvas( bool aEnable ) override;
|
||||
|
||||
/**
|
||||
* switches currently used canvas (default / Cairo / OpenGL).
|
||||
*/
|
||||
void OnSwitchCanvas( wxCommandEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Update UI called when switches currently used canvas (default / Cairo / OpenGL).
|
||||
*/
|
||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
||||
virtual void UseGalCanvas() override;
|
||||
|
||||
/**
|
||||
* Allows Gerbview to install its preferences panels into the preferences dialog.
|
||||
|
@ -180,11 +180,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||
viewMenu->AppendSeparator();
|
||||
|
||||
viewMenu->AddSeparator();
|
||||
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
|
||||
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
viewMenu->AppendSeparator();
|
||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
||||
@ -238,34 +238,30 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||
|
||||
//-- Preferences menu -----------------------------------------------
|
||||
//
|
||||
wxMenu* preferencesMenu = new wxMenu;
|
||||
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||
};
|
||||
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||
};
|
||||
|
||||
CONDITIONAL_MENU* preferencesMenu = new CONDITIONAL_MENU( false, selTool );
|
||||
|
||||
// Options (Preferences on WXMAC)
|
||||
text = AddHotkeyName( _( "&Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES );
|
||||
AddMenuItem( preferencesMenu, wxID_PREFERENCES, text,
|
||||
_( "Show preferences for all open tools" ),
|
||||
KiBitmap( preference_xpm ) );
|
||||
preferencesMenu->AddItem( wxID_PREFERENCES, text, _( "Show preferences for all open tools" ),
|
||||
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||
|
||||
// Canvas selection
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
text = AddHotkeyName( _( "Accelerated Graphics" ), GerbviewHotkeysDescr, HK_CANVAS_OPENGL );
|
||||
AddMenuItem( preferencesMenu, ID_MENU_CANVAS_OPENGL, text,
|
||||
_( "Use hardware-accelerated graphics (recommended)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
|
||||
text = AddHotkeyName( _( "Standard Graphics" ), GerbviewHotkeysDescr, HK_CANVAS_CAIRO );
|
||||
AddMenuItem( preferencesMenu, ID_MENU_CANVAS_CAIRO, text,
|
||||
_( "Use software graphics (fall-back)" ),
|
||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
// Language submenu
|
||||
preferencesMenu->AddSeparator();
|
||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||
|
||||
//
|
||||
// Append menus to the menubar
|
||||
preferencesMenu->AddSeparator();
|
||||
preferencesMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||
preferencesMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||
|
||||
preferencesMenu->AppendSeparator();
|
||||
|
||||
//-- Menubar -----------------------------------------------
|
||||
//
|
||||
menuBar->Append( fileMenu, _( "&File" ) );
|
||||
menuBar->Append( viewMenu, _( "&View" ) );
|
||||
|
@ -703,8 +703,6 @@ public:
|
||||
wxString GetToolMsg() { return m_toolMsg; }
|
||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
||||
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
|
||||
virtual void ToolOnRightClick( wxCommandEvent& event );
|
||||
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
||||
|
||||
/**
|
||||
* Called when modifying the page settings.
|
||||
@ -812,18 +810,14 @@ public:
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
||||
|
||||
/**
|
||||
* Use to switch between standard and GAL-based canvas.
|
||||
*
|
||||
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
||||
* Use to start up the GAL drawing canvas.
|
||||
*/
|
||||
virtual void UseGalCanvas( bool aEnable );
|
||||
virtual void UseGalCanvas();
|
||||
|
||||
/**
|
||||
* Changes the current rendering backend.
|
||||
* aCanvasType is the new rendering backend type.
|
||||
* @return true if any kind of GAL canvas is used.
|
||||
*/
|
||||
virtual bool SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
||||
virtual void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType );
|
||||
|
||||
/**
|
||||
* Return a pointer to GAL-based canvas of given EDA draw frame.
|
||||
|
@ -514,8 +514,6 @@ public:
|
||||
void OnToggleEdgeDrawMode( wxCommandEvent& aEvent );
|
||||
void OnToggleTextDrawMode( wxCommandEvent& aEvent );
|
||||
|
||||
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
|
||||
|
||||
// User interface update event handlers.
|
||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||
|
||||
@ -536,12 +534,7 @@ public:
|
||||
void SetFastGrid2();
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||
virtual void UseGalCanvas( bool aEnable ) override;
|
||||
|
||||
/**
|
||||
* Update UI called when switches currently used canvas (default / Cairo / OpenGL).
|
||||
*/
|
||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
||||
virtual void UseGalCanvas() override;
|
||||
|
||||
PCB_GENERAL_SETTINGS& Settings()
|
||||
{
|
||||
|
@ -46,11 +46,13 @@ public:
|
||||
|
||||
// Generic document actions
|
||||
static TOOL_ACTION doNew; // sadly 'new' is a reserved word
|
||||
static TOOL_ACTION newLibrary;
|
||||
static TOOL_ACTION open;
|
||||
static TOOL_ACTION save;
|
||||
static TOOL_ACTION saveAs;
|
||||
static TOOL_ACTION saveCopyAs;
|
||||
static TOOL_ACTION saveAll;
|
||||
static TOOL_ACTION revert;
|
||||
static TOOL_ACTION pageSettings;
|
||||
static TOOL_ACTION print;
|
||||
static TOOL_ACTION plot;
|
||||
@ -128,6 +130,10 @@ public:
|
||||
static TOOL_ACTION toggleUnits;
|
||||
static TOOL_ACTION togglePolarCoords;
|
||||
|
||||
// Misc
|
||||
static TOOL_ACTION acceleratedGraphics;
|
||||
static TOOL_ACTION standardGraphics;
|
||||
|
||||
/**
|
||||
* Function TranslateLegacyId()
|
||||
* Translates legacy tool ids to the corresponding TOOL_ACTION name.
|
||||
|
@ -78,6 +78,8 @@ public:
|
||||
int ToggleGrid( const TOOL_EVENT& aEvent );
|
||||
int GridProperties( const TOOL_EVENT& aEvent );
|
||||
|
||||
int SwitchCanvas( const TOOL_EVENT& aEvent );
|
||||
|
||||
///> Sets up handlers for various events.
|
||||
void setTransitions() override;
|
||||
|
||||
|
@ -180,7 +180,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas( true );
|
||||
UseGalCanvas();
|
||||
|
||||
m_auimgr.Update();
|
||||
|
||||
|
@ -293,7 +293,6 @@ set( PCBNEW_CLASS_SRCS
|
||||
text_mod_grid_table.cpp
|
||||
toolbars_footprint_editor.cpp
|
||||
toolbars_footprint_viewer.cpp
|
||||
toolbar_onrightclick.cpp
|
||||
toolbars_pcb_editor.cpp
|
||||
tracks_cleaner.cpp
|
||||
undo_redo.cpp
|
||||
|
@ -145,15 +145,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||
// Menu 3D Frame
|
||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_Frame )
|
||||
|
||||
// Switching canvases
|
||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, FOOTPRINT_EDIT_FRAME::OnSwitchCanvas )
|
||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, FOOTPRINT_EDIT_FRAME::OnSwitchCanvas )
|
||||
|
||||
// UI update events.
|
||||
EVT_UPDATE_UI( ID_MODEDIT_EXPORT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateSaveAs )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_SAVE, FOOTPRINT_EDIT_FRAME::OnUpdateSave )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_SAVE_AS, FOOTPRINT_EDIT_FRAME::OnUpdateSaveAs )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_REVERT_PART, FOOTPRINT_EDIT_FRAME::OnUpdateSave )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleTargeted )
|
||||
EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
|
||||
@ -291,7 +283,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
||||
UseGalCanvas();
|
||||
|
||||
m_auimgr.Update();
|
||||
updateTitle();
|
||||
@ -313,15 +305,15 @@ FOOTPRINT_EDIT_FRAME::~FOOTPRINT_EDIT_FRAME()
|
||||
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
||||
void FOOTPRINT_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||
{
|
||||
// switches currently used canvas (default / Cairo / OpenGL).
|
||||
PCB_BASE_FRAME::OnSwitchCanvas( aEvent );
|
||||
// switches currently used canvas (Cairo / OpenGL).
|
||||
PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
|
||||
// The base class method *does not reinit* the layers manager.
|
||||
// We must upate the layer widget to match board visibility states,
|
||||
// both layers and render columns, and and some settings dependent on the canvas.
|
||||
// The base class method *does not reinit* the layers manager. We must upate the layer
|
||||
// widget to match board visibility states, both layers and render columns, and and some
|
||||
// settings dependent on the canvas.
|
||||
UpdateUserInterface();
|
||||
}
|
||||
|
||||
@ -572,29 +564,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateModuleTargeted( wxUpdateUIEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
if( aEvent.GetId() == ID_MODEDIT_SAVE )
|
||||
{
|
||||
wxString text = IsCurrentFPFromBoard() ? _( "&Update Footprint on Board" ) : _( "&Save" );
|
||||
text = AddHotkeyName( text, m_hotkeysDescrList, HK_SAVE );
|
||||
aEvent.SetText( text );
|
||||
}
|
||||
|
||||
aEvent.Enable( GetBoard()->m_Modules && GetScreen()->IsModify() );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateSaveAs( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
LIB_ID libId = getTargetFPID();
|
||||
const wxString& libName = libId.GetLibNickname();
|
||||
const wxString& partName = libId.GetLibItemName();
|
||||
|
||||
aEvent.Enable( !libName.IsEmpty() || !partName.IsEmpty() );
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent )
|
||||
{
|
||||
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
|
||||
@ -940,16 +909,13 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
|
||||
}
|
||||
|
||||
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
||||
void FOOTPRINT_EDIT_FRAME::UseGalCanvas()
|
||||
{
|
||||
PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
|
||||
PCB_BASE_EDIT_FRAME::UseGalCanvas();
|
||||
|
||||
if( aEnable )
|
||||
{
|
||||
// Be sure the axis are enabled:
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
updateView();
|
||||
}
|
||||
// Be sure the axis are enabled:
|
||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||
updateView();
|
||||
|
||||
ReCreateMenuBar();
|
||||
|
||||
|
@ -92,10 +92,10 @@ public:
|
||||
void CloseModuleEditor( wxCommandEvent& Event );
|
||||
|
||||
/**
|
||||
* switches currently used canvas (default / Cairo / OpenGL).
|
||||
* switches currently used canvas (Cairo / OpenGL).
|
||||
* It also reinit the layers manager that slightly changes with canvases
|
||||
*/
|
||||
void OnSwitchCanvas( wxCommandEvent& aEvent ) override;
|
||||
void SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType ) override;
|
||||
|
||||
/**
|
||||
* Update the layer manager and other widgets from the board setup
|
||||
@ -133,7 +133,6 @@ public:
|
||||
// The Tool Framework initalization, for GAL mode
|
||||
void setupTools();
|
||||
|
||||
void ToolOnRightClick( wxCommandEvent& event ) override;
|
||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||
void OnToggleSearchTree( wxCommandEvent& event );
|
||||
|
||||
@ -321,7 +320,7 @@ public:
|
||||
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
|
||||
|
||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||
void UseGalCanvas( bool aEnable ) override;
|
||||
void UseGalCanvas() override;
|
||||
|
||||
/**
|
||||
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
||||
|
@ -239,7 +239,7 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||
|
||||
UseGalCanvas( true );
|
||||
UseGalCanvas();
|
||||
|
||||
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
||||
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user