| 4507 | } |
| 4508 | |
| 4509 | bool HandleMenuItem(HWND aHwnd, WORD aMenuItemID, HWND aGuiHwnd) |
| 4510 | // See if an item was selected from the tray menu or main menu. Note that it is possible |
| 4511 | // for one of the standard menu items to be triggered from a GUI menu if the menu or one of |
| 4512 | // its submenus was modified with the "menu, MenuName, Standard" command. |
| 4513 | // Returns true if the message is fully handled here, false otherwise. |
| 4514 | { |
| 4515 | switch (aMenuItemID) |
| 4516 | { |
| 4517 | case ID_TRAY_OPEN: |
| 4518 | ShowMainWindow(); |
| 4519 | return true; |
| 4520 | case ID_TRAY_EDITSCRIPT: |
| 4521 | case ID_FILE_EDITSCRIPT: |
| 4522 | g_script.Edit(); |
| 4523 | return true; |
| 4524 | case ID_TRAY_RELOADSCRIPT: |
| 4525 | case ID_FILE_RELOADSCRIPT: |
| 4526 | if (!g_script.Reload(false)) |
| 4527 | MsgBox(_T("The script could not be reloaded.")); |
| 4528 | return true; |
| 4529 | case ID_TRAY_WINDOWSPY: |
| 4530 | case ID_FILE_WINDOWSPY: |
| 4531 | LaunchWindowSpy(); |
| 4532 | return true; |
| 4533 | case ID_TRAY_HELP: |
| 4534 | case ID_HELP_USERMANUAL: |
| 4535 | LaunchAutoHotkeyHelp(); |
| 4536 | return true; |
| 4537 | case ID_TRAY_SUSPEND: |
| 4538 | case ID_FILE_SUSPEND: |
| 4539 | Line::ToggleSuspendState(); |
| 4540 | return true; |
| 4541 | case ID_TRAY_PAUSE: |
| 4542 | case ID_FILE_PAUSE: |
| 4543 | if (g->IsPaused) |
| 4544 | --g_nPausedThreads; |
| 4545 | else |
| 4546 | ++g_nPausedThreads; // For this purpose the idle thread is counted as a paused thread. |
| 4547 | g->IsPaused = !g->IsPaused; |
| 4548 | g_script.UpdateTrayIcon(); |
| 4549 | return true; |
| 4550 | case ID_TRAY_EXIT: |
| 4551 | case ID_FILE_EXIT: |
| 4552 | g_script.ExitApp(EXIT_MENU); // More reliable than PostQuitMessage(), which has been known to fail in rare cases. |
| 4553 | return true; // If there is an OnExit function, the above might not actually exit. |
| 4554 | case ID_VIEW_LINES: |
| 4555 | ShowMainWindow(MAIN_MODE_LINES); |
| 4556 | return true; |
| 4557 | case ID_VIEW_VARIABLES: |
| 4558 | ShowMainWindow(MAIN_MODE_VARS); |
| 4559 | return true; |
| 4560 | case ID_VIEW_HOTKEYS: |
| 4561 | ShowMainWindow(MAIN_MODE_HOTKEYS); |
| 4562 | return true; |
| 4563 | case ID_VIEW_KEYHISTORY: |
| 4564 | ShowMainWindow(MAIN_MODE_KEYHISTORY); |
| 4565 | return true; |
| 4566 | case ID_VIEW_REFRESH: |
no test coverage detected