Move some more menu commands to ACTIONs.
This commit is contained in:
parent
01326d1304
commit
a27e4246e0
|
@ -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 )
|
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()
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
|
||||||
{
|
{
|
||||||
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
||||||
|
|
||||||
|
@ -633,7 +623,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
||||||
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
||||||
|
|
||||||
galCanvas->SetEvtHandlerEnabled( aEnable );
|
galCanvas->SetEvtHandlerEnabled( true );
|
||||||
galCanvas->StartDrawing();
|
galCanvas->StartDrawing();
|
||||||
|
|
||||||
// Reset current tool on switch();
|
// 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...
|
GetGalCanvas()->SwitchBackend( aCanvasType );
|
||||||
auto galCanvas = GetGalCanvas();
|
m_canvasType = GetGalCanvas()->GetBackend();
|
||||||
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;
|
|
||||||
|
|
||||||
return use_gal;
|
UseGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,10 +23,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file draw_frame.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <pgm_base.h>
|
#include <pgm_base.h>
|
||||||
#include <kiface_i.h>
|
#include <kiface_i.h>
|
||||||
|
@ -396,11 +392,6 @@ int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
|
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMask, bool aPrintMirrorMode, void* aData )
|
||||||
{
|
{
|
||||||
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );
|
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
|
#define VIRT_MAX (MAX_AXIS/2.0) ///< max X or Y coordinate in virtual space
|
||||||
|
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
void EDA_DRAW_FRAME::UseGalCanvas()
|
||||||
{
|
|
||||||
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 )
|
|
||||||
{
|
{
|
||||||
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||||
|
|
||||||
|
@ -1011,8 +790,8 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
viewControls->EnableMousewheelPan( m_canvas->GetEnableMousewheelPan() );
|
||||||
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
viewControls->EnableAutoPan( m_canvas->GetEnableAutoPan() );
|
||||||
|
|
||||||
m_canvas->SetEvtHandlerEnabled( !aEnable );
|
m_canvas->SetEvtHandlerEnabled( false );
|
||||||
GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
|
GetGalCanvas()->SetEvtHandlerEnabled( true );
|
||||||
|
|
||||||
GetGalCanvas()->StartDrawing();
|
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();
|
GetGalCanvas()->SwitchBackend( aCanvasType );
|
||||||
wxCHECK( galCanvas, false );
|
m_canvasType = GetGalCanvas()->GetBackend();
|
||||||
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;
|
|
||||||
|
|
||||||
return use_gal;
|
UseGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,11 @@ TOOL_ACTION ACTIONS::doNew( "common.Control.new",
|
||||||
_( "New..." ), _( "Create a new document in the editor" ),
|
_( "New..." ), _( "Create a new document in the editor" ),
|
||||||
new_generic_xpm );
|
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",
|
TOOL_ACTION ACTIONS::open( "common.Control.open",
|
||||||
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
|
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
|
||||||
_( "Open..." ), _( "Open existing document" ),
|
_( "Open..." ), _( "Open existing document" ),
|
||||||
|
@ -34,6 +39,11 @@ TOOL_ACTION ACTIONS::saveAll( "common.Control.saveAll",
|
||||||
_( "Save All" ), _( "Save all changes" ),
|
_( "Save All" ), _( "Save all changes" ),
|
||||||
save_xpm );
|
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",
|
TOOL_ACTION ACTIONS::pageSettings( "common.Control.pageSettings",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
_( "Page Settings..." ), _( "Settings for paper size and frame references" ),
|
_( "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" ),
|
_( "Switch units" ), _( "Switch between inches and millimeters" ),
|
||||||
unit_mm_xpm );
|
unit_mm_xpm );
|
||||||
|
|
||||||
|
|
||||||
TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords",
|
TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
_( "Polar Coordinates" ), _( "Switch between polar and cartesian coordinate systems" ),
|
_( "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" ),
|
_( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ),
|
||||||
cursor_xpm );
|
cursor_xpm );
|
||||||
|
|
||||||
|
|
||||||
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
|
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
|
||||||
AS_GLOBAL, 0,
|
AS_GLOBAL, 0,
|
||||||
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
|
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
|
||||||
cursor_shape_xpm );
|
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
|
// 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()
|
void COMMON_TOOLS::setTransitions()
|
||||||
{
|
{
|
||||||
// Cursor control
|
// Cursor control
|
||||||
|
@ -530,6 +543,9 @@ void COMMON_TOOLS::setTransitions()
|
||||||
|
|
||||||
Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() );
|
Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() );
|
||||||
Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.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->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
|
|
||||||
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
||||||
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
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_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
|
||||||
EVT_MENU( ID_LIBEDIT_GEN_SVG_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_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 )
|
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( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
|
||||||
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
|
||||||
LIB_EDIT_FRAME::OnUpdateEditingPart )
|
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()
|
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):
|
// 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):
|
// Set options specific to symbol editor (axies are always enabled):
|
||||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||||
|
|
|
@ -129,7 +129,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* switches currently used canvas ( Cairo / OpenGL).
|
* 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. */
|
/** The nickname of the current library being edited and empty string if none. */
|
||||||
wxString GetCurLib() const;
|
wxString GetCurLib() const;
|
||||||
|
|
|
@ -44,7 +44,6 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// we always have to start from scratch with a new wxMenuBar.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
LIB_ID libId = getTargetLibId();
|
LIB_ID libId = getTargetLibId();
|
||||||
|
@ -58,8 +57,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
return ( !readOnly && m_libMgr->IsPartModified( partName, libName ) );
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//-- File menu -----------------------------------------------
|
||||||
// Menu File:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
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
|
// 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 );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
//-- Edit menu -----------------------------------------------
|
||||||
// Edit menu
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
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::symbolProperties, havePartCondition );
|
||||||
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
|
||||||
|
|
||||||
//
|
//-- View menu -----------------------------------------------
|
||||||
// Menu View:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -188,8 +184,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
viewMenu->AddCheckItem( EE_ACTIONS::showComponentTree, compTreeShownCondition );
|
||||||
|
|
||||||
//
|
//-- Place menu -----------------------------------------------
|
||||||
// Menu Place:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
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::drawSymbolArc, EE_CONDITIONS::ShowAlways );
|
||||||
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::drawSymbolLines, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
//-- Inspect menu -----------------------------------------------
|
||||||
// Menu Inspect:
|
|
||||||
//
|
//
|
||||||
wxMenu* inspectMenu = new wxMenu;
|
wxMenu* inspectMenu = new wxMenu;
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Show Datasheet" ), g_Libedit_Hotkeys_Descr, HK_LIBEDIT_VIEW_DOC );
|
|
||||||
AddMenuItem( inspectMenu,
|
AddMenuItem( inspectMenu,
|
||||||
ID_LIBEDIT_VIEW_DOC,
|
ID_LIBEDIT_VIEW_DOC,
|
||||||
text,
|
AddHotkeyName( _( "Show Datasheet" ), g_Libedit_Hotkeys_Descr, HK_LIBEDIT_VIEW_DOC ),
|
||||||
_( "Open associated datasheet in web browser" ),
|
_( "Open associated datasheet in web browser" ),
|
||||||
KiBitmap( datasheet_xpm ) );
|
KiBitmap( datasheet_xpm ) );
|
||||||
|
|
||||||
|
@ -218,47 +211,36 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Check duplicate and off grid pins" ),
|
_( "Check duplicate and off grid pins" ),
|
||||||
KiBitmap( erc_xpm ) );
|
KiBitmap( erc_xpm ) );
|
||||||
|
|
||||||
// Menu Preferences:
|
//-- Preferences menu -----------------------------------------------
|
||||||
wxMenu* preferencesMenu = new wxMenu;
|
//
|
||||||
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
// Environment varialbes
|
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
AddMenuItem( preferencesMenu,
|
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
};
|
||||||
_( "&Configure Paths..." ),
|
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
_( "Edit path configuration environment variables" ),
|
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||||
KiBitmap( path_xpm ) );
|
};
|
||||||
|
|
||||||
// Library list
|
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ),
|
||||||
AddMenuItem( preferencesMenu,
|
_( "Edit path configuration environment variables" ),
|
||||||
ID_EDIT_SYM_LIB_TABLE,
|
path_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
_( "Manage &Symbol Libraries..." ),
|
|
||||||
_( "Edit the global and project symbol library tables." ),
|
|
||||||
KiBitmap( library_table_xpm ) );
|
|
||||||
|
|
||||||
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
|
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||||
text = AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES );
|
AddHotkeyName( _( "&Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ),
|
||||||
AddMenuItem( preferencesMenu, wxID_PREFERENCES, text,
|
_( "Show preferences for all open tools" ),
|
||||||
_( "Show preferences for all open tools" ),
|
preference_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
KiBitmap( preference_xpm ) );
|
|
||||||
|
|
||||||
// Language submenu
|
prefsMenu->AddSeparator();
|
||||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
Pgm().AddMenuLanguageList( prefsMenu );
|
||||||
|
|
||||||
preferencesMenu->AppendSeparator();
|
prefsMenu->AddSeparator();
|
||||||
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
text = AddHotkeyName( _( "Modern Toolset (&Accelerated)" ), g_Libedit_Hotkeys_Descr,
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
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 );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create the menubar and append all submenus
|
// Create the menubar and append all submenus
|
||||||
|
@ -268,7 +250,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||||
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
|
|
|
@ -45,9 +45,6 @@ class CONDITIONAL_MENU;
|
||||||
// Build the tools menu
|
// Build the tools menu
|
||||||
static void prepareToolsMenu( wxMenu* aParentMenu );
|
static void prepareToolsMenu( wxMenu* aParentMenu );
|
||||||
|
|
||||||
// Build the preferences menu
|
|
||||||
static void preparePreferencesMenu( SCH_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::ReCreateMenuBar()
|
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.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
auto modifiedDocumentCondition = [] ( const SELECTION& sel ) {
|
auto modifiedDocumentCondition = [] ( const SELECTION& sel ) {
|
||||||
SCH_SHEET_LIST sheetList( g_RootSheet );
|
SCH_SHEET_LIST sheetList( g_RootSheet );
|
||||||
return sheetList.IsModified();
|
return sheetList.IsModified();
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//-- File menu -----------------------------------------------------------
|
||||||
// Menu File:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
static ACTION_MENU* openRecentMenu;
|
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
|
// 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 );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
//-- Edit menu -----------------------------------------------------------
|
||||||
// Menu Edit:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -176,8 +170,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Sets symbol fields to original library values" ),
|
_( "Sets symbol fields to original library values" ),
|
||||||
update_fields_xpm, EE_CONDITIONS::ShowAlways );
|
update_fields_xpm, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
//-- View menu -----------------------------------------------------------
|
||||||
// Menu View:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
|
@ -232,8 +225,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//
|
//-- Place menu -----------------------------------------------------------
|
||||||
// Menu place:
|
|
||||||
//
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
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::placeSchematicText, EE_CONDITIONS::ShowAlways );
|
||||||
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( EE_ACTIONS::placeImage, EE_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//
|
//-- Inspect menu -----------------------------------------------
|
||||||
// Menu Inspect:
|
|
||||||
//
|
//
|
||||||
wxMenu* inspectMenu = new wxMenu;
|
wxMenu* inspectMenu = new wxMenu;
|
||||||
AddMenuItem( inspectMenu, ID_GET_ERC, _( "Electrical Rules &Checker" ),
|
AddMenuItem( inspectMenu, ID_GET_ERC, _( "Electrical Rules &Checker" ),
|
||||||
_( "Perform electrical rules check" ), KiBitmap( erc_xpm ) );
|
_( "Perform electrical rules check" ), KiBitmap( erc_xpm ) );
|
||||||
|
|
||||||
//
|
//-- Tools menu -----------------------------------------------
|
||||||
// Menu Tools:
|
|
||||||
//
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
prepareToolsMenu( toolsMenu );
|
prepareToolsMenu( toolsMenu );
|
||||||
|
|
||||||
|
//-- Preferences menu -----------------------------------------------
|
||||||
//
|
//
|
||||||
// Menu Preferences:
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
//
|
|
||||||
wxMenu* preferencesMenu = new wxMenu;
|
|
||||||
preparePreferencesMenu( this, preferencesMenu );
|
|
||||||
|
|
||||||
// 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( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||||
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
||||||
menuBar->Append( preferencesMenu, _( "P&references" ) );
|
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
||||||
SetMenuBar( 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 )
|
void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
LIB_VIEW_FRAME* viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER, true );
|
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;
|
m_useSingleCanvasPane = true;
|
||||||
|
|
||||||
SetGalCanvas( static_cast<SCH_DRAW_PANEL*> (m_canvas) );
|
SetGalCanvas( static_cast<SCH_DRAW_PANEL*>( m_canvas ) );
|
||||||
|
|
||||||
// Set up viewport
|
// Set up viewport
|
||||||
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -125,16 +125,6 @@ public:
|
||||||
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
|
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
|
||||||
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
|
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
|
* @return the increment value of the position of an item
|
||||||
* for the repeat command
|
* 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 )
|
EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate )
|
||||||
#endif /* KICAD_SPICE */
|
#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. */
|
/* Handle user interface update events. */
|
||||||
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
|
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()
|
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( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, GERBVIEW_FRAME::Process_Config )
|
||||||
|
|
||||||
EVT_MENU( wxID_PREFERENCES, 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
|
// menu Postprocess
|
||||||
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
|
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 )
|
void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
// JEY TODO: OBSOLETE?
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
|
|
||||||
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) GetScreen()->GetCurItem();
|
||||||
|
@ -372,40 +369,3 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
if( needs_refresh )
|
if( needs_refresh )
|
||||||
UpdateDisplayOptions( options );
|
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 );
|
GetGalCanvas()->SwitchBackend( canvasType );
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
|
|
||||||
// Enable the axes to match legacy draw style
|
// Enable the axes to match legacy draw style
|
||||||
auto& galOptions = GetGalDisplayOptions();
|
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();
|
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
||||||
|
|
||||||
if( m_toolManager )
|
if( m_toolManager )
|
||||||
|
{
|
||||||
m_toolManager->SetEnvironment( m_gerberLayout, GetGalCanvas()->GetView(),
|
m_toolManager->SetEnvironment( m_gerberLayout, GetGalCanvas()->GetView(),
|
||||||
GetGalCanvas()->GetViewControls(), this );
|
GetGalCanvas()->GetViewControls(), this );
|
||||||
|
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
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->GetGAL()->SetGridColor( GetLayerColor( LAYER_GERBVIEW_GRID ) );
|
||||||
galCanvas->SetEventDispatcher( NULL );
|
|
||||||
|
|
||||||
m_colorsSettings->SetLegacyMode( true );
|
SetPageSettings( GetPageSettings() );
|
||||||
m_canvas->Refresh();
|
|
||||||
}
|
galCanvas->GetView()->RecacheAllItems();
|
||||||
|
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
||||||
|
galCanvas->StartDrawing();
|
||||||
|
|
||||||
m_LayersManager->ReFill();
|
m_LayersManager->ReFill();
|
||||||
m_LayersManager->ReFillRender();
|
m_LayersManager->ReFillRender();
|
||||||
|
|
|
@ -599,17 +599,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||||
virtual void UseGalCanvas( bool aEnable ) override;
|
virtual void UseGalCanvas() 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 );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows Gerbview to install its preferences panels into the preferences dialog.
|
* Allows Gerbview to install its preferences panels into the preferences dialog.
|
||||||
|
|
|
@ -180,11 +180,11 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||||
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
|
||||||
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
|
||||||
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
|
||||||
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
|
||||||
|
@ -238,34 +238,30 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
//-- Preferences menu -----------------------------------------------
|
//-- 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)
|
// Options (Preferences on WXMAC)
|
||||||
text = AddHotkeyName( _( "&Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES );
|
text = AddHotkeyName( _( "&Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES );
|
||||||
AddMenuItem( preferencesMenu, wxID_PREFERENCES, text,
|
preferencesMenu->AddItem( wxID_PREFERENCES, text, _( "Show preferences for all open tools" ),
|
||||||
_( "Show preferences for all open tools" ),
|
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
KiBitmap( preference_xpm ) );
|
|
||||||
|
|
||||||
// Canvas selection
|
preferencesMenu->AddSeparator();
|
||||||
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
|
|
||||||
Pgm().AddMenuLanguageList( preferencesMenu );
|
Pgm().AddMenuLanguageList( preferencesMenu );
|
||||||
|
|
||||||
//
|
preferencesMenu->AddSeparator();
|
||||||
// Append menus to the menubar
|
preferencesMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
|
preferencesMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
|
|
||||||
|
preferencesMenu->AppendSeparator();
|
||||||
|
|
||||||
|
//-- Menubar -----------------------------------------------
|
||||||
//
|
//
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
|
|
|
@ -703,8 +703,6 @@ public:
|
||||||
wxString GetToolMsg() { return m_toolMsg; }
|
wxString GetToolMsg() { return m_toolMsg; }
|
||||||
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
|
||||||
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
|
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) {}
|
||||||
virtual void ToolOnRightClick( wxCommandEvent& event );
|
|
||||||
void AdjustScrollBars( const wxPoint& aCenterPosition );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when modifying the page settings.
|
* Called when modifying the page settings.
|
||||||
|
@ -812,18 +810,14 @@ public:
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
EDA_DRAW_PANEL_GAL::GAL_TYPE LoadCanvasTypeSetting();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to switch between standard and GAL-based canvas.
|
* Use to start up the GAL drawing canvas.
|
||||||
*
|
|
||||||
* @param aEnable True for GAL-based canvas, false for standard canvas.
|
|
||||||
*/
|
*/
|
||||||
virtual void UseGalCanvas( bool aEnable );
|
virtual void UseGalCanvas();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changes the current rendering backend.
|
* 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.
|
* Return a pointer to GAL-based canvas of given EDA draw frame.
|
||||||
|
|
|
@ -514,8 +514,6 @@ public:
|
||||||
void OnToggleEdgeDrawMode( wxCommandEvent& aEvent );
|
void OnToggleEdgeDrawMode( wxCommandEvent& aEvent );
|
||||||
void OnToggleTextDrawMode( wxCommandEvent& aEvent );
|
void OnToggleTextDrawMode( wxCommandEvent& aEvent );
|
||||||
|
|
||||||
virtual void OnSwitchCanvas( wxCommandEvent& aEvent );
|
|
||||||
|
|
||||||
// User interface update event handlers.
|
// User interface update event handlers.
|
||||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
|
@ -536,12 +534,7 @@ public:
|
||||||
void SetFastGrid2();
|
void SetFastGrid2();
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas
|
||||||
virtual void UseGalCanvas( bool aEnable ) override;
|
virtual void UseGalCanvas() override;
|
||||||
|
|
||||||
/**
|
|
||||||
* Update UI called when switches currently used canvas (default / Cairo / OpenGL).
|
|
||||||
*/
|
|
||||||
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
|
|
||||||
|
|
||||||
PCB_GENERAL_SETTINGS& Settings()
|
PCB_GENERAL_SETTINGS& Settings()
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,11 +46,13 @@ public:
|
||||||
|
|
||||||
// Generic document actions
|
// Generic document actions
|
||||||
static TOOL_ACTION doNew; // sadly 'new' is a reserved word
|
static TOOL_ACTION doNew; // sadly 'new' is a reserved word
|
||||||
|
static TOOL_ACTION newLibrary;
|
||||||
static TOOL_ACTION open;
|
static TOOL_ACTION open;
|
||||||
static TOOL_ACTION save;
|
static TOOL_ACTION save;
|
||||||
static TOOL_ACTION saveAs;
|
static TOOL_ACTION saveAs;
|
||||||
static TOOL_ACTION saveCopyAs;
|
static TOOL_ACTION saveCopyAs;
|
||||||
static TOOL_ACTION saveAll;
|
static TOOL_ACTION saveAll;
|
||||||
|
static TOOL_ACTION revert;
|
||||||
static TOOL_ACTION pageSettings;
|
static TOOL_ACTION pageSettings;
|
||||||
static TOOL_ACTION print;
|
static TOOL_ACTION print;
|
||||||
static TOOL_ACTION plot;
|
static TOOL_ACTION plot;
|
||||||
|
@ -128,6 +130,10 @@ public:
|
||||||
static TOOL_ACTION toggleUnits;
|
static TOOL_ACTION toggleUnits;
|
||||||
static TOOL_ACTION togglePolarCoords;
|
static TOOL_ACTION togglePolarCoords;
|
||||||
|
|
||||||
|
// Misc
|
||||||
|
static TOOL_ACTION acceleratedGraphics;
|
||||||
|
static TOOL_ACTION standardGraphics;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function TranslateLegacyId()
|
* Function TranslateLegacyId()
|
||||||
* Translates legacy tool ids to the corresponding TOOL_ACTION name.
|
* Translates legacy tool ids to the corresponding TOOL_ACTION name.
|
||||||
|
|
|
@ -78,6 +78,8 @@ public:
|
||||||
int ToggleGrid( const TOOL_EVENT& aEvent );
|
int ToggleGrid( const TOOL_EVENT& aEvent );
|
||||||
int GridProperties( const TOOL_EVENT& aEvent );
|
int GridProperties( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
|
int SwitchCanvas( const TOOL_EVENT& aEvent );
|
||||||
|
|
||||||
///> Sets up handlers for various events.
|
///> Sets up handlers for various events.
|
||||||
void setTransitions() override;
|
void setTransitions() override;
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,7 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,6 @@ set( PCBNEW_CLASS_SRCS
|
||||||
text_mod_grid_table.cpp
|
text_mod_grid_table.cpp
|
||||||
toolbars_footprint_editor.cpp
|
toolbars_footprint_editor.cpp
|
||||||
toolbars_footprint_viewer.cpp
|
toolbars_footprint_viewer.cpp
|
||||||
toolbar_onrightclick.cpp
|
|
||||||
toolbars_pcb_editor.cpp
|
toolbars_pcb_editor.cpp
|
||||||
tracks_cleaner.cpp
|
tracks_cleaner.cpp
|
||||||
undo_redo.cpp
|
undo_redo.cpp
|
||||||
|
|
|
@ -145,15 +145,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
// Menu 3D Frame
|
// Menu 3D Frame
|
||||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, FOOTPRINT_EDIT_FRAME::Show3D_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.
|
// 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_DELETE_PART, FOOTPRINT_EDIT_FRAME::OnUpdateModuleTargeted )
|
||||||
EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
EVT_UPDATE_UI( ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||||
FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard )
|
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->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
UseGalCanvas();
|
||||||
|
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
updateTitle();
|
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).
|
// switches currently used canvas (Cairo / OpenGL).
|
||||||
PCB_BASE_FRAME::OnSwitchCanvas( aEvent );
|
PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
|
||||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
||||||
|
|
||||||
// The base class method *does not reinit* the layers manager.
|
// The base class method *does not reinit* the layers manager. We must upate the layer
|
||||||
// We must upate the layer widget to match board visibility states,
|
// widget to match board visibility states, both layers and render columns, and and some
|
||||||
// both layers and render columns, and and some settings dependent on the canvas.
|
// settings dependent on the canvas.
|
||||||
UpdateUserInterface();
|
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 )
|
void FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
PCB_EDIT_FRAME* frame = (PCB_EDIT_FRAME*) Kiway().Player( FRAME_PCB, false );
|
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 );
|
||||||
// Be sure the axis are enabled:
|
updateView();
|
||||||
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
|
|
||||||
updateView();
|
|
||||||
}
|
|
||||||
|
|
||||||
ReCreateMenuBar();
|
ReCreateMenuBar();
|
||||||
|
|
||||||
|
|
|
@ -92,10 +92,10 @@ public:
|
||||||
void CloseModuleEditor( wxCommandEvent& Event );
|
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
|
* 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
|
* Update the layer manager and other widgets from the board setup
|
||||||
|
@ -133,7 +133,6 @@ public:
|
||||||
// The Tool Framework initalization, for GAL mode
|
// The Tool Framework initalization, for GAL mode
|
||||||
void setupTools();
|
void setupTools();
|
||||||
|
|
||||||
void ToolOnRightClick( wxCommandEvent& event ) override;
|
|
||||||
void OnConfigurePaths( wxCommandEvent& aEvent );
|
void OnConfigurePaths( wxCommandEvent& aEvent );
|
||||||
void OnToggleSearchTree( wxCommandEvent& event );
|
void OnToggleSearchTree( wxCommandEvent& event );
|
||||||
|
|
||||||
|
@ -321,7 +320,7 @@ public:
|
||||||
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
|
void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) override;
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||||
void UseGalCanvas( bool aEnable ) override;
|
void UseGalCanvas() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a KiCad board (.kicad_pcb) from \a aFileName.
|
* 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->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
|
|
||||||
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
// Restore last zoom. (If auto-zooming we'll adjust when we load the footprint.)
|
||||||
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
GetGalCanvas()->GetView()->SetScale( m_lastZoom );
|
||||||
|
|
|
@ -236,7 +236,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent
|
||||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( backend != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
|
UseGalCanvas();
|
||||||
updateView();
|
updateView();
|
||||||
|
|
||||||
SetActiveLayer( F_Cu );
|
SetActiveLayer( F_Cu );
|
||||||
|
|
|
@ -47,105 +47,92 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// we always have to start from scratch with a new wxMenuBar.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
// Recreate all menus:
|
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
|
return GetBoard()->m_Modules && GetScreen()->IsModify();
|
||||||
|
};
|
||||||
|
auto libraryPartCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
|
LIB_ID libId = getTargetFPID();
|
||||||
|
const wxString& libName = libId.GetLibNickname();
|
||||||
|
const wxString& partName = libId.GetLibItemName();
|
||||||
|
|
||||||
// Menu File:
|
return( !libName.IsEmpty() || !partName.IsEmpty() );
|
||||||
wxMenu* fileMenu = new wxMenu;
|
};
|
||||||
|
|
||||||
AddMenuItem( fileMenu,
|
//-- File menu -----------------------------------------------
|
||||||
ID_MODEDIT_CREATE_NEW_LIB,
|
//
|
||||||
_( "New Library..." ),
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
_( "Creates an empty library" ),
|
|
||||||
KiBitmap( new_library_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( fileMenu,
|
fileMenu->AddItem( ID_MODEDIT_CREATE_NEW_LIB,
|
||||||
ID_MODEDIT_ADD_LIBRARY,
|
_( "New Library..." ),
|
||||||
_( "Add Library..." ),
|
_( "Creates an empty library" ),
|
||||||
_( "Adds a previously created library" ),
|
new_library_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
KiBitmap( add_library_xpm ) );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&New Footprint..." ), m_hotkeysDescrList, HK_NEW );
|
fileMenu->AddItem( ID_MODEDIT_ADD_LIBRARY,
|
||||||
AddMenuItem( fileMenu, ID_MODEDIT_NEW_MODULE,
|
_( "Add Library..." ),
|
||||||
text, _( "Create a new footprint" ),
|
_( "Adds a previously created library" ),
|
||||||
KiBitmap( new_footprint_xpm ) );
|
add_library_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
fileMenu->AddItem( ID_MODEDIT_NEW_MODULE,
|
||||||
|
AddHotkeyName( _( "&New Footprint..." ), m_hotkeysDescrList, HK_NEW ),
|
||||||
|
_( "Create a new footprint" ),
|
||||||
|
new_footprint_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
#ifdef KICAD_SCRIPTING
|
#ifdef KICAD_SCRIPTING
|
||||||
AddMenuItem( fileMenu, ID_MODEDIT_NEW_MODULE_FROM_WIZARD,
|
fileMenu->AddItem( ID_MODEDIT_NEW_MODULE_FROM_WIZARD,
|
||||||
_( "&Create Footprint..." ),
|
_( "&Create Footprint..." ),
|
||||||
_( "Create a new footprint using the footprint wizard" ),
|
_( "Create a new footprint using the footprint wizard" ),
|
||||||
KiBitmap( module_wizard_xpm ) );
|
module_wizard_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
fileMenu->AddSeparator();
|
||||||
|
fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition );
|
||||||
|
fileMenu->AddItem( ACTIONS::saveAs, libraryPartCondition );
|
||||||
|
fileMenu->AddItem( ID_MODEDIT_REVERT_PART,
|
||||||
|
_( "Revert" ),
|
||||||
|
_( "Throw away changes" ),
|
||||||
|
undo_xpm, modifiedDocumentCondition );
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&Save" ), m_hotkeysDescrList, HK_SAVE );
|
fileMenu->AddSeparator();
|
||||||
AddMenuItem( fileMenu, ID_MODEDIT_SAVE, text,
|
|
||||||
_( "Save changes" ),
|
|
||||||
KiBitmap( save_xpm ) );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Save &As..." ), m_hotkeysDescrList, HK_SAVEAS );
|
ACTION_MENU* submenuImport = new ACTION_MENU();
|
||||||
AddMenuItem( fileMenu, ID_MODEDIT_SAVE_AS, text,
|
submenuImport->SetTool( selTool );
|
||||||
_( "Save a copy to a new name and/or location" ),
|
submenuImport->SetTitle( _( "Import" ) );
|
||||||
KiBitmap( save_as_xpm ) );
|
submenuImport->SetIcon( import_xpm );
|
||||||
|
|
||||||
AddMenuItem( fileMenu, ID_MODEDIT_REVERT_PART,
|
submenuImport->Add( _( "&Footprint..." ),
|
||||||
_( "&Revert" ),
|
_( "Import a footprint from file" ),
|
||||||
_( "Throw away changes" ),
|
ID_MODEDIT_IMPORT_PART, import_module_xpm );
|
||||||
KiBitmap( undo_xpm ) );
|
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
submenuImport->Add( _( "&Graphics..." ),
|
||||||
|
_( "Import 2D Drawing file to Footprint Editor on Drawings layer" ),
|
||||||
|
ID_GEN_IMPORT_GRAPHICS_FILE, import_vector_xpm );
|
||||||
|
|
||||||
wxMenu* submenuImport = new wxMenu();
|
fileMenu->AddMenu( submenuImport, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
AddMenuItem( submenuImport, ID_MODEDIT_IMPORT_PART,
|
CONDITIONAL_MENU* submenuExport = new CONDITIONAL_MENU( false, selTool );
|
||||||
_( "&Footprint..." ),
|
submenuExport->SetTitle( _( "Export" ) );
|
||||||
_( "Import a footprint from file" ),
|
submenuExport->SetIcon( export_xpm );
|
||||||
KiBitmap( import_module_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( submenuImport, ID_GEN_IMPORT_GRAPHICS_FILE,
|
submenuExport->AddItem( ID_MODEDIT_EXPORT_PART, _( "&Footprint..." ),
|
||||||
_( "&Graphics..." ),
|
_( "Export current footprint to a file" ),
|
||||||
_( "Import 2D Drawing file to Footprint Editor on Drawings layer" ),
|
export_module_xpm, modifiedDocumentCondition );
|
||||||
KiBitmap( import_vector_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( fileMenu, submenuImport,
|
submenuExport->AddItem( ID_MODEDIT_SAVE_PNG, _( "View as &PNG..." ),
|
||||||
ID_GEN_IMPORT_FILE, _( "&Import" ),
|
_( "Create a PNG file from the current view" ),
|
||||||
_( "Import files" ), KiBitmap( import_xpm ) );
|
plot_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
wxMenu* submenuExport = new wxMenu();
|
fileMenu->AddMenu( submenuExport, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
AddMenuItem( submenuExport, ID_MODEDIT_EXPORT_PART,
|
fileMenu->AddSeparator();
|
||||||
_( "&Footprint..." ),
|
fileMenu->AddItem( ACTIONS::print, SELECTION_CONDITIONS::ShowAlways );
|
||||||
_( "Export current footprint to a file" ),
|
|
||||||
KiBitmap( export_module_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( submenuExport, ID_MODEDIT_SAVE_PNG,
|
fileMenu->AddSeparator();
|
||||||
_( "View as &PNG..." ),
|
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
||||||
_( "Create a PNG file from the current view" ),
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
KiBitmap( plot_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( fileMenu, submenuExport,
|
//-- Edit menu -----------------------------------------------
|
||||||
ID_GEN_EXPORT_FILE, _( "&Export" ),
|
//
|
||||||
_( "Export files" ), KiBitmap( export_xpm ) );
|
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
|
||||||
|
|
||||||
// Print
|
|
||||||
text = AddHotkeyName( _( "&Print..." ), m_hotkeysDescrList, HK_PRINT );
|
|
||||||
AddMenuItem( fileMenu, wxID_PRINT, text,
|
|
||||||
_( "Print current footprint" ),
|
|
||||||
KiBitmap( print_button_xpm ) );
|
|
||||||
|
|
||||||
fileMenu->AppendSeparator();
|
|
||||||
|
|
||||||
// Close editor
|
|
||||||
AddMenuItem( fileMenu, wxID_EXIT,
|
|
||||||
_( "&Exit" ),
|
|
||||||
_( "Close footprint editor" ),
|
|
||||||
KiBitmap( exit_xpm ) );
|
|
||||||
|
|
||||||
//----- Edit menu ------------------
|
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
|
@ -158,7 +145,6 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
return GetToolId() == ID_NO_TOOL_SELECTED;
|
return GetToolId() == ID_NO_TOOL_SELECTED;
|
||||||
};
|
};
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&Undo" ), g_Board_Editor_Hotkeys_Descr, HK_UNDO );
|
|
||||||
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
|
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
|
||||||
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
|
||||||
|
|
||||||
|
@ -185,7 +171,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "Delete the current footprint" ),
|
_( "Delete the current footprint" ),
|
||||||
KiBitmap( delete_xpm ) );
|
KiBitmap( delete_xpm ) );
|
||||||
|
|
||||||
//--------- View menu ----------------
|
//-- View menu -----------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
|
@ -217,12 +204,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
};
|
};
|
||||||
|
|
||||||
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
|
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
|
||||||
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
|
_( "Footprint &Library Browser" ),
|
||||||
|
_( "Browse footprint libraries" ),
|
||||||
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
|
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&3D Viewer" ), m_hotkeysDescrList, HK_3D_VIEWER );
|
|
||||||
viewMenu->AddItem( ID_MENU_PCB_SHOW_3D_FRAME,
|
viewMenu->AddItem( ID_MENU_PCB_SHOW_3D_FRAME,
|
||||||
text, _( "Show footprint in 3D viewer" ),
|
AddHotkeyName( _( "&3D Viewer" ), m_hotkeysDescrList, HK_3D_VIEWER ),
|
||||||
|
_( "Show footprint in 3D viewer" ),
|
||||||
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
|
@ -272,8 +260,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
|
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
|
||||||
search_tree_xpm, searchTreeShownCondition );
|
search_tree_xpm, searchTreeShownCondition );
|
||||||
|
|
||||||
|
//-- Place menu -----------------------------------------------
|
||||||
//-------- Place menu --------------------
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
placeMenu->AddItem( PCB_ACTIONS::placePad, SELECTION_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( PCB_ACTIONS::placePad, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
@ -290,15 +278,17 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
|
||||||
//----- Inspect menu ---------------------
|
//-- Inspect menu -----------------------------------------------
|
||||||
|
//
|
||||||
wxMenu* inspectMenu = new wxMenu;
|
wxMenu* inspectMenu = new wxMenu;
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&Measure" ), m_hotkeysDescrList, HK_MEASURE_TOOL );
|
|
||||||
AddMenuItem( inspectMenu, ID_MODEDIT_MEASUREMENT_TOOL,
|
AddMenuItem( inspectMenu, ID_MODEDIT_MEASUREMENT_TOOL,
|
||||||
text, _( "Measure distance" ),
|
AddHotkeyName( _( "&Measure" ), m_hotkeysDescrList, HK_MEASURE_TOOL ),
|
||||||
|
_( "Measure distance" ),
|
||||||
KiBitmap( measurement_xpm ) );
|
KiBitmap( measurement_xpm ) );
|
||||||
|
|
||||||
//----- Tools menu ---------------------
|
//-- Tools menu -----------------------------------------------
|
||||||
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
|
|
||||||
AddMenuItem( toolsMenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
AddMenuItem( toolsMenu, ID_MODEDIT_LOAD_MODULE_FROM_BOARD,
|
||||||
|
@ -312,52 +302,46 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
|
||||||
KiBitmap( insert_module_board_xpm ) );
|
KiBitmap( insert_module_board_xpm ) );
|
||||||
|
|
||||||
|
|
||||||
//----- Preferences menu -----------------
|
//-- Preferences menu -----------------------------------------------
|
||||||
wxMenu* prefs_menu = new wxMenu;
|
//
|
||||||
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
// Path configuration edit dialog.
|
auto acceleratedGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
AddMenuItem( prefs_menu,
|
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL;
|
||||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
};
|
||||||
_( "&Configure Paths..." ),
|
auto standardGraphicsCondition = [ this ] ( const SELECTION& aSel ) {
|
||||||
_( "Edit path configuration environment variables" ),
|
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
|
||||||
KiBitmap( path_xpm ) );
|
};
|
||||||
|
|
||||||
AddMenuItem( prefs_menu, ID_PCB_LIB_TABLE_EDIT,
|
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ),
|
||||||
_( "Manage &Footprint Libraries..." ), _( "Configure footprint library table" ),
|
_( "Edit path configuration environment variables" ),
|
||||||
KiBitmap( library_table_xpm ) );
|
path_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
// Settings
|
prefsMenu->AddItem( ID_PCB_LIB_TABLE_EDIT, _( "Manage &Footprint Libraries..." ),
|
||||||
text = AddHotkeyName( _( "&Preferences..." ), m_hotkeysDescrList, HK_PREFERENCES );
|
_( "Edit the global and project footprint library tables." ),
|
||||||
AddMenuItem( prefs_menu, wxID_PREFERENCES, text,
|
library_table_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
_( "Show preferences for all open tools" ),
|
|
||||||
KiBitmap( preference_xpm ) );
|
|
||||||
|
|
||||||
prefs_menu->AppendSeparator();
|
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||||
|
AddHotkeyName( _( "&Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ),
|
||||||
|
_( "Show preferences for all open tools" ),
|
||||||
|
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Accelerated Graphics" ), m_hotkeysDescrList, HK_CANVAS_OPENGL );
|
prefsMenu->AddSeparator();
|
||||||
AddMenuItem( prefs_menu, ID_MENU_CANVAS_OPENGL, text,
|
Pgm().AddMenuLanguageList( prefsMenu );
|
||||||
_( "Use hardware-accelerated graphics (recommended)" ),
|
|
||||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Standard Graphics" ), m_hotkeysDescrList, HK_CANVAS_CAIRO );
|
prefsMenu->AddSeparator();
|
||||||
AddMenuItem( prefs_menu, ID_MENU_CANVAS_CAIRO, text,
|
prefsMenu->AddCheckItem( ACTIONS::acceleratedGraphics, acceleratedGraphicsCondition );
|
||||||
_( "Use software graphics (fall-back)" ),
|
prefsMenu->AddCheckItem( ACTIONS::standardGraphics, standardGraphicsCondition );
|
||||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
|
||||||
|
|
||||||
prefs_menu->AppendSeparator();
|
//--MenuBar -----------------------------------------------------------
|
||||||
|
//
|
||||||
// Language submenu
|
|
||||||
Pgm().AddMenuLanguageList( prefs_menu );
|
|
||||||
|
|
||||||
//------------------------------------
|
|
||||||
// Append menus to the menubar
|
|
||||||
menuBar->Append( fileMenu, _( "&File" ) );
|
menuBar->Append( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
menuBar->Append( placeMenu, _( "&Place" ) );
|
menuBar->Append( placeMenu, _( "&Place" ) );
|
||||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||||
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
||||||
menuBar->Append( prefs_menu, _( "P&references" ) );
|
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
|
|
|
@ -42,21 +42,9 @@
|
||||||
#include "pcbnew_id.h"
|
#include "pcbnew_id.h"
|
||||||
|
|
||||||
|
|
||||||
// Build the place submenu
|
|
||||||
static void preparePlaceMenu( CONDITIONAL_MENU* aPlaceMenu, SELECTION_TOOL* aSelectionTool );
|
|
||||||
|
|
||||||
// Build the route menu
|
// Build the route menu
|
||||||
static void prepareRouteMenu( wxMenu* aParentMenu );
|
static void prepareRouteMenu( wxMenu* aParentMenu );
|
||||||
|
|
||||||
// Build the inspect menu
|
|
||||||
static void prepareInspectMenu( wxMenu* aParentMenu );
|
|
||||||
|
|
||||||
// Build the library management menu
|
|
||||||
static void prepareLibraryMenu( wxMenu* aParentMenu );
|
|
||||||
|
|
||||||
// Build the preferences menu
|
|
||||||
static void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu );
|
|
||||||
|
|
||||||
// Build the tools menu
|
// Build the tools menu
|
||||||
static void prepareToolsMenu( wxMenu* aParentMenu );
|
static void prepareToolsMenu( wxMenu* aParentMenu );
|
||||||
|
|
||||||
|
@ -68,7 +56,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// we always have to start from scratch with a new wxMenuBar.
|
// we always have to start from scratch with a new wxMenuBar.
|
||||||
wxMenuBar* oldMenuBar = GetMenuBar();
|
wxMenuBar* oldMenuBar = GetMenuBar();
|
||||||
wxMenuBar* menuBar = new wxMenuBar();
|
wxMenuBar* menuBar = new wxMenuBar();
|
||||||
wxString text;
|
|
||||||
|
|
||||||
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
auto modifiedDocumentCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
return GetScreen()->IsModify();
|
return GetScreen()->IsModify();
|
||||||
|
@ -76,7 +63,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
// Recreate all menus:
|
// Recreate all menus:
|
||||||
|
|
||||||
//----- Edit menu -----------------------------------------------------------
|
//-- File menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
static ACTION_MENU* openRecentMenu;
|
static ACTION_MENU* openRecentMenu;
|
||||||
|
|
||||||
|
@ -134,7 +122,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
fileMenu->AddSeparator();
|
fileMenu->AddSeparator();
|
||||||
|
|
||||||
//----- Import submenu ------------------------------------------------------
|
// Import submenu
|
||||||
ACTION_MENU* submenuImport = new ACTION_MENU();
|
ACTION_MENU* submenuImport = new ACTION_MENU();
|
||||||
submenuImport->SetTool( selTool );
|
submenuImport->SetTool( selTool );
|
||||||
submenuImport->SetTitle( _( "Import" ) );
|
submenuImport->SetTitle( _( "Import" ) );
|
||||||
|
@ -149,7 +137,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
fileMenu->AddMenu( submenuImport, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddMenu( submenuImport, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//----- Export submenu ------------------------------------------------------
|
// Export submenu
|
||||||
ACTION_MENU* submenuExport = new ACTION_MENU();
|
ACTION_MENU* submenuExport = new ACTION_MENU();
|
||||||
submenuExport->SetTool( selTool );
|
submenuExport->SetTool( selTool );
|
||||||
submenuExport->SetTitle( _( "Export" ) );
|
submenuExport->SetTitle( _( "Export" ) );
|
||||||
|
@ -175,7 +163,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
|
|
||||||
fileMenu->AddMenu( submenuExport, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddMenu( submenuExport, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//----- Fabrication Outputs submenu -----------------------------------------
|
// Fabrication Outputs submenu
|
||||||
ACTION_MENU* submenuFabOutputs = new ACTION_MENU();
|
ACTION_MENU* submenuFabOutputs = new ACTION_MENU();
|
||||||
submenuFabOutputs->SetTool( selTool );
|
submenuFabOutputs->SetTool( selTool );
|
||||||
submenuFabOutputs->SetTitle( _( "Fabrication Outputs" ) );
|
submenuFabOutputs->SetTitle( _( "Fabrication Outputs" ) );
|
||||||
|
@ -214,7 +202,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( ACTIONS::plot, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
|
||||||
//----- archive submenu -----------------------------------------------------
|
// Archive submenu
|
||||||
ACTION_MENU* submenuArchive = new ACTION_MENU();
|
ACTION_MENU* submenuArchive = new ACTION_MENU();
|
||||||
submenuArchive->SetTool( selTool );
|
submenuArchive->SetTool( selTool );
|
||||||
submenuArchive->SetTitle( _( "Archive Footprints" ) );
|
submenuArchive->SetTitle( _( "Archive Footprints" ) );
|
||||||
|
@ -237,7 +225,8 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
// Don't use ACTIONS::quit; wxWidgets moves this on OSX and expects to find it via wxID_EXIT
|
// 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, SELECTION_CONDITIONS::ShowAlways );
|
fileMenu->AddItem( wxID_EXIT, _( "Quit" ), "", exit_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//----- Edit menu -----------------------------------------------------------
|
//-- Edit menu -----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
|
|
||||||
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
|
||||||
|
@ -349,15 +338,18 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
||||||
_( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER,
|
_( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER,
|
||||||
layers_manager_xpm, layersPaletteShownCondition );
|
layers_manager_xpm, layersPaletteShownCondition );
|
||||||
|
|
||||||
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
|
||||||
_( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS,
|
_( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS,
|
||||||
mw_toolbar_xpm, microwaveToolbarShownCondition );
|
mw_toolbar_xpm, microwaveToolbarShownCondition );
|
||||||
|
|
||||||
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
|
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
|
||||||
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
|
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
|
||||||
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
|
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
text = AddHotkeyName( _( "&3D Viewer" ), g_Board_Editor_Hotkeys_Descr, HK_3D_VIEWER );
|
|
||||||
viewMenu->AddItem( ID_MENU_PCB_SHOW_3D_FRAME,
|
viewMenu->AddItem( ID_MENU_PCB_SHOW_3D_FRAME,
|
||||||
text, _( "Show board in 3D viewer" ),
|
AddHotkeyName( _( "&3D Viewer" ), g_Board_Editor_Hotkeys_Descr, HK_3D_VIEWER ),
|
||||||
|
_( "Show board in 3D viewer" ),
|
||||||
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
viewMenu->AddSeparator();
|
viewMenu->AddSeparator();
|
||||||
|
@ -420,30 +412,110 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
viewMenu->AppendSeparator();
|
viewMenu->AppendSeparator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----- Place Menu ----------------------------------------------------------
|
//-- Place Menu ----------------------------------------------------------
|
||||||
|
//
|
||||||
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
CONDITIONAL_MENU* placeMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
preparePlaceMenu( placeMenu, selTool );
|
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::placeModule, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawVia, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawZone, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
//----- Route Menu ----------------------------------------------------------
|
placeMenu->AddSeparator();
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drawDimension, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->AddSeparator();
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::placeTarget, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->AddSeparator();
|
||||||
|
placeMenu->AddItem( PCB_ACTIONS::drillOrigin, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
placeMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
placeMenu->AddSeparator();
|
||||||
|
|
||||||
|
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU;
|
||||||
|
autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
|
||||||
|
autoplaceSubmenu->SetTool( selTool );
|
||||||
|
autoplaceSubmenu->SetIcon( mode_module_xpm );
|
||||||
|
|
||||||
|
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceOffboardComponents );
|
||||||
|
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceSelectedComponents );
|
||||||
|
|
||||||
|
placeMenu->AddMenu( autoplaceSubmenu );
|
||||||
|
|
||||||
|
//-- Route Menu ----------------------------------------------------------
|
||||||
|
//
|
||||||
wxMenu* routeMenu = new wxMenu;
|
wxMenu* routeMenu = new wxMenu;
|
||||||
prepareRouteMenu( routeMenu );
|
prepareRouteMenu( routeMenu );
|
||||||
|
|
||||||
//----- Inspect Menu --------------------------------------------------------
|
//-- Inspect Menu --------------------------------------------------------
|
||||||
|
//
|
||||||
wxMenu* inspectMenu = new wxMenu;
|
wxMenu* inspectMenu = new wxMenu;
|
||||||
prepareInspectMenu( inspectMenu );
|
|
||||||
|
|
||||||
//----- Tools menu ----------------------------------------------------------
|
AddMenuItem( inspectMenu, ID_MENU_LIST_NETS,
|
||||||
|
_( "&List Nets" ),
|
||||||
|
_( "View list of nets with names and IDs" ),
|
||||||
|
KiBitmap( list_nets_xpm ) );
|
||||||
|
|
||||||
|
AddMenuItem( inspectMenu, ID_PCB_MEASUREMENT_TOOL,
|
||||||
|
AddHotkeyName( _( "&Measure" ), g_Board_Editor_Hotkeys_Descr, HK_MEASURE_TOOL ),
|
||||||
|
_( "Measure distance" ),
|
||||||
|
KiBitmap( measurement_xpm ) );
|
||||||
|
|
||||||
|
inspectMenu->AppendSeparator();
|
||||||
|
AddMenuItem( inspectMenu, ID_DRC_CONTROL,
|
||||||
|
_( "&Design Rules Checker" ),
|
||||||
|
_( "Perform design rules check" ),
|
||||||
|
KiBitmap( erc_xpm ) );
|
||||||
|
|
||||||
|
//-- Tools menu ----------------------------------------------------------
|
||||||
|
//
|
||||||
wxMenu* toolsMenu = new wxMenu;
|
wxMenu* toolsMenu = new wxMenu;
|
||||||
prepareToolsMenu( toolsMenu );
|
prepareToolsMenu( toolsMenu );
|
||||||
|
|
||||||
//----- Preferences and configuration menu ----------------------------------
|
//-- Preferences menu ----------------------------------------------------
|
||||||
wxMenu* configmenu = new wxMenu;
|
//
|
||||||
prepareLibraryMenu( configmenu );
|
CONDITIONAL_MENU* prefsMenu = new CONDITIONAL_MENU( false, selTool );
|
||||||
configmenu->AppendSeparator();
|
|
||||||
|
|
||||||
preparePreferencesMenu( this, configmenu );
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
//------ Append all menus to the menuBar ------------------------------------
|
prefsMenu->AddItem( ID_PREFERENCES_CONFIGURE_PATHS, _( "&Configure Paths..." ),
|
||||||
|
_( "Edit path configuration environment variables" ),
|
||||||
|
path_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
prefsMenu->AddItem( ID_PCB_LIB_TABLE_EDIT, _( "Manage &Footprint Libraries..." ),
|
||||||
|
_( "Edit the global and project footprint library tables." ),
|
||||||
|
library_table_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
|
||||||
|
#ifdef BUILD_GITHUB_PLUGIN
|
||||||
|
prefsMenu->AddItem( ID_PCB_3DSHAPELIB_WIZARD, _( "Add &3D Shapes Libraries Wizard..." ),
|
||||||
|
_( "Download 3D shape libraries from GitHub" ),
|
||||||
|
import3d_xpm, SELECTION_CONDITIONS::ShowAlways );
|
||||||
|
#endif
|
||||||
|
prefsMenu->AddItem( wxID_PREFERENCES,
|
||||||
|
AddHotkeyName( _( "&Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ),
|
||||||
|
_( "Show preferences for all open tools" ),
|
||||||
|
preference_xpm, SELECTION_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( fileMenu, _( "&File" ) );
|
||||||
menuBar->Append( editMenu, _( "&Edit" ) );
|
menuBar->Append( editMenu, _( "&Edit" ) );
|
||||||
menuBar->Append( viewMenu, _( "&View" ) );
|
menuBar->Append( viewMenu, _( "&View" ) );
|
||||||
|
@ -451,7 +523,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
menuBar->Append( routeMenu, _( "Ro&ute" ) );
|
menuBar->Append( routeMenu, _( "Ro&ute" ) );
|
||||||
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
menuBar->Append( inspectMenu, _( "&Inspect" ) );
|
||||||
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
menuBar->Append( toolsMenu, _( "&Tools" ) );
|
||||||
menuBar->Append( configmenu, _( "P&references" ) );
|
menuBar->Append( prefsMenu, _( "P&references" ) );
|
||||||
AddStandardHelpMenu( menuBar );
|
AddStandardHelpMenu( menuBar );
|
||||||
|
|
||||||
SetMenuBar( menuBar );
|
SetMenuBar( menuBar );
|
||||||
|
@ -465,73 +537,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Build the preferences menu
|
|
||||||
void preparePreferencesMenu( PCB_EDIT_FRAME* aFrame, wxMenu* aParentMenu )
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&Preferences..." ), g_Board_Editor_Hotkeys_Descr, HK_PREFERENCES );
|
|
||||||
AddMenuItem( aParentMenu, wxID_PREFERENCES, text,
|
|
||||||
_( "Show preferences for all open tools" ),
|
|
||||||
KiBitmap( preference_xpm ) );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Accelerated Graphics" ), g_Board_Editor_Hotkeys_Descr,
|
|
||||||
HK_CANVAS_OPENGL );
|
|
||||||
AddMenuItem( aParentMenu, ID_MENU_CANVAS_OPENGL, text,
|
|
||||||
_( "Use hardware-accelerated graphics (recommended)" ),
|
|
||||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "Standard Graphics" ), g_Board_Editor_Hotkeys_Descr,
|
|
||||||
HK_CANVAS_CAIRO );
|
|
||||||
AddMenuItem( aParentMenu, ID_MENU_CANVAS_CAIRO, text,
|
|
||||||
_( "Use software graphics (fall-back)" ),
|
|
||||||
KiBitmap( tools_xpm ), wxITEM_RADIO );
|
|
||||||
|
|
||||||
aParentMenu->AppendSeparator();
|
|
||||||
|
|
||||||
// Language submenu
|
|
||||||
Pgm().AddMenuLanguageList( aParentMenu );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Build the place submenu
|
|
||||||
void preparePlaceMenu( CONDITIONAL_MENU* aPlaceMenu, SELECTION_TOOL* aSelectionTool )
|
|
||||||
{
|
|
||||||
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::placeModule, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawVia, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawZone, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawZoneKeepout, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::placeText, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawArc, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawCircle, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawLine, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawPolygon, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
aPlaceMenu->AddSeparator();
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drawDimension, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
aPlaceMenu->AddSeparator();
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::placeTarget, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
aPlaceMenu->AddSeparator();
|
|
||||||
aPlaceMenu->AddItem( PCB_ACTIONS::drillOrigin, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
aPlaceMenu->AddItem( ACTIONS::gridSetOrigin, SELECTION_CONDITIONS::ShowAlways );
|
|
||||||
|
|
||||||
aPlaceMenu->AddSeparator();
|
|
||||||
|
|
||||||
ACTION_MENU* autoplaceSubmenu = new ACTION_MENU;
|
|
||||||
autoplaceSubmenu->SetTitle( _( "Auto-Place Footprints" ) );
|
|
||||||
autoplaceSubmenu->SetTool( aSelectionTool );
|
|
||||||
autoplaceSubmenu->SetIcon( mode_module_xpm );
|
|
||||||
|
|
||||||
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceOffboardComponents );
|
|
||||||
autoplaceSubmenu->Add( PCB_ACTIONS::autoplaceSelectedComponents );
|
|
||||||
|
|
||||||
aPlaceMenu->AddMenu( autoplaceSubmenu );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Build the route menu
|
// Build the route menu
|
||||||
void prepareRouteMenu( wxMenu* aParentMenu )
|
void prepareRouteMenu( wxMenu* aParentMenu )
|
||||||
{
|
{
|
||||||
|
@ -584,53 +589,6 @@ void prepareRouteMenu( wxMenu* aParentMenu )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Build the inspect menu
|
|
||||||
void prepareInspectMenu( wxMenu* aParentMenu )
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
|
|
||||||
AddMenuItem( aParentMenu, ID_MENU_LIST_NETS,
|
|
||||||
_( "&List Nets" ),
|
|
||||||
_( "View list of nets with names and IDs" ),
|
|
||||||
KiBitmap( list_nets_xpm ) );
|
|
||||||
|
|
||||||
text = AddHotkeyName( _( "&Measure" ), g_Board_Editor_Hotkeys_Descr, HK_MEASURE_TOOL );
|
|
||||||
AddMenuItem( aParentMenu, ID_PCB_MEASUREMENT_TOOL, text,
|
|
||||||
_( "Measure distance" ),
|
|
||||||
KiBitmap( measurement_xpm ) );
|
|
||||||
|
|
||||||
aParentMenu->AppendSeparator();
|
|
||||||
|
|
||||||
AddMenuItem( aParentMenu, ID_DRC_CONTROL,
|
|
||||||
_( "&Design Rules Checker" ),
|
|
||||||
_( "Perform design rules check" ),
|
|
||||||
KiBitmap( erc_xpm ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Build the library management menu
|
|
||||||
void prepareLibraryMenu( wxMenu* aParentMenu )
|
|
||||||
{
|
|
||||||
AddMenuItem( aParentMenu,
|
|
||||||
ID_PREFERENCES_CONFIGURE_PATHS,
|
|
||||||
_( "&Configure Paths..." ),
|
|
||||||
_( "Edit path configuration environment variables" ),
|
|
||||||
KiBitmap( path_xpm ) );
|
|
||||||
|
|
||||||
AddMenuItem( aParentMenu, ID_PCB_LIB_TABLE_EDIT,
|
|
||||||
_( "Manage &Footprint Libraries..." ),
|
|
||||||
_( "Edit the global and project footprint library lists" ),
|
|
||||||
KiBitmap( library_table_xpm ) );
|
|
||||||
|
|
||||||
#ifdef BUILD_GITHUB_PLUGIN
|
|
||||||
AddMenuItem( aParentMenu, ID_PCB_3DSHAPELIB_WIZARD,
|
|
||||||
_( "Add &3D Shapes Libraries Wizard..." ),
|
|
||||||
_( "Download 3D shape libraries from GitHub" ),
|
|
||||||
KiBitmap( import3d_xpm ) );
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Build the tools menu
|
// Build the tools menu
|
||||||
void prepareToolsMenu( wxMenu* aParentMenu )
|
void prepareToolsMenu( wxMenu* aParentMenu )
|
||||||
{
|
{
|
||||||
|
|
|
@ -62,15 +62,11 @@ void PCB_BASE_EDIT_FRAME::SetRotationAngle( int aRotationAngle )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
void PCB_BASE_EDIT_FRAME::UseGalCanvas()
|
||||||
{
|
{
|
||||||
PCB_BASE_FRAME::UseGalCanvas( aEnable );
|
PCB_BASE_FRAME::UseGalCanvas();
|
||||||
|
|
||||||
// No matter what, reenable undo/redo on switching to the legacy canvas
|
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
|
||||||
if( !aEnable )
|
|
||||||
UndoRedoBlock( false );
|
|
||||||
else
|
|
||||||
static_cast<PCB_DRAW_PANEL_GAL*>( GetGalCanvas() )->SyncLayersVisibility( m_Pcb );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ public:
|
||||||
void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
|
void InstallGraphicItemPropertiesDialog( BOARD_ITEM* aItem );
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||||
void UseGalCanvas( bool aEnable ) override;
|
void UseGalCanvas() override;
|
||||||
|
|
||||||
///> @copydoc PCB_BASE_FRAME::SetBoard()
|
///> @copydoc PCB_BASE_FRAME::SetBoard()
|
||||||
virtual void SetBoard( BOARD* aBoard ) override;
|
virtual void SetBoard( BOARD* aBoard ) override;
|
||||||
|
|
|
@ -88,9 +88,6 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
|
||||||
|
|
||||||
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
|
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
|
||||||
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
||||||
// Switching canvases
|
|
||||||
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, PCB_BASE_FRAME::OnUpdateSwitchCanvas )
|
|
||||||
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, PCB_BASE_FRAME::OnUpdateSwitchCanvas )
|
|
||||||
|
|
||||||
EVT_UPDATE_UI_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
EVT_UPDATE_UI_RANGE( ID_ZOOM_IN, ID_ZOOM_PAGE, PCB_BASE_FRAME::OnUpdateSelectZoom )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
@ -593,21 +590,6 @@ void PCB_BASE_FRAME::OnToggleTextDrawMode( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_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 PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||||
{
|
{
|
||||||
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
|
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )
|
||||||
|
@ -998,62 +980,29 @@ void PCB_BASE_FRAME::SetFastGrid2()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
|
void PCB_BASE_FRAME::UseGalCanvas()
|
||||||
{
|
{
|
||||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
EDA_DRAW_FRAME::UseGalCanvas();
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
EDA_DRAW_PANEL_GAL* galCanvas = GetGalCanvas();
|
||||||
|
|
||||||
if( m_toolManager )
|
if( m_toolManager )
|
||||||
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
||||||
GetGalCanvas()->GetViewControls(), this );
|
GetGalCanvas()->GetViewControls(), this );
|
||||||
|
|
||||||
if( aEnable )
|
SetBoard( m_Pcb );
|
||||||
{
|
|
||||||
SetBoard( m_Pcb );
|
|
||||||
|
|
||||||
if( m_toolManager )
|
if( m_toolManager )
|
||||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||||
|
|
||||||
// Transfer latest current display options from legacy to GAL canvas:
|
// Transfer latest current display options from legacy to GAL canvas:
|
||||||
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
|
auto painter = static_cast<KIGFX::PCB_PAINTER*>( galCanvas->GetView()->GetPainter() );
|
||||||
auto settings = painter->GetSettings();
|
auto settings = painter->GetSettings();
|
||||||
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
|
||||||
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
|
settings->LoadDisplayOptions( displ_opts, ShowPageLimits() );
|
||||||
|
|
||||||
galCanvas->GetView()->RecacheAllItems();
|
galCanvas->GetView()->RecacheAllItems();
|
||||||
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
galCanvas->SetEventDispatcher( m_toolDispatcher );
|
||||||
galCanvas->StartDrawing();
|
galCanvas->StartDrawing();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_toolManager )
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
|
||||||
|
|
||||||
// Redirect all events to the legacy canvas
|
|
||||||
galCanvas->SetEventDispatcher( NULL );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
|
|
||||||
{
|
|
||||||
wxMenuBar* menuBar = GetMenuBar();
|
|
||||||
EDA_DRAW_PANEL_GAL* gal_canvas = GetGalCanvas();
|
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
|
|
||||||
|
|
||||||
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 );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -385,10 +385,10 @@ void PCB_DRAW_PANEL_GAL::OnShow()
|
||||||
{
|
{
|
||||||
// Fallback to software renderer
|
// Fallback to software renderer
|
||||||
DisplayError( frame, e.what() );
|
DisplayError( frame, e.what() );
|
||||||
bool use_gal = SwitchBackend( GAL_TYPE_CAIRO );
|
SwitchBackend( GAL_TYPE_CAIRO );
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
frame->UseGalCanvas( use_gal );
|
frame->UseGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( frame )
|
if( frame )
|
||||||
|
|
|
@ -182,10 +182,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
||||||
// Menu 3D Frame
|
// Menu 3D Frame
|
||||||
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame )
|
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, PCB_EDIT_FRAME::Show3D_Frame )
|
||||||
|
|
||||||
// Switching canvases
|
|
||||||
EVT_MENU( ID_MENU_CANVAS_CAIRO, PCB_EDIT_FRAME::OnSwitchCanvas )
|
|
||||||
EVT_MENU( ID_MENU_CANVAS_OPENGL, PCB_EDIT_FRAME::OnSwitchCanvas )
|
|
||||||
|
|
||||||
// Menu Get Design Rules Editor
|
// Menu Get Design Rules Editor
|
||||||
EVT_MENU( ID_BOARD_SETUP_DIALOG, PCB_EDIT_FRAME::ShowBoardSetupDialog )
|
EVT_MENU( ID_BOARD_SETUP_DIALOG, PCB_EDIT_FRAME::ShowBoardSetupDialog )
|
||||||
|
|
||||||
|
@ -411,7 +407,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
|
||||||
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
view->SetScale( GetZoomLevelCoeff() / m_canvas->GetZoom() );
|
||||||
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
view->SetCenter( VECTOR2D( m_canvas->GetScreenCenterLogicalPosition() ) );
|
||||||
|
|
||||||
UseGalCanvas( true );
|
UseGalCanvas();
|
||||||
|
|
||||||
// disable Export STEP item if kicad2step does not exist
|
// disable Export STEP item if kicad2step does not exist
|
||||||
wxString strK2S = Pgm().GetExecutablePath();
|
wxString strK2S = Pgm().GetExecutablePath();
|
||||||
|
@ -628,9 +624,9 @@ void PCB_EDIT_FRAME::Show3D_Frame( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
void PCB_EDIT_FRAME::UseGalCanvas()
|
||||||
{
|
{
|
||||||
PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
|
PCB_BASE_EDIT_FRAME::UseGalCanvas();
|
||||||
COLORS_DESIGN_SETTINGS& cds = Settings().Colors();
|
COLORS_DESIGN_SETTINGS& cds = Settings().Colors();
|
||||||
|
|
||||||
cds.SetLegacyMode( false );
|
cds.SetLegacyMode( false );
|
||||||
|
@ -999,14 +995,13 @@ void PCB_EDIT_FRAME::OnLayerColorChange( wxCommandEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::OnSwitchCanvas( wxCommandEvent& aEvent )
|
void PCB_EDIT_FRAME::SwitchCanvas( EDA_DRAW_PANEL_GAL::GAL_TYPE aCanvasType )
|
||||||
{
|
{
|
||||||
// switches currently used canvas (Cairo / OpenGL).
|
// switches currently used canvas (Cairo / OpenGL).
|
||||||
PCB_BASE_FRAME::OnSwitchCanvas( aEvent );
|
PCB_BASE_FRAME::SwitchCanvas( aCanvasType );
|
||||||
|
|
||||||
// The base class method *does not reinit* the layers manager.
|
// The base class method *does not reinit* the layers manager. We must upate the
|
||||||
// We must upate the layer widget to match board visibility states,
|
// layer widget to match board visibility states, both layers and render columns.
|
||||||
// both layers and render columns.
|
|
||||||
syncLayerVisibilities();
|
syncLayerVisibilities();
|
||||||
syncLayerWidgetLayer();
|
syncLayerWidgetLayer();
|
||||||
syncRenderStates();
|
syncRenderStates();
|
||||||
|
|
|
@ -103,10 +103,10 @@ protected:
|
||||||
wxString createBackupFile( const wxString& aFileName );
|
wxString createBackupFile( const wxString& aFileName );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* switches currently used canvas (default / Cairo / OpenGL).
|
* switches currently used canvas (Cairo / OpenGL).
|
||||||
* It also reinit the layers manager that slightly changes with canvases
|
* 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;
|
||||||
|
|
||||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||||
/**
|
/**
|
||||||
|
@ -573,7 +573,7 @@ public:
|
||||||
void Show3D_Frame( wxCommandEvent& event ) override;
|
void Show3D_Frame( wxCommandEvent& event ) override;
|
||||||
|
|
||||||
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
///> @copydoc EDA_DRAW_FRAME::UseGalCanvas()
|
||||||
void UseGalCanvas( bool aEnable ) override;
|
void UseGalCanvas() override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ShowBoardSetupDialog
|
* Function ShowBoardSetupDialog
|
||||||
|
@ -588,7 +588,6 @@ public:
|
||||||
|
|
||||||
void OnSelectOptionToolbar( wxCommandEvent& event );
|
void OnSelectOptionToolbar( wxCommandEvent& event );
|
||||||
void OnFlipPcbView( wxCommandEvent& event );
|
void OnFlipPcbView( wxCommandEvent& event );
|
||||||
void ToolOnRightClick( wxCommandEvent& event ) override;
|
|
||||||
|
|
||||||
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
|
||||||
|
|
||||||
GetScreen()->PushCommandToUndoList( oldBuffer );
|
GetScreen()->PushCommandToUndoList( oldBuffer );
|
||||||
|
|
||||||
UseGalCanvas( GetGalCanvas() );
|
UseGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -158,7 +158,7 @@ void Refresh()
|
||||||
auto gal_canvas = static_cast<PCB_DRAW_PANEL_GAL*>( s_PcbEditFrame->GetGalCanvas() );
|
auto gal_canvas = static_cast<PCB_DRAW_PANEL_GAL*>( s_PcbEditFrame->GetGalCanvas() );
|
||||||
|
|
||||||
// Reinit everything: this is the easy way to do that
|
// Reinit everything: this is the easy way to do that
|
||||||
s_PcbEditFrame->UseGalCanvas( true );
|
s_PcbEditFrame->UseGalCanvas();
|
||||||
gal_canvas->Refresh();
|
gal_canvas->Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,49 +0,0 @@
|
||||||
/**
|
|
||||||
* @file tool_onrightclick.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
|
|
||||||
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
|
||||||
* Copyright (C) 1992-2012 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 Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <confirm.h>
|
|
||||||
#include <pcbnew.h>
|
|
||||||
#include <pcb_edit_frame.h>
|
|
||||||
#include <footprint_edit_frame.h>
|
|
||||||
#include <pcbnew_id.h>
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( event.GetSelection() == ID_PCB_PLACE_GRID_COORD_BUTT )
|
|
||||||
InvokeDialogGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINT_EDIT_FRAME::ToolOnRightClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
if( event.GetSelection() == ID_PCB_PLACE_GRID_COORD_BUTT )
|
|
||||||
InvokeDialogGrid();
|
|
||||||
}
|
|
Loading…
Reference in New Issue