summaryrefslogtreecommitdiff
path: root/plugins/Popup/src/opt_adv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Popup/src/opt_adv.cpp')
-rw-r--r--plugins/Popup/src/opt_adv.cpp722
1 files changed, 343 insertions, 379 deletions
diff --git a/plugins/Popup/src/opt_adv.cpp b/plugins/Popup/src/opt_adv.cpp
index 5befd5ba3a..c4c5513244 100644
--- a/plugins/Popup/src/opt_adv.cpp
+++ b/plugins/Popup/src/opt_adv.cpp
@@ -49,25 +49,30 @@ void LoadOption_AdvOpts()
PopUpOptions.EnableHistory = db_get_b(NULL, MODULNAME, "EnableHistory", TRUE);
PopUpOptions.HistorySize = db_get_w(NULL, MODULNAME, "HistorySize", SETTING_HISTORYSIZE_DEFAULT);
PopUpOptions.UseHppHistoryLog = db_get_b(NULL, MODULNAME, "UseHppHistoryLog", TRUE);
+
//Avatars
PopUpOptions.avatarBorders = db_get_b(NULL, MODULNAME, "AvatarBorders", TRUE);
PopUpOptions.avatarPNGBorders = db_get_b(NULL, MODULNAME, "AvatarPNGBorders", FALSE);
PopUpOptions.avatarRadius = db_get_b(NULL, MODULNAME, "AvatarRadius", 2);
PopUpOptions.avatarSize = db_get_w(NULL, MODULNAME, "AvatarSize", SETTING_AVTSIZE_DEFAULT);
PopUpOptions.EnableAvatarUpdates = db_get_b(NULL, MODULNAME, "EnableAvatarUpdates", FALSE);
+
//Monitor
PopUpOptions.Monitor = db_get_b(NULL, MODULNAME, "Monitor", SETTING_MONITOR_DEFAULT);
+
//Transparency
PopUpOptions.Enable9xTransparency = db_get_b(NULL, MODULNAME, "EnableRegionTransparency", TRUE);
PopUpOptions.UseTransparency = db_get_b(NULL, MODULNAME, "UseTransparency", TRUE);
PopUpOptions.Alpha = db_get_b(NULL, MODULNAME, "Alpha", SETTING_ALPHA_DEFAULT);
PopUpOptions.OpaqueOnHover = db_get_b(NULL, MODULNAME, "OpaqueOnHover", TRUE);
+
//Effects
PopUpOptions.UseAnimations = db_get_b(NULL, MODULNAME, "UseAnimations", TRUE);
PopUpOptions.UseEffect = db_get_b(NULL, MODULNAME, "Fade", TRUE);
PopUpOptions.Effect = (LPTSTR)DBGetContactSettingStringX(NULL, MODULNAME, "Effect", "", DBVT_TCHAR);
PopUpOptions.FadeIn = db_get_dw(NULL, MODULNAME, "FadeInTime", SETTING_FADEINTIME_DEFAULT);
PopUpOptions.FadeOut = db_get_dw(NULL, MODULNAME, "FadeOutTime", SETTING_FADEOUTTIME_DEFAULT);
+
//other old stuff
PopUpOptions.MaxPopups = db_get_w(NULL, MODULNAME, "MaxPopups", 20);
}
@@ -76,13 +81,12 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
{
TCHAR tstr[64];
static bool bDlgInit = false; //some controls send WM_COMMAND before or during WM_INITDIALOG
+ UINT idCtrl;
switch (msg) {
- case WM_INITDIALOG: {
- HWND hCtrl = NULL;
-
- //Create preview box:
- {
+ case WM_INITDIALOG:
+ //Create preview box:
+ {
hwndBox = CreateWindowEx(
WS_EX_TOOLWINDOW|WS_EX_TOPMOST, // dwStyleEx
_T(BOXPREVIEW_WNDCLASS), // Class name
@@ -97,14 +101,14 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
hInst, // Instance
(LPVOID)0);
ShowWindow(hwndBox, SW_HIDE);
- }
- //Group: History
- {
+ }
+ //Group: History
+ {
CheckDlgButton(hwnd, IDC_ENABLE_HISTORY, PopUpOptions.EnableHistory);
SetDlgItemInt (hwnd, IDC_HISTORYSIZE, PopUpOptions.HistorySize, FALSE);
CheckDlgButton(hwnd, IDC_HPPLOG, PopUpOptions.UseHppHistoryLog);
- hCtrl = GetDlgItem(hwnd, IDC_SHOWHISTORY);
+ HWND hCtrl = GetDlgItem(hwnd, IDC_SHOWHISTORY);
SendMessage(hCtrl, BUTTONSETASFLATBTN, TRUE, 0);
SendMessage(hCtrl, BUTTONADDTOOLTIP, (WPARAM)Translate("Popup History"), 0);
SendMessage(hCtrl, BM_SETIMAGE, IMAGE_ICON, (LPARAM)IcoLib_GetIcon(ICO_HISTORY,0));
@@ -114,9 +118,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopUpOptions.EnableHistory);
EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopUpOptions.EnableHistory);
EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopUpOptions.EnableHistory && gbHppInstalled);
- }
- //Group: Avatars
- {
+ }
+ //Group: Avatars
+ {
//Borders
CheckDlgButton(hwnd, IDC_AVT_BORDER, PopUpOptions.avatarBorders);
CheckDlgButton(hwnd, IDC_AVT_PNGBORDER, PopUpOptions.avatarPNGBorders);
@@ -134,9 +138,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemInt(hwnd, IDC_AVT_SIZE, PopUpOptions.avatarSize, FALSE);
//Request avatars
CheckDlgButton(hwnd, IDC_AVT_REQUEST, PopUpOptions.EnableAvatarUpdates);
- }
- //Group: Monitor
- {
+ }
+ //Group: Monitor
+ {
BOOL bMonitor = 0;
bMonitor = GetSystemMetrics(SM_CMONITORS)>1;
@@ -147,9 +151,9 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwnd, IDC_MULTIMONITOR_DESC), bMonitor);
EnableWindow(GetDlgItem(hwnd, IDC_MIRANDAWND), bMonitor);
EnableWindow(GetDlgItem(hwnd, IDC_ACTIVEWND), bMonitor);
- }
- //Group: Transparency
- {
+ }
+ //Group: Transparency
+ {
//9x/ME
CheckDlgButton(hwnd, IDC_TRANS_9X, PopUpOptions.Enable9xTransparency);
//EnableWindow(GetDlgItem(hwnd, IDC_TRANS_9X), !IsWinVer2000Plus());
@@ -163,19 +167,18 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
CheckDlgButton(hwnd, IDC_TRANS_OPAQUEONHOVER, PopUpOptions.OpaqueOnHover);
{
-
BOOL how = TRUE;
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS) ,how);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER) ,how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS), how);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1), how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER), how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT), how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER), how && PopUpOptions.UseTransparency);
}
ShowWindow(GetDlgItem(hwnd, IDC_TRANS), IsWinVer2000Plus() ? SW_SHOW : SW_HIDE);
- }
- //Group: Effects
- {
+ }
+ //Group: Effects
+ {
//Use Animations
CheckDlgButton(hwnd, IDC_USEANIMATIONS, PopUpOptions.UseAnimations);
//Fade
@@ -205,7 +208,7 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
EnableWindow(GetDlgItem(hwnd, IDC_EFFECT), how);
EnableWindow(GetDlgItem(hwnd, IDC_EFFECT_TXT), how);
- hCtrl = GetDlgItem(hwnd, IDC_EFFECT);
+ HWND hCtrl = GetDlgItem(hwnd, IDC_EFFECT);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("No effect")) ,-2);
ComboBox_SetItemData(hCtrl, ComboBox_AddString(hCtrl, TranslateT("Fade in/out")) ,-1);
dwActiveItem = (DWORD)PopUpOptions.UseEffect;
@@ -217,364 +220,323 @@ INT_PTR CALLBACK DlgProcPopUpAdvOpts(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
SendDlgItemMessage(hwnd, IDC_EFFECT, CB_SETCURSEL, dwActiveItem, 0);
}
+ }
+
+ //later check stuff
+ SetDlgItemInt(hwnd, IDC_MAXPOPUPS, PopUpOptions.MaxPopups, FALSE);
+ TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG
+ bDlgInit = true;
+ return TRUE;
+
+ case WM_HSCROLL:
+ switch (idCtrl = GetDlgCtrlID((HWND)lParam)) {
+ case IDC_AVT_SIZE_SLIDE:
+ PopUpOptions.avatarSize = SendDlgItemMessage(hwnd,IDC_AVT_SIZE_SLIDE, TBM_GETPOS,0,0);
+ SetDlgItemInt(hwnd, IDC_AVT_SIZE ,PopUpOptions.avatarSize,FALSE);
+ SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopUpOptions.avatarSize / 2),0));
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_TRANS_SLIDER:
+ PopUpOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd,IDC_TRANS_SLIDER, TBM_GETPOS, 0,0);
+ wsprintf(tstr, TranslateT("%d%%"), Byte2Percentile(PopUpOptions.Alpha));
+ SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+ break;
+
+ case WM_COMMAND:
+ idCtrl = LOWORD(wParam);
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED: //Button controls
+ switch(idCtrl) {
+ case IDC_ENABLE_HISTORY:
+ PopUpOptions.EnableHistory = !PopUpOptions.EnableHistory;
+ EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopUpOptions.EnableHistory);
+ EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopUpOptions.EnableHistory);
+ EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopUpOptions.EnableHistory);
+ EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopUpOptions.EnableHistory);
+ EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopUpOptions.EnableHistory && gbHppInstalled);
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_SHOWHISTORY:
+ PopupHistoryShow();
+ break;
+
+ case IDC_HPPLOG:
+ PopUpOptions.UseHppHistoryLog = !PopUpOptions.UseHppHistoryLog;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_AVT_BORDER:
+ PopUpOptions.avatarBorders = !PopUpOptions.avatarBorders;
+ EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopUpOptions.avatarBorders);
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_AVT_PNGBORDER:
+ PopUpOptions.avatarPNGBorders = !PopUpOptions.avatarPNGBorders;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_AVT_REQUEST:
+ PopUpOptions.EnableAvatarUpdates = !PopUpOptions.EnableAvatarUpdates;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_MIRANDAWND:
+ PopUpOptions.Monitor = MN_MIRANDA;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_ACTIVEWND:
+ PopUpOptions.Monitor = MN_ACTIVE;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_TRANS_9X:
+ PopUpOptions.Enable9xTransparency = !PopUpOptions.Enable9xTransparency;
+ SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
+ break;
+
+ case IDC_TRANS:
+ PopUpOptions.UseTransparency = !PopUpOptions.UseTransparency;
+ {
+ BOOL how = TRUE;
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopUpOptions.UseTransparency);
+ EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER) ,how && PopUpOptions.UseTransparency);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_TRANS_OPAQUEONHOVER:
+ PopUpOptions.OpaqueOnHover = !PopUpOptions.OpaqueOnHover;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_USEANIMATIONS:
+ PopUpOptions.UseAnimations = !PopUpOptions.UseAnimations;
+ {
+ BOOL enable = PopUpOptions.UseAnimations || PopUpOptions.UseEffect;
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_PREVIEW:
+ PopUpPreview();
+ break;
}
+ break;
- //later check stuff
- {
- SetDlgItemInt(hwnd, IDC_MAXPOPUPS, PopUpOptions.MaxPopups, FALSE);
+ case CBN_SELCHANGE:
+ //lParam = Handle to the control
+ switch(idCtrl) {
+ case IDC_EFFECT:
+ {
+ int iEffect = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
+ PopUpOptions.UseEffect = (iEffect != -2) ? TRUE : FALSE;
+ mir_free(PopUpOptions.Effect);
+ PopUpOptions.Effect = mir_tstrdup((iEffect >= 0) ? g_lstPopupVfx[iEffect] : _T(""));
+
+ BOOL enable = PopUpOptions.UseAnimations || PopUpOptions.UseEffect;
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable);
+ EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable);
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
}
+ break;
- TranslateDialogDefault(hwnd); //do it on end of WM_INITDIALOG
- bDlgInit = true;
- }//end WM_INITDIALOG
- return TRUE;
- case WM_HSCROLL: {
- UINT idCtrl = GetDlgCtrlID((HWND)lParam);
- switch (idCtrl) {
- case IDC_AVT_SIZE_SLIDE:
- {
- PopUpOptions.avatarSize = SendDlgItemMessage(hwnd,IDC_AVT_SIZE_SLIDE, TBM_GETPOS,0,0);
- SetDlgItemInt(hwnd, IDC_AVT_SIZE ,PopUpOptions.avatarSize,FALSE);
- SendDlgItemMessage(hwnd, IDC_AVT_RADIUS_SPIN,UDM_SETRANGE, 0, (LPARAM)MAKELONG((PopUpOptions.avatarSize / 2),0));
+ case EN_CHANGE: //Edit controls change
+ if (!bDlgInit) break;
+ //lParam = Handle to the control
+ switch(idCtrl) {
+ case IDC_MAXPOPUPS:
+ {
+ int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (maxPop > 0){
+ PopUpOptions.MaxPopups = maxPop;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_TRANS_SLIDER:
- {
- PopUpOptions.Alpha = (BYTE)SendDlgItemMessage(hwnd,IDC_TRANS_SLIDER, TBM_GETPOS, 0,0);
- wsprintf(tstr, TranslateT("%d%%"), Byte2Percentile(PopUpOptions.Alpha));
- SetDlgItemText(hwnd, IDC_TRANS_PERCENT, tstr);
+ }
+ }
+ break;
+ case IDC_HISTORYSIZE:
+ {
+ int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if ( histSize > 0 &&
+ histSize <= SETTING_HISTORYSIZE_MAX){
+ PopUpOptions.HistorySize = histSize;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ }
+ break;
+ case IDC_AVT_RADIUS:
+ {
+ int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if ( avtRadius <= SETTING_AVTSIZE_MAX / 2 ) {
+ PopUpOptions.avatarRadius = avtRadius;
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- default:
- break;
- }// end switch idCtrl
- }//end WM_HSCROLL
- break;
- case WM_COMMAND: {
- UINT idCtrl = LOWORD(wParam);
- switch (HIWORD(wParam)) {
- case BN_CLICKED: //Button controls
- switch(idCtrl) {
- case IDC_ENABLE_HISTORY:
- {
- PopUpOptions.EnableHistory = !PopUpOptions.EnableHistory;
- EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC1), PopUpOptions.EnableHistory);
- EnableWindow(GetDlgItem(hwnd, IDC_HISTORYSIZE), PopUpOptions.EnableHistory);
- EnableWindow(GetDlgItem(hwnd, IDC_HISTORY_STATIC2), PopUpOptions.EnableHistory);
- EnableWindow(GetDlgItem(hwnd, IDC_SHOWHISTORY), PopUpOptions.EnableHistory);
- EnableWindow(GetDlgItem(hwnd, IDC_HPPLOG), PopUpOptions.EnableHistory && gbHppInstalled);
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_SHOWHISTORY:
- {
- PopupHistoryShow();
- }
- break;
- case IDC_HPPLOG:
- {
- PopUpOptions.UseHppHistoryLog = !PopUpOptions.UseHppHistoryLog;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_AVT_BORDER:
- {
- PopUpOptions.avatarBorders = !PopUpOptions.avatarBorders;
- EnableWindow(GetDlgItem(hwnd, IDC_AVT_PNGBORDER), PopUpOptions.avatarBorders);
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_AVT_PNGBORDER:
- {
- PopUpOptions.avatarPNGBorders = !PopUpOptions.avatarPNGBorders;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_AVT_REQUEST:
- {
- PopUpOptions.EnableAvatarUpdates = !PopUpOptions.EnableAvatarUpdates;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_MIRANDAWND:
- {
- PopUpOptions.Monitor = MN_MIRANDA;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_ACTIVEWND:
- {
- PopUpOptions.Monitor = MN_ACTIVE;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_TRANS_9X:
- {
- PopUpOptions.Enable9xTransparency = !PopUpOptions.Enable9xTransparency;
- SendMessage(GetParent(hwnd), PSM_CHANGED,0,0);
- }
- break;
- case IDC_TRANS:
- {
- PopUpOptions.UseTransparency = !PopUpOptions.UseTransparency;
-
- BOOL how = TRUE;
-
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_TXT1) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_SLIDER) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_PERCENT) ,how && PopUpOptions.UseTransparency);
- EnableWindow(GetDlgItem(hwnd, IDC_TRANS_OPAQUEONHOVER) ,how && PopUpOptions.UseTransparency);
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_TRANS_OPAQUEONHOVER:
- {
- PopUpOptions.OpaqueOnHover = !PopUpOptions.OpaqueOnHover;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_USEANIMATIONS:
- {
- PopUpOptions.UseAnimations = !PopUpOptions.UseAnimations;
- BOOL enable = PopUpOptions.UseAnimations || PopUpOptions.UseEffect;
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable);
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- case IDC_PREVIEW:
- {
- PopUpPreview();
- }
- break;
- default:
- break;
- }
- break;
- case CBN_SELCHANGE: //ComboBox controls
- switch(idCtrl) {
- //lParam = Handle to the control
- case IDC_EFFECT:
- {
- int iEffect = ComboBox_GetItemData((HWND)lParam, ComboBox_GetCurSel((HWND)lParam));
- PopUpOptions.UseEffect = (iEffect != -2) ? TRUE : FALSE;
- mir_free(PopUpOptions.Effect);
- PopUpOptions.Effect = mir_tstrdup((iEffect >= 0) ? g_lstPopupVfx[iEffect] : _T(""));
-
- BOOL enable = PopUpOptions.UseAnimations || PopUpOptions.UseEffect;
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT1), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_SPIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEIN_TXT2), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT1), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_SPIN), enable);
- EnableWindow(GetDlgItem(hwnd, IDC_FADEOUT_TXT2), enable);
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- break;
- default:
- break;
- }
- break;
- case EN_CHANGE: //Edit controls change
- if (!bDlgInit) break;
- switch(idCtrl) {
- //lParam = Handle to the control
- case IDC_MAXPOPUPS:
- {
- int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (maxPop > 0){
- PopUpOptions.MaxPopups = maxPop;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_HISTORYSIZE:
- {
- int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if ( histSize > 0 &&
- histSize <= SETTING_HISTORYSIZE_MAX){
- PopUpOptions.HistorySize = histSize;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_AVT_RADIUS:
- {
- int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if ( avtRadius <= SETTING_AVTSIZE_MAX / 2 ) {
- PopUpOptions.avatarRadius = avtRadius;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_FADEIN:
- {
- int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if ( fadeIn >= SETTING_FADEINTIME_MIN &&
- fadeIn <= SETTING_FADEINTIME_MAX ) {
- PopUpOptions.FadeIn = fadeIn;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_FADEOUT:
- {
- int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if ( fadeOut >= SETTING_FADEOUTTIME_MIN &&
- fadeOut <= SETTING_FADEOUTTIME_MAX){
- PopUpOptions.FadeOut = fadeOut;
- SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
- }
- }
- break;
- default:
- break;
- }//end switch(idCtrl)
- break;
- case EN_KILLFOCUS: //Edit controls lost fokus
- switch(idCtrl) {
- //lParam = Handle to the control
- case IDC_MAXPOPUPS:
- {
- int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (maxPop <= 0)
- PopUpOptions.MaxPopups = 20;
- if (maxPop != PopUpOptions.MaxPopups) {
- SetDlgItemInt(hwnd, idCtrl, PopUpOptions.MaxPopups, FALSE);
- //ErrorMSG(1);
- SetFocus((HWND)lParam);
- }
- }
- break;
- case IDC_HISTORYSIZE:
- {
- int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (histSize <= 0)
- PopUpOptions.HistorySize = SETTING_HISTORYSIZE_DEFAULT;
- else if (histSize > SETTING_HISTORYSIZE_MAX)
- PopUpOptions.HistorySize = SETTING_HISTORYSIZE_MAX;
- if (histSize != PopUpOptions.HistorySize) {
- SetDlgItemInt(hwnd, idCtrl, PopUpOptions.HistorySize, FALSE);
- ErrorMSG(1, SETTING_HISTORYSIZE_MAX);
- SetFocus((HWND)lParam);
- }
- }
- break;
- case IDC_AVT_RADIUS:
- {
- int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (avtRadius > SETTING_AVTSIZE_MAX / 2)
- PopUpOptions.avatarRadius = SETTING_AVTSIZE_MAX / 2;
- if (avtRadius != PopUpOptions.avatarRadius) {
- SetDlgItemInt(hwnd, idCtrl, PopUpOptions.avatarRadius, FALSE);
- ErrorMSG(0, SETTING_AVTSIZE_MAX / 2);
- SetFocus((HWND)lParam);
- }
- }
- break;
- case IDC_FADEIN:
- {
- int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (fade < SETTING_FADEINTIME_MIN)
- PopUpOptions.FadeIn = SETTING_FADEINTIME_MIN;
- else if (fade > SETTING_FADEINTIME_MAX)
- PopUpOptions.FadeIn = SETTING_FADEINTIME_MAX;
- if (fade != PopUpOptions.FadeIn) {
- SetDlgItemInt(hwnd, idCtrl, PopUpOptions.FadeIn, FALSE);
- ErrorMSG(SETTING_FADEINTIME_MIN, SETTING_FADEINTIME_MAX);
- SetFocus((HWND)lParam);
- }
- }
- break;
- case IDC_FADEOUT:
- {
- int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
- if (fade < SETTING_FADEOUTTIME_MIN)
- PopUpOptions.FadeOut = SETTING_FADEOUTTIME_MIN;
- else if (fade > SETTING_FADEOUTTIME_MAX)
- PopUpOptions.FadeOut = SETTING_FADEOUTTIME_MAX;
- if (fade != PopUpOptions.FadeOut) {
- SetDlgItemInt(hwnd, idCtrl, PopUpOptions.FadeOut, FALSE);
- ErrorMSG(SETTING_FADEOUTTIME_MIN, SETTING_FADEOUTTIME_MAX);
- SetFocus((HWND)lParam);
- }
- }
- break;
- default:
- break;
- }//end switch(idCtrl)
- break;
- default:
- break;
- }// end switch (HIWORD(wParam))
- }//end WM_COMMAND
- break;
- case WM_NOTIFY: {
- switch(((LPNMHDR)lParam)->idFrom) {
- case 0: {
- switch (((LPNMHDR)lParam)->code) {
- case PSN_RESET:
- LoadOption_AdvOpts();
- return TRUE;
- case PSN_APPLY:
- {
- //History
- db_set_b(NULL, MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory);
- db_set_w(NULL, MODULNAME, "HistorySize", PopUpOptions.HistorySize);
- PopupHistoryResize();
- db_set_b(NULL, MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
- //Avatars
- db_set_b(NULL, MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
- db_set_b(NULL, MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
- db_set_b(NULL, MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
- db_set_w(NULL, MODULNAME, "AvatarSize", PopUpOptions.avatarSize);
- db_set_b(NULL, MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
- //Monitor
- db_set_b(NULL, MODULNAME, "Monitor", PopUpOptions.Monitor);
- //Transparency
- db_set_b(NULL, MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
- db_set_b(NULL, MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
- db_set_b(NULL, MODULNAME, "Alpha", PopUpOptions.Alpha);
- db_set_b(NULL, MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
-
- //Effects
- db_set_b(NULL, MODULNAME, "UseAnimations", PopUpOptions.UseAnimations);
- db_set_b(NULL, MODULNAME, "Fade", PopUpOptions.UseEffect);
- db_set_ts(NULL, MODULNAME, "Effect", PopUpOptions.Effect);
- db_set_dw(NULL, MODULNAME, "FadeInTime", PopUpOptions.FadeIn);
- db_set_dw(NULL, MODULNAME, "FadeOutTime", PopUpOptions.FadeOut);
- //other old stuff
- db_set_w(NULL, MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups);
- }
- return TRUE;
- default:
- break;
}
+ }
+ break;
+ case IDC_FADEIN:
+ {
+ int fadeIn = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if ( fadeIn >= SETTING_FADEINTIME_MIN &&
+ fadeIn <= SETTING_FADEINTIME_MAX ) {
+ PopUpOptions.FadeIn = fadeIn;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ }
+ break;
+ case IDC_FADEOUT:
+ {
+ int fadeOut = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if ( fadeOut >= SETTING_FADEOUTTIME_MIN &&
+ fadeOut <= SETTING_FADEOUTTIME_MAX){
+ PopUpOptions.FadeOut = fadeOut;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
- break;
- default:
- break;
+ }
+ break;
}
- }//end WM_NOTIFY
- break;
- case WM_DESTROY:
- {
- bDlgInit = false;
- }//end WM_DESTROY
break;
- default:
- return FALSE;
- }//end switch (msg)
+
+ case EN_KILLFOCUS: //Edit controls lost fokus
+ //lParam = Handle to the control
+ switch(idCtrl) {
+ case IDC_MAXPOPUPS:
+ {
+ int maxPop = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (maxPop <= 0)
+ PopUpOptions.MaxPopups = 20;
+ if (maxPop != PopUpOptions.MaxPopups) {
+ SetDlgItemInt(hwnd, idCtrl, PopUpOptions.MaxPopups, FALSE);
+ //ErrorMSG(1);
+ SetFocus((HWND)lParam);
+ }
+ }
+ break;
+ case IDC_HISTORYSIZE:
+ {
+ int histSize = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (histSize <= 0)
+ PopUpOptions.HistorySize = SETTING_HISTORYSIZE_DEFAULT;
+ else if (histSize > SETTING_HISTORYSIZE_MAX)
+ PopUpOptions.HistorySize = SETTING_HISTORYSIZE_MAX;
+ if (histSize != PopUpOptions.HistorySize) {
+ SetDlgItemInt(hwnd, idCtrl, PopUpOptions.HistorySize, FALSE);
+ ErrorMSG(1, SETTING_HISTORYSIZE_MAX);
+ SetFocus((HWND)lParam);
+ }
+ }
+ break;
+ case IDC_AVT_RADIUS:
+ {
+ int avtRadius = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (avtRadius > SETTING_AVTSIZE_MAX / 2)
+ PopUpOptions.avatarRadius = SETTING_AVTSIZE_MAX / 2;
+ if (avtRadius != PopUpOptions.avatarRadius) {
+ SetDlgItemInt(hwnd, idCtrl, PopUpOptions.avatarRadius, FALSE);
+ ErrorMSG(0, SETTING_AVTSIZE_MAX / 2);
+ SetFocus((HWND)lParam);
+ }
+ }
+ break;
+ case IDC_FADEIN:
+ {
+ int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (fade < SETTING_FADEINTIME_MIN)
+ PopUpOptions.FadeIn = SETTING_FADEINTIME_MIN;
+ else if (fade > SETTING_FADEINTIME_MAX)
+ PopUpOptions.FadeIn = SETTING_FADEINTIME_MAX;
+ if (fade != PopUpOptions.FadeIn) {
+ SetDlgItemInt(hwnd, idCtrl, PopUpOptions.FadeIn, FALSE);
+ ErrorMSG(SETTING_FADEINTIME_MIN, SETTING_FADEINTIME_MAX);
+ SetFocus((HWND)lParam);
+ }
+ }
+ break;
+ case IDC_FADEOUT:
+ {
+ int fade = GetDlgItemInt(hwnd, idCtrl, NULL, FALSE);
+ if (fade < SETTING_FADEOUTTIME_MIN)
+ PopUpOptions.FadeOut = SETTING_FADEOUTTIME_MIN;
+ else if (fade > SETTING_FADEOUTTIME_MAX)
+ PopUpOptions.FadeOut = SETTING_FADEOUTTIME_MAX;
+ if (fade != PopUpOptions.FadeOut) {
+ SetDlgItemInt(hwnd, idCtrl, PopUpOptions.FadeOut, FALSE);
+ ErrorMSG(SETTING_FADEOUTTIME_MIN, SETTING_FADEOUTTIME_MAX);
+ SetFocus((HWND)lParam);
+ }
+ }
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_RESET:
+ LoadOption_AdvOpts();
+ return TRUE;
+
+ case PSN_APPLY:
+ //History
+ db_set_b(NULL, MODULNAME, "EnableHistory", (BYTE)PopUpOptions.EnableHistory);
+ db_set_w(NULL, MODULNAME, "HistorySize", PopUpOptions.HistorySize);
+ PopupHistoryResize();
+ db_set_b(NULL, MODULNAME, "UseHppHistoryLog", PopUpOptions.UseHppHistoryLog);
+ //Avatars
+ db_set_b(NULL, MODULNAME, "AvatarBorders", PopUpOptions.avatarBorders);
+ db_set_b(NULL, MODULNAME, "AvatarPNGBorders", PopUpOptions.avatarPNGBorders);
+ db_set_b(NULL, MODULNAME, "AvatarRadius", PopUpOptions.avatarRadius);
+ db_set_w(NULL, MODULNAME, "AvatarSize", PopUpOptions.avatarSize);
+ db_set_b(NULL, MODULNAME, "EnableAvatarUpdates", PopUpOptions.EnableAvatarUpdates);
+ //Monitor
+ db_set_b(NULL, MODULNAME, "Monitor", PopUpOptions.Monitor);
+ //Transparency
+ db_set_b(NULL, MODULNAME, "EnableRegionTransparency", PopUpOptions.Enable9xTransparency);
+ db_set_b(NULL, MODULNAME, "UseTransparency", PopUpOptions.UseTransparency);
+ db_set_b(NULL, MODULNAME, "Alpha", PopUpOptions.Alpha);
+ db_set_b(NULL, MODULNAME, "OpaqueOnHover", PopUpOptions.OpaqueOnHover);
+
+ //Effects
+ db_set_b(NULL, MODULNAME, "UseAnimations", PopUpOptions.UseAnimations);
+ db_set_b(NULL, MODULNAME, "Fade", PopUpOptions.UseEffect);
+ db_set_ts(NULL, MODULNAME, "Effect", PopUpOptions.Effect);
+ db_set_dw(NULL, MODULNAME, "FadeInTime", PopUpOptions.FadeIn);
+ db_set_dw(NULL, MODULNAME, "FadeOutTime", PopUpOptions.FadeOut);
+ //other old stuff
+ db_set_w(NULL, MODULNAME, "MaxPopups", (BYTE)PopUpOptions.MaxPopups);
+ }
+ return TRUE;
+ }
+ break;
+
+ case WM_DESTROY:
+ bDlgInit = false;
+ break;
+ }
return FALSE;
}
@@ -602,9 +564,9 @@ LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
int newVal = (BYTE)SendMessage(hwnd, TBM_GETPOS, 0, 0);
if (oldVal != newVal) {
- if (oldVal < 0) {
+ if (oldVal < 0)
SetWindowLongPtr(hwndBox, GWLP_USERDATA, 0);
- }
+
RECT rc; GetWindowRect(hwnd, &rc);
SetWindowPos(hwndBox, NULL,
(rc.left+rc.right-newVal)/2, rc.bottom+2, newVal, newVal,
@@ -617,6 +579,7 @@ LRESULT CALLBACK AvatarTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARA
}
}
break;
+
case WM_MOUSELEAVE:
SetWindowRgn(hwndBox, NULL, TRUE);
ShowWindow(hwndBox, SW_HIDE);
@@ -666,8 +629,9 @@ LRESULT CALLBACK AlphaTrackBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
oldVal = newVal;
}
- break;
}
+ break;
+
case WM_MOUSELEAVE:
SetWindowLongPtr(hwndBox, GWL_EXSTYLE, GetWindowLongPtr(hwndBox, GWL_EXSTYLE) & ~WS_EX_LAYERED);
SetLayeredWindowAttributes(hwndBox, NULL, 255, LWA_ALPHA);