summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-10-22 20:33:56 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-10-22 20:33:56 +0300
commit29be1661e4f294cc1056a1d315001f25acfbb21f (patch)
treefb82c9ca81e26dea9ec26dbe68677aeca7efd6bb
parent57f3aa3dbcefdd94a4f26a71adccfe8ebe988eab (diff)
fixes #4602 (NewStory: сделать опцию для ограничения максимальной высоты превьюшки изображения)
-rw-r--r--plugins/NewStory/res/resource.rc18
-rw-r--r--plugins/NewStory/src/main.cpp2
-rw-r--r--plugins/NewStory/src/options.cpp5
-rw-r--r--plugins/NewStory/src/resource.h4
-rw-r--r--plugins/NewStory/src/stdafx.h1
-rw-r--r--plugins/NewStory/src/templates.cpp6
6 files changed, 27 insertions, 9 deletions
diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc
index 470db6d250..b3f4494f6f 100644
--- a/plugins/NewStory/res/resource.rc
+++ b/plugins/NewStory/res/resource.rc
@@ -74,11 +74,18 @@ IDI_USERS ICON "users.ico"
IDI_REPLY ICON "reply.ico"
-IDI_NO_IMAGE PNG "no-image-ico.png"
-
IDI_DELIVERED ICON "delivered.ico"
-IDI_REMOTEREAD ICON "remoteread.ico"
+IDI_REMOTEREAD ICON "remoteread.ico"
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// PNG
+//
+
+IDI_NO_IMAGE PNG "no-image-ico.png"
+
/////////////////////////////////////////////////////////////////////////////
//
@@ -152,7 +159,7 @@ IDD_OPT_ADVANCED DIALOGEX 0, 0, 307, 223
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Log window",IDC_STATIC,0,0,307,119
+ GROUPBOX "Log window",IDC_STATIC,0,0,307,133
CONTROL "Group messages",IDC_GROUPING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,9,289,12
CONTROL "Enable vertical scroll bar",IDC_VSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,22,289,12
CONTROL "Draw window edge",IDC_DRAWEDGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,35,289,12
@@ -161,6 +168,9 @@ BEGIN
CONTROL "Show event type",IDC_SHOW_TYPE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,74,289,12
CONTROL "Show event direction",IDC_SHOW_DIRECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,87,289,12
CONTROL "Show picture preview",IDC_SHOW_PREVIEW,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,100,289,12
+ LTEXT "Maximum preview height (in pixels)",IDC_STATIC,11,117,235,9
+ EDITTEXT IDC_PREVIEW_HEIGHT,254,114,40,14,ES_AUTOHSCROLL
+ CONTROL "",IDC_SPIN1,"msctls_updown32",UDS_SETBUDDYINT | UDS_AUTOBUDDY | UDS_ARROWKEYS,290,114,11,14
END
IDD_OPT_TEMPLATES DIALOGEX 0, 0, 307, 234
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index e497dce495..f271bf1f40 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -36,6 +36,8 @@ CMOption<uint32_t> g_clCustom2(MODULENAME, "CustomColor2", -1);
CMOption<uint32_t> g_clCustom3(MODULENAME, "CustomColor3", -1);
CMOption<uint32_t> g_clCustom4(MODULENAME, "CustomColor4", -1);
+CMOption<int> g_iPreviewHeight(MODULENAME, "PreviewHeight", 300);
+
MWindowList g_hNewstoryWindows = 0, g_hNewstoryLogs = 0;
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp
index a879a54e91..7098909ecd 100644
--- a/plugins/NewStory/src/options.cpp
+++ b/plugins/NewStory/src/options.cpp
@@ -41,12 +41,14 @@ protected:
class CGeneralOptsDlg : public CBaseOptsDlg
{
+ CCtrlSpin spinHeight;
CCtrlCheck chkGrouping, chkVScroll, chkDrawEdge, chkSortOrder, chkHppCompat;
CCtrlCheck chkShowType, chkShowPreview, chkShowDirection;
public:
CGeneralOptsDlg() :
CBaseOptsDlg(IDD_OPT_ADVANCED),
+ spinHeight(this, IDC_SPIN1, 500, 200),
chkVScroll(this, IDC_VSCROLL),
chkShowType(this, IDC_SHOW_TYPE),
chkDrawEdge(this, IDC_DRAWEDGE),
@@ -60,11 +62,12 @@ public:
CreateLink(chkShowType, g_bShowType);
CreateLink(chkGrouping, g_bOptGrouping);
CreateLink(chkDrawEdge, g_bOptDrawEdge);
+ CreateLink(chkSortOrder, g_plugin.bSortAscending);
CreateLink(chkHppCompat, g_bOptHppCompat);
CreateLink(chkShowPreview, g_bShowPreview);
CreateLink(chkShowDirection, g_bShowDirection);
- CreateLink(chkSortOrder, g_plugin.bSortAscending);
+ CreateLink(spinHeight, g_iPreviewHeight);
}
bool OnApply() override
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index be213cd879..a53b45a995 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -102,7 +102,9 @@
#define IDC_TOPLINE 1062
#define IDC_SHOW_PREVIEW 1062
#define IDC_DELSERVERHISTORY 1063
+#define IDC_PREVIEW_HEIGHT 1063
#define IDC_BOTH 1064
+#define IDC_SPIN1 1064
#define IDC_COLOR1 1065
#define IDC_COLOR2 1066
#define IDC_COLOR3 1067
@@ -130,7 +132,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 131
#define _APS_NEXT_COMMAND_VALUE 40019
-#define _APS_NEXT_CONTROL_VALUE 1061
+#define _APS_NEXT_CONTROL_VALUE 1065
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index 324b17befc..a0edec01c5 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -128,6 +128,7 @@ struct CMPlugin : public PLUGIN<CMPlugin>
extern CMOption<bool> g_bOptGrouping, g_bOptDrawEdge, g_bOptHppCompat, g_bShowType, g_bShowDirection, g_bShowPreview;
extern CMOption<uint32_t> g_clCustom0, g_clCustom1, g_clCustom2, g_clCustom3, g_clCustom4;
+extern CMOption<int> g_iPreviewHeight;
extern wchar_t* months[12];
extern int g_iPixelY;
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp
index 36c6cedadb..e915e468ae 100644
--- a/plugins/NewStory/src/templates.cpp
+++ b/plugins/NewStory/src/templates.cpp
@@ -45,7 +45,7 @@ static wchar_t* font2html(LOGFONTA &lf, wchar_t *dest)
return dest;
}
-static void AppendImage(CMStringW &buf, const CMStringW &wszUrl, const CMStringW &wszDescr, ItemData *pItem, UINT uMaxHeight = 300)
+static void AppendImage(CMStringW &buf, const CMStringW &wszUrl, const CMStringW &wszDescr, ItemData *pItem, UINT uMaxHeight)
{
if (g_plugin.bShowPreview) {
pItem->pOwner->webPage.load_image(wszUrl, pItem);
@@ -150,7 +150,7 @@ static void AppendString(CMStringW &buf, const wchar_t *p, ItemData *pItem)
if (auto *p2 = wcsstr(p1, L"[/img]")) {
CMStringW wszDescr(p1, int(p2 - p1));
- AppendImage(buf, wszUrl, wszDescr, pItem, iMaxHeight ? iMaxHeight : 300);
+ AppendImage(buf, wszUrl, wszDescr, pItem, iMaxHeight ? iMaxHeight : g_iPreviewHeight);
p = p2 + 5;
}
}
@@ -161,7 +161,7 @@ static void AppendString(CMStringW &buf, const wchar_t *p, ItemData *pItem)
if (auto *p1 = wcsstr(p, L"[/img]")) {
CMStringW wszUrl(p, int(p1 - p));
- AppendImage(buf, wszUrl, L"", pItem);
+ AppendImage(buf, wszUrl, L"", pItem, g_iPreviewHeight);
p = p1 + 5;
}
else p--;