mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-18 16:59:18 +00:00
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:
parent
f9e4ee1fc9
commit
69afa27a5f
3d-viewer/3d_viewer
common
cvpcb
eeschema
CMakeLists.txtcross-probing.cppee_hotkeys.cppeeschema_id.h
libedit
menubar.cppsch_base_frame.cppsch_base_frame.hsch_edit_frame.cppsch_edit_frame.hschematic_undo_redo.cpptoolbars_sch_editor.cpptoolbars_viewlib.cpptools
ee_actions.cppee_actions.hee_selection_tool.cpplib_control.cpplib_control.hlib_edit_tool.cpplib_edit_tool.hsch_drawing_tools.cppsch_edit_tool.cppsch_editor_control.cppsch_editor_control.hsch_wire_bus_tool.cpp
viewlib_frame.cppviewlib_frame.hgerbview
include
kicad
pagelayout_editor
pcbnew
footprint_edit_frame.cppfootprint_edit_frame.hfootprint_viewer_frame.cppfootprint_wizard_frame.cpphotkeys.cppmenubar_footprint_editor.cppmenubar_pcb_editor.cpppcb_base_edit_frame.hpcb_base_frame.cpppcb_edit_frame.cpppcb_edit_frame.hpcbnew_id.htoolbars_footprint_editor.cpptoolbars_footprint_viewer.cpptoolbars_pcb_editor.cpptoolbars_update_user_interface.cpp
tools
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
85
common/tool/action_toolbar.cpp
Normal file
85
common/tool/action_toolbar.cpp
Normal 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();
|
||||
}
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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>();
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -792,6 +792,8 @@ bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
|
||||
#endif
|
||||
}
|
||||
|
||||
UpdateUI();
|
||||
|
||||
return hotkey_handled;
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,7 @@ public:
|
||||
// currently: do nothing in CvPcb.
|
||||
}
|
||||
|
||||
void SyncMenusAndToolbars() override;
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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 )
|
||||
|
@ -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.
|
||||
*
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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();
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user