static int OnModulesLoaded(WPARAM, LPARAM) { ReloadGlobals(); LoadGlobalIcons(); LoadMsgLogIcons(); ModuleLoad(0, 0); CMenuItem mi; SET_UID(mi, 0x58d8dc1, 0x1c25, 0x49c0, 0xb8, 0x7c, 0xa3, 0x22, 0x2b, 0x3d, 0xf1, 0xd8); mi.position = -2000090000; mi.flags = CMIF_DEFAULT; mi.hIcolibItem = Skin_GetIconHandle(SKINICON_EVENT_MESSAGE); mi.name.a = LPGEN("&Message"); mi.pszService = MS_MSG_SENDMESSAGE; hMsgMenuItem = Menu_AddContactMenuItem(&mi); IcoLib_ReleaseIcon((HICON)mi.hIcolibItem); HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); HookEvent(ME_FONT_RELOAD, FontServiceFontsChanged); HookEvent(ME_MSG_ICONPRESSED, StatusIconPressed); HookEvent(ME_MC_DEFAULTTCHANGED, MetaContactChanged); RestoreUnreadMessageAlerts(); OptionsInit(); RegisterStatusIcons(); return 0; }
void InitGlobals() { g_dat = (struct GlobalMessageData *)malloc(sizeof(struct GlobalMessageData)); g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_hAck = HookEvent(ME_PROTO_ACK, ackevent); ReloadGlobals(); g_dat->hParent = NULL; g_dat->protoNum = 0; g_dat->protoNames = NULL; g_dat->hIconList = NULL; }
void InitGlobals() { g_dat.hMessageWindowList = WindowList_Create(); HookEvent(ME_DB_EVENT_ADDED, dbaddedevent); HookEvent(ME_PROTO_ACK, ackevent); HookEvent(ME_SKIN2_ICONSCHANGED, IconsChanged); HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); HookEvent(ME_SYSTEM_SHUTDOWN, OnShutdown); HookEvent(ME_MC_DEFAULTTCHANGED, OnMetaChanged); ReloadGlobals(); InitIcons(); }
void InitGlobals() { g_dat = (struct GlobalMessageData *)malloc(sizeof(struct GlobalMessageData)); g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_dat->hMenuANSIEncoding = CreatePopupMenu(); AppendMenuA(g_dat->hMenuANSIEncoding, MF_STRING, 500, Translate("Default codepage")); AppendMenuA(g_dat->hMenuANSIEncoding, MF_SEPARATOR, 0, 0); EnumSystemCodePagesA(LangAddCallback, CP_INSTALLED); g_hAck = HookEvent(ME_PROTO_ACK, ackevent); ReloadGlobals(); g_dat->hParent = NULL; g_dat->protoNum = 0; g_dat->protoNames = NULL; g_dat->hIconList = NULL; }
void InitGlobals() { g_dat = (struct GlobalMessageData *)mir_alloc(sizeof(struct GlobalMessageData)); g_dat->hMessageWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_dat->hParentWindowList = (HANDLE) CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0); g_dat->hMenuANSIEncoding = CreatePopupMenu(); AppendMenu(g_dat->hMenuANSIEncoding, MF_STRING, 500, TranslateT("Default codepage")); AppendMenuA(g_dat->hMenuANSIEncoding, MF_SEPARATOR, 0, 0); EnumSystemCodePagesA(LangAddCallback, CP_INSTALLED); g_hAck = HookEvent(ME_PROTO_ACK, ackevent); ReloadGlobals(); g_dat->lastParent = NULL; g_dat->lastChatParent = NULL; g_dat->protoNum = 0; g_dat->protoNames = NULL; g_dat->hTabIconList = NULL; g_dat->hButtonIconList = ImageList_Create(16, 16, IsWinVerXPPlus() ? ILC_COLOR32 | ILC_MASK : ILC_COLOR8 | ILC_MASK, (g_dat->protoNum + 1) * 12 + 8, 0); g_dat->draftList = NULL; }
static int SplitmsgModulesLoaded(WPARAM wParam, LPARAM lParam) { CLISTMENUITEM mi; PROTOCOLDESCRIPTOR **protocol; int protoCount, i; ReloadGlobals(); RegisterIcoLibIcons(); RegisterFontServiceFonts(); LoadGlobalIcons(); LoadMsgLogIcons(); LoadProtocolIcons(); ZeroMemory(&mi, sizeof(mi)); mi.cbSize = sizeof(mi); mi.position = -2000090000; mi.flags = 0; mi.hIcon = LoadSkinnedIcon(SKINICON_EVENT_MESSAGE); mi.pszName = Translate("&Message"); mi.pszService = MS_MSG_SENDMESSAGE; CallService(MS_PROTO_ENUMPROTOCOLS, (WPARAM) & protoCount, (LPARAM) & protocol); for (i = 0; i < protoCount; i++) { if (protocol[i]->type != PROTOTYPE_PROTOCOL) continue; if (CallProtoService(protocol[i]->szName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_IMSEND) { mi.pszContactOwner = protocol[i]->szName; hMsgMenuItem = realloc(hMsgMenuItem, (hMsgMenuItemCount + 1) * sizeof(HANDLE)); hMsgMenuItem[hMsgMenuItemCount++] = (HANDLE) CallService(MS_CLIST_ADDCONTACTMENUITEM, 0, (LPARAM) & mi); } } HookEvent(ME_CLIST_DOUBLECLICKED, SendMessageCommand); HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_IEVIEW_OPTIONSCHANGED, SmileySettingsChanged); HookEvent(ME_AV_MYAVATARCHANGED, MyAvatarChanged); HookEvent(ME_AV_AVATARCHANGED, AvatarChanged); RestoreUnreadMessageAlerts(); return 0; }
static BOOL CALLBACK DlgProcTypeOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static HANDLE hItemNew, hItemUnknown; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); { CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); cii.flags = CLCIIF_GROUPFONT | CLCIIF_CHECKBOX; cii.pszText = Translate("** New contacts **"); hItemNew = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); cii.pszText = Translate("** Unknown contacts **"); hItemUnknown = (HANDLE) SendDlgItemMessage(hwndDlg, IDC_CLIST, CLM_ADDINFOITEM, 0, (LPARAM) & cii); } SetWindowLong(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE, GetWindowLong(GetDlgItem(hwndDlg, IDC_CLIST), GWL_STYLE) | (CLS_SHOWHIDDEN) | (CLS_NOHIDEOFFLINE)); ResetCList(hwndDlg); RebuildList(hwndDlg, hItemNew, hItemUnknown); CheckDlgButton(hwndDlg, IDC_SHOWNOTIFY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, SRMSGDEFSET_SHOWTYPING)); CheckDlgButton(hwndDlg, IDC_TYPEWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, SRMSGDEFSET_SHOWTYPINGWIN)); CheckDlgButton(hwndDlg, IDC_TYPETRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, SRMSGDEFSET_SHOWTYPINGNOWIN)); CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)); CheckDlgButton(hwndDlg, IDC_NOTIFYBALLOON, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, SRMSGDEFSET_SHOWTYPINGCLIST)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); CheckDlgButton(hwndDlg, IDC_NOTIFYTRAY, BST_CHECKED); SetWindowTextA(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), Translate("Show balloon popup (unsupported system)")); } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_TYPETRAY: if (IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)) { if (!ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), TRUE); } } else { EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), FALSE); } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case IDC_SHOWNOTIFY: EnableWindow(GetDlgItem(hwndDlg, IDC_TYPEWIN), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_TYPETRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYTRAY), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); EnableWindow(GetDlgItem(hwndDlg, IDC_NOTIFYBALLOON), IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY) && ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)); //fall-thru case IDC_TYPEWIN: case IDC_NOTIFYTRAY: case IDC_NOTIFYBALLOON: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; case WM_NOTIFY: switch (((NMHDR *) lParam)->idFrom) { case IDC_CLIST: switch (((NMHDR *) lParam)->code) { case CLN_OPTIONSCHANGED: ResetCList(hwndDlg); break; case CLN_CHECKCHANGED: SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } break; case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { SaveList(hwndDlg, hItemNew, hItemUnknown); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPING, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWNOTIFY)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPEWIN)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGNOWIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TYPETRAY)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTYPINGCLIST, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_NOTIFYTRAY)); ReloadGlobals(); WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); } } break; } break; } return FALSE; }
static BOOL CALLBACK DlgProcLogOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { static HBRUSH hBkgColourBrush; switch (msg) { case WM_INITDIALOG: TranslateDialogDefault(hwndDlg); switch (DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, SRMSGDEFSET_LOADHISTORY)) { case LOADHISTORY_UNREAD: CheckDlgButton(hwndDlg, IDC_LOADUNREAD, BST_CHECKED); break; case LOADHISTORY_COUNT: CheckDlgButton(hwndDlg, IDC_LOADCOUNT, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), TRUE); break; case LOADHISTORY_TIME: CheckDlgButton(hwndDlg, IDC_LOADTIME, BST_CHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), TRUE); EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), TRUE); break; } SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETRANGE, 0, MAKELONG(100, 0)); SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, SRMSGDEFSET_LOADCOUNT)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETRANGE, 0, MAKELONG(12 * 60, 0)); SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_SETPOS, 0, DBGetContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, SRMSGDEFSET_LOADTIME)); CheckDlgButton(hwndDlg, IDC_SHOWLOGICONS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, SRMSGDEFSET_SHOWLOGICONS)); CheckDlgButton(hwndDlg, IDC_SHOWNAMES, !DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES)); CheckDlgButton(hwndDlg, IDC_SHOWTIMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, SRMSGDEFSET_SHOWTIME)); CheckDlgButton(hwndDlg, IDC_SHOWSECONDS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, SRMSGDEFSET_SHOWSECONDS)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); CheckDlgButton(hwndDlg, IDC_SHOWDATES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, SRMSGDEFSET_SHOWDATE)); CheckDlgButton(hwndDlg, IDC_USELONGDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, SRMSGDEFSET_USELONGDATE)); CheckDlgButton(hwndDlg, IDC_USERELATIVEDATE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, SRMSGDEFSET_USERELATIVEDATE)); EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); // if (!ServiceExists(MS_IEVIEW_WINDOW)) { // EnableWindow(GetDlgItem(hwndDlg, IDC_USEIEVIEW), FALSE); // } // CheckDlgButton(hwndDlg, IDC_USEIEVIEW, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, SRMSGDEFSET_USEIEVIEW)); CheckDlgButton(hwndDlg, IDC_GROUPMESSAGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, SRMSGDEFSET_GROUPMESSAGES)); CheckDlgButton(hwndDlg, IDC_MARKFOLLOWUPS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, SRMSGDEFSET_MARKFOLLOWUPS)); CheckDlgButton(hwndDlg, IDC_MESSAGEONNEWLINE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, SRMSGDEFSET_MESSAGEONNEWLINE)); CheckDlgButton(hwndDlg, IDC_DRAWLINES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, SRMSGDEFSET_DRAWLINES)); EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES)); EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES)); CheckDlgButton(hwndDlg, IDC_SHOWSTATUSCHANGES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, SRMSGDEFSET_SHOWSTATUSCH)); SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SRMSGDEFSET_BKGCOLOUR)); SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_SETDEFAULTCOLOUR, 0, SRMSGDEFSET_BKGCOLOUR); SendDlgItemMessage(hwndDlg, IDC_BKGINPUT, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SRMSGDEFSET_INPUTBKGCOLOUR)); SendDlgItemMessage(hwndDlg, IDC_BKGINPUT, CPM_SETDEFAULTCOLOUR, 0, SRMSGDEFSET_INPUTBKGCOLOUR); SendDlgItemMessage(hwndDlg, IDC_BKGINCOMING, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SRMSGDEFSET_INCOMINGBKGCOLOUR)); SendDlgItemMessage(hwndDlg, IDC_BKGINCOMING, CPM_SETDEFAULTCOLOUR, 0, SRMSGDEFSET_INCOMINGBKGCOLOUR); SendDlgItemMessage(hwndDlg, IDC_BKGOUTGOING, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SRMSGDEFSET_OUTGOINGBKGCOLOUR)); SendDlgItemMessage(hwndDlg, IDC_BKGOUTGOING, CPM_SETDEFAULTCOLOUR, 0, SRMSGDEFSET_OUTGOINGBKGCOLOUR); SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_SETCOLOUR, 0, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SRMSGDEFSET_LINECOLOUR)); hBkgColourBrush = CreateSolidBrush(SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0)); { int i; LOGFONTA lf; for (i = 0; i < sizeof(fontOptionsList) / sizeof(fontOptionsList[0]); i++) { LoadMsgDlgFont(i, &lf, &fontOptionsList[i].colour); lstrcpyA(fontOptionsList[i].szFace, lf.lfFaceName); fontOptionsList[i].size = (char) lf.lfHeight; fontOptionsList[i].style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fontOptionsList[i].charset = lf.lfCharSet; //I *think* some OSs will fail LB_ADDSTRING if lParam==0 SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_ADDSTRING, 0, i + 1); } SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETSEL, TRUE, 0); SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETCOLOUR, 0, fontOptionsList[0].colour); SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, fontOptionsList[0].defColour); } return TRUE; case WM_CTLCOLORLISTBOX: SetBkColor((HDC) wParam, SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0)); return (BOOL) hBkgColourBrush; case WM_MEASUREITEM: { MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *) lParam; HFONT hFont, hoFont; HDC hdc; SIZE fontSize; int iItem = mis->itemData - 1; hFont = CreateFontA(fontOptionsList[iItem].size, 0, 0, 0, fontOptionsList[iItem].style & FONTF_BOLD ? FW_BOLD : FW_NORMAL, fontOptionsList[iItem].style & FONTF_ITALIC ? 1 : 0, 0, 0, fontOptionsList[iItem].charset, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontOptionsList[iItem].szFace); hdc = GetDC(GetDlgItem(hwndDlg, mis->CtlID)); hoFont = (HFONT) SelectObject(hdc, hFont); GetTextExtentPoint32A(hdc, fontOptionsList[iItem].szDescr, lstrlenA(fontOptionsList[iItem].szDescr), &fontSize); SelectObject(hdc, hoFont); ReleaseDC(GetDlgItem(hwndDlg, mis->CtlID), hdc); DeleteObject(hFont); mis->itemWidth = fontSize.cx; mis->itemHeight = fontSize.cy; return TRUE; } case WM_DRAWITEM: { DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *) lParam; HFONT hFont, hoFont; HBRUSH hBrush; char *pszText; int iItem = dis->itemData - 1; COLORREF color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0); switch (iItem) { case 1: case 5: case 6: case 7: case 9: color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_BKGINCOMING, CPM_GETCOLOUR, 0, 0); break; case 0: case 2: case 3: case 4: color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_BKGOUTGOING, CPM_GETCOLOUR, 0, 0); break; case 8: color = (COLORREF) SendDlgItemMessage(hwndDlg, IDC_BKGINPUT, CPM_GETCOLOUR, 0, 0); break; } hBrush = CreateSolidBrush(color); hFont = CreateFontA(fontOptionsList[iItem].size, 0, 0, 0, fontOptionsList[iItem].style & FONTF_BOLD ? FW_BOLD : FW_NORMAL, fontOptionsList[iItem].style & FONTF_ITALIC ? 1 : 0, 0, 0, fontOptionsList[iItem].charset, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, fontOptionsList[iItem].szFace); hoFont = (HFONT) SelectObject(dis->hDC, hFont); SetBkMode(dis->hDC, TRANSPARENT); FillRect(dis->hDC, &dis->rcItem, hBrush); if (dis->itemState & ODS_SELECTED) FrameRect(dis->hDC, &dis->rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); SetTextColor(dis->hDC, fontOptionsList[iItem].colour); pszText = Translate(fontOptionsList[iItem].szDescr); TextOutA(dis->hDC, dis->rcItem.left, dis->rcItem.top, pszText, lstrlenA(pszText)); SelectObject(dis->hDC, hoFont); DeleteObject(hFont); DeleteObject(hBrush); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_LOADUNREAD: case IDC_LOADCOUNT: case IDC_LOADTIME: EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADCOUNTSPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMEN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME)); EnableWindow(GetDlgItem(hwndDlg, IDC_LOADTIMESPIN), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME)); EnableWindow(GetDlgItem(hwndDlg, IDC_STMINSOLD), IsDlgButtonChecked(hwndDlg, IDC_LOADTIME)); break; case IDC_SHOWTIMES: EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWSECONDS), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); EnableWindow(GetDlgItem(hwndDlg, IDC_SHOWDATES), IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); case IDC_SHOWDATES: EnableWindow(GetDlgItem(hwndDlg, IDC_USELONGDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); EnableWindow(GetDlgItem(hwndDlg, IDC_USERELATIVEDATE), IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES) && IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); break; case IDC_GROUPMESSAGES: EnableWindow(GetDlgItem(hwndDlg, IDC_MARKFOLLOWUPS), IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES)); break; case IDC_DRAWLINES: EnableWindow(GetDlgItem(hwndDlg, IDC_LINECOLOUR), IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES)); break; case IDC_BKGCOLOUR: DeleteObject(hBkgColourBrush); hBkgColourBrush = CreateSolidBrush(SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0)); case IDC_BKGINCOMING: case IDC_BKGOUTGOING: case IDC_BKGINPUT: InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); break; case IDC_FONTLIST: if (HIWORD(wParam) == LBN_SELCHANGE) { if (SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELCOUNT, 0, 0) > 1) { SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETCOLOUR, 0, GetSysColor(COLOR_3DFACE)); SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, GetSysColor(COLOR_WINDOWTEXT)); } else { int i = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1; SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETCOLOUR, 0, fontOptionsList[i].colour); SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_SETDEFAULTCOLOUR, 0, fontOptionsList[i].defColour); } } if (HIWORD(wParam) != LBN_DBLCLK) return TRUE; //fall through case IDC_CHOOSEFONT: { CHOOSEFONTA cf = { 0 }; LOGFONTA lf = { 0 }; int i = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETCURSEL, 0, 0), 0) - 1; lf.lfHeight = fontOptionsList[i].size; lf.lfWeight = fontOptionsList[i].style & FONTF_BOLD ? FW_BOLD : FW_NORMAL; lf.lfItalic = fontOptionsList[i].style & FONTF_ITALIC ? 1 : 0; lf.lfCharSet = fontOptionsList[i].charset; lf.lfOutPrecision = OUT_DEFAULT_PRECIS; lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; lf.lfQuality = DEFAULT_QUALITY; lf.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; lstrcpyA(lf.lfFaceName, fontOptionsList[i].szFace); cf.lStructSize = sizeof(cf); cf.hwndOwner = hwndDlg; cf.lpLogFont = &lf; cf.Flags = CF_FORCEFONTEXIST | CF_INITTOLOGFONTSTRUCT | CF_SCREENFONTS; if (ChooseFontA(&cf)) { int selItems[sizeof(fontOptionsList) / sizeof(fontOptionsList[0])]; int sel, selCount; selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, sizeof(fontOptionsList) / sizeof(fontOptionsList[0]), (LPARAM) selItems); for (sel = 0; sel < selCount; sel++) { i = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[sel], 0) - 1; fontOptionsList[i].size = (char) lf.lfHeight; fontOptionsList[i].style = (lf.lfWeight >= FW_BOLD ? FONTF_BOLD : 0) | (lf.lfItalic ? FONTF_ITALIC : 0); fontOptionsList[i].charset = lf.lfCharSet; lstrcpyA(fontOptionsList[i].szFace, lf.lfFaceName); { MEASUREITEMSTRUCT mis = { 0 }; mis.CtlID = IDC_FONTLIST; mis.itemData = i + 1; SendMessage(hwndDlg, WM_MEASUREITEM, 0, (LPARAM) & mis); SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_SETITEMHEIGHT, selItems[sel], mis.itemHeight); } } InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, TRUE); break; } return TRUE; } case IDC_FONTCOLOUR: { int selItems[sizeof(fontOptionsList) / sizeof(fontOptionsList[0])]; int sel, selCount, i; selCount = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETSELITEMS, sizeof(fontOptionsList) / sizeof(fontOptionsList[0]), (LPARAM) selItems); for (sel = 0; sel < selCount; sel++) { i = SendDlgItemMessage(hwndDlg, IDC_FONTLIST, LB_GETITEMDATA, selItems[sel], 0) - 1; fontOptionsList[i].colour = SendDlgItemMessage(hwndDlg, IDC_FONTCOLOUR, CPM_GETCOLOUR, 0, 0); } InvalidateRect(GetDlgItem(hwndDlg, IDC_FONTLIST), NULL, FALSE); break; } case IDC_LOADCOUNTN: case IDC_LOADTIMEN: if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return TRUE; break; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->idFrom) { case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: if (IsDlgButtonChecked(hwndDlg, IDC_LOADCOUNT)) DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_COUNT); else if (IsDlgButtonChecked(hwndDlg, IDC_LOADTIME)) DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_TIME); else DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LOADHISTORY, LOADHISTORY_UNREAD); DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADCOUNT, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADCOUNTSPIN, UDM_GETPOS, 0, 0)); DBWriteContactSettingWord(NULL, SRMMMOD, SRMSGSET_LOADTIME, (WORD) SendDlgItemMessage(hwndDlg, IDC_LOADTIMESPIN, UDM_GETPOS, 0, 0)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWLOGICONS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWLOGICONS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDENAMES, (BYTE) ! IsDlgButtonChecked(hwndDlg, IDC_SHOWNAMES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTIME, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTIMES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSECONDS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSECONDS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWDATES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USELONGDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USELONGDATE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USERELATIVEDATE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USERELATIVEDATE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSCH, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSCHANGES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_GROUPMESSAGES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_GROUPMESSAGES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MARKFOLLOWUPS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MARKFOLLOWUPS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_MESSAGEONNEWLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_MESSAGEONNEWLINE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DRAWLINES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DRAWLINES)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_BKGCOLOUR, SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INPUTBKGCOLOUR, SendDlgItemMessage(hwndDlg, IDC_BKGINPUT, CPM_GETCOLOUR, 0, 0)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INCOMINGBKGCOLOUR, SendDlgItemMessage(hwndDlg, IDC_BKGINCOMING, CPM_GETCOLOUR, 0, 0)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_OUTGOINGBKGCOLOUR, SendDlgItemMessage(hwndDlg, IDC_BKGOUTGOING, CPM_GETCOLOUR, 0, 0)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_LINECOLOUR, SendDlgItemMessage(hwndDlg, IDC_LINECOLOUR, CPM_GETCOLOUR, 0, 0)); // DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USEIEVIEW, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USEIEVIEW)); { int i; char str[32]; for (i = 0; i < sizeof(fontOptionsList) / sizeof(fontOptionsList[0]); i++) { wsprintfA(str, "SRMFont%d", i); DBWriteContactSettingString(NULL, SRMMMOD, str, fontOptionsList[i].szFace); wsprintfA(str, "SRMFont%dSize", i); DBWriteContactSettingByte(NULL, SRMMMOD, str, fontOptionsList[i].size); wsprintfA(str, "SRMFont%dSty", i); DBWriteContactSettingByte(NULL, SRMMMOD, str, fontOptionsList[i].style); wsprintfA(str, "SRMFont%dSet", i); DBWriteContactSettingByte(NULL, SRMMMOD, str, fontOptionsList[i].charset); wsprintfA(str, "SRMFont%dCol", i); DBWriteContactSettingDword(NULL, SRMMMOD, str, fontOptionsList[i].colour); } } FreeMsgLogIcons(); LoadMsgLogIcons(); ReloadGlobals(); WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); return TRUE; } break; } break; case WM_DESTROY: DeleteObject(hBkgColourBrush); break; } return FALSE; }
static BOOL CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_INITDIALOG: { int bChecked; DWORD msgTimeout, avatarHeight; TranslateDialogDefault(hwndDlg); CheckDlgButton(hwndDlg, IDC_SHOWBUTTONLINE, g_dat->flags&SMF_SHOWBTNS); CheckDlgButton(hwndDlg, IDC_AUTOPOPUP, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP)); CheckDlgButton(hwndDlg, IDC_STAYMINIMIZED, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED)); CheckDlgButton(hwndDlg, IDC_AUTOMIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN)); CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, SRMSGDEFSET_AUTOCLOSE)); CheckDlgButton(hwndDlg, IDC_SAVEPERCONTACT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT)); CheckDlgButton(hwndDlg, IDC_SAVESPLITTERPERCONTACT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVESPLITTERPERCONTACT, SRMSGDEFSET_SAVESPLITTERPERCONTACT)); CheckDlgButton(hwndDlg, IDC_CASCADE, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE)); CheckDlgButton(hwndDlg, IDC_SENDONENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER)); CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, SRMSGDEFSET_SENDONDBLENTER)); CheckDlgButton(hwndDlg, IDC_STATUSWIN, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, SRMSGDEFSET_STATUSICON)); CheckDlgButton(hwndDlg, IDC_SHOWSTATUSBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR)); CheckDlgButton(hwndDlg, IDC_SHOWTITLEBAR, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, SRMSGDEFSET_SHOWTITLEBAR)); CheckDlgButton(hwndDlg, IDC_SHOWPROGRESS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, SRMSGDEFSET_SHOWPROGRESS)); CheckDlgButton(hwndDlg, IDC_USETABS, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, SRMSGDEFSET_USETABS)); CheckDlgButton(hwndDlg, IDC_TABSATBOTTOM, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, SRMSGDEFSET_TABSATBOTTOM)); CheckDlgButton(hwndDlg, IDC_CREATETABSINBKG, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CREATETABSINBKG, SRMSGDEFSET_CREATETABSINBKG)); CheckDlgButton(hwndDlg, IDC_LIMITNAMES, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, SRMSGDEFSET_LIMITNAMES)); CheckDlgButton(hwndDlg, IDC_HIDEONETAB, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, SRMSGDEFSET_HIDEONETAB)); CheckDlgButton(hwndDlg, IDC_TRANSPARENCY, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, SRMSGDEFSET_USETRANSPARENCY)); SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255)); SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SRMSGDEFSET_ACTIVEALPHA)); SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETRANGE, FALSE, MAKELONG(0,255)); SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_SETPOS, TRUE, DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SRMSGDEFSET_INACTIVEALPHA)); { char str[10]; sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)/255)); SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str); sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)/255)); SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str); } if (pSetLayeredWindowAttributes == NULL) { EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCY), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), FALSE); } else { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked); } CheckDlgButton(hwndDlg, IDC_AVATARSUPPORT, g_dat->flags&SMF_AVATAR); // EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITAVATARH), FALSE); // EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), FALSE); CheckDlgButton(hwndDlg, IDC_LIMITAVATARH, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, SRMSGDEFSET_LIMITAVHEIGHT)); avatarHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, SRMSGDEFSET_AVHEIGHT); SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, avatarHeight, FALSE); avatarHeight = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHTMIN, SRMSGDEFSET_AVHEIGHTMIN); SetDlgItemInt(hwndDlg, IDC_AVATARHEIGHTMIN, avatarHeight, FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITAVATARH), IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); if (!IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHTMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT1), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT2), FALSE); } else { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHTMIN), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT1), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT2), bChecked); } CheckDlgButton(hwndDlg, IDC_CTRLSUPPORT, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, SRMSGDEFSET_CTRLSUPPORT)); CheckDlgButton(hwndDlg, IDC_DELTEMP, DBGetContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP)); msgTimeout = DBGetContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT); SetDlgItemInt(hwndDlg, IDC_SECONDS, msgTimeout >= SRMSGSET_MSGTIMEOUT_MIN ? msgTimeout / 1000 : SRMSGDEFSET_MSGTIMEOUT / 1000, FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_CTRLSUPPORT), !IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS); EnableWindow(GetDlgItem(hwndDlg, IDC_CREATETABSINBKG), bChecked && IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDEONETAB), bChecked ); EnableWindow(GetDlgItem(hwndDlg, IDC_CASCADE), !bChecked && !IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); EnableWindow(GetDlgItem(hwndDlg, IDC_SAVEPERCONTACT), !bChecked ); return TRUE; } case WM_COMMAND: switch (LOWORD(wParam)) { case IDC_AUTOPOPUP: EnableWindow(GetDlgItem(hwndDlg, IDC_STAYMINIMIZED), IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); EnableWindow(GetDlgItem(hwndDlg, IDC_CREATETABSINBKG), IsDlgButtonChecked(hwndDlg, IDC_USETABS) && IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); break; case IDC_AUTOMIN: CheckDlgButton(hwndDlg, IDC_AUTOCLOSE, BST_UNCHECKED); break; case IDC_USETABS: { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_USETABS); EnableWindow(GetDlgItem(hwndDlg, IDC_CREATETABSINBKG), bChecked && IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); EnableWindow(GetDlgItem(hwndDlg, IDC_TABSATBOTTOM), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITNAMES), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_HIDEONETAB), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_CASCADE), !bChecked && !IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); EnableWindow(GetDlgItem(hwndDlg, IDC_SAVEPERCONTACT), !bChecked); } break; case IDC_AUTOCLOSE: CheckDlgButton(hwndDlg, IDC_AUTOMIN, BST_UNCHECKED); EnableWindow(GetDlgItem(hwndDlg, IDC_CTRLSUPPORT), !IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); break; case IDC_SENDONENTER: CheckDlgButton(hwndDlg, IDC_SENDONDBLENTER, BST_UNCHECKED); break; case IDC_SENDONDBLENTER: CheckDlgButton(hwndDlg, IDC_SENDONENTER, BST_UNCHECKED); break; case IDC_SAVEPERCONTACT: EnableWindow(GetDlgItem(hwndDlg, IDC_CASCADE), !IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); break; case IDC_SECONDS: if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return 0; break; case IDC_AVATARSUPPORT: EnableWindow(GetDlgItem(hwndDlg, IDC_LIMITAVATARH), IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); if (!IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)) { EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHTMIN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT1), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT2), FALSE); } else { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHTMIN), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT1), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT2), bChecked); } break; case IDC_LIMITAVATARH: { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHT), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARHEIGHTMIN), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT1), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_AVATARTEXT2), bChecked); } break; case IDC_AVATARHEIGHT: case IDC_AVATARHEIGHTMIN: if (HIWORD(wParam) != EN_CHANGE || (HWND) lParam != GetFocus()) return 0; break; case IDC_TRANSPARENCY: if (pSetLayeredWindowAttributes != NULL) { int bChecked = IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYVALUE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ATRANSPARENCYPERC), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYVALUE), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_ITRANSPARENCYPERC), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT1), bChecked); EnableWindow(GetDlgItem(hwndDlg, IDC_TRANSPARENCYTEXT2), bChecked); } break; } SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; case WM_HSCROLL: { char str[10]; sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)/256)); SetDlgItemTextA(hwndDlg, IDC_ATRANSPARENCYPERC, str); sprintf(str,"%d%%",(int)(100*SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)/256)); SetDlgItemTextA(hwndDlg, IDC_ITRANSPARENCYPERC, str); SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); } break; case WM_NOTIFY: switch (((LPNMHDR) lParam)->idFrom) { case 0: switch (((LPNMHDR) lParam)->code) { case PSN_APPLY: { DWORD msgTimeout, avatarHeight; DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWBUTTONLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWBUTTONLINE)); //DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWINFOLINE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWINFOLINE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOPOPUP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOPOPUP)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STAYMINIMIZED, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STAYMINIMIZED)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOMIN, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOMIN)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AUTOCLOSE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AUTOCLOSE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVEPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVEPERCONTACT)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SAVESPLITTERPERCONTACT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SAVESPLITTERPERCONTACT)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CASCADE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CASCADE)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONENTER)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDONDBLENTER, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SENDONDBLENTER)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_STATUSICON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_STATUSWIN)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWSTATUSBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSBAR)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWTITLEBAR, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWTITLEBAR)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SHOWPROGRESS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWPROGRESS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETABS, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_USETABS)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_TABSATBOTTOM, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TABSATBOTTOM)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITNAMES, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITNAMES)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_HIDEONETAB, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_HIDEONETAB)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CREATETABSINBKG, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CREATETABSINBKG)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_AVATARENABLE, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_AVATARSUPPORT)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_LIMITAVHEIGHT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_LIMITAVATARH)); avatarHeight = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHT, NULL, TRUE); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHT, avatarHeight<0?SRMSGDEFSET_AVHEIGHT:avatarHeight); avatarHeight = GetDlgItemInt(hwndDlg, IDC_AVATARHEIGHTMIN, NULL, TRUE); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_AVHEIGHTMIN, avatarHeight<0?SRMSGDEFSET_AVHEIGHTMIN:avatarHeight); //DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_SENDBUTTON, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_SHOWSENDBTN)); //DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CHARCOUNT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CHARCOUNT)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_CTRLSUPPORT, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_CTRLSUPPORT)); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_DELTEMP, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_DELTEMP)); msgTimeout = GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) >= SRMSGSET_MSGTIMEOUT_MIN / 1000 ? GetDlgItemInt(hwndDlg, IDC_SECONDS, NULL, TRUE) * 1000 : SRMSGDEFSET_MSGTIMEOUT; DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_MSGTIMEOUT, msgTimeout); DBWriteContactSettingByte(NULL, SRMMMOD, SRMSGSET_USETRANSPARENCY, (BYTE) IsDlgButtonChecked(hwndDlg, IDC_TRANSPARENCY)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_ACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ATRANSPARENCYVALUE,TBM_GETPOS,0,0)); DBWriteContactSettingDword(NULL, SRMMMOD, SRMSGSET_INACTIVEALPHA, SendDlgItemMessage(hwndDlg,IDC_ITRANSPARENCYVALUE,TBM_GETPOS,0,0)); ReloadGlobals(); WindowList_Broadcast(g_dat->hParentWindowList, DM_OPTIONSAPPLIED, 0, 0); WindowList_Broadcast(g_dat->hMessageWindowList, DM_OPTIONSAPPLIED, 0, 0); return TRUE; } } break; } break; case WM_DESTROY: break; } return FALSE; }