Added generation of accelerator table
This commit is contained in:
parent
485ee6ec95
commit
dc52c3626a
BIN
editor/editor.aps
Normal file
BIN
editor/editor.aps
Normal file
Binary file not shown.
BIN
ogl_editor/data/windows/editor.aps
Normal file
BIN
ogl_editor/data/windows/editor.aps
Normal file
Binary file not shown.
@ -1310,6 +1310,9 @@ static void onTab()
|
|||||||
|
|
||||||
void Editor_menuEvent(int menuItem)
|
void Editor_menuEvent(int menuItem)
|
||||||
{
|
{
|
||||||
|
if (menuItem == EDITOR_MENU_ENTER_CURRENT_V && is_editing)
|
||||||
|
endEditing();
|
||||||
|
|
||||||
cancelEditing();
|
cancelEditing();
|
||||||
|
|
||||||
// If some internal control has focus we let it do its thing
|
// If some internal control has focus we let it do its thing
|
||||||
|
|||||||
@ -181,7 +181,7 @@ static void formatName(wchar_t* outName, int keyMod, int key, const wchar_t* nam
|
|||||||
wcscat(modName, L"Alt - ");
|
wcscat(modName, L"Alt - ");
|
||||||
|
|
||||||
if ((keyMod & EMGUI_KEY_SHIFT))
|
if ((keyMod & EMGUI_KEY_SHIFT))
|
||||||
wcscat(modName, L"Alt - ");
|
wcscat(modName, L"Shift - ");
|
||||||
|
|
||||||
if (key < 127)
|
if (key < 127)
|
||||||
{
|
{
|
||||||
@ -209,21 +209,51 @@ static void formatName(wchar_t* outName, int keyMod, int key, const wchar_t* nam
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
/*
|
|
||||||
static void addAccelarator(const MenuDescriptor* desc)
|
static void addAccelarator(const MenuDescriptor* desc)
|
||||||
{
|
{
|
||||||
uint8_t virt = 0;
|
uint8_t virt = 0;
|
||||||
uint32_t winMod = desc->winMod;
|
uint32_t winMod = desc->winMod;
|
||||||
uint32_t key = desc->key;
|
uint32_t key = desc->key;
|
||||||
|
ACCEL* accel = &s_accelTable[s_accelCount++];
|
||||||
|
|
||||||
if (winMod & EMGUI_KEY_ALT)
|
if (winMod & EMGUI_KEY_ALT)
|
||||||
virt |= 0x10;
|
virt |= 0x10;
|
||||||
if (winMod & EMGUI_KEY_CTRL)
|
if (winMod & EMGUI_KEY_CTRL)
|
||||||
virt |= 0x08;
|
virt |= 0x08;
|
||||||
//if (key > 127)
|
if (winMod & EMGUI_KEY_SHIFT)
|
||||||
// virt
|
virt |= 0x04;
|
||||||
|
|
||||||
|
if (key < 127)
|
||||||
|
{
|
||||||
|
accel->key = (char)(key);
|
||||||
|
|
||||||
|
if (virt != 0)
|
||||||
|
{
|
||||||
|
accel->key = (char)(key & ~0x20);
|
||||||
|
virt |= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
virt |= 1;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case EMGUI_KEY_ARROW_DOWN : accel->key = VK_DOWN; break;
|
||||||
|
case EMGUI_KEY_ARROW_UP: accel->key = VK_UP; break;
|
||||||
|
case EMGUI_KEY_ARROW_RIGHT: accel->key = VK_RIGHT; break;
|
||||||
|
case EMGUI_KEY_ARROW_LEFT: accel->key = VK_LEFT; break;
|
||||||
|
case EMGUI_KEY_ESC: accel->key = VK_ESCAPE; break;
|
||||||
|
case EMGUI_KEY_TAB: accel->key = VK_TAB; break;
|
||||||
|
case EMGUI_KEY_BACKSPACE: accel->key = VK_DELETE; break;
|
||||||
|
case EMGUI_KEY_ENTER: accel->key = VK_RETURN; break;
|
||||||
|
case EMGUI_KEY_SPACE: accel->key = VK_SPACE; break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
accel->fVirt = virt;
|
||||||
|
accel->cmd = (WORD)desc->id;
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -248,6 +278,7 @@ static void buildSubMenu(HMENU parentMenu, MenuDescriptor menuDesc[], wchar_t* n
|
|||||||
wchar_t temp[256];
|
wchar_t temp[256];
|
||||||
formatName(temp, desc->winMod, desc->key, desc->name);
|
formatName(temp, desc->winMod, desc->key, desc->name);
|
||||||
AppendMenu(menu, MF_STRING, desc->id, temp);
|
AppendMenu(menu, MF_STRING, desc->id, temp);
|
||||||
|
addAccelarator(desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc++;
|
desc++;
|
||||||
@ -512,7 +543,7 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmndLine, i
|
|||||||
if (!createWindow(L"RocketEditor", 800, 600))
|
if (!createWindow(L"RocketEditor", 800, 600))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
accel = LoadAccelerators(instance, MAKEINTRESOURCE(IDR_ACCELERATOR));
|
accel = CreateAcceleratorTable(s_accelTable, s_accelCount);
|
||||||
|
|
||||||
// Update timed function every 16 ms
|
// Update timed function every 16 ms
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user