void CMainWnd::OnCommand(UINT uNotify, UINT uId, HWND hwndCtrl) { switch(uId) { case IDM_LOGOPEN: this->OpenLogFile(); break; case IDC_ED_FILTER: if (uNotify == EN_CHANGE) this->OnChangeFilter(); break; case IDC_CB_USEREGEXP: edFilter.SetUseRegExp(Button_IsChecked(hUseRegExp)); OnChangeFilter(); break; case IDA_CTRL_A: this->OnSelectAll(); break; case IDA_CTRL_C: this->OnCopyToClibBoard(); break; case IDM_CLEARLOG: this->ClearLog(); break; case IDM_TOP: this->SetTop(); break; case IDM_WEBLOGIC_START: this->OnClickStart(); break; case IDM_WEBLOGIC_FORCESHUTDOWN: this->OnClickForceShutdown(); break; case IDM_WNDTRANSPARENT: this->OnClickSetTransparent(); break; case IDM_LOGCLOSE: this->StopFileCheck(); break; case IDM_OPTION: this->OpenOption(); break; case IDM_LOG_ALLSEL: MessageBox(_T("AllSEl!")); break; case IDM_CLOSE: DeleteObject(hFont); PostQuitMessage(0); break; } }
void SavePlayers(HWND dialog) { AdaptTeams(dialog); for (int i = 0; i < 9; i++) { scen.players[i].resources[0] = GetDlgItemInt(dialog, IDC_P_GOLD1 + i, NULL, FALSE); scen.players[i].resources[1] = GetDlgItemInt(dialog, IDC_P_WOOD1 + i, NULL, FALSE); scen.players[i].resources[2] = GetDlgItemInt(dialog, IDC_P_FOOD1 + i, NULL, FALSE); scen.players[i].resources[3] = GetDlgItemInt(dialog, IDC_P_STONE1 + i, NULL, FALSE); GetDlgItemText(dialog, IDC_P_NAME1 + i, scen.players[i].name, 30); scen.players[i].civ = LCombo_GetSelId(dialog, IDC_P_CIV1 + i); scen.players[i].human = Button_IsChecked(GetDlgItem(dialog, IDC_P_HUMAN1 + i)); scen.players[i].pop = static_cast<float>(GetDlgItemInt(dialog, IDC_P_POP1 + i, NULL, FALSE)); scen.players[i].color = LCombo_GetSelId(dialog, IDC_P_COLOR1 + i); scen.players[i].age = SendDlgItemMessage(dialog, IDC_P_AGE1 + i, CB_GETCURSEL, 0, 0) - 1; scen.players[i].player_number = SendDlgItemMessage(dialog, IDC_P_P1_NUM + i, CB_GETCURSEL, 0, 0); } }
/* * OnCommand() */ void cd_OnCommand(HWND copyInstDlg, UINT ctrlID, HWND ctrl, UINT notify) { int i; UINT result = 0; switch (ctrlID) { case IDOK: for (i = 0; i < 8; i++) { HWND checkBox = GetDlgItem(copyInstDlg, IDC_INST1_CHK + i); if (Button_IsChecked(checkBox)) { result |= 1 << i; } } case IDCANCEL: EndDialog(copyInstDlg, result); break; default: break; } }
/* * OnCommand - handles OK and X buttons */ void sd_OnCommand(HWND sysDlg, UINT ctrlID, HWND ctrl, UINT notify) { int value; switch (ctrlID) { /* * Menus */ case IDM_RETRIEVE_SYS: TX81Z_RetrieveData(Prog_midi, REQ_SYS, &Prog_snapshot); SendMessage(Prog_mainWnd, WM_COMMAND , MAKEWPARAM(IDD_SYSDLG, EDN_CHANGE) , (LPARAM) sysDlg); sd_InitControlValues(sysDlg); return; case IDM_TRANSMIT_SYS: TX81Z_SendData(Prog_midi, REQ_SYS, &Prog_snapshot); return; case IDM_EXIT: PostMessage(Prog_mainWnd, WM_COMMAND, IDM_EXIT, 0L); case IDM_CLOSE: case IDCANCEL: DestroyWindow(sysDlg); return; case IDM_UNDO: Undo_Undo(sd_undo, sd_Undo, sysDlg); goto UpdateUndoMenus; case IDM_REDO: Undo_Redo(sd_undo, sd_Redo, sysDlg); UpdateUndoMenus: EnableMenuItem(sd_menu, IDM_UNDO , MF_BYCOMMAND | (Undo_AnyUndoes(sd_undo) ? MF_ENABLED : MF_GRAYED)); EnableMenuItem(sd_menu, IDM_REDO , MF_BYCOMMAND | (Undo_AnyRedoes(sd_undo) ? MF_ENABLED : MF_GRAYED)); return; case IDM_KYBDDLG: case IDM_REMOTEWND: case IDM_MAINWND: case IDM_VOICEDLG: case IDM_PFMDLG: case IDM_FXDLG: case IDM_PCDLG: case IDM_MTODLG: case IDM_MTFDLG: SendMessage(Prog_mainWnd, WM_COMMAND, ctrlID, 0); return; case IDM_HELP: Prog_OpenHelp(sysDlg, _T("system_editor.html")); return; /* * Controls */ case IDC_SYSEX_SW: case IDC_MEMPROT_SW: case IDC_COMBINE_SW: case IDC_AT_SW: { unsigned i; /* * Find the toggleInit structure for the button. */ for (i = 0; i < sd_toggleInitCnt; i++) { if (sd_toggleInits[i].ctrlID == ctrlID) break; } /* * Find the checked status of the button. */ value = Button_IsChecked(ctrl); /* * Toggle the text on the button the user clicked. */ Button_SetText(ctrl, value ? sd_toggleInits[i].modeOn : sd_toggleInits[i].modeOff); break; } case IDC_STARTUP_MSG: if (notify == LCN_EDITUPDATE) { int cursorPos = LcdCtrl_GetCursorPos(ctrl); ctrlID += cursorPos; value = LcdCtrl_GetChar(ctrl, cursorPos); } else { return; } break; default: if (notify == LCN_SELCHANGE) { value = LcdCtrl_GetValue(ctrl); } else { return; } break; } sd_ChangeParameter(ctrlID - SYS_ID_OFFSET, value, CP_SEND); }