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; RefreshItems( 0, m_hotkeys.size()-1 ); }
void ctlSQLGrid::OnLabelClick(wxGridEvent &event) { int row = event.GetRow(); int col = event.GetCol(); // add support for (de)selecting multiple rows and cols with Control pressed if ( row >= 0 && (event.ControlDown() || event.CmdDown()) ) { if (GetSelectedRows().Index(row) == wxNOT_FOUND) SelectRow(row, true); else DeselectRow(row); } else if ( col >= 0 && (event.ControlDown() || event.CmdDown()) ) { if (GetSelectedCols().Index(col) == wxNOT_FOUND) SelectCol(col, true); else DeselectCol(col); } else event.Skip(); }
void HOTKEY_LIST_CTRL::OnChar( wxKeyEvent& aEvent ) { if( m_curEditingRow != -1 ) { long key = aEvent.GetKeyCode(); switch( key ) { case WXK_ESCAPE: // Remove selection DeselectRow( m_curEditingRow ); m_curEditingRow = -1; break; default: if( key >= 'a' && key <= 'z' ) // convert to uppercase key = key + ('A' - 'a'); // Remap Ctrl A (=1+GR_KB_CTRL) to Ctrl Z(=26+GR_KB_CTRL) // to GR_KB_CTRL+'A' .. GR_KB_CTRL+'Z' if( aEvent.ControlDown() && key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) key += 'A' - 1; /* Disallow shift for keys that have two keycodes on them (e.g. number and * punctuation keys) leaving only the "letter keys" of A-Z. * Then, you can have, e.g. Ctrl-5 and Ctrl-% (GB layout) * and Ctrl-( and Ctrl-5 (FR layout). * Otherwise, you'd have to have to say Ctrl-Shift-5 on a FR layout */ bool keyIsLetter = key >= 'A' && key <= 'Z'; if( aEvent.ShiftDown() && ( keyIsLetter || key > 256 ) ) key |= GR_KB_SHIFT; if( aEvent.ControlDown() ) key |= GR_KB_CTRL; if( aEvent.AltDown() ) key |= GR_KB_ALT; // 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; recalculateColumns(); } // Remove selection DeselectRow( m_curEditingRow ); m_curEditingRow = -1; } } } RefreshItems(0,m_hotkeys.size()-1); }