Move hotkeys to ACTION architecture.

This commit is contained in:
Jeff Young 2019-06-09 22:57:23 +01:00
parent c13ef839c1
commit 5e49517781
162 changed files with 1851 additions and 4227 deletions

View File

@ -201,7 +201,8 @@ class EDA_3D_VIEWER : public KIWAY_PLAYER
void DisplayHotKeys()
{
DisplayHotkeyList( this, GetHotkeyConfig() );
// JEY TODO: need a toolManager....
DisplayHotkeyList( this, GetToolManager() );
}
/**

View File

@ -31,7 +31,7 @@
#include "../3d_viewer_id.h"
// Define 3D Viewer Hotkeys
static EDA_HOTKEY HkHotkeysHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY HkHotkeysHelp( _HKI( "List Hotkeys" ), wxID_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY Hk3D_PivotCenter( _HKI( "Center pivot rotation (Middle mouse click)" ), 0, WXK_SPACE );
static EDA_HOTKEY Hk3D_MoveLeft( _HKI( "Move board Left" ), ID_POPUP_MOVE3D_LEFT, WXK_LEFT );
static EDA_HOTKEY Hk3D_MoveRight( _HKI( "Move board Right" ), ID_POPUP_MOVE3D_RIGHT, WXK_RIGHT );

View File

@ -3,6 +3,8 @@ if( COMPILER_SUPPORTS_WSHADOW )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WSHADOW_FLAGS}")
endif()
add_definitions( -DBITMAP_2_CMP )
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
../potrace

View File

@ -25,20 +25,17 @@
#include <fctsys.h>
#include <macros.h>
#include <wx/clipbrd.h>
#include <pgm_base.h>
#include <confirm.h>
#include <gestfich.h>
#include <wildcards_and_files_ext.h>
#include <bitmap_io.h>
#include <bitmaps.h>
#include <build_version.h>
#include <menus_helpers.h>
#include <kiway.h>
#include <kiface_i.h>
#include <wx/rawbmp.h>
#include <potracelib.h>
#include "bitmap2component.h"
#include "bitmap2cmp_gui_base.h"

View File

@ -376,6 +376,7 @@ set( COMMON_SRCS
tool/action_menu.cpp
tool/action_toolbar.cpp
tool/actions.cpp
tool/common_control.cpp
tool/common_tools.cpp
tool/conditional_menu.cpp
tool/edit_constraints.cpp

View File

@ -30,15 +30,15 @@
#include <wx/button.h>
DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, EDA_HOTKEY_CONFIG* aDescList ):
DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolMgr ):
DIALOG_SHIM( aParent, wxID_ANY, _( "Hotkey List" ) )
{
const auto margin = KIUI::GetStdMargin();
auto main_sizer = new wxBoxSizer( wxVERTICAL );
m_hk_list = new PANEL_HOTKEYS_EDITOR( aParent, this, true,
aDescList, aDescList, {} );
m_hk_list = new PANEL_HOTKEYS_EDITOR( this, true );
m_hk_list->AddHotKeys( aToolMgr );
main_sizer->Add( m_hk_list, 1, wxTOP | wxLEFT | wxRIGHT | wxEXPAND, margin );

View File

@ -32,27 +32,23 @@
#include <dialog_shim.h>
// Private forwards
class TOOL_MANAGER;
class PANEL_HOTKEYS_EDITOR;
/**
* A dialog that presents the user with a read-only list of hotkeys and
* their current bindings.
* A dialog that presents the user with a read-only list of hotkeys and their current bindings.
*/
class DIALOG_LIST_HOTKEYS: public DIALOG_SHIM
{
public:
/**
* Construct a hotkey list dialog on the given frame, with a set of hotkeys
* Construct a hotkey list dialog on the given frame
*
* @param aParent the parent frame
* @param aDescList the list of hotkey sections (each of which has a list
* of hotkeys) to display
*/
DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent,
EDA_HOTKEY_CONFIG* aDescList );
DIALOG_LIST_HOTKEYS( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolManager );
protected:
@ -62,7 +58,6 @@ protected:
bool TransferDataToWindow() override;
private:
PANEL_HOTKEYS_EDITOR* m_hk_list;
};

View File

@ -22,16 +22,14 @@
*/
#include <panel_hotkeys_editor.h>
#include <eda_base_frame.h>
#include <kiway_player.h>
#include <wx/srchctrl.h>
#include <wx/panel.h>
#include <wx/button.h>
#include <wx/sizer.h>
#include <widgets/button_row_panel.h>
#include <widgets/ui_common.h>
#include <tool/tool_manager.h>
static const wxSize default_dialog_size { 500, 350 };
static const wxSize min_dialog_size { -1, 350 };
@ -57,17 +55,10 @@ static wxSearchCtrl* CreateTextFilterBox( wxWindow* aParent, const wxString& aDe
}
PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow,
bool aReadOnly,
EDA_HOTKEY_CONFIG* aHotkeys,
EDA_HOTKEY_CONFIG* aShowHotkeys,
const wxString& aNickname ) :
PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( wxWindow* aWindow, bool aReadOnly ) :
wxPanel( aWindow, wxID_ANY, wxDefaultPosition, default_dialog_size ),
m_frame( aFrame ),
m_readOnly( aReadOnly ),
m_hotkeys( aHotkeys ),
m_nickname( aNickname ),
m_hotkeyStore( aShowHotkeys )
m_hotkeyStore()
{
const auto margin = KIUI::GetStdMargin();
auto mainSizer = new wxBoxSizer( wxVERTICAL );
@ -93,8 +84,13 @@ PANEL_HOTKEYS_EDITOR::PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aW
this->Layout();
// Connect Events
filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED,
&PANEL_HOTKEYS_EDITOR::OnFilterSearch, this );
filterSearch->Bind( wxEVT_COMMAND_TEXT_UPDATED, &PANEL_HOTKEYS_EDITOR::OnFilterSearch, this );
}
void PANEL_HOTKEYS_EDITOR::AddHotKeys( TOOL_MANAGER* aToolMgr )
{
m_toolManagers.push_back( aToolMgr );
}
@ -116,26 +112,19 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
[this]( wxCommandEvent& ){
m_hotkeyListCtrl->ResetAllHotkeys( true );
}
},
{
wxID_ANY,
_( "Import Hotkeys..." ),
_( "Import hotkey definitions from an external file, replacing the current values" ),
[this]( wxCommandEvent& ){
// JEY TODO: implement hotkey import....
/*m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );*/
}
}
};
const BUTTON_ROW_PANEL::BTN_DEF_LIST r_btn_defs = {
{
wxID_ANY,
_( "Import..." ),
_( "Import hotkey definitions from an external file, replacing the current values" ),
[this]( wxCommandEvent& ){
m_frame->ImportHotkeyConfigFromFile( m_hotkeys, m_nickname );
}
},
{
wxID_ANY,
_( "Export..." ),
_( "Export these hotkey definitions to an external file" ),
[this]( wxCommandEvent& ){
m_frame->ExportHotkeyConfigToFile( m_hotkeys, m_nickname );
}
},
};
auto btnPanel = std::make_unique<BUTTON_ROW_PANEL>( this, l_btn_defs, r_btn_defs );
@ -146,6 +135,7 @@ void PANEL_HOTKEYS_EDITOR::installButtons( wxSizer* aSizer )
bool PANEL_HOTKEYS_EDITOR::TransferDataToWindow()
{
m_hotkeyStore.Init( m_toolManagers );
return m_hotkeyListCtrl->TransferDataToControl();
}
@ -156,7 +146,8 @@ bool PANEL_HOTKEYS_EDITOR::TransferDataFromWindow()
return false;
// save the hotkeys
m_frame->WriteHotkeyConfig( m_hotkeys );
for( TOOL_MANAGER* toolMgr : m_toolManagers )
WriteHotKeyConfig( toolMgr->GetActions() );
return true;
}

View File

@ -37,14 +37,15 @@
#include <widgets/paged_dialog.h>
#include <bitmaps.h>
#include <tool/action_menu.h>
#include <tool/common_control.h>
#include <tool/tool_manager.h>
#include <menus_helpers.h>
#include <tool/actions.h>
/// The default auto save interval is 10 minutes.
#define DEFAULT_AUTO_SAVE_INTERVAL 600
#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
///@{
/// \ingroup config
@ -66,10 +67,8 @@ static const wxString entryMaximized = "Maximized"; ///< Nonzero iff frame is m
BEGIN_EVENT_TABLE( EDA_BASE_FRAME, wxFrame )
EVT_MENU( wxID_HELP, EDA_BASE_FRAME::GetKicadHelp )
EVT_MENU( wxID_INDEX, EDA_BASE_FRAME::GetKicadHelp )
EVT_MENU( ID_HELP_GET_INVOLVED, EDA_BASE_FRAME::GetKicadContribute )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::GetKicadAbout )
EVT_MENU( wxID_ABOUT, EDA_BASE_FRAME::OnKicadAbout )
EVT_MENU( wxID_PREFERENCES, EDA_BASE_FRAME::OnPreferences )
EVT_CHAR_HOOK( EDA_BASE_FRAME::OnCharHook )
EVT_MENU_OPEN( EDA_BASE_FRAME::OnMenuOpen )
@ -290,30 +289,18 @@ void EDA_BASE_FRAME::ReCreateMenuBar()
void EDA_BASE_FRAME::AddStandardHelpMenu( wxMenuBar* aMenuBar )
{
wxMenu* helpMenu = new wxMenu;
COMMON_CONTROL* commonControl = m_toolManager->GetTool<COMMON_CONTROL>();
ACTION_MENU* helpMenu = new ACTION_MENU();
AddMenuItem( helpMenu, wxID_HELP,
_( "&Help" ),
_( "Open product documentation in a web browser" ),
KiBitmap( online_help_xpm ) );
AddMenuItem( helpMenu, wxID_INDEX,
_( "&Getting Started with KiCad" ),
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
KiBitmap( help_xpm ) );
// JEY TODO: move to actions...
AddMenuItem( helpMenu, ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, _( "&List Hotkeys..." ),
_( "Displays current hotkeys table and corresponding commands" ),
KiBitmap( hotkeys_xpm ) );
helpMenu->SetTool( commonControl );
helpMenu->Add( ACTIONS::help );
helpMenu->Add( ACTIONS::gettingStarted );
helpMenu->Add( ACTIONS::listHotKeys );
helpMenu->Add( ACTIONS::getInvolved );
helpMenu->AppendSeparator();
AddMenuItem( helpMenu, ID_HELP_GET_INVOLVED, _( "Get &Involved" ),
_( "Open \"Contribute to KiCad\" in a web browser" ),
KiBitmap( info_xpm ) );
helpMenu->AppendSeparator();
AddMenuItem( helpMenu, wxID_ABOUT, _( "&About KiCad" ), KiBitmap( about_xpm ) );
helpMenu->Add( _( "&About KiCad" ), "", wxID_ABOUT, about_xpm );
aMenuBar->Append( helpMenu, _( "&Help" ) );
}
@ -517,112 +504,33 @@ wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
}
void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
{
const SEARCH_STACK& search = sys_search();
/* We have to get document for beginners,
* or the full specific doc
* if event id is wxID_INDEX, we want the document for beginners.
* else the specific doc file (its name is in Kiface().GetHelpFileName())
* The document for beginners is the same for all KiCad utilities
*/
if( event.GetId() == wxID_INDEX )
{
// List of possible names for Getting Started in KiCad
const wxChar* names[2] = {
wxT( "getting_started_in_kicad" ),
wxT( "Getting_Started_in_KiCad" )
};
wxString helpFile;
// Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
// or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
for( unsigned ii = 0; ii < arrayDim( names ); ii++ )
{
helpFile = SearchHelpFileFullPath( search, names[ii] );
if( !helpFile.IsEmpty() )
break;
}
if( !helpFile )
{
wxString msg = wxString::Format( _(
"Html or pdf help file \n\"%s\"\n or\n\"%s\" could not be found." ), names[0], names[1] );
wxMessageBox( msg );
}
else
{
GetAssociatedDocument( this, helpFile );
}
return;
}
wxString base_name = help_name();
wxString helpFile = SearchHelpFileFullPath( search, base_name );
if( !helpFile )
{
wxString msg = wxString::Format( _(
"Help file \"%s\" could not be found." ),
GetChars( base_name )
);
wxMessageBox( msg );
}
else
{
GetAssociatedDocument( this, helpFile );
}
}
void EDA_BASE_FRAME::GetKicadContribute( wxCommandEvent& event )
{
if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
{
wxString msg;
msg.Printf( _( "Could not launch the default browser.\n"
"For information on how to help the KiCad project, visit %s" ),
URL_GET_INVOLVED );
wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, this );
}
}
void EDA_BASE_FRAME::GetKicadAbout( wxCommandEvent& event )
void EDA_BASE_FRAME::OnKicadAbout( wxCommandEvent& event )
{
void ShowAboutDialog(EDA_BASE_FRAME * aParent); // See AboutDialog_main.cpp
ShowAboutDialog( this );
}
bool EDA_BASE_FRAME::ShowPreferences( EDA_HOTKEY_CONFIG* aHotkeys, EDA_HOTKEY_CONFIG* aShowHotkeys,
const wxString& aHotkeysNickname )
void EDA_BASE_FRAME::OnPreferences( wxCommandEvent& event )
{
PAGED_DIALOG dlg( this, _( "Preferences" ) );
wxTreebook* book = dlg.GetTreebook();
book->AddPage( new PANEL_COMMON_SETTINGS( &dlg, book ), _( "Common" ) );
book->AddPage( new PANEL_HOTKEYS_EDITOR( this, book, false,
aHotkeys, aShowHotkeys, aHotkeysNickname ), _( "Hotkeys" ) );
PANEL_HOTKEYS_EDITOR* hotkeysPanel = new PANEL_HOTKEYS_EDITOR( book, false );
book->AddPage( hotkeysPanel, _( "Hotkeys" ) );
for( unsigned i = 0; i < KIWAY_PLAYER_COUNT; ++i )
{
KIWAY_PLAYER* frame = dlg.Kiway().Player( (FRAME_T) i, false );
if( frame )
frame->InstallPreferences( &dlg );
frame->InstallPreferences( &dlg, hotkeysPanel );
}
if( dlg.ShowModal() == wxID_OK )
{
dlg.Kiway().CommonSettingsChanged();
return true;
}
return false;
}

View File

@ -86,11 +86,9 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_auxiliaryToolBar = NULL;
m_gridSelectBox = NULL;
m_zoomSelectBox = NULL;
m_hotkeysDescrList = NULL;
m_canvasType = EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE;
m_galCanvas = NULL;
m_actions = NULL;
m_toolDispatcher = NULL;
m_messagePanel = NULL;
m_currentScreen = NULL;
@ -241,17 +239,6 @@ void EDA_DRAW_FRAME::EraseMsgBox()
}
bool EDA_DRAW_FRAME::GetToolToggled( int aToolId )
{
// Checks all the toolbars and returns true if the given tool id is toggled.
return ( ( m_mainToolBar && m_mainToolBar->GetToolToggled( aToolId ) ) ||
( m_optionsToolBar && m_optionsToolBar->GetToolToggled( aToolId ) ) ||
( m_drawToolBar && m_drawToolBar->GetToolToggled( aToolId ) ) ||
( m_auxiliaryToolBar && m_auxiliaryToolBar->GetToolToggled( aToolId ) )
);
}
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
@ -275,18 +262,6 @@ void EDA_DRAW_FRAME::OnUpdateSelectGrid( wxUpdateUIEvent& aEvent )
}
int EDA_DRAW_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
wxString* aFullFileName )
{
int result = EDA_BASE_FRAME::WriteHotkeyConfig( aDescList, aFullFileName );
if( GetToolManager() )
GetToolManager()->UpdateHotKeys();
return result;
}
void EDA_DRAW_FRAME::PrintPage( wxDC* aDC )
{
wxMessageBox( wxT("EDA_DRAW_FRAME::PrintPage() error") );

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2018 Kicad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2019 Kicad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -22,28 +22,82 @@
*/
#include <hotkey_store.h>
#include <tool/tool_manager.h>
#include <tool/tool_action.h>
HOTKEY_STORE::HOTKEY_STORE( EDA_HOTKEY_CONFIG* aHotkeys )
wxString HOTKEY_STORE::GetAppName( TOOL_ACTION* aAction )
{
for( EDA_HOTKEY_CONFIG* section = aHotkeys; section->m_HK_InfoList; ++section )
{
m_hk_sections.push_back( genSection( *section ) );
}
wxString name( aAction->GetName() );
return name.BeforeFirst( '.' );
}
HOTKEY_SECTION HOTKEY_STORE::genSection( EDA_HOTKEY_CONFIG& aSection )
wxString HOTKEY_STORE::GetSectionName( TOOL_ACTION* aAction )
{
HOTKEY_SECTION generated_section { {}, {}, aSection };
std::map<wxString, wxString> s_AppNames = {
{ wxT( "common" ), _( "Common" ) },
{ wxT( "kicad" ), _( "Kicad Manager" ) },
{ wxT( "eeschema" ), _( "Eeschema" ) },
{ wxT( "pcbnew" ), _( "PcbNew" ) },
{ wxT( "plEditor" ), _( "Page Layout Editor" ) }
};
generated_section.m_name = wxGetTranslation( *aSection.m_Title );
wxString appName = GetAppName( aAction );
if( s_AppNames.count( appName ) )
return s_AppNames[ appName ];
else
return wxT( "XXX" + appName );
}
for( EDA_HOTKEY** info_ptr = aSection.m_HK_InfoList; *info_ptr; ++info_ptr )
HOTKEY_STORE::HOTKEY_STORE()
{
}
void HOTKEY_STORE::Init( std::vector<TOOL_MANAGER*> aToolManagerList )
{
m_toolManagers = std::move( aToolManagerList );
// Collect all action maps into a single master map. This will re-group everything
// and elimate duplicates
std::map<std::string, TOOL_ACTION*> masterMap;
for( TOOL_MANAGER* toolMgr : m_toolManagers )
{
generated_section.m_hotkeys.push_back( { **info_ptr, *aSection.m_SectionTag } );
for( const auto& entry : toolMgr->GetActions() )
{
// Internal actions probably shouldn't be allowed hotkeys
if( entry.second->GetMenuItem().IsEmpty() )
continue;
masterMap[ entry.first ] = entry.second;
}
}
wxString currentApp;
HOTKEY_SECTION* currentSection = nullptr;
HOTKEY* currentHotKey = nullptr;
return generated_section;
for( const auto& entry : masterMap )
{
wxString thisApp = GetAppName( entry.second );
if( thisApp != currentApp )
{
m_hk_sections.emplace_back( HOTKEY_SECTION() );
currentApp = thisApp;
currentSection = &m_hk_sections.back();
currentSection->m_SectionName = GetSectionName( entry.second );
}
currentSection->m_HotKeys.emplace_back( HOTKEY() );
currentHotKey = &currentSection->m_HotKeys.back();
currentHotKey->m_Parent = entry.second;
currentHotKey->m_EditKeycode = entry.second->GetHotKey();
}
}
@ -53,102 +107,57 @@ std::vector<HOTKEY_SECTION>& HOTKEY_STORE::GetSections()
}
CHANGED_HOTKEY* HOTKEY_STORE::FindHotkey( const wxString& aTag, int aCmdId )
{
CHANGED_HOTKEY* found_key = nullptr;
for( auto& section: m_hk_sections )
{
if( *section.m_section.m_SectionTag != aTag)
continue;
for( auto& hotkey: section.m_hotkeys )
{
auto& curr_hk = hotkey.GetCurrentValue();
if( curr_hk.m_Idcommand == aCmdId )
{
found_key = &hotkey;
break;
}
}
}
return found_key;
}
void HOTKEY_STORE::SaveAllHotkeys()
{
for( auto& section: m_hk_sections )
for( HOTKEY_SECTION& section: m_hk_sections )
{
for( auto& hotkey: section.m_hotkeys )
{
hotkey.SaveHotkey();
}
for( HOTKEY& hotkey: section.m_HotKeys )
hotkey.m_Parent->SetHotKey( hotkey.m_EditKeycode );
}
}
void HOTKEY_STORE::ResetAllHotkeysToDefault()
{
for( auto& section: m_hk_sections )
for( HOTKEY_SECTION& section: m_hk_sections )
{
for( auto& hotkey: section.m_hotkeys )
{
hotkey.GetCurrentValue().ResetKeyCodeToDefault();
}
for( HOTKEY& hotkey: section.m_HotKeys )
hotkey.m_EditKeycode = hotkey.m_Parent->GetDefaultHotKey();
}
}
void HOTKEY_STORE::ResetAllHotkeysToOriginal()
{
for( auto& section: m_hk_sections )
for( HOTKEY_SECTION& section: m_hk_sections )
{
for( auto& hotkey: section.m_hotkeys )
{
hotkey.GetCurrentValue().m_KeyCode = hotkey.GetOriginalValue().m_KeyCode;
}
for( HOTKEY& hotkey: section.m_HotKeys )
hotkey.m_EditKeycode = hotkey.m_Parent->GetHotKey();
}
}
bool HOTKEY_STORE::CheckKeyConflicts( long aKey, const wxString& aSectionTag,
EDA_HOTKEY** aConfKey, EDA_HOTKEY_CONFIG** aConfSect )
bool HOTKEY_STORE::CheckKeyConflicts( TOOL_ACTION* aAction, long aKey, HOTKEY** aConflict )
{
EDA_HOTKEY* conflicting_key = nullptr;
EDA_HOTKEY_CONFIG* conflicting_section = nullptr;
wxString sectionName = GetSectionName( aAction );
for( auto& section: m_hk_sections )
for( HOTKEY_SECTION& section: m_hk_sections )
{
const auto& sectionTag = *section.m_section.m_SectionTag;
if( aSectionTag != g_CommonSectionTag
&& sectionTag != g_CommonSectionTag
&& sectionTag != aSectionTag )
{
// This key and its conflict candidate are in orthogonal sections, so skip.
if( section.m_SectionName != sectionName )
continue;
}
// See if any *current* hotkeys are in conflict
for( auto& hotkey: section.m_hotkeys )
for( HOTKEY& hotkey: section.m_HotKeys )
{
auto& curr_hk = hotkey.GetCurrentValue();
if( aKey == curr_hk.m_KeyCode )
if( hotkey.m_Parent == aAction )
continue;
if( hotkey.m_EditKeycode == aKey )
{
conflicting_key = &curr_hk;
conflicting_section = &section.m_section;
*aConflict = &hotkey;
return true;
}
}
}
// Write the outparams
if( aConfKey )
*aConfKey = conflicting_key;
if( aConfSect )
*aConfSect = conflicting_section;
return conflicting_key == nullptr;
return false;
}

View File

@ -41,14 +41,12 @@
#include <eda_draw_frame.h>
#include <tool/tool_manager.h>
#include "dialogs/dialog_hotkey_list.h"
#include <wx/apptrait.h>
#include <wx/stdpaths.h>
#include <wx/tokenzr.h>
#include <tool/tool_action.h>
#define HOTKEYS_CONFIG_KEY wxT( "Keys" )
wxString g_CommonSectionTag( wxT( "[common]" ) );
@ -59,23 +57,8 @@ wxString g_CommonSectionTag( wxT( "[common]" ) );
*/
EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent ) :
m_defaultKeyCode( keycode ), m_KeyCode( keycode ), m_InfoMsg( infomsg ),
m_Idcommand( idcommand ), m_IdMenuEvent( idmenuevent )
{
}
EDA_HOTKEY::EDA_HOTKEY( const EDA_HOTKEY* base )
{
m_defaultKeyCode = base->m_defaultKeyCode; // initialize default key code
m_KeyCode = base->m_KeyCode;
m_InfoMsg = base->m_InfoMsg;
m_Idcommand = base->m_Idcommand;
m_IdMenuEvent = base->m_IdMenuEvent;
}
EDA_HOTKEY_CLIENT_DATA::~EDA_HOTKEY_CLIENT_DATA()
m_KeyCode( keycode ), m_InfoMsg( infomsg ), m_Idcommand( idcommand ),
m_IdMenuEvent( idmenuevent )
{
}
@ -174,16 +157,16 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
bool found = false;
// Assume keycode of 0 is "unassigned"
if( (aKeycode & GR_KB_CTRL) != 0 )
if( (aKeycode & MD_CTRL) != 0 )
modifier << MODIFIER_CTRL;
if( (aKeycode & GR_KB_ALT) != 0 )
if( (aKeycode & MD_ALT) != 0 )
modifier << MODIFIER_ALT;
if( (aKeycode & GR_KB_SHIFT) != 0 )
if( (aKeycode & MD_SHIFT) != 0 )
modifier << MODIFIER_SHIFT;
aKeycode &= ~( GR_KB_CTRL | GR_KB_ALT | GR_KB_SHIFT );
aKeycode &= ~( MD_CTRL | MD_ALT | MD_SHIFT );
if( (aKeycode > ' ') && (aKeycode < 0x7F ) )
{
@ -217,58 +200,26 @@ wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
}
/*
* helper function use in AddHotkeyName to calculate an accelerator string
* In some menus, accelerators do not perform exactly the same action as
* the hotkey that perform a similar action.
* this is usually the case when this action uses the current mouse position
* for instance zoom action is ran from the F1 key or the Zoom menu.
* a zoom uses the mouse position from a hot key and not from the menu
* In this case, the accelerator if Shift+<hotkey>
* But for many keys, the Shift modifier is not usable, and the accelerator is Alt+<hotkey>
/**
* AddHotkeyName
* @param aText - the base text on which to append the hotkey
* @param aHotKey - the hotkey keycode
* @param aStyle - IS_HOTKEY to add <tab><keyname> (shortcuts in menus, same as hotkeys)
* IS_COMMENT to add <spaces><(keyname)> mainly in tool tips
*/
static void AddModifierToKey( wxString& aFullKey, const wxString & aKey )
{
if( (aKey.Length() == 1) && (aKey[0] >= 'A') && (aKey[0] <= 'Z'))
// We can use Shift+<key> as accelerator and <key> for hot key
aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey;
else
// We must use Alt+<key> as accelerator and <key> for hot key
aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey;
}
/* AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value)
* aText = a wxString. returns aText + key name
* aList = pointer to a EDA_HOTKEY list of commands
* aCommandId = Command Id value
* aShortCutType = IS_HOTKEY to add <tab><keyname> (shortcuts in menus, same as hotkeys)
* IS_ACCELERATOR to add <tab><Shift+keyname> (accelerators in menus, not hotkeys)
* IS_COMMENT to add <spaces><(keyname)> mainly in tool tips
* Return a wxString (aTest + key name) if key found or aText without modification
*/
wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList,
int aCommandId, HOTKEY_ACTION_TYPE aShortCutType )
wxString AddHotkeyName( const wxString& aText, int aHotKey, HOTKEY_ACTION_TYPE aStyle )
{
wxString msg = aText;
wxString keyname;
if( aList )
keyname = KeyNameFromCommandId( aList, aCommandId );
wxString keyname = KeyNameFromKeyCode( aHotKey );
if( !keyname.IsEmpty() )
{
switch( aShortCutType )
switch( aStyle )
{
case IS_HOTKEY:
msg << wxT( "\t" ) << keyname;
break;
case IS_ACCELERATOR:
AddModifierToKey( msg, keyname );
break;
case IS_COMMENT:
msg << wxT( " (" ) << keyname << wxT( ")" );
break;
@ -300,6 +251,7 @@ wxString AddHotkeyName( const wxString& aText,
int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType )
{
// JEY TODO: obsolete once 3DViewer and ProjectManager are moved over...
wxString msg = aText;
wxString keyname;
EDA_HOTKEY** list;
@ -319,10 +271,6 @@ wxString AddHotkeyName( const wxString& aText,
msg << wxT( "\t" ) << keyname;
break;
case IS_ACCELERATOR:
AddModifierToKey( msg, keyname );
break;
case IS_COMMENT:
msg << wxT( " (" ) << keyname << wxT( ")" );
break;
@ -352,6 +300,7 @@ wxString AddHotkeyName( const wxString& aText,
*/
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
{
// JEY TODO: obsolete once 3DViewer and ProjectManager are moved over...
wxString keyname;
for( ; *aList != nullptr; aList++ )
@ -387,28 +336,28 @@ int KeyCodeFromKeyName( const wxString& keyname )
wxString prefix;
int modifier = 0;
while( 1 )
while( true )
{
prefix.Empty();
if( key.StartsWith( MODIFIER_CTRL_BASE ) )
{
modifier |= GR_KB_CTRL;
modifier |= MD_CTRL;
prefix = MODIFIER_CTRL_BASE;
}
else if( key.StartsWith( MODIFIER_CMD_MAC ) )
{
modifier |= GR_KB_CTRL;
modifier |= MD_CTRL;
prefix = MODIFIER_CMD_MAC;
}
else if( key.StartsWith( MODIFIER_ALT ) )
{
modifier |= GR_KB_ALT;
modifier |= MD_ALT;
prefix = MODIFIER_ALT;
}
else if( key.StartsWith( MODIFIER_SHIFT ) )
{
modifier |= GR_KB_SHIFT;
modifier |= MD_SHIFT;
prefix = MODIFIER_SHIFT;
}
else
@ -440,139 +389,104 @@ int KeyCodeFromKeyName( const wxString& keyname )
}
/* DisplayHotkeyList
* Displays the current hotkey list
* aList = a EDA_HOTKEY_CONFIG list(Null terminated)
/*
* DisplayHotkeyList
* Displays the hotkeys registered with the given tool manager.
*/
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
void DisplayHotkeyList( EDA_BASE_FRAME* aParent, TOOL_MANAGER* aToolManager )
{
DIALOG_LIST_HOTKEYS dlg( aFrame, aDescList );
DIALOG_LIST_HOTKEYS dlg( aParent, aToolManager );
dlg.ShowModal();
}
/**
* Function GetDescriptorFromHotkey
* Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/
EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList )
int WriteHotKeyConfig( std::map<std::string, TOOL_ACTION*> aActionMap )
{
for( ; *aList != nullptr; aList++ )
{
EDA_HOTKEY* hk_decr = *aList;
wxFileName fn( "user" );
if( hk_decr->m_KeyCode == aKey )
return hk_decr;
}
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
fn.SetPath( GetKicadConfigPath() );
return nullptr;
}
EDA_HOTKEY* GetDescriptorFromCommand( int aCommand, EDA_HOTKEY** aList )
{
for( ; *aList != nullptr; aList++ )
{
EDA_HOTKEY* hk_decr = *aList;
if( hk_decr->m_Idcommand == aCommand )
return hk_decr;
}
return nullptr;
}
int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
wxString* aFullFileName )
{
wxString msg;
wxString keyname, infokey;
FILE* file;
msg = wxT( "$hotkey list\n" );
// Print the current hotkey list
EDA_HOTKEY** list;
for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
{
if( aDescList->m_Title )
{
msg += wxT( "# " );
msg += *aDescList->m_Title;
msg += wxT( "\n" );
}
msg += *aDescList->m_SectionTag;
msg += wxT( "\n" );
list = aDescList->m_HK_InfoList;
for( ; *list != nullptr; list++ )
{
EDA_HOTKEY* hk_decr = *list;
msg += wxT( "shortcut " );
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
AddDelimiterString( keyname );
infokey = hk_decr->m_InfoMsg;
AddDelimiterString( infokey );
msg += keyname + wxT( ": " ) + infokey + wxT( "\n" );
}
}
msg += wxT( "$Endlist\n" );
if( aFullFileName )
file = wxFopen( *aFullFileName, wxT( "wt" ) );
else
{
wxString configName( ConfigBaseName() );
if( configName == SCH_EDIT_FRAME_NAME || configName == LIB_EDIT_FRAME_NAME )
configName = EESCHEMA_HOTKEY_NAME;
else if( configName == PCB_EDIT_FRAME_NAME ||
configName == FOOTPRINT_EDIT_FRAME_NAME )
configName = PCBNEW_HOTKEY_NAME;
wxFileName fn( configName );
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
fn.SetPath( GetKicadConfigPath() );
file = wxFopen( fn.GetFullPath(), wxT( "wt" ) );
}
if( file )
{
wxFputs( msg, file );
fclose( file );
}
else
{
msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
if( !wxFile::Exists( fn.GetFullPath() ) )
return 0;
wxFile file( fn.GetFullPath(), wxFile::OpenMode::read );
if( !file.IsOpened() ) // There is a problem to open file
return 0;
// Read entire hotkey set into map
//
wxString input;
std::map<wxString, int> hotkeys;
file.ReadAll( &input );
input.Replace( "\r\n", "\n" ); // Convert Windows files to Unix line-ends
wxStringTokenizer fileTokenizer( input, "\n", wxTOKEN_STRTOK );
while( fileTokenizer.HasMoreTokens() )
{
wxStringTokenizer lineTokenizer( fileTokenizer.GetNextToken(), "\t" );
wxString cmdName = lineTokenizer.GetNextToken();
wxString keyName = lineTokenizer.GetNextToken();
if( !cmdName.IsEmpty() )
hotkeys[ cmdName ] = KeyCodeFromKeyName( keyName );
}
file.Close();
// Overlay this app's hotkey definitions onto the map
//
for( const auto& ii : aActionMap )
{
if( ii.second->GetHotKey() )
hotkeys[ ii.first ] = ii.second->GetHotKey();
}
// Write entire hotkey set
//
file.Open( fn.GetFullPath(), wxFile::OpenMode::write );
for( const auto& ii : hotkeys )
file.Write( wxString::Format( "%s\t%s\n", ii.first, KeyNameFromKeyCode( ii.second ) ) );
file.Close();
return 1;
}
int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList,
const bool aDefaultLocation )
int ReadLegacyHotkeyConfig( const wxString& aAppname, std::map<std::string, int>& aMap )
{
// For Eeschema and Pcbnew frames, we read the new combined file.
// For other kifaces, we read the frame-based file
if( aAppname == LIB_EDIT_FRAME_NAME || aAppname == SCH_EDIT_FRAME_NAME )
{
return ReadLegacyHotkeyConfigFile( EESCHEMA_HOTKEY_NAME, aMap );
}
else if( aAppname == PCB_EDIT_FRAME_NAME || aAppname == FOOTPRINT_EDIT_FRAME_NAME )
{
return ReadLegacyHotkeyConfigFile( PCBNEW_HOTKEY_NAME, aMap );
}
return ReadLegacyHotkeyConfigFile( aAppname, aMap );
}
int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map<std::string, int>& aMap )
{
wxFileName fn( aFilename );
if( aDefaultLocation )
{
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
fn.SetPath( GetKicadConfigPath() );
}
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
fn.SetPath( GetKicadConfigPath() );
if( !wxFile::Exists( fn.GetFullPath() ) )
return 0;
wxFile cfgfile( fn.GetFullPath() );
if( !cfgfile.IsOpened() ) // There is a problem to open file
return 0;
@ -591,43 +505,7 @@ int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* a
data.Replace( "\\n", "\n", true );
// parse
ParseHotkeyConfig( data, aDescList, aFilename );
// cleanup
cfgfile.Close();
return 1;
}
int ReadHotkeyConfig( const wxString& aAppname, struct EDA_HOTKEY_CONFIG* aDescList )
{
// For Eeschema and Pcbnew frames, we read the new combined file.
// For other kifaces, we read the frame-based file
if( aAppname == LIB_EDIT_FRAME_NAME || aAppname == SCH_EDIT_FRAME_NAME )
{
return ReadHotkeyConfigFile( EESCHEMA_HOTKEY_NAME, aDescList );
}
else if( aAppname == PCB_EDIT_FRAME_NAME || aAppname == FOOTPRINT_EDIT_FRAME_NAME )
{
return ReadHotkeyConfigFile( PCBNEW_HOTKEY_NAME, aDescList );
}
return ReadHotkeyConfigFile( aAppname, aDescList );
}
/* Function ParseHotkeyConfig
* the input format is: shortcut "key" "function"
* lines starting by # are ignored (comments)
* lines like [xxx] are tags (example: [common] or [libedit] which identify sections
*/
void ParseHotkeyConfig( const wxString& data,
struct EDA_HOTKEY_CONFIG* aDescList,
const wxString& aAppname )
{
// Read the config
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
EDA_HOTKEY** CurrentHotkeyList = nullptr;
while( tokenizer.HasMoreTokens() )
{
@ -636,38 +514,11 @@ void ParseHotkeyConfig( const wxString& data,
wxString line_type = lineTokenizer.GetNextToken();
if( line_type[0] == '#' ) //comment
if( line_type[0] == '#' ) // comment
continue;
if( line_type[0] == '[' ) // A tag is found. search infos in list
{
CurrentHotkeyList = nullptr;
EDA_HOTKEY_CONFIG* DList = aDescList;
for( ; DList->m_HK_InfoList; DList++ )
{
if( *DList->m_SectionTag == line_type )
{
CurrentHotkeyList = DList->m_HK_InfoList;
break;
}
}
if( line_type[0] == '[' ) // tags ignored reading legacy hotkeys
continue;
}
// Do not accept hotkey assignments from hotkey files that don't match the application
if( aAppname == LIB_EDIT_FRAME_NAME && line_type == wxT( "[eeschema]" ) )
CurrentHotkeyList = nullptr;
if( aAppname == SCH_EDIT_FRAME_NAME && line_type == wxT( "[libedit]" ) )
CurrentHotkeyList = nullptr;
if( aAppname == PCB_EDIT_FRAME_NAME && line_type == wxT( "[footprinteditor]" ) )
CurrentHotkeyList = nullptr;
if( aAppname == FOOTPRINT_EDIT_FRAME_NAME && line_type == wxT( "[pcbnew]" ) )
CurrentHotkeyList = nullptr;
if( line_type == wxT( "$Endlist" ) )
break;
@ -675,9 +526,6 @@ void ParseHotkeyConfig( const wxString& data,
if( line_type != wxT( "shortcut" ) )
continue;
if( CurrentHotkeyList == nullptr )
continue;
// Get the key name
lineTokenizer.SetString( lineTokenizer.GetString(), L"\"\r\n\t ", wxTOKEN_STRTOK );
wxString keyname = lineTokenizer.GetNextToken();
@ -687,22 +535,13 @@ void ParseHotkeyConfig( const wxString& data,
// Get the command name
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
// search the hotkey in current hotkey list
for( EDA_HOTKEY** list = CurrentHotkeyList; *list != nullptr; list++ )
{
EDA_HOTKEY* hk_decr = *list;
if( hk_decr->m_InfoMsg == fctname )
{
int keycode = KeyCodeFromKeyName( keyname );
if( keycode != KEY_NON_FOUND ) // means the key name is found in list or unassigned
hk_decr->m_KeyCode = keycode;
break;
}
}
// Add the pair to the map
aMap[ fctname.ToStdString() ] = KeyCodeFromKeyName( keyname );
}
// cleanup
cfgfile.Close();
return 1;
}
@ -729,8 +568,9 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
if( filename.IsEmpty() )
return;
::ReadHotkeyConfigFile( filename, aDescList, false );
WriteHotkeyConfig( aDescList );
// JEY TODO: implement import of new hotkeys file....
//::ReadHotkeyConfigFile( filename, aDescList, false );
//WriteHotKeyConfig( aDescList );
SetMruPath( wxFileName( filename ).GetPath() );
}
@ -761,7 +601,8 @@ void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList,
if( filename.IsEmpty() )
return;
WriteHotkeyConfig( aDescList, &filename );
// JEY TODO: make this whole routine oboslete?
//WriteHotKeyConfig( aDescList, &filename );
SetMruPath( wxFileName( filename ).GetPath() );
}

View File

@ -178,6 +178,12 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
}
const std::map<std::string, TOOL_ACTION*>& ACTION_MANAGER::GetActions()
{
return m_actionNameIndex;
}
int ACTION_MANAGER::GetHotKey( const TOOL_ACTION& aAction ) const
{
std::map<int, int>::const_iterator it = m_hotkeys.find( aAction.GetId() );
@ -191,13 +197,19 @@ int ACTION_MANAGER::GetHotKey( const TOOL_ACTION& aAction ) const
void ACTION_MANAGER::UpdateHotKeys()
{
std::map<std::string, int> legacyHotKeyMap;
std::map<std::string, int> userHotKeyMap;
m_actionHotKeys.clear();
m_hotkeys.clear();
ReadLegacyHotkeyConfig( m_toolMgr->GetEditFrame()->ConfigBaseName(), legacyHotKeyMap );
// JEY TODO: read user hotkey config...
for( const auto& actionName : m_actionNameIndex )
{
TOOL_ACTION* action = actionName.second;
int hotkey = processHotKey( action );
int hotkey = processHotKey( action, legacyHotKeyMap, userHotKeyMap );
if( hotkey <= 0 )
continue;
@ -218,53 +230,20 @@ void ACTION_MANAGER::UpdateHotKeys()
m_actionHotKeys[hotkey].push_back( action );
m_hotkeys[action->GetId()] = hotkey;
}
}
int ACTION_MANAGER::processHotKey( TOOL_ACTION* aAction )
int ACTION_MANAGER::processHotKey( TOOL_ACTION* aAction, std::map<std::string, int> aLegacyMap,
std::map<std::string, int> aHotKeyMap )
{
int hotkey = aAction->getDefaultHotKey();
if( ( hotkey & TOOL_ACTION::LEGACY_HK ) )
{
hotkey = hotkey & ~TOOL_ACTION::LEGACY_HK; // it leaves only HK_xxx identifier
auto frame = static_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetEditFrame() );
EDA_HOTKEY* hk_desc = nullptr;
if( frame )
hk_desc = frame->GetHotKeyDescription( hotkey );
if( hk_desc )
{
hotkey = hk_desc->m_KeyCode;
// Convert modifiers to the ones used by the Tool Framework
if( hotkey & GR_KB_CTRL )
{
hotkey &= ~GR_KB_CTRL;
hotkey |= MD_CTRL;
}
if( hotkey & GR_KB_ALT )
{
hotkey &= ~GR_KB_ALT;
hotkey |= MD_ALT;
}
if( hotkey & GR_KB_SHIFT )
{
hotkey &= ~GR_KB_SHIFT;
hotkey |= MD_SHIFT;
}
}
else
{
hotkey = 0;
}
}
return hotkey;
aAction->m_hotKey = aAction->m_defaultHotKey;
if( !aAction->m_legacyName.empty() && aLegacyMap.count( aAction->m_legacyName ) )
aAction->m_hotKey = aLegacyMap[ aAction->m_legacyName ];
if( aHotKeyMap.count( aAction->m_name ) )
aAction->m_hotKey = aHotKeyMap[ aAction->m_name ];
return aAction->m_hotKey;
}

View File

@ -1,415 +1,564 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 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 Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <tool/actions.h>
#include <hotkeys.h>
#include <bitmaps.h>
// These members are static in class ACTIONS: Build them here:
TOOL_ACTION ACTIONS::doNew( "common.Control.new",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_NEW ),
AS_GLOBAL,
MD_CTRL + 'N', LEGACY_HK_NAME( "New" ),
_( "New..." ), _( "Create a new document in the editor" ),
new_generic_xpm );
TOOL_ACTION ACTIONS::newLibrary( "common.Control.newLibrary",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "New Library..." ), _( "Create a new library folder" ),
new_generic_xpm );
TOOL_ACTION ACTIONS::addLibrary( "common.Control.addLibrary",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Add Library..." ), _( "Add an existing library folder" ),
add_library_xpm );
TOOL_ACTION ACTIONS::open( "common.Control.open",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
AS_GLOBAL,
MD_CTRL + 'O', LEGACY_HK_NAME( "Open" ),
_( "Open..." ), _( "Open existing document" ),
directory_xpm );
TOOL_ACTION ACTIONS::save( "common.Control.save",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SAVE ),
AS_GLOBAL,
MD_CTRL + 'S', LEGACY_HK_NAME( "Save" ),
_( "Save" ), _( "Save changes" ),
save_xpm );
TOOL_ACTION ACTIONS::saveAs( "common.Control.saveAs",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SAVEAS ),
AS_GLOBAL,
MD_SHIFT + MD_CTRL + 'S', LEGACY_HK_NAME( "Save As" ),
_( "Save As..." ), _( "Save current document to another location" ),
save_as_xpm );
TOOL_ACTION ACTIONS::saveCopyAs( "common.Control.saveCopyAs",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Save Copy As..." ), _( "Save a copy of the current document to another location" ),
save_as_xpm );
TOOL_ACTION ACTIONS::saveAll( "common.Control.saveAll",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Save All" ), _( "Save all changes" ),
save_xpm );
TOOL_ACTION ACTIONS::revert( "common.Control.revert",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Revert" ), _( "Throw away changes" ),
undo_xpm );
TOOL_ACTION ACTIONS::pageSettings( "common.Control.pageSettings",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Page Settings..." ), _( "Settings for paper size and frame references" ),
sheetset_xpm );
TOOL_ACTION ACTIONS::print( "common.Control.print",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_PRINT ),
AS_GLOBAL,
MD_CTRL + 'P', LEGACY_HK_NAME( "Print" ),
_( "Print..." ), _( "Print" ),
print_button_xpm );
TOOL_ACTION ACTIONS::plot( "common.Control.plot",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Plot..." ), _( "Plot" ),
plot_xpm );
TOOL_ACTION ACTIONS::quit( "common.Control.quit",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "", // Not currently in use due to wxWidgets crankiness
_( "Quit" ), _( "Close the current editor" ),
exit_xpm );
// Generic Edit Actions
TOOL_ACTION ACTIONS::cancelInteractive( "common.Interactive.cancel",
AS_GLOBAL, 0, // ESC key is handled in the dispatcher
AS_GLOBAL,
0, "", // ESC key is handled in the dispatcher
_( "Cancel" ), _( "Cancel current tool" ),
cancel_xpm, AF_NONE );
TOOL_ACTION ACTIONS::updateMenu( "common.Interactive.updateMenu",
AS_GLOBAL, 0, "", "" ); // This is an internal event
AS_GLOBAL );
TOOL_ACTION ACTIONS::undo( "common.Interactive.undo",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UNDO ),
AS_GLOBAL,
MD_CTRL + 'Z', LEGACY_HK_NAME( "Undo" ),
_( "Undo" ), _( "Undo last edit" ),
undo_xpm );
TOOL_ACTION ACTIONS::redo( "common.Interactive.redo",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REDO ),
AS_GLOBAL,
#if defined( __WXMAC__ )
MD_SHIFT + MD_CTRL + 'Z',
#else
MD_CTRL + 'Y',
#endif
LEGACY_HK_NAME( "Redo" ),
_( "Redo" ), _( "Redo last edit" ),
redo_xpm );
TOOL_ACTION ACTIONS::cut( "common.Interactive.cut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CUT ),
AS_GLOBAL,
MD_CTRL + 'X', LEGACY_HK_NAME( "Cut" ),
_( "Cut" ), _( "Cut selected item(s) to clipboard" ),
cut_xpm );
TOOL_ACTION ACTIONS::copy( "common.Interactive.copy",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_COPY ),
AS_GLOBAL,
MD_CTRL + 'C', LEGACY_HK_NAME( "Copy" ),
_( "Copy" ), _( "Copy selected item(s) to clipboard" ),
copy_xpm );
TOOL_ACTION ACTIONS::paste( "common.Interactive.paste",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_PASTE ),
AS_GLOBAL,
MD_CTRL + 'V', LEGACY_HK_NAME( "Paste" ),
_( "Paste" ), _( "Paste clipboard into schematic" ),
paste_xpm );
TOOL_ACTION ACTIONS::duplicate( "common.Interactive.duplicate",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DUPLICATE ),
AS_GLOBAL,
MD_CTRL + 'D', LEGACY_HK_NAME( "Duplicate" ),
_( "Duplicate" ), _( "Duplicates the selected item(s)" ),
duplicate_xpm );
TOOL_ACTION ACTIONS::doDelete( "common.Interactive.delete",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DELETE ),
AS_GLOBAL,
WXK_DELETE, LEGACY_HK_NAME( "Delete Item" ),
_( "Delete" ), _( "Deletes selected item(s)" ),
delete_xpm );
TOOL_ACTION ACTIONS::activatePointEditor( "common.Control.activatePointEditor",
AS_GLOBAL, 0, "", "" ); // This is an internal event
AS_GLOBAL );
TOOL_ACTION ACTIONS::find( "common.Interactive.find",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FIND ),
AS_GLOBAL,
MD_CTRL + 'F', LEGACY_HK_NAME( "Find" ),
_( "Find" ), _( "Find text" ),
find_xpm );
TOOL_ACTION ACTIONS::findAndReplace( "common.Interactive.findAndReplace",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REPLACE ),
AS_GLOBAL,
MD_CTRL + MD_ALT + 'F', LEGACY_HK_NAME( "Find and Replace" ),
_( "Find and Replace" ), _( "Find and replace text" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::findNext( "common.Interactive.findNext",
AS_GLOBAL, 0,
AS_GLOBAL,
WXK_F5, LEGACY_HK_NAME( "Find Next" ),
_( "Find Next" ), _( "Find next match" ),
find_xpm );
TOOL_ACTION ACTIONS::findNextMarker( "common.Interactive.findNextMarker",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_FIND_NEXT_MARKER ),
AS_GLOBAL,
MD_SHIFT + WXK_F5, LEGACY_HK_NAME( "Find Next Marker" ),
_( "Find Next Marker" ), "",
find_xpm );
TOOL_ACTION ACTIONS::replaceAndFindNext( "common.Interactive.replaceAndFindNext",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Replace and Find Next" ), _( "Replace current match and find next" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::replaceAll( "common.Interactive.replaceAll",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Replace All" ), _( "Replace all matches" ),
find_replace_xpm );
TOOL_ACTION ACTIONS::updateFind( "common.Control.updateFind",
AS_GLOBAL, 0, "", "" ); // This is an internal event
AS_GLOBAL );
// View Controls
TOOL_ACTION ACTIONS::zoomRedraw( "common.Control.zoomRedraw",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_REDRAW ),
AS_GLOBAL,
#if defined( __WXMAC__ )
MD_CTRL + 'R',
#else
WXK_F3,
#endif
LEGACY_HK_NAME( "Zoom Redraw" ),
_( "Refresh" ), "",
zoom_redraw_xpm );
TOOL_ACTION ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
AS_GLOBAL,
#if defined( __WXMAC__ )
MD_CTRL + '0',
#else
WXK_HOME,
#endif
LEGACY_HK_NAME( "Zoom Auto" ),
_( "Zoom to Fit" ), "",
zoom_fit_in_page_xpm );
TOOL_ACTION ACTIONS::zoomIn( "common.Control.zoomIn",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_IN ),
AS_GLOBAL,
#if defined( __WXMAC__ )
MD_CTRL + '+',
#else
WXK_F1,
#endif
LEGACY_HK_NAME( "Zoom In" ),
_( "Zoom In" ), "",
zoom_in_xpm );
TOOL_ACTION ACTIONS::zoomOut( "common.Control.zoomOut",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_OUT ),
AS_GLOBAL,
#if defined( __WXMAC__ )
MD_CTRL + '-',
#else
WXK_F2,
#endif
LEGACY_HK_NAME( "Zoom Out" ),
_( "Zoom Out" ), "",
zoom_out_xpm );
TOOL_ACTION ACTIONS::zoomInCenter( "common.Control.zoomInCenter",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Zoom In" ), "",
zoom_in_xpm );
TOOL_ACTION ACTIONS::zoomOutCenter( "common.Control.zoomOutCenter",
AS_GLOBAL, 0,
AS_GLOBAL,
0, "",
_( "Zoom Out" ), "",
zoom_out_xpm );
TOOL_ACTION ACTIONS::zoomCenter( "common.Control.zoomCenter",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_CENTER ),
AS_GLOBAL,
WXK_F4, LEGACY_HK_NAME( "Zoom Center" ),
_( "Center" ), "",
zoom_center_on_screen_xpm );
TOOL_ACTION ACTIONS::zoomFitScreen( "common.Control.zoomFitScreen",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_AUTO ),
_( "Zoom to Fit" ), "",
zoom_fit_in_page_xpm );
TOOL_ACTION ACTIONS::zoomTool( "common.Control.zoomTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ZOOM_SELECTION ),
AS_GLOBAL,
MD_CTRL + WXK_F5, LEGACY_HK_NAME( "Zoom to Selection" ),
_( "Zoom to Selection" ), "",
zoom_area_xpm, AF_ACTIVATE );
TOOL_ACTION ACTIONS::zoomPreset( "common.Control.zoomPreset",
AS_GLOBAL, 0,
"", "" );
AS_GLOBAL );
TOOL_ACTION ACTIONS::centerContents( "common.Control.centerContents",
AS_GLOBAL, 0,
"", "" );
AS_GLOBAL );
// Cursor control
TOOL_ACTION ACTIONS::cursorUp( "common.Control.cursorUp",
AS_GLOBAL, WXK_UP,
"", "", NULL, AF_NONE, (void*) CURSOR_UP );
AS_GLOBAL,
WXK_UP, "",
"", "",
nullptr, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION ACTIONS::cursorDown( "common.Control.cursorDown",
AS_GLOBAL, WXK_DOWN,
"", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
AS_GLOBAL,
WXK_DOWN, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_DOWN );
TOOL_ACTION ACTIONS::cursorLeft( "common.Control.cursorLeft",
AS_GLOBAL, WXK_LEFT,
"", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
AS_GLOBAL,
WXK_LEFT, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION ACTIONS::cursorRight( "common.Control.cursorRight",
AS_GLOBAL, WXK_RIGHT,
"", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
AS_GLOBAL,
WXK_RIGHT, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_RIGHT );
TOOL_ACTION ACTIONS::cursorUpFast( "common.Control.cursorUpFast",
AS_GLOBAL, MD_CTRL + WXK_UP,
"", "", NULL, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
AS_GLOBAL,
MD_CTRL + WXK_UP, "",
"", "",
nullptr, AF_NONE, (void*) ( CURSOR_UP | CURSOR_FAST_MOVE ) );
TOOL_ACTION ACTIONS::cursorDownFast( "common.Control.cursorDownFast",
AS_GLOBAL, MD_CTRL + WXK_DOWN,
"", "" , NULL, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
AS_GLOBAL,
MD_CTRL + WXK_DOWN, "",
"", "" ,
nullptr, AF_NONE, (void*) ( CURSOR_DOWN | CURSOR_FAST_MOVE ) );
TOOL_ACTION ACTIONS::cursorLeftFast( "common.Control.cursorLeftFast",
AS_GLOBAL, MD_CTRL + WXK_LEFT,
"", "" , NULL, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
AS_GLOBAL,
MD_CTRL + WXK_LEFT, "",
"", "" ,
nullptr, AF_NONE, (void*) ( CURSOR_LEFT | CURSOR_FAST_MOVE ) );
TOOL_ACTION ACTIONS::cursorRightFast( "common.Control.cursorRightFast",
AS_GLOBAL, MD_CTRL + WXK_RIGHT,
"", "" , NULL, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
AS_GLOBAL,
MD_CTRL + WXK_RIGHT, "",
"", "" ,
nullptr, AF_NONE, (void*) ( CURSOR_RIGHT | CURSOR_FAST_MOVE ) );
TOOL_ACTION ACTIONS::cursorClick( "common.Control.cursorClick",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_CLICK ),
"", "", NULL, AF_NONE, (void*) CURSOR_CLICK );
AS_GLOBAL,
WXK_RETURN, LEGACY_HK_NAME( "Mouse Left Click" ),
"", "",
nullptr, AF_NONE, (void*) CURSOR_CLICK );
TOOL_ACTION ACTIONS::cursorDblClick( "common.Control.cursorDblClick",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEFT_DCLICK ),
"", "", NULL, AF_NONE, (void*) CURSOR_DBL_CLICK );
AS_GLOBAL,
WXK_END, LEGACY_HK_NAME( "Mouse Left Double Click" ),
"", "",
nullptr, 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 );
AS_GLOBAL,
MD_SHIFT + WXK_UP, "",
"", "",
nullptr, AF_NONE, (void*) CURSOR_UP );
TOOL_ACTION ACTIONS::panDown( "common.Control.panDown",
AS_GLOBAL, MD_SHIFT + WXK_DOWN,
"", "" , NULL, AF_NONE, (void*) CURSOR_DOWN );
AS_GLOBAL,
MD_SHIFT + WXK_DOWN, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_DOWN );
TOOL_ACTION ACTIONS::panLeft( "common.Control.panLeft",
AS_GLOBAL, MD_SHIFT + WXK_LEFT,
"", "" , NULL, AF_NONE, (void*) CURSOR_LEFT );
AS_GLOBAL,
MD_SHIFT + WXK_LEFT, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_LEFT );
TOOL_ACTION ACTIONS::panRight( "common.Control.panRight",
AS_GLOBAL, MD_SHIFT + WXK_RIGHT,
"", "" , NULL, AF_NONE, (void*) CURSOR_RIGHT );
AS_GLOBAL,
MD_SHIFT + WXK_RIGHT, "",
"", "" ,
nullptr, AF_NONE, (void*) CURSOR_RIGHT );
// Grid control
TOOL_ACTION ACTIONS::gridFast1( "common.Control.gridFast1",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID1 ),
AS_GLOBAL,
MD_ALT + '1', LEGACY_HK_NAME( "Switch Grid To Fast Grid1" ),
"", "" );
TOOL_ACTION ACTIONS::gridFast2( "common.Control.gridFast2",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_FASTGRID2 ),
AS_GLOBAL,
MD_ALT + '2', LEGACY_HK_NAME( "Switch Grid To Fast Grid2" ),
"", "" );
TOOL_ACTION ACTIONS::gridNext( "common.Control.gridNext",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_NEXT ),
AS_GLOBAL,
'N', LEGACY_HK_NAME( "Switch Grid To Next" ),
"", "" );
TOOL_ACTION ACTIONS::gridPrev( "common.Control.gridPrev",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_GRID_TO_PREVIOUS ),
AS_GLOBAL, MD_SHIFT + 'N', LEGACY_HK_NAME( "Switch Grid To Previous" ),
"", "" );
TOOL_ACTION ACTIONS::gridSetOrigin( "common.Control.gridSetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SET_GRID_ORIGIN ),
AS_GLOBAL,
'S', LEGACY_HK_NAME( "Set Grid Origin" ),
_( "Grid Origin" ), _( "Set the grid origin point" ),
grid_select_axis_xpm );
TOOL_ACTION ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_GRID_ORIGIN ),
AS_GLOBAL,
'Z', LEGACY_HK_NAME( "Reset Grid Origin" ),
"", "" );
TOOL_ACTION ACTIONS::gridPreset( "common.Control.gridPreset",
AS_GLOBAL, 0,
"", "" );
AS_GLOBAL );
TOOL_ACTION ACTIONS::toggleGrid( "common.Control.toggleGrid",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Grid" ), _( "Display grid dots or lines in the edit window" ),
grid_xpm );
TOOL_ACTION ACTIONS::gridProperties( "common.Control.gridProperties",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Grid Properties..." ), _( "Set grid dimensions" ),
grid_select_xpm );
TOOL_ACTION ACTIONS::imperialUnits( "common.Control.imperialUnits",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Imperial" ), _( "Use inches and mils" ),
unit_inch_xpm );
TOOL_ACTION ACTIONS::metricUnits( "common.Control.metricUnits",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Metric" ), _( "Use millimeters" ),
unit_mm_xpm );
TOOL_ACTION ACTIONS::toggleUnits( "common.Control.toggleUnits",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_UNITS ),
AS_GLOBAL,
MD_CTRL + 'U', LEGACY_HK_NAME( "Switch Units" ),
_( "Switch units" ), _( "Switch between inches and millimeters" ),
unit_mm_xpm );
TOOL_ACTION ACTIONS::togglePolarCoords( "common.Control.togglePolarCoords",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Polar Coordinates" ), _( "Switch between polar and cartesian coordinate systems" ),
polar_coord_xpm );
TOOL_ACTION ACTIONS::resetLocalCoords( "common.Control.resetLocalCoords",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_RESET_LOCAL_COORD ),
AS_GLOBAL,
' ', LEGACY_HK_NAME( "Reset Local Coordinates" ),
"", "" );
TOOL_ACTION ACTIONS::toggleCursor( "common.Control.toggleCursor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_TOGGLE_CURSOR ),
AS_GLOBAL,
MD_CTRL + MD_SHIFT + 'X', LEGACY_HK_NAME( "Toggle Cursor Display (Modern Toolset only)" ),
_( "Always Show Cursor" ), _( "Display crosshairs even in selection tool" ),
cursor_xpm );
TOOL_ACTION ACTIONS::toggleCursorStyle( "common.Control.toggleCursorStyle",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Full-Window Crosshairs" ), _( "Switch display of full-window crosshairs" ),
cursor_shape_xpm );
TOOL_ACTION ACTIONS::highContrastMode( "common.Control.highContrastMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_HIGHCONTRAST_MODE ),
AS_GLOBAL,
MD_CTRL + 'H', LEGACY_HK_NAME( "Toggle High Contrast Mode" ),
_( "High Contrast Mode" ), _( "Use high contrast display mode" ),
contrast_mode_xpm );
TOOL_ACTION ACTIONS::highContrastInc( "common.Control.highContrastInc",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_INC ),
"", "" );
TOOL_ACTION ACTIONS::highContrastDec( "common.Control.highContrastDec",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HIGHCONTRAST_DEC ),
"", "" );
TOOL_ACTION ACTIONS::selectionTool( "common.InteractiveSelection.selectionTool",
AS_GLOBAL, 0, _( "Select item(s)" ), "",
AS_GLOBAL, 0, "",
_( "Select item(s)" ), "",
cursor_xpm, AF_ACTIVATE );
TOOL_ACTION ACTIONS::measureTool( "common.InteractiveEdit.measureTool",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MEASURE_TOOL ),
AS_GLOBAL,
MD_CTRL + MD_SHIFT + 'M', LEGACY_HK_NAME( "Measure Distance (Modern Toolset only)" ),
_( "Measure Tool" ), _( "Interactively measure distance between points" ),
measurement_xpm, AF_ACTIVATE );
TOOL_ACTION ACTIONS::show3DViewer( "common.Control.show3DViewer",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_3D_VIEWER ),
AS_GLOBAL,
MD_ALT + '3', LEGACY_HK_NAME( "3D Viewer" ),
_( "3D Viewer" ), _( "Show 3D viewer window" ),
three_d_xpm );
TOOL_ACTION ACTIONS::showSymbolBrowser( "common.Control.showSymbolBrowser",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Symbol Library Browser" ), _( "Browse symbol libraries" ),
library_browse_xpm );
TOOL_ACTION ACTIONS::showSymbolEditor( "common.Control.showSymbolEditor",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Symbol Editor" ), _( "Create, delete and edit symbols" ),
libedit_xpm );
TOOL_ACTION ACTIONS::showFootprintBrowser( "common.Control.showFootprintBrowser",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Footprint Library Browser" ), _( "Browse footprint libraries" ),
modview_icon_xpm );
TOOL_ACTION ACTIONS::showFootprintEditor( "common.Control.showFootprintEditor",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Footprint Editor" ), _( "Create, delete and edit footprints" ),
module_editor_xpm );
TOOL_ACTION ACTIONS::updatePcbFromSchematic( "common.Control.updatePcbFromSchematic",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UPDATE_PCB_FROM_SCH ),
AS_GLOBAL,
WXK_F8, LEGACY_HK_NAME( "Update PCB from Schematic" ),
_( "Update PCB from Schematic..." ), _( "Push changes from schematic to PCB" ),
update_pcb_from_sch_xpm );
TOOL_ACTION ACTIONS::configurePaths( "common.Control.configurePaths",
AS_GLOBAL, 0,
_( "Configure Paths..." ), _( "Edit path configuration environment variables" ),
path_xpm );
TOOL_ACTION ACTIONS::showSymbolLibTable( "common.Control.showSymbolLibTable",
AS_GLOBAL, 0,
_( "Manage Symbol Libraries..." ),
_( "Edit the global and project symbol library lists" ),
library_table_xpm );
TOOL_ACTION ACTIONS::showFootprintLibTable( "common.Control.showFootprintLibTable",
AS_GLOBAL, 0,
_( "Manage Footprint Libraries..." ),
_( "Edit the global and project footprint library lists" ),
library_table_xpm );
TOOL_ACTION ACTIONS::acceleratedGraphics( "common.Control.acceleratedGraphics",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_OPENGL ),
AS_GLOBAL,
#ifdef __WXMAC__
MD_ALT + WXK_F11,
#else
WXK_F11,
#endif
LEGACY_HK_NAME( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
_( "Accelerated Graphics" ), _( "Use hardware-accelerated graphics (recommended)" ),
tools_xpm );
TOOL_ACTION ACTIONS::standardGraphics( "common.Control.standardGraphics",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_CANVAS_CAIRO ),
AS_GLOBAL,
#ifdef __WXMAC__
MD_ALT + WXK_F12,
#else
WXK_F12,
#endif
LEGACY_HK_NAME( "Switch to Modern Toolset with software graphics (fall-back)" ),
_( "Standard Graphics" ), _( "Use software graphics (fall-back)" ),
tools_xpm );
TOOL_ACTION ACTIONS::configurePaths( "common.SuiteControl.configurePaths",
AS_GLOBAL, 0, "",
_( "Configure Paths..." ), _( "Edit path configuration environment variables" ),
path_xpm );
TOOL_ACTION ACTIONS::showSymbolLibTable( "common.SuiteControl.showSymbolLibTable",
AS_GLOBAL, 0, "",
_( "Manage Symbol Libraries..." ),
_( "Edit the global and project symbol library lists" ),
library_table_xpm );
TOOL_ACTION ACTIONS::showFootprintLibTable( "common.SuiteControl.showFootprintLibTable",
AS_GLOBAL, 0, "",
_( "Manage Footprint Libraries..." ),
_( "Edit the global and project footprint library lists" ),
library_table_xpm );
TOOL_ACTION ACTIONS::gettingStarted( "common.SuiteControl.gettingStarted",
AS_GLOBAL, 0, "",
_( "Getting Started with KiCad" ),
_( "Open \"Getting Started in KiCad\" guide for beginners" ),
help_xpm );
TOOL_ACTION ACTIONS::help( "common.SuiteControl.help",
AS_GLOBAL, 0, "",
_( "Help" ),
_( "Open product documentation in a web browser" ),
online_help_xpm );
TOOL_ACTION ACTIONS::listHotKeys( "common.SuiteControl.listHotKeys",
AS_GLOBAL,
MD_CTRL + WXK_F1, LEGACY_HK_NAME( "List Hotkeys" ),
_( "List Hotkeys..." ),
_( "Displays current hotkeys table and corresponding commands" ),
hotkeys_xpm );
TOOL_ACTION ACTIONS::getInvolved( "common.SuiteControl.getInvolved",
AS_GLOBAL, 0, "",
_( "Get Involved" ),
_( "Open \"Contribute to KiCad\" in a web browser" ),
info_xpm );
// System-wide selection Events

View File

@ -0,0 +1,201 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014-2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* 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 <bitmaps.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
#include <eda_draw_frame.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <base_screen.h>
#include <tool/common_control.h>
#include <id.h>
#include <project.h>
#include <kiface_i.h>
#include <dialog_configure_paths.h>
#include <eda_doc.h>
#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
void COMMON_CONTROL::Reset( RESET_REASON aReason )
{
m_frame = getEditFrame<EDA_BASE_FRAME>();
}
int COMMON_CONTROL::ConfigurePaths( const TOOL_EVENT& aEvent )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( m_frame, DIALOG_CONFIGUREPATHS, &m_frame->Kiway() );
return 0;
}
int COMMON_CONTROL::ShowLibraryTable( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &ACTIONS::showSymbolLibTable ) )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
kiface->CreateWindow( m_frame, DIALOG_SCH_LIBRARY_TABLE, &m_frame->Kiway() );
}
else if( aEvent.IsAction( &ACTIONS::showFootprintLibTable ) )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( m_frame, DIALOG_PCB_LIBRARY_TABLE, &m_frame->Kiway() );
}
return 0;
}
int COMMON_CONTROL::ShowPlayer( const TOOL_EVENT& aEvent )
{
FRAME_T playerType = FRAME_SCH_VIEWER;
if( aEvent.IsAction( &ACTIONS::showSymbolBrowser ) )
playerType = FRAME_SCH_VIEWER;
else if( aEvent.IsAction( &ACTIONS::showSymbolEditor ) )
playerType = FRAME_SCH_LIB_EDITOR;
else if( aEvent.IsAction( &ACTIONS::showFootprintBrowser ) )
playerType = FRAME_PCB_MODULE_VIEWER;
else if( aEvent.IsAction( &ACTIONS::showFootprintEditor ) )
playerType = FRAME_PCB_MODULE_EDITOR;
else
wxFAIL_MSG( "ShowPlayer(): unexpected request" );
KIWAY_PLAYER* editor = m_frame->Kiway().Player( playerType, true );
// Needed on Windows, other platforms do not use it, but it creates no issue
if( editor->IsIconized() )
editor->Iconize( false );
editor->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != editor )
editor->SetFocus();
return 0;
}
int COMMON_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
const SEARCH_STACK& search = m_frame->sys_search();
wxString helpFile;
wxString msg;
/* We have to get document for beginners,
* or the full specific doc
* if event id is wxID_INDEX, we want the document for beginners.
* else the specific doc file (its name is in Kiface().GetHelpFileName())
* The document for beginners is the same for all KiCad utilities
*/
if( aEvent.IsAction( &ACTIONS::gettingStarted ) )
{
// List of possible names for Getting Started in KiCad
const wxChar* names[2] = {
wxT( "getting_started_in_kicad" ),
wxT( "Getting_Started_in_KiCad" )
};
// Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
// or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
for( auto& name : names )
{
helpFile = SearchHelpFileFullPath( search, name );
if( !helpFile.IsEmpty() )
break;
}
if( !helpFile )
{
msg = wxString::Format( _( "Html or pdf help file \n%s\nor\n%s could not be found." ),
names[0], names[1] );
wxMessageBox( msg );
return -1;
}
}
else
{
wxString base_name = m_frame->help_name();
helpFile = SearchHelpFileFullPath( search, base_name );
if( !helpFile )
{
msg = wxString::Format( _( "Help file \"%s\" could not be found." ), base_name );
wxMessageBox( msg );
return -1;
}
}
GetAssociatedDocument( m_frame, helpFile );
return 0;
}
int COMMON_CONTROL::ListHotKeys( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_toolMgr );
return 0;
}
int COMMON_CONTROL::GetInvolved( const TOOL_EVENT& aEvent )
{
if( !wxLaunchDefaultBrowser( URL_GET_INVOLVED ) )
{
wxString msg;
msg.Printf( _( "Could not launch the default browser.\n"
"For information on how to help the KiCad project, visit %s" ),
URL_GET_INVOLVED );
wxMessageBox( msg, _( "Get involved with KiCad" ), wxOK, m_frame );
}
return 0;
}
void COMMON_CONTROL::setTransitions()
{
Go( &COMMON_CONTROL::ConfigurePaths, ACTIONS::configurePaths.MakeEvent() );
Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showSymbolLibTable.MakeEvent() );
Go( &COMMON_CONTROL::ShowLibraryTable, ACTIONS::showFootprintLibTable.MakeEvent() );
Go( &COMMON_CONTROL::ShowPlayer, ACTIONS::showSymbolBrowser.MakeEvent() );
Go( &COMMON_CONTROL::ShowPlayer, ACTIONS::showSymbolEditor.MakeEvent() );
Go( &COMMON_CONTROL::ShowPlayer, ACTIONS::showFootprintBrowser.MakeEvent() );
Go( &COMMON_CONTROL::ShowPlayer, ACTIONS::showFootprintEditor.MakeEvent() );
Go( &COMMON_CONTROL::ShowHelp, ACTIONS::gettingStarted.MakeEvent() );
Go( &COMMON_CONTROL::ShowHelp, ACTIONS::help.MakeEvent() );
Go( &COMMON_CONTROL::ListHotKeys, ACTIONS::listHotKeys.MakeEvent() );
Go( &COMMON_CONTROL::GetInvolved, ACTIONS::getInvolved.MakeEvent() );
}

View File

@ -31,7 +31,6 @@
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <base_screen.h>
#include <hotkeys.h>
#include <tool/common_tools.h>
#include <id.h>
#include <project.h>
@ -494,31 +493,6 @@ int COMMON_TOOLS::ToggleCursorStyle( const TOOL_EVENT& aEvent )
}
int COMMON_TOOLS::ConfigurePaths( const TOOL_EVENT& aEvent )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( m_frame, DIALOG_CONFIGUREPATHS, &m_frame->Kiway() );
return 0;
}
int COMMON_TOOLS::ShowLibraryTable( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &ACTIONS::showSymbolLibTable ) )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_SCH );
kiface->CreateWindow( m_frame, DIALOG_SCH_LIBRARY_TABLE, &m_frame->Kiway() );
}
else if( aEvent.IsAction( &ACTIONS::showFootprintLibTable ) )
{
KIFACE* kiface = m_frame->Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( m_frame, DIALOG_PCB_LIBRARY_TABLE, &m_frame->Kiway() );
}
return 0;
}
int COMMON_TOOLS::SwitchCanvas( const TOOL_EVENT& aEvent )
{
if( aEvent.IsAction( &ACTIONS::acceleratedGraphics ) )
@ -532,38 +506,6 @@ int COMMON_TOOLS::SwitchCanvas( const TOOL_EVENT& aEvent )
}
int COMMON_TOOLS::ShowPlayer( const TOOL_EVENT& aEvent )
{
FRAME_T playerType = FRAME_SCH_VIEWER;
if( aEvent.IsAction( &ACTIONS::showSymbolBrowser ) )
playerType = FRAME_SCH_VIEWER;
else if( aEvent.IsAction( &ACTIONS::showSymbolEditor ) )
playerType = FRAME_SCH_LIB_EDITOR;
else if( aEvent.IsAction( &ACTIONS::showFootprintBrowser ) )
playerType = FRAME_PCB_MODULE_VIEWER;
else if( aEvent.IsAction( &ACTIONS::showFootprintEditor ) )
playerType = FRAME_PCB_MODULE_EDITOR;
else
wxFAIL_MSG( "ShowPlayer(): unexpected request" );
KIWAY_PLAYER* editor = m_frame->Kiway().Player( playerType, true );
// Needed on Windows, other platforms do not use it, but it creates no issue
if( editor->IsIconized() )
editor->Iconize( false );
editor->Raise();
// Raising the window does not set the focus on Linux. This should work on
// any platform.
if( wxWindow::FindFocus() != editor )
editor->SetFocus();
return 0;
}
void COMMON_TOOLS::setTransitions()
{
// Cursor control
@ -594,33 +536,27 @@ void COMMON_TOOLS::setTransitions()
Go( &COMMON_TOOLS::ZoomCenter, ACTIONS::zoomCenter.MakeEvent() );
Go( &COMMON_TOOLS::ZoomFitScreen, ACTIONS::zoomFitScreen.MakeEvent() );
Go( &COMMON_TOOLS::ZoomPreset, ACTIONS::zoomPreset.MakeEvent() );
Go( &COMMON_TOOLS::CenterContents, ACTIONS::centerContents.MakeEvent() );
// Grid control
Go( &COMMON_TOOLS::GridNext, ACTIONS::gridNext.MakeEvent() );
Go( &COMMON_TOOLS::GridPrev, ACTIONS::gridPrev.MakeEvent() );
Go( &COMMON_TOOLS::GridPreset, ACTIONS::gridPreset.MakeEvent() );
Go( &COMMON_TOOLS::ToggleGrid, ACTIONS::toggleGrid.MakeEvent() );
Go( &COMMON_TOOLS::GridProperties, ACTIONS::gridProperties.MakeEvent() );
// Units and coordinates
Go( &COMMON_TOOLS::ImperialUnits, ACTIONS::imperialUnits.MakeEvent() );
Go( &COMMON_TOOLS::MetricUnits, ACTIONS::metricUnits.MakeEvent() );
Go( &COMMON_TOOLS::ToggleUnits, ACTIONS::toggleUnits.MakeEvent() );
Go( &COMMON_TOOLS::TogglePolarCoords, ACTIONS::togglePolarCoords.MakeEvent() );
Go( &COMMON_TOOLS::ResetLocalCoords, ACTIONS::resetLocalCoords.MakeEvent() );
// Misc
Go( &COMMON_TOOLS::ToggleCursor, ACTIONS::toggleCursor.MakeEvent() );
Go( &COMMON_TOOLS::ToggleCursorStyle, ACTIONS::toggleCursorStyle.MakeEvent() );
Go( &COMMON_TOOLS::ConfigurePaths, ACTIONS::configurePaths.MakeEvent() );
Go( &COMMON_TOOLS::ShowLibraryTable, ACTIONS::showSymbolLibTable.MakeEvent() );
Go( &COMMON_TOOLS::ShowLibraryTable, ACTIONS::showFootprintLibTable.MakeEvent() );
Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::acceleratedGraphics.MakeEvent() );
Go( &COMMON_TOOLS::SwitchCanvas, ACTIONS::standardGraphics.MakeEvent() );
Go( &COMMON_TOOLS::ShowPlayer, ACTIONS::showSymbolBrowser.MakeEvent() );
Go( &COMMON_TOOLS::ShowPlayer, ACTIONS::showSymbolEditor.MakeEvent() );
Go( &COMMON_TOOLS::ShowPlayer, ACTIONS::showFootprintBrowser.MakeEvent() );
Go( &COMMON_TOOLS::ShowPlayer, ACTIONS::showFootprintEditor.MakeEvent() );
}

View File

@ -28,11 +28,19 @@
#include <algorithm>
TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope,
int aDefaultHotKey, const wxString& aMenuItem, const wxString& aMenuDesc,
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
m_menuItem( aMenuItem ), m_menuDescription( aMenuDesc ),
m_icon( aIcon ), m_id( -1 ), m_flags( aFlags ), m_param( aParam )
int aDefaultHotKey, const std::string& aLegacyHotKeyName,
const wxString& aMenuText, const wxString& aTooltip,
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
m_name( aName ),
m_scope( aScope ),
m_defaultHotKey( aDefaultHotKey ),
m_legacyName( aLegacyHotKeyName ),
m_menuText( aMenuText ),
m_tooltip( aTooltip ),
m_icon( aIcon ),
m_id( -1 ),
m_flags( aFlags ),
m_param( aParam )
{
ACTION_MANAGER::GetActionList().push_back( this );
}

View File

@ -45,7 +45,7 @@ KIGFX::VIEW_CONTROLS* TOOL_BASE::getViewControls() const
}
wxWindow* TOOL_BASE::getEditFrameInt() const
EDA_BASE_FRAME* TOOL_BASE::getEditFrameInt() const
{
return m_toolMgr->GetEditFrame();
}

View File

@ -26,7 +26,6 @@
#include <map>
#include <stack>
#include <algorithm>
#include <core/optional.h>
#include <wx/event.h>
@ -311,6 +310,12 @@ void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aPara
}
const std::map<std::string, TOOL_ACTION*>& TOOL_MANAGER::GetActions()
{
return m_actionMgr->GetActions();
}
int TOOL_MANAGER::GetHotKey( const TOOL_ACTION& aAction )
{
return m_actionMgr->GetHotKey( aAction );
@ -464,6 +469,8 @@ void TOOL_MANAGER::InitTools()
}
}
m_actionMgr->UpdateHotKeys();
ResetTools( TOOL_BASE::RUN );
}
@ -863,7 +870,6 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
m_view = aView;
m_viewControls = aViewControls;
m_frame = aFrame;
m_actionMgr->UpdateHotKeys();
}

View File

@ -46,15 +46,6 @@ void ZOOM_TOOL::Reset( RESET_REASON aReason )
int ZOOM_TOOL::Main( const TOOL_EVENT& aEvent )
{
// This method is called both when the zoom tool is activated (on) or deactivated (off)
wxMenuBar* menu = m_frame->GetMenuBar();
bool zoom_tool_is_on = m_frame->GetToolToggled( ID_ZOOM_SELECTION ) ||
( menu && menu->IsChecked( ID_ZOOM_SELECTION ) );
if( !zoom_tool_is_on ) // This is a tool deselection: do nothing
return 0;
m_frame->SetToolID( ID_ZOOM_SELECTION, wxCURSOR_MAGNIFIER, _( "Zoom to selection" ) );
while( auto evt = Wait() )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2016 Chris Pavlina <pavlina.chris@gmail.com>
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -23,11 +23,9 @@
*/
#include <cctype>
#include <widgets/widget_hotkey_list.h>
#include <wx/statline.h>
#include <tool/tool_action.h>
#include <eda_draw_frame.h>
#include <dialog_shim.h>
@ -59,14 +57,14 @@ enum ID_WHKL_MENU_IDS
*/
class WIDGET_HOTKEY_CLIENT_DATA : public wxClientData
{
CHANGED_HOTKEY& m_changed_hotkey;
HOTKEY& m_changed_hotkey;
public:
WIDGET_HOTKEY_CLIENT_DATA( CHANGED_HOTKEY& aChangedHotkey )
WIDGET_HOTKEY_CLIENT_DATA( HOTKEY& aChangedHotkey )
: m_changed_hotkey( aChangedHotkey )
{}
CHANGED_HOTKEY& GetChangedHotkey() { return m_changed_hotkey; }
HOTKEY& GetChangedHotkey() { return m_changed_hotkey; }
};
@ -245,17 +243,17 @@ public:
*
* @return true on match (or if filter is disabled)
*/
bool FilterMatches( const EDA_HOTKEY& aHotkey ) const
bool FilterMatches( const HOTKEY& aHotkey ) const
{
if( !m_valid )
return true;
// Match in the (translated) filter string
const auto normedInfo = wxGetTranslation( aHotkey.m_InfoMsg ).Upper();
const auto normedInfo = wxGetTranslation( aHotkey.m_Parent->GetMenuItem() ).Upper();
if( normedInfo.Contains( m_normalised_filter_str ) )
return true;
const wxString keyName = KeyNameFromKeyCode( aHotkey.m_KeyCode );
const wxString keyName = KeyNameFromKeyCode( aHotkey.m_EditKeycode );
if( keyName.Upper().Contains( m_normalised_filter_str ) )
return true;
@ -275,25 +273,11 @@ WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::GetHKClientData( wxTreeListItem a
{
wxClientData* data = GetItemData( aItem );
if( !data )
{
return NULL;
}
else
{
if( data )
return static_cast<WIDGET_HOTKEY_CLIENT_DATA*>( data );
}
}
else
{
return NULL;
}
}
WIDGET_HOTKEY_CLIENT_DATA* WIDGET_HOTKEY_LIST::GetSelHKClientData()
{
return GetHKClientData( GetSelection() );
return nullptr;
}
@ -318,15 +302,17 @@ void WIDGET_HOTKEY_LIST::UpdateFromClientData()
if( hkdata )
{
const auto& changed_hk = hkdata->GetChangedHotkey();
const EDA_HOTKEY& hk = changed_hk.GetCurrentValue();
wxString key_text = KeyNameFromKeyCode( hk.m_KeyCode );
wxString label = changed_hk.m_Parent->GetMenuItem();
wxString key_text = KeyNameFromKeyCode( changed_hk.m_EditKeycode );
if( label.IsEmpty() )
label = changed_hk.m_Parent->GetName();
// mark unsaved changes
if( changed_hk.HasUnsavedChange() )
if( changed_hk.m_EditKeycode != changed_hk.m_Parent->GetHotKey() )
key_text += " *";
SetItemText( i, 0, wxGetTranslation( hk.m_InfoMsg ) );
SetItemText( i, 0, label );
SetItemText( i, 1, key_text);
}
}
@ -337,23 +323,16 @@ void WIDGET_HOTKEY_LIST::UpdateFromClientData()
}
void WIDGET_HOTKEY_LIST::changeHotkey( CHANGED_HOTKEY& aHotkey, long aKey )
void WIDGET_HOTKEY_LIST::changeHotkey( HOTKEY& aHotkey, long aKey )
{
// See if this key code is handled in hotkeys names list
bool exists;
KeyNameFromKeyCode( aKey, &exists );
auto& curr_hk = aHotkey.GetCurrentValue();
if( exists && curr_hk.m_KeyCode != aKey )
if( exists && aHotkey.m_EditKeycode != aKey )
{
const auto& tag = aHotkey.GetSectionTag();
bool can_update = ResolveKeyConflicts( aKey, tag );
if( can_update )
{
curr_hk.m_KeyCode = aKey;
}
if( ResolveKeyConflicts( aHotkey.m_Parent, aKey ) )
aHotkey.m_EditKeycode = aKey;
}
}
@ -387,9 +366,8 @@ void WIDGET_HOTKEY_LIST::ResetItem( wxTreeListItem aItem )
return;
auto& changed_hk = hkdata->GetChangedHotkey();
const auto& orig_hk = changed_hk.GetOriginalValue();
changeHotkey( changed_hk, orig_hk.m_KeyCode );
changeHotkey( changed_hk, changed_hk.m_Parent->GetHotKey() );
UpdateFromClientData();
}
@ -403,7 +381,7 @@ void WIDGET_HOTKEY_LIST::ResetItemToDefault( wxTreeListItem aItem )
auto& changed_hk = hkdata->GetChangedHotkey();
changeHotkey( changed_hk, changed_hk.GetCurrentValue().GetDefaultKeyCode() );
changeHotkey( changed_hk, changed_hk.m_Parent->GetDefaultHotKey() );
UpdateFromClientData();
}
@ -469,45 +447,38 @@ void WIDGET_HOTKEY_LIST::OnMenu( wxCommandEvent& aEvent )
}
bool WIDGET_HOTKEY_LIST::ResolveKeyConflicts( long aKey, const wxString& aSectionTag )
bool WIDGET_HOTKEY_LIST::ResolveKeyConflicts( TOOL_ACTION* aAction, long aKey )
{
EDA_HOTKEY* conflicting_key = nullptr;
EDA_HOTKEY_CONFIG* conflicting_section = nullptr;
HOTKEY* conflictingHotKey = nullptr;
m_hk_store.CheckKeyConflicts( aKey, aSectionTag, &conflicting_key, &conflicting_section );
m_hk_store.CheckKeyConflicts( aAction, aKey, &conflictingHotKey );
if( conflicting_key != nullptr )
{
wxString info = wxGetTranslation( conflicting_key->m_InfoMsg );
wxString msg = wxString::Format(
_( "\"%s\" is already assigned to \"%s\" in section \"%s\". Are you sure you want "
"to change its assignment?" ),
KeyNameFromKeyCode( aKey ), GetChars( info ),
*(conflicting_section->m_Title) );
wxMessageDialog dlg( GetParent(), msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
if( dlg.ShowModal() == wxID_YES )
{
// Reset the other hotkey
conflicting_key->m_KeyCode = 0;
UpdateFromClientData();
return true;
}
else
{
return false;
}
}
else
if( !conflictingHotKey )
return true;
TOOL_ACTION* conflictingAction = conflictingHotKey->m_Parent;
wxString msg = wxString::Format( _( "\"%s\" is already assigned to \"%s\" in section \"%s\". "
"Are you sure you want to change its assignment?" ),
KeyNameFromKeyCode( aKey ),
conflictingAction->GetMenuItem(),
HOTKEY_STORE::GetSectionName( conflictingAction ) );
wxMessageDialog dlg( GetParent(), msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT );
if( dlg.ShowModal() == wxID_YES )
{
// Reset the other hotkey
conflictingHotKey->m_EditKeycode = 0;
UpdateFromClientData();
return true;
}
return false;
}
WIDGET_HOTKEY_LIST::WIDGET_HOTKEY_LIST( wxWindow* aParent, HOTKEY_STORE& aHotkeyStore,
bool aReadOnly )
bool aReadOnly )
: TWO_COLUMN_TREE_LIST( aParent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTL_SINGLE ),
m_hk_store( aHotkeyStore ),
m_readOnly( aReadOnly )
@ -573,14 +544,14 @@ void WIDGET_HOTKEY_LIST::updateShownItems( const wxString& aFilterStr )
HOTKEY_FILTER filter( aFilterStr );
for( auto& section: m_hk_store.GetSections() )
for( HOTKEY_SECTION& section: m_hk_store.GetSections() )
{
// Create parent tree item
wxTreeListItem parent = AppendItem( GetRootItem(), section.m_name );
wxTreeListItem parent = AppendItem( GetRootItem(), section.m_SectionName );
for( auto& hotkey: section.m_hotkeys )
for( HOTKEY& hotkey: section.m_HotKeys )
{
if( filter.FilterMatches( hotkey.GetCurrentValue() ) )
if( filter.FilterMatches( hotkey ) )
{
wxTreeListItem item = AppendItem( parent, wxEmptyString );
SetItemData( item, new WIDGET_HOTKEY_CLIENT_DATA( hotkey ) );

View File

@ -23,10 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file cvpcb_mainframe.cpp
*/
#include <fctsys.h>
#include <build_version.h>
#include <kiway_express.h>
@ -48,7 +44,7 @@
#include <invoke_pcb_dialog.h>
#include <display_footprints_frame.h>
#include <cvpcb_id.h>
#include <tool/action_toolbar.h>
#include <cvpcb_mainframe.h>
wxSize const FRAME_MIN_SIZE_DU( 350, 250 );
@ -65,7 +61,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
// Menu events
EVT_MENU( ID_SAVE_PROJECT, CVPCB_MAINFRAME::OnSaveAndContinue )
EVT_MENU( wxID_EXIT, CVPCB_MAINFRAME::OnQuit )
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, CVPCB_MAINFRAME::OnConfigurePaths )
EVT_MENU( ID_CVPCB_EQUFILES_LIST_EDIT, CVPCB_MAINFRAME::OnEditEquFilesList )
// Toolbar events

View File

@ -25,8 +25,6 @@
#include <fctsys.h>
#include <common.h>
#include <gal/graphics_abstraction_layer.h>
#include <class_draw_panel_gal.h>
#include <pcb_draw_panel_gal.h>
#include <confirm.h>
#include <macros.h>
@ -36,7 +34,6 @@
#include <lib_id.h>
#include <fp_lib_table.h>
#include <eda_dockart.h>
#include <io_mgr.h>
#include <class_module.h>
#include <class_board.h>
#include <pcb_painter.h>
@ -44,10 +41,10 @@
#include <display_footprints_frame.h>
#include <cvpcb_id.h>
#include <listboxes.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <view/view.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/cvpcb_actions.h>

View File

@ -102,9 +102,6 @@ public:
void InstallOptionsDisplay( wxCommandEvent& event );
MODULE* Get_Module( const wxString& CmpName );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override { return NULL; }
/* SaveCopyInUndoList() virtual
* currently: do nothing in CvPcb.
* but but be defined because it is a pure virtual in PCB_BASE_FRAME

View File

@ -55,6 +55,7 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
wxMenu* preferencesMenu = new wxMenu;
// Path configuration edit dialog.
// JEY TODO: fix these....
AddMenuItem( preferencesMenu,
ID_PREFERENCES_CONFIGURE_PATHS,
_( "&Configure Paths..." ),

View File

@ -20,10 +20,8 @@
#include <limits>
#include <functional>
using namespace std::placeholders;
#include <class_draw_panel_gal.h>
#include <view/view.h>
#include <hotkeys.h>
#include <bitmaps.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
@ -34,7 +32,7 @@ using namespace std::placeholders;
TOOL_ACTION CVPCB_ACTIONS::selectionActivate( "cvpcb.InteractiveSelection",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
"", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere

View File

@ -31,7 +31,6 @@ include_directories(
${INC_AFTER}
)
set( EESCHEMA_DLGS
dialogs/dialog_annotate.cpp
dialogs/dialog_annotate_base.cpp
@ -153,7 +152,6 @@ set( EESCHEMA_SRCS
generate_alias_info.cpp
getpart.cpp
hierarch.cpp
ee_hotkeys.cpp
lib_arc.cpp
lib_bezier.cpp
lib_circle.cpp

View File

@ -1,413 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <id.h>
#include <eeschema_id.h>
#include <ee_hotkeys.h>
#include <sch_edit_frame.h>
#include <sch_draw_panel.h>
#include <general.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <class_libentry.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_component.h>
#include <sch_sheet.h>
#include <dialogs/dialog_schematic_find.h>
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/ee_actions.h>
// Remark: the hotkey message info is used as keyword in hotkey config files and
// as comments in help windows, therefore translated only when displayed
// they are marked _HKI to be extracted by translation tools
// See hotkeys_basic.h for more info
/* How to add a new hotkey:
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
* hotkeys.h).
* add a new EDA_HOTKEY entry like:
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION,
* default key value);
* _HKI("Command Label") is the name used in hotkey list display, and the
* identifier in the hotkey list file
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in
* OnHotKey() function.
* default key value is the default hotkey for this command. Can be overridden
* by the user hotkey list file
* add the HkMyNewEntry pointer in the schematic_Hotkey_List list or the
* libEdit_Hotkey_List list or common_Hotkey_List if the same command is
* added both in Eeschema and libedit)
* Add the new code in the switch in OnHotKey() function.
* when the variable itemInEdit is true, an item is currently edited.
* This can be useful if the new function cannot be executed while an item is
* currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
*
* Note: If an hotkey is a special key be sure the corresponding wxWidget
* keycode (WXK_XXXX) is handled in the hotkey_name_descr
* s_Hotkey_Name_List list (see hotkeys_basic.cpp) and see this list
* for some ascii keys (space ...)
*
* Key modifier are: GR_KB_CTRL GR_KB_ALT
*/
// Common commands
// Fit on Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( _HKI( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME );
#else
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' );
#endif
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
// Refresh Screen
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
#else
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' );
#endif
// Zoom In
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
#else
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' );
#endif
// Zoom Out
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
#else
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif
static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',',
wxID_PREFERENCES );
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkLeaveSheet( _HKI( "Leave Sheet" ), HK_LEAVE_SHEET, GR_KB_ALT + WXK_BACK );
static EDA_HOTKEY HkSwitchGridToNext( _HKI( "Switch Grid To Next" ),
HK_SWITCH_GRID_TO_NEXT, 'N' );
static EDA_HOTKEY HkSwitchGridToPrevious( _HKI( "Switch Grid To Previous" ),
HK_SWITCH_GRID_TO_PREVIOUS, 'N' + GR_KB_SHIFT );
// mouse click command:
static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN,
ID_MOUSE_CLICK );
static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK, WXK_END,
ID_MOUSE_DOUBLECLICK );
// Schematic editor
static EDA_HOTKEY HkBeginWire( _HKI( "Begin Wire" ), HK_BEGIN_WIRE, 'W' );
static EDA_HOTKEY HkBeginBus( _HKI( "Begin Bus" ), HK_BEGIN_BUS, 'B' );
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' );
static EDA_HOTKEY HkAddHierarchicalLabel( _HKI( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
static EDA_HOTKEY HkAddGlobalLabel( _HKI( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'H' );
static EDA_HOTKEY HkAddJunction( _HKI( "Add Junction" ), HK_ADD_JUNCTION, 'J' );
static EDA_HOTKEY HkAddComponent( _HKI( "Add Symbol" ), HK_ADD_NEW_COMPONENT, 'A' );
static EDA_HOTKEY HkAddPower( _HKI( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
static EDA_HOTKEY HkAddNoConn( _HKI( "Add No Connect Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
static EDA_HOTKEY HkAddHierSheet( _HKI( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' );
static EDA_HOTKEY HkAddBusEntry( _HKI( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' );
static EDA_HOTKEY HkAddWireEntry( _HKI( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' );
static EDA_HOTKEY HkAddGraphicPolyLine( _HKI( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' );
static EDA_HOTKEY HkAddGraphicText( _HKI( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' );
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 Datasheet" ), HK_SHOW_DATASHEET, 'D' );
static EDA_HOTKEY HkEditWithLibedit( _HKI( "Edit with Symbol Editor" ), HK_EDIT_COMPONENT_WITH_LIBEDIT, 'E' + GR_KB_CTRL );
static EDA_HOTKEY HkDuplicateItem( _HKI( "Duplicate" ), HK_DUPLICATE, 'D' + GR_KB_CTRL );
static EDA_HOTKEY HkMove( _HKI( "Move Schematic Item" ), HK_MOVE, 'M' );
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 );
static EDA_HOTKEY HkFind( _HKI( "Find" ), HK_FIND, 'F' + GR_KB_CTRL );
static EDA_HOTKEY HkReplace( _HKI( "Find and Replace" ), HK_REPLACE, 'F' + GR_KB_CTRL + GR_KB_ALT );
static EDA_HOTKEY HkFindNextItem( _HKI( "Find Next" ), HK_FIND_NEXT, WXK_F5 );
static EDA_HOTKEY HkFindNextMarker( _HKI( "Find Next Marker" ), HK_FIND_NEXT_MARKER, WXK_F5 + GR_KB_SHIFT );
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5,
ID_ZOOM_SELECTION );
// Special keys for library editor:
static EDA_HOTKEY HkCreatePin( _HKI( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
static EDA_HOTKEY HkInsertPin( _HKI( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
// 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 );
// Selection
static EDA_HOTKEY HkSelectNode( _HKI( "Select Node" ), HK_SELECT_NODE, GR_KB_ALT + '3' );
static EDA_HOTKEY HkSelectConnection( _HKI( "Select Connection" ), HK_SELECT_CONNECTION, GR_KB_ALT + '4' );
// Higtlight connection
static EDA_HOTKEY HkHighlightConnection( _HKI( "Highlight Net" ), ID_HOTKEY_HIGHLIGHT, 'B' + GR_KB_CTRL );
static EDA_HOTKEY HkUnfoldBus( _HKI( "Unfold from Bus" ), HK_UNFOLD_BUS, 'C', ID_SCH_UNFOLD_BUS );
// Common: hotkeys_basic.h
static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', wxID_NEW );
static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', wxID_OPEN );
static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', wxID_SAVE );
static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_SHIFTCTRL + 'S', wxID_SAVEAS );
static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', wxID_PRINT );
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z' );
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y' );
#else
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_SHIFTCTRL + 'Z' );
#endif
static EDA_HOTKEY HkCut( _HKI( "Cut" ), HK_CUT, GR_KB_CTRL + 'X' );
static EDA_HOTKEY HkCopy( _HKI( "Copy" ), HK_COPY, GR_KB_CTRL + 'C' );
static EDA_HOTKEY HkPaste( _HKI( "Paste" ), HK_PASTE, GR_KB_CTRL + 'V' );
static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
HK_CANVAS_OPENGL,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F11, ID_MENU_CANVAS_OPENGL );
static EDA_HOTKEY HkCanvasCairo( _HKI( "Switch to Modern Toolset with software graphics (fall-back)" ),
HK_CANVAS_CAIRO,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F12, ID_MENU_CANVAS_CAIRO );
// List of common hotkey descriptors
static EDA_HOTKEY* common_Hotkey_List[] =
{
&HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint,
&HkUndo, &HkRedo,
&HkCut, &HkCopy, &HkPaste,
&HkFind, &HkReplace,
&HkHelp,
&HkPreferences,
&HkZoomIn,
&HkZoomOut,
&HkZoomRedraw,
&HkZoomCenter,
&HkZoomAuto,
&HkZoomSelection,
&HkSwitchUnits,
&HkResetLocalCoord,
&HkSwitchGridToNext,
&HkSwitchGridToPrevious,
&HkEdit,
&HkDuplicateItem,
&HkDelete,
&HkRotate,
&HkDrag,
&HkMove,
&HkMirrorX,
&HkMirrorY,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
};
// List of common hotkey descriptors, for the library viewer
static EDA_HOTKEY* common_basic_Hotkey_List[] =
{
&HkCut, &HkCopy, &HkPaste,
&HkHelp,
&HkZoomIn,
&HkZoomOut,
&HkZoomRedraw,
&HkZoomCenter,
&HkZoomAuto,
&HkResetLocalCoord,
&HkEdit,
&HkDuplicateItem,
&HkDelete,
&HkRotate,
&HkMove,
&HkMirrorX,
&HkMirrorY,
&HkMouseLeftClick,
&HkMouseLeftDClick,
NULL
};
// List of hotkey descriptors for schematic
static EDA_HOTKEY* schematic_Hotkey_List[] =
{
&HkFindNextItem,
&HkFindNextMarker,
&HkInsert,
&HkAddComponent,
&HkAddPower,
&HkEditValue,
&HkEditReference,
&HkEditFootprint,
&HkShowDatasheet,
&HkEditWithLibedit,
&HkSelectNode,
&HkSelectConnection,
&HkBeginWire,
&HkBeginBus,
&HkEndLineWireBus,
&HkAddLabel,
&HkAddHierarchicalLabel,
&HkAddGlobalLabel,
&HkAddJunction,
&HkAddNoConn,
&HkAddHierSheet,
&HkAddWireEntry,
&HkAddBusEntry,
&HkAddGraphicPolyLine,
&HkAddGraphicText,
&HkUpdatePcbFromSch,
&HkAutoplaceFields,
&HkLeaveSheet,
&HkHighlightConnection,
&HkUnfoldBus,
&HkCanvasCairo,
&HkCanvasOpenGL,
NULL
};
// List of hotkey descriptors for library editor
static EDA_HOTKEY* libEdit_Hotkey_List[] =
{
&HkCreatePin,
&HkInsertPin,
&HkShowDatasheet,
NULL
};
// List of hotkey descriptors for library viewer (currently empty)
static EDA_HOTKEY* viewlib_Hotkey_List[] =
{
NULL
};
// Keyword Identifiers (tags) in key code configuration file (section names)
// (.m_SectionTag member of a EDA_HOTKEY_CONFIG)
static wxString schematicSectionTag( wxT( "[eeschema]" ) );
static wxString libEditSectionTag( wxT( "[libedit]" ) );
// Titles for hotkey editor and hotkey display
static wxString commonSectionTitle( _HKI( "Common" ) );
static wxString schematicSectionTitle( _HKI( "Schematic Editor" ) );
static wxString libEditSectionTitle( _HKI( "Library Editor" ) );
// list of sections and corresponding hotkey list for Eeschema (used to create
// an hotkey config file)
struct EDA_HOTKEY_CONFIG g_Eeschema_Hotkeys_Descr[] =
{
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
{ &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
{ &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
{ NULL, NULL, NULL }
};
// list of sections and corresponding hotkey list for the schematic editor
// (used to list current hotkeys)
struct EDA_HOTKEY_CONFIG g_Schematic_Hotkeys_Descr[] =
{
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
{ &schematicSectionTag, schematic_Hotkey_List, &schematicSectionTitle },
{ NULL, NULL, NULL }
};
// list of sections and corresponding hotkey list for the component editor
// (used to list current hotkeys)
struct EDA_HOTKEY_CONFIG g_Libedit_Hotkeys_Descr[] =
{
{ &g_CommonSectionTag, common_Hotkey_List, &commonSectionTitle },
{ &libEditSectionTag, libEdit_Hotkey_List, &libEditSectionTitle },
{ NULL, NULL, NULL }
};
// list of sections and corresponding hotkey list for the component browser
// (used to list current hotkeys)
struct EDA_HOTKEY_CONFIG g_Viewlib_Hotkeys_Descr[] =
{
{ &g_CommonSectionTag, common_basic_Hotkey_List, &commonSectionTitle },
{ NULL, NULL, NULL }
};
EDA_HOTKEY* SCH_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
{
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromCommand( aCommand, schematic_Hotkey_List );
return HK_Descr;
}
EDA_HOTKEY* LIB_EDIT_FRAME::GetHotKeyDescription( int aCommand ) const
{
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromCommand( aCommand, libEdit_Hotkey_List );
return HK_Descr;
}
EDA_HOTKEY* LIB_VIEW_FRAME::GetHotKeyDescription( int aCommand ) const
{
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromCommand( aCommand, viewlib_Hotkey_List );
return HK_Descr;
}

View File

@ -1,87 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* eeschema/hotkeys.h
*/
#ifndef EESCHEMA_KOTKEYS_H_
#define EESCHEMA_KOTKEYS_H_
#include <hotkeys_basic.h>
// List of hot keys id.
// see also enum common_hotkey_id_command in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_command {
HK_REPEAT_LAST = HK_COMMON_END,
HK_LIBEDIT_CREATE_PIN,
HK_SHOW_DATASHEET,
HK_ROTATE,
HK_EDIT,
HK_EDIT_COMPONENT_VALUE,
HK_EDIT_COMPONENT_REFERENCE,
HK_EDIT_COMPONENT_FOOTPRINT,
HK_EDIT_COMPONENT_WITH_LIBEDIT,
HK_MIRROR_X,
HK_MIRROR_Y,
HK_MOVE,
HK_DRAG,
HK_SELECT_NODE,
HK_SELECT_CONNECTION,
HK_ADD_NEW_COMPONENT,
HK_ADD_NEW_POWER,
HK_BEGIN_WIRE,
HK_BEGIN_BUS,
HK_UNFOLD_BUS,
HK_END_CURR_LINEWIREBUS,
HK_ADD_WIRE_ENTRY,
HK_ADD_BUS_ENTRY,
HK_ADD_LABEL,
HK_ADD_HLABEL,
HK_ADD_GLABEL,
HK_ADD_JUNCTION,
HK_ADD_HIER_SHEET,
HK_ADD_GRAPHIC_TEXT,
HK_ADD_GRAPHIC_POLYLINE,
HK_ADD_NOCONN_FLAG,
HK_LEAVE_SHEET,
HK_AUTOPLACE_FIELDS,
HK_SELECT_ITEMS_ON_PCB,
HK_CANVAS_OPENGL,
HK_CANVAS_CAIRO,
};
// List of hotkey descriptors for Eeschema
extern struct EDA_HOTKEY_CONFIG g_Eeschema_Hotkeys_Descr[];
// List of hotkey descriptors for the schematic editor only
extern struct EDA_HOTKEY_CONFIG g_Schematic_Hotkeys_Descr[];
// List of hotkey descriptors for the lib editor only
extern struct EDA_HOTKEY_CONFIG g_Libedit_Hotkeys_Descr[];
// List of hotkey descriptors for the lib browser only
extern struct EDA_HOTKEY_CONFIG g_Viewlib_Hotkeys_Descr[];
#endif // EESCHEMA_KOTKEYS_H_

View File

@ -33,16 +33,13 @@
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <eda_text.h>
#include <general.h>
#include <class_libentry.h>
#include <ee_hotkeys.h>
#include <transform.h>
#include <wildcards_and_files_ext.h>
#include <symbol_lib_table.h>
#include <dialogs/dialog_global_sym_lib_table_config.h>
#include <dialogs/panel_sym_lib_table.h>
#include <kiway.h>
#include <sim/sim_plot_frame.h>
@ -245,10 +242,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
SetLayerColor( COLOR4D::WHITE, LAYER_SCHEMATIC_BACKGROUND );
SetLayerColor( COLOR4D::BLACK, LAYER_SCHEMATIC_CURSOR );
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( SCH_EDIT_FRAME_NAME, g_Eeschema_Hotkeys_Descr );
wxConfigLoadSetups( KifaceSettings(), cfg_params() );
wxFileName fn = SYMBOL_LIB_TABLE::GetGlobalTableFileName();

View File

@ -36,7 +36,6 @@
#include <invoke_sch_dialog.h>
#include <lib_edit_frame.h>
#include <eeschema_config.h>
#include <ee_hotkeys.h>
#include <ws_draw_item.h>
#include <ws_data_model.h>
#include <class_library.h>
@ -48,6 +47,7 @@
#include <dialogs/panel_eeschema_settings.h>
#include <dialogs/panel_eeschema_display_options.h>
#include <dialogs/panel_libedit_display_options.h>
#include <panel_hotkeys_editor.h>
#include <widgets/widget_eeschema_color_config.h>
#include <widgets/symbol_tree_pane.h>
#include <dialogs/panel_libedit_settings.h>
@ -128,23 +128,6 @@ COLOR4D GetInvisibleItemColor()
}
void LIB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
switch( id )
{
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for LibEdit.
DisplayHotkeyList( this, g_Libedit_Hotkeys_Descr );
break;
default:
DisplayError( this, wxT( "LIB_EDIT_FRAME::Process_Config error" ) );
}
}
void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
@ -152,6 +135,7 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
switch( id )
{
// JEY TODO: are these still active?
case ID_CONFIG_SAVE:
SaveProjectSettings( true );
break;
@ -183,28 +167,14 @@ void SCH_EDIT_FRAME::Process_Config( wxCommandEvent& event )
}
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for eeschema.
DisplayHotkeyList( this, g_Schematic_Hotkeys_Descr );
break;
default:
DisplayError( this, wxT( "SCH_EDIT_FRAME::Process_Config error" ) );
}
}
void SCH_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
{
if( ShowPreferences( g_Eeschema_Hotkeys_Descr, g_Schematic_Hotkeys_Descr, wxT( "eeschema" ) ) )
{
SaveSettings( config() ); // save values shared by eeschema applications.
GetGalCanvas()->Refresh( true );
}
}
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent )
void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
@ -212,6 +182,8 @@ void SCH_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent )
book->AddSubPage( new PANEL_EESCHEMA_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
book->AddSubPage( new PANEL_EESCHEMA_COLOR_CONFIG( this, book ), _( "Colors" ) );
book->AddSubPage( new PANEL_EESCHEMA_TEMPLATE_FIELDNAMES( this, book ), _( "Field Name Templates" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}
@ -411,7 +383,6 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
long tmp;
ReadHotkeyConfig( SCH_EDIT_FRAME_NAME, g_Schematic_Hotkeys_Descr );
wxConfigLoadSetups( aCfg, GetConfigurationSettings() );
SetDefaultBusThickness( (int) aCfg->Read( DefaultBusWidthEntry, DEFAULTBUSTHICKNESS ) );
@ -548,8 +519,6 @@ void LIB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
{
EDA_DRAW_FRAME::LoadSettings( aCfg );
ReadHotkeyConfig( LIB_EDIT_FRAME_NAME, g_Libedit_Hotkeys_Descr );
SetDefaultLineThickness( (int) aCfg->Read( DefaultDrawLineWidthEntry, DEFAULTDRAWLINETHICKNESS ) );
SetDefaultPinLength( (int) aCfg->Read( DefaultPinLengthEntry, DEFAULTPINLENGTH ) );
m_textPinNumDefaultSize = (int) aCfg->Read( defaultPinNumSizeEntry, DEFAULTPINNUMSIZE );
@ -608,22 +577,15 @@ void LIB_EDIT_FRAME::SaveSettings( wxConfigBase* aCfg )
}
void LIB_EDIT_FRAME::OnPreferencesOptions( wxCommandEvent& event )
{
if( ShowPreferences( g_Eeschema_Hotkeys_Descr, g_Libedit_Hotkeys_Descr, wxT( "eeschema" ) ) )
{
SaveSettings( config() ); // save values shared by eeschema applications.
GetGalCanvas()->Refresh( true );
}
}
void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent )
void LIB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new PANEL_LIBEDIT_SETTINGS( this, book ), _( "Symbol Editor" ) );
book->AddSubPage( new PANEL_LIBEDIT_DISPLAY_OPTIONS( this, aParent ), _( "Display Options" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}

View File

@ -43,12 +43,13 @@
#include <widgets/symbol_tree_pane.h>
#include <widgets/lib_tree.h>
#include <symbol_lib_table.h>
#include <ee_hotkeys.h>
#include <eeschema_config.h>
#include <wildcards_and_files_ext.h>
#include <wx/progdlg.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
@ -98,10 +99,6 @@ BEGIN_EVENT_TABLE( LIB_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_LIBEDIT_GEN_SVG_FILE, LIB_EDIT_FRAME::OnPlotCurrentComponent )
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
EVT_MENU( wxID_PREFERENCES, LIB_EDIT_FRAME::OnPreferencesOptions )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, LIB_EDIT_FRAME::Process_Config )
// Update user interface elements.
EVT_UPDATE_UI( ID_LIBEDIT_SYNC_PIN_EDIT, LIB_EDIT_FRAME::OnUpdateSyncPinEdit )
EVT_UPDATE_UI( ID_LIBEDIT_SELECT_PART_NUMBER, LIB_EDIT_FRAME::OnUpdatePartNumber )
@ -116,7 +113,6 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetShowDeMorgan( false );
m_DrawSpecificConvert = true;
m_DrawSpecificUnit = false;
m_hotkeysDescrList = g_Libedit_Hotkeys_Descr;
m_SyncPinEdit = false;
m_repeatPinStep = DEFAULT_REPEAT_OFFSET_PIN;
SetShowElectricalType( true );
@ -230,6 +226,7 @@ void LIB_EDIT_FRAME::setupTools()
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EE_SELECTION_TOOL );
@ -759,6 +756,7 @@ void LIB_EDIT_FRAME::CommonSettingsChanged()
void LIB_EDIT_FRAME::ShowChangedLanguage()
{
// JEY TODO: push this down into EDA_BASE_FRAME...
// call my base class
SCH_BASE_FRAME::ShowChangedLanguage();

View File

@ -177,9 +177,6 @@ public:
void ReCreateMenuBar() override;
void OnPreferencesOptions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
/**
* Pin editing (add, delete, move...) can be synchronized between units
* when units are interchangeable because in this case similar pins are expected
@ -268,9 +265,6 @@ public:
void ReCreateOptToolbar();
double BestZoom() override; // Returns the best zoom
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override;
@ -449,7 +443,7 @@ public:
/**
* Allows Libedit to install its preferences panel into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent ) override;
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.

View File

@ -31,7 +31,6 @@
#include <tools/ee_selection_tool.h>
#include <lib_manager.h>
#include "eeschema_id.h"
#include "ee_hotkeys.h"
#include "lib_edit_frame.h"
@ -211,7 +210,7 @@ void LIB_EDIT_FRAME::ReCreateMenuBar()
prefsMenu->AddItem( ACTIONS::configurePaths, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::showSymbolLibTable, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), g_Libedit_Hotkeys_Descr, HK_PREFERENCES ),
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, EE_CONDITIONS::ShowAlways );

View File

@ -24,14 +24,13 @@
*/
#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 <lib_manager.h>
#include <tool/action_toolbar.h>
#include <tools/ee_actions.h>
#ifdef __UNIX__
@ -117,6 +116,7 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddControl( m_partSelectBox );
KiScaledSeparator( m_mainToolBar, this );
// JEY TODO: move to an action....
m_mainToolBar->AddTool( ID_LIBEDIT_SYNC_PIN_EDIT, wxEmptyString,
KiScaledBitmap( pin2pin_xpm, this ),
_( "Synchronized pin edit mode\n"

View File

@ -23,7 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <kiface_i.h>
#include <menus_helpers.h>
#include <pgm_base.h>
@ -32,7 +31,6 @@
#include <tools/ee_selection_tool.h>
#include <tools/ee_actions.h>
#include "eeschema_id.h"
#include "ee_hotkeys.h"
#include "sch_edit_frame.h"
class CONDITIONAL_MENU;
@ -311,7 +309,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
prefsMenu->AddItem( ACTIONS::configurePaths, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::showSymbolLibTable, EE_CONDITIONS::ShowAlways );
prefsMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), g_Eeschema_Hotkeys_Descr, HK_PREFERENCES ),
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, EE_CONDITIONS::ShowAlways );

View File

@ -46,7 +46,6 @@
#include <reporter.h>
#include <lib_edit_frame.h>
#include <viewlib_frame.h>
#include <ee_hotkeys.h>
#include <eeschema_config.h>
#include <sch_sheet.h>
#include <sim/sim_plot_frame.h>
@ -56,6 +55,8 @@
#include <view/view.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/ee_actions.h>
@ -225,9 +226,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_MENU( ID_CONFIG_SAVE, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_CONFIG_READ, SCH_EDIT_FRAME::Process_Config )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, SCH_EDIT_FRAME::Process_Config )
EVT_TOOL( wxID_PREFERENCES, SCH_EDIT_FRAME::OnPreferencesOptions )
EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject )
EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols )
@ -254,7 +252,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_printMonochrome = true;
m_printSheetReference = true;
SetShowPageLimits( true );
m_hotkeysDescrList = g_Schematic_Hotkeys_Descr;
m_undoItem = NULL;
m_hasAutoSave = true;
m_FrameSize = ConvertDialogToPixels( wxSize( 500, 350 ) ); // default in case of no prefs
@ -345,6 +342,7 @@ void SCH_EDIT_FRAME::setupTools()
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new EE_SELECTION_TOOL );

View File

@ -305,9 +305,6 @@ public:
void ReCreateOptToolbar();
void ReCreateMenuBar() override;
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
/**
* Must be called after a schematic change in order to set the "modify" flag of the
* current screen and update the date in frame reference.
@ -765,11 +762,6 @@ private:
void OnAppendProject( wxCommandEvent& event );
void OnImportProject( wxCommandEvent& event );
// a helper function to run the dialog that allows to rename the symbol library Id of
// groups of components, for instance after a symbol has moved from a library to
// another library
void OnPreferencesOptions( wxCommandEvent& event );
/**
* Set the main window title bar text.
*
@ -1096,7 +1088,7 @@ public:
/**
* Allows Eeschema to install its preferences panels into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent ) override;
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.

View File

@ -20,15 +20,13 @@
*/
#include <dialog_helpers.h>
#include <macros.h>
#include <menus_helpers.h>
#include "class_library.h"
#include "eeschema_id.h"
#include "general.h"
#include "viewlib_frame.h"
#include <symbol_lib_table.h>
#include <tool/action_toolbar.h>
#include <tool/conditional_menu.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
@ -104,12 +102,13 @@ void LIB_VIEW_FRAME::ReCreateMenuBar()
//-- File menu -----------------------------------------------------------
//
wxMenu* fileMenu = new wxMenu;
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, libControl );
fileMenu->AddItem( wxID_EXIT, _( "Close" ), _( "Close footprint viewer" ),
exit_xpm, EE_CONDITIONS::ShowAlways );
fileMenu->Resolve();
AddMenuItem( fileMenu, wxID_EXIT,
_( "Cl&ose" ),
_( "Close schematic symbol viewer" ),
KiBitmap( exit_xpm ) );
//-- View menu -----------------------------------------------------------
//

View File

@ -205,7 +205,10 @@ public:
static TOOL_ACTION highlightNetCursor;
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override
{
return OPT<TOOL_EVENT>();
}
};

View File

@ -26,7 +26,6 @@
#include <sch_marker.h>
#include <id.h>
#include <kiway.h>
#include <ee_hotkeys.h>
#include <confirm.h>
#include <tool/conditional_menu.h>
#include <tool/selection_conditions.h>
@ -47,22 +46,23 @@
#include <dialogs/dialog_display_info_HTML_base.h>
TOOL_ACTION EE_ACTIONS::runERC( "eeschame.InspectionTool.runERC",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Electrical Rules &Checker" ), _( "Perform electrical rules check" ),
erc_xpm );
TOOL_ACTION EE_ACTIONS::runSimulation( "eeschema.EditorControl.runSimulation",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Simulator..." ), _( "Simulate circuit in SPICE" ),
simulator_xpm );
TOOL_ACTION EE_ACTIONS::showDatasheet( "eeschema.InspectionTool.showDatasheet",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SHOW_DATASHEET ),
AS_GLOBAL,
'D', LEGACY_HK_NAME( "Show Datasheet" ),
_( "Show Datasheet" ), _( "Opens the datasheet in a browser" ),
datasheet_xpm );
TOOL_ACTION EE_ACTIONS::showMarkerInfo( "eeschema.InspectionTool.showMarkerInfo",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Marker Info" ), _( "Display the marker's info in a dialog" ),
info_xpm );

View File

@ -27,11 +27,12 @@
#include <tool/tool_manager.h>
#include <sch_base_frame.h>
TOOL_ACTION EE_ACTIONS::pickerTool( "eeschema.Picker", AS_GLOBAL, 0, "", "", NULL, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::pickerTool( "eeschema.InteractivePicker.activate",
AS_GLOBAL, 0, "", "", "", NULL, AF_ACTIVATE );
EE_PICKER_TOOL::EE_PICKER_TOOL()
: EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.Picker" )
: EE_TOOL_BASE<SCH_BASE_FRAME>( "eeschema.InteractivePicker" )
{
resetPicker();
}

View File

@ -48,12 +48,14 @@ using namespace std::placeholders;
// Point editor
TOOL_ACTION EE_ACTIONS::pointEditorAddCorner( "eeschema.PointEditor.addCorner",
AS_GLOBAL, 0,
_( "Create Corner" ), _( "Create a corner" ), add_corner_xpm );
AS_GLOBAL, 0, "",
_( "Create Corner" ), _( "Create a corner" ),
add_corner_xpm );
TOOL_ACTION EE_ACTIONS::pointEditorRemoveCorner( "eeschema.PointEditor.removeCorner",
AS_GLOBAL, 0,
_( "Remove Corner" ), _( "Remove corner" ), delete_xpm );
AS_GLOBAL, 0, "",
_( "Remove Corner" ), _( "Remove corner" ),
delete_xpm );
// Few constants to avoid using bare numbers for point indices

View File

@ -44,38 +44,39 @@
#include <painter.h>
#include <eeschema_id.h>
#include <menus_helpers.h>
#include <ee_hotkeys.h>
// Selection tool actions
TOOL_ACTION EE_ACTIONS::selectionActivate( "eeschema.InteractiveSelection",
AS_GLOBAL, 0, "", "", // No description, not shown anywhere
AS_GLOBAL, 0, "", "", "", // No description, not shown anywhere
nullptr, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::selectNode( "eeschema.InteractiveSelection.SelectNode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SELECT_NODE ),
AS_GLOBAL,
MD_ALT + '3', LEGACY_HK_NAME( "Select Node" ),
_( "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 ),
AS_GLOBAL,
MD_ALT + '4', LEGACY_HK_NAME( "Select Connection" ),
_( "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
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::addItemToSel( "eeschema.InteractiveSelection.AddItemToSel",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::addItemsToSel( "eeschema.InteractiveSelection.AddItemsToSel",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::removeItemFromSel( "eeschema.InteractiveSelection.RemoveItemFromSel",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::removeItemsFromSel( "eeschema.InteractiveSelection.RemoveItemsFromSel",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::clearSelection( "eeschema.InteractiveSelection.ClearSelection",
AS_GLOBAL, 0, "", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
SELECTION_CONDITION EE_CONDITIONS::Empty = [] (const SELECTION& aSelection )

View File

@ -32,58 +32,58 @@
TOOL_ACTION EE_ACTIONS::newSymbol( "eeschema.SymbolLibraryControl.newSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "New Symbol..." ), _( "Create a new symbol" ),
new_component_xpm );
TOOL_ACTION EE_ACTIONS::editSymbol( "eeschema.SymbolLibraryControl.editSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Edit Symbol" ), _( "Show selected symbol on editor canvas" ),
edit_xpm );
TOOL_ACTION EE_ACTIONS::duplicateSymbol( "eeschema.SymbolLibraryControl.duplicateSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Duplicate Symbol" ), _( "Make a copy of the selected symbol" ),
duplicate_xpm );
TOOL_ACTION EE_ACTIONS::deleteSymbol( "eeschema.SymbolLibraryControl.deleteSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Delete Symbol" ), _( "Remove the selected symbol from its library" ),
delete_xpm );
TOOL_ACTION EE_ACTIONS::cutSymbol( "eeschema.SymbolLibraryControl.cutSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Cut Symbol" ), "",
cut_xpm );
TOOL_ACTION EE_ACTIONS::copySymbol( "eeschema.SymbolLibraryControl.copySymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Copy Symbol" ), "",
copy_xpm );
TOOL_ACTION EE_ACTIONS::pasteSymbol( "eeschema.SymbolLibraryControl.pasteSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Paste Symbol" ), "",
paste_xpm );
TOOL_ACTION EE_ACTIONS::importSymbol( "eeschema.SymbolLibraryControl.importSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Import Symbol..." ), _( "Import a symbol to the current library" ),
import_part_xpm );
TOOL_ACTION EE_ACTIONS::exportSymbol( "eeschema.SymbolLibraryControl.exportSymbol",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Export Symbol..." ), _( "Export a symbol to a new library file" ),
export_part_xpm );
TOOL_ACTION EE_ACTIONS::showElectricalTypes( "eeschema.SymbolLibraryControl.showElectricalTypes",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Pin Electrical Types" ), _( "Annotate pins with their electrical types" ),
pin_show_etype_xpm );
TOOL_ACTION EE_ACTIONS::showComponentTree( "eeschema.SymbolLibraryControl.showComponentTree",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Symbol Tree" ), "",
search_tree_xpm );

View File

@ -36,7 +36,6 @@
#include <tools/ee_selection_tool.h>
#include <tools/lib_drawing_tools.h>
#include <tools/lib_pin_tool.h>
#include <ee_hotkeys.h>
#include <class_libentry.h>
#include <bitmaps.h>
#include <lib_text.h>
@ -48,42 +47,44 @@
// Drawing tool actions
TOOL_ACTION EE_ACTIONS::placeSymbolPin( "libedit.InteractiveDrawing.placeSymbolPin",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LIBEDIT_CREATE_PIN ),
AS_GLOBAL,
'P', LEGACY_HK_NAME( "Create Pin" ),
_( "Add Pin" ), _( "Add a pin" ),
pin_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeSymbolText( "libedit.InteractiveDrawing.placeSymbolText",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add Text" ), _( "Add a text item" ),
text_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSymbolRectangle( "libedit.InteractiveDrawing.drawSymbolRectangle",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add Rectangle" ), _( "Add a rectangle" ),
add_rectangle_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSymbolCircle( "libedit.InteractiveDrawing.drawSymbolCircle",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add Circle" ), _( "Add a circle" ),
add_circle_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSymbolArc( "libedit.InteractiveDrawing.drawSymbolArc",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add Arc" ), _( "Add an arc" ),
add_arc_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSymbolLines( "libedit.InteractiveDrawing.drawSymbolLines",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add Lines" ), _( "Add connected graphic lines" ),
add_graphical_segments_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeSymbolAnchor( "libedit.InteractiveDrawing.placeSymbolAnchor",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Move Symbol Anchor" ), _( "Specify a new location for the symbol anchor" ),
anchor_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::finishDrawing( "libedit.InteractiveDrawing.finishDrawing",
AS_GLOBAL, 0, _( "Finish Drawing" ), _( "Finish drawing shape" ),
AS_GLOBAL, 0, "",
_( "Finish Drawing" ), _( "Finish drawing shape" ),
checked_ok_xpm, AF_NONE );

View File

@ -28,7 +28,6 @@
#include <tools/lib_drawing_tools.h>
#include <tools/lib_move_tool.h>
#include <ee_actions.h>
#include <ee_hotkeys.h>
#include <bitmaps.h>
#include <confirm.h>
#include <base_struct.h>

View File

@ -24,7 +24,6 @@
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <ee_actions.h>
#include <ee_hotkeys.h>
#include <view/view.h>
#include <bitmaps.h>
#include <base_struct.h>

View File

@ -34,15 +34,18 @@
TOOL_ACTION EE_ACTIONS::pushPinLength( "libedit.PinEditing.pushPinLength",
AS_GLOBAL, 0, _( "Push Pin Length" ), _( "Copy pin length to other pins in symbol" ),
AS_GLOBAL, 0, "",
_( "Push Pin Length" ), _( "Copy pin length to other pins in symbol" ),
pin_size_to_xpm );
TOOL_ACTION EE_ACTIONS::pushPinNameSize( "libedit.PinEditing.pushPinNameSize",
AS_GLOBAL, 0, _( "Push Pin Name Size" ), _( "Copy pin name size to other pins in symbol" ),
AS_GLOBAL, 0, "",
_( "Push Pin Name Size" ), _( "Copy pin name size to other pins in symbol" ),
pin_size_to_xpm );
TOOL_ACTION EE_ACTIONS::pushPinNumSize( "libedit.PinEditing.pushPinNumSize",
AS_GLOBAL, 0, _( "Push Pin Number Size" ), _( "Copy pin number size to other pins in symbol" ),
AS_GLOBAL, 0, "",
_( "Push Pin Number Size" ), _( "Copy pin number size to other pins in symbol" ),
pin_size_to_xpm );

View File

@ -36,7 +36,6 @@
#include <view/view_controls.h>
#include <view/view.h>
#include <tool/tool_manager.h>
#include <ee_hotkeys.h>
#include <sch_component.h>
#include <sch_no_connect.h>
#include <sch_line.h>
@ -50,98 +49,119 @@
// Drawing tool actions
TOOL_ACTION EE_ACTIONS::placeSymbol( "eeschema.InteractiveDrawing.placeSymbol",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_COMPONENT ),
AS_GLOBAL,
'A', LEGACY_HK_NAME( "Add Symbol" ),
_( "Add Symbol" ), _( "Add a symbol" ),
add_component_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placePower( "eeschema.InteractiveDrawing.placePowerPort",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NEW_POWER ),
AS_GLOBAL,
'P', LEGACY_HK_NAME( "Add Power" ),
_( "Add Power" ), _( "Add a power port" ),
add_power_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeNoConnect( "eeschema.InteractiveDrawing.placeNoConnect",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_NOCONN_FLAG ),
AS_GLOBAL,
'Q', LEGACY_HK_NAME( "Add No Connect Flag" ),
_( "Add No Connect Flag" ), _( "Add a no-connection flag" ),
noconn_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeJunction( "eeschema.InteractiveDrawing.placeJunction",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_JUNCTION ),
AS_GLOBAL,
'J', LEGACY_HK_NAME( "Add Junction" ),
_( "Add Junction" ), _( "Add a junction" ),
add_junction_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeBusWireEntry( "eeschema.InteractiveDrawing.placeBusWireEntry",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_WIRE_ENTRY ),
AS_GLOBAL,
'Z', LEGACY_HK_NAME( "Add Wire Entry" ),
_( "Add Wire to Bus Entry" ), _( "Add a wire entry to a bus" ),
add_line2bus_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeBusBusEntry( "eeschema.InteractiveDrawing.placeBusBusEntry",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_BUS_ENTRY ),
AS_GLOBAL,
'/', LEGACY_HK_NAME( "Add Bus Entry" ),
_( "Add Bus to Bus Entry" ), _( "Add a bus entry to a bus" ),
add_bus2bus_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeLabel( "eeschema.InteractiveDrawing.placeLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_LABEL ),
AS_GLOBAL,
'L', LEGACY_HK_NAME( "Add Label" ),
_( "Add Label" ), _( "Add a net label" ),
add_line_label_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeHierarchicalLabel( "eeschema.InteractiveDrawing.placeHierarchicalLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_HLABEL ),
AS_GLOBAL,
'H', LEGACY_HK_NAME( "Add Hierarchical Label" ),
_( "Add Hierarchical Label" ), _( "Add a hierarchical sheet label" ),
add_hierarchical_label_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawSheet( "eeschema.InteractiveDrawing.drawSheet",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_HIER_SHEET ),
AS_GLOBAL,
'S', LEGACY_HK_NAME( "Add Sheet" ),
_( "Add Sheet" ), _( "Add a hierarchical sheet" ),
add_hierarchical_subsheet_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeSheetPin( "eeschema.InteractiveDrawing.placeSheetPin",
AS_GLOBAL, 0, _( "Add Sheet Pin" ), _( "Add a sheet pin" ),
AS_GLOBAL, 0, "",
_( "Add Sheet Pin" ), _( "Add a sheet pin" ),
add_hierar_pin_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::importSheetPin( "eeschema.InteractiveDrawing.importSheetPin",
AS_GLOBAL, 0, _( "Import Sheet Pin" ), _( "Import a hierarchical sheet pin" ),
AS_GLOBAL, 0, "",
_( "Import Sheet Pin" ), _( "Import a hierarchical sheet pin" ),
import_hierarchical_label_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeGlobalLabel( "eeschema.InteractiveDrawing.placeGlobalLabel",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GLABEL ),
AS_GLOBAL,
MD_CTRL + 'H', LEGACY_HK_NAME( "Add Global Label" ),
_( "Add Global Label" ), _( "Add a global label" ),
add_glabel_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeSchematicText( "eeschema.InteractiveDrawing.placeSchematicText",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GRAPHIC_TEXT ),
AS_GLOBAL,
'T', LEGACY_HK_NAME( "Add Graphic Text" ),
_( "Add Text" ), _( "Add text" ),
text_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::placeImage( "eeschema.InteractiveDrawing.placeImage",
AS_GLOBAL, 0, _( "Add Image" ), _( "Add bitmap image" ),
AS_GLOBAL, 0, "",
_( "Add Image" ), _( "Add bitmap image" ),
image_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::finishSheet( "eeschema.InteractiveDrawing.finishSheet",
AS_GLOBAL, 0, _( "Finish Sheet" ), _( "Finish drawing sheet" ),
AS_GLOBAL, 0, "",
_( "Finish Sheet" ), _( "Finish drawing sheet" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addJunction( "eeschema.InteractiveEditing.addJunction",
AS_GLOBAL, 0, _( "Add Junction" ), _( "Add a wire or bus junction" ),
AS_GLOBAL, 0, "",
_( "Add Junction" ), _( "Add a wire or bus junction" ),
add_junction_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addLabel( "eeschema.InteractiveEditing.addLabel",
AS_GLOBAL, 0, _( "Add Label" ), _( "Add a label to a wire or bus" ),
AS_GLOBAL, 0, "",
_( "Add Label" ), _( "Add a label to a wire or bus" ),
add_line_label_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addGlobalLabel( "eeschema.InteractiveEditing.addGlobalLabel",
AS_GLOBAL, 0, _( "Add Global Label" ), _( "Add a global label to a wire or bus" ),
AS_GLOBAL, 0, "",
_( "Add Global Label" ), _( "Add a global label to a wire or bus" ),
add_glabel_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addHierLabel( "eeschema.InteractiveEditing.addHierLabel",
AS_GLOBAL, 0, _( "Add Hierarchical Label" ), _( "Add a hierarchical label to a wire or bus" ),
AS_GLOBAL, 0, "",
_( "Add Hierarchical Label" ), _( "Add a hierarchical label to a wire or bus" ),
add_hierarchical_label_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addSheetPin( "eeschema.InteractiveEditing.addSheetPin",
AS_GLOBAL, 0, _( "Add Sheet Pin" ), _( "Add a sheet pin to the selected sheet" ),
AS_GLOBAL, 0, "",
_( "Add Sheet Pin" ), _( "Add a sheet pin to the selected sheet" ),
add_hierarchical_label_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::addImportedSheetPin( "eeschema.InteractiveEditing.addImportedSheetPin",
AS_GLOBAL, 0, _( "Add Imported Sheet Pin" ), _( "Add an imported sheet pin" ),
AS_GLOBAL, 0, "",
_( "Add Imported Sheet Pin" ), _( "Add an imported sheet pin" ),
add_hierarchical_label_xpm, AF_NONE );

View File

@ -28,7 +28,6 @@
#include <tools/ee_picker_tool.h>
#include <tools/sch_move_tool.h>
#include <ee_actions.h>
#include <ee_hotkeys.h>
#include <bitmaps.h>
#include <confirm.h>
#include <eda_doc.h>
@ -51,132 +50,141 @@
TOOL_ACTION EE_ACTIONS::repeatDrawItem( "eeschema.InteractiveEdit.repeatDrawItem",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_REPEAT_LAST ),
AS_GLOBAL,
WXK_INSERT, LEGACY_HK_NAME( "Repeat Last Item" ),
_( "Repeat Last Item" ), _( "Duplicates the last drawn item" ),
nullptr );
TOOL_ACTION EE_ACTIONS::rotateCW( "eeschema.InteractiveEdit.rotateCW",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Rotate Clockwise" ), _( "Rotates selected item(s) clockwise" ),
rotate_cw_xpm );
TOOL_ACTION EE_ACTIONS::rotateCCW( "eeschema.InteractiveEdit.rotateCCW",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROTATE ),
AS_GLOBAL,
'R', LEGACY_HK_NAME( "Rotate Item" ),
_( "Rotate" ), _( "Rotates selected item(s) counter-clockwise" ),
rotate_ccw_xpm );
TOOL_ACTION EE_ACTIONS::mirrorX( "eeschema.InteractiveEdit.mirrorX",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_X ),
AS_GLOBAL,
'X', LEGACY_HK_NAME( "Mirror X" ),
_( "Mirror Around Horizontal Axis" ), _( "Flips selected item(s) from top to bottom" ),
mirror_v_xpm );
TOOL_ACTION EE_ACTIONS::mirrorY( "eeschema.InteractiveEdit.mirrorY",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MIRROR_Y ),
AS_GLOBAL,
'Y', LEGACY_HK_NAME( "Mirror Y" ),
_( "Mirror Around Vertical Axis" ), _( "Flips selected item(s) from left to right" ),
mirror_h_xpm );
TOOL_ACTION EE_ACTIONS::properties( "eeschema.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT ),
AS_GLOBAL,
'E', LEGACY_HK_NAME( "Edit Item" ),
_( "Properties..." ), _( "Displays item properties dialog" ),
edit_xpm );
TOOL_ACTION EE_ACTIONS::editReference( "eeschema.InteractiveEdit.editReference",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_REFERENCE ),
AS_GLOBAL,
'U', LEGACY_HK_NAME( "Edit Symbol Reference" ),
_( "Edit Reference..." ), _( "Displays reference field dialog" ),
edit_comp_ref_xpm );
TOOL_ACTION EE_ACTIONS::editValue( "eeschema.InteractiveEdit.editValue",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_VALUE ),
AS_GLOBAL,
'V', LEGACY_HK_NAME( "Edit Symbol Value" ),
_( "Edit Value..." ), _( "Displays value field dialog" ),
edit_comp_value_xpm );
TOOL_ACTION EE_ACTIONS::editFootprint( "eeschema.InteractiveEdit.editFootprint",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_FOOTPRINT ),
AS_GLOBAL,
'F', LEGACY_HK_NAME( "Edit Symbol Footprint" ),
_( "Edit Footprint..." ), _( "Displays footprint field dialog" ),
edit_comp_footprint_xpm );
TOOL_ACTION EE_ACTIONS::autoplaceFields( "eeschema.InteractiveEdit.autoplaceFields",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_AUTOPLACE_FIELDS ),
AS_GLOBAL,
'O', LEGACY_HK_NAME( "Autoplace Fields" ),
_( "Autoplace Fields" ), _( "Runs the automatic placement algorithm on the symbol's fields" ),
autoplace_fields_xpm );
TOOL_ACTION EE_ACTIONS::updateFieldsFromLibrary( "eeschema.InteractiveEdit.updateFieldsFromLibrary",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Update Fields from Library..." ), _( "Sets symbol fields to original library values" ),
update_fields_xpm );
TOOL_ACTION EE_ACTIONS::toggleDeMorgan( "eeschema.InteractiveEdit.toggleDeMorgan",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "DeMorgan Conversion" ), _( "Switch between DeMorgan representations" ),
morgan2_xpm );
TOOL_ACTION EE_ACTIONS::showDeMorganStandard( "eeschema.InteractiveEdit.showDeMorganStandard",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "DeMorgan Standard" ), _( "Switch to standard DeMorgan representation" ),
morgan1_xpm );
TOOL_ACTION EE_ACTIONS::showDeMorganAlternate( "eeschema.InteractiveEdit.showDeMorganAlternate",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "DeMorgan Alternate" ), _( "Switch to alternate DeMorgan representation" ),
morgan2_xpm );
TOOL_ACTION EE_ACTIONS::toShapeSlash( "eeschema.InteractiveEdit.toShapeSlash",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Set Bus Entry Shape /" ), _( "Change the bus entry shape to /" ),
change_entry_orient_xpm );
TOOL_ACTION EE_ACTIONS::toShapeBackslash( "eeschema.InteractiveEdit.toShapeBackslash",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Set Bus Entry Shape \\" ), _( "Change the bus entry shape to \\" ),
change_entry_orient_xpm );
TOOL_ACTION EE_ACTIONS::toLabel( "eeschema.InteractiveEdit.toLabel",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Change to Label" ), _( "Change existing item to a label" ),
add_line_label_xpm );
TOOL_ACTION EE_ACTIONS::toHLabel( "eeschema.InteractiveEdit.toHLabel",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Change to Hierarchical Label" ), _( "Change existing item to a hierarchical label" ),
add_hierarchical_label_xpm );
TOOL_ACTION EE_ACTIONS::toGLabel( "eeschema.InteractiveEdit.toGLabel",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Change to Global Label" ), _( "Change existing item to a global label" ),
add_glabel_xpm );
TOOL_ACTION EE_ACTIONS::toText( "eeschema.InteractiveEdit.toText",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Change to Text" ), _( "Change existing item to a text comment" ),
text_xpm );
TOOL_ACTION EE_ACTIONS::cleanupSheetPins( "eeschema.InteractiveEdit.cleanupSheetPins",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Cleanup Sheet Pins" ), _( "Delete unreferenced sheet pins" ),
nullptr );
TOOL_ACTION EE_ACTIONS::symbolProperties( "eeschema.InteractiveEdit.symbolProperties",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Symbol Properties..." ), _( "Displays symbol properties dialog" ),
part_properties_xpm );
TOOL_ACTION EE_ACTIONS::pinTable( "eeschema.InteractiveEdit.pinTable",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Pin Table..." ), _( "Displays pin table for bulk editing of pins" ),
pin_table_xpm );
TOOL_ACTION EE_ACTIONS::deleteItemCursor( "eeschema.InteractiveEdit.deleteTool",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Delete Items" ), _( "Delete clicked items" ),
delete_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::breakWire( "eeschema.InteractiveEdit.breakWire",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Break Wire" ), _( "Divide a wire into segments which can be dragged independently" ),
break_line_xpm );
TOOL_ACTION EE_ACTIONS::breakBus( "eeschema.InteractiveEdit.breakBus",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Break Bus" ), _( "Divide a bus into segments which can be dragged independently" ),
break_line_xpm );

View File

@ -34,10 +34,10 @@
#include <tools/ee_actions.h>
#include <tools/ee_picker_tool.h>
#include <tools/sch_editor_control.h>
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_wire_bus_tool.h>
#include <ee_hotkeys.h>
#include <advanced_config.h>
#include <simulation_cursors.h>
#include <sim/sim_plot_frame.h>
@ -52,97 +52,99 @@
#include <invoke_sch_dialog.h>
TOOL_ACTION EE_ACTIONS::refreshPreview( "eeschema.EditorControl.refreshPreview",
AS_GLOBAL, 0, "", "" );
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::simProbe( "eeschema.Simulation.probe",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Add a simulator probe" ), "" );
TOOL_ACTION EE_ACTIONS::simTune( "eeschema.Simulation.tune",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Select a value to be tuned" ), "" );
TOOL_ACTION EE_ACTIONS::highlightNet( "eeschema.EditorControl.highlightNet",
AS_GLOBAL, 0, "", "" );
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::clearHighlight( "eeschema.EditorControl.clearHighlight",
AS_GLOBAL, 0, "", "" );
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::updateNetHighlighting( "eeschema.EditorControl.updateNetHighlighting",
AS_GLOBAL, 0, "", "" );
AS_GLOBAL );
TOOL_ACTION EE_ACTIONS::highlightNetCursor( "eeschema.EditorControl.highlightNetTool",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Highlight Nets" ), _( "Highlight wires and pins of a net" ),
net_highlight_schematic_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::editWithLibEdit( "eeschema.EditorControl.editWithSymbolEditor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_COMPONENT_WITH_LIBEDIT ),
AS_GLOBAL,
MD_CTRL + 'E', LEGACY_HK_NAME( "Edit with Symbol Editor" ),
_( "Edit with Symbol Editor" ), _( "Open the symbol editor to edit the symbol" ),
libedit_xpm );
TOOL_ACTION EE_ACTIONS::editSymbolFields( "eeschema.EditorControl.editSymbolFields",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Edit Symbol Fields..." ), _( "Bulk-edit fields of all symbols in schematic" ),
spreadsheet_xpm );
TOOL_ACTION EE_ACTIONS::editSymbolLibraryLinks( "eeschema.EditorControl.editSymbolLibraryLinks",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Edit Symbol Library Links..." ), _( "Edit links between schematic and library symbols" ),
edit_cmp_symb_links_xpm );
TOOL_ACTION EE_ACTIONS::assignFootprints( "eeschema.EditorControl.assignFootprints",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Assign Footprints..." ), _( "Run Cvpcb" ),
cvpcb_xpm );
TOOL_ACTION EE_ACTIONS::annotate( "eeschema.EditorControl.annotate",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Annotate Schematic..." ), _( "Fill in schematic symbol reference designators" ),
annotate_xpm );
TOOL_ACTION EE_ACTIONS::showBusManager( "eeschema.EditorControl.showBusManager",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Bus Definitions..." ), _( "Manage bus definitions" ),
bus_definition_tool_xpm );
TOOL_ACTION EE_ACTIONS::showPcbNew( "eeschema.EditorControl.showPcbNew",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Open PCB Editor" ), _( "Run Pcbnew" ),
pcbnew_xpm );
TOOL_ACTION EE_ACTIONS::generateBOM( "eeschema.EditorControl.generateBOM",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Generate BOM..." ), _( "Generate a bill of materials for the current schematic" ),
bom_xpm );
TOOL_ACTION EE_ACTIONS::enterSheet( "eeschema.EditorControl.enterSheet",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Enter Sheet" ), _( "Display the selected sheet's contents in the Eeschema window" ),
enter_sheet_xpm );
TOOL_ACTION EE_ACTIONS::leaveSheet( "eeschema.EditorControl.leaveSheet",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_LEAVE_SHEET ),
AS_GLOBAL,
MD_ALT + WXK_BACK, LEGACY_HK_NAME( "Leave Sheet" ),
_( "Leave Sheet" ), _( "Display the parent sheet in the Eeschema window" ),
leave_sheet_xpm );
TOOL_ACTION EE_ACTIONS::navigateHierarchy( "eeschema.EditorControl.navigateHierarchy",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Hierarchy Navigator" ), "",
hierarchy_nav_xpm );
TOOL_ACTION EE_ACTIONS::explicitCrossProbe( "eeschema.EditorControl.explicitCrossProbe",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SELECT_ITEMS_ON_PCB ),
AS_GLOBAL, 0, "",
_( "Highlight on PCB" ), _( "Highlight corresponding items in PCBNew" ),
select_same_sheet_xpm );
TOOL_ACTION EE_ACTIONS::toggleHiddenPins( "eeschema.EditorControl.showHiddenPins",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Show Hidden Pins" ), "",
hidden_pin_xpm );
TOOL_ACTION EE_ACTIONS::toggleForceHV( "eeschema.EditorControl.forceHVLines",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Force H/V Wires and Busses" ), "",
lines90_xpm );

View File

@ -25,7 +25,6 @@
#include <tools/ee_selection_tool.h>
#include <tools/sch_wire_bus_tool.h>
#include <ee_actions.h>
#include <ee_hotkeys.h>
#include <bitmaps.h>
#include <base_struct.h>
#include <sch_item.h>
@ -39,15 +38,17 @@
TOOL_ACTION EE_ACTIONS::move( "eeschema.InteractiveEdit.move",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_MOVE ),
AS_GLOBAL,
'M', LEGACY_HK_NAME( "Move Item" ),
_( "Move" ), _( "Moves the selected item(s)" ), move_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drag( "eeschema.InteractiveEdit.drag",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_DRAG ),
AS_GLOBAL,
'G', LEGACY_HK_NAME( "Drag Item" ),
_( "Drag" ), _( "Drags the selected item(s)" ), move_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::moveActivate( "eeschema.InteractiveMove",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Move Activate" ), "", move_xpm, AF_ACTIVATE );

View File

@ -35,7 +35,6 @@
#include <view/view_controls.h>
#include <view/view.h>
#include <tool/tool_manager.h>
#include <ee_hotkeys.h>
#include <sch_junction.h>
#include <sch_line.h>
#include <sch_bus_entry.h>
@ -44,54 +43,63 @@
#include <advanced_config.h>
TOOL_ACTION EE_ACTIONS::startWire( "eeschema.WireBusDrawing.startWire",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Start Wire" ), _( "Start drawing a wire" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawWire( "eeschema.WireBusDrawing.drawWires",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_WIRE ),
AS_GLOBAL,
'W', LEGACY_HK_NAME( "Begin Wire" ),
_( "Add Wire" ), _( "Add a wire" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::startBus( "eeschema.WireBusDrawing.startBus",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Start Bus" ), _( "Start drawing a bus" ),
add_bus_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawBus( "eeschema.WireBusDrawing.drawBusses",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_BUS ),
AS_GLOBAL,
'B', LEGACY_HK_NAME( "Begin Bus" ),
_( "Add Bus" ), _( "Add a bus" ),
add_bus_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::unfoldBus( "eeschema.WireBusDrawing.unfoldBus",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UNFOLD_BUS ),
AS_GLOBAL,
'C', LEGACY_HK_NAME( "Unfold from Bus" ),
_( "Unfold from Bus" ), _( "Break a wire out of a bus" ),
nullptr, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::startLines( "eeschema.WireBusDrawing.startLines",
AS_GLOBAL, 0, _( "Begin Lines" ), _( "Start drawing connected graphic lines" ),
AS_GLOBAL, 0, "",
_( "Begin Lines" ), _( "Start drawing connected graphic lines" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::drawLines( "eeschema.WireBusDrawing.drawLines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ADD_GRAPHIC_POLYLINE ),
AS_GLOBAL,
'I', LEGACY_HK_NAME( "Add Graphic PolyLine" ),
_( "Add Lines" ), _( "Add connected graphic lines" ),
add_dashed_line_xpm, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::finishLineWireOrBus( "eeschema.WireBusDrawing.finishLineWireOrBus",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_END_CURR_LINEWIREBUS ),
AS_GLOBAL,
'K', LEGACY_HK_NAME( "End Line Wire Bus" ),
_( "Finish Wire or Bus" ), _( "Complete drawing at current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::finishWire( "eeschema.WireBusDrawing.finishWire",
AS_GLOBAL, 0, _( "Finish Wire" ), _( "Complete wire with current segment" ),
AS_GLOBAL, 0, "",
_( "Finish Wire" ), _( "Complete wire with current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::finishBus( "eeschema.WireBusDrawing.finishBus",
AS_GLOBAL, 0, _( "Finish Bus" ), _( "Complete bus with current segment" ),
AS_GLOBAL, 0, "",
_( "Finish Bus" ), _( "Complete bus with current segment" ),
checked_ok_xpm, AF_NONE );
TOOL_ACTION EE_ACTIONS::finishLine( "eeschema.WireBusDrawing.finishLine",
AS_GLOBAL, 0, _( "Finish Lines" ), _( "Complete connected lines with current segment" ),
AS_GLOBAL, 0, "",
_( "Finish Lines" ), _( "Complete connected lines with current segment" ),
checked_ok_xpm, AF_NONE );

View File

@ -36,7 +36,6 @@
#include <general.h>
#include <viewlib_frame.h>
#include <symbol_lib_table.h>
#include <ee_hotkeys.h>
#include <dialog_helpers.h>
#include <class_libentry.h>
#include <class_library.h>
@ -44,6 +43,7 @@
#include <sch_painter.h>
#include <confirm.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tool/tool_dispatcher.h>
#include <tools/ee_actions.h>
#include <tool/common_tools.h>
@ -84,7 +84,6 @@ BEGIN_EVENT_TABLE( LIB_VIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_EXIT, LIB_VIEW_FRAME::CloseLibraryViewer )
EVT_MENU( ID_SET_RELATIVE_OFFSET, LIB_VIEW_FRAME::OnSetRelativeOffset )
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, LIB_VIEW_FRAME::OnDisplayHotkeyList )
EVT_UPDATE_UI( ID_LIBVIEW_SELECT_PART_NUMBER, LIB_VIEW_FRAME::onUpdateUnitChoice )
@ -121,7 +120,6 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
icon.CopyFromBitmap( KiBitmap( library_browse_xpm ) );
SetIcon( icon );
m_hotkeysDescrList = g_Viewlib_Hotkeys_Descr;
m_libListWidth = 200;
m_cmpListWidth = 300;
m_listPowerCmpOnly = false;
@ -799,8 +797,3 @@ void LIB_VIEW_FRAME::OnAddPartToSchematic( wxCommandEvent& aEvent )
}
}
void LIB_VIEW_FRAME::OnDisplayHotkeyList( wxCommandEvent& event )
{
DisplayHotkeyList( this, g_Viewlib_Hotkeys_Descr );
}

View File

@ -96,14 +96,6 @@ public:
void OnSetRelativeOffset( wxCommandEvent& event );
void OnSelectSymbol( wxCommandEvent& aEvent );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
/**
* Displays the hotkey dialog
*/
void OnDisplayHotkeyList( wxCommandEvent& event );
void LoadSettings( wxConfigBase* aCfg ) override;
void SaveSettings( wxConfigBase* aCfg ) override;

View File

@ -47,7 +47,6 @@ set( GERBVIEW_SRCS
files.cpp
gerbview_config.cpp
gerbview_frame.cpp
hotkeys.cpp
json11.cpp
job_file_reader.cpp
locate.cpp

View File

@ -74,11 +74,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_MENU( wxID_EXIT, GERBVIEW_FRAME::OnQuit )
// menu Preferences
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, GERBVIEW_FRAME::Process_Config )
EVT_MENU( wxID_PREFERENCES, GERBVIEW_FRAME::Process_Config )
// menu Postprocess
EVT_MENU( ID_GERBVIEW_SHOW_LIST_DCODES, GERBVIEW_FRAME::Process_Special_Functions )
EVT_MENU( ID_GERBVIEW_SHOW_SOURCE, GERBVIEW_FRAME::OnShowGerberSourceFile )
@ -126,7 +121,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
GERBVIEW_SELECTION_TOOL* selTool = GetToolManager()->GetTool<GERBVIEW_SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
GERBVIEW_SELECTION& selection = selTool->GetSelection();
GERBER_DRAW_ITEM* currItem = (GERBER_DRAW_ITEM*) selection.Front();
switch( id )

View File

@ -30,7 +30,6 @@
#include <kiface_i.h>
#include <pgm_base.h>
#include <gerbview.h>
#include <hotkeys.h>
#include <gerbview_frame.h>
const wxChar* g_GerberPageSizeList[] =
@ -123,11 +122,6 @@ PGM_BASE& Pgm()
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{
start_common( aCtlBits );
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( GERBVIEW_FRAME_NAME, GerbviewHotkeysDescr );
return true;
}

View File

@ -28,39 +28,21 @@
#include <common.h>
#include <config_params.h>
#include <gerbview_frame.h>
#include <hotkeys.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_gerbview_settings.h>
#include <dialogs/panel_gerbview_display_options.h>
void GERBVIEW_FRAME::Process_Config( wxCommandEvent& event )
{
int id = event.GetId();
switch( id )
{
case wxID_PREFERENCES:
ShowPreferences( GerbviewHotkeysDescr, GerbviewHotkeysDescr, wxT( "gerbview" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
// Display current hotkey list for GerbView.
DisplayHotkeyList( this, GerbviewHotkeysDescr );
break;
default:
wxMessageBox( wxT( "GERBVIEW_FRAME::Process_Config error" ) );
break;
}
}
#include <panel_hotkeys_editor.h>
void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent )
void GERBVIEW_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
PANEL_HOTKEYS_EDITOR* aHotkeysPanel )
{
wxTreebook* book = aParent->GetTreebook();
book->AddPage( new PANEL_GERBVIEW_SETTINGS( this, book ), _( "Gerbview" ) );
book->AddSubPage( new PANEL_GERBVIEW_DISPLAY_OPTIONS( this, book ), _( "Display Options" ) );
aHotkeysPanel->AddHotKeys( GetToolManager() );
}

View File

@ -30,21 +30,20 @@
#include <bitmaps.h>
#include <wildcards_and_files_ext.h>
#include <eda_dockart.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_id.h>
#include <hotkeys.h>
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include <dialog_helpers.h>
#include <DCodeSelectionbox.h>
#include <gerbview_layer_widget.h>
#include <gerbview_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tool/tool_dispatcher.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/gerbview_actions.h>
@ -81,7 +80,6 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
m_showAxis = true; // true to show X and Y axis on screen
m_showBorderAndTitleBlock = false; // true for reference drawings.
m_hotkeysDescrList = GerbviewHotkeysDescr;
m_SelLayerBox = NULL;
m_DCodeSelector = NULL;
m_SelComponentBox = nullptr;
@ -1139,6 +1137,7 @@ void GERBVIEW_FRAME::setupTools()
m_toolDispatcher = new TOOL_DISPATCHER( m_toolManager, m_actions );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new GERBVIEW_SELECTION_TOOL );
m_toolManager->RegisterTool( new GERBVIEW_CONTROL );

View File

@ -450,13 +450,8 @@ public:
*/
void OnQuit( wxCommandEvent& event );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
GERBER_DRAW_ITEM* Locate( const wxPoint& aPosition, int typeloc );
void Process_Config( wxCommandEvent& event );
void OnUpdateDrawMode( wxUpdateUIEvent& aEvent );
void OnUpdateSelectDCode( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
@ -590,7 +585,7 @@ public:
/**
* Allows Gerbview to install its preferences panels into the preferences dialog.
*/
void InstallPreferences( PAGED_DIALOG* aParent ) override;
void InstallPreferences( PAGED_DIALOG* aParent, PANEL_HOTKEYS_EDITOR* aHotkeysPanel ) override;
/**
* Called after the preferences dialog is run.

View File

@ -1,138 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <common.h>
#include <gerbview_id.h>
#include <gerbview.h>
#include <gerbview_frame.h>
#include <gerbview_layer_widget.h>
#include <hotkeys.h>
/* How to add a new hotkey:
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
* add a new EDA_HOTKEY entry like:
* static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the
* hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch
* in OnHotKey() function. default key value is the default hotkey for this command.
* Can be overrided by the user hotkey list file add the HkMyNewEntry pointer in the
* s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) Add the
* new code in the switch in OnHotKey() function. when the variable PopupOn is true,
* an item is currently edited. This can be usefull if the new function cannot be
* executed while an item is currently being edited
* ( For example, one cannot start a new wire when a component is moving.)
*
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* and see this list for some ascii keys (space ...)
*/
// local variables
// Hotkey list:
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ),
HK_ZOOM_SELECTION, GR_KB_CTRL + WXK_F5 );
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ),
HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES );
static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY HkSwitchUnits( _HKI( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkSwitchHighContrastMode( _HKI( "Toggle High Contrast Mode" ),
HK_SWITCH_HIGHCONTRAST_MODE, 'H' + GR_KB_CTRL );
static EDA_HOTKEY HkLinesDisplayMode( _HKI( "Gbr Lines Display Mode" ),
HK_GBR_LINES_DISPLAY_MODE, 'L' );
static EDA_HOTKEY HkFlashedDisplayMode( _HKI( "Gbr Flashed Display Mode" ),
HK_GBR_FLASHED_DISPLAY_MODE, 'F' );
static EDA_HOTKEY HkPolygonDisplayMode( _HKI( "Gbr Polygons Display Mode" ),
HK_GBR_POLYGON_DISPLAY_MODE, 'P' );
static EDA_HOTKEY HkNegativeObjDisplayMode( _HKI( "Gbr Negative Obj Display Mode" ),
HK_GBR_NEGATIVE_DISPLAY_ONOFF, 'N' );
static EDA_HOTKEY HkDCodesDisplayMode( _HKI( "DCodes Display Mode" ),
HK_GBR_DCODE_DISPLAY_ONOFF, 'D' );
static EDA_HOTKEY HkSwitch2NextCopperLayer( _HKI( "Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' );
static EDA_HOTKEY HkSwitch2PreviousCopperLayer( _HKI( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static EDA_HOTKEY HkCanvasOpenGL( _HKI( "Switch to Modern Toolset with hardware-accelerated graphics (recommended)" ),
HK_CANVAS_OPENGL,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F11 );
static EDA_HOTKEY HkCanvasCairo( _HKI( "Switch to Modern Toolset with software graphics (fall-back)" ),
HK_CANVAS_CAIRO,
#ifdef __WXMAC__
GR_KB_ALT +
#endif
WXK_F12 );
static EDA_HOTKEY HkMeasureTool( _HKI( "Measure Distance (Modern Toolset only)" ),
HK_MEASURE_TOOL, 'M' + GR_KB_SHIFTCTRL );
// List of common hotkey descriptors
EDA_HOTKEY* gerbviewHotkeyList[] = {
&HkHelp, &HkPreferences,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkZoomSelection, &HkSwitchUnits, &HkResetLocalCoord,
&HkLinesDisplayMode, &HkFlashedDisplayMode, &HkPolygonDisplayMode,
&HkDCodesDisplayMode, &HkNegativeObjDisplayMode,
&HkSwitchHighContrastMode,
&HkSwitch2NextCopperLayer,
&HkSwitch2PreviousCopperLayer,
&HkCanvasOpenGL,
&HkCanvasCairo,
&HkMeasureTool,
NULL
};
// list of sections and corresponding hotkey list for GerbView (used to create an hotkey
// config file)
static wxString gerbviewSectionTag( wxT( "[gerbview]" ) );
static wxString gerbviewSectionTitle( _HKI( "Gerbview Hotkeys" ) );
struct EDA_HOTKEY_CONFIG GerbviewHotkeysDescr[] =
{
{ &gerbviewSectionTag, gerbviewHotkeyList, &gerbviewSectionTitle },
{ NULL, NULL, NULL }
};
EDA_HOTKEY* GERBVIEW_FRAME::GetHotKeyDescription( int aCommand ) const
{
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, gerbviewHotkeyList );
return HK_Descr;
}

View File

@ -1,53 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* 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
*/
/**
* gerbview/hotkeys.h
*/
#ifndef GERBVIEW_KOTKEYS_H_
#define GERBVIEW_KOTKEYS_H_
#include <hotkeys_basic.h>
// List of hot keys id.
// see also enum common_hotkey_id_command in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_command {
HK_GBR_LINES_DISPLAY_MODE = HK_COMMON_END,
HK_GBR_FLASHED_DISPLAY_MODE,
HK_GBR_POLYGON_DISPLAY_MODE,
HK_GBR_NEGATIVE_DISPLAY_ONOFF,
HK_GBR_DCODE_DISPLAY_ONOFF,
HK_SWITCH_HIGHCONTRAST_MODE,
HK_SWITCH_LAYER_TO_NEXT,
HK_SWITCH_LAYER_TO_PREVIOUS,
HK_CANVAS_OPENGL,
HK_CANVAS_CAIRO
};
// List of hotkey descriptors for GerbView.
extern struct EDA_HOTKEY_CONFIG GerbviewHotkeysDescr[];
#endif // GERBVIEW_KOTKEYS_H_

View File

@ -28,7 +28,6 @@
#include <kiface_i.h>
#include <pgm_base.h>
#include "gerbview_id.h"
#include "hotkeys.h"
#include <menus_helpers.h>
#include <tool/actions.h>
#include <tool/tool_manager.h>
@ -250,7 +249,7 @@ void GERBVIEW_FRAME::ReCreateMenuBar()
CONDITIONAL_MENU* preferencesMenu = new CONDITIONAL_MENU( false, selTool );
preferencesMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), GerbviewHotkeysDescr, HK_PREFERENCES ),
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, SELECTION_CONDITIONS::ShowAlways );

View File

@ -26,7 +26,6 @@
#include <gerbview_frame.h>
#include <bitmaps.h>
#include <gerbview_id.h>
#include <hotkeys.h>
#include <gerber_file_image.h>
#include <gerber_file_image_list.h>
#include <gbr_layer_box_selector.h>
@ -36,6 +35,7 @@
#include <kicad_string.h>
#include <wx/wupdlock.h>
#include <tool/actions.h>
#include <tool/action_toolbar.h>
#include <tools/gerbview_actions.h>
void GERBVIEW_FRAME::ReCreateHToolbar( void )

View File

@ -70,9 +70,6 @@ public:
static TOOL_ACTION layerChanged; // notification
// Miscellaneous
static TOOL_ACTION showHelp;
// Highlighting
static TOOL_ACTION highlightClear;
static TOOL_ACTION highlightNet;

View File

@ -23,86 +23,82 @@
#include <gerbview_frame.h>
#include <tool/tool_manager.h>
#include <menus_helpers.h>
#include <hotkeys.h>
#include "gerbview_actions.h"
#include "gerbview_control.h"
#include "gerbview_selection_tool.h"
TOOL_ACTION GERBVIEW_ACTIONS::layerChanged( "gerbview.Control.layerChanged",
AS_GLOBAL, 0,
"", "",
NULL, AF_NOTIFY );
AS_GLOBAL, 0, "", "", "",
nullptr, AF_NOTIFY );
TOOL_ACTION GERBVIEW_ACTIONS::highlightClear( "gerbview.Control.highlightClear",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Clear Highlight" ), "",
highlight_remove_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightNet( "gerbview.Control.highlightNet",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Highlight Net" ), "",
general_ratsnest_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightComponent( "gerbview.Control.highlightComponent",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Highlight Component" ), "",
file_footprint_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::highlightAttribute( "gerbview.Control.highlightAttribute",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
_( "Highlight Attribute" ), "",
flag_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::layerNext( "gerbview.Control.layerNext",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_NEXT ),
AS_GLOBAL,
'+', LEGACY_HK_NAME( "Switch to Next Layer" ),
"", "" );
TOOL_ACTION GERBVIEW_ACTIONS::layerPrev( "gerbview.Control.layerPrev",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_SWITCH_LAYER_TO_PREVIOUS ),
AS_GLOBAL,
'-', LEGACY_HK_NAME( "Switch to Previous Layer" ),
"", "" );
TOOL_ACTION GERBVIEW_ACTIONS::linesDisplayOutlines( "gerbview.Control.linesDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_LINES_DISPLAY_MODE ),
AS_GLOBAL,
'L', LEGACY_HK_NAME( "Gbr Lines Display Mode" ),
_( "Sketch Lines" ), _( "Show lines in outline mode" ),
showtrack_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::flashedDisplayOutlines( "gerbview.Control.flashedDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_FLASHED_DISPLAY_MODE ),
AS_GLOBAL,
'F', LEGACY_HK_NAME( "Gbr Flashed Display Mode" ),
_( "Sketch Flashed Items" ), _( "Show flashed items in outline mode" ),
pad_sketch_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::polygonsDisplayOutlines( "gerbview.Control.polygonsDisplayOutlines",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_POLYGON_DISPLAY_MODE ),
AS_GLOBAL,
'P', LEGACY_HK_NAME( "Gbr Polygons Display Mode" ),
_( "Sketch Polygons" ), _( "Show polygons in outline mode" ),
opt_show_polygon_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::negativeObjectDisplay( "gerbview.Control.negativeObjectDisplay",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_NEGATIVE_DISPLAY_ONOFF ),
AS_GLOBAL,
'N', LEGACY_HK_NAME( "Gbr Negative Obj Display Mode" ),
_( "Ghost Negative Objects" ), _( "Show negative objects in ghost color" ),
gerbview_show_negative_objects_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::dcodeDisplay( "gerbview.Control.dcodeDisplay",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_DCODE_DISPLAY_ONOFF ),
AS_GLOBAL,
'D', LEGACY_HK_NAME( "DCodes Display Mode" ),
_( "Show DCodes" ), _( "Show dcode number" ),
show_dcodenumber_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::toggleDiffMode( "gerbview.Control.toggleDiffMode",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_GBR_DCODE_DISPLAY_ONOFF ),
AS_GLOBAL, 0, "",
_( "Show in Differential Mode" ), _( "Show layers in diff (compare) mode" ),
gbr_select_mode2_xpm );
TOOL_ACTION GERBVIEW_ACTIONS::showHelp( "gerbview.Control.showHelp",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_HELP ),
"", "" );
GERBVIEW_CONTROL::GERBVIEW_CONTROL() :
TOOL_INTERACTIVE( "gerbview.Control" ), m_frame( NULL )
{
}
GERBVIEW_CONTROL::~GERBVIEW_CONTROL()
TOOL_INTERACTIVE( "gerbview.Control" ),
m_frame( nullptr )
{
}
@ -117,7 +113,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
{
auto settings = static_cast<KIGFX::GERBVIEW_PAINTER*>( getView()->GetPainter() )->GetSettings();
const auto& selection = m_toolMgr->GetTool<GERBVIEW_SELECTION_TOOL>()->GetSelection();
GERBER_DRAW_ITEM* item = NULL;
GERBER_DRAW_ITEM* item = nullptr;
if( selection.Size() == 1 )
{
@ -235,14 +231,6 @@ int GERBVIEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
}
int GERBVIEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
DisplayHotkeyList( m_frame, m_frame->GetHotkeyConfig() );
return 0;
}
int GERBVIEW_CONTROL::UpdateMessagePanel( const TOOL_EVENT& aEvent )
{
GERBVIEW_SELECTION_TOOL* selTool = m_toolMgr->GetTool<GERBVIEW_SELECTION_TOOL>();
@ -285,8 +273,6 @@ void GERBVIEW_CONTROL::setTransitions()
Go( &GERBVIEW_CONTROL::DisplayControl, ACTIONS::highContrastMode.MakeEvent() );
Go( &GERBVIEW_CONTROL::DisplayControl, GERBVIEW_ACTIONS::toggleDiffMode.MakeEvent() );
Go( &GERBVIEW_CONTROL::ShowHelp, GERBVIEW_ACTIONS::showHelp.MakeEvent() );
Go( &GERBVIEW_CONTROL::UpdateMessagePanel, EVENTS::SelectedEvent );
Go( &GERBVIEW_CONTROL::UpdateMessagePanel, EVENTS::UnselectedEvent );
Go( &GERBVIEW_CONTROL::UpdateMessagePanel, EVENTS::ClearedEvent );

View File

@ -34,7 +34,7 @@ class GERBVIEW_CONTROL : public TOOL_INTERACTIVE
{
public:
GERBVIEW_CONTROL();
~GERBVIEW_CONTROL();
~GERBVIEW_CONTROL() override { }
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
@ -58,7 +58,6 @@ public:
// Miscellaneous
int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int UpdateMessagePanel( const TOOL_EVENT& aEvent );
int Print( const TOOL_EVENT& aEvent );

View File

@ -31,8 +31,6 @@ using namespace std::placeholders;
#include <view/view_group.h>
#include <painter.h>
#include <bitmaps.h>
#include <hotkeys.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <preview_items/bright_box.h>
@ -45,24 +43,20 @@ using namespace std::placeholders;
// Selection tool actions
TOOL_ACTION GERBVIEW_ACTIONS::selectionActivate( "gerbview.InteractiveSelection",
AS_GLOBAL, 0,
AS_GLOBAL, 0, "",
"", "", NULL, AF_ACTIVATE ); // No description, it is not supposed to be shown anywhere
TOOL_ACTION GERBVIEW_ACTIONS::selectionCursor( "gerbview.InteractiveSelection.Cursor",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION GERBVIEW_ACTIONS::selectItem( "gerbview.InteractiveSelection.SelectItem",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION GERBVIEW_ACTIONS::unselectItem( "gerbview.InteractiveSelection.UnselectItem",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
TOOL_ACTION GERBVIEW_ACTIONS::selectionClear( "gerbview.InteractiveSelection.Clear",
AS_GLOBAL, 0,
"", "" ); // No description, it is not supposed to be shown anywhere
AS_GLOBAL );
class HIGHLIGHT_MENU: public ACTION_MENU

View File

@ -45,8 +45,7 @@
#include <common.h>
#include <layers_id_colors_and_visibility.h>
#include <frame_type.h>
#include "hotkeys_basic.h"
#include <tool/action_toolbar.h>
#include <hotkeys_basic.h>
#include <kiway_holder.h>
// Option for main frames
@ -72,6 +71,7 @@ class TOOL_DISPATCHER;
class ACTIONS;
class PAGED_DIALOG;
class DIALOG_EDIT_LIBRARY_TABLES;
class PANEL_HOTKEYS_EDITOR;
enum id_librarytype {
@ -123,6 +123,7 @@ protected:
// and to name some config files (legacy hotkey files)
TOOL_MANAGER* m_toolManager;
ACTIONS* m_actions;
bool m_hasAutoSave;
bool m_autoSaveState;
@ -173,15 +174,6 @@ protected:
*/
virtual bool doAutoSave();
/**
* Return a SEARCH_STACK pertaining to entire program.
*
* This is overloaded in #KICAD_MANAGER_FRAME
*/
virtual const SEARCH_STACK& sys_search();
virtual wxString help_name();
/**
* Called when when the units setting has changed to allow for any derived classes
* to handle refreshing and controls that have units based measurements in them. The
@ -246,14 +238,17 @@ public:
bool IsType( FRAME_T aType ) const { return m_Ident == aType; }
void GetKicadHelp( wxCommandEvent& event );
/**
* Return a SEARCH_STACK pertaining to entire program.
*
* This is overloaded in #KICAD_MANAGER_FRAME
*/
virtual const SEARCH_STACK& sys_search();
void GetKicadContribute( wxCommandEvent& event );
virtual wxString help_name();
void GetKicadAbout( wxCommandEvent& event );
bool ShowPreferences( EDA_HOTKEY_CONFIG* aHotkeys, EDA_HOTKEY_CONFIG* aShowHotkeys,
const wxString& aHotkeysNickname );
void OnKicadAbout( wxCommandEvent& event );
void OnPreferences( wxCommandEvent& event );
void PrintMsg( const wxString& text );
@ -268,7 +263,7 @@ public:
* Allow a frame to load its preference panels (if any) into the preferences dialog.
* @param aParent a paged dialog into which the preference panels should be installed
*/
virtual void InstallPreferences( PAGED_DIALOG* aParent ) { }
virtual void InstallPreferences( PAGED_DIALOG* , PANEL_HOTKEYS_EDITOR* ) { }
/**
* Load common frame parameters from a configuration file.
@ -300,7 +295,6 @@ public:
return baseCfgName;
}
/**
* Save changes to the project settings to the project (.pro) file.
*
@ -312,20 +306,6 @@ public:
// Read/Save and Import/export hotkeys config
/**
* Store the current hotkey list
*
* The hotkey list is stored using the standard wxConfig mechanism or a file.
*
* @param aDescList = pointer to the current hotkey list.
* @param aFullFileName = a wxString pointer to a full file name.
* if NULL, use the standard wxConfig mechanism (default)
* the output format is: shortcut "key" "function"
* lines starting with # are comments
*/
virtual int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
wxString* aFullFileName = NULL );
/**
* Prompt the user for an old hotkey file to read, and read it.
*

View File

@ -98,8 +98,6 @@ protected:
std::unique_ptr<wxSingleInstanceChecker> m_file_checker; ///< prevents opening same file multiple times.
EDA_HOTKEY_CONFIG* m_hotkeysDescrList;
int m_LastGridSizeId; // the command id offset (>= 0) of the last selected grid
// 0 is for the grid corresponding to
// a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
@ -116,7 +114,6 @@ protected:
bool m_PolarCoords; //< for those frames that support polar coordinates
TOOL_DISPATCHER* m_toolDispatcher;
ACTIONS* m_actions;
/// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId;
@ -351,22 +348,6 @@ public:
*/
virtual void ExecuteRemoteCommand( const char* cmdline ){}
///> @copydoc EDA_BASE_FRAME::WriteHotkeyConfig
int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL ) override;
/**
* Return a structure containing currently used hotkey mapping.
*/
EDA_HOTKEY_CONFIG* GetHotkeyConfig() const { return m_hotkeysDescrList; }
/**
* Search lists of hot key identifiers (HK_xxx) used in the frame to find a matching
* hot key descriptor.
* @param aCommand is the hot key identifier.
* @return Hot key descriptor or NULL if none found.
*/
virtual EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const = 0;
/**
* Return a human readable value which can be displayed as zoom
* level indicator in dialogs.
@ -389,20 +370,6 @@ public:
virtual void ReCreateVToolbar() = 0;
virtual void ReCreateAuxiliaryToolbar() { }
// Toolbar accessors
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.
*
* This is needed because GerbView and Pcbnew can put some of the same tools in
* different toolbars.
*/
bool GetToolToggled( int aToolId );
/**
* Set the tool command ID to \a aId and sets the cursor to \a aCursor.
*

View File

@ -21,98 +21,25 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file hotkey_store.h
*/
#ifndef HOTKEY_STORE__H
#define HOTKEY_STORE__H
#include <hotkeys_basic.h>
class TOOL_MANAGER;
/**
* Class that manages a hotkey that can be changed, reset to its
* old value, a default or saved.
*/
class CHANGED_HOTKEY
struct HOTKEY
{
public:
CHANGED_HOTKEY( EDA_HOTKEY& aHotkey, const wxString& aTag ):
m_orig( aHotkey ),
m_changed( aHotkey ),
m_tag( aTag )
{}
EDA_HOTKEY& GetCurrentValue()
{
return m_changed;
}
const EDA_HOTKEY& GetCurrentValue() const
{
return m_changed;
}
/**
* Gets the original value of the hotkey. This is what the hotkey used
* to be, and what it would be set to if reset.
*
* @return reference to the original hotkey.
*/
const EDA_HOTKEY& GetOriginalValue() const
{
return m_orig;
}
/**
* Save changed hotkey to the original location.
*/
void SaveHotkey()
{
m_orig = m_changed;
}
/**
* @brief Return true if the hotkey doesn't match the original (i.e. it
* has been changed)
*/
bool HasUnsavedChange() const
{
return m_orig.m_KeyCode != m_changed.m_KeyCode;
}
const wxString& GetSectionTag() const
{
return m_tag;
}
private:
// Reference to an "original" hotkey config
EDA_HOTKEY& m_orig;
// A separate changeable config
EDA_HOTKEY m_changed;
// The hotkey section tag, used to spot conflicts
const wxString& m_tag;
TOOL_ACTION* m_Parent;
int m_EditKeycode;
};
/**
* Associates a set of hotkeys (a section) with a display name and the hotkeys
*/
struct HOTKEY_SECTION
{
// The displayed, translated, name of the section
wxString m_name;
// List of update-able hotkey data for this section
std::vector<CHANGED_HOTKEY> m_hotkeys;
// Back reference to the underlying hotkey data of this section
EDA_HOTKEY_CONFIG& m_section;
wxString m_SectionName; // The displayed, translated, name of the section
std::vector<HOTKEY> m_HotKeys;
};
@ -124,26 +51,22 @@ class HOTKEY_STORE
{
public:
using SECTION_LIST = std::vector<HOTKEY_SECTION>;
/**
* Construct a HOTKEY_STORE from a list of hotkey sections
*
* @param aHotkeys the hotkey configs that will be managed by this store.
*/
HOTKEY_STORE( EDA_HOTKEY_CONFIG* aHotkeys );
HOTKEY_STORE();
void Init( std::vector<TOOL_MANAGER*> aToolManagerList );
static wxString GetAppName( TOOL_ACTION* aAction );
static wxString GetSectionName( TOOL_ACTION* aAction );
/**
* Get the list of sections managed by this store
*/
SECTION_LIST& GetSections();
/**
* Find a hotkey with the given command ID and in the given section
* @return pointer to the hotkey if found.
*/
CHANGED_HOTKEY* FindHotkey( const wxString& aTag, int aCmdId );
std::vector<HOTKEY_SECTION>& GetSections();
/**
* Persist all changes to hotkeys in the store to the underlying
@ -164,24 +87,16 @@ public:
/**
* Check whether the given key conflicts with anything in this store.
*
* @param aAction - the action the key is proposed to be assigned to. Only conflicts
* within the same section will be flagged.
* @param aKey - key to check
* @param aSectionTag - section tag into which the key is proposed to be installed
* @param aConfKey - if not NULL, outparam getting the key this one conflicts with
* @param aConfSect - if not NULL, outparam getting the section this one conflicts with
* @param aConflict - outparam getting the section this one conflicts with
*/
bool CheckKeyConflicts( long aKey, const wxString& aSectionTag,
EDA_HOTKEY** aConfKey, EDA_HOTKEY_CONFIG** aConfSect );
bool CheckKeyConflicts( TOOL_ACTION* aAction, long aKey, HOTKEY** aConflict );
private:
/**
* Generate a HOTKEY_SECTION for a single section
* described by an EDA_HOTKEY_CONFIG
*/
HOTKEY_SECTION genSection( EDA_HOTKEY_CONFIG& aSection );
// Internal data for every hotkey passed in
SECTION_LIST m_hk_sections;
std::vector<TOOL_MANAGER*> m_toolManagers;
std::vector<HOTKEY_SECTION> m_hk_sections;
};
#endif // HOTKEY_STORE__H

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -21,14 +21,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file hotkeys_basic.h
* @brief Some functions to handle hotkeys in KiCad
*/
#ifndef HOTKEYS_BASIC_H
#define HOTKEYS_BASIC_H
#include <map>
#include <common.h>
#define DEFAULT_HOTKEY_FILENAME_EXT wxT( "hotkeys" )
@ -43,6 +39,8 @@
// strings to translate
#include <i18n_utility.h> // _HKI definition
class TOOL_ACTION;
class TOOL_MANAGER;
class EDA_BASE_FRAME;
@ -58,9 +56,6 @@ extern wxString g_CommonSectionTag;
*/
class EDA_HOTKEY
{
private:
int m_defaultKeyCode; // Key code assigned upon object construction, to be used as default value
public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
wxString m_InfoMsg; // info message.
@ -69,13 +64,6 @@ public:
public:
EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
EDA_HOTKEY( const EDA_HOTKEY* base);
void ResetKeyCodeToDefault() { m_KeyCode = m_defaultKeyCode; }
int GetDefaultKeyCode() const
{
return m_defaultKeyCode;
}
};
@ -94,39 +82,12 @@ public:
struct EDA_HOTKEY_CONFIG
{
public:
wxString* m_SectionTag; // The configuration file section name.
EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers
wxString* m_Title; // Title displayed in hotkey editor and used as comment in file
wxString* m_SectionTag; // The configuration file section name.
EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers
wxString* m_Title; // Title displayed in hotkey editor and used as comment in file
};
/**
* Class EDA_HOTKEY_CLIENT_DATA
* provides client data member for hotkeys to include in command events generated
* by the hot key.
*/
class EDA_HOTKEY_CLIENT_DATA : public wxClientData
{
//< Logical position of the mouse cursor when the hot key was pressed.
wxPoint m_position;
public:
EDA_HOTKEY_CLIENT_DATA( const wxPoint& aPosition = wxDefaultPosition ) :
m_position( aPosition ) {}
~EDA_HOTKEY_CLIENT_DATA();
void SetPosition( const wxPoint& aPosition ) { m_position = aPosition; }
wxPoint GetPosition() { return m_position; }
};
/* Functions:
*/
void AddHotkeyConfigMenu( wxMenu* menu );
void HandleHotkeyConfigMenuSelection( EDA_BASE_FRAME* frame, int id );
/**
* Function KeyNameFromKeyCode
* return the key name from the key code
@ -136,7 +97,7 @@ void HandleHotkeyConfigMenuSelection( EDA_BASE_FRAME* frame, int id );
* @param aIsFound = a pointer to a bool to return true if found, or false. an be NULL default)
* @return the key name in a wxString
*/
wxString KeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL );
wxString KeyNameFromKeyCode( int aKeycode, bool * aIsFound = nullptr );
/**
* Function KeyNameFromCommandId
@ -147,17 +108,6 @@ wxString KeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL );
*/
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId );
/**
* Function KeyCodeFromKeyName
* return the key code from its key name
* Only some wxWidgets key values are handled for function key
* @param keyname = wxString key name to find in s_Hotkey_Name_List[],
* like F2 or space or an usual (ascii) char.
* @return the key code
*/
int KeyCodeFromKeyName( const wxString& keyname );
/**
* An helper enum for AddHotkeyName function
* In menus we can add a hot key, or an accelerator , or sometimes just a comment
@ -169,21 +119,18 @@ int KeyCodeFromKeyName( const wxString& keyname );
enum HOTKEY_ACTION_TYPE
{
IS_HOTKEY,
IS_ACCELERATOR,
IS_COMMENT
};
/**
* Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name
* @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value
* @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
* @return a wxString (aTest + key name) if key found or aText without modification
* AddHotkeyName
* @param aText - the base text on which to append the hotkey
* @param aHotKey - the hotkey keycode
* @param aStyle - IS_HOTKEY to add <tab><keyname> (shortcuts in menus, same as hotkeys)
* IS_COMMENT to add <spaces><(keyname)> mainly in tool tips
*/
wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList, int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY);
wxString AddHotkeyName( const wxString& aText, int aHotKey,
HOTKEY_ACTION_TYPE aStyle = IS_HOTKEY);
/**
* Function AddHotkeyName
@ -203,101 +150,33 @@ wxString AddHotkeyName( const wxString& aText,
* Function DisplayHotkeyList
* Displays the current hotkey list
* @param aFrame = current active frame
* @param aList = pointer to a EDA_HOTKEY_CONFIG list (Null terminated)
* @param aToolMgr = the tool manager holding the registered actions from which the hotkeys
* will be harvested
*/
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList );
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, TOOL_MANAGER* aToolMgr );
/**
* Function GetDescriptorFromHotkey
* Returns a EDA_HOTKEY* pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
* Function WriteHotKeyConfig
* Updates the hotkeys config file with the hotkeys from the given actions map.
*/
EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList );
int WriteHotKeyConfig( std::map<std::string, TOOL_ACTION*> aActionMap );
/**
* Function GetDescriptorFromCommand
* Returns a EDA_HOTKEY* pointer from a hot key identifier.
* @param aCommand = hot key identifier (@see hotkeys.h)
* @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/
EDA_HOTKEY* GetDescriptorFromCommand( int aCommand, EDA_HOTKEY** aList );
/**
* Function ReadHotkeyConfig
* Function ReadLegacyHotkeyConfigFile
* Read hotkey configuration for a given app,
* possibly before the frame for that app has been created
* @param aFilename = the filename to save the hotkeys as
* @param aDescList = the hotkey data
* @param aDefaultLocation = if true, add hotkey path and extension to aFilename
* @param aMap The list of keycodes mapped by legacy property names
* @return 1 on success, 0 on failure
*/
int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList,
const bool aDefaultLocation = true );
int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map<std::string, int>& aMap );
/**
* Function ReadHotkeyConfig
* Function ReadLegacyHotkeyConfig
* Read configuration data and fill the current hotkey list with hotkeys
* @param aAppname = the value of the app's m_FrameName
* @param aDescList = current hotkey list descr. to initialize.
* @param aMap The list of keycodes mapped by legacy property names
*/
int ReadHotkeyConfig( const wxString& aAppname, struct EDA_HOTKEY_CONFIG* aDescList );
/**
* Function ParseHotkeyConfig
* Translates hotkey string data into application hotkeys
* @param data The string of data read from the configuration files
* @param aDescList The list of hotkeys to update
* @param aAppname The application interface requesting hotkey updates or empty for all
*/
void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescList,
const wxString& aAppname );
// common hotkeys event id
// these hotkey ID are used in many files, so they are define here only once.
enum common_hotkey_id_command {
HK_NOT_FOUND = 0,
HK_NEW,
HK_OPEN,
HK_SAVE,
HK_SAVEAS,
HK_PRINT,
HK_UNDO,
HK_REDO,
HK_CUT,
HK_COPY,
HK_PASTE,
HK_DUPLICATE,
HK_DELETE,
HK_FIND,
HK_FIND_NEXT,
HK_FIND_NEXT_MARKER,
HK_REPLACE,
HK_RESET_LOCAL_COORD,
HK_SET_GRID_ORIGIN,
HK_RESET_GRID_ORIGIN,
HK_SWITCH_GRID_TO_FASTGRID1,
HK_SWITCH_GRID_TO_FASTGRID2,
HK_SWITCH_GRID_TO_NEXT,
HK_SWITCH_GRID_TO_PREVIOUS,
HK_SWITCH_UNITS,
HK_HELP,
HK_ZOOM_IN,
HK_ZOOM_OUT,
HK_ZOOM_REDRAW,
HK_ZOOM_CENTER,
HK_ZOOM_AUTO,
HK_ZOOM_SELECTION,
HK_LEFT_CLICK,
HK_LEFT_DCLICK,
HK_PREFERENCES,
HK_TOGGLE_CURSOR,
HK_MEASURE_TOOL,
HK_UPDATE_PCB_FROM_SCH,
HK_COMMON_END
};
int ReadLegacyHotkeyConfig( const wxString& aAppname, std::map<std::string, int>& aMap );
#endif // HOTKEYS_BASIC_H

View File

@ -34,24 +34,23 @@
class wxPanel;
class wxSizer;
class TOOL_MANAGER;
class PANEL_HOTKEYS_EDITOR : public wxPanel
{
protected:
EDA_BASE_FRAME* m_frame;
bool m_readOnly;
struct EDA_HOTKEY_CONFIG* m_hotkeys;
wxString m_nickname;
bool m_readOnly;
std::vector<TOOL_MANAGER*> m_toolManagers;
HOTKEY_STORE m_hotkeyStore;
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
HOTKEY_STORE m_hotkeyStore;
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
public:
PANEL_HOTKEYS_EDITOR( EDA_BASE_FRAME* aFrame, wxWindow* aWindow, bool aReadOnly,
EDA_HOTKEY_CONFIG* aHotkeys, EDA_HOTKEY_CONFIG* aShowHotkeys,
const wxString& aNickname );
PANEL_HOTKEYS_EDITOR( wxWindow* aWindow, bool aReadOnly );
void AddHotKeys( TOOL_MANAGER* aToolMgr );
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;

View File

@ -63,9 +63,6 @@ class wxApp;
class wxMenu;
class wxWindow;
class FILENAME_RESOLVER;
class EDA_DRAW_FRAME;
class FILE_HISTORY : public wxFileHistory
{

View File

@ -74,6 +74,11 @@ public:
*/
static int MakeActionId( const std::string& aActionName );
/**
* Get a list of currently-registered actions mapped by their name.
*/
const std::map<std::string, TOOL_ACTION*>& GetActions();
/**
* Function FindAction()
* Finds an action with a given name (if there is one available).
@ -98,7 +103,7 @@ public:
int GetHotKey( const TOOL_ACTION& aAction ) const;
/**
* Function UpdateHotKeys()
* Function ReadHotKeyConfig()
* Updates TOOL_ACTIONs hot key assignment according to the current frame's Hot Key Editor settings.
*/
void UpdateHotKeys();
@ -117,9 +122,10 @@ public:
}
private:
///> Resolves a reference to legacy hot key settings to a particular hot key.
///> @param aAction is the action to be resolved.
int processHotKey( TOOL_ACTION* aAction );
// Resolves a hotkey by applying legacy and current settings over the action's
// default hotkey.
int processHotKey( TOOL_ACTION* aAction, std::map<std::string, int> aLegacyMap,
std::map<std::string, int> aHotKeyMap );
///> Tool manager needed to run actions
TOOL_MANAGER* m_toolMgr;

View File

@ -32,6 +32,8 @@
class TOOL_EVENT;
class TOOL_MANAGER;
#define LEGACY_HK_NAME( x ) x
/**
* Class ACTIONS
*
@ -94,8 +96,6 @@ public:
static TOOL_ACTION toggleCursor;
static TOOL_ACTION toggleCursorStyle;
static TOOL_ACTION highContrastMode;
static TOOL_ACTION highContrastInc;
static TOOL_ACTION highContrastDec;
/// Cursor control with keyboard
static TOOL_ACTION cursorUp;
@ -146,11 +146,17 @@ public:
static TOOL_ACTION showFootprintBrowser;
static TOOL_ACTION showFootprintEditor;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION acceleratedGraphics;
static TOOL_ACTION standardGraphics;
// Suite
static TOOL_ACTION configurePaths;
static TOOL_ACTION showSymbolLibTable;
static TOOL_ACTION showFootprintLibTable;
static TOOL_ACTION acceleratedGraphics;
static TOOL_ACTION standardGraphics;
static TOOL_ACTION gettingStarted;
static TOOL_ACTION help;
static TOOL_ACTION listHotKeys;
static TOOL_ACTION getInvolved;
/**
* Function TranslateLegacyId()

View File

@ -0,0 +1,67 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 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 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 COMMON_CONTROL_H
#define COMMON_CONTROL_H
#include <tool/tool_interactive.h>
class EDA_BASE_FRAME;
/**
* Class COMMON_CONTROL
*
* Handles actions that are shared between different applications
*/
class COMMON_CONTROL : public TOOL_INTERACTIVE
{
public:
COMMON_CONTROL() :
TOOL_INTERACTIVE( "common.SuiteControl" ),
m_frame( nullptr )
{ }
~COMMON_CONTROL() override { }
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;
int ConfigurePaths( const TOOL_EVENT& aEvent );
int ShowLibraryTable( const TOOL_EVENT& aEvent );
int ShowPlayer( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int ListHotKeys( const TOOL_EVENT& aEvent );
int GetInvolved( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions() override;
private:
///> Pointer to the currently used edit frame.
EDA_BASE_FRAME* m_frame;
};
#endif

View File

@ -40,10 +40,10 @@ class COMMON_TOOLS : public TOOL_INTERACTIVE
public:
COMMON_TOOLS() :
TOOL_INTERACTIVE( "common.Control" ),
m_frame( NULL )
m_frame( nullptr )
{ }
virtual ~COMMON_TOOLS() { }
~COMMON_TOOLS() override { }
/// @copydoc TOOL_BASE::Reset()
void Reset( RESET_REASON aReason ) override;
@ -79,12 +79,8 @@ public:
int ToggleGrid( const TOOL_EVENT& aEvent );
int GridProperties( const TOOL_EVENT& aEvent );
int ConfigurePaths( const TOOL_EVENT& aEvent );
int ShowLibraryTable( const TOOL_EVENT& aEvent );
int SwitchCanvas( const TOOL_EVENT& aEvent );
int ShowPlayer( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events.
void setTransitions() override;

View File

@ -28,7 +28,6 @@
#include <functional>
#include <core/typeinfo.h>
#include <vector>
#include <tool/selection.h>
///> Functor type that checks a specific condition for selected items.

View File

@ -47,9 +47,10 @@ class TOOL_ACTION
{
public:
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
int aDefaultHotKey = 0, const wxString& aMenuItem = wxEmptyString,
const wxString& aMenuDesc = wxEmptyString, const BITMAP_OPAQUE* aIcon = NULL,
TOOL_ACTION_FLAGS aFlags = AF_NONE, void* aParam = NULL );
int aDefaultHotKey = 0, const std::string& aLegacyHotKeyName = "",
const wxString& aMenuText = wxEmptyString, const wxString& aTooltip = wxEmptyString,
const BITMAP_OPAQUE* aIcon = nullptr, TOOL_ACTION_FLAGS aFlags = AF_NONE,
void* aParam = nullptr );
~TOOL_ACTION();
@ -66,15 +67,25 @@ public:
/**
* Function GetName()
* Returns name of the action. It is the same one that is contained in TOOL_EVENT that is
* sent by activating the TOOL_ACTION.
* sent by activating the TOOL_ACTION. Convention is "app.tool.actionName".
*
* @return Name of the action.
*/
const std::string& GetName() const
{
return m_name;
}
const std::string& GetName() const { return m_name; }
/**
* Function GetDefaultHotKey()
* Returns the default hotkey (if any) for the action.
*/
int GetDefaultHotKey() const { return m_defaultHotKey; }
/**
* Function GetHotKey()
* Returns the hotkey keycode which initiates the action.
*/
int GetHotKey() const { return m_hotKey; }
void SetHotKey( int aKeycode ) { m_hotKey = aKeycode; }
/**
* Function GetId()
* Returns the unique id of the TOOL_ACTION object. It is valid only after registering the
@ -82,10 +93,7 @@ public:
*
* @return The unique identification number. If the number is negative, then it is not valid.
*/
int GetId() const
{
return m_id;
}
int GetId() const { return m_id; }
/**
* Function MakeEvent()
@ -102,30 +110,13 @@ public:
return TOOL_EVENT( TC_COMMAND, TA_ACTION, m_name, m_scope, m_param );
}
const wxString& GetMenuItem() const
{
return m_menuItem;
}
const wxString& GetMenuItem() const { return m_menuText; }
void SetMenuItem( const wxString& aItem ) { m_menuText = aItem; }
void SetMenuItem( const wxString& aItem )
{
m_menuItem = aItem;
}
const wxString& GetDescription() const { return m_tooltip; }
void SetDescription( const wxString& aDescription ) { m_tooltip = aDescription; }
const wxString& GetDescription() const
{
return m_menuDescription;
}
void SetDescription( const wxString& aDescription )
{
m_menuDescription = aDescription;
}
TOOL_ACTION_SCOPE GetScope() const
{
return m_scope;
}
TOOL_ACTION_SCOPE GetScope() const { return m_scope; }
/**
* Returns name of the tool associated with the action. It is basically the action name
@ -158,57 +149,26 @@ public:
return m_icon;
}
/**
* Creates a hot key code that refers to a legacy hot key setting, instead of a particular key.
* @param aHotKey is an ID of hot key to be referred (see hotkeys.h).
*/
inline static int LegacyHotKey( int aHotKey )
{
assert( ( aHotKey & LEGACY_HK ) == 0 );
return aHotKey | LEGACY_HK;
}
private:
friend class ACTION_MANAGER;
/// Returns the hot key assigned in the object definition. It may refer to a legacy hot key setting
/// (if LEGACY_HK flag is set).
int getDefaultHotKey()
{
return m_defaultHotKey;
}
/// Name of the action (convention is "app.tool.actionName")
std::string m_name;
TOOL_ACTION_SCOPE m_scope;
/// Name of the action (convention is: app.[tool.]action.name)
std::string m_name;
const int m_defaultHotKey; // Default hot key
int m_hotKey; // The curret hotkey (post-user-settings-application)
const std::string m_legacyName; // Name for reading legacy hotkey settings
/// Scope of the action
TOOL_ACTION_SCOPE m_scope;
wxString m_menuText;
wxString m_tooltip;
const BITMAP_OPAQUE* m_icon; // Icon for the menu entry
/// Default hot key that activates the action.
const int m_defaultHotKey;
int m_id; // Unique ID for maps. Assigned by ACTION_MANAGER.
/// Menu entry text
wxString m_menuItem;
TOOL_ACTION_FLAGS m_flags;
void* m_param; // Generic parameter
/// Pop-up help
wxString m_menuDescription;
// Icon for menu entry
const BITMAP_OPAQUE* m_icon;
/// Unique ID for fast matching. Assigned by ACTION_MANAGER.
int m_id;
/// Action flags
TOOL_ACTION_FLAGS m_flags;
/// Generic parameter
void* m_param;
/// Flag to determine the hot key settings is not a particular key, but a reference to legacy
/// hot key setting.
static const int LEGACY_HK = 0x800000;
};
#endif

View File

@ -36,7 +36,6 @@
class EDA_ITEM;
class TOOL_MANAGER;
class wxWindow;
namespace KIGFX
{
@ -187,6 +186,9 @@ protected:
template <typename T>
T* getEditFrame() const
{
#if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
wxASSERT( dynamic_cast<T*>( getEditFrameInt() ) );
#endif
return static_cast<T*>( getEditFrameInt() );
}
@ -199,8 +201,9 @@ protected:
T* getModel() const
{
EDA_ITEM* m = getModelInt();
#if !defined( QA_TEST ) // Dynamic casts give the linker a siezure in the test framework
wxASSERT( dynamic_cast<T*>( m ) );
#endif
return static_cast<T*>( m );
}
@ -220,7 +223,7 @@ private:
// hide the implementation to avoid spreading half of
// kicad and wxWidgets headers to the tools that may not need them at all!
EDA_ITEM* getModelInt() const;
wxWindow* getEditFrameInt() const;
EDA_BASE_FRAME* getEditFrameInt() const;
};
#endif

View File

@ -158,9 +158,11 @@ public:
RunAction( aAction, aNow, (void*) NULL );
}
const std::map<std::string, TOOL_ACTION*>& GetActions();
///> @copydoc ACTION_MANAGER::GetHotKey()
int GetHotKey( const TOOL_ACTION& aAction );
///> @copydoc ACTION_MANAGER::UpdateHotKeys()
void UpdateHotKeys();

View File

@ -55,13 +55,6 @@ class WIDGET_HOTKEY_LIST : public TWO_COLUMN_TREE_LIST
*/
WIDGET_HOTKEY_CLIENT_DATA* GetHKClientData( wxTreeListItem aItem );
/**
* Method GetSelHKClientData
* Return the WIDGET_HOTKEY_CLIENT_DATA for the item being edited, or NULL if
* none is selected.
*/
WIDGET_HOTKEY_CLIENT_DATA* GetSelHKClientData();
/**
* Get the WIDGET_HOTKEY_CLIENT_DATA form an item and assert if it isn't
* found. This is for use when the data not being present indicates an
@ -93,7 +86,7 @@ class WIDGET_HOTKEY_LIST : public TWO_COLUMN_TREE_LIST
* @param aHotkey the change-able hotkey to try to change
* @param aKey the key code to change it to
*/
void changeHotkey( CHANGED_HOTKEY& aHotkey, long aKey );
void changeHotkey( HOTKEY& aHotkey, long aKey );
protected:
@ -150,11 +143,11 @@ protected:
* section and g_CommonSectionTag section.
*
* @param aKey - key to check
* @param aSectionTag - section tag into which the key is proposed to be installed
* @param aActionName - name of the action into which the key is proposed to be installed
*
* @return true iff the user accepted the overwrite or no conflict existed
*/
bool ResolveKeyConflicts( long aKey, const wxString& aSectionTag );
bool ResolveKeyConflicts( TOOL_ACTION* aAction, long aKey );
public:
/**

View File

@ -142,8 +142,5 @@ void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, const w
btn->SetToolTip( aToolTip );
m_buttonSizer->Add( btn,
0,
wxALL | wxEXPAND,
BUTTON_SEPARATION );
m_buttonSizer->Add( btn, 0, wxALL | wxEXPAND, BUTTON_SEPARATION );
}

View File

@ -124,11 +124,6 @@ bool PGM_KICAD::OnPgmInit()
m_bm.m_search.Insert( it->second.GetValue(), 0 );
}
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
extern struct EDA_HOTKEY_CONFIG kicad_Manager_Hotkeys_Descr[];
ReadHotkeyConfig( KICAD_MANAGER_FRAME_NAME, kicad_Manager_Hotkeys_Descr );
KICAD_MANAGER_FRAME* frame = new KICAD_MANAGER_FRAME( NULL, wxT( "KiCad" ),
wxDefaultPosition, wxSize( 775, -1 ) );
App().SetTopWindow( frame );

View File

@ -23,8 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <eda_draw_frame.h>
#include <panel_hotkeys_editor.h>
#include <gestfich.h>
#include <kiway.h>
#include <kiway_player.h>
@ -32,12 +30,13 @@
#include <bitmaps.h>
#include <executable_names.h>
#include <build_version.h>
#include <dialog_configure_paths.h>
#include <dialog_edit_library_tables.h>
#include "pgm_kicad.h"
#include "tree_project_frame.h"
#include "kicad_id.h"
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tool/common_control.h>
#include <tools/kicad_manager_actions.h>
#include <tools/kicad_manager_control.h>
#ifdef __WXMAC__
@ -58,7 +57,6 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
m_active_project = false;
m_mainToolBar = nullptr;
m_leftWinWidth = 60;
m_manager_Hotkeys_Descr = NULL;
m_AboutTitle = "KiCad";
// Create the status line (bottom of the frame)
@ -90,8 +88,10 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& titl
// Create the manager
m_toolManager = new TOOL_MANAGER;
m_toolManager->SetEnvironment( nullptr, nullptr, nullptr, this );
m_actions = new KICAD_MANAGER_ACTIONS();
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new KICAD_MANAGER_CONTROL );
m_toolManager->InitTools();
@ -162,7 +162,6 @@ const wxString KICAD_MANAGER_FRAME::SchFileName()
wxFileName fn( GetProjectFileName() );
fn.SetExt( SchematicFileExtension );
return fn.GetFullPath();
}
@ -172,7 +171,6 @@ const wxString KICAD_MANAGER_FRAME::PcbFileName()
wxFileName fn( GetProjectFileName() );
fn.SetExt( PcbFileExtension );
return fn.GetFullPath();
}
@ -182,7 +180,6 @@ const wxString KICAD_MANAGER_FRAME::PcbLegacyFileName()
wxFileName fn( GetProjectFileName() );
fn.SetExt( LegacyPcbFileExtension );
return fn.GetFullPath();
}
@ -257,8 +254,9 @@ void KICAD_MANAGER_FRAME::OnExit( wxCommandEvent& event )
void KICAD_MANAGER_FRAME::TERMINATE_HANDLER::OnTerminate( int pid, int status )
{
wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ),
GetChars( m_appName ), pid );
wxString msg = wxString::Format( _( "%s closed [pid=%d]\n" ),
m_appName,
pid );
wxWindow* window = wxWindow::FindWindowByName( KICAD_MANAGER_FRAME_NAME );
@ -276,8 +274,7 @@ void KICAD_MANAGER_FRAME::TERMINATE_HANDLER::OnTerminate( int pid, int status )
}
void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile,
wxString params )
void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile, wxString params )
{
if( params.size() )
AddDelimiterString( params );
@ -289,8 +286,9 @@ void KICAD_MANAGER_FRAME::Execute( wxWindow* frame, const wxString& execFile,
if( pid > 0 )
{
wxString msg = wxString::Format( _( "%s %s opened [pid=%ld]\n" ),
GetChars( execFile ), GetChars( params ), pid );
execFile,
params,
pid );
PrintMsg( msg );
#ifdef __WXMAC__
@ -585,34 +583,3 @@ void KICAD_MANAGER_FRAME::PrintPrjInfo()
}
void KICAD_MANAGER_FRAME::OnShowHotkeys( wxCommandEvent& event )
{
DisplayHotkeyList( this, m_manager_Hotkeys_Descr );
}
void KICAD_MANAGER_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
{
KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( this, DIALOG_CONFIGUREPATHS, &Kiway() );
}
void KICAD_MANAGER_FRAME::OnEditSymLibTable( wxCommandEvent& aEvent )
{
KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_SCH );
kiface->CreateWindow( this, DIALOG_SCH_LIBRARY_TABLE, &Kiway() );
}
void KICAD_MANAGER_FRAME::OnEditFpLibTable( wxCommandEvent& aEvent )
{
KIFACE* kiface = Kiway().KiFACE( KIWAY::FACE_PCB );
kiface->CreateWindow( this, DIALOG_PCB_LIBRARY_TABLE, &Kiway() );
}
void KICAD_MANAGER_FRAME::OnPreferences( wxCommandEvent& aEvent )
{
ShowPreferences( m_manager_Hotkeys_Descr, m_manager_Hotkeys_Descr, wxT( "kicad" ) );
}

View File

@ -22,11 +22,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file kicad/kicad.h
* @brief KICAD_MANAGER_FRAME is the KiCad main frame.
*/
#ifndef KICAD_H
#define KICAD_H
@ -40,6 +35,7 @@
class LAUNCHER_PANEL;
class TREEPROJECTFILES;
class TREE_PROJECT_FRAME;
class ACTION_TOOLBAR;
// Identify the type of files handled by Kicad manager
//
@ -99,14 +95,9 @@ public:
void OnRunPcbCalculator( wxCommandEvent& event );
void OnRunPageLayoutEditor( wxCommandEvent& event );
void OnConfigurePaths( wxCommandEvent& aEvent );
void OnEditSymLibTable( wxCommandEvent& aEvent );
void OnEditFpLibTable( wxCommandEvent& aEvent );
void OnPreferences( wxCommandEvent& aEvent );
void OnOpenTextEditor( wxCommandEvent& event );
void OnOpenFileInTextEditor( wxCommandEvent& event );
void OnBrowseInFileExplorer( wxCommandEvent& event );
void OnShowHotkeys( wxCommandEvent& event );
void OnFileHistory( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
@ -224,7 +215,6 @@ private:
ACTION_TOOLBAR* m_mainToolBar;
int m_leftWinWidth;
EDA_HOTKEY_CONFIG* m_manager_Hotkeys_Descr;
void language_change( wxCommandEvent& event );

View File

@ -27,6 +27,7 @@
#include <hotkeys_basic.h>
#include <menus_helpers.h>
#include <tool/tool_manager.h>
#include <tool/action_toolbar.h>
#include <tools/kicad_manager_control.h>
#include <tools/kicad_manager_actions.h>
#include "kicad_manager_frame.h"
@ -45,10 +46,6 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_MENU( ID_TO_TEXT_EDITOR, KICAD_MANAGER_FRAME::OnOpenTextEditor )
EVT_MENU( ID_BROWSE_AN_SELECT_FILE, KICAD_MANAGER_FRAME::OnOpenFileInTextEditor )
EVT_MENU( ID_BROWSE_IN_FILE_EXPLORER, KICAD_MANAGER_FRAME::OnBrowseInFileExplorer )
EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, KICAD_MANAGER_FRAME::OnConfigurePaths )
EVT_MENU( ID_EDIT_SYMBOL_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditSymLibTable )
EVT_MENU( ID_EDIT_FOOTPRINT_LIBRARY_TABLE, KICAD_MANAGER_FRAME::OnEditFpLibTable )
EVT_MENU( wxID_PREFERENCES, KICAD_MANAGER_FRAME::OnPreferences )
EVT_MENU( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
EVT_MENU( ID_READ_ZIP_ARCHIVE, KICAD_MANAGER_FRAME::OnUnarchiveFiles )
EVT_MENU( ID_IMPORT_EAGLE_PROJECT, KICAD_MANAGER_FRAME::OnImportEagleFiles )
@ -59,10 +56,6 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, KICAD_MANAGER_FRAME::OnFileHistory )
// Show hotkeys
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, KICAD_MANAGER_FRAME::OnShowHotkeys )
// Special functions
EVT_MENU( ID_INIT_WATCHED_PATHS, KICAD_MANAGER_FRAME::OnChangeWatchedPaths )
@ -95,9 +88,7 @@ END_EVENT_TABLE()
enum hotkey_id_command
{
HK_RUN_EESCHEMA = HK_COMMON_END,
HK_NEW_PRJ_TEMPLATE,
HK_REFRESH,
HK_RUN_EESCHEMA = 0,
HK_RUN_LIBEDIT,
HK_RUN_PCBNEW,
HK_RUN_FPEDITOR,
@ -115,9 +106,6 @@ enum hotkey_id_command
// See hotkeys_basic.h for more info
// hotkeys command:
static EDA_HOTKEY HkNewProjectFromTemplate( _HKI( "New Project From Template" ),
HK_NEW_PRJ_TEMPLATE, 'T' + GR_KB_CTRL );
static EDA_HOTKEY HkRefresh( _HKI( "Refresh Project Tree" ), HK_REFRESH, GR_KB_CTRL + 'R' );
static EDA_HOTKEY HkRunEeschema( _HKI( "Run Eeschema" ), HK_RUN_EESCHEMA, 'E' + GR_KB_CTRL, 0 );
static EDA_HOTKEY HkRunLibedit( _HKI( "Run LibEdit" ), HK_RUN_LIBEDIT, 'L' + GR_KB_CTRL, 0 );
static EDA_HOTKEY HkRunPcbnew( _HKI( "Run Pcbnew" ), HK_RUN_PCBNEW, 'P' + GR_KB_CTRL, 0 );
@ -129,24 +117,9 @@ static EDA_HOTKEY HkRunPcbCalc( _HKI( "Run PcbCalculator" ),
HK_RUN_PCBCALCULATOR, 'A' + GR_KB_CTRL, 0 );
static EDA_HOTKEY HkRunPleditor( _HKI( "Run PlEditor" ), HK_RUN_PLEDITOR, 'Y' + GR_KB_CTRL, 0 );
// Common: hotkeys_basic.h
static EDA_HOTKEY HkNewProject( _HKI( "New Project" ), HK_NEW, GR_KB_CTRL + 'N' );
static EDA_HOTKEY HkOpenProject( _HKI( "Open Project" ), HK_OPEN, GR_KB_CTRL + 'O' );
static EDA_HOTKEY HkSaveProject( _HKI( "Save Project" ), HK_SAVE, GR_KB_CTRL + 'S' );
static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ),
HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES );
// List of hotkey descriptors
EDA_HOTKEY* common_Hotkey_List[] =
{
&HkNewProject, &HkNewProjectFromTemplate, &HkOpenProject,
// Currently there is nothing to save
// (Kicad manager does not save any info in .pro file)
#if 0
&HkSaveProject,
#endif
&HkRefresh, &HkHelp, &HkPreferences,
&HkRunEeschema, &HkRunLibedit,
&HkRunPcbnew, &HkRunModedit, &HkRunGerbview,
&HkRunBm2Cmp, &HkRunPcbCalc, &HkRunPleditor,
@ -160,7 +133,7 @@ static wxString sectionTitle( _HKI( "Kicad Manager Hotkeys" ) );
struct EDA_HOTKEY_CONFIG kicad_Manager_Hotkeys_Descr[] = {
{ &g_CommonSectionTag, common_Hotkey_List, &sectionTitle },
{ NULL, NULL, NULL }
{ nullptr, nullptr, nullptr }
};
///////////// End hotkeys management ///////////////////////////////////////
@ -176,8 +149,6 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
wxMenuBar* oldMenuBar = GetMenuBar();
wxMenuBar* menuBar = new wxMenuBar();
m_manager_Hotkeys_Descr = kicad_Manager_Hotkeys_Descr;
//-- File menu -----------------------------------------------------------
//
CONDITIONAL_MENU* fileMenu = new CONDITIONAL_MENU( false, controlTool );
@ -295,7 +266,7 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
prefsMenu->AddItem( ACTIONS::showSymbolLibTable, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), kicad_Manager_Hotkeys_Descr, HK_PREFERENCES ),
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
@ -312,15 +283,6 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
SetMenuBar( menuBar );
delete oldMenuBar;
// Add the hotkey to the "show hotkey list" menu, because we do not have
// a management of the keyboard keys in Kicad.
// So all hotheys should be added to the menubar
// Note Use wxMenuBar::SetLabel only after the menubar
// has been associated with a frame. (see wxWidgets doc)
msg = AddHotkeyName( menuBar->GetLabel( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST ),
kicad_Manager_Hotkeys_Descr, HK_HELP );
menuBar->SetLabel( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, msg );
}

View File

@ -30,17 +30,20 @@
#include <pgm_base.h>
TOOL_ACTION KICAD_MANAGER_ACTIONS::newProject( "kicad.Control.newProject",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_NEW ),
AS_GLOBAL,
MD_CTRL + 'N', LEGACY_HK_NAME( "New Project" ),
_( "New Project..." ), _( "Create new blank project" ),
new_project_xpm );
TOOL_ACTION KICAD_MANAGER_ACTIONS::newFromTemplate( "kicad.Control.newFromTemplate",
AS_GLOBAL, 0, // TOOL_ACTION::LegacyHotKey( HK_NEW_PRJ_TEMPLATE ),
AS_GLOBAL,
MD_CTRL + 'T', LEGACY_HK_NAME( "New Project From Template" ),
_( "New Project from Template..." ), _( "Create new project from template" ),
new_project_with_template_xpm );
TOOL_ACTION KICAD_MANAGER_ACTIONS::openProject( "kicad.Control.openProject",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_OPEN ),
AS_GLOBAL,
MD_CTRL + 'O', LEGACY_HK_NAME( "Open Project" ),
_( "Open Project..." ), _( "Open an existing project" ),
open_project_xpm );
@ -192,8 +195,8 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
// Get project destination folder and project file name.
wxString default_dir = wxFileName( Prj().GetProjectFullName() ).GetPathWithSep();
wxString title = _( "New Project Folder" );
wxFileDialog dlg( m_frame, title, default_dir, wxEmptyString,
ProjectFileWildcard(), wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
wxFileDialog dlg( m_frame, title, default_dir, wxEmptyString, ProjectFileWildcard(),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
// Add a "Create a new directory" checkbox
dlg.SetExtraControlCreator( &DIR_CHECKBOX::Create );
@ -299,7 +302,6 @@ int KICAD_MANAGER_CONTROL::NewFromTemplate( const TOOL_EVENT& aEvent )
m_frame->CreateNewProject( fn.GetFullPath() );
m_frame->LoadProject( fn );
return 0;
}
@ -323,12 +325,10 @@ int KICAD_MANAGER_CONTROL::OpenProject( const TOOL_EVENT& aEvent )
return -1;
m_frame->LoadProject( pro );
return 0;
}
int KICAD_MANAGER_CONTROL::Refresh( const TOOL_EVENT& aEvent )
{
m_frame->RefreshProjectTree();
@ -338,9 +338,9 @@ int KICAD_MANAGER_CONTROL::Refresh( const TOOL_EVENT& aEvent )
void KICAD_MANAGER_CONTROL::setTransitions()
{
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newFromTemplate.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::NewProject, KICAD_MANAGER_ACTIONS::newProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::NewFromTemplate, KICAD_MANAGER_ACTIONS::newFromTemplate.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::OpenProject, KICAD_MANAGER_ACTIONS::openProject.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::Refresh, ACTIONS::zoomRedraw.MakeEvent() );
Go( &KICAD_MANAGER_CONTROL::Refresh, ACTIONS::zoomRedraw.MakeEvent() );
}

View File

@ -24,7 +24,6 @@ set( PL_EDITOR_SRCS
pl_draw_panel_gal.cpp
pl_editor_undo_redo.cpp
properties_frame.cpp
hotkeys.cpp
menubar.cpp
toolbars_pl_editor.cpp

View File

@ -1,138 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors.
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <common.h>
#include <id.h>
#include <pl_editor_frame.h>
#include <hotkeys.h>
#include <pl_editor_id.h>
// Remark: the hotkey message info is used as keyword in hotkey config files and
// as comments in help windows, therefore translated only when displayed
// they are marked _HKI to be extracted by translation tools
// See hotkeys_basic.h for more info
/* How to add a new hotkey:
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION.
* add a new EDA_HOTKEY entry like:
* static EDA_HOTKEY HkMyNewEntry(_HKI("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* 'Command Label' is the name used in hotkey list display, and the identifier in the
* hotkey list file
* 'MY_NEW_ID_FUNCTION' is the id event function used in the switch in OnHotKey() function.
* 'Default key value' is the default hotkey for this command.
* Can be overrided by the user hotkey list
* Add the 'HkMyNewEntry' pointer in the s_PlEditor_Hotkey_List list
* Add the new code in the switch in OnHotKey() function.
*
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
* and see this list for some ascii keys (space ...)
*/
// Hotkey list:
// mouse click command:
static EDA_HOTKEY HkMouseLeftClick( _HKI( "Mouse Left Click" ), HK_LEFT_CLICK, WXK_RETURN, 0 );
static EDA_HOTKEY HkMouseLeftDClick( _HKI( "Mouse Left Double Click" ), HK_LEFT_DCLICK,
WXK_END, 0 );
static EDA_HOTKEY HkResetLocalCoord( _HKI( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' );
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static EDA_HOTKEY HkZoomCenter( _HKI( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static EDA_HOTKEY HkZoomRedraw( _HKI( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomIn( _HKI( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static EDA_HOTKEY HkZoomSelection( _HKI( "Zoom to Selection" ), HK_ZOOM_SELECTION,
GR_KB_CTRL + WXK_F5 );
static EDA_HOTKEY HkHelp( _HKI( "List Hotkeys" ), HK_HELP, GR_KB_CTRL + WXK_F1 );
static EDA_HOTKEY HkMoveItem( _HKI( "Move Item" ), HK_MOVE, 'M' );
static EDA_HOTKEY HkDeleteItem( _HKI( "Delete Item" ), HK_DELETE, WXK_DELETE );
// Common: hotkeys_basic.h
static EDA_HOTKEY HkUndo( _HKI( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
static EDA_HOTKEY HkRedo( _HKI( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
static EDA_HOTKEY HkCut( _HKI( "Cut" ), HK_CUT, GR_KB_CTRL + 'X' );
static EDA_HOTKEY HkCopy( _HKI( "Copy" ), HK_COPY, GR_KB_CTRL + 'C' );
static EDA_HOTKEY HkPaste( _HKI( "Paste" ), HK_PASTE, GR_KB_CTRL + 'V' );
static EDA_HOTKEY HkNew( _HKI( "New" ), HK_NEW, GR_KB_CTRL + 'N', (int) wxID_NEW );
static EDA_HOTKEY HkOpen( _HKI( "Open" ), HK_OPEN, GR_KB_CTRL + 'O', (int) wxID_OPEN );
static EDA_HOTKEY HkSave( _HKI( "Save" ), HK_SAVE, GR_KB_CTRL + 'S', (int) wxID_SAVE );
static EDA_HOTKEY HkSaveAs( _HKI( "Save As" ), HK_SAVEAS, GR_KB_CTRL + GR_KB_SHIFT + 'S',
(int) wxID_SAVEAS );
static EDA_HOTKEY HkPrint( _HKI( "Print" ), HK_PRINT, GR_KB_CTRL + 'P', (int) wxID_PRINT );
static EDA_HOTKEY HkPreferences( _HKI( "Preferences" ), HK_PREFERENCES, GR_KB_CTRL + ',', (int) wxID_PREFERENCES );
// List of common hotkey descriptors
EDA_HOTKEY* s_Common_Hotkey_List[] =
{
&HkNew, &HkOpen, &HkSave, &HkSaveAs, &HkPrint,
&HkUndo, &HkRedo,
&HkCut, &HkCopy, &HkPaste, &HkDeleteItem,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkZoomSelection, &HkResetLocalCoord,
&HkHelp, &HkPreferences,
&HkMouseLeftClick, &HkMouseLeftDClick,
NULL
};
EDA_HOTKEY* s_PlEditor_Hotkey_List[] =
{
&HkMoveItem,
&HkDeleteItem,
NULL
};
// Titles for hotkey editor and hotkey display
static wxString commonSectionTitle( _HKI( "Common" ) );
// list of sections and corresponding hotkey list for Pl_Editor
// (used to create an hotkey config file)
static wxString s_PlEditorSectionTag( wxT( "[pl_editor]" ) );
static wxString s_PlEditorSectionTitle( _HKI( "Page Layout Editor" ) );
struct EDA_HOTKEY_CONFIG PlEditorHotkeysDescr[] =
{
{ &g_CommonSectionTag, s_Common_Hotkey_List, &commonSectionTitle },
{ &s_PlEditorSectionTag, s_PlEditor_Hotkey_List, &s_PlEditorSectionTitle },
{ NULL, NULL, NULL }
};
EDA_HOTKEY* PL_EDITOR_FRAME::GetHotKeyDescription( int aCommand ) const
{
EDA_HOTKEY* HK_Descr = GetDescriptorFromCommand( aCommand, s_Common_Hotkey_List );
if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromCommand( aCommand, s_PlEditor_Hotkey_List );
return HK_Descr;
}

View File

@ -1,46 +0,0 @@
/**
* @file pagelayout_editor/hotkeys.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2016-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 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 PL_EDITOR_KOTKEYS_H_
#define PL_EDITOR_KOTKEYS_H_
#include <hotkeys_basic.h>
// List of hot keys id.
// see also enum common_hotkey_id_command in hotkeys_basic.h
// for shared hotkeys id
enum hotkey_id_command {
HK_PL_EDITOR_START = HK_COMMON_END,
HK_MOVE,
HK_PL_EDITOR_END
};
// List of hotkey descriptors for PlEditor.
extern struct EDA_HOTKEY_CONFIG PlEditorHotkeysDescr[];
#endif // PL_EDITOR_KOTKEYS_H_

View File

@ -31,7 +31,6 @@
#include <tool/selection.h>
#include <tools/pl_actions.h>
#include <tools/pl_selection_tool.h>
#include "hotkeys.h"
#include "pl_editor_frame.h"
#include "pl_editor_id.h"
@ -157,7 +156,7 @@ void PL_EDITOR_FRAME::ReCreateMenuBar()
CONDITIONAL_MENU* preferencesMenu = new CONDITIONAL_MENU( false, selTool );
preferencesMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), PlEditorHotkeysDescr, HK_PREFERENCES ),
_( "Preferences...\tCTRL+," ),
_( "Show preferences for all open tools" ),
preference_xpm, SELECTION_CONDITIONS::ShowAlways );

View File

@ -33,10 +33,7 @@
#include <gestfich.h>
#include <ws_draw_item.h>
#include <pl_editor_frame.h>
#include <hotkeys.h>
#include <build_version.h>
#include <wx/file.h>
#include <wx/snglinst.h>
@ -119,11 +116,6 @@ PGM_BASE& Pgm()
bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
{
start_common( aCtlBits );
// Must be called before creating the main frame in order to
// display the real hotkeys in menus or tool tips
ReadHotkeyConfig( PL_EDITOR_FRAME_NAME, PlEditorHotkeysDescr );
return true;
}

View File

@ -33,15 +33,16 @@
#include <pl_editor_frame.h>
#include <pl_editor_id.h>
#include <pl_draw_panel_gal.h>
#include <hotkeys.h>
#include <pl_editor_screen.h>
#include <ws_data_model.h>
#include <properties_frame.h>
#include <view/view.h>
#include <confirm.h>
#include <tool/selection.h>
#include <tool/action_toolbar.h>
#include <tool/tool_dispatcher.h>
#include <tool/tool_manager.h>
#include <tool/common_control.h>
#include <tool/common_tools.h>
#include <tool/zoom_tool.h>
#include <tools/pl_actions.h>
@ -59,14 +60,10 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PL_EDITOR_FRAME::OnFileHistory )
// menu Preferences
EVT_MENU( ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_MENU( wxID_PREFERENCES, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_TOOL( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
EVT_TOOL( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode )
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner)
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::Process_Special_Functions)
EVT_CHOICE( ID_SELECT_COORDINATE_ORIGIN, PL_EDITOR_FRAME::OnSelectCoordOriginCorner )
EVT_CHOICE( ID_SELECT_PAGE_NUMBER, PL_EDITOR_FRAME::OnSelectPage )
EVT_UPDATE_UI( ID_SHOW_REAL_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode )
EVT_UPDATE_UI( ID_SHOW_PL_EDITOR_MODE, PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayEditMode )
@ -87,7 +84,6 @@ PL_EDITOR_FRAME::PL_EDITOR_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_showAxis = false; // true to show X and Y axis on screen
m_showGridAxis = true;
m_showBorderAndTitleBlock = true; // true for reference drawings.
m_hotkeysDescrList = PlEditorHotkeysDescr;
m_originSelectChoice = 0;
SetDrawBgColor( WHITE ); // default value, user option (WHITE/BLACK)
WS_DATA_MODEL::GetTheInstance().m_EditMode = true;
@ -206,6 +202,7 @@ void PL_EDITOR_FRAME::setupTools()
GetGalCanvas()->SetEventDispatcher( m_toolDispatcher );
// Register tools
m_toolManager->RegisterTool( new COMMON_CONTROL );
m_toolManager->RegisterTool( new COMMON_TOOLS );
m_toolManager->RegisterTool( new ZOOM_TOOL );
m_toolManager->RegisterTool( new PL_SELECTION_TOOL );
@ -266,34 +263,12 @@ void PL_EDITOR_FRAME::OnCloseWindow( wxCloseEvent& Event )
/* Handles the selection of tools, menu, and popup menu commands.
*/
void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
void PL_EDITOR_FRAME::OnSelectPage( wxCommandEvent& event )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
cmd.SetEventObject( this );
switch( event.GetId() )
{
case wxID_PREFERENCES:
ShowPreferences( PlEditorHotkeysDescr, PlEditorHotkeysDescr, wxT( "pl_editor" ) );
break;
case ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST:
DisplayHotkeyList( this, PlEditorHotkeysDescr );
break;
case ID_SELECT_PAGE_NUMBER:
{
KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetLayerVisible( LAYER_WORKSHEET_PAGE1, m_pageSelectBox->GetSelection() == 0 );
view->SetLayerVisible( LAYER_WORKSHEET_PAGEn, m_pageSelectBox->GetSelection() == 1 );
GetGalCanvas()->Refresh();
}
break;
default:
wxMessageBox( wxT( "PL_EDITOR_FRAME::Process_Special_Functions error" ) );
break;
}
KIGFX::VIEW* view = GetGalCanvas()->GetView();
view->SetLayerVisible( LAYER_WORKSHEET_PAGE1, m_pageSelectBox->GetSelection() == 0 );
view->SetLayerVisible( LAYER_WORKSHEET_PAGEn, m_pageSelectBox->GetSelection() == 1 );
GetGalCanvas()->Refresh();
}
@ -627,7 +602,7 @@ void PL_EDITOR_FRAME::HardRedraw()
drawPanel->DisplayWorksheet();
PL_SELECTION_TOOL* selTool = m_toolManager->GetTool<PL_SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
PL_SELECTION& selection = selTool->GetSelection();
WS_DATA_ITEM* item = nullptr;
if( selection.GetSize() == 1 )

View File

@ -199,7 +199,7 @@ public:
void SaveSettings( wxConfigBase* aCfg ) override;
void Process_Special_Functions( wxCommandEvent& event );
void OnSelectPage( wxCommandEvent& event );
/**
* called when the user select one of the 4 page corner as corner reference (or the
@ -219,9 +219,6 @@ public:
void OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& event );
void OnUpdateTitleBlockDisplayEditMode( wxUpdateUIEvent& event );
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
/**
* Function ToPrinter
* Open a dialog frame to print layers

View File

@ -287,7 +287,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WS_DATA_ITEM* aItem )
void PROPERTIES_FRAME::OnAcceptPrms( wxCommandEvent& event )
{
PL_SELECTION_TOOL* selTool = m_parent->GetToolManager()->GetTool<PL_SELECTION_TOOL>();
SELECTION& selection = selTool->GetSelection();
PL_SELECTION& selection = selTool->GetSelection();
m_parent->SaveCopyInUndoList();

View File

@ -20,14 +20,13 @@
*/
#include <fctsys.h>
#include <common.h>
#include <macros.h>
#include <bitmaps.h>
#include <tool/action_toolbar.h>
#include <tools/pl_actions.h>
#include <pl_editor_id.h>
#include <pl_editor_frame.h>
#include <hotkeys.h>
void PL_EDITOR_FRAME::ReCreateHToolbar()
{

Some files were not shown because too many files have changed in this diff Show More