summaryrefslogtreecommitdiff
path: root/plugins/MyDetails
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-02-05 17:53:49 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-02-05 17:53:49 +0000
commit9ee70ef5ffd533779b4e679fc972236fa6e54ad8 (patch)
tree202f0eee7f098f1471a0c56fe262bac600f23458 /plugins/MyDetails
parente3735ebc0ae98d45cd68687d9034c94e549d9afe (diff)
- hidden option to use clist_modern's skinning engine in MyDetails;
- frames' service presence is checked only once; - unused option removed git-svn-id: http://svn.miranda-ng.org/main/trunk@3443 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/MyDetails')
-rw-r--r--plugins/MyDetails/src/commons.h2
-rw-r--r--plugins/MyDetails/src/frame.cpp40
-rw-r--r--plugins/MyDetails/src/mydetails.cpp1
-rw-r--r--plugins/MyDetails/src/options.cpp1
-rw-r--r--plugins/MyDetails/src/options.h3
-rw-r--r--plugins/MyDetails/src/resource.h1
6 files changed, 26 insertions, 22 deletions
diff --git a/plugins/MyDetails/src/commons.h b/plugins/MyDetails/src/commons.h
index a331359341..e80845995d 100644
--- a/plugins/MyDetails/src/commons.h
+++ b/plugins/MyDetails/src/commons.h
@@ -73,6 +73,8 @@ extern HINSTANCE hInst;
extern long nickname_dialog_open;
extern long status_msg_dialog_open;
+extern bool g_bFramesExist;
+
#include "m_mydetails.h"
#include "data.h"
#include "options.h"
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp
index 476c286e5f..7be6ff38f9 100644
--- a/plugins/MyDetails/src/frame.cpp
+++ b/plugins/MyDetails/src/frame.cpp
@@ -53,6 +53,7 @@ HWND hwnd_frame = NULL;
HWND hwnd_container = NULL;
int frame_id = -1;
+bool g_bFramesExist = false;
HANDLE hMenuShowHideFrame = 0;
@@ -155,7 +156,6 @@ struct MyDetailsFrameData
int protocol_number;
bool showing_menu;
- bool skinning;
bool recalc_rectangles;
bool get_status_messages;
@@ -179,7 +179,7 @@ void InitFrames()
void DeInitFrames()
{
- if (ServiceExists(MS_CLIST_FRAMES_REMOVEFRAME) && frame_id != -1)
+ if (g_bFramesExist && frame_id != -1)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)frame_id, 0);
for (int i = 0 ; i < NUM_FONTS ; i++ )
@@ -274,7 +274,7 @@ int CreateFrame()
wndclass.lpszClassName = WINDOW_CLASS_NAME;
RegisterClass(&wndclass);
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (g_bFramesExist) {
hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My Details"),
WS_CHILD | WS_VISIBLE,
0,0,10,10, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL);
@@ -626,7 +626,7 @@ void CalcRectangles(HWND hwnd)
DeleteTooltipWindows(data);
- if (ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS) && frame_id != -1) {
+ if (g_bFramesExist && frame_id != -1) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (flags & F_UNCOLLAPSED) {
RECT rf;
@@ -642,10 +642,8 @@ void CalcRectangles(HWND hwnd)
GetClientRect(parent, &rp_client);
GetWindowRect(parent, &rp_window);
GetWindowRect(hwnd, &r_window);
- int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top);
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- diff += (r_window.top - rp_window.top);
+ int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top) + r_window.top - rp_window.top;
SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
@@ -972,7 +970,7 @@ void CalcRectangles(HWND hwnd)
r.bottom = max(next_top - SPACE_TEXT_TEXT, avatar_bottom);
- if (opts.resize_frame && ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS) && frame_id != -1) {
+ if (opts.resize_frame && g_bFramesExist && frame_id != -1) {
RECT rf;
GetClientRect(hwnd, &rf);
@@ -987,14 +985,12 @@ void CalcRectangles(HWND hwnd)
GetClientRect(parent, &rp_client);
GetWindowRect(parent, &rp_window);
GetWindowRect(hwnd, &r_window);
- int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top);
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
- diff += (r_window.top - rp_window.top);
+ int diff = (rp_window.bottom - rp_window.top) - (rp_client.bottom - rp_client.top) + r_window.top - rp_window.top;
SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
- else if (IsWindowVisible(hwnd) && ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ else if ( IsWindowVisible(hwnd)) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (flags & F_VISIBLE) {
CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS, MAKEWPARAM(FO_HEIGHT, frame_id), (LPARAM)(size));
@@ -1030,12 +1026,12 @@ HBITMAP CreateBitmap32(int cx, int cy)
return DirectBitmap;
}
-void EraseBackground(HWND hwnd, HDC hdc, MyDetailsFrameData* data)
+void EraseBackground(HWND hwnd, HDC hdc)
{
RECT r;
GetClientRect(hwnd, &r);
- if ( isSkinEngineEnabled())
+ if ( opts.use_skinning && isSkinEngineEnabled() && !FrameIsFloating())
SkinDrawWindowBack(hwnd, hdc, &r, "Main,ID=Background");
else {
HBRUSH hB = CreateSolidBrush(opts.bkg_color);
@@ -1115,7 +1111,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
Protocol *proto = protocols->Get(data->protocol_number);
if (proto == NULL) {
- EraseBackground(hwnd, hdc_orig, data);
+ EraseBackground(hwnd, hdc_orig);
return;
}
@@ -1127,7 +1123,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
RECT r = r_full;
HDC hdc = CreateCompatibleDC(hdc_orig);
- HBITMAP hBmp = CreateBitmap32(r.right,r.bottom);//,1,GetDeviceCaps(hdc,BITSPIXEL),NULL);
+ HBITMAP hBmp = CreateBitmap32(r.right,r.bottom);
SelectObject(hdc, hBmp);
int old_bk_mode = SetBkMode(hdc, TRANSPARENT);
@@ -1136,7 +1132,7 @@ void Draw(HWND hwnd, HDC hdc_orig)
SetStretchBltMode(hdc, HALFTONE);
// Erase
- EraseBackground(hwnd, hdc, data);
+ EraseBackground(hwnd, hdc);
r.left += min(opts.borders[LEFT], r.right);
r.right = max(r.right - opts.borders[RIGHT], r.left);
@@ -1563,7 +1559,6 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
data->recalc_rectangles = true;
data->get_status_messages = false;
data->showing_menu = false;
- data->skinning = ServiceExists(MS_SKIN_DRAWGLYPH) != 0;
data->protocol_number = DBGetContactSettingWord(NULL,"MyDetails","ProtocolNumber",0);
if (data->protocol_number >= protocols->GetSize())
@@ -1630,6 +1625,9 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
return TRUE;
+ case WM_ERASEBKGND:
+ return TRUE;
+
case WM_LBUTTONUP:
proto = protocols->Get(data->protocol_number);
if (proto != NULL) {
@@ -2221,7 +2219,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar
INT_PTR ShowHideFrameFunc(WPARAM wParam, LPARAM lParam)
{
- if ( ServiceExists(MS_CLIST_FRAMES_ADDFRAME))
+ if (g_bFramesExist)
CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
else {
if (MyDetailsFrameVisible())
@@ -2238,7 +2236,7 @@ INT_PTR ShowHideFrameFunc(WPARAM wParam, LPARAM lParam)
INT_PTR ShowFrameFunc(WPARAM wParam, LPARAM lParam)
{
- if ( ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (g_bFramesExist) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (!(flags & F_VISIBLE))
CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
@@ -2257,7 +2255,7 @@ INT_PTR ShowFrameFunc(WPARAM wParam, LPARAM lParam)
INT_PTR HideFrameFunc(WPARAM wParam, LPARAM lParam)
{
- if (ServiceExists(MS_CLIST_FRAMES_ADDFRAME)) {
+ if (g_bFramesExist) {
int flags = CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLAGS, frame_id), 0);
if (flags & F_VISIBLE)
CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp
index 3956494c9c..454429dd13 100644
--- a/plugins/MyDetails/src/mydetails.cpp
+++ b/plugins/MyDetails/src/mydetails.cpp
@@ -648,6 +648,7 @@ extern "C" __declspec(dllexport) int Load()
nickname_dialog_open = 0;
status_msg_dialog_open = 0;
+ g_bFramesExist = ServiceExists(MS_CLIST_FRAMES_ADDFRAME) != 0;
// Options
InitOptions();
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp
index 40002dccc6..fb293223a7 100644
--- a/plugins/MyDetails/src/options.cpp
+++ b/plugins/MyDetails/src/options.cpp
@@ -50,6 +50,7 @@ static OptPageControl pageControls[] = {
{ &opts.draw_avatar_custom_corner_size, CONTROL_SPIN, IDC_AVATAR_CUSTOM_CORNER_SIZE, "AvatarCustomCornerSize", (WORD) 4, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN, (WORD) 1, (WORD) 255 },
{ &opts.use_avatar_space_to_draw_text, CONTROL_CHECKBOX, IDC_AVATAR_USE_FREE_SPACE, "AvatarUseFreeSpaceToDrawText", (BYTE) 1 },
{ &opts.resize_frame, CONTROL_CHECKBOX, IDC_RESIZE_FRAME, "ResizeFrame", (BYTE) 0 },
+ { &opts.use_skinning, CONTROL_CHECKBOX, IDC_USE_SKINNING, "UseSkinning", (BYTE) 0 },
{ &opts.borders[RIGHT], CONTROL_SPIN, IDC_BORDER_RIGHT, "BorderRight", (WORD) 8, IDC_BORDER_RIGHT_SPIN, (WORD) 0, (WORD) 255 },
{ &opts.borders[LEFT], CONTROL_SPIN, IDC_BORDER_LEFT, "BorderLeft", (WORD) 8, IDC_BORDER_LEFT_SPIN, (WORD) 0, (WORD) 255 },
{ &opts.borders[TOP], CONTROL_SPIN, IDC_BORDER_TOP, "BorderTop", (WORD) 8, IDC_BORDER_TOP_SPIN, (WORD) 0, (WORD) 255 },
diff --git a/plugins/MyDetails/src/options.h b/plugins/MyDetails/src/options.h
index c8b11ef725..8e215e80e3 100644
--- a/plugins/MyDetails/src/options.h
+++ b/plugins/MyDetails/src/options.h
@@ -48,7 +48,7 @@ struct Options
bool draw_avatar_custom_size;
bool draw_avatar_allow_to_grow;
- int draw_avatar_custom_size_pixels;
+ int draw_avatar_custom_size_pixels;
bool draw_avatar_border;
COLORREF draw_avatar_border_color;
bool draw_avatar_round_corner;
@@ -61,6 +61,7 @@ struct Options
bool use_avatar_space_to_draw_text;
bool resize_frame;
+ bool use_skinning;
int refresh_status_message_timer;
};
diff --git a/plugins/MyDetails/src/resource.h b/plugins/MyDetails/src/resource.h
index 53e7dae134..5e4fb7084b 100644
--- a/plugins/MyDetails/src/resource.h
+++ b/plugins/MyDetails/src/resource.h
@@ -45,6 +45,7 @@
#define IDC_AVATAR_CUSTOM_SIZE_CHK 1765
#define IDC_AVATAR_ROUND_CORNERS 1800
#define IDC_AVATAR_USE_FREE_SPACE 1801
+#define IDC_USE_SKINNING 1838
#define IDC_AVATAR_BORDER_COLOR_L 1839
#define IDC_AVATAR_BORDER_COLOR 1840
#define IDC_AVATAR_BKG_COLOR_L 1841