summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/res/resource.rc4
-rw-r--r--plugins/NewStory/src/history_control.cpp117
-rw-r--r--plugins/NewStory/src/history_control.h2
-rw-r--r--plugins/NewStory/src/main.cpp6
-rw-r--r--plugins/NewStory/src/options.cpp9
-rw-r--r--plugins/NewStory/src/resource.h2
-rw-r--r--plugins/NewStory/src/stdafx.h7
7 files changed, 84 insertions, 63 deletions
diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc
index 7caf81eff9..2764a4c02f 100644
--- a/plugins/NewStory/res/resource.rc
+++ b/plugins/NewStory/res/resource.rc
@@ -147,12 +147,14 @@ 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,80
+ GROUPBOX "Log window",IDC_STATIC,0,0,307,104
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
CONTROL "Ascending events sort order",IDC_SORT_ASCENDING,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,48,289,12
CONTROL "History++ compatiblity mode",IDC_HPP_COMPAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,8,61,289,12
+ 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
END
IDD_OPT_TEMPLATES DIALOGEX 0, 0, 307, 223
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 10b446d7f1..bc2ce23a28 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -493,25 +493,13 @@ int NewstoryListData::GetItemHeight(int index)
if (!item)
return 0;
- if (item->savedHeight >= 0)
- return item->savedHeight;
-
- int fontid, colorid;
- item->getFontColor(fontid, colorid);
- item->checkCreate(m_hwnd);
-
- HDC hdc = GetDC(m_hwnd);
- HFONT hOldFont = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
-
- RECT rc; GetClientRect(m_hwnd, &rc);
- int width = rc.right - rc.left;
-
- SIZE sz = { width - 6, 0 };
- MTextMeasure(hdc, &sz, item->data);
-
- SelectObject(hdc, hOldFont);
- ReleaseDC(m_hwnd, hdc);
- return item->savedHeight = sz.cy + 5;
+ if (item->savedHeight == -1) {
+ HDC hdc = GetDC(m_hwnd);
+ item->savedHeight = PaintItem(hdc, item, 0, cachedWindowWidth, false);
+ ReleaseDC(m_hwnd, hdc);
+ }
+
+ return item->savedHeight;
}
bool NewstoryListData::HasSelection() const
@@ -558,26 +546,23 @@ void NewstoryListData::OpenFolder()
}
}
-int NewstoryListData::PaintItem(HDC hdc, int index, int top, int width)
+int NewstoryListData::PaintItem(HDC hdc, ItemData *pItem, int top, int width, bool bDraw)
{
- auto *item = LoadItem(index);
- item->savedTop = top;
-
// remove any selections that might be created by the BBCodes parser
- MTextSendMessage(0, item->data, EM_SETSEL, 0, 0);
+ MTextSendMessage(0, pItem->data, EM_SETSEL, 0, 0);
// LOGFONT lfText;
COLORREF clText, clBack, clLine;
int fontid, colorid;
- item->getFontColor(fontid, colorid);
+ pItem->getFontColor(fontid, colorid);
clText = g_fontTable[fontid].cl;
- if (item->m_bHighlighted) {
+ if (pItem->m_bHighlighted) {
clText = g_fontTable[FONT_HIGHLIGHT].cl;
clBack = g_colorTable[COLOR_HIGHLIGHT_BACK].cl;
clLine = g_colorTable[COLOR_FRAME].cl;
}
- else if (item->m_bSelected) {
+ else if (pItem->m_bSelected) {
clText = g_colorTable[COLOR_SELTEXT].cl;
clBack = g_colorTable[COLOR_SELBACK].cl;
clLine = g_colorTable[COLOR_SELFRAME].cl;
@@ -587,28 +572,35 @@ int NewstoryListData::PaintItem(HDC hdc, int index, int top, int width)
clBack = g_colorTable[colorid].cl;
}
- item->checkCreate(m_hwnd);
+ pItem->checkCreate(m_hwnd);
SIZE sz;
sz.cx = width - 2;
POINT pos;
- pos.x = 38;
+ pos.x = 2;
pos.y = top + 2;
- // Bookmark icon
- if (item->dbe.flags & DBEF_BOOKMARK)
+ if (g_plugin.bShowType) // Message type icon
+ pos.x += 18;
+
+ if (g_plugin.bShowDirecction) // Message direction icon
+ pos.x += 18;
+
+ if (pItem->dbe.flags & DBEF_BOOKMARK) // Bookmark icon
pos.x += 18;
sz.cx -= pos.x;
- if (item->m_bOfflineDownloaded)
+ if (pItem->m_bOfflineDownloaded) // Download completed icon
sz.cx -= 18;
HFONT hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
- MTextMeasure(hdc, &sz, item->data);
+ MTextMeasure(hdc, &sz, pItem->data);
SelectObject(hdc, hfnt);
int height = sz.cy + 5;
+ if (!bDraw)
+ return height;
HBRUSH hbr = CreateSolidBrush(clBack);
RECT rc = { 0, top, width, top + height };
@@ -618,40 +610,51 @@ int NewstoryListData::PaintItem(HDC hdc, int index, int top, int width)
SetTextColor(hdc, clText);
SetBkMode(hdc, TRANSPARENT);
+ pos.x = 2;
HICON hIcon;
- switch (item->dbe.eventType) {
- case EVENTTYPE_MESSAGE:
- hIcon = g_plugin.getIcon(IDI_SENDMSG);
- break;
- case EVENTTYPE_FILE:
- hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
- break;
- case EVENTTYPE_STATUSCHANGE:
- hIcon = g_plugin.getIcon(IDI_SIGNIN);
- break;
- default:
- hIcon = g_plugin.getIcon(IDI_UNKNOWN);
- break;
+
+ // Message type icon
+ if (g_plugin.bShowType) {
+ switch (pItem->dbe.eventType) {
+ case EVENTTYPE_MESSAGE:
+ hIcon = g_plugin.getIcon(IDI_SENDMSG);
+ break;
+ case EVENTTYPE_FILE:
+ hIcon = Skin_LoadIcon(SKINICON_EVENT_FILE);
+ break;
+ case EVENTTYPE_STATUSCHANGE:
+ hIcon = g_plugin.getIcon(IDI_SIGNIN);
+ break;
+ default:
+ hIcon = g_plugin.getIcon(IDI_UNKNOWN);
+ break;
+ }
+ DrawIconEx(hdc, pos.x, pos.y, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ pos.x += 18;
}
- DrawIconEx(hdc, 2, pos.y, hIcon, 16, 16, 0, 0, DI_NORMAL);
// Direction icon
- if (item->dbe.flags & DBEF_SENT)
- hIcon = g_plugin.getIcon(IDI_MSGOUT);
- else
- hIcon = g_plugin.getIcon(IDI_MSGIN);
- DrawIconEx(hdc, 20, pos.y, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ if (g_plugin.bShowDirecction) {
+ if (pItem->dbe.flags & DBEF_SENT)
+ hIcon = g_plugin.getIcon(IDI_MSGOUT);
+ else
+ hIcon = g_plugin.getIcon(IDI_MSGIN);
+ DrawIconEx(hdc, pos.x, pos.y, hIcon, 16, 16, 0, 0, DI_NORMAL);
+ pos.x += 18;
+ }
// Bookmark icon
- if (item->dbe.flags & DBEF_BOOKMARK)
- DrawIconEx(hdc, 38, pos.y, g_plugin.getIcon(IDI_BOOKMARK), 16, 16, 0, 0, DI_NORMAL);
+ if (pItem->dbe.flags & DBEF_BOOKMARK) {
+ DrawIconEx(hdc, pos.x, pos.y, g_plugin.getIcon(IDI_BOOKMARK), 16, 16, 0, 0, DI_NORMAL);
+ pos.x += 18;
+ }
// Finished icon
- if (item->m_bOfflineDownloaded)
+ if (pItem->m_bOfflineDownloaded)
DrawIconEx(hdc, width-20, pos.y, g_plugin.getIcon(IDI_OK), 16, 16, 0, 0, DI_NORMAL);
hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
- MTextDisplay(hdc, pos, sz, item->data);
+ MTextDisplay(hdc, pos, sz, pItem->data);
SelectObject(hdc, hfnt);
HPEN hpn = (HPEN)SelectObject(hdc, CreatePen(PS_SOLID, 1, clLine));
@@ -1092,7 +1095,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
int top = data->scrollTopPixel;
idx = data->scrollTopItem;
while ((top < height) && (idx < data->totalCount))
- top += data->PaintItem(hdc, idx++, top, width);
+ top += data->PaintItem(hdc, data->LoadItem(idx++), top, width, true);
data->cachedMaxDrawnItem = idx;
if (top <= height) {
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index d726b32ea7..e9d3631bcc 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -69,7 +69,7 @@ struct NewstoryListData : public MZeroedObject
void OpenFolder();
void PageUp();
void PageDown();
- int PaintItem(HDC hdc, int index, int top, int width);
+ int PaintItem(HDC hdc, ItemData* pItem, int top, int width, bool bDraw);
void Quote();
void RecalcScrollBar();
void Reply();
diff --git a/plugins/NewStory/src/main.cpp b/plugins/NewStory/src/main.cpp
index bb09d38e40..ad31043cf7 100644
--- a/plugins/NewStory/src/main.cpp
+++ b/plugins/NewStory/src/main.cpp
@@ -23,6 +23,8 @@ CMPlugin g_plugin;
CMOption<bool> g_bOptGrouping(MODULENAME, "MessageGrouping", false);
CMOption<bool> g_bOptDrawEdge(MODULENAME, "DrawEdge", true);
CMOption<bool> g_bOptHppCompat(MODULENAME, "HppCompat", false);
+CMOption<bool> g_bShowType(MODULENAME, "ShowType", true);
+CMOption<bool> g_bShowDirection(MODULENAME, "ShowDirection", true);
MWindowList g_hNewstoryWindows = 0, g_hNewstoryLogs = 0;
@@ -148,9 +150,11 @@ int CMPlugin::Load()
{
registerIcon(MODULETITLE, icons);
+ bShowType = g_bShowType;
bDrawEdge = g_bOptDrawEdge;
- bMsgGrouping = g_bOptGrouping;
bHppCompat = g_bOptHppCompat;
+ bMsgGrouping = g_bOptGrouping;
+ bShowDirecction = g_bShowDirection;
m_log = RegisterSrmmLog(this, MODULETITLE, _T(MODULENAME), NewStory_Stub);
diff --git a/plugins/NewStory/src/options.cpp b/plugins/NewStory/src/options.cpp
index c9d1787c4f..fcab30f32c 100644
--- a/plugins/NewStory/src/options.cpp
+++ b/plugins/NewStory/src/options.cpp
@@ -42,29 +42,36 @@ protected:
class CGeneralOptsDlg : public CBaseOptsDlg
{
CCtrlCheck chkGrouping, chkVScroll, chkDrawEdge, chkSortOrder, chkHppCompat;
+ CCtrlCheck chkShowType, chkShowDirection;
public:
CGeneralOptsDlg() :
CBaseOptsDlg(IDD_OPT_ADVANCED),
chkVScroll(this, IDC_VSCROLL),
+ chkShowType(this, IDC_SHOW_TYPE),
chkDrawEdge(this, IDC_DRAWEDGE),
chkGrouping(this, IDC_GROUPING),
chkHppCompat(this, IDC_HPP_COMPAT),
- chkSortOrder(this, IDC_SORT_ASCENDING)
+ chkSortOrder(this, IDC_SORT_ASCENDING),
+ chkShowDirection(this, IDC_SHOW_DIRECTION)
{
CreateLink(chkVScroll, g_plugin.bOptVScroll);
+ CreateLink(chkShowType, g_bShowType);
CreateLink(chkGrouping, g_bOptGrouping);
CreateLink(chkDrawEdge, g_bOptDrawEdge);
CreateLink(chkHppCompat, g_bOptHppCompat);
+ CreateLink(chkShowDirection, g_bShowDirection);
CreateLink(chkSortOrder, g_plugin.bSortAscending);
}
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;
return true;
}
};
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index 6d9166f5ec..4281744430 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -93,6 +93,8 @@
#define IDC_HPP_COMPAT 1059
#define IDC_SORT_ASCENDING2 1059
#define IDC_BOOKMARKSLIST 1060
+#define IDC_SHOW_TYPE 1060
+#define IDC_SHOW_DIRECTION 1061
#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 718f05d90f..29432ef557 100644
--- a/plugins/NewStory/src/stdafx.h
+++ b/plugins/NewStory/src/stdafx.h
@@ -98,7 +98,10 @@ struct CMPlugin : public PLUGIN<CMPlugin>
HBRUSH hBackBrush;
CMOption<bool> bOptVScroll, bSortAscending;
- bool bMsgGrouping, bDrawEdge, bHppCompat, bDisableDelete = false; // thesw options are a copy of static CMOption to keep performance high
+
+ // thesw options are a copy of static CMOption to keep performance high
+ bool bMsgGrouping, bDrawEdge, bHppCompat, bDisableDelete = false;
+ bool bShowType, bShowDirecction;
CMPlugin();
@@ -106,6 +109,6 @@ struct CMPlugin : public PLUGIN<CMPlugin>
int Unload() override;
};
-extern CMOption<bool> g_bOptGrouping, g_bOptDrawEdge, g_bOptHppCompat;
+extern CMOption<bool> g_bOptGrouping, g_bOptDrawEdge, g_bOptHppCompat, g_bShowType, g_bShowDirection;
extern wchar_t* months[12];
extern int g_iPixelY;