From a1d3e949563298b0d9aec7dd04cffdd054b86bf7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 10 Apr 2020 16:18:14 +0300 Subject: fixes #2313 (Request: Clist Classic - Dont move offline users to bottom) --- src/core/stdclist/res/resource.rc | 40 +++++++++++++++++++------------------ src/core/stdclist/src/clistopts.cpp | 7 +++++-- src/core/stdclist/src/contact.cpp | 7 ++++--- src/core/stdclist/src/init.cpp | 5 +++-- src/core/stdclist/src/resource.h | 4 +++- src/core/stdclist/src/stdafx.h | 2 +- 6 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/core/stdclist/res/resource.rc b/src/core/stdclist/res/resource.rc index 6682b85efb..614c54ac26 100644 --- a/src/core/stdclist/res/resource.rc +++ b/src/core/stdclist/res/resource.rc @@ -40,7 +40,7 @@ BEGIN LTEXT "This will erase all history and settings for this contact!",IDC_STATIC,7,18,239,16 END -IDD_OPT_CLIST DIALOGEX 0, 0, 314, 204 +IDD_OPT_CLIST DIALOGEX 0, 0, 314, 219 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 @@ -48,24 +48,26 @@ BEGIN CONTROL "Sort contacts by name",IDC_SORTBYNAME,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,14,287,10 CONTROL "Sort contacts by status",IDC_SORTBYSTATUS,"Button",BS_AUTORADIOBUTTON,10,26,287,10 CONTROL "Sort contacts by protocol",IDC_SORTBYPROTO,"Button",BS_AUTORADIOBUTTON,10,38,287,10 - CONTROL "Single click interface",IDC_ONECLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,68,298,10 - CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,81,151,11 - CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,95,86,9 - EDITTEXT IDC_BLINKTIME,12,108,35,12,ES_NUMBER - CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,39,107,11,14 - LTEXT "ms delay",IDC_STMSDELAY,52,111,113,8 - CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,143,90,10 - COMBOBOX IDC_PRIMARYSTATUS,104,142,78,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - LTEXT "icon when statuses differ",IDC_STATIC,189,144,116,8,NOT WS_GROUP - CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,160,89,10 - EDITTEXT IDC_CYCLETIME,103,159,30,12,ES_RIGHT | ES_NUMBER + CONTROL "Single click interface",IDC_ONECLK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,83,298,10 + CONTROL "Always show status in tooltip",IDC_ALWAYSSTATUS,"Button",BS_AUTOCHECKBOX | BS_TOP | BS_MULTILINE | WS_TABSTOP,10,96,151,11 + CONTROL "Disable icon blinking",IDC_DISABLEBLINK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,110,86,9 + EDITTEXT IDC_BLINKTIME,12,123,35,12,ES_NUMBER + CONTROL "Spin5",IDC_BLINKSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,39,123,11,14 + LTEXT "ms delay",IDC_STMSDELAY,52,126,113,8 + CONTROL "Show",IDC_DONTCYCLE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,10,158,90,10 + COMBOBOX IDC_PRIMARYSTATUS,104,157,78,70,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + LTEXT "icon when statuses differ",IDC_STATIC,189,159,116,8,NOT WS_GROUP + CONTROL "Cycle icons every",IDC_CYCLE,"Button",BS_AUTORADIOBUTTON,10,175,89,10 + EDITTEXT IDC_CYCLETIME,103,174,30,12,ES_RIGHT | ES_NUMBER CONTROL "Spin1",IDC_CYCLETIMESPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,127,158,10,14 - LTEXT "seconds, when statuses differ",IDC_STATIC,141,161,165,8,NOT WS_GROUP - CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,177,91,10 - CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,177,198,10 - GROUPBOX "System tray icon",IDC_STATIC,2,57,310,70 - GROUPBOX "System tray icon when using multiple protocols",IDC_STATIC,2,131,310,66 - GROUPBOX "Contact list sorting",IDC_STATIC,2,2,310,54,WS_GROUP + LTEXT "seconds, when statuses differ",IDC_STATIC,141,176,165,8,NOT WS_GROUP + CONTROL "Show multiple icons",IDC_MULTITRAY,"Button",BS_AUTORADIOBUTTON,10,192,91,10 + CONTROL "Only when statuses differ",IDC_ALWAYSMULTI,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,108,192,198,10 + GROUPBOX "System tray icon",IDC_STATIC,2,72,310,70 + GROUPBOX "System tray icon when using multiple protocols",IDC_STATIC,2,146,310,66 + GROUPBOX "Contact list sorting",IDC_STATIC,2,2,310,68,WS_GROUP + CONTROL "Don't move offline user to bottom",IDC_NOOFFLINEMOVE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,10,53,287,10 END IDD_OPT_CLUI DIALOGEX 0, 0, 313, 233 @@ -228,7 +230,7 @@ BEGIN VERTGUIDE, 2 VERTGUIDE, 308 TOPMARGIN, 2 - BOTTOMMARGIN, 202 + BOTTOMMARGIN, 217 HORZGUIDE, 179 HORZGUIDE, 196 END diff --git a/src/core/stdclist/src/clistopts.cpp b/src/core/stdclist/src/clistopts.cpp index 59a31eaeac..691b93074c 100644 --- a/src/core/stdclist/src/clistopts.cpp +++ b/src/core/stdclist/src/clistopts.cpp @@ -28,7 +28,7 @@ class ClistOptsDlg : public CDlgBase { CCtrlSpin cycleTime, blink; CCtrlCombo status; - CCtrlCheck sortByName, sortByStatus, sortByProto; + CCtrlCheck sortByName, sortByStatus, sortByProto, chkOfflineBottom; CCtrlCheck chkDisableBlink, chkCycle, chkDontCycle, chkMulti; public: @@ -43,7 +43,8 @@ public: sortByName(this, IDC_SORTBYNAME), sortByProto(this, IDC_SORTBYPROTO), sortByStatus(this, IDC_SORTBYSTATUS), - chkDisableBlink(this, IDC_DISABLEBLINK) + chkDisableBlink(this, IDC_DISABLEBLINK), + chkOfflineBottom(this, IDC_NOOFFLINEMOVE) { chkDisableBlink.OnChange = Callback(this, &ClistOptsDlg::onChange_DisableBlink); chkCycle.OnChange = chkDontCycle.OnChange = chkMulti.OnChange = Callback(this, &ClistOptsDlg::onChange_Tray); @@ -54,6 +55,7 @@ public: sortByName.SetState(!g_plugin.getByte("SortByStatus", SETTING_SORTBYSTATUS_DEFAULT) && !g_plugin.getByte("SortByProto", SETTING_SORTBYPROTO_DEFAULT)); sortByProto.SetState(g_plugin.getByte("SortByProto", SETTING_SORTBYPROTO_DEFAULT)); sortByStatus.SetState(g_plugin.getByte("SortByStatus", SETTING_SORTBYSTATUS_DEFAULT)); + chkOfflineBottom.SetState(g_plugin.getByte("NoOfflineBottom")); CheckDlgButton(m_hwnd, IDC_ONECLK, g_plugin.getByte("Tray1Click", SETTING_TRAY1CLICK_DEFAULT)); CheckDlgButton(m_hwnd, IDC_ALWAYSSTATUS, g_plugin.getByte("AlwaysStatus", SETTING_ALWAYSSTATUS_DEFAULT)); @@ -91,6 +93,7 @@ public: { g_plugin.setByte("SortByStatus", g_bSortByStatus = sortByStatus.GetState()); g_plugin.setByte("SortByProto", g_bSortByProto = sortByProto.GetState()); + g_plugin.getByte("NoOfflineBottom", g_bNoOfflineBottom = chkOfflineBottom.GetState()); g_plugin.setByte("Tray1Click", IsDlgButtonChecked(m_hwnd, IDC_ONECLK)); g_plugin.setByte("AlwaysStatus", IsDlgButtonChecked(m_hwnd, IDC_ALWAYSSTATUS)); g_plugin.setByte("AlwaysMulti", !IsDlgButtonChecked(m_hwnd, IDC_ALWAYSMULTI)); diff --git a/src/core/stdclist/src/contact.cpp b/src/core/stdclist/src/contact.cpp index 2fc5bd4757..28f3da370b 100644 --- a/src/core/stdclist/src/contact.cpp +++ b/src/core/stdclist/src/contact.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" -int g_bSortByStatus, g_bSortByProto; +bool g_bSortByStatus, g_bSortByProto, g_bNoOfflineBottom; const struct { @@ -81,8 +81,9 @@ int CompareContacts(const ClcContact* c1, const ClcContact* c2) } else { //one is offline: offline goes below online - if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) - return 2 * (statusa == ID_STATUS_OFFLINE) - 1; + if (!g_bNoOfflineBottom) + if ((statusa == ID_STATUS_OFFLINE) != (statusb == ID_STATUS_OFFLINE)) + return 2 * (statusa == ID_STATUS_OFFLINE) - 1; } nameb = Clist_GetContactDisplayName(a); diff --git a/src/core/stdclist/src/init.cpp b/src/core/stdclist/src/init.cpp index 1aec9c59de..e37d6f07cd 100644 --- a/src/core/stdclist/src/init.cpp +++ b/src/core/stdclist/src/init.cpp @@ -107,8 +107,9 @@ static INT_PTR GetStatusMode(WPARAM, LPARAM) int CMPlugin::Load() { - g_bSortByStatus = g_plugin.getByte("SortByStatus", SETTING_SORTBYSTATUS_DEFAULT); - g_bSortByProto = g_plugin.getByte("SortByProto", SETTING_SORTBYPROTO_DEFAULT); + g_bSortByStatus = g_plugin.getBool("SortByStatus", SETTING_SORTBYSTATUS_DEFAULT); + g_bSortByProto = g_plugin.getBool("SortByProto", SETTING_SORTBYPROTO_DEFAULT); + g_bNoOfflineBottom = g_plugin.getBool("NoOfflineBottom"); Clist_GetInterface(); coreCli = g_clistApi; diff --git a/src/core/stdclist/src/resource.h b/src/core/stdclist/src/resource.h index b4c544a1d2..76473f5926 100644 --- a/src/core/stdclist/src/resource.h +++ b/src/core/stdclist/src/resource.h @@ -123,6 +123,8 @@ #define IDC_DISABLEDOCKING 1658 #define IDC_WINCOLOUR 1659 #define IDC_STMSDELAY 1661 +#define IDC_CHECK1 1662 +#define IDC_NOOFFLINEMOVE 1662 // Next default values for new objects // @@ -130,7 +132,7 @@ #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 293 #define _APS_NEXT_COMMAND_VALUE 40018 -#define _APS_NEXT_CONTROL_VALUE 1662 +#define _APS_NEXT_CONTROL_VALUE 1663 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/src/core/stdclist/src/stdafx.h b/src/core/stdclist/src/stdafx.h index f734181b6c..6e74d8398a 100644 --- a/src/core/stdclist/src/stdafx.h +++ b/src/core/stdclist/src/stdafx.h @@ -65,6 +65,6 @@ struct CMPlugin : public PLUGIN // shared vars extern CLIST_INTERFACE coreCli; -extern int g_bSortByStatus, g_bSortByProto; +extern bool g_bSortByStatus, g_bSortByProto, g_bNoOfflineBottom; void LoadClcOptions(HWND hwnd, struct ClcData *dat, BOOL bFirst); -- cgit v1.2.3