Implement ACTION_TOOLBAR and update some of the menus to ACTION_MENU.

This gives us better separation of MVC in line with the design of
the modern toolset.  It also reduces a whole bunch of duplicated
data.
This commit is contained in:
Jeff Young 2019-05-14 20:21:10 +01:00
parent f9e4ee1fc9
commit 69afa27a5f
89 changed files with 1462 additions and 2174 deletions

View File

@ -234,22 +234,13 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
*/
void loadCommonSettings();
/**
* Filename to propose for save a screenshot
*/
wxFileName m_defaultSaveScreenshotFileName;
wxFileName m_defaultSaveScreenshotFileName;
/**
* The canvas where the openGL context will be rendered
*/
EDA_3D_CANVAS *m_canvas;
wxAuiToolBar* m_mainToolBar;
EDA_3D_CANVAS* m_canvas;
CINFO3D_VISU m_settings;
/**
* Store all the settings and options to be used by the renders
*/
CINFO3D_VISU m_settings;
bool m_disable_ray_tracing;
bool m_disable_ray_tracing;
/**
* Trace mask used to enable or disable the trace output of this class.

View File

@ -395,10 +395,11 @@ set( COMMON_SRCS
math/math_util.cpp
tool/action_manager.cpp
tool/action_menu.cpp
tool/action_toolbar.cpp
tool/actions.cpp
tool/common_tools.cpp
tool/conditional_menu.cpp
tool/action_menu.cpp
tool/edit_constraints.cpp
tool/edit_points.cpp
tool/grid_menu.cpp

View File

@ -74,7 +74,6 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
wxFrame( aParent, wxID_ANY, aTitle, aPos, aSize, aStyle, aFrameName )
{
m_Ident = aFrameType;
m_mainToolBar = NULL;
m_hasAutoSave = false;
m_autoSaveState = false;
m_autoSaveInterval = -1;

View File

@ -81,8 +81,6 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_CHAR_HOOK( EDA_DRAW_FRAME::OnCharHook )
EVT_MOUSEWHEEL( EDA_DRAW_FRAME::OnMouseEvent )
EVT_MENU_OPEN( EDA_DRAW_FRAME::OnMenuOpen )
EVT_ACTIVATE( EDA_DRAW_FRAME::OnActivate )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
@ -98,6 +96,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
{
m_useSingleCanvasPane = false;
m_socketServer = nullptr;
m_mainToolBar = NULL;
m_drawToolBar = NULL;
m_optionsToolBar = NULL;
m_auxiliaryToolBar = NULL;
@ -271,9 +270,7 @@ void EDA_DRAW_FRAME::EraseMsgBox()
void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
{
if( m_canvas )
m_canvas->SetCanStartBlock( -1 );
// TODO Obsolete!
event.Skip(); // required under wxMAC
}

View File

@ -1,11 +1,7 @@
#include "fctsys.h"
#include "gr_basic.h"
#include "base_screen.h"
#include "common.h"
#include "macros.h"
#include "class_drawpanel.h"
#include "marker_base.h"
#include "dialog_display_info_HTML_base.h"

View File

@ -114,18 +114,8 @@ BEGIN_EVENT_TABLE( EDA_DRAW_FRAME, KIWAY_PLAYER )
EVT_MENU_RANGE( ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER,
EDA_DRAW_FRAME::OnSelectGrid )
EVT_TOOL( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnToggleGridState )
EVT_TOOL_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnSelectUnits )
EVT_TOOL( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnToggleCrossHairStyle )
EVT_UPDATE_UI( wxID_UNDO, EDA_DRAW_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, EDA_DRAW_FRAME::OnUpdateRedo )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRID, EDA_DRAW_FRAME::OnUpdateGrid )
EVT_UPDATE_UI( ID_TB_OPTIONS_SELECT_CURSOR, EDA_DRAW_FRAME::OnUpdateCrossHairStyle )
EVT_UPDATE_UI_RANGE( ID_TB_OPTIONS_SELECT_UNIT_MM, ID_TB_OPTIONS_SELECT_UNIT_INCH,
EDA_DRAW_FRAME::OnUpdateUnits )
END_EVENT_TABLE()
@ -137,6 +127,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
KIWAY_PLAYER( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
{
m_socketServer = nullptr;
m_mainToolBar = NULL;
m_drawToolBar = NULL;
m_optionsToolBar = NULL;
m_auxiliaryToolBar = NULL;
@ -356,21 +347,6 @@ bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
}
void EDA_DRAW_FRAME::OnSelectUnits( wxCommandEvent& aEvent )
{
if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM && m_UserUnits != MILLIMETRES )
{
m_UserUnits = MILLIMETRES;
unitsChangeRefresh();
}
else if( aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH && m_UserUnits != INCHES )
{
m_UserUnits = INCHES;
unitsChangeRefresh();
}
}
void EDA_DRAW_FRAME::OnToggleCrossHairStyle( wxCommandEvent& aEvent )
{
INSTALL_UNBUFFERED_DC( dc, m_canvas );
@ -398,27 +374,6 @@ void EDA_DRAW_FRAME::OnUpdateRedo( wxUpdateUIEvent& aEvent )
}
void EDA_DRAW_FRAME::OnUpdateUnits( wxUpdateUIEvent& aEvent )
{
bool enable;
enable = ( ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_MM) && (m_UserUnits == MILLIMETRES))
|| ((aEvent.GetId() == ID_TB_OPTIONS_SELECT_UNIT_INCH) && (m_UserUnits == INCHES)) );
aEvent.Check( enable );
DisplayUnitsMsg();
}
void EDA_DRAW_FRAME::OnUpdateGrid( wxUpdateUIEvent& aEvent )
{
wxString tool_tip = IsGridVisible() ? _( "Hide grid" ) : _( "Show grid" );
aEvent.Check( IsGridVisible() );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_GRID, tool_tip );
}
void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
{
// No need to update the grid select box if it doesn't exist or the grid setting change

View File

@ -383,11 +383,11 @@ void ACTION_MENU::onMenuEvent( wxMenuEvent& aEvent )
#endif
// Handling non-action menu entries (e.g. items in clarification list)
if( !evt )
if( !evt && m_selected < wxID_LOWEST )
{
menuText = GetLabelText( aEvent.GetId() );
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId(),
AS_GLOBAL, &menuText );
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, m_selected, AS_GLOBAL,
&menuText );
}
}
}
@ -399,6 +399,10 @@ void ACTION_MENU::onMenuEvent( wxMenuEvent& aEvent )
//aEvent.StopPropagation();
m_tool->GetManager()->ProcessEvent( *evt );
}
else
{
aEvent.Skip();
}
}

View File

@ -0,0 +1,85 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.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 <functional>
#include <draw_frame.h>
#include <tool/actions.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tool/tool_interactive.h>
#include <tool/action_toolbar.h>
ACTION_TOOLBAR::ACTION_TOOLBAR( EDA_DRAW_FRAME* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, long style ) :
wxAuiToolBar( parent, id, pos, size, style ),
m_toolManager( parent->GetToolManager() )
{
Connect( wxEVT_COMMAND_TOOL_CLICKED, wxAuiToolBarEventHandler( ACTION_TOOLBAR::onToolEvent ), NULL, this );
}
void ACTION_TOOLBAR::Add( const TOOL_ACTION& aAction, bool aIsToggleEntry )
{
int toolId = aAction.GetId() + ACTION_ID;
AddTool( toolId, wxEmptyString, KiBitmap( aAction.GetIcon() ), aAction.GetDescription(),
aIsToggleEntry ? wxITEM_CHECK : wxITEM_NORMAL );
m_toolActions[ toolId ] = &aAction;
}
void ACTION_TOOLBAR::Toggle( const TOOL_ACTION& aAction, bool aState )
{
ToggleTool( aAction.GetId() + ACTION_ID, aState );
}
void ACTION_TOOLBAR::onToolEvent( wxAuiToolBarEvent& aEvent )
{
OPT_TOOL_EVENT evt;
wxString menuText;
wxEventType type = aEvent.GetEventType();
if( type == wxEVT_COMMAND_TOOL_CLICKED && aEvent.GetId() >= ACTION_ID )
{
const auto it = m_toolActions.find( aEvent.GetId() );
if( it != m_toolActions.end() )
evt = it->second->MakeEvent();
}
// forward the action/update event to the TOOL_MANAGER
if( evt && m_toolManager )
{
//aEvent.StopPropagation();
m_toolManager->ProcessEvent( *evt );
}
else
{
aEvent.Skip();
}
}

View File

@ -13,10 +13,35 @@ TOOL_ACTION ACTIONS::cancelInteractive( "common.Interactive.cancel",
TOOL_ACTION ACTIONS::updateMenu( "common.Interactive.updateMenu",
AS_GLOBAL, 0, "", "" ); // This is an internal event
TOOL_ACTION ACTIONS::undo( "common.Interactive.undo",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UNDO ),
_( "Undo" ), _( "Undo last edit" ),
undo_xpm );
TOOL_ACTION ACTIONS::redo( "common.Interactive.redo",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REDO ),
_( "Redo" ), _( "Redo last edit" ),
redo_xpm );
TOOL_ACTION ACTIONS::cut( "common.Interactive.cut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_CUT ),
_( "Cut" ), _( "Cut selected item(s) to clipboard" ),
cut_xpm );
TOOL_ACTION ACTIONS::copy( "common.Interactive.copy",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COPY ),
_( "Copy" ), _( "Copy selected item(s) to clipboard" ),
copy_xpm );
TOOL_ACTION ACTIONS::paste( "common.Interactive.paste",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_PASTE ),
_( "Paste" ), _( "Paste clipboard into schematic" ),
paste_xpm );
// View Controls
TOOL_ACTION ACTIONS::zoomRedraw( "common.Control.zoomRedraw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_REDRAW ),
_( "Refresh View" ), "",
_( "Refresh" ), "",
zoom_redraw_xpm );
TOOL_ACTION ACTIONS::zoomIn( "common.Control.zoomIn",
@ -105,7 +130,6 @@ TOOL_ACTION ACTIONS::cursorDblClick( "common.Control.cursorDblClick",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
"", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
TOOL_ACTION ACTIONS::panUp( "common.Control.panUp",
AS_GLOBAL, MD_SHIFT + WXK_UP,
"", "", NULL, AF_NONE, (void*) CURSOR_UP );
@ -177,6 +201,18 @@ TOOL_ACTION ACTIONS::toggleUnits( "common.Control.toggleUnits",
unit_mm_xpm );
TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ),
_( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ),
cursor_xpm );
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
AS_GLOBAL, 0,
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
cursor_shape_xpm );
// System-wide selection Events
///> Event sent after an item is selected.

View File

@ -22,6 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <bitmaps.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <draw_frame.h>
@ -34,29 +35,6 @@
#include <tool/common_tools.h>
TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ),
_( "Always Show Cursor" ),
_( "Switch whether the cursor is displayed even when not in an editing tool" ) );
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
AS_GLOBAL, 0,
_( "Full-Window Crosshairs" ),
_( "Switch display of full-window crosshairs" ) );
COMMON_TOOLS::COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ), m_frame( NULL )
{
}
COMMON_TOOLS::~COMMON_TOOLS()
{
}
void COMMON_TOOLS::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<EDA_DRAW_FRAME>();

View File

@ -51,6 +51,32 @@ void CONDITIONAL_MENU::AddCheckItem( const TOOL_ACTION& aAction,
}
void CONDITIONAL_MENU::AddItem( int aId, const wxString& aText, const wxString& aTooltip,
BITMAP_DEF aIcon, const SELECTION_CONDITION& aCondition,
int aOrder )
{
wxMenuItem* item = new wxMenuItem( nullptr, aId, aText, aTooltip, wxITEM_NORMAL );
if( aIcon )
item->SetBitmap( KiBitmap( aIcon ) );
addEntry( ENTRY( item, aCondition, aOrder, false ) );
}
void CONDITIONAL_MENU::AddCheckItem( int aId, const wxString& aText, const wxString& aTooltip,
BITMAP_DEF aIcon, const SELECTION_CONDITION& aCondition,
int aOrder )
{
wxMenuItem* item = new wxMenuItem( nullptr, aId, aText, aTooltip, wxITEM_CHECK );
if( aIcon )
item->SetBitmap( KiBitmap( aIcon ) );
addEntry( ENTRY( item, aCondition, aOrder, true ) );
}
void CONDITIONAL_MENU::AddMenu( ACTION_MENU* aMenu, const SELECTION_CONDITION& aCondition,
int aOrder )
{
@ -94,6 +120,10 @@ void CONDITIONAL_MENU::Evaluate( SELECTION& aSelection )
case ENTRY::MENU:
menuItem = Add( entry.Menu() );
break;
case ENTRY::WXITEM:
menuItem = Append( entry.wxItem()->GetId(), entry.wxItem()->GetItemLabel(),
entry.wxItem()->GetHelp(), entry.wxItem()->GetKind() );
break;
case ENTRY::SEPARATOR:
menuItem = AppendSeparator();
break;

View File

@ -469,8 +469,6 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
if( type == wxEVT_CHAR && !keyIsSpecial )
aEvent.Skip();
#endif
m_toolMgr->UpdateUI();
}
@ -482,8 +480,6 @@ void TOOL_DISPATCHER::DispatchWxCommand( wxCommandEvent& aEvent )
m_toolMgr->ProcessEvent( *evt );
else
aEvent.Skip();
m_toolMgr->UpdateUI();
}

View File

@ -792,6 +792,8 @@ bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
#endif
}
UpdateUI();
return hotkey_handled;
}

View File

@ -119,9 +119,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
displ_opts->m_ShowTrackClearanceMode = PCB_DISPLAY_OPTIONS::DO_NOT_SHOW_CLEARANCE;
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
// Create GAL canvas
#ifdef __WXMAC__
@ -134,19 +131,6 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
GetGalDisplayOptions(), backend );
SetGalCanvas( gal_drawPanel );
m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
m_auimgr.Update();
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
@ -164,6 +148,23 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( KIWAY* aKiway, wxWindow* aPa
// Run the control tool, it is supposed to be always active
m_toolManager->InvokeTool( "cvpcb.InteractiveSelection" );
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
m_auimgr.Update();
auto& galOpts = GetGalDisplayOptions();
galOpts.m_axesEnabled = true;
UseGalCanvas( true );
@ -212,8 +213,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
return;
// Create options tool bar.
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// TODO: these can be moved to the 'proper' right vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable
@ -223,37 +224,20 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
wxEmptyString, wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ),
wxITEM_CHECK );
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ),
wxITEM_CHECK );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
_( "Hide grid" ), wxITEM_CHECK );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
#else
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape (not supported in Legacy Toolset)" ),
wxITEM_CHECK );
#endif
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
@ -277,28 +261,18 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
if( m_mainToolBar != NULL )
return;
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiScaledBitmap( config_xpm, this ),
_( "Display options" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ),
_( "Zoom in (F1)" ) );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ),
_( "Zoom out (F2)" ) );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ),
_( "Redraw view (F3)" ) );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ),
_( "Zoom to fit footprint (Home)" ) );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiScaledBitmap( three_d_xpm, this ),
@ -623,6 +597,13 @@ void DISPLAY_FOOTPRINTS_FRAME::OnUIToolSelection( wxUpdateUIEvent& aEvent )
}
void DISPLAY_FOOTPRINTS_FRAME::SyncMenusAndToolbars()
{
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
}
/*
* Redraw the BOARD items but not cursors, axis or grid.
*/
@ -634,3 +615,4 @@ void BOARD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
m_Modules->Draw( aPanel, aDC, GR_COPY );
}
}

View File

@ -148,6 +148,7 @@ public:
// currently: do nothing in CvPcb.
}
void SyncMenusAndToolbars() override;
DECLARE_EVENT_TABLE()
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2016 CERN
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -30,21 +30,6 @@ OPT<TOOL_EVENT> CVPCB_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_ZOOM_IN: // toolbar button "Zoom In"
case ID_VIEWER_ZOOM_IN:
return ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT: // toolbar button "Zoom In"
case ID_VIEWER_ZOOM_OUT:
return ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
case ID_VIEWER_ZOOM_PAGE:
return ACTIONS::zoomFitScreen.MakeEvent();
case ID_ZOOM_SELECTION:
return ACTIONS::zoomTool.MakeEvent();
case ID_TB_MEASUREMENT_TOOL:
return CVPCB_ACTIONS::measureTool.MakeEvent();

View File

@ -229,7 +229,7 @@ set( EESCHEMA_SRCS
tools/ee_picker_tool.cpp
tools/ee_point_editor.cpp
tools/ee_selection_tool.cpp
tools/lib_editor_control.cpp
tools/lib_control.cpp
tools/lib_drawing_tools.cpp
tools/lib_edit_tool.cpp
tools/lib_move_tool.cpp

View File

@ -76,7 +76,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( strcmp( idcmd, "$NET:" ) == 0 )
{
if( GetToolId() == ID_HIGHLIGHT_BUTT )
if( GetToolId() == ID_HIGHLIGHT_TOOL )
{
m_SelectedNetName = FROM_UTF8( text );

View File

@ -138,63 +138,52 @@ static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_
// Schematic editor
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W',
ID_WIRE_BUTT );
ID_WIRE_TOOL );
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B',
ID_BUS_BUTT );
static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K',
ID_SCH_END_LINE_WIRE_OR_BUS );
ID_BUS_TOOL );
static EDA_HOTKEY HkEndLineWireBus( _HKI( "End Line Wire Bus" ), HK_END_CURR_LINEWIREBUS, 'K' );
static EDA_HOTKEY HkAddLabel( _HKI( "Add Label" ), HK_ADD_LABEL, 'L',
ID_LABEL_BUTT );
ID_LABEL_TOOL );
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H',
ID_HIERLABEL_BUTT );
ID_HIERLABEL_TOOL );
static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H',
ID_GLOBALLABEL_BUTT );
ID_GLOBALLABEL_TOOL );
static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J',
ID_JUNCTION_BUTT );
ID_JUNCTION_TOOL );
static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A',
ID_SCH_PLACE_COMPONENT );
ID_PLACE_SYMBOL_TOOL );
static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P',
ID_PLACE_POWER_BUTT );
ID_PLACE_POWER_TOOL );
static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q',
ID_NOCONN_BUTT );
ID_NOCONNECT_TOOL );
static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S',
ID_SHEET_SYMBOL_BUTT );
ID_SHEET_TOOL );
static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/',
ID_BUSTOBUS_ENTRY_BUTT );
ID_BUSTOBUS_ENTRY_TOOL );
static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z',
ID_WIRETOBUS_ENTRY_BUTT );
ID_WIRETOBUS_ENTRY_TOOL );
static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I',
ID_LINE_COMMENT_BUTT );
ID_SCHEMATIC_LINE_TOOL );
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T',
ID_TEXT_COMMENT_BUTT );
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y',
ID_SCH_MIRROR_Y );
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X',
ID_SCH_MIRROR_X );
static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R',
ID_SCH_ROTATE_CLOCKWISE );
static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E',
ID_SCH_EDIT_ITEM );
static EDA_HOTKEY HkEditValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V',
ID_SCH_EDIT_COMPONENT_VALUE );
static EDA_HOTKEY HkEditReference( _HKI( "Edit Symbol Reference" ), HK_EDIT_COMPONENT_REFERENCE, 'U',
ID_SCH_EDIT_COMPONENT_REFERENCE );
static EDA_HOTKEY HkEditFootprint( _HKI( "Edit Symbol Footprint" ), HK_EDIT_COMPONENT_FOOTPRINT, 'F',
ID_SCH_EDIT_COMPONENT_FOOTPRINT );
ID_SCHEMATIC_TEXT_TOOL );
static EDA_HOTKEY HkMirrorY( _HKI( "Mirror Y" ), HK_MIRROR_Y, 'Y' );
static EDA_HOTKEY HkMirrorX( _HKI( "Mirror X" ), HK_MIRROR_X, 'X' );
static EDA_HOTKEY HkRotate( _HKI( "Rotate Item" ), HK_ROTATE, 'R' );
static EDA_HOTKEY HkEdit( _HKI( "Edit Item" ), HK_EDIT, 'E' );
static EDA_HOTKEY HkEditValue( _HKI( "Edit Symbol Value" ), HK_EDIT_COMPONENT_VALUE, 'V' );
static EDA_HOTKEY HkEditReference( _HKI( "Edit Symbol Reference" ), HK_EDIT_COMPONENT_REFERENCE, 'U' );
static EDA_HOTKEY HkEditFootprint( _HKI( "Edit Symbol Footprint" ), HK_EDIT_COMPONENT_FOOTPRINT, 'F' );
static EDA_HOTKEY HkShowDatasheet( _HKI( "Show Symbol Datasheet" ), HK_SHOW_COMPONENT_DATASHEET, 'D',
ID_SCH_DISPLAYDOC_CMP );
static EDA_HOTKEY HkEditWithLibedit( _HKI( "Edit with Symbol Editor" ), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL,
ID_SCH_CALL_LIBEDIT_AND_LOAD_CMP );
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M',
ID_SCH_MOVE );
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M' );
static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate" ), HK_DUPLICATE, 'D' + GR_KB_CTRL,
ID_SCH_DUPLICATE );
static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate" ), HK_DUPLICATE, 'D' + GR_KB_CTRL );
static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G',
ID_SCH_DRAG );
static EDA_HOTKEY HkDrag( _HKI( "Drag Item" ), HK_DRAG, 'G' );
static EDA_HOTKEY HkInsert( _HKI( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static EDA_HOTKEY HkDelete( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
@ -217,8 +206,7 @@ static EDA_HOTKEY HkViewDoc( _HKI( "Show Datasheet" ), HK_LIBEDIT_VIEW_DOC, 'D'
ID_LIBEDIT_VIEW_DOC );
// Autoplace fields
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O',
ID_AUTOPLACE_FIELDS );
static EDA_HOTKEY HkAutoplaceFields( _HKI( "Autoplace Fields" ), HK_AUTOPLACE_FIELDS, 'O' );
static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ), HK_UPDATE_PCB_FROM_SCH, WXK_F8,
ID_UPDATE_PCB_FROM_SCH );
@ -293,6 +281,7 @@ static EDA_HOTKEY* common_Hotkey_List[] =
&HkZoomCenter,
&HkZoomAuto,
&HkZoomSelection,
&HkSwitchUnits,
&HkResetLocalCoord,
&HkEdit,
&HkDuplicateItem,

View File

@ -66,7 +66,6 @@ enum id_eeschema_frm
ID_EDIT_COMPONENTS_TO_SYMBOLS_LIB_ID,
/* Schematic editor horizontal toolbar IDs */
ID_HIERARCHY,
ID_SCH_LEAVE_SHEET,
ID_TO_LIBVIEW,
ID_GET_ANNOTATE,
@ -76,33 +75,25 @@ enum id_eeschema_frm
ID_GEN_PLOT_SCHEMATIC,
/* Schematic editor vertical toolbar IDs */
ID_SCHEMATIC_VERTICAL_TOOLBAR_START,
ID_HIGHLIGHT_BUTT,
ID_SCH_PLACE_COMPONENT,
ID_PLACE_POWER_BUTT,
ID_BUS_BUTT,
ID_WIRE_BUTT,
ID_BUSTOBUS_ENTRY_BUTT,
ID_WIRETOBUS_ENTRY_BUTT,
ID_LABEL_BUTT,
ID_GLOBALLABEL_BUTT,
ID_HIERLABEL_BUTT,
ID_IMPORT_HLABEL_BUTT,
ID_SHEET_PIN_BUTT,
ID_NOCONN_BUTT,
ID_JUNCTION_BUTT,
ID_SHEET_SYMBOL_BUTT,
ID_TEXT_COMMENT_BUTT,
ID_LINE_COMMENT_BUTT,
ID_ADD_IMAGE_BUTT,
ID_SCHEMATIC_DELETE_ITEM_BUTT,
ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
ID_MENU_DELETE_ITEM_BUTT,
// Toolbar options id:
ID_TB_OPTIONS_HIDDEN_PINS,
ID_TB_OPTIONS_BUS_WIRES_ORIENT,
ID_HIGHLIGHT_TOOL,
ID_PLACE_SYMBOL_TOOL,
ID_PLACE_POWER_TOOL,
ID_BUS_TOOL,
ID_WIRE_TOOL,
ID_BUSTOBUS_ENTRY_TOOL,
ID_WIRETOBUS_ENTRY_TOOL,
ID_LABEL_TOOL,
ID_GLOBALLABEL_TOOL,
ID_HIERLABEL_TOOL,
ID_IMPORT_SHEETPIN_TOOL,
ID_SHEETPIN_TOOL,
ID_NOCONNECT_TOOL,
ID_JUNCTION_TOOL,
ID_SHEET_TOOL,
ID_SCHEMATIC_TEXT_TOOL,
ID_SCHEMATIC_LINE_TOOL,
ID_PLACE_IMAGE_TOOL,
ID_DELETE_TOOL,
// Dynamically bound in AddMenusForBus()
ID_POPUP_SCH_UNFOLD_BUS,
@ -119,25 +110,10 @@ enum id_eeschema_frm
ID_POPUP_SCH_SELECT_UNIT_CMP_MAX = ID_POPUP_SCH_SELECT_UNIT1
+ MAX_UNIT_COUNT_PER_PACKAGE,
// Change orientation command IDs.
ID_SCH_MIRROR_X,
ID_SCH_MIRROR_Y,
ID_SCH_ROTATE_CLOCKWISE,
ID_SCH_ROTATE_COUNTERCLOCKWISE,
ID_SCH_EDIT_ITEM,
ID_SCH_EDIT_COMPONENT_VALUE,
ID_SCH_EDIT_COMPONENT_REFERENCE,
ID_SCH_EDIT_COMPONENT_FOOTPRINT,
ID_SCH_MOVE,
ID_SCH_DRAG,
ID_SCH_DUPLICATE,
ID_SCH_DELETE,
ID_SCH_END_LINE_WIRE_OR_BUS,
ID_SCH_UNFOLD_BUS,
ID_AUTOPLACE_FIELDS,
// Schematic editor commmands. These are command IDs that are generated by multiple
// events (menus, toolbar, context menu, etc.) that result in the same event handler.
ID_CANCEL_CURRENT_COMMAND,
@ -169,10 +145,8 @@ enum id_eeschema_frm
ID_DE_MORGAN_NORMAL_BUTT,
ID_DE_MORGAN_CONVERT_BUTT,
ID_LIBEDIT_SYNC_PIN_EDIT,
ID_LIBEDIT_EDIT_PIN_BY_TABLE,
ID_LIBEDIT_VIEW_DOC,
ID_LIBEDIT_CHECK_PART,
ID_LIBEDIT_SYMBOL_PROPERTIES,
ID_LIBEDIT_SELECT_PART_NUMBER,
/* Library editor vertical toolbar IDs. */
@ -187,10 +161,6 @@ enum id_eeschema_frm
ID_LIBEDIT_EXPORT_BODY_BUTT,
ID_LIBEDIT_DELETE_ITEM_BUTT,
/* Library editor toolbar options IDs */
ID_LIBEDIT_SHOW_ELECTRICAL_TYPE,
ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE,
/* Library editor menubar IDs */
ID_LIBEDIT_GEN_PNG_FILE,
ID_LIBEDIT_GEN_SVG_FILE,
@ -206,7 +176,6 @@ enum id_eeschema_frm
ID_LIBVIEW_LIB_LIST,
ID_LIBVIEW_CMP_LIST,
ID_SET_RELATIVE_OFFSET,
ID_LIBVIEW_SHOW_ELECTRICAL_TYPE,
ID_UPDATE_PCB_FROM_SCH,
ID_UPDATE_SCH_FROM_PCB,

View File

@ -63,7 +63,7 @@
#include <tools/lib_edit_tool.h>
#include <tools/lib_move_tool.h>
#include <tools/lib_drawing_tools.h>
#include <tools/lib_editor_control.h>
#include <tools/lib_control.h>
#include <tools/ee_point_editor.h>
#include <sch_view.h>
#include <sch_painter.h>
@ -106,8 +106,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
// Main horizontal toolbar.
EVT_TOOL( ID_TO_LIBVIEW, LIB_EDIT_FRAME::OnOpenLibraryViewer )
EVT_TOOL( wxID_UNDO, LIB_EDIT_FRAME::GetComponentFromUndoList )
EVT_TOOL( wxID_REDO, LIB_EDIT_FRAME::GetComponentFromRedoList )
EVT_TOOL( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnCheckComponent )
EVT_TOOL( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
EVT_TOOL( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnSelectBodyStyle )
@ -121,10 +119,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_LIBEDIT_IMPORT_BODY_BUTT, LIB_EDIT_FRAME::OnImportBody )
EVT_TOOL( ID_LIBEDIT_EXPORT_BODY_BUTT, LIB_EDIT_FRAME::OnExportBody )
// Left vertical toolbar (option toolbar).
EVT_TOOL( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, LIB_EDIT_FRAME::OnShowElectricalType )
EVT_TOOL( ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE, LIB_EDIT_FRAME::OnToggleSearchTree )
// menubar commands
EVT_MENU( wxID_EXIT, LIB_EDIT_FRAME::CloseWindow )
EVT_MENU( ID_LIBEDIT_GEN_PNG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
@ -149,19 +143,12 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_UPDATE_UI( ID_LIBEDIT_SAVE_AS, LIB_EDIT_FRAME::OnUpdateHavePart )
EVT_UPDATE_UI( ID_LIBEDIT_REVERT, LIB_EDIT_FRAME::OnUpdateRevert )
EVT_UPDATE_UI( ID_LIBEDIT_CHECK_PART, LIB_EDIT_FRAME::OnUpdateEditingPart )
EVT_UPDATE_UI( ID_LIBEDIT_SYMBOL_PROPERTIES, LIB_EDIT_FRAME::OnUpdateEditingPart )
EVT_UPDATE_UI( wxID_UNDO, LIB_EDIT_FRAME::OnUpdateUndo )
EVT_UPDATE_UI( wxID_REDO, LIB_EDIT_FRAME::OnUpdateRedo )
EVT_UPDATE_UI( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnUpdateSyncPinEdit )
EVT_UPDATE_UI( ID_LIBEDIT_EDIT_PIN_BY_TABLE, LIB_EDIT_FRAME::OnUpdatePinTable )
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnUpdatePartNumber )
EVT_UPDATE_UI( ID_DE_MORGAN_NORMAL_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganNormal )
EVT_UPDATE_UI( ID_DE_MORGAN_CONVERT_BUTT, LIB_EDIT_FRAME::OnUpdateDeMorganConvert )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, LIB_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, LIB_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI_RANGE( ID_LIBEDIT_PIN_BUTT, ID_LIBEDIT_DELETE_ITEM_BUTT,
LIB_EDIT_FRAME::OnUpdateEditingPart )
EVT_UPDATE_UI( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, LIB_EDIT_FRAME::OnUpdateElectricalType )
EVT_UPDATE_UI( ID_MENU_CANVAS_CAIRO, LIB_EDIT_FRAME::OnUpdateSwitchCanvas )
EVT_UPDATE_UI( ID_MENU_CANVAS_OPENGL, LIB_EDIT_FRAME::OnUpdateSwitchCanvas )
@ -230,7 +217,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.SetManagedWindow( this );
m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
@ -255,8 +241,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
Bind( wxEVT_COMMAND_MENU_SELECTED, &LIB_EDIT_FRAME::OnEditSymbolLibTable, this,
ID_EDIT_SYM_LIB_TABLE );
wxCommandEvent evt( wxEVT_COMMAND_MENU_SELECTED, ID_ZOOM_PAGE );
wxPostEvent( this, evt );
m_toolManager->RunAction( ACTIONS::zoomFitScreen, true );
SyncView();
GetGalCanvas()->GetViewControls()->SetSnapping( true );
@ -308,7 +293,7 @@ void LIB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new EE_POINT_EDITOR );
m_toolManager->RegisterTool( new LIB_MOVE_TOOL );
m_toolManager->RegisterTool( new LIB_EDIT_TOOL );
m_toolManager->RegisterTool( new LIB_EDITOR_CONTROL );
m_toolManager->RegisterTool( new LIB_CONTROL );
m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active
@ -385,17 +370,6 @@ void LIB_EDIT_FRAME::RebuildSymbolUnitsList()
}
void LIB_EDIT_FRAME::OnShowElectricalType( wxCommandEvent& event )
{
m_showPinElectricalTypeName = !m_showPinElectricalTypeName;
// Update canvas
GetRenderSettings()->m_ShowPinsElectricalType = m_showPinElectricalTypeName;
GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
GetCanvas()->Refresh();
}
void LIB_EDIT_FRAME::OnToggleSearchTree( wxCommandEvent& event )
{
auto& treePane = m_auimgr.GetPane( m_treePane );
@ -427,19 +401,6 @@ void LIB_EDIT_FRAME::ClearSearchTreeSelection()
}
void LIB_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void LIB_EDIT_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( GetShowElectricalType() );
}
void LIB_EDIT_FRAME::OnUpdateSave( wxUpdateUIEvent& aEvent )
{
LIB_ID libId = getTargetLibId();
@ -490,28 +451,6 @@ void LIB_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
}
void LIB_EDIT_FRAME::OnUpdateUndo( wxUpdateUIEvent& event )
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
event.Enable( GetCurPart()
&& GetScreen()
&& GetScreen()->GetUndoCommandCount() != 0
&& EE_CONDITIONS::Idle( selTool->GetSelection() ) );
}
void LIB_EDIT_FRAME::OnUpdateRedo( wxUpdateUIEvent& event )
{
EE_SELECTION_TOOL* selTool = m_toolManager->GetTool<EE_SELECTION_TOOL>();
event.Enable( GetCurPart()
&& GetScreen()
&& GetScreen()->GetRedoCommandCount() != 0
&& EE_CONDITIONS::Idle( selTool->GetSelection() ) );
}
void LIB_EDIT_FRAME::OnUpdateSyncPinEdit( wxUpdateUIEvent& event )
{
LIB_PART* part = GetCurPart();
@ -520,13 +459,6 @@ void LIB_EDIT_FRAME::OnUpdateSyncPinEdit( wxUpdateUIEvent& event )
}
void LIB_EDIT_FRAME::OnUpdatePinTable( wxUpdateUIEvent& event )
{
LIB_PART* part = GetCurPart();
event.Enable( part != NULL );
}
void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event )
{
if( m_partSelectBox == NULL )

View File

@ -55,11 +55,6 @@ class LIB_EDIT_FRAME : public SCH_BASE_FRAME
SYMBOL_TREE_PANE* m_treePane; ///< component search tree widget
LIB_MANAGER* m_libMgr; ///< manager taking care of temporary modificatoins
/**
* the option to show the pin electrical name in the component editor
*/
bool m_showPinElectricalTypeName;
// The unit number to edit and show
int m_unit;
@ -284,11 +279,6 @@ public:
void OnSelectUnit( wxCommandEvent& event );
/**
* From Option toolbar: option to show the electrical pin type name
*/
void OnShowElectricalType( wxCommandEvent& event );
void OnToggleSearchTree( wxCommandEvent& event );
void OnEditSymbolLibTable( wxCommandEvent& aEvent ) override;
@ -301,19 +291,14 @@ public:
void OnSelectBodyStyle( wxCommandEvent& event );
void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateHavePart( wxUpdateUIEvent& aEvent );
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateRevert( wxUpdateUIEvent& aEvent );
void OnUpdateUndo( wxUpdateUIEvent& event );
void OnUpdateRedo( wxUpdateUIEvent& event );
void OnUpdateSyncPinEdit( wxUpdateUIEvent& event );
void OnUpdatePinTable( wxUpdateUIEvent& event );
void OnUpdatePartNumber( wxUpdateUIEvent& event );
void OnUpdateDeMorganNormal( wxUpdateUIEvent& event );
void OnUpdateDeMorganConvert( wxUpdateUIEvent& event );
void OnUpdateElectricalType( wxUpdateUIEvent& aEvent );
void UpdateAfterSymbolProperties( wxString* aOldName, wxArrayString* aOldAliases );
void RebuildSymbolUnitsList();
@ -378,9 +363,6 @@ public:
bool GetShowDeMorgan() { return m_showDeMorgan; }
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
void ClearMsgPanel() override { DisplayCmpDoc(); }
private:
@ -473,12 +455,12 @@ public:
void SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoType = UR_LIBEDIT,
bool aAppend = false );
void GetComponentFromUndoList();
void GetComponentFromRedoList();
void RollbackPartFromUndo();
private:
void GetComponentFromUndoList( wxCommandEvent& event );
void GetComponentFromRedoList( wxCommandEvent& event );
/**
* Read a component symbol file (*.sym ) and add graphic items to the current component.
*

View File

@ -57,7 +57,7 @@ void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoT
}
void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
void LIB_EDIT_FRAME::GetComponentFromRedoList()
{
if( GetScreen()->GetRedoCommandCount() <= 0 )
return;
@ -105,7 +105,7 @@ void LIB_EDIT_FRAME::GetComponentFromRedoList( wxCommandEvent& event )
}
void LIB_EDIT_FRAME::GetComponentFromUndoList( wxCommandEvent& event )
void LIB_EDIT_FRAME::GetComponentFromUndoList()
{
if( GetScreen()->GetUndoCommandCount() <= 0 )
return;

View File

@ -139,36 +139,29 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
_( "Quit Library Editor" ),
KiBitmap( exit_xpm ) );
//
// Edit menu
wxMenu* editMenu = new wxMenu;
//
CONDITIONAL_MENU* editMenu = new CONDITIONAL_MENU( false, selTool );
text = AddHotkeyName( _( "&Undo" ), g_Libedit_Hotkeys_Descr, HK_UNDO );
AddMenuItem( editMenu,
wxID_UNDO,
text,
_( "Undo last edit" ),
KiBitmap( undo_xpm ) );
auto enableUndoCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart() && GetScreen() && GetScreen()->GetUndoCommandCount() != 0
&& EE_CONDITIONS::Idle( sel );
};
auto enableRedoCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart() && GetScreen() && GetScreen()->GetRedoCommandCount() != 0
&& EE_CONDITIONS::Idle( sel );
};
auto havePartCondition = [ this ] ( const SELECTION& sel ) {
return GetCurPart();
};
text = AddHotkeyName( _( "&Redo" ), g_Libedit_Hotkeys_Descr, HK_REDO );
AddMenuItem( editMenu,
wxID_REDO,
text,
_( "Redo the last undo command" ),
KiBitmap( redo_xpm ) );
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
editMenu->AppendSeparator();
AddMenuItem( editMenu,
ID_LIBEDIT_SYMBOL_PROPERTIES,
_( "&Properties..." ),
_( "Edit symbol properties" ),
KiBitmap( part_properties_xpm ) );
AddMenuItem( editMenu,
ID_LIBEDIT_EDIT_PIN_BY_TABLE,
_( "Pin &Table..." ),
_( "Show pin table" ),
KiBitmap( pin_table_xpm ) );
editMenu->AddSeparator();
editMenu->AddItem( EE_ACTIONS::symbolProperties, havePartCondition );
editMenu->AddItem( EE_ACTIONS::pinTable, havePartCondition );
//
// Menu View:
@ -178,19 +171,15 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
};
auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES;
};
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor;
};
auto compTreeShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsSearchTreeShown();
};
@ -211,6 +200,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );

View File

@ -26,13 +26,14 @@
#include <fctsys.h>
#include <ee_hotkeys.h>
#include <eeschema_id.h>
#include <tool/action_toolbar.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <dialog_helpers.h>
#include <bitmaps.h>
#include <help_common_strings.h>
#include <tools/ee_actions.h>
#ifdef __UNIX__
#define LISTBOX_WIDTH 140
@ -46,39 +47,18 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
HELP_SELECT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, KiScaledBitmap( pin_xpm, this ),
HELP_ADD_PIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString,
KiScaledBitmap( text_xpm, this ),
HELP_ADD_BODYTEXT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString,
KiScaledBitmap( add_rectangle_xpm, this ),
HELP_ADD_BODYRECT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString,
KiScaledBitmap( add_circle_xpm, this ),
HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString,
KiScaledBitmap( add_arc_xpm, this ),
HELP_ADD_BODYARC, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString,
KiScaledBitmap( add_polygon_xpm, this ),
HELP_ADD_BODYPOLYGON, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString,
KiScaledBitmap( anchor_xpm, this ),
_( "Move symbol anchor" ), wxITEM_CHECK );
m_drawToolBar->Add( EE_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolRectangle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolCircle, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolArc, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSymbolLines, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbolAnchor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString,
KiScaledBitmap( import_xpm, this ),
@ -88,9 +68,7 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
KiScaledBitmap( export_xpm, this ),
_( "Export current drawing" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString,
KiScaledBitmap( delete_xpm, this ),
HELP_DELETE_ITEMS, wxITEM_CHECK );
m_drawToolBar->Add( EE_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Realize();
}
@ -103,8 +81,8 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString,
@ -115,44 +93,20 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
KiScaledBitmap( save_xpm, this ),
_( "Save all changes" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
msg = AddHotkeyName( HELP_UNDO, g_Libedit_Hotkeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
msg = AddHotkeyName( HELP_REDO, g_Libedit_Hotkeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ), msg );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Refresh libraries and redraw view" ), g_Libedit_Hotkeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Libedit_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Libedit_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom to fit symbol" ), g_Libedit_Hotkeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_SYMBOL_PROPERTIES, wxEmptyString,
KiScaledBitmap( part_properties_xpm, this ),
_( "Edit symbol properties" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_TABLE, wxEmptyString,
KiScaledBitmap( pin_table_xpm, this ),
_( "Show pin table" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( EE_ACTIONS::symbolProperties );
m_mainToolBar->Add( EE_ACTIONS::pinTable );
KiScaledSeparator( m_mainToolBar, this );
@ -206,32 +160,18 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
if( m_optionsToolBar )
m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK );
ACTION_TOOLBAR* optToolbar = static_cast<ACTION_TOOLBAR*>( m_optionsToolBar );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ), _( "Set units to inches" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, wxEmptyString,
KiScaledBitmap( pin_show_etype_xpm, this ),
_( "Show pins electrical type" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString,
KiScaledBitmap( search_tree_xpm, this ),
_( "Toggles the search tree" ), wxITEM_CHECK );
optToolbar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( EE_ACTIONS::showElectricalTypes, ACTION_TOOLBAR::TOGGLE );
optToolbar->Add( EE_ACTIONS::showComponentTree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Realize();
}
@ -239,14 +179,29 @@ void LIB_EDIT_FRAME::ReCreateOptToolbar()
void LIB_EDIT_FRAME::SyncMenusAndToolbars()
{
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, GetUserUnits() != INCHES );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, GetUserUnits() == INCHES );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->ToggleTool( ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE, IsSearchTreeShown() );
m_optionsToolBar->Toggle( EE_ACTIONS::showElectricalTypes, GetShowElectricalType() );
m_optionsToolBar->Toggle( EE_ACTIONS::showComponentTree, IsSearchTreeShown() );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( EE_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbolPin, GetToolId() == ID_LIBEDIT_PIN_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbolText, GetToolId() == ID_LIBEDIT_BODY_TEXT_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolRectangle, GetToolId() == ID_LIBEDIT_BODY_RECT_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolCircle, GetToolId() == ID_LIBEDIT_BODY_CIRCLE_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolArc, GetToolId() == ID_LIBEDIT_BODY_ARC_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::drawSymbolLines, GetToolId() == ID_LIBEDIT_BODY_LINE_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbolAnchor, GetToolId() == ID_LIBEDIT_ANCHOR_ITEM_BUTT );
m_drawToolBar->Refresh();
}

View File

@ -92,23 +92,18 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
auto belowRootSheetCondition = [] ( const SELECTION& aSel ) {
return g_CurrentSheet->Last() != g_RootSheet;
};
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
};
auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES;
};
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor;
};
auto hiddenPinsCondition = [ this ] ( const SELECTION& aSel ) {
return GetShowAllPins();
};
@ -131,6 +126,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
@ -358,8 +354,8 @@ void prepareEditMenu( wxMenu* aParentMenu )
// Delete
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_MENU_DELETE_ITEM_BUTT,
_( "&Delete" ), HELP_DELETE_ITEMS,
AddMenuItem( aParentMenu, ID_DELETE_TOOL,
_( "&Delete Tool" ), HELP_DELETE_ITEMS,
KiBitmap( delete_xpm ) );
// Find

View File

@ -99,6 +99,7 @@ SCH_BASE_FRAME::SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aWindo
// but this is an acceptable value
m_repeatStep = wxPoint( DEFAULT_REPEAT_OFFSET_X, DEFAULT_REPEAT_OFFSET_Y );
m_repeatDeltaLabel = DEFAULT_REPEAT_LABEL_INC;
m_showPinElectricalTypeName = false;
}

View File

@ -91,7 +91,7 @@ protected:
///< when it is repeated
int m_repeatDeltaLabel; ///< the increment value of labels like bus members
///< when they are repeated
bool m_showPinElectricalTypeName;
public:
SCH_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent,
@ -115,6 +115,12 @@ public:
*/
virtual bool GetShowAllPins() const { return true; }
/**
* Allow some frames to show/hide pin electrical type names.
*/
bool GetShowElectricalType() { return m_showPinElectricalTypeName; }
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
/**
* switches currently used canvas ( Cairo / OpenGL).
*/

View File

@ -252,8 +252,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_RUN_CVPCB, SCH_EDIT_FRAME::OnOpenCvpcb )
EVT_TOOL( ID_SHEET_SET, EDA_DRAW_FRAME::Process_PageSettings )
EVT_TOOL( wxID_UNDO, SCH_EDIT_FRAME::GetSchematicFromUndoList )
EVT_TOOL( wxID_REDO, SCH_EDIT_FRAME::GetSchematicFromRedoList )
EVT_TOOL( ID_GET_ANNOTATE, SCH_EDIT_FRAME::OnAnnotate )
EVT_TOOL( wxID_PRINT, SCH_EDIT_FRAME::OnPrint )
EVT_TOOL( ID_GET_ERC, SCH_EDIT_FRAME::OnErc )
@ -281,11 +279,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
/* Handle user interface update events. */
EVT_UPDATE_UI( wxID_PASTE, SCH_EDIT_FRAME::OnUpdatePaste )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_HIGHLIGHT_BUTT, SCH_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, SCH_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END,
SCH_EDIT_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_SAVE_PROJECT, SCH_EDIT_FRAME::OnUpdateSave )
EVT_UPDATE_UI( ID_UPDATE_ONE_SHEET, SCH_EDIT_FRAME::OnUpdateSaveSheet )
EVT_UPDATE_UI( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnUpdateRemapSymbols )
@ -370,8 +363,8 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_auimgr.Update();
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
GetToolManager()->RunAction( "common.Control.zoomFitScreen", true );
GetToolManager()->RunAction( ACTIONS::gridPreset, true, m_LastGridSizeId );
GetToolManager()->RunAction( ACTIONS::zoomFitScreen, true );
if( GetGalCanvas() )
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
@ -743,13 +736,6 @@ void SCH_EDIT_FRAME::OnModify()
}
void SCH_EDIT_FRAME::OnUpdateSelectTool( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void SCH_EDIT_FRAME::OnUpdatePaste( wxUpdateUIEvent& event )
{
event.Enable( m_blockItems.GetCount() > 0 );

View File

@ -794,7 +794,6 @@ private:
/* User interface update event handlers. */
void OnUpdatePaste( wxUpdateUIEvent& event );
void OnUpdateSelectTool( wxUpdateUIEvent& aEvent );
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateSaveSheet( wxUpdateUIEvent& aEvent );
void OnUpdateRemapSymbols( wxUpdateUIEvent& aEvent );
@ -1008,8 +1007,6 @@ public:
bool aAppend = false,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) );
private:
/**
* Restore an undo or redo command to put data pointed by \a aList in the previous state.
*
@ -1018,25 +1015,6 @@ private:
*/
void PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRedoCommand );
/**
* Redo the last edit.
*
* - Save the current schematic in Undo list
* - Get an old version of the schematic from Redo list
*
* @return none
*/
void GetSchematicFromRedoList( wxCommandEvent& event );
/**
* Perform an undo the last edit.
*
* - Save the current schematic in Redo list
* - Get an old version of the schematic from Undo list
*/
void GetSchematicFromUndoList( wxCommandEvent& event );
public:
/**
* Clone \a aItem and owns that clone in this container.
*/

View File

@ -345,61 +345,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}
void SCH_EDIT_FRAME::GetSchematicFromUndoList( wxCommandEvent& event )
{
if( GetScreen()->GetUndoCommandCount() <= 0 )
return;
// Inform tools that undo command was issued
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
/* Get the old list */
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
/* Undo the command */
PutDataInPreviousState( List, false );
/* Put the old list in RedoList */
List->ReversePickersListOrder();
GetScreen()->PushCommandToRedoList( List );
SetSheetNumberAndCount();
TestDanglingEnds();
SyncView();
GetCanvas()->Refresh();
OnModify();
}
void SCH_EDIT_FRAME::GetSchematicFromRedoList( wxCommandEvent& event )
{
if( GetScreen()->GetRedoCommandCount() == 0 )
return;
// Inform tools that undo command was issued
m_toolManager->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
/* Get the old list */
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
/* Redo the command: */
PutDataInPreviousState( List, true );
/* Put the old list in UndoList */
List->ReversePickersListOrder();
GetScreen()->PushCommandToUndoList( List );
SetSheetNumberAndCount();
TestDanglingEnds();
SyncView();
GetCanvas()->Refresh();
OnModify();
}
void SCH_EDIT_FRAME::RollbackSchematicFromUndo()
{
PICKED_ITEMS_LIST* undo = GetScreen()->PopCommandFromUndoList();

View File

@ -31,6 +31,7 @@
#include <ee_hotkeys.h>
#include <eeschema_id.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <help_common_strings.h>
#include <tools/ee_actions.h>
@ -41,9 +42,9 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg;
// Set up toolbar
@ -74,20 +75,12 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_GEN_PLOT_SCHEMATIC, wxEmptyString, KiScaledBitmap( plot_xpm, this ),
_( "Plot schematic" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiScaledBitmap( paste_xpm, this ),
_( "Paste" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_UNDO, g_Schematic_Hotkeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ), msg );
msg = AddHotkeyName( HELP_REDO, g_Schematic_Hotkeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::paste );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::undo );
m_mainToolBar->Add( ACTIONS::redo );
KiScaledSeparator( m_mainToolBar, this );
@ -98,43 +91,20 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
HELP_REPLACE, nullptr );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( EE_ACTIONS::navigateHierarchy );
m_mainToolBar->Add( EE_ACTIONS::leaveSheet );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Schematic_Hotkeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Schematic_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Schematic_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Schematic_Hotkeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiScaledBitmap( hierarchy_nav_xpm, this ),
_( "Navigate schematic hierarchy" ) );
m_mainToolBar->AddTool( ID_SCH_LEAVE_SHEET, wxEmptyString,
KiScaledBitmap( leave_sheet_xpm, this ), _( "Leave sheet" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_RUN_LIBRARY, wxEmptyString, KiScaledBitmap( libedit_xpm, this ),
HELP_RUN_LIB_EDITOR );
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
KiScaledBitmap( library_browse_xpm, this ), HELP_RUN_LIB_VIEWER );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( EE_ACTIONS::showSymbolEditor );
m_mainToolBar->Add( EE_ACTIONS::showLibraryBrowser );
// modedit is with libedit in a "library section" because the user must have footprints before
// they can be assigned.
@ -181,82 +151,30 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
HELP_SELECT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_HIGHLIGHT_BUTT, wxEmptyString,
KiScaledBitmap( net_highlight_schematic_xpm, this ),
HELP_HIGHLIGHT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString,
KiScaledBitmap( add_component_xpm, this ), HELP_PLACE_COMPONENTS,
wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString,
KiScaledBitmap( add_power_xpm, this ),
HELP_PLACE_POWERPORT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString, KiScaledBitmap( add_line_xpm, this ),
HELP_PLACE_WIRE, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, KiScaledBitmap( add_bus_xpm, this ),
HELP_PLACE_BUS, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString,
KiScaledBitmap( add_line2bus_xpm, this ),
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString,
KiScaledBitmap( add_bus2bus_xpm, this ),
HELP_PLACE_BUS2BUS_ENTRY, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString, KiScaledBitmap( noconn_xpm, this ),
HELP_PLACE_NC_FLAG, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
KiScaledBitmap( add_junction_xpm, this ),
HELP_PLACE_JUNCTION, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString,
KiScaledBitmap( add_line_label_xpm, this ),
HELP_PLACE_NETLABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_GLOBALLABEL_BUTT, wxEmptyString, KiScaledBitmap( add_glabel_xpm, this ),
HELP_PLACE_GLOBALLABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
KiScaledBitmap( add_hierarchical_label_xpm, this ),
HELP_PLACE_HIER_LABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
KiScaledBitmap( add_hierarchical_subsheet_xpm, this ),
HELP_PLACE_SHEET, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
KiScaledBitmap( import_hierarchical_label_xpm, this ),
HELP_IMPORT_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_PIN_BUTT, wxEmptyString,
KiScaledBitmap( add_hierar_pin_xpm, this ),
HELP_PLACE_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
KiScaledBitmap( add_dashed_line_xpm, this ),
HELP_PLACE_GRAPHICLINES, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_ADD_IMAGE_BUTT, wxEmptyString, KiScaledBitmap( image_xpm, this ),
_("Add bitmap image"), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString,
KiScaledBitmap( delete_xpm, this ),
HELP_DELETE_ITEMS, wxITEM_CHECK );
m_drawToolBar->Add( EE_ACTIONS::selectionTool, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::highlightNetCursor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSymbol, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placePower, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawWire, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawBus, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeBusWireEntry, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeBusBusEntry, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeNoConnect, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeJunction, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeLabel, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeGlobalLabel, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeHierarchicalLabel, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawSheet, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::importSheetPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSheetPin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::drawLines, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeSchematicText, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::placeImage, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( EE_ACTIONS::deleteItemCursor, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Realize();
}
@ -269,35 +187,16 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
if( m_optionsToolBar )
m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ),
_( "Set unit to inch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set unit to mm" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
//KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
KiScaledBitmap( hidden_pin_xpm, this ),
_( "Show hidden pins" ), wxITEM_CHECK );
//KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
KiScaledBitmap( lines90_xpm, this ),
_( "HV orientation for wires and bus" ),
wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::toggleHiddenPins, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::toggleForceHV, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Realize();
}
@ -305,17 +204,41 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
void SCH_EDIT_FRAME::SyncMenusAndToolbars()
{
m_mainToolBar->EnableTool( ID_SCH_LEAVE_SHEET, g_CurrentSheet->Last() != g_RootSheet );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_GRID, IsGridVisible() );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, GetUserUnits() != INCHES );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, GetUserUnits() == INCHES );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_CURSOR, galOpts.m_fullscreenCursor );
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_HIDDEN_PINS, GetShowAllPins() );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, GetForceHVLines() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleHiddenPins, GetShowAllPins() );
m_optionsToolBar->Toggle( EE_ACTIONS::toggleForceHV, GetForceHVLines() );
m_optionsToolBar->Refresh();
m_drawToolBar->Toggle( EE_ACTIONS::selectionTool, GetToolId() == ID_NO_TOOL_SELECTED );
m_drawToolBar->Toggle( EE_ACTIONS::highlightNetCursor, GetToolId() == ID_HIGHLIGHT_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeSymbol, GetToolId() == ID_COMPONENT_BUTT );
m_drawToolBar->Toggle( EE_ACTIONS::placePower, GetToolId() == ID_PLACE_POWER_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::drawWire, GetToolId() == ID_WIRE_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::drawBus, GetToolId() == ID_BUS_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeBusWireEntry, GetToolId() == ID_WIRETOBUS_ENTRY_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeBusBusEntry, GetToolId() == ID_BUSTOBUS_ENTRY_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeNoConnect, GetToolId() == ID_NOCONNECT_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeJunction, GetToolId() == ID_JUNCTION_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeLabel, GetToolId() == ID_LABEL_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeGlobalLabel, GetToolId() == ID_GLOBALLABEL_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeHierarchicalLabel, GetToolId() == ID_HIERLABEL_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::drawSheet, GetToolId() == ID_SHEET_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::importSheetPin, GetToolId() == ID_IMPORT_SHEETPIN_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeSheetPin, GetToolId() == ID_SHEETPIN_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::drawLines, GetToolId() == ID_SCHEMATIC_LINE_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeSchematicText, GetToolId() == ID_SCHEMATIC_TEXT_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::placeImage, GetToolId() == ID_PLACE_IMAGE_TOOL );
m_drawToolBar->Toggle( EE_ACTIONS::deleteItemCursor, GetToolId() == ID_DELETE_TOOL );
m_drawToolBar->Refresh();
}

View File

@ -31,17 +31,22 @@
#include "ee_hotkeys.h"
#include "viewlib_frame.h"
#include <symbol_lib_table.h>
#include <tool/conditional_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <tools/lib_control.h>
void LIB_VIEW_FRAME::ReCreateHToolbar()
{
wxString msg;
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
ACTION_TOOLBAR* toolbar = static_cast<ACTION_TOOLBAR*>( m_mainToolBar );
wxString msg;
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiScaledBitmap( add_component_xpm, this ),
@ -56,26 +61,11 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
KiScaledBitmap( lib_next_xpm, this ),
_( "Display next symbol" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Zoom in" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom to fit symbol" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
toolbar->AddSeparator();
toolbar->Add( ACTIONS::zoomRedraw );
toolbar->Add( ACTIONS::zoomInCenter );
toolbar->Add( ACTIONS::zoomOutCenter );
toolbar->Add( ACTIONS::zoomFitScreen );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
@ -118,8 +108,9 @@ void LIB_VIEW_FRAME::ReCreateVToolbar()
// Virtual function
void LIB_VIEW_FRAME::ReCreateMenuBar( void )
void LIB_VIEW_FRAME::ReCreateMenuBar()
{
LIB_CONTROL* libControl = m_toolManager->GetTool<LIB_CONTROL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -137,27 +128,23 @@ void LIB_VIEW_FRAME::ReCreateMenuBar( void )
KiBitmap( exit_xpm ) );
// View menu
wxMenu* viewMenu = new wxMenu;
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, libControl );
text = AddHotkeyName( _( "Zoom &In" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
text = AddHotkeyName( _( "Zoom &Out" ), g_Viewlib_Hotkeys_Descr,
HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
viewMenu->AddItem( ACTIONS::zoomInCenter, EE_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, EE_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, EE_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, EE_CONDITIONS::ShowAlways );
text = AddHotkeyName( _( "&Zoom to Fit" ), g_Viewlib_Hotkeys_Descr, HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, _( "Zoom to fit symbol" ),
KiBitmap( zoom_fit_in_page_xpm ) );
viewMenu->AddSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, EE_CONDITIONS::ShowAlways );
text = AddHotkeyName( _( "&Redraw" ), g_Viewlib_Hotkeys_Descr, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, _( "&Show Pin Electrical Type" ),
wxEmptyString, KiBitmap( pin_show_etype_xpm ), wxITEM_CHECK );
viewMenu->AddSeparator();
viewMenu->AddItem( EE_ACTIONS::showElectricalTypes, EE_CONDITIONS::ShowAlways );
// Menu Help:
wxMenu* helpMenu = new wxMenu;
@ -184,7 +171,6 @@ void LIB_VIEW_FRAME::ReCreateMenuBar( void )
_( "&About Eeschema" ),
_( "About Eeschema schematic designer" ),
KiBitmap( info_xpm ) );
// Append menus to the menubar
menuBar->Append( fileMenu, _( "&File" ) );

View File

@ -33,179 +33,18 @@ OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_NO_TOOL_SELECTED:
return EE_ACTIONS::selectionTool.MakeEvent();
case ID_CANCEL_CURRENT_COMMAND:
return ACTIONS::cancelInteractive.MakeEvent();
case ID_TB_OPTIONS_SHOW_GRID:
return ACTIONS::toggleGrid.MakeEvent();
case ID_TB_OPTIONS_SELECT_CURSOR:
return ACTIONS::toggleCursorStyle.MakeEvent();
case ID_TB_OPTIONS_BUS_WIRES_ORIENT:
return EE_ACTIONS::toggleForceHV.MakeEvent();
case ID_TB_OPTIONS_SELECT_UNIT_INCH:
return ACTIONS::imperialUnits.MakeEvent();
case ID_TB_OPTIONS_SELECT_UNIT_MM:
return ACTIONS::metricUnits.MakeEvent();
case ID_TB_OPTIONS_HIDDEN_PINS:
return EE_ACTIONS::toggleHiddenPins.MakeEvent();
case ID_ZOOM_REDRAW:
case ID_VIEWER_ZOOM_REDRAW:
return ACTIONS::zoomRedraw.MakeEvent();
case ID_ZOOM_IN:
case ID_VIEWER_ZOOM_IN:
return ACTIONS::zoomInCenter.MakeEvent();
case ID_ZOOM_OUT:
case ID_VIEWER_ZOOM_OUT:
return ACTIONS::zoomOutCenter.MakeEvent();
case ID_ZOOM_PAGE: // toolbar button "Fit on Screen"
case ID_VIEWER_ZOOM_PAGE:
return ACTIONS::zoomFitScreen.MakeEvent();
case ID_ZOOM_SELECTION:
return ACTIONS::zoomTool.MakeEvent();
case ID_HIERARCHY:
return EE_ACTIONS::navigateHierarchy.MakeEvent();
case ID_TO_LIBVIEW:
return EE_ACTIONS::showLibraryBrowser.MakeEvent();
case ID_HIGHLIGHT_BUTT:
return EE_ACTIONS::highlightNetCursor.MakeEvent();
case ID_HIGHLIGHT_NET:
return EE_ACTIONS::highlightNet.MakeEvent();
case ID_SCH_PLACE_COMPONENT:
return EE_ACTIONS::placeSymbol.MakeEvent();
case ID_PLACE_POWER_BUTT:
return EE_ACTIONS::placePower.MakeEvent();
case ID_WIRE_BUTT:
return EE_ACTIONS::drawWire.MakeEvent();
case ID_BUS_BUTT:
return EE_ACTIONS::drawBus.MakeEvent();
case ID_NOCONN_BUTT:
return EE_ACTIONS::placeNoConnect.MakeEvent();
case ID_JUNCTION_BUTT:
return EE_ACTIONS::placeJunction.MakeEvent();
case ID_WIRETOBUS_ENTRY_BUTT:
return EE_ACTIONS::placeBusWireEntry.MakeEvent();
case ID_BUSTOBUS_ENTRY_BUTT:
return EE_ACTIONS::placeBusBusEntry.MakeEvent();
case ID_LABEL_BUTT:
return EE_ACTIONS::placeLabel.MakeEvent();
case ID_GLOBALLABEL_BUTT:
return EE_ACTIONS::placeGlobalLabel.MakeEvent();
case ID_HIERLABEL_BUTT:
return EE_ACTIONS::placeHierarchicalLabel.MakeEvent();
case ID_SHEET_PIN_BUTT:
return EE_ACTIONS::placeSheetPin.MakeEvent();
case ID_IMPORT_HLABEL_BUTT:
return EE_ACTIONS::importSheetPin.MakeEvent();
case ID_SHEET_SYMBOL_BUTT:
return EE_ACTIONS::drawSheet.MakeEvent();
case ID_TEXT_COMMENT_BUTT:
return EE_ACTIONS::placeSchematicText.MakeEvent();
case ID_LINE_COMMENT_BUTT:
return EE_ACTIONS::drawLines.MakeEvent();
case ID_ADD_IMAGE_BUTT:
return EE_ACTIONS::placeImage.MakeEvent();
case ID_SCH_END_LINE_WIRE_OR_BUS:
return EE_ACTIONS::finishLineWireOrBus.MakeEvent();
case ID_MENU_DELETE_ITEM_BUTT:
case ID_SCHEMATIC_DELETE_ITEM_BUTT:
case ID_DELETE_TOOL:
return EE_ACTIONS::deleteItemCursor.MakeEvent();
case ID_SCH_MOVE:
return EE_ACTIONS::move.MakeEvent();
case ID_SCH_DRAG:
return EE_ACTIONS::drag.MakeEvent();
case ID_SCH_DELETE:
return EE_ACTIONS::doDelete.MakeEvent();
case ID_SIM_PROBE:
return EE_ACTIONS::simProbe.MakeEvent();
case ID_SIM_TUNE:
return EE_ACTIONS::simTune.MakeEvent();
case ID_SCH_ROTATE_CLOCKWISE:
return EE_ACTIONS::rotateCW.MakeEvent();
case ID_SCH_ROTATE_COUNTERCLOCKWISE:
return EE_ACTIONS::rotateCCW.MakeEvent();
case ID_SCH_MIRROR_X:
return EE_ACTIONS::mirrorX.MakeEvent();
case ID_SCH_MIRROR_Y:
return EE_ACTIONS::mirrorY.MakeEvent();
case ID_SCH_DUPLICATE:
return EE_ACTIONS::duplicate.MakeEvent();
case ID_REPEAT_BUTT:
return EE_ACTIONS::repeatDrawItem.MakeEvent();
case ID_SCH_EDIT_ITEM:
return EE_ACTIONS::properties.MakeEvent();
case ID_SCH_EDIT_COMPONENT_REFERENCE:
return EE_ACTIONS::editReference.MakeEvent();
case ID_SCH_EDIT_COMPONENT_VALUE:
return EE_ACTIONS::editValue.MakeEvent();
case ID_SCH_EDIT_COMPONENT_FOOTPRINT:
return EE_ACTIONS::editFootprint.MakeEvent();
case wxID_CUT:
return EE_ACTIONS::cut.MakeEvent();
case wxID_COPY:
return EE_ACTIONS::copy.MakeEvent();
case wxID_PASTE:
return EE_ACTIONS::paste.MakeEvent();
case ID_AUTOPLACE_FIELDS:
return EE_ACTIONS::autoplaceFields.MakeEvent();
case ID_SCH_LEAVE_SHEET:
return EE_ACTIONS::leaveSheet.MakeEvent();
case ID_HOTKEY_SELECT_NODE:
return EE_ACTIONS::selectNode.MakeEvent();
@ -220,36 +59,6 @@ OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
case ID_MOUSE_DOUBLECLICK:
return EE_ACTIONS::cursorDblClick.MakeEvent();
case ID_LIBEDIT_PIN_BUTT:
return EE_ACTIONS::placeSymbolPin.MakeEvent();
case ID_LIBEDIT_BODY_TEXT_BUTT:
return EE_ACTIONS::placeSymbolText.MakeEvent();
case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
return EE_ACTIONS::placeSymbolAnchor.MakeEvent();
case ID_LIBEDIT_BODY_ARC_BUTT:
return EE_ACTIONS::drawSymbolArc.MakeEvent();
case ID_LIBEDIT_BODY_CIRCLE_BUTT:
return EE_ACTIONS::drawSymbolCircle.MakeEvent();
case ID_LIBEDIT_BODY_LINE_BUTT:
return EE_ACTIONS::drawSymbolLines.MakeEvent();
case ID_LIBEDIT_BODY_RECT_BUTT:
return EE_ACTIONS::drawSymbolRectangle.MakeEvent();
case ID_LIBEDIT_DELETE_ITEM_BUTT:
return EE_ACTIONS::deleteItemCursor.MakeEvent();
case ID_LIBEDIT_SYMBOL_PROPERTIES:
return EE_ACTIONS::symbolProperties.MakeEvent();
case ID_LIBEDIT_EDIT_PIN_BY_TABLE:
return EE_ACTIONS::pinTable.MakeEvent();
}
return OPT<TOOL_EVENT>();

View File

@ -147,6 +147,7 @@ public:
/// Inspection
static TOOL_ACTION showDatasheet;
static TOOL_ACTION showMarkerInfo;
static TOOL_ACTION showSymbolEditor;
static TOOL_ACTION editWithSymbolEditor;
static TOOL_ACTION showLibraryBrowser;
@ -169,6 +170,7 @@ public:
static TOOL_ACTION pushPinLength;
static TOOL_ACTION pushPinNameSize;
static TOOL_ACTION pushPinNumSize;
static TOOL_ACTION showElectricalTypes;
static TOOL_ACTION showComponentTree;
static TOOL_ACTION toggleForceHV;

View File

@ -48,18 +48,20 @@
// Selection tool actions
TOOL_ACTION EE_ACTIONS::selectionActivate( "eeschema.InteractiveSelection",
AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE ); // No description, not shown anywhere
AS_GLOBAL, 0, "", "", // No description, not shown anywhere
nullptr, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::selectionTool( "eeschema.InteractiveSelection.selectionTool",
AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE ); // No description, not shown anywhere
AS_GLOBAL, 0, _( "Select item(s)" ), "",
cursor_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::selectNode( "eeschema.InteractiveSelection.SelectNode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SELECT_NODE ),
_( "Select Node" ), _( "Select a connection item under the cursor" ), nullptr );
_( "Select Node" ), _( "Select a connection item under the cursor" ) );
TOOL_ACTION EE_ACTIONS::selectConnection( "eeschema.InteractiveSelection.SelectConnection",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SELECT_CONNECTION ),
_( "Select Connection" ), _( "Select a complete connection" ), nullptr );
_( "Select Connection" ), _( "Select a complete connection" ) );
TOOL_ACTION EE_ACTIONS::selectionMenu( "eeschema.InteractiveSelection.SelectionMenu",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere

View File

@ -22,30 +22,26 @@
*/
#include <fctsys.h>
#include <sch_painter.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
#include <lib_edit_frame.h>
#include <tools/lib_editor_control.h>
#include <tools/lib_control.h>
TOOL_ACTION EE_ACTIONS::showComponentTree( "eeschema.SymbolEditorControl.showComponentTree",
TOOL_ACTION EE_ACTIONS::showElectricalTypes( "eeschema.SymbolLibraryControl.showElectricalTypes",
AS_GLOBAL, 0,
_( "Show Pin Electrical Types" ), "",
pin_show_etype_xpm );
TOOL_ACTION EE_ACTIONS::showComponentTree( "eeschema.SymbolLibraryControl.showComponentTree",
AS_GLOBAL, 0,
_( "Show Symbol Tree" ), "",
search_tree_xpm );
LIB_EDITOR_CONTROL::LIB_EDITOR_CONTROL() :
EE_TOOL_BASE<LIB_EDIT_FRAME>( "eeschema.SymbolEditorControl" )
{
}
LIB_EDITOR_CONTROL::~LIB_EDITOR_CONTROL()
{
}
int LIB_EDITOR_CONTROL::ShowLibraryBrowser( const TOOL_EVENT& aEvent )
int LIB_CONTROL::ShowLibraryBrowser( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
m_frame->OnOpenLibraryViewer( dummy );
@ -54,17 +50,36 @@ int LIB_EDITOR_CONTROL::ShowLibraryBrowser( const TOOL_EVENT& aEvent )
}
int LIB_EDITOR_CONTROL::ShowComponentTree( const TOOL_EVENT& aEvent )
int LIB_CONTROL::ShowComponentTree( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
m_frame->OnToggleSearchTree( dummy );
if( m_isLibEdit )
{
LIB_EDIT_FRAME* editFrame = static_cast<LIB_EDIT_FRAME*>( m_frame );
wxCommandEvent dummy;
editFrame->OnToggleSearchTree( dummy );
}
return 0;
}
void LIB_EDITOR_CONTROL::setTransitions()
int LIB_CONTROL::ShowElectricalTypes( const TOOL_EVENT& aEvent )
{
Go( &LIB_EDITOR_CONTROL::ShowLibraryBrowser, EE_ACTIONS::showLibraryBrowser.MakeEvent() );
Go( &LIB_EDITOR_CONTROL::ShowComponentTree, EE_ACTIONS::showComponentTree.MakeEvent() );
m_frame->SetShowElectricalType( !m_frame->GetShowElectricalType() );
// Update canvas
m_frame->GetRenderSettings()->m_ShowPinsElectricalType = m_frame->GetShowElectricalType();
m_frame->GetCanvas()->GetView()->UpdateAllItems( KIGFX::REPAINT );
m_frame->GetCanvas()->Refresh();
return 0;
}
void LIB_CONTROL::setTransitions()
{
Go( &LIB_CONTROL::ShowLibraryBrowser, EE_ACTIONS::showLibraryBrowser.MakeEvent() );
Go( &LIB_CONTROL::ShowElectricalTypes, EE_ACTIONS::showElectricalTypes.MakeEvent() );
Go( &LIB_CONTROL::ShowComponentTree, EE_ACTIONS::showComponentTree.MakeEvent() );
}

View File

@ -22,8 +22,8 @@
*/
#ifndef LIB_EDITOR_CONTROL_H
#define LIB_EDITOR_CONTROL_H
#ifndef LIB_CONTROL_H
#define LIB_CONTROL_H
#include <sch_base_frame.h>
#include <tools/ee_tool_base.h>
@ -31,21 +31,21 @@
class LIB_EDIT_FRAME;
/**
* Class LIB_EDITOR_CONTROL
* Class LIB_CONTROL
*
* Handles actions specific to the schematic editor in eeschema.
* Handles actions for the various symbol editor and viewers.
*/
class LIB_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<LIB_EDIT_FRAME>
class LIB_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_BASE_FRAME>
{
public:
LIB_EDITOR_CONTROL();
~LIB_EDITOR_CONTROL();
LIB_CONTROL() :
EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.SymbolLibraryControl" )
{ }
int ToggleLockSelected( const TOOL_EVENT& aEvent );
int LockSelected( const TOOL_EVENT& aEvent );
int UnlockSelected( const TOOL_EVENT& aEvent );
virtual ~LIB_CONTROL() { }
int ShowLibraryBrowser( const TOOL_EVENT& aEvent );
int ShowElectricalTypes( const TOOL_EVENT& aEvent );
int ShowComponentTree( const TOOL_EVENT& aEvent );
private:

View File

@ -82,8 +82,8 @@ bool LIB_EDIT_TOOL::Init()
moveMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
}
//
@ -114,9 +114,9 @@ bool LIB_EDIT_TOOL::Init()
selToolMenu.AddItem( EE_ACTIONS::properties, EE_CONDITIONS::Count( 1 ), 200 );
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 300 );
selToolMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( EE_ACTIONS::paste, EE_CONDITIONS::Idle, 300 );
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 300 );
selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 300 );
return true;
}
@ -550,6 +550,20 @@ int LIB_EDIT_TOOL::PinTable( const TOOL_EVENT& aEvent )
}
int LIB_EDIT_TOOL::Undo( const TOOL_EVENT& aEvent )
{
m_frame->GetComponentFromUndoList();
return 0;
}
int LIB_EDIT_TOOL::Redo( const TOOL_EVENT& aEvent )
{
m_frame->GetComponentFromRedoList();
return 0;
}
int LIB_EDIT_TOOL::Cut( const TOOL_EVENT& aEvent )
{
int retVal = Copy( aEvent );
@ -657,7 +671,9 @@ void LIB_EDIT_TOOL::setTransitions()
Go( &LIB_EDIT_TOOL::Properties, EE_ACTIONS::symbolProperties.MakeEvent() );
Go( &LIB_EDIT_TOOL::PinTable, EE_ACTIONS::pinTable.MakeEvent() );
Go( &LIB_EDIT_TOOL::Cut, EE_ACTIONS::cut.MakeEvent() );
Go( &LIB_EDIT_TOOL::Copy, EE_ACTIONS::copy.MakeEvent() );
Go( &LIB_EDIT_TOOL::Paste, EE_ACTIONS::paste.MakeEvent() );
Go( &LIB_EDIT_TOOL::Undo, ACTIONS::undo.MakeEvent() );
Go( &LIB_EDIT_TOOL::Redo, ACTIONS::redo.MakeEvent() );
Go( &LIB_EDIT_TOOL::Cut, ACTIONS::cut.MakeEvent() );
Go( &LIB_EDIT_TOOL::Copy, ACTIONS::copy.MakeEvent() );
Go( &LIB_EDIT_TOOL::Paste, ACTIONS::paste.MakeEvent() );
}

View File

@ -47,6 +47,8 @@ public:
int Properties( const TOOL_EVENT& aEvent );
int PinTable( const TOOL_EVENT& aEvent );
int Undo( const TOOL_EVENT& aEvent );
int Redo( const TOOL_EVENT& aEvent );
int Cut( const TOOL_EVENT& aEvent );
int Copy( const TOOL_EVENT& aEvent );
int Paste( const TOOL_EVENT& aEvent );

View File

@ -202,7 +202,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
{
SCH_COMPONENT* component = aEvent.Parameter<SCH_COMPONENT*>();
m_frame->SetToolID( ID_SCH_PLACE_COMPONENT, wxCURSOR_PENCIL, _( "Add Symbol" ) );
m_frame->SetToolID( ID_PLACE_SYMBOL_TOOL, wxCURSOR_PENCIL, _( "Add Symbol" ) );
return doPlaceComponent( component, nullptr, s_SymbolHistoryList );
}
@ -214,7 +214,7 @@ int SCH_DRAWING_TOOLS::PlacePower( const TOOL_EVENT& aEvent )
SCHLIB_FILTER filter;
filter.FilterPowerParts( true );
m_frame->SetToolID( ID_PLACE_POWER_BUTT, wxCURSOR_PENCIL, _( "Add Power" ) );
m_frame->SetToolID( ID_PLACE_POWER_TOOL, wxCURSOR_PENCIL, _( "Add Power" ) );
return doPlaceComponent( component, &filter, s_PowerHistoryList );
}
@ -350,7 +350,7 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
{
SCH_BITMAP* image = aEvent.Parameter<SCH_BITMAP*>();
m_frame->SetToolID( ID_ADD_IMAGE_BUTT, wxCURSOR_PENCIL, _( "Add image" ) );
m_frame->SetToolID( ID_PLACE_IMAGE_TOOL, wxCURSOR_PENCIL, _( "Add image" ) );
VECTOR2I cursorPos = getViewControls()->GetCursorPosition();
@ -469,28 +469,28 @@ int SCH_DRAWING_TOOLS::PlaceImage( const TOOL_EVENT& aEvent )
int SCH_DRAWING_TOOLS::PlaceNoConnect( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_NOCONN_BUTT, wxCURSOR_PENCIL, _( "Add no connect" ) );
m_frame->SetToolID( ID_NOCONNECT_TOOL, wxCURSOR_PENCIL, _( "Add no connect" ) );
return doSingleClickPlace( SCH_NO_CONNECT_T );
}
int SCH_DRAWING_TOOLS::PlaceJunction( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_JUNCTION_BUTT, wxCURSOR_PENCIL, _( "Add junction" ) );
m_frame->SetToolID( ID_JUNCTION_TOOL, wxCURSOR_PENCIL, _( "Add junction" ) );
return doSingleClickPlace( SCH_JUNCTION_T );
}
int SCH_DRAWING_TOOLS::PlaceBusWireEntry( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_WIRETOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
m_frame->SetToolID( ID_WIRETOBUS_ENTRY_TOOL, wxCURSOR_PENCIL, _( "Add wire to bus entry" ) );
return doSingleClickPlace( SCH_BUS_WIRE_ENTRY_T );
}
int SCH_DRAWING_TOOLS::PlaceBusBusEntry( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_BUSTOBUS_ENTRY_BUTT, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
m_frame->SetToolID( ID_BUSTOBUS_ENTRY_TOOL, wxCURSOR_PENCIL, _( "Add bus to bus entry" ) );
return doSingleClickPlace( SCH_BUS_BUS_ENTRY_T );
}
@ -565,42 +565,42 @@ int SCH_DRAWING_TOOLS::doSingleClickPlace( KICAD_T aType )
int SCH_DRAWING_TOOLS::PlaceLabel( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_LABEL_BUTT, wxCURSOR_PENCIL, _( "Add net label" ) );
m_frame->SetToolID( ID_LABEL_TOOL, wxCURSOR_PENCIL, _( "Add net label" ) );
return doTwoClickPlace( SCH_LABEL_T );
}
int SCH_DRAWING_TOOLS::PlaceGlobalLabel( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_GLOBALLABEL_BUTT, wxCURSOR_PENCIL, _( "Add global label" ) );
m_frame->SetToolID( ID_GLOBALLABEL_TOOL, wxCURSOR_PENCIL, _( "Add global label" ) );
return doTwoClickPlace( SCH_GLOBAL_LABEL_T );
}
int SCH_DRAWING_TOOLS::PlaceHierarchicalLabel( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_HIERLABEL_BUTT, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
m_frame->SetToolID( ID_HIERLABEL_TOOL, wxCURSOR_PENCIL, _( "Add hierarchical label" ) );
return doTwoClickPlace( SCH_HIER_LABEL_T );
}
int SCH_DRAWING_TOOLS::PlaceSheetPin( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_SHEET_PIN_BUTT, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
m_frame->SetToolID( ID_SHEETPIN_TOOL, wxCURSOR_PENCIL, _( "Add sheet pins" ) );
return doTwoClickPlace( SCH_SHEET_PIN_T );
}
int SCH_DRAWING_TOOLS::ImportSheetPin( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_IMPORT_HLABEL_BUTT, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
m_frame->SetToolID( ID_IMPORT_SHEETPIN_TOOL, wxCURSOR_PENCIL, _( "Import sheet pins" ) );
return doTwoClickPlace( SCH_SHEET_PIN_T );
}
int SCH_DRAWING_TOOLS::PlaceSchematicText( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_TEXT_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add text" ) );
m_frame->SetToolID( ID_SCHEMATIC_TEXT_TOOL, wxCURSOR_PENCIL, _( "Add text" ) );
return doTwoClickPlace( SCH_TEXT_T );
}
@ -662,7 +662,7 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
if( item )
{
if( m_frame->GetToolId() == ID_IMPORT_HLABEL_BUTT )
if( m_frame->GetToolId() == ID_IMPORT_SHEETPIN_TOOL )
item = m_frame->ImportSheetPin( (SCH_SHEET*) item );
else
item = m_frame->CreateSheetPin( (SCH_SHEET*) item );
@ -740,7 +740,7 @@ int SCH_DRAWING_TOOLS::doTwoClickPlace( KICAD_T aType )
int SCH_DRAWING_TOOLS::DrawSheet( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_SHEET_SYMBOL_BUTT, wxCURSOR_PENCIL, _( "Add sheet" ) );
m_frame->SetToolID( ID_SHEET_TOOL, wxCURSOR_PENCIL, _( "Add sheet" ) );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
getViewControls()->ShowCursor( true );

View File

@ -162,7 +162,7 @@ TOOL_ACTION EE_ACTIONS::doDelete( "eeschema.InteractiveEdit.doDelete",
TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteItemCursor",
AS_GLOBAL, 0,
_( "DoDelete Items" ), _( "DoDelete clicked items" ),
nullptr, AF_ACTIVATE );
delete_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::breakWire( "eeschema.InteractiveEdit.breakWire",
AS_GLOBAL, 0,
@ -255,14 +255,14 @@ bool SCH_EDIT_TOOL::Init()
wxASSERT_MSG( drawingTools, "eeshema.InteractiveDrawing tool is not available" );
auto sheetTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_SHEET_SYMBOL_BUTT );
return ( m_frame->GetToolId() == ID_SHEET_TOOL );
};
auto anyTextTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_LABEL_BUTT
|| m_frame->GetToolId() == ID_GLOBALLABEL_BUTT
|| m_frame->GetToolId() == ID_HIERLABEL_BUTT
|| m_frame->GetToolId() == ID_TEXT_COMMENT_BUTT );
return ( m_frame->GetToolId() == ID_LABEL_TOOL
|| m_frame->GetToolId() == ID_GLOBALLABEL_TOOL
|| m_frame->GetToolId() == ID_HIERLABEL_TOOL
|| m_frame->GetToolId() == ID_SCHEMATIC_TEXT_TOOL );
};
auto duplicateCondition = [] ( const SELECTION& aSel ) {
@ -379,8 +379,8 @@ bool SCH_EDIT_TOOL::Init()
moveMenu.AddMenu( symUnitMenu.get(), EE_CONDITIONS::SingleMultiUnitSymbol, 1 );
moveMenu.AddSeparator( EE_CONDITIONS::IdleSelection );
moveMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection );
moveMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection );
moveMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection );
moveMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection );
}
//
@ -452,9 +452,9 @@ bool SCH_EDIT_TOOL::Init()
selToolMenu.AddItem( EE_ACTIONS::cleanupSheetPins, singleSheetCondition, 200 );
selToolMenu.AddSeparator( EE_CONDITIONS::Idle, 200 );
selToolMenu.AddItem( EE_ACTIONS::cut, EE_CONDITIONS::IdleSelection, 200 );
selToolMenu.AddItem( EE_ACTIONS::copy, EE_CONDITIONS::IdleSelection, 200 );
selToolMenu.AddItem( EE_ACTIONS::paste, EE_CONDITIONS::Idle, 200 );
selToolMenu.AddItem( ACTIONS::cut, EE_CONDITIONS::IdleSelection, 200 );
selToolMenu.AddItem( ACTIONS::copy, EE_CONDITIONS::IdleSelection, 200 );
selToolMenu.AddItem( ACTIONS::paste, EE_CONDITIONS::Idle, 200 );
return true;
}
@ -998,7 +998,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
wxCHECK( picker, 0 );
m_frame->SetToolID( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxCURSOR_BULLSEYE, _( "Delete item" ) );
m_frame->SetToolID( ID_DELETE_TOOL, wxCURSOR_BULLSEYE, _( "Delete item" ) );
picker->SetClickHandler( std::bind( deleteItem, m_frame, std::placeholders::_1 ) );
picker->Activate();
Wait();

View File

@ -73,19 +73,13 @@ TOOL_ACTION EE_ACTIONS::updateNetHighlighting( "eeschema.EditorControl.updateNet
TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetCursor",
AS_GLOBAL, 0,
_( "Highlight Net" ), _( "Highlight wires and pins of a net" ), NULL, AF_ACTIVATE );
_( "Highlight Nets" ), _( "Highlight wires and pins of a net" ),
net_highlight_schematic_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::cut( "eeschema.EditorControl.cut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_CUT ),
_( "Cut" ), _( "Cut selected item(s) to clipboard" ), cut_xpm );
TOOL_ACTION EE_ACTIONS::copy( "eeschema.EditorControl.copy",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COPY ),
_( "Copy" ), _( "Copy selected item(s) to clipboard" ), copy_xpm );
TOOL_ACTION EE_ACTIONS::paste( "eeschema.EditorControl.paste",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_PASTE ),
_( "Paste" ), _( "Paste clipboard into schematic" ), paste_xpm );
TOOL_ACTION EE_ACTIONS::showSymbolEditor( "eeschema.EditorControl.showSymbolEditor",
AS_GLOBAL, 0,
_( "Show Symbol Editor" ), _( "Create, delete and edit symbols" ),
libedit_xpm );
TOOL_ACTION EE_ACTIONS::editWithSymbolEditor( "eeschema.EditorControl.editWithSymbolEditor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_WITH_LIBEDIT ),
@ -128,17 +122,6 @@ TOOL_ACTION EE_ACTIONS::toggleForceHV( "eeschema.EditorControl.forceHVLines",
lines90_xpm );
SCH_EDITOR_CONTROL::SCH_EDITOR_CONTROL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" )
{
}
SCH_EDITOR_CONTROL::~SCH_EDITOR_CONTROL()
{
}
int SCH_EDITOR_CONTROL::CrossProbeToPcb( const TOOL_EVENT& aEvent )
{
doCrossProbeSchToPcb( aEvent, false );
@ -468,7 +451,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
EE_PICKER_TOOL* picker = m_toolMgr->GetTool<EE_PICKER_TOOL>();
assert( picker );
m_frame->SetToolID( ID_HIGHLIGHT_BUTT, wxCURSOR_HAND, _( "Highlight specific net" ) );
m_frame->SetToolID( ID_HIGHLIGHT_TOOL, wxCURSOR_HAND, _( "Highlight specific net" ) );
picker->SetClickHandler( std::bind( highlightNet, m_toolMgr, std::placeholders::_1 ) );
picker->Activate();
Wait();
@ -477,6 +460,65 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::Undo( const TOOL_EVENT& aEvent )
{
if( m_frame->GetScreen()->GetUndoCommandCount() <= 0 )
return 0;
// Inform tools that undo command was issued
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
/* Get the old list */
PICKED_ITEMS_LIST* List = m_frame->GetScreen()->PopCommandFromUndoList();
/* Undo the command */
m_frame->PutDataInPreviousState( List, false );
/* Put the old list in RedoList */
List->ReversePickersListOrder();
m_frame->GetScreen()->PushCommandToRedoList( List );
m_frame->SetSheetNumberAndCount();
m_frame->TestDanglingEnds();
m_frame->SyncView();
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
return 0;
}
int SCH_EDITOR_CONTROL::Redo( const TOOL_EVENT& aEvent )
{
if( m_frame->GetScreen()->GetRedoCommandCount() == 0 )
return 0;
// Inform tools that undo command was issued
m_toolMgr->ProcessEvent( { TC_MESSAGE, TA_UNDO_REDO_PRE, AS_GLOBAL } );
/* Get the old list */
PICKED_ITEMS_LIST* List = m_frame->GetScreen()->PopCommandFromRedoList();
/* Redo the command: */
m_frame->PutDataInPreviousState( List, true );
/* Put the old list in UndoList */
List->ReversePickersListOrder();
m_frame->GetScreen()->PushCommandToUndoList( List );
m_frame->SetSheetNumberAndCount();
m_frame->TestDanglingEnds();
m_frame->SyncView();
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
return 0;
}
bool SCH_EDITOR_CONTROL::doCopy()
{
EE_SELECTION_TOOL* selTool = m_toolMgr->GetTool<EE_SELECTION_TOOL>();
@ -683,11 +725,18 @@ int SCH_EDITOR_CONTROL::EditWithSymbolEditor( const TOOL_EVENT& aEvent )
}
int SCH_EDITOR_CONTROL::ShowSymbolEditor( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
m_frame->OnOpenLibraryEditor( dummy );
return 0;
}
int SCH_EDITOR_CONTROL::ShowLibraryBrowser( const TOOL_EVENT& aEvent )
{
wxCommandEvent dummy;
m_frame->OnOpenLibraryViewer( dummy );
return 0;
}
@ -766,11 +815,14 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EVENTS::SelectedItemsModified );
Go( &SCH_EDITOR_CONTROL::UpdateNetHighlighting, EE_ACTIONS::updateNetHighlighting.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Cut, EE_ACTIONS::cut.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Copy, EE_ACTIONS::copy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Paste, EE_ACTIONS::paste.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Cut, ACTIONS::cut.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Copy, ACTIONS::copy.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::Paste, ACTIONS::paste.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithSymbolEditor.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowSymbolEditor, EE_ACTIONS::showSymbolEditor.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowLibraryBrowser, EE_ACTIONS::showLibraryBrowser.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EnterSheet, EE_ACTIONS::enterSheet.MakeEvent() );

View File

@ -38,8 +38,12 @@ class SCH_EDIT_FRAME;
class SCH_EDITOR_CONTROL : public wxEvtHandler, public EE_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_EDITOR_CONTROL();
~SCH_EDITOR_CONTROL();
SCH_EDITOR_CONTROL() :
EE_TOOL_BASE<SCH_EDIT_FRAME>( "eeschema.EditorControl" ),
m_probingSchToPcb( false )
{ }
~SCH_EDITOR_CONTROL() { }
int ToggleLockSelected( const TOOL_EVENT& aEvent );
int LockSelected( const TOOL_EVENT& aEvent );
@ -69,12 +73,16 @@ public:
///> Launches a tool to highlight nets.
int HighlightNetCursor( const TOOL_EVENT& aEvent );
int Undo( const TOOL_EVENT& aEvent );
int Redo( const TOOL_EVENT& aEvent );
///> Clipboard support.
int Cut( const TOOL_EVENT& aEvent );
int Copy( const TOOL_EVENT& aEvent );
int Paste( const TOOL_EVENT& aEvent );
int EditWithSymbolEditor( const TOOL_EVENT& aEvent );
int ShowSymbolEditor( const TOOL_EVENT& aEvent );
int ShowLibraryBrowser( const TOOL_EVENT& aEvent );
int EnterSheet( const TOOL_EVENT& aEvent );

View File

@ -203,11 +203,11 @@ bool SCH_WIRE_BUS_TOOL::Init()
EE_TOOL_BASE::Init();
auto wireOrBusTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_WIRE_BUTT || m_frame->GetToolId() == ID_BUS_BUTT );
return ( m_frame->GetToolId() == ID_WIRE_TOOL || m_frame->GetToolId() == ID_BUS_TOOL );
};
auto lineTool = [ this ] ( const SELECTION& aSel ) {
return ( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT );
return ( m_frame->GetToolId() == ID_SCHEMATIC_LINE_TOOL );
};
auto belowRootSheetCondition = [] ( const SELECTION& aSel ) {
@ -319,11 +319,11 @@ int SCH_WIRE_BUS_TOOL::StartWire( const TOOL_EVENT& aEvent )
*/
int SCH_WIRE_BUS_TOOL::DrawWires( const TOOL_EVENT& aEvent )
{
if( m_frame->GetToolId() == ID_WIRE_BUTT )
if( m_frame->GetToolId() == ID_WIRE_TOOL )
return StartWire( aEvent );
else
{
m_frame->SetToolID( ID_WIRE_BUTT, wxCURSOR_PENCIL, _( "Add wire" ) );
m_frame->SetToolID( ID_WIRE_TOOL, wxCURSOR_PENCIL, _( "Add wire" ) );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
return doDrawSegments( LAYER_WIRE, nullptr );
@ -351,11 +351,11 @@ int SCH_WIRE_BUS_TOOL::StartBus( const TOOL_EVENT& aEvent )
*/
int SCH_WIRE_BUS_TOOL::DrawBusses( const TOOL_EVENT& aEvent )
{
if( m_frame->GetToolId() == ID_BUS_BUTT )
if( m_frame->GetToolId() == ID_BUS_TOOL )
return StartBus( aEvent );
else
{
m_frame->SetToolID( ID_BUS_BUTT, wxCURSOR_PENCIL, _( "Add bus" ) );
m_frame->SetToolID( ID_BUS_TOOL, wxCURSOR_PENCIL, _( "Add bus" ) );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
return doDrawSegments( LAYER_BUS, nullptr );
@ -411,9 +411,9 @@ int SCH_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent )
return doDrawSegments( LAYER_WIRE, segment );
// If we came from one of our tools then re-enter it in the idle state
if( m_frame->GetToolId() == ID_WIRE_BUTT )
if( m_frame->GetToolId() == ID_WIRE_TOOL )
return doDrawSegments( LAYER_WIRE, nullptr );
else if( m_frame->GetToolId() == ID_BUS_BUTT )
else if( m_frame->GetToolId() == ID_BUS_TOOL )
return doDrawSegments( LAYER_BUS, nullptr );
m_frame->SetNoToolSelected();
@ -462,11 +462,11 @@ int SCH_WIRE_BUS_TOOL::StartLine( const TOOL_EVENT& aEvent)
*/
int SCH_WIRE_BUS_TOOL::DrawLines( const TOOL_EVENT& aEvent)
{
if( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT )
if( m_frame->GetToolId() == ID_SCHEMATIC_LINE_TOOL )
return StartLine( aEvent );
else
{
m_frame->SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add lines" ) );
m_frame->SetToolID( ID_SCHEMATIC_LINE_TOOL, wxCURSOR_PENCIL, _( "Add lines" ) );
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
return doDrawSegments( LAYER_NOTES, nullptr );

View File

@ -48,6 +48,7 @@
#include <tools/ee_actions.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/lib_control.h>
// Save previous component library viewer state.
wxString LIB_VIEW_FRAME::m_libraryName;
@ -83,11 +84,9 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_DRAW_FRAME::GetKicadContribute )
EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset )
EVT_MENU( ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, LIB_VIEW_FRAME::OnShowElectricalType )
EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, LIB_VIEW_FRAME::onUpdateNormalBodyStyleButton )
EVT_UPDATE_UI( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, LIB_VIEW_FRAME::onUpdateAltBodyStyleButton )
EVT_UPDATE_UI( ID_LIBVIEW_SHOW_ELECTRICAL_TYPE, LIB_VIEW_FRAME::OnUpdateElectricalType )
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::onUpdateUnitChoice )
EVT_UPDATE_UI( ID_LIBEDIT_VIEW_DOC, LIB_VIEW_FRAME::onUpdateDocButton )
@ -141,8 +140,7 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
// Menu bar is not mandatory: uncomment/comment the next line
// to add/remove the menubar
setupTools();
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
@ -187,7 +185,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_auimgr.Update();
setupTools();
GetToolManager()->RunAction( "common.Control.gridPreset", true, m_LastGridSizeId );
GetToolManager()->RunAction( "common.Control.zoomFitScreen", true );
@ -232,6 +229,7 @@ void LIB_VIEW_FRAME::setupTools()
// Register tools
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new LIB_CONTROL );
m_toolManager->InitTools();
@ -406,23 +404,6 @@ void LIB_VIEW_FRAME::OnSetRelativeOffset( wxCommandEvent& event )
}
void LIB_VIEW_FRAME::OnShowElectricalType( wxCommandEvent& event )
{
m_showPinElectricalTypeName = !m_showPinElectricalTypeName;
// Update canvas
GetRenderSettings()->m_ShowPinsElectricalType = m_showPinElectricalTypeName;
GetCanvas()->GetView()->MarkDirty();
GetCanvas()->Refresh();
}
void LIB_VIEW_FRAME::OnUpdateElectricalType( wxUpdateUIEvent& aEvent )
{
aEvent.Check( GetShowElectricalType() );
}
void LIB_VIEW_FRAME::onUpdateUnitChoice( wxUpdateUIEvent& aEvent )
{
LIB_PART* part = getSelectedSymbol();

View File

@ -97,7 +97,6 @@ public:
void ClickOnCmpList( wxCommandEvent& event );
void OnSetRelativeOffset( wxCommandEvent& event );
void OnSelectSymbol( wxCommandEvent& aEvent );
void OnShowElectricalType( wxCommandEvent& event );
bool GeneralControl( wxDC* aDC, const wxPoint& aPosition, EDA_KEY aHotKey ) override;
@ -151,9 +150,6 @@ public:
int GetUnit() const { return m_unit; }
int GetConvert() const { return m_convert; }
bool GetShowElectricalType() const { return m_showPinElectricalTypeName; }
void SetShowElectricalType( bool aShow ) { m_showPinElectricalTypeName = aShow; }
const BOX2I GetDocumentExtents() const override;
private:
@ -219,11 +215,6 @@ private:
LIB_ALIAS* m_previewItem;
/**
* the option to show the pin electrical name in the component editor
*/
bool m_showPinElectricalTypeName;
DECLARE_EVENT_TABLE()
};

View File

@ -112,8 +112,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
EVT_MENU( ID_ZOOM_SELECTION, GERBVIEW_FRAME::Process_Special_Functions )
// Vertical toolbar:
EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions )
@ -121,8 +119,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar
//EVT_TOOL( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::Process_Special_Functions ) // mentioned below
EVT_TOOL( ID_ZOOM_SELECTION, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnToggleCoordType )
EVT_TOOL( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, GERBVIEW_FRAME::OnTogglePolygonDrawMode )
@ -152,7 +148,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_HIGHLIGHT_REMOVE_ALL, GERBVIEW_FRAME::Process_Special_Functions )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, GERBVIEW_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, GERBVIEW_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_TB_MEASUREMENT_TOOL, GERBVIEW_FRAME::OnUpdateSelectTool )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, GERBVIEW_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH,
@ -224,14 +219,6 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetNoToolSelected();
break;
case ID_ZOOM_SELECTION:
// This tool is located on the main toolbar: switch it on or off on click
if( GetToolId() != ID_ZOOM_SELECTION )
SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
else
SetNoToolSelected();
break;
case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
break;
@ -481,7 +468,6 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
needs_refresh = true;
break;
// collect GAL-only tools here:
case ID_TB_MEASUREMENT_TOOL:
SetToolID( id, wxCURSOR_DEFAULT, _( "Unsupported tool in this canvas" ) );
break;
@ -567,9 +553,8 @@ void GERBVIEW_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
for( auto ii: menuList )
{
wxMenuItem* item = menuBar->FindItem( ii.menuId );
if( item && ii.galType == canvasType )
{
item->Check( true );
}
}
}

View File

@ -143,6 +143,7 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
setupTools();
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateOptToolbar();
@ -166,8 +167,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
ReFillLayerWidget(); // this is near end because contents establish size
m_auimgr.Update();
setupTools();
SetActiveLayer( 0, true );
Zoom_Automatique( false ); // Gives a default zoom value

View File

@ -686,6 +686,8 @@ public:
*/
void CommonSettingsChanged() override;
void SyncMenusAndToolbars() override;
DECLARE_EVENT_TABLE()
};

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -19,11 +19,6 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file toolbars_gerber.cpp
* @brief Build tool bars
*/
#include <fctsys.h>
#include <common.h>
@ -40,6 +35,7 @@
#include <bitmaps.h>
#include <kicad_string.h>
#include <wx/wupdlock.h>
#include <tool/actions.h>
void GERBVIEW_FRAME::ReCreateHToolbar( void )
{
@ -48,8 +44,8 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString,
@ -71,22 +67,13 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print layers" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Redraw view" ), GerbviewHotkeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
msg = AddHotkeyName( _( "Zoom in" ), GerbviewHotkeysDescr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), GerbviewHotkeysDescr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom to fit" ), GerbviewHotkeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
@ -112,9 +99,9 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
wxStaticText* text;
if( !m_auxiliaryToolBar )
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition,
wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Creates box to display and choose components:
if( !m_SelComponentBox )
@ -206,30 +193,29 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
}
void GERBVIEW_FRAME::ReCreateVToolbar( void )
void GERBVIEW_FRAME::ReCreateVToolbar()
{
if( m_drawToolBar )
return;
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, _( "Select item" ),
KiScaledBitmap( cursor_xpm, this ) );
KiScaledSeparator( m_mainToolBar, this );
m_drawToolBar->AddSeparator();
m_drawToolBar->Realize();
}
void GERBVIEW_FRAME::ReCreateOptToolbar( void )
void GERBVIEW_FRAME::ReCreateOptToolbar()
{
if( m_optionsToolBar )
m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// TODO: these can be moved to the 'proper' vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable
@ -238,42 +224,21 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK );
if( IsGalCanvasActive() )
{
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ),
wxITEM_CHECK );
}
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ),
wxITEM_CHECK );
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Turn polar coordinates on" ), wxITEM_CHECK );
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
#else
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape (not supported in Legacy Toolset)" ),
wxITEM_CHECK );
#endif
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString,
@ -298,39 +263,15 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
KiScaledBitmap( show_dcodenumber_xpm, this ),
_( "Show dcode number" ), wxITEM_CHECK );
// tools to select draw mode in GerbView, unused in GAL
if( !IsGalCanvasActive() )
{
KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString,
KiScaledBitmap( gbr_select_mode0_xpm, this ),
_( "Show layers in raw mode\n"
"(could have problems with negative items when more than one gerber file is shown)" ),
wxITEM_RADIO );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
KiScaledBitmap( gbr_select_mode1_xpm, this ),
_( "Show layers in stacked mode\n"
"(show negative items without artifacts)" ),
wxITEM_RADIO );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in transparency mode\n"
"(show negative items without artifacts)" ),
wxITEM_RADIO );
}
else
{
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in diff (compare) mode" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in diff (compare) mode" ),
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
}
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ),
wxITEM_CHECK );
// Tools to show/hide toolbars:
KiScaledSeparator( m_mainToolBar, this );
@ -340,7 +281,6 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
_( "Show/hide the layers manager toolbar" ),
wxITEM_CHECK );
m_optionsToolBar->Realize();
}
@ -426,10 +366,8 @@ void GERBVIEW_FRAME::updateComponentListSelectBox()
m_SelComponentBox->Append( NO_SELECTION_STRING );
// Now copy the list to the choice box
for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
{
m_SelComponentBox->Append( ii->first );
}
for( auto& ii : full_list )
m_SelComponentBox->Append( ii.first );
m_SelComponentBox->SetSelection( 0 );
}
@ -456,10 +394,8 @@ void GERBVIEW_FRAME::updateNetnameListSelectBox()
m_SelNetnameBox->Append( NO_SELECTION_STRING );
// Now copy the list to the choice box
for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
{
m_SelNetnameBox->Append( UnescapeString( ii->first ) );
}
for( auto& ii : full_list )
m_SelNetnameBox->Append( UnescapeString( ii.first ) );
m_SelNetnameBox->SetSelection( 0 );
}
@ -678,3 +614,19 @@ void GERBVIEW_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
m_SelLayerBox->SetSelection( GetActiveLayer() );
}
}
void GERBVIEW_FRAME::SyncMenusAndToolbars()
{
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
KIGFX::GAL_DISPLAY_OPTIONS& galOpts = GetGalDisplayOptions();
m_optionsToolBar->Toggle( ACTIONS::toggleCursorStyle, galOpts.m_fullscreenCursor );
m_optionsToolBar->Refresh();
}

View File

@ -36,6 +36,7 @@
class wxSingleInstanceChecker;
class EDA_HOTKEY;
class ACTION_TOOLBAR;
using KIGFX::COLOR4D;
@ -152,16 +153,17 @@ protected:
wxChoice* m_gridSelectBox;
wxChoice* m_zoomSelectBox;
ACTION_TOOLBAR* m_mainToolBar;
/// Auxiliary tool bar typically shown below the main tool bar at the top of the
/// main window.
wxAuiToolBar* m_auxiliaryToolBar;
ACTION_TOOLBAR* m_auxiliaryToolBar;
/// The tool bar that contains the buttons for quick access to the application draw
/// tools. It typically is located on the right side of the main window.
wxAuiToolBar* m_drawToolBar;
ACTION_TOOLBAR* m_drawToolBar;
/// The options tool bar typcially located on the left edge of the main window.
wxAuiToolBar* m_optionsToolBar;
ACTION_TOOLBAR* m_optionsToolBar;
/// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel;
@ -481,10 +483,10 @@ public:
virtual void ReCreateAuxiliaryToolbar();
// Toolbar accessors
wxAuiToolBar* GetMainToolBar() const { return m_mainToolBar; }
wxAuiToolBar* GetOptionsToolBar() const { return m_optionsToolBar; }
wxAuiToolBar* GetDrawToolBar() const { return m_drawToolBar; }
wxAuiToolBar* GetAuxiliaryToolBar() const { return m_auxiliaryToolBar; }
ACTION_TOOLBAR* GetMainToolBar() const { return m_mainToolBar; }
ACTION_TOOLBAR* GetOptionsToolBar() const { return m_optionsToolBar; }
ACTION_TOOLBAR* GetDrawToolBar() const { return m_drawToolBar; }
ACTION_TOOLBAR* GetAuxiliaryToolBar() const { return m_auxiliaryToolBar; }
/**
* Checks all the toolbars and returns true if the given tool id is toggled.
@ -610,16 +612,13 @@ public:
// Command event handlers shared by all applications derived from EDA_DRAW_FRAME.
void OnToggleGridState( wxCommandEvent& aEvent );
void OnSelectUnits( wxCommandEvent& aEvent );
void OnToggleCrossHairStyle( wxCommandEvent& aEvent );
// Update user interface event handlers shared by all applications derived from
// EDA_DRAW_FRAME.
void OnUpdateUndo( wxUpdateUIEvent& aEvent );
void OnUpdateRedo( wxUpdateUIEvent& aEvent );
void OnUpdateGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateUnits( wxUpdateUIEvent& aEvent );
void OnUpdateCrossHairStyle( wxUpdateUIEvent& aEvent );
/**

View File

@ -50,6 +50,8 @@
#ifdef USE_WX_OVERLAY
#include <wx/overlay.h>
#include <tool/action_toolbar.h>
#endif
// Option for main frames
@ -115,34 +117,32 @@ class EDA_BASE_FRAME : public wxFrame
wxWindow* findQuasiModalDialog();
protected:
FRAME_T m_Ident; ///< Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
FRAME_T m_Ident; ///< Id Type (pcb, schematic, library..)
wxPoint m_FramePos;
wxSize m_FrameSize;
wxString m_configFrameName; ///< prefix used in config to identify some params (frame size...)
wxString m_configFrameName; ///< prefix used in config to identify some params (frame size...)
///< if empty, the frame name defined in CTOR is used
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
wxString m_AboutTitle; ///< Name of program displayed in About.
wxString m_AboutTitle; ///< Name of program displayed in About.
wxAuiManager m_auimgr;
wxAuiManager m_auimgr;
/// Flag to indicate if this frame supports auto save.
bool m_hasAutoSave;
bool m_hasAutoSave;
/// Flag to indicate the last auto save state.
bool m_autoSaveState;
bool m_autoSaveState;
/// The auto save interval time in seconds.
int m_autoSaveInterval;
int m_autoSaveInterval;
/// The timer used to implement the auto save feature;
wxTimer* m_autoSaveTimer;
wxTimer* m_autoSaveTimer;
wxString m_perspective; ///< wxAuiManager perspective.
wxString m_perspective; ///< wxAuiManager perspective.
wxString m_mruPath; ///< Most recently used path.
wxString m_mruPath; ///< Most recently used path.
///> Default style flags used for wxAUI toolbars
static constexpr int KICAD_AUI_TB_STYLE = wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_PLAIN_BACKGROUND;

View File

@ -121,8 +121,6 @@ enum main_id
ID_ZOOM_SELECTION,
ID_SEL_BG_COLOR,
ID_REPEAT_BUTT,
ID_LANGUAGE_CHOICE,
ID_LANGUAGE_DEFAULT,
ID_LANGUAGE_ENGLISH,

View File

@ -582,10 +582,6 @@ public:
// User interface update event handlers.
void OnUpdateCoordType( wxUpdateUIEvent& aEvent );
void OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateGraphicDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateEdgeDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
virtual void OnUpdateLayerAlpha( wxUpdateUIEvent& aEvent ) {}

View File

@ -220,7 +220,7 @@ protected:
TOOL_INTERACTIVE* m_tool;
///> Menu items with ID higher than that are considered TOOL_ACTIONs
static const int ACTION_ID = 10000;
static const int ACTION_ID = 20000;
///> Associates tool actions with menu item IDs. Non-owning.
std::map<int, const TOOL_ACTION*> m_toolActions;

View File

@ -0,0 +1,72 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.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
*/
#ifndef ACTION_TOOLBAR_H
#define ACTION_TOOLBAR_H
#include <map>
#include <wx/aui/auibar.h>
#include <tool/tool_event.h>
class EDA_DRAW_FRAME;
class TOOL_MANAGER;
class TOOL_ACTION;
/**
* Class ACTION_TOOLBAR
*
* Defines the structure of a toolbar with buttons that invoke ACTIONs.
*/
class ACTION_TOOLBAR : public wxAuiToolBar
{
public:
ACTION_TOOLBAR( EDA_DRAW_FRAME* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxAUI_TB_DEFAULT_STYLE );
virtual ~ACTION_TOOLBAR() {}
/**
* Function Add()
* Adds a TOOL_ACTION-based button to the toolbar. After selecting the entry,
* a TOOL_EVENT command containing name of the action is sent.
*/
void Add( const TOOL_ACTION& aAction, bool aIsToggleEntry = false );
void Toggle( const TOOL_ACTION& aAction, bool aState );
static const bool TOGGLE = true;
protected:
///> The default tool event handler.
void onToolEvent( wxAuiToolBarEvent& aEvent );
protected:
///> Tool items with ID higher than that are considered TOOL_ACTIONs
static const int ACTION_ID = 10000;
TOOL_MANAGER* m_toolManager;
std::map<int, const TOOL_ACTION*> m_toolActions;
};
#endif

View File

@ -47,6 +47,11 @@ public:
// Generic actions
static TOOL_ACTION cancelInteractive;
static TOOL_ACTION updateMenu;
static TOOL_ACTION undo;
static TOOL_ACTION redo;
static TOOL_ACTION cut;
static TOOL_ACTION copy;
static TOOL_ACTION paste;
// View controls
static TOOL_ACTION zoomRedraw;

View File

@ -38,8 +38,12 @@ class EDA_DRAW_FRAME;
class COMMON_TOOLS : public TOOL_INTERACTIVE
{
public:
COMMON_TOOLS();
~COMMON_TOOLS();
COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ),
m_frame( NULL )
{ }
virtual ~COMMON_TOOLS() { }
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;

View File

@ -63,6 +63,9 @@ public:
void AddItem( const TOOL_ACTION& aAction, const SELECTION_CONDITION& aCondition,
int aOrder = ANY_ORDER );
void AddItem( int aId, const wxString& aText, const wxString& aTooltip, BITMAP_DEF aIcon,
const SELECTION_CONDITION& aCondition, int aOrder = ANY_ORDER );
/**
* Function AddCheckItem()
*
@ -75,6 +78,9 @@ public:
void AddCheckItem( const TOOL_ACTION& aAction, const SELECTION_CONDITION& aCondition,
int aOrder = ANY_ORDER );
void AddCheckItem( int aId, const wxString& aText, const wxString& aTooltip, BITMAP_DEF aIcon,
const SELECTION_CONDITION& aCondition, int aOrder = ANY_ORDER );
/**
* Function AddMenu()
*
@ -133,6 +139,15 @@ private:
m_data.menu = aMenu;
}
ENTRY( wxMenuItem* aItem, SELECTION_CONDITION aCondition, int aOrder, bool aCheckmark ) :
m_type( WXITEM ),
m_condition( aCondition ),
m_order( aOrder ),
m_isCheckmarkEntry( aCheckmark )
{
m_data.wxItem = aItem;
}
// Separator
ENTRY( SELECTION_CONDITION aCondition, int aOrder ) :
m_type( SEPARATOR ),
@ -146,6 +161,7 @@ private:
enum ENTRY_TYPE {
ACTION,
MENU,
WXITEM,
SEPARATOR
};
@ -166,6 +182,12 @@ private:
return m_data.menu;
}
inline wxMenuItem* wxItem() const
{
assert( m_type == WXITEM );
return m_data.wxItem;
}
inline bool IsCheckmarkEntry() const
{
return m_isCheckmarkEntry;
@ -192,6 +214,7 @@ private:
union {
const TOOL_ACTION* action;
ACTION_MENU* menu;
wxMenuItem* wxItem;
} m_data;
///> Condition to be fulfilled to show the entry in menu.

View File

@ -296,7 +296,7 @@ private:
TREE_PROJECT_FRAME* m_LeftWin;
LAUNCHER_PANEL* m_Launcher;
wxTextCtrl* m_MessagesBox;
wxAuiToolBar* m_VToolBar; // Vertical toolbar (not used)
wxAuiToolBar* m_mainToolBar;
int m_leftWinWidth;
EDA_HOTKEY_CONFIG* m_manager_Hotkeys_Descr;

View File

@ -60,6 +60,7 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
KIWAY_HOLDER( &::Kiway )
{
m_active_project = false;
m_mainToolBar = nullptr;
m_leftWinWidth = 60;
m_manager_Hotkeys_Descr = NULL;
m_AboutTitle = "KiCad";

View File

@ -38,15 +38,11 @@ void PL_EDITOR_FRAME::ReCreateHToolbar( void )
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg;
// Standard file commands
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( wxID_NEW, wxEmptyString, KiScaledBitmap( new_page_layout_xpm, this ),
_( "New page layout design" ) );
@ -78,6 +74,7 @@ void PL_EDITOR_FRAME::ReCreateHToolbar( void )
KiScaledBitmap( redo_xpm, this ), _( "Redo" ) );
// Standard Zoom controls:
// JEY TODO: move to COMMON_TOOLS....
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Redraw view" ), PlEditorHotkeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
@ -161,8 +158,8 @@ void PL_EDITOR_FRAME::ReCreateVToolbar( void )
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString,

View File

@ -197,8 +197,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
// Option toolbar:
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar )
EVT_UPDATE_UI( ID_GEN_IMPORT_GRAPHICS_FILE, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
@ -282,6 +280,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
initLibraryTree();
m_treePane = new FOOTPRINT_TREE_PANE( this );
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();
// ReCreateMenuBar(); // UseGalCanvas() will do this for us.
ReCreateHToolbar();
ReCreateVToolbar();
@ -318,8 +319,6 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
// Create the manager and dispatcher & route draw panel events to the dispatcher
setupTools();
GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
UseGalCanvas( m_canvasType != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
@ -613,10 +612,6 @@ void FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar( wxUpdateUIEvent& aEvent )
state = displ_opts->m_ContrastModeDisplay;
break;
case ID_MODEDIT_SHOW_HIDE_SEARCH_TREE:
state = IsSearchTreeShown();
break;
default:
wxMessageBox( "FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar error" );
break;
@ -1023,7 +1018,7 @@ void FOOTPRINT_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new EDIT_TOOL );
m_toolManager->RegisterTool( new PAD_TOOL );
m_toolManager->RegisterTool( new DRAWING_TOOL );
m_toolManager->RegisterTool( new EE_POINT_EDITOR );
m_toolManager->RegisterTool( new POINT_EDITOR );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new MODULE_EDITOR_TOOLS );
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );

View File

@ -494,6 +494,8 @@ public:
void KiwayMailIn( KIWAY_EXPRESS& mail ) override;
void SyncMenusAndToolbars() override;
DECLARE_EVENT_TABLE()
protected:

View File

@ -181,19 +181,9 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
// Menu bar is not mandatory: uncomment/comment the next line
// to add/remove the menubar
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateLibraryList();
UpdateTitle();
// Create GAL canvas
PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(),
LoadCanvasTypeSetting() );
auto drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(), LoadCanvasTypeSetting() );
SetGalCanvas( drawPanel );
// Create the manager and dispatcher & route draw panel events to the dispatcher
@ -205,11 +195,18 @@ FOOTPRINT_VIEWER_FRAME::FOOTPRINT_VIEWER_FRAME( KIWAY* aKiway, wxWindow* aParent
drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new SELECTION_TOOL );
m_toolManager->RegisterTool( new COMMON_TOOLS ); // for std context menus (zoom & grid)
m_toolManager->InitTools();
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateLibraryList();
UpdateTitle();
// If a footprint was previously loaded, reload it
if( getCurNickname().size() && getCurFootprintName().size() )
{

View File

@ -74,26 +74,14 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
EVT_ACTIVATE( FOOTPRINT_WIZARD_FRAME::OnActivate )
// Toolbar events
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD,
FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
EVT_TOOL( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT,
FOOTPRINT_WIZARD_FRAME::DefaultParameters )
EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT,
FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS,
FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE,
FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW,
FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
EVT_TOOL( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, FOOTPRINT_WIZARD_FRAME::SelectCurrentWizard )
EVT_TOOL( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, FOOTPRINT_WIZARD_FRAME::DefaultParameters )
EVT_TOOL( ID_FOOTPRINT_WIZARD_NEXT, FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
EVT_TOOL( ID_FOOTPRINT_WIZARD_PREVIOUS, FOOTPRINT_WIZARD_FRAME::Process_Special_Functions )
EVT_TOOL( ID_FOOTPRINT_WIZARD_DONE, FOOTPRINT_WIZARD_FRAME::ExportSelectedFootprint )
EVT_TOOL( ID_FOOTPRINT_WIZARD_SHOW_3D_VIEW, FOOTPRINT_WIZARD_FRAME::Show3D_Frame )
// listbox events
EVT_LISTBOX( ID_FOOTPRINT_WIZARD_PAGE_LIST, FOOTPRINT_WIZARD_FRAME::ClickOnPageList )
EVT_GRID_CMD_CELL_CHANGED( ID_FOOTPRINT_WIZARD_PARAMETER_LIST,
FOOTPRINT_WIZARD_FRAME::ParametersUpdated )
@ -102,27 +90,16 @@ BEGIN_EVENT_TABLE( FOOTPRINT_WIZARD_FRAME, EDA_DRAW_FRAME )
END_EVENT_TABLE()
/* Note: our FOOTPRINT_WIZARD_FRAME is always modal.
* Note:
* On windows, when the frame with type wxFRAME_FLOAT_ON_PARENT is displayed
* its parent frame is sometimes brought to the foreground when closing the
* LIB_VIEW_FRAME frame.
* If it still happens, it could be better to use wxSTAY_ON_TOP
* instead of wxFRAME_FLOAT_ON_PARENT
*/
#ifdef __WINDOWS__
#define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT // could be wxSTAY_ON_TOP if issues
#else
#define MODAL_MODE_EXTRASTYLE wxFRAME_FLOAT_ON_PARENT
#endif
// Note: our FOOTPRINT_WIZARD_FRAME is always modal.
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
wxWindow* aParent, FRAME_T aFrameType ) :
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize,
aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | MODAL_MODE_EXTRASTYLE
: KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
FOOTPRINT_WIZARD_FRAME_NAME ), m_wizardListShown( false )
FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway, wxWindow* aParent,
FRAME_T aFrameType ) :
PCB_BASE_FRAME( aKiway, aParent, aFrameType, _( "Footprint Wizard" ),
wxDefaultPosition, wxDefaultSize,
aParent ? KICAD_DEFAULT_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT
: KICAD_DEFAULT_DRAWFRAME_STYLE | wxSTAY_ON_TOP,
FOOTPRINT_WIZARD_FRAME_NAME ),
m_wizardListShown( false )
{
wxASSERT( aFrameType == FRAME_PCB_FOOTPRINT_WIZARD );
@ -158,9 +135,7 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
PCB_BASE_FRAME* caller = dynamic_cast<PCB_BASE_FRAME*>( aParent );
if( caller )
{
SetUserUnits( caller->GetUserUnits() );
}
auto disp_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
// In viewer, the default net clearance is not known (it depends on the actual board).
@ -174,9 +149,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
ReCreateHToolbar();
ReCreateVToolbar();
// Create GAL canvas
#ifdef __WXMAC__
// Cairo renderer doesn't handle Retina displays
@ -188,6 +160,26 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
GetGalDisplayOptions(), backend );
SetGalCanvas( gal_drawPanel );
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
gal_drawPanel->GetViewControls(), this );
m_actions = new PCB_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->InitTools();
// Run the control tool, it is supposed to be always active
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
// Create the toolbars
ReCreateHToolbar();
ReCreateVToolbar();
// Create the parameters panel
m_parametersPanel = new wxPanel( this, wxID_ANY );
@ -234,22 +226,6 @@ FOOTPRINT_WIZARD_FRAME::FOOTPRINT_WIZARD_FRAME( KIWAY* aKiway,
m_auimgr.AddPane( (wxWindow*) GetGalCanvas(),
wxAuiPaneInfo().Name( "DrawFrameGal" ).CentrePane().Hide() );
// Create the manager and dispatcher & route draw panel events to the dispatcher
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( GetBoard(), gal_drawPanel->GetView(),
gal_drawPanel->GetViewControls(), this );
m_actions = new PCB_ACTIONS();
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
gal_drawPanel->SetEventDispatcher( m_toolDispatcher );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new SELECTION_TOOL ); // for std context menus (zoom & grid)
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->InitTools();
// Run the control tool, it is supposed to be always active
m_toolManager->InvokeTool( "pcbnew.InteractiveSelection" );
auto& galOpts = GetGalDisplayOptions();
galOpts.m_fullscreenCursor = true;
galOpts.m_forceDisplayCursor = true;
@ -453,11 +429,11 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
return;
// Get the list of names, values, types, hints and designators
wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
wxArrayString designatorsList = footprintWizard->GetParameterDesignators( m_parameterGridPage );
wxArrayString namesList = footprintWizard->GetParameterNames( m_parameterGridPage );
wxArrayString valuesList = footprintWizard->GetParameterValues( m_parameterGridPage );
wxArrayString typesList = footprintWizard->GetParameterTypes( m_parameterGridPage );
wxArrayString hintsList = footprintWizard->GetParameterHints( m_parameterGridPage );
// Dimension the wxGrid
if( m_parameterGrid->GetNumberRows() > 0 )
@ -536,7 +512,6 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList()
void FOOTPRINT_WIZARD_FRAME::ResizeParamColumns()
{
// Parameter grid is not yet configured
if( ( m_parameterGrid == NULL ) || ( m_parameterGrid->GetNumberCols() == 0 ) )
return;
@ -559,14 +534,12 @@ void FOOTPRINT_WIZARD_FRAME::ResizeParamColumns()
void FOOTPRINT_WIZARD_FRAME::ClickOnPageList( wxCommandEvent& event )
{
int ii = m_pageList->GetSelection();
if( ii < 0 )
return;
ReCreateParameterList();
m_canvas->Refresh();
DisplayWizardInfos();
if( m_pageList->GetSelection() > 0 )
{
ReCreateParameterList();
m_canvas->Refresh();
DisplayWizardInfos();
}
}
@ -636,36 +609,6 @@ bool FOOTPRINT_WIZARD_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
switch( aHotKey )
{
case WXK_F1:
cmd.SetId( ID_KEY_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
keyHandled = true;
break;
case WXK_F2:
cmd.SetId( ID_KEY_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
keyHandled = true;
break;
case WXK_F3:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
keyHandled = true;
break;
case WXK_F4:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
keyHandled = true;
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
keyHandled = true;
break;
case ' ':
GetScreen()->m_O_Curseur = GetCrossHairPosition();
keyHandled = true;
@ -737,8 +680,8 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
if( !m_mainToolBar )
{
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_SELECT_WIZARD, wxEmptyString,
@ -746,17 +689,14 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
_( "Select wizard script to run" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT, wxEmptyString,
KiBitmap( reload_xpm ),
_( "Reset wizard parameters to default") );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Select previous parameters page" ) );
m_mainToolBar->AddTool( ID_FOOTPRINT_WIZARD_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ),
_( "Select next parameters page" ) );
@ -767,25 +707,10 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateHToolbar()
_( "Show footprint in 3D viewer" ) );
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hotkeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hotkeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hotkeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hotkeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg );
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
// The footprint wizard always can export the current footprint
m_mainToolBar->AddSeparator();

View File

@ -167,7 +167,11 @@ static EDA_HOTKEY HkAddArc( _HKI( "Draw Arc" ), HK_ADD_ARC, 'A' + GR_KB_SHIFTCTR
static EDA_HOTKEY HkAddText( _HKI( "Add Text" ), HK_ADD_TEXT, 'T' + GR_KB_SHIFTCTRL );
static EDA_HOTKEY HkAddDimension( _HKI( "Add Dimension" ), HK_ADD_DIMENSION,
'H' + GR_KB_SHIFTCTRL );
#ifdef __WXMAC__
static EDA_HOTKEY HkAddFilledZone( _HKI( "Add Filled Zone" ), HK_ADD_ZONE, 'Z' + GR_KB_ALT );
#else
static EDA_HOTKEY HkAddFilledZone( _HKI( "Add Filled Zone" ), HK_ADD_ZONE, 'Z' + GR_KB_SHIFTCTRL );
#endif
static EDA_HOTKEY HkAddFreeVia( _HKI( "Add Vias" ), HK_ADD_FREE_VIA, 'V' + GR_KB_SHIFTCTRL );
static EDA_HOTKEY HkAddKeepout( _HKI( "Add Keepout Area" ), HK_ADD_KEEPOUT, 'K' + GR_KB_SHIFTCTRL );
static EDA_HOTKEY HkAddZoneCutout( _HKI( "Add a Zone Cutout" ), HK_ADD_CUTOUT, 'C' + GR_KB_SHIFT );
@ -318,9 +322,7 @@ static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
#else
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO,
GR_KB_SHIFT + GR_KB_CTRL + 'Z',
(int) wxID_REDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z', (int) wxID_REDO );
#endif
static EDA_HOTKEY HkEditCut( _HKI( "Cut" ), HK_EDIT_CUT, GR_KB_CTRL + 'X', (int) wxID_CUT );

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -24,17 +24,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pcbnew/menubar_footprint_editor.cpp
* @brief (Re)Create the main menubar for the footprint editor
*/
#include "footprint_edit_frame.h"
#include <advanced_config.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <tool/tool_manager.h>
#include <tool/conditional_menu.h>
#include <tool/actions.h>
#include <tools/selection_tool.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "pcbnew.h"
@ -43,6 +41,7 @@
void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -165,6 +164,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
if( IsGalCanvasActive() )
{
// JEY TODO: move to ACTIONS...
text = AddHotkeyName( _( "Cu&t" ), m_hotkeysDescrList, HK_EDIT_CUT );
AddMenuItem( editMenu, ID_EDIT_CUT, text,
_( "Cuts the selected item(s) to the Clipboard" ), KiBitmap( cut_xpm ) );
@ -197,125 +197,99 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( delete_xpm ) );
//--------- View menu ----------------
wxMenu* viewMenu = new wxMenu;
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
AddMenuItem( viewMenu, ID_OPEN_MODULE_VIEWER,
_( "Footprint &Library Browser" ),
_( "Browse footprint libraries" ),
KiBitmap( modview_icon_xpm ) );
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPolarCood;
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
};
auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES;
};
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor;
};
auto sketchPadsCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPadFill;
};
auto sketchEdgesCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayModEdgeFill;
};
auto searchTreeShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsSearchTreeShown();
};
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
modview_icon_xpm, SELECTION_CONDITIONS::ShowAlways );
text = AddHotkeyName( _( "&3D Viewer" ), m_hotkeysDescrList, HK_3D_VIEWER );
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME,
text, _( "Show footprint in 3D viewer" ),
KiBitmap( three_d_xpm ) );
viewMenu->AddItem( ID_MENU_PCB_SHOW_3D_FRAME,
text, _( "Show footprint in 3D viewer" ),
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
* we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
* events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
* zoom in and out from hotkeys are equivalent to the pop up menu zoom
* From here, zooming is made around the screen center
* From hotkeys, zooming is made around the mouse cursor position
* (obviously not possible from the toolbar or menubar command)
*
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus
*/
text = AddHotkeyName( _( "Zoom &In" ), m_hotkeysDescrList,
HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
text = AddHotkeyName( _( "Zoom &Out" ), m_hotkeysDescrList,
HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
text = AddHotkeyName( _( "&Zoom to Fit" ), m_hotkeysDescrList,
HK_ZOOM_AUTO );
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, _( "Zoom to fit footprint" ),
KiBitmap( zoom_fit_in_page_xpm ) );
text = AddHotkeyName( _( "Zoom to Selection" ), m_hotkeysDescrList, HK_ZOOM_SELECTION );
AddMenuItem( viewMenu, ID_ZOOM_SELECTION, text, KiBitmap( zoom_area_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "&Redraw" ), m_hotkeysDescrList, HK_ZOOM_REDRAW );
AddMenuItem( viewMenu, ID_ZOOM_REDRAW, text,
HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_GRID,
_( "Show &Grid" ), wxEmptyString,
KiBitmap( grid_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, ID_PCB_USER_GRID_SETUP,
_( "Grid &Settings..." ),_( "Adjust custom user-defined grid dimensions" ),
KiBitmap( grid_xpm ) );
AddMenuItem( viewMenu, ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
KiBitmap( polar_coord_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
// Units submenu
wxMenu* unitsSubMenu = new wxMenu;
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH,
_( "&Imperial" ), _( "Use imperial units" ),
KiBitmap( unit_inch_xpm ), wxITEM_RADIO );
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM,
_( "&Metric" ), _( "Use metric units" ),
KiBitmap( unit_mm_xpm ), wxITEM_RADIO );
AddMenuItem( viewMenu, unitsSubMenu,
-1, _( "&Units" ),
_( "Select which units are displayed" ),
KiBitmap( unit_mm_xpm ) );
#ifndef __APPLE__
AddMenuItem( viewMenu, ID_TB_OPTIONS_SELECT_CURSOR,
_( "Full Window Crosshair" ),
_( "Change cursor shape" ),
KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
#else
AddMenuItem( viewMenu, ID_TB_OPTIONS_SELECT_CURSOR,
_( "Full Window Crosshair" ),
_( "Change cursor shape (not supported in Legacy Toolset)" ),
KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
#endif
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AppendSeparator();
viewMenu->AddSeparator();
// Drawing Mode Submenu
wxMenu* drawingModeSubMenu = new wxMenu;
CONDITIONAL_MENU* drawingModeSubMenu = new CONDITIONAL_MENU( false, selTool );
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
drawingModeSubMenu->SetIcon( add_zone_xpm );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
KiBitmap( pad_sketch_xpm ), wxITEM_CHECK );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
pad_sketch_xpm, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
_( "Sketch Footprint &Edges" ), _( "Show footprint edges in outline mode" ),
show_mod_edge_xpm, sketchEdgesCondition );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
_( "Sketch Footprint &Edges" ), _( "Show footprint edges in outline mode" ),
KiBitmap( show_mod_edge_xpm ), wxITEM_CHECK );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
_( "Sketch Footprint Te&xt" ), _( "Show footprint text in outline mode" ),
KiBitmap( text_sketch_xpm ), wxITEM_CHECK );
AddMenuItem( viewMenu, drawingModeSubMenu,
-1, _( "&Drawing Mode" ),
_( "Select how items are displayed" ),
KiBitmap( add_zone_xpm ) );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
wxMenu* contrastModeSubMenu = new wxMenu;
ACTION_MENU* contrastModeSubMenu = new ACTION_MENU;
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->SetTool( selTool );
text = AddHotkeyName( _( "&High Contrast Mode" ), m_hotkeysDescrList,
HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, text,
_( "Use high contrast display mode" ),
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
text, _( "Use high contrast display mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
contrastModeSubMenu->AppendSeparator();
text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Pcbnew_Editor_Hotkeys_Descr,
HK_DEC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA,
@ -328,19 +302,14 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
text, _( "Make the current layer less transparent" ),
KiBitmap( contrast_mode_xpm ) );
AddMenuItem( viewMenu, contrastModeSubMenu,
-1, _( "&Contrast Mode" ),
_( "Select how items are displayed" ),
KiBitmap( contrast_mode_xpm ) );
viewMenu->AddMenu( contrastModeSubMenu );
// Separator
viewMenu->AppendSeparator();
AddMenuItem( viewMenu,
ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
_( "&Search Tree" ),
_( "Toggles the search tree visibility" ),
KiBitmap( search_tree_xpm ), wxITEM_CHECK );
viewMenu->AddCheckItem( ID_MODEDIT_SHOW_HIDE_SEARCH_TREE,
_( "&Search Tree" ), _( "Toggles the search tree visibility" ),
search_tree_xpm, searchTreeShownCondition );
//-------- Place menu --------------------

View File

@ -24,17 +24,17 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file menubar_pcb_editor.cpp
* board editor menubars
*/
#include <pcb_edit_frame.h>
#include <advanced_config.h>
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pgm_base.h>
#include <tool/tool_manager.h>
#include <tool/conditional_menu.h>
#include <tool/actions.h>
#include <tool/selection_conditions.h>
#include <tools/selection_tool.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "pcbnew.h"
@ -52,9 +52,6 @@ static void prepareExportMenu( wxMenu* aParentMenu );
// Build the edit menu
static void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal );
// Build the view menu
static void prepareViewMenu( wxMenu* aParentMenu, bool aUseGal );
// Build the place submenu
static void preparePlaceMenu( wxMenu* aParentMenu );
@ -79,6 +76,7 @@ static void prepareHelpMenu( wxMenu* aParentMenu );
void PCB_EDIT_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
// wxWidgets handles the Mac Application menu behind the scenes, but that means
// we always have to start from scratch with a new wxMenuBar.
wxMenuBar* oldMenuBar = GetMenuBar();
@ -96,8 +94,172 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
prepareEditMenu( editMenu, IsGalCanvasActive() );
//----- View menu -----------------------------------------------------------
wxMenu* viewMenu = new wxMenu;
prepareViewMenu( viewMenu, IsGalCanvasActive() );
CONDITIONAL_MENU* viewMenu = new CONDITIONAL_MENU( false, selTool );
auto layersPaletteShownCondition = [ this ] ( const SELECTION& aSel ) {
return LayerManagerShown();
};
auto microwaveToolbarShownCondition = [ this ] ( const SELECTION& aSel ) {
return MicrowaveToolbarShown();
};
auto gridShownCondition = [ this ] ( const SELECTION& aSel ) {
return IsGridVisible();
};
auto polarCoordsCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPolarCood;
};
auto imperialUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == INCHES;
};
auto metricUnitsCondition = [ this ] ( const SELECTION& aSel ) {
return GetUserUnits() == MILLIMETRES;
};
auto fullCrosshairCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalDisplayOptions().m_fullscreenCursor;
};
auto ratsnestShownCondition = [ this ] ( const SELECTION& aSel ) {
return GetBoard()->IsElementVisible( LAYER_RATSNEST );
};
auto curvedRatsnestCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayRatsnestLinesCurved;
};
auto boardFlippedCondition = [ this ] ( const SELECTION& aSel ) {
return GetGalCanvas()->GetView()->IsMirroredX();
};
auto zonesFilledCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayZonesMode == 0;
};
auto zonesWireframedCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayZonesMode == 1;
};
auto zonesOutlinedCondition = [ this ] ( const SELECTION& aSel ) {
return ( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayZonesMode == 2;
};
auto sketchTracksCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPcbTrackFill;
};
auto sketchViasCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayViaFill;
};
auto sketchPadsCondition = [ this ] ( const SELECTION& aSel ) {
return !( (PCB_DISPLAY_OPTIONS*) GetDisplayOptions() )->m_DisplayPadFill;
};
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
_( "Show La&yers Manager" ), HELP_SHOW_HIDE_LAYERMANAGER,
layers_manager_xpm, layersPaletteShownCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
_( "Show Microwa&ve Toolbar" ), HELP_SHOW_HIDE_MICROWAVE_TOOLS,
mw_toolbar_xpm, microwaveToolbarShownCondition );
viewMenu->AddItem( ID_OPEN_MODULE_VIEWER,
_( "Footprint &Library Browser" ), _( "Browse footprint libraries" ),
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,
text, _( "Show board in 3D viewer" ),
three_d_xpm, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddSeparator();
viewMenu->AddItem( ACTIONS::zoomInCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomOutCenter, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomFitScreen, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomTool, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddItem( ACTIONS::zoomRedraw, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AppendSeparator();
viewMenu->AddCheckItem( ACTIONS::toggleGrid, gridShownCondition );
viewMenu->AddItem( ACTIONS::gridProperties, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
polar_coord_xpm, polarCoordsCondition );
// Units submenu
CONDITIONAL_MENU* unitsSubMenu = new CONDITIONAL_MENU( false, selTool );
unitsSubMenu->SetTitle( _( "&Units" ) );
unitsSubMenu->SetIcon( unit_mm_xpm );
unitsSubMenu->AddCheckItem( ACTIONS::imperialUnits, imperialUnitsCondition );
unitsSubMenu->AddCheckItem( ACTIONS::metricUnits, metricUnitsCondition );
viewMenu->AddMenu( unitsSubMenu );
viewMenu->AddCheckItem( ACTIONS::toggleCursorStyle, fullCrosshairCondition );
viewMenu->AddSeparator();
viewMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_RATSNEST,
_( "Show Ratsnest" ), _( "Show board ratsnest" ),
general_ratsnest_xpm, ratsnestShownCondition );
viewMenu->AddCheckItem( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
_( "Curved Ratsnest Lines" ), _( "Show ratsnest with curved lines" ),
curved_ratsnest_xpm, curvedRatsnestCondition );
viewMenu->AddSeparator();
// Drawing Mode Submenu
CONDITIONAL_MENU* drawingModeSubMenu = new CONDITIONAL_MENU( false, selTool );
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
drawingModeSubMenu->SetIcon( add_zone_xpm );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES,
_( "&Fill Zones" ), _( "Show filled areas of zones" ),
show_zone_xpm, zonesFilledCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
_( "&Wireframe Zones" ), _( "Show only zone outlines" ),
show_zone_disable_xpm, zonesWireframedCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
_( "&Sketch Zones" ),
_( "Hatch outline of filled areas of zones" ) ,
show_zone_outline_only_xpm , zonesOutlinedCondition );
drawingModeSubMenu->AddSeparator();
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
pad_sketch_xpm, sketchPadsCondition );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
_( "Sketch &Vias" ), _( "Show vias in outline mode" ),
via_sketch_xpm, sketchViasCondition );
text = AddHotkeyName( _( "Sketch &Tracks" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_TRACK_DISPLAY_MODE );
drawingModeSubMenu->AddCheckItem( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
text, _( "Show tracks in outline mode" ),
showtrack_xpm, sketchTracksCondition );
viewMenu->AddMenu( drawingModeSubMenu );
// Contrast Mode Submenu
ACTION_MENU* contrastModeSubMenu = new ACTION_MENU;
contrastModeSubMenu->SetTitle( _( "&Contrast Mode" ) );
contrastModeSubMenu->SetIcon( contrast_mode_xpm );
contrastModeSubMenu->SetTool( selTool );
text = AddHotkeyName( _( "&High Contrast Mode" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
text, _( "Use high contrast display mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
contrastModeSubMenu->AppendSeparator();
text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_DEC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA,
text, _( "Make the current layer more transparent" ),
KiBitmap( contrast_mode_xpm ) );
text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_INC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA,
text, _( "Make the current layer less transparent" ),
KiBitmap( contrast_mode_xpm ) );
viewMenu->AddMenu( contrastModeSubMenu );
viewMenu->AddCheckItem( ID_MENU_PCB_FLIP_VIEW,
_( "Flip &Board View" ), _( "Flip (mirror) the board view" ),
flip_board_xpm, boardFlippedCondition );
#ifdef __APPLE__
viewMenu->AppendSeparator();
#endif
//----- Place Menu ----------------------------------------------------------
wxMenu* placeMenu = new wxMenu;
@ -458,6 +620,7 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
{
wxString text;
// JEY TODO: convert to actions (PCB_CONTROL is already ready)...
text = AddHotkeyName( _( "&Undo" ), g_Board_Editor_Hotkeys_Descr, HK_UNDO );
AddMenuItem( aParentMenu, wxID_UNDO, text, HELP_UNDO, KiBitmap( undo_xpm ) );
@ -466,6 +629,7 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
aParentMenu->AppendSeparator();
// JEY TODO: convert to actions:
if( aUseGal )
{
text = AddHotkeyName( _( "&Cut" ), g_Board_Editor_Hotkeys_Descr, HK_EDIT_CUT );
@ -539,201 +703,11 @@ void prepareEditMenu( wxMenu* aParentMenu, bool aUseGal )
// Build the view menu
void prepareViewMenu( wxMenu* aParentMenu, bool aUseGal )
void prepareViewMenu( CONDITIONAL_MENU* aParentMenu, PCB_EDIT_FRAME* aFrame )
{
wxString text;
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
_( "Show La&yers Manager" ),
HELP_SHOW_HIDE_LAYERMANAGER,
KiBitmap( layers_manager_xpm ), wxITEM_CHECK );
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
_( "Show Microwa&ve Toolbar" ),
HELP_SHOW_HIDE_MICROWAVE_TOOLS,
KiBitmap( mw_toolbar_xpm ), wxITEM_CHECK );
AddMenuItem( aParentMenu, ID_OPEN_MODULE_VIEWER,
_( "Footprint &Library Browser" ),
_( "Browse footprint libraries" ),
KiBitmap( modview_icon_xpm ) );
text = AddHotkeyName( _( "&3D Viewer" ), g_Board_Editor_Hotkeys_Descr, HK_3D_VIEWER );
AddMenuItem( aParentMenu, ID_MENU_PCB_SHOW_3D_FRAME,
text, _( "Show board in 3D viewer" ),
KiBitmap( three_d_xpm ) );
aParentMenu->AppendSeparator();
/* Important Note for ZOOM IN and ZOOM OUT commands from menubar:
* we cannot add hotkey info here, because the hotkey HK_ZOOM_IN and HK_ZOOM_OUT
* events(default = WXK_F1 and WXK_F2) are *NOT* equivalent to this menu command:
* zoom in and out from hotkeys are equivalent to the pop up menu zoom
* From here, zooming is made around the screen center
* From hotkeys, zooming is made around the mouse cursor position
* (obviously not possible from the toolbar or menubar command)
*
* in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus
*/
text = AddHotkeyName( _( "Zoom &In" ), g_Board_Editor_Hotkeys_Descr,
HK_ZOOM_IN, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_ZOOM_IN, text, HELP_ZOOM_IN, KiBitmap( zoom_in_xpm ) );
text = AddHotkeyName( _( "Zoom &Out" ), g_Board_Editor_Hotkeys_Descr,
HK_ZOOM_OUT, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
text = AddHotkeyName( _( "Zoom to &Fit" ), g_Board_Editor_Hotkeys_Descr,
HK_ZOOM_AUTO );
AddMenuItem( aParentMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
KiBitmap( zoom_fit_in_page_xpm ) );
text = AddHotkeyName( _( "Zoom to Selection" ), g_Board_Editor_Hotkeys_Descr,
HK_ZOOM_SELECTION );
AddMenuItem( aParentMenu, ID_ZOOM_SELECTION, text, KiBitmap( zoom_area_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "&Redraw" ), g_Board_Editor_Hotkeys_Descr, HK_ZOOM_REDRAW );
AddMenuItem( aParentMenu, ID_ZOOM_REDRAW, text,
HELP_ZOOM_REDRAW, KiBitmap( zoom_redraw_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_GRID,
_( "Show &Grid" ), wxEmptyString,
KiBitmap( grid_xpm ), wxITEM_CHECK );
AddMenuItem( aParentMenu, ID_PCB_USER_GRID_SETUP,
_( "Grid &Settings..." ),_( "Adjust custom user-defined grid dimensions" ),
KiBitmap( grid_xpm ) );
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_POLAR_COORD,
_( "Display &Polar Coordinates" ), wxEmptyString,
KiBitmap( polar_coord_xpm ), wxITEM_CHECK );
// Units submenu
wxMenu* unitsSubMenu = new wxMenu;
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_INCH,
_( "&Imperial" ), _( "Use imperial units" ),
KiBitmap( unit_inch_xpm ), wxITEM_RADIO );
AddMenuItem( unitsSubMenu, ID_TB_OPTIONS_SELECT_UNIT_MM,
_( "&Metric" ), _( "Use metric units" ),
KiBitmap( unit_mm_xpm ), wxITEM_RADIO );
AddMenuItem( aParentMenu, unitsSubMenu, -1, _( "&Units" ),
_( "Select which units are displayed" ),
KiBitmap( unit_mm_xpm ) );
#ifndef __APPLE__
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR,
_( "Full Window Crosshair" ),
_( "Change cursor shape" ),
KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
#else
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SELECT_CURSOR,
_( "Full Window Crosshair" ),
_( "Change cursor shape (not supported in Legacy Toolset)" ),
KiBitmap( cursor_shape_xpm ), wxITEM_CHECK );
#endif
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_TB_OPTIONS_SHOW_RATSNEST,
_( "Show Ratsnest" ),
_( "Show board ratsnest" ),
KiBitmap( general_ratsnest_xpm ), wxITEM_CHECK );
AddMenuItem( aParentMenu, ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
_( "Curved Ratsnest Lines" ),
_( "Show ratsnest with curved lines" ),
KiBitmap( curved_ratsnest_xpm ), wxITEM_CHECK );
aParentMenu->AppendSeparator();
// Drawing Mode Submenu
wxMenu* drawingModeSubMenu = new wxMenu;
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES,
_( "&Fill Zones" ), _( "Show filled areas in zones" ),
KiBitmap( show_zone_xpm ), wxITEM_RADIO );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
_( "&Wireframe Zones" ), _( "Show outlines of filled areas only in zones" ),
KiBitmap( show_zone_disable_xpm ), wxITEM_RADIO );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
_( "&Sketch Zones" ), _( "Do not show filled areas in zones" ),
KiBitmap( show_zone_outline_only_xpm ), wxITEM_RADIO );
drawingModeSubMenu->AppendSeparator();
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_PADS_SKETCH,
_( "Sketch &Pads" ), _( "Show pads in outline mode" ),
KiBitmap( pad_sketch_xpm ), wxITEM_CHECK );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
_( "Sketch &Vias" ), _( "Show vias in outline mode" ),
KiBitmap( via_sketch_xpm ), wxITEM_CHECK );
text = AddHotkeyName( _( "Sketch &Tracks" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_TRACK_DISPLAY_MODE );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, text,
_( "Show tracks in outline mode" ),
KiBitmap( showtrack_xpm ), wxITEM_CHECK );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH,
_( "Sketch &Graphic Items" ), _( "Show graphic items in outline mode" ),
KiBitmap( text_sketch_xpm ), wxITEM_CHECK );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH,
_( "Sketch Footprint &Edges" ), _( "Show footprint edges in outline mode" ),
KiBitmap( show_mod_edge_xpm ), wxITEM_CHECK );
AddMenuItem( drawingModeSubMenu, ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH,
_( "Sketch Footprint Te&xt" ), _( "Show footprint text in outline mode" ),
KiBitmap( text_sketch_xpm ), wxITEM_CHECK );
AddMenuItem( aParentMenu, drawingModeSubMenu,
-1, _( "&Drawing Mode" ),
_( "Select how items are displayed" ),
KiBitmap( add_zone_xpm ) );
// Contrast Mode Submenu
wxMenu* contrastModeSubMenu = new wxMenu;
text = AddHotkeyName( _( "&High Contrast Mode" ), g_Board_Editor_Hotkeys_Descr,
HK_SWITCH_HIGHCONTRAST_MODE );
AddMenuItem( contrastModeSubMenu, ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
text, _( "Use high contrast display mode" ),
KiBitmap( contrast_mode_xpm ), wxITEM_CHECK );
contrastModeSubMenu->AppendSeparator();
text = AddHotkeyName( _( "&Decrease Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_DEC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_DEC_LAYER_ALPHA,
text, _( "Make the current layer more transparent" ),
KiBitmap( contrast_mode_xpm ) );
text = AddHotkeyName( _( "&Increase Layer Opacity" ), g_Board_Editor_Hotkeys_Descr,
HK_INC_LAYER_ALPHA );
AddMenuItem( contrastModeSubMenu, ID_INC_LAYER_ALPHA,
text, _( "Make the current layer less transparent" ),
KiBitmap( contrast_mode_xpm ) );
AddMenuItem( aParentMenu, contrastModeSubMenu,
-1, _( "&Contrast Mode" ),
_( "Select how items are displayed" ),
KiBitmap( contrast_mode_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_FLIP_VIEW,
_( "Flip &Board View" ),
_( "Flip (mirror) the board view" ),
KiBitmap( flip_board_xpm ), wxITEM_CHECK );
#ifdef __APPLE__
aParentMenu->AppendSeparator();
#endif
}

View File

@ -101,6 +101,7 @@ public:
*/
void SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsList, UNDO_REDO_T aTypeCommand,
const wxPoint& aTransformPoint = wxPoint( 0, 0 ) ) override;
/**
* Function RestoreCopyFromRedoList
* Redo the last edit:

View File

@ -88,10 +88,6 @@ BEGIN_EVENT_TABLE( PCB_BASE_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnToggleTextDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_POLAR_COORD, PCB_BASE_FRAME::OnUpdateCoordType )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_PADS_SKETCH, PCB_BASE_FRAME::OnUpdatePadDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_GRAPHIC_SKETCH, PCB_BASE_FRAME::OnUpdateGraphicDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, PCB_BASE_FRAME::OnUpdateEdgeDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, PCB_BASE_FRAME::OnUpdateTextDrawMode )
EVT_UPDATE_UI( ID_ON_GRID_SELECT, PCB_BASE_FRAME::OnUpdateSelectGrid )
EVT_UPDATE_UI( ID_ON_ZOOM_SELECT, PCB_BASE_FRAME::OnUpdateSelectZoom )
// Switching canvases
@ -645,50 +641,6 @@ void PCB_BASE_FRAME::OnUpdateCoordType( wxUpdateUIEvent& aEvent )
}
void PCB_BASE_FRAME::OnUpdatePadDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayPadFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_PADS_SKETCH,
displ_opts->m_DisplayPadFill ?
_( "Show pads in outline mode" ) :
_( "Show pads in fill mode" ) );
}
void PCB_BASE_FRAME::OnUpdateGraphicDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayDrawItemsFill);
}
void PCB_BASE_FRAME::OnUpdateEdgeDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayModEdgeFill );
wxString msgEdgesFill[2] = { _( "Show outlines in filled mode" ),
_( "Show outlines in sketch mode" ) };
unsigned i = displ_opts->m_DisplayModTextFill == SKETCH ? 0 : 1;
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, msgEdgesFill[i] );
}
void PCB_BASE_FRAME::OnUpdateTextDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayModTextFill );
wxString msgTextsFill[2] = { _( "Show texts in filled mode" ),
_( "Show texts in sketch mode" ) };
unsigned i = displ_opts->m_DisplayModTextFill == SKETCH ? 0 : 1;
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, msgTextsFill[i] );
}
void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
{
if( m_zoomSelectBox == NULL || m_zoomSelectBox->GetParent() == NULL )

View File

@ -69,6 +69,7 @@
#include <tool/zoom_tool.h>
#include <tools/selection_tool.h>
#include <tools/picker_tool.h>
#include <tools/point_editor.h>
#include <tools/edit_tool.h>
#include <tools/drawing_tool.h>
#include <tools/point_editor.h>
@ -233,20 +234,14 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
#endif
// Option toolbar
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_RATSNEST,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
@ -284,16 +279,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_TB_OPTIONS_DRC_OFF, PCB_EDIT_FRAME::OnUpdateDrcEnable )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_RATSNEST, PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, PCB_EDIT_FRAME::OnUpdateViaDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_CURVED_RATSNEST_LINES, PCB_EDIT_FRAME::OnUpdateCurvedRatsnest )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, PCB_EDIT_FRAME::OnUpdateTraceDrawMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
PCB_EDIT_FRAME::OnUpdateShowLayerManager )
EVT_UPDATE_UI( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
@ -338,10 +325,9 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_AboutTitle = "Pcbnew";
// Create GAL canvas
EDA_DRAW_PANEL_GAL* galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ),
m_FrameSize,
GetGalDisplayOptions(),
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
auto galCanvas = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
GetGalDisplayOptions(),
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
SetGalCanvas( galCanvas );
@ -374,6 +360,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
if( m_canvas )
m_canvas->SetEnableBlockCommands( true );
setupTools();
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
@ -410,8 +397,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_auimgr.Update();
setupTools();
Zoom_Automatique( false );
m_canvasType = LoadCanvasTypeSetting();
@ -579,7 +564,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new EDIT_TOOL );
m_toolManager->RegisterTool( new PAD_TOOL );
m_toolManager->RegisterTool( new DRAWING_TOOL );
m_toolManager->RegisterTool( new EE_POINT_EDITOR );
m_toolManager->RegisterTool( new POINT_EDITOR );
m_toolManager->RegisterTool( new PCBNEW_CONTROL );
m_toolManager->RegisterTool( new PCB_EDITOR_CONTROL );
m_toolManager->RegisterTool( new ALIGN_DISTRIBUTE_TOOL );
@ -753,10 +738,6 @@ void PCB_EDIT_FRAME::enableGALSpecificMenus()
if( GetMenuBar()->FindItem( id ) )
GetMenuBar()->FindItem( id )->Enable( enable );
}
// Update settings for GAL menus
auto view = GetGalCanvas()->GetView();
GetMenuBar()->FindItem( ID_MENU_PCB_FLIP_VIEW )->Check( view->IsMirroredX() );
}
}

View File

@ -348,22 +348,17 @@ public:
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
void OnUpdateDrcEnable( wxUpdateUIEvent& aEvent );
void OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent );
void OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent );
void OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent );
void OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent );
bool LayerManagerShown();
bool MicrowaveToolbarShown();
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
void OnLayerColorChange( wxCommandEvent& aEvent );
void OnConfigurePaths( wxCommandEvent& aEvent );
void OnUpdatePCBFromSch( wxCommandEvent& event );
void OnRunEeschema( wxCommandEvent& event );
void OnUpdateCurvedRatsnest( wxUpdateUIEvent& aEvent );
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true );
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true );

View File

@ -172,8 +172,6 @@ enum pcbnew_ids
ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,
ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE,
ID_POPUP_PCB_DISPLAY_FOOTPRINT_DOC,
ID_POPUP_PCB_MOVE_TRACK_NODE,
ID_POPUP_PCB_BREAK_TRACK,

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@ -20,13 +20,8 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file tool_footprint_editor.cpp
* @brief methods to build Footprint Editor toolbars
*/
#include <fctsys.h>
#include <tool/actions.h>
#include <pcbnew.h>
#include <footprint_edit_frame.h>
#include <dialog_helpers.h>
@ -47,8 +42,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg;
@ -87,22 +82,12 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ),
_( "Redo last undo command" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Refresh libraries and redraw view" ), g_Module_Editor_Hotkeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hotkeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString,
@ -159,8 +144,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
@ -214,30 +199,20 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
if( m_optionsToolBar )
m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiScaledBitmap( grid_xpm, this ),
_( "Hide grid" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display Polar Coord ON" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show Pads Sketch" ), wxITEM_CHECK );
@ -264,3 +239,17 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
}
void FOOTPRINT_EDIT_FRAME::SyncMenusAndToolbars()
{
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, !opts->m_DisplayPadFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, !opts->m_DisplayModTextFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, !opts->m_DisplayModEdgeFill );
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
m_optionsToolBar->Refresh();
}

View File

@ -23,7 +23,7 @@
#include <dialog_helpers.h>
#include <macros.h>
#include <menus_helpers.h>
#include <tool/actions.h>
#include "help_common_strings.h"
#include "hotkeys.h"
#include "footprint_viewer_frame.h"
@ -45,8 +45,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_PART, wxEmptyString,
@ -54,45 +54,28 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
_( "Select footprint to browse" ) );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODVIEW_OPTIONS, wxEmptyString,
KiScaledBitmap( config_xpm, this ),
_( "Display options" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_MODVIEW_PREVIOUS, wxEmptyString,
KiScaledBitmap( lib_previous_xpm, this ),
_( "Display previous footprint" ) );
m_mainToolBar->AddTool( ID_MODVIEW_NEXT, wxEmptyString,
KiScaledBitmap( lib_next_xpm, this ),
_( "Display next footprint" ) );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_REDRAW );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_IN, wxEmptyString,
KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_OUT, wxEmptyString,
KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom to fit" ), g_Module_Viewer_Hotkeys_Descr, HK_ZOOM_AUTO );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODVIEW_SHOW_3D_VIEW, wxEmptyString,
KiScaledBitmap( three_d_xpm, this ),
_( "Show footprint in 3D viewer" ) );
m_mainToolBar->AddTool( ID_ADD_FOOTPRINT_TO_BOARD, wxEmptyString,
KiScaledBitmap( export_xpm, this ),
_( "Insert footprint in board" ) );

View File

@ -24,11 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file tool_pcb_editor.cpp
* @brief PCB editor toolbars build/rebuild functions
*/
#include <fctsys.h>
#include <kiface_i.h>
#include <help_common_strings.h>
@ -37,9 +32,8 @@
#include <class_drawpanel.h>
#include <confirm.h>
#include <bitmaps.h>
#include <class_board.h>
#include <tool/actions.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
@ -246,8 +240,8 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new ACTION_TOOLBAR( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
#define ADD_TOOL( id, xpm, tooltip ) \
m_mainToolBar->AddTool( id, wxEmptyString, KiScaledBitmap( xpm, this ), tooltip );
@ -279,18 +273,12 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hotkeys_Descr, HK_FIND_ITEM, IS_COMMENT );
ADD_TOOL( ID_FIND_ITEMS, find_xpm, msg );
KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
ADD_TOOL( ID_ZOOM_REDRAW, zoom_redraw_xpm, msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_IN, IS_COMMENT );
ADD_TOOL( ID_ZOOM_IN, zoom_in_xpm, msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
ADD_TOOL( ID_ZOOM_OUT, zoom_out_xpm, msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hotkeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
ADD_TOOL( ID_ZOOM_PAGE, zoom_fit_in_page_xpm, msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator();
m_mainToolBar->Add( ACTIONS::zoomRedraw );
m_mainToolBar->Add( ACTIONS::zoomInCenter );
m_mainToolBar->Add( ACTIONS::zoomOutCenter );
m_mainToolBar->Add( ACTIONS::zoomFitScreen );
m_mainToolBar->Add( ACTIONS::zoomTool, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_mainToolBar, this );
ADD_TOOL( ID_OPEN_MODULE_EDITOR, module_editor_xpm, _( "Open footprint editor" ) );
@ -355,33 +343,21 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
if( m_optionsToolBar )
m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new ACTION_TOOLBAR( this, ID_OPT_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiScaledBitmap( drc_off_xpm, this ),
_( "Enable design rule checking" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
_( "Hide grid" ), wxITEM_CHECK );
m_optionsToolBar->Add( ACTIONS::toggleGrid, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
#else
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape (not supported in Legacy Toolset)" ),
wxITEM_CHECK );
#endif
m_optionsToolBar->Add( ACTIONS::imperialUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::metricUnits, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( ACTIONS::toggleCursorStyle, ACTION_TOOLBAR::TOGGLE );
KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
@ -447,8 +423,8 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_drawToolBar = new ACTION_TOOLBAR( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
@ -594,8 +570,9 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
return;
}
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_auxiliaryToolBar = new ACTION_TOOLBAR( this, ID_AUX_TOOLBAR,
wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
/* Set up toolbar items */

View File

@ -24,11 +24,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file toolbars_update_user_interface.cpp
* @brief Function to update toolbars UI after changing parameters.
*/
#include <fctsys.h>
#include <pgm_base.h>
#include <class_drawpanel.h>
@ -37,6 +32,7 @@
#include <class_board.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <tool/actions.h>
#include <drc.h>
#include <pcb_layer_box_selector.h>
@ -89,12 +85,6 @@ void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
#endif
void PCB_EDIT_FRAME::OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent )
{
}
void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
{
bool state = !Settings().m_legacyDrcOn;
@ -105,38 +95,6 @@ void PCB_EDIT_FRAME::OnUpdateDrcEnable( wxUpdateUIEvent& aEvent )
_( "Enable design rule checking while routing/editing tracks using Legacy Toolset.\nUse Route > Interactive Router Settings... for Modern Toolset." ) );
}
void PCB_EDIT_FRAME::OnUpdateShowBoardRatsnest( wxUpdateUIEvent& aEvent )
{
aEvent.Check( GetBoard()->IsElementVisible( LAYER_RATSNEST ) );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_RATSNEST,
GetBoard()->IsElementVisible( LAYER_RATSNEST ) ?
_( "Hide board ratsnest" ) :
_( "Show board ratsnest" ) );
}
void PCB_EDIT_FRAME::OnUpdateViaDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayViaFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_VIAS_SKETCH,
displ_opts->m_DisplayViaFill ?
_( "Show vias in outline mode" ) :
_( "Show vias in fill mode" ) );
}
void PCB_EDIT_FRAME::OnUpdateTraceDrawMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( !displ_opts->m_DisplayPcbTrackFill );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH,
displ_opts->m_DisplayPcbTrackFill ?
_( "Show tracks in outline mode" ) :
_( "Show tracks in fill mode" ) );
}
void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
@ -147,25 +105,14 @@ void PCB_EDIT_FRAME::OnUpdateHighContrastDisplayMode( wxUpdateUIEvent& aEvent )
_( "High contrast display mode" ) );
}
void PCB_EDIT_FRAME::OnUpdateCurvedRatsnest( wxUpdateUIEvent& aEvent )
bool PCB_EDIT_FRAME::LayerManagerShown()
{
auto displ_opts = (PCB_DISPLAY_OPTIONS*)GetDisplayOptions();
aEvent.Check( displ_opts->m_DisplayRatsnestLinesCurved );
m_optionsToolBar->SetToolShortHelp( ID_TB_OPTIONS_CURVED_RATSNEST_LINES,
!displ_opts->m_DisplayRatsnestLinesCurved ?
_( "Show ratsnest with curved lines" ) :
_( "Show ratsnest with straight lines" ) );
return m_auimgr.GetPane( "LayersManager" ).IsShown();
}
void PCB_EDIT_FRAME::OnUpdateShowLayerManager( wxUpdateUIEvent& aEvent )
bool PCB_EDIT_FRAME::MicrowaveToolbarShown()
{
aEvent.Check( m_auimgr.GetPane( "LayersManager" ).IsShown() );
}
void PCB_EDIT_FRAME::OnUpdateShowMicrowaveToolbar( wxUpdateUIEvent& aEvent )
{
aEvent.Check( m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown() );
return m_auimgr.GetPane( "MicrowaveToolbar" ).IsShown();
}
@ -190,42 +137,19 @@ void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent )
void PCB_EDIT_FRAME::SyncMenusAndToolbars()
{
PCB_DISPLAY_OPTIONS* displOpts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
wxMenuBar* menuBar = GetMenuBar();
PCB_DISPLAY_OPTIONS* opts = (PCB_DISPLAY_OPTIONS*) GetDisplayOptions();
int zoneMode = opts->m_DisplayZonesMode;
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, false );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, false );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, false );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, zoneMode == 0 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, zoneMode == 1 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, zoneMode == 2 );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, !opts->m_DisplayPcbTrackFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, !opts->m_DisplayViaFill );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, !opts->m_DisplayPadFill );
switch( displOpts->m_DisplayZonesMode )
{
case 0:
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES )->Check( true );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES, true );
break;
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );
m_optionsToolBar->Toggle( ACTIONS::metricUnits, GetUserUnits() != INCHES );
m_optionsToolBar->Toggle( ACTIONS::imperialUnits, GetUserUnits() == INCHES );
case 1:
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES_DISABLE )->Check( true );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, true );
break;
case 2:
menuBar->FindItem( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY )->Check( true );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, true );
break;
}
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, false );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, false );
if( GetUserUnits() == INCHES )
{
menuBar->FindItem( ID_TB_OPTIONS_SELECT_UNIT_INCH )->Check( true );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, true );
}
else
{
menuBar->FindItem( ID_TB_OPTIONS_SELECT_UNIT_MM )->Check( true );
m_optionsToolBar->ToggleTool( ID_TB_OPTIONS_SELECT_UNIT_MM, true );
}
m_optionsToolBar->Refresh();
}

View File

@ -151,16 +151,6 @@ TOOL_ACTION PCB_ACTIONS::measureTool( "pcbnew.InteractiveEdit.measureTool",
_( "Measuring Tool" ), _( "Interactively measure distance between points" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::copyToClipboard( "pcbnew.InteractiveEdit.CopyToClipboard",
AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
_( "Copy" ), _( "Copy selected content to clipboard" ),
copy_xpm );
TOOL_ACTION PCB_ACTIONS::cutToClipboard( "pcbnew.InteractiveEdit.CutToClipboard",
AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
_( "Cut" ), _( "Cut selected content to clipboard" ),
cut_xpm );
TOOL_ACTION PCB_ACTIONS::updateUnits( "pcbnew.InteractiveEdit.updateUnits",
AS_GLOBAL, 0,
"", "" );
@ -270,11 +260,11 @@ bool EDIT_TOOL::Init()
menu.AddSeparator( SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::cutToClipboard, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( PCB_ACTIONS::copyToClipboard, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( ACTIONS::cut, SELECTION_CONDITIONS::NotEmpty );
menu.AddItem( ACTIONS::copy, SELECTION_CONDITIONS::NotEmpty );
// Selection tool handles the context menu for some other tools, such as the Picker.
// Don't add things like Paste when another tool is active.
menu.AddItem( PCB_ACTIONS::pasteFromClipboard, noActiveToolCondition );
menu.AddItem( ACTIONS::paste, noActiveToolCondition );
// Mirror only available in modedit
menu.AddSeparator( editingModuleCondition && SELECTION_CONDITIONS::NotEmpty );
@ -1374,33 +1364,6 @@ int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
}
void EDIT_TOOL::setTransitions()
{
Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicate.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
Go( &EDIT_TOOL::CreateArray,PCB_ACTIONS::createArray.MakeEvent() );
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::editFootprintInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::exchangeFootprints.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, PCB_ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, PCB_ACTIONS::copyToClipboard.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, PCB_ACTIONS::cutToClipboard.MakeEvent() );
}
bool EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
{
if( m_dragging && aSelection.HasReferencePoint() )
@ -1558,3 +1521,33 @@ int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent )
return 0;
}
void EDIT_TOOL::setTransitions()
{
Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicate.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
Go( &EDIT_TOOL::CreateArray,PCB_ACTIONS::createArray.MakeEvent() );
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::editFootprintInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::exchangeFootprints.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, PCB_ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
}

View File

@ -215,13 +215,13 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
return PCB_ACTIONS::microwaveCreateLine.MakeEvent();
case ID_EDIT_CUT:
return PCB_ACTIONS::cutToClipboard.MakeEvent();
return ACTIONS::cut.MakeEvent();
case ID_EDIT_COPY:
return PCB_ACTIONS::copyToClipboard.MakeEvent();
return ACTIONS::copy.MakeEvent();
case ID_EDIT_PASTE:
return PCB_ACTIONS::pasteFromClipboard.MakeEvent();
return PCB_ACTIONS::paste.MakeEvent();
case ID_POPUP_PCB_FILL_ALL_ZONES:
return PCB_ACTIONS::zoneFillAll.MakeEvent();

View File

@ -269,11 +269,6 @@ public:
/// Tool for creating an array of objects
static TOOL_ACTION createArray;
/// Clipboard
static TOOL_ACTION copyToClipboard;
static TOOL_ACTION pasteFromClipboard;
static TOOL_ACTION cutToClipboard;
/// Display module edges as outlines
static TOOL_ACTION moduleEdgeOutlines;

View File

@ -135,7 +135,8 @@ TOOL_ACTION PCB_ACTIONS::clearHighlight( "pcbnew.EditorControl.clearHighlight",
TOOL_ACTION PCB_ACTIONS::highlightNetCursor( "pcbnew.EditorControl.highlightNetCursor",
AS_GLOBAL, 0,
"", "" );
"Highlight Nets", "Highlight all copper items of a net",
net_highlight_xpm );
TOOL_ACTION PCB_ACTIONS::highlightNetSelection( "pcbnew.EditorControl.highlightNetSelection",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHLIGHT_NET_SELECTION ),
@ -594,7 +595,6 @@ int PCB_EDITOR_CONTROL::modifyLockSelected( MODIFY_MODE aMode )
int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
{
auto selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
KIGFX::VIEW* view = getView();
KIGFX::VIEW_CONTROLS* controls = getViewControls();
BOARD* board = getModel<BOARD>();

View File

@ -199,11 +199,6 @@ TOOL_ACTION PCB_ACTIONS::toBeDone( "pcbnew.Control.toBeDone",
AS_GLOBAL, 0, // dialog saying it is not implemented yet
"", "" ); // so users are aware of that
TOOL_ACTION PCB_ACTIONS::pasteFromClipboard( "pcbnew.InteractiveEdit.pasteFromClipboard",
AS_GLOBAL, 0, // do not define a hotkey and let TranslateLegacyId() handle the event
_( "Paste" ), _( "Paste content from clipboard" ),
paste_xpm );
PCBNEW_CONTROL::PCBNEW_CONTROL() :
PCB_TOOL_BASE( "pcbnew.Control" ), m_frame( NULL )
@ -956,6 +951,29 @@ int PCBNEW_CONTROL::AppendBoard( PLUGIN& pi, wxString& fileName )
}
int PCBNEW_CONTROL::Undo( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
wxCommandEvent dummy;
if( editFrame )
editFrame->RestoreCopyFromUndoList( dummy );
return 0;
}
int PCBNEW_CONTROL::Redo( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = dynamic_cast<PCB_BASE_EDIT_FRAME*>( m_frame );
wxCommandEvent dummy;
if( editFrame )
editFrame->RestoreCopyFromRedoList( dummy );
return 0;
}
int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_frame->GetHotkeyConfig() );
@ -1010,6 +1028,9 @@ void PCBNEW_CONTROL::setTransitions()
Go( &PCBNEW_CONTROL::GridSetOrigin, ACTIONS::gridSetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::GridResetOrigin, ACTIONS::gridResetOrigin.MakeEvent() );
Go( &PCBNEW_CONTROL::Undo, ACTIONS::undo.MakeEvent() );
Go( &PCBNEW_CONTROL::Redo, ACTIONS::redo.MakeEvent() );
// Miscellaneous
Go( &PCBNEW_CONTROL::ResetCoords, PCB_ACTIONS::resetCoords.MakeEvent() );
Go( &PCBNEW_CONTROL::DeleteItemCursor, PCB_ACTIONS::deleteItemCursor.MakeEvent() );
@ -1019,7 +1040,7 @@ void PCBNEW_CONTROL::setTransitions()
// Append control
Go( &PCBNEW_CONTROL::AppendBoardFromFile, PCB_ACTIONS::appendBoard.MakeEvent() );
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard, PCB_ACTIONS::pasteFromClipboard.MakeEvent() );
Go( &PCBNEW_CONTROL::PasteItemsFromClipboard, PCB_ACTIONS::paste.MakeEvent() );
}

View File

@ -85,6 +85,9 @@ public:
static bool DoSetGridOrigin( KIGFX::VIEW* aView, PCB_BASE_FRAME* aFrame,
BOARD_ITEM* originViewItem, const VECTOR2D& aPoint );
int Undo( const TOOL_EVENT& aEvent );
int Redo( const TOOL_EVENT& aEvent );
// Miscellaneous
int ResetCoords( const TOOL_EVENT& aEvent );
int DeleteItemCursor( const TOOL_EVENT& aEvent );

View File

@ -238,7 +238,7 @@ private:
};
EE_POINT_EDITOR::EE_POINT_EDITOR() :
POINT_EDITOR::POINT_EDITOR() :
PCB_TOOL_BASE( "pcbnew.PointEditor" ),
m_selectionTool( NULL ),
m_editedPoint( NULL ),
@ -249,7 +249,7 @@ EE_POINT_EDITOR::EE_POINT_EDITOR() :
}
void EE_POINT_EDITOR::Reset( RESET_REASON aReason )
void POINT_EDITOR::Reset( RESET_REASON aReason )
{
m_refill = false;
m_editPoints.reset();
@ -262,7 +262,7 @@ void EE_POINT_EDITOR::Reset( RESET_REASON aReason )
}
bool EE_POINT_EDITOR::Init()
bool POINT_EDITOR::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
@ -270,15 +270,15 @@ bool EE_POINT_EDITOR::Init()
wxASSERT_MSG( m_selectionTool, _( "pcbnew.InteractiveSelection tool is not available" ) );
auto& menu = m_selectionTool->GetToolMenu().GetMenu();
menu.AddItem( PCB_ACTIONS::pointEditorAddCorner, EE_POINT_EDITOR::addCornerCondition );
menu.AddItem( PCB_ACTIONS::pointEditorAddCorner, POINT_EDITOR::addCornerCondition );
menu.AddItem( PCB_ACTIONS::pointEditorRemoveCorner,
std::bind( &EE_POINT_EDITOR::removeCornerCondition, this, _1 ) );
std::bind( &POINT_EDITOR::removeCornerCondition, this, _1 ) );
return true;
}
void EE_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
void POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
{
EDIT_POINT* point = m_editedPoint;
@ -296,7 +296,7 @@ void EE_POINT_EDITOR::updateEditedPoint( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
if( !m_selectionTool )
return 0;
@ -438,7 +438,7 @@ int EE_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
}
void EE_POINT_EDITOR::updateItem() const
void POINT_EDITOR::updateItem() const
{
EDA_ITEM* item = m_editPoints->GetParent();
@ -642,7 +642,7 @@ void EE_POINT_EDITOR::updateItem() const
}
void EE_POINT_EDITOR::finishItem()
void POINT_EDITOR::finishItem()
{
auto item = m_editPoints->GetParent();
@ -673,7 +673,7 @@ void EE_POINT_EDITOR::finishItem()
}
bool EE_POINT_EDITOR::validatePolygon( SHAPE_POLY_SET& aModified, const SHAPE_POLY_SET* aOriginal ) const
bool POINT_EDITOR::validatePolygon( SHAPE_POLY_SET& aModified, const SHAPE_POLY_SET* aOriginal ) const
{
if( !aModified.IsSelfIntersecting() )
{
@ -696,7 +696,7 @@ bool EE_POINT_EDITOR::validatePolygon( SHAPE_POLY_SET& aModified, const SHAPE_PO
}
void EE_POINT_EDITOR::updatePoints()
void POINT_EDITOR::updatePoints()
{
if( !m_editPoints )
return;
@ -805,7 +805,7 @@ void EE_POINT_EDITOR::updatePoints()
}
void EE_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
void POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
{
KIGFX::VIEW_CONTROLS* controls = getViewControls();
@ -824,7 +824,7 @@ void EE_POINT_EDITOR::setEditedPoint( EDIT_POINT* aPoint )
}
void EE_POINT_EDITOR::setAltConstraint( bool aEnabled )
void POINT_EDITOR::setAltConstraint( bool aEnabled )
{
if( aEnabled )
{
@ -848,7 +848,7 @@ void EE_POINT_EDITOR::setAltConstraint( bool aEnabled )
}
EDIT_POINT EE_POINT_EDITOR::get45DegConstrainer() const
EDIT_POINT POINT_EDITOR::get45DegConstrainer() const
{
EDA_ITEM* item = m_editPoints->GetParent();
@ -900,17 +900,17 @@ EDIT_POINT EE_POINT_EDITOR::get45DegConstrainer() const
}
void EE_POINT_EDITOR::setTransitions()
void POINT_EDITOR::setTransitions()
{
Go( &EE_POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &EE_POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &EE_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &EE_POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
Go( &EE_POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );
Go( &POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );
}
bool EE_POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem )
bool POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem )
{
const auto type = aItem.Type();
@ -922,7 +922,7 @@ bool EE_POINT_EDITOR::canAddCorner( const EDA_ITEM& aItem )
}
bool EE_POINT_EDITOR::addCornerCondition( const SELECTION& aSelection )
bool POINT_EDITOR::addCornerCondition( const SELECTION& aSelection )
{
if( aSelection.Size() != 1 )
return false;
@ -949,7 +949,7 @@ findVertex( SHAPE_POLY_SET& aPolySet, const EDIT_POINT& aPoint )
}
bool EE_POINT_EDITOR::removeCornerCondition( const SELECTION& )
bool POINT_EDITOR::removeCornerCondition( const SELECTION& )
{
if( !m_editPoints || !m_editedPoint )
return false;
@ -990,7 +990,7 @@ bool EE_POINT_EDITOR::removeCornerCondition( const SELECTION& )
}
int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
int POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
{
if( !m_editPoints )
return 0;
@ -1115,7 +1115,7 @@ int EE_POINT_EDITOR::addCorner( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
int POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
{
if( !m_editPoints || !m_editedPoint )
return 0;
@ -1202,7 +1202,7 @@ int EE_POINT_EDITOR::removeCorner( const TOOL_EVENT& aEvent )
}
int EE_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
int POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
{
m_refill = true; // zone has been modified outside the point editor tool
updatePoints();

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __POINT_EDITOR_H
#define __POINT_EDITOR_H
#ifndef POINT_EDITOR_H
#define POINT_EDITOR_H
#include <tool/tool_interactive.h>
#include "tool/edit_points.h"
@ -40,10 +40,10 @@ class SHAPE_POLY_SET;
*
* Tool that displays edit points allowing to modify items by dragging the points.
*/
class EE_POINT_EDITOR : public PCB_TOOL_BASE
class POINT_EDITOR : public PCB_TOOL_BASE
{
public:
EE_POINT_EDITOR();
POINT_EDITOR();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;

View File

@ -697,29 +697,6 @@ bool SELECTION_TOOL::selectMultiple()
}
void SELECTION_TOOL::setTransitions()
{
Go( &SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() );
Go( &SELECTION_TOOL::CursorSelection, PCB_ACTIONS::selectionCursor.MakeEvent() );
Go( &SELECTION_TOOL::ClearSelection, PCB_ACTIONS::selectionClear.MakeEvent() );
Go( &SELECTION_TOOL::SelectItem, PCB_ACTIONS::selectItem.MakeEvent() );
Go( &SELECTION_TOOL::SelectItems, PCB_ACTIONS::selectItems.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItem, PCB_ACTIONS::unselectItem.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItems, PCB_ACTIONS::unselectItems.MakeEvent() );
Go( &SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
Go( &SELECTION_TOOL::find, PCB_ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::findMove, PCB_ACTIONS::findMove.MakeEvent() );
Go( &SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );
Go( &SELECTION_TOOL::selectConnection, PCB_ACTIONS::selectConnection.MakeEvent() );
Go( &SELECTION_TOOL::expandSelectedConnection, PCB_ACTIONS::expandSelectedConnection.MakeEvent() );
Go( &SELECTION_TOOL::selectCopper, PCB_ACTIONS::selectCopper.MakeEvent() );
Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() );
Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() );
Go( &SELECTION_TOOL::selectOnSheetFromEeschema, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() );
Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsModified );
}
SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
{
if( !m_locked || m_editModules )
@ -872,11 +849,11 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
if( !m_selection.HasType( PCB_TRACE_T ) && !m_selection.HasType( PCB_VIA_T ) )
return 0;
return expandSelectedConnection( aEvent );
return expandConnection( aEvent );
}
int SELECTION_TOOL::expandSelectedConnection( const TOOL_EVENT& aEvent )
int SELECTION_TOOL::expandConnection( const TOOL_EVENT& aEvent )
{
// copy the selection, since we're going to iterate and modify
auto selection = m_selection.GetItems();
@ -1153,7 +1130,7 @@ void SELECTION_TOOL::zoomFitSelection()
}
int SELECTION_TOOL::selectOnSheetFromEeschema( const TOOL_EVENT& aEvent )
int SELECTION_TOOL::selectSheetContents( const TOOL_EVENT& aEvent )
{
clearSelection();
wxString* sheetpath = aEvent.Parameter<wxString*>();
@ -2304,3 +2281,46 @@ int SELECTION_TOOL::updateSelection( const TOOL_EVENT& aEvent )
}
int SELECTION_TOOL::UpdateMenu( const TOOL_EVENT& aEvent )
{
ACTION_MENU* actionMenu = aEvent.Parameter<ACTION_MENU*>();
CONDITIONAL_MENU* conditionalMenu = dynamic_cast<CONDITIONAL_MENU*>( actionMenu );
if( conditionalMenu )
conditionalMenu->Evaluate( m_selection );
if( actionMenu )
actionMenu->UpdateAll();
return 0;
}
void SELECTION_TOOL::setTransitions()
{
Go( &SELECTION_TOOL::UpdateMenu, ACTIONS::updateMenu.MakeEvent() );
Go( &SELECTION_TOOL::Main, PCB_ACTIONS::selectionActivate.MakeEvent() );
Go( &SELECTION_TOOL::CursorSelection, PCB_ACTIONS::selectionCursor.MakeEvent() );
Go( &SELECTION_TOOL::ClearSelection, PCB_ACTIONS::selectionClear.MakeEvent() );
Go( &SELECTION_TOOL::SelectItem, PCB_ACTIONS::selectItem.MakeEvent() );
Go( &SELECTION_TOOL::SelectItems, PCB_ACTIONS::selectItems.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItem, PCB_ACTIONS::unselectItem.MakeEvent() );
Go( &SELECTION_TOOL::UnselectItems, PCB_ACTIONS::unselectItems.MakeEvent() );
Go( &SELECTION_TOOL::SelectionMenu, PCB_ACTIONS::selectionMenu.MakeEvent() );
Go( &SELECTION_TOOL::find, PCB_ACTIONS::find.MakeEvent() );
Go( &SELECTION_TOOL::findMove, PCB_ACTIONS::findMove.MakeEvent() );
Go( &SELECTION_TOOL::filterSelection, PCB_ACTIONS::filterSelection.MakeEvent() );
Go( &SELECTION_TOOL::selectConnection, PCB_ACTIONS::selectConnection.MakeEvent() );
Go( &SELECTION_TOOL::expandConnection, PCB_ACTIONS::expandSelectedConnection.MakeEvent() );
Go( &SELECTION_TOOL::selectCopper, PCB_ACTIONS::selectCopper.MakeEvent() );
Go( &SELECTION_TOOL::selectNet, PCB_ACTIONS::selectNet.MakeEvent() );
Go( &SELECTION_TOOL::selectSameSheet, PCB_ACTIONS::selectSameSheet.MakeEvent() );
Go( &SELECTION_TOOL::selectSheetContents, PCB_ACTIONS::selectOnSheetFromEeschema.MakeEvent() );
Go( &SELECTION_TOOL::updateSelection, EVENTS::SelectedItemsModified );
}

View File

@ -196,7 +196,7 @@ private:
int selectConnection( const TOOL_EVENT& aEvent );
///> Expands the current selection to select a connection between two junctions
int expandSelectedConnection( const TOOL_EVENT& aEvent );
int expandConnection( const TOOL_EVENT& aEvent );
///> Selects items with a continuous copper connection to items in selection
int selectCopper( const TOOL_EVENT& aEvent );
@ -230,7 +230,7 @@ private:
///> Selects all modules belonging to same sheet, from Eeschema,
///> using crossprobing
int selectOnSheetFromEeschema( const TOOL_EVENT& aEvent );
int selectSheetContents( const TOOL_EVENT& aEvent );
///> Selects all modules belonging to same hierarchical sheet
///> as the selected footprint.
@ -335,6 +335,11 @@ private:
*/
int updateSelection( const TOOL_EVENT& aEvent );
/**
* Pass the selection to a conditional menu for updating.
*/
int UpdateMenu( const TOOL_EVENT& aEvent );
const GENERAL_COLLECTORS_GUIDE getCollectorsGuide() const;
private: