static BOOL CALLBACK IEViewEmoticonsOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; BOOL bChecked; char path[MAX_PATH]; switch (msg) { case WM_INITDIALOG: { char *path; TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_SMILEYS_PREVIEW, BM_SETIMAGE, IMAGE_ICON, (LPARAM) smileyIcon); bChecked = FALSE; i = Options::getSmileyFlags(); if (i&Options::SMILEY_ENABLED) { bChecked = TRUE; CheckDlgButton(hwndDlg, IDC_SMILEYS, TRUE); } EnableWindow(GetDlgItem(hwndDlg, IDC_SMILEYS_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_SMILEYS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ISOLATED_SMILEYS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_SURROUND_SMILEYS), bChecked); // EnableWindow(GetDlgItem(hwndDlg, IDC_REPLACE_SMILEYADD), bChecked); if (Options::getSmileyFlags() & Options::SMILEY_PROTOCOLS) { CheckDlgButton(hwndDlg, IDC_PROTO_SMILEYS, TRUE); } else { bChecked = FALSE; } EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOLIST), bChecked); if (i&Options::SMILEY_ISOLATED) { CheckDlgButton(hwndDlg, IDC_ISOLATED_SMILEYS, TRUE); } if (i&Options::SMILEY_SURROUND) { CheckDlgButton(hwndDlg, IDC_SURROUND_SMILEYS, TRUE); } // if (i&Options::SMILEY_SMILEYADD) { // CheckDlgButton(hwndDlg, IDC_REPLACE_SMILEYADD, TRUE); // } PROTOCOLDESCRIPTOR **protoList; int protoCount; CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM)&protoCount, (LPARAM)&protoList); protoNames = new char[protoCount+1][128]; protoFilenames = new char[protoCount+1][MAX_PATH]; protoNum = 0; for (i = 0; i < protoCount+1; i++) { char * protocolName; char protoName[128]; char displayName[256]; if (i==0) { strcpy(protoNames[protoNum], ""); protocolName = "Standard"; } else if (protoList[i-1]->type == PROTOTYPE_PROTOCOL) { strcpy(protoNames[protoNum], protoList[i-1]->szName); CallProtoService(protoList[i-1]->szName, PS_GETNAME, sizeof(protoName), (LPARAM)protoName); protocolName = protoName;//protoList[i-1]->szName; } else { continue; } strcpy(displayName, protocolName); strcat(displayName, " smileys"); path = (char *) Options::getSmileyFile(protoNames[protoNum]); if (path != NULL) { strcpy (protoFilenames[protoNum], path); } else { strcpy (protoFilenames[protoNum], ""); } SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, LB_ADDSTRING, 0, (LPARAM)displayName); protoNum++; } SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, LB_SETCURSEL, 0, 0); SetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, protoFilenames[0]); lastProtoItem = 0; return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_SMILEYS_FILENAME: if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE) SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_SMILEYS_PREVIEW: { int iItem = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, LB_GETCURSEL, 0, 0); GetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path, sizeof(path)); if (SmileyMap::loadLibrary("IEVIewPreview", path)) { SmileyMap *map = SmileyMap::getSmileyMap("IEVIewPreview"); if (map!=NULL) { RECT rc; GetWindowRect(GetDlgItem(hwndDlg, IDC_SMILEYS_PREVIEW), &rc); map->getWindow()->show(NULL, 0, 0, rc.left, rc.bottom); } } else { SetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, protoFilenames[iItem]); } } break; case IDC_ISOLATED_SMILEYS: case IDC_SURROUND_SMILEYS: // case IDC_REPLACE_SMILEYADD: SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_SMILEYS: bChecked = IsDlgButtonChecked(hwndDlg, IDC_SMILEYS); EnableWindow(GetDlgItem(hwndDlg, IDC_SMILEYS_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_SMILEYS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ISOLATED_SMILEYS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_SURROUND_SMILEYS), bChecked); // EnableWindow(GetDlgItem(hwndDlg, IDC_REPLACE_SMILEYADD), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_PROTO_SMILEYS), bChecked); case IDC_PROTO_SMILEYS: bChecked = IsDlgButtonChecked(hwndDlg, IDC_PROTO_SMILEYS) & IsDlgButtonChecked(hwndDlg, IDC_SMILEYS); if (!bChecked ) { SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, LB_SETCURSEL, 0, 0); GetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path, sizeof(path)); strcpy(protoFilenames[lastProtoItem], path); SetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, protoFilenames[0]); lastProtoItem = 0; } EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOLIST), bChecked); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_BROWSE_SMILEYS: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "Smiley Library (*.asl)\0*.asl\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "asl"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; } case IDC_PROTOLIST: if (HIWORD(wParam) == LBN_SELCHANGE) { int iItem = SendDlgItemMessage(hwndDlg, IDC_PROTOLIST, LB_GETCURSEL, 0, 0); GetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path, sizeof(path)); strcpy(protoFilenames[lastProtoItem], path); SetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, protoFilenames[iItem]); lastProtoItem = iItem; } } break; case WM_NOTIFY: { switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: i = 0; if (IsDlgButtonChecked(hwndDlg, IDC_SMILEYS)) { i |= Options::SMILEY_ENABLED; } if (IsDlgButtonChecked(hwndDlg, IDC_ISOLATED_SMILEYS)) { i |= Options::SMILEY_ISOLATED; } if (IsDlgButtonChecked(hwndDlg, IDC_SURROUND_SMILEYS)) { i |= Options::SMILEY_SURROUND; } /* if (IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYADD)) { i |= Options::SMILEY_SMILEYADD; } */ if (IsDlgButtonChecked(hwndDlg, IDC_PROTO_SMILEYS)) { i |= Options::SMILEY_PROTOCOLS; } Options::setSmileyFlags(i); GetDlgItemText(hwndDlg, IDC_SMILEYS_FILENAME, path, sizeof(path)); strcpy(protoFilenames[lastProtoItem], path); for (i = 0; i < protoNum; i++) { Options::setSmileyFile(protoNames[i], protoFilenames[i]); } return TRUE; } } break; case WM_DESTROY: if (protoNames != NULL) { delete[] protoNames; protoNames = NULL; } if (protoFilenames != NULL) { delete[] protoFilenames; protoFilenames = NULL; } break; } return FALSE; }
static BOOL CALLBACK AddCheatCallB(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { static int lbfocus; static HWND hwndLB; switch (uMsg) { case WM_VSCROLL: if (scrollnum > (CSTOD - 1)) { switch ((int)LOWORD(wParam)) { case SB_TOP: scrollindex = -32768; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0); FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb); break; case SB_BOTTOM: scrollindex = scrollmax; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0); FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb); break; case SB_LINEUP: if (scrollindex > -32768) { scrollindex--; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_DELETESTRING, (CSTOD - 1), 0); FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768, cfcallbinsertt); } break; case SB_PAGEUP: scrollindex -= CSTOD; if (scrollindex < -32768) scrollindex = -32768; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, (CSTOD - 1), 0); FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb); break; case SB_LINEDOWN: if (scrollindex < scrollmax) { scrollindex++; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_DELETESTRING, 0, 0); FCEUI_CheatSearchGetRange(scrollindex + 32768 + (CSTOD - 1), scrollindex + 32768 + (CSTOD - 1), cfcallbinsert); } break; case SB_PAGEDOWN: scrollindex += CSTOD; if (scrollindex > scrollmax) scrollindex = scrollmax; SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, 0, 0); FCEUI_CheatSearchGetRange(scrollindex + 32768, scrollindex + 32768 + (CSTOD - 1), cfcallb); break; case SB_THUMBPOSITION: case SB_THUMBTRACK: scrollindex = (short int)HIWORD(wParam); SendDlgItemMessage(hwndDlg, 120, SBM_SETPOS, scrollindex, 1); SendDlgItemMessage(hwndDlg, 108, LB_RESETCONTENT, 0, 0); FCEUI_CheatSearchGetRange(32768 + scrollindex, 32768 + scrollindex + (CSTOD - 1), cfcallb); break; } } break; case WM_INITDIALOG: selcheat = -1; FixCheatSelButtons(hwndDlg, 0); acwin = hwndDlg; SetDlgItemText(hwndDlg, 110, (LPTSTR)U8ToStr(cheatval1)); SetDlgItemText(hwndDlg, 111, (LPTSTR)U8ToStr(cheatval2)); DoGet(); CheckRadioButton(hwndDlg, 115, 120, scheatmethod + 115); lbfocus = 0; hwndLB = 0; RedoCheatsLB(hwndDlg); break; case WM_VKEYTOITEM: if (lbfocus) { int real; real = SendDlgItemMessage(hwndDlg, 108, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0); switch ((int)LOWORD(wParam)) { case VK_UP: /* mmmm....recursive goodness */ if (!real) SendMessage(hwndDlg, WM_VSCROLL, SB_LINEUP, 0); return(-1); break; case VK_DOWN: if (real == (CSTOD - 1)) SendMessage(hwndDlg, WM_VSCROLL, SB_LINEDOWN, 0); return(-1); break; case VK_PRIOR: SendMessage(hwndDlg, WM_VSCROLL, SB_PAGEUP, 0); break; case VK_NEXT: SendMessage(hwndDlg, WM_VSCROLL, SB_PAGEDOWN, 0); break; case VK_HOME: SendMessage(hwndDlg, WM_VSCROLL, SB_TOP, 0); break; case VK_END: SendMessage(hwndDlg, WM_VSCROLL, SB_BOTTOM, 0); break; } return(-2); } break; case WM_CLOSE: case WM_QUIT: goto gornk; case WM_COMMAND: switch (LOWORD(wParam)) { case 300: /* List box selection changed. */ if (HIWORD(wParam) == LBN_SELCHANGE) { char *s; uint32 a; uint8 v; int status; int c, type; selcheat = SendDlgItemMessage(hwndDlg, 300, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0); if (selcheat < 0) { FixCheatSelButtons(hwndDlg, 0); break; } FixCheatSelButtons(hwndDlg, 1); FCEUI_GetCheat(selcheat, &s, &a, &v, &c, &status, &type); SetDlgItemText(hwndDlg, 200, (LPTSTR)s); SetDlgItemText(hwndDlg, 201, (LPTSTR)U16ToStr(a)); SetDlgItemText(hwndDlg, 202, (LPTSTR)U8ToStr(v)); SetDlgItemText(hwndDlg, 203, (c == -1) ? (LPTSTR)"" : (LPTSTR)IToStr(c)); CheckDlgButton(hwndDlg, 204, type ? BST_CHECKED : BST_UNCHECKED); } break; case 108: switch (HIWORD(wParam)) { case LBN_SELCHANGE: { char TempArray[32]; SendDlgItemMessage(hwndDlg, 108, LB_GETTEXT, SendDlgItemMessage(hwndDlg, 108, LB_GETCURSEL, 0, (LPARAM)(LPSTR)0), (LPARAM)(LPCTSTR)TempArray); TempArray[4] = 0; SetDlgItemText(hwndDlg, 201, (LPTSTR)TempArray); } break; case LBN_SETFOCUS: lbfocus = 1; break; case LBN_KILLFOCUS: lbfocus = 0; break; } break; } switch (HIWORD(wParam)) { case LBN_DBLCLK: if (selcheat >= 0) { if (LOWORD(wParam) == 300) FCEUI_ToggleCheat(selcheat); RedoCheatsLB(hwndDlg); SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0); } break; case BN_CLICKED: if (LOWORD(wParam) >= 115 && LOWORD(wParam) <= 120) scheatmethod = LOWORD(wParam) - 115; else switch (LOWORD(wParam)) { case 112: FCEUI_CheatSearchBegin(); DoGet(); break; case 113: FCEUI_CheatSearchEnd(scheatmethod, cheatval1, cheatval2); DoGet(); break; case 114: FCEUI_CheatSearchSetCurrentAsOriginal(); DoGet(); break; case 107: FCEUI_CheatSearchShowExcluded(); DoGet(); break; case 250: /* Add Cheat Button */ { int a, v, c, t; char name[257]; char temp[16]; GetDlgItemText(hwndDlg, 200, name, 256 + 1); GetDlgItemText(hwndDlg, 201, temp, 4 + 1); a = StrToU16(temp); GetDlgItemText(hwndDlg, 202, temp, 3 + 1); v = StrToU8(temp); GetDlgItemText(hwndDlg, 203, temp, 3 + 1); if (temp[0] == 0) c = -1; else c = StrToI(temp); t = (IsDlgButtonChecked(hwndDlg, 204) == BST_CHECKED) ? 1 : 0; FCEUI_AddCheat(name, a, v, c, t); RedoCheatsLB(hwndDlg); SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0); } break; case 253: /* Add GG Cheat Button */ { uint16 a; int c; uint8 v; char name[257]; GetDlgItemText(hwndDlg, 200, name, 256 + 1); if (FCEUI_DecodeGG(name, &a, &v, &c)) { FCEUI_AddCheat(name, a, v, c, 1); RedoCheatsLB(hwndDlg); SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0); } } break; case 251: /* Update Cheat Button */ if (selcheat >= 0) { int a, v, c, t; char name[257]; char temp[16]; GetDlgItemText(hwndDlg, 200, name, 256 + 1); GetDlgItemText(hwndDlg, 201, temp, 4 + 1); a = StrToU16(temp); GetDlgItemText(hwndDlg, 202, temp, 3 + 1); v = StrToU8(temp); GetDlgItemText(hwndDlg, 203, temp, 3 + 1); if (temp[0] == 0) c = -1; else c = StrToI(temp); t = (IsDlgButtonChecked(hwndDlg, 204) == BST_CHECKED) ? 1 : 0; FCEUI_SetCheat(selcheat, name, a, v, c, -1, t); RedoCheatsLB(hwndDlg); SendDlgItemMessage(hwndDlg, 300, LB_SETCURSEL, selcheat, 0); } break; case 252: /* Delete cheat button */ if (selcheat >= 0) { FCEUI_DelCheat(selcheat); SendDlgItemMessage(hwndDlg, 300, LB_DELETESTRING, selcheat, 0); FixCheatSelButtons(hwndDlg, 0); selcheat = -1; SetDlgItemText(hwndDlg, 200, (LPTSTR)""); SetDlgItemText(hwndDlg, 201, (LPTSTR)""); SetDlgItemText(hwndDlg, 202, (LPTSTR)""); SetDlgItemText(hwndDlg, 203, (LPTSTR)""); CheckDlgButton(hwndDlg, 204, BST_UNCHECKED); } break; case 106: gornk: EndDialog(hwndDlg, 0); acwin = 0; break; } break; case EN_CHANGE: { char TempArray[256]; GetDlgItemText(hwndDlg, LOWORD(wParam), TempArray, 256); switch (LOWORD(wParam)) { case 110: cheatval1 = StrToU8(TempArray); break; case 111: cheatval2 = StrToU8(TempArray); break; } } break; } } return 0; }
INT_PTR CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { switch (tmp_CFlashMode) { case ADDON_CFLASH_MODE_Path: SetFocus(GetDlgItem(dialog,IDC_RFOLDER)); CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE); EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); if (strlen(tmp_cflash_path)) _OKbutton = TRUE; break; case ADDON_CFLASH_MODE_File: SetFocus(GetDlgItem(dialog,IDC_RFILE)); CheckDlgButton(dialog, IDC_RFILE, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); if (strlen(tmp_cflash_filename)) _OKbutton = TRUE; break; case ADDON_CFLASH_MODE_RomPath: SetFocus(GetDlgItem(dialog,IDC_PATHDESMUME)); CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); _OKbutton = TRUE; break; } SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), tmp_cflash_filename); SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_cflash_path); return FALSE; } case WM_COMMAND: { switch (LOWORD(wparam)) { case IDC_BBROWSE: { int filterSize = 0, i = 0; OPENFILENAME ofn; char filename[MAX_PATH] = ""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = dialog; const char *fileFilter = "Compact Flash image (*.img)\0*.img\0Any file (*.*)\0*.*\0"; ofn.lpstrFilter = fileFilter; ofn.nFilterIndex = 1; ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "img"; ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT | OFN_PATHMUSTEXIST; if(!GetOpenFileName(&ofn)) return FALSE; SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), filename); strcpy(tmp_cflash_filename, filename); if (!strlen(tmp_cflash_filename)) EnableWindow(OKbutton, FALSE); else EnableWindow(OKbutton, TRUE); return FALSE; } case IDC_BBROWSE2: { BROWSEINFO bp={0}; bp.hwndOwner=dialog; bp.pidlRoot=NULL; bp.pszDisplayName=NULL; bp.lpszTitle="Select directory for Compact Flash"; bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_USENEWUI; bp.lpfn=NULL; LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp); if (tmp!=NULL) { memset(tmp_cflash_path, 0, sizeof(tmp_cflash_path)); SHGetPathFromIDList(tmp, tmp_cflash_path); if (tmp_cflash_path[strlen(tmp_cflash_path)-1] != '\\') tmp_cflash_path[strlen(tmp_cflash_path)] = '\\'; SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_cflash_path); } if (strlen(tmp_cflash_path)) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); break; } case IDC_RFILE: { if (HIWORD(wparam) == BN_CLICKED) { tmp_CFlashMode = ADDON_CFLASH_MODE_File; EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); if (!strlen(tmp_cflash_filename)) EnableWindow(OKbutton, FALSE); } break; } case IDC_RFOLDER: { if (HIWORD(wparam) == BN_CLICKED) { tmp_CFlashMode = ADDON_CFLASH_MODE_Path; EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE); EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE); if (!strlen(tmp_cflash_path)) EnableWindow(OKbutton, FALSE); } break; } case IDC_PATHDESMUME: { if (HIWORD(wparam) == BN_CLICKED) { tmp_CFlashMode = ADDON_CFLASH_MODE_RomPath; EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); EnableWindow(OKbutton, TRUE); } break; } } break; } } return FALSE; }
INT_PTR CALLBACK PrintSizeDlgProc(HWND hdlg, UINT wmsg, WPARAM wparam, LPARAM lparam) { TCHAR buf[8]; GP_LPPRINT lpr = (GP_LPPRINT)GetWindowLongPtr(GetParent(hdlg), 4); switch (wmsg) { case WM_INITDIALOG: wsprintf(buf, TEXT("%d"), lpr->pdef.x); SetDlgItemText(hdlg, PSIZE_DEFX, buf); wsprintf(buf, TEXT("%d"), lpr->pdef.y); SetDlgItemText(hdlg, PSIZE_DEFY, buf); wsprintf(buf, TEXT("%d"), lpr->poff.x); SetDlgItemText(hdlg, PSIZE_OFFX, buf); wsprintf(buf, TEXT("%d"), lpr->poff.y); SetDlgItemText(hdlg, PSIZE_OFFY, buf); wsprintf(buf, TEXT("%d"), lpr->psize.x); SetDlgItemText(hdlg, PSIZE_X, buf); wsprintf(buf, TEXT("%d"), lpr->psize.y); SetDlgItemText(hdlg, PSIZE_Y, buf); CheckDlgButton(hdlg, PSIZE_DEF, TRUE); EnableWindow(GetDlgItem(hdlg, PSIZE_X), FALSE); EnableWindow(GetDlgItem(hdlg, PSIZE_Y), FALSE); return TRUE; case WM_COMMAND: switch (wparam) { case PSIZE_DEF: EnableWindow(GetDlgItem(hdlg, PSIZE_X), FALSE); EnableWindow(GetDlgItem(hdlg, PSIZE_Y), FALSE); return FALSE; case PSIZE_OTHER: EnableWindow(GetDlgItem(hdlg, PSIZE_X), TRUE); EnableWindow(GetDlgItem(hdlg, PSIZE_Y), TRUE); return FALSE; case IDOK: if (SendDlgItemMessage(hdlg, PSIZE_OTHER, BM_GETCHECK, 0, 0L)) { SendDlgItemMessage(hdlg, PSIZE_X, WM_GETTEXT, 7, (LPARAM) (LPSTR) buf); GetInt(buf, (LPINT)&lpr->psize.x); SendDlgItemMessage(hdlg, PSIZE_Y, WM_GETTEXT, 7, (LPARAM) (LPSTR) buf); GetInt(buf, (LPINT)&lpr->psize.y); } else { lpr->psize.x = lpr->pdef.x; lpr->psize.y = lpr->pdef.y; } SendDlgItemMessage(hdlg, PSIZE_OFFX, WM_GETTEXT, 7, (LPARAM) (LPSTR) buf); GetInt(buf, (LPINT)&lpr->poff.x); SendDlgItemMessage(hdlg, PSIZE_OFFY, WM_GETTEXT, 7, (LPARAM) (LPSTR) buf); GetInt(buf, (LPINT)&lpr->poff.y); if (lpr->psize.x <= 0) lpr->psize.x = lpr->pdef.x; if (lpr->psize.y <= 0) lpr->psize.y = lpr->pdef.y; EndDialog(hdlg, IDOK); return TRUE; case IDCANCEL: EndDialog(hdlg, IDCANCEL); return TRUE; } /* switch(wparam) */ break; } /* switch(msg) */ return FALSE; }
BOOL CDownloadProperties_IntegrityPage::OnInitDialog() { CPropertyPage::OnInitDialog(); fsDownload_Properties dp; fsDownload_Properties *dp0 = m_pvDlds->at (0)->pMgr->GetDownloadMgr ()->GetDP (); if (DP_EQ (bCheckIntegrityWhenDone, FALSE)) CheckDlgButton (IDC_PERFORMCHECKWHENDONE, dp0->bCheckIntegrityWhenDone ? BST_CHECKED : BST_UNCHECKED); else CheckDlgButton (IDC_PERFORMCHECKWHENDONE, BST_INDETERMINATE); m_wndICFR.AddString (LS (L_ASK)); m_wndICFR.AddString (LS (L_RESTART)); m_wndICFR.AddString (LS (L_DONOTHING)); if (DP_EQ (enICFR, FALSE)) m_wndICFR.SetCurSel (dp0->enICFR); LPCTSTR ppszAlgs [] = { _T("MD5"), _T("SHA-1"), _T("SHA-2 256"), _T("SHA-2 384"), _T("SHA-2 512"), _T("CRC 32") }; DWORD adwAlgs [] = { HA_MD5, HA_SHA1, HA_SHA2, MAKELONG (HA_SHA2, HSHA2S_384), MAKELONG (HA_SHA2, HSHA2S_512), HA_CRC32, }; DWORD dwAlg = (DWORD)-1; if (m_pvDlds->size () == 1) dwAlg = dp0->dwIntegrityCheckAlgorithm; for (int i = 0; i < sizeof (ppszAlgs) / sizeof (LPCSTR); i++) { m_wndAlgorithm.AddString (ppszAlgs [i]); m_wndAlgorithm.SetItemData (i, adwAlgs [i]); if (dwAlg == adwAlgs [i]) m_wndAlgorithm.SetCurSel (i); } if (m_pvDlds->size () == 1) { SetDlgItemText (IDC_CHECKSUM, dp0->pszCheckSum); } else { UINT anIds [] = { IDC__CHECKSUMOFTHISFILE, IDC_CHECKSUM, IDC__ALGORITHM, IDC_ALGORITHM }; for (int i = 0; i < sizeof (anIds) / sizeof (UINT); i++) GetDlgItem (anIds [i])->ShowWindow (SW_HIDE); } ApplyLanguage (); UpdateEnabled (); return TRUE; }
LRESULT CALLBACK CFG_OnSelChangedProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { TCHAR szText[256]; TCHAR tmp[20]; TCHAR szFile[260]; hwndConfDialog = hDlg; switch(uMsg) { case WM_INITDIALOG: { g_bChanged = false; CFG_OnChildDialogInit(hDlg); SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0, (LPARAM)"ALT"); SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0 ,(LPARAM)"CONTROL"); SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_ADDSTRING, 0, (LPARAM)"SHIFT"); if(AppCFGtemp.dwMinimizeMODKey == MOD_ALT) SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 0, 0); else if(AppCFGtemp.dwMinimizeMODKey == MOD_CONTROL) SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 1, 0); else if(AppCFGtemp.dwMinimizeMODKey == MOD_SHIFT) SendDlgItemMessage (hDlg,IDC_COMBO_MOD, CB_SETCURSEL, 2, 0); sprintf(tmp,"%c",AppCFGtemp.cMinimizeKey); SetDlgItemText(hDlg,IDC_EDIT_KEY,tmp); SendDlgItemMessage (hDlg,IDC_EDIT_KEY, EM_SETLIMITTEXT,1, 0); CheckDlgButton(hDlg,IDC_CHECK_CONNECT_CLOSE,AppCFGtemp.bCloseOnConnect); CheckDlgButton(hDlg,IDC_CHECK1,AppCFGtemp.bAutostart); CheckDlgButton(hDlg,IDC_CHECK_SHORTNAME,AppCFGtemp.bUseShortCountry); CheckDlgButton(hDlg,IDC_CHECK_REG_WEB_PROTOCOLS,AppCFGtemp.bRegisterWebProtocols); CheckDlgButton(hDlg,IDC_CHECK_NO_MAP_RESIZE,AppCFGtemp.bNoMapResize); CheckDlgButton(hDlg,IDC_CHECK_REFRESH_AT_START_UP,AppCFGtemp.bAutoRefreshServerlist); LVCOLUMN lvColumn; //initialize the columns lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM ; lvColumn.fmt = LVCFMT_LEFT; HWND hwndLVexes; hwndLVexes = GetDlgItem(hDlg,IDC_LIST_CFG_EXES); lvColumn.cx = 80; lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnName"); ListView_InsertColumn(hwndLVexes, 0, &lvColumn); lvColumn.cx = 120; lvColumn.pszText = (LPSTR)g_lang.GetString("LaunchByScript"); ListView_InsertColumn(hwndLVexes, 1, &lvColumn); lvColumn.cx = 180; lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnExePath"); ListView_InsertColumn(hwndLVexes, 3, &lvColumn); lvColumn.pszText = (LPSTR)g_lang.GetString("ColumnCommand"); ListView_InsertColumn(hwndLVexes, 4, &lvColumn); DWORD dwExStyle=0; dwExStyle = ListView_GetExtendedListViewStyle(hwndLVexes); dwExStyle |= LVS_EX_FULLROWSELECT | LVS_EX_LABELTIP ; ListView_SetExtendedListViewStyle(hwndLVexes,dwExStyle); CheckDlgButton(hDlg,IDC_CHECK2,AppCFGtemp.bUse_minimize); CheckDlgButton(hDlg,IDC_CHECK_SCR_RESTORE,AppCFGtemp.bUSE_SCREEN_RESTORE ); sprintf(szText,"%d",AppCFGtemp.iAutoRefreshEveryMinuteInterval); SetDlgItemText(hDlg,IDC_EDIT_AUTO_REFRESH_INTERVAL,szText); sprintf(szText,"%d",(AppCFGtemp.socktimeout.tv_sec*1000)+AppCFGtemp.socktimeout.tv_usec); SetDlgItemText(hDlg,IDC_EDIT_SOCK_TIMEOUT_S,szText); sprintf(szText,"%d",AppCFGtemp.dwRetries); SetDlgItemText(hDlg,IDC_EDIT_CFG_RETRIES,szText); CheckDlgButton(hDlg,IDC_CHECK_XMPP_ACTIVE,AppCFGtemp.bXMPP_Active); SetDlgItemText(hDlg,IDC_EDIT_XMPP_USERNAME,AppCFGtemp.szXMPP_USERNAME); SetDlgItemText(hDlg,IDC_EDIT_XMPP_PASSWORD,AppCFGtemp.szXMPP_PASSWORD); SetDlgItemText(hDlg,IDC_EDIT_XMPP_SERVER,AppCFGtemp.szXMPP_SERVER); CheckDlgButton(hDlg,IDC_CHECK_BUDDY_NOTIFY,AppCFGtemp.bBuddyNotify); CheckDlgButton(hDlg,IDC_CHECK_USE_WAV_FILE,AppCFGtemp.bUseBuddySndNotify); SetDlgItemText(hDlg,IDC_EDIT_WAV_FILE,AppCFGtemp.szNotifySoundWAVfile); SetDlgItemText(hDlg,IDC_EDIT_MIRC,g_sMIRCoutput.c_str()); CheckDlgButton(hDlg,IDC_CHECK_EXT_ACTIVE,AppCFGtemp.bUse_EXT_APP); CheckDlgButton(hDlg,IDC_CHECK_EXT_ACTIVE2,AppCFGtemp.bUse_EXT_APP2); CheckDlgButton(hDlg,IDC_CHECK_MIRC,AppCFGtemp.bUseMIRC); g_lang.EnumerateLanguage(); for( map<string,string>::iterator ii=g_lang.m_Languages.begin(); ii!=g_lang.m_Languages.end(); ++ii) { const TCHAR *psz = (*ii).first.c_str() ; SendMessage(GetDlgItem(hDlg,IDC_COMBO_LANG), (UINT) CB_ADDSTRING, 0, (LPARAM)psz ); } SendMessage(GetDlgItem(hDlg,IDC_COMBO_LANG), (UINT) CB_SELECTSTRING, 0, (LPARAM)g_lang.m_strCurrentLang.c_str() ); int gameID=-1; gameID = CFG_GetGameID(g_currSelCfg); if(gameID!=-1) { sprintf(szText,g_lang.GetString("CFGSettingsTitle"),GamesInfoCFG[gameID].szGAME_NAME); SetWindowText(GetDlgItem(hDlg,IDC_STATIC_GAME_NAME),szText); TCHAR szTempMaster[200]; if(GamesInfoCFG[gameID].bUseHTTPServerList==FALSE) sprintf(szTempMaster,"%s:%d",GamesInfoCFG[gameID].szMasterServerIP[0],GamesInfoCFG[gameID].dwMasterServerPORT); else sprintf(szTempMaster,"%s",GamesInfoCFG[gameID].szMasterServerIP[0]); SetDlgItemText(hDlg,IDC_EDIT_MASTER_SERVER,szTempMaster);//GamesInfoCFG[gameID].szMasterServerIP[0]); CheckDlgButton(hDlg,IDC_CHECK_USE_HTTP,GamesInfoCFG[gameID].bUseHTTPServerList[0]); CheckDlgButton(hDlg,IDC_CHECK_ACTIVE,GamesInfoCFG[gameID].bActive); sprintf(szText,"Example web protocol: %s://10.0.0.1:%d",gm.GamesInfo[gameID].szWebProtocolName,gm.GamesInfo[gameID].dwDefaultPort); SetDlgItemText(hDlg,IDC_STATIC_WEB_PROTOCOL,szText); CFG_Enumerate_installations(hDlg,gameID); } SetDlgItemText(hDlg,IDC_BUTTON_ADD_INSTALL,g_lang.GetString("CFGAddInstall")); SetDlgItemText(hDlg,IDC_BUTTON_EDIT_INSTALL,g_lang.GetString("CFGEditInstall")); SetDlgItemText(hDlg,IDC_BUTTON_DELETE_INSTALL,g_lang.GetString("CFGDeleteInstall")); SetDlgItemText(hDlg,IDC_EDIT_EXT_EXE,AppCFGtemp.szEXT_EXE_PATH); SetDlgItemText(hDlg,IDC_EDIT_EXT_CMD,AppCFGtemp.szEXT_EXE_CMD); SetDlgItemText(hDlg,IDC_EDIT_EXT_WINDOWNAME,AppCFGtemp.szEXT_EXE_WINDOWNAME); SetDlgItemText(hDlg,IDC_EDIT_WINDOWNAME,AppCFGtemp.szET_WindowName); SetDlgItemText(hDlg,IDC_EDIT_EXT_EXE2,AppCFGtemp.szOnReturn_EXE_PATH); SetDlgItemText(hDlg,IDC_EDIT_EXT_CMD2,AppCFGtemp.szOnReturn_EXE_CMD); SetDlgItemText(hDlg,IDC_STATIC_INSTALL_PATH,EXE_PATH); g_hwndScrollTrans = GetDlgItem(hDlg,IDC_SLIDER_TRANS); SendMessage(g_hwndScrollTrans,TBM_SETRANGE,TRUE,(LPARAM)MAKELONG(MIN_TRANSPARANCY, 100)) ; //AppCFG.g_cTransparancy); SendMessage(g_hwndScrollTrans,TBM_SETPOS,TRUE,(LPARAM)AppCFGtemp.g_cTransparancy ) ; //AppCFG.g_cTransparancy); SetDlgTrans(hDlg,AppCFGtemp.g_cTransparancy); g_hwndSleepSlider = GetDlgItem(hDlg,IDC_SLIDER_SLEEP_VAL); SendMessage(g_hwndSleepSlider,TBM_SETRANGE,TRUE,(LPARAM)MAKELONG(0, 2000)) ; SendMessage(g_hwndSleepSlider,TBM_SETPOS,TRUE,(LPARAM)AppCFGtemp.dwSleep) ; TCHAR sztemp[100]; sprintf(sztemp,"Sleep time is %d ms",AppCFGtemp.dwSleep); SetDlgItemText(hDlg,IDC_STATIC_SLEEP_VAL,sztemp); g_hwndScrollThreads = GetDlgItem(hDlg,IDC_SLIDER_THREADS); SendMessage( g_hwndScrollThreads,TBM_SETRANGE,TRUE,(LPARAM)MAKELONG(1, 256)) ; SendMessage(g_hwndScrollThreads,TBM_SETPOS,TRUE,(LPARAM)AppCFGtemp.dwThreads) ; SetDlgItemText(hDlg,IDC_STATIC_THREAD,_itoa(AppCFGtemp.dwThreads ,sztemp,10)); break; } case WM_VSCROLL: { if(lParam==(LPARAM)g_hwndScrollTrans) { int i = (TCHAR)SendMessage(GetDlgItem(hDlg,IDC_SLIDER_TRANS),TBM_GETPOS,0,(LPARAM)0) ; SetDlgTrans(GetParent(hDlg),i); } else if (lParam==(LPARAM)g_hwndScrollThreads) { DWORD i = (DWORD)SendMessage(GetDlgItem(hDlg,IDC_SLIDER_THREADS),TBM_GETPOS,0,(LPARAM)0) ; TCHAR sztemp[20]; AppCFGtemp.dwThreads = i; SetDlgItemText(hDlg,IDC_STATIC_THREAD,_itoa(i,sztemp,10)); } else if (lParam==(LPARAM)g_hwndSleepSlider) { DWORD i = (DWORD)SendMessage(GetDlgItem(hDlg,IDC_SLIDER_SLEEP_VAL),TBM_GETPOS,0,(LPARAM)0) ; TCHAR sztemp[100]; AppCFG.dwSleep = i; AppCFGtemp.dwSleep = i; sprintf(sztemp,"Sleep time is %d ms",i); SetDlgItemText(hDlg,IDC_STATIC_SLEEP_VAL,sztemp); } return FALSE; } case WM_COMMAND: switch(HIWORD(wParam)) { case CBN_SELCHANGE: { if(LOWORD(wParam)==IDC_COMBO_LANG) { TCHAR sztemp[200]; int idx= SendMessage(GetDlgItem(hDlg,IDC_COMBO_LANG), (UINT) CB_GETCURSEL, 0, (LPARAM)0 ); SendMessage(GetDlgItem(hDlg,IDC_COMBO_LANG), (UINT) CB_GETLBTEXT, idx, (LPARAM)sztemp ); strcpy(AppCFGtemp.szLanguageFilename,g_lang.m_Languages[sztemp].c_str()); g_lang.loadFile(g_lang.m_Languages[sztemp].c_str()); MessageBox(NULL,g_lang.GetString("AlertRestartRequired"),"Alert!",MB_OK); } } break; case CBN_CLOSEUP : g_bChanged = true; break; case BN_CLICKED: break; case EN_CHANGE: { g_bChanged = true; } } switch (LOWORD(wParam)) { case IDC_CHECK_USE_HTTP: g_bChanged = true; break; case IDC_BUTTON_SEL_FONT: HFONT hf; hf = CFG_SelectFont(); DeleteObject(g_hf); g_hf = hf; ChangeFont(g_hWnd, g_hf); break; case IDCANCEL: EndDialog(hDlg, 0); break; case IDC_BUTTON_ADD_INSTALL: { DialogBox(g_hInst, (LPCTSTR)IDD_ADD_NEW_GAME_INSTALLATION, hDlg, (DLGPROC)CFG_AddNewInstall_Proc); int gameID = CFG_GetGameID(g_currSelCfg); CFG_Enumerate_installations(hDlg,gameID); } break; case IDC_BUTTON_EDIT_INSTALL: { int n; n = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_LIST_CFG_EXES)); if(n!=-1) { DialogBoxParam(g_hInst, (LPCTSTR)IDD_ADD_NEW_GAME_INSTALLATION, hDlg, (DLGPROC)CFG_EditInstall_Proc,n); int gameID = CFG_GetGameID(g_currSelCfg); CFG_Enumerate_installations(hDlg,gameID); } } break; case IDC_BUTTON_DELETE_INSTALL: { int n; n = ListView_GetSelectionMark(GetDlgItem(hDlg,IDC_LIST_CFG_EXES)); if(n!=-1) { int gameID = CFG_GetGameID(g_currSelCfg); if(gameID!=-1) { GamesInfoCFG[gameID].vGAME_INST.erase(GamesInfoCFG[gameID].vGAME_INST.begin()+n); CFG_Enumerate_installations(hDlg,gameID); } } } break; case IDC_EXT_EXE: { OPENFILENAME ofn; memset(&ofn,0,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFilter = NULL; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0External exe\0*.exe\0"; ofn.nFilterIndex = 2; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = AppCFGtemp.szEXT_EXE_PATH; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if(GetOpenFileName(&ofn)) SetDlgItemText(hDlg,IDC_EDIT_EXT_EXE,ofn.lpstrFile); return TRUE; } case IDC_EXT_EXE2: { OPENFILENAME ofn; memset(&ofn,0,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFilter = NULL; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0External exe\0*.exe\0"; ofn.nFilterIndex = 2; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = AppCFGtemp.szOnReturn_EXE_PATH; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if(GetOpenFileName(&ofn)) SetDlgItemText(hDlg,IDC_EDIT_EXT_EXE2,ofn.lpstrFile); return TRUE; } case IDC_BUTTON_WAV_FILE: { OPENFILENAME ofn; memset(&ofn,0,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFilter = NULL; ofn.lpstrFile = szFile; ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Wav\0*.wav\0"; ofn.nFilterIndex = 2; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.lpstrInitialDir = AppCFGtemp.szNotifySoundWAVfile; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if(GetOpenFileName(&ofn)) SetDlgItemText(hDlg,IDC_EDIT_WAV_FILE,ofn.lpstrFile); return TRUE; } } break; } return FALSE; }
/** * name: DlgProc_EditPhone() * desc: dialog procedure * * return: 0 or 1 **/ INT_PTR CALLBACK DlgProc_Phone(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) { LPCBEXITEM cbi = (LPCBEXITEM)GetUserData(hDlg); static int noRecursion = 0; switch (msg) { case WM_INITDIALOG: { UINT i, item, countryCount; LPIDSTRLIST pCountries; HWND hCombo = GetDlgItem(hDlg, EDIT_COUNTRY); cbi = (LPCBEXITEM)lParam; if (!cbi) return FALSE; SetUserData(hDlg, lParam); SendDlgItemMessage(hDlg, IDC_HEADERBAR, WM_SETICON, 0, (LPARAM)IcoLib_GetIcon(ICO_DLG_PHONE, TRUE)); if (db_get_b(NULL, MODNAME, SET_ICONS_BUTTONS, 1)) { SendDlgItemMessage(hDlg, IDOK, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_OK)); SendDlgItemMessage(hDlg, IDCANCEL, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_BTN_CANCEL)); } // translate Userinfo buttons { TCHAR szButton[MAX_PATH]; HWND hBtn; hBtn = GetDlgItem(hDlg, IDOK); GetWindowText(hBtn, szButton, _countof(szButton)); SetWindowText(hBtn, TranslateTS(szButton)); hBtn = GetDlgItem(hDlg, IDCANCEL); GetWindowText(hBtn, szButton, _countof(szButton)); SetWindowText(hBtn, TranslateTS(szButton)); } if (*cbi->pszVal) SetWindowText(hDlg, LPGENT("Edit phone number")); if (cbi->wFlags & CBEXIF_SMS) CheckDlgButton(hDlg, CHECK_SMS, BST_CHECKED); TranslateDialogDefault(hDlg); EnableWindow(GetDlgItem(hDlg, IDOK), *cbi->pszVal); SendDlgItemMessage(hDlg, EDIT_AREA, EM_LIMITTEXT, 31, 0); SendDlgItemMessage(hDlg, EDIT_NUMBER, EM_LIMITTEXT, 63, 0); SendDlgItemMessage(hDlg, EDIT_CATEGORY, EM_LIMITTEXT, cbi->ccCat - 1, 0); SendDlgItemMessage(hDlg, EDIT_PHONE, EM_LIMITTEXT, cbi->ccVal - 1, 0); GetCountryList(&countryCount, &pCountries); for (i = 0; i < countryCount; i++) { if (pCountries[i].nID == 0 || pCountries[i].nID == 0xFFFF) continue; item = SendMessage(hCombo, CB_ADDSTRING, NULL, (LPARAM)pCountries[i].ptszTranslated); SendMessage(hCombo, CB_SETITEMDATA, item, pCountries[i].nID); } SetDlgItemText(hDlg, EDIT_PHONE, cbi->pszVal); SetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat); EnableWindow(GetDlgItem(hDlg, EDIT_CATEGORY), !(cbi->wFlags & CBEXIF_CATREADONLY)); } return TRUE; case WM_CTLCOLORSTATIC: SetBkColor((HDC)wParam, RGB(255, 255, 255)); return (INT_PTR)GetStockObject(WHITE_BRUSH); case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: if (HIWORD(wParam) == BN_CLICKED) { TCHAR szText[MAXDATASIZE]; int errorPos; if (!GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)) || !CheckPhoneSyntax(szText, cbi->pszVal, cbi->ccVal, errorPos) || errorPos > -1) { MsgErr(hDlg, TranslateT("The phone number should start with a + and consist of\nnumbers, spaces, brackets and hyphens only.")); break; } // save category string GetDlgItemText(hDlg, EDIT_CATEGORY, cbi->pszCat, cbi->ccCat); // save SMS flag if ((int)IsDlgButtonChecked(hDlg, CHECK_SMS) != ((cbi->wFlags & CBEXIF_SMS) == CBEXIF_SMS)) cbi->wFlags ^= CBEXIF_SMS; } //fall through case IDCANCEL: if (HIWORD(wParam) == BN_CLICKED) EndDialog(hDlg, wParam); break; case EDIT_COUNTRY: if (HIWORD(wParam) != CBN_SELCHANGE) break; case EDIT_AREA: case EDIT_NUMBER: if (LOWORD(wParam) != EDIT_COUNTRY && HIWORD(wParam) != EN_CHANGE) break; if (noRecursion) break; EnableWindow(GetDlgItem(hDlg, IDOK), TRUE); { TCHAR szPhone[MAXDATASIZE], szArea[32], szData[64]; int nCurSel = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCURSEL, 0, 0); UINT nCountry = (nCurSel != CB_ERR) ? SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, nCurSel, 0) : 0; GetDlgItemText(hDlg, EDIT_AREA, szArea, _countof(szArea)); GetDlgItemText(hDlg, EDIT_NUMBER, szData, _countof(szData)); mir_sntprintf(szPhone, _T("+%u (%s) %s"), nCountry, szArea, szData); noRecursion = 1; SetDlgItemText(hDlg, EDIT_PHONE, szPhone); noRecursion = 0; } break; case EDIT_PHONE: if (HIWORD(wParam) != EN_UPDATE) break; if (noRecursion) break; noRecursion = 1; { TCHAR szText[MAXDATASIZE], *pText = 0, *pArea, *pNumber; bool isValid = true; GetDlgItemText(hDlg, EDIT_PHONE, szText, _countof(szText)); if (szText[0] != '+') isValid = false; if (isValid) { int country = _tcstol(szText + 1, &pText, 10); if (pText - szText > 4) isValid = false; else { int i; for (i = SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) { if (country == SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_GETITEMDATA, i, 0)) { SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, i, 0); break; } } if (i < 0) isValid = false; } } if (isValid) { pArea = pText + _tcscspn(pText, _T("0123456789")); pText = pArea + _tcsspn(pArea, _T("0123456789")); if (*pText) { *pText = '\0'; pNumber = pText + 1 + _tcscspn(pText + 1, _T("0123456789")); SetDlgItemText(hDlg, EDIT_NUMBER, pNumber); } SetDlgItemText(hDlg, EDIT_AREA, pArea); } if (!isValid) { SendDlgItemMessage(hDlg, EDIT_COUNTRY, CB_SETCURSEL, -1, 0); SetDlgItemText(hDlg, EDIT_AREA, _T("")); SetDlgItemText(hDlg, EDIT_NUMBER, _T("")); } } noRecursion = 0; EnableWindow(GetDlgItem(hDlg, IDOK), GetWindowTextLength(GetDlgItem(hDlg, EDIT_PHONE))); break; } break; } return FALSE; }
INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg){ case WM_INITDIALOG:{ DWORD style; g_opHdlg=hdlg; bOptionsInit=TRUE; TranslateDialogDefault(hdlg); if(g_iButtonsCount!=db_get_b(NULL, PLGNAME,"ButtonsCount", 0)) { LOGFONT logFont; HFONT hFont; bNeedRestart=TRUE; EnableWindow(GetDlgItem(hdlg,IDC_BUTTONSLIST),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BLISTADD),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BLISTREMOVE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUTREE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MTREEADD),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MTREEREMOVE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_BUTTONNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_MENUNAME),FALSE); ShowWindow(GetDlgItem(hdlg,IDC_WARNING),SW_SHOW); hFont = (HFONT)SendDlgItemMessage(hdlg, IDC_WARNING, WM_GETFONT, 0, 0); GetObject(hFont, sizeof(logFont), &logFont); logFont.lfWeight = FW_BOLD; hFont = CreateFontIndirect(&logFont); SendDlgItemMessage(hdlg, IDC_WARNING, WM_SETFONT, (WPARAM)hFont, 0); break; } g_iOPButtonsCount=g_iButtonsCount; hButtonsList=GetDlgItem(hdlg,IDC_BUTTONSLIST); hMenuTree=GetDlgItem(hdlg,IDC_MENUTREE); style = GetWindowLongPtr(hButtonsList,GWL_STYLE); style |=TVS_NOHSCROLL; SetWindowLongPtr(hButtonsList,GWL_STYLE, style); style = GetWindowLongPtr(hMenuTree,GWL_STYLE); style |=TVS_NOHSCROLL; SetWindowLongPtr(hMenuTree,GWL_STYLE, style); BuildButtonsList(hButtonsList); if (!TreeView_GetCount(hButtonsList)) EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE); mir_subclassWindow( GetDlgItem(hdlg,IDC_BUTTONNAME), EditSubclassProc); mir_subclassWindow( GetDlgItem(hdlg,IDC_MENUNAME), EditSubclassProc); EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); CheckDlgButton(hdlg,IDC_RAUTOSEND,(g_bRClickAuto=db_get_b(NULL,PLGNAME,"RClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg,IDC_LAUTOSEND,(g_bLClickAuto=db_get_b(NULL,PLGNAME,"LClickAuto",0)) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg,IDC_ENABLEQUICKMENU,(g_bQuickMenu=db_get_b(NULL, PLGNAME,"QuickMenu", 1)) ? BST_CHECKED : BST_UNCHECKED); bOptionsInit=FALSE; }break; case WM_LBUTTONUP: if(drag) { TVHITTESTINFO hti; HTREEITEM htiAfter=NULL; ButtonData* bd=NULL; TVITEM tvi; RECT rc; BYTE height; BOOLEAN bAsChild = FALSE; TreeView_SetInsertMark(hMenuTree, NULL, 0 ); ReleaseCapture(); SetCursor( LoadCursor( NULL, IDC_ARROW )); hti.pt.x = ( SHORT )LOWORD( lparam ); hti.pt.y = ( SHORT )HIWORD( lparam ); ClientToScreen(hdlg,&hti.pt); ScreenToClient(hMenuTree,&hti.pt); TreeView_HitTest( hMenuTree, &hti ); if(TreeView_GetParent(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem)) break; if(TreeView_GetChild(hMenuTree,hti.hItem)&&TreeView_GetChild(hMenuTree,hDragItem)) break; if ( hti.flags & TVHT_ABOVE ) { htiAfter = TVI_FIRST; } else if ( hti.flags & ( TVHT_NOWHERE|TVHT_BELOW )) { htiAfter = TVI_LAST; } else if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) { // check where over the item, the pointer is if ( !TreeView_GetItemRect( hMenuTree, hti.hItem, &rc, FALSE )) { drag=0; break; } height = ( BYTE )( rc.bottom - rc.top ); if ( hti.pt.y - ( height / 3 ) < rc.top ) { HTREEITEM hItem = hti.hItem; if ( !( hti.hItem = TreeView_GetPrevSibling( hMenuTree, hItem )) ) { if ( !( hti.hItem = TreeView_GetParent(hMenuTree, hItem ))) htiAfter = TVI_FIRST; else bAsChild = TRUE; } } else if ( hti.pt.y + ( height / 3 ) <= rc.bottom ) { bAsChild = TRUE; } } if(TreeView_GetChild(hMenuTree,hDragItem)&&bAsChild) break; if(hti.hItem){ tvi.hItem=hti.hItem; tvi.mask=TVIF_PARAM |TVIF_HANDLE; TreeView_GetItem(hMenuTree,&tvi); if ((bd=(ButtonData*)tvi.lParam)&&(bd->fEntryOpType&QMF_EX_SEPARATOR)) bAsChild = FALSE; } if(TreeView_GetParent(hMenuTree,hti.hItem)) bAsChild = FALSE; MoveItem( hDragItem, htiAfter?htiAfter:hti.hItem, bAsChild ); SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); drag=0; } break; /////////////////////////////////// //From UserInfoEx by DeathAxe // case WM_MOUSEMOVE: { if (!drag) break; { TVHITTESTINFO hti; hti.pt.x=(short)LOWORD(lparam); hti.pt.y=(short)HIWORD(lparam); ClientToScreen(hdlg,&hti.pt); ScreenToClient(hMenuTree,&hti.pt); TreeView_HitTest(hMenuTree,&hti); if ( hti.flags & ( TVHT_ONITEM|TVHT_ONITEMRIGHT )) { RECT rc; BYTE height; if ( TreeView_GetItemRect(hMenuTree, hti.hItem, &rc, FALSE )) { height = ( BYTE )( rc.bottom - rc.top ); if ( hti.pt.y - ( height / 3 ) < rc.top ) { SetCursor( LoadCursor( NULL, IDC_ARROW )); TreeView_SetInsertMark( hMenuTree, hti.hItem, 0 ); } else if ( hti.pt.y + ( height / 3 ) > rc.bottom ) { SetCursor( LoadCursor( NULL, IDC_ARROW )); TreeView_SetInsertMark( hMenuTree, hti.hItem, 1 ); } else { TreeView_SetInsertMark( hMenuTree, NULL, 0 ); SetCursor( LoadCursor( GetModuleHandle(NULL), MAKEINTRESOURCE( 183 )) ); } } } else { if ( hti.flags & TVHT_ABOVE ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEUP, 0 ), 0 ); if ( hti.flags & TVHT_BELOW ) SendMessage( hMenuTree, WM_VSCROLL, MAKEWPARAM( SB_LINEDOWN, 0 ), 0 ); TreeView_SetInsertMark( hMenuTree, NULL, 0 ); } } }break; ///////////// case WM_DESTROY: if (g_varhelpDlg) DestroyWindow(g_varhelpDlg); g_varhelpDlg=NULL; break; case WM_NOTIFY: switch(((LPNMHDR)lparam)->idFrom) { case 0: if (((LPNMHDR)lparam)->code == PSN_APPLY ) { if (!bNeedRestart){ SetMenuEntryProperties(hdlg); SaveMenuTree(hdlg); } db_set_b(NULL,PLGNAME,"RClickAuto",(BYTE)(g_bRClickAuto=IsDlgButtonChecked(hdlg,IDC_RAUTOSEND))); db_set_b(NULL,PLGNAME,"LClickAuto",(BYTE)(g_bLClickAuto=IsDlgButtonChecked(hdlg,IDC_LAUTOSEND))); db_set_b(NULL,PLGNAME,"QuickMenu",(BYTE)(g_bQuickMenu=IsDlgButtonChecked(hdlg,IDC_ENABLEQUICKMENU))); return 1; } else if (((LPNMHDR)lparam)->code == PSN_RESET ) { if (!bNeedRestart) RestoreModuleData(hdlg); return 1; } break; case IDC_MENUTREE: switch (((LPNMHDR)lparam)->code){ case TVN_KEYDOWN:{ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam); if ( pTVKeyDown->wVKey == VK_F2 ) TreeView_EditLabel(hMenuTree,TreeView_GetSelection(hMenuTree)); else if ( pTVKeyDown->wVKey == VK_DELETE ) SendMessage(hdlg,WM_COMMAND,IDC_MTREEREMOVE,0); }break; case TVN_BEGINLABELEDITA: case TVN_BEGINLABELEDITW: hwndEdit=TreeView_GetEditControl(hMenuTree); mir_subclassWindow(hwndEdit, LabelEditSubclassProc); break; case TVN_ENDLABELEDITA: case TVN_ENDLABELEDITW: { TVITEM tvi; ButtonData* bd=NULL; TCHAR strbuf[256]; TCHAR szLabel[256]; tvi.pszText = strbuf; tvi.cchTextMax = SIZEOF(strbuf); tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM; tvi.hItem=TreeView_GetSelection(hMenuTree); TreeView_GetItem(hMenuTree,&tvi); GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel)); hwndEdit=NULL; if (!_tcslen(szLabel)) break; if (bd = (ButtonData*)tvi.lParam){ if (!_tcscmp(szLabel,_T("---"))) { if(TreeView_GetChild(hMenuTree,tvi.hItem)) break; else{ bd->fEntryOpType=QMF_EX_SEPARATOR; EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); } } else { bd->fEntryOpType&=~QMF_EX_SEPARATOR; EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE); SetDlgItemText(hdlg, IDC_MENUVALUE, bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/); } bd->pszOpName=mir_tstrdup(szLabel); tvi.pszText=szLabel; TreeView_SetItem(hMenuTree, &tvi); SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); } }break; case NM_KILLFOCUS: TreeView_EndEditLabelNow(hButtonsList, 1); break; case TVN_BEGINDRAGA: case TVN_BEGINDRAGW: SetCapture(hdlg); drag=1; hDragItem=((LPNMTREEVIEW)lparam)->itemNew.hItem; TreeView_SelectItem(hMenuTree,hDragItem); break; case TVN_SELCHANGINGA: case TVN_SELCHANGINGW: { TVITEM tvi; HTREEITEM hti; ButtonData* bd; hti=TreeView_GetSelection(hMenuTree); if (hti==NULL) break; tvi.hItem=hti; tvi.mask=TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem(hMenuTree,&tvi); if (tvi.lParam == 0) break; bd = ( ButtonData* )tvi.lParam; if (bd) { TCHAR szValue[256]; GetDlgItemText(hdlg, IDC_MENUVALUE, szValue, SIZEOF(szValue)); if(_tcslen(szValue)) { if(bd->pszOpValue&&(bd->pszOpValue!=bd->pszValue)) mir_free(bd->pszOpValue); bd->pszOpValue=mir_tstrdup(szValue); } bd->bOpInQMenu=IsDlgButtonChecked(hdlg,IDC_INQMENU); bd->bIsOpServName=IsDlgButtonChecked(hdlg,IDC_ISSERVNAME); } }break; case TVN_SELCHANGEDA: case TVN_SELCHANGEDW: { TVITEM tvi; HTREEITEM hti; ButtonData* bd=NULL; hti=TreeView_GetSelection(hMenuTree); if (hti==NULL) break; tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hti; TreeView_GetItem(hMenuTree,&tvi); bd = ( ButtonData* )tvi.lParam; if (bd) { if (!TreeView_GetChild(hMenuTree, tvi.hItem)&&!(bd->fEntryOpType&QMF_EX_SEPARATOR)) { EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),TRUE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),TRUE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),TRUE); SetDlgItemText(hdlg, IDC_MENUVALUE, bd->pszOpValue/*?bd->pszOpValue:bd->pszValue*/); } else { EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); if (!(bd->fEntryOpType&QMF_EX_SEPARATOR)) EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); } CheckDlgButton(hdlg,IDC_INQMENU,bd->bOpInQMenu ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg,IDC_ISSERVNAME,bd->bIsOpServName ? BST_CHECKED : BST_UNCHECKED); } } }break; case IDC_BUTTONSLIST: switch (((LPNMHDR)lparam)->code) { case TVN_KEYDOWN:{ TV_KEYDOWN* pTVKeyDown = (TV_KEYDOWN*) ((LPNMHDR)lparam); if ( pTVKeyDown->wVKey == VK_F2 ) TreeView_EditLabel(hButtonsList,TreeView_GetSelection(hButtonsList)); else if ( pTVKeyDown->wVKey == VK_DELETE ) SendMessage(hdlg,WM_COMMAND,IDC_BLISTREMOVE,0); }break; case TVN_BEGINLABELEDITA: case TVN_BEGINLABELEDITW: hwndEdit = TreeView_GetEditControl(hButtonsList); mir_subclassWindow(hwndEdit, LabelEditSubclassProc); break; case TVN_ENDLABELEDITA: case TVN_ENDLABELEDITW: { TVITEM tvi; TCHAR strbuf[128]; TCHAR szLabel[128]; tvi.pszText = strbuf; tvi.cchTextMax = SIZEOF(strbuf); tvi.mask=TVIF_TEXT |TVIF_HANDLE|TVIF_PARAM; tvi.hItem=TreeView_GetSelection(hButtonsList); TreeView_GetItem(hButtonsList,&tvi); GetWindowText(hwndEdit, szLabel, SIZEOF(szLabel)); hwndEdit=NULL; if (!_tcslen(szLabel)) break; tvi.pszText=szLabel; ((ListData*)tvi.lParam)->dwOPFlags|=QMF_RENAMED; TreeView_SetItem(hButtonsList, &tvi); SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); }break; case TVN_SELCHANGINGA: case TVN_SELCHANGINGW: SetMenuEntryProperties(hdlg); break; case TVN_SELCHANGEDA: case TVN_SELCHANGEDW: { TVITEM tvi; HTREEITEM hti; hti=TreeView_GetSelection(hButtonsList); if(hti==NULL||!TreeView_GetCount(hButtonsList)) { EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); break; } tvi.mask=TVIF_HANDLE|TVIF_PARAM; tvi.hItem=hti; TreeView_GetItem(hButtonsList,&tvi); if(tvi.lParam==0) break; BuildMenuTree(hMenuTree,(SortedList *)((ListData*)tvi.lParam)->sl); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),TRUE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),TRUE); CheckDlgButton(hdlg,IDC_ISSERVNAME2,((ListData*)tvi.lParam)->bIsOpServName ? BST_CHECKED : BST_UNCHECKED); if (((ListData*)tvi.lParam)->ptszOPQValue) SetDlgItemText(hdlg, IDC_RCLICKVALUE, ((ListData*)tvi.lParam)->ptszOPQValue); else SetDlgItemText(hdlg, IDC_RCLICKVALUE, _T("")); }break; }break; } break; case WM_COMMAND: switch(LOWORD(wparam)) { case IDC_VARHELP: if (!g_varhelpDlg) g_varhelpDlg=CreateDialog(hinstance,MAKEINTRESOURCE(IDD_HELPDIALOG), 0, HelpDlgProc); else //ShowWindow(g_varhelpDlg,SW_SHOWDEFAULT); SetWindowPos(g_varhelpDlg,0,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); break; case IDC_BLISTADD: { TVINSERTSTRUCT tvis; ListData* ld=NULL; TCHAR namebuff[MAX_PATH]={'\0'}; int count=TreeView_GetCount(hButtonsList); if (count>10) break; if(g_iOPButtonsCount==99){ MessageBox(NULL, TranslateT("Congratulation!\r\nYou have clicked this button 100 times!\r\nThere was access violation at this point...\r\nAnd now function for freeing resources must be called...\r\nBut no! there's only break :D"), TranslateT("You win!"),MB_OK); break; } ld = (ListData *)mir_alloc(sizeof(ListData)); ButtonsList[g_iOPButtonsCount++]=ld; ld->sl=List_Create(0,1); ld->dwOPFlags=QMF_NEW; ld->bIsOpServName=0; ld->ptszButtonName=NULL; ld->ptszOPQValue=NULL; ld->ptszQValue=NULL; tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; GetDlgItemText(hdlg, IDC_BUTTONNAME, namebuff, SIZEOF(namebuff)); tvis.item.mask=TVIF_PARAM|TVIF_TEXT; tvis.item.pszText=(_tcslen(namebuff))?namebuff:TranslateT("New Button"); tvis.item.lParam=(LPARAM)ld; TreeView_SelectItem(hButtonsList,TreeView_InsertItem(hButtonsList,&tvis)); }break; case IDC_BLISTREMOVE: { TVITEM tvi; ListData* ld; if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break; tvi.mask=TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem(hButtonsList,&tvi); ld= (ListData*)tvi.lParam; ld->dwOPFlags|=QMF_DELETNEEDED; TreeView_DeleteItem(hButtonsList,tvi.hItem); if (!TreeView_GetCount(hButtonsList)) { TreeView_DeleteAllItems(hMenuTree); EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_RCLICKVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME2),FALSE); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); SetDlgItemText(hdlg, IDC_RCLICKVALUE, _T("")); } }break; case IDC_MTREEADD: { TVINSERTSTRUCT tvis; TVITEM tvi; ButtonData *bd=NULL; SortedList *sl=NULL; TCHAR namebuff[MAX_PATH]={'\0'}; if (!TreeView_GetCount(hButtonsList)) break; if (!(tvi.hItem=TreeView_GetSelection(hButtonsList))) break; bd = (ButtonData *)mir_alloc(sizeof(ButtonData)); memset(bd,0,sizeof(ButtonData)); GetDlgItemText(hdlg, IDC_MENUNAME, namebuff, SIZEOF(namebuff)); bd->dwOPPos=TreeView_GetCount(hMenuTree)-1; bd->pszOpName=_tcslen(namebuff)?mir_tstrdup(namebuff):mir_tstrdup(TranslateT("New Menu Entry")); bd->pszOpValue=mir_tstrdup(bd->pszOpName); bd->fEntryOpType=!_tcscmp(namebuff,_T("---"))?QMF_EX_SEPARATOR:0; bd->dwOPFlags=QMF_NEW; bd->pszName=NULL; bd->pszValue=NULL; tvi.mask=TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem(hButtonsList,&tvi); sl=((ListData*)tvi.lParam)->sl; List_InsertPtr(sl,bd); tvis.hParent = NULL; tvis.hInsertAfter = TVI_LAST; tvis.item.mask=TVIF_PARAM|TVIF_TEXT; tvis.item.pszText=bd->pszOpName; tvis.item.lParam=(LPARAM)bd; TreeView_SelectItem(hMenuTree,TreeView_InsertItem(hMenuTree,&tvis)); }break; case IDC_MTREEREMOVE: { TVITEM tvi; TVINSERTSTRUCT tvis; HTREEITEM hti=NULL; ButtonData *bd=NULL; tvi.mask=TVIF_HANDLE|TVIF_PARAM; if (!(tvi.hItem=TreeView_GetSelection(hMenuTree))) break; TreeView_GetItem(hMenuTree,&tvi); hti=tvi.hItem; bd= (ButtonData*)tvi.lParam; bd->dwOPFlags|=QMF_DELETNEEDED; if(tvi.hItem=TreeView_GetChild(hMenuTree,tvi.hItem)) { TCHAR strbuf[128]; while(tvi.hItem){ tvis.hInsertAfter=hti; tvi.pszText = strbuf; tvi.cchTextMax = SIZEOF(strbuf); tvi.mask=TVIF_HANDLE|TVIF_PARAM|TVIF_TEXT; TreeView_GetItem(hMenuTree,&tvi); tvis.hParent=NULL; tvis.item=tvi; TreeView_InsertItem(hMenuTree,&tvis); tvi.hItem=TreeView_GetNextSibling(hMenuTree,tvi.hItem); } } TreeView_DeleteItem(hMenuTree,hti); if (!TreeView_GetCount(hMenuTree)) { EnableWindow(GetDlgItem(hdlg,IDC_MENUVALUE),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_ISSERVNAME),FALSE); EnableWindow(GetDlgItem(hdlg,IDC_INQMENU),FALSE); SetDlgItemText(hdlg, IDC_MENUVALUE, _T("")); } }break; } break; case WM_CLOSE: EndDialog(hdlg,0); return 0; } if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); else if ((HIWORD(wparam) == EN_CHANGE)&&(GetFocus()==(HWND)lparam)) if (!bOptionsInit) SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); return 0; }
INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); SendDlgItemMessage(hwndDlg, IDC_MAXCHANNEL, CB_RESETCONTENT, 0, 0); for (int i = 1; i <= MAXCHAN; i++) SendDlgItemMessage(hwndDlg, IDC_MAXCHANNEL, CB_ADDSTRING, 0, (LPARAM)_itot(i, tmp, 10)); SendDlgItemMessage(hwndDlg, IDC_MAXCHANNEL, CB_SETCURSEL, sndLimSnd - 1, 0); SetDlgItemText(hwndDlg, IDC_CURRPATH, CurrBassPath); hwndOptSlider = GetDlgItem(hwndDlg, IDC_VOLUME); SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETRANGE, FALSE, MAKELONG(SLIDER_MIN, SLIDER_MAX)); SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETPOS, TRUE, Volume); SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_SETPAGESIZE, 0, 5); { SYSTEMTIME systime = { 0 }; systime.wHour = HIBYTE(TimeWrd1); systime.wMinute = LOBYTE(TimeWrd1); systime.wYear = 2000; systime.wMonth = 1; systime.wDay = 1; SendDlgItemMessage(hwndDlg, IDC_TIME1, DTM_SETFORMAT, 0, (LPARAM)_T("HH:mm")); SendDlgItemMessage(hwndDlg, IDC_TIME1, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&systime); systime.wHour = HIBYTE(TimeWrd2); systime.wMinute = LOBYTE(TimeWrd2); SendDlgItemMessage(hwndDlg, IDC_TIME2, DTM_SETFORMAT, 0, (LPARAM)_T("HH:mm")); SendDlgItemMessage(hwndDlg, IDC_TIME2, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&systime); } CheckDlgButton(hwndDlg, IDC_PREVIEW, EnPreview ? BST_CHECKED : BST_UNCHECKED); for (int i = IDC_CHECKBOX1; i < IDC_CHECKBOX10 + 1; i++) if (StatMask & (1 << (i - IDC_CHECKBOX1))) CheckDlgButton(hwndDlg, i, BST_CHECKED); if (QuietTime) { EnableWindow(GetDlgItem(hwndDlg, IDC_TIME1), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_TIME2), TRUE); CheckDlgButton(hwndDlg, IDC_QUIETTIME, BST_CHECKED); } if (hBass == NULL) { EnableWindow(GetDlgItem(hwndDlg, IDC_VOLUME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXCHANNEL), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_OUTDEVICE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_QUIETTIME), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PREVIEW), FALSE); for (int i = IDC_CHECKBOX1; i < IDC_CHECKBOX10 + 1; i++) EnableWindow(GetDlgItem(hwndDlg, i), FALSE); } else { DWORD bassver = BASS_GetVersion(); mir_sntprintf(tmp, TranslateT("un4seen's bass version: %d.%d.%d.%d"), bassver >> 24, (bassver >> 16) & 0xff, (bassver >> 8) & 0xff, bassver & 0xff); SetDlgItemText(hwndDlg, IDC_BASSVERSION, tmp); SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_RESETCONTENT, 0, 0); SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_ADDSTRING, 0, (LPARAM)TranslateT("--default device--")); SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, 0, 0); BASS_DEVICEINFO info; ptrT tszDeviceName(db_get_tsa(NULL, ModuleName, OPT_OUTDEVICE)); for (int i = 1; BASS_GetDeviceInfo(i + newBass, &info); i++) { SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_ADDSTRING, 0, _A2T(info.name)); if (!mir_tstrcmp(tszDeviceName, _A2T(info.name))) SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_SETCURSEL, i, 0); } } return TRUE; case WM_HSCROLL: if (hBass != NULL) if (LOWORD(wParam) == SB_ENDSCROLL || LOWORD(wParam) == SB_THUMBTRACK) { Volume = SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0); BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100); SendMessage(hwndSlider, TBM_SETPOS, TRUE, Volume); Preview = TRUE; if (EnPreview) SkinPlaySound("AlertMsg"); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; case WM_NOTIFY: switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: if (hBass != NULL) { SYSTEMTIME systime = { 0 }; GetDlgItemText(hwndDlg, IDC_OUTDEVICE, tmp, _countof(tmp)); db_set_ts(NULL, ModuleName, OPT_OUTDEVICE, tmp); Volume = (DWORD)SendDlgItemMessage(hwndDlg, IDC_VOLUME, TBM_GETPOS, 0, 0); db_set_b(NULL, ModuleName, OPT_VOLUME, Volume); sndLimSnd = SendDlgItemMessage(hwndDlg, IDC_MAXCHANNEL, CB_GETCURSEL, 0, 0) + 1; if (sndLimSnd > MAXCHAN) sndLimSnd = MAXCHAN; db_set_b(NULL, ModuleName, OPT_MAXCHAN, sndLimSnd); QuietTime = IsDlgButtonChecked(hwndDlg, IDC_QUIETTIME) == BST_CHECKED; db_set_b(NULL, ModuleName, OPT_QUIETTIME, QuietTime); SendDlgItemMessage(hwndDlg, IDC_TIME1, DTM_GETSYSTEMTIME, 0, (LPARAM)&systime); TimeWrd1 = MAKEWORD(systime.wMinute, systime.wHour); db_set_w(NULL, ModuleName, OPT_TIME1, TimeWrd1); SendDlgItemMessage(hwndDlg, IDC_TIME2, DTM_GETSYSTEMTIME, 0, (LPARAM)&systime); TimeWrd2 = MAKEWORD(systime.wMinute, systime.wHour); db_set_w(NULL, ModuleName, OPT_TIME2, TimeWrd2); EnPreview = IsDlgButtonChecked(hwndDlg, IDC_PREVIEW) == BST_CHECKED; db_set_b(NULL, ModuleName, OPT_PREVIEW, EnPreview); StatMask = 0; for (int i = IDC_CHECKBOX10; i > IDC_CHECKBOX1 - 1; i--) { StatMask <<= 1; if (IsDlgButtonChecked(hwndDlg, i) == BST_CHECKED) StatMask |= 1; } db_set_w(NULL, ModuleName, OPT_STATUS, StatMask); device = SendDlgItemMessage(hwndDlg, IDC_OUTDEVICE, CB_GETCURSEL, 0, 0); if (device == 0) device = -1; else device += newBass; } return 1; case PSN_RESET: if (hBass != NULL) BASS_SetConfig(BASS_CONFIG_GVOL_STREAM, Volume * 100); return 1; case DTN_DATETIMECHANGE: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); return 1; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_QUIETTIME: { BOOL b = IsDlgButtonChecked(hwndDlg, IDC_QUIETTIME) == BST_CHECKED; EnableWindow(GetDlgItem(hwndDlg, IDC_TIME1), b); EnableWindow(GetDlgItem(hwndDlg, IDC_TIME2), b); } case IDC_MAXCHANNEL: case IDC_OUTDEVICE: case IDC_CHECKBOX1: case IDC_CHECKBOX2: case IDC_CHECKBOX3: case IDC_CHECKBOX4: case IDC_CHECKBOX5: case IDC_CHECKBOX6: case IDC_CHECKBOX7: case IDC_CHECKBOX8: case IDC_CHECKBOX9: case IDC_CHECKBOX10: case IDC_PREVIEW: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_GETBASS: Utils_OpenUrl("http://www.un4seen.com/"); break; } break; } return 0; }
static INT_PTR CALLBACK JabberAddBookmarkDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { JabberAddBookmarkDlgParam* param = (JabberAddBookmarkDlgParam*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); TCHAR text[512]; JABBER_LIST_ITEM *item; switch (msg) { case WM_INITDIALOG: param = (JabberAddBookmarkDlgParam*)lParam; SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam); param->ppro->m_hwndJabberAddBookmark = hwndDlg; TranslateDialogDefault(hwndDlg); if (item = param->m_item) { if (!mir_tstrcmp(item->type, _T("conference"))) { if (!_tcschr(item->jid, _T('@'))) { //no room name - consider it is transport CheckDlgButton(hwndDlg, IDC_AGENT_RADIO, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE); } else CheckDlgButton(hwndDlg, IDC_ROOM_RADIO, BST_CHECKED); } else { CheckDlgButton(hwndDlg, IDC_URL_RADIO, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE); CheckDlgButton(hwndDlg, IDC_CHECK_BM_AUTOJOIN, BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_BM_AUTOJOIN), FALSE); } EnableWindow(GetDlgItem(hwndDlg, IDC_ROOM_RADIO), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_URL_RADIO), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AGENT_RADIO), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_BM_AUTOJOIN), FALSE); if (item->jid) SetDlgItemText(hwndDlg, IDC_ROOM_JID, item->jid); if (item->name) SetDlgItemText(hwndDlg, IDC_NAME, item->name); if (item->nick) SetDlgItemText(hwndDlg, IDC_NICK, item->nick); if (item->password) SetDlgItemText(hwndDlg, IDC_PASSWORD, item->password); if (item->bAutoJoin) CheckDlgButton(hwndDlg, IDC_CHECK_BM_AUTOJOIN, BST_CHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_ROOM_RADIO) == BST_CHECKED) EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_BM_AUTOJOIN), TRUE); } else { EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); CheckDlgButton(hwndDlg, IDC_ROOM_RADIO, BST_CHECKED); } return TRUE; case WM_COMMAND: switch (HIWORD(wParam)) { case BN_CLICKED: switch (LOWORD (wParam)) { case IDC_ROOM_RADIO: EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_BM_AUTOJOIN), TRUE); break; case IDC_AGENT_RADIO: case IDC_URL_RADIO: EnableWindow(GetDlgItem(hwndDlg, IDC_NICK), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_PASSWORD), FALSE); CheckDlgButton(hwndDlg, IDC_CHECK_BM_AUTOJOIN, BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_CHECK_BM_AUTOJOIN), FALSE); break; } } switch (LOWORD(wParam)) { case IDC_ROOM_JID: if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE) EnableWindow(GetDlgItem(hwndDlg, IDOK), GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text))); break; case IDOK: { GetDlgItemText(hwndDlg, IDC_ROOM_JID, text, _countof(text)); TCHAR *roomJID = NEWTSTR_ALLOCA(text); if (param->m_item) param->ppro->ListRemove(LIST_BOOKMARK, param->m_item->jid); item = param->ppro->ListAdd(LIST_BOOKMARK, roomJID); if (IsDlgButtonChecked(hwndDlg, IDC_URL_RADIO) == BST_CHECKED) replaceStrT(item->type, _T("url")); else replaceStrT(item->type, _T("conference")); GetDlgItemText(hwndDlg, IDC_NICK, text, _countof(text)); replaceStrT(item->nick, text); GetDlgItemText(hwndDlg, IDC_PASSWORD, text, _countof(text)); replaceStrT(item->password, text); GetDlgItemText(hwndDlg, IDC_NAME, text, _countof(text)); replaceStrT(item->name, (text[0] == 0) ? roomJID : text); item->bAutoJoin = (IsDlgButtonChecked(hwndDlg, IDC_CHECK_BM_AUTOJOIN) == BST_CHECKED); XmlNodeIq iq( param->ppro->AddIQ(&CJabberProto::OnIqResultSetBookmarks, JABBER_IQ_TYPE_SET)); param->ppro->SetBookmarkRequest(iq); param->ppro->m_ThreadInfo->send(iq); } // fall through case IDCANCEL: EndDialog(hwndDlg, 0); break; } break; case WM_JABBER_CHECK_ONLINE: if (!param->ppro->m_bJabberOnline) EndDialog(hwndDlg, 0); break; case WM_DESTROY: param->ppro->m_hwndJabberAddBookmark = NULL; break; } return FALSE; }
BOOL CALLBACK DIALOGMsgProcEnc(HWND hWndDlg, UINT Message, WPARAM wParam, LPARAM lParam) { switch(Message) { case WM_INITDIALOG: { char buf[50]; char *Quality[]={"Default","10","20","30","40","50","60","70","80","90","100","110","120","130","140","150","200","300","400","500",0}; char *BitRate[]={"Auto","8","18","20","24","32","40","48","56","64","96","112","128","160","192","224","256","320","384",0}; char *BandWidth[]={"Auto","Full","4000","8000","11025","16000","22050","24000","32000","44100","48000",0}; CMyEncCfg cfg(false); SetWindowPos(GetDlgItem(hWndDlg,IDC_CHK_TAG),GetDlgItem(hWndDlg,IDC_GRP_TAG),0,0,0,0,SWP_NOMOVE | SWP_NOSIZE); INIT_CB(hWndDlg,IDC_CB_QUALITY,Quality,0); INIT_CB(hWndDlg,IDC_CB_BITRATE,BitRate,0); INIT_CB(hWndDlg,IDC_CB_BANDWIDTH,BandWidth,0); INIT_CB_GENRES(hWndDlg,IDC_CB_GENRE,ID3Genres,0); SendMessage(GetDlgItem(hWndDlg, IDC_BTN_ARTFILE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse); #ifdef IDC_BTN_BROWSE SendMessage(GetDlgItem(hWndDlg, IDC_BTN_BROWSE), BM_SETIMAGE, IMAGE_BITMAP, (LPARAM) hBmBrowse); if(!cfg.OutDir || !*cfg.OutDir) { GetCurrentDirectory(MAX_PATH,config_AACoutdir); FREE_ARRAY(cfg.OutDir); cfg.OutDir=strdup(config_AACoutdir); } else strcpy(config_AACoutdir,cfg.OutDir); SetDlgItemText(hWndDlg, IDC_E_BROWSE, cfg.OutDir); #endif if(cfg.EncCfg.mpegVersion==MPEG4) CheckDlgButton(hWndDlg,IDC_RADIO_MPEG4,TRUE); else CheckDlgButton(hWndDlg,IDC_RADIO_MPEG2,TRUE); switch(cfg.EncCfg.aacObjectType) { case MAIN: CheckDlgButton(hWndDlg,IDC_RADIO_MAIN,TRUE); break; case LOW: CheckDlgButton(hWndDlg,IDC_RADIO_LOW,TRUE); break; case SSR: CheckDlgButton(hWndDlg,IDC_RADIO_SSR,TRUE); break; case LTP: CheckDlgButton(hWndDlg,IDC_RADIO_LTP,TRUE); DISABLE_LTP break; } switch(cfg.EncCfg.outputFormat) { case RAW: CheckDlgButton(hWndDlg,IDC_RADIO_RAW,TRUE); break; case ADTS: CheckDlgButton(hWndDlg,IDC_RADIO_ADTS,TRUE); break; } CheckDlgButton(hWndDlg, IDC_CHK_ALLOWMIDSIDE, cfg.EncCfg.allowMidside); CheckDlgButton(hWndDlg, IDC_CHK_USETNS, cfg.EncCfg.useTns); CheckDlgButton(hWndDlg, IDC_CHK_USELFE, cfg.EncCfg.useLfe); if(cfg.UseQuality) CheckDlgButton(hWndDlg,IDC_RADIO_QUALITY,TRUE); else CheckDlgButton(hWndDlg,IDC_RADIO_BITRATE,TRUE); switch(cfg.EncCfg.quantqual) { case 100: SendMessage(GetDlgItem(hWndDlg, IDC_CB_QUALITY), CB_SETCURSEL, 0, 0); break; default: if(cfg.EncCfg.quantqual<10) cfg.EncCfg.quantqual=10; if(cfg.EncCfg.quantqual>500) cfg.EncCfg.quantqual=500; sprintf(buf,"%lu",cfg.EncCfg.quantqual); SetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf); break; } switch(cfg.EncCfg.bitRate) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BITRATE), CB_SETCURSEL, 0, 0); break; default: sprintf(buf,"%lu",cfg.EncCfg.bitRate); SetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf); break; } switch(cfg.EncCfg.bandWidth) { case 0: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 0, 0); break; case 0xffffffff: SendMessage(GetDlgItem(hWndDlg, IDC_CB_BANDWIDTH), CB_SETCURSEL, 1, 0); break; default: sprintf(buf,"%lu",cfg.EncCfg.bandWidth); SetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf); break; } CheckDlgButton(hWndDlg, IDC_CHK_WRITEMP4, cfg.SaveMP4); CheckDlgButton(hWndDlg,IDC_CHK_AUTOCFG, cfg.AutoCfg); DISABLE_CTRLS_ENC(!cfg.AutoCfg); CheckDlgButton(hWndDlg,IDC_CHK_TAG, cfg.TagOn); ENABLE_TAG(cfg.TagOn); ENABLE_AACTAGS(cfg.SaveMP4); SetDlgItemText(hWndDlg, IDC_E_ARTIST, cfg.Tag.artist); SetDlgItemText(hWndDlg, IDC_E_TITLE, cfg.Tag.title); SetDlgItemText(hWndDlg, IDC_E_ALBUM, cfg.Tag.album); SetDlgItemText(hWndDlg, IDC_E_YEAR, cfg.Tag.year); SetDlgItemText(hWndDlg, IDC_CB_GENRE, cfg.Tag.genre); SetDlgItemText(hWndDlg, IDC_E_WRITER, cfg.Tag.writer); SetDlgItemText(hWndDlg, IDC_E_COMMENT, cfg.Tag.comment); SetDlgItemText(hWndDlg, IDC_E_ARTFILE, cfg.Tag.artFilename); SetDlgItemInt(hWndDlg, IDC_E_TRACK, cfg.Tag.trackno, FALSE); SetDlgItemInt(hWndDlg, IDC_E_NTRACKS, cfg.Tag.ntracks, FALSE); SetDlgItemInt(hWndDlg, IDC_E_DISK, cfg.Tag.discno, FALSE); SetDlgItemInt(hWndDlg, IDC_E_NDISKS, cfg.Tag.ndiscs, FALSE); SetDlgItemInt(hWndDlg, IDC_E_COMPILATION, cfg.Tag.compilation, FALSE); CheckDlgButton(hWndDlg, IDC_CHK_COMPILATION, cfg.Tag.compilation); } break; // End of WM_INITDIALOG case WM_CLOSE: // Closing the Dialog behaves the same as Cancel PostMessage(hWndDlg, WM_COMMAND, IDCANCEL, 0L); break; // End of WM_CLOSE case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: { // HANDLE hCfg=(HANDLE)lParam; char buf[50]; CMyEncCfg cfg; cfg.AutoCfg=IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG) ? TRUE : FALSE; cfg.EncCfg.mpegVersion=IsDlgButtonChecked(hWndDlg,IDC_RADIO_MPEG4) ? MPEG4 : MPEG2; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_MAIN)) cfg.EncCfg.aacObjectType=MAIN; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LOW)) cfg.EncCfg.aacObjectType=LOW; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_SSR)) cfg.EncCfg.aacObjectType=SSR; if(IsDlgButtonChecked(hWndDlg,IDC_RADIO_LTP)) cfg.EncCfg.aacObjectType=LTP; cfg.EncCfg.allowMidside=IsDlgButtonChecked(hWndDlg, IDC_CHK_ALLOWMIDSIDE); cfg.EncCfg.useTns=IsDlgButtonChecked(hWndDlg, IDC_CHK_USETNS); cfg.EncCfg.useLfe=IsDlgButtonChecked(hWndDlg, IDC_CHK_USELFE); GetDlgItemText(hWndDlg, IDC_CB_BITRATE, buf, 50); switch(*buf) { case 'A': // Auto cfg.EncCfg.bitRate=0; break; default: cfg.EncCfg.bitRate=GetDlgItemInt(hWndDlg, IDC_CB_BITRATE, 0, FALSE); } GetDlgItemText(hWndDlg, IDC_CB_BANDWIDTH, buf, 50); switch(*buf) { case 'A': // Auto cfg.EncCfg.bandWidth=0; break; case 'F': // Full cfg.EncCfg.bandWidth=0xffffffff; break; default: cfg.EncCfg.bandWidth=GetDlgItemInt(hWndDlg, IDC_CB_BANDWIDTH, 0, FALSE); } cfg.UseQuality=IsDlgButtonChecked(hWndDlg,IDC_RADIO_QUALITY) ? TRUE : FALSE; GetDlgItemText(hWndDlg, IDC_CB_QUALITY, buf, 50); switch(*buf) { case 'D': // Default cfg.EncCfg.quantqual=100; break; default: cfg.EncCfg.quantqual=GetDlgItemInt(hWndDlg, IDC_CB_QUALITY, 0, FALSE); } cfg.EncCfg.outputFormat=IsDlgButtonChecked(hWndDlg,IDC_RADIO_RAW) ? RAW : ADTS; #ifdef IDC_E_BROWSE GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH); FREE_ARRAY(cfg.OutDir); cfg.OutDir=strdup(config_AACoutdir); #endif cfg.SaveMP4=IsDlgButtonChecked(hWndDlg, IDC_CHK_WRITEMP4) ? TRUE : FALSE; cfg.TagOn=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG) ? 1 : 0; char buffer[MAX_PATH]; GetDlgItemText(hWndDlg, IDC_E_ARTIST, buffer, MAX_PATH); cfg.Tag.artist=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_TITLE, buffer, MAX_PATH); cfg.Tag.title=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_ALBUM, buffer, MAX_PATH); cfg.Tag.album=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_YEAR, buffer, MAX_PATH); cfg.Tag.year=strdup(buffer); GetDlgItemText(hWndDlg, IDC_CB_GENRE, buffer, MAX_PATH); cfg.Tag.genre=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_WRITER, buffer, MAX_PATH); cfg.Tag.writer=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_COMMENT, buffer, MAX_PATH); cfg.Tag.comment=strdup(buffer); GetDlgItemText(hWndDlg, IDC_E_ARTFILE, buffer, MAX_PATH); cfg.Tag.artFilename=strdup(buffer); cfg.Tag.trackno=GetDlgItemInt(hWndDlg, IDC_E_TRACK, 0, FALSE); cfg.Tag.ntracks=GetDlgItemInt(hWndDlg, IDC_E_NTRACKS, 0, FALSE); cfg.Tag.discno=GetDlgItemInt(hWndDlg, IDC_E_DISK, 0, FALSE); cfg.Tag.ndiscs=GetDlgItemInt(hWndDlg, IDC_E_NDISKS, 0, FALSE); cfg.Tag.compilation=(BYTE)GetDlgItemInt(hWndDlg, IDC_E_COMPILATION, 0, FALSE); cfg.Tag.compilation=IsDlgButtonChecked(hWndDlg, IDC_CHK_COMPILATION) ? 1 : 0; EndDialog(hWndDlg, TRUE);//(DWORD)hCfg); } break; case IDCANCEL: // Ignore data values entered into the controls // and dismiss the dialog window returning FALSE EndDialog(hWndDlg, FALSE); break; case IDC_BTN_ABOUT: DialogBox((HINSTANCE)hInstance,(LPCSTR)MAKEINTRESOURCE(IDD_ABOUT), (HWND)hWndDlg, (DLGPROC)DialogMsgProcAbout); break; case IDC_BTN_LICENSE: { char *license = "\nPlease note that the use of this software may require the payment of patent royalties.\n" "You need to consider this issue before you start building derivative works.\n" "We are not warranting or indemnifying you in any way for patent royalities!\n" "YOU ARE SOLELY RESPONSIBLE FOR YOUR OWN ACTIONS!\n" "\n" "FAAC is based on the ISO MPEG-4 reference code. For this code base the\n" "following license applies:\n" "\n" /* "This software module was originally developed by\n" "\n" "FirstName LastName (CompanyName)\n" "\n" "and edited by\n" "\n" "FirstName LastName (CompanyName)\n" "FirstName LastName (CompanyName)\n" "\n" */ "in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard\n" "ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an\n" "implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools\n" "as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives\n" "users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this\n" "software module or modifications thereof for use in hardware or\n" "software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio\n" "standards. Those intending to use this software module in hardware or\n" "software products are advised that this use may infringe existing\n" "patents. The original developer of this software module and his/her\n" "company, the subsequent editors and their companies, and ISO/IEC have\n" "no liability for use of this software module or modifications thereof\n" "in an implementation. Copyright is not released for non MPEG-2\n" "NBC/MPEG-4 Audio conforming products. The original developer retains\n" "full right to use the code for his/her own purpose, assign or donate\n" "the code to a third party and to inhibit third party from using the\n" "code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This\n" "copyright notice must be included in all copies or derivative works.\n" "\n" "Copyright (c) 1997.\n" "\n" "For the changes made for the FAAC project the GNU Lesser General Public\n" "License (LGPL), version 2 1991 applies:\n" "\n" "FAAC - Freeware Advanced Audio Coder\n" "Copyright (C) 2001-2004 The individual contributors\n" "\n" "This library is free software; you can redistribute it and/or modify it under the terms of\n" "the GNU Lesser General Public License as published by the Free Software Foundation;\n" "either version 2.1 of the License, or (at your option) any later version.\n" "\n" "This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;\n" "without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "See the GNU Lesser General Public License for more details.\n" "\n" "You should have received a copy of the GNU Lesser General Public\n" "License along with this library; if not, write to the Free Software\n" "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n"; MessageBox(hWndDlg,license,"FAAC libray License",MB_OK|MB_ICONINFORMATION); } break; #ifdef IDC_BTN_BROWSE case IDC_BTN_BROWSE: { char name[MAX_PATH]; BROWSEINFO bi; ITEMIDLIST *idlist; bi.hwndOwner = hWndDlg; bi.pidlRoot = 0; bi.pszDisplayName = name; bi.lpszTitle = "Select a directory for AAC-MPEG4 file output:"; bi.ulFlags = BIF_RETURNONLYFSDIRS; bi.lpfn = BrowseCallbackProc; bi.lParam = 0; GetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir, MAX_PATH); idlist = SHBrowseForFolder( &bi ); if(idlist) { SHGetPathFromIDList( idlist, config_AACoutdir); SetDlgItemText(hWndDlg, IDC_E_BROWSE, config_AACoutdir); } } break; #endif case IDC_BTN_ARTFILE: { OPENFILENAME ofn; char ArtFilename[MAX_PATH]=""; // GetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename, MAX_PATH); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = (HWND)hWndDlg; ofn.lpstrFilter = "Cover art files (*.gif,*jpg,*.png)\0*.gif;*.jpg;*.png\0"; ofn.lpstrCustomFilter = NULL; ofn.nFilterIndex = 1; ofn.lpstrFile = ArtFilename; ofn.nMaxFile = MAX_PATH; //sizeof ArtFilename; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = "Select cover art file"; ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_ENABLESIZING; ofn.lpstrDefExt = NULL;//"jpg"; ofn.hInstance = hInstance; if(GetOpenFileName(&ofn)) SetDlgItemText(hWndDlg, IDC_E_ARTFILE, ArtFilename); } break; case IDC_RADIO_MPEG4: EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), !IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG)); break; case IDC_RADIO_MPEG2: EnableWindow(GetDlgItem(hWndDlg, IDC_RADIO_LTP), FALSE); DISABLE_LTP break; case IDC_CHK_AUTOCFG: { char Enabled=!IsDlgButtonChecked(hWndDlg,IDC_CHK_AUTOCFG); DISABLE_CTRLS_ENC(Enabled); } break; case IDC_CHK_TAG: { char Enabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG); ENABLE_TAG(Enabled); } // break; case IDC_CHK_WRITEMP4: { char Enabled=IsDlgButtonChecked(hWndDlg,IDC_CHK_WRITEMP4) && IsDlgButtonChecked(hWndDlg,IDC_CHK_TAG); ENABLE_AACTAGS(Enabled); } break; } break; // End of WM_COMMAND default: return FALSE; } return TRUE; } // End of DIALOGSMsgProc
void UpdateControls(HWND hwnd) { int proto = nProtocol; if (GlobalNudge.useByProtocol) { proto = GetSelProto(hwnd,NULL); ActualNudge = NULL; for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) { if(n->item.iProtoNumber == proto) ActualNudge = &n->item; } } else ActualNudge = &DefaultNudge; SetDlgItemInt(hwnd, IDC_SENDTIME, GlobalNudge.sendTimeSec,FALSE); SetDlgItemInt(hwnd, IDC_RECVTIME, GlobalNudge.recvTimeSec,FALSE); SetDlgItemInt(hwnd, IDC_RESENDDELAY, GlobalNudge.resendDelaySec,FALSE); CheckDlgButton(hwnd, IDC_USEBYPROTOCOL, (WPARAM) GlobalNudge.useByProtocol); if (ActualNudge)// fix NULL pointer then no nudge support protocols { CheckDlgButton(hwnd, IDC_CHECKPOP, (WPARAM) ActualNudge->showPopup); CheckDlgButton(hwnd, IDC_CHECKCLIST, (WPARAM) ActualNudge->shakeClist); CheckDlgButton(hwnd, IDC_CHECKCHAT, (WPARAM) ActualNudge->shakeChat); CheckDlgButton(hwnd, IDC_CHECKSTATUS, (WPARAM) ActualNudge->showStatus); CheckDlgButton(hwnd, IDC_AUTORESEND, (WPARAM) ActualNudge->autoResend); CheckDlgButton(hwnd, IDC_OPENMESSAGE, (WPARAM) ActualNudge->openMessageWindow); CheckDlgButton(hwnd, IDC_OPENCONTACTLIST, (WPARAM) ActualNudge->openContactList); CheckDlgButton(hwnd, IDC_IGNORE, (WPARAM) ActualNudge->useIgnoreSettings); EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend); CheckDlgButton(hwnd,IDC_CHECKST0,ActualNudge->statusFlags & NUDGE_ACC_ST0 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST1,ActualNudge->statusFlags & NUDGE_ACC_ST1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST2,ActualNudge->statusFlags & NUDGE_ACC_ST2 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST3,ActualNudge->statusFlags & NUDGE_ACC_ST3 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST4,ActualNudge->statusFlags & NUDGE_ACC_ST4 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST5,ActualNudge->statusFlags & NUDGE_ACC_ST5 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST6,ActualNudge->statusFlags & NUDGE_ACC_ST6 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST7,ActualNudge->statusFlags & NUDGE_ACC_ST7 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST8,ActualNudge->statusFlags & NUDGE_ACC_ST8 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd,IDC_CHECKST9,ActualNudge->statusFlags & NUDGE_ACC_ST9 ? BST_CHECKED : BST_UNCHECKED); SetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText); SetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText); } else { EnableWindow(GetDlgItem(hwnd,IDC_PROTOLIST),FALSE); } }
void CPPgGeneral::LoadSettings(void) { GetDlgItem(IDC_NICK)->SetWindowText(thePrefs.GetUserNickVC()); for(int i = 0; i < m_language.GetCount(); i++) if(m_language.GetItemData(i) == thePrefs.GetLanguageID()) m_language.SetCurSel(i); if(thePrefs.m_bAutoStart) CheckDlgButton(IDC_STARTWIN,1); else CheckDlgButton(IDC_STARTWIN,0); //Deleted by thilon on 2008.03.20 //if(thePrefs.startMinimized) // CheckDlgButton(IDC_STARTMIN,1); //else // CheckDlgButton(IDC_STARTMIN,0); if (thePrefs.onlineSig) CheckDlgButton(IDC_ONLINESIG,1); else CheckDlgButton(IDC_ONLINESIG,0); if (thePrefs.m_bShowBroswer) CheckDlgButton(IDC_WEBBROWSER,1); // Added by thilon on 2006.08.03, WebBroswer else CheckDlgButton(IDC_WEBBROWSER,0); if(thePrefs.beepOnError) CheckDlgButton(IDC_BEEPER,1); else CheckDlgButton(IDC_BEEPER,0); if(thePrefs.confirmExit) CheckDlgButton(IDC_EXIT,1); else CheckDlgButton(IDC_EXIT,0); if(thePrefs.splashscreen) CheckDlgButton(IDC_SPLASHON,1); else CheckDlgButton(IDC_SPLASHON,0); if(thePrefs.bringtoforeground) CheckDlgButton(IDC_BRINGTOFOREGROUND,1); else CheckDlgButton(IDC_BRINGTOFOREGROUND,0); if(thePrefs.updatenotify) CheckDlgButton(IDC_CHECK4UPDATE,1); else CheckDlgButton(IDC_CHECK4UPDATE,0); if(thePrefs.m_bEnableMiniMule) CheckDlgButton(IDC_MINIMULE,1); else CheckDlgButton(IDC_MINIMULE,0); CString strBuffer; strBuffer.Format(_T("%i %s"),thePrefs.versioncheckdays,GetResString(IDS_DAYS2)); GetDlgItem(IDC_DAYS)->SetWindowText(strBuffer); switch(thePrefs.GetCloseMode()) { case 0: m_CtrlCloseMode.SetCurSel(0); break; case 1: m_CtrlCloseMode.SetCurSel(1); break; case 2: m_CtrlCloseMode.SetCurSel(2); break; } //缓存模式 switch(m_iFileBufferSize) { case 524288: m_DownloadBuffSizeCtrl.SetCurSel(0); break; case 1048576: m_DownloadBuffSizeCtrl.SetCurSel(1); break; case 2097152: m_DownloadBuffSizeCtrl.SetCurSel(2); break; case 4194304: m_DownloadBuffSizeCtrl.SetCurSel(3); break; case 8388608: m_DownloadBuffSizeCtrl.SetCurSel(4); break; case 16777216: m_DownloadBuffSizeCtrl.SetCurSel(5); break; } // added by vc-yavey on 20100429 : config rss <begin> InitRssControl(); // added by vc-yavey on 20100429 : config rss <end> }
static BOOL CALLBACK IEViewTemplatesOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; BOOL bChecked; char path[MAX_PATH]; switch (msg) { case WM_INITDIALOG: { char *path; TranslateDialogDefault(hwndDlg); bChecked = FALSE; if (Options::getTemplatesFlags() & Options::TEMPLATES_ENABLED) { bChecked = TRUE; CheckDlgButton(hwndDlg, IDC_TEMPLATES, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_FILE) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_FILE, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_URL) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_URL, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_STATUSCHANGE) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_STATUSCHANGE, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_NICKNAMES) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_NICKNAMES, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_TIME) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_TIME, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_DATE) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_DATE, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_SHOW_SECONDS) { CheckDlgButton(hwndDlg, IDC_LOG_SHOW_SECONDS, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_LONG_DATE) { CheckDlgButton(hwndDlg, IDC_LOG_LONG_DATE, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_RELATIVE_DATE) { CheckDlgButton(hwndDlg, IDC_LOG_RELATIVE_DATE, TRUE); } if (Options::getTemplatesFlags() & Options::LOG_GROUP_MESSAGES) { CheckDlgButton(hwndDlg, IDC_LOG_GROUP_MESSAGES, TRUE); } EnableWindow(GetDlgItem(hwndDlg, IDC_TEMPLATES_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_TEMPLATES), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TEMPLATES_FILENAME_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_TEMPLATES_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_FILE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_URL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_STATUSCHANGE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_NICKNAMES), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_TIME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_SECONDS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_LONG_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_RELATIVE_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_GROUP_MESSAGES), bChecked); path = (char *)Options::getTemplatesFile(); if (path != NULL) { SetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME, path); } path = (char *)Options::getTemplatesFileRTL(); if (path != NULL) { SetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME_RTL, path); } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_TEMPLATES_FILENAME: case IDC_TEMPLATES_FILENAME_RTL: if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE) SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_LOG_SHOW_FILE: case IDC_LOG_SHOW_URL: case IDC_LOG_SHOW_STATUSCHANGE: case IDC_LOG_SHOW_NICKNAMES: case IDC_LOG_SHOW_TIME: case IDC_LOG_SHOW_DATE: case IDC_LOG_SHOW_SECONDS: case IDC_LOG_LONG_DATE: case IDC_LOG_RELATIVE_DATE: case IDC_LOG_GROUP_MESSAGES: SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_TEMPLATES: bChecked = IsDlgButtonChecked(hwndDlg, IDC_TEMPLATES); EnableWindow(GetDlgItem(hwndDlg, IDC_TEMPLATES_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_TEMPLATES), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TEMPLATES_FILENAME_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_TEMPLATES_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_FILE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_URL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_STATUSCHANGE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_NICKNAMES), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_TIME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_SHOW_SECONDS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_LONG_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_RELATIVE_DATE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LOG_GROUP_MESSAGES), bChecked); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_BROWSE_TEMPLATES: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "Templates (*.ivt)\0*.ivt\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "ivt"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME, path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; case IDC_BROWSE_TEMPLATES_RTL: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "Templates (*.ivt)\0*.ivt\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "ivt"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME_RTL, path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; } } break; case WM_NOTIFY: { switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: i = 0; if (IsDlgButtonChecked(hwndDlg, IDC_TEMPLATES)) { i |= Options::TEMPLATES_ENABLED; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_FILE)) { i |= Options::LOG_SHOW_FILE; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_URL)) { i |= Options::LOG_SHOW_URL; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_STATUSCHANGE)) { i |= Options::LOG_SHOW_STATUSCHANGE; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_NICKNAMES)) { i |= Options::LOG_SHOW_NICKNAMES; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_TIME)) { i |= Options::LOG_SHOW_TIME; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_DATE)) { i |= Options::LOG_SHOW_DATE; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_SHOW_SECONDS)) { i |= Options::LOG_SHOW_SECONDS; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_LONG_DATE)) { i |= Options::LOG_LONG_DATE; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_RELATIVE_DATE)) { i |= Options::LOG_RELATIVE_DATE; } if (IsDlgButtonChecked(hwndDlg, IDC_LOG_GROUP_MESSAGES)) { i |= Options::LOG_GROUP_MESSAGES; } Options::setTemplatesFlags(i); GetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME, path, sizeof(path)); Options::setTemplatesFile(path); GetDlgItemText(hwndDlg, IDC_TEMPLATES_FILENAME_RTL, path, sizeof(path)); Options::setTemplatesFileRTL(path); return TRUE; } } break; case WM_DESTROY: break; } return FALSE; }
bool CAviReportWnd::DoModal(CAviFile* pAF, bool fHideChecked, bool fShowWarningText) { m_nChunks = 0; m_rtDur = 0; for(int i = 0; i < (int)pAF->m_avih.dwStreams; i++) { int cnt = pAF->m_strms[i]->cs2.GetCount(); if(cnt <= 0) continue; CAviFile::strm_t::chunk2& c2 = pAF->m_strms[i]->cs2[cnt-1]; m_nChunks = max(m_nChunks, c2.n); m_rtDur = max(m_rtDur, (REFERENCE_TIME)c2.t<<13); } CRect r, r2; GetDesktopWindow()->GetWindowRect(r); r.DeflateRect(r.Width()/4, r.Height()/4); LPCTSTR wndclass = AfxRegisterWndClass( CS_VREDRAW|CS_HREDRAW|CS_DBLCLKS, AfxGetApp()->LoadStandardCursor(IDC_ARROW), (HBRUSH)(COLOR_BTNFACE + 1), 0); CreateEx(0, wndclass, TITLE, WS_POPUPWINDOW|WS_CAPTION|WS_CLIPCHILDREN, r, NULL, 0); CRect cr; GetClientRect(cr); cr.DeflateRect(10, 10); SetFont(&m_font, FALSE); CDC* pDC = GetDC(); CFont* pOldFont = pDC->SelectObject(&m_font); // CString str( _T("This AVI file was not prepared for sequential reading, the alternative ") _T("'Avi Splitter' will now let the default one handle it. ") _T("The complete reinterleaving of this file is strongly recommended before ") _T("burning it onto a slow media like cd-rom.")); r = cr; pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT); r.right = cr.right; m_message.Create(str, WS_CHILD|WS_VISIBLE, r, this); m_message.SetFont(&m_font, FALSE); // r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom); str = _T("Do not show this dialog again (hold Shift to re-enable it)"); pDC->DrawText(str, r, DT_WORDBREAK|DT_CALCRECT); r.right = cr.right; m_checkbox.Create(str, WS_CHILD|WS_VISIBLE|BS_CHECKBOX|BS_AUTOCHECKBOX, r, this, IDC_DONOTSHOWAGAINCHECK); m_checkbox.SetFont(&m_font, FALSE); CheckDlgButton(IDC_DONOTSHOWAGAINCHECK, fHideChecked?BST_CHECKED:BST_UNCHECKED); // if(!fShowWarningText) { m_message.ShowWindow(SW_HIDE); m_checkbox.ShowWindow(SW_HIDE); r = cr; } else { r.SetRect(cr.left, r.bottom + 10, cr.right, cr.bottom); } m_graph.Create(pAF, r, this); // pDC->SelectObject(pOldFont); ReleaseDC(pDC); SetWindowPos(&wndTop, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE); SetForegroundWindow(); ShowWindow(SW_SHOWNORMAL); return !!RunModalLoop(); }
void WSetKey( WAccelEditInfo *einfo, BYTE scan_code ) { bool cntl; bool shift; bool alt; char *str; char scan_key; uint_16 key; uint_16 skey; bool is_virt; BYTE kbstate[256]; int ta_ret; #ifdef __NT__ WORD ta_key; #else DWORD ta_key; #endif if( einfo == NULL ) { return; } is_virt = TRUE; key = einfo->key_info.key; skey = WMapShiftedKeyToKey( key ); GetKeyboardState( kbstate ); cntl = (kbstate[VK_CONTROL] & 0x0080) != 0; shift = (kbstate[VK_SHIFT] & 0x0080) != 0; alt = (kbstate[VK_MENU] & 0x0080) != 0; str = WGetVKeyFromID( key ); if( str == NULL ) { // I am assumming that they key must be alphanumeric // as WGetVKeyFromID( key ) would filter out all others if( isalpha( key ) ) { if( alt ) { str = WGetASCIIVKText( key ); } else { if( cntl ) { key = toupper( key ) - '@'; } else { if( !shift ) { key = tolower( key ); } } str = WGetASCIIKeyText( key ); is_virt = FALSE; } } else if( isdigit( key ) ) { if( alt || cntl ) { str = WGetASCIIVKText( key ); } else { if( shift ) { key = WMapKeyToShiftedKey( key ); } str = WGetASCIIKeyText( key ); is_virt = FALSE; } } else if( isdigit( skey ) ) { str = WGetASCIIVKText( skey ); // The remaining keys are the ones where we did not get a // virtual key we could translate, an alpha-numeric key, // a shifted 0-9 ( ie !@#$%^&*() ). // The ToAscii function handles everything except the following // keys where cntl is pressed. These keys are `-=[]\;',./ // So, I throw up my hands in defeat and add a special case } else if( cntl && (scan_key = WMapScanCodeToKey( scan_code )) != 0 ) { str = WGetASCIIKeyText( scan_key ); } else { ta_ret = ToAscii( key, scan_code, kbstate, &ta_key, 0 ); if( ta_ret ) { if( shift ) { ta_key = WMapShiftedKeyToKey( ta_key ); } str = WGetASCIIKeyText( ta_key ); } } } WSetEditWithStr( GetDlgItem( einfo->edit_dlg, IDM_ACCEDKEY ), str ); WSetVirtKey( einfo->edit_dlg, is_virt ); if( is_virt ) { CheckDlgButton( einfo->edit_dlg, IDM_ACCEDALT, ( alt ) ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDCNTL, ( cntl ) ? BST_CHECKED : BST_UNCHECKED ); CheckDlgButton( einfo->edit_dlg, IDM_ACCEDSHFT, ( shift ) ? BST_CHECKED : BST_UNCHECKED ); } }
LRESULT CALLBACK CFG_EditInstall_Proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { TCHAR szFile[260]; switch(uMsg) { case WM_INITDIALOG: { CFG_editexeIdx = lParam; int gameID = CFG_GetGameID(g_currSelCfg); GAME_INSTALLATIONS gi; gi = GamesInfoCFG[gameID].vGAME_INST.at(lParam); g_cfgScriptTmp.clear(); g_cfgFilterNameTmp.clear(); g_EditorTI.sScript = gi.sScript; g_EditorTI.sName = gi.sFilterName; CheckDlgButton(hDlg,IDC_CHECK_CONDITION,gi.bActiveScript); SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,gi.sFilterName.c_str()); SetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,gi.sName.c_str()); SetDlgItemText(hDlg,IDC_EDIT_PATH,gi.szGAME_PATH.c_str()); SetDlgItemText(hDlg,IDC_EDIT_CMD,gi.szGAME_CMD.c_str()); // SetDlgItemText(hDlg,IDC_EDIT_CFG_MOD,gi.sMod.c_str()); // SetDlgItemText(hDlg,IDC_EDIT_CFG_VERSION,gi.sVersion.c_str()); break; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_BUTTON_EDIT_SCRIPT: DialogBoxParam(g_hInst, (LPCTSTR)IDD_DLG_EDIT_FILTER, hDlg, (DLGPROC)FilterEditor_Dlg,-2); g_cfgScriptTmp = g_EditorTI.sScript; g_cfgFilterNameTmp = g_EditorTI.sName; SetDlgItemText(hDlg,IDC_EDIT_SCRIPTNAME,g_cfgFilterNameTmp.c_str()); break; case IDC_BUTTON_CFG_EXE_CANCEL: EndDialog(hDlg,0); break; case IDC_BUTTON_EXE_CFG_OK: { int gameID = CFG_GetGameID(g_currSelCfg); TCHAR szTemp[MAX_PATH*2]; GAME_INSTALLATIONS gi; GetDlgItemText(hDlg,IDC_EDIT_CFG_PROPNAME,szTemp,MAX_PATH); if(strlen(szTemp)==0) { MessageBox(hDlg,g_lang.GetString("NoName"),"Error saving",MB_OK); return TRUE; } if(IsDlgButtonChecked(hDlg,IDC_CHECK_CONDITION)==BST_CHECKED) gi.bActiveScript=TRUE; else gi.bActiveScript=FALSE; gi.sFilterName = g_cfgFilterNameTmp; gi.sScript = g_cfgScriptTmp; gi.sName = szTemp; GetDlgItemText(hDlg,IDC_EDIT_PATH,szTemp,MAX_PATH); gi.szGAME_PATH = szTemp; GetDlgItemText(hDlg,IDC_EDIT_CMD,szTemp,MAX_PATH*2); gi.szGAME_CMD = szTemp; GamesInfoCFG[gameID].vGAME_INST.at(CFG_editexeIdx) = gi; EndDialog(hDlg,0); } break; case IDC_BUTTON_ET_PATH: { OPENFILENAME ofn; memset(&ofn,0,sizeof(OPENFILENAME)); ofn.lStructSize = sizeof (OPENFILENAME); ofn.hwndOwner = hDlg; ofn.lpstrFilter = NULL; ofn.lpstrFile = szFile; // Set lpstrFile[0] to '\0' so that GetOpenFileName does not // use the contents of szFile to initialize itself. // ofn.lpstrFile[0] = '\0'; ofn.nMaxFile = sizeof(szFile); ofn.lpstrFilter = "All\0*.*\0Executable\0*.exe\0"; ofn.nFilterIndex = 2; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; int gameID=-1; gameID = CFG_GetGameID(g_currSelCfg); if(gameID!=-1) { if(GamesInfoCFG[gameID].vGAME_INST.size()>0) ofn.lpstrInitialDir = GamesInfoCFG[gameID].vGAME_INST[CFG_editexeIdx].szGAME_PATH.c_str(); } ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; if(GetOpenFileName(&ofn)) SetDlgItemText(hDlg,IDC_EDIT_PATH,ofn.lpstrFile); return TRUE; } } break; } } return FALSE; }
static INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOWSBAR, db_get_b(NULL, "CLUI", "ShowSBar", 1) ? BST_CHECKED : BST_UNCHECKED); { BYTE showOpts = db_get_b(NULL, "CLUI", "SBarShow", 1); CheckDlgButton(hwndDlg, IDC_SHOWICON, showOpts & 1 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWPROTO, showOpts & 2 ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWSTATUS, showOpts & 4 ? BST_CHECKED : BST_UNCHECKED); } CheckDlgButton(hwndDlg, IDC_RIGHTSTATUS, db_get_b(NULL, "CLUI", "SBarRightClk", 0) ? BST_UNCHECKED : BST_CHECKED); CheckDlgButton(hwndDlg, IDC_RIGHTMIRANDA, IsDlgButtonChecked(hwndDlg, IDC_RIGHTSTATUS) == BST_UNCHECKED ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_EQUALSECTIONS, db_get_b(NULL, "CLUI", "EqualSections", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SBPANELBEVEL, db_get_b(NULL, "CLUI", "SBarBevel", 1) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWGRIP, db_get_b(NULL, "CLUI", "ShowGrip", 1) ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) { EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSTATUS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTSTATUS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTMIRANDA), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_EQUALSECTIONS), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_SBPANELBEVEL), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWGRIP), FALSE); } return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_SHOWSBAR) { EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWICON), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWPROTO), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSTATUS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTSTATUS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_RIGHTMIRANDA), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_EQUALSECTIONS), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_SBPANELBEVEL), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWGRIP), IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: if (((LPNMHDR) lParam)->code == PSN_APPLY ) { db_set_b(NULL, "CLUI", "ShowSBar", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)); db_set_b(NULL, "CLUI", "SBarShow", (BYTE) ((IsDlgButtonChecked(hwndDlg, IDC_SHOWICON) ? 1 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWPROTO) ? 2 : 0) | (IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUS) ? 4 : 0))); db_set_b(NULL, "CLUI", "SBarRightClk", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_RIGHTMIRANDA)); db_set_b(NULL, "CLUI", "EqualSections", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_EQUALSECTIONS)); db_set_b(NULL, "CLUI", "SBarBevel", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SBPANELBEVEL)); pcli->pfnLoadCluiGlobalOpts(); if (db_get_b(NULL, "CLUI", "ShowGrip", 1) != (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)) { HWND parent = GetParent(pcli->hwndStatus); int flags = WS_CHILD | CCS_BOTTOM; db_set_b(NULL, "CLUI", "ShowGrip", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWGRIP)); ShowWindow(pcli->hwndStatus, SW_HIDE); DestroyWindow(pcli->hwndStatus); flags |= db_get_b(NULL, "CLUI", "ShowSBar", 1) ? WS_VISIBLE : 0; flags |= db_get_b(NULL, "CLUI", "ShowGrip", 1) ? SBARS_SIZEGRIP : 0; pcli->hwndStatus = CreateWindow(STATUSCLASSNAME, NULL, flags, 0, 0, 0, 0, parent, NULL, g_hInst, NULL); } if (IsDlgButtonChecked(hwndDlg, IDC_SHOWSBAR)) ShowWindow(pcli->hwndStatus, SW_SHOW); else ShowWindow(pcli->hwndStatus, SW_HIDE); SendMessage(pcli->hwndContactList, WM_SIZE, 0, 0); return TRUE; } break; } return FALSE; }
static INT_PTR CALLBACK SysConfProc(HWND hDlgWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HKEY hKey; WCHAR buffer[MAX_LOAD_STRING]; DWORD bufSize; WCHAR wszReg[] = { 'S','o','f','t','w','a','r','e','\\', 'M','i','c','r','o','s','o','f','t','\\','O','L','E','\\','\0' }; WCHAR wszEnableDCOM[] = { 'E','n','a','b','l','e','D','C','O','M','\0' }; WCHAR wszEnableRemote[] = { 'E','n','a','b','l','e', 'R','e','m','o','t','e','C','o','n','n','e','c','t','\0' }; WCHAR wszYes[] = { 'Y', '\0' }; WCHAR wszNo[] = { 'N', '\0' }; switch(uMsg) { case WM_INITDIALOG: if(RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey) != ERROR_SUCCESS) RegCreateKey(HKEY_LOCAL_MACHINE, wszReg, &hKey); bufSize = sizeof(buffer); if(RegGetValue(hKey, NULL, wszEnableDCOM, RRF_RT_REG_SZ, NULL, buffer, &bufSize) != ERROR_SUCCESS) { bufSize = sizeof(wszYes); RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ, (BYTE*)wszYes, bufSize); } CheckDlgButton(hDlgWnd, IDC_ENABLEDCOM, buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED); bufSize = sizeof(buffer); if(RegGetValue(hKey, NULL, wszEnableRemote, RRF_RT_REG_SZ, NULL, buffer, &bufSize) != ERROR_SUCCESS) { bufSize = sizeof(wszYes); RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ, (BYTE*)wszYes, bufSize); } CheckDlgButton(hDlgWnd, IDC_ENABLEREMOTE, buffer[0]=='Y' ? BST_CHECKED : BST_UNCHECKED); RegCloseKey(hKey); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDOK: bufSize = sizeof(wszYes); RegOpenKey(HKEY_LOCAL_MACHINE, wszReg, &hKey); RegSetValueEx(hKey, wszEnableDCOM, 0, REG_SZ, IsDlgButtonChecked(hDlgWnd, IDC_ENABLEDCOM) == BST_CHECKED ? (BYTE*)wszYes : (BYTE*)wszNo, bufSize); RegSetValueEx(hKey, wszEnableRemote, 0, REG_SZ, IsDlgButtonChecked(hDlgWnd, IDC_ENABLEREMOTE) == BST_CHECKED ? (BYTE*)wszYes : (BYTE*)wszNo, bufSize); RegCloseKey(hKey); EndDialog(hDlgWnd, IDOK); return TRUE; case IDCANCEL: EndDialog(hDlgWnd, IDCANCEL); return TRUE; } } return FALSE; }
static INT_PTR CALLBACK DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_BRINGTOFRONT, db_get_b(NULL, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONTOP, db_get_b(NULL, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_TOOLWND, db_get_b(NULL, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_MIN2TRAY, db_get_b(NULL, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); CheckDlgButton(hwndDlg, IDC_SHOWCAPTION, db_get_b(NULL, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_SHOWMAINMENU, db_get_b(NULL, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_CLIENTDRAG, db_get_b(NULL, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) { EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), FALSE); } CheckDlgButton(hwndDlg, IDC_FADEINOUT, db_get_b(NULL, "CLUI", "FadeInOut", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOSIZE, db_get_b(NULL, "CLUI", "AutoSize", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DROPSHADOW, db_get_b(NULL, "CList", "WindowShadow", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_ONDESKTOP, db_get_b(NULL, "CList", "OnDesktop", 0) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); SendDlgItemMessage(hwndDlg, IDC_MAXSIZESPIN, UDM_SETPOS, 0, db_get_b(NULL, "CLUI", "MaxSizeHeight", 75)); CheckDlgButton(hwndDlg, IDC_AUTOSIZEUPWARD, db_get_b(NULL, "CLUI", "AutoSizeUpward", 0) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_AUTOHIDE, db_get_b(NULL, "CList", "AutoHide", SETTING_AUTOHIDE_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETRANGE, 0, MAKELONG(900, 1)); SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_SETPOS, 0, MAKELONG(db_get_w(NULL, "CList", "HideTime", SETTING_HIDETIME_DEFAULT), 0)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC21), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC22), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZEHEIGHT), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZESPIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), FALSE); } { DBVARIANT dbv; if ( !db_get_ts(NULL, "CList", "TitleText", &dbv)) { SetDlgItemText(hwndDlg, IDC_TITLETEXT, dbv.ptszVal); db_free( &dbv ); } else SetDlgItemTextA(hwndDlg, IDC_TITLETEXT, MIRANDANAME); } CheckDlgButton(hwndDlg, IDC_TRANSPARENT, db_get_b(NULL, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT) ? BST_CHECKED : BST_UNCHECKED); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC12), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSACTIVE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSINACTIVE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVEPERC), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_INACTIVEPERC), FALSE); } SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETRANGE, FALSE, MAKELONG(1, 255)); SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "Alpha", SETTING_ALPHA_DEFAULT)); SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_SETPOS, TRUE, db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT)); SendMessage(hwndDlg, WM_HSCROLL, 0x12345678, 0); return TRUE; case WM_COMMAND: if (LOWORD(wParam) == IDC_AUTOHIDE) { EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIME), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDETIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC01), IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); } else if (LOWORD(wParam) == IDC_TRANSPARENT) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC11), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC12), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSACTIVE), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSINACTIVE), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); EnableWindow(GetDlgItem(hwndDlg, IDC_ACTIVEPERC), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); EnableWindow(GetDlgItem(hwndDlg, IDC_INACTIVEPERC), IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); } else if (LOWORD(wParam) == IDC_AUTOSIZE) { EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC21), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); EnableWindow(GetDlgItem(hwndDlg, IDC_STATIC22), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZEHEIGHT), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); EnableWindow(GetDlgItem(hwndDlg, IDC_MAXSIZESPIN), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); EnableWindow(GetDlgItem(hwndDlg, IDC_AUTOSIZEUPWARD), IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); } else if (LOWORD(wParam) == IDC_TOOLWND) { EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); } else if (LOWORD(wParam) == IDC_SHOWCAPTION) { EnableWindow(GetDlgItem(hwndDlg, IDC_TOOLWND), IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_MIN2TRAY), BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND) && IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); EnableWindow(GetDlgItem(hwndDlg, IDC_TITLETEXT), IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); } if ((LOWORD(wParam) == IDC_HIDETIME || LOWORD(wParam) == IDC_TITLETEXT || LOWORD(wParam) == IDC_MAXSIZEHEIGHT) && (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus())) return 0; // Enable apply button SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_HSCROLL: { char str[10]; mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_INACTIVEPERC, str); mir_snprintf(str, SIZEOF(str), "%d%%", 100 * SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0) / 255); SetDlgItemTextA(hwndDlg, IDC_ACTIVEPERC, str); } if (wParam != 0x12345678) SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: if (((LPNMHDR) lParam)->code == PSN_APPLY) { db_set_b(NULL, "CList", "OnTop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONTOP)); db_set_b(NULL, "CList", "ToolWindow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)); db_set_b(NULL, "CList", "BringToFront", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_BRINGTOFRONT)); db_set_b(NULL, "CLUI", "FadeInOut", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_FADEINOUT)); db_set_b(NULL, "CLUI", "AutoSize", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZE)); db_set_b(NULL, "CLUI", "MaxSizeHeight", (BYTE) GetDlgItemInt(hwndDlg, IDC_MAXSIZEHEIGHT, NULL, FALSE)); db_set_b(NULL, "CLUI", "AutoSizeUpward", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOSIZEUPWARD)); db_set_b(NULL, "CList", "AutoHide", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOHIDE)); db_set_w(NULL, "CList", "HideTime", (WORD) SendDlgItemMessage(hwndDlg, IDC_HIDETIMESPIN, UDM_GETPOS, 0, 0)); db_set_b(NULL, "CList", "Transparent", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)); db_set_b(NULL, "CList", "Alpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSACTIVE, TBM_GETPOS, 0, 0)); db_set_b(NULL, "CList", "AutoAlpha", (BYTE) SendDlgItemMessage(hwndDlg, IDC_TRANSINACTIVE, TBM_GETPOS, 0, 0)); db_set_b(NULL, "CList", "WindowShadow", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DROPSHADOW)); db_set_b(NULL, "CList", "OnDesktop", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)); db_set_b(NULL, "CLUI", "ShowCaption", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)); db_set_b(NULL, "CLUI", "ShowMainMenu", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)); db_set_b(NULL, "CLUI", "ClientAreaDrag", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CLIENTDRAG)); db_set_b(NULL, "CList", "Min2Tray", (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY)); { TCHAR title[256]; GetDlgItemText(hwndDlg, IDC_TITLETEXT, title, SIZEOF(title)); db_set_ts(NULL, "CList", "TitleText", title); SetWindowText(pcli->hwndContactList, title); } pcli->pfnLoadCluiGlobalOpts(); SetWindowPos(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_ONTOP) ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE); if (IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) { // Window must be hidden to dynamically remove the taskbar button. // See http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/taskbar.asp WINDOWPLACEMENT p; p.length = sizeof(p); GetWindowPlacement(pcli->hwndContactList, &p); ShowWindow(pcli->hwndContactList, SW_HIDE); SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE); SetWindowPlacement(pcli->hwndContactList, &p); } else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_TOOLWINDOW); if (IsDlgButtonChecked(hwndDlg, IDC_ONDESKTOP)) { HWND hProgMan = FindWindowA("Progman", NULL); if (IsWindow(hProgMan)) SetParent(pcli->hwndContactList, hProgMan); } else SetParent(pcli->hwndContactList, NULL); if (IsDlgButtonChecked(hwndDlg, IDC_SHOWCAPTION)) SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX); else SetWindowLongPtr(pcli->hwndContactList, GWL_STYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_STYLE) & ~(WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX)); if (BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_SHOWMAINMENU)) SetMenu(pcli->hwndContactList, NULL); else SetMenu(pcli->hwndContactList, pcli->hMenuMain); SetWindowPos(pcli->hwndContactList, 0, 0, 0, 0, 0, SWP_NOZORDER | SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED); RedrawWindow(pcli->hwndContactList, NULL, NULL, RDW_FRAME | RDW_INVALIDATE); if (IsIconic(pcli->hwndContactList) && BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_TOOLWND)) ShowWindow(pcli->hwndContactList, IsDlgButtonChecked(hwndDlg, IDC_MIN2TRAY) ? SW_HIDE : SW_SHOW); if (IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENT)) { SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) | WS_EX_LAYERED); SetLayeredWindowAttributes(pcli->hwndContactList, RGB(0, 0, 0), (BYTE)db_get_b(NULL, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA); } else SetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE, GetWindowLongPtr(pcli->hwndContactList, GWL_EXSTYLE) & ~WS_EX_LAYERED); SendMessage(pcli->hwndContactTree, WM_SIZE, 0, 0); //forces it to send a cln_listsizechanged return TRUE; } break; } return FALSE; }
BOOL CALLBACK GbaSlotCFlash(HWND dialog, UINT msg,WPARAM wparam,LPARAM lparam) { switch(msg) { case WM_INITDIALOG: { SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), tmp_cflash_filename); SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_cflash_path); if (tmp_CFlashUsePath) { if (tmp_CFlashUseRomPath) { CheckDlgButton(dialog, IDC_PATHDESMUME, BST_CHECKED); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(OKbutton, TRUE); } else { EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE); if (strlen(tmp_cflash_path)) EnableWindow(OKbutton, TRUE); } EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); CheckDlgButton(dialog, IDC_RFOLDER, BST_CHECKED); } else { EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); if (strlen(tmp_cflash_filename)) EnableWindow(OKbutton, TRUE); CheckDlgButton(dialog, IDC_RFILE, BST_CHECKED); } return TRUE; } case WM_COMMAND: { switch (LOWORD(wparam)) { case IDC_BBROWSE: { int filterSize = 0, i = 0; OPENFILENAME ofn; char filename[MAX_PATH] = "", fileFilter[512]=""; ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(ofn); ofn.hwndOwner = dialog; strncpy (fileFilter, "Compact Flash image (*.img)|*.img||",512 - strlen(fileFilter)); strncat (fileFilter, "Any file (*.*)|*.*||",512 - strlen(fileFilter)); filterSize = strlen(fileFilter); for (i = 0; i < filterSize; i++) if (fileFilter[i] == '|') fileFilter[i] = '\0'; ofn.lpstrFilter = fileFilter; ofn.nFilterIndex = 1; ofn.lpstrFile = filename; ofn.nMaxFile = MAX_PATH; ofn.lpstrDefExt = "img"; ofn.Flags = OFN_NOCHANGEDIR | OFN_CREATEPROMPT; if(!GetOpenFileName(&ofn)) return FALSE; SetWindowText(GetDlgItem(dialog, IDC_PATHIMG), filename); strcpy(tmp_cflash_filename, filename); if (!strlen(tmp_cflash_filename)) EnableWindow(OKbutton, FALSE); else EnableWindow(OKbutton, TRUE); return FALSE; } case IDC_BBROWSE2: { BROWSEINFO bp={0}; bp.hwndOwner=dialog; bp.pidlRoot=NULL; bp.pszDisplayName=NULL; bp.lpszTitle="Select directory for Compact Flash"; bp.ulFlags=BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE; bp.lpfn=NULL; LPITEMIDLIST tmp = SHBrowseForFolder((LPBROWSEINFO)&bp); if (tmp!=NULL) { memset(tmp_cflash_path, 0, sizeof(tmp_cflash_path)); SHGetPathFromIDList(tmp, tmp_cflash_path); if (tmp_cflash_path[strlen(tmp_cflash_path)-1] != '\\') tmp_cflash_path[strlen(tmp_cflash_path)] = '\\'; SetWindowText(GetDlgItem(dialog, IDC_PATH), tmp_cflash_path); } if (strlen(tmp_cflash_path)) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); break; } case IDC_RFILE: { tmp_CFlashUsePath = FALSE; EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), TRUE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); if (!strlen(tmp_cflash_filename)) EnableWindow(OKbutton, FALSE); break; } case IDC_RFOLDER: { tmp_CFlashUsePath = TRUE; EnableWindow(GetDlgItem(dialog, IDC_PATHIMG), FALSE); EnableWindow(GetDlgItem(dialog, IDC_BBROWSE), FALSE); if (IsDlgButtonChecked(dialog, IDC_PATHDESMUME)) { tmp_CFlashUseRomPath = TRUE; EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); EnableWindow(OKbutton, TRUE); } else { tmp_CFlashUseRomPath = FALSE; EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE); EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE); } EnableWindow(GetDlgItem(dialog, IDC_PATHDESMUME), TRUE); break; } case IDC_PATHDESMUME: { if (IsDlgButtonChecked(dialog, IDC_PATHDESMUME)) { tmp_CFlashUseRomPath = TRUE; EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), FALSE); EnableWindow(GetDlgItem(dialog, IDC_PATH), FALSE); EnableWindow(OKbutton, TRUE); } else { tmp_CFlashUseRomPath = FALSE; EnableWindow(GetDlgItem(dialog, IDC_BBROWSE2), TRUE); EnableWindow(GetDlgItem(dialog, IDC_PATH), TRUE); if (strlen(tmp_cflash_path)) EnableWindow(OKbutton, TRUE); else EnableWindow(OKbutton, FALSE); } break; } } break; } } return FALSE; }
void CConfigMsgLogDlg::vUpdate_GUI_From_Datastore(USHORT usIndex) { SLOGINFO sLogStruct; SLOGTRIGGER& sTrigger = sLogStruct.m_sLogTrigger; if (GetLoggingBlock(usIndex, sLogStruct) == S_OK) { vEnableDisableControls(!m_bLogON); } else { vEnableDisableControls(FALSE); return; } m_omListLogFiles.SetCheck(usIndex, sLogStruct.m_bEnabled); (GetDlgItem(IDC_EDIT_LOGFILEPATH))->SetWindowText(sLogStruct.m_sLogFileName); SetGUIFromTimeMode(sLogStruct.m_eLogTimerMode); SetGUIFromChannel(sLogStruct.m_ChannelSelected); int CheckBox = (DEC == sLogStruct.m_eNumFormat) ? IDC_RBTN_DECIMAL : IDC_RBTN_HEX; CheckRadioButton(IDC_RBTN_DECIMAL, IDC_RBTN_HEX, CheckBox); CheckBox = (APPEND_MODE == sLogStruct.m_eFileMode) ? IDC_RBTN_APPEND : IDC_RBTN_OVERWRITE; CheckRadioButton(IDC_RBTN_APPEND, IDC_RBTN_OVERWRITE, CheckBox); if(sLogStruct.m_eLogTimerMode == TIME_MODE_ABSOLUTE) { m_ChkbResetTimeStamp.EnableWindow(1); } else { m_ChkbResetTimeStamp.EnableWindow(0); } if(sLogStruct.m_bResetAbsTimeStamp == TRUE) { m_ChkbResetTimeStamp.SetCheck(1); } else { m_ChkbResetTimeStamp.SetCheck(0); } if (sTrigger.m_unTriggerType != NONE) { if (sTrigger.m_unTriggerType == BOTH) // Start and stop trigger edit { // control CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { if (sTrigger.m_unTriggerType == START) // Start trigger edit control { CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_CHECKED); m_odStartMsgID.vSetValue((__int64) sTrigger.m_unStartID); } else { vUpdateControl(IDC_CHKB_STARTTRIGGER, CHECKBOX, CActionFlag::CLEAR_CTRL); vUpdateControl(IDC_EDIT_STARTMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } if (sTrigger.m_unTriggerType == STOP) // Stop trigger edit control { CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_CHECKED); m_odStopMsgID.vSetValue((__int64) sTrigger.m_unStopID); } else { vUpdateControl(IDC_CHKB_STOPTRIGGER, CHECKBOX, CActionFlag::CLEAR_CTRL); vUpdateControl(IDC_EDIT_STOPMSGID, EDITCTRL, CActionFlag::CLEAR_CTRL); } } } else { // Start trigger check box control: clear CheckDlgButton(IDC_CHKB_STARTTRIGGER, BST_UNCHECKED); // Stop trigger check box control: clear CheckDlgButton(IDC_CHKB_STOPTRIGGER, BST_UNCHECKED); // Start trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STARTMSGID, EDITCTRL, FALSE); // Stop trigger edit control: clear and disable vEnableDisableControl(IDC_EDIT_STOPMSGID, EDITCTRL, FALSE); } }
// weather options INT_PTR CALLBACK OptionsProc(HWND hdlg, UINT msg, WPARAM wparam, LPARAM lparam) { TCHAR str[512]; switch (msg) { case WM_INITDIALOG: opt_startup = TRUE; TranslateDialogDefault(hdlg); // load settings _ltot(opt.UpdateTime, str, 10); SetDlgItemText(hdlg, IDC_UPDATETIME, str); SetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign); SendDlgItemMessage(hdlg, IDC_AVATARSPIN, UDM_SETRANGE32, 0, 999); SendDlgItemMessage(hdlg, IDC_AVATARSPIN, UDM_SETPOS, 0, opt.AvatarSize); SendDlgItemMessage(hdlg, IDC_AVATARSIZE, EM_LIMITTEXT, 3, 0); CheckDlgButton(hdlg, IDC_STARTUPUPD, opt.StartupUpdate ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_UPDATE, opt.AutoUpdate ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_PROTOCOND, !opt.NoProtoCondition ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_UPDCONDCHG, opt.UpdateOnlyConditionChanged ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_REMOVEOLD, opt.RemoveOldData ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_MAKEI, opt.MakeItalic ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_DISCONDICON, opt.DisCondIcon ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_DONOTAPPUNITS, opt.DoNotAppendUnit ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hdlg, IDC_NOFRAC, opt.NoFrac ? BST_CHECKED : BST_UNCHECKED); // load units switch (opt.tUnit) { // temperature case 1: CheckRadioButton(hdlg, IDC_T1, IDC_T2, IDC_T1); break; case 2: CheckRadioButton(hdlg, IDC_T1, IDC_T2, IDC_T2); break; } switch (opt.wUnit) { // wind case 1: CheckRadioButton(hdlg, IDC_W1, IDC_W4, IDC_W1); break; case 2: CheckRadioButton(hdlg, IDC_W1, IDC_W4, IDC_W2); break; case 3: CheckRadioButton(hdlg, IDC_W1, IDC_W4, IDC_W3); break; case 4: CheckRadioButton(hdlg, IDC_W1, IDC_W4, IDC_W4); break; } switch (opt.vUnit) { // visibility case 1: CheckRadioButton(hdlg, IDC_V1, IDC_V2, IDC_V1); break; case 2: CheckRadioButton(hdlg, IDC_V1, IDC_V2, IDC_V2); break; } switch (opt.pUnit) { // pressure case 1: CheckRadioButton(hdlg, IDC_P1, IDC_P4, IDC_P1); break; case 2: CheckRadioButton(hdlg, IDC_P1, IDC_P4, IDC_P2); break; case 3: CheckRadioButton(hdlg, IDC_P1, IDC_P4, IDC_P3); break; case 4: CheckRadioButton(hdlg, IDC_P1, IDC_P4, IDC_P4); break; } switch (opt.dUnit) { // pressure case 1: CheckRadioButton(hdlg, IDC_D1, IDC_D3, IDC_D1); break; case 2: CheckRadioButton(hdlg, IDC_D1, IDC_D3, IDC_D2); break; case 3: CheckRadioButton(hdlg, IDC_D1, IDC_D3, IDC_D3); break; } switch (opt.eUnit) { // elev case 1: CheckRadioButton(hdlg, IDC_E1, IDC_E2, IDC_E1); break; case 2: CheckRadioButton(hdlg, IDC_E1, IDC_E2, IDC_E2); break; } opt_startup = FALSE; return 0; case WM_COMMAND: if (HIWORD(wparam) == BN_CLICKED && GetFocus() == (HWND)lparam) if (!opt_startup) SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); if (!((LOWORD(wparam) == IDC_UPDATE || LOWORD(wparam) == IDC_DEGREE) && (HIWORD(wparam) != EN_CHANGE || (HWND)lparam != GetFocus()))) if (!opt_startup) SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0); return 0; case WM_NOTIFY: switch (((LPNMHDR)lparam)->code) { case PSN_APPLY: // change the status for weather protocol if (IsDlgButtonChecked(hdlg, IDC_PROTOCOND) && opt.DefStn != NULL) { old_status = status; status = db_get_w(opt.DefStn, WEATHERPROTONAME, "StatusIcon", NOSTATUSDATA); ProtoBroadcastAck(WEATHERPROTONAME, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)old_status, status); } // get update time and remove the old timer GetDlgItemText(hdlg, IDC_UPDATETIME, str, SIZEOF(str)); opt.UpdateTime = (WORD)_ttoi(str); if (opt.UpdateTime < 1) opt.UpdateTime = 1; KillTimer(NULL, timerId); timerId = SetTimer(NULL, 0, opt.UpdateTime * 60000, (TIMERPROC)timerProc); // other general options GetDlgItemText(hdlg, IDC_DEGREE, opt.DegreeSign, SIZEOF(opt.DegreeSign)); opt.StartupUpdate = IsDlgButtonChecked(hdlg, IDC_STARTUPUPD); opt.AutoUpdate = IsDlgButtonChecked(hdlg, IDC_UPDATE); opt.NoProtoCondition = BST_UNCHECKED == IsDlgButtonChecked(hdlg, IDC_PROTOCOND); opt.DisCondIcon = IsDlgButtonChecked(hdlg, IDC_DISCONDICON); opt.UpdateOnlyConditionChanged = (BYTE)IsDlgButtonChecked(hdlg, IDC_UPDCONDCHG); opt.RemoveOldData = IsDlgButtonChecked(hdlg, IDC_REMOVEOLD); opt.MakeItalic = IsDlgButtonChecked(hdlg, IDC_MAKEI); opt.AvatarSize = GetDlgItemInt(hdlg, IDC_AVATARSIZE, NULL, FALSE); opt.DoNotAppendUnit = IsDlgButtonChecked(hdlg, IDC_DONOTAPPUNITS); opt.NoFrac = IsDlgButtonChecked(hdlg, IDC_NOFRAC); UpdateMenu(opt.AutoUpdate); // save the units if (IsDlgButtonChecked(hdlg, IDC_T1)) opt.tUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_T2)) opt.tUnit = 2; if (IsDlgButtonChecked(hdlg, IDC_W1)) opt.wUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_W2)) opt.wUnit = 2; if (IsDlgButtonChecked(hdlg, IDC_W3)) opt.wUnit = 3; if (IsDlgButtonChecked(hdlg, IDC_W4)) opt.wUnit = 4; if (IsDlgButtonChecked(hdlg, IDC_V1)) opt.vUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_V2)) opt.vUnit = 2; if (IsDlgButtonChecked(hdlg, IDC_P1)) opt.pUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_P2)) opt.pUnit = 2; if (IsDlgButtonChecked(hdlg, IDC_P3)) opt.pUnit = 3; if (IsDlgButtonChecked(hdlg, IDC_P4)) opt.pUnit = 4; if (IsDlgButtonChecked(hdlg, IDC_D1)) opt.dUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_D2)) opt.dUnit = 2; if (IsDlgButtonChecked(hdlg, IDC_D3)) opt.dUnit = 3; if (IsDlgButtonChecked(hdlg, IDC_E1)) opt.eUnit = 1; if (IsDlgButtonChecked(hdlg, IDC_E2)) opt.eUnit = 2; // save the new weather options SaveOptions(); RedrawFrame(0, 0); return 1; } break; } return 0; }
INT_PTR CALLBACK dlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hwLocation = GetDlgItem(hwndDlg, IDC_LOCATION); HWND hwDirList = GetDlgItem(hwndDlg, IDC_DIRLIST); HWND hwCheckBox = GetDlgItem(hwndDlg, IDC_CHECK); switch (uMsg) { case WM_INITDIALOG: { HWND hwIcon; HWND hwText; RECT dialog_r, temp_r; HFONT hFont = (HFONT) SendMessage(hwParent, WM_GETFONT, 0, 0); int y_offset = 0; int width, height; int baseUnitY; // Init dialog unit conversion { TEXTMETRIC tm; HDC hDC; hDC = GetDC(hwndDlg); SelectObject(hDC, hFont); GetTextMetrics(hDC, &tm); baseUnitY = tm.tmHeight; ReleaseDC(hwndDlg, hDC); } GetWindowRect(hwChild, &dialog_r); ScreenToClient(hwParent, (LPPOINT) &dialog_r); ScreenToClient(hwParent, ((LPPOINT) &dialog_r) + 1); width = dialog_r.right - dialog_r.left; height = dialog_r.bottom - dialog_r.top; MoveWindow( hwndDlg, dialog_r.left, dialog_r.top, width, height, FALSE ); hwIcon = GetDlgItem(hwndDlg, IDC_NSISICON); hwText = GetDlgItem(hwndDlg, IDC_TEXT); g_hwDirList = hwDirList; SendMessage(hwndDlg, WM_SETFONT, (WPARAM) hFont, TRUE); SendMessage(hwIcon, WM_SETFONT, (WPARAM) hFont, TRUE); SendMessage(hwText, WM_SETFONT, (WPARAM) hFont, TRUE); SendMessage(hwLocation, WM_SETFONT, (WPARAM) hFont, TRUE); SendMessage(hwDirList, WM_SETFONT, (WPARAM) hFont, TRUE); SendMessage(hwCheckBox, WM_SETFONT, (WPARAM) hFont, TRUE); if (rtl) { AddRTLStyle(hwText, SS_RIGHT); AddRTLStyle(hwLocation, ES_RIGHT); AddRTLStyle(hwDirList, 0); AddRTLStyle(hwCheckBox, BS_RIGHT | BS_LEFTTEXT); } GetClientRect(hwIcon, &temp_r); if (!noicon) { SendMessage( hwIcon, STM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadIcon(GetModuleHandle(0), MAKEINTRESOURCE(103)) ); MoveWindow( hwIcon, rtl ? width - temp_r.right : 0, 0, temp_r.right, temp_r.bottom, FALSE ); temp_r.right += 3; } else { ShowWindow(hwIcon, SW_HIDE); temp_r.right = 0; } if (rtl) { ProgressiveSetWindowPos( hwText, 0, width - temp_r.right, 3 * baseUnitY //MulDiv(24, baseUnitY, 8); ); } else { ProgressiveSetWindowPos( hwText, temp_r.right, width - temp_r.right + 3, 3 * baseUnitY //MulDiv(24, baseUnitY, 8); ); } SetWindowText(hwText, *text ? text : _T("Select the Start Menu folder in which you would like to create the program's shortcuts:")); ProgressiveSetWindowPos( hwLocation, 0, width, MulDiv(12, baseUnitY, 8) ); if (*lastused == _T('>')) { CheckDlgButton(hwndDlg, IDC_CHECK, BST_CHECKED); lstrcpy(lastused, lstrcpy(buf, lastused) + 1); EnableWindow(hwDirList, FALSE); EnableWindow(hwLocation, FALSE); } SetWindowText(hwLocation, *lastused ? lastused : progname); temp_r.bottom = MulDiv(8, baseUnitY, 8); ProgressiveSetWindowPos( hwDirList, 0, width, height - y_offset - (*checkbox ? temp_r.bottom + 3 : 0) ); if (*checkbox) { ProgressiveSetWindowPos( hwCheckBox, 0, width, temp_r.bottom ); ShowWindow(hwCheckBox, SW_SHOWNA); SetWindowText(hwCheckBox, checkbox); } AddFolderFromReg(CSIDL_COMMON_PROGRAMS); AddFolderFromReg(CSIDL_PROGRAMS); // Tell NSIS to remove old inner dialog and pass handle of the new inner dialog SendMessage(hwParent, WM_NOTIFY_CUSTOM_READY, (WPARAM)hwndDlg, 0); ShowWindow(hwndDlg, SW_SHOWNA); if (IsDlgButtonChecked(hwndDlg, IDC_CHECK) == BST_CHECKED) SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwCheckBox, TRUE); else SendMessage(hwndDlg, WM_NEXTDLGCTL, (WPARAM) hwLocation, TRUE); } break; case WM_COMMAND: if (LOWORD(wParam) == IDC_DIRLIST && HIWORD(wParam) == LBN_SELCHANGE) { LRESULT selection = SendMessage(hwDirList, LB_GETCURSEL, 0, 0); if (selection != LB_ERR) { SendMessage(hwDirList, LB_GETTEXT, selection, (WPARAM)buf); if (autoadd) lstrcat(lstrcat(buf, _T("\\")), progname); SetWindowText(hwLocation, buf); } } else if (LOWORD(wParam) == IDC_CHECK && HIWORD(wParam) == BN_CLICKED) { BOOL bEnable = IsDlgButtonChecked(hwndDlg, IDC_CHECK) != BST_CHECKED; EnableWindow(hwDirList, bEnable); EnableWindow(hwLocation, bEnable); if (bEnable) goto ValidateLocation; *buf = _T('!'); //This only needs to be != 0, actual value does not matter goto SetOkBtn; } else if (LOWORD(wParam) == IDC_LOCATION && HIWORD(wParam) == EN_CHANGE) { ValidateLocation: GetWindowText(hwLocation, buf, MAX_PATH); validate_filename(buf); SetOkBtn: EnableWindow(GetDlgItem(hwParent, IDOK), *buf != _T('\0')); } break; case WM_USER+666: g_done = 1; if (wParam == NOTIFY_BYE_BYE) pushstring(_T("cancel")); else { GetWindowText(hwLocation, buf + 1, MAX_PATH); validate_filename(buf); if (IsDlgButtonChecked(hwndDlg, IDC_CHECK) == BST_CHECKED) { buf[0] = _T('>'); pushstring(buf); } else { pushstring(buf + 1); } pushstring(_T("success")); } case WM_CTLCOLORSTATIC: case WM_CTLCOLOREDIT: case WM_CTLCOLORDLG: case WM_CTLCOLORBTN: case WM_CTLCOLORLISTBOX: // let the NSIS window handle colors, it knows best return SendMessage(hwParent, uMsg, wParam, lParam); break; } return FALSE; }
// edit weather settings // lParam = current contact INT_PTR CALLBACK DlgProcChange(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { DBVARIANT dbv; TCHAR str[256], str2[256], city[256], filter[256], *pfilter, *chop; char loc[512]; OPENFILENAME ofn; // common dialog box structure MCONTACT hContact; WIDATA *sData; CntSetWndDataType *wndData = NULL; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); wndData = ( CntSetWndDataType* )mir_alloc(sizeof(CntSetWndDataType)); wndData->hContact = hContact = lParam; wndData->hRename = LoadSkinnedIcon(SKINICON_OTHER_RENAME); wndData->hUserDetail = LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS); wndData->hFile = LoadSkinnedIcon(SKINICON_EVENT_FILE); wndData->hSrchAll = LoadSkinnedIcon(SKINICON_OTHER_SEARCHALL); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)wndData); // set button images SendDlgItemMessage(hwndDlg, IDC_GETNAME, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hRename); SendDlgItemMessage(hwndDlg, IDC_SVCINFO, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hUserDetail); SendDlgItemMessage(hwndDlg, IDC_BROWSE, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hFile); SendDlgItemMessage(hwndDlg, IDC_VIEW1, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hSrchAll); SendDlgItemMessage(hwndDlg, IDC_RESET1, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hRename); SendDlgItemMessage(hwndDlg, IDC_VIEW2, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hSrchAll); SendDlgItemMessage(hwndDlg, IDC_RESET2, BM_SETIMAGE, IMAGE_ICON, (LPARAM)wndData->hRename); // make all buttons flat SendDlgItemMessage(hwndDlg, IDC_GETNAME, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_SVCINFO, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_BROWSE, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_VIEW1, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_RESET1, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_VIEW2, BUTTONSETASFLATBTN, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_RESET2, BUTTONSETASFLATBTN, TRUE, 0); // set tooltip for the buttons SendDlgItemMessage(hwndDlg, IDC_GETNAME, BUTTONADDTOOLTIP, (WPARAM) LPGENT("Get city name from ID"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_SVCINFO, BUTTONADDTOOLTIP, (WPARAM) LPGENT("Weather INI information"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_BROWSE, BUTTONADDTOOLTIP, (WPARAM) LPGENT("Browse"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_VIEW1, BUTTONADDTOOLTIP, (WPARAM) LPGENT("View webpage"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_RESET1, BUTTONADDTOOLTIP, (WPARAM) LPGENT("Reset to default"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_VIEW2, BUTTONADDTOOLTIP, (WPARAM) LPGENT("View webpage"), BATF_TCHAR); SendDlgItemMessage(hwndDlg, IDC_RESET2, BUTTONADDTOOLTIP, (WPARAM) LPGENT("Reset to default"), BATF_TCHAR); // save the handle for the contact WindowList_Add(hWindowList, hwndDlg, hContact); // start to get the settings // if the setting not exist, leave the dialog box blank if ( !db_get_ts(hContact, WEATHERPROTONAME, "ID", &dbv)) { SetDlgItemText(hwndDlg, IDC_ID, dbv.ptszVal); // check if the station is a default station CheckDlgButton(hwndDlg, IDC_DEFA, _tcscmp(dbv.ptszVal, opt.Default) != 0 ? BST_CHECKED : BST_UNCHECKED); db_free(&dbv); } if ( !db_get_ts(hContact, WEATHERPROTONAME, "Nick", &dbv)) { SetDlgItemText(hwndDlg, IDC_NAME, dbv.ptszVal); db_free(&dbv); } if ( !db_get_ts(hContact, WEATHERPROTONAME, "Log", &dbv)) { SetDlgItemText(hwndDlg, IDC_LOG, dbv.ptszVal); // if the log path is not empty, check the checkbox for external log if (dbv.ptszVal[0]) CheckDlgButton(hwndDlg, IDC_External, BST_CHECKED); db_free(&dbv); } // enable/disable the browse button depending on the value of external log checkbox EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)); // other checkbox options CheckDlgButton(hwndDlg, IDC_DPop, db_get_b(hContact, WEATHERPROTONAME, "DPopUp", FALSE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_DAutoUpdate, db_get_b(hContact, WEATHERPROTONAME, "DAutoUpdate", FALSE) ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwndDlg, IDC_Internal, db_get_b(hContact, WEATHERPROTONAME, "History", 0) ? BST_CHECKED : BST_UNCHECKED); if ( !db_get_ts(hContact, WEATHERPROTONAME, "InfoURL", &dbv)) { SetDlgItemText(hwndDlg, IDC_IURL, dbv.ptszVal); db_free(&dbv); } if ( !db_get_ts(hContact, WEATHERPROTONAME, "MapURL", &dbv)) { SetDlgItemText(hwndDlg, IDC_MURL, dbv.ptszVal); db_free(&dbv); } // display the dialog box and free memory Utils_RestoreWindowPositionNoMove(hwndDlg, NULL, WEATHERPROTONAME, "EditSetting_"); ShowWindow(hwndDlg, SW_SHOW); break; case WM_COMMAND: wndData = (CntSetWndDataType*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); hContact = wndData ? wndData->hContact : NULL; switch(LOWORD(wParam)) { case IDC_ID: // check if there are 2 parts in the ID (svc/id) seperated by "/" // if not, don't let user change the setting GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); chop = _tcsstr(str, _T("/")); if (chop == NULL) EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), FALSE); else EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), TRUE); break; case IDC_NAME: // check if station name is entered // if not, don't let user change the setting GetDlgItemText(hwndDlg, IDC_NAME, str, SIZEOF(str)); EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), str[0] != 0); break; case IDC_GETNAME: { // the button for getting station name from the internet // this function uses the ID search for add/find weather station if ( !CheckSearch()) return TRUE; // don't download if update is in progress // get the weather update data using the string in the ID field GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); GetSvc(str); WIDATA *sData = GetWIData(str); GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); GetID(str); // if ID search is available, do it if (sData->IDSearch.Available) { TCHAR *szData = NULL; // load the page mir_snprintf(loc, SIZEOF(loc), sData->IDSearch.SearchURL, str); str[0] = 0; if (InternetDownloadFile(loc, NULL, sData->UserAgent, &szData) == 0) { TCHAR *szInfo = szData; TCHAR* search = _tcsstr(szInfo, sData->IDSearch.NotFoundStr); // if the page is found (ie. valid ID), get the name of the city if (search == NULL) GetDataValue(&sData->IDSearch.Name, str, &szInfo); } // free memory mir_free(szData); NetlibHttpDisconnect(); } // give no station name but only ID if the search is unavailable if (str[0] != 0) SetDlgItemText(hwndDlg, IDC_NAME, str); break; } case IDC_External: // enable/disable the borwse button depending if the external log is enabled EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE), (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)); if ( !(BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) return TRUE; case IDC_BROWSE: // fall through // browse for the external log file GetDlgItemText(hwndDlg, IDC_LOG, str, SIZEOF(str)); // Initialize OPENFILENAME memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; ofn.lpstrFile = str; ofn.nMaxFile = SIZEOF(str); // set filters _tcscpy(filter, TranslateT("Text Files")); _tcscat(filter, _T(" (*.txt)")); pfilter = filter + _tcslen(filter)+1; _tcscpy(pfilter, _T("*.txt")); pfilter = pfilter + _tcslen(pfilter)+1; _tcscpy(pfilter, TranslateT("All Files")); _tcscat(pfilter, _T(" (*.*)")); pfilter = pfilter + _tcslen(pfilter)+1; _tcscpy(pfilter, _T("*.*")); pfilter = pfilter + _tcslen(pfilter)+1; *pfilter = '\0'; ofn.lpstrFilter = filter; ofn.nFilterIndex = 1; ofn.lpstrFileTitle = NULL; ofn.nMaxFileTitle = 0; ofn.lpstrInitialDir = NULL; ofn.Flags = OFN_PATHMUSTEXIST; // Display a Open dialog box and put the file name on the dialog if (GetOpenFileName(&ofn)) SetDlgItemText(hwndDlg, IDC_LOG, ofn.lpstrFile); // if there is no log file specified, disable external logging EnableWindow(GetDlgItem(hwndDlg, IDC_CHANGE), ofn.lpstrFile[0] != 0); break; case IDC_VIEW1: // view the page for more info GetDlgItemText(hwndDlg, IDC_IURL, str, SIZEOF(str)); if (str[0] == 0) return TRUE; GetDlgItemText(hwndDlg, IDC_ID, str2, SIZEOF(str2)); OpenUrl(str, str2); break; case IDC_VIEW2: // view the page for weather map GetDlgItemText(hwndDlg, IDC_MURL, str, SIZEOF(str)); if (str[0] == 0) return TRUE; GetDlgItemText(hwndDlg, IDC_ID, str2, SIZEOF(str2)); OpenUrl(str, str2); break; case IDC_RESET1: // reset the more info url to service default GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); GetSvc(str); sData = GetWIData(str); SetDlgItemTextA(hwndDlg, IDC_IURL, sData->DefaultURL); break; case IDC_RESET2: // reset the weathe map url to service default GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); GetSvc(str); sData = GetWIData(str); SetDlgItemText(hwndDlg, IDC_MURL, sData->DefaultMap); break; case IDC_SVCINFO: // display the information of the ini file used by the weather station GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); GetSvc(str); GetINIInfo(str); break; case IDC_CHANGE: // temporary disable the protocol while applying the change // start writing the new settings to database GetDlgItemText(hwndDlg, IDC_ID, str, SIZEOF(str)); db_set_ts(hContact, WEATHERPROTONAME, "ID", str); if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_DEFA)) { // if default station is set _tcscpy(opt.Default, str); opt.DefStn = hContact; db_set_ts(NULL, WEATHERPROTONAME, "Default", opt.Default); } GetDlgItemText(hwndDlg, IDC_NAME, city, SIZEOF(city)); db_set_ts(hContact, WEATHERPROTONAME, "Nick", city); mir_sntprintf(str2, SIZEOF(str2), TranslateT("Current weather information for %s."), city); if ((BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)) { GetDlgItemText(hwndDlg, IDC_LOG, str, SIZEOF(str)); db_set_ts(hContact, WEATHERPROTONAME, "Log", str); } else db_unset(hContact, WEATHERPROTONAME, "Log"); GetDlgItemText(hwndDlg, IDC_IURL, str, SIZEOF(str)); db_set_ts(hContact, WEATHERPROTONAME, "InfoURL", str); GetDlgItemText(hwndDlg, IDC_MURL, str, SIZEOF(str)); db_set_ts(hContact, WEATHERPROTONAME, "MapURL", str); db_set_w(hContact, WEATHERPROTONAME, "Status", ID_STATUS_OFFLINE); db_set_w(hContact, WEATHERPROTONAME, "StatusIcon", ID_STATUS_OFFLINE); AvatarDownloaded(hContact); db_set_ts(hContact, WEATHERPROTONAME, "About", str2); db_set_b(hContact, WEATHERPROTONAME, "History", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Internal)); db_set_b(hContact, WEATHERPROTONAME, "Overwrite", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_Overwrite)); db_set_b(hContact, WEATHERPROTONAME, "File", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_External)); db_set_b(hContact, WEATHERPROTONAME, "DPopUp", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DPop)); db_set_b(hContact, WEATHERPROTONAME, "DAutoUpdate", (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DAutoUpdate)); // re-enable the protocol and update the data for the station db_set_s(hContact, WEATHERPROTONAME, "LastCondition", "None"); UpdateSingleStation(hContact, 0); case IDCANCEL: // fall through // remove the dialog from window list and close it DestroyWindow(hwndDlg); break; } break; case WM_CLOSE: // remove the dialog from window list and close it DestroyWindow(hwndDlg); break; case WM_DESTROY: wndData = (CntSetWndDataType*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); Skin_ReleaseIcon(wndData->hFile); Skin_ReleaseIcon(wndData->hRename); Skin_ReleaseIcon(wndData->hSrchAll); Skin_ReleaseIcon(wndData->hUserDetail); mir_free(wndData); SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); WindowList_Remove(hWindowList, hwndDlg); Utils_SaveWindowPosition(hwndDlg, NULL, WEATHERPROTONAME, "EditSetting_"); break; } return FALSE; }
static VOID UpdatePrefDlgControls(PPREFERENCES_CONTEXT Context, DWORD LineID) { INT OldID, MixerID = 0; INT DeviceCbIndex; /* select the mixer */ DeviceCbIndex = SendDlgItemMessage(Context->hwndDlg, IDC_MIXERDEVICE, CB_GETCURSEL, 0, 0); if (DeviceCbIndex != CB_ERR) { MixerID = SendDlgItemMessage(Context->hwndDlg, IDC_MIXERDEVICE, CB_GETITEMDATA, DeviceCbIndex, 0); if (MixerID == CB_ERR) { MixerID = 0; } } OldID = Context->Selected; if (MixerID != OldID && SndMixerSelect(Context->Mixer, MixerID)) { Context->Selected = SndMixerGetSelection(Context->Mixer); /* update the controls */ Context->PlaybackID = (DWORD)-1; Context->RecordingID = (DWORD)-1; Context->OtherLines = 0; Context->SelectedLine = (DWORD)-1; SndMixerGetProductName(Context->Mixer, Context->DeviceName, sizeof(Context->DeviceName) / sizeof(Context->DeviceName[0])); if (SndMixerEnumLines(Context->Mixer, PrefDlgAddLine, Context)) { UINT SelBox = 0; /* enable/disable controls and make default selection */ EnableWindow(GetDlgItem(Context->hwndDlg, IDC_PLAYBACK), Context->PlaybackID != (DWORD)-1); CheckDlgButton(Context->hwndDlg, IDC_PLAYBACK, (Context->PlaybackID != (DWORD)-1 && SelBox++ == 0) ? BST_CHECKED : BST_UNCHECKED); EnableWindow(GetDlgItem(Context->hwndDlg, IDC_RECORDING), Context->RecordingID != (DWORD)-1); CheckDlgButton(Context->hwndDlg, IDC_RECORDING, (Context->RecordingID != (DWORD)-1 && SelBox++ == 0) ? BST_CHECKED : BST_UNCHECKED); if (Context->OtherLines != 0) { /* select the first item in the other lines combo box by default */ SendDlgItemMessage(Context->hwndDlg, IDC_LINE, CB_SETCURSEL, 0, 0); } EnableWindow(GetDlgItem(Context->hwndDlg, IDC_LINE), FALSE); EnableWindow(GetDlgItem(Context->hwndDlg, IDC_OTHER), Context->OtherLines != 0); CheckDlgButton(Context->hwndDlg, IDC_LINE, (Context->OtherLines != 0 && SelBox++ == 0) ? BST_CHECKED : BST_UNCHECKED); /* disable the OK button if the device doesn't have any lines */ EnableWindow(GetDlgItem(Context->hwndDlg, IDOK), Context->PlaybackID != (DWORD)-1 || Context->RecordingID != (DWORD)-1 || Context->OtherLines != 0); LineID = Context->SelectedLine; } } /* update the line sources list */ if ((MixerID != OldID && Context->SelectedLine != (DWORD)-1) || (Context->SelectedLine != LineID && LineID != (DWORD)-1)) { Context->SelectedLine = LineID; (void)ListView_DeleteAllItems(GetDlgItem(Context->hwndDlg, IDC_CONTROLS)); Context->tmp = 0; SndMixerEnumConnections(Context->Mixer, LineID, PrefDlgAddConnection, Context); } }
LRESULT CALLBACK CounterDlgHandler( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam ) { static int init; COUNTEROBJ * st; st = (COUNTEROBJ *) actobject; if ((st==NULL)||(st->type!=OB_COUNTER)) return(FALSE); switch( message ) { case WM_INITDIALOG: SCROLLINFO lpsi; lpsi.cbSize=sizeof(SCROLLINFO); lpsi.fMask=SIF_RANGE|SIF_POS; lpsi.nMin=4; lpsi.nMax=300; SetScrollInfo(GetDlgItem(hDlg,IDC_FONTSIZEBAR),SB_CTL,&lpsi, TRUE); SetScrollPos(GetDlgItem(hDlg,IDC_FONTSIZEBAR), SB_CTL,st->fontsize, TRUE); SetDlgItemInt(hDlg, IDC_FONTSIZE, st->fontsize, FALSE); SetDlgItemText(hDlg, IDC_CAPTION, st->wndcaption); SetDlgItemInt(hDlg, IDC_RESETVALUE, (int)st->resetvalue,TRUE); switch (st->mode) { case 0: CheckDlgButton(hDlg, IDC_COUNTFT,TRUE); break; case 1: CheckDlgButton(hDlg, IDC_COUNTTF,TRUE); break; case 2: CheckDlgButton(hDlg, IDC_COUNTIV,TRUE); break; case 3: CheckDlgButton(hDlg, IDC_COUNTFREQ,TRUE); break; } CheckDlgButton(hDlg, IDC_SHOWCOUNTER,st->showcounter); CheckDlgButton(hDlg, IDC_INTEGER,st->integer); return TRUE; case WM_CLOSE: EndDialog(hDlg, LOWORD(wParam)); return TRUE; break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_COUNTFT: st->mode=0; break; case IDC_COUNTTF: st->mode=1; break; case IDC_COUNTIV: st->mode=2; break; case IDC_COUNTFREQ: st->mode=3; break; case IDC_RESETCOUNTER: st->countervalue=st->resetvalue; break; case IDC_RESETVALUE: st->resetvalue=(float)GetDlgItemInt(hDlg, IDC_RESETVALUE,NULL, 1); break; case IDC_FONTCOLOR: st->fontcolor=select_color(hDlg); InvalidateRect(hDlg,NULL,FALSE); InvalidateRect(st->displayWnd,NULL,TRUE); break; case IDC_BKCOLOR: st->bkcolor=select_color(hDlg); InvalidateRect(hDlg,NULL,FALSE); InvalidateRect(st->displayWnd,NULL,TRUE); break; case IDC_CAPTION: GetDlgItemText(hDlg,IDC_CAPTION,st->wndcaption,50); SetWindowText(st->displayWnd,st->wndcaption); break; case IDC_INTEGER: st->integer=IsDlgButtonChecked(hDlg,IDC_INTEGER); InvalidateRect(st->displayWnd,NULL,TRUE); break; case IDC_SHOWCOUNTER: { int i; i=IsDlgButtonChecked(hDlg,IDC_SHOWCOUNTER); if ((st->showcounter)&&(!i)&&(st->displayWnd)) { DestroyWindow(st->displayWnd); st->displayWnd=NULL; } if ((!st->showcounter)&&(i)) { if(!(st->displayWnd=CreateWindow("Counter_Class", "Counter", WS_THICKFRAME| WS_CLIPCHILDREN,st->left, st->top, st->right-st->left, st->bottom-st->top, NULL, NULL, hInst, NULL))) report_error("can't create Counter Window"); else { ShowWindow( st->displayWnd, TRUE ); UpdateWindow( st->displayWnd ); } } st->showcounter=i; } break; } return TRUE; case WM_HSCROLL: if (lParam == (long) GetDlgItem(hDlg,IDC_FONTSIZEBAR)) { int nNewPos=get_scrollpos(wParam,lParam); SetDlgItemInt(hDlg, IDC_FONTSIZE, nNewPos, TRUE); st->fontsize=nNewPos; if (st->font) DeleteObject(st->font); if (!(st->font = CreateFont(-MulDiv(st->fontsize, GetDeviceCaps(GetDC(NULL), LOGPIXELSY), 72), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "Arial"))) report_error("Font creation failed!"); InvalidateRect(st->displayWnd, NULL, TRUE); } break; case WM_SIZE: case WM_MOVE: update_toolbox_position(hDlg); case WM_PAINT: color_button(GetDlgItem(hDlg,IDC_FONTCOLOR),st->fontcolor); color_button(GetDlgItem(hDlg,IDC_BKCOLOR),st->bkcolor); break; } return FALSE; }
// CDlgSAPrefs20 message handlers BOOL CDlgSAPrefs20::OnInitDialog() { CheckDlgButton(IDC_DEBUG_AUTOCONNECTOR , prefs.debug_autoconnector() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_AUTOPLAYER, prefs.debug_autoplayer() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_HEARTBEAT, prefs.debug_heartbeat() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_PRWIN, prefs.debug_prwin() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_ICM, prefs.debug_icm() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_OCCLUSSION, prefs.debug_occlusionchecker() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_POKERTRACKER, prefs.debug_pokertracker() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_REBUY, prefs.debug_rebuy() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_REPLAYFRAMES, prefs.debug_replayframes() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_SCRAPER, prefs.debug_scraper() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_SESSIONCOUNTER, prefs.debug_sessioncounter() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_STABLEFRAMESCOUNTER, prefs.debug_stableframescounter() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_SYMBOLENGINE, prefs.debug_symbolengine() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_BLINDLOCKING, prefs.debug_blindlocking() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_MEMORY_SYMBOLS, prefs.debug_memorysymbols() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_TABLEMAP_LOADER, prefs.debug_tablemap_loader() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_FILESYSTEM_MONITOR, prefs.debug_filesystem_monitor() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_TABLE_POSITIONER, prefs.debug_table_positioner() ? MF_CHECKED : MF_UNCHECKED); CheckDlgButton(IDC_DEBUG_ALLTHEREST, prefs.debug_alltherest() ? MF_CHECKED : MF_UNCHECKED); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
INT_PTR CALLBACK ModifyDlgProc(HWND hwnd, UINT iMsg, WPARAM wParam, LPARAM lParam) { static size_w len; HWND hwndHV = GetActiveHexView(g_hwndMain); static BOOL fHexLength = FALSE; static int nLastOperand = 0; static int nLastOperation = 0; static BOOL fBigEndian = FALSE; int basetype; static const int SearchTypeFromBaseType[] = { SEARCHTYPE_BYTE, SEARCHTYPE_WORD, SEARCHTYPE_DWORD, SEARCHTYPE_QWORD, SEARCHTYPE_BYTE, SEARCHTYPE_WORD, SEARCHTYPE_DWORD, SEARCHTYPE_QWORD, SEARCHTYPE_FLOAT, SEARCHTYPE_DOUBLE, }; switch (iMsg) { case WM_INITDIALOG: AddComboStringList(GetDlgItem(hwnd, IDC_MODIFY_DATATYPE), szTypeList, 0); AddComboStringList(GetDlgItem(hwnd, IDC_MODIFY_OPERATION), szOpList, nLastOperation); SetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, nLastOperand, fHexLength ? 16 : 10, FALSE); CheckDlgButton(hwnd, IDC_HEX, fHexLength ? BST_CHECKED : BST_UNCHECKED); CheckDlgButton(hwnd, IDC_ENDIAN, fBigEndian ? BST_CHECKED : BST_UNCHECKED); //len = HexView_GetSelSize(hwndHV); //SetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, len, fHexLength ? 16 : 10, FALSE); CenterWindow(hwnd); return TRUE; case WM_CLOSE: EndDialog(hwnd, FALSE); return TRUE; case WM_COMMAND: switch(LOWORD(wParam)) { case IDC_MODIFY_OPERATION: case IDC_MODIFY_OPERAND: case IDC_MODIFY_NUMBYTES: nLastOperation = (int)SendDlgItemMessage(hwnd, IDC_MODIFY_OPERATION, CB_GETCURSEL, 0, 0); nLastOperand = (int)GetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, fHexLength ? 16 : 10); len = GetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, fHexLength ? 16 : 10); return TRUE; case IDC_ENDIAN: fBigEndian = IsDlgButtonChecked(hwnd, IDC_ENDIAN); return TRUE; case IDC_HEX: fHexLength = IsDlgButtonChecked(hwnd, IDC_HEX); /* len = HexView_GetSelSize(hwndHV); SetDlgItemBaseInt(hwnd, IDC_MODIFY_NUMBYTES, len, fHexLength ? 16 : 10, FALSE); */ SetDlgItemBaseInt(hwnd, IDC_MODIFY_OPERAND, nLastOperand, fHexLength ? 16 : 10, FALSE); SendDlgItemMessage(hwnd, IDC_MODIFY_OPERAND, EM_SETSEL, 0, -1); SetDlgItemFocus(hwnd, IDC_MODIFY_OPERAND); return TRUE; case IDOK: // get the basetype we are using basetype = (int)SendDlgItemMessage(hwnd, IDC_INSERT_DATATYPE, CB_GETCURSEL, 0, 0); basetype = SearchTypeFromBaseType[basetype]; // get the operand in raw-byte format, ensure it is always little-endian // as we must do these calculations using the native byte ordering format operandLen = sizeof(operandData); UpdateSearchData(GetDlgItem(hwnd, IDC_MODIFY_OPERAND), basetype, FALSE, operandData, &operandLen); HexView_GetSelSize(hwndHV, &len); ModifyHexViewData(hwndHV, nLastOperation, operandData, len, basetype, fBigEndian); EndDialog(hwnd, TRUE); return TRUE; case IDCANCEL: EndDialog(hwnd, FALSE); return TRUE; default: return FALSE; } case WM_HELP: return HandleContextHelp(hwnd, lParam, IDD_TRANSFORM); default: break; } return FALSE; }
static BOOL CALLBACK IEViewBasicOptDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { int i; BOOL bChecked; char path[MAX_PATH]; switch (msg) { case WM_INITDIALOG: { char *path; TranslateDialogDefault(hwndDlg); bChecked = FALSE; if (Options::getBkgImageFlags() & Options::BKGIMAGE_ENABLED) { bChecked = TRUE; CheckDlgButton(hwndDlg, IDC_BACKGROUND_IMAGE, TRUE); } EnableWindow(GetDlgItem(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_BACKGROUND_IMAGE), bChecked); if (Options::getBkgImageFlags() & Options::BKGIMAGE_SCROLL) { CheckDlgButton(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE, TRUE); } path = (char *)Options::getBkgImageFile(); if (path != NULL) { SetDlgItemText(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path); } bChecked = FALSE; if (Options::getExternalCSSFlags() & Options::EXTERNALCSS_ENABLED) { bChecked = TRUE; CheckDlgButton(hwndDlg, IDC_EXTERNALCSS, TRUE); } EnableWindow(GetDlgItem(hwndDlg, IDC_EXTERNALCSS_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_EXTERNALCSS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_EXTERNALCSS_RTL), bChecked); path = (char *)Options::getExternalCSSFile(); if (path != NULL) { SetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME, path); } path = (char *)Options::getExternalCSSFileRTL(); if (path != NULL) { SetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path); } return TRUE; } case WM_COMMAND: { switch (LOWORD(wParam)) { case IDC_BACKGROUND_IMAGE_FILENAME: case IDC_EXTERNALCSS_FILENAME: case IDC_EXTERNALCSS_FILENAME_RTL: if ((HWND)lParam==GetFocus() && HIWORD(wParam)==EN_CHANGE) SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_SCROLL_BACKGROUND_IMAGE: SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_BACKGROUND_IMAGE: bChecked = IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE); EnableWindow(GetDlgItem(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_BACKGROUND_IMAGE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE), bChecked); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_EXTERNALCSS: bChecked = IsDlgButtonChecked(hwndDlg, IDC_EXTERNALCSS); EnableWindow(GetDlgItem(hwndDlg, IDC_EXTERNALCSS_FILENAME), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_EXTERNALCSS), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_BROWSE_EXTERNALCSS_RTL), bChecked); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); break; case IDC_BROWSE_BACKGROUND_IMAGE: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME); ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "All Images (*.jpg,*.gif,*.png,*.bmp)\0*.jpg;*.gif;*.png;*.bmp\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "jpg"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg,IDC_BACKGROUND_IMAGE_FILENAME,path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; case IDC_BROWSE_EXTERNALCSS: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "Style Sheet (*.css)\0*.css\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "css"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME, path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; case IDC_BROWSE_EXTERNALCSS_RTL: { OPENFILENAME ofn={0}; GetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path)); ofn.lStructSize = sizeof(OPENFILENAME);//_SIZE_VERSION_400; ofn.hwndOwner = hwndDlg; ofn.hInstance = NULL; ofn.lpstrFilter = "Style Sheet (*.css)\0*.css\0All Files\0*.*\0\0"; ofn.lpstrFile = path; ofn.Flags = OFN_FILEMUSTEXIST; ofn.nMaxFile = sizeof(path); ofn.nMaxFileTitle = MAX_PATH; ofn.lpstrDefExt = "css"; if(GetOpenFileName(&ofn)) { SetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path); SendMessage(GetParent(GetParent(hwndDlg)), PSM_CHANGED, 0, 0); } } break; } } break; case WM_NOTIFY: { switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: i = 0; if (IsDlgButtonChecked(hwndDlg, IDC_BACKGROUND_IMAGE)) { i |= Options::BKGIMAGE_ENABLED; } if (IsDlgButtonChecked(hwndDlg, IDC_SCROLL_BACKGROUND_IMAGE)) { i |= Options::BKGIMAGE_SCROLL; } Options::setBkgImageFlags(i); GetDlgItemText(hwndDlg, IDC_BACKGROUND_IMAGE_FILENAME, path, sizeof(path)); Options::setBkgImageFile(path); i = 0; if (IsDlgButtonChecked(hwndDlg, IDC_EXTERNALCSS)) { i |= Options::BKGIMAGE_ENABLED; } Options::setExternalCSSFlags(i); GetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME, path, sizeof(path)); Options::setExternalCSSFile(path); GetDlgItemText(hwndDlg, IDC_EXTERNALCSS_FILENAME_RTL, path, sizeof(path)); Options::setExternalCSSFileRTL(path); return TRUE; } } break; case WM_DESTROY: break; } return FALSE; }