Win32 - UpdateHotkeyAssignments - now retrieves key assignment from hotkeys
This commit is contained in:
parent
3b1591abe2
commit
7b49f8923b
|
@ -3969,6 +3969,31 @@ void ChangeMenuItemText(int menuitem, string text)
|
||||||
SetMenuItemInfo(mainMenu, menuitem, FALSE, &moo);
|
SetMenuItemInfo(mainMenu, menuitem, FALSE, &moo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* GetModifierString(int num)
|
||||||
|
{
|
||||||
|
switch (num)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return "";
|
||||||
|
case 1:
|
||||||
|
return "Alt+";
|
||||||
|
case 2:
|
||||||
|
return "Ctrl+";
|
||||||
|
case 3:
|
||||||
|
return "Ctrl+Alt+";
|
||||||
|
case 4:
|
||||||
|
return "Shift+";
|
||||||
|
case 5:
|
||||||
|
return "Alt+Shift+";
|
||||||
|
case 6:
|
||||||
|
return "Ctrl+Shift+";
|
||||||
|
case 7:
|
||||||
|
return "Ctrl+Alt+Shift+";
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//adelikat: This function find the current hotkey assignments for corresponding menu items
|
//adelikat: This function find the current hotkey assignments for corresponding menu items
|
||||||
// and appends it to the menu item. This function works correctly for all language menus
|
// and appends it to the menu item. This function works correctly for all language menus
|
||||||
// However, a Menu item in the Resource file must NOT have a /t (tab) in its caption.
|
// However, a Menu item in the Resource file must NOT have a /t (tab) in its caption.
|
||||||
|
@ -3977,6 +4002,7 @@ void UpdateHotkeyAssignments()
|
||||||
//Update all menu items that can be called from a hotkey to include the current hotkey assignment
|
//Update all menu items that can be called from a hotkey to include the current hotkey assignment
|
||||||
char itemText[255]; //To get the current text from a mnue item
|
char itemText[255]; //To get the current text from a mnue item
|
||||||
string text; //Used to manipulate menu item text
|
string text; //Used to manipulate menu item text
|
||||||
|
string keyname; //Used to hold the name of the hotkey
|
||||||
int truncate; //Used to truncate the hotkey config from the menu item
|
int truncate; //Used to truncate the hotkey config from the menu item
|
||||||
|
|
||||||
//-------------------------------FILE---------------------------------------
|
//-------------------------------FILE---------------------------------------
|
||||||
|
@ -3986,11 +4012,17 @@ void UpdateHotkeyAssignments()
|
||||||
text = itemText; //Store in string object
|
text = itemText; //Store in string object
|
||||||
truncate = text.find("\t"); //Find the tab
|
truncate = text.find("\t"); //Find the tab
|
||||||
if (truncate >= 1) //Truncate if it exists
|
if (truncate >= 1) //Truncate if it exists
|
||||||
text = text.substr(0,truncate);
|
text = text.substr(0,truncate+1);
|
||||||
text.append("\tCtrl+O"); //TODO: Append actual hotkey assignment
|
keyname = CustomKeys.OpenROM.key; //Get key & modifiers
|
||||||
|
keyname.insert(0,GetModifierString(CustomKeys.OpenROM.modifiers));
|
||||||
|
text.append(keyname);
|
||||||
ChangeMenuItemText(IDM_OPEN, text); //Set Menu item text
|
ChangeMenuItemText(IDM_OPEN, text); //Set Menu item text
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***
|
/***
|
||||||
* Author: adelikat
|
* Author: adelikat
|
||||||
* Date Added: May 8, 2009
|
* Date Added: May 8, 2009
|
||||||
|
|
Loading…
Reference in New Issue