2011-10-18 19:59:19 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-04-16 15:26:51 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, j-p.charras at wanadoo.fr
|
2011-10-18 19:59:19 +00:00
|
|
|
* Copyright (C) 2010-2011 Wayne Stambaugh <stambaughw@verizon.net>
|
2016-06-12 01:22:13 +00:00
|
|
|
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
2011-10-18 19:59:19 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
/**
|
|
|
|
* @file hotkeys_basic.cpp
|
2011-09-30 18:15:37 +00:00
|
|
|
* @brief Some functions to handle hotkeys in KiCad
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <fctsys.h>
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
#include <kiface_i.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <hotkeys_basic.h>
|
|
|
|
#include <id.h>
|
|
|
|
#include <confirm.h>
|
|
|
|
#include <kicad_string.h>
|
|
|
|
#include <gestfich.h>
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <eda_base_frame.h>
|
2012-01-23 04:33:36 +00:00
|
|
|
#include <macros.h>
|
|
|
|
#include <dialog_hotkeys_editor.h>
|
2012-04-09 09:16:47 +00:00
|
|
|
#include <menus_helpers.h>
|
2015-05-05 18:39:42 +00:00
|
|
|
#include <tool/tool_manager.h>
|
2007-09-19 15:29:50 +00:00
|
|
|
|
2009-04-06 18:54:57 +00:00
|
|
|
#include <wx/apptrait.h>
|
|
|
|
#include <wx/stdpaths.h>
|
2010-08-28 18:02:24 +00:00
|
|
|
#include <wx/tokenzr.h>
|
2009-04-06 18:54:57 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
#define HOTKEYS_CONFIG_KEY wxT( "Keys" )
|
2007-08-20 11:33:45 +00:00
|
|
|
|
2009-04-05 20:49:15 +00:00
|
|
|
wxString g_CommonSectionTag( wxT( "[common]" ) );
|
2014-10-16 01:17:46 +00:00
|
|
|
|
2009-11-23 15:16:50 +00:00
|
|
|
|
2015-08-01 21:46:27 +00:00
|
|
|
/* Class to handle hotkey commands hotkeys have a default value
|
2009-11-23 15:16:50 +00:00
|
|
|
* This class allows the real key code changed by user from a key code list
|
|
|
|
* file.
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2007-08-20 11:33:45 +00:00
|
|
|
|
2016-03-29 16:35:24 +00:00
|
|
|
EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent ) :
|
2016-03-29 17:51:53 +00:00
|
|
|
m_defaultKeyCode( keycode ), m_KeyCode( keycode ), m_InfoMsg( infomsg ),
|
|
|
|
m_Idcommand( idcommand ), m_IdMenuEvent( idmenuevent )
|
2007-08-20 11:33:45 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2016-03-29 17:51:53 +00:00
|
|
|
EDA_HOTKEY::EDA_HOTKEY( const EDA_HOTKEY* base )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
2016-03-29 17:51:53 +00:00
|
|
|
m_defaultKeyCode = base->m_defaultKeyCode; // initialize default key code
|
2010-08-28 18:02:24 +00:00
|
|
|
m_KeyCode = base->m_KeyCode;
|
|
|
|
m_InfoMsg = base->m_InfoMsg;
|
|
|
|
m_Idcommand = base->m_Idcommand;
|
|
|
|
m_IdMenuEvent = base->m_IdMenuEvent;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-10-26 20:46:04 +00:00
|
|
|
EDA_HOTKEY_CLIENT_DATA::~EDA_HOTKEY_CLIENT_DATA()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-21 19:37:31 +00:00
|
|
|
/* class to handle the printable name and the keycode
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
|
|
|
struct hotkey_name_descr
|
|
|
|
{
|
2007-10-31 08:34:05 +00:00
|
|
|
const wxChar* m_Name;
|
2010-01-20 18:59:46 +00:00
|
|
|
int m_KeyCode;
|
2007-08-21 19:37:31 +00:00
|
|
|
};
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
/* table giving the hotkey name from the hotkey code, for special keys
|
|
|
|
* Note : when modifiers (ATL, SHIFT, CTRL) do not modify
|
|
|
|
* the code of the key, do need to enter the modified key code
|
|
|
|
* For instance wxT( "F1" ), WXK_F1 handle F1, AltF1, CtrlF1 ...
|
2010-08-29 16:36:52 +00:00
|
|
|
* Key names are:
|
|
|
|
* "Space","Ctrl+Space","Alt+Space" or
|
|
|
|
* "Alt+A","Ctrl+F1", ...
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2015-07-02 07:28:54 +00:00
|
|
|
static struct hotkey_name_descr hotkeyNameList[] =
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
{ wxT( "F1" ), WXK_F1 },
|
|
|
|
{ wxT( "F2" ), WXK_F2 },
|
|
|
|
{ wxT( "F3" ), WXK_F3 },
|
|
|
|
{ wxT( "F4" ), WXK_F4 },
|
|
|
|
{ wxT( "F5" ), WXK_F5 },
|
|
|
|
{ wxT( "F6" ), WXK_F6 },
|
|
|
|
{ wxT( "F7" ), WXK_F7 },
|
|
|
|
{ wxT( "F8" ), WXK_F8 },
|
|
|
|
{ wxT( "F9" ), WXK_F9 },
|
|
|
|
{ wxT( "F10" ), WXK_F10 },
|
|
|
|
{ wxT( "F11" ), WXK_F11 },
|
|
|
|
{ wxT( "F12" ), WXK_F12 },
|
|
|
|
|
|
|
|
{ wxT( "Esc" ), WXK_ESCAPE },
|
|
|
|
{ wxT( "Del" ), WXK_DELETE },
|
2010-08-29 16:36:52 +00:00
|
|
|
{ wxT( "Tab" ), WXK_TAB },
|
2010-08-28 18:02:24 +00:00
|
|
|
{ wxT( "BkSp" ), WXK_BACK },
|
|
|
|
{ wxT( "Ins" ), WXK_INSERT },
|
|
|
|
|
|
|
|
{ wxT( "Home" ), WXK_HOME },
|
|
|
|
{ wxT( "End" ), WXK_END },
|
|
|
|
{ wxT( "PgUp" ), WXK_PAGEUP },
|
|
|
|
{ wxT( "PgDn" ), WXK_PAGEDOWN },
|
|
|
|
|
|
|
|
{ wxT( "Up" ), WXK_UP },
|
|
|
|
{ wxT( "Down" ), WXK_DOWN },
|
|
|
|
{ wxT( "Left" ), WXK_LEFT },
|
|
|
|
{ wxT( "Right" ), WXK_RIGHT },
|
2010-01-20 18:59:46 +00:00
|
|
|
|
2015-07-02 07:28:54 +00:00
|
|
|
{ wxT( "Return" ), WXK_RETURN },
|
2014-04-03 07:40:55 +00:00
|
|
|
|
2010-08-29 16:36:52 +00:00
|
|
|
{ wxT( "Space" ), WXK_SPACE },
|
|
|
|
|
2010-01-20 18:59:46 +00:00
|
|
|
// Do not change this line: end of list
|
2010-08-28 18:02:24 +00:00
|
|
|
{ wxT( "" ), 0 }
|
2007-08-21 19:37:31 +00:00
|
|
|
};
|
|
|
|
|
2015-07-02 07:28:54 +00:00
|
|
|
// name of modifier keys.
|
|
|
|
// Note: the Ctrl key is Cmd key on Mac OS X.
|
|
|
|
// However, in wxWidgets defs, the key WXK_CONTROL is the Cmd key,
|
|
|
|
// so the code using WXK_CONTROL should be ok on any system.
|
|
|
|
// (on Mac OS X the actual Ctrl key code is WXK_RAW_CONTROL)
|
|
|
|
#ifdef __WXMAC__
|
2015-07-04 08:36:58 +00:00
|
|
|
#define USING_MAC_CMD
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef USING_MAC_CMD
|
2015-07-02 07:28:54 +00:00
|
|
|
#define MODIFIER_CTRL wxT( "Cmd+" )
|
|
|
|
#else
|
|
|
|
#define MODIFIER_CTRL wxT( "Ctrl+" )
|
|
|
|
#endif
|
|
|
|
#define MODIFIER_CMD_MAC wxT( "Cmd+" )
|
|
|
|
#define MODIFIER_CTRL_BASE wxT( "Ctrl+" )
|
|
|
|
#define MODIFIER_ALT wxT( "Alt+" )
|
|
|
|
#define MODIFIER_SHIFT wxT( "Shift+" )
|
2010-08-28 19:08:58 +00:00
|
|
|
|
2007-08-21 19:37:31 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Function KeyNameFromKeyCode
|
2007-08-30 08:15:05 +00:00
|
|
|
* return the key name from the key code
|
2009-11-23 15:16:50 +00:00
|
|
|
* Only some wxWidgets key values are handled for function key ( see
|
2015-07-02 07:28:54 +00:00
|
|
|
* hotkeyNameList[] )
|
2010-02-16 10:42:57 +00:00
|
|
|
* @param aKeycode = key code (ascii value, or wxWidgets value for function keys)
|
2018-01-06 04:22:00 +00:00
|
|
|
* @param aIsFound = a pointer to a bool to return true if found, or false. an be nullptr default)
|
2007-08-30 08:15:05 +00:00
|
|
|
* @return the key name in a wxString
|
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
wxString KeyNameFromKeyCode( int aKeycode, bool* aIsFound )
|
2007-08-20 11:33:45 +00:00
|
|
|
{
|
2007-08-30 08:15:05 +00:00
|
|
|
wxString keyname, modifier, fullkeyname;
|
|
|
|
int ii;
|
2010-08-28 18:02:24 +00:00
|
|
|
bool found = false;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2014-10-16 01:17:51 +00:00
|
|
|
// Assume keycode of 0 is "unassigned"
|
|
|
|
if( aKeycode == 0 )
|
|
|
|
return wxT( "<unassigned>");
|
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
if( (aKeycode & GR_KB_CTRL) != 0 )
|
2010-08-28 19:08:58 +00:00
|
|
|
modifier << MODIFIER_CTRL;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
if( (aKeycode & GR_KB_ALT) != 0 )
|
2010-08-28 19:08:58 +00:00
|
|
|
modifier << MODIFIER_ALT;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
if( (aKeycode & GR_KB_SHIFT) != 0 )
|
2010-08-28 19:08:58 +00:00
|
|
|
modifier << MODIFIER_SHIFT;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
aKeycode &= ~( GR_KB_CTRL | GR_KB_ALT | GR_KB_SHIFT );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-08-29 16:36:52 +00:00
|
|
|
if( (aKeycode > ' ') && (aKeycode < 0x7F ) )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
found = true;
|
2011-09-01 12:54:34 +00:00
|
|
|
keyname.Append( (wxChar)aKeycode );
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for( ii = 0; ; ii++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2015-07-02 07:28:54 +00:00
|
|
|
if( hotkeyNameList[ii].m_KeyCode == 0 ) // End of list
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
keyname = wxT( "<unknown>" );
|
|
|
|
break;
|
|
|
|
}
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2015-07-02 07:28:54 +00:00
|
|
|
if( hotkeyNameList[ii].m_KeyCode == aKeycode )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
2015-07-02 07:28:54 +00:00
|
|
|
keyname = hotkeyNameList[ii].m_Name;
|
2010-08-28 18:02:24 +00:00
|
|
|
found = true;
|
|
|
|
break;
|
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( aIsFound )
|
|
|
|
*aIsFound = found;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
fullkeyname = modifier + keyname;
|
|
|
|
return fullkeyname;
|
2007-08-21 19:37:31 +00:00
|
|
|
}
|
2007-08-20 11:33:45 +00:00
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2011-09-23 20:00:30 +00:00
|
|
|
/*
|
|
|
|
* helper function use in AddHotkeyName to calculate an accelerator string
|
2011-09-29 16:49:40 +00:00
|
|
|
* In some menus, accelerators do not perform exactly the same action as
|
|
|
|
* the hotkey that perform a similar action.
|
2011-09-23 20:00:30 +00:00
|
|
|
* 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>
|
2011-09-24 17:15:29 +00:00
|
|
|
* But for many keys, the Shift modifier is not usable, and the accelerator is Alt+<hotkey>
|
2011-09-23 20:00:30 +00:00
|
|
|
*/
|
|
|
|
static void AddModifierToKey( wxString& aFullKey, const wxString & aKey )
|
|
|
|
{
|
2011-09-24 17:15:29 +00:00
|
|
|
if( (aKey.Length() == 1) && (aKey[0] >= 'A') && (aKey[0] <= 'Z'))
|
2013-09-21 17:09:08 +00:00
|
|
|
// We can use Shift+<key> as accelerator and <key> for hot key
|
2011-09-23 20:00:30 +00:00
|
|
|
aFullKey << wxT( "\t" ) << MODIFIER_SHIFT << aKey;
|
2011-09-24 17:15:29 +00:00
|
|
|
else
|
2013-11-04 17:18:19 +00:00
|
|
|
// We must use Alt+<key> as accelerator and <key> for hot key
|
2011-09-24 17:15:29 +00:00
|
|
|
aFullKey << wxT( "\t" ) << MODIFIER_ALT << aKey;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* AddHotkeyName
|
2007-08-30 08:15:05 +00:00
|
|
|
* Add the key name from the Command id value ( m_Idcommand member value)
|
2010-12-20 17:44:25 +00:00
|
|
|
* aText = a wxString. returns aText + key name
|
2011-09-29 16:49:40 +00:00
|
|
|
* aList = pointer to a EDA_HOTKEY list of commands
|
2010-12-20 17:44:25 +00:00
|
|
|
* aCommandId = Command Id value
|
2011-09-23 20:00:30 +00:00
|
|
|
* 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)
|
2011-09-29 16:49:40 +00:00
|
|
|
* IS_COMMENT to add <spaces><(keyname)> mainly in tool tips
|
2010-12-20 17:44:25 +00:00
|
|
|
* Return a wxString (aTest + key name) if key found or aText without modification
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList,
|
2011-09-23 20:00:30 +00:00
|
|
|
int aCommandId, HOTKEY_ACTION_TYPE aShortCutType )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString msg = aText;
|
2010-02-14 18:14:33 +00:00
|
|
|
wxString keyname;
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
if( aList )
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
keyname = KeyNameFromCommandId( aList, aCommandId );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
|
|
|
if( !keyname.IsEmpty() )
|
2011-04-05 14:46:51 +00:00
|
|
|
{
|
2011-09-23 20:00:30 +00:00
|
|
|
switch( aShortCutType )
|
|
|
|
{
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_HOTKEY:
|
|
|
|
msg << wxT( "\t" ) << keyname;
|
|
|
|
break;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_ACCELERATOR:
|
|
|
|
AddModifierToKey( msg, keyname );
|
|
|
|
break;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_COMMENT:
|
|
|
|
msg << wxT( " (" ) << keyname << wxT( ")" );
|
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
2011-04-05 14:46:51 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2015-07-04 08:36:58 +00:00
|
|
|
#ifdef USING_MAC_CMD
|
2015-08-01 21:46:27 +00:00
|
|
|
// On OSX, the modifier equivalent to the Ctrl key of PCs
|
2015-07-04 08:36:58 +00:00
|
|
|
// is the Cmd key, but in code we should use Ctrl as prefix in menus
|
|
|
|
msg.Replace( MODIFIER_CMD_MAC, MODIFIER_CTRL_BASE );
|
|
|
|
#endif
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* AddHotkeyName
|
2007-09-06 11:52:26 +00:00
|
|
|
* Add the key name from the Command id value ( m_Idcommand member value)
|
2010-12-20 17:44:25 +00:00
|
|
|
* aText = a wxString. returns aText + key name
|
2011-09-29 16:49:40 +00:00
|
|
|
* aList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
|
2010-12-20 17:44:25 +00:00
|
|
|
* aCommandId = Command Id value
|
2011-09-23 20:00:30 +00:00
|
|
|
* aShortCutType = IS_HOTKEY to add <tab><keyname> (active shortcuts in menus)
|
|
|
|
* IS_ACCELERATOR to add <tab><Shift+keyname> (active accelerators in menus)
|
|
|
|
* IS_COMMENT to add <spaces><(keyname)>
|
2010-12-20 17:44:25 +00:00
|
|
|
* Return a wxString (aText + key name) if key found or aText without modification
|
2007-09-06 11:52:26 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
wxString AddHotkeyName( const wxString& aText,
|
|
|
|
struct EDA_HOTKEY_CONFIG* aDescList,
|
|
|
|
int aCommandId,
|
|
|
|
HOTKEY_ACTION_TYPE aShortCutType )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
2011-09-29 16:49:40 +00:00
|
|
|
wxString msg = aText;
|
|
|
|
wxString keyname;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_HOTKEY** list;
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
if( aDescList )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
list = aDescList->m_HK_InfoList;
|
|
|
|
keyname = KeyNameFromCommandId( list, aCommandId );
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
if( !keyname.IsEmpty() )
|
|
|
|
{
|
2011-09-23 20:00:30 +00:00
|
|
|
switch( aShortCutType )
|
|
|
|
{
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_HOTKEY:
|
|
|
|
msg << wxT( "\t" ) << keyname;
|
|
|
|
break;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_ACCELERATOR:
|
|
|
|
AddModifierToKey( msg, keyname );
|
|
|
|
break;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
case IS_COMMENT:
|
|
|
|
msg << wxT( " (" ) << keyname << wxT( ")" );
|
|
|
|
break;
|
2011-09-23 20:00:30 +00:00
|
|
|
}
|
2014-10-17 14:36:47 +00:00
|
|
|
|
2010-02-14 18:14:33 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-09-06 11:52:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-07-04 08:36:58 +00:00
|
|
|
#ifdef USING_MAC_CMD
|
2015-08-01 21:46:27 +00:00
|
|
|
// On OSX, the modifier equivalent to the Ctrl key of PCs
|
2015-07-04 08:36:58 +00:00
|
|
|
// is the Cmd key, but in code we should use Ctrl as prefix in menus
|
|
|
|
msg.Replace( MODIFIER_CMD_MAC, MODIFIER_CTRL_BASE );
|
|
|
|
#endif
|
|
|
|
|
2007-09-06 11:52:26 +00:00
|
|
|
return msg;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Function KeyNameFromCommandId
|
2007-08-30 08:15:05 +00:00
|
|
|
* return the key name from the Command id value ( m_Idcommand member value)
|
2011-09-29 16:49:40 +00:00
|
|
|
* @param aList = pointer to a EDA_HOTKEY list of commands
|
2010-02-16 10:42:57 +00:00
|
|
|
* @param aCommandId = Command Id value
|
2007-08-30 08:15:05 +00:00
|
|
|
* @return the key name in a wxString
|
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
wxString KeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
|
|
|
wxString keyname;
|
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; *aList != nullptr; aList++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2011-09-29 16:49:40 +00:00
|
|
|
EDA_HOTKEY* hk_decr = *aList;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-02-16 10:42:57 +00:00
|
|
|
if( hk_decr->m_Idcommand == aCommandId )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return keyname;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
* Function KeyCodeFromKeyName
|
2007-08-30 08:15:05 +00:00
|
|
|
* return the key code from its key name
|
|
|
|
* Only some wxWidgets key values are handled for function key
|
2015-07-02 07:28:54 +00:00
|
|
|
* @param keyname = wxString key name to find in hotkeyNameList[],
|
2010-01-20 18:59:46 +00:00
|
|
|
* like F2 or space or an usual (ascii) char.
|
2007-08-30 08:15:05 +00:00
|
|
|
* @return the key code
|
|
|
|
*/
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
int KeyCodeFromKeyName( const wxString& keyname )
|
2007-08-21 19:37:31 +00:00
|
|
|
{
|
2007-08-30 08:15:05 +00:00
|
|
|
int ii, keycode = 0;
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
// Search for modifiers: Ctrl+ Alt+ and Shift+
|
2015-07-02 07:28:54 +00:00
|
|
|
// Note: on Mac OSX, the Cmd key is equiv here to Ctrl
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString key = keyname;
|
2015-07-02 07:28:54 +00:00
|
|
|
wxString prefix;
|
2010-08-28 18:02:24 +00:00
|
|
|
int modifier = 0;
|
2015-07-02 07:28:54 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
while( 1 )
|
|
|
|
{
|
2015-07-02 07:28:54 +00:00
|
|
|
prefix.Empty();
|
|
|
|
|
|
|
|
if( key.StartsWith( MODIFIER_CTRL_BASE ) )
|
|
|
|
{
|
|
|
|
modifier |= GR_KB_CTRL;
|
|
|
|
prefix = MODIFIER_CTRL_BASE;
|
|
|
|
}
|
|
|
|
else if( key.StartsWith( MODIFIER_CMD_MAC ) )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
modifier |= GR_KB_CTRL;
|
2015-07-02 07:28:54 +00:00
|
|
|
prefix = MODIFIER_CMD_MAC;
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
2010-08-28 19:08:58 +00:00
|
|
|
else if( key.StartsWith( MODIFIER_ALT ) )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
modifier |= GR_KB_ALT;
|
2015-07-02 07:28:54 +00:00
|
|
|
prefix = MODIFIER_ALT;
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
2010-08-28 19:08:58 +00:00
|
|
|
else if( key.StartsWith( MODIFIER_SHIFT ) )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
modifier |= GR_KB_SHIFT;
|
2015-07-02 07:28:54 +00:00
|
|
|
prefix = MODIFIER_SHIFT;
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
|
|
|
else
|
2011-09-01 12:54:34 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
break;
|
2011-09-01 12:54:34 +00:00
|
|
|
}
|
2015-07-02 07:28:54 +00:00
|
|
|
|
|
|
|
if( !prefix.IsEmpty() )
|
|
|
|
key.Remove( 0, prefix.Len() );
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
|
|
|
|
2010-08-29 16:36:52 +00:00
|
|
|
if( (key.length() == 1) && (key[0] > ' ') && (key[0] < 0x7F) )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
keycode = key[0];
|
|
|
|
keycode += modifier;
|
2010-08-29 16:36:52 +00:00
|
|
|
return keycode;
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
|
|
|
|
2018-01-08 11:52:17 +00:00
|
|
|
for( ii = 0; hotkeyNameList[ii].m_KeyCode != 0; ii++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2015-07-02 07:28:54 +00:00
|
|
|
if( key.CmpNoCase( hotkeyNameList[ii].m_Name ) == 0 )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2015-07-02 07:28:54 +00:00
|
|
|
keycode = hotkeyNameList[ii].m_KeyCode + modifier;
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return keycode;
|
2007-08-20 11:33:45 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* DisplayHotkeyList
|
2007-08-30 08:15:05 +00:00
|
|
|
* Displays the current hotkey list
|
2011-09-29 16:49:40 +00:00
|
|
|
* aList = a EDA_HOTKEY_CONFIG list(Null terminated)
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2015-03-15 11:41:06 +00:00
|
|
|
#include <html_messagebox.h>
|
|
|
|
|
2015-03-02 17:29:18 +00:00
|
|
|
void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
|
2007-08-20 11:33:45 +00:00
|
|
|
{
|
2011-09-29 16:49:40 +00:00
|
|
|
wxString keyname;
|
2015-03-22 14:04:09 +00:00
|
|
|
wxString keymessage;
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_HOTKEY** list;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
wxString msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" );
|
2011-09-09 19:30:59 +00:00
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
msg += wxT( "<H3>" );
|
|
|
|
msg += _( "Hotkeys List" );
|
|
|
|
msg += wxT( "</H3> <table cellpadding=\"0\">" );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
list = aDescList->m_HK_InfoList;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; *list != nullptr; list++ )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_HOTKEY* hk_decr = *list;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2011-09-07 09:27:02 +00:00
|
|
|
if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
|
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
2015-03-22 14:04:09 +00:00
|
|
|
keymessage = wxGetTranslation( hk_decr->m_InfoMsg );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
|
2015-03-22 14:04:09 +00:00
|
|
|
// Some chars are modified, using html encoding, to be
|
2013-09-21 17:09:08 +00:00
|
|
|
// displayed by DisplayHtmlInfoMessage()
|
2014-10-17 14:36:47 +00:00
|
|
|
keyname.Replace( wxT( "<" ), wxT( "<" ) );
|
|
|
|
keyname.Replace( wxT( ">" ), wxT( ">" ) );
|
2015-03-22 14:04:09 +00:00
|
|
|
msg += wxT( "<tr><td>" ) + keymessage + wxT( "</td>" );
|
2014-10-17 14:36:47 +00:00
|
|
|
msg += wxT( "<td><b> " ) + keyname + wxT( "</b></td></tr>" );
|
2011-09-07 09:27:02 +00:00
|
|
|
}
|
2007-09-06 11:52:26 +00:00
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
msg += wxT( "</table></html></body>" );
|
2015-03-15 11:41:06 +00:00
|
|
|
|
|
|
|
// Create a non modal dialog, which shows the list of hotkeys until dismissed
|
|
|
|
// but does not block the parent window
|
2018-01-11 08:08:55 +00:00
|
|
|
HTML_MESSAGE_BOX *dlg = new HTML_MESSAGE_BOX( aFrame, _( "Hotkeys List" ) );
|
|
|
|
dlg->SetDialogSizeInDU( 300, 250 );
|
|
|
|
|
2015-03-15 11:41:06 +00:00
|
|
|
dlg->AddHTML_Text( msg );
|
|
|
|
dlg->Show( true );
|
2007-08-20 11:33:45 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-11-12 16:36:43 +00:00
|
|
|
/**
|
|
|
|
* Function GetDescriptorFromHotkey
|
2011-09-29 16:49:40 +00:00
|
|
|
* Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
|
2010-02-16 11:02:20 +00:00
|
|
|
* @param aKey = key code (ascii value, or wxWidgets value for function keys
|
2011-09-29 16:49:40 +00:00
|
|
|
* @param aList = pointer to a EDA_HOTKEY list of commands
|
|
|
|
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
|
2007-08-30 08:15:05 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList )
|
2007-08-20 11:33:45 +00:00
|
|
|
{
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; *aList != nullptr; aList++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2011-09-29 16:49:40 +00:00
|
|
|
EDA_HOTKEY* hk_decr = *aList;
|
|
|
|
|
2010-02-16 11:02:20 +00:00
|
|
|
if( hk_decr->m_KeyCode == aKey )
|
2007-09-22 14:31:20 +00:00
|
|
|
return hk_decr;
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
return nullptr;
|
2007-08-20 11:33:45 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2015-05-05 18:39:42 +00:00
|
|
|
EDA_HOTKEY* GetDescriptorFromCommand( int aCommand, EDA_HOTKEY** aList )
|
|
|
|
{
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; *aList != nullptr; aList++ )
|
2015-05-05 18:39:42 +00:00
|
|
|
{
|
|
|
|
EDA_HOTKEY* hk_decr = *aList;
|
|
|
|
|
|
|
|
if( hk_decr->m_Idcommand == aCommand )
|
|
|
|
return hk_decr;
|
|
|
|
}
|
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
return nullptr;
|
2015-05-05 18:39:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
|
|
|
|
wxString* aFullFileName )
|
2007-08-21 19:37:31 +00:00
|
|
|
{
|
2007-08-30 08:15:05 +00:00
|
|
|
wxString msg;
|
|
|
|
wxString keyname, infokey;
|
|
|
|
|
|
|
|
msg = wxT( "$hotkey list\n" );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Print the current hotkey list
|
|
|
|
EDA_HOTKEY** list;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; aDescList->m_HK_InfoList != nullptr; aDescList++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2014-10-16 01:17:46 +00:00
|
|
|
if( aDescList->m_Title )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
msg += wxT( "# " );
|
2014-10-16 01:17:46 +00:00
|
|
|
msg += *aDescList->m_Title;
|
2010-08-28 18:02:24 +00:00
|
|
|
msg += wxT( "\n" );
|
2007-09-06 11:52:26 +00:00
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
msg += *aDescList->m_SectionTag;
|
|
|
|
msg += wxT( "\n" );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
list = aDescList->m_HK_InfoList;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
for( ; *list != nullptr; list++ )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_HOTKEY* hk_decr = *list;
|
2010-08-28 18:02:24 +00:00
|
|
|
msg += wxT( "shortcut " );
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
keyname = KeyNameFromKeyCode( hk_decr->m_KeyCode );
|
2007-09-06 11:52:26 +00:00
|
|
|
AddDelimiterString( keyname );
|
|
|
|
infokey = hk_decr->m_InfoMsg;
|
|
|
|
AddDelimiterString( infokey );
|
|
|
|
msg += keyname + wxT( ": " ) + infokey + wxT( "\n" );
|
|
|
|
}
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
msg += wxT( "$Endlist\n" );
|
|
|
|
|
|
|
|
if( aFullFileName )
|
|
|
|
{
|
|
|
|
FILE* file = wxFopen( *aFullFileName, wxT( "wt" ) );
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( file )
|
2011-09-01 12:54:34 +00:00
|
|
|
{
|
2011-02-28 18:36:19 +00:00
|
|
|
fputs( TO_UTF8( msg ), file );
|
2013-06-05 12:03:16 +00:00
|
|
|
fclose( file );
|
2011-09-01 12:54:34 +00:00
|
|
|
}
|
2010-08-28 18:02:24 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
msg.Printf( wxT( "Unable to write file %s" ), GetChars( *aFullFileName ) );
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2015-03-03 14:53:47 +00:00
|
|
|
wxFileName fn( GetName() );
|
2015-03-02 17:29:18 +00:00
|
|
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
2018-01-06 04:22:00 +00:00
|
|
|
std::unique_ptr<wxConfigBase> config( GetNewConfig( fn.GetFullPath() ) );
|
2014-09-05 21:12:38 +00:00
|
|
|
config->Write( HOTKEYS_CONFIG_KEY, msg );
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
return 1;
|
2007-08-21 19:37:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
|
|
|
|
struct EDA_HOTKEY_CONFIG* aDescList )
|
2007-08-21 19:37:31 +00:00
|
|
|
{
|
2015-03-02 17:29:18 +00:00
|
|
|
wxFileName fn( aFilename );
|
|
|
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
|
|
|
|
|
|
|
wxFile cfgfile( fn.GetFullPath() );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2014-11-23 11:41:57 +00:00
|
|
|
if( !cfgfile.IsOpened() ) // There is a problem to open file
|
|
|
|
return 0;
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// get length
|
2010-08-28 18:02:24 +00:00
|
|
|
cfgfile.SeekEnd();
|
|
|
|
wxFileOffset size = cfgfile.Tell();
|
|
|
|
cfgfile.Seek( 0 );
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// read data
|
2018-01-08 11:52:17 +00:00
|
|
|
std::vector<char> buffer( size );
|
2018-01-06 04:22:00 +00:00
|
|
|
cfgfile.Read( buffer.data(), size );
|
|
|
|
wxString data( buffer.data(), wxConvUTF8 );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// parse
|
2010-08-28 18:02:24 +00:00
|
|
|
ParseHotkeyConfig( data, aDescList );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// cleanup
|
2010-08-28 18:02:24 +00:00
|
|
|
cfgfile.Close();
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
|
2011-09-29 16:49:40 +00:00
|
|
|
void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
2015-03-02 17:29:18 +00:00
|
|
|
wxFileName fn( Appname );
|
|
|
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
|
|
|
|
2017-03-04 07:34:59 +00:00
|
|
|
std::unique_ptr<wxConfigBase> config;
|
|
|
|
config.reset( GetNewConfig( fn.GetFullPath() ) );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2014-09-05 21:12:38 +00:00
|
|
|
if( !config->HasEntry( HOTKEYS_CONFIG_KEY ) )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
// assume defaults are ok
|
|
|
|
return;
|
2007-08-30 08:15:05 +00:00
|
|
|
}
|
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString data;
|
2014-09-05 21:12:38 +00:00
|
|
|
config->Read( HOTKEYS_CONFIG_KEY, &data );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
|
|
|
ParseHotkeyConfig( data, aDescList );
|
|
|
|
}
|
|
|
|
|
2014-10-17 14:36:47 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* Function ReadHotkeyConfig
|
2010-08-28 18:02:24 +00:00
|
|
|
* Read configuration data and fill the current hotkey list with hotkeys
|
2011-09-29 16:49:40 +00:00
|
|
|
* aDescList is the current hotkey list descr. to initialize.
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
2015-03-03 14:53:47 +00:00
|
|
|
::ReadHotkeyConfig( GetName(), aDescList );
|
2010-08-28 18:02:24 +00:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-09-06 11:52:26 +00:00
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* Function ParseHotkeyConfig
|
2010-08-28 18:02:24 +00:00
|
|
|
* the input format is: shortcut "key" "function"
|
|
|
|
* lines starting by # are ignored (comments)
|
2010-12-20 17:44:25 +00:00
|
|
|
* lines like [xxx] are tags (example: [common] or [libedit] which identify sections
|
2010-08-28 18:02:24 +00:00
|
|
|
*/
|
2011-09-29 16:49:40 +00:00
|
|
|
void ParseHotkeyConfig( const wxString& data,
|
|
|
|
struct EDA_HOTKEY_CONFIG* aDescList )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Read the config
|
2010-08-28 18:02:24 +00:00
|
|
|
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
|
2018-01-06 04:22:00 +00:00
|
|
|
EDA_HOTKEY** CurrentHotkeyList = nullptr;
|
2010-08-28 18:02:24 +00:00
|
|
|
|
|
|
|
while( tokenizer.HasMoreTokens() )
|
2007-08-21 19:37:31 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString line = tokenizer.GetNextToken();
|
|
|
|
wxStringTokenizer lineTokenizer( line );
|
|
|
|
|
|
|
|
wxString line_type = lineTokenizer.GetNextToken();
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( line_type[0] == '#' ) //comment
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if( line_type[0] == '[' ) // A tag is found. search infos in list
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
2018-01-06 04:22:00 +00:00
|
|
|
CurrentHotkeyList = nullptr;
|
2011-09-29 16:49:40 +00:00
|
|
|
EDA_HOTKEY_CONFIG* DList = aDescList;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
for( ; DList->m_HK_InfoList; DList++ )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
if( *DList->m_SectionTag == line_type )
|
2007-09-06 11:52:26 +00:00
|
|
|
{
|
|
|
|
CurrentHotkeyList = DList->m_HK_InfoList;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( line_type == wxT( "$Endlist" ) )
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( line_type != wxT( "shortcut" ) )
|
|
|
|
continue;
|
2011-09-01 12:54:34 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
if( CurrentHotkeyList == nullptr )
|
2007-09-06 11:52:26 +00:00
|
|
|
continue;
|
2007-08-30 08:15:05 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Get the key name
|
2010-08-28 18:02:24 +00:00
|
|
|
lineTokenizer.SetString( lineTokenizer.GetString(), L"\"\r\n\t ", wxTOKEN_STRTOK );
|
|
|
|
wxString keyname = lineTokenizer.GetNextToken();
|
2008-09-03 16:19:06 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString remainder = lineTokenizer.GetString();
|
2008-09-03 16:19:06 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Get the command name
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
|
2008-09-03 16:19:06 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// search the hotkey in current hotkey list
|
2018-01-06 04:22:00 +00:00
|
|
|
for( EDA_HOTKEY** list = CurrentHotkeyList; *list != nullptr; list++ )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
EDA_HOTKEY* hk_decr = *list;
|
2011-09-29 16:49:40 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
if( hk_decr->m_InfoMsg == fctname )
|
2007-08-30 08:15:05 +00:00
|
|
|
{
|
2015-09-07 20:04:16 +00:00
|
|
|
hk_decr->m_KeyCode = KeyCodeFromKeyName( keyname );
|
2007-08-30 08:15:05 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2007-08-21 19:37:31 +00:00
|
|
|
}
|
2007-09-19 15:29:50 +00:00
|
|
|
|
|
|
|
|
2015-03-02 17:29:18 +00:00
|
|
|
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( EDA_HOTKEY_CONFIG* aDescList,
|
2015-08-01 21:46:27 +00:00
|
|
|
const wxString& aDefaultShortname )
|
2007-09-19 15:29:50 +00:00
|
|
|
{
|
2010-08-28 18:02:24 +00:00
|
|
|
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
|
|
|
wxString mask = wxT( "*." ) + ext;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2018-01-06 04:22:00 +00:00
|
|
|
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString path = GetMruPath();
|
2015-03-02 17:29:18 +00:00
|
|
|
wxFileName fn( aDefaultShortname );
|
|
|
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString filename = EDA_FILE_SELECTOR( _( "Read Hotkey Configuration File:" ),
|
2015-08-01 21:46:27 +00:00
|
|
|
path,
|
|
|
|
fn.GetFullPath(),
|
|
|
|
ext,
|
|
|
|
mask,
|
|
|
|
this,
|
|
|
|
wxFD_OPEN,
|
|
|
|
true );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
|
|
|
if( filename.IsEmpty() )
|
|
|
|
return;
|
2007-09-19 15:29:50 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
ReadHotkeyConfigFile( filename, aDescList );
|
2018-01-08 11:52:17 +00:00
|
|
|
WriteHotkeyConfig( aDescList );
|
2015-09-25 19:38:09 +00:00
|
|
|
SetMruPath( wxFileName( filename ).GetPath() );
|
2010-08-28 18:02:24 +00:00
|
|
|
}
|
2007-09-19 15:29:50 +00:00
|
|
|
|
2010-08-28 18:02:24 +00:00
|
|
|
|
2015-03-02 17:29:18 +00:00
|
|
|
void EDA_BASE_FRAME::ExportHotkeyConfigToFile( EDA_HOTKEY_CONFIG* aDescList,
|
2015-08-01 21:46:27 +00:00
|
|
|
const wxString& aDefaultShortname )
|
2010-08-28 18:02:24 +00:00
|
|
|
{
|
|
|
|
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
|
|
|
|
wxString mask = wxT( "*." ) + ext;
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
wxString path = wxPathOnly( Prj().GetProjectFullName() );
|
|
|
|
#else
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString path = GetMruPath();
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
#endif
|
2015-03-02 17:29:18 +00:00
|
|
|
wxFileName fn( aDefaultShortname );
|
|
|
|
fn.SetExt( DEFAULT_HOTKEY_FILENAME_EXT );
|
Modular KiCad Blueprint Milestone B), major portions:
*) When kicad.exe closes a project, close any open KIFACEs so that they cannot
get disassociated from their true PROJECT.
*) Allow loading eeschema library editor from kicad.exe
*) Allow loading pcbnew library editor from kicad.exe
*) Rename LIB_COMPONENT to LIB_PART.
*) Add class PART_LIBS, and PART_LIB.
*) Make PART_LIBS non-global, i.e. PROJECT specific.
*) Implement "data on demand" for PART_LIBS
*) Implement "data on demand" for schematic SEARCH_STACK.
*) Use RSTRINGs to retain eeschema editor's notion of last library and part being edited.
*) Get rid of library search on every SCH_COMPONENT::Draw() call, instead use
a weak pointer.
*) Remove all chdir() calls so projects don't need to be CWD.
*) Romove APPEND support from OpenProjectFiles().
*) Make OpenProjectFiles() robust, even for creating new projects.
*) Load EESCHEMA colors in the KIWAY::OnKiwayStart() rather in window open,
and save them in the .eeschema config file, not in the project file.
*) Fix bug with wxDir() while accessing protected dirs in kicad.exe
*) Consolidate template copying into PROJECT class, not in kicad.exe source.
*) Generally untangle eeschema, making its libraries not global but rather
held in the PROJECT.
2014-08-13 20:28:54 +00:00
|
|
|
|
2015-09-25 19:38:09 +00:00
|
|
|
wxString filename = EDA_FILE_SELECTOR( _( "Write Hotkey Configuration File:" ),
|
|
|
|
path,
|
|
|
|
fn.GetFullPath(),
|
|
|
|
ext,
|
|
|
|
mask,
|
|
|
|
this,
|
|
|
|
wxFD_SAVE,
|
|
|
|
true );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
|
|
|
if( filename.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
WriteHotkeyConfig( aDescList, &filename );
|
2015-09-25 19:38:09 +00:00
|
|
|
SetMruPath( wxFileName( filename ).GetPath() );
|
2007-09-19 15:29:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-12-20 17:44:25 +00:00
|
|
|
/* add hotkey config options submenu to aMenu
|
2007-09-19 15:29:50 +00:00
|
|
|
*/
|
2010-01-18 12:37:53 +00:00
|
|
|
void AddHotkeyConfigMenu( wxMenu* aMenu )
|
2007-09-19 15:29:50 +00:00
|
|
|
{
|
2018-01-06 04:22:00 +00:00
|
|
|
if( aMenu == nullptr )
|
2010-01-18 12:37:53 +00:00
|
|
|
return;
|
|
|
|
|
2018-01-08 11:52:17 +00:00
|
|
|
wxMenu* HotkeySubmenu = new wxMenu();
|
2007-09-19 15:29:50 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Call hotkeys editor
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_SHOW_EDITOR,
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "&Edit Hotkeys..." ),
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Edit hotkeys list" ),
|
|
|
|
KiBitmap( config_xpm ) );
|
2010-08-28 18:02:24 +00:00
|
|
|
|
|
|
|
HotkeySubmenu->AppendSeparator();
|
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// create hotkey file to export current hotkeys config
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_EXPORT_CONFIG,
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "E&xport Hotkeys..." ),
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Export current hotkeys into configuration file" ),
|
|
|
|
KiBitmap( hotkeys_export_xpm ) );
|
2007-11-14 16:02:19 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Reload hotkey file
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( HotkeySubmenu, ID_PREFERENCES_HOTKEY_IMPORT_CONFIG,
|
2018-02-09 16:28:33 +00:00
|
|
|
_( "&Import Hotkeys..." ),
|
2017-06-02 09:51:11 +00:00
|
|
|
_( "Load existing hotkey configuration file" ),
|
|
|
|
KiBitmap( hotkeys_import_xpm ) );
|
2009-10-27 13:48:24 +00:00
|
|
|
|
* KIWAY Milestone A): Make major modules into DLL/DSOs.
! The initial testing of this commit should be done using a Debug build so that
all the wxASSERT()s are enabled. Also, be sure and keep enabled the
USE_KIWAY_DLLs option. The tree won't likely build without it. Turning it
off is senseless anyways. If you want stable code, go back to a prior version,
the one tagged with "stable".
* Relocate all functionality out of the wxApp derivative into more finely
targeted purposes:
a) DLL/DSO specific
b) PROJECT specific
c) EXE or process specific
d) configuration file specific data
e) configuration file manipulations functions.
All of this functionality was blended into an extremely large wxApp derivative
and that was incompatible with the desire to support multiple concurrently
loaded DLL/DSO's ("KIFACE")s and multiple concurrently open projects.
An amazing amount of organization come from simply sorting each bit of
functionality into the proper box.
* Switch to wxConfigBase from wxConfig everywhere except instantiation.
* Add classes KIWAY, KIFACE, KIFACE_I, SEARCH_STACK, PGM_BASE, PGM_KICAD,
PGM_SINGLE_TOP,
* Remove "Return" prefix on many function names.
* Remove obvious comments from CMakeLists.txt files, and from else() and endif()s.
* Fix building boost for use in a DSO on linux.
* Remove some of the assumptions in the CMakeLists.txt files that windows had
to be the host platform when building windows binaries.
* Reduce the number of wxStrings being constructed at program load time via
static construction.
* Pass wxConfigBase* to all SaveSettings() and LoadSettings() functions so that
these functions are useful even when the wxConfigBase comes from another
source, as is the case in the KICAD_MANAGER_FRAME.
* Move the setting of the KIPRJMOD environment variable into class PROJECT,
so that it can be moved into a project variable soon, and out of FP_LIB_TABLE.
* Add the KIWAY_PLAYER which is associated with a particular PROJECT, and all
its child wxFrames and wxDialogs now have a Kiway() member function which
returns a KIWAY& that that window tree branch is in support of. This is like
wxWindows DNA in that child windows get this member with proper value at time
of construction.
* Anticipate some of the needs for milestones B) and C) and make code
adjustments now in an effort to reduce work in those milestones.
* No testing has been done for python scripting, since milestone C) has that
being largely reworked and re-thought-out.
2014-03-20 00:42:08 +00:00
|
|
|
// Append HotkeySubmenu to menu
|
2011-09-01 12:54:34 +00:00
|
|
|
AddMenuItem( aMenu, HotkeySubmenu,
|
2017-06-02 09:51:11 +00:00
|
|
|
wxID_ANY, _( "&Hotkeys Options" ),
|
|
|
|
_( "Edit hotkeys configuration and preferences" ),
|
2011-09-01 12:54:34 +00:00
|
|
|
KiBitmap( hotkeys_xpm ) );
|
2007-09-22 14:31:20 +00:00
|
|
|
}
|