diff options
-rw-r--r-- | src/core/stdpopup/res/resource.rc | 73 | ||||
-rw-r--r-- | src/core/stdpopup/src/message_pump.cpp | 2 | ||||
-rw-r--r-- | src/core/stdpopup/src/options.cpp | 155 | ||||
-rw-r--r-- | src/core/stdpopup/src/options.h | 2 | ||||
-rw-r--r-- | src/core/stdpopup/src/resource.h | 11 |
5 files changed, 168 insertions, 75 deletions
diff --git a/src/core/stdpopup/res/resource.rc b/src/core/stdpopup/res/resource.rc index cc5b9a5072..4ead0c34aa 100644 --- a/src/core/stdpopup/res/resource.rc +++ b/src/core/stdpopup/res/resource.rc @@ -7,7 +7,7 @@ // // Generated from the TEXTINCLUDE 2 resource. // -#include <winres.h> +#include "winres.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -61,41 +61,39 @@ BEGIN CONTROL "Case sensitive",IDC_HISTORY_FILTER_CASESENSITIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,185,287,222,10 END -IDD_OPT1 DIALOGEX 0, 0, 297, 218 +IDD_OPT_MAIN DIALOGEX 0, 0, 297, 218 STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN - GROUPBOX "Default timeout",IDC_STATIC,4,7,153,36 - CONTROL "Never timeout",IDC_RAD_NOTIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_GROUP,10,16,77,10,WS_EX_RIGHT - CONTROL "Set timeout:",IDC_RAD_TIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,10,28,77,10,WS_EX_RIGHT - EDITTEXT IDC_ED_TIMEOUT,93,26,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT - CONTROL "",IDC_SPIN_TIMEOUT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,131,26,12,14 + GROUPBOX "Default timeout",IDC_STATIC,4,7,153,44 + CONTROL "Never timeout",IDC_RAD_NOTIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT | WS_GROUP,10,18,77,10,WS_EX_RIGHT + CONTROL "Set timeout:",IDC_RAD_TIMEOUT,"Button",BS_AUTORADIOBUTTON | BS_LEFTTEXT,10,32,77,10,WS_EX_RIGHT + EDITTEXT IDC_ED_TIMEOUT,94,30,40,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT + CONTROL "",IDC_SPIN_TIMEOUT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,132,30,12,14 EDITTEXT IDC_ED_WIDTH,238,84,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",IDC_SPIN_WIDTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,84,12,14 EDITTEXT IDC_ED_MAXHEIGHT,238,102,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",IDC_SPIN_MAXHEIGHT,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,102,12,14 RTEXT "Width:",IDC_STATIC,174,87,60,8,0,WS_EX_RIGHT RTEXT "Maximum height:",IDC_STATIC,174,104,60,8,0,WS_EX_RIGHT - GROUPBOX "Options",IDC_STATIC,4,116,153,94 - EDITTEXT IDC_ED_TRANS,97,183,33,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT - CONTROL "",IDC_SPIN_TRANS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,126,183,13,12 - RTEXT "Opacity (%):",IDC_STATIC,11,186,84,8,0,WS_EX_RIGHT - CONTROL "Border",IDC_CHK_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,127,121,10 - CONTROL "Round corners (window)",IDC_CHK_ROUNDCORNERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,138,121,10 + GROUPBOX "Options",IDC_STATIC,4,55,153,155 + EDITTEXT IDC_ED_TRANS,97,146,33,12,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT + CONTROL "",IDC_SPIN_TRANS,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS,126,147,13,12 + RTEXT "Opacity (%):",IDC_STATIC,11,149,84,8,0,WS_EX_RIGHT + CONTROL "Border",IDC_CHK_BORDER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,71,139,10 + CONTROL "Round corners (window)",IDC_CHK_ROUNDCORNERS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,85,139,10 PUSHBUTTON "Preview",IDC_BTN_PREVIEW,161,194,130,17 - COMBOBOX IDC_CMB_ANIMATE,25,160,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Transparent background",IDC_CHK_TRANSBG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,199,121,10 + COMBOBOX IDC_CMB_ANIMATE,25,113,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP + CONTROL "Transparent background",IDC_CHK_TRANSBG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,166,138,10 GROUPBOX "Layout",IDC_STATIC,161,7,129,184 RTEXT "Avatar size:",IDC_STATIC,174,122,60,8,0,WS_EX_RIGHT EDITTEXT IDC_ED_AVSIZE,238,120,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",IDC_SPIN_AVSIZE,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,120,12,14 - GROUPBOX "Disable when",IDC_STATIC,4,44,153,70 - CONTROL "",IDC_LST_STATUS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,54,148,56 COMBOBOX IDC_CMB_PLACEMENT,165,19,120,68,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_CMB_ICON,165,36,120,69,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP COMBOBOX IDC_CMB_AV,165,53,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP - CONTROL "Global hover",IDC_CHK_GLOBALHOVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,173,121,10 + CONTROL "Global hover",IDC_CHK_GLOBALHOVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,133,138,10 COMBOBOX IDC_CMB_TIME,165,69,120,76,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP EDITTEXT IDC_ED_SBWIDTH,238,138,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",IDC_SPIN_SBWIDTH,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,138,11,14 @@ -106,7 +104,19 @@ BEGIN EDITTEXT IDC_ED_PADDING,238,173,39,14,ES_RIGHT | ES_AUTOHSCROLL | ES_NUMBER,WS_EX_RIGHT CONTROL "",IDC_SPIN_PADDING,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS,270,173,12,14 RTEXT "Padding:",IDC_STATIC,174,176,60,8 - CONTROL "Round corners (avatar)",IDC_CHK_ROUNDCORNERSAV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,149,121,10 + CONTROL "Round corners (avatar)",IDC_CHK_ROUNDCORNERSAV,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,99,139,10 +END + +IDD_OPT_ADVANCED DIALOGEX 0, 0, 297, 218 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Disable when",IDC_STATIC,6,7,283,203 + CONTROL "",IDC_LST_STATUS,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_NOLABELWRAP | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,7,61,275,142 + CONTROL "Always (has priority)",IDC_DISABLE_ALWAYS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,19,270,10 + CONTROL "Fullscreen mode",IDC_DISABLE_FULLSCREEN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,33,270,10 + LTEXT "Statuses",IDC_STATIC,11,49,269,8 END IDD_CLASSES DIALOGEX 0, 0, 294, 223 @@ -134,7 +144,7 @@ END #ifdef APSTUDIO_INVOKED GUIDELINES DESIGNINFO BEGIN - IDD_OPT1, DIALOG + IDD_OPT_MAIN, DIALOG BEGIN LEFTMARGIN, 4 RIGHTMARGIN, 290 @@ -142,6 +152,10 @@ BEGIN BOTTOMMARGIN, 211 END + IDD_OPT_ADVANCED, DIALOG + BEGIN + END + IDD_CLASSES, DIALOG BEGIN LEFTMARGIN, 7 @@ -161,8 +175,27 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. IDI_POPUP ICON "popup.ico" + IDI_NOPOPUP ICON "popup_no.ico" + IDI_HISTORY ICON "popup_history.ico" + + +///////////////////////////////////////////////////////////////////////////// +// +// AFX_DIALOG_LAYOUT +// + +IDD_OPT_MAIN AFX_DIALOG_LAYOUT +BEGIN + 0 +END + +IDD_OPT_ADVANCED AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // English (United States) resources ///////////////////////////////////////////////////////////////////////////// diff --git a/src/core/stdpopup/src/message_pump.cpp b/src/core/stdpopup/src/message_pump.cpp index 9afca31246..96952f1f41 100644 --- a/src/core/stdpopup/src/message_pump.cpp +++ b/src/core/stdpopup/src/message_pump.cpp @@ -22,7 +22,7 @@ unsigned __stdcall MessagePumpThread(void *) int status = CallService(MS_CLIST_GETSTATUSMODE, 0, 0); if (status >= ID_STATUS_OFFLINE && status <= ID_STATUS_MAX && options.disable_status[status - ID_STATUS_OFFLINE]) enabled = false; - if ((options.disable_full_screen && IsFullScreen()) || IsWorkstationLocked()) + if (options.disable_always || (options.disable_full_screen && IsFullScreen()) || IsWorkstationLocked()) enabled = false; PopupData *pd = (PopupData *)hwndMsg.lParam; diff --git a/src/core/stdpopup/src/options.cpp b/src/core/stdpopup/src/options.cpp index f0df5a2de7..2bdbade5c2 100644 --- a/src/core/stdpopup/src/options.cpp +++ b/src/core/stdpopup/src/options.cpp @@ -42,7 +42,9 @@ void LoadOptions() options.disable_status[i] = (g_plugin.getByte(buff, 0) == 1); } - options.disable_full_screen = g_plugin.getByte("DisableFullScreen", 1) == 1; + options.disable_always = g_plugin.getByte("DisableAlways", false); + options.disable_full_screen = g_plugin.getBool("DisableFullScreen", true); + options.drop_shadow = g_plugin.getByte("DropShadow", 0) == 1; options.sb_width = g_plugin.getDword("SidebarWidth", 22); options.padding = g_plugin.getDword("Padding", 4); @@ -75,27 +77,47 @@ void SaveOptions() mir_snprintf(buff, "DisableStatus%d", i - 1); g_plugin.setByte(buff, options.disable_status[i] ? 1 : 0); } - g_plugin.setByte("DisableFullScreen", (options.disable_full_screen ? 1 : 0)); + g_plugin.setByte("DisableAlways", options.disable_always); + g_plugin.setByte("DisableFullScreen", options.disable_full_screen); g_plugin.setByte("DropShadow", (options.drop_shadow ? 1 : 0)); g_plugin.setDword("SidebarWidth", options.sb_width); g_plugin.setDword("Padding", options.padding); g_plugin.setDword("AvatarPadding", options.av_padding); } -class CMainOptDlg : public CDlgBase +///////////////////////////////////////////////////////////////////////////////////////// +// Options basic class + +class CBaseOptionsDlg : public CDlgBase +{ + void OnFinish(CDlgBase *) + { + SaveOptions(); + } + +public: + CBaseOptionsDlg(int iDlgId) : + CDlgBase(g_plugin, iDlgId) + { + m_OnFinishWizard = Callback(this, &CBaseOptionsDlg::OnFinish); + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// +// Main options dialog + +class CMainOptDlg : public CBaseOptionsDlg { CCtrlCheck chkTimeout, chkNoTimeout; CCtrlCombo cmbPlacement, cmbIcon, cmbTime, cmbAva, cmbAnimate; CCtrlButton btnPreview; - CCtrlListView m_statuses; public: CMainOptDlg() : - CDlgBase(g_plugin, IDD_OPT1), + CBaseOptionsDlg(IDD_OPT_MAIN), cmbAva(this, IDC_CMB_AV), cmbIcon(this, IDC_CMB_ICON), cmbTime(this, IDC_CMB_TIME), - m_statuses(this, IDC_LST_STATUS), btnPreview(this, IDC_BTN_PREVIEW), cmbAnimate(this, IDC_CMB_ANIMATE), chkTimeout(this, IDC_RAD_TIMEOUT), @@ -140,42 +162,6 @@ public: CheckDlgButton(m_hwnd, IDC_CHK_GLOBALHOVER, options.global_hover ? BST_CHECKED : BST_UNCHECKED); - // initialise and fill listbox - m_statuses.DeleteAllItems(); - - m_statuses.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); - - LVCOLUMN lvc = { 0 }; - // Initialize the LVCOLUMN structure. - // The mask specifies that the format, width, text, and - // subitem members of the structure are valid. - lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; - lvc.fmt = LVCFMT_LEFT; - - lvc.iSubItem = 0; - lvc.pszText = TranslateT("Status"); - lvc.cx = 200; - m_statuses.InsertColumn(0, &lvc); - - // Some code to create the list-view control. - // Initialize LVITEM members that are common to all - // items. - LVITEM lvI = { 0 }; - lvI.mask = LVIF_TEXT; - - int i = 0; - for (; i < _countof(options.disable_status); i++) { - lvI.pszText = Clist_GetStatusModeDescription(ID_STATUS_OFFLINE + i, 0); - lvI.iItem = i; - m_statuses.InsertItem(&lvI); - m_statuses.SetCheckState(i, options.disable_status[i]); - } - - lvI.pszText = TranslateT("Full-screen app running"); - lvI.iItem = i; - m_statuses.InsertItem(&lvI); - m_statuses.SetCheckState(i, options.disable_full_screen); - SendDlgItemMessage(m_hwnd, IDC_SPIN_TIMEOUT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(360, 1)); SendDlgItemMessage(m_hwnd, IDC_SPIN_WIDTH, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16)); SendDlgItemMessage(m_hwnd, IDC_SPIN_MAXHEIGHT, UDM_SETRANGE, 0, (LPARAM)MAKELONG(2048, 16)); @@ -286,13 +272,6 @@ public: options.av_round = IsDlgButtonChecked(m_hwnd, IDC_CHK_ROUNDCORNERSAV) && IsWindowEnabled(GetDlgItem(m_hwnd, IDC_CHK_ROUNDCORNERSAV)) ? true : false; options.trans_bg = IsDlgButtonChecked(m_hwnd, IDC_CHK_TRANSBG) ? true : false; options.global_hover = IsDlgButtonChecked(m_hwnd, IDC_CHK_GLOBALHOVER) ? true : false; - - int i = 0; - for (; i < _countof(options.disable_status); i++) - options.disable_status[i] = (m_statuses.GetCheckState(i) == 1); - options.disable_full_screen = (m_statuses.GetCheckState(i) == 1); - - SaveOptions(); return true; } @@ -334,6 +313,80 @@ public: }; ///////////////////////////////////////////////////////////////////////////////////////// +// Advanced options dialog + +class CAdvancedOptDlg : public CBaseOptionsDlg +{ + CCtrlCheck chkAlways, chkFullScreen; + CCtrlListView m_statuses; + +public: + CAdvancedOptDlg() : + CBaseOptionsDlg(IDD_OPT_ADVANCED), + m_statuses(this, IDC_LST_STATUS), + chkAlways(this, IDC_DISABLE_ALWAYS), + chkFullScreen(this, IDC_DISABLE_FULLSCREEN) + { + chkAlways.OnChange = Callback(this, &CAdvancedOptDlg::onChange_Always); + } + + bool OnInitDialog() override + { + chkAlways.SetState(options.disable_always); + chkFullScreen.SetState(options.disable_full_screen); + + // initialise and fill listbox + m_statuses.DeleteAllItems(); + + m_statuses.SetExtendedListViewStyle(LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES); + + LVCOLUMN lvc = { 0 }; + // Initialize the LVCOLUMN structure. + // The mask specifies that the format, width, text, and + // subitem members of the structure are valid. + lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; + lvc.fmt = LVCFMT_LEFT; + + lvc.iSubItem = 0; + lvc.pszText = TranslateT("Status"); + lvc.cx = 200; + m_statuses.InsertColumn(0, &lvc); + + // Some code to create the list-view control. + // Initialize LVITEM members that are common to all + // items. + LVITEM lvI = { 0 }; + lvI.mask = LVIF_TEXT; + + int i = 0; + for (; i < _countof(options.disable_status); i++) { + lvI.pszText = Clist_GetStatusModeDescription(ID_STATUS_OFFLINE + i, 0); + lvI.iItem = i; + m_statuses.InsertItem(&lvI); + m_statuses.SetCheckState(i, options.disable_status[i]); + } + return true; + } + + bool OnApply() override + { + options.disable_always = chkAlways.IsChecked(); + options.disable_full_screen = chkFullScreen.IsChecked(); + + for (int i = 0; i < _countof(options.disable_status); i++) + options.disable_status[i] = (m_statuses.GetCheckState(i) == 1); + return true; + } + + void onChange_Always(CCtrlCheck *) + { + bool bEnable = chkAlways.IsChecked(); + m_statuses.Enable(bEnable); + chkFullScreen.Enable(bEnable); + } +}; + +///////////////////////////////////////////////////////////////////////////////////////// // Classes' options dialog class CClassesOptDlg : public CDlgBase @@ -495,6 +548,10 @@ int OptInit(WPARAM wParam, LPARAM) odp.pDialog = new CMainOptDlg(); g_plugin.addOptions(wParam, &odp); + odp.szTab.a = LPGEN("Advanced"); + odp.pDialog = new CAdvancedOptDlg(); + g_plugin.addOptions(wParam, &odp); + odp.szTab.a = LPGEN("Classes"); odp.pDialog = new CClassesOptDlg(); g_plugin.addOptions(wParam, &odp); diff --git a/src/core/stdpopup/src/options.h b/src/core/stdpopup/src/options.h index f80f179e14..0cc9744c51 100644 --- a/src/core/stdpopup/src/options.h +++ b/src/core/stdpopup/src/options.h @@ -22,7 +22,7 @@ struct Options int text_indent; bool global_hover; PopupTimeLayout time_layout; - bool disable_full_screen; + bool disable_full_screen, disable_always; bool drop_shadow; int sb_width; int padding, av_padding; diff --git a/src/core/stdpopup/src/resource.h b/src/core/stdpopup/src/resource.h index 87140dfdbd..3755fe6412 100644 --- a/src/core/stdpopup/src/resource.h +++ b/src/core/stdpopup/src/resource.h @@ -1,8 +1,9 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by D:\Development\Miranda NG\plugins\YAPP\res\yapp.rc +// Used by W:\miranda-ng\src\core\stdpopup\res\resource.rc // -#define IDD_OPT1 101 +#define IDD_OPT_MAIN 101 +#define IDD_OPT_ADVANCED 102 #define IDD_LST_HISTORY 104 #define IDI_POPUP 105 #define IDI_NOPOPUP 106 @@ -55,14 +56,16 @@ #define IDC_HISTORY_FILTER_CASESENSITIVE 1046 #define IDC_LST_CLASSES 1047 #define IDC_CHK_TIMEOUT 1048 +#define IDC_DISABLE_ALWAYS 1051 +#define IDC_DISABLE_FULLSCREEN 1052 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 108 +#define _APS_NEXT_RESOURCE_VALUE 110 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1051 +#define _APS_NEXT_CONTROL_VALUE 1052 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif |