summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-02-19 18:50:14 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-02-19 18:50:14 +0300
commitf50885f33f7d1e129d719f06a43cc73518e0ffb1 (patch)
treec9eb6db791011b7ffb45a70f95d1f28d0d3395ad /plugins
parent58f9f9dea0865f900fa0c1e6e2ef8ffc18ecef74 (diff)
NewStory: custom colors
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/res/resource.rc54
-rw-r--r--plugins/NewStory/src/main.cpp23
-rw-r--r--plugins/NewStory/src/options.cpp22
-rw-r--r--plugins/NewStory/src/resource.h5
-rw-r--r--plugins/NewStory/src/stdafx.h6
-rw-r--r--plugins/NewStory/src/templates.cpp9
-rw-r--r--plugins/NewStory/src/utils.cpp4
7 files changed, 85 insertions, 38 deletions
diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc
index 69b81bcd7f..570d5217c4 100644
--- a/plugins/NewStory/res/resource.rc
+++ b/plugins/NewStory/res/resource.rc
@@ -157,21 +157,31 @@ BEGIN
CONTROL "Show event direction",IDC_SHOW_DIRECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,87,289,12
END
-IDD_OPT_TEMPLATES DIALOGEX 0, 0, 307, 223
-STYLE DS_SETFONT | WS_CHILD
+IDD_OPT_TEMPLATES DIALOGEX 0, 0, 307, 234
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
LTEXT "Template list:",IDC_STATIC,7,7,140,8
- CONTROL "Tree1",IDC_TEMPLATES,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER | WS_TABSTOP,12,20,135,117
+ CONTROL "Tree1",IDC_TEMPLATES,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_FULLROWSELECT | WS_BORDER | WS_HSCROLL | WS_TABSTOP,12,20,135,117
LTEXT "Edit template:",IDC_STATIC,7,142,293,8
EDITTEXT IDC_EDITTEMPLATE,12,155,288,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
LTEXT "Text preview:",IDC_STATIC,157,7,143,8
EDITTEXT IDC_PREVIEW,162,20,138,42,ES_MULTILINE | ES_AUTOVSCROLL | ES_READONLY
LTEXT "Graphic preview:",IDC_STATIC,157,67,143,8
CONTROL "",IDC_GPREVIEW,"MTextControl",WS_TABSTOP,162,80,138,57
- CONTROL "",IDC_RESET,"MButtonClass",WS_TABSTOP,248,202,16,16
- CONTROL "",IDC_DISCARD,"MButtonClass",WS_TABSTOP,266,202,16,16
- CONTROL "",IDC_VARHELP,"MButtonClass",WS_DISABLED | WS_TABSTOP,284,202,16,16
+ CONTROL "",IDC_COLOR1,"ColourPicker",WS_TABSTOP,15,200,24,13
+ CONTROL "",IDC_COLOR2,"ColourPicker",WS_TABSTOP,47,200,24,13
+ CONTROL "",IDC_COLOR3,"ColourPicker",WS_TABSTOP,79,200,24,13
+ CONTROL "",IDC_COLOR4,"ColourPicker",WS_TABSTOP,111,200,24,13
+ CONTROL "",IDC_COLOR5,"ColourPicker",WS_TABSTOP,143,200,24,13
+ CONTROL "",IDC_RESET,"MButtonClass",WS_TABSTOP,248,201,16,16
+ CONTROL "",IDC_DISCARD,"MButtonClass",WS_TABSTOP,266,201,16,16
+ CONTROL "",IDC_VARHELP,"MButtonClass",WS_DISABLED | WS_TABSTOP,284,201,16,16
+ CTEXT "[c2]",IDC_STATIC,17,216,18,8
+ CTEXT "[c4]",IDC_STATIC,81,216,18,8
+ CTEXT "[c6]",IDC_STATIC,145,216,18,8
+ CTEXT "[c3]",IDC_STATIC,49,216,18,8
+ CTEXT "[c5]",IDC_STATIC,114,216,18,8
END
IDD_EMPTYHISTORY DIALOGEX 0, 0, 294, 86
@@ -180,13 +190,15 @@ EXSTYLE WS_EX_CONTROLPARENT
CAPTION "Empty history"
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- CONTROL "Are you sure to remove selected event(s)?",IDC_TOPLINE,"Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8
- CONTROL "Remove server history", IDC_DELSERVERHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,280,8
+ CONTROL "Are you sure to remove selected event(s)?",IDC_TOPLINE,
+ "Static",SS_SIMPLE | SS_NOPREFIX | WS_GROUP,7,7,270,8
+ CONTROL "Remove server history",IDC_DELSERVERHISTORY,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,37,280,8
CONTROL "Remove history for everyone",IDC_BOTH,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,50,260,8
PUSHBUTTON "&Yes",IDOK,149,65,65,14
DEFPUSHBUTTON "&No",IDCANCEL,221,65,65,14
END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -211,27 +223,8 @@ BEGIN
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 300
- VERTGUIDE, 12
- VERTGUIDE, 147
- VERTGUIDE, 152
- VERTGUIDE, 157
- VERTGUIDE, 162
- VERTGUIDE, 268
- VERTGUIDE, 284
TOPMARGIN, 7
- BOTTOMMARGIN, 216
- HORZGUIDE, 15
- HORZGUIDE, 20
- HORZGUIDE, 62
- HORZGUIDE, 67
- HORZGUIDE, 75
- HORZGUIDE, 80
- HORZGUIDE, 137
- HORZGUIDE, 142
- HORZGUIDE, 150
- HORZGUIDE, 155
- HORZGUIDE, 197
- HORZGUIDE, 202
+ BOTTOMMARGIN, 227
END
END
#endif // APSTUDIO_INVOKED
@@ -311,6 +304,11 @@ BEGIN
0
END
+IDD_OPT_TEMPLATES AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // Neutral resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index d8c3ec7624..0cd647fd3e 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -26,6 +26,12 @@ CMOption<bool> g_bOptHppCompat(MODULENAME, "HppCompat", false);
CMOption<bool> g_bShowType(MODULENAME, "ShowType", true);
CMOption<bool> g_bShowDirection(MODULENAME, "ShowDirection", true);
+CMOption<uint32_t> g_clCustom0(MODULENAME, "CustomColor0", -1);
+CMOption<uint32_t> g_clCustom1(MODULENAME, "CustomColor1", -1);
+CMOption<uint32_t> g_clCustom2(MODULENAME, "CustomColor2", -1);
+CMOption<uint32_t> g_clCustom3(MODULENAME, "CustomColor3", -1);
+CMOption<uint32_t> g_clCustom4(MODULENAME, "CustomColor4", -1);
+
MWindowList g_hNewstoryWindows = 0, g_hNewstoryLogs = 0;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -146,16 +152,27 @@ static int evtPreShutdown(WPARAM, LPARAM)
return 0;
}
-int CMPlugin::Load()
+void CMPlugin::LoadOptions()
{
- registerIcon(MODULETITLE, icons);
-
bShowType = g_bShowType;
bDrawEdge = g_bOptDrawEdge;
bHppCompat = g_bOptHppCompat;
bMsgGrouping = g_bOptGrouping;
bShowDirecction = g_bShowDirection;
+ clCustom[0] = g_clCustom0;
+ clCustom[1] = g_clCustom1;
+ clCustom[2] = g_clCustom2;
+ clCustom[3] = g_clCustom3;
+ clCustom[4] = g_clCustom4;
+}
+
+int CMPlugin::Load()
+{
+ registerIcon(MODULETITLE, icons);
+
+ LoadOptions();
+
m_log = RegisterSrmmLog(this, MODULETITLE, _T(MODULENAME), NewStory_Stub);
g_hNewstoryLogs = WindowList_Create();
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp
index 13b2480976..1fa938c0c7 100644
--- a/plugins/NewStory/src/options.cpp
+++ b/plugins/NewStory/src/options.cpp
@@ -67,11 +67,7 @@ public:
bool OnApply() override
{
- g_plugin.bShowType = g_bShowType;
- g_plugin.bDrawEdge = g_bOptDrawEdge;
- g_plugin.bMsgGrouping = g_bOptGrouping;
- g_plugin.bHppCompat = g_bOptHppCompat;
- g_plugin.bShowDirecction = g_bShowDirection;
+ g_plugin.LoadOptions();
return true;
}
};
@@ -86,6 +82,7 @@ class CTemplateOptsDlg : public CBaseOptsDlg
CCtrlBase preview, gpreview;
CCtrlEdit m_edit;
+ CCtrlColor clr0, clr1, clr2, clr3, clr4;
CCtrlMButton btnDiscard, bthVarHelp, btnReset;
CCtrlTreeView m_tree;
@@ -102,6 +99,11 @@ class CTemplateOptsDlg : public CBaseOptsDlg
public:
CTemplateOptsDlg() :
CBaseOptsDlg(IDD_OPT_TEMPLATES),
+ clr0(this, IDC_COLOR1),
+ clr1(this, IDC_COLOR2),
+ clr2(this, IDC_COLOR3),
+ clr3(this, IDC_COLOR4),
+ clr4(this, IDC_COLOR5),
m_edit(this, IDC_EDITTEMPLATE),
m_tree(this, IDC_TEMPLATES),
preview(this, IDC_PREVIEW),
@@ -110,6 +112,12 @@ public:
btnDiscard(this, IDC_DISCARD, g_plugin.getIcon(IDI_RESET), LPGEN("Cancel edit")),
bthVarHelp(this, IDC_VARHELP, g_plugin.getIcon(IDI_VARHELP), LPGEN("Variables help"))
{
+ CreateLink(clr0, g_clCustom0);
+ CreateLink(clr1, g_clCustom1);
+ CreateLink(clr2, g_clCustom2);
+ CreateLink(clr3, g_clCustom3);
+ CreateLink(clr4, g_clCustom4);
+
btnReset.OnClick = Callback(this, &CTemplateOptsDlg::onClick_Reset);
btnDiscard.OnClick = Callback(this, &CTemplateOptsDlg::onClick_Discard);
bthVarHelp.OnClick = Callback(this, &CTemplateOptsDlg::onClick_Help);
@@ -187,6 +195,7 @@ public:
}
}
+ g_plugin.LoadOptions();
onChange_Edit();
SaveTemplates();
return true;
@@ -251,6 +260,9 @@ public:
void onChange_Edit(CCtrlEdit* = 0)
{
+ if (m_curr == nullptr)
+ return;
+
replaceStrW(m_curr->tmpValue, m_edit.GetText());
m_tempItem.fill(int(m_curr - templates)); // copy data from template to event
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index 8862d46dd3..f166ba6d58 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -99,6 +99,11 @@
#define IDC_TOPLINE 1062
#define IDC_DELSERVERHISTORY 1063
#define IDC_BOTH 1064
+#define IDC_COLOR1 1065
+#define IDC_COLOR2 1066
+#define IDC_COLOR3 1067
+#define IDC_COLOR4 1068
+#define IDC_COLOR5 1069
#define ID_FILTER_SHOWALLEVENTS 40001
#define ID_FILTER_SHOWINCOMINGEVENTSONLY 40002
#define ID_FILTER_SHOWOUTGOINGEVENTSONLY 40003
diff --git a/plugins/NewStory/src/stdafx.h b/plugins/NewStory/src/stdafx.h
index f6cb9c2c89..5cafb41211 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -103,13 +103,19 @@ struct CMPlugin : public PLUGIN<CMPlugin>
// thesw options are a copy of static CMOption to keep performance high
bool bMsgGrouping, bDrawEdge, bHppCompat, bDisableDelete = false;
bool bShowType, bShowDirecction;
+
+ COLORREF clCustom[5];
CMPlugin();
+ void LoadOptions();
+
int Load() override;
int Unload() override;
};
extern CMOption<bool> g_bOptGrouping, g_bOptDrawEdge, g_bOptHppCompat, g_bShowType, g_bShowDirection;
+extern CMOption<uint32_t> g_clCustom0, g_clCustom1, g_clCustom2, g_clCustom3, g_clCustom4;
+
extern wchar_t* months[12];
extern int g_iPixelY;
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp
index b4e7438b4e..16341329ea 100644
--- a/plugins/NewStory/src/templates.cpp
+++ b/plugins/NewStory/src/templates.cpp
@@ -106,9 +106,14 @@ CMStringA ItemData::formatRtf(const wchar_t *pwszStr)
COLORREF cr = F.cl;
buf.AppendFormat("{\\colortbl \\red%u\\green%u\\blue%u;", GetRValue(cr), GetGValue(cr), GetBValue(cr));
cr = g_colorTable[(dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK].cl;
- buf.AppendFormat("\\red%u\\green%u\\blue%u;}", GetRValue(cr), GetGValue(cr), GetBValue(cr));
+ buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(cr), GetGValue(cr), GetBValue(cr));
- buf.AppendFormat("\\uc1\\pard \\cf0\\f0\\b0\\i0\\fs%d ", GetFontHeight(F.lf));
+ for (auto cl : g_plugin.clCustom) {
+ cr = (cl == -1) ? 0 : cl;
+ buf.AppendFormat("\\red%u\\green%u\\blue%u;", GetRValue(cr), GetGValue(cr), GetBValue(cr));
+ }
+
+ buf.AppendFormat("}\\uc1\\pard \\cf0\\f0\\b0\\i0\\fs%d ", GetFontHeight(F.lf));
AppendUnicodeToBuffer(buf, (pwszStr) ? pwszStr : formatString());
buf.Append("}");
diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp
index 288798819f..fc42f07f43 100644
--- a/plugins/NewStory/src/utils.cpp
+++ b/plugins/NewStory/src/utils.cpp
@@ -64,6 +64,10 @@ static bbcodes[] =
{ L"[c0]", nullptr },
{ L"[c1]", nullptr },
{ L"[c2]", nullptr },
+ { L"[c3]", nullptr },
+ { L"[c4]", nullptr },
+ { L"[c5]", nullptr },
+ { L"[c6]", nullptr },
{ L"[$hicon=", L"$]" },