From 01e2e633ef9c613464b84d8065d103d1112d4156 Mon Sep 17 00:00:00 2001
From: George Hazan <ghazan@miranda.im>
Date: Tue, 5 May 2020 19:03:57 +0300
Subject: NewStory: option to hide scrollbar

---
 plugins/NewStory/src/history_control.cpp | 8 ++++++--
 plugins/NewStory/src/main.cpp            | 3 ++-
 plugins/NewStory/src/options.cpp         | 4 +++-
 plugins/NewStory/src/resource.h          | 1 +
 plugins/NewStory/src/stdafx.h            | 3 ++-
 5 files changed, 14 insertions(+), 5 deletions(-)

(limited to 'plugins/NewStory/src')

diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index f7225ef153..e851c0b768 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -242,7 +242,8 @@ struct NewstoryListData : public MZeroedObject
 			scrollTopPixel = cachedMaxTopPixel;
 		}
 
-		RecalcScrollBar();
+		if (g_plugin.bOptVScroll)
+			RecalcScrollBar();
 	}
 
 	int LayoutItem(int index)
@@ -505,7 +506,10 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
 	case WM_CREATE:
 		data = new NewstoryListData(hwnd);
 		SetWindowLongPtr(hwnd, 0, (LONG_PTR)data);
-		data->RecalcScrollBar();
+		if (!g_plugin.bOptVScroll)
+			SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_VSCROLL);
+		else 
+			data->RecalcScrollBar();
 		break;
 
 	// History list control messages
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index 4e1a540171..5f38b787a7 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -32,7 +32,8 @@ PLUGININFOEX pluginInfoEx =
 };
 
 CMPlugin::CMPlugin() :
-	PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx)
+	PLUGIN<CMPlugin>(MODULENAME, pluginInfoEx),
+	bOptVScroll(MODULENAME, "VScroll", true)
 {
 }
 
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp
index f6c681bda2..12c0581688 100644
--- a/plugins/NewStory/src/options.cpp
+++ b/plugins/NewStory/src/options.cpp
@@ -5,13 +5,15 @@
 
 class CGeneralOptsDlg : public CDlgBase
 {
-	CCtrlCheck chkGrouping;
+	CCtrlCheck chkGrouping, chkVScroll;
 
 public:
 	CGeneralOptsDlg() :
 		CDlgBase(g_plugin, IDD_OPT_ADVANCED),
+		chkVScroll(this, IDC_VSCROLL),
 		chkGrouping(this, IDC_GROUPING)
 	{
+		CreateLink(chkVScroll, g_plugin.bOptVScroll);
 		CreateLink(chkGrouping, g_bOptGrouping);
 	}
 
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index e9dc7ace1d..8dc3868356 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -80,6 +80,7 @@
 #define IDC_MONTHCALENDAR               1046
 #define IDC_GROUPING                    1047
 #define IDC_TEMPLATES                   1048
+#define IDC_VSCROLL                     1048
 #define IDC_EDITTEMPLATE                1049
 #define IDC_PREVIEW                     1050
 #define IDC_GPREVIEW                    1051
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index 83ea563746..eb3adc1797 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -81,7 +81,8 @@ struct CMPlugin : public PLUGIN<CMPlugin>
 {
 	HANDLE m_log;
 
-	bool bMsgGrouping;
+	CMOption<bool> bOptVScroll;
+	bool bMsgGrouping; // this option is a copy of static CMOption to keep performance high
 
 	CMPlugin();
 
-- 
cgit v1.2.3