diff options
author | George Hazan <ghazan@miranda.im> | 2019-08-29 22:34:56 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-08-29 22:34:56 +0300 |
commit | a8f4c176d9983951d3f1b9803e08c7170a27eacd (patch) | |
tree | 5bc0ac59b63ccc92dc0ff4a3a1df9ea25f050c07 /plugins/Scriver | |
parent | 8c7a670b1b6644aafb0fc78bd3039da45e7a7d37 (diff) |
Scriver: options automation
Diffstat (limited to 'plugins/Scriver')
-rw-r--r-- | plugins/Scriver/src/globals.cpp | 10 | ||||
-rw-r--r-- | plugins/Scriver/src/msgdialog.cpp | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/msgoptions.cpp | 42 | ||||
-rw-r--r-- | plugins/Scriver/src/msgs.h | 17 | ||||
-rw-r--r-- | plugins/Scriver/src/srmm.cpp | 13 | ||||
-rw-r--r-- | plugins/Scriver/src/stdafx.h | 2 | ||||
-rw-r--r-- | plugins/Scriver/src/tabs.cpp | 6 |
7 files changed, 40 insertions, 52 deletions
diff --git a/plugins/Scriver/src/globals.cpp b/plugins/Scriver/src/globals.cpp index b084f1c7fd..a44e955100 100644 --- a/plugins/Scriver/src/globals.cpp +++ b/plugins/Scriver/src/globals.cpp @@ -370,14 +370,14 @@ void ReloadGlobals() g_dat.flags |= SMF_DRAWLINES;
if (g_plugin.getByte(SRMSGSET_HIDENAMES, SRMSGDEFSET_HIDENAMES))
g_dat.flags |= SMF_HIDENAMES;
- if (g_plugin.getByte(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP))
+ if (g_plugin.bAutoPopup)
g_dat.flags |= SMF_AUTOPOPUP;
- if (g_plugin.getByte(SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED))
+ if (g_plugin.bStayMinimized)
g_dat.flags |= SMF_STAYMINIMIZED;
- if (g_plugin.getByte(SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS))
+ if (g_plugin.bSaveDrafts)
g_dat.flags |= SMF_SAVEDRAFTS;
- if (g_plugin.getByte(SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP))
+ if (g_plugin.bDelTemp)
g_dat.flags |= SMF_DELTEMP;
if (g_plugin.getByte(SRMSGSET_INDENTTEXT, SRMSGDEFSET_INDENTTEXT))
g_dat.flags |= SMF_INDENTTEXT;
@@ -405,7 +405,7 @@ void ReloadGlobals() g_dat.flags2 |= SMF2_LIMITTABS;
if (g_plugin.getByte(SRMSGSET_LIMITCHATSTABS, SRMSGDEFSET_LIMITCHATSTABS))
g_dat.flags2 |= SMF2_LIMITCHATSTABS;
- if (g_plugin.getByte(SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS))
+ if (g_plugin.bHideContainer)
g_dat.flags2 |= SMF2_HIDECONTAINERS;
if (g_plugin.getByte(SRMSGSET_SHOWSTATUSBAR, SRMSGDEFSET_SHOWSTATUSBAR))
diff --git a/plugins/Scriver/src/msgdialog.cpp b/plugins/Scriver/src/msgdialog.cpp index a233adc74b..6b23e03e8c 100644 --- a/plugins/Scriver/src/msgdialog.cpp +++ b/plugins/Scriver/src/msgdialog.cpp @@ -468,7 +468,7 @@ void CSrmmWindow::onClick_Ok(CCtrlButton *pButton) m_message.SetText(L"");
EnableWindow(GetDlgItem(m_hwnd, IDOK), FALSE);
- if (g_plugin.getByte(SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN))
+ if (g_plugin.bSaveDrafts)
ShowWindow(m_hwndParent, SW_MINIMIZE);
if (pButton == nullptr)
diff --git a/plugins/Scriver/src/msgoptions.cpp b/plugins/Scriver/src/msgoptions.cpp index cd4a247429..cf5163cd6b 100644 --- a/plugins/Scriver/src/msgoptions.cpp +++ b/plugins/Scriver/src/msgoptions.cpp @@ -221,10 +221,6 @@ static const struct CheckBoxValues_t statusValues[] = class CMainOptionsDlg : public CBaseOptionDlg
{
- CCtrlCheck chkAutoPopup, chkCascade, chkSavePerContact;
- CCtrlCombo cmbSendMode;
- CCtrlTreeView m_tree;
-
void FillCheckBoxTree(const struct CheckBoxValues_t *values, int nValues, DWORD style)
{
TVINSERTSTRUCT tvis;
@@ -255,15 +251,33 @@ class CMainOptionsDlg : public CBaseOptionDlg return flags;
}
+ CCtrlCheck chkAutoMin, chkAutoPopup, chkCascade, chkSavePerContact, chkStayMinimized;
+ CCtrlCheck chkSaveDrafts, chkDelTemp, chkHideContainer;
+ CCtrlCombo cmbSendMode;
+ CCtrlTreeView m_tree;
+
public:
CMainOptionsDlg() :
CBaseOptionDlg(IDD_OPT_MSGDLG),
m_tree(this, IDC_POPLIST),
+ chkAutoMin(this, IDC_AUTOMIN),
chkCascade(this, IDC_CASCADE),
+ chkDelTemp(this, IDC_DELTEMP),
cmbSendMode(this, IDC_SENDMODE),
chkAutoPopup(this, IDC_AUTOPOPUP),
+ chkSaveDrafts(this, IDC_SAVEDRAFTS),
+ chkHideContainer(this, IDC_HIDECONTAINERS),
+ chkStayMinimized(this, IDC_STAYMINIMIZED),
chkSavePerContact(this, IDC_SAVEPERCONTACT)
{
+ CreateLink(chkCascade, g_plugin.bCascade);
+ CreateLink(chkAutoMin, g_plugin.bAutoMin);
+ CreateLink(chkAutoPopup, g_plugin.bAutoPopup);
+ CreateLink(chkSaveDrafts, g_plugin.bSaveDrafts);
+ CreateLink(chkHideContainer, g_plugin.bHideContainer);
+ CreateLink(chkStayMinimized, g_plugin.bStayMinimized);
+ CreateLink(chkSavePerContact, g_plugin.bSavePerContact);
+
chkCascade.OnChange = Callback(this, &CMainOptionsDlg::onChange_Cascade);
chkAutoPopup.OnChange = Callback(this, &CMainOptionsDlg::onChange_AutoPopup);
chkSavePerContact.OnChange = Callback(this, &CMainOptionsDlg::onChange_SavePerContact);
@@ -273,20 +287,10 @@ public: {
SetWindowLongPtr(m_tree.GetHwnd(), GWL_STYLE, (GetWindowLongPtr(m_tree.GetHwnd(), GWL_STYLE) & ~WS_BORDER) | TVS_NOHSCROLL | TVS_CHECKBOXES);
FillCheckBoxTree(statusValues, _countof(statusValues), g_plugin.getDword(SRMSGSET_POPFLAGS, SRMSGDEFSET_POPFLAGS));
- chkAutoPopup.SetState(g_plugin.getByte(SRMSGSET_AUTOPOPUP, SRMSGDEFSET_AUTOPOPUP));
-
- CheckDlgButton(m_hwnd, IDC_STAYMINIMIZED, g_plugin.getByte(SRMSGSET_STAYMINIMIZED, SRMSGDEFSET_STAYMINIMIZED) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_AUTOMIN, g_plugin.getByte(SRMSGSET_AUTOMIN, SRMSGDEFSET_AUTOMIN) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_SAVEDRAFTS, g_plugin.getByte(SRMSGSET_SAVEDRAFTS, SRMSGDEFSET_SAVEDRAFTS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_HIDECONTAINERS, g_plugin.getByte(SRMSGSET_HIDECONTAINERS, SRMSGDEFSET_HIDECONTAINERS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_DELTEMP, g_plugin.getByte(SRMSGSET_DELTEMP, SRMSGDEFSET_DELTEMP) ? BST_CHECKED : BST_UNCHECKED);
SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_SETRANGE, 0, MAKELONG(60, 4));
SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_SETPOS, 0, g_plugin.getDword(SRMSGSET_MSGTIMEOUT, SRMSGDEFSET_MSGTIMEOUT) / 1000);
- chkCascade.SetState(g_plugin.getByte(SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE));
- chkSavePerContact.SetState(g_plugin.getByte(SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT));
-
cmbSendMode.AddString(TranslateT("Enter"));
cmbSendMode.AddString(TranslateT("Double 'Enter'"));
cmbSendMode.AddString(TranslateT("Ctrl+Enter"));
@@ -300,20 +304,10 @@ public: bool OnApply() override
{
g_plugin.setDword(SRMSGSET_POPFLAGS, MakeCheckBoxTreeFlags());
- g_plugin.setByte(SRMSGSET_AUTOPOPUP, chkAutoPopup.GetState());
- g_plugin.setByte(SRMSGSET_STAYMINIMIZED, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_STAYMINIMIZED));
- g_plugin.setByte(SRMSGSET_AUTOMIN, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_AUTOMIN));
- g_plugin.setByte(SRMSGSET_SAVEDRAFTS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_SAVEDRAFTS));
- g_plugin.setByte(SRMSGSET_DELTEMP, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_DELTEMP));
g_plugin.setDword(SRMSGSET_MSGTIMEOUT, (DWORD)SendDlgItemMessage(m_hwnd, IDC_SECONDSSPIN, UDM_GETPOS, 0, 0) * 1000);
g_plugin.setByte(SRMSGSET_SENDMODE, cmbSendMode.GetCurSel());
-
- g_plugin.setByte(SRMSGSET_SAVEPERCONTACT, chkSavePerContact.GetState());
- g_plugin.setByte(SRMSGSET_CASCADE, chkCascade.GetState());
-
- g_plugin.setByte(SRMSGSET_HIDECONTAINERS, (BYTE)IsDlgButtonChecked(m_hwnd, IDC_HIDECONTAINERS));
return true;
}
diff --git a/plugins/Scriver/src/msgs.h b/plugins/Scriver/src/msgs.h index f7b11640b2..f33f8fa99b 100644 --- a/plugins/Scriver/src/msgs.h +++ b/plugins/Scriver/src/msgs.h @@ -342,10 +342,6 @@ extern int fontOptionsListSize; #define SRMSGSET_LIMITCHATSTABSNUM "LimitChatsTabsNum"
#define SRMSGDEFSET_LIMITCHATSTABSNUM 10
-#define SRMSGSET_CASCADE "Cascade"
-#define SRMSGDEFSET_CASCADE 1
-#define SRMSGSET_SAVEPERCONTACT "SavePerContact"
-#define SRMSGDEFSET_SAVEPERCONTACT 0
#define SRMSGSET_SHOWTITLEBAR "ShowTitleBar"
#define SRMSGDEFSET_SHOWTITLEBAR 1
#define SRMSGSET_SHOWSTATUSBAR "ShowStatusBar"
@@ -362,14 +358,8 @@ extern int fontOptionsListSize; #define SRMSGDEFSET_SHOWINFOLINE 1
#define SRMSGSET_SHOWPROGRESS "ShowProgress"
#define SRMSGDEFSET_SHOWPROGRESS 0
-#define SRMSGSET_AUTOPOPUP "AutoPopupMsg"
-#define SRMSGDEFSET_AUTOPOPUP 0
-#define SRMSGSET_STAYMINIMIZED "StayMinimized"
-#define SRMSGDEFSET_STAYMINIMIZED 0
#define SRMSGSET_SWITCHTOACTIVE "SwitchToActiveTab"
#define SRMSGDEFSET_SWITCHTOACTIVE 0
-#define SRMSGSET_AUTOMIN "AutoMin"
-#define SRMSGDEFSET_AUTOMIN 0
#define SRMSGSET_AUTOCLOSE "AutoClose"
#define SRMSGDEFSET_AUTOCLOSE 0
#define SRMSGSET_SENDBUTTON "UseSendButton"
@@ -378,8 +368,6 @@ extern int fontOptionsListSize; #define SRMSGDEFSET_CHARCOUNT 0
#define SRMSGSET_CTRLSUPPORT "SupportCtrlUpDn"
#define SRMSGDEFSET_CTRLSUPPORT 1
-#define SRMSGSET_DELTEMP "DeleteTempCont"
-#define SRMSGDEFSET_DELTEMP 0
#define SRMSGSET_MSGTIMEOUT "MessageTimeout"
#define SRMSGDEFSET_MSGTIMEOUT 10000
#define SRMSGSET_FLASHCOUNT "FlashMax"
@@ -464,16 +452,11 @@ extern int fontOptionsListSize; #define SRMSGSET_INACTIVEALPHA "InactiveAlpha"
#define SRMSGDEFSET_INACTIVEALPHA 0
#define SRMSGSET_WINDOWTITLE "WindowTitle"
-#define SRMSGSET_SAVEDRAFTS "SaveDrafts"
-#define SRMSGDEFSET_SAVEDRAFTS 0
#define SRMSGSET_BUTTONVISIBILITY "ButtonVisibility"
#define SRMSGDEFSET_BUTTONVISIBILITY 0xFFFF
#define SRMSGSET_CHATBUTTONVISIBILITY "ChatButtonVisibility"
#define SRMSGDEFSET_CHATBUTTONVISIBILITY 0xFFFF
-#define SRMSGSET_HIDECONTAINERS "HideContainers"
-#define SRMSGDEFSET_HIDECONTAINERS 0
-
#define SRMSGSET_AUTORESIZELINES "AutoResizeLines"
#define SRMSGDEFSET_AUTORESIZELINES 2
diff --git a/plugins/Scriver/src/srmm.cpp b/plugins/Scriver/src/srmm.cpp index 95571ba0ed..33f18aa9bf 100644 --- a/plugins/Scriver/src/srmm.cpp +++ b/plugins/Scriver/src/srmm.cpp @@ -46,8 +46,17 @@ PLUGININFOEX pluginInfoEx = { };
CMPlugin::CMPlugin() :
- PLUGIN<CMPlugin>(SRMM_MODULE, pluginInfoEx)
-{}
+ PLUGIN<CMPlugin>(SRMM_MODULE, pluginInfoEx),
+ bCascade(SRMM_MODULE, "Cascade", 1),
+ bAutoMin(SRMM_MODULE, "AutoMin", 0),
+ bDelTemp(SRMM_MODULE, "DeleteTempCont", 0),
+ bAutoPopup(SRMM_MODULE, "AutoPopupMsg", 0),
+ bSaveDrafts(SRMM_MODULE, "SaveDrafts", 0),
+ bHideContainer(SRMM_MODULE, "HideContainers", 0),
+ bStayMinimized(SRMM_MODULE, "StayMinimized", 0),
+ bSavePerContact(SRMM_MODULE, "SavePerContact", 0)
+{
+}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/Scriver/src/stdafx.h b/plugins/Scriver/src/stdafx.h index ad8cc20feb..1d375415ea 100644 --- a/plugins/Scriver/src/stdafx.h +++ b/plugins/Scriver/src/stdafx.h @@ -70,6 +70,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. struct CMPlugin : public PLUGIN<CMPlugin>
{
+ CMOption<BYTE> bSavePerContact, bCascade, bStayMinimized, bAutoMin, bSaveDrafts, bDelTemp, bHideContainer, bAutoPopup;
+
CMPlugin();
int Load() override;
diff --git a/plugins/Scriver/src/tabs.cpp b/plugins/Scriver/src/tabs.cpp index 783a3b3d81..167a6465e4 100644 --- a/plugins/Scriver/src/tabs.cpp +++ b/plugins/Scriver/src/tabs.cpp @@ -623,7 +623,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara switch (msg) {
case WM_INITDIALOG:
{
- int savePerContact = g_plugin.getByte(SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
+ int savePerContact = g_plugin.bSavePerContact;
NewMessageWindowLParam *newData = (NewMessageWindowLParam *)lParam;
dat = (ParentWindowData *)mir_alloc(sizeof(ParentWindowData));
dat->hContact = newData->hContact;
@@ -670,7 +670,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara if (ScriverRestoreWindowPosition(hwndDlg, hSContact, SRMM_MODULE, (newData->isChat && !savePerContact) ? "chat" : "", 0, SW_HIDE))
SetWindowPos(hwndDlg, nullptr, 0, 0, 450, 300, SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
- if (!savePerContact && g_plugin.getByte(SRMSGSET_CASCADE, SRMSGDEFSET_CASCADE))
+ if (!savePerContact && g_plugin.bCascade)
WindowList_Broadcast(g_dat.hParentWindowList, DM_CASCADENEWWINDOW, (WPARAM)hwndDlg, (LPARAM)&dat->windowWasCascaded);
PostMessage(hwndDlg, WM_SIZE, 0, 0);
@@ -1016,7 +1016,7 @@ static INT_PTR CALLBACK DlgProcParentWindow(HWND hwndDlg, UINT msg, WPARAM wPara SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0);
WindowList_Remove(g_dat.hParentWindowList, hwndDlg);
{
- int savePerContact = g_plugin.getByte(SRMSGSET_SAVEPERCONTACT, SRMSGDEFSET_SAVEPERCONTACT);
+ int savePerContact = g_plugin.bSavePerContact;
MCONTACT hContact = (savePerContact) ? dat->hContact : 0;
WINDOWPLACEMENT wp = { sizeof(wp) };
|