Commit c09bc26d authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor PCBNew code fixes.

* Translate French code names and comments.
* Dead code removal.
* Hot key object and structure coding style policy fixes.
* Doxygen comment warning fixes.
parent eaf17c59
/* /**
dialog_hotkeys_editor.cpp * @file dialog_hotkeys_editor.cpp
*/ */
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
...@@ -32,8 +33,7 @@ dialog_hotkeys_editor.cpp ...@@ -32,8 +33,7 @@ dialog_hotkeys_editor.cpp
#include "dialog_hotkeys_editor.h" #include "dialog_hotkeys_editor.h"
void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys )
Ki_HotkeyInfoSectionDescriptor* hotkeys )
{ {
HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys ); HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys );
...@@ -47,7 +47,7 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, ...@@ -47,7 +47,7 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* parent,
HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent,
Ki_HotkeyInfoSectionDescriptor* hotkeys ) : EDA_HOTKEY_CONFIG* hotkeys ) :
HOTKEYS_EDITOR_DIALOG_BASE( parent ) HOTKEYS_EDITOR_DIALOG_BASE( parent )
{ {
m_parent = parent; m_parent = parent;
...@@ -78,18 +78,21 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) ...@@ -78,18 +78,21 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event )
/* edit the live hotkey table */ /* edit the live hotkey table */
HotkeyGridTable::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys(); HotkeyGridTable::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys();
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = m_hotkeys; section->m_HK_InfoList; section++ ) for( section = m_hotkeys; section->m_HK_InfoList; section++ )
{ {
wxString sectionTag = *section->m_SectionTag; wxString sectionTag = *section->m_SectionTag;
Ki_HotkeyInfo** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
/* find the corresponding hotkey */ /* find the corresponding hotkey */
HotkeyGridTable::hotkey_spec_vector::iterator i; HotkeyGridTable::hotkey_spec_vector::iterator i;
for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i ) for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i )
{ {
if( i->first == sectionTag if( i->first == sectionTag
...@@ -122,6 +125,7 @@ void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event ) ...@@ -122,6 +125,7 @@ void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event )
{ {
m_table->RestoreFrom( m_hotkeys ); m_table->RestoreFrom( m_hotkeys );
m_curEditingRow = -1; m_curEditingRow = -1;
for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i ) for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i )
SetHotkeyCellState( i, false ); SetHotkeyCellState( i, false );
...@@ -153,6 +157,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) ...@@ -153,6 +157,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
SetHotkeyCellState( m_curEditingRow, false ); SetHotkeyCellState( m_curEditingRow, false );
int newRow = event.GetRow(); int newRow = event.GetRow();
if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) ) if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) )
{ {
m_curEditingRow = -1; m_curEditingRow = -1;
...@@ -166,6 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) ...@@ -166,6 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event )
Update(); Update();
} }
/** OnRightClickOnCell /** OnRightClickOnCell
* If a cell is selected, display a list of keys for selection * If a cell is selected, display a list of keys for selection
* The list is restricted to keys that cannot be entered: * The list is restricted to keys that cannot be entered:
...@@ -194,18 +200,19 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event ) ...@@ -194,18 +200,19 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event )
wxT("Alt+Space"), wxT("Alt+Space"),
}; };
wxString keyname = wxGetSingleChoice( wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ),
_("Special keys only. For others keys, use keyboard"), _( "Select a key" ), C_COUNT, choices, this );
_("Select a key"), C_COUNT, choices, this);
int key = ReturnKeyCodeFromKeyName( keyname ); int key = ReturnKeyCodeFromKeyName( keyname );
if( key == 0 ) if( key == 0 )
return; return;
m_table->SetKeyCode( m_curEditingRow, key ); m_table->SetKeyCode( m_curEditingRow, key );
m_hotkeyGrid->Refresh(); m_hotkeyGrid->Refresh();
Update(); Update();
} }
void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
{ {
if( m_curEditingRow != -1 ) if( m_curEditingRow != -1 )
...@@ -222,8 +229,10 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) ...@@ -222,8 +229,10 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
default: default:
if( event.ControlDown() ) if( event.ControlDown() )
key |= GR_KB_CTRL; key |= GR_KB_CTRL;
if( event.AltDown() ) if( event.AltDown() )
key |= GR_KB_ALT; key |= GR_KB_ALT;
if( event.ShiftDown() && (key > 256) ) if( event.ShiftDown() && (key > 256) )
key |= GR_KB_SHIFT; key |= GR_KB_SHIFT;
...@@ -243,12 +252,16 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) ...@@ -243,12 +252,16 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event )
// See if this key code is handled in hotkeys names list // See if this key code is handled in hotkeys names list
bool exists; bool exists;
ReturnKeyNameFromKeyCode( key, &exists ); ReturnKeyNameFromKeyCode( key, &exists );
if( !exists ) // not handled, see hotkeys_basic.cpp if( !exists ) // not handled, see hotkeys_basic.cpp
wxMessageBox( _("Hotkey code not handled" ) ); {
wxMessageBox( _( "Hotkey code not handled" ) );
}
else else
{ {
m_table->SetKeyCode( m_curEditingRow, key ); m_table->SetKeyCode( m_curEditingRow, key );
} }
break; break;
} }
} }
......
...@@ -4,24 +4,23 @@ ...@@ -4,24 +4,23 @@
* Reads the hotkey table from its stored format into a format suitable * Reads the hotkey table from its stored format into a format suitable
* for a wxGrid. * for a wxGrid.
*/ */
HotkeyGridTable::HotkeyGridTable( struct HotkeyGridTable::HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin ) :
Ki_HotkeyInfoSectionDescriptor* origin ) :
wxGridTableBase(), wxGridTableBase(),
m_hotkeys() m_hotkeys()
{ {
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
hotkey_spec spec( *section->m_SectionTag, new Ki_HotkeyInfo( NULL, 0, 0 ) ); hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( NULL, 0, 0 ) );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
Ki_HotkeyInfo** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
hotkey_spec spec( *section->m_SectionTag, hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( info ) );
new Ki_HotkeyInfo( info ) );
m_hotkeys.push_back( spec ); m_hotkeys.push_back( spec );
} }
} }
...@@ -165,19 +164,19 @@ void HotkeyGridTable::SetKeyCode( int row, long key ) ...@@ -165,19 +164,19 @@ void HotkeyGridTable::SetKeyCode( int row, long key )
} }
void HotkeyGridTable::RestoreFrom( struct void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin )
Ki_HotkeyInfoSectionDescriptor* origin )
{ {
int row = 0; int row = 0;
Ki_HotkeyInfoSectionDescriptor* section; EDA_HOTKEY_CONFIG* section;
for( section = origin; section->m_HK_InfoList; section++ ) for( section = origin; section->m_HK_InfoList; section++ )
{ {
++row; ++row;
Ki_HotkeyInfo** info_ptr; EDA_HOTKEY** info_ptr;
for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ )
{ {
Ki_HotkeyInfo* info = *info_ptr; EDA_HOTKEY* info = *info_ptr;
m_hotkeys[row++].second->m_KeyCode = info->m_KeyCode; m_hotkeys[row++].second->m_KeyCode = info->m_KeyCode;
} }
} }
......
/*********************/ /**
/* hotkeys_basic.cpp */ * @file hotkeys_basic.cpp
/*********************/ */
/* Some functions to handle hotkeys in kicad /* Some functions to handle hotkeys in kicad
*/ */
...@@ -34,8 +34,7 @@ wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) ); ...@@ -34,8 +34,7 @@ wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) );
* file. * file.
*/ */
Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent )
int keycode, int idmenuevent )
{ {
m_KeyCode = keycode; // Key code (ascii value for ascii keys m_KeyCode = keycode; // Key code (ascii value for ascii keys
// or wxWidgets code for function key // or wxWidgets code for function key
...@@ -47,7 +46,7 @@ Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, ...@@ -47,7 +46,7 @@ Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand,
} }
Ki_HotkeyInfo::Ki_HotkeyInfo( const Ki_HotkeyInfo* base ) EDA_HOTKEY::EDA_HOTKEY( const EDA_HOTKEY* base )
{ {
m_KeyCode = base->m_KeyCode; m_KeyCode = base->m_KeyCode;
m_InfoMsg = base->m_InfoMsg; m_InfoMsg = base->m_InfoMsg;
...@@ -154,6 +153,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) ...@@ -154,6 +153,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
keyname = wxT( "<unknown>" ); keyname = wxT( "<unknown>" );
break; break;
} }
if( s_Hotkey_Name_List[ii].m_KeyCode == aKeycode ) if( s_Hotkey_Name_List[ii].m_KeyCode == aKeycode )
{ {
keyname = s_Hotkey_Name_List[ii].m_Name; keyname = s_Hotkey_Name_List[ii].m_Name;
...@@ -173,8 +173,8 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) ...@@ -173,8 +173,8 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound )
/* /*
* helper function use in AddHotkeyName to calculate an accelerator string * helper function use in AddHotkeyName to calculate an accelerator string
* In some menus, accelerators do not perform exactely the same action as * In some menus, accelerators do not perform exactly the same action as
* the hotkey that perfoms a similar action. * the hotkey that perform a similar action.
* this is usually the case when this action uses the current mouse position * 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. * 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 * a zoom uses the mouse position from a hot key and not from the menu
...@@ -199,14 +199,14 @@ static void AddModifierToKey( wxString& aFullKey, const wxString & aKey ) ...@@ -199,14 +199,14 @@ static void AddModifierToKey( wxString& aFullKey, const wxString & aKey )
/* AddHotkeyName /* AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* aText = a wxString. returns aText + key name * aText = a wxString. returns aText + key name
* aList = pointer to a Ki_HotkeyInfo list of commands * aList = pointer to a EDA_HOTKEY list of commands
* aCommandId = Command Id value * aCommandId = Command Id value
* aShortCutType = IS_HOTKEY to add <tab><keyname> (shortcuts in menus, same as hotkeys) * aShortCutType = IS_HOTKEY to add <tab><keyname> (shortcuts in menus, same as hotkeys)
* IS_ACCELERATOR to add <tab><Shift+keyname> (accelerators in menus, not hotkeys) * IS_ACCELERATOR to add <tab><Shift+keyname> (accelerators in menus, not hotkeys)
* IS_COMMENT to add <spaces><(keyname)> mainly in tooltips * IS_COMMENT to add <spaces><(keyname)> mainly in tool tips
* Return a wxString (aTest + key name) if key found or aText without modification * Return a wxString (aTest + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList,
int aCommandId, HOTKEY_ACTION_TYPE aShortCutType ) int aCommandId, HOTKEY_ACTION_TYPE aShortCutType )
{ {
wxString msg = aText; wxString msg = aText;
...@@ -222,9 +222,11 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, ...@@ -222,9 +222,11 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
case IS_HOTKEY: case IS_HOTKEY:
msg << wxT( "\t" ) << keyname; msg << wxT( "\t" ) << keyname;
break; break;
case IS_ACCELERATOR: case IS_ACCELERATOR:
AddModifierToKey( msg, keyname ); AddModifierToKey( msg, keyname );
break; break;
case IS_COMMENT: case IS_COMMENT:
msg << wxT( " (" ) << keyname << wxT( ")" ); msg << wxT( " (" ) << keyname << wxT( ")" );
break; break;
...@@ -238,7 +240,7 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, ...@@ -238,7 +240,7 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
/* AddHotkeyName /* AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* aText = a wxString. returns aText + key name * aText = a wxString. returns aText + key name
* aList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands * aList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
* aCommandId = Command Id value * aCommandId = Command Id value
* aShortCutType = IS_HOTKEY to add <tab><keyname> (active shortcuts in menus) * aShortCutType = IS_HOTKEY to add <tab><keyname> (active shortcuts in menus)
* IS_ACCELERATOR to add <tab><Shift+keyname> (active accelerators in menus) * IS_ACCELERATOR to add <tab><Shift+keyname> (active accelerators in menus)
...@@ -246,13 +248,13 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, ...@@ -246,13 +248,13 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList,
* Return a wxString (aText + key name) if key found or aText without modification * Return a wxString (aText + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, wxString AddHotkeyName( const wxString& aText,
struct Ki_HotkeyInfoSectionDescriptor* aDescList, struct EDA_HOTKEY_CONFIG* aDescList,
int aCommandId, int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType ) HOTKEY_ACTION_TYPE aShortCutType )
{ {
wxString msg = aText; wxString msg = aText;
wxString keyname; wxString keyname;
Ki_HotkeyInfo** List; EDA_HOTKEY** List;
if( aDescList ) if( aDescList )
{ {
...@@ -268,9 +270,11 @@ wxString AddHotkeyName( const wxString& aText, ...@@ -268,9 +270,11 @@ wxString AddHotkeyName( const wxString& aText,
case IS_HOTKEY: case IS_HOTKEY:
msg << wxT( "\t" ) << keyname; msg << wxT( "\t" ) << keyname;
break; break;
case IS_ACCELERATOR: case IS_ACCELERATOR:
AddModifierToKey( msg, keyname ); AddModifierToKey( msg, keyname );
break; break;
case IS_COMMENT: case IS_COMMENT:
msg << wxT( " (" ) << keyname << wxT( ")" ); msg << wxT( " (" ) << keyname << wxT( ")" );
break; break;
...@@ -287,17 +291,17 @@ wxString AddHotkeyName( const wxString& aText, ...@@ -287,17 +291,17 @@ wxString AddHotkeyName( const wxString& aText,
/** /**
* Function ReturnKeyNameFromCommandId * Function ReturnKeyNameFromCommandId
* return the key name from the Command id value ( m_Idcommand member value) * return the key name from the Command id value ( m_Idcommand member value)
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @return the key name in a wxString * @return the key name in a wxString
*/ */
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ) wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId )
{ {
wxString keyname; wxString keyname;
for( ; *aList != NULL; aList++ ) for( ; *aList != NULL; aList++ )
{ {
Ki_HotkeyInfo* hk_decr = *aList; EDA_HOTKEY* hk_decr = *aList;
if( hk_decr->m_Idcommand == aCommandId ) if( hk_decr->m_Idcommand == aCommandId )
{ {
...@@ -373,13 +377,12 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ) ...@@ -373,13 +377,12 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname )
/* DisplayHotkeyList /* DisplayHotkeyList
* Displays the current hotkey list * Displays the current hotkey list
* aList = a Ki_HotkeyInfoSectionDescriptor list(Null terminated) * aList = a EDA_HOTKEY_CONFIG list(Null terminated)
*/ */
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList )
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{ {
wxString keyname; wxString keyname;
Ki_HotkeyInfo** List; EDA_HOTKEY** List;
wxString msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" ); wxString msg = wxT( "<html><body bgcolor=\"#E2E2E2\">" );
...@@ -393,7 +396,8 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, ...@@ -393,7 +396,8 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame,
for( ; *List != NULL; List++ ) for( ; *List != NULL; List++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; EDA_HOTKEY* hk_decr = *List;
if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) ) if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) )
{ {
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
...@@ -410,16 +414,17 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, ...@@ -410,16 +414,17 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame,
/** /**
* Function GetDescriptorFromHotkey * Function GetDescriptorFromHotkey
* Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function * Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys * @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List * @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/ */
Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ) EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList )
{ {
for( ; *aList != NULL; aList++ ) for( ; *aList != NULL; aList++ )
{ {
Ki_HotkeyInfo* hk_decr = *aList; EDA_HOTKEY* hk_decr = *aList;
if( hk_decr->m_KeyCode == aKey ) if( hk_decr->m_KeyCode == aKey )
return hk_decr; return hk_decr;
} }
...@@ -434,12 +439,12 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ) ...@@ -434,12 +439,12 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList )
* It is stored using the standard wxConfig mechanism or a file. * It is stored using the standard wxConfig mechanism or a file.
* *
* @param aDescList = pointer to the current hotkey list. * @param aDescList = pointer to the current hotkey list.
* @param aFullFileName = a wxString pointer to a fuill file name. * @param aFullFileName = a wxString pointer to a full file name.
* if NULL, use the standard wxConfig mechanism (default) * if NULL, use the standard wxConfig mechanism (default)
* the output format is: shortcut "key" "function" * the output format is: shortcut "key" "function"
* lines starting with # are comments * lines starting with # are comments
*/ */
int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
wxString* aFullFileName ) wxString* aFullFileName )
{ {
wxString msg; wxString msg;
...@@ -448,7 +453,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD ...@@ -448,7 +453,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
msg = wxT( "$hotkey list\n" ); msg = wxT( "$hotkey list\n" );
/* Print the current hotkey list */ /* Print the current hotkey list */
Ki_HotkeyInfo** List; EDA_HOTKEY** List;
for( ; aDescList->m_HK_InfoList != NULL; aDescList++ ) for( ; aDescList->m_HK_InfoList != NULL; aDescList++ )
{ {
...@@ -466,7 +471,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD ...@@ -466,7 +471,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
for( ; *List != NULL; List++ ) for( ; *List != NULL; List++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; EDA_HOTKEY* hk_decr = *List;
msg += wxT( "shortcut " ); msg += wxT( "shortcut " );
keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode );
AddDelimiterString( keyname ); AddDelimiterString( keyname );
...@@ -510,7 +515,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD ...@@ -510,7 +515,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD
* @param aDescList = current hotkey list descr. to initialise. * @param aDescList = current hotkey list descr. to initialise.
*/ */
int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename, int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename,
struct Ki_HotkeyInfoSectionDescriptor* aDescList ) struct EDA_HOTKEY_CONFIG* aDescList )
{ {
wxFile cfgfile( aFilename ); wxFile cfgfile( aFilename );
...@@ -534,8 +539,7 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& ...@@ -534,8 +539,7 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString&
return 1; return 1;
} }
void ReadHotkeyConfig( const wxString& Appname, void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList )
struct Ki_HotkeyInfoSectionDescriptor* aDescList )
{ {
wxConfig config( Appname ); wxConfig config( Appname );
...@@ -553,9 +557,9 @@ void ReadHotkeyConfig( const wxString& Appname, ...@@ -553,9 +557,9 @@ void ReadHotkeyConfig( const wxString& Appname,
/* Function ReadHotkeyConfig /* Function ReadHotkeyConfig
* Read configuration data and fill the current hotkey list with hotkeys * Read configuration data and fill the current hotkey list with hotkeys
* aDescList is the current hotkey list descr. to initialise. * aDescList is the current hotkey list descr. to initialize.
*/ */
int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ) int EDA_BASE_FRAME::ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList )
{ {
::ReadHotkeyConfig( m_FrameName, aDescList ); ::ReadHotkeyConfig( m_FrameName, aDescList );
return 1; return 1;
...@@ -568,11 +572,11 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDe ...@@ -568,11 +572,11 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDe
* lines like [xxx] are tags (example: [common] or [libedit] which identify sections * lines like [xxx] are tags (example: [common] or [libedit] which identify sections
*/ */
void ParseHotkeyConfig( const wxString& data, void ParseHotkeyConfig( const wxString& data,
struct Ki_HotkeyInfoSectionDescriptor* aDescList ) struct EDA_HOTKEY_CONFIG* aDescList )
{ {
/* Read the config */ /* Read the config */
wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK ); wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK );
Ki_HotkeyInfo** CurrentHotkeyList = 0; EDA_HOTKEY** CurrentHotkeyList = 0;
while( tokenizer.HasMoreTokens() ) while( tokenizer.HasMoreTokens() )
{ {
...@@ -580,13 +584,14 @@ void ParseHotkeyConfig( const wxString& data, ...@@ -580,13 +584,14 @@ void ParseHotkeyConfig( const wxString& data,
wxStringTokenizer lineTokenizer( line ); wxStringTokenizer lineTokenizer( line );
wxString line_type = lineTokenizer.GetNextToken(); wxString line_type = lineTokenizer.GetNextToken();
if( line_type[0] == '#' ) //comment if( line_type[0] == '#' ) //comment
continue; continue;
if( line_type[0] == '[' ) // A tag is found. search infos in list if( line_type[0] == '[' ) // A tag is found. search infos in list
{ {
CurrentHotkeyList = 0; CurrentHotkeyList = 0;
Ki_HotkeyInfoSectionDescriptor* DList = aDescList; EDA_HOTKEY_CONFIG* DList = aDescList;
for( ; DList->m_HK_InfoList; DList++ ) for( ; DList->m_HK_InfoList; DList++ )
{ {
...@@ -619,9 +624,10 @@ void ParseHotkeyConfig( const wxString& data, ...@@ -619,9 +624,10 @@ void ParseHotkeyConfig( const wxString& data,
wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' ); wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' );
/* search the hotkey in current hotkey list */ /* search the hotkey in current hotkey list */
for( Ki_HotkeyInfo** List = CurrentHotkeyList; *List != NULL; List++ ) for( EDA_HOTKEY** List = CurrentHotkeyList; *List != NULL; List++ )
{ {
Ki_HotkeyInfo* hk_decr = *List; EDA_HOTKEY* hk_decr = *List;
if( hk_decr->m_InfoMsg == fctname ) if( hk_decr->m_InfoMsg == fctname )
{ {
int code = ReturnKeyCodeFromKeyName( keyname ); int code = ReturnKeyCodeFromKeyName( keyname );
...@@ -639,9 +645,9 @@ void ParseHotkeyConfig( const wxString& data, ...@@ -639,9 +645,9 @@ void ParseHotkeyConfig( const wxString& data,
/** /**
* Function ImportHotkeyConfigFromFile * Function ImportHotkeyConfigFromFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialise. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ) void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList )
{ {
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT; wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext; wxString mask = wxT( "*." ) + ext;
...@@ -667,9 +673,9 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDesc ...@@ -667,9 +673,9 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDesc
/** /**
* Function ExportHotkeyConfigToFile * Function ExportHotkeyConfigToFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialise. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ) void EDA_BASE_FRAME::ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList )
{ {
wxString ext = DEFAULT_HOTKEY_FILENAME_EXT; wxString ext = DEFAULT_HOTKEY_FILENAME_EXT;
wxString mask = wxT( "*." ) + ext; wxString mask = wxT( "*." ) + ext;
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see
* hotkeys.h). * hotkeys.h).
* add a new Ki_HotkeyInfo entry like: * add a new EDA_HOTKEY entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION,
* default key value); * default key value);
* wxT("Command Label") is the name used in hotkey list display, and the * wxT("Command Label") is the name used in hotkey list display, and the
* identifier in the hotkey list file * identifier in the hotkey list file
...@@ -58,104 +58,104 @@ ...@@ -58,104 +58,104 @@
/* Fit on Screen */ /* Fit on Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Fit on Screen" ), HK_ZOOM_AUTO, WXK_HOME );
#else #else
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' );
#endif #endif
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
/* Refresh Screen */ /* Refresh Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
#else #else
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' );
#endif #endif
/* Zoom In */ /* Zoom In */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
#else #else
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' );
#endif #endif
/* Zoom Out */ /* Zoom Out */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
#else #else
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif #endif
static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' ); HK_RESET_LOCAL_COORD, ' ' );
/* Undo */ /* Undo */
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO ); static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
/* Redo */ /* Redo */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO ); static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
#else #else
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z', static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_SHIFT + GR_KB_CTRL + 'Z',
(int) wxID_REDO ); (int) wxID_REDO );
#endif #endif
// Schematic editor // Schematic editor
static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' ); static EDA_HOTKEY HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' );
static Ki_HotkeyInfo HkAddHierarchicalLabel( wxT( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' ); static EDA_HOTKEY HkAddHierarchicalLabel( wxT( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' );
static Ki_HotkeyInfo HkAddGlobalLabel( wxT( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' ); static EDA_HOTKEY HkAddGlobalLabel( wxT( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' );
static Ki_HotkeyInfo HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J' ); static EDA_HOTKEY HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J' );
static Ki_HotkeyInfo HkBeginWire( wxT( "Draw Wire" ), HK_BEGIN_WIRE, 'W' ); static EDA_HOTKEY HkBeginWire( wxT( "Draw Wire" ), HK_BEGIN_WIRE, 'W' );
static Ki_HotkeyInfo HkBeginBus( wxT( "Draw Bus" ), HK_BEGIN_BUS, 'B' ); static EDA_HOTKEY HkBeginBus( wxT( "Draw Bus" ), HK_BEGIN_BUS, 'B' );
static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' ); static EDA_HOTKEY HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' );
static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' ); static EDA_HOTKEY HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' );
static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' ); static EDA_HOTKEY HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' );
static Ki_HotkeyInfo HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' ); static EDA_HOTKEY HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' );
static Ki_HotkeyInfo HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' ); static EDA_HOTKEY HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' );
static Ki_HotkeyInfo HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' ); static EDA_HOTKEY HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' );
static Ki_HotkeyInfo HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' ); static EDA_HOTKEY HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' );
static Ki_HotkeyInfo HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' ); static EDA_HOTKEY HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' );
static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' ); static EDA_HOTKEY HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' );
static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' ); static EDA_HOTKEY HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' );
static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ), static EDA_HOTKEY HkOrientNormalComponent( wxT( "Orient Normal Component" ),
HK_ORIENT_NORMAL_COMPONENT, 'N' ); HK_ORIENT_NORMAL_COMPONENT, 'N' );
static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' ); static EDA_HOTKEY HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' );
static Ki_HotkeyInfo HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' ); static EDA_HOTKEY HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' );
static Ki_HotkeyInfo HkEditComponentValue( wxT( "Edit Component Value" ), static EDA_HOTKEY HkEditComponentValue( wxT( "Edit Component Value" ),
HK_EDIT_COMPONENT_VALUE, 'V', HK_EDIT_COMPONENT_VALUE, 'V',
ID_POPUP_SCH_EDIT_VALUE_CMP ); ID_POPUP_SCH_EDIT_VALUE_CMP );
static Ki_HotkeyInfo HkEditComponentFootprint( wxT( "Edit Component Footprint" ), static EDA_HOTKEY HkEditComponentFootprint( wxT( "Edit Component Footprint" ),
HK_EDIT_COMPONENT_FOOTPRINT, 'F', HK_EDIT_COMPONENT_FOOTPRINT, 'F',
ID_POPUP_SCH_EDIT_FOOTPRINT_CMP ); ID_POPUP_SCH_EDIT_FOOTPRINT_CMP );
static Ki_HotkeyInfo HkMove( wxT( "Move Schematic Item" ), static EDA_HOTKEY HkMove( wxT( "Move Schematic Item" ),
HK_MOVE_COMPONENT_OR_ITEM, 'M', HK_MOVE_COMPONENT_OR_ITEM, 'M',
ID_POPUP_SCH_MOVE_ITEM ); ID_POPUP_SCH_MOVE_ITEM );
static Ki_HotkeyInfo HkCopyComponentOrText( wxT( "Copy Component or Label" ), static EDA_HOTKEY HkCopyComponentOrText( wxT( "Copy Component or Label" ),
HK_COPY_COMPONENT_OR_LABEL, 'C', HK_COPY_COMPONENT_OR_LABEL, 'C',
ID_POPUP_SCH_COPY_ITEM ); ID_POPUP_SCH_COPY_ITEM );
static Ki_HotkeyInfo HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G', static EDA_HOTKEY HkDrag( wxT( "Drag Schematic Item" ), HK_DRAG, 'G',
ID_POPUP_SCH_DRAG_CMP_REQUEST ); ID_POPUP_SCH_DRAG_CMP_REQUEST );
static Ki_HotkeyInfo HkMove2Drag( wxT( "Move Block -> Drag Block" ), static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ),
HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' ); HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' );
static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT ); static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE ); static EDA_HOTKEY HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
static Ki_HotkeyInfo HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5 ); static EDA_HOTKEY HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5 );
static Ki_HotkeyInfo HkFindNextDrcMarker( wxT( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER, static EDA_HOTKEY HkFindNextDrcMarker( wxT( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER,
WXK_F5 + GR_KB_SHIFT ); WXK_F5 + GR_KB_SHIFT );
// Special keys for library editor: // Special keys for library editor:
static Ki_HotkeyInfo HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' ); static EDA_HOTKEY HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' );
static Ki_HotkeyInfo HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT ); static EDA_HOTKEY HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT );
static Ki_HotkeyInfo HkMoveLibItem( wxT( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' ); static EDA_HOTKEY HkMoveLibItem( wxT( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' );
// List of common hotkey descriptors // List of common hotkey descriptors
Ki_HotkeyInfo* s_Common_Hotkey_List[] = EDA_HOTKEY* s_Common_Hotkey_List[] =
{ {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomIn,
...@@ -170,7 +170,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] = ...@@ -170,7 +170,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] =
}; };
// List of hotkey descriptors for schematic // List of hotkey descriptors for schematic
Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = EDA_HOTKEY* s_Schematic_Hotkey_List[] =
{ {
&HkFindItem, &HkFindItem,
&HkFindNextItem, &HkFindNextItem,
...@@ -206,7 +206,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = ...@@ -206,7 +206,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] =
}; };
// List of hotkey descriptors for library editor // List of hotkey descriptors for library editor
Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = EDA_HOTKEY* s_LibEdit_Hotkey_List[] =
{ {
&HkCreatePin, &HkCreatePin,
&HkInsertPin, &HkInsertPin,
...@@ -220,7 +220,7 @@ Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = ...@@ -220,7 +220,7 @@ Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] =
// list of sections and corresponding hotkey list for eeschema (used to create // list of sections and corresponding hotkey list for eeschema (used to create
// an hotkey config file) // an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Eeschema_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" }, { &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" },
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, L"Schematic editor keys" }, { &g_SchematicSectionTag, s_Schematic_Hotkey_List, L"Schematic editor keys" },
...@@ -230,7 +230,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] = ...@@ -230,7 +230,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] =
// list of sections and corresponding hotkey list for the schematic editor // list of sections and corresponding hotkey list for the schematic editor
// (used to list current hotkeys) // (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Schematic_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, { &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_SchematicSectionTag, s_Schematic_Hotkey_List, NULL }, { &g_SchematicSectionTag, s_Schematic_Hotkey_List, NULL },
...@@ -239,7 +239,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] = ...@@ -239,7 +239,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] =
// list of sections and corresponding hotkey list for the component editor // list of sections and corresponding hotkey list for the component editor
// (used to list current hotkeys) // (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Libedit_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, { &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ &g_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL }, { &g_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL },
...@@ -248,7 +248,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] = ...@@ -248,7 +248,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] =
// list of sections and corresponding hotkey list for the component browser // list of sections and corresponding hotkey list for the component browser
// (used to list current hotkeys) // (used to list current hotkeys)
struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Common_Hotkey_List, NULL }, { &g_CommonSectionTag, s_Common_Hotkey_List, NULL },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
...@@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
// Search command from key : // Search command from key :
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List );
...@@ -864,7 +864,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, ...@@ -864,7 +864,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
if( (aHotKey >= 'a') && (aHotKey <= 'z') ) if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List );
......
/***************/ /**
/* hotkeys.h */ * eeschema/hotkeys.h
/***************/ */
#ifndef KOTKEYS_H #ifndef KOTKEYS_H
#define KOTKEYS_H #define KOTKEYS_H
...@@ -46,15 +46,15 @@ enum hotkey_id_commnand { ...@@ -46,15 +46,15 @@ enum hotkey_id_commnand {
}; };
// List of hotkey descriptors for eeschema // List of hotkey descriptors for eeschema
extern struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Eeschema_Hokeys_Descr[];
// List of hotkey descriptors for the schematic editor only // List of hotkey descriptors for the schematic editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Schematic_Hokeys_Descr[];
// List of hotkey descriptors for the lib editor only // List of hotkey descriptors for the lib editor only
extern struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Libedit_Hokeys_Descr[];
// List of hotkey descriptors for the lib browser only // List of hotkey descriptors for the lib browser only
extern struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[];
#endif // KOTKEYS_H #endif // KOTKEYS_H
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
* add a new Ki_HotkeyInfo entry like: * add a new EDA_HOTKEY entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the * "Command Label" is the name used in hotkey list display, and the identifier in the
* hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch
* in OnHotKey() function. default key value is the default hotkey for this command. * in OnHotKey() function. default key value is the default hotkey for this command.
...@@ -33,25 +33,25 @@ ...@@ -33,25 +33,25 @@
/* local variables */ /* local variables */
/* Hotkey list: */ /* Hotkey list: */
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' ); HK_RESET_LOCAL_COORD, ' ' );
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' );
static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ),
HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' );
static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' ); HK_SWITCH_LAYER_TO_NEXT, '+' );
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
// List of common hotkey descriptors // List of common hotkey descriptors
Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = { EDA_HOTKEY* s_Gerbview_Hotkey_List[] = {
&HkHelp, &HkHelp,
&HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter,
&HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, &HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord,
...@@ -63,7 +63,7 @@ Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = { ...@@ -63,7 +63,7 @@ Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = {
// list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file) // list of sections and corresponding hotkey list for pcbnew (used to create an hotkey config file)
struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[] =
{ {
{ &g_CommonSectionTag, s_Gerbview_Hotkey_List, NULL }, { &g_CommonSectionTag, s_Gerbview_Hotkey_List, NULL },
{ NULL, NULL, NULL } { NULL, NULL, NULL }
...@@ -86,8 +86,10 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) ...@@ -86,8 +86,10 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct )
if( (hotkey >= 'a') && (hotkey <= 'z') ) if( (hotkey >= 'a') && (hotkey <= 'z') )
hotkey += 'A' - 'a'; hotkey += 'A' - 'a';
Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List ); EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List );
if( HK_Descr == NULL ) return;
if( HK_Descr == NULL )
return;
switch( HK_Descr->m_Idcommand ) switch( HK_Descr->m_Idcommand )
{ {
......
/***************/ /**
/* hotkeys.h */ * gerbview/hotkeys.h
/***************/ */
#ifndef KOTKEYS_H #ifndef KOTKEYS_H
#define KOTKEYS_H #define KOTKEYS_H
...@@ -17,6 +18,6 @@ enum hotkey_id_commnand { ...@@ -17,6 +18,6 @@ enum hotkey_id_commnand {
}; };
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
extern struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[];
#endif // KOTKEYS_H #endif // KOTKEYS_H
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
bool SetLayersOrdered(bool value); bool SetLayersOrdered(bool value);
bool SetLayersHotkeys(bool value); bool SetLayersHotkeys(bool value);
// Hotkey Info // Hotkey Info
struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys;
}; };
#define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ #define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \
......
...@@ -25,13 +25,13 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE ...@@ -25,13 +25,13 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE
{ {
protected: protected:
EDA_DRAW_FRAME* m_parent; EDA_DRAW_FRAME* m_parent;
struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; struct EDA_HOTKEY_CONFIG* m_hotkeys;
HotkeyGridTable* m_table; HotkeyGridTable* m_table;
int m_curEditingRow; int m_curEditingRow;
public: public:
HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, Ki_HotkeyInfoSectionDescriptor* hotkeys ); HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys );
~HOTKEYS_EDITOR_DIALOG() {}; ~HOTKEYS_EDITOR_DIALOG() {};
...@@ -45,6 +45,6 @@ private: ...@@ -45,6 +45,6 @@ private:
void SetHotkeyCellState( int aRow, bool aHightlight ); void SetHotkeyCellState( int aRow, bool aHightlight );
}; };
void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, Ki_HotkeyInfoSectionDescriptor* hotkeys ); void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys );
#endif #endif
...@@ -18,10 +18,10 @@ class HotkeyGridTable : public wxGridTableBase ...@@ -18,10 +18,10 @@ class HotkeyGridTable : public wxGridTableBase
{ {
public: public:
typedef std::pair< wxString, Ki_HotkeyInfo* > hotkey_spec; typedef std::pair< wxString, EDA_HOTKEY* > hotkey_spec;
typedef std::vector< hotkey_spec > hotkey_spec_vector; typedef std::vector< hotkey_spec > hotkey_spec_vector;
HotkeyGridTable( struct Ki_HotkeyInfoSectionDescriptor* origin ); HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin );
virtual ~HotkeyGridTable(); virtual ~HotkeyGridTable();
hotkey_spec_vector& getHotkeys(); hotkey_spec_vector& getHotkeys();
...@@ -47,7 +47,7 @@ private: ...@@ -47,7 +47,7 @@ private:
public: public:
virtual bool isHeader( int row ); virtual bool isHeader( int row );
virtual void SetKeyCode( int row, long key ); virtual void SetKeyCode( int row, long key );
virtual void RestoreFrom( struct Ki_HotkeyInfoSectionDescriptor* origin ); virtual void RestoreFrom( struct EDA_HOTKEY_CONFIG* origin );
protected: protected:
std::vector< hotkey_spec > m_hotkeys; std::vector< hotkey_spec > m_hotkeys;
......
/*******************/ /**
/* hotkeys_basic.h */ * @file hotkeys_basic.h
/*******************/ */
/* Some functions to handle hotkeys in kicad /* Some functions to handle hotkeys in kicad
*/ */
...@@ -17,7 +17,7 @@ class EDA_DRAW_FRAME; ...@@ -17,7 +17,7 @@ class EDA_DRAW_FRAME;
/* Class to handle hotkey commands. hotkeys have a default value /* Class to handle hotkey commands. hotkeys have a default value
* This class allows the real key code changed by user(from a key code list file) * This class allows the real key code changed by user(from a key code list file)
*/ */
class Ki_HotkeyInfo class EDA_HOTKEY
{ {
public: public:
int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key
...@@ -26,30 +26,33 @@ public: ...@@ -26,30 +26,33 @@ public:
int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h) int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h)
public: public:
Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 ); EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 );
Ki_HotkeyInfo( const Ki_HotkeyInfo* base); EDA_HOTKEY( const EDA_HOTKEY* base);
}; };
/* handle a Section name and the corresponding list of hotkeys (Ki_HotkeyInfo list)
/**
* Structure EDA_HOTKEY_CONFIG
* contains the information required to save hot key information to a configuration file.
* a Section name and the corresponding list of hotkeys (EDA_HOTKEY list)
* hotkeys are grouped by section. * hotkeys are grouped by section.
* a section is a list of hotkey infos ( a Ki_HotkeyInfo list). * a section is a list of hotkey infos ( a EDA_HOTKEY list).
* A full list of hoteys can used one or many sections * A full list of hotkeys can used one or many sections
* for instance: * for instance:
* the schematic editor uses a common section (zoom hotkeys list ..) and a specific section * the schematic editor uses a common section (zoom hotkeys list ..) and a specific section
* the library editor uses the same common section and a specific section * the library editor uses the same common section and a specific section
* this feature avoid duplications and made hotkey file config easier to understand and edit * this feature avoid duplications and made hotkey file config easier to understand and edit
*/ */
struct Ki_HotkeyInfoSectionDescriptor struct EDA_HOTKEY_CONFIG
{ {
public: public:
wxString* m_SectionTag; // The section name wxString* m_SectionTag; // The configuration file section name.
Ki_HotkeyInfo** m_HK_InfoList; // List of Ki_HotkeyInfo pointers EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers
const wchar_t* m_Comment; // comment: will be printed in the config file const wchar_t* m_Comment; // Will be printed in the config file only.
// Info usage only
}; };
/* Identifiers (tags) in key code configuration file (or section names) /* Identifiers (tags) in key code configuration file (or section names)
* .m_SectionTag member of a Ki_HotkeyInfoSectionDescriptor * .m_SectionTag member of a EDA_HOTKEY_CONFIG
*/ */
extern wxString g_CommonSectionTag; extern wxString g_CommonSectionTag;
extern wxString g_SchematicSectionTag; extern wxString g_SchematicSectionTag;
...@@ -77,11 +80,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL ) ...@@ -77,11 +80,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL )
/** /**
* Function ReturnKeyNameFromCommandId * Function ReturnKeyNameFromCommandId
* return the key name from the Command id value ( m_Idcommand member value) * return the key name from the Command id value ( m_Idcommand member value)
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @return the key name in a wxString * @return the key name in a wxString
*/ */
wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ); wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId );
/** /**
* Function ReturnKeyCodeFromKeyName * Function ReturnKeyCodeFromKeyName
...@@ -98,7 +101,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ); ...@@ -98,7 +101,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname );
* Hot keys can perform actions using the current mouse cursor position * Hot keys can perform actions using the current mouse cursor position
* Accelerators performs the same action as the associated menu * Accelerators performs the same action as the associated menu
* A comment is used in tool tips for some tools (zoom ..) * A comment is used in tool tips for some tools (zoom ..)
* to show the hot key that perfoms this action * to show the hot key that performs this action
*/ */
enum HOTKEY_ACTION_TYPE enum HOTKEY_ACTION_TYPE
{ {
...@@ -111,28 +114,25 @@ enum HOTKEY_ACTION_TYPE ...@@ -111,28 +114,25 @@ enum HOTKEY_ACTION_TYPE
* Function AddHotkeyName * Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name * @param aText = a wxString. returns aText + key name
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @param aIsShortCut = true to add &lttab&gt&ltkeyname&gt (active shortcuts in menus) * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
* = false to add &ltspaces&gt&lt(keyname)&gt
* @return a wxString (aTest + key name) if key found or aText without modification * @return a wxString (aTest + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList, int aCommandId,
int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY); HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY);
/** /**
* Function AddHotkeyName * Function AddHotkeyName
* Add the key name from the Command id value ( m_Idcommand member value) * Add the key name from the Command id value ( m_Idcommand member value)
* @param aText = a wxString. returns aText + key name * @param aText = a wxString. returns aText + key name
* @param aDescrList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands * @param aDescrList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands
* @param aCommandId = Command Id value * @param aCommandId = Command Id value
* @param aIsShortCut = true to add &lttab&gt&ltkeyname&gt (active shortcuts in menus) * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut.
* = false to add &ltspaces&gt&lt(keyname)&gt
* @return a wxString (aTest + key name) if key found or aText without modification * @return a wxString (aTest + key name) if key found or aText without modification
*/ */
wxString AddHotkeyName( const wxString& aText, wxString AddHotkeyName( const wxString& aText,
struct Ki_HotkeyInfoSectionDescriptor* aDescrList, struct EDA_HOTKEY_CONFIG* aDescrList,
int aCommandId, int aCommandId,
HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY ); HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY );
...@@ -140,19 +140,18 @@ wxString AddHotkeyName( const wxString& aText, ...@@ -140,19 +140,18 @@ wxString AddHotkeyName( const wxString& aText,
* Function DisplayHotkeyList * Function DisplayHotkeyList
* Displays the current hotkey list * Displays the current hotkey list
* @param aFrame = current active frame * @param aFrame = current active frame
* @param aList = pointer to a Ki_HotkeyInfoSectionDescriptor list (Null terminated) * @param aList = pointer to a EDA_HOTKEY_CONFIG list (Null terminated)
*/ */
void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList );
struct Ki_HotkeyInfoSectionDescriptor* aList );
/** /**
* Function GetDescriptorFromHotkey * Function GetDescriptorFromHotkey
* Return a Ki_HotkeyInfo * pointer fron a key code for OnHotKey() function * Return a EDA_HOTKEY * pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys * @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a Ki_HotkeyInfo list of commands * @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List * @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/ */
Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ); EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList );
/** /**
* Function ReadHotkeyConfig * Function ReadHotkeyConfig
...@@ -161,11 +160,9 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ); ...@@ -161,11 +160,9 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList );
* @param Appname = the value of the app's m_FrameName * @param Appname = the value of the app's m_FrameName
* @param aDescList = the hotkey data * @param aDescList = the hotkey data
*/ */
void ReadHotkeyConfig( const wxString& Appname, void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
void ParseHotkeyConfig( const wxString& data, void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
// common hotkeys event id // common hotkeys event id
......
...@@ -44,8 +44,7 @@ public: ...@@ -44,8 +44,7 @@ public:
int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch) int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch)
int m_DisplayModText; // How to display module texts (line/ filled / sketch) int m_DisplayModText; // How to display module texts (line/ filled / sketch)
bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, bool m_DisplayPcbTrackFill; // FALSE : tracks are show in sketch mode, TRUE = filled.
* TRUE = filled */
EDA_UNITS_T m_UserGridUnit; EDA_UNITS_T m_UserGridUnit;
wxRealPoint m_UserGridSize; wxRealPoint m_UserGridSize;
...@@ -160,22 +159,12 @@ public: ...@@ -160,22 +159,12 @@ public:
/** /**
* Function CursorGoto * Function CursorGoto
* positions the cursor at a given coordinate and reframes the drawing if * positions the cursor at a given coordinate and reframes the drawing if the
*the
* requested point is out of view. * requested point is out of view.
* @param aPos The point to go to. * @param aPos The point to go to.
*/ */
void CursorGoto( const wxPoint& aPos ); void CursorGoto( const wxPoint& aPos );
void place_marqueur( wxDC* DC,
const wxPoint& pos,
char* pt_bitmap,
int DrawMode,
int color,
int type );
MODULE* Copie_Module( MODULE* module );
/** /**
* Function Save_Module_In_Library * Function Save_Module_In_Library
* Save in an existing library a given footprint * Save in an existing library a given footprint
...@@ -211,7 +200,7 @@ public: ...@@ -211,7 +200,7 @@ public:
* do not forget to call this basic OnModify function to update info * do not forget to call this basic OnModify function to update info
* in derived OnModify functions * in derived OnModify functions
*/ */
virtual void OnModify( ); virtual void OnModify();
// Modules (footprints) // Modules (footprints)
/** /**
...@@ -424,20 +413,33 @@ public: ...@@ -424,20 +413,33 @@ public:
* Return true if OK, false if the file is not created (or has a problem) * Return true if OK, false if the file is not created (or has a problem)
*/ */
bool Genere_GERBER( const wxString& FullFileName, /**
int Layer, * Function ExportToGerberFile
bool PlotOriginIsAuxAxis, * create one output files one per board layer in the RS274X format.
GRTraceMode trace_mode ); * <p>
bool Genere_HPGL( const wxString& FullFileName, * The units are in inches and in the format 3.4 with the leading zeros omitted.
int Layer, * Coordinates are absolute value. The 3.4 format is used because the native PCBNew
GRTraceMode trace_mode ); * units are 1/10000 inch.
bool Genere_PS( const wxString& FullFileName, * </p>
int Layer, */
bool useA4, bool ExportToGerberFile( const wxString& aFullFileName,
GRTraceMode trace_mode ); int aLayer,
bool Genere_DXF( const wxString& FullFileName, bool aPlotOriginIsAuxAxis,
int Layer, GRTraceMode aTraceMode );
GRTraceMode trace_mode );
bool ExportToHpglFile( const wxString& aFullFileName,
int aLayer,
GRTraceMode aTraceMode );
bool ExportToPostScriptFile( const wxString& aFullFileName,
int aLayer,
bool aUseA4,
GRTraceMode aTraceMode );
bool ExportToDxfFile( const wxString& aFullFileName,
int aLayer,
GRTraceMode aTraceMode );
void Plot_Layer( PLOTTER* plotter, void Plot_Layer( PLOTTER* plotter,
int Layer, int Layer,
GRTraceMode trace_mode ); GRTraceMode trace_mode );
......
...@@ -173,16 +173,21 @@ public: ...@@ -173,16 +173,21 @@ public:
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
/** /**
* Function RecordMacros * Function RecordMacros.
* record sequence hotkeys and cursor position to macros. * records sequence of hotkeys and cursor positions to a macro.
* @param aDC = current device context
* @param aNumber The current number macros.
*/ */
void RecordMacros(wxDC* aDC, int aNumber); void RecordMacros( wxDC* aDC, int aNumber );
/** /**
* Function CallMacros * Function CallMacros
* play hotkeys and cursor position from recorded macros. * play hotkeys and cursor position from a recorded macro.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/ */
void CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber); void CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber );
void SaveMacros(); void SaveMacros();
......
...@@ -43,7 +43,6 @@ class BASE_SCREEN; ...@@ -43,7 +43,6 @@ class BASE_SCREEN;
class EDA_TOOLBAR; class EDA_TOOLBAR;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class Ki_HotkeyInfo;
class PLOTTER; class PLOTTER;
enum id_librarytype { enum id_librarytype {
...@@ -139,7 +138,7 @@ public: ...@@ -139,7 +138,7 @@ public:
* Read configuration data and fill the current hotkey list with hotkeys * Read configuration data and fill the current hotkey list with hotkeys
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); int ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function WriteHotkeyConfig * Function WriteHotkeyConfig
...@@ -152,8 +151,7 @@ public: ...@@ -152,8 +151,7 @@ public:
* the output format is: shortcut "key" "function" * the output format is: shortcut "key" "function"
* lines starting with # are comments * lines starting with # are comments
*/ */
int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL);
wxString* aFullFileName = NULL);
/** /**
* Function ReadHotkeyConfigFile * Function ReadHotkeyConfigFile
...@@ -162,22 +160,21 @@ public: ...@@ -162,22 +160,21 @@ public:
* @param aFilename = file name to read. * @param aFilename = file name to read.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
int ReadHotkeyConfigFile( const wxString& aFilename, int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList );
struct Ki_HotkeyInfoSectionDescriptor* aDescList );
/** /**
* Function ImportHotkeyConfigFromFile * Function ImportHotkeyConfigFromFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); void ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function ExportHotkeyConfigToFile * Function ExportHotkeyConfigToFile
* Prompt the user for an old hotkey file to read, and read it. * Prompt the user for an old hotkey file to read, and read it.
* @param aDescList = current hotkey list descr. to initialize. * @param aDescList = current hotkey list descr. to initialize.
*/ */
void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList );
/** /**
* Function SetLanguage * Function SetLanguage
...@@ -284,7 +281,7 @@ public: ...@@ -284,7 +281,7 @@ public:
wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis
protected: protected:
Ki_HotkeyInfoSectionDescriptor * m_HotkeysZoomAndGridList; EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId; int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color int m_GridColor; // Grid color
......
/***************/ /**
/* hotkeys.cpp */ * @file pcbnew/hotkeys.cpp
/***************/ */
#include "fctsys.h" #include "fctsys.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -10,16 +10,19 @@ ...@@ -10,16 +10,19 @@
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION.
* add a new Ki_HotkeyInfo entry like: * add a new EDA_HOTKEY entry like:
* static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value);
* "Command Label" is the name used in hotkey list display, and the identifier in the hotkey list file * "Command Label" is the name used in hotkey list display, and the identifier in the
* MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in OnHotKey() function. * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch
* default key value is the default hotkey for this command. Can be overrided by the user hotkey list file * in OnHotKey() function.
* add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) * default key value is the default hotkey for this command. Can be overridden by the user
* hotkey list file
* add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the
* s_module_edit_Hotkey_List list)
* Add the new code in the switch in OnHotKey() function. * Add the new code in the switch in OnHotKey() function.
* Note: when the variable itemCurrentlyEdited is true, an item is currently edited. * Note: when the variable itemCurrentlyEdited is true, an item is currently edited.
* This can be useful if the new function cannot be executed while an item is currently being edited * This can be useful if the new function cannot be executed while an item is currently
* ( For example, one cannot start a new wire when a component is moving.) * being edited ( For example, one cannot start a new wire when a component is moving.)
* *
* Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX) * Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX)
* is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp) * is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp)
...@@ -28,173 +31,167 @@ ...@@ -28,173 +31,167 @@
/* local variables */ /* local variables */
/* Hotkey list: */ /* Hotkey list: */
static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ), static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ),
HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN ); HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN );
static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ), static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ),
HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP ); HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP );
static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ), static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ),
HK_SWITCH_LAYER_TO_INNER1, WXK_F5 ); HK_SWITCH_LAYER_TO_INNER1, WXK_F5 );
static Ki_HotkeyInfo HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ), static EDA_HOTKEY HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ),
HK_SWITCH_LAYER_TO_INNER2, WXK_F6 ); HK_SWITCH_LAYER_TO_INNER2, WXK_F6 );
static Ki_HotkeyInfo HkSwitch2InnerLayer3( wxT( "Switch to Inner layer 3" ), static EDA_HOTKEY HkSwitch2InnerLayer3( wxT( "Switch to Inner layer 3" ),
HK_SWITCH_LAYER_TO_INNER3, WXK_F7 ); HK_SWITCH_LAYER_TO_INNER3, WXK_F7 );
static Ki_HotkeyInfo HkSwitch2InnerLayer4( wxT( "Switch to Inner layer 4" ), static EDA_HOTKEY HkSwitch2InnerLayer4( wxT( "Switch to Inner layer 4" ),
HK_SWITCH_LAYER_TO_INNER4, WXK_F8 ); HK_SWITCH_LAYER_TO_INNER4, WXK_F8 );
static Ki_HotkeyInfo HkSwitch2InnerLayer5( wxT( "Switch to Inner layer 5" ), static EDA_HOTKEY HkSwitch2InnerLayer5( wxT( "Switch to Inner layer 5" ),
HK_SWITCH_LAYER_TO_INNER5, WXK_F9 ); HK_SWITCH_LAYER_TO_INNER5, WXK_F9 );
static Ki_HotkeyInfo HkSwitch2InnerLayer6( wxT( "Switch to Inner layer 6" ), static EDA_HOTKEY HkSwitch2InnerLayer6( wxT( "Switch to Inner layer 6" ),
HK_SWITCH_LAYER_TO_INNER6, WXK_F10 ); HK_SWITCH_LAYER_TO_INNER6, WXK_F10 );
static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ),
HK_SWITCH_LAYER_TO_NEXT, '+' ); HK_SWITCH_LAYER_TO_NEXT, '+' );
static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ),
"Switch to Previous Layer" ),
HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); HK_SWITCH_LAYER_TO_PREVIOUS, '-' );
static Ki_HotkeyInfo HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' static EDA_HOTKEY HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL );
+ GR_KB_CTRL ); static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL );
static Ki_HotkeyInfo HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL );
+ GR_KB_CTRL ); static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK );
static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
+ GR_KB_CTRL ); static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static Ki_HotkeyInfo HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ),
WXK_BACK );
static Ki_HotkeyInfo HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' );
static Ki_HotkeyInfo HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' );
static Ki_HotkeyInfo HkSwitchTrackPosture( wxT( "Switch Track Posture" ),
HK_SWITCH_TRACK_POSTURE, '/' ); HK_SWITCH_TRACK_POSTURE, '/' );
static Ki_HotkeyInfo HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ),
HK_DRAG_TRACK_KEEP_SLOPE, 'D' ); HK_DRAG_TRACK_KEEP_SLOPE, 'D' );
static Ki_HotkeyInfo HkPlaceItem( wxT( "Place Item" ), static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' );
HK_PLACE_ITEM, 'P' ); static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL );
static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END );
+ GR_KB_CTRL ); static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' );
static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); static EDA_HOTKEY HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' );
static Ki_HotkeyInfo HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' );
static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
'F' ); static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' );
static Ki_HotkeyInfo HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
static Ki_HotkeyInfo HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' );
static Ki_HotkeyInfo HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM,
'G' );
static Ki_HotkeyInfo HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ),
HK_GET_AND_MOVE_FOOTPRINT, 'T' ); HK_GET_AND_MOVE_FOOTPRINT, 'T' );
static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ),
HK_LOCK_UNLOCK_FOOTPRINT, 'L' ); HK_LOCK_UNLOCK_FOOTPRINT, 'L' );
static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE ); static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE );
static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ),
HK_RESET_LOCAL_COORD, ' ' ); HK_RESET_LOCAL_COORD, ' ' );
/* Fit on Screen */ /* Fit on Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
#else #else
static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' ); static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, GR_KB_CTRL + '0' );
#endif #endif
static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 );
/* Refresh Screen */ /* Refresh Screen */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 );
#else #else
static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' ); static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, GR_KB_CTRL + 'R' );
#endif #endif
/* Zoom In */ /* Zoom In */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 );
#else #else
static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' ); static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, GR_KB_CTRL + '+' );
#endif #endif
/* Zoom Out */ /* Zoom Out */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
#else #else
static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' ); static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif #endif
static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' );
/* Undo */ /* Undo */
static Ki_HotkeyInfo HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', static EDA_HOTKEY HkUndo( wxT( "Undo" ), HK_UNDO, GR_KB_CTRL + 'Z', (int) wxID_UNDO );
(int) wxID_UNDO );
/* Redo */ /* Redo */
#if !defined( __WXMAC__ ) #if !defined( __WXMAC__ )
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, GR_KB_CTRL + 'Y', (int) wxID_REDO );
(int) wxID_REDO );
#else #else
static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO,
GR_KB_SHIFT + GR_KB_CTRL + 'Z', GR_KB_SHIFT + GR_KB_CTRL + 'Z',
(int) wxID_REDO ); (int) wxID_REDO );
#endif #endif
static Ki_HotkeyInfo HkSwitchTrackWidthToNext( wxT( "Switch Track Width To Next" ), HK_SWITCH_TRACK_WIDTH_TO_NEXT, 'W' ); static EDA_HOTKEY HkSwitchTrackWidthToNext( wxT( "Switch Track Width To Next" ),
HK_SWITCH_TRACK_WIDTH_TO_NEXT, 'W' );
static Ki_HotkeyInfo HkSwitchTrackWidthToPrevious( wxT( "Switch Track Width To Previous" ), HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS, 'W' static EDA_HOTKEY HkSwitchTrackWidthToPrevious( wxT( "Switch Track Width To Previous" ),
HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS, 'W'
+ GR_KB_CTRL ); + GR_KB_CTRL );
static Ki_HotkeyInfo HkSwitchGridToFastGrid1( wxT( "Switch Grid To Fast Grid1" ), HK_SWITCH_GRID_TO_FASTGRID1, GR_KB_ALT + '1' ); static EDA_HOTKEY HkSwitchGridToFastGrid1( wxT( "Switch Grid To Fast Grid1" ),
HK_SWITCH_GRID_TO_FASTGRID1, GR_KB_ALT + '1' );
static Ki_HotkeyInfo HkSwitchGridToFastGrid2( wxT( "Switch Grid To Fast Grid2" ), HK_SWITCH_GRID_TO_FASTGRID2, GR_KB_ALT + '2' ); static EDA_HOTKEY HkSwitchGridToFastGrid2( wxT( "Switch Grid To Fast Grid2" ),
HK_SWITCH_GRID_TO_FASTGRID2, GR_KB_ALT + '2' );
static Ki_HotkeyInfo HkSwitchGridToNext( wxT( "Switch Grid To Next" ), HK_SWITCH_GRID_TO_NEXT, '`' ); static EDA_HOTKEY HkSwitchGridToNext( wxT( "Switch Grid To Next" ),
HK_SWITCH_GRID_TO_NEXT, '`' );
static Ki_HotkeyInfo HkSwitchGridToPrevious( wxT( "Switch Grid To Previous" ), HK_SWITCH_GRID_TO_PREVIOUS, '`' static EDA_HOTKEY HkSwitchGridToPrevious( wxT( "Switch Grid To Previous" ),
+ GR_KB_CTRL ); HK_SWITCH_GRID_TO_PREVIOUS, '`' + GR_KB_CTRL );
static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL );
+ GR_KB_CTRL ); static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ),
static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ),
HK_SWITCH_TRACK_DISPLAY_MODE, 'K' ); HK_SWITCH_TRACK_DISPLAY_MODE, 'K' );
static Ki_HotkeyInfo HkAddModule( wxT( "Add Module" ), HK_ADD_MODULE, 'O' ); static EDA_HOTKEY HkAddModule( wxT( "Add Module" ), HK_ADD_MODULE, 'O' );
/* Record and play macros */ /* Record and play macros */
static Ki_HotkeyInfo HkRecordMacros0( wxT( "Record Macro 0" ), HK_RECORD_MACROS_0, GR_KB_CTRL+'0' ); static EDA_HOTKEY HkRecordMacros0( wxT( "Record Macro 0" ), HK_RECORD_MACROS_0, GR_KB_CTRL+'0' );
static EDA_HOTKEY HkCallMacros0( wxT( "Call Macro 0" ), HK_CALL_MACROS_0, '0' );
static Ki_HotkeyInfo HkCallMacros0( wxT( "Call Macro 0" ), HK_CALL_MACROS_0, '0' ); static EDA_HOTKEY HkRecordMacros1( wxT( "Record Macro 1" ), HK_RECORD_MACROS_1, GR_KB_CTRL+'1' );
static Ki_HotkeyInfo HkRecordMacros1( wxT( "Record Macro 1" ), HK_RECORD_MACROS_1, GR_KB_CTRL+'1' ); static EDA_HOTKEY HkCallMacros1( wxT( "Call Macro 1" ), HK_CALL_MACROS_1, '1' );
static Ki_HotkeyInfo HkCallMacros1( wxT( "Call Macro 1" ), HK_CALL_MACROS_1, '1' ); static EDA_HOTKEY HkRecordMacros2( wxT( "Record Macro 2" ), HK_RECORD_MACROS_2, GR_KB_CTRL+'2' );
static Ki_HotkeyInfo HkRecordMacros2( wxT( "Record Macro 2" ), HK_RECORD_MACROS_2, GR_KB_CTRL+'2' ); static EDA_HOTKEY HkCallMacros2( wxT( "Call Macro 2" ), HK_CALL_MACROS_2, '2' );
static Ki_HotkeyInfo HkCallMacros2( wxT( "Call Macro 2" ), HK_CALL_MACROS_2, '2' ); static EDA_HOTKEY HkRecordMacros3( wxT( "Record Macro 3" ), HK_RECORD_MACROS_3, GR_KB_CTRL+'3' );
static Ki_HotkeyInfo HkRecordMacros3( wxT( "Record Macro 3" ), HK_RECORD_MACROS_3, GR_KB_CTRL+'3' ); static EDA_HOTKEY HkCallMacros3( wxT( "Call Macro 3" ), HK_CALL_MACROS_3, '3' );
static Ki_HotkeyInfo HkCallMacros3( wxT( "Call Macro 3" ), HK_CALL_MACROS_3, '3' ); static EDA_HOTKEY HkRecordMacros4( wxT( "Record Macro 4" ), HK_RECORD_MACROS_4, GR_KB_CTRL+'4' );
static Ki_HotkeyInfo HkRecordMacros4( wxT( "Record Macro 4" ), HK_RECORD_MACROS_4, GR_KB_CTRL+'4' ); static EDA_HOTKEY HkCallMacros4( wxT( "Call Macro 4" ), HK_CALL_MACROS_4, '4' );
static Ki_HotkeyInfo HkCallMacros4( wxT( "Call Macro 4" ), HK_CALL_MACROS_4, '4' ); static EDA_HOTKEY HkRecordMacros5( wxT( "Record Macro 5" ), HK_RECORD_MACROS_5, GR_KB_CTRL+'5' );
static Ki_HotkeyInfo HkRecordMacros5( wxT( "Record Macro 5" ), HK_RECORD_MACROS_5, GR_KB_CTRL+'5' ); static EDA_HOTKEY HkCallMacros5( wxT( "Call Macro 5" ), HK_CALL_MACROS_5, '5' );
static Ki_HotkeyInfo HkCallMacros5( wxT( "Call Macro 5" ), HK_CALL_MACROS_5, '5' ); static EDA_HOTKEY HkRecordMacros6( wxT( "Record Macro 6" ), HK_RECORD_MACROS_6, GR_KB_CTRL+'6' );
static Ki_HotkeyInfo HkRecordMacros6( wxT( "Record Macro 6" ), HK_RECORD_MACROS_6, GR_KB_CTRL+'6' ); static EDA_HOTKEY HkCallMacros6( wxT( "Call Macro 6" ), HK_CALL_MACROS_6, '6' );
static Ki_HotkeyInfo HkCallMacros6( wxT( "Call Macro 6" ), HK_CALL_MACROS_6, '6' ); static EDA_HOTKEY HkRecordMacros7( wxT( "Record Macro 7" ), HK_RECORD_MACROS_7, GR_KB_CTRL+'7' );
static Ki_HotkeyInfo HkRecordMacros7( wxT( "Record Macro 7" ), HK_RECORD_MACROS_7, GR_KB_CTRL+'7' ); static EDA_HOTKEY HkCallMacros7( wxT( "Call Macro 7" ), HK_CALL_MACROS_7, '7' );
static Ki_HotkeyInfo HkCallMacros7( wxT( "Call Macro 7" ), HK_CALL_MACROS_7, '7' ); static EDA_HOTKEY HkRecordMacros8( wxT( "Record Macro 8" ), HK_RECORD_MACROS_8, GR_KB_CTRL+'8' );
static Ki_HotkeyInfo HkRecordMacros8( wxT( "Record Macro 8" ), HK_RECORD_MACROS_8, GR_KB_CTRL+'8' ); static EDA_HOTKEY HkCallMacros8( wxT( "Call Macro 8" ), HK_CALL_MACROS_8, '8' );
static Ki_HotkeyInfo HkCallMacros8( wxT( "Call Macro 8" ), HK_CALL_MACROS_8, '8' ); static EDA_HOTKEY HkRecordMacros9( wxT( "Record Macro 9" ), HK_RECORD_MACROS_9, GR_KB_CTRL+'9' );
static Ki_HotkeyInfo HkRecordMacros9( wxT( "Record Macro 9" ), HK_RECORD_MACROS_9, GR_KB_CTRL+'9' ); static EDA_HOTKEY HkCallMacros9( wxT( "Call Macro 9" ), HK_CALL_MACROS_9, '9' );
static Ki_HotkeyInfo HkCallMacros9( wxT( "Call Macro 9" ), HK_CALL_MACROS_9, '9' );
// List of common hotkey descriptors // List of common hotkey descriptors
Ki_HotkeyInfo* common_Hotkey_List[] = EDA_HOTKEY* common_Hotkey_List[] =
{ {
&HkHelp, &HkZoomIn, &HkZoomOut, &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto,
...@@ -204,7 +201,7 @@ Ki_HotkeyInfo* common_Hotkey_List[] = ...@@ -204,7 +201,7 @@ Ki_HotkeyInfo* common_Hotkey_List[] =
}; };
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
Ki_HotkeyInfo* board_edit_Hotkey_List[] = EDA_HOTKEY* board_edit_Hotkey_List[] =
{ {
&HkTrackDisplayMode, &HkDelete, &HkTrackDisplayMode, &HkDelete,
&HkBackspace, &HkBackspace,
...@@ -231,7 +228,7 @@ Ki_HotkeyInfo* board_edit_Hotkey_List[] = ...@@ -231,7 +228,7 @@ Ki_HotkeyInfo* board_edit_Hotkey_List[] =
}; };
// List of hotkey descriptors for the module editor // List of hotkey descriptors for the module editor
Ki_HotkeyInfo* module_edit_Hotkey_List[] = { EDA_HOTKEY* module_edit_Hotkey_List[] = {
&HkMoveItem, &HkRotateItem, &HkEditBoardItem, &HkMoveItem, &HkRotateItem, &HkEditBoardItem,
&HkDelete, &HkDelete,
NULL NULL
...@@ -239,38 +236,25 @@ Ki_HotkeyInfo* module_edit_Hotkey_List[] = { ...@@ -239,38 +236,25 @@ Ki_HotkeyInfo* module_edit_Hotkey_List[] = {
// list of sections and corresponding hotkey list for pcbnew // list of sections and corresponding hotkey list for pcbnew
// (used to create an hotkey config file, and edit hotkeys ) // (used to create an hotkey config file, and edit hotkeys )
struct Ki_HotkeyInfoSectionDescriptor g_Pcbnew_Editor_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[] = {
{ { { &g_CommonSectionTag, common_Hotkey_List, L"Common keys" },
&g_CommonSectionTag, common_Hotkey_List, L"Common keys" { &g_BoardEditorSectionTag, board_edit_Hotkey_List, L"Board editor keys" },
}, { &g_ModuleEditSectionTag, module_edit_Hotkey_List, L"Footprint editor keys" },
{ { NULL, NULL, NULL }
&g_BoardEditorSectionTag, board_edit_Hotkey_List, L"Board editor keys" };
},{
&g_ModuleEditSectionTag, module_edit_Hotkey_List, L"Footprint editor keys"
},{
NULL, NULL, NULL
} };
// list of sections and corresponding hotkey list for the board editor // list of sections and corresponding hotkey list for the board editor
// (used to list current hotkeys in the board editor) // (used to list current hotkeys in the board editor)
struct Ki_HotkeyInfoSectionDescriptor g_Board_Editor_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[] = {
{ { { &g_CommonSectionTag, common_Hotkey_List, NULL },
&g_CommonSectionTag, common_Hotkey_List, { &g_BoardEditorSectionTag, board_edit_Hotkey_List, NULL },
NULL { NULL, NULL, NULL }
},{ };
&g_BoardEditorSectionTag, board_edit_Hotkey_List, NULL
},{
NULL, NULL, NULL
} };
// list of sections and corresponding hotkey list for the footprint editor // list of sections and corresponding hotkey list for the footprint editor
// (used to list current hotkeys in the module editor) // (used to list current hotkeys in the module editor)
struct Ki_HotkeyInfoSectionDescriptor g_Module_Editor_Hokeys_Descr[] = struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = {
{ { { &g_CommonSectionTag, common_Hotkey_List, NULL },
&g_CommonSectionTag, common_Hotkey_List, NULL { &g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL },
},{ { NULL, NULL, NULL }
&g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL };
},{
NULL, NULL, NULL
} };
...@@ -79,24 +79,26 @@ enum hotkey_id_commnand { ...@@ -79,24 +79,26 @@ enum hotkey_id_commnand {
HK_CALL_MACROS_9 HK_CALL_MACROS_9
}; };
// Full list of hotkey descriptors for borad editor and footprint editor // Full list of hotkey descriptors for board editor and footprint editor
extern struct Ki_HotkeyInfoSectionDescriptor g_Pcbnew_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the board editor only // List of hotkey descriptors for the board editor only
extern struct Ki_HotkeyInfoSectionDescriptor g_Board_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[];
// List of hotkey descriptors for the footprint editor only // List of hotkey descriptors for the footprint editor only
extern struct Ki_HotkeyInfoSectionDescriptor g_Module_Editor_Hokeys_Descr[]; extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[];
// List of common hotkey descriptors // List of common hotkey descriptors
// used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp // used in hotkeys_board_editor.cpp and hotkeys_module_editor.cpp
extern Ki_HotkeyInfo* common_Hotkey_List[]; extern EDA_HOTKEY* common_Hotkey_List[];
// List of hotkey descriptors for pcbnew // List of hotkey descriptors for pcbnew
// used in hotkeys_board_editor.cpp // used in hotkeys_board_editor.cpp
extern Ki_HotkeyInfo* board_edit_Hotkey_List[]; extern EDA_HOTKEY* board_edit_Hotkey_List[];
// List of hotkey descriptors for the module editor // List of hotkey descriptors for the module editor
// used in hotkeys_module_editor.cpp // used in hotkeys_module_editor.cpp
extern Ki_HotkeyInfo* module_edit_Hotkey_List[]; extern EDA_HOTKEY* module_edit_Hotkey_List[];
#endif /* _PCBNEW_HOTKEYS_H_ */ #endif /* _PCBNEW_HOTKEYS_H_ */
...@@ -22,52 +22,39 @@ ...@@ -22,52 +22,39 @@
*/ */
/**
* Function RecordMacros.
* Record sequence hotkeys and cursor position to macros.
* @param aDC = current device context
* @param aNumber The current number macros.
*/
void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber) void PCB_EDIT_FRAME::RecordMacros(wxDC* aDC, int aNumber)
{ {
assert(aNumber >= 0); assert( aNumber >= 0 );
assert(aNumber < 10); assert( aNumber < 10 );
wxString msg, tmp; wxString msg, tmp;
if( m_RecordingMacros < 0 ) if( m_RecordingMacros < 0 )
{ {
m_RecordingMacros = aNumber; m_RecordingMacros = aNumber;
m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition(false); m_Macros[aNumber].m_StartPosition = GetScreen()->GetCrossHairPosition( false );
m_Macros[aNumber].m_Record.clear(); m_Macros[aNumber].m_Record.clear();
msg.Printf( wxT("%s %d"), _( "Recording macros" ), aNumber); msg.Printf( wxT( "%s %d" ), _( "Recording macros" ), aNumber );
SetStatusText(msg); SetStatusText( msg );
} }
else else
{ {
m_RecordingMacros = -1; m_RecordingMacros = -1;
msg.Printf( wxT("%s %d %s"), _( "Macros" ), aNumber, _( "recorded" )); msg.Printf( wxT( "%s %d %s" ), _( "Macros" ), aNumber, _( "recorded" ) );
SetStatusText(msg); SetStatusText( msg );
} }
} }
/** void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber )
* Function CallMacros
* play hotkeys and cursor position from recorded macros.
* @param aDC = current device context
* @param aPosition The current cursor position in logical (drawing) units.
* @param aNumber The current number macros.
*/
void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber)
{ {
PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = GetScreen();
wxPoint tPosition; wxPoint tPosition;
wxString msg; wxString msg;
msg.Printf( wxT("%s %d"), _( "Call macros"), aNumber); msg.Printf( wxT( "%s %d" ), _( "Call macros" ), aNumber );
SetStatusText( msg ); SetStatusText( msg );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED );
...@@ -97,15 +84,6 @@ void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber ...@@ -97,15 +84,6 @@ void PCB_EDIT_FRAME::CallMacros(wxDC* aDC, const wxPoint& aPosition, int aNumber
} }
/**
* Function OnHotKey.
* ** Commands are case insensitive **
* Some commands are relatives to the item under the mouse cursor
* @param aDC = current device context
* @param aHotkeyCode = hotkey code (ascii or wxWidget code for special keys)
* @param aPosition The current cursor position in logical (drawing) units.
* @param aItem = NULL or pointer on a EDA_ITEM under the mouse cursor
*/
void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition, void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosition,
EDA_ITEM* aItem ) EDA_ITEM* aItem )
{ {
...@@ -124,7 +102,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -124,7 +102,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') ) if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') )
aHotkeyCode += 'A' - 'a'; aHotkeyCode += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List );
...@@ -646,18 +624,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit ...@@ -646,18 +624,6 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
} }
/**
* Function OnHotkeyDeleteItem
* Delete the item found under the mouse cursor
* Depending on the current active tool::
* Tool track
* if a track is in progress: Delete the last segment
* else delete the entire track
* Tool module (footprint):
* Delete the module.
* @param aDC = current device context
* @return true if an item was deleted
*/
bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC ) bool PCB_EDIT_FRAME::OnHotkeyDeleteItem( wxDC* aDC )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
...@@ -823,14 +789,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) ...@@ -823,14 +789,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand )
return false; return false;
} }
/**
* Function OnHotkeyMoveItem
* Move or drag the item (footprint, track, text .. ) found under the mouse cursor
* An item can be moved (or dragged) only if there is no item currently edited
* Only a footprint, a pad or a track can be dragged
* @param aIdCommand = the hotkey command id
* @return true if an item was moved
*/
bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand ) bool PCB_EDIT_FRAME::OnHotkeyMoveItem( int aIdCommand )
{ {
BOARD_ITEM* item = GetCurItem(); BOARD_ITEM* item = GetCurItem();
......
/*****************************/ /**
/* hotkeys_module_editor.cpp */ * @file hotkeys_module_editor.cpp
/*****************************/ */
#include "fctsys.h" #include "fctsys.h"
#include "pcbnew.h" #include "pcbnew.h"
...@@ -36,7 +36,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos ...@@ -36,7 +36,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos
if( (aHotKey >= 'a') && (aHotKey <= 'z') ) if( (aHotKey >= 'a') && (aHotKey <= 'z') )
aHotKey += 'A' - 'a'; aHotKey += 'A' - 'a';
Ki_HotkeyInfo* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List ); EDA_HOTKEY* HK_Descr = GetDescriptorFromHotkey( aHotKey, common_Hotkey_List );
if( HK_Descr == NULL ) if( HK_Descr == NULL )
HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List ); HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List );
......
...@@ -205,38 +205,6 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -205,38 +205,6 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
} }
/**
* Function Copie_Module
* Copy an existing footprint. The new footprint is added in module list
* @param module = footprint to copy
* @return a pointer on the new footprint (the copy of the existing footprint)
*/
MODULE* PCB_BASE_FRAME::Copie_Module( MODULE* module )
{
MODULE* newmodule;
if( module == NULL )
return NULL;
OnModify();
/* Duplicate module */
GetBoard()->m_Status_Pcb = 0;
newmodule = new MODULE( GetBoard() );
newmodule->Copy( module );
GetBoard()->Add( newmodule, ADD_APPEND );
newmodule->m_Flags = IS_NEW;
GetBoard()->m_NetInfo->BuildListOfNets();
newmodule->DisplayInfo( this );
GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
return newmodule;
}
/* Redraw the footprint when moving the mouse. /* Redraw the footprint when moving the mouse.
*/ */
void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
......
/** /**
* @file pcbnew.cpp * @file pcbnew.cpp
* @file PCBNEW: main program. * @brief PCBNEW: main program.
*/ */
#include "fctsys.h" #include "fctsys.h"
......
...@@ -49,6 +49,7 @@ static bool setDouble( double* aDouble, double aValue, double aMin, double aMax ...@@ -49,6 +49,7 @@ static bool setDouble( double* aDouble, double aValue, double aMin, double aMax
return true; return true;
} }
/*******************************/ /*******************************/
/* Dialog box for plot control */ /* Dialog box for plot control */
/*******************************/ /*******************************/
...@@ -63,8 +64,10 @@ private: ...@@ -63,8 +64,10 @@ private:
double m_YScaleAdjust; double m_YScaleAdjust;
static wxPoint prevPosition; // Dialog position & size static wxPoint prevPosition; // Dialog position & size
static wxSize prevSize; static wxSize prevSize;
public: public:
DIALOG_PLOT( PCB_EDIT_FRAME* parent ); DIALOG_PLOT( PCB_EDIT_FRAME* parent );
private: private:
void Init_Dialog(); void Init_Dialog();
void Plot( wxCommandEvent& event ); void Plot( wxCommandEvent& event );
...@@ -77,6 +80,7 @@ private: ...@@ -77,6 +80,7 @@ private:
void CreateDrillFile( wxCommandEvent& event ); void CreateDrillFile( wxCommandEvent& event );
}; };
wxPoint DIALOG_PLOT::prevPosition( -1, -1 ); wxPoint DIALOG_PLOT::prevPosition( -1, -1 );
wxSize DIALOG_PLOT::prevSize; wxSize DIALOG_PLOT::prevSize;
...@@ -95,8 +99,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) : ...@@ -95,8 +99,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) :
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
if( prevPosition.x != -1 ) if( prevPosition.x != -1 )
SetSize( prevPosition.x, prevPosition.y, SetSize( prevPosition.x, prevPosition.y, prevSize.x, prevSize.y );
prevSize.x, prevSize.y );
else else
Center(); Center();
} }
...@@ -153,6 +156,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -153,6 +156,7 @@ void DIALOG_PLOT::Init_Dialog()
// (Front or Top to Back or Bottom) // (Front or Top to Back or Bottom)
DECLARE_LAYERS_ORDER_LIST( layersOrder ); DECLARE_LAYERS_ORDER_LIST( layersOrder );
int layerIndex, checkIndex, layer; int layerIndex, checkIndex, layer;
for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ ) for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ )
{ {
layer = layersOrder[layerIndex]; layer = layersOrder[layerIndex];
...@@ -265,6 +269,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -265,6 +269,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
// to preselect it when opening the dialog. // to preselect it when opening the dialog.
wxFileName fn( m_outputDirectoryName->GetValue() ); wxFileName fn( m_outputDirectoryName->GetValue() );
wxString path; wxString path;
if( fn.IsRelative() ) if( fn.IsRelative() )
path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue(); path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
else else
...@@ -495,6 +500,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -495,6 +500,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "X scale constrained!\n" ) ); msg.Printf( wxT( "X scale constrained!\n" ) );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_Config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust ); m_Config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust );
// Y scale // Y scale
...@@ -508,6 +514,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -508,6 +514,7 @@ void DIALOG_PLOT::applyPlotSettings()
msg.Printf( wxT( "Y scale constrained!\n" ) ); msg.Printf( wxT( "Y scale constrained!\n" ) );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
m_Config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust ); m_Config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust );
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
...@@ -516,13 +523,14 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -516,13 +523,14 @@ void DIALOG_PLOT::applyPlotSettings()
long selectedLayers = 0; long selectedLayers = 0;
unsigned int i; unsigned int i;
for( i = 0; i < layerList.size(); i++ ) for( i = 0; i < layerList.size(); i++ )
{ {
if( m_layerCheckListBox->IsChecked( i ) ) if( m_layerCheckListBox->IsChecked( i ) )
selectedLayers |= (1 << layerList[i]); selectedLayers |= (1 << layerList[i]);
} }
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.SetLayerSelection( selectedLayers );
tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue(); tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue();
tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() ); tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() );
...@@ -581,6 +589,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -581,6 +589,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
g_PcbPlotOptions.m_AutoScale = false; g_PcbPlotOptions.m_AutoScale = false;
g_PcbPlotOptions.m_PlotScale = 1; g_PcbPlotOptions.m_PlotScale = 1;
switch( g_PcbPlotOptions.GetScaleSelection() ) switch( g_PcbPlotOptions.GetScaleSelection() )
{ {
default: default:
...@@ -610,6 +619,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -610,6 +619,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
*/ */
if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 ) if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustX = m_XScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustX = m_XScaleAdjust;
if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 ) if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust;
...@@ -638,14 +648,17 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -638,14 +648,17 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
if( g_PcbPlotOptions.m_PlotScale < MIN_SCALE ) if( g_PcbPlotOptions.m_PlotScale < MIN_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very small value" ) ); _( "Warning: Scale option set to a very small value" ) );
if( g_PcbPlotOptions.m_PlotScale > MAX_SCALE ) if( g_PcbPlotOptions.m_PlotScale > MAX_SCALE )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) ); _( "Warning: Scale option set to a very large value" ) );
long layerMask = 1; long layerMask = 1;
for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 ) for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 )
{ {
bool success = false; bool success = false;
if( g_PcbPlotOptions.GetLayerSelection() & layerMask ) if( g_PcbPlotOptions.GetLayerSelection() & layerMask )
{ {
fn = m_Parent->GetScreen()->GetFileName(); fn = m_Parent->GetScreen()->GetFileName();
...@@ -742,42 +755,43 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -742,42 +755,43 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
switch( g_PcbPlotOptions.GetPlotFormat() ) switch( g_PcbPlotOptions.GetPlotFormat() )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
success = m_Parent->Genere_PS( fn.GetFullPath(), layer, success = m_Parent->ExportToPostScriptFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.GetPsA4Output(), g_PcbPlotOptions.GetPsA4Output(),
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_GERBER: case PLOT_FORMAT_GERBER:
success = m_Parent->Genere_GERBER( fn.GetFullPath(), layer, success = m_Parent->ExportToGerberFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.GetUseAuxOrigin(), g_PcbPlotOptions.GetUseAuxOrigin(),
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_HPGL: case PLOT_FORMAT_HPGL:
success = m_Parent->Genere_HPGL( fn.GetFullPath(), layer, success = m_Parent->ExportToHpglFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
case PLOT_FORMAT_DXF: case PLOT_FORMAT_DXF:
success = m_Parent->Genere_DXF( fn.GetFullPath(), layer, success = m_Parent->ExportToDxfFile( fn.GetFullPath(), layer,
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
} }
// Print diags in messages box: // Print diags in messages box:
wxString msg; wxString msg;
if( success ) if( success )
msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) ); msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) );
else else
msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) ); msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) );
msg << wxT( "\n" ); msg << wxT( "\n" );
m_messagesBox->AppendText( msg ); m_messagesBox->AppendText( msg );
} }
} }
// If no layer selected, we have nothing plotted. // If no layer selected, we have nothing plotted.
// Prompt user if it happens // Prompt user if it happens because he could think there is a bug in pcbnew.
// because he could think there is a bug in pcbnew:
if( !g_PcbPlotOptions.GetLayerSelection() ) if( !g_PcbPlotOptions.GetLayerSelection() )
DisplayError( this, _( "No layer selected" ) ); DisplayError( this, _( "No layer selected" ) );
} }
......
...@@ -15,11 +15,13 @@ ...@@ -15,11 +15,13 @@
#include "pcbplot.h" #include "pcbplot.h"
bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) bool PCB_BASE_FRAME::ExportToDxfFile( const wxString& aFullFileName, int aLayer,
GRTraceMode aTraceMode )
{ {
Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc; Ki_PageDescr* currentsheet = GetScreen()->m_CurrentSheetDesc;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
return false; return false;
...@@ -31,13 +33,13 @@ bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTrac ...@@ -31,13 +33,13 @@ bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTrac
plotter->set_paper_size( currentsheet ); plotter->set_paper_size( currentsheet );
plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 ); plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 );
plotter->set_creator( wxT( "PCBNEW-DXF" ) ); plotter->set_creator( wxT( "PCBNEW-DXF" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
if( g_PcbPlotOptions.m_PlotFrameRef ) if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
...@@ -23,16 +23,10 @@ ...@@ -23,16 +23,10 @@
#include "protos.h" #include "protos.h"
/* Creates the output files, one per board layer: bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLayer,
* filenames are like xxxc.PHO and use the RS274X format bool aPlotOriginIsAuxAxis, GRTraceMode aTraceMode )
* Units = inches
* format 3.4, Leading zero omitted, Abs format
* format 3.4 uses the native pcbnew units (1/10000 inch).
*/
bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
bool PlotOriginIsAuxAxis, GRTraceMode trace_mode )
{ {
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -44,7 +38,7 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, ...@@ -44,7 +38,7 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
/* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */ /* Calculate scaling from pcbnew units (in 0.1 mil or 0.0001 inch) to gerber units */
double scale = g_PcbPlotOptions.m_PlotScale; double scale = g_PcbPlotOptions.m_PlotScale;
if( PlotOriginIsAuxAxis ) if( aPlotOriginIsAuxAxis )
{ {
offset = m_Auxiliary_Axis_Position; offset = m_Auxiliary_Axis_Position;
} }
...@@ -60,20 +54,20 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, ...@@ -60,20 +54,20 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer,
plotter->set_viewport( offset, scale, 0 ); plotter->set_viewport( offset, scale, 0 );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-RS274X" ) ); plotter->set_creator( wxT( "PCBNEW-RS274X" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
if( plotter->start_plot( output_file ) ) if( plotter->start_plot( output_file ) )
{ {
// Skip NPTH pads on copper layers // Skip NPTH pads on copper layers
// ( only if hole size == pad size ): // ( only if hole size == pad size ):
if( (Layer >= LAYER_N_BACK) && (Layer <= LAYER_N_FRONT) ) if( (aLayer >= LAYER_N_BACK) && (aLayer <= LAYER_N_FRONT) )
g_PcbPlotOptions.m_SkipNPTH_Pads = true; g_PcbPlotOptions.m_SkipNPTH_Pads = true;
// Sheet refs on gerber CAN be useful... and they're always 1:1 // Sheet refs on gerber CAN be useful... and they're always 1:1
if( g_PcbPlotOptions.m_PlotFrameRef ) if( g_PcbPlotOptions.m_PlotFrameRef )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
g_PcbPlotOptions.m_SkipNPTH_Pads = false; g_PcbPlotOptions.m_SkipNPTH_Pads = false;
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
#include "pcbplot.h" #include "pcbplot.h"
bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTraceMode trace_mode ) bool PCB_BASE_FRAME::ExportToHpglFile( const wxString& aFullFileName, int aLayer,
GRTraceMode aTraceMode )
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize BoardSize; wxSize BoardSize;
...@@ -27,7 +28,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -27,7 +28,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
double scale; double scale;
wxPoint offset; wxPoint offset;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -40,8 +41,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -40,8 +41,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) / int pen_diam = wxRound( (g_PcbPlotOptions.m_HPGLPenDiam * U_PCB) /
g_PcbPlotOptions.m_PlotScale ); g_PcbPlotOptions.m_PlotScale );
// compute pen_overlay (from g_m_HPGLPenOvr in mils) // compute pen_overlay (from g_m_HPGLPenOvr in mils) with plot scale
// with plot scale
if( g_PcbPlotOptions.m_HPGLPenOvr < 0 ) if( g_PcbPlotOptions.m_HPGLPenOvr < 0 )
g_PcbPlotOptions.m_HPGLPenOvr = 0; g_PcbPlotOptions.m_HPGLPenOvr = 0;
...@@ -100,19 +100,18 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra ...@@ -100,19 +100,18 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-HPGL" ) ); plotter->set_creator( wxT( "PCBNEW-HPGL" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed ); plotter->set_pen_speed( g_PcbPlotOptions.m_HPGLPenSpeed );
plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum ); plotter->set_pen_number( g_PcbPlotOptions.m_HPGLPenNum );
plotter->set_pen_overlap( pen_overlay ); plotter->set_pen_overlap( pen_overlay );
plotter->set_pen_diameter( pen_diam ); plotter->set_pen_diameter( pen_diam );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
* paperscale!=1, anyway */
if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
/* Generate a PostScript file (*. ps) of the circuit layer. /* Generate a PostScript file (*. ps) of the circuit layer.
* If layer < 0: all layers are plotted. * If layer < 0: all layers are plotted.
*/ */
bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer,
bool useA4, GRTraceMode trace_mode ) bool aUseA4, GRTraceMode aTraceMode )
{ {
wxSize SheetSize; wxSize SheetSize;
wxSize PaperSize; wxSize PaperSize;
...@@ -34,7 +34,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -34,7 +34,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
Ki_PageDescr* SheetPS; Ki_PageDescr* SheetPS;
wxPoint offset; wxPoint offset;
FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) );
if( output_file == NULL ) if( output_file == NULL )
{ {
...@@ -54,7 +54,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -54,7 +54,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
SheetSize.x = currentsheet->m_Size.x * U_PCB; SheetSize.x = currentsheet->m_Size.x * U_PCB;
SheetSize.y = currentsheet->m_Size.y * U_PCB; SheetSize.y = currentsheet->m_Size.y * U_PCB;
if( useA4 ) if( aUseA4 )
{ {
SheetPS = &g_Sheet_A4; SheetPS = &g_Sheet_A4;
PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB; PaperSize.x = g_Sheet_A4.m_Size.x * U_PCB;
...@@ -82,7 +82,9 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -82,7 +82,9 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
scale = MIN( Xscale, Yscale ); scale = MIN( Xscale, Yscale );
} }
else else
{
scale = g_PcbPlotOptions.m_PlotScale * paperscale; scale = g_PcbPlotOptions.m_PlotScale * paperscale;
}
if( Center ) if( Center )
{ {
...@@ -102,11 +104,10 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -102,11 +104,10 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror );
plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth );
plotter->set_creator( wxT( "PCBNEW-PS" ) ); plotter->set_creator( wxT( "PCBNEW-PS" ) );
plotter->set_filename( FullFileName ); plotter->set_filename( aFullFileName );
plotter->start_plot( output_file ); plotter->start_plot( output_file );
/* The worksheet is not significant with scale!=1... It is with /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */
* paperscale!=1, anyway */
if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) if( g_PcbPlotOptions.m_PlotFrameRef && !Center )
PlotWorkSheet( plotter, GetScreen() ); PlotWorkSheet( plotter, GetScreen() );
...@@ -126,7 +127,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, ...@@ -126,7 +127,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer,
plotter->set_color( BLACK ); plotter->set_color( BLACK );
} }
Plot_Layer( plotter, Layer, trace_mode ); Plot_Layer( plotter, aLayer, aTraceMode );
plotter->end_plot(); plotter->end_plot();
delete plotter; delete plotter;
SetLocaleTo_Default(); SetLocaleTo_Default();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment