summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-03-22 21:50:38 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-03-22 21:50:38 +0300
commitde72c19d77098ca5a5870cfeb8bce5068e8a1092 (patch)
tree19e3d79e740c220e749d435b7365310a02e8d03f /plugins/NewStory/src/history_array.cpp
parent444a4a54745a33980b8d5bbe156cffaa3981f2ad (diff)
NewStory: fix for the template preview window in options
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp38
1 files changed, 21 insertions, 17 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index 3aef75df2c..26e7add7c8 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -201,18 +201,20 @@ int ItemData::calcHeight(int top, int width, POINT *pPos)
pos.x = 2;
pos.y = top + 2;
- if (g_plugin.bShowType) // Message type icon
- pos.x += 18;
+ if (!pOwner->bReadOnly) {
+ if (g_plugin.bShowType) // Message type icon
+ pos.x += 18;
- if (g_plugin.bShowDirection) // Message direction icon
- pos.x += 18;
+ if (g_plugin.bShowDirection) // Message direction icon
+ pos.x += 18;
- if (dbe.flags & DBEF_BOOKMARK) // Bookmark icon
- pos.x += 18;
+ if (dbe.flags & DBEF_BOOKMARK) // Bookmark icon
+ pos.x += 18;
- sz.cx -= pos.x;
- if (m_bOfflineDownloaded != 0) // Download completed icon
- sz.cx -= 18;
+ sz.cx -= pos.x;
+ if (m_bOfflineDownloaded != 0) // Download completed icon
+ sz.cx -= 18;
+ }
leftOffset = pos.x;
if (savedHeight == -1) {
@@ -456,14 +458,14 @@ void ItemData::load(bool bLoadAlways)
dbe.unload();
}
-void ItemData::setText()
+void ItemData::setText(const wchar_t *pwszText)
{
int fontid, colorid;
getFontColor(fontid, colorid);
pOwner->webPage.clText = g_fontTable[fontid].cl;
pOwner->webPage.clBack = g_colorTable[colorid].cl;
- m_doc = litehtml::document::createFromString(T2Utf(formatHtml()), &pOwner->webPage);
+ m_doc = litehtml::document::createFromString(T2Utf(formatHtml(pwszText)), &pOwner->webPage);
}
// Array
@@ -683,12 +685,14 @@ ItemData* HistoryArray::insert(int pos)
{
int count = getCount();
ItemData *pNew = &allocateItem();
- ItemData *pPrev = get(count-1, false);
-
- for (int i = count; i >= pos; i--) {
- memcpy(pNew, pPrev, sizeof(ItemData));
- pNew = pPrev;
- pPrev = get(i - 1, false);
+
+ if (count > 0) {
+ ItemData *pPrev = get(count - 1, false);
+ for (int i = count; i >= pos; i--) {
+ memcpy(pNew, pPrev, sizeof(ItemData));
+ pNew = pPrev;
+ pPrev = get(i - 1, false);
+ }
}
ItemData tmp;