summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/YAPP/res/yapp.rc4
-rw-r--r--plugins/YAPP/src/options.cpp12
-rw-r--r--plugins/YAPP/src/options.h2
-rw-r--r--plugins/YAPP/src/popwin.cpp116
-rw-r--r--plugins/YAPP/src/popwin.h4
-rw-r--r--plugins/YAPP/src/resource.h2
6 files changed, 83 insertions, 57 deletions
diff --git a/plugins/YAPP/res/yapp.rc b/plugins/YAPP/res/yapp.rc
index d4a7243199..18421e003e 100644
--- a/plugins/YAPP/res/yapp.rc
+++ b/plugins/YAPP/res/yapp.rc
@@ -98,7 +98,7 @@ BEGIN
CONTROL "Border",IDC_CHK_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,127,121,10
CONTROL "Round corners (window)",IDC_CHK_ROUNDCORNERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,138,121,10
PUSHBUTTON "Preview",IDC_BTN_PREVIEW,161,194,130,17
- CONTROL "Animate",IDC_CHK_ANIMATE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,160,121,10
+ COMBOBOX IDC_CMB_ANIMATE,25,160,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
CONTROL "Transparent background",IDC_CHK_TRANSBG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,199,121,10
GROUPBOX "Layout",IDC_STATIC,161,7,129,184
RTEXT "Avatar size:",IDC_STATIC,174,122,60,8,0,WS_EX_RIGHT
@@ -109,7 +109,7 @@ BEGIN
COMBOBOX IDC_CMB_PLACEMENT,165,19,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_CMB_ICON,165,36,120,69,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
COMBOBOX IDC_CMB_AV,165,53,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
- CONTROL "Global hover",IDC_CHK_GLOBALHOVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,171,121,10
+ CONTROL "Global hover",IDC_CHK_GLOBALHOVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,173,121,10
COMBOBOX IDC_CMB_TIME,165,69,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
EDITTEXT IDC_ED_SBWIDTH,238,138,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT
CONTROL "",IDC_SPIN_SBWIDTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,138,11,14
diff --git a/plugins/YAPP/src/options.cpp b/plugins/YAPP/src/options.cpp
index 186e841f75..f2fafa9aa3 100644
--- a/plugins/YAPP/src/options.cpp
+++ b/plugins/YAPP/src/options.cpp
@@ -29,7 +29,7 @@ void LoadOptions()
options.border = db_get_b(0, MODULE, "Border", 1) == 1;
options.round = db_get_b(0, MODULE, "RoundCorners", 1) == 1;
options.av_round = db_get_b(0, MODULE, "AvatarRoundCorners", 1) == 1;
- options.animate = db_get_b(0, MODULE, "Animate", 1) == 1;
+ options.animate = db_get_b(0, MODULE, "Animate", 0);
options.trans_bg = db_get_b(0, MODULE, "TransparentBg", 0) == 1;
options.use_mim_monitor = db_get_b(0, MODULE, "UseMimMonitor", 1) == 1;
options.right_icon = db_get_b(0, MODULE, "RightIcon", 0) == 1;
@@ -62,7 +62,7 @@ void SaveOptions()
db_set_b(0, MODULE, "Border", (options.border ? 1 : 0));
db_set_b(0, MODULE, "RoundCorners", (options.round ? 1 : 0));
db_set_b(0, MODULE, "AvatarRoundCorners", (options.av_round ? 1 : 0));
- db_set_b(0, MODULE, "Animate", (options.animate ? 1 : 0));
+ db_set_b(0, MODULE, "Animate", options.animate);
db_set_b(0, MODULE, "TransparentBg", (options.trans_bg ? 1 : 0));
db_set_b(0, MODULE, "UseMimMonitor", (options.use_mim_monitor ? 1 : 0));
db_set_b(0, MODULE, "RightIcon", (options.right_icon ? 1 : 0));
@@ -253,7 +253,11 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERS, options.round);
CheckDlgButton(hwndDlg, IDC_CHK_ROUNDCORNERSAV, options.av_round);
- CheckDlgButton(hwndDlg, IDC_CHK_ANIMATE, options.animate);
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("No animate"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Horizontal animate"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_ADDSTRING, 0, (LPARAM)TranslateT("Vertical animate"));
+ SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_SETCURSEL, options.animate, 0);
+
CheckDlgButton(hwndDlg, IDC_CHK_TRANSBG, options.trans_bg);
return FALSE;
@@ -328,7 +332,7 @@ static INT_PTR CALLBACK DlgProcOpts1(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
options.border = IsDlgButtonChecked(hwndDlg, IDC_CHK_BORDER) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_BORDER)) ? true : false;
options.round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERS) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERS)) ? true : false;
options.av_round = IsDlgButtonChecked(hwndDlg, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_CHK_ROUNDCORNERSAV)) ? true : false;
- options.animate = IsDlgButtonChecked(hwndDlg, IDC_CHK_ANIMATE) ? true : false;
+ options.animate = SendDlgItemMessage(hwndDlg, IDC_CMB_ANIMATE, CB_GETCURSEL, 0, 0);
options.trans_bg = IsDlgButtonChecked(hwndDlg, IDC_CHK_TRANSBG) ? true : false;
options.global_hover = IsDlgButtonChecked(hwndDlg, IDC_CHK_GLOBALHOVER) ? true : false;
diff --git a/plugins/YAPP/src/options.h b/plugins/YAPP/src/options.h
index b9107236f6..d11342074e 100644
--- a/plugins/YAPP/src/options.h
+++ b/plugins/YAPP/src/options.h
@@ -11,7 +11,7 @@ typedef struct {
int opacity;
bool border;
bool round, av_round;
- bool animate;
+ int animate;
bool trans_bg;
bool use_mim_monitor;
bool right_icon;
diff --git a/plugins/YAPP/src/popwin.cpp b/plugins/YAPP/src/popwin.cpp
index a24178f16e..57fa749be3 100644
--- a/plugins/YAPP/src/popwin.cpp
+++ b/plugins/YAPP/src/popwin.cpp
@@ -28,35 +28,6 @@ void trimW(wchar_t *str) {
if (str[pos] == L'\t') str[pos] = L' ';
}
-void SetStartValues(void)
-{
- RECT wa_rect;
- SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, 0);
- if (options.use_mim_monitor && MyMonitorFromRect && MyGetMonitorInfo)
- {
- RECT clr;
- GetWindowRect((HWND)CallService(MS_CLUI_GETHWND, 0, 0), &clr);
- HMONITOR hMonitor = MyMonitorFromRect(&clr, MONITOR_DEFAULTTONEAREST);
- if (hMonitor)
- {
- MONITORINFO mi;
- mi.cbSize = sizeof(mi);
- if (MyGetMonitorInfo(hMonitor, &mi))
- wa_rect = mi.rcWork;
- }
- }
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- pop_start_x = wa_rect.right - options.win_width - 1;
- else
- pop_start_x = wa_rect.left + 1;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
- pop_start_y = wa_rect.bottom - 1;
- else
- pop_start_y = wa_rect.top + 1;
-}
-
struct HWNDStackNode {
HWND hwnd;
struct HWNDStackNode *next;
@@ -68,30 +39,32 @@ int stack_size = 0;
void RepositionWindows() {
HWNDStackNode *current;
int x = pop_start_x, y = pop_start_y;
- int height;//, total_height = 0;
+ int height;
- /*
- current = hwnd_stack_top;
- while(current) {
- SendMessage(current->hwnd, PUM_GETHEIGHT, (WPARAM)&height, 0);
- total_height += height;
- current = current->next;
+ if (options.animate == ANIMATE_HORZ)
+ {
+ if (options.location == PL_BOTTOMRIGHT ||options.location == PL_TOPRIGHT)
+ x -= options.win_width + 1;
+ if (options.location == PL_BOTTOMLEFT ||options.location == PL_TOPLEFT)
+ x += options.win_width + 1;
}
- */
current = hwnd_stack_top;
while(current) {
SendMessage(current->hwnd, PUM_GETHEIGHT, (WPARAM)&height, 0);
if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height + 1;
- SendMessage(current->hwnd, PUM_MOVE, (WPARAM)x, (LPARAM)y);
- if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height + 1;
+ if (options.animate == ANIMATE_VERT)
+ if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height + 1;
+
+ SendMessage(current->hwnd, PUM_MOVE, (WPARAM)x, (LPARAM)y);
+ if (options.animate != ANIMATE_VERT)
+ if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height + 1;
current = current->next;
}
}
void AddWindowToStack(HWND hwnd) {
- SetStartValues();
HWNDStackNode *new_node = (HWNDStackNode *)mir_alloc(sizeof(HWNDStackNode));
new_node->hwnd = hwnd;
@@ -101,15 +74,60 @@ void AddWindowToStack(HWND hwnd) {
int height;
SendMessage(hwnd, PUM_GETHEIGHT, (WPARAM)&height, 0);
- int x = pop_start_x, y = pop_start_y;
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
- x += options.win_width;
- else
- x -= options.win_width;
-
- if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT) y -= height;
- SetWindowPos(hwnd, 0, x, y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
- if (options.location == PL_TOPRIGHT || options.location == PL_TOPLEFT) y += height;
+ RECT wa_rect;
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &wa_rect, 0);
+ if (options.use_mim_monitor && MyMonitorFromRect && MyGetMonitorInfo)
+ {
+ RECT clr;
+ GetWindowRect((HWND)CallService(MS_CLUI_GETHWND, 0, 0), &clr);
+ HMONITOR hMonitor = MyMonitorFromRect(&clr, MONITOR_DEFAULTTONEAREST);
+ if (hMonitor)
+ {
+ MONITORINFO mi;
+ mi.cbSize = sizeof(mi);
+ if (MyGetMonitorInfo(hMonitor, &mi))
+ wa_rect = mi.rcWork;
+ }
+ }
+
+ switch (options.animate)
+ {
+ case ANIMATE_NO:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_HORZ:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right;
+ else
+ pop_start_x = wa_rect.left - options.win_width;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top + 1;
+ break;
+ case ANIMATE_VERT:
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_TOPRIGHT)
+ pop_start_x = wa_rect.right - options.win_width - 1;
+ else
+ pop_start_x = wa_rect.left + 1;
+
+ if (options.location == PL_BOTTOMRIGHT || options.location == PL_BOTTOMLEFT)
+ pop_start_y = wa_rect.bottom;
+ else
+ pop_start_y = wa_rect.top - height + 1;
+ break;
+ }
+
+ SetWindowPos(hwnd, 0, pop_start_x, pop_start_y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE);
stack_size++;
diff --git a/plugins/YAPP/src/popwin.h b/plugins/YAPP/src/popwin.h
index 4d826ceade..d4b49b308c 100644
--- a/plugins/YAPP/src/popwin.h
+++ b/plugins/YAPP/src/popwin.h
@@ -15,6 +15,10 @@
#define PUM_KILLNOTIFY (WM_USER + 0x031)
#define PUM_UPDATENOTIFY (WM_USER + 0x032)
+#define ANIMATE_NO 0
+#define ANIMATE_HORZ 1
+#define ANIMATE_VERT 2
+
void InitWindowStack();
void DeinitWindowStack();
diff --git a/plugins/YAPP/src/resource.h b/plugins/YAPP/src/resource.h
index d7db4cda2e..6ffa3d7e86 100644
--- a/plugins/YAPP/src/resource.h
+++ b/plugins/YAPP/src/resource.h
@@ -33,7 +33,7 @@
#define IDC_CHK_BORDER 1018
#define IDC_CHK_ROUNDCORNERS 1019
#define IDC_BTN_PREVIEW 1020
-#define IDC_CHK_ANIMATE 1021
+#define IDC_CMB_ANIMATE 1021
#define IDC_CHK_TRANSBG 1022
#define IDC_RAD_RIGHTICON 1023
#define IDC_SPIN_INDENT2 1023