From 497153f11a96cd336e8dadeeaa50c29e2c1bc2af Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 25 Sep 2012 14:32:41 +0000 Subject: - fix for the clist services creation order - Clist Nicer's options adapted for the extraicons plugin git-svn-id: http://svn.miranda-ng.org/main/trunk@1651 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/res/resource.rc | 24 ++++--- plugins/Clist_nicer/src/Include/resource.h | 1 + plugins/Clist_nicer/src/clc.cpp | 5 +- plugins/Clist_nicer/src/clcopts.cpp | 108 ++++++++++++++++++++--------- plugins/Clist_nicer/src/clistmod.cpp | 19 +++++ plugins/Clist_nicer/src/init.cpp | 3 + 6 files changed, 116 insertions(+), 44 deletions(-) (limited to 'plugins/Clist_nicer') diff --git a/plugins/Clist_nicer/res/resource.rc b/plugins/Clist_nicer/res/resource.rc index 3c3541a321..6115b08891 100644 --- a/plugins/Clist_nicer/res/resource.rc +++ b/plugins/Clist_nicer/res/resource.rc @@ -287,12 +287,20 @@ IDD_OPT_XICONS DIALOGEX 0, 0, 227, 205 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD FONT 8, "MS Shell Dlg", 0, 0, 0x0 BEGIN - GROUPBOX "Extra icons (drag items to reorder them)",IDC_STATIC,1,100,224,87 - EDITTEXT IDC_EXICONSCALE,141,192,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER + GROUPBOX "Extra icons (drag items to reorder them)",IDC_STATIC,1,0,224,164 + PUSHBUTTON "Reset order and visibility to default",IDC_RESETXICONS,5,169,216,15 + CONTROL "",IDC_EXTRAORDER,"SysTreeView32",TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,4,12,216,148 + LTEXT "Extra icon size",IDC_STATIC,51,193,87,11 + EDITTEXT IDC_EXICONSCALE,141,192,31,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER CONTROL "",IDC_EXICONSCALESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_HOTTRACK,160,187,12,14 - LTEXT "Extra icon size",IDC_STATIC,51,193,87,11 - CONTROL "Show status icons",IDC_SHOWSTATUSICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,10,106,10 +END + +IDD_OPT_ICONS DIALOGEX 0, 0, 227, 205 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD +FONT 8, "MS Shell Dlg", 0, 0, 0x0 +BEGIN GROUPBOX "Icons",IDC_STATIC,1,0,224,99 + CONTROL "Show status icons",IDC_SHOWSTATUSICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,10,106,10 CONTROL "Show visibility icons",IDC_SHOWVISIBILITY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,214,10 CONTROL "When possible, draw status icons in avatar space",IDC_SELECTIVEICONS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,34,214,10 @@ -303,8 +311,6 @@ BEGIN CONTROL "Dim idle contacts",IDC_IDLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,70,214,10 CONTROL "Replace status icons with xStatus",IDC_XSTATUSASSTATUS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,82,214,10 - CONTROL "",IDC_EXTRAORDER,"SysTreeView32",TVS_NOTOOLTIPS | WS_BORDER | WS_HSCROLL | WS_TABSTOP,22,111,182,56 - PUSHBUTTON "Reset order and visibility to default",IDC_RESETXICONS,5,169,216,15 END IDD_OPT_CLUI DIALOGEX 0, 0, 305, 226 @@ -594,19 +600,19 @@ END // TEXTINCLUDE // -1 TEXTINCLUDE +1 TEXTINCLUDE BEGIN "..\\src\\include\\resource.h\0" END -2 TEXTINCLUDE +2 TEXTINCLUDE BEGIN "#include \r\n" "#include \r\n" "#include \r\n" END -3 TEXTINCLUDE +3 TEXTINCLUDE BEGIN "\r\n" "\0" diff --git a/plugins/Clist_nicer/src/Include/resource.h b/plugins/Clist_nicer/src/Include/resource.h index 0512a0dda0..e7224dd57d 100644 --- a/plugins/Clist_nicer/src/Include/resource.h +++ b/plugins/Clist_nicer/src/Include/resource.h @@ -27,6 +27,7 @@ #define IDC_DROPUSER 215 #define IDD_OPT_CLUI 218 #define IDD_OPT_XICONS 219 +#define IDD_OPT_ICONS 220 #define IDD_OPT_CLC 228 #define IDD_OPT_CLCBKG 230 #define IDD_OPT_SBAR 234 diff --git a/plugins/Clist_nicer/src/clc.cpp b/plugins/Clist_nicer/src/clc.cpp index 0841efed14..84ab25af3c 100644 --- a/plugins/Clist_nicer/src/clc.cpp +++ b/plugins/Clist_nicer/src/clc.cpp @@ -803,8 +803,5 @@ LBL_Def: } } - { - LRESULT result = saveContactListControlWndProc(hwnd, msg, wParam, lParam); - return result; - } + return saveContactListControlWndProc(hwnd, msg, wParam, lParam); } diff --git a/plugins/Clist_nicer/src/clcopts.cpp b/plugins/Clist_nicer/src/clcopts.cpp index 60af19554b..cb778098cd 100644 --- a/plugins/Clist_nicer/src/clcopts.cpp +++ b/plugins/Clist_nicer/src/clcopts.cpp @@ -26,6 +26,8 @@ UNICODE done #include #include "../coolsb/coolscroll.h" +#include + #define DBFONTF_BOLD 1 #define DBFONTF_ITALIC 2 #define DBFONTF_UNDERLINE 4 @@ -894,18 +896,6 @@ static INT_PTR CALLBACK DlgProcXIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPA case WM_USER + 100: p = (DISPLAYPROFILE *)lParam; if (p) { - CheckDlgButton(hwndDlg, IDC_XSTATUSASSTATUS, p->dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS ? 1 : 0); - - CheckDlgButton(hwndDlg, IDC_SHOWSTATUSICONS, (p->dwFlags & CLUI_FRAME_STATUSICONS) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWVISIBILITY, (p->dwFlags & CLUI_SHOWVISI) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SHOWMETA, (p->dwFlags & CLUI_USEMETAICONS) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_OVERLAYICONS, (p->dwFlags & CLUI_FRAME_OVERLAYICONS) ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwndDlg, IDC_SELECTIVEICONS, (p->dwFlags & CLUI_FRAME_SELECTIVEICONS) ? BST_CHECKED : BST_UNCHECKED); - - CheckDlgButton(hwndDlg, IDC_STATUSICONSCENTERED, p->bCenterStatusIcons ? 1 : 0); - CheckDlgButton(hwndDlg, IDC_IDLE, p->bDimIdle ? BST_CHECKED : BST_UNCHECKED); - SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_SETRANGE, 0, MAKELONG(20, 8)); SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_SETPOS, 0, (LPARAM)p->exIconScale); FillOrderTree(hwndDlg, GetDlgItem(hwndDlg, IDC_EXTRAORDER), p->exIconOrder, p->dwExtraImageMask); @@ -919,16 +909,6 @@ static INT_PTR CALLBACK DlgProcXIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPA p->exIconScale = SendDlgItemMessage(hwndDlg, IDC_EXICONSCALESPIN, UDM_GETPOS, 0, 0); p->exIconScale = (p->exIconScale < 8 || p->exIconScale > 20) ? 16 : p->exIconScale; - - p->dwFlags |= ((IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSICONS) ? CLUI_FRAME_STATUSICONS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_SHOWVISIBILITY) ? CLUI_SHOWVISI : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_SHOWMETA) ? CLUI_USEMETAICONS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_OVERLAYICONS) ? CLUI_FRAME_OVERLAYICONS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_XSTATUSASSTATUS) ? CLUI_FRAME_USEXSTATUSASSTATUS : 0) | - (IsDlgButtonChecked(hwndDlg, IDC_SELECTIVEICONS) ? CLUI_FRAME_SELECTIVEICONS : 0)); - - p->bDimIdle = IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0; - p->bCenterStatusIcons = IsDlgButtonChecked(hwndDlg, IDC_STATUSICONSCENTERED) ? 1 : 0; } return 0; @@ -1037,6 +1017,61 @@ static INT_PTR CALLBACK DlgProcXIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPA return FALSE; } +static INT_PTR CALLBACK DlgProcIcons(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) +{ + DISPLAYPROFILE *p; + + switch (msg) { + case WM_INITDIALOG: + TranslateDialogDefault(hwndDlg); + return TRUE; + + case WM_COMMAND: + SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); + break; + + case WM_USER + 100: + p = (DISPLAYPROFILE *)lParam; + if (p) { + CheckDlgButton(hwndDlg, IDC_XSTATUSASSTATUS, p->dwFlags & CLUI_FRAME_USEXSTATUSASSTATUS ? 1 : 0); + + CheckDlgButton(hwndDlg, IDC_SHOWSTATUSICONS, (p->dwFlags & CLUI_FRAME_STATUSICONS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWVISIBILITY, (p->dwFlags & CLUI_SHOWVISI) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SHOWMETA, (p->dwFlags & CLUI_USEMETAICONS) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_OVERLAYICONS, (p->dwFlags & CLUI_FRAME_OVERLAYICONS) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_SELECTIVEICONS, (p->dwFlags & CLUI_FRAME_SELECTIVEICONS) ? BST_CHECKED : BST_UNCHECKED); + + CheckDlgButton(hwndDlg, IDC_STATUSICONSCENTERED, p->bCenterStatusIcons ? 1 : 0); + CheckDlgButton(hwndDlg, IDC_IDLE, p->bDimIdle ? BST_CHECKED : BST_UNCHECKED); + } + return 0; + + case WM_USER + 200: + p = (DISPLAYPROFILE *)lParam; + if (p) { + p->dwFlags |= ((IsDlgButtonChecked(hwndDlg, IDC_SHOWSTATUSICONS) ? CLUI_FRAME_STATUSICONS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SHOWVISIBILITY) ? CLUI_SHOWVISI : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SHOWMETA) ? CLUI_USEMETAICONS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_OVERLAYICONS) ? CLUI_FRAME_OVERLAYICONS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_XSTATUSASSTATUS) ? CLUI_FRAME_USEXSTATUSASSTATUS : 0) | + (IsDlgButtonChecked(hwndDlg, IDC_SELECTIVEICONS) ? CLUI_FRAME_SELECTIVEICONS : 0)); + + p->bDimIdle = IsDlgButtonChecked(hwndDlg, IDC_IDLE) ? 1 : 0; + p->bCenterStatusIcons = IsDlgButtonChecked(hwndDlg, IDC_STATUSICONSCENTERED) ? 1 : 0; + } + return 0; + + case WM_NOTIFY: + switch (((LPNMHDR) lParam)->code) { + case PSN_APPLY: + return TRUE; + } + break; + } + return FALSE; +} + static HWND hwndList; static DISPLAYPROFILE dsp_current; @@ -1080,40 +1115,51 @@ static INT_PTR CALLBACK DlgProcDspProfiles(HWND hwnd, UINT msg, WPARAM wParam, L hwndTab = GetDlgItem(hwnd, IDC_OPTIONSTAB); iInit = TRUE; + int iOrder = 0; TCITEM tci; tci.mask = TCIF_PARAM|TCIF_TEXT; tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_DSPITEMS), hwnd, DlgProcDspItems); tci.pszText = TranslateT("Contacts"); - TabCtrl_InsertItem(hwndTab, 0, &tci); + TabCtrl_InsertItem(hwndTab, iOrder, &tci); int oPage = cfg::getByte("CLUI", "opage_d", 0); MoveWindow((HWND)tci.lParam,64,25,rcClient.right-128,rcClient.bottom-67,1); - ShowWindow((HWND)tci.lParam, oPage == 0 ? SW_SHOW : SW_HIDE); + ShowWindow((HWND)tci.lParam, oPage == iOrder ? SW_SHOW : SW_HIDE); if (IS_THEMED) API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_DSPGROUPS), hwnd, DlgProcDspGroups); tci.pszText = TranslateT("Groups and layout"); - TabCtrl_InsertItem(hwndTab, 1, &tci); + TabCtrl_InsertItem(hwndTab, ++iOrder, &tci); MoveWindow((HWND)tci.lParam,64,25,rcClient.right-128,rcClient.bottom-67,1); - ShowWindow((HWND)tci.lParam, oPage == 1 ? SW_SHOW : SW_HIDE); + ShowWindow((HWND)tci.lParam, oPage == iOrder ? SW_SHOW : SW_HIDE); if (IS_THEMED) API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); - tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_XICONS), hwnd, DlgProcXIcons); + tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_ICONS), hwnd, DlgProcIcons); tci.pszText = TranslateT("Icons"); - TabCtrl_InsertItem(hwndTab, 2, &tci); + TabCtrl_InsertItem(hwndTab, ++iOrder, &tci); MoveWindow((HWND)tci.lParam,64,25,rcClient.right-128,rcClient.bottom-67,1); - ShowWindow((HWND)tci.lParam, oPage == 2 ? SW_SHOW : SW_HIDE); + ShowWindow((HWND)tci.lParam, oPage == iOrder ? SW_SHOW : SW_HIDE); if (IS_THEMED) API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); + if ( !ServiceExists(MS_EXTRAICON_REGISTER)) { + tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_XICONS), hwnd, DlgProcXIcons); + tci.pszText = TranslateT("Extra Icons"); + TabCtrl_InsertItem(hwndTab, ++iOrder, &tci); + MoveWindow((HWND)tci.lParam,64,25,rcClient.right-128,rcClient.bottom-67,1); + ShowWindow((HWND)tci.lParam, oPage == iOrder ? SW_SHOW : SW_HIDE); + if (IS_THEMED) + API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); + } + tci.lParam = (LPARAM)CreateDialog(g_hInst,MAKEINTRESOURCE(IDD_OPT_DSPADVANCED), hwnd, DlgProcDspAdvanced); tci.pszText = TranslateT("Advanced"); - TabCtrl_InsertItem(hwndTab, 3, &tci); + TabCtrl_InsertItem(hwndTab, ++iOrder, &tci); MoveWindow((HWND)tci.lParam,64,25,rcClient.right-128,rcClient.bottom-67,1); - ShowWindow((HWND)tci.lParam, oPage == 3 ? SW_SHOW : SW_HIDE); + ShowWindow((HWND)tci.lParam, oPage == iOrder ? SW_SHOW : SW_HIDE); if (IS_THEMED) API::pfnEnableThemeDialogTexture((HWND)tci.lParam, ETDT_ENABLETAB); diff --git a/plugins/Clist_nicer/src/clistmod.cpp b/plugins/Clist_nicer/src/clistmod.cpp index 7e7cb40f38..d07f079815 100644 --- a/plugins/Clist_nicer/src/clistmod.cpp +++ b/plugins/Clist_nicer/src/clistmod.cpp @@ -103,6 +103,25 @@ int LoadContactListModule(void) return 0; } +///////////////////////////////////////////////////////////////////////////////////////// + +static INT_PTR GetCaps(WPARAM wParam, LPARAM) +{ + switch (wParam) { + case CLUICAPS_FLAGS1: + return CLUIF_HIDEEMPTYGROUPS | CLUIF_DISABLEGROUPS | CLUIF_HASONTOPOPTION | CLUIF_HASAUTOHIDEOPTION; + case CLUICAPS_FLAGS2: + return MAKELONG(MAXEXTRACOLUMNS,1); + } + return 0; +} + +int PreloadContactListModule(void) +{ + CreateServiceFunction(MS_CLUI_GETCAPS, GetCaps); + return 0; +} + /* Begin of Hrk's code for bug */ diff --git a/plugins/Clist_nicer/src/init.cpp b/plugins/Clist_nicer/src/init.cpp index 63fed7fbce..f4cb71debc 100644 --- a/plugins/Clist_nicer/src/init.cpp +++ b/plugins/Clist_nicer/src/init.cpp @@ -175,6 +175,7 @@ extern "C" __declspec(dllexport) PLUGININFOEX * MirandaPluginInfoEx(DWORD mirand extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_CLIST, MIID_LAST}; +int PreloadContactListModule(void); int LoadContactListModule(void); int LoadCLCModule(void); void LoadCLUIModule( void ); @@ -311,6 +312,8 @@ extern "C" int __declspec(dllexport) CListInitialise() _tcslwr(cfg::dat.tszProfilePath); + PreloadContactListModule(); + // get the clist interface pcli = ( CLIST_INTERFACE* )CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, (LPARAM)g_hInst); if ( (INT_PTR)pcli == CALLSERVICE_NOTFOUND ) { -- cgit v1.2.3