diff --git a/common/dialogs/dialog_hotkeys_editor.cpp b/common/dialogs/dialog_hotkeys_editor.cpp index 1af057eb1e..5f3687fbbc 100644 --- a/common/dialogs/dialog_hotkeys_editor.cpp +++ b/common/dialogs/dialog_hotkeys_editor.cpp @@ -1,6 +1,7 @@ -/* -dialog_hotkeys_editor.cpp -*/ +/** + * @file dialog_hotkeys_editor.cpp + */ + /* * This program source code file is part of KICAD, a free EDA CAD application. * @@ -32,8 +33,7 @@ dialog_hotkeys_editor.cpp #include "dialog_hotkeys_editor.h" -void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, - Ki_HotkeyInfoSectionDescriptor* hotkeys ) +void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys ) { HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys ); @@ -46,8 +46,8 @@ void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, } -HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, - Ki_HotkeyInfoSectionDescriptor* hotkeys ) : +HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, + EDA_HOTKEY_CONFIG* hotkeys ) : HOTKEYS_EDITOR_DIALOG_BASE( parent ) { m_parent = parent; @@ -78,18 +78,21 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) /* edit the live hotkey table */ 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++ ) { - wxString sectionTag = *section->m_SectionTag; + wxString sectionTag = *section->m_SectionTag; + + EDA_HOTKEY** info_ptr; - Ki_HotkeyInfo** 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 */ HotkeyGridTable::hotkey_spec_vector::iterator i; + for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i ) { if( i->first == sectionTag @@ -122,6 +125,7 @@ void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event ) { m_table->RestoreFrom( m_hotkeys ); m_curEditingRow = -1; + for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i ) SetHotkeyCellState( i, false ); @@ -153,6 +157,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) SetHotkeyCellState( m_curEditingRow, false ); int newRow = event.GetRow(); + if( ( event.GetCol() != 1 ) || ( m_table->isHeader( newRow ) ) ) { m_curEditingRow = -1; @@ -166,6 +171,7 @@ void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) Update(); } + /** OnRightClickOnCell * If a cell is selected, display a list of keys for selection * The list is restricted to keys that cannot be entered: @@ -194,18 +200,19 @@ void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event ) wxT("Alt+Space"), }; - wxString keyname = wxGetSingleChoice( - _("Special keys only. For others keys, use keyboard"), - _("Select a key"), C_COUNT, choices, this); + wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ), + _( "Select a key" ), C_COUNT, choices, this ); int key = ReturnKeyCodeFromKeyName( keyname ); if( key == 0 ) return; + m_table->SetKeyCode( m_curEditingRow, key ); m_hotkeyGrid->Refresh(); Update(); } + void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) { if( m_curEditingRow != -1 ) @@ -222,8 +229,10 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) default: if( event.ControlDown() ) key |= GR_KB_CTRL; + if( event.AltDown() ) key |= GR_KB_ALT; + if( event.ShiftDown() && (key > 256) ) key |= GR_KB_SHIFT; @@ -243,12 +252,16 @@ void HOTKEYS_EDITOR_DIALOG::OnKeyPressed( wxKeyEvent& event ) // See if this key code is handled in hotkeys names list bool exists; ReturnKeyNameFromKeyCode( key, &exists ); + if( !exists ) // not handled, see hotkeys_basic.cpp - wxMessageBox( _("Hotkey code not handled" ) ); + { + wxMessageBox( _( "Hotkey code not handled" ) ); + } else { m_table->SetKeyCode( m_curEditingRow, key ); } + break; } } diff --git a/common/hotkey_grid_table.cpp b/common/hotkey_grid_table.cpp index b7f9214d9a..6ff89b9f37 100644 --- a/common/hotkey_grid_table.cpp +++ b/common/hotkey_grid_table.cpp @@ -4,24 +4,23 @@ * Reads the hotkey table from its stored format into a format suitable * for a wxGrid. */ -HotkeyGridTable::HotkeyGridTable( struct - Ki_HotkeyInfoSectionDescriptor* origin ) : +HotkeyGridTable::HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin ) : wxGridTableBase(), m_hotkeys() { - Ki_HotkeyInfoSectionDescriptor* section; + EDA_HOTKEY_CONFIG* 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 ); - Ki_HotkeyInfo** info_ptr; + EDA_HOTKEY** info_ptr; + for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) { - Ki_HotkeyInfo* info = *info_ptr; - hotkey_spec spec( *section->m_SectionTag, - new Ki_HotkeyInfo( info ) ); + EDA_HOTKEY* info = *info_ptr; + hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( info ) ); m_hotkeys.push_back( spec ); } } @@ -165,19 +164,19 @@ void HotkeyGridTable::SetKeyCode( int row, long key ) } -void HotkeyGridTable::RestoreFrom( struct - Ki_HotkeyInfoSectionDescriptor* origin ) +void HotkeyGridTable::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ) { int row = 0; - Ki_HotkeyInfoSectionDescriptor* section; + EDA_HOTKEY_CONFIG* section; for( section = origin; section->m_HK_InfoList; section++ ) { ++row; - Ki_HotkeyInfo** info_ptr; + EDA_HOTKEY** 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; } } diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 6269d3a5b3..85aba2eb9b 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -1,6 +1,6 @@ -/*********************/ -/* hotkeys_basic.cpp */ -/*********************/ +/** + * @file hotkeys_basic.cpp + */ /* Some functions to handle hotkeys in kicad */ @@ -34,8 +34,7 @@ wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) ); * file. */ -Ki_HotkeyInfo::Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, - int keycode, int idmenuevent ) +EDA_HOTKEY::EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent ) { m_KeyCode = keycode; // Key code (ascii value for ascii keys // or wxWidgets code for function key @@ -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_InfoMsg = base->m_InfoMsg; @@ -154,6 +153,7 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) keyname = wxT( "" ); break; } + if( s_Hotkey_Name_List[ii].m_KeyCode == aKeycode ) { keyname = s_Hotkey_Name_List[ii].m_Name; @@ -173,8 +173,8 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool* aIsFound ) /* * helper function use in AddHotkeyName to calculate an accelerator string - * In some menus, accelerators do not perform exactely the same action as - * the hotkey that perfoms a similar action. + * In some menus, accelerators do not perform exactly the same action as + * the hotkey that perform a similar action. * this is usually the case when this action uses the current mouse position * for instance zoom action is ran from the F1 key or the Zoom menu. * a zoom uses the mouse position from a hot key and not from the menu @@ -199,14 +199,14 @@ static void AddModifierToKey( wxString& aFullKey, const wxString & aKey ) /* AddHotkeyName * Add the key name from the Command id value ( m_Idcommand member value) * aText = a wxString. returns aText + key name - * aList = pointer to a Ki_HotkeyInfo list of commands + * aList = pointer to a EDA_HOTKEY list of commands * aCommandId = Command Id value * aShortCutType = IS_HOTKEY to add (shortcuts in menus, same as hotkeys) * IS_ACCELERATOR to add (accelerators in menus, not hotkeys) - * IS_COMMENT to add <(keyname)> mainly in tooltips + * IS_COMMENT to add <(keyname)> mainly in tool tips * 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 ) { wxString msg = aText; @@ -222,9 +222,11 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, case IS_HOTKEY: msg << wxT( "\t" ) << keyname; break; + case IS_ACCELERATOR: AddModifierToKey( msg, keyname ); break; + case IS_COMMENT: msg << wxT( " (" ) << keyname << wxT( ")" ); break; @@ -238,21 +240,21 @@ wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, /* AddHotkeyName * Add the key name from the Command id value ( m_Idcommand member value) * aText = a wxString. returns aText + key name - * aList = pointer to a Ki_HotkeyInfoSectionDescriptor DescrList of commands + * aList = pointer to a EDA_HOTKEY_CONFIG DescrList of commands * aCommandId = Command Id value * aShortCutType = IS_HOTKEY to add (active shortcuts in menus) * IS_ACCELERATOR to add (active accelerators in menus) * IS_COMMENT to add <(keyname)> * Return a wxString (aText + key name) if key found or aText without modification */ -wxString AddHotkeyName( const wxString& aText, - struct Ki_HotkeyInfoSectionDescriptor* aDescList, - int aCommandId, - HOTKEY_ACTION_TYPE aShortCutType ) +wxString AddHotkeyName( const wxString& aText, + struct EDA_HOTKEY_CONFIG* aDescList, + int aCommandId, + HOTKEY_ACTION_TYPE aShortCutType ) { - wxString msg = aText; - wxString keyname; - Ki_HotkeyInfo** List; + wxString msg = aText; + wxString keyname; + EDA_HOTKEY** List; if( aDescList ) { @@ -268,9 +270,11 @@ wxString AddHotkeyName( const wxString& aText, case IS_HOTKEY: msg << wxT( "\t" ) << keyname; break; + case IS_ACCELERATOR: AddModifierToKey( msg, keyname ); break; + case IS_COMMENT: msg << wxT( " (" ) << keyname << wxT( ")" ); break; @@ -287,17 +291,17 @@ wxString AddHotkeyName( const wxString& aText, /** * Function ReturnKeyNameFromCommandId * 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 * @return the key name in a wxString */ -wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ) +wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId ) { wxString keyname; for( ; *aList != NULL; aList++ ) { - Ki_HotkeyInfo* hk_decr = *aList; + EDA_HOTKEY* hk_decr = *aList; if( hk_decr->m_Idcommand == aCommandId ) { @@ -373,15 +377,14 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ) /* DisplayHotkeyList * 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, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ) +void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aDescList ) { - wxString keyname; - Ki_HotkeyInfo** List; + wxString keyname; + EDA_HOTKEY** List; - wxString msg = wxT( "" ); + wxString msg = wxT( "" ); msg += wxT( "

"); msg += _("Hotkeys List"); @@ -393,7 +396,8 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, for( ; *List != NULL; List++ ) { - Ki_HotkeyInfo* hk_decr = *List; + EDA_HOTKEY* hk_decr = *List; + if( !hk_decr->m_InfoMsg.Contains( wxT( "Macros" ) ) ) { keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); @@ -410,16 +414,17 @@ void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, /** * 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 aList = pointer to a Ki_HotkeyInfo list of commands - * @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List + * @param aList = pointer to a EDA_HOTKEY list of commands + * @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++ ) { - Ki_HotkeyInfo* hk_decr = *aList; + EDA_HOTKEY* hk_decr = *aList; + if( hk_decr->m_KeyCode == aKey ) return hk_decr; } @@ -434,13 +439,13 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ) * It is stored using the standard wxConfig mechanism or a file. * * @param aDescList = pointer to the current hotkey list. - * @param aFullFileName = a wxString pointer to a fuill file name. + * @param aFullFileName = a wxString pointer to a full file name. * if NULL, use the standard wxConfig mechanism (default) * the output format is: shortcut "key" "function" * lines starting with # are comments */ -int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, - wxString* aFullFileName ) +int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, + wxString* aFullFileName ) { wxString msg; wxString keyname, infokey; @@ -448,7 +453,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD msg = wxT( "$hotkey list\n" ); /* Print the current hotkey list */ - Ki_HotkeyInfo** List; + EDA_HOTKEY** List; for( ; aDescList->m_HK_InfoList != NULL; aDescList++ ) { @@ -466,7 +471,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD for( ; *List != NULL; List++ ) { - Ki_HotkeyInfo* hk_decr = *List; + EDA_HOTKEY* hk_decr = *List; msg += wxT( "shortcut " ); keyname = ReturnKeyNameFromKeyCode( hk_decr->m_KeyCode ); AddDelimiterString( keyname ); @@ -509,8 +514,8 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aD * @param aFilename = file name to read. * @param aDescList = current hotkey list descr. to initialise. */ -int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ) +int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& aFilename, + struct EDA_HOTKEY_CONFIG* aDescList ) { wxFile cfgfile( aFilename ); @@ -534,8 +539,7 @@ int EDA_BASE_FRAME::ReadHotkeyConfigFile( const wxString& return 1; } -void ReadHotkeyConfig( const wxString& Appname, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ) +void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList ) { wxConfig config( Appname ); @@ -553,9 +557,9 @@ void ReadHotkeyConfig( const wxString& Appname, /* Function ReadHotkeyConfig * 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 ); return 1; @@ -567,12 +571,12 @@ int EDA_BASE_FRAME::ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDe * lines starting by # are ignored (comments) * lines like [xxx] are tags (example: [common] or [libedit] which identify sections */ -void ParseHotkeyConfig( const wxString& data, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ) +void ParseHotkeyConfig( const wxString& data, + struct EDA_HOTKEY_CONFIG* aDescList ) { /* Read the config */ wxStringTokenizer tokenizer( data, L"\r\n", wxTOKEN_STRTOK ); - Ki_HotkeyInfo** CurrentHotkeyList = 0; + EDA_HOTKEY** CurrentHotkeyList = 0; while( tokenizer.HasMoreTokens() ) { @@ -580,13 +584,14 @@ void ParseHotkeyConfig( const wxString& data, wxStringTokenizer lineTokenizer( line ); wxString line_type = lineTokenizer.GetNextToken(); + if( line_type[0] == '#' ) //comment continue; if( line_type[0] == '[' ) // A tag is found. search infos in list { CurrentHotkeyList = 0; - Ki_HotkeyInfoSectionDescriptor* DList = aDescList; + EDA_HOTKEY_CONFIG* DList = aDescList; for( ; DList->m_HK_InfoList; DList++ ) { @@ -619,9 +624,10 @@ void ParseHotkeyConfig( const wxString& data, wxString fctname = remainder.AfterFirst( '\"' ).BeforeFirst( '\"' ); /* 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 ) { int code = ReturnKeyCodeFromKeyName( keyname ); @@ -639,9 +645,9 @@ void ParseHotkeyConfig( const wxString& data, /** * Function ImportHotkeyConfigFromFile * 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 mask = wxT( "*." ) + ext; @@ -667,9 +673,9 @@ void EDA_BASE_FRAME::ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDesc /** * Function ExportHotkeyConfigToFile * 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 mask = wxT( "*." ) + ext; diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index 26df568e66..aabea7c908 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -22,8 +22,8 @@ /* How to add a new hotkey: * add a new id in the enum hotkey_id_command like MY_NEW_ID_FUNCTION (see * hotkeys.h). - * add a new Ki_HotkeyInfo entry like: - * static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, + * add a new EDA_HOTKEY entry like: + * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, * default key value); * wxT("Command Label") is the name used in hotkey list display, and the * identifier in the hotkey list file @@ -58,104 +58,104 @@ /* Fit on Screen */ #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 -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 -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 */ #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 -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 /* Zoom In */ #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 -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 /* Zoom Out */ #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 -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 -static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); -static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), +static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); +static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), HK_RESET_LOCAL_COORD, ' ' ); /* 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 */ #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 -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 ); #endif // Schematic editor -static Ki_HotkeyInfo HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' ); -static Ki_HotkeyInfo 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 Ki_HotkeyInfo HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J' ); -static Ki_HotkeyInfo HkBeginWire( wxT( "Draw Wire" ), HK_BEGIN_WIRE, 'W' ); -static Ki_HotkeyInfo HkBeginBus( wxT( "Draw Bus" ), HK_BEGIN_BUS, 'B' ); -static Ki_HotkeyInfo HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' ); -static Ki_HotkeyInfo HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' ); -static Ki_HotkeyInfo HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' ); -static Ki_HotkeyInfo HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' ); -static Ki_HotkeyInfo HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' ); -static Ki_HotkeyInfo HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' ); -static Ki_HotkeyInfo HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' ); -static Ki_HotkeyInfo HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' ); -static Ki_HotkeyInfo HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' ); -static Ki_HotkeyInfo HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' ); -static Ki_HotkeyInfo HkOrientNormalComponent( wxT( "Orient Normal Component" ), +static EDA_HOTKEY HkAddLabel( wxT( "add Label" ), HK_ADD_LABEL, 'L' ); +static EDA_HOTKEY HkAddHierarchicalLabel( wxT( "Add Hierarchical Label" ), HK_ADD_HLABEL, 'H' ); +static EDA_HOTKEY HkAddGlobalLabel( wxT( "Add Global Label" ), HK_ADD_GLABEL, GR_KB_CTRL + 'L' ); +static EDA_HOTKEY HkAddJunction( wxT( "Add Junction" ), HK_ADD_JUNCTION, 'J' ); +static EDA_HOTKEY HkBeginWire( wxT( "Draw Wire" ), HK_BEGIN_WIRE, 'W' ); +static EDA_HOTKEY HkBeginBus( wxT( "Draw Bus" ), HK_BEGIN_BUS, 'B' ); +static EDA_HOTKEY HkAddComponent( wxT( "Add Component" ), HK_ADD_NEW_COMPONENT, 'A' ); +static EDA_HOTKEY HkAddPower( wxT( "Add Power" ), HK_ADD_NEW_POWER, 'P' ); +static EDA_HOTKEY HkAddNoConn( wxT( "Add NoConnected Flag" ), HK_ADD_NOCONN_FLAG, 'Q' ); +static EDA_HOTKEY HkAddHierSheet( wxT( "Add Sheet" ), HK_ADD_HIER_SHEET, 'S' ); +static EDA_HOTKEY HkAddBusEntry( wxT( "Add Bus Entry" ), HK_ADD_BUS_ENTRY, '/' ); +static EDA_HOTKEY HkAddWireEntry( wxT( "Add Wire Entry" ), HK_ADD_WIRE_ENTRY, 'Z' ); +static EDA_HOTKEY HkAddGraphicPolyLine( wxT( "Add Graphic PolyLine" ), HK_ADD_GRAPHIC_POLYLINE, 'I' ); +static EDA_HOTKEY HkAddGraphicText( wxT( "Add Graphic Text" ), HK_ADD_GRAPHIC_TEXT, 'T' ); +static EDA_HOTKEY HkMirrorYComponent( wxT( "Mirror Y Component" ), HK_MIRROR_Y_COMPONENT, 'Y' ); +static EDA_HOTKEY HkMirrorXComponent( wxT( "Mirror X Component" ), HK_MIRROR_X_COMPONENT, 'X' ); +static EDA_HOTKEY HkOrientNormalComponent( wxT( "Orient Normal Component" ), HK_ORIENT_NORMAL_COMPONENT, 'N' ); -static Ki_HotkeyInfo HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' ); -static Ki_HotkeyInfo HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' ); -static Ki_HotkeyInfo HkEditComponentValue( wxT( "Edit Component Value" ), +static EDA_HOTKEY HkRotate( wxT( "Rotate Item" ), HK_ROTATE, 'R' ); +static EDA_HOTKEY HkEdit( wxT( "Edit Schematic Item" ), HK_EDIT, 'E' ); +static EDA_HOTKEY HkEditComponentValue( wxT( "Edit Component Value" ), HK_EDIT_COMPONENT_VALUE, 'V', 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', 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', 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', 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 ); -static Ki_HotkeyInfo HkMove2Drag( wxT( "Move Block -> Drag Block" ), +static EDA_HOTKEY HkMove2Drag( wxT( "Move Block -> Drag Block" ), HK_MOVEBLOCK_TO_DRAGBLOCK, '\t' ); -static Ki_HotkeyInfo HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT ); -static Ki_HotkeyInfo HkDelete( wxT( "Delete Item" ), HK_DELETE, WXK_DELETE ); +static EDA_HOTKEY HkInsert( wxT( "Repeat Last Item" ), HK_REPEAT_LAST, WXK_INSERT ); +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 Ki_HotkeyInfo 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 HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); +static EDA_HOTKEY HkFindNextItem( wxT( "Find Next Item" ), HK_FIND_NEXT_ITEM, WXK_F5 ); +static EDA_HOTKEY HkFindNextDrcMarker( wxT( "Find Next DRC Marker" ), HK_FIND_NEXT_DRC_MARKER, WXK_F5 + GR_KB_SHIFT ); // Special keys for library editor: -static Ki_HotkeyInfo HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' ); -static Ki_HotkeyInfo 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 HkCreatePin( wxT( "Create Pin" ), HK_LIBEDIT_CREATE_PIN, 'P' ); +static EDA_HOTKEY HkInsertPin( wxT( "Repeat Pin" ), HK_REPEAT_LAST, WXK_INSERT ); +static EDA_HOTKEY HkMoveLibItem( wxT( "Move Library Item" ), HK_LIBEDIT_MOVE_GRAPHIC_ITEM, 'M' ); // List of common hotkey descriptors -Ki_HotkeyInfo* s_Common_Hotkey_List[] = +EDA_HOTKEY* s_Common_Hotkey_List[] = { &HkHelp, &HkZoomIn, @@ -170,7 +170,7 @@ Ki_HotkeyInfo* s_Common_Hotkey_List[] = }; // List of hotkey descriptors for schematic -Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = +EDA_HOTKEY* s_Schematic_Hotkey_List[] = { &HkFindItem, &HkFindNextItem, @@ -206,7 +206,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = }; // List of hotkey descriptors for library editor -Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = +EDA_HOTKEY* s_LibEdit_Hotkey_List[] = { &HkCreatePin, &HkInsertPin, @@ -220,7 +220,7 @@ Ki_HotkeyInfo* s_LibEdit_Hotkey_List[] = // list of sections and corresponding hotkey list for eeschema (used to create // 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_SchematicSectionTag, s_Schematic_Hotkey_List, L"Schematic editor keys" }, @@ -230,7 +230,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Eeschema_Hokeys_Descr[] = // list of sections and corresponding hotkey list for the schematic editor // (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_SchematicSectionTag, s_Schematic_Hotkey_List, NULL }, @@ -239,7 +239,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Schematic_Hokeys_Descr[] = // list of sections and corresponding hotkey list for the component editor // (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_LibEditSectionTag, s_LibEdit_Hotkey_List, NULL }, @@ -248,7 +248,7 @@ struct Ki_HotkeyInfoSectionDescriptor s_Libedit_Hokeys_Descr[] = // list of sections and corresponding hotkey list for the component browser // (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 }, { NULL, NULL, NULL } @@ -282,7 +282,7 @@ void SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, aHotKey += 'A' - 'a'; // 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 ) HK_Descr = GetDescriptorFromHotkey( aHotKey, s_Schematic_Hotkey_List ); @@ -864,7 +864,7 @@ void LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition, if( (aHotKey >= 'a') && (aHotKey <= 'z') ) 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 ) HK_Descr = GetDescriptorFromHotkey( aHotKey, s_LibEdit_Hotkey_List ); diff --git a/eeschema/hotkeys.h b/eeschema/hotkeys.h index d7cfe462ce..eed341a3c5 100644 --- a/eeschema/hotkeys.h +++ b/eeschema/hotkeys.h @@ -1,6 +1,6 @@ -/***************/ -/* hotkeys.h */ -/***************/ +/** + * eeschema/hotkeys.h + */ #ifndef KOTKEYS_H #define KOTKEYS_H @@ -46,15 +46,15 @@ enum hotkey_id_commnand { }; // 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 -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 -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 -extern struct Ki_HotkeyInfoSectionDescriptor s_Viewlib_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG s_Viewlib_Hokeys_Descr[]; #endif // KOTKEYS_H diff --git a/gerbview/hotkeys.cpp b/gerbview/hotkeys.cpp index 5b7e952102..5164bd2deb 100644 --- a/gerbview/hotkeys.cpp +++ b/gerbview/hotkeys.cpp @@ -14,8 +14,8 @@ /* How to add a new hotkey: * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. - * add a new Ki_HotkeyInfo entry like: - * static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); + * add a new EDA_HOTKEY entry like: + * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); * "Command Label" is the name used in hotkey list display, and the identifier in the * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch * in OnHotKey() function. default key value is the default hotkey for this command. @@ -33,25 +33,25 @@ /* local variables */ /* Hotkey list: */ -static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), - HK_RESET_LOCAL_COORD, ' ' ); -static Ki_HotkeyInfo HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); -static Ki_HotkeyInfo HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); -static Ki_HotkeyInfo HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); -static Ki_HotkeyInfo HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); -static Ki_HotkeyInfo HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); -static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); -static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); -static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), - HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); +static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), + HK_RESET_LOCAL_COORD, ' ' ); +static EDA_HOTKEY HkZoomAuto( wxT( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME ); +static EDA_HOTKEY HkZoomCenter( wxT( "Zoom Center" ), HK_ZOOM_CENTER, WXK_F4 ); +static EDA_HOTKEY HkZoomRedraw( wxT( "Zoom Redraw" ), HK_ZOOM_REDRAW, WXK_F3 ); +static EDA_HOTKEY HkZoomOut( wxT( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); +static EDA_HOTKEY HkZoomIn( wxT( "Zoom In" ), HK_ZOOM_IN, WXK_F1 ); +static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); +static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' ); +static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), + HK_SWITCH_GBR_ITEMS_DISPLAY_MODE, 'F' ); -static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), - HK_SWITCH_LAYER_TO_NEXT, '+' ); -static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), - HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); +static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), + HK_SWITCH_LAYER_TO_NEXT, '+' ); +static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), + HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); // List of common hotkey descriptors -Ki_HotkeyInfo* s_Gerbview_Hotkey_List[] = { +EDA_HOTKEY* s_Gerbview_Hotkey_List[] = { &HkHelp, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkSwitchUnits, &HkResetLocalCoord, @@ -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) -struct Ki_HotkeyInfoSectionDescriptor s_Gerbview_Hokeys_Descr[] = +struct EDA_HOTKEY_CONFIG s_Gerbview_Hokeys_Descr[] = { { &g_CommonSectionTag, s_Gerbview_Hotkey_List, NULL }, { NULL, NULL, NULL } @@ -86,8 +86,10 @@ void GERBVIEW_FRAME::OnHotKey( wxDC* DC, int hotkey, EDA_ITEM* DrawStruct ) if( (hotkey >= 'a') && (hotkey <= 'z') ) hotkey += 'A' - 'a'; - Ki_HotkeyInfo * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List ); - if( HK_Descr == NULL ) return; + EDA_HOTKEY * HK_Descr = GetDescriptorFromHotkey( hotkey, s_Gerbview_Hotkey_List ); + + if( HK_Descr == NULL ) + return; switch( HK_Descr->m_Idcommand ) { diff --git a/gerbview/hotkeys.h b/gerbview/hotkeys.h index 9a2c465ac3..30a7bafac8 100644 --- a/gerbview/hotkeys.h +++ b/gerbview/hotkeys.h @@ -1,6 +1,7 @@ -/***************/ -/* hotkeys.h */ -/***************/ +/** + * gerbview/hotkeys.h + */ + #ifndef KOTKEYS_H #define KOTKEYS_H @@ -17,6 +18,6 @@ enum hotkey_id_commnand { }; // 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 diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index a75b5e9349..ab9c3a83cc 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -43,7 +43,7 @@ public: bool SetLayersOrdered(bool value); bool SetLayersHotkeys(bool value); // Hotkey Info - struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; + struct EDA_HOTKEY_CONFIG* m_hotkeys; }; #define DECLARE_LAYERS_HOTKEY(list) int list[LAYER_COUNT] = \ diff --git a/include/dialog_hotkeys_editor.h b/include/dialog_hotkeys_editor.h index 7c9bf90f29..af704ca41d 100644 --- a/include/dialog_hotkeys_editor.h +++ b/include/dialog_hotkeys_editor.h @@ -25,13 +25,13 @@ class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE { protected: EDA_DRAW_FRAME* m_parent; - struct Ki_HotkeyInfoSectionDescriptor* m_hotkeys; + struct EDA_HOTKEY_CONFIG* m_hotkeys; HotkeyGridTable* m_table; int m_curEditingRow; 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() {}; @@ -45,6 +45,6 @@ private: 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 diff --git a/include/hotkey_grid_table.h b/include/hotkey_grid_table.h index e50ad43ad6..e96eb9c342 100644 --- a/include/hotkey_grid_table.h +++ b/include/hotkey_grid_table.h @@ -18,10 +18,10 @@ class HotkeyGridTable : public wxGridTableBase { 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; - HotkeyGridTable( struct Ki_HotkeyInfoSectionDescriptor* origin ); + HotkeyGridTable( struct EDA_HOTKEY_CONFIG* origin ); virtual ~HotkeyGridTable(); hotkey_spec_vector& getHotkeys(); @@ -47,7 +47,7 @@ private: public: virtual bool isHeader( int row ); virtual void SetKeyCode( int row, long key ); - virtual void RestoreFrom( struct Ki_HotkeyInfoSectionDescriptor* origin ); + virtual void RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ); protected: std::vector< hotkey_spec > m_hotkeys; diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index 0096384e27..5985ba9c18 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -1,6 +1,6 @@ -/*******************/ -/* hotkeys_basic.h */ -/*******************/ +/** + * @file hotkeys_basic.h + */ /* Some functions to handle hotkeys in kicad */ @@ -17,39 +17,42 @@ class EDA_DRAW_FRAME; /* 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) */ -class Ki_HotkeyInfo +class EDA_HOTKEY { public: - int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key - wxString m_InfoMsg; // info message. - int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) - int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h) + int m_KeyCode; // Key code (ascii value for ascii keys or wxWidgets code for function key + wxString m_InfoMsg; // info message. + int m_Idcommand; // internal id for the corresponding command (see hotkey_id_commnand list) + int m_IdMenuEvent; // id to call the corresponding event (if any) (see id.h) public: - Ki_HotkeyInfo( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 ); - Ki_HotkeyInfo( const Ki_HotkeyInfo* base); + EDA_HOTKEY( const wxChar* infomsg, int idcommand, int keycode, int idmenuevent = 0 ); + 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. - * a section is a list of hotkey infos ( a Ki_HotkeyInfo list). - * A full list of hoteys can used one or many sections + * a section is a list of hotkey infos ( a EDA_HOTKEY list). + * A full list of hotkeys can used one or many sections * for instance: * 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 * this feature avoid duplications and made hotkey file config easier to understand and edit */ -struct Ki_HotkeyInfoSectionDescriptor +struct EDA_HOTKEY_CONFIG { public: - wxString* m_SectionTag; // The section name - Ki_HotkeyInfo** m_HK_InfoList; // List of Ki_HotkeyInfo pointers - const wchar_t* m_Comment; // comment: will be printed in the config file - // Info usage only + wxString* m_SectionTag; // The configuration file section name. + EDA_HOTKEY** m_HK_InfoList; // List of EDA_HOTKEY pointers + const wchar_t* m_Comment; // Will be printed in the config file only. }; /* 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_SchematicSectionTag; @@ -77,11 +80,11 @@ wxString ReturnKeyNameFromKeyCode( int aKeycode, bool * aIsFound = NULL ) /** * Function ReturnKeyNameFromCommandId * 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 * @return the key name in a wxString */ -wxString ReturnKeyNameFromCommandId( Ki_HotkeyInfo** aList, int aCommandId ); +wxString ReturnKeyNameFromCommandId( EDA_HOTKEY** aList, int aCommandId ); /** * Function ReturnKeyCodeFromKeyName @@ -98,7 +101,7 @@ int ReturnKeyCodeFromKeyName( const wxString& keyname ); * Hot keys can perform actions using the current mouse cursor position * Accelerators performs the same action as the associated menu * 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 { @@ -111,48 +114,44 @@ enum HOTKEY_ACTION_TYPE * Function AddHotkeyName * Add the key name from the Command id value ( m_Idcommand member value) * @param aText = a wxString. returns aText + key name - * @param aList = pointer to a Ki_HotkeyInfo list of commands + * @param aList = pointer to a EDA_HOTKEY list of commands * @param aCommandId = Command Id value - * @param aIsShortCut = true to add <tab><keyname> (active shortcuts in menus) - * = false to add <spaces><(keyname)> + * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut. * @return a wxString (aTest + key name) if key found or aText without modification */ -wxString AddHotkeyName( const wxString& aText, Ki_HotkeyInfo** aList, - int aCommandId, - HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY); +wxString AddHotkeyName( const wxString& aText, EDA_HOTKEY** aList, int aCommandId, + HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY); /** * Function AddHotkeyName * Add the key name from the Command id value ( m_Idcommand member value) * @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 aIsShortCut = true to add <tab><keyname> (active shortcuts in menus) - * = false to add <spaces><(keyname)> + * @param aShortCutType The #HOTKEY_ACTION_TYPE of the shortcut. * @return a wxString (aTest + key name) if key found or aText without modification */ -wxString AddHotkeyName( const wxString& aText, - struct Ki_HotkeyInfoSectionDescriptor* aDescrList, - int aCommandId, - HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY ); +wxString AddHotkeyName( const wxString& aText, + struct EDA_HOTKEY_CONFIG* aDescrList, + int aCommandId, + HOTKEY_ACTION_TYPE aShortCutType = IS_HOTKEY ); /** * Function DisplayHotkeyList * Displays the current hotkey list * @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, - struct Ki_HotkeyInfoSectionDescriptor* aList ); +void DisplayHotkeyList( EDA_DRAW_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList ); /** * 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 aList = pointer to a Ki_HotkeyInfo list of commands - * @return the corresponding Ki_HotkeyInfo pointer from the Ki_HotkeyInfo List + * @param aList = pointer to a EDA_HOTKEY list of commands + * @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 @@ -161,11 +160,9 @@ Ki_HotkeyInfo* GetDescriptorFromHotkey( int aKey, Ki_HotkeyInfo** aList ); * @param Appname = the value of the app's m_FrameName * @param aDescList = the hotkey data */ -void ReadHotkeyConfig( const wxString& Appname, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ); +void ReadHotkeyConfig( const wxString& Appname, struct EDA_HOTKEY_CONFIG* aDescList ); -void ParseHotkeyConfig( const wxString& data, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ); +void ParseHotkeyConfig( const wxString& data, struct EDA_HOTKEY_CONFIG* aDescList ); // common hotkeys event id diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index de37a71cf8..a2ae1403e5 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -44,8 +44,7 @@ public: int m_DisplayModEdge; // How to display module drawings (line/ filled / sketch) int m_DisplayModText; // How to display module texts (line/ filled / sketch) - bool m_DisplayPcbTrackFill; /* FALSE : tracks are show in sketch mode, - * TRUE = filled */ + bool m_DisplayPcbTrackFill; // FALSE : tracks are show in sketch mode, TRUE = filled. EDA_UNITS_T m_UserGridUnit; wxRealPoint m_UserGridSize; @@ -160,21 +159,11 @@ public: /** * Function CursorGoto - * positions the cursor at a given coordinate and reframes the drawing if - *the + * positions the cursor at a given coordinate and reframes the drawing if the * requested point is out of view. * @param aPos The point to go to. */ - 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 ); + void CursorGoto( const wxPoint& aPos ); /** * Function Save_Module_In_Library @@ -211,7 +200,7 @@ public: * do not forget to call this basic OnModify function to update info * in derived OnModify functions */ - virtual void OnModify( ); + virtual void OnModify(); // Modules (footprints) /** @@ -424,20 +413,33 @@ public: * Return true if OK, false if the file is not created (or has a problem) */ - bool Genere_GERBER( const wxString& FullFileName, - int Layer, - bool PlotOriginIsAuxAxis, - GRTraceMode trace_mode ); - bool Genere_HPGL( const wxString& FullFileName, - int Layer, - GRTraceMode trace_mode ); - bool Genere_PS( const wxString& FullFileName, - int Layer, - bool useA4, - GRTraceMode trace_mode ); - bool Genere_DXF( const wxString& FullFileName, - int Layer, - GRTraceMode trace_mode ); + /** + * Function ExportToGerberFile + * create one output files one per board layer in the RS274X format. + *

+ * The units are in inches and in the format 3.4 with the leading zeros omitted. + * Coordinates are absolute value. The 3.4 format is used because the native PCBNew + * units are 1/10000 inch. + *

+ */ + bool ExportToGerberFile( const wxString& aFullFileName, + int aLayer, + bool aPlotOriginIsAuxAxis, + GRTraceMode aTraceMode ); + + 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, int Layer, GRTraceMode trace_mode ); diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index e156a6c581..28a00f8263 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -173,16 +173,21 @@ public: void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); /** - * Function RecordMacros - * record sequence hotkeys and cursor position to macros. + * Function RecordMacros. + * 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 - * 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(); diff --git a/include/wxstruct.h b/include/wxstruct.h index f3a5ec9da5..0141736e9b 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -43,7 +43,6 @@ class BASE_SCREEN; class EDA_TOOLBAR; class PARAM_CFG_BASE; class Ki_PageDescr; -class Ki_HotkeyInfo; class PLOTTER; enum id_librarytype { @@ -139,7 +138,7 @@ public: * Read configuration data and fill the current hotkey list with hotkeys * @param aDescList = current hotkey list descr. to initialize. */ - int ReadHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + int ReadHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList ); /** * Function WriteHotkeyConfig @@ -152,8 +151,7 @@ public: * the output format is: shortcut "key" "function" * lines starting with # are comments */ - int WriteHotkeyConfig( struct Ki_HotkeyInfoSectionDescriptor* aDescList, - wxString* aFullFileName = NULL); + int WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, wxString* aFullFileName = NULL); /** * Function ReadHotkeyConfigFile @@ -162,22 +160,21 @@ public: * @param aFilename = file name to read. * @param aDescList = current hotkey list descr. to initialize. */ - int ReadHotkeyConfigFile( const wxString& aFilename, - struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + int ReadHotkeyConfigFile( const wxString& aFilename, struct EDA_HOTKEY_CONFIG* aDescList ); /** * Function ImportHotkeyConfigFromFile * Prompt the user for an old hotkey file to read, and read it. * @param aDescList = current hotkey list descr. to initialize. */ - void ImportHotkeyConfigFromFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + void ImportHotkeyConfigFromFile( struct EDA_HOTKEY_CONFIG* aDescList ); /** * Function ExportHotkeyConfigToFile * Prompt the user for an old hotkey file to read, and read it. * @param aDescList = current hotkey list descr. to initialize. */ - void ExportHotkeyConfigToFile( struct Ki_HotkeyInfoSectionDescriptor* aDescList ); + void ExportHotkeyConfigToFile( struct EDA_HOTKEY_CONFIG* aDescList ); /** * Function SetLanguage @@ -284,7 +281,7 @@ public: wxPoint m_Auxiliary_Axis_Position; // position of the auxiliary axis protected: - Ki_HotkeyInfoSectionDescriptor * m_HotkeysZoomAndGridList; + EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; int m_LastGridSizeId; bool m_DrawGrid; // hide/Show grid int m_GridColor; // Grid color diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index 7f7fb59f6c..fcfc0fe809 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -1,6 +1,6 @@ -/***************/ -/* hotkeys.cpp */ -/***************/ +/** + * @file pcbnew/hotkeys.cpp + */ #include "fctsys.h" #include "pcbnew.h" @@ -10,16 +10,19 @@ /* How to add a new hotkey: * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION. - * add a new Ki_HotkeyInfo entry like: - * static Ki_HotkeyInfo HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); - * "Command Label" is the name used in hotkey list display, and the identifier in the hotkey list file - * MY_NEW_ID_FUNCTION is an equivalent id function used in the switch in OnHotKey() function. - * default key value is the default hotkey for this command. Can be overrided by the user hotkey list file - * add the HkMyNewEntry pointer in the s_board_edit_Hotkey_List list ( or/and the s_module_edit_Hotkey_List list) + * add a new EDA_HOTKEY entry like: + * static EDA_HOTKEY HkMyNewEntry(wxT("Command Label"), MY_NEW_ID_FUNCTION, default key value); + * "Command Label" is the name used in hotkey list display, and the identifier in the + * hotkey list file MY_NEW_ID_FUNCTION is an equivalent id function used in the switch + * in OnHotKey() function. + * default key value is the default hotkey for this command. Can be 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. * 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 - * ( For example, one cannot start a new wire when a component is moving.) + * This can be useful if the new function cannot be executed while an item is currently + * being edited ( For example, one cannot start a new wire when a component is moving.) * * Note: If an hotkey is a special key, be sure the corresponding wxWidget keycode (WXK_XXXX) * is handled in the hotkey_name_descr s_Hotkey_Name_List list (see hotkeys_basic.cpp) @@ -28,173 +31,167 @@ /* local variables */ /* Hotkey list: */ -static Ki_HotkeyInfo HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ), - HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN ); -static Ki_HotkeyInfo HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ), - HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP ); -static Ki_HotkeyInfo HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ), - HK_SWITCH_LAYER_TO_INNER1, WXK_F5 ); -static Ki_HotkeyInfo HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ), - HK_SWITCH_LAYER_TO_INNER2, WXK_F6 ); -static Ki_HotkeyInfo HkSwitch2InnerLayer3( wxT( "Switch to Inner layer 3" ), - HK_SWITCH_LAYER_TO_INNER3, WXK_F7 ); -static Ki_HotkeyInfo HkSwitch2InnerLayer4( wxT( "Switch to Inner layer 4" ), - HK_SWITCH_LAYER_TO_INNER4, WXK_F8 ); -static Ki_HotkeyInfo HkSwitch2InnerLayer5( wxT( "Switch to Inner layer 5" ), - HK_SWITCH_LAYER_TO_INNER5, WXK_F9 ); -static Ki_HotkeyInfo HkSwitch2InnerLayer6( wxT( "Switch to Inner layer 6" ), - HK_SWITCH_LAYER_TO_INNER6, WXK_F10 ); +static EDA_HOTKEY HkSwitch2CopperLayer( wxT( "Switch to Copper layer" ), + HK_SWITCH_LAYER_TO_COPPER, WXK_PAGEDOWN ); +static EDA_HOTKEY HkSwitch2ComponentLayer( wxT( "Switch to Component layer" ), + HK_SWITCH_LAYER_TO_COMPONENT, WXK_PAGEUP ); +static EDA_HOTKEY HkSwitch2InnerLayer1( wxT( "Switch to Inner layer 1" ), + HK_SWITCH_LAYER_TO_INNER1, WXK_F5 ); +static EDA_HOTKEY HkSwitch2InnerLayer2( wxT( "Switch to Inner layer 2" ), + HK_SWITCH_LAYER_TO_INNER2, WXK_F6 ); +static EDA_HOTKEY HkSwitch2InnerLayer3( wxT( "Switch to Inner layer 3" ), + HK_SWITCH_LAYER_TO_INNER3, WXK_F7 ); +static EDA_HOTKEY HkSwitch2InnerLayer4( wxT( "Switch to Inner layer 4" ), + HK_SWITCH_LAYER_TO_INNER4, WXK_F8 ); +static EDA_HOTKEY HkSwitch2InnerLayer5( wxT( "Switch to Inner layer 5" ), + HK_SWITCH_LAYER_TO_INNER5, WXK_F9 ); +static EDA_HOTKEY HkSwitch2InnerLayer6( wxT( "Switch to Inner layer 6" ), + HK_SWITCH_LAYER_TO_INNER6, WXK_F10 ); -static Ki_HotkeyInfo HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), - HK_SWITCH_LAYER_TO_NEXT, '+' ); -static Ki_HotkeyInfo HkSwitch2PreviousCopperLayer( wxT( - "Switch to Previous Layer" ), - HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); +static EDA_HOTKEY HkSwitch2NextCopperLayer( wxT( "Switch to Next Layer" ), + HK_SWITCH_LAYER_TO_NEXT, '+' ); +static EDA_HOTKEY HkSwitch2PreviousCopperLayer( wxT( "Switch to Previous Layer" ), + HK_SWITCH_LAYER_TO_PREVIOUS, '-' ); -static Ki_HotkeyInfo HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' - + GR_KB_CTRL ); -static Ki_HotkeyInfo HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' - + GR_KB_CTRL ); -static Ki_HotkeyInfo HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' - + GR_KB_CTRL ); -static Ki_HotkeyInfo HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, - 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, '/' ); -static Ki_HotkeyInfo HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), - HK_DRAG_TRACK_KEEP_SLOPE, 'D' ); -static Ki_HotkeyInfo HkPlaceItem( wxT( "Place Item" ), - HK_PLACE_ITEM, 'P' ); -static Ki_HotkeyInfo HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' - + GR_KB_CTRL ); -static Ki_HotkeyInfo HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); -static Ki_HotkeyInfo HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); -static Ki_HotkeyInfo HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, - 'F' ); -static Ki_HotkeyInfo HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); -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' ); -static Ki_HotkeyInfo HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), - HK_LOCK_UNLOCK_FOOTPRINT, 'L' ); -static Ki_HotkeyInfo HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE ); -static Ki_HotkeyInfo HkResetLocalCoord( wxT( "Reset Local Coordinates" ), - HK_RESET_LOCAL_COORD, ' ' ); +static EDA_HOTKEY HkSavefile( wxT( "Save board" ), HK_SAVE_BOARD, 'S' + GR_KB_CTRL ); +static EDA_HOTKEY HkLoadfile( wxT( "Load board" ), HK_LOAD_BOARD, 'L' + GR_KB_CTRL ); +static EDA_HOTKEY HkFindItem( wxT( "Find Item" ), HK_FIND_ITEM, 'F' + GR_KB_CTRL ); +static EDA_HOTKEY HkBackspace( wxT( "Delete track segment" ), HK_BACK_SPACE, WXK_BACK ); +static EDA_HOTKEY HkAddNewTrack( wxT( "Add new track" ), HK_ADD_NEW_TRACK, 'X' ); +static EDA_HOTKEY HkAddVia( wxT( "Add Via" ), HK_ADD_VIA, 'V' ); +static EDA_HOTKEY HkSwitchTrackPosture( wxT( "Switch Track Posture" ), + HK_SWITCH_TRACK_POSTURE, '/' ); +static EDA_HOTKEY HkDragTrackKeepSlope( wxT( "Drag track keep slope" ), + HK_DRAG_TRACK_KEEP_SLOPE, 'D' ); +static EDA_HOTKEY HkPlaceItem( wxT( "Place Item" ), HK_PLACE_ITEM, 'P' ); +static EDA_HOTKEY HkAddMicroVia( wxT( "Add MicroVia" ), HK_ADD_MICROVIA, 'V' + GR_KB_CTRL ); +static EDA_HOTKEY HkEndTrack( wxT( "End Track" ), HK_END_TRACK, WXK_END ); +static EDA_HOTKEY HkEditBoardItem( wxT( "Edit Item" ), HK_EDIT_ITEM, 'E' ); +static EDA_HOTKEY HkFlipFootprint( wxT( "Flip Footprint" ), HK_FLIP_FOOTPRINT, 'F' ); +static EDA_HOTKEY HkRotateItem( wxT( "Rotate Item" ), HK_ROTATE_ITEM, 'R' ); +static EDA_HOTKEY HkMoveItem( wxT( "Move Item" ), HK_MOVE_ITEM, 'M' ); +static EDA_HOTKEY HkDragFootprint( wxT( "Drag Footprint" ), HK_DRAG_ITEM, 'G' ); +static EDA_HOTKEY HkGetAndMoveFootprint( wxT( "Get and Move Footprint" ), + HK_GET_AND_MOVE_FOOTPRINT, 'T' ); +static EDA_HOTKEY HkLock_Unlock_Footprint( wxT( "Lock/Unlock Footprint" ), + HK_LOCK_UNLOCK_FOOTPRINT, 'L' ); +static EDA_HOTKEY HkDelete( wxT( "Delete Track or Footprint" ), HK_DELETE, WXK_DELETE ); +static EDA_HOTKEY HkResetLocalCoord( wxT( "Reset Local Coordinates" ), + HK_RESET_LOCAL_COORD, ' ' ); /* Fit on Screen */ #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 -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 -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 */ #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 -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 /* Zoom In */ #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 -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 /* Zoom Out */ #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 -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 -static Ki_HotkeyInfo HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); +static EDA_HOTKEY HkHelp( wxT( "Help (this window)" ), HK_HELP, '?' ); /* 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 */ #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 -static Ki_HotkeyInfo HkRedo( wxT( "Redo" ), HK_REDO, - GR_KB_SHIFT + GR_KB_CTRL + 'Z', - (int) wxID_REDO ); +static EDA_HOTKEY HkRedo( wxT( "Redo" ), HK_REDO, + GR_KB_SHIFT + GR_KB_CTRL + 'Z', + (int) wxID_REDO ); #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' - + GR_KB_CTRL ); +static EDA_HOTKEY HkSwitchTrackWidthToPrevious( wxT( "Switch Track Width To Previous" ), + HK_SWITCH_TRACK_WIDTH_TO_PREVIOUS, 'W' + + 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, '`' - + GR_KB_CTRL ); +static EDA_HOTKEY HkSwitchGridToPrevious( wxT( "Switch Grid To Previous" ), + HK_SWITCH_GRID_TO_PREVIOUS, '`' + GR_KB_CTRL ); -static Ki_HotkeyInfo HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' - + GR_KB_CTRL ); -static Ki_HotkeyInfo HkTrackDisplayMode( wxT( "Track Display Mode" ), - HK_SWITCH_TRACK_DISPLAY_MODE, 'K' ); -static Ki_HotkeyInfo HkAddModule( wxT( "Add Module" ), HK_ADD_MODULE, 'O' ); +static EDA_HOTKEY HkSwitchUnits( wxT( "Switch Units" ), HK_SWITCH_UNITS, 'U' + GR_KB_CTRL ); +static EDA_HOTKEY HkTrackDisplayMode( wxT( "Track Display Mode" ), + HK_SWITCH_TRACK_DISPLAY_MODE, 'K' ); +static EDA_HOTKEY HkAddModule( wxT( "Add Module" ), HK_ADD_MODULE, 'O' ); /* 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 Ki_HotkeyInfo HkCallMacros0( wxT( "Call Macro 0" ), HK_CALL_MACROS_0, '0' ); +static EDA_HOTKEY HkCallMacros0( wxT( "Call Macro 0" ), HK_CALL_MACROS_0, '0' ); -static Ki_HotkeyInfo HkRecordMacros1( wxT( "Record Macro 1" ), HK_RECORD_MACROS_1, GR_KB_CTRL+'1' ); +static EDA_HOTKEY HkRecordMacros1( wxT( "Record Macro 1" ), HK_RECORD_MACROS_1, GR_KB_CTRL+'1' ); -static Ki_HotkeyInfo HkCallMacros1( wxT( "Call Macro 1" ), HK_CALL_MACROS_1, '1' ); +static EDA_HOTKEY HkCallMacros1( wxT( "Call Macro 1" ), HK_CALL_MACROS_1, '1' ); -static Ki_HotkeyInfo HkRecordMacros2( wxT( "Record Macro 2" ), HK_RECORD_MACROS_2, GR_KB_CTRL+'2' ); +static EDA_HOTKEY HkRecordMacros2( wxT( "Record Macro 2" ), HK_RECORD_MACROS_2, GR_KB_CTRL+'2' ); -static Ki_HotkeyInfo HkCallMacros2( wxT( "Call Macro 2" ), HK_CALL_MACROS_2, '2' ); +static EDA_HOTKEY HkCallMacros2( wxT( "Call Macro 2" ), HK_CALL_MACROS_2, '2' ); -static Ki_HotkeyInfo HkRecordMacros3( wxT( "Record Macro 3" ), HK_RECORD_MACROS_3, GR_KB_CTRL+'3' ); +static EDA_HOTKEY HkRecordMacros3( wxT( "Record Macro 3" ), HK_RECORD_MACROS_3, GR_KB_CTRL+'3' ); -static Ki_HotkeyInfo HkCallMacros3( wxT( "Call Macro 3" ), HK_CALL_MACROS_3, '3' ); +static EDA_HOTKEY HkCallMacros3( wxT( "Call Macro 3" ), HK_CALL_MACROS_3, '3' ); -static Ki_HotkeyInfo HkRecordMacros4( wxT( "Record Macro 4" ), HK_RECORD_MACROS_4, GR_KB_CTRL+'4' ); +static EDA_HOTKEY HkRecordMacros4( wxT( "Record Macro 4" ), HK_RECORD_MACROS_4, GR_KB_CTRL+'4' ); -static Ki_HotkeyInfo HkCallMacros4( wxT( "Call Macro 4" ), HK_CALL_MACROS_4, '4' ); +static EDA_HOTKEY HkCallMacros4( wxT( "Call Macro 4" ), HK_CALL_MACROS_4, '4' ); -static Ki_HotkeyInfo HkRecordMacros5( wxT( "Record Macro 5" ), HK_RECORD_MACROS_5, GR_KB_CTRL+'5' ); +static EDA_HOTKEY HkRecordMacros5( wxT( "Record Macro 5" ), HK_RECORD_MACROS_5, GR_KB_CTRL+'5' ); -static Ki_HotkeyInfo HkCallMacros5( wxT( "Call Macro 5" ), HK_CALL_MACROS_5, '5' ); +static EDA_HOTKEY HkCallMacros5( wxT( "Call Macro 5" ), HK_CALL_MACROS_5, '5' ); -static Ki_HotkeyInfo HkRecordMacros6( wxT( "Record Macro 6" ), HK_RECORD_MACROS_6, GR_KB_CTRL+'6' ); +static EDA_HOTKEY HkRecordMacros6( wxT( "Record Macro 6" ), HK_RECORD_MACROS_6, GR_KB_CTRL+'6' ); -static Ki_HotkeyInfo HkCallMacros6( wxT( "Call Macro 6" ), HK_CALL_MACROS_6, '6' ); +static EDA_HOTKEY HkCallMacros6( wxT( "Call Macro 6" ), HK_CALL_MACROS_6, '6' ); -static Ki_HotkeyInfo HkRecordMacros7( wxT( "Record Macro 7" ), HK_RECORD_MACROS_7, GR_KB_CTRL+'7' ); +static EDA_HOTKEY HkRecordMacros7( wxT( "Record Macro 7" ), HK_RECORD_MACROS_7, GR_KB_CTRL+'7' ); -static Ki_HotkeyInfo HkCallMacros7( wxT( "Call Macro 7" ), HK_CALL_MACROS_7, '7' ); +static EDA_HOTKEY HkCallMacros7( wxT( "Call Macro 7" ), HK_CALL_MACROS_7, '7' ); -static Ki_HotkeyInfo HkRecordMacros8( wxT( "Record Macro 8" ), HK_RECORD_MACROS_8, GR_KB_CTRL+'8' ); +static EDA_HOTKEY HkRecordMacros8( wxT( "Record Macro 8" ), HK_RECORD_MACROS_8, GR_KB_CTRL+'8' ); -static Ki_HotkeyInfo HkCallMacros8( wxT( "Call Macro 8" ), HK_CALL_MACROS_8, '8' ); +static EDA_HOTKEY HkCallMacros8( wxT( "Call Macro 8" ), HK_CALL_MACROS_8, '8' ); -static Ki_HotkeyInfo HkRecordMacros9( wxT( "Record Macro 9" ), HK_RECORD_MACROS_9, GR_KB_CTRL+'9' ); +static EDA_HOTKEY 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 -Ki_HotkeyInfo* common_Hotkey_List[] = +EDA_HOTKEY* common_Hotkey_List[] = { &HkHelp, &HkZoomIn, &HkZoomOut, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, @@ -204,7 +201,7 @@ Ki_HotkeyInfo* common_Hotkey_List[] = }; // List of hotkey descriptors for pcbnew -Ki_HotkeyInfo* board_edit_Hotkey_List[] = +EDA_HOTKEY* board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete, &HkBackspace, @@ -231,7 +228,7 @@ Ki_HotkeyInfo* board_edit_Hotkey_List[] = }; // List of hotkey descriptors for the module editor -Ki_HotkeyInfo* module_edit_Hotkey_List[] = { +EDA_HOTKEY* module_edit_Hotkey_List[] = { &HkMoveItem, &HkRotateItem, &HkEditBoardItem, &HkDelete, NULL @@ -239,38 +236,25 @@ Ki_HotkeyInfo* module_edit_Hotkey_List[] = { // list of sections and corresponding hotkey list for pcbnew // (used to create an hotkey config file, and edit hotkeys ) -struct Ki_HotkeyInfoSectionDescriptor g_Pcbnew_Editor_Hokeys_Descr[] = -{ { - &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 - } }; +struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[] = { + { &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 } +}; // list of sections and corresponding hotkey list for the board editor // (used to list current hotkeys in the board editor) -struct Ki_HotkeyInfoSectionDescriptor g_Board_Editor_Hokeys_Descr[] = -{ { - &g_CommonSectionTag, common_Hotkey_List, - NULL - },{ - &g_BoardEditorSectionTag, board_edit_Hotkey_List, NULL - },{ - NULL, NULL, NULL - } }; +struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[] = { + { &g_CommonSectionTag, common_Hotkey_List, NULL }, + { &g_BoardEditorSectionTag, board_edit_Hotkey_List, NULL }, + { NULL, NULL, NULL } +}; // list of sections and corresponding hotkey list for the footprint editor // (used to list current hotkeys in the module editor) -struct Ki_HotkeyInfoSectionDescriptor g_Module_Editor_Hokeys_Descr[] = -{ { - &g_CommonSectionTag, common_Hotkey_List, NULL - },{ - &g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL - },{ - NULL, NULL, NULL - } }; - +struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[] = { + { &g_CommonSectionTag, common_Hotkey_List, NULL }, + { &g_ModuleEditSectionTag, module_edit_Hotkey_List, NULL }, + { NULL, NULL, NULL } +}; diff --git a/pcbnew/hotkeys.h b/pcbnew/hotkeys.h index 4eba6a5499..a733830232 100644 --- a/pcbnew/hotkeys.h +++ b/pcbnew/hotkeys.h @@ -79,24 +79,26 @@ enum hotkey_id_commnand { HK_CALL_MACROS_9 }; -// Full list of hotkey descriptors for borad editor and footprint editor -extern struct Ki_HotkeyInfoSectionDescriptor g_Pcbnew_Editor_Hokeys_Descr[]; +// Full list of hotkey descriptors for board editor and footprint editor +extern struct EDA_HOTKEY_CONFIG g_Pcbnew_Editor_Hokeys_Descr[]; // 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 -extern struct Ki_HotkeyInfoSectionDescriptor g_Module_Editor_Hokeys_Descr[]; +extern struct EDA_HOTKEY_CONFIG g_Module_Editor_Hokeys_Descr[]; // List of common hotkey descriptors // 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 // 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 // used in hotkeys_module_editor.cpp -extern Ki_HotkeyInfo* module_edit_Hotkey_List[]; +extern EDA_HOTKEY* module_edit_Hotkey_List[]; #endif /* _PCBNEW_HOTKEYS_H_ */ diff --git a/pcbnew/hotkeys_board_editor.cpp b/pcbnew/hotkeys_board_editor.cpp index 60e6cee66b..8050fc93ef 100644 --- a/pcbnew/hotkeys_board_editor.cpp +++ b/pcbnew/hotkeys_board_editor.cpp @@ -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) { - assert(aNumber >= 0); - assert(aNumber < 10); + assert( aNumber >= 0 ); + assert( aNumber < 10 ); wxString msg, tmp; if( m_RecordingMacros < 0 ) { 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(); - msg.Printf( wxT("%s %d"), _( "Recording macros" ), aNumber); - SetStatusText(msg); + msg.Printf( wxT( "%s %d" ), _( "Recording macros" ), aNumber ); + SetStatusText( msg ); } else { m_RecordingMacros = -1; - msg.Printf( wxT("%s %d %s"), _( "Macros" ), aNumber, _( "recorded" )); - SetStatusText(msg); + msg.Printf( wxT( "%s %d %s" ), _( "Macros" ), aNumber, _( "recorded" ) ); + SetStatusText( msg ); } } -/** - * 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) +void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumber ) { PCB_SCREEN* screen = GetScreen(); wxPoint tPosition; wxString msg; - msg.Printf( wxT("%s %d"), _( "Call macros"), aNumber); + msg.Printf( wxT( "%s %d" ), _( "Call macros" ), aNumber ); SetStatusText( msg ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); @@ -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, EDA_ITEM* aItem ) { @@ -124,7 +102,7 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit if( (aHotkeyCode >= 'a') && (aHotkeyCode <= 'z') ) 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 ) HK_Descr = GetDescriptorFromHotkey( aHotkeyCode, board_edit_Hotkey_List ); @@ -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 ) { BOARD_ITEM* item = GetCurItem(); @@ -823,14 +789,7 @@ bool PCB_EDIT_FRAME::OnHotkeyEditItem( int aIdCommand ) 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 ) { BOARD_ITEM* item = GetCurItem(); diff --git a/pcbnew/hotkeys_module_editor.cpp b/pcbnew/hotkeys_module_editor.cpp index 5e2221ff2e..61e8684859 100644 --- a/pcbnew/hotkeys_module_editor.cpp +++ b/pcbnew/hotkeys_module_editor.cpp @@ -1,6 +1,6 @@ -/*****************************/ -/* hotkeys_module_editor.cpp */ -/*****************************/ +/** + * @file hotkeys_module_editor.cpp + */ #include "fctsys.h" #include "pcbnew.h" @@ -36,7 +36,7 @@ void FOOTPRINT_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPos if( (aHotKey >= 'a') && (aHotKey <= 'z') ) 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 ) HK_Descr = GetDescriptorFromHotkey( aHotKey, module_edit_Hotkey_List ); diff --git a/pcbnew/modules.cpp b/pcbnew/modules.cpp index 2b55475998..8835df3c0e 100644 --- a/pcbnew/modules.cpp +++ b/pcbnew/modules.cpp @@ -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. */ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase ) diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 884b26f18d..050d76e3c0 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -1,6 +1,6 @@ /** * @file pcbnew.cpp - * @file PCBNEW: main program. + * @brief PCBNEW: main program. */ #include "fctsys.h" diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 3c4b6d74dd..1be1f43194 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -49,6 +49,7 @@ static bool setDouble( double* aDouble, double aValue, double aMin, double aMax return true; } + /*******************************/ /* Dialog box for plot control */ /*******************************/ @@ -63,8 +64,10 @@ private: double m_YScaleAdjust; static wxPoint prevPosition; // Dialog position & size static wxSize prevSize; + public: DIALOG_PLOT( PCB_EDIT_FRAME* parent ); + private: void Init_Dialog(); void Plot( wxCommandEvent& event ); @@ -77,6 +80,7 @@ private: void CreateDrillFile( wxCommandEvent& event ); }; + wxPoint DIALOG_PLOT::prevPosition( -1, -1 ); wxSize DIALOG_PLOT::prevSize; @@ -95,8 +99,7 @@ DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* parent ) : GetSizer()->SetSizeHints( this ); if( prevPosition.x != -1 ) - SetSize( prevPosition.x, prevPosition.y, - prevSize.x, prevSize.y ); + SetSize( prevPosition.x, prevPosition.y, prevSize.x, prevSize.y ); else Center(); } @@ -153,6 +156,7 @@ void DIALOG_PLOT::Init_Dialog() // (Front or Top to Back or Bottom) DECLARE_LAYERS_ORDER_LIST( layersOrder ); int layerIndex, checkIndex, layer; + for( layerIndex = 0; layerIndex < NB_LAYERS; layerIndex++ ) { layer = layersOrder[layerIndex]; @@ -265,6 +269,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) // to preselect it when opening the dialog. wxFileName fn( m_outputDirectoryName->GetValue() ); wxString path; + if( fn.IsRelative() ) path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue(); else @@ -495,6 +500,7 @@ void DIALOG_PLOT::applyPlotSettings() msg.Printf( wxT( "X scale constrained!\n" ) ); m_messagesBox->AppendText( msg ); } + m_Config->Write( CONFIG_XFINESCALE_ADJ, m_XScaleAdjust ); // Y scale @@ -508,6 +514,7 @@ void DIALOG_PLOT::applyPlotSettings() msg.Printf( wxT( "Y scale constrained!\n" ) ); m_messagesBox->AppendText( msg ); } + m_Config->Write( CONFIG_YFINESCALE_ADJ, m_YScaleAdjust ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); @@ -516,13 +523,14 @@ void DIALOG_PLOT::applyPlotSettings() long selectedLayers = 0; unsigned int i; + for( i = 0; i < layerList.size(); i++ ) { if( m_layerCheckListBox->IsChecked( i ) ) selectedLayers |= (1 << layerList[i]); } - tempOptions.SetLayerSelection( selectedLayers ); + tempOptions.SetLayerSelection( selectedLayers ); tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue(); tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() ); @@ -581,6 +589,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) g_PcbPlotOptions.m_AutoScale = false; g_PcbPlotOptions.m_PlotScale = 1; + switch( g_PcbPlotOptions.GetScaleSelection() ) { default: @@ -610,6 +619,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) */ if( m_fineAdjustXscaleOpt->IsEnabled() && m_XScaleAdjust != 0.0 ) g_PcbPlotOptions.m_FineScaleAdjustX = m_XScaleAdjust; + if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 ) g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust; @@ -637,15 +647,18 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) // Test for a reasonable scale value if( g_PcbPlotOptions.m_PlotScale < MIN_SCALE ) 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 ) DisplayInfoMessage( this, - _( "Warning: Scale option set to a very large value" ) ); + _( "Warning: Scale option set to a very large value" ) ); long layerMask = 1; + for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 ) { bool success = false; + if( g_PcbPlotOptions.GetLayerSelection() & layerMask ) { fn = m_Parent->GetScreen()->GetFileName(); @@ -742,42 +755,43 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) switch( g_PcbPlotOptions.GetPlotFormat() ) { case PLOT_FORMAT_POST: - success = m_Parent->Genere_PS( fn.GetFullPath(), layer, - g_PcbPlotOptions.GetPsA4Output(), - g_PcbPlotOptions.m_PlotMode ); + success = m_Parent->ExportToPostScriptFile( fn.GetFullPath(), layer, + g_PcbPlotOptions.GetPsA4Output(), + g_PcbPlotOptions.m_PlotMode ); break; case PLOT_FORMAT_GERBER: - success = m_Parent->Genere_GERBER( fn.GetFullPath(), layer, - g_PcbPlotOptions.GetUseAuxOrigin(), - g_PcbPlotOptions.m_PlotMode ); + success = m_Parent->ExportToGerberFile( fn.GetFullPath(), layer, + g_PcbPlotOptions.GetUseAuxOrigin(), + g_PcbPlotOptions.m_PlotMode ); break; case PLOT_FORMAT_HPGL: - success = m_Parent->Genere_HPGL( fn.GetFullPath(), layer, - g_PcbPlotOptions.m_PlotMode ); + success = m_Parent->ExportToHpglFile( fn.GetFullPath(), layer, + g_PcbPlotOptions.m_PlotMode ); break; case PLOT_FORMAT_DXF: - success = m_Parent->Genere_DXF( fn.GetFullPath(), layer, - g_PcbPlotOptions.m_PlotMode ); + success = m_Parent->ExportToDxfFile( fn.GetFullPath(), layer, + g_PcbPlotOptions.m_PlotMode ); break; } // Print diags in messages box: wxString msg; + if( success ) msg.Printf( _( "Plot file <%s> created" ), GetChars( fn.GetFullPath() ) ); else msg.Printf( _( "Unable to create <%s>" ), GetChars( fn.GetFullPath() ) ); + msg << wxT( "\n" ); m_messagesBox->AppendText( msg ); } } // If no layer selected, we have nothing plotted. - // Prompt user if it happens - // because he could think there is a bug in pcbnew: + // Prompt user if it happens because he could think there is a bug in pcbnew. if( !g_PcbPlotOptions.GetLayerSelection() ) DisplayError( this, _( "No layer selected" ) ); } diff --git a/pcbnew/plotdxf.cpp b/pcbnew/plotdxf.cpp index 8430b31639..06e3801250 100644 --- a/pcbnew/plotdxf.cpp +++ b/pcbnew/plotdxf.cpp @@ -15,11 +15,13 @@ #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; - FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); + FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); + if( output_file == NULL ) { return false; @@ -31,13 +33,13 @@ bool PCB_BASE_FRAME::Genere_DXF( const wxString& FullFileName, int Layer, GRTrac plotter->set_paper_size( currentsheet ); plotter->set_viewport( wxPoint( 0, 0 ), 1, 0 ); plotter->set_creator( wxT( "PCBNEW-DXF" ) ); - plotter->set_filename( FullFileName ); + plotter->set_filename( aFullFileName ); plotter->start_plot( output_file ); if( g_PcbPlotOptions.m_PlotFrameRef ) PlotWorkSheet( plotter, GetScreen() ); - Plot_Layer( plotter, Layer, trace_mode ); + Plot_Layer( plotter, aLayer, aTraceMode ); plotter->end_plot(); delete plotter; SetLocaleTo_Default(); diff --git a/pcbnew/plotgerb.cpp b/pcbnew/plotgerb.cpp index ce33c34c91..94b8910a50 100644 --- a/pcbnew/plotgerb.cpp +++ b/pcbnew/plotgerb.cpp @@ -23,16 +23,10 @@ #include "protos.h" -/* Creates the output files, one per board layer: - * filenames are like xxxc.PHO and use the RS274X format - * 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 ) +bool PCB_BASE_FRAME::ExportToGerberFile( const wxString& aFullFileName, int aLayer, + bool aPlotOriginIsAuxAxis, GRTraceMode aTraceMode ) { - FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); + FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); if( output_file == NULL ) { @@ -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 */ double scale = g_PcbPlotOptions.m_PlotScale; - if( PlotOriginIsAuxAxis ) + if( aPlotOriginIsAuxAxis ) { offset = m_Auxiliary_Axis_Position; } @@ -60,20 +54,20 @@ bool PCB_BASE_FRAME::Genere_GERBER( const wxString& FullFileName, int Layer, plotter->set_viewport( offset, scale, 0 ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_creator( wxT( "PCBNEW-RS274X" ) ); - plotter->set_filename( FullFileName ); + plotter->set_filename( aFullFileName ); if( plotter->start_plot( output_file ) ) { // Skip NPTH pads on copper layers // ( 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; // Sheet refs on gerber CAN be useful... and they're always 1:1 if( g_PcbPlotOptions.m_PlotFrameRef ) PlotWorkSheet( plotter, GetScreen() ); - Plot_Layer( plotter, Layer, trace_mode ); + Plot_Layer( plotter, aLayer, aTraceMode ); plotter->end_plot(); g_PcbPlotOptions.m_SkipNPTH_Pads = false; diff --git a/pcbnew/plothpgl.cpp b/pcbnew/plothpgl.cpp index cb23911828..6cb9955095 100644 --- a/pcbnew/plothpgl.cpp +++ b/pcbnew/plothpgl.cpp @@ -17,7 +17,8 @@ #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 BoardSize; @@ -27,7 +28,7 @@ bool PCB_BASE_FRAME::Genere_HPGL( const wxString& FullFileName, int Layer, GRTra double scale; wxPoint offset; - FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); + FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); if( output_file == NULL ) { @@ -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) / g_PcbPlotOptions.m_PlotScale ); - // compute pen_overlay (from g_m_HPGLPenOvr in mils) - // with plot scale + // compute pen_overlay (from g_m_HPGLPenOvr in mils) with plot scale if( 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 plotter->set_viewport( offset, scale, g_PcbPlotOptions.m_PlotMirror ); plotter->set_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); 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_number( g_PcbPlotOptions.m_HPGLPenNum ); plotter->set_pen_overlap( pen_overlay ); plotter->set_pen_diameter( pen_diam ); plotter->start_plot( output_file ); - /* The worksheet is not significant with scale!=1... It is with - * paperscale!=1, anyway */ + /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */ if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) PlotWorkSheet( plotter, GetScreen() ); - Plot_Layer( plotter, Layer, trace_mode ); + Plot_Layer( plotter, aLayer, aTraceMode ); plotter->end_plot(); delete plotter; SetLocaleTo_Default(); diff --git a/pcbnew/plotps.cpp b/pcbnew/plotps.cpp index 4e0919fc29..46f156c592 100644 --- a/pcbnew/plotps.cpp +++ b/pcbnew/plotps.cpp @@ -21,8 +21,8 @@ /* Generate a PostScript file (*. ps) of the circuit layer. * If layer < 0: all layers are plotted. */ -bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, - bool useA4, GRTraceMode trace_mode ) +bool PCB_BASE_FRAME::ExportToPostScriptFile( const wxString& aFullFileName, int aLayer, + bool aUseA4, GRTraceMode aTraceMode ) { wxSize SheetSize; wxSize PaperSize; @@ -34,7 +34,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, Ki_PageDescr* SheetPS; wxPoint offset; - FILE* output_file = wxFopen( FullFileName, wxT( "wt" ) ); + FILE* output_file = wxFopen( aFullFileName, wxT( "wt" ) ); if( output_file == NULL ) { @@ -54,7 +54,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, SheetSize.x = currentsheet->m_Size.x * U_PCB; SheetSize.y = currentsheet->m_Size.y * U_PCB; - if( useA4 ) + if( aUseA4 ) { SheetPS = &g_Sheet_A4; 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, scale = MIN( Xscale, Yscale ); } else + { scale = g_PcbPlotOptions.m_PlotScale * paperscale; + } if( Center ) { @@ -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_default_line_width( g_PcbPlotOptions.m_PlotLineWidth ); plotter->set_creator( wxT( "PCBNEW-PS" ) ); - plotter->set_filename( FullFileName ); + plotter->set_filename( aFullFileName ); plotter->start_plot( output_file ); - /* The worksheet is not significant with scale!=1... It is with - * paperscale!=1, anyway */ + /* The worksheet is not significant with scale!=1... It is with paperscale!=1, anyway */ if( g_PcbPlotOptions.m_PlotFrameRef && !Center ) PlotWorkSheet( plotter, GetScreen() ); @@ -126,7 +127,7 @@ bool PCB_BASE_FRAME::Genere_PS( const wxString& FullFileName, int Layer, plotter->set_color( BLACK ); } - Plot_Layer( plotter, Layer, trace_mode ); + Plot_Layer( plotter, aLayer, aTraceMode ); plotter->end_plot(); delete plotter; SetLocaleTo_Default();