From a42f2c620125faa6d4664a2da9fa3fce1302cfab Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sun, 20 Jan 2013 18:38:26 +0000 Subject: Set colours through FontService git-svn-id: http://svn.miranda-ng.org/main/trunk@3198 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MyDetails/res/resource.rc | 161 ++++++++++++------------------------ plugins/MyDetails/src/frame.cpp | 134 +++++++++++++++++++----------- plugins/MyDetails/src/mydetails.cpp | 2 +- plugins/MyDetails/src/options.cpp | 6 +- plugins/MyDetails/src/resource.h | 4 +- 5 files changed, 144 insertions(+), 163 deletions(-) (limited to 'plugins/MyDetails') diff --git a/plugins/MyDetails/res/resource.rc b/plugins/MyDetails/res/resource.rc index a1c2e13b66..8b6f758d81 100644 --- a/plugins/MyDetails/res/resource.rc +++ b/plugins/MyDetails/res/resource.rc @@ -1,4 +1,4 @@ -//Microsoft Developer Studio generated resource script. +// Microsoft Visual C++ generated resource script. // #include "..\src\resource.h" @@ -14,13 +14,11 @@ #undef APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources +// English (United States) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US #pragma code_page(1252) -#endif //_WIN32 ///////////////////////////////////////////////////////////////////////////// // @@ -44,18 +42,13 @@ BEGIN BEGIN BLOCK "080004b0" BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", " \0" - VALUE "FileDescription", "MyDetails Miranda Plugin\0" - VALUE "FileVersion", "0, 0, 1, 11\0" - VALUE "InternalName", "mydetails\0" - VALUE "LegalCopyright", "Copyright © 2005-2008 Ricardo Pescuma Domenecci, Drugwash\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "mydetails.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "\0" - VALUE "ProductVersion", "0, 0, 1, 11\0" - VALUE "SpecialBuild", "\0" + VALUE "CompanyName", " " + VALUE "FileDescription", "MyDetails Miranda Plugin" + VALUE "FileVersion", "0, 0, 1, 11" + VALUE "InternalName", "mydetails" + VALUE "LegalCopyright", "Copyright © 2005-2008 Ricardo Pescuma Domenecci, Drugwash" + VALUE "OriginalFilename", "mydetails.dll" + VALUE "ProductVersion", "0, 0, 1, 11" END END BLOCK "VarFileInfo" @@ -70,121 +63,82 @@ END // Dialog // -IDD_SETNICKNAME DIALOG DISCARDABLE 0, 0, 283, 65 -STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | - WS_SYSMENU +IDD_SETNICKNAME DIALOG 0, 0, 283, 65 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Set My Nickname" FONT 8, "MS Shell Dlg" BEGIN RTEXT "Nickname:",IDC_STATIC,7,8,51,12 - EDITTEXT IDC_NICKNAME,67,7,209,31,ES_MULTILINE | ES_AUTOVSCROLL | - WS_VSCROLL + EDITTEXT IDC_NICKNAME,67,7,209,31,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL DEFPUSHBUTTON "OK",IDOK,87,44,50,14 PUSHBUTTON "Cancel",IDCANCEL,146,44,50,14 END IDD_OPTS DIALOGEX 0, 0, 316, 246 -STYLE DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "General",IDC_STATIC,7,7,302,70 - CONTROL "Cycle through protocols every:", - IDC_CYCLE_THROUGH_PROTOS,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,13,18,114,14 + CONTROL "Cycle through protocols every:",IDC_CYCLE_THROUGH_PROTOS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,18,115,14 EDITTEXT IDC_CYCLE_TIME,129,18,35,12,ES_NUMBER - CONTROL "",IDC_CYCLE_TIME_SPIN,"msctls_updown32",UDS_SETBUDDYINT | - UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | - UDS_HOTTRACK,156,18,11,12 + CONTROL "",IDC_CYCLE_TIME_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,156,18,11,12 LTEXT "seconds",IDC_STATIC,171,21,32,11 - CONTROL "Global on avatar",IDC_GLOBAL_ON_AVATAR,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,207,18,96,14 - CONTROL "RTL",IDC_TEXT_RTL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP, - 13,32,85,14 - CONTROL "Align text to right",IDC_TEXT_ALIGN_RIGHT,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,105,32,96,14 - CONTROL "Global on nickname",IDC_GLOBAL_ON_NICKNAME,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,207,32,96,14 - CONTROL "Auto-resize frame",IDC_RESIZE_FRAME,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,46,85,14 + CONTROL "Global on avatar",IDC_GLOBAL_ON_AVATAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,18,96,14 + CONTROL "RTL",IDC_TEXT_RTL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,32,86,14 + CONTROL "Align text to right",IDC_TEXT_ALIGN_RIGHT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,32,96,14 + CONTROL "Global on nickname",IDC_GLOBAL_ON_NICKNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,32,96,14 + CONTROL "Auto-resize frame",IDC_RESIZE_FRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,46,86,14 CONTROL "Use contact list smileys",IDC_USE_CONTACT_LIST_SMILEYS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,46,96,14 - CONTROL "Global on status",IDC_GLOBAL_ON_STATUS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,207,46,96,14 - CONTROL "Replace Smileys",IDC_REPLACE_SMILEYS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,60,85,14 - CONTROL "Resize Smileys",IDC_RESIZE_SMILEYS,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,105,60,96,14 + CONTROL "Global on status",IDC_GLOBAL_ON_STATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,46,96,14 + CONTROL "Replace Smileys",IDC_REPLACE_SMILEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,60,86,14 + CONTROL "Resize Smileys",IDC_RESIZE_SMILEYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,105,60,96,14 CONTROL "Global on status message",IDC_GLOBAL_ON_STATUS_MESSAGE, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,207,61,96,14 GROUPBOX "Frame Options",IDC_STATIC,7,78,302,44 - LTEXT "Top:",IDC_STATIC,16,91,41,11 + RTEXT "Top:",IDC_STATIC,12,91,41,11 EDITTEXT IDC_BORDER_TOP,59,89,35,12,ES_NUMBER - CONTROL "",IDC_BORDER_TOP_SPIN,"msctls_updown32",UDS_SETBUDDYINT | - UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | - UDS_HOTTRACK,88,89,11,12 - LTEXT "Bottom:",IDC_STATIC,111,91,41,11 + CONTROL "",IDC_BORDER_TOP_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,88,89,11,12 + RTEXT "Bottom:",IDC_STATIC,111,91,41,11 EDITTEXT IDC_BORDER_BOTTOM,154,89,35,12,ES_NUMBER - CONTROL "",IDC_BORDER_BOTTOM_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | - UDS_NOTHOUSANDS | UDS_HOTTRACK,182,89,11,12 - LTEXT "Left:",IDC_STATIC,15,105,41,11 + CONTROL "",IDC_BORDER_BOTTOM_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,182,89,11,12 + RTEXT "Left:",IDC_STATIC,12,105,42,11 EDITTEXT IDC_BORDER_LEFT,59,103,35,12,ES_NUMBER - CONTROL "",IDC_BORDER_LEFT_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | - UDS_NOTHOUSANDS | UDS_HOTTRACK,88,103,11,12 - LTEXT "Right:",IDC_STATIC,111,106,41,11 + CONTROL "",IDC_BORDER_LEFT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,88,103,11,12 + RTEXT "Right:",IDC_STATIC,111,106,41,11 EDITTEXT IDC_BORDER_RIGHT,154,104,35,12,ES_NUMBER - CONTROL "",IDC_BORDER_RIGHT_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | - UDS_NOTHOUSANDS | UDS_HOTTRACK,182,104,11,12 - LTEXT "Background Color:",IDC_AVATAR_BKG_COLOR_L,205,91,66,10 - CONTROL "",IDC_AVATAR_BKG_COLOR,"ColourPicker",WS_TABSTOP,277,89, - 17,13 + CONTROL "",IDC_BORDER_RIGHT_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,182,104,11,12 GROUPBOX "Avatar",IDC_STATIC,7,124,302,83 - CONTROL "Custom size:",IDC_AVATAR_CUSTOM_SIZE_CHK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,137,66,9 + CONTROL "Custom size:",IDC_AVATAR_CUSTOM_SIZE_CHK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,137,70,9 EDITTEXT IDC_AVATAR_CUSTOM_SIZE,87,135,35,12,ES_NUMBER - CONTROL "",IDC_AVATAR_CUSTOM_SIZE_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | - UDS_NOTHOUSANDS | UDS_HOTTRACK,116,134,11,12 + CONTROL "",IDC_AVATAR_CUSTOM_SIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,116,134,11,12 LTEXT "pixels",IDC_STATIC,130,137,24,11 - CONTROL "Allow it to grow",IDC_AVATAR_ALLOW_TO_GROW,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,174,137,106,9 - CONTROL "Draw border on avatar",IDC_AVATAR_DRAW_BORDER,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,16,152,103,9 - LTEXT "Border Color:",IDC_AVATAR_BORDER_COLOR_L,123,152,53,10 - CONTROL "",IDC_AVATAR_BORDER_COLOR,"ColourPicker",WS_TABSTOP,180, - 149,17,13 + CONTROL "Allow it to grow",IDC_AVATAR_ALLOW_TO_GROW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,174,137,126,9 + CONTROL "Draw border on avatar",IDC_AVATAR_DRAW_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,152,288,9 CONTROL "Round corners of avatars",IDC_AVATAR_ROUND_CORNERS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,166,280,8 - CONTROL "Custom corner size:", - IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,27,179,93,11 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,166,288,8 + CONTROL "Custom corner size:",IDC_AVATAR_CUSTOM_CORNER_SIZE_CHECK, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,27,179,93,11 EDITTEXT IDC_AVATAR_CUSTOM_CORNER_SIZE,127,178,35,12,ES_NUMBER - CONTROL "",IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,"msctls_updown32", - UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | - UDS_NOTHOUSANDS | UDS_HOTTRACK,165,178,11,12 + CONTROL "",IDC_AVATAR_CUSTOM_CORNER_SIZE_SPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,165,178,11,12 LTEXT "pixels",IDC_STATIC,179,181,41,11 - CONTROL "Use free space (under avatar) to other texts", - IDC_AVATAR_USE_FREE_SPACE,"Button",BS_AUTOCHECKBOX | - WS_TABSTOP,16,195,280,8 + CONTROL "Use free space (under avatar) to other texts",IDC_AVATAR_USE_FREE_SPACE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,195,288,8 GROUPBOX "Protocol",IDC_STATIC,7,209,302,28 - CONTROL "Show protocol name",IDC_SHOW_PROTO_NAME,"Button", - BS_AUTOCHECKBOX | WS_TABSTOP,13,221,138,14 + CONTROL "Show protocol name",IDC_SHOW_PROTO_NAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,221,138,14 CONTROL "Show protocol cycle button",IDC_SHOW_CYCLE_PROTO_BUTTON, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,163,221,138,14 END -IDD_SETSTATUSMESSAGE DIALOG DISCARDABLE 0, 0, 283, 68 -STYLE DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | - WS_SYSMENU +IDD_SETSTATUSMESSAGE DIALOG 0, 0, 283, 68 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Set My Status Message for All Status" FONT 8, "MS Shell Dlg" BEGIN RTEXT "Status Message:",IDC_STATIC,7,8,69,12 - EDITTEXT IDC_STATUSMESSAGE,81,7,195,35,ES_MULTILINE | - ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL + EDITTEXT IDC_STATUSMESSAGE,81,7,195,35,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN | WS_VSCROLL DEFPUSHBUTTON "OK",IDOK,87,47,50,14 PUSHBUTTON "Cancel",IDCANCEL,146,47,50,14 END @@ -196,7 +150,7 @@ END // #ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE +GUIDELINES DESIGNINFO BEGIN IDD_SETNICKNAME, DIALOG BEGIN @@ -210,6 +164,8 @@ BEGIN BEGIN LEFTMARGIN, 7 RIGHTMARGIN, 309 + VERTGUIDE, 12 + VERTGUIDE, 300 TOPMARGIN, 7 BOTTOMMARGIN, 238 END @@ -232,10 +188,10 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_LISTENINGTO ICON "listening_to.ico" -IDI_RIGHT_ARROW ICON "rightarrow.ico" -IDI_LEFT_ARROW ICON "leftarrow.ico" -#endif // English (U.S.) resources +IDI_LISTENINGTO ICON "listening_to.ico" +IDI_RIGHT_ARROW ICON "rightarrow.ico" +IDI_LEFT_ARROW ICON "leftarrow.ico" +#endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// @@ -243,10 +199,8 @@ IDI_LEFT_ARROW ICON "leftarrow.ico" // Portuguese (Brazil) resources #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PTB) -#ifdef _WIN32 LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN #pragma code_page(1252) -#endif //_WIN32 #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -280,7 +234,7 @@ END // Menu // -IDR_MENU1 MENU DISCARDABLE +IDR_MENU1 MENU BEGIN POPUP "Status popup" BEGIN @@ -301,16 +255,13 @@ BEGIN MENUITEM "Set My Avatar...", ID_AVATARPOPUP_SETMYAVATAR MENUITEM "Set My Nickname...", ID_NICKPOPUP_SETMYNICKNAME MENUITEM "Set My Status Message...", ID_STATUSMESSAGEPOPUP_SETMYSTATUSMESSAGE - MENUITEM "Enable Listening To", ID_CONTEXTPOPUP_ENABLELISTENINGTO - MENUITEM SEPARATOR MENUITEM "Show next protocol", ID_SHOW_NEXT_PROTO MENUITEM "Show previous protocol", ID_SHOW_PREV_PROTO MENUITEM SEPARATOR MENUITEM "Cycle through protocols", ID_CYCLE_THROUGH_PROTOS - MENUITEM "Don't cycle through protocols", - ID_DONT_CYCLE_THROUGH_PROTOS + MENUITEM "Don't cycle through protocols", ID_DONT_CYCLE_THROUGH_PROTOS END POPUP "Nick popup" BEGIN @@ -321,7 +272,6 @@ BEGIN BEGIN MENUITEM SEPARATOR MENUITEM "Set My Status Message...", ID_STATUSMESSAGEPOPUP_SETMYSTATUSMESSAGE - END POPUP "Avatar popup" BEGIN @@ -332,7 +282,6 @@ BEGIN BEGIN MENUITEM SEPARATOR MENUITEM "Enable Listening To", ID_LISTENINGTOPOPUP_SENDLISTENINGTO - END END diff --git a/plugins/MyDetails/src/frame.cpp b/plugins/MyDetails/src/frame.cpp index 42188491fd..0cf86070a1 100644 --- a/plugins/MyDetails/src/frame.cpp +++ b/plugins/MyDetails/src/frame.cpp @@ -73,7 +73,7 @@ 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) }; - +ColourIDT bg_colour, av_colour; int CreateFrame(); void FixMainMenu(); void RefreshFrame(); @@ -203,6 +203,15 @@ int ReloadFont(WPARAM wParam, LPARAM lParam) font_colour[i] = CallService(MS_FONT_GETT, (WPARAM)&font_id[i], (LPARAM)&log_font); hFont[i] = CreateFontIndirect(&log_font); } + + RefreshFrame(); + return 0; +} + +int ReloadColour(WPARAM,LPARAM) +{ + opts.bkg_color = (COLORREF) CallService(MS_COLOUR_GETT,(WPARAM)&bg_colour,0); + opts.draw_avatar_border_color = (COLORREF) CallService(MS_COLOUR_GETT,(WPARAM)&av_colour,0); RefreshFrame(); return 0; @@ -217,6 +226,27 @@ int SmileyAddOptionsChangedHook(WPARAM wParam,LPARAM lParam) int CreateFrame() { HDC hdc = GetDC(NULL); + + ZeroMemory(&bg_colour, sizeof(bg_colour)); + bg_colour.cbSize = sizeof(ColourIDT); + _tcsncpy(bg_colour.name,LPGENT("Background"),SIZEOF(bg_colour.name)); + _tcsncpy(bg_colour.group,LPGENT("My Details"),SIZEOF(bg_colour.group)); + strncpy(bg_colour.dbSettingsGroup,MODULE_NAME,sizeof(bg_colour.dbSettingsGroup)); + strncpy(bg_colour.setting,"BackgroundColor",sizeof(bg_colour.setting)); + bg_colour.defcolour = GetSysColor(COLOR_BTNFACE); + ColourRegisterT(&bg_colour); + + ZeroMemory(&av_colour, sizeof(av_colour)); + av_colour.cbSize = sizeof(ColourIDT); + _tcsncpy(av_colour.name,LPGENT("Avatar Border"),SIZEOF(av_colour.name)); + _tcsncpy(av_colour.group,LPGENT("My Details"),SIZEOF(av_colour.group)); + strncpy(av_colour.dbSettingsGroup,MODULE_NAME,sizeof(av_colour.dbSettingsGroup)); + strncpy(av_colour.setting,"AvatarBorderColor",sizeof(av_colour.setting)); + av_colour.defcolour = RGB(0,0,0); + ColourRegisterT(&av_colour); + ReloadColour(0,0); + HookEvent(ME_COLOUR_RELOAD,ReloadColour); + for (int i = 0 ; i < NUM_FONTS ; i++) { ZeroMemory(&font_id[i], sizeof(font_id[i])); @@ -225,6 +255,8 @@ int CreateFrame() _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)); char tmp[128]; mir_snprintf(tmp, sizeof(tmp), "%sFont", font_names[i]); @@ -375,7 +407,7 @@ LRESULT CALLBACK FrameContainerWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE; case WM_CLOSE: - DBWriteContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 0); + db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 0); ShowWindow(hwnd, SW_HIDE); FixMainMenu(); return TRUE; @@ -510,13 +542,11 @@ RECT GetRect(HDC hdc, RECT rc, const TCHAR *text, const TCHAR *def_text, Protoco HWND CreateTooltip(HWND hwnd, RECT &rect) { - // struct specifying control classes to register - INITCOMMONCONTROLSEX iccex; - HWND hwndTT; // handle to the ToolTip control // struct specifying info about tool in ToolTip control - TOOLINFO ti; unsigned int uid = 0; // for ti initialization + // struct specifying control classes to register + INITCOMMONCONTROLSEX iccex; // Load the ToolTip class from the DLL. iccex.dwSize = sizeof(iccex); iccex.dwICC = ICC_BAR_CLASSES; @@ -525,7 +555,7 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) return NULL; /* CREATE A TOOLTIP WINDOW */ - hwndTT = CreateWindowEx(WS_EX_TOPMOST, + HWND hwndTT = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, @@ -537,9 +567,10 @@ HWND CreateTooltip(HWND hwnd, RECT &rect) NULL, hInst, NULL - ); + ); // handle to the ToolTip control /* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */ + TOOLINFO ti; ti.cbSize = sizeof(TOOLINFO); ti.uFlags = TTF_SUBCLASS; ti.hwnd = hwnd; @@ -1008,7 +1039,6 @@ HBITMAP CreateBitmap32(int cx, int cy) { BITMAPINFO RGB32BitsBITMAPINFO; UINT * ptPixels; - HBITMAP DirectBitmap; ZeroMemory(&RGB32BitsBITMAPINFO,sizeof(BITMAPINFO)); RGB32BitsBITMAPINFO.bmiHeader.biSize=sizeof(BITMAPINFOHEADER); @@ -1017,8 +1047,8 @@ HBITMAP CreateBitmap32(int cx, int cy) RGB32BitsBITMAPINFO.bmiHeader.biPlanes=1; RGB32BitsBITMAPINFO.bmiHeader.biBitCount=32; - DirectBitmap = CreateDIBSection(NULL, - (BITMAPINFO *)&RGB32BitsBITMAPINFO, + HBITMAP DirectBitmap = CreateDIBSection(NULL, + &RGB32BitsBITMAPINFO, DIB_RGB_COLORS, (void **)&ptPixels, NULL, 0); @@ -1033,7 +1063,7 @@ void EraseBackground(HWND hwnd, HDC hdc, MyDetailsFrameData* data) if ( isSkinEngineEnabled()) SkinDrawWindowBack(hwnd, hdc, &r, "Main,ID=Background"); else { - HBRUSH hB = CreateSolidBrush((COLORREF) DBGetContactSettingDword(NULL,"MyDetails","BackgroundColor",GetSysColor(COLOR_BTNFACE))); + HBRUSH hB = CreateSolidBrush(opts.bkg_color); FillRect(hdc, &r, hB); DeleteObject(hB); } @@ -1438,11 +1468,8 @@ void ShowGlobalStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, { HMENU submenu = (HMENU) CallService(MS_CLIST_MENUGETSTATUS,0,0); - if (opts.draw_text_align_right) - p.x = data->status_rect.right; - else - p.x = data->status_rect.left; - p.y = data->status_rect.bottom+1; + p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left); + p.y = data->status_rect.bottom+1; ClientToScreen(hwnd, &p); int ret = TrackPopupMenu(submenu, TPM_TOPALIGN|TPM_RIGHTBUTTON|TPM_RETURNCMD @@ -1494,10 +1521,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto if (submenu != NULL) { - if (opts.draw_text_align_right) - p.x = data->status_rect.right; - else - p.x = data->status_rect.left; + p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left); p.y = data->status_rect.bottom+1; ClientToScreen(hwnd, &p); @@ -1521,7 +1545,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); submenu = GetSubMenu(menu, 0); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); + TranslateMenu(submenu); DWORD flags = CallProtoService(proto->name, PS_GETCAPS, PFLAGNUM_2,0); for ( int i = GetMenuItemCount(submenu) -1 ; i >= 0 ; i-- ) @@ -1533,10 +1557,7 @@ void ShowProtocolStatusMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto } } - if (opts.draw_text_align_right) - p.x = data->status_rect.right; - else - p.x = data->status_rect.left; + p.x = (opts.draw_text_align_right ? data->status_rect.right : data->status_rect.left); p.y = data->status_rect.bottom+1; ClientToScreen(hwnd, &p); @@ -1554,7 +1575,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P { HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); HMENU submenu = GetSubMenu(menu, 5); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); + TranslateMenu(submenu); // Add this proto to menu TCHAR tmp[128]; @@ -1588,10 +1609,7 @@ void ShowListeningToMenu(HWND hwnd, MyDetailsFrameData *data, Protocol *proto, P SetMenuItemInfo(submenu, ID_LISTENINGTOPOPUP_SENDLISTENINGTO, FALSE, &mii); - if (opts.draw_text_align_right) - p.x = data->listening_to_rect.right; - else - p.x = data->listening_to_rect.left; + 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; ClientToScreen(hwnd, &p); @@ -1849,7 +1867,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); HMENU submenu = GetSubMenu(menu, 4); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); + TranslateMenu(submenu); // Add this proto to menu TCHAR tmp[128]; @@ -1895,7 +1913,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); HMENU submenu = GetSubMenu(menu, 2); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); + TranslateMenu(submenu); // Add this proto to menu TCHAR tmp[128]; @@ -2034,7 +2052,7 @@ LRESULT CALLBACK FrameWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPar { HMENU menu = LoadMenu(hInst, MAKEINTRESOURCE(IDR_MENU1)); HMENU submenu = GetSubMenu(menu, 1); - CallService(MS_LANGPACK_TRANSLATEMENU,(WPARAM)submenu,0); + TranslateMenu(submenu); if (opts.cycle_through_protocols) RemoveMenu(submenu, ID_CYCLE_THROUGH_PROTOS, MF_BYCOMMAND); @@ -2428,7 +2446,7 @@ INT_PTR ShowHideFrameFunc(WPARAM wParam, LPARAM lParam) else { ShowWindow(hwnd_container, SW_SHOW); - DBWriteContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); + db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); } FixMainMenu(); @@ -2450,7 +2468,7 @@ INT_PTR ShowFrameFunc(WPARAM wParam, LPARAM lParam) if ( !MyDetailsFrameVisible()) { ShowWindow(hwnd_container, SW_SHOW); - DBWriteContactSettingByte(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); + db_set_b(0, MODULE_NAME, SETTING_FRAME_VISIBLE, 1); FixMainMenu(); } @@ -2484,12 +2502,12 @@ INT_PTR HideFrameFunc(WPARAM wParam, LPARAM lParam) void FixMainMenu() { CLISTMENUITEM mi = { sizeof(mi) }; - mi.flags = CMIM_NAME; + mi.flags = CMIM_NAME | CMIF_TCHAR; if (MyDetailsFrameVisible()) - mi.pszName = Translate("Hide My Details"); + mi.ptszName = LPGENT("Hide My Details"); else - mi.pszName = Translate("Show My Details"); + mi.ptszName = LPGENT("Show My Details"); CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuShowHideFrame, (LPARAM)&mi); } @@ -2660,7 +2678,7 @@ int SettingsChangedHook(WPARAM wParam, LPARAM lParam) if ((HANDLE)wParam == NULL) { - Protocol *proto = protocols->Get((const char*)cws->szModule); + Protocol *proto = protocols->Get(cws->szModule); if (!strcmp(cws->szSetting,"MyHandle") || !strcmp(cws->szSetting,"UIN") @@ -2708,19 +2726,35 @@ int ProtoAckHook(WPARAM wParam, LPARAM lParam) ACKDATA *ack = (ACKDATA*)lParam; - if (ack->type == ACKTYPE_STATUS) + if(ack->result == ACKRESULT_SUCCESS) { - Protocol *proto = protocols->Get((const char *) ack->szModule); + switch (ack->type) + { + case ACKTYPE_STATUS: + { + Protocol *proto = protocols->Get(ack->szModule); - if (proto != NULL) - PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM) proto->name, 0); - } - else if (ack->type == ACKTYPE_AWAYMSG) - { - Protocol *proto = protocols->Get((const char *) ack->szModule); + if (proto != NULL) + PostMessage(hwnd_frame, MWM_STATUS_CHANGED, (WPARAM) proto->name, 0); + break; + } + case ACKTYPE_AWAYMSG: + { + Protocol *proto = protocols->Get(ack->szModule); + + if (proto != NULL) + PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, (WPARAM) proto->name, 0); + break; + } + case ACKTYPE_AVATAR: + { + Protocol *proto = protocols->Get(ack->szModule); - if (proto != NULL) - PostMessage(hwnd_frame, MWM_STATUS_MSG_CHANGED, (WPARAM) proto->name, 0); + if (proto != NULL) + PostMessage(hwnd_frame, MWM_AVATAR_CHANGED, (WPARAM) proto->name, 0); + break; + } + } } return 0; diff --git a/plugins/MyDetails/src/mydetails.cpp b/plugins/MyDetails/src/mydetails.cpp index ae66a1dca4..8179b90600 100644 --- a/plugins/MyDetails/src/mydetails.cpp +++ b/plugins/MyDetails/src/mydetails.cpp @@ -708,7 +708,7 @@ static INT_PTR PluginCommand_SetMyStatusMessageUI(WPARAM wParam,LPARAM lParam) static INT_PTR PluginCommand_CycleThroughtProtocols(WPARAM wParam,LPARAM lParam) { - DBWriteContactSettingByte(NULL,"MyDetails","CicleThroughtProtocols", (BYTE) wParam); + db_set_b(NULL,"MyDetails","CicleThroughtProtocols", (BYTE) wParam); LoadOptions(); diff --git a/plugins/MyDetails/src/options.cpp b/plugins/MyDetails/src/options.cpp index 65b7e488db..40002dccc6 100644 --- a/plugins/MyDetails/src/options.cpp +++ b/plugins/MyDetails/src/options.cpp @@ -45,7 +45,6 @@ static OptPageControl pageControls[] = { { &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_border_color, CONTROL_COLOR, IDC_AVATAR_BORDER_COLOR, "AvatarBorderColor", (DWORD) RGB(0,0,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 }, @@ -55,7 +54,6 @@ static OptPageControl pageControls[] = { { &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 }, - { &opts.bkg_color, CONTROL_COLOR, IDC_AVATAR_BKG_COLOR, "BackgroundColor", (DWORD) GetSysColor(COLOR_BTNFACE) } }; @@ -65,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 = DBGetContactSettingWord(NULL,"MyDetails","RefreshStatusMessageTimer",12); - DBWriteContactSettingWord(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(); diff --git a/plugins/MyDetails/src/resource.h b/plugins/MyDetails/src/resource.h index b53e46d1a3..53e7dae134 100644 --- a/plugins/MyDetails/src/resource.h +++ b/plugins/MyDetails/src/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} -// Microsoft Developer Studio generated include file. -// Used by resource.rc +// Microsoft Visual C++ generated include file. +// Used by C:\Users\xx\Documents\Visual Studio 2010\Projects\miranda-ng\plugins\MyDetails\res\resource.rc // #define IDD_SETNICKNAME 101 #define IDD_OPTS 102 -- cgit v1.2.3