diff options
Diffstat (limited to 'plugins/MyDetails/src')
-rw-r--r-- | plugins/MyDetails/src/commons.h | 4 | ||||
-rw-r--r-- | plugins/MyDetails/src/frame.cpp | 434 | ||||
-rw-r--r-- | plugins/MyDetails/src/mydetails.cpp | 204 | ||||
-rw-r--r-- | plugins/MyDetails/src/options.cpp | 142 |
4 files changed, 384 insertions, 400 deletions
diff --git a/plugins/MyDetails/src/commons.h b/plugins/MyDetails/src/commons.h index dca54c9d74..408feb8ba8 100644 --- a/plugins/MyDetails/src/commons.h +++ b/plugins/MyDetails/src/commons.h @@ -78,8 +78,8 @@ static __inline int DRAW_TEXT(HDC hDC, LPCTSTR lpString, int nCount, LPRECT lpRe if (!opts.replace_smileys)
return DrawText(hDC, lpString, nCount, lpRect, uFormat);
- return Smileys_DrawText(hDC, lpString, nCount, lpRect, uFormat | (opts.resize_smileys ? DT_RESIZE_SMILEYS : 0),
- opts.use_contact_list_smileys ? "clist" : protocol, NULL);
+ return Smileys_DrawText(hDC, lpString, nCount, lpRect, uFormat | (opts.resize_smileys ? DT_RESIZE_SMILEYS : 0),
+ opts.use_contact_list_smileys ? "clist" : protocol, NULL);
}
#endif // __COMMONS_H__
diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 358dfd9d02..383ea5bb31 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -21,9 +21,9 @@ Boston, MA 02111-1307, USA. // Prototypes /////////////////////////////////////////////////////////////////////////////////////
-#define WINDOW_NAME_PREFIX "mydetails_window"
-#define WINDOW_CLASS_NAME _T("MyDetailsFrame")
-#define CONTAINER_CLASS_NAME _T("MyDetailsFrameContainer")
+#define WINDOW_NAME_PREFIX "mydetails_window"
+#define WINDOW_CLASS_NAME _T("MyDetailsFrame")
+#define CONTAINER_CLASS_NAME _T("MyDetailsFrameContainer")
#define ID_FRAME_TIMER 1011
#define ID_RECALC_TIMER 1012
@@ -39,12 +39,12 @@ Boston, MA 02111-1307, USA. // Messages
-#define MWM_REFRESH (WM_USER+10)
-#define MWM_NICK_CHANGED (WM_USER+11)
-#define MWM_STATUS_CHANGED (WM_USER+12)
-#define MWM_STATUS_MSG_CHANGED (WM_USER+13)
-#define MWM_AVATAR_CHANGED (WM_USER+14)
-#define MWM_LISTENINGTO_CHANGED (WM_USER+15)
+#define MWM_REFRESH (WM_USER + 10)
+#define MWM_NICK_CHANGED (WM_USER + 11)
+#define MWM_STATUS_CHANGED (WM_USER + 12)
+#define MWM_STATUS_MSG_CHANGED (WM_USER + 13)
+#define MWM_AVATAR_CHANGED (WM_USER + 14)
+#define MWM_LISTENINGTO_CHANGED (WM_USER + 15)
HWND hwnd_frame = NULL;
@@ -68,14 +68,14 @@ COLORREF font_colour[NUM_FONTS]; // Defaults
char *font_settings[] = { "NicknameFont", "AccountFont", "StatusFont", "StatusMessageFont", "ListeningToFont" };
-TCHAR *font_names[] = { LPGENT("Nickname"), LPGENT("Account"), LPGENT("Status"), LPGENT("Status Message"), LPGENT("Listening To") };
+TCHAR *font_names[] = { LPGENT("Nickname"), LPGENT("Account"), LPGENT("Status"), LPGENT("Status message"), LPGENT("Listening to") };
char font_sizes[] = { 13, 8, 8, 8, 8 };
BYTE font_styles[] = { DBFONTF_BOLD, 0, 0, DBFONTF_ITALIC, DBFONTF_ITALIC };
-COLORREF font_colors[] = { RGB(0,0,0), RGB(0,0,0), RGB(0,0,0), RGB(150,150,150), RGB(150,150,150) };
+COLORREF font_colors[] = { RGB(0, 0, 0), RGB(0, 0, 0), RGB(0, 0, 0), RGB(150, 150, 150), RGB(150, 150, 150) };
static ColourID
- bg_colour = { sizeof(bg_colour), LPGEN("My Details"), LPGEN("Background"), MODULE_NAME, "BackgroundColor", 0, GetSysColor(COLOR_BTNFACE) },
- av_colour = { sizeof(av_colour), LPGEN("My Details"), LPGEN("Avatar Border"), MODULE_NAME, "AvatarBorderColor", 0, RGB(0,0,0) };
+ bg_colour = { sizeof(bg_colour), LPGEN("My details"), LPGEN("Background"), MODULE_NAME, "BackgroundColor", 0, GetSysColor(COLOR_BTNFACE) },
+ av_colour = { sizeof(av_colour), LPGEN("My details"), LPGEN("Avatar border"), MODULE_NAME, "AvatarBorderColor", 0, RGB(0, 0, 0) };
int CreateFrame();
void FixMainMenu();
@@ -172,8 +172,8 @@ void InitFrames() HookEvent(ME_DB_CONTACT_SETTINGCHANGED, SettingsChangedHook);
HookEvent(ME_AV_MYAVATARCHANGED, AvatarChangedHook);
HookEvent(ME_PROTO_ACK, ProtoAckHook);
- HookEvent(ME_SMILEYADD_OPTIONSCHANGED,SmileyAddOptionsChangedHook);
- HookEvent(ME_LISTENINGTO_ENABLE_STATE_CHANGED,ListeningtoEnableStateChangedHook);
+ HookEvent(ME_SMILEYADD_OPTIONSCHANGED, SmileyAddOptionsChangedHook);
+ HookEvent(ME_LISTENINGTO_ENABLE_STATE_CHANGED, ListeningtoEnableStateChangedHook);
}
void DeInitFrames()
@@ -181,7 +181,7 @@ void DeInitFrames() if (g_bFramesExist && frame_id != -1)
CallService(MS_CLIST_FRAMES_REMOVEFRAME, (WPARAM)frame_id, 0);
- for (int i = 0 ; i < NUM_FONTS ; i++ )
+ for (int i = 0 ; i < NUM_FONTS ; i++)
if (hFont[i] != 0)
DeleteObject(hFont[i]);
@@ -193,7 +193,7 @@ void DeInitFrames() int ReloadFont(WPARAM wParam, LPARAM lParam)
{
- for (int i = 0 ; i < NUM_FONTS ; i++ ) {
+ for (int i = 0 ; i < NUM_FONTS ; i++) {
if (hFont[i] != 0)
DeleteObject(hFont[i]);
@@ -206,16 +206,16 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) return 0;
}
-int ReloadColour(WPARAM,LPARAM)
+int ReloadColour(WPARAM, LPARAM)
{
- opts.bkg_color = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&bg_colour,0);
- opts.draw_avatar_border_color = (COLORREF)CallService(MS_COLOUR_GET,(WPARAM)&av_colour,0);
+ opts.bkg_color = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&bg_colour, 0);
+ opts.draw_avatar_border_color = (COLORREF)CallService(MS_COLOUR_GET, (WPARAM)&av_colour, 0);
RefreshFrame();
return 0;
}
-int SmileyAddOptionsChangedHook(WPARAM wParam,LPARAM lParam)
+int SmileyAddOptionsChangedHook(WPARAM wParam, LPARAM lParam)
{
RefreshFrame();
return 0;
@@ -227,18 +227,18 @@ int CreateFrame() ColourRegister(&bg_colour);
ColourRegister(&av_colour);
- ReloadColour(0,0);
+ ReloadColour(0, 0);
HookEvent(ME_COLOUR_RELOAD, ReloadColour);
for (int i = 0 ; i < NUM_FONTS ; i++) {
ZeroMemory(&font_id[i], sizeof(font_id[i]));
font_id[i].cbSize = sizeof(FontIDT);
- _tcsncpy(font_id[i].group, LPGENT("My Details"), SIZEOF(font_id[i].group));
+ _tcsncpy(font_id[i].group, LPGENT("My details"), SIZEOF(font_id[i].group));
_tcsncpy(font_id[i].name, font_names[i], SIZEOF(font_id[i].name));
strncpy(font_id[i].dbSettingsGroup, MODULE_NAME, SIZEOF(font_id[i].dbSettingsGroup));
_tcsncpy(font_id[i].backgroundName, LPGENT("Background"), SIZEOF(font_id[i].backgroundName));
- _tcsncpy(font_id[i].backgroundGroup, LPGENT("My Details"), SIZEOF(font_id[i].backgroundGroup));
+ _tcsncpy(font_id[i].backgroundGroup, LPGENT("My details"), SIZEOF(font_id[i].backgroundGroup));
strncpy(font_id[i].prefix, font_settings[i], SIZEOF(font_id[i].prefix));
@@ -254,31 +254,30 @@ int CreateFrame() ReleaseDC(NULL, hdc);
- ReloadFont(0,0);
+ ReloadFont(0, 0);
HookEvent(ME_FONT_RELOAD, ReloadFont);
WNDCLASS wndclass;
- wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; //CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = FrameWindowProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; //CS_PARENTDC | CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = FrameWindowProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = WINDOW_CLASS_NAME;
RegisterClass(&wndclass);
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);
+ 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);
CLISTFrame Frame = {0};
Frame.cbSize = sizeof(Frame);
- Frame.tname = TranslateT("My Details");
+ Frame.tname = TranslateT("My details");
Frame.cbSize = sizeof(CLISTFrame);
Frame.hWnd = hwnd_frame;
Frame.align = alTop;
@@ -287,7 +286,7 @@ int CreateFrame() Frame.height = 100;
frame_id = CallService(MS_CLIST_FRAMES_ADDFRAME, (WPARAM)&Frame, 0);
- if ( db_get_b(NULL, "MyDetails", "ForceHideFrame", 0)) {
+ if (db_get_b(NULL, "MyDetails", "ForceHideFrame", 0)) {
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);
@@ -295,7 +294,7 @@ int CreateFrame() db_unset(NULL, "MyDetails", "ForceHideFrame");
}
- if ( db_get_b(NULL, "MyDetails", "ForceShowFrame", 0)) {
+ if (db_get_b(NULL, "MyDetails", "ForceShowFrame", 0)) {
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);
@@ -304,25 +303,24 @@ int CreateFrame() }
}
else {
- wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;//CS_HREDRAW | CS_VREDRAW;
- wndclass.lpfnWndProc = FrameContainerWindowProc;
- wndclass.cbClsExtra = 0;
- wndclass.cbWndExtra = 0;
- wndclass.hInstance = hInst;
- wndclass.hIcon = NULL;
- wndclass.hCursor = LoadCursor (NULL, IDC_ARROW);
+ wndclass.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW;//CS_HREDRAW | CS_VREDRAW;
+ wndclass.lpfnWndProc = FrameContainerWindowProc;
+ wndclass.cbClsExtra = 0;
+ wndclass.cbWndExtra = 0;
+ wndclass.hInstance = hInst;
+ wndclass.hIcon = NULL;
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = 0; //(HBRUSH)(COLOR_3DFACE+1);
- wndclass.lpszMenuName = NULL;
+ wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = CONTAINER_CLASS_NAME;
RegisterClass(&wndclass);
- hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My Details"),
+ hwnd_container = CreateWindowEx(WS_EX_TOOLWINDOW, CONTAINER_CLASS_NAME, TranslateT("My details"),
(WS_THICKFRAME | WS_CAPTION | WS_SYSMENU) & ~WS_VISIBLE,
- 0,0,200,130, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL);
+ 0, 0, 200, 130, (HWND)CallService(MS_CLUI_GETHWND, 0, 0), NULL, hInst, NULL);
- hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My Details"),
- WS_CHILD | WS_VISIBLE,
- 0,0,10,10, hwnd_container, NULL, hInst, NULL);
+ hwnd_frame = CreateWindow(WINDOW_CLASS_NAME, TranslateT("My details"), WS_CHILD | WS_VISIBLE,
+ 0, 0, 10, 10, hwnd_container, NULL, hInst, NULL);
SetWindowLongPtr(hwnd_container, GWLP_USERDATA, (LONG_PTR)hwnd_frame);
SendMessage(hwnd_container, WM_SIZE, 0, 0);
@@ -332,14 +330,14 @@ int CreateFrame() CLISTMENUITEM mi = { sizeof(mi) };
mi.flags = CMIF_TCHAR;
mi.popupPosition = -0x7FFFFFFF;
- mi.ptszPopupName = LPGENT("My Details");
+ mi.ptszPopupName = LPGENT("My details");
mi.position = 1; // 500010000
mi.hIcon = LoadSkinnedIcon(SKINICON_OTHER_USERDETAILS);
- mi.ptszName = LPGENT("Show My Details");
- mi.pszService= MODULE_NAME "/ShowHideMyDetails";
+ mi.ptszName = LPGENT("Show my details");
+ mi.pszService = MODULE_NAME"/ShowHideMyDetails";
hMenuShowHideFrame = Menu_AddMainMenuItem(&mi);
- if ( db_get_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) {
+ if (db_get_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1) == 1) {
ShowWindow(hwnd_container, SW_SHOW);
FixMainMenu();
}
@@ -351,7 +349,6 @@ int CreateFrame() return 0;
}
-
bool FrameIsFloating()
{
if (frame_id == -1)
@@ -360,7 +357,6 @@ bool FrameIsFloating() return (CallService(MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM(FO_FLOATING, frame_id), 0) != 0);
}
-
LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg) {
@@ -403,7 +399,7 @@ BOOL ScreenToClient(HWND hWnd, LPRECT lpRect) pt.y = lpRect->top;
BOOL ret = ScreenToClient(hWnd, &pt);
- if ( !ret)
+ if (!ret)
return ret;
lpRect->left = pt.x;
@@ -436,8 +432,7 @@ RECT GetInnerRect(const RECT &rc, const RECT &clipping) return rc_ret;
}
-RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left, bool frame = true,
- bool end_elipsis_on_frame = true)
+RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left, bool frame = true, bool end_elipsis_on_frame = true)
{
RECT r = rc;
@@ -480,7 +475,7 @@ RECT GetRect(HDC hdc, RECT rc, SIZE s, UINT uFormat, int next_top, int text_left }
RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protocol *proto, UINT uFormat,
- int next_top, int text_left, bool smileys = true, bool frame = true, bool end_elipsis_on_frame = true)
+ int next_top, int text_left, bool smileys = true, bool frame = true, bool end_elipsis_on_frame = true)
{
const TCHAR *tmp;
@@ -497,7 +492,8 @@ RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protoco // Only first line
TCHAR *tmp2 = _tcsdup(tmp);
TCHAR *pos = _tcschr(tmp2, '\r');
- if (pos != NULL) pos[0] = '\0';
+ if (pos != NULL)
+ pos[0] = '\0';
pos = _tcschr(tmp2, '\n');
if (pos != NULL)
pos[0] = '\0';
@@ -523,7 +519,7 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) // struct specifying control classes to register
INITCOMMONCONTROLSEX iccex;
iccex.dwSize = sizeof(iccex);
- iccex.dwICC = ICC_BAR_CLASSES;
+ iccex.dwICC = ICC_BAR_CLASSES;
if (!InitCommonControlsEx(&iccex))
return NULL;
@@ -557,8 +553,8 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) ti.rect.bottom = rect.bottom;
/* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
- SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti);
- SendMessage(hwndTT, TTM_SETDELAYTIME, (WPARAM) (DWORD) TTDT_AUTOPOP, (LPARAM) MAKELONG(24 * 60 * 60 * 1000, 0));
+ SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM)(LPTOOLINFO)&ti);
+ SendMessage(hwndTT, TTM_SETDELAYTIME, (WPARAM)(DWORD)TTDT_AUTOPOP, (LPARAM)MAKELONG(24 * 60 * 60 * 1000, 0));
return hwndTT;
}
@@ -599,7 +595,7 @@ void DeleteTooltipWindows(MyDetailsFrameData *data) void CalcRectangles(HWND hwnd)
{
HDC hdc = GetDC(hwnd);
- HFONT hOldFont = (HFONT) GetCurrentObject(hdc, OBJ_FONT);
+ HFONT hOldFont = (HFONT)GetCurrentObject(hdc, OBJ_FONT);
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (hdc == NULL || data == NULL)
@@ -661,8 +657,8 @@ void CalcRectangles(HWND hwnd) int avatar_bottom = 0;
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS
- | (opts.draw_text_align_right ? DT_RIGHT : DT_LEFT)
- | (opts.draw_text_rtl ? DT_RTLREADING : 0);
+ | (opts.draw_text_align_right ? DT_RIGHT : DT_LEFT)
+ | (opts.draw_text_rtl ? DT_RTLREADING : 0);
// make some borders
r.left += min(opts.borders[LEFT], r.right);
@@ -706,7 +702,7 @@ void CalcRectangles(HWND hwnd) }
// Fit to image proportions
- if ( !opts.draw_avatar_allow_to_grow) {
+ if (!opts.draw_avatar_allow_to_grow) {
if (width > bmp.bmWidth)
width = bmp.bmWidth;
@@ -714,7 +710,7 @@ void CalcRectangles(HWND hwnd) height = bmp.bmHeight;
}
- if ( !opts.resize_frame && height * bmp.bmWidth / bmp.bmHeight <= width)
+ if (!opts.resize_frame && height * bmp.bmWidth / bmp.bmHeight <= width)
width = height * bmp.bmWidth / bmp.bmHeight;
else
height = width * bmp.bmHeight / bmp.bmWidth;
@@ -761,8 +757,7 @@ void CalcRectangles(HWND hwnd) if (opts.show_protocol_cycle_button)
tmp_r.right -= 2 * ICON_SIZE;
- data->proto_rect = GetRect(hdc, tmp_r, proto->description, _T(""), proto, uFormat,
- next_top, tmp_text_left, false, true, false);
+ data->proto_rect = GetRect(hdc, tmp_r, proto->description, _T(""), proto, uFormat, next_top, tmp_text_left, false, true, false);
if (opts.show_protocol_cycle_button) {
data->draw_proto_cycle= true;
@@ -804,7 +799,8 @@ void CalcRectangles(HWND hwnd) next_top = max(data->next_proto_rect.bottom, data->proto_rect.bottom) + SPACE_TEXT_TEXT;
}
- else next_top = data->proto_rect.bottom + SPACE_TEXT_TEXT;
+ else
+ next_top = data->proto_rect.bottom + SPACE_TEXT_TEXT;
}
// Fits more?
@@ -904,8 +900,7 @@ void CalcRectangles(HWND hwnd) if (proto->listening_to[0] == '\0') {
SelectObject(hdc, hFont[FONT_LISTENING_TO]);
- data->listening_to_rect = GetRect(hdc, r, proto->listening_to, DEFAULT_LISTENING_TO, proto, uFormat,
- next_top, text_left);
+ data->listening_to_rect = GetRect(hdc, r, proto->listening_to, DEFAULT_LISTENING_TO, proto, uFormat, next_top, text_left);
data->listening_to_text_rect = data->listening_to_rect;
ZeroMemory(&data->listening_to_icon_rect, sizeof(data->listening_to_icon_rect));
@@ -986,7 +981,7 @@ void CalcRectangles(HWND hwnd) SetWindowPos(parent, 0, 0, 0, rp_window.right - rp_window.left, size + diff, SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
}
}
- else if ( IsWindowVisible(hwnd)) {
+ 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));
@@ -1001,18 +996,17 @@ finish: ReleaseDC(hwnd, hdc);
}
-
HBITMAP CreateBitmap32(int cx, int cy)
{
BITMAPINFO RGB32BitsBITMAPINFO;
- UINT * ptPixels;
+ UINT *ptPixels;
- ZeroMemory(&RGB32BitsBITMAPINFO,sizeof(BITMAPINFO));
- RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
- RGB32BitsBITMAPINFO.bmiHeader.biWidth=cx;//bm.bmWidth;
- RGB32BitsBITMAPINFO.bmiHeader.biHeight=cy;//bm.bmHeight;
- RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1;
- RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32;
+ ZeroMemory(&RGB32BitsBITMAPINFO, sizeof(BITMAPINFO));
+ RGB32BitsBITMAPINFO.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ RGB32BitsBITMAPINFO.bmiHeader.biWidth = cx;//bm.bmWidth;
+ RGB32BitsBITMAPINFO.bmiHeader.biHeight = cy;//bm.bmHeight;
+ RGB32BitsBITMAPINFO.bmiHeader.biPlanes = 1;
+ RGB32BitsBITMAPINFO.bmiHeader.biBitCount = 32;
HBITMAP DirectBitmap = CreateDIBSection(NULL,
&RGB32BitsBITMAPINFO,
@@ -1027,7 +1021,7 @@ void EraseBackground(HWND hwnd, HDC hdc) RECT r;
GetClientRect(hwnd, &r);
- if ( opts.use_skinning && isSkinEngineEnabled() && !FrameIsFloating())
+ if (opts.use_skinning && isSkinEngineEnabled() && !FrameIsFloating())
SkinDrawWindowBack(hwnd, hdc, &r, "Main,ID=Background");
else {
HBRUSH hB = CreateSolidBrush(opts.bkg_color);
@@ -1064,8 +1058,7 @@ void DrawTextWithRect(HDC hdc, const TCHAR *text, const TCHAR *def_text, RECT rc RECT rc_tmp;
int text_height;
- if (mouse_over)
- {
+ if (mouse_over) {
uFormat &= ~DT_END_ELLIPSIS;
rc_tmp = r;
@@ -1096,7 +1089,7 @@ void DrawTextWithRect(HDC hdc, const TCHAR *text, const TCHAR *def_text, RECT rc DeleteObject(rgn);
if (mouse_over)
- FrameRect(hdc, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH));
+ FrameRect(hdc, &rc, (HBRUSH)GetStockObject(GRAY_BRUSH));
free(tmp2);
}
@@ -1119,11 +1112,11 @@ void Draw(HWND hwnd, HDC hdc_orig) RECT r = r_full;
HDC hdc = CreateCompatibleDC(hdc_orig);
- HBITMAP hBmp = CreateBitmap32(r.right,r.bottom);
+ HBITMAP hBmp = CreateBitmap32(r.right, r.bottom);
HBITMAP old_bitmap = (HBITMAP)SelectObject(hdc, hBmp);
int old_bk_mode = SetBkMode(hdc, TRANSPARENT);
- HFONT old_font = (HFONT) SelectObject(hdc, hFont[0]);
+ HFONT old_font = (HFONT)SelectObject(hdc, hFont[0]);
COLORREF old_color = GetTextColor(hdc);
SetStretchBltMode(hdc, HALFTONE);
@@ -1138,8 +1131,8 @@ void Draw(HWND hwnd, HDC hdc_orig) // Draw items
UINT uFormat = DT_SINGLELINE | DT_NOPREFIX | DT_END_ELLIPSIS
- | (opts.draw_text_align_right ? DT_RIGHT : DT_LEFT)
- | (opts.draw_text_rtl ? DT_RTLREADING : 0);
+ | (opts.draw_text_align_right ? DT_RIGHT : DT_LEFT)
+ | (opts.draw_text_rtl ? DT_RTLREADING : 0);
// Image
if (data->draw_img) {
@@ -1157,19 +1150,20 @@ void Draw(HWND hwnd, HDC hdc_orig) else
round_radius = min(width, height) / 6;
}
- else round_radius = 0;
+ else
+ round_radius = 0;
AVATARDRAWREQUEST adr = { sizeof(AVATARDRAWREQUEST) };
adr.hTargetDC = hdc;
adr.rcDraw = data->img_rect;
- adr.dwFlags = AVDRQ_OWNPIC | AVDRQ_HIDEBORDERONTRANSPARENCY |
- (opts.draw_avatar_border ? AVDRQ_DRAWBORDER : 0 ) |
- (opts.draw_avatar_round_corner ? AVDRQ_ROUNDEDCORNER : 0 );
+ adr.dwFlags = AVDRQ_OWNPIC | AVDRQ_HIDEBORDERONTRANSPARENCY
+ | (opts.draw_avatar_border ? AVDRQ_DRAWBORDER : 0 )
+ | (opts.draw_avatar_round_corner ? AVDRQ_ROUNDEDCORNER : 0 );
adr.clrBorder = opts.draw_avatar_border_color;
adr.radius = round_radius;
adr.alpha = 255;
adr.szProto = proto->name;
- CallService(MS_AV_DRAWAVATAR, 0, (LPARAM) &adr);
+ CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&adr);
// Clipping rgn
SelectClipRgn(hdc, NULL);
@@ -1185,8 +1179,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SelectObject(hdc, hFont[FONT_NICK]);
SetTextColor(hdc, font_colour[FONT_NICK]);
- DrawTextWithRect(hdc, proto->nickname, DEFAULT_NICKNAME, rc, uFormat,
- data->mouse_over_nick && proto->CanSetNick(), proto);
+ DrawTextWithRect(hdc, proto->nickname, DEFAULT_NICKNAME, rc, uFormat, data->mouse_over_nick && proto->CanSetNick(), proto);
// Clipping rgn
SelectClipRgn(hdc, NULL);
@@ -1244,7 +1237,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DeleteObject(rgn);
if (data->mouse_over_proto)
- FrameRect(hdc, &rc, (HBRUSH) GetStockObject(GRAY_BRUSH));
+ FrameRect(hdc, &rc, (HBRUSH)GetStockObject(GRAY_BRUSH));
}
// Status
@@ -1287,7 +1280,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DeleteObject(rgn);
if (data->mouse_over_status)
- FrameRect(hdc, &rtmp, (HBRUSH) GetStockObject(GRAY_BRUSH));
+ FrameRect(hdc, &rtmp, (HBRUSH)GetStockObject(GRAY_BRUSH));
}
// Away message
@@ -1300,7 +1293,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SetTextColor(hdc, font_colour[FONT_AWAY_MSG]);
DrawTextWithRect(hdc, proto->status_message, DEFAULT_STATUS_MESSAGE, rc, uFormat,
- data->mouse_over_away_msg && proto->CanSetStatusMsg(), proto);
+ data->mouse_over_away_msg && proto->CanSetStatusMsg(), proto);
// Clipping rgn
SelectClipRgn(hdc, NULL);
@@ -1318,7 +1311,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SetTextColor(hdc, font_colour[FONT_LISTENING_TO]);
DrawTextWithRect(hdc, proto->listening_to, DEFAULT_LISTENING_TO, rc, uFormat,
- data->mouse_over_listening_to && protocols->CanSetListeningTo(), proto);
+ data->mouse_over_listening_to && protocols->CanSetListeningTo(), proto);
// Clipping rgn
SelectClipRgn(hdc, NULL);
@@ -1358,7 +1351,7 @@ void Draw(HWND hwnd, HDC hdc_orig) DeleteObject(rgn);
if (data->mouse_over_listening_to && protocols->CanSetListeningTo())
- FrameRect(hdc, &rtmp, (HBRUSH) GetStockObject(GRAY_BRUSH));
+ FrameRect(hdc, &rtmp, (HBRUSH)GetStockObject(GRAY_BRUSH));
}
}
@@ -1366,8 +1359,7 @@ void Draw(HWND hwnd, HDC hdc_orig) SetTextColor(hdc, old_color);
SetBkMode(hdc, old_bk_mode);
- BitBlt(hdc_orig, r_full.left, r_full.top, r_full.right - r_full.left,
- r_full.bottom - r_full.top, hdc, r_full.left, r_full.top, SRCCOPY);
+ BitBlt(hdc_orig, r_full.left, r_full.top, r_full.right - r_full.left, r_full.bottom - r_full.top, hdc, r_full.left, r_full.top, SRCCOPY);
SelectObject(hdc, old_bitmap);
DeleteDC(hdc);
@@ -1382,7 +1374,7 @@ bool InsideRect(POINT *p, RECT *r) void MakeHover(HWND hwnd, bool draw, bool *hover, POINT *p, RECT *r)
{
if (draw && p != NULL && r != NULL && InsideRect(p, r)) {
- if ( !*hover) {
+ if (!*hover) {
*hover = true;
InvalidateRect(hwnd, NULL, FALSE);
@@ -1406,19 +1398,19 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, HMENU submenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS,0,0);
p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left);
- p.y = data->status_rect.bottom+1;
+ p.y = data->status_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
if (ret)
- CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret),MPCF_MAINMENU),0);
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret), MPCF_MAINMENU), 0);
}
void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, POINT &p)
{
- HMENU menu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS,0,0);
+ HMENU menu = (HMENU)CallService(MS_CLIST_MENUGETSTATUS, 0, 0);
HMENU submenu = NULL;
if (menu != NULL) {
@@ -1434,10 +1426,10 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto if (mii.cch != 0) {
mii.cch++;
- mii.dwTypeData = (TCHAR*)malloc(sizeof(TCHAR) * mii.cch);
+ mii.dwTypeData = (TCHAR *)malloc(sizeof(TCHAR) * mii.cch);
GetMenuItemInfo(menu, i, TRUE, &mii);
- if ( _tcscmp(mii.dwTypeData, proto->description) == 0)
+ if (_tcscmp(mii.dwTypeData, proto->description) == 0)
submenu = GetSubMenu(menu, i);
free(mii.dwTypeData);
@@ -1450,35 +1442,36 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto if (submenu != NULL) {
p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left);
- p.y = data->status_rect.bottom+1;
+ p.y = data->status_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
if (ret)
- CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret),MPCF_MAINMENU),0);
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(ret), MPCF_MAINMENU), 0);
}
else {
// Well, lets do it by hand
- static int statusModePf2List[]={0xFFFFFFFF,PF2_ONLINE,PF2_SHORTAWAY,PF2_LONGAWAY,PF2_LIGHTDND,PF2_HEAVYDND,PF2_FREECHAT,PF2_INVISIBLE,PF2_ONTHEPHONE,PF2_OUTTOLUNCH};
+ static int statusModePf2List[] = { 0xFFFFFFFF, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT,
+ PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH };
menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1));
submenu = GetSubMenu(menu, 0);
TranslateMenu(submenu);
// Hide menu
- DWORD flags = CallProtoService(proto->name, PS_GETCAPS, PFLAGNUM_2,0);
- for ( int i = GetMenuItemCount(submenu) -1 ; i >= 0 ; i-- )
- if ( !(flags & statusModePf2List[i]))
+ DWORD flags = CallProtoService(proto->name, PS_GETCAPS, PFLAGNUM_2, 0);
+ for (int i = GetMenuItemCount(submenu) - 1; i >= 0; i--)
+ if (!(flags & statusModePf2List[i]))
RemoveMenu(submenu, i, MF_BYPOSITION);
p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left);
- p.y = data->status_rect.bottom+1;
+ p.y = data->status_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
if (ret)
proto->SetStatus(ret);
@@ -1493,7 +1486,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P // Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable Listening To for %s"), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable listening to for %s"), proto->description);
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -1504,7 +1497,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.cch = (int)_tcslen(tmp);
mii.wID = 1;
- if ( !proto->CanSetListeningTo())
+ if (!proto->CanSetListeningTo())
mii.fState |= MFS_DISABLED;
InsertMenuItem(submenu, 0, TRUE, &mii);
@@ -1514,22 +1507,22 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P mii.fMask = MIIM_STATE;
mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0;
- if ( !protocols->CanSetListeningTo())
+ if (!protocols->CanSetListeningTo())
mii.fState |= MFS_DISABLED;
SetMenuItemInfo(submenu, ID_LISTENINGTOPOPUP_SENDLISTENINGTO, FALSE, &mii);
p.x = (opts.draw_text_align_right ? data->listening_to_rect.right : data->listening_to_rect.left);
- p.y = data->listening_to_rect.bottom+1;
+ p.y = data->listening_to_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD
- | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD
+ | (opts.draw_text_align_right ? TPM_RIGHTALIGN : TPM_LEFTALIGN), p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
switch(ret) {
case 1:
- CallService(MS_LISTENINGTO_ENABLE, (LPARAM) proto->name, !proto->ListeningToEnabled());
+ CallService(MS_LISTENINGTO_ENABLE, (LPARAM)proto->name, !proto->ListeningToEnabled());
break;
case ID_LISTENINGTOPOPUP_SENDLISTENINGTO:
@@ -1548,13 +1541,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar {
data = new MyDetailsFrameData();
ZeroMemory(data, sizeof(MyDetailsFrameData));
- SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) data);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)data);
data->recalc_rectangles = true;
data->get_status_messages = false;
data->showing_menu = false;
- data->protocol_number = db_get_w(NULL,"MyDetails","ProtocolNumber",0);
+ data->protocol_number = db_get_w(NULL, "MyDetails", "ProtocolNumber", 0);
if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
@@ -1594,7 +1587,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_TIMER:
if (wParam == ID_FRAME_TIMER) {
- if ( !data->showing_menu)
+ if (!data->showing_menu)
CallService(MS_MYDETAILS_SHOWNEXTPROTOCOL, 0, 0);
}
else if (wParam == ID_RECALC_TIMER) {
@@ -1634,14 +1627,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (opts.global_on_avatar)
CallService(MS_MYDETAILS_SETMYAVATARUI, 0, 0);
else
- CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM)proto->name);
}
// In nick?
else if (data->draw_nick && InsideRect(&p, &data->nick_rect) && proto->CanSetNick()) {
if (opts.global_on_nickname)
CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, 0);
else
- CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM)proto->name);
}
// In proto cycle button?
else if (data->draw_proto_cycle && InsideRect(&p, &data->next_proto_rect))
@@ -1654,7 +1647,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (opts.global_on_status_message)
CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, 0);
else
- CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM)proto->name);
}
// In status?
else if (data->draw_status && InsideRect(&p, &data->status_rect)) {
@@ -1677,7 +1670,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar HMENU menu = CreatePopupMenu();
- for (int i = protocols->GetSize() - 1 ; i >= 0 ; i--) {
+ for (int i = protocols->GetSize() - 1; i >= 0 ; i--) {
MENUITEMINFO mii = { sizeof(mii) };
mii.fMask = MIIM_ID | MIIM_TYPE;
mii.fType = MFT_STRING;
@@ -1697,14 +1690,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar p.x = data->proto_rect.right;
else
p.x = data->proto_rect.left;
- p.y = data->proto_rect.bottom+1;
+ p.y = data->proto_rect.bottom + 1;
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(menu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(menu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
if (ret != 0)
- PluginCommand_ShowProtocol(NULL, (WPARAM) protocols->Get(ret-1)->name);
+ PluginCommand_ShowProtocol(NULL, (WPARAM)protocols->Get(ret - 1)->name);
data->showing_menu = false;
}
@@ -1712,10 +1705,10 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case WM_MEASUREITEM:
- return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam);
+ return CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
case WM_DRAWITEM:
- return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam);
+ return CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
case WM_CONTEXTMENU:
proto = protocols->Get(data->protocol_number);
@@ -1736,7 +1729,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Avatar for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my avatar for %s..."), proto->description);
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -1746,7 +1739,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.cch = (int)_tcslen(tmp);
mii.wID = 1;
- if ( !proto->CanSetAvatar()) {
+ if (!proto->CanSetAvatar()) {
mii.fMask |= MIIM_STATE;
mii.fState = MFS_DISABLED;
}
@@ -1755,12 +1748,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
switch(ret) {
case 1:
- CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM)proto->name);
break;
case ID_AVATARPOPUP_SETMYAVATAR:
@@ -1776,7 +1769,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar // Add this proto to menu
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s..."), proto->description);
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -1786,7 +1779,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.cch = (int)_tcslen(tmp);
mii.wID = 1;
- if ( !proto->CanSetNick()) {
+ if (!proto->CanSetNick()) {
mii.fMask |= MIIM_STATE;
mii.fState = MFS_DISABLED;
}
@@ -1795,12 +1788,12 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
switch(ret) {
case 1:
- CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM)proto->name);
break;
case ID_NICKPOPUP_SETMYNICKNAME:
@@ -1824,7 +1817,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
MENUITEMINFO mii = {0};
mii.cbSize = sizeof(mii);
@@ -1834,7 +1827,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.cch = (int)_tcslen(tmp);
mii.wID = 1;
- if ( !proto->CanSetStatusMsg()) {
+ if (!proto->CanSetStatusMsg()) {
mii.fMask |= MIIM_STATE;
mii.fState = MFS_DISABLED;
}
@@ -1843,7 +1836,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar }
// Add this to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."),
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR));
MENUITEMINFO mii = {0};
@@ -1863,16 +1856,16 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
switch(ret) {
case 1:
- CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM)proto->name);
break;
case 2:
- CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, (WPARAM) proto->status, 0);
+ CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, (WPARAM)proto->status, 0);
break;
case ID_STATUSMESSAGEPOPUP_SETMYSTATUSMESSAGE:
@@ -1892,8 +1885,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar ShowListeningToMenu(hwnd, data, proto, p);
// In protocol?
- else if (data->draw_proto && InsideRect(&p, &data->proto_rect))
- {
+ else if (data->draw_proto && InsideRect(&p, &data->proto_rect)) {
}
// Default context menu
else {
@@ -1910,7 +1902,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar TCHAR tmp[128];
MENUITEMINFO mii = {0};
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable Listening To for %s"), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Enable listening to for %s"), proto->description);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1920,13 +1912,13 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.dwTypeData = tmp;
mii.cch = (int)_tcslen(tmp);
mii.wID = 5;
- if ( !proto->CanSetListeningTo())
+ if (!proto->CanSetListeningTo())
mii.fState |= MFS_DISABLED;
InsertMenuItem(submenu, 0, TRUE, &mii);
// Add this to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."),
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, proto->status, GSMDF_TCHAR));
ZeroMemory(&mii, sizeof(mii));
@@ -1946,7 +1938,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar if (protocols->CanSetStatusMsgPerProtocol()) {
// Add this proto to menu
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Status Message for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my status message for %s..."), proto->description);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1964,7 +1956,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar InsertMenuItem(submenu, 0, TRUE, &mii);
}
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s..."), proto->description);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1974,14 +1966,14 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.cch = (int)_tcslen(tmp);
mii.wID = 2;
- if ( !proto->CanSetNick()) {
+ if (!proto->CanSetNick()) {
mii.fMask |= MIIM_STATE;
mii.fState = MFS_DISABLED;
}
InsertMenuItem(submenu, 0, TRUE, &mii);
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Avatar for %s..."), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my avatar for %s..."), proto->description);
ZeroMemory(&mii, sizeof(mii));
mii.cbSize = sizeof(mii);
@@ -1991,7 +1983,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.cch = (int)_tcslen(tmp);
mii.wID = 1;
- if ( !proto->CanSetAvatar()) {
+ if (!proto->CanSetAvatar()) {
mii.fMask |= MIIM_STATE;
mii.fState = MFS_DISABLED;
}
@@ -2003,19 +1995,19 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar mii.fMask = MIIM_STATE;
mii.fState = protocols->ListeningToEnabled() ? MFS_CHECKED : 0;
- if ( !protocols->CanSetListeningTo())
+ if (!protocols->CanSetListeningTo())
mii.fState |= MFS_DISABLED;
SetMenuItemInfo(submenu, ID_CONTEXTPOPUP_ENABLELISTENINGTO, FALSE, &mii);
ClientToScreen(hwnd, &p);
- int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_LEFTALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
+ int ret = TrackPopupMenu(submenu, TPM_TOPALIGN | TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, p.x, p.y, 0, hwnd, NULL);
DestroyMenu(menu);
- switch(ret) {
+ switch (ret) {
case 1:
- CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYAVATARUI, 0, (LPARAM)proto->name);
break;
case ID_AVATARPOPUP_SETMYAVATAR:
@@ -2023,7 +2015,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case 2:
- CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYNICKNAMEUI, 0, (LPARAM)proto->name);
break;
case ID_NICKPOPUP_SETMYNICKNAME:
@@ -2031,11 +2023,11 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case 3:
- CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM) proto->name);
+ CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, 0, (LPARAM)proto->name);
break;
case 4:
- CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, (WPARAM) proto->status, 0);
+ CallService(MS_MYDETAILS_SETMYSTATUSMESSAGEUI, (WPARAM)proto->status, 0);
break;
case ID_STATUSMESSAGEPOPUP_SETMYSTATUSMESSAGE:
@@ -2043,7 +2035,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case 5:
- CallService(MS_LISTENINGTO_ENABLE, (LPARAM) proto->name, !proto->ListeningToEnabled());
+ CallService(MS_LISTENINGTO_ENABLE, (LPARAM)proto->name, !proto->ListeningToEnabled());
break;
case ID_CONTEXTPOPUP_ENABLELISTENINGTO:
@@ -2115,9 +2107,9 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case WM_NOTIFY:
{
- LPNMHDR lpnmhdr = (LPNMHDR) lParam;
+ LPNMHDR lpnmhdr = (LPNMHDR)lParam;
- int i = (int) lpnmhdr->code;
+ int i = (int)lpnmhdr->code;
switch (lpnmhdr->code) {
case TTN_GETDISPINFO:
@@ -2125,7 +2117,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd, GWLP_USERDATA);
proto = protocols->Get(data->protocol_number);
- LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO) lpnmhdr;
+ LPNMTTDISPINFO lpttd = (LPNMTTDISPINFO)lpnmhdr;
SendMessage(lpnmhdr->hwndFrom, TTM_SETMAXTIPWIDTH, 0, 300);
if (lpnmhdr->hwndFrom == data->nick_tt_hwnd)
@@ -2162,7 +2154,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case MWM_AVATAR_CHANGED:
- proto = protocols->Get((const char*)wParam);
+ proto = protocols->Get((const char *)wParam);
if (proto != NULL) {
proto->GetAvatar();
RefreshFrame();
@@ -2170,7 +2162,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case MWM_NICK_CHANGED:
- proto = protocols->Get((const char*)wParam);
+ proto = protocols->Get((const char *)wParam);
if (proto != NULL) {
proto->GetNick();
RefreshFrame();
@@ -2179,7 +2171,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar break;
case MWM_STATUS_CHANGED:
- proto = protocols->Get((const char*)wParam);
+ proto = protocols->Get((const char *)wParam);
if (proto != NULL) {
proto->GetStatus();
proto->GetStatusMsg();
@@ -2197,7 +2189,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar case MWM_LISTENINGTO_CHANGED:
if (wParam != NULL) {
- proto = protocols->Get((const char*)wParam);
+ proto = protocols->Get((const char *)wParam);
if (proto != NULL)
proto->GetListeningTo();
}
@@ -2234,7 +2226,7 @@ INT_PTR ShowFrameFunc(WPARAM wParam, LPARAM lParam) CallService(MS_CLIST_FRAMES_SHFRAME, frame_id, 0);
}
else {
- if ( !MyDetailsFrameVisible()) {
+ if (!MyDetailsFrameVisible()) {
ShowWindow(hwnd_container, SW_SHOW);
db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1);
@@ -2267,9 +2259,9 @@ void FixMainMenu() mi.flags = CMIM_NAME | CMIF_TCHAR;
if (MyDetailsFrameVisible())
- mi.ptszName = LPGENT("Hide My Details");
+ mi.ptszName = LPGENT("Hide my details");
else
- mi.ptszName = LPGENT("Show My Details");
+ mi.ptszName = LPGENT("Show my details");
Menu_ModifyItem(hMenuShowHideFrame, &mi);
}
@@ -2336,23 +2328,23 @@ void SetStatusMessageRefreshTime(HWND hwnd) {
KillTimer(hwnd, ID_STATUSMESSAGE_TIMER);
- opts.refresh_status_message_timer = db_get_w(NULL,"MyDetails","RefreshStatusMessageTimer",12);
+ opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
if (opts.refresh_status_message_timer > 0)
SetTimer(hwnd, ID_STATUSMESSAGE_TIMER, opts.refresh_status_message_timer * 1000, NULL);
}
-INT_PTR PluginCommand_ShowNextProtocol(WPARAM wParam,LPARAM lParam)
+INT_PTR PluginCommand_ShowNextProtocol(WPARAM wParam, LPARAM lParam)
{
if (hwnd_frame == NULL)
return -1;
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
- data->protocol_number ++;
+ data->protocol_number++;
if (data->protocol_number >= protocols->GetSize())
data->protocol_number = 0;
- db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
@@ -2363,18 +2355,18 @@ INT_PTR PluginCommand_ShowNextProtocol(WPARAM wParam,LPARAM lParam) return 0;
}
-INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM wParam,LPARAM lParam)
+INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM wParam, LPARAM lParam)
{
if (hwnd_frame == NULL)
return -1;
MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
- data->protocol_number --;
+ data->protocol_number--;
if (data->protocol_number < 0)
data->protocol_number = protocols->GetSize() - 1;
- db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
@@ -2385,15 +2377,15 @@ INT_PTR PluginCommand_ShowPreviousProtocol(WPARAM wParam,LPARAM lParam) return 0;
}
-INT_PTR PluginCommand_ShowProtocol(WPARAM wParam,LPARAM lParam)
+INT_PTR PluginCommand_ShowProtocol(WPARAM wParam, LPARAM lParam)
{
- char * proto = (char *)lParam;
+ char *proto = (char *)lParam;
if (proto == NULL)
return -1;
int proto_num = -1;
- for (int i = 0 ; i < protocols->GetSize() ; i++) {
- if ( _stricmp(protocols->Get(i)->name, proto) == 0) {
+ for (int i = 0 ; i < protocols->GetSize(); i++) {
+ if (_stricmp(protocols->Get(i)->name, proto) == 0) {
proto_num = i;
break;
}
@@ -2408,7 +2400,7 @@ INT_PTR PluginCommand_ShowProtocol(WPARAM wParam,LPARAM lParam) MyDetailsFrameData *data = (MyDetailsFrameData *)GetWindowLongPtr(hwnd_frame, GWLP_USERDATA);
data->protocol_number = proto_num;
- db_set_w(NULL,"MyDetails","ProtocolNumber",data->protocol_number);
+ db_set_w(NULL, "MyDetails", "ProtocolNumber", data->protocol_number);
data->recalc_rectangles = true;
@@ -2424,32 +2416,28 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) if (hwnd_frame == NULL)
return 0;
- DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
+ DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
if ((HANDLE)wParam == NULL) {
Protocol *proto = protocols->Get(cws->szModule);
- if (!strcmp(cws->szSetting,"MyHandle")
- || !strcmp(cws->szSetting,"UIN")
- || !strcmp(cws->szSetting,"Nick")
- || !strcmp(cws->szSetting,"FirstName")
- || !strcmp(cws->szSetting,"e-mail")
- || !strcmp(cws->szSetting,"LastName")
- || !strcmp(cws->szSetting,"JID"))
+ if (!strcmp(cws->szSetting, "MyHandle")
+ || !strcmp(cws->szSetting, "UIN")
+ || !strcmp(cws->szSetting, "Nick")
+ || !strcmp(cws->szSetting, "FirstName")
+ || !strcmp(cws->szSetting, "e-mail")
+ || !strcmp(cws->szSetting, "LastName")
+ || !strcmp(cws->szSetting, "JID"))
{
// Name changed
if (proto != NULL)
- PostMessage(hwnd_frame, MWM_NICK_CHANGED, (WPARAM) proto->name, 0);
+ PostMessage(hwnd_frame, MWM_NICK_CHANGED, (WPARAM)proto->name, 0);
}
- else if (strstr(cws->szModule,"Away"))
- {
+ else if (strstr(cws->szModule, "Away"))
// Status message changed
PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, 0, 0);
- }
- else if (proto != NULL && strcmp(cws->szSetting,"ListeningTo") == 0)
- {
- PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, (WPARAM) proto->name, 0);
- }
+ else if (proto != NULL && strcmp(cws->szSetting, "ListeningTo") == 0)
+ PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, (WPARAM)proto->name, 0);
}
return 0;
@@ -2460,10 +2448,10 @@ int AvatarChangedHook(WPARAM wParam, LPARAM lParam) if (hwnd_frame == NULL)
return 0;
- Protocol *proto = protocols->Get((const char*)wParam);
+ Protocol *proto = protocols->Get((const char *)wParam);
if (proto != NULL)
- PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM) proto->name, 0);
+ PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM)proto->name, 0);
return 0;
}
@@ -2473,7 +2461,7 @@ int ProtoAckHook(WPARAM wParam, LPARAM lParam) if (hwnd_frame == NULL)
return 0;
- ACKDATA *ack = (ACKDATA*)lParam;
+ ACKDATA *ack = (ACKDATA *)lParam;
if (ack->result != ACKRESULT_SUCCESS)
return 0;
@@ -2481,29 +2469,29 @@ int ProtoAckHook(WPARAM wParam, LPARAM lParam) switch (ack->type) {
case ACKTYPE_STATUS:
if (proto != NULL)
- PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM) proto->name, 0);
+ PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM)proto->name, 0);
break;
case ACKTYPE_AWAYMSG:
if (proto != NULL)
- PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, (WPARAM) proto->name, 0);
+ PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, (WPARAM)proto->name, 0);
break;
case ACKTYPE_AVATAR:
if (proto != NULL)
- PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM) proto->name, 0);
+ PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM)proto->name, 0);
break;
}
return 0;
}
-int ListeningtoEnableStateChangedHook(WPARAM wParam,LPARAM lParam)
+int ListeningtoEnableStateChangedHook(WPARAM wParam, LPARAM lParam)
{
if (hwnd_frame == NULL)
return 0;
- if (wParam == NULL || protocols->Get((const char*)wParam) != NULL)
+ if (wParam == NULL || protocols->Get((const char *)wParam) != NULL)
PostMessage(hwnd_frame, MWM_LISTENINGTO_CHANGED, wParam, 0);
return 0;
diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index 24f6cf68d4..7b8d6bf2f3 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -39,11 +39,10 @@ PLUGININFOEX pluginInfo={ {0xa82baeb3, 0xa33c, 0x4036, {0xb8, 0x37, 0x78, 0x3, 0xa5, 0xb6, 0xc2, 0xab}}
};
-static IconItem iconList[] =
-{
+static IconItem iconList[] = {
{ LPGEN("Listening to"), "LISTENING_TO_ICON", IDI_LISTENINGTO },
- { LPGEN("Previous protocol"), "MYDETAILS_PREV_PROTOCOL", IDI_LEFT_ARROW },
- { LPGEN("Next protocol"), "MYDETAILS_NEXT_PROTOCOL", IDI_RIGHT_ARROW }
+ { LPGEN("Previous account"), "MYDETAILS_PREV_PROTOCOL", IDI_LEFT_ARROW },
+ { LPGEN("Next account"), "MYDETAILS_NEXT_PROTOCOL", IDI_RIGHT_ARROW }
};
// Hooks
@@ -71,15 +70,14 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda // Set nickname ///////////////////////////////////////////////////////////////////////////////////
-#define WMU_SETDATA (WM_USER+1)
+#define WMU_SETDATA (WM_USER + 1)
static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch ( msg ) {
+ switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- SendMessage(GetDlgItem(hwndDlg, IDC_NICKNAME), EM_LIMITTEXT,
- MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE - 1, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_NICKNAME), EM_LIMITTEXT, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE - 1, 0);
return TRUE;
case WMU_SETDATA:
@@ -96,7 +94,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam TCHAR *nick = protocols->Get(0)->nickname;
bool foundDefNick = true;
- for (int i=1 ; foundDefNick && i < protocols->GetSize() ; i++) {
+ for (int i = 1; foundDefNick && i < protocols->GetSize(); i++) {
if (_tcsicmp(protocols->Get(i)->nickname, nick) != 0) {
foundDefNick = false;
break;
@@ -104,7 +102,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam }
if (foundDefNick)
- if ( _tcsicmp(protocols->default_nick, nick) != 0)
+ if (_tcsicmp(protocols->default_nick, nick) != 0)
lstrcpy(protocols->default_nick, nick);
}
@@ -115,19 +113,18 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam Protocol *proto = protocols->Get(proto_num);
TCHAR tmp[128];
- mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set My Nickname for %s"), proto->description);
+ mir_sntprintf(tmp, SIZEOF(tmp), TranslateT("Set my nickname for %s"), proto->description);
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)tmp);
HICON hIcon = (HICON)CallProtoService(proto->name, PS_LOADICON, PLI_PROTOCOL, 0);
- if (hIcon != NULL)
- {
+ if (hIcon != NULL) {
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
DestroyIcon(hIcon);
}
SetDlgItemText(hwndDlg, IDC_NICKNAME, proto->nickname);
- SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT,
+ SendDlgItemMessage(hwndDlg, IDC_NICKNAME, EM_LIMITTEXT,
min(MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE, proto->GetNickMaxLength()), 0);
}
@@ -135,7 +132,7 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam }
case WM_COMMAND:
- switch(wParam) {
+ switch (wParam) {
case IDOK:
{
TCHAR tmp[MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE];
@@ -168,9 +165,9 @@ static INT_PTR CALLBACK DlgProcSetNickname(HWND hwndDlg, UINT msg, WPARAM wParam return FALSE;
}
-static INT_PTR PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_SetMyNicknameUI(WPARAM wParam, LPARAM lParam)
{
- char *proto = (char*)lParam;
+ char *proto = (char *)lParam;
int proto_num = -1;
if (proto != NULL) {
@@ -185,36 +182,36 @@ static INT_PTR PluginCommand_SetMyNicknameUI(WPARAM wParam,LPARAM lParam) if (proto_num == -1)
return -1;
- if ( !protocols->Get(i)->CanSetNick())
+ if (!protocols->Get(i)->CanSetNick())
return -2;
}
- if ( !nickname_dialog_open) {
+ if (!nickname_dialog_open) {
InterlockedExchange(&nickname_dialog_open, 1);
- hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE( IDD_SETNICKNAME ), NULL, DlgProcSetNickname);
+ hwndSetNickname = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETNICKNAME), NULL, DlgProcSetNickname);
SendMessage(hwndSetNickname, WMU_SETDATA, proto_num, 0);
}
- SetForegroundWindow( hwndSetNickname );
- SetFocus( hwndSetNickname );
- ShowWindow( hwndSetNickname, SW_SHOW );
+ SetForegroundWindow(hwndSetNickname);
+ SetFocus(hwndSetNickname);
+ ShowWindow(hwndSetNickname, SW_SHOW);
return 0;
}
-static INT_PTR PluginCommand_SetMyNickname(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_SetMyNickname(WPARAM wParam, LPARAM lParam)
{
- char *proto = (char*)wParam;
+ char *proto = (char *)wParam;
if (proto != NULL) {
- for (int i = 0 ; i < protocols->GetSize() ; i++) {
- if ( _stricmp(protocols->Get(i)->name, proto) == 0) {
- if ( !protocols->Get(i)->CanSetNick())
+ for (int i = 0; i < protocols->GetSize(); i++) {
+ if (_stricmp(protocols->Get(i)->name, proto) == 0) {
+ if (!protocols->Get(i)->CanSetNick())
return -2;
- protocols->Get(i)->SetNick((TCHAR*)lParam);
+ protocols->Get(i)->SetNick((TCHAR *)lParam);
return 0;
}
}
@@ -222,17 +219,17 @@ static INT_PTR PluginCommand_SetMyNickname(WPARAM wParam,LPARAM lParam) return -1;
}
- protocols->SetNicks((TCHAR*)lParam);
+ protocols->SetNicks((TCHAR *)lParam);
return 0;
}
-static INT_PTR PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_GetMyNickname(WPARAM wParam, LPARAM lParam)
{
- TCHAR *ret = (TCHAR*)lParam;
+ TCHAR *ret = (TCHAR *)lParam;
if (ret == NULL)
return -1;
- char *proto = (char*)wParam;
+ char *proto = (char *)wParam;
if (proto == NULL) {
if (protocols->default_nick != NULL)
lstrcpyn(ret, protocols->default_nick, MS_MYDETAILS_GETMYNICKNAME_BUFFER_SIZE);
@@ -254,18 +251,15 @@ static INT_PTR PluginCommand_GetMyNickname(WPARAM wParam,LPARAM lParam) // Set avatar /////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_SetMyAvatarUI(WPARAM wParam, LPARAM lParam)
{
- char * proto = (char *)lParam;
+ char *proto = (char *)lParam;
int proto_num = -1;
- if (proto != NULL)
- {
+ if (proto != NULL) {
int i;
- for (i = 0 ; i < protocols->GetSize() ; i++)
- {
- if (_stricmp(protocols->Get(i)->name, proto) == 0)
- {
+ for (i = 0; i < protocols->GetSize(); i++) {
+ if (_stricmp(protocols->Get(i)->name, proto) == 0) {
proto_num = i;
break;
}
@@ -274,34 +268,28 @@ static INT_PTR PluginCommand_SetMyAvatarUI(WPARAM wParam,LPARAM lParam) if (proto_num == -1)
return -1;
- if ( !protocols->Get(i)->CanSetAvatar())
- {
+ if (!protocols->Get(i)->CanSetAvatar())
return -2;
- }
}
if (proto_num == -1)
- {
protocols->SetAvatars(NULL);
- }
else
- {
protocols->Get(proto_num)->SetAvatar(NULL);
- }
return 0;
}
-static INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- char *proto = (char*)wParam;
+ char *proto = (char *)wParam;
if (proto != NULL) {
- for (int i = 0 ; i < protocols->GetSize() ; i++) {
+ for (int i = 0; i < protocols->GetSize(); i++) {
if (_stricmp(protocols->Get(i)->name, proto) == 0) {
- if ( !protocols->Get(i)->CanSetAvatar())
+ if (!protocols->Get(i)->CanSetAvatar())
return -2;
- protocols->Get(i)->SetAvatar((TCHAR*)lParam);
+ protocols->Get(i)->SetAvatar((TCHAR *)lParam);
return 0;
}
}
@@ -309,13 +297,13 @@ static INT_PTR PluginCommand_SetMyAvatar(WPARAM wParam,LPARAM lParam) return -1;
}
- protocols->SetAvatars((TCHAR*)lParam);
+ protocols->SetAvatars((TCHAR *)lParam);
return 0;
}
int Status2SkinIcon(int status)
{
- switch(status) {
+ switch (status) {
case ID_STATUS_AWAY: return SKINICON_STATUS_AWAY;
case ID_STATUS_NA: return SKINICON_STATUS_NA;
case ID_STATUS_DND: return SKINICON_STATUS_DND;
@@ -331,10 +319,10 @@ int Status2SkinIcon(int status) return SKINICON_STATUS_OFFLINE;
}
-static INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam, LPARAM lParam)
{
- TCHAR* ret = (TCHAR*)lParam;
- char * proto = (char *)wParam;
+ TCHAR *ret = (TCHAR *)lParam;
+ char *proto = (char *)wParam;
if (ret == NULL)
return -1;
@@ -342,15 +330,15 @@ static INT_PTR PluginCommand_GetMyAvatar(WPARAM wParam,LPARAM lParam) if (proto == NULL) {
if (protocols->default_avatar_file != NULL)
lstrcpyn(ret, protocols->default_avatar_file, MS_MYDETAILS_GETMYAVATAR_BUFFER_SIZE);
- else
+ else
ret[0] = '\0';
return 0;
}
- for (int i = 0 ; i < protocols->GetSize() ; i++) {
- if ( _stricmp(protocols->Get(i)->name, proto) == 0) {
- if ( !protocols->Get(i)->CanGetAvatar())
+ for (int i = 0; i < protocols->GetSize(); i++) {
+ if (_stricmp(protocols->Get(i)->name, proto) == 0) {
+ if (!protocols->Get(i)->CanGetAvatar())
return -2;
protocols->Get(i)->GetAvatar();
@@ -397,11 +385,11 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w case WMU_SETDATA:
{
- SetStatusMessageData *data = (SetStatusMessageData *) malloc(sizeof(SetStatusMessageData));
+ SetStatusMessageData *data = (SetStatusMessageData *)malloc(sizeof(SetStatusMessageData));
data->status = (int)wParam;
data->proto_num = (int)lParam;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) data);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)data);
if (data->proto_num >= 0) {
Protocol *proto = protocols->Get(data->proto_num);
@@ -413,24 +401,22 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w }
TCHAR title[256];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Status Message for %s"), proto->description);
+ mir_sntprintf(title, SIZEOF(title), TranslateT("Set my status message for %s"), proto->description);
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, proto->GetStatusMsg());
}
- else if (data->status != 0)
- {
+ else if (data->status != 0) {
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(Status2SkinIcon(data->status)));
TCHAR title[256];
- mir_sntprintf(title, SIZEOF(title), TranslateT("Set My Status Message for %s"),
+ mir_sntprintf(title, SIZEOF(title), TranslateT("Set my status message for %s"),
CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, data->status, GSMDF_TCHAR));
SendMessage(hwndDlg, WM_SETTEXT, 0, (LPARAM)title);
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg(data->status));
}
- else
- {
+ else {
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedIcon(SKINICON_OTHER_MIRANDA));
SetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, protocols->GetDefaultStatusMsg());
@@ -439,13 +425,13 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w return TRUE;
}
case WM_COMMAND:
- switch(wParam) {
+ switch (wParam) {
case IDOK:
{
TCHAR tmp[MS_MYDETAILS_GETMYSTATUSMESSAGE_BUFFER_SIZE];
GetDlgItemText(hwndDlg, IDC_STATUSMESSAGE, tmp, sizeof(tmp));
- SetStatusMessageData *data = (SetStatusMessageData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ SetStatusMessageData *data = (SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (data->proto_num >= 0)
protocols->Get(data->proto_num)->SetStatusMsg(tmp);
@@ -469,9 +455,9 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w break;
case WM_DESTROY:
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_WNDPROC,
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_WNDPROC,
GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_STATUSMESSAGE), GWLP_USERDATA));
- free((SetStatusMessageData *) GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
+ free((SetStatusMessageData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA));
InterlockedExchange(&status_msg_dialog_open, 0);
break;
}
@@ -479,69 +465,55 @@ static INT_PTR CALLBACK DlgProcSetStatusMessage(HWND hwndDlg, UINT msg, WPARAM w return FALSE;
}
-static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
{
int status = (int)wParam;
- char * proto_name = (char *)lParam;
+ char *proto_name = (char *)lParam;
int proto_num = -1;
Protocol *proto = NULL;
if (status != 0 && (status < ID_STATUS_OFFLINE || status > ID_STATUS_OUTTOLUNCH))
return -10;
- if (proto_name != NULL)
- {
- for (int i = 0 ; i < protocols->GetSize() ; i++)
- {
+ if (proto_name != NULL) {
+ for (int i = 0; i < protocols->GetSize(); i++) {
proto = protocols->Get(i);
- if (_stricmp(proto->name, proto_name) == 0)
- {
+ if (_stricmp(proto->name, proto_name) == 0) {
proto_num = i;
break;
}
}
- if (proto_num == -1) {
+ if (proto_num == -1)
return -1;
- }
- if (protocols->CanSetStatusMsgPerProtocol() && !proto->CanSetStatusMsg()) {
+ if (protocols->CanSetStatusMsgPerProtocol() && !proto->CanSetStatusMsg())
return -2;
- }
}
- else if (ServiceExists(MS_SA_CHANGESTATUSMSG))
- {
+ else if (ServiceExists(MS_SA_CHANGESTATUSMSG)) {
if (proto == NULL && status == 0)
- {
CallService(MS_SA_CHANGESTATUSMSG, protocols->GetGlobalStatus(), NULL);
- }
else if (status == 0)
- {
- CallService(MS_SA_CHANGESTATUSMSG, proto->status, (LPARAM) proto_name);
- }
+ CallService(MS_SA_CHANGESTATUSMSG, proto->status, (LPARAM)proto_name);
else
- {
- CallService(MS_SA_CHANGESTATUSMSG, status, (LPARAM) proto_name);
- }
+ CallService(MS_SA_CHANGESTATUSMSG, status, (LPARAM)proto_name);
return 0;
}
- if (proto == NULL || proto->status != ID_STATUS_OFFLINE)
- {
- if ( !status_msg_dialog_open)
- {
+ if (proto == NULL || proto->status != ID_STATUS_OFFLINE) {
+ if (!status_msg_dialog_open) {
InterlockedExchange(&status_msg_dialog_open, 1);
- hwndSetStatusMsg = CreateDialog(hInst, MAKEINTRESOURCE( IDD_SETSTATUSMESSAGE ), NULL, DlgProcSetStatusMessage );
+ hwndSetStatusMsg = CreateDialog(hInst, MAKEINTRESOURCE(IDD_SETSTATUSMESSAGE), NULL, DlgProcSetStatusMessage);
SendMessage(hwndSetStatusMsg, WMU_SETDATA, status, proto_num);
}
- SetForegroundWindow( hwndSetStatusMsg );
- SetFocus( hwndSetStatusMsg );
- ShowWindow( hwndSetStatusMsg, SW_SHOW );
+ SetForegroundWindow(hwndSetStatusMsg);
+ SetFocus(hwndSetStatusMsg);
+ ShowWindow(hwndSetStatusMsg, SW_SHOW);
return 0;
}
@@ -550,9 +522,9 @@ static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam) }
-static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam)
+static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam, LPARAM lParam)
{
- db_set_b(NULL,"MyDetails","CicleThroughtProtocols", (BYTE) wParam);
+ db_set_b(NULL, "MyDetails", "CicleThroughtProtocols", (BYTE)wParam);
LoadOptions();
@@ -561,23 +533,23 @@ static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam) // Services ///////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR Menu_SetMyAvatarUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR Menu_SetMyAvatarUI(WPARAM wParam, LPARAM lParam)
{
return PluginCommand_SetMyAvatarUI(0, 0);
}
-static INT_PTR Menu_SetMyNicknameUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR Menu_SetMyNicknameUI(WPARAM wParam, LPARAM lParam)
{
return PluginCommand_SetMyNicknameUI(0, 0);
}
-static INT_PTR Menu_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam)
+static INT_PTR Menu_SetMyStatusMessageUI(WPARAM wParam, LPARAM lParam)
{
return PluginCommand_SetMyStatusMessageUI(0, 0);
}
// Hook called after init
-static int MainInit(WPARAM wparam,LPARAM lparam)
+static int MainInit(WPARAM wparam, LPARAM lparam)
{
InitProtocolData();
@@ -586,7 +558,7 @@ static int MainInit(WPARAM wparam,LPARAM lparam) mi.popupPosition = 500050000;
mi.flags = CMIF_ROOTPOPUP | CMIF_TCHAR;
mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_USERDETAILS);
- mi.ptszName = LPGENT("My Details");
+ mi.ptszName = LPGENT("My details");
HANDLE hMenuRoot = Menu_AddMainMenuItem(&mi);
mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR;
@@ -596,20 +568,20 @@ static int MainInit(WPARAM wparam,LPARAM lparam) if (protocols->CanSetAvatars()) {
mi.position = 100001;
- mi.ptszName = LPGENT("Set My Avatar...");
+ mi.ptszName = LPGENT("Set my avatar...");
CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYAVATARUI, Menu_SetMyAvatarUI);
mi.pszService = "MENU_" MS_MYDETAILS_SETMYAVATARUI;
Menu_AddMainMenuItem(&mi);
}
mi.position = 100002;
- mi.ptszName = LPGENT("Set My Nickname...");
+ mi.ptszName = LPGENT("Set my nickname...");
CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYNICKNAMEUI, Menu_SetMyNicknameUI);
mi.pszService = "MENU_" MS_MYDETAILS_SETMYNICKNAMEUI;
Menu_AddMainMenuItem(&mi);
mi.position = 100003;
- mi.ptszName = LPGENT("Set My Status Message...");
+ mi.ptszName = LPGENT("Set my status message...");
CreateServiceFunction("MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI, Menu_SetMyStatusMessageUI);
mi.pszService = "MENU_" MS_MYDETAILS_SETMYSTATUSMESSAGEUI;
Menu_AddMainMenuItem(&mi);
@@ -622,10 +594,10 @@ static int MainInit(WPARAM wparam,LPARAM lparam) InitFrames();
- if ( Skin_GetIcon("LISTENING_TO_ICON") == NULL)
+ if (Skin_GetIcon("LISTENING_TO_ICON") == NULL)
Icon_Register(hInst, LPGEN("Contact list"), iconList, 1);
- Icon_Register(hInst, LPGEN("My Details"), iconList+1, SIZEOF(iconList)-1);
+ Icon_Register(hInst, LPGEN("My details"), iconList + 1, SIZEOF(iconList) - 1);
return 0;
}
diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index 148f63e633..b78db698d9 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -26,34 +26,34 @@ Options opts; // Functions //////////////////////////////////////////////////////////////////////////////////////
-static OptPageControl pageControls[] = {
- { &opts.cycle_through_protocols, CONTROL_CHECKBOX, IDC_CYCLE_THROUGH_PROTOS, "CicleThroughtProtocols", (BYTE) 1 },
- { &opts.seconds_to_show_protocol, CONTROL_SPIN, IDC_CYCLE_TIME, "CicleTime", (WORD) 5, IDC_CYCLE_TIME_SPIN, (WORD) 1, (WORD) 255 },
- { &opts.draw_show_protocol_name, CONTROL_CHECKBOX, IDC_SHOW_PROTO_NAME, "ShowProtocolName", (BYTE) 1 },
- { &opts.show_protocol_cycle_button, CONTROL_CHECKBOX, IDC_SHOW_CYCLE_PROTO_BUTTON, "ShowProtocolCycleButton", (BYTE) 0 },
- { &opts.draw_text_rtl, CONTROL_CHECKBOX, IDC_TEXT_RTL, "TextRTL", (BYTE) 0 },
- { &opts.draw_text_align_right, CONTROL_CHECKBOX, IDC_TEXT_ALIGN_RIGHT, "TextAlignRight", (BYTE) 0 },
- { &opts.replace_smileys, CONTROL_CHECKBOX, IDC_REPLACE_SMILEYS, "ReplaceSmileys", (BYTE) 1 },
- { &opts.resize_smileys, CONTROL_CHECKBOX, IDC_RESIZE_SMILEYS, "ResizeSmileys", (BYTE) 0 },
- { &opts.use_contact_list_smileys, CONTROL_CHECKBOX, IDC_USE_CONTACT_LIST_SMILEYS, "UseContactListSmileys", (BYTE) 0 },
- { &opts.global_on_avatar, CONTROL_CHECKBOX, IDC_GLOBAL_ON_AVATAR, "GlobalOnAvatar", (BYTE) 0 },
- { &opts.global_on_nickname, CONTROL_CHECKBOX, IDC_GLOBAL_ON_NICKNAME, "GlobalOnNickname", (BYTE) 0 },
- { &opts.global_on_status, CONTROL_CHECKBOX, IDC_GLOBAL_ON_STATUS, "GlobalOnStatus", (BYTE) 0 },
- { &opts.global_on_status_message, CONTROL_CHECKBOX, IDC_GLOBAL_ON_STATUS_MESSAGE, "GlobalOnStatusMessage", (BYTE) 0 },
- { &opts.draw_avatar_allow_to_grow, CONTROL_CHECKBOX, IDC_AVATAR_ALLOW_TO_GROW, "AvatarAllowToGrow", (BYTE) 0 },
- { &opts.draw_avatar_custom_size, CONTROL_CHECKBOX, IDC_AVATAR_CUSTOM_SIZE_CHK, "AvatarCustomSize", (BYTE) 0 },
- { &opts.draw_avatar_custom_size_pixels, CONTROL_SPIN, IDC_AVATAR_CUSTOM_SIZE, "AvatarCustomSizePixels", (WORD) 30, IDC_AVATAR_CUSTOM_SIZE_SPIN, (WORD) 1, (WORD) 255 },
- { &opts.draw_avatar_border, CONTROL_CHECKBOX, IDC_AVATAR_DRAW_BORDER, "AvatarDrawBorders", (BYTE) 0 },
- { &opts.draw_avatar_round_corner, CONTROL_CHECKBOX, IDC_AVATAR_ROUND_CORNERS, "AvatarRoundCorners", (BYTE) 1 },
- { &opts.draw_avatar_use_custom_corner_size, CONTROL_CHECKBOX, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, "AvatarUseCustomCornerSize", (BYTE) 0 },
- { &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 },
- { &opts.borders[BOTTOM], CONTROL_SPIN, IDC_BORDER_BOTTOM, "BorderBottom", (WORD) 8, IDC_BORDER_BOTTOM_SPIN, (WORD) 0, (WORD) 255 },
+static OptPageControl pageControls[] = {
+ { &opts.cycle_through_protocols, CONTROL_CHECKBOX, IDC_CYCLE_THROUGH_PROTOS, "CicleThroughtProtocols", (BYTE)1 },
+ { &opts.seconds_to_show_protocol, CONTROL_SPIN, IDC_CYCLE_TIME, "CicleTime", (WORD)5, IDC_CYCLE_TIME_SPIN, (WORD)1, (WORD)255 },
+ { &opts.draw_show_protocol_name, CONTROL_CHECKBOX, IDC_SHOW_PROTO_NAME, "ShowProtocolName", (BYTE)1 },
+ { &opts.show_protocol_cycle_button, CONTROL_CHECKBOX, IDC_SHOW_CYCLE_PROTO_BUTTON, "ShowProtocolCycleButton", (BYTE)0 },
+ { &opts.draw_text_rtl, CONTROL_CHECKBOX, IDC_TEXT_RTL, "TextRTL", (BYTE)0 },
+ { &opts.draw_text_align_right, CONTROL_CHECKBOX, IDC_TEXT_ALIGN_RIGHT, "TextAlignRight", (BYTE)0 },
+ { &opts.replace_smileys, CONTROL_CHECKBOX, IDC_REPLACE_SMILEYS, "ReplaceSmileys", (BYTE)1 },
+ { &opts.resize_smileys, CONTROL_CHECKBOX, IDC_RESIZE_SMILEYS, "ResizeSmileys", (BYTE)0 },
+ { &opts.use_contact_list_smileys, CONTROL_CHECKBOX, IDC_USE_CONTACT_LIST_SMILEYS, "UseContactListSmileys", (BYTE)0 },
+ { &opts.global_on_avatar, CONTROL_CHECKBOX, IDC_GLOBAL_ON_AVATAR, "GlobalOnAvatar", (BYTE)0 },
+ { &opts.global_on_nickname, CONTROL_CHECKBOX, IDC_GLOBAL_ON_NICKNAME, "GlobalOnNickname", (BYTE)0 },
+ { &opts.global_on_status, CONTROL_CHECKBOX, IDC_GLOBAL_ON_STATUS, "GlobalOnStatus", (BYTE)0 },
+ { &opts.global_on_status_message, CONTROL_CHECKBOX, IDC_GLOBAL_ON_STATUS_MESSAGE, "GlobalOnStatusMessage", (BYTE)0 },
+ { &opts.draw_avatar_allow_to_grow, CONTROL_CHECKBOX, IDC_AVATAR_ALLOW_TO_GROW, "AvatarAllowToGrow", (BYTE)0 },
+ { &opts.draw_avatar_custom_size, CONTROL_CHECKBOX, IDC_AVATAR_CUSTOM_SIZE_CHK, "AvatarCustomSize", (BYTE)0 },
+ { &opts.draw_avatar_custom_size_pixels, CONTROL_SPIN, IDC_AVATAR_CUSTOM_SIZE, "AvatarCustomSizePixels", (WORD)30, IDC_AVATAR_CUSTOM_SIZE_SPIN, (WORD)1, (WORD)255 },
+ { &opts.draw_avatar_border, CONTROL_CHECKBOX, IDC_AVATAR_DRAW_BORDER, "AvatarDrawBorders", (BYTE)0 },
+ { &opts.draw_avatar_round_corner, CONTROL_CHECKBOX, IDC_AVATAR_ROUND_CORNERS, "AvatarRoundCorners", (BYTE)1 },
+ { &opts.draw_avatar_use_custom_corner_size, CONTROL_CHECKBOX, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, "AvatarUseCustomCornerSize", (BYTE)0 },
+ { &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 },
+ { &opts.borders[BOTTOM], CONTROL_SPIN, IDC_BORDER_BOTTOM, "BorderBottom", (WORD)8, IDC_BORDER_BOTTOM_SPIN, (WORD)0, (WORD)255 },
};
@@ -63,8 +63,8 @@ void LoadOptions() LoadOpts(pageControls, SIZEOF(pageControls), MODULE_NAME);
// This is created here to assert that this key always exists
- opts.refresh_status_message_timer = db_get_w(NULL,"MyDetails","RefreshStatusMessageTimer",12);
- db_set_w(NULL,"MyDetails","RefreshStatusMessageTimer", opts.refresh_status_message_timer);
+ opts.refresh_status_message_timer = db_get_w(NULL, "MyDetails", "RefreshStatusMessageTimer", 12);
+ db_set_w(NULL, "MyDetails", "RefreshStatusMessageTimer", opts.refresh_status_message_timer);
SetCycleTime();
RefreshFrameAndCalcRects();
@@ -76,46 +76,70 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA switch (msg) {
case WM_INITDIALOG:
- if (!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER)) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR_L),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR),FALSE);
+ if (!IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK), FALSE);
}
- if (!IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS)) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),FALSE);
+ if (!IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS) || !IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN), FALSE);
}
- if (!IsDlgButtonChecked(hwndDlg,IDC_SHOW_PROTO_NAME))
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_CYCLE_PROTO_BUTTON),FALSE);
+ if (!IsDlgButtonChecked(hwndDlg, IDC_SHOW_PROTO_NAME))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_CYCLE_PROTO_BUTTON), FALSE);
- if ( !ServiceExists(MS_SMILEYADD_BATCHPARSE)) {
- EnableWindow(GetDlgItem(hwndDlg,IDC_REPLACE_SMILEYS),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_USE_CONTACT_LIST_SMILEYS),FALSE);
- EnableWindow(GetDlgItem(hwndDlg,IDC_RESIZE_SMILEYS),FALSE);
+ if (!IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_CHK)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_SPIN), FALSE);
}
- if ( !ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS))
- EnableWindow(GetDlgItem(hwndDlg,IDC_RESIZE_FRAME),FALSE);
+ if (!IsDlgButtonChecked(hwndDlg, IDC_CYCLE_THROUGH_PROTOS)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME_SPIN), FALSE);
+ }
+
+ if (!IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), FALSE);
+ }
+
+ if (!ServiceExists(MS_SMILEYADD_BATCHPARSE)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_REPLACE_SMILEYS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), FALSE);
+ }
+
+ if (!ServiceExists(MS_CLIST_FRAMES_SETFRAMEOPTIONS))
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_FRAME), FALSE);
break;
case WM_COMMAND:
- if (LOWORD(wParam)==IDC_AVATAR_DRAW_BORDER) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg,IDC_AVATAR_DRAW_BORDER);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR_L),enabled);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_BORDER_COLOR),enabled);
+ if (LOWORD(wParam) == IDC_AVATAR_ROUND_CORNERS || LOWORD(wParam) == IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_AVATAR_ROUND_CORNERS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK), enabled);
+ enabled = enabled && IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN), enabled);
+ }
+ else if (LOWORD(wParam) == IDC_SHOW_PROTO_NAME) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_SHOW_PROTO_NAME);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SHOW_CYCLE_PROTO_BUTTON), enabled);
+ }
+ else if (LOWORD(wParam) == IDC_AVATAR_CUSTOM_SIZE_CHK) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_CHK);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_AVATAR_CUSTOM_SIZE_SPIN), enabled);
}
- else if (LOWORD(wParam)==IDC_AVATAR_ROUND_CORNERS) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg,IDC_AVATAR_ROUND_CORNERS);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK),enabled);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE),enabled);
- EnableWindow(GetDlgItem(hwndDlg,IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN),enabled);
+ else if (LOWORD(wParam) == IDC_CYCLE_THROUGH_PROTOS) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_CYCLE_THROUGH_PROTOS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CYCLE_TIME_SPIN), enabled);
}
- else if (LOWORD(wParam)==IDC_SHOW_PROTO_NAME) {
- BOOL enabled = IsDlgButtonChecked(hwndDlg,IDC_SHOW_PROTO_NAME);
- EnableWindow(GetDlgItem(hwndDlg,IDC_SHOW_CYCLE_PROTO_BUTTON),enabled);
+ else if (LOWORD(wParam) == IDC_REPLACE_SMILEYS) {
+ BOOL enabled = IsDlgButtonChecked(hwndDlg, IDC_REPLACE_SMILEYS);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_USE_CONTACT_LIST_SMILEYS), enabled);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RESIZE_SMILEYS), enabled);
}
break;
@@ -135,7 +159,7 @@ static INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return ret;
}
-int InitOptionsCallback(WPARAM wParam,LPARAM)
+int InitOptionsCallback(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
odp.position = -200000000;
@@ -143,7 +167,7 @@ int InitOptionsCallback(WPARAM wParam,LPARAM) odp.pfnDlgProc = DlgProcOpts;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTS);
odp.ptszGroup = LPGENT("Contact list");
- odp.ptszTitle = LPGENT("My Details");
+ odp.ptszTitle = LPGENT("My details");
odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
Options_AddPage(wParam, &odp);
return 0;
|