summaryrefslogtreecommitdiff
path: root/plugins/YAPP/src/popwin.cpp
diff options
context:
space:
mode:
authorVlad Mironov <mironych@googlemail.com>2013-02-14 15:24:59 +0000
committerVlad Mironov <mironych@googlemail.com>2013-02-14 15:24:59 +0000
commit5f84a05fe1a3e88567589ffe2003a40c84632f09 (patch)
tree3109d08fb36d19299927acaa53a613e0df854a0e /plugins/YAPP/src/popwin.cpp
parent901217c9bb0d3f0785bd7cbf97050f3b16ef16de (diff)
YAPP: Added another kind of animation.
git-svn-id: http://svn.miranda-ng.org/main/trunk@3602 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/YAPP/src/popwin.cpp')
-rw-r--r--plugins/YAPP/src/popwin.cpp116
1 files changed, 67 insertions, 49 deletions
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++;