From: <sag...@us...> - 2012-03-08 01:39:35
|
Revision: 1211 http://modplug.svn.sourceforge.net/modplug/?rev=1211&view=rev Author: saga-games Date: 2012-03-08 01:39:23 +0000 (Thu, 08 Mar 2012) Log Message: ----------- [Imp] Keyboard Settings: Added a search box, so finding a shortcut by name should be much easier now. [Mod] Updated my keymap a bit. Modified Paths: -------------- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp trunk/OpenMPT/mptrack/KeyConfigDlg.h trunk/OpenMPT/mptrack/mptrack.rc trunk/OpenMPT/mptrack/resource.h trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.cpp =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-03-08 00:13:11 UTC (rev 1210) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.cpp 2012-03-08 01:39:23 UTC (rev 1211) @@ -111,6 +111,7 @@ ON_COMMAND(IDC_EFFECTLETTERSIT, OnSetITEffects) ON_COMMAND(IDC_CLEARLOG, OnClearLog) ON_COMMAND(IDC_RESTORE_KEYMAP, OnRestoreDefaultKeymap) + ON_EN_CHANGE(IDC_FIND, OnSearchTermChanged) ON_WM_DESTROY() END_MESSAGE_MAP() @@ -127,6 +128,7 @@ DDX_Control(pDX, IDC_CHECKKEYDOWN, m_bKeyDown); DDX_Control(pDX, IDC_CHECKKEYHOLD, m_bKeyHold); DDX_Control(pDX, IDC_CHECKKEYUP, m_bKeyUp); + DDX_Control(pDX, IDC_FIND, m_eFind); } @@ -177,7 +179,7 @@ // Filter commands: We only need user to see a select set off commands // for each category void COptionsKeyboard::DefineCommandCategories() - +//---------------------------------------------- { CommandCategory *newCat; @@ -359,36 +361,90 @@ } -// Fills command list and automatically selects first command. void COptionsKeyboard::OnCategorySelChanged() //------------------------------------------- { - //CommandID nCmd = (CommandID)m_lbnCommandKeys.GetItemData( m_lbnCommandKeys.GetCurSel() ); - int nCat = m_cmbCategory.GetItemData( m_cmbCategory.GetCurSel() ); + int cat = m_cmbCategory.GetItemData(m_cmbCategory.GetCurSel()); - //Fill Command list - if ((nCat >= 0) && (nCat != m_nCurCategory)) //have we changed category? + if(cat >= 0 && cat != m_nCurCategory) { - CommandID com; - m_nCurCategory = nCat; - m_lbnCommandKeys.ResetContent(); - for (int c=0; c<commandCategories[nCat].commands.GetSize(); c++) + // Changed category + UpdateShortcutList(cat); + } +} + + +void COptionsKeyboard::OnSearchTermChanged() +//------------------------------------------ +{ + UpdateShortcutList(); +} + + +// Fills command list and automatically selects first command. +void COptionsKeyboard::UpdateShortcutList(int category) +//----------------------------------------------------- +{ + CString findString; + m_eFind.GetWindowText(findString); + findString.MakeLower(); + + const bool doSearch = !findString.IsEmpty(); + + m_nCurCategory = category; + + int firstCat = category, lastCat = category; + if(category == -1) + { + // We will search in all categories + firstCat = 0; + lastCat = commandCategories.GetSize() - 1; + } + + m_lbnCommandKeys.ResetContent(); + + for(int cat = firstCat; cat <= lastCat; cat++) + { + // When searching, we also add the category names to the list. + bool addCategoryName = (firstCat != lastCat); + + for(int cmd = 0; cmd < commandCategories[cat].commands.GetSize(); cmd++) { - com = (CommandID)commandCategories[nCat].commands[c]; - if (plocalCmdSet->GetCommandText(com)) + CommandID com = (CommandID)commandCategories[cat].commands[cmd]; + + CString cmdText = plocalCmdSet->GetCommandText(com); + bool addString = true; + if(doSearch) { - if (!plocalCmdSet->isHidden(com)) + addString = (cmdText.MakeLower().Find(findString) >= 0); + } + + if(addString) + { + if(!plocalCmdSet->isHidden(com)) + { + if(doSearch && addCategoryName) + { + const CString catName = "------ " + commandCategories[cat].name.Trim() + " ------"; + m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString(catName), DWORD_PTR(-1)); + addCategoryName = false; + } + m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString(plocalCmdSet->GetCommandText(com)), com); - - if (commandCategories[nCat].separatorAt(com)) + } + + if(commandCategories[cat].separatorAt(com)) m_lbnCommandKeys.SetItemData(m_lbnCommandKeys.AddString("------------------------------------------------------"), DWORD_PTR(-1)); } } - m_lbnCommandKeys.SetCurSel(0); - OnCommandKeySelChanged(); + } + + m_lbnCommandKeys.SetCurSel(0); + OnCommandKeySelChanged(); } + // Fills key choice list and automatically selects first key choice void COptionsKeyboard::OnCommandKeySelChanged() //--------------------------------------------- @@ -424,12 +480,13 @@ m_bKeyUp.EnableWindow(TRUE); m_nCurHotKey = nCmd; + m_nCurCategory = GetCategoryFromCommandID(nCmd); char s[20]; m_cmbKeyChoice.ResetContent(); int numChoices=plocalCmdSet->GetKeyListSize(nCmd); if ((nCmd<kcNumCommands) && (numChoices>0)) - { + { for (int i=0; i<numChoices; i++) { wsprintf(s, "Choice %d (of %d)", i+1, numChoices); @@ -482,6 +539,7 @@ //rewbs.autochord void COptionsKeyboard::OnChordWaitTimeChanged() +//--------------------------------------------- { CString s; UINT val; @@ -530,6 +588,7 @@ void COptionsKeyboard::OnRestoreKeyChoice() +//----------------------------------------- { KeyCombination kc; CommandID cmd = (CommandID)m_nCurHotKey; @@ -555,6 +614,7 @@ } void COptionsKeyboard::OnDeleteKeyChoice() +//---------------------------------------- { CommandID cmd = (CommandID)m_nCurHotKey; @@ -576,6 +636,7 @@ void COptionsKeyboard::OnSetKeyChoice() +//------------------------------------- { CString report, reportHistory; KeyCombination kc; @@ -591,9 +652,9 @@ kc.mod = m_eCustHotKey.mod; kc.code = m_eCustHotKey.code; kc.ctx = (commandCategories[m_nCurCategory]).id; - temp |= m_bKeyDown.GetCheck()?kKeyEventDown:0; - temp |= m_bKeyHold.GetCheck()?kKeyEventRepeat:0; - temp |= m_bKeyUp.GetCheck()?kKeyEventUp:0; + temp |= m_bKeyDown.GetCheck() ? kKeyEventDown : 0; + temp |= m_bKeyHold.GetCheck() ? kKeyEventRepeat : 0; + temp |= m_bKeyUp.GetCheck() ? kKeyEventUp : 0; kc.event =(KeyEventType)temp; //kc.event =(KeyEventType)((UINT)kKeyEventDown|(UINT)kKeyEventRepeat); //detect invalid input @@ -627,6 +688,7 @@ return; } + void COptionsKeyboard::OnOK() //--------------------------- { @@ -641,12 +703,15 @@ void COptionsKeyboard::OnDestroy() +//-------------------------------- { CPropertyPage::OnDestroy(); delete plocalCmdSet; } + void COptionsKeyboard::OnLoad() +//----------------------------- { std::string filename = m_sFullPathName; FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(true, "mkb", filename, @@ -660,7 +725,9 @@ //TentativeSetToDefaultFile(m_sFullPathName); } + void COptionsKeyboard::OnSave() +//----------------------------- { std::string filename = m_sFullPathName; FileDlgResult files = CTrackApp::ShowOpenSaveFileDialog(false, "mkb", filename, @@ -673,31 +740,41 @@ //TentativeSetToDefaultFile(m_sFullPathName); } + void COptionsKeyboard::OnNotesRepeat() +//------------------------------------ { plocalCmdSet->QuickChange_NotesRepeat(); ForceUpdateGUI(); } + void COptionsKeyboard::OnNoNotesRepeat() +//-------------------------------------- { plocalCmdSet->QuickChange_NoNotesRepeat(); ForceUpdateGUI(); } + void COptionsKeyboard::OnSetITEffects() +//------------------------------------- { plocalCmdSet->QuickChange_SetEffectsIT(); ForceUpdateGUI(); } + void COptionsKeyboard::OnSetXMEffects() +//------------------------------------- { plocalCmdSet->QuickChange_SetEffectsXM(); ForceUpdateGUI(); } + void COptionsKeyboard::ForceUpdateGUI() +//------------------------------------- { //update gui m_bForceUpdate=true; // m_nCurKeyChoice and m_nCurHotKey haven't changed, yet we still want to update. @@ -708,7 +785,9 @@ OnSettingsChanged(); // Enable "apply" button } + void COptionsKeyboard::OnClearLog() +//--------------------------------- { m_eReport.SetWindowText(""); ForceUpdateGUI(); @@ -723,4 +802,21 @@ plocalCmdSet->LoadDefaultKeymap(); ForceUpdateGUI(); } -} \ No newline at end of file +} + + +int COptionsKeyboard::GetCategoryFromCommandID(CommandID command) const +//--------------------------------------------------------------------- +{ + for(int cat = 0; cat < commandCategories.GetSize(); cat++) + { + for(int cmd = 0; cmd < commandCategories[cat].commands.GetSize(); cmd++) + { + if(commandCategories[cat].commands[cmd] == command) + { + return cat; + } + } + } + return -1; +} Modified: trunk/OpenMPT/mptrack/KeyConfigDlg.h =================================================================== --- trunk/OpenMPT/mptrack/KeyConfigDlg.h 2012-03-08 00:13:11 UTC (rev 1210) +++ trunk/OpenMPT/mptrack/KeyConfigDlg.h 2012-03-08 01:39:23 UTC (rev 1211) @@ -49,7 +49,7 @@ for (int p=0; p<separators.GetSize(); p++) { if (separators[p]==c) - return true; + return true; } return false; } @@ -100,6 +100,7 @@ CButton m_bKeyDown, m_bKeyHold, m_bKeyUp; CButton m_bnReset; CCustEdit m_eCustHotKey; + CEdit m_eFind; CEdit m_eReport, m_eChordWaitTime; UINT m_nKeyboardCfg; int m_nCurHotKey, m_nCurCategory, m_nCurKeyChoice; @@ -110,6 +111,8 @@ bool m_bChoiceModified; void ForceUpdateGUI(); + void UpdateShortcutList(int category = -1); + int GetCategoryFromCommandID(CommandID command) const; public: COptionsKeyboard():CPropertyPage(IDD_OPTIONS_KEYBOARD) { m_nKeyboardCfg = 0; } @@ -131,6 +134,7 @@ afx_msg void OnKeyChoiceSelect(); afx_msg void OnCommandKeySelChanged(); afx_msg void OnCategorySelChanged(); + afx_msg void OnSearchTermChanged(); afx_msg void OnChordWaitTimeChanged(); //rewbs.autochord afx_msg void OnHotKeyChanged(); afx_msg void OnSettingsChanged() { SetModified(TRUE); } Modified: trunk/OpenMPT/mptrack/mptrack.rc =================================================================== --- trunk/OpenMPT/mptrack/mptrack.rc 2012-03-08 00:13:11 UTC (rev 1210) +++ trunk/OpenMPT/mptrack/mptrack.rc 2012-03-08 01:39:23 UTC (rev 1211) @@ -466,7 +466,7 @@ BEGIN LTEXT "Select category:",IDC_STATIC,7,5,131,11 COMBOBOX IDC_KEYCATEGORY,5,16,133,204,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LISTBOX IDC_COMMAND_LIST,5,32,133,244,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + LISTBOX IDC_COMMAND_LIST,5,32,133,228,LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_CHOICECOMBO,150,18,72,51,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP LTEXT "Key:",IDC_STATIC,150,38,16,8 EDITTEXT IDC_CUSTHOTKEY,168,36,54,13,ES_AUTOHSCROLL @@ -489,10 +489,12 @@ GROUPBOX "Key setup for this command ",IDC_STATIC,144,6,126,84 GROUPBOX "Misc",IDC_STATIC,144,96,126,40 GROUPBOX "Multi Config Handling",IDC_STATIC,144,144,126,48 - PUSHBUTTON "it",IDC_EFFECTLETTERSIT,98,252,12,9,NOT WS_VISIBLE - PUSHBUTTON "xm",IDC_EFFECTLETTERSXM,114,252,12,9,NOT WS_VISIBLE - LTEXT "Effect letters like:",IDC_STATIC,6,254,73,11,NOT WS_VISIBLE + PUSHBUTTON "it",IDC_EFFECTLETTERSIT,103,223,12,9,NOT WS_VISIBLE + PUSHBUTTON "xm",IDC_EFFECTLETTERSXM,119,223,12,9,NOT WS_VISIBLE + LTEXT "Effect letters like:",IDC_STATIC,11,225,73,11,NOT WS_VISIBLE PUSHBUTTON "Restore default configuration",IDC_RESTORE_KEYMAP,150,174,114,12 + EDITTEXT IDC_FIND,30,264,108,12,ES_AUTOHSCROLL + LTEXT "Find:",IDC_STATIC,6,266,24,8 END IDD_OPTIONS_COLORS DIALOGEX 0, 0, 272, 281 @@ -1086,7 +1088,7 @@ END IDD_PAGEEDITEFFECT DIALOGEX 0, 0, 220, 35 -STYLE DS_SETFONT | WS_CHILD | WS_CAPTION +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_CAPTION CAPTION "Effect" FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN Modified: trunk/OpenMPT/mptrack/resource.h =================================================================== --- trunk/OpenMPT/mptrack/resource.h 2012-03-08 00:13:11 UTC (rev 1210) +++ trunk/OpenMPT/mptrack/resource.h 2012-03-08 01:39:23 UTC (rev 1211) @@ -944,6 +944,7 @@ #define IDC_LASTUPDATE 2435 #define IDC_RESTORE_KEYMAP 2436 #define IDC_SAMPLE_AUTOTUNE 2437 +#define IDC_FIND 2438 #define ID_FILE_NEWMOD 32771 #define ID_FILE_NEWXM 32772 #define ID_FILE_NEWS3M 32773 @@ -1220,7 +1221,7 @@ #define _APS_3D_CONTROLS 1 #define _APS_NEXT_RESOURCE_VALUE 535 #define _APS_NEXT_COMMAND_VALUE 44602 -#define _APS_NEXT_CONTROL_VALUE 2448 +#define _APS_NEXT_CONTROL_VALUE 2439 #define _APS_NEXT_SYMED_VALUE 901 #endif #endif Modified: trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb =================================================================== --- trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-03-08 00:13:11 UTC (rev 1210) +++ trunk/OpenMPT/packageTemplate/extraKeymaps/DE_jojo.mkb 2012-03-08 01:39:23 UTC (rev 1211) @@ -28,10 +28,10 @@ 0:1362:2:86:1 //Paste: Ctrl+V (KeyDown) 0:1363:3:86:1 //Mix Paste: Shift+Ctrl+V (KeyDown) 0:1793:1:86:1 //Paste Flood: Shift+V (KeyDown) -0:1820:6:86:1 //Push Forward Paste (Insert): Ctrl+Alt+V (KeyDown) +0:1820:6:86:5 //Push Forward Paste (Insert): Ctrl+Alt+V (KeyDown|KeyHold) 0:1364:2:53:1 //Select All: Ctrl+5 (KeyDown) 0:1365:2:70:1 //Find / Replace: Ctrl+F (KeyDown) -0:1366:0:114:1 //Find Next: F3 (KeyDown) +0:1366:0:114:5 //Find Next: F3 (KeyDown|KeyHold) 0:1021:4:71:1 //View General: Alt+G (KeyDown) 0:1021:0:112:1 //View General: F1 (KeyDown) 0:1022:4:80:1 //View Pattern: Alt+P (KeyDown) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |