diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 882dc57722..6032ff9117 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -179,7 +179,6 @@ set( COMMON_SRCS grid_tricks.cpp gr_basic.cpp hotkeys_basic.cpp - hotkey_grid_table.cpp html_messagebox.cpp kiface_i.cpp kiway.cpp diff --git a/common/dialogs/dialog_hotkeys_editor.cpp b/common/dialogs/dialog_hotkeys_editor.cpp index 1c249b7f3c..04025a08f2 100644 --- a/common/dialogs/dialog_hotkeys_editor.cpp +++ b/common/dialogs/dialog_hotkeys_editor.cpp @@ -30,59 +30,252 @@ #include #include #include +#include #include -void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys ) -{ - HOTKEYS_EDITOR_DIALOG dialog( parent, hotkeys ); - int diag = dialog.ShowModal(); - if( diag == wxID_OK ) +HOTKEY_LIST_CTRL::HOTKEY_LIST_CTRL( wxWindow *aParent, struct EDA_HOTKEY_CONFIG* aSection ) : + wxListCtrl( aParent, wxID_ANY, wxDefaultPosition, + wxDefaultSize, wxLC_HRULES|wxLC_REPORT|wxLC_SINGLE_SEL|wxLC_VIRTUAL ) +{ + m_sectionTag = aSection->m_SectionTag; + m_curEditingRow = -1; + + InsertColumn( 0, _( "Command" ) ); + InsertColumn( 1, _( "Hotkey" ) ); + + // Add a dummy hotkey_spec which is a header before each hotkey list + EDA_HOTKEY** hotkey_descr_list; + + // Add a copy of hotkeys to our list + for( hotkey_descr_list = aSection->m_HK_InfoList; *hotkey_descr_list; + hotkey_descr_list++ ) { - parent->ReCreateMenuBar(); - parent->Refresh(); + EDA_HOTKEY* hotkey_descr = *hotkey_descr_list; + m_hotkeys.push_back( new EDA_HOTKEY( hotkey_descr ) ); + } + + // Set item count to hotkey size, this gets it to autoload the entries + SetItemCount( m_hotkeys.size() ); + + SetColumnWidth( 0, wxLIST_AUTOSIZE ); + SetColumnWidth( 1, wxLIST_AUTOSIZE ); + + Bind( wxEVT_CHAR, &HOTKEY_LIST_CTRL::OnChar, this ); + Bind( wxEVT_LIST_ITEM_SELECTED, &HOTKEY_LIST_CTRL::OnListItemSelected, this ); + Bind( wxEVT_SIZE, &HOTKEY_LIST_CTRL::OnSize, this ); +} + + +void HOTKEY_LIST_CTRL::OnSize( wxSizeEvent& aEvent ) +{ + float totalLength = 0; + float scale = 0; + + // Find max character length of first column + int maxInfoMsgLength = 0; + for( int i = 0; i < GetItemCount(); i++ ) + { + int length = GetItemText( i, 0 ).Length(); + if( length > maxInfoMsgLength ) + maxInfoMsgLength = length; + } + + // Find max character length of second column + int maxKeyCodeLength = 0; + for( int i = 0; i < GetItemCount(); i++ ) + { + int length = GetItemText( i, 1 ).Length(); + if( length > maxKeyCodeLength ) + maxKeyCodeLength = length; + } + + // Use the lengths of column texts to create a scale of the max list width + // to set the column widths + totalLength = maxInfoMsgLength + maxKeyCodeLength; + + scale = (float) GetClientSize().x / totalLength; + + SetColumnWidth( 0, int( maxInfoMsgLength*scale ) - 2 ); + SetColumnWidth( 1, int( maxKeyCodeLength*scale ) ); + + aEvent.Skip(); +} + + +void HOTKEY_LIST_CTRL::OnListItemSelected( wxListEvent& aEvent ) +{ + m_curEditingRow = aEvent.GetIndex(); +} + + +void HOTKEY_LIST_CTRL::DeselectRow( int aRow ) +{ + SetItemState( aRow, 0, wxLIST_STATE_SELECTED ); +} + + +wxString HOTKEY_LIST_CTRL::OnGetItemText( long aRow, long aColumn ) const +{ + EDA_HOTKEY* hotkey_descr = m_hotkeys[aRow]; + + if( aColumn == 0 ) + { + return hotkey_descr->m_InfoMsg; + } + else + { + return KeyNameFromKeyCode( hotkey_descr->m_KeyCode ); } } -HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, - EDA_HOTKEY_CONFIG* hotkeys ) : - HOTKEYS_EDITOR_DIALOG_BASE( parent ) +void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent ) { - m_parent = parent; - m_hotkeys = hotkeys; + if( m_curEditingRow != -1 ) + { + long key = aEvent.GetKeyCode(); + + switch( key ) + { + case WXK_ESCAPE: + // Remove selection + DeselectRow( m_curEditingRow ); + m_curEditingRow = -1; + break; + + default: + if( aEvent.ControlDown() ) + key |= GR_KB_CTRL; + + if( aEvent.AltDown() ) + key |= GR_KB_ALT; + + if( aEvent.ShiftDown() && (key > 256) ) + key |= GR_KB_SHIFT; + + // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL) + // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z' + if( (key > GR_KB_CTRL) && (key <= GR_KB_CTRL+26) ) + key += ('A' - 1); + + if( key >= 'a' && key <= 'z' ) // convert to uppercase + key = key + ('A' - 'a'); + + // See if this key code is handled in hotkeys names list + bool exists; + KeyNameFromKeyCode( key, &exists ); + + if( exists && m_hotkeys[m_curEditingRow]->m_KeyCode != key ) + { + bool canUpdate = ((HOTKEY_SECTION_PAGE *)m_parent)->GetDialog()->CanSetKey( key, m_sectionTag ); + + if( canUpdate ) + { + m_hotkeys[m_curEditingRow]->m_KeyCode = key; + } + + // Remove selection + DeselectRow( m_curEditingRow ); + m_curEditingRow = -1; + } + + + break; + } + } + RefreshItems(0,m_hotkeys.size()-1); +} + + +void HOTKEY_LIST_CTRL::RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection ) +{ + int row = 0; + + EDA_HOTKEY** info_ptr; + + for( info_ptr = aSection->m_HK_InfoList; *info_ptr; info_ptr++ ) + { + EDA_HOTKEY* info = *info_ptr; + m_hotkeys[row++]->m_KeyCode = info->m_KeyCode; + } + + // Remove selection + DeselectRow( m_curEditingRow ); m_curEditingRow = -1; - m_table = new HOTKEY_EDITOR_GRID_TABLE( hotkeys ); - m_hotkeyGrid->SetTable( m_table, true ); + RefreshItems( 0, m_hotkeys.size()-1 ); +} - m_hotkeyGrid->AutoSizeColumn( 0 ); - m_hotkeyGrid->EnableDragGridSize( false ); - for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i ) +HOTKEY_SECTION_PAGE::HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog, + wxNotebook* aParent, + const wxString& aTitle, + EDA_HOTKEY_CONFIG* aSection ) : + wxPanel( aParent, -1, wxDefaultPosition, wxDefaultSize, + wxTAB_TRAVERSAL | wxBORDER_SUNKEN ), + m_hotkeySection( aSection ), + m_dialog( aDialog ) +{ + aParent->AddPage( this, aTitle ); + + wxBoxSizer* bMainSizer = new wxBoxSizer( wxVERTICAL ); + + this->SetSizer( bMainSizer ); + + m_hotkeyList = new HOTKEY_LIST_CTRL( this, aSection ); + bMainSizer->Add( m_hotkeyList, 1, wxALL|wxEXPAND, 5 ); +} + + +void HOTKEY_SECTION_PAGE::Restore() +{ + m_hotkeyList->RestoreFrom( m_hotkeySection ); + + Update(); +} + + +void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys ) +{ + HOTKEYS_EDITOR_DIALOG dialog( aParent, aHotkeys ); + + int diag = dialog.ShowModal(); + if( diag == wxID_OK ) { - m_hotkeyGrid->SetReadOnly( i, 0, true ); - m_hotkeyGrid->SetReadOnly( i, 1, true ); + aParent->ReCreateMenuBar(); + aParent->Refresh(); + } +} + + +HOTKEYS_EDITOR_DIALOG::HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* aParent, + EDA_HOTKEY_CONFIG* aHotkeys ) : + HOTKEYS_EDITOR_DIALOG_BASE( aParent ), + m_parent( aParent ), + m_hotkeys( aHotkeys ) +{ + EDA_HOTKEY_CONFIG* section; + + for( section = m_hotkeys; section->m_HK_InfoList; section++ ) + { + m_hotkeySectionPages.push_back(new HOTKEY_SECTION_PAGE( this, m_hotkeySections, _( *section->m_Title ), section )); } m_OKButton->SetDefault(); - m_hotkeyGrid->SetFocus(); - GetSizer()->SetSizeHints( this ); Center(); } void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) { - /* edit the live hotkey table */ - HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector& hotkey_vec = m_table->getHotkeys(); + std::vector::iterator i; - EDA_HOTKEY_CONFIG* section; - - for( section = m_hotkeys; section->m_HK_InfoList; section++ ) + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) { - wxString sectionTag = *section->m_SectionTag; + std::vector& hotkey_vec = (*i)->GetHotkeys(); + EDA_HOTKEY_CONFIG* section = (*i)->GetHotkeySection(); EDA_HOTKEY** info_ptr; @@ -91,21 +284,20 @@ void HOTKEYS_EDITOR_DIALOG::OnOKClicked( wxCommandEvent& event ) EDA_HOTKEY* info = *info_ptr; /* find the corresponding hotkey */ - HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector::iterator i; + std::vector::iterator j; - for( i = hotkey_vec.begin(); i != hotkey_vec.end(); ++i ) + for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j ) { - if( i->first == sectionTag - && i->second - && i->second->m_Idcommand == info->m_Idcommand ) + if( (*j) && (*j)->m_Idcommand == info->m_Idcommand ) { - info->m_KeyCode = i->second->m_KeyCode; + info->m_KeyCode = (*j)->m_KeyCode; break; } } } } + /* save the hotkeys */ m_parent->WriteHotkeyConfig( m_hotkeys ); @@ -119,154 +311,73 @@ void HOTKEYS_EDITOR_DIALOG::CancelClicked( wxCommandEvent& event ) } -/* Reinit the hotkeys to the initial state (remove all pending changes +/** + * Function UndoClicked + * Reinit the hotkeys to the initial state (remove all pending changes + * + * @param aEvent is the button press event, unused */ -void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& event ) +void HOTKEYS_EDITOR_DIALOG::UndoClicked( wxCommandEvent& aEvent ) { - m_table->RestoreFrom( m_hotkeys ); - m_curEditingRow = -1; + std::vector::iterator i; - for( int i = 0; i < m_hotkeyGrid->GetNumberRows(); ++i ) - SetHotkeyCellState( i, false ); - - m_hotkeyGrid->Refresh(); - Update(); -} - - -void HOTKEYS_EDITOR_DIALOG::SetHotkeyCellState( int aRow, bool aHightlight ) -{ - if( aHightlight ) + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) { - m_hotkeyGrid->SetCellTextColour( aRow, 1, *wxRED ); - wxFont bold_font(m_hotkeyGrid->GetDefaultCellFont() ); - bold_font.SetWeight(wxFONTWEIGHT_BOLD); - m_hotkeyGrid->SetCellFont( aRow, 1, bold_font ); - } - else - { - m_hotkeyGrid->SetCellTextColour( aRow, 1, m_hotkeyGrid->GetDefaultCellTextColour() ); - m_hotkeyGrid->SetCellFont( aRow, 1, m_hotkeyGrid->GetDefaultCellFont() ); + (*i)->Restore(); } } -void HOTKEYS_EDITOR_DIALOG::OnClickOnCell( wxGridEvent& event ) +bool HOTKEYS_EDITOR_DIALOG::CanSetKey( long aKey, const wxString* sectionTag ) { - if( m_curEditingRow != -1 ) - SetHotkeyCellState( m_curEditingRow, false ); + std::vector::iterator i; - int newRow = event.GetRow(); + EDA_HOTKEY* conflictingKey = NULL; + HOTKEY_SECTION_PAGE* conflictingSection = NULL; - if( ( event.GetCol() != 1 ) || ( m_table->IsHeader( newRow ) ) ) + for( i = m_hotkeySectionPages.begin(); i != m_hotkeySectionPages.end(); ++i ) { - m_curEditingRow = -1; - } - else - { - m_curEditingRow = newRow; - SetHotkeyCellState( m_curEditingRow, true ); - } - m_hotkeyGrid->Refresh(); - Update(); -} + // Any non Common section can only conflict with itself and Common + if( *sectionTag != g_CommonSectionTag + && *((*i)->GetHotkeySection()->m_SectionTag) != g_CommonSectionTag + && *((*i)->GetHotkeySection()->m_SectionTag) != *sectionTag ) + continue; + std::vector& hotkey_vec = (*i)->GetHotkeys(); + /* find the corresponding hotkey */ + std::vector::iterator j; -/** OnRightClickOnCell - * If a cell is selected, display a list of keys for selection - * The list is restricted to keys that cannot be entered: - * tab, home, return ... because these keys have special functions in dialogs - */ -void HOTKEYS_EDITOR_DIALOG::OnRightClickOnCell( wxGridEvent& event ) -{ - // Select the new cell if needed - OnClickOnCell(event); - - if( m_curEditingRow == -1 ) - return; - - // Do not translate these key names. They are internally used. - // See hotkeys_basic.cpp - #define C_COUNT 9 - wxString choices[C_COUNT] = - { - wxT("End") - wxT("Tab"), - wxT("Ctrl+Tab"), - wxT("Alt+Tab"), - wxT("Home"), - wxT("Space"), - wxT("Ctrl+Space"), - wxT("Alt+Space"), - wxT("Return") - }; - - wxString keyname = wxGetSingleChoice( _( "Special keys only. For others keys, use keyboard" ), - _( "Select a key" ), C_COUNT, choices, this ); - int key = KeyCodeFromKeyName( 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 ) - { - long key = event.GetKeyCode(); - - switch( key ) + for( j = hotkey_vec.begin(); j != hotkey_vec.end(); ++j ) { - case WXK_ESCAPE: - SetHotkeyCellState( m_curEditingRow, false ); - m_curEditingRow = -1; - break; - - default: - if( event.ControlDown() ) - key |= GR_KB_CTRL; - - if( event.AltDown() ) - key |= GR_KB_ALT; - - if( event.ShiftDown() && (key > 256) ) - key |= GR_KB_SHIFT; - - // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL) - // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z' - if( (key > GR_KB_CTRL) && (key <= GR_KB_CTRL+26) ) - key += ('A' - 1); - - if( key >= 'a' && key <= 'z' ) // convert to uppercase - key = key + ('A' - 'a'); - -#if 0 // For debug only - wxString msg; - msg.Printf(wxT("key %X, keycode %X"),event.GetKeyCode(), key); - wxMessageBox(msg); -#endif - // See if this key code is handled in hotkeys names list - bool exists; - KeyNameFromKeyCode( key, &exists ); - - if( !exists ) // not handled, see hotkeys_basic.cpp + if( aKey == (*j)->m_KeyCode ) { - wxMessageBox( _( "Hotkey code not handled" ) ); - } - else - { - m_table->SetKeyCode( m_curEditingRow, key ); - } + conflictingKey = (*j); + conflictingSection = (*i); - break; + break; + } } } - m_hotkeyGrid->Refresh(); - Update(); + if( conflictingKey != NULL ) + { + wxString msg = wxString::Format( + _( "<%s> is already assigned to \"%s\" in section \"%s\". Are you sure you want to change its assignment?" ), + KeyNameFromKeyCode( aKey ), conflictingKey->m_InfoMsg, *(conflictingSection->GetHotkeySection()->m_Title) + ); + + wxMessageDialog dlg( this, msg, _( "Confirm change" ), wxYES_NO | wxNO_DEFAULT ); + + if( dlg.ShowModal() == wxID_YES ) + { + conflictingKey->m_KeyCode = 0; + return true; + } + else + { + return false; + } + } + + return true; } diff --git a/common/dialogs/dialog_hotkeys_editor_base.cpp b/common/dialogs/dialog_hotkeys_editor_base.cpp index 175ab779ee..65f821fedb 100644 --- a/common/dialogs/dialog_hotkeys_editor_base.cpp +++ b/common/dialogs/dialog_hotkeys_editor_base.cpp @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 6 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -14,37 +14,18 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind this->SetSizeHints( wxDefaultSize, wxDefaultSize ); wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxHORIZONTAL ); + bMainSizer = new wxBoxSizer( wxVERTICAL ); - m_hotkeyGrid = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxDOUBLE_BORDER|wxTAB_TRAVERSAL|wxWANTS_CHARS ); + m_staticText1 = new wxStaticText( this, wxID_ANY, _("Select a row and press a new key combination to alter the binding."), wxDefaultPosition, wxDefaultSize, 0 ); + m_staticText1->Wrap( 400 ); + bMainSizer->Add( m_staticText1, 0, wxALL|wxEXPAND, 5 ); - // Grid - m_hotkeyGrid->CreateGrid( 1, 2 ); - m_hotkeyGrid->EnableEditing( false ); - m_hotkeyGrid->EnableGridLines( true ); - m_hotkeyGrid->EnableDragGridSize( false ); - m_hotkeyGrid->SetMargins( 0, 0 ); + m_hotkeySections = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 ); - // Columns - m_hotkeyGrid->AutoSizeColumns(); - m_hotkeyGrid->EnableDragColMove( false ); - m_hotkeyGrid->EnableDragColSize( true ); - m_hotkeyGrid->SetColLabelSize( 30 ); - m_hotkeyGrid->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Rows - m_hotkeyGrid->EnableDragRowSize( true ); - m_hotkeyGrid->SetRowLabelSize( 0 ); - m_hotkeyGrid->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE ); - - // Label Appearance - - // Cell Defaults - m_hotkeyGrid->SetDefaultCellAlignment( wxALIGN_LEFT, wxALIGN_TOP ); - bMainSizer->Add( m_hotkeyGrid, 1, wxALL|wxEXPAND, 5 ); + bMainSizer->Add( m_hotkeySections, 1, wxEXPAND | wxALL, 5 ); wxBoxSizer* b_buttonsSizer; - b_buttonsSizer = new wxBoxSizer( wxVERTICAL ); + b_buttonsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OKButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); b_buttonsSizer->Add( m_OKButton, 0, wxALL|wxEXPAND, 5 ); @@ -56,16 +37,13 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind b_buttonsSizer->Add( m_undoButton, 0, wxALL|wxEXPAND, 5 ); - bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 ); + bMainSizer->Add( b_buttonsSizer, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5 ); this->SetSizer( bMainSizer ); this->Layout(); // Connect Events - m_hotkeyGrid->Connect( wxEVT_CHAR, wxKeyEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnKeyPressed ), NULL, this ); - m_hotkeyGrid->Connect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnRightClickOnCell ), NULL, this ); - m_hotkeyGrid->Connect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnClickOnCell ), NULL, this ); m_OKButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this ); m_cancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this ); m_undoButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this ); @@ -74,9 +52,6 @@ HOTKEYS_EDITOR_DIALOG_BASE::HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWind HOTKEYS_EDITOR_DIALOG_BASE::~HOTKEYS_EDITOR_DIALOG_BASE() { // Disconnect Events - m_hotkeyGrid->Disconnect( wxEVT_CHAR, wxKeyEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnKeyPressed ), NULL, this ); - m_hotkeyGrid->Disconnect( wxEVT_GRID_CELL_RIGHT_CLICK, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnRightClickOnCell ), NULL, this ); - m_hotkeyGrid->Disconnect( wxEVT_GRID_SELECT_CELL, wxGridEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnClickOnCell ), NULL, this ); m_OKButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::OnOKClicked ), NULL, this ); m_cancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::CancelClicked ), NULL, this ); m_undoButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( HOTKEYS_EDITOR_DIALOG_BASE::UndoClicked ), NULL, this ); diff --git a/common/dialogs/dialog_hotkeys_editor_base.fbp b/common/dialogs/dialog_hotkeys_editor_base.fbp index a4cb362dfa..e4661000d7 100644 --- a/common/dialogs/dialog_hotkeys_editor_base.fbp +++ b/common/dialogs/dialog_hotkeys_editor_base.fbp @@ -1,6 +1,6 @@ - + C++ @@ -20,8 +20,10 @@ . 1 + 1 1 1 + UI 0 0 @@ -42,7 +44,7 @@ HOTKEYS_EDITOR_DIALOG_BASE - 304,235 + 450,500 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Hotkeys Editor @@ -89,13 +91,13 @@ bMainSizer - wxHORIZONTAL + wxVERTICAL none 5 wxALL|wxEXPAND - 1 - + 0 + 1 1 1 @@ -104,50 +106,26 @@ - 1 - 0 1 - - - wxALIGN_LEFT - - wxALIGN_TOP 0 1 - wxALIGN_CENTRE - 30 - - wxALIGN_CENTRE - 2 - 1 0 Dock 0 Left - 0 - 1 - 0 - 1 - 0 1 1 - - 1 0 0 wxID_ANY - - - - 0 - 0 + Select a row and press a new key combination to alter the binding. 0 @@ -155,7 +133,7 @@ 0 1 - m_hotkeyGrid + m_staticText1 1 @@ -163,55 +141,19 @@ 1 Resizable - wxALIGN_CENTRE - 0 - - wxALIGN_CENTRE - - 1 1 + 0 - wxDOUBLE_BORDER|wxTAB_TRAVERSAL|wxWANTS_CHARS - OnKeyPressed + + 400 + - - - - OnRightClickOnCell - - - - - - - - - - - - - - - - - - - - - - - - - - - - OnClickOnCell @@ -236,18 +178,102 @@ 5 - wxALIGN_CENTER_VERTICAL + wxEXPAND | wxALL + 1 + + 1 + 1 + 1 + 1 + + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_hotkeySections + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER|wxALIGN_RIGHT 0 - + b_buttonsSizer - wxVERTICAL + wxHORIZONTAL none - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -331,11 +357,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 @@ -419,11 +445,11 @@ - + 5 wxALL|wxEXPAND 0 - + 1 1 1 diff --git a/common/dialogs/dialog_hotkeys_editor_base.h b/common/dialogs/dialog_hotkeys_editor_base.h index 5ce7605bae..58c3ce6c67 100644 --- a/common/dialogs/dialog_hotkeys_editor_base.h +++ b/common/dialogs/dialog_hotkeys_editor_base.h @@ -1,5 +1,5 @@ /////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Oct 8 2012) +// C++ code generated with wxFormBuilder (version Jun 6 2014) // http://www.wxformbuilder.org/ // // PLEASE DO "NOT" EDIT THIS FILE! @@ -14,12 +14,13 @@ class DIALOG_SHIM; #include "dialog_shim.h" +#include +#include +#include +#include #include #include -#include -#include -#include -#include +#include #include #include #include @@ -35,15 +36,13 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM private: protected: - wxGrid* m_hotkeyGrid; + wxStaticText* m_staticText1; + wxNotebook* m_hotkeySections; wxButton* m_OKButton; wxButton* m_cancelButton; wxButton* m_undoButton; // Virtual event handlers, overide them in your derived class - virtual void OnKeyPressed( wxKeyEvent& event ) { event.Skip(); } - virtual void OnRightClickOnCell( wxGridEvent& event ) { event.Skip(); } - virtual void OnClickOnCell( wxGridEvent& event ) { event.Skip(); } virtual void OnOKClicked( wxCommandEvent& event ) { event.Skip(); } virtual void CancelClicked( wxCommandEvent& event ) { event.Skip(); } virtual void UndoClicked( wxCommandEvent& event ) { event.Skip(); } @@ -51,7 +50,7 @@ class HOTKEYS_EDITOR_DIALOG_BASE : public DIALOG_SHIM public: - HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 304,235 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); + HOTKEYS_EDITOR_DIALOG_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hotkeys Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 450,500 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); ~HOTKEYS_EDITOR_DIALOG_BASE(); }; diff --git a/common/hotkey_grid_table.cpp b/common/hotkey_grid_table.cpp deleted file mode 100644 index c1f82545f3..0000000000 --- a/common/hotkey_grid_table.cpp +++ /dev/null @@ -1,220 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include - -/* - * Reads the hotkey table from its stored format into a format suitable - * for a wxGrid. - */ -HOTKEY_EDITOR_GRID_TABLE::HOTKEY_EDITOR_GRID_TABLE( struct EDA_HOTKEY_CONFIG* origin ) : - wxGridTableBase(), m_hotkeys() -{ - EDA_HOTKEY_CONFIG* section; - - for( section = origin; section->m_HK_InfoList; section++ ) - { - // Add a dummy hotkey_spec which is a header before each hotkey list - hotkey_spec spec( *section->m_SectionTag, NULL ); - m_hotkeys.push_back( spec ); - - EDA_HOTKEY** hotkey_descr_list; - - // Add hotkeys descr - for( hotkey_descr_list = section->m_HK_InfoList; *hotkey_descr_list; - hotkey_descr_list++ ) - { - EDA_HOTKEY* hotkey_descr = *hotkey_descr_list; - hotkey_spec spec( *section->m_SectionTag, new EDA_HOTKEY( hotkey_descr ) ); - m_hotkeys.push_back( spec ); - } - } -} - - -HOTKEY_EDITOR_GRID_TABLE::hotkey_spec_vector& HOTKEY_EDITOR_GRID_TABLE::getHotkeys() -{ - return m_hotkeys; -} - - -int HOTKEY_EDITOR_GRID_TABLE::GetNumberRows() -{ - return m_hotkeys.size(); -} - - -int HOTKEY_EDITOR_GRID_TABLE::GetNumberCols() -{ - return 2; -} - - -bool HOTKEY_EDITOR_GRID_TABLE::IsEmptyCell( int row, int col ) -{ - return col == 1 && m_hotkeys[row].second == NULL; -} - - -wxString HOTKEY_EDITOR_GRID_TABLE::GetValue( int row, int col ) -{ - EDA_HOTKEY* hotkey_descr = m_hotkeys[row].second; - - if( col == 0 ) - { - if( hotkey_descr == NULL ) - { - // section header - return m_hotkeys[row].first; - } - else - { - return hotkey_descr->m_InfoMsg; - } - } - else - { - if( hotkey_descr == NULL ) - { - // section header - return wxEmptyString; - } - else - { - return KeyNameFromKeyCode( hotkey_descr->m_KeyCode ); - } - } -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetValue( int row, int col, const wxString& value ) -{ -} - - -wxString HOTKEY_EDITOR_GRID_TABLE::GetTypeName( int row, int col ) -{ - return wxGRID_VALUE_STRING; -} - - -bool HOTKEY_EDITOR_GRID_TABLE::CanGetValueAs( int row, int col, const wxString& typeName ) -{ - return typeName == wxGRID_VALUE_STRING && col == 2; -} - - -bool HOTKEY_EDITOR_GRID_TABLE::CanSetValueAs( int row, int col, const wxString& typeName ) -{ - return false; -} - - -long HOTKEY_EDITOR_GRID_TABLE::GetValueAsLong( int row, int col ) -{ - return -1L; -} - - -double HOTKEY_EDITOR_GRID_TABLE::GetValueAsDouble( int row, int col ) -{ - return 0.0; -} - - -bool HOTKEY_EDITOR_GRID_TABLE::GetValueAsBool( int row, int col ) -{ - return false; -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetValueAsLong( int row, int col, long value ) -{ -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetValueAsDouble( int row, int col, double value ) -{ -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetValueAsBool( int row, int col, bool value ) -{ -} - - -void* HOTKEY_EDITOR_GRID_TABLE::GetValueAsCustom( int row, int col ) -{ - return 0; -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetValueAsCustom( int row, int col, void* value ) -{ -} - - -wxString HOTKEY_EDITOR_GRID_TABLE::GetColLabelValue( int col ) -{ - return col == 0 ? _( "Command" ) : _( "Hotkey" ); -} - - -bool HOTKEY_EDITOR_GRID_TABLE::IsHeader( int row ) -{ - return m_hotkeys[row].second == NULL; -} - - -void HOTKEY_EDITOR_GRID_TABLE::SetKeyCode( int row, long key ) -{ - m_hotkeys[row].second->m_KeyCode = key; -} - - -void HOTKEY_EDITOR_GRID_TABLE::RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ) -{ - int row = 0; - EDA_HOTKEY_CONFIG* section; - - for( section = origin; section->m_HK_InfoList; section++ ) - { - ++row; // Skip header - EDA_HOTKEY** info_ptr; - - for( info_ptr = section->m_HK_InfoList; *info_ptr; info_ptr++ ) - { - EDA_HOTKEY* info = *info_ptr; - m_hotkeys[row++].second->m_KeyCode = info->m_KeyCode; - } - } -} - - -HOTKEY_EDITOR_GRID_TABLE::~HOTKEY_EDITOR_GRID_TABLE() -{ - hotkey_spec_vector::iterator i; - - for( i = m_hotkeys.begin(); i != m_hotkeys.end(); ++i ) - delete i->second; -} diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index e8d0532ac5..0ff9d7fb60 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -52,6 +52,12 @@ wxString g_LibEditSectionTag( wxT( "[libedit]" ) ); wxString g_BoardEditorSectionTag( wxT( "[pcbnew]" ) ); wxString g_ModuleEditSectionTag( wxT( "[footprinteditor]" ) ); +wxString g_CommonSectionTitle( wxT( "Common" ) ); +wxString g_SchematicSectionTitle( wxT( "Schematic Editor" ) ); +wxString g_LibEditSectionTitle( wxT( "Library Editor" ) ); +wxString g_BoardEditorSectionTitle( wxT( "Board Editor" ) ); +wxString g_ModuleEditSectionTitle( wxT( "Footprint Editor" ) ); + /* Class to handle hotkey commnands. hotkeys have a default value * This class allows the real key code changed by user from a key code list @@ -490,10 +496,10 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, for( ; aDescList->m_HK_InfoList != NULL; aDescList++ ) { - if( aDescList->m_Comment ) + if( aDescList->m_Title ) { msg += wxT( "# " ); - msg += wxString( aDescList->m_Comment ); + msg += *aDescList->m_Title; msg += wxT( "\n" ); } diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index d302150c8a..aaf41c7ea2 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -305,18 +305,18 @@ static EDA_HOTKEY* viewlib_Hotkey_List[] = // an hotkey config file) struct EDA_HOTKEY_CONFIG g_Eeschema_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_Hotkey_List, L"Common keys" }, - { &g_SchematicSectionTag, schematic_Hotkey_List, L"Schematic editor keys" }, - { &g_LibEditSectionTag, libEdit_Hotkey_List, L"library editor keys" }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_SchematicSectionTag, schematic_Hotkey_List, &g_SchematicSectionTitle }, + { &g_LibEditSectionTag, libEdit_Hotkey_List, &g_LibEditSectionTitle }, + { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the schematic editor // (used to list current hotkeys) struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_Hotkey_List, NULL }, - { &g_SchematicSectionTag, schematic_Hotkey_List, NULL }, + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_SchematicSectionTag, schematic_Hotkey_List, &g_SchematicSectionTitle }, { NULL, NULL, NULL } }; @@ -324,17 +324,17 @@ struct EDA_HOTKEY_CONFIG g_Schematic_Hokeys_Descr[] = // (used to list current hotkeys) struct EDA_HOTKEY_CONFIG g_Libedit_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_Hotkey_List, NULL }, - { &g_LibEditSectionTag, libEdit_Hotkey_List, NULL }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_LibEditSectionTag, libEdit_Hotkey_List, &g_LibEditSectionTitle }, + { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the component browser // (used to list current hotkeys) struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_basic_Hotkey_List, NULL }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, common_basic_Hotkey_List, &g_CommonSectionTitle }, + { NULL, NULL, NULL } }; /* diff --git a/include/dialog_hotkeys_editor.h b/include/dialog_hotkeys_editor.h index 81c523f935..c634a29c1d 100644 --- a/include/dialog_hotkeys_editor.h +++ b/include/dialog_hotkeys_editor.h @@ -17,34 +17,82 @@ #include #include -#include #include #include <../common/dialogs/dialog_hotkeys_editor_base.h> +class HOTKEYS_EDITOR_DIALOG; + +class HOTKEY_LIST_CTRL : public wxListCtrl +{ +public: + HOTKEY_LIST_CTRL( wxWindow* aParent, struct EDA_HOTKEY_CONFIG* aSection ); + ~HOTKEY_LIST_CTRL() {}; + + void DeselectRow( int aRow ); + std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeys; } + void RestoreFrom( struct EDA_HOTKEY_CONFIG* aSection ); + +private: + int m_curEditingRow; + wxString* m_sectionTag; + std::vector< EDA_HOTKEY* > m_hotkeys; + +protected: + wxString OnGetItemText( long aRow, long aColumn ) const; + void OnChar( wxKeyEvent& aEvent ); + void OnListItemSelected( wxListEvent& aEvent ); + void OnSize( wxSizeEvent& aEvent ); +}; + +class HOTKEY_SECTION_PAGE : public wxPanel +{ +public: +private: + EDA_HOTKEY_CONFIG* m_hotkeySection; + HOTKEY_LIST_CTRL *m_hotkeyList; + HOTKEYS_EDITOR_DIALOG* m_dialog; + +public: + /** Constructor to create a setup page for one netlist format. + * Used in Netlist format Dialog box creation + * @param parent = wxNotebook * parent + * @param title = title (name) of the notebook page + * @param id_NetType = netlist type id + */ + HOTKEY_SECTION_PAGE( HOTKEYS_EDITOR_DIALOG* aDialog, wxNotebook* aParent, + const wxString& aTitle, + EDA_HOTKEY_CONFIG* aSection ); + ~HOTKEY_SECTION_PAGE() {}; + void Restore(); + + std::vector< EDA_HOTKEY* >& GetHotkeys() { return m_hotkeyList->GetHotkeys(); } + EDA_HOTKEY_CONFIG* GetHotkeySection() { return m_hotkeySection; } + + HOTKEYS_EDITOR_DIALOG* GetDialog() { return m_dialog; } +}; + + class HOTKEYS_EDITOR_DIALOG : public HOTKEYS_EDITOR_DIALOG_BASE { protected: EDA_DRAW_FRAME* m_parent; struct EDA_HOTKEY_CONFIG* m_hotkeys; - HOTKEY_EDITOR_GRID_TABLE* m_table; - - int m_curEditingRow; + + std::vector m_hotkeySectionPages; public: - HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys ); + HOTKEYS_EDITOR_DIALOG( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys ); ~HOTKEYS_EDITOR_DIALOG() {}; + bool CanSetKey( long aKey, const wxString* aSectionTag ); + private: - void OnOKClicked( wxCommandEvent& event ); - void CancelClicked( wxCommandEvent& event ); - void UndoClicked( wxCommandEvent& event ); - void OnClickOnCell( wxGridEvent& event ); - void OnRightClickOnCell( wxGridEvent& event ); - void OnKeyPressed( wxKeyEvent& event ); - void SetHotkeyCellState( int aRow, bool aHightlight ); + void OnOKClicked( wxCommandEvent& aEvent ); + void CancelClicked( wxCommandEvent& aEvent ); + void UndoClicked( wxCommandEvent& aEvent ); }; -void InstallHotkeyFrame( EDA_DRAW_FRAME* parent, EDA_HOTKEY_CONFIG* hotkeys ); +void InstallHotkeyFrame( EDA_DRAW_FRAME* aParent, EDA_HOTKEY_CONFIG* aHotkeys ); #endif diff --git a/include/hotkey_grid_table.h b/include/hotkey_grid_table.h deleted file mode 100644 index 27fbbcfb9c..0000000000 --- a/include/hotkey_grid_table.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __hotkeys_grid_table__ -#define __hotkeys_grid_table__ - -#include - -#include -#include - -#include -#include - -#include -#include -#include -#include - -class HOTKEY_EDITOR_GRID_TABLE : public wxGridTableBase -{ - -public: - typedef std::pair< wxString, EDA_HOTKEY* > hotkey_spec; - typedef std::vector< hotkey_spec > hotkey_spec_vector; - - HOTKEY_EDITOR_GRID_TABLE( struct EDA_HOTKEY_CONFIG* origin ); - virtual ~HOTKEY_EDITOR_GRID_TABLE(); - hotkey_spec_vector& getHotkeys(); - -private: - virtual int GetNumberRows(); - virtual int GetNumberCols(); - virtual bool IsEmptyCell( int row, int col ); - virtual wxString GetValue( int row, int col ); - virtual void SetValue( int row, int col, const wxString& value ); - virtual wxString GetTypeName( int row, int col ); - virtual bool CanGetValueAs( int row, int col, const wxString& typeName ); - virtual bool CanSetValueAs( int row, int col, const wxString& typeName ); - virtual long GetValueAsLong( int row, int col ); - virtual double GetValueAsDouble( int row, int col ); - virtual bool GetValueAsBool( int row, int col ); - virtual void SetValueAsLong( int row, int col, long value ); - virtual void SetValueAsDouble( int row, int col, double value ); - virtual void SetValueAsBool( int row, int col, bool value ); - virtual void* GetValueAsCustom( int row, int col ); - virtual void SetValueAsCustom( int row, int col, void* value ); - virtual wxString GetColLabelValue( int col ); - -public: - virtual bool IsHeader( int row ); - virtual void SetKeyCode( int row, long key ); - virtual void RestoreFrom( struct EDA_HOTKEY_CONFIG* origin ); - -protected: - std::vector< hotkey_spec > m_hotkeys; - -}; - -#endif diff --git a/include/hotkeys_basic.h b/include/hotkeys_basic.h index cbae182e39..b560fe964f 100644 --- a/include/hotkeys_basic.h +++ b/include/hotkeys_basic.h @@ -44,6 +44,12 @@ extern wxString g_LibEditSectionTag; extern wxString g_BoardEditorSectionTag; extern wxString g_ModuleEditSectionTag; +extern wxString g_CommonSectionTitle; +extern wxString g_SchematicSectionTitle; +extern wxString g_LibEditSectionTitle; +extern wxString g_BoardEditorSectionTitle; +extern wxString g_ModuleEditSectionTitle; + /** * class EDA_HOTKEY @@ -81,7 +87,7 @@ struct EDA_HOTKEY_CONFIG public: 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. + wxString* m_Title; // Title displayed in hotkey editor and used as comment in file }; diff --git a/pagelayout_editor/hotkeys.cpp b/pagelayout_editor/hotkeys.cpp index 5313763bb5..e7cc0f61b7 100644 --- a/pagelayout_editor/hotkeys.cpp +++ b/pagelayout_editor/hotkeys.cpp @@ -107,12 +107,13 @@ EDA_HOTKEY* s_PlEditor_Hotkey_List[] = // list of sections and corresponding hotkey list for Pl_Editor // (used to create an hotkey config file) wxString s_PlEditorSectionTag( wxT( "[pl_editor]" ) ); +wxString s_PlEditorSectionTitle( wxT( "Part Layout Editor" ) ); struct EDA_HOTKEY_CONFIG s_PlEditor_Hokeys_Descr[] = { - { &g_CommonSectionTag, s_Common_Hotkey_List, L"Common keys" }, - { &s_PlEditorSectionTag, s_PlEditor_Hotkey_List, L"pl_editor keys" }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, s_Common_Hotkey_List, &g_CommonSectionTitle }, + { &s_PlEditorSectionTag, s_PlEditor_Hotkey_List, &s_PlEditorSectionTitle }, + { NULL, NULL, NULL } }; diff --git a/pcbnew/hotkeys.cpp b/pcbnew/hotkeys.cpp index e6ed7dee19..5012c1cd87 100644 --- a/pcbnew/hotkeys.cpp +++ b/pcbnew/hotkeys.cpp @@ -285,33 +285,33 @@ EDA_HOTKEY* module_viewer_Hotkey_List[] = { // list of sections and corresponding hotkey list for Pcbnew // (used to create an hotkey config file, and edit hotkeys ) 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 } + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_BoardEditorSectionTag, board_edit_Hotkey_List, &g_BoardEditorSectionTitle }, + { &g_ModuleEditSectionTag, module_edit_Hotkey_List, &g_ModuleEditSectionTitle }, + { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the board editor // (used to list current hotkeys in the board editor) struct EDA_HOTKEY_CONFIG g_Board_Editor_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_Hotkey_List, NULL }, - { &g_BoardEditorSectionTag, board_edit_Hotkey_List, NULL }, + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_BoardEditorSectionTag, board_edit_Hotkey_List, &g_BoardEditorSectionTitle }, { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the footprint editor // (used to list current hotkeys in the module editor) 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 } + { &g_CommonSectionTag, common_Hotkey_List, &g_CommonSectionTitle }, + { &g_ModuleEditSectionTag, module_edit_Hotkey_List, &g_ModuleEditSectionTitle }, + { NULL, NULL, NULL } }; // list of sections and corresponding hotkey list for the footprint viewer // (used to list current hotkeys in the module viewer) struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[] = { - { &g_CommonSectionTag, common_basic_Hotkey_List, NULL }, - { NULL, NULL, NULL } + { &g_CommonSectionTag, common_basic_Hotkey_List, &g_CommonSectionTitle }, + { NULL, NULL, NULL } };