summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/litehtml/containers/windows/cairo/windows_container.cpp2
-rw-r--r--plugins/NewStory/src/TxDIB.cpp8
-rw-r--r--plugins/NewStory/src/history_control.cpp20
-rw-r--r--plugins/NewStory/src/history_control.h3
-rw-r--r--plugins/NewStory/src/templates.cpp2
-rw-r--r--plugins/NewStory/src/webpage.cpp12
6 files changed, 29 insertions, 18 deletions
diff --git a/libs/litehtml/containers/windows/cairo/windows_container.cpp b/libs/litehtml/containers/windows/cairo/windows_container.cpp
index 0b9929e6e3..94b22034b0 100644
--- a/libs/litehtml/containers/windows/cairo/windows_container.cpp
+++ b/libs/litehtml/containers/windows/cairo/windows_container.cpp
@@ -131,7 +131,7 @@ litehtml::string windows_container::resolve_color(const litehtml::string& color)
{ "ButtonShadow", COLOR_BTNSHADOW },
{ "ButtonText", COLOR_BTNTEXT },
{ "CaptionText", COLOR_CAPTIONTEXT },
- { "GrayText", COLOR_GRAYTEXT },
+ { "GrayText", COLOR_GRAYTEXT },
{ "Highlight", COLOR_HIGHLIGHT },
{ "HighlightText", COLOR_HIGHLIGHTTEXT },
{ "InactiveBorder", COLOR_INACTIVEBORDER },
diff --git a/plugins/NewStory/src/TxDIB.cpp b/plugins/NewStory/src/TxDIB.cpp
index 094fd4a2f2..074bc57403 100644
--- a/plugins/NewStory/src/TxDIB.cpp
+++ b/plugins/NewStory/src/TxDIB.cpp
@@ -326,9 +326,6 @@ void CTxDIB::tile(HDC hdc, LPRECT rcDraw, LPRECT rcClip /*= NULL*/)
bf.AlphaFormat = AC_SRC_ALPHA;
bf.SourceConstantAlpha = 255;
- int x = 0;
- int y = 0;
-
HBITMAP bmp = createBitmap(hdc);
HDC memDC = CreateCompatibleDC(hdc);
HBITMAP oldBmp = (HBITMAP)SelectObject(memDC, bmp);
@@ -415,7 +412,7 @@ BOOL CTxDIB::createFromHBITMAP(HBITMAP bmp)
if (dib) {
int nColors = FreeImage_GetColorsUsed(dib);
HDC dc = GetDC(NULL);
- int res = GetDIBits(dc, bmp, 0, FreeImage_GetHeight(dib), FreeImage_GetBits(dib), FreeImage_GetInfo(dib), DIB_RGB_COLORS);
+ GetDIBits(dc, bmp, 0, FreeImage_GetHeight(dib), FreeImage_GetBits(dib), FreeImage_GetInfo(dib), DIB_RGB_COLORS);
ReleaseDC(NULL, dc);
FreeImage_GetInfoHeader(dib)->biClrUsed = nColors;
FreeImage_GetInfoHeader(dib)->biClrImportant = nColors;
@@ -445,7 +442,6 @@ BOOL CTxDIB::attach(LPVOID pdib)
}
}
if (dib) {
- BITMAPINFO *hdr = FreeImage_GetInfo(dib);
m_width = FreeImage_GetWidth(dib);
m_height = FreeImage_GetHeight(dib);
m_bits = (LPRGBQUAD)malloc(m_width * m_height * sizeof(RGBQUAD));
@@ -759,7 +755,7 @@ bool CTxDIB::QIShrink(int newWidth, int newHeight, CTxDIB *dst /*= NULL */)
srcPtrS = m_bits;
destPtrS = newBits;
int ex = 0, ey = 0; //ex and ey replace division...
- int dy = 0;
+
//(we just add pixels, until by adding newWidth or newHeight we get a number greater than old size... then
// it's time to move to next pixel)
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index b5e323d412..d559085d5f 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -676,32 +676,31 @@ void NewstoryListData::Paint(simpledib::dib &dib, RECT *rcDraw)
POINT pos;
int height = pItem->calcHeight(top, cachedWindowWidth, &pos);
- COLORREF clText, clBack, clLine;
+ COLORREF clLine;
int fontid, colorid;
pItem->getFontColor(fontid, colorid);
if (pItem->m_bHighlighted) {
- clText = g_fontTable[FONT_HIGHLIGHT].cl;
- clBack = g_colorTable[COLOR_HIGHLIGHT_BACK].cl;
+ webPage.clText = g_fontTable[FONT_HIGHLIGHT].cl;
+ webPage.clBack = g_colorTable[COLOR_HIGHLIGHT_BACK].cl;
clLine = g_colorTable[COLOR_FRAME].cl;
}
else if (pItem->m_bSelected) {
- clText = g_colorTable[COLOR_SELTEXT].cl;
- clBack = g_colorTable[COLOR_SELBACK].cl;
+ webPage.clText = g_colorTable[COLOR_SELTEXT].cl;
+ webPage.clBack = g_colorTable[COLOR_SELBACK].cl;
clLine = g_colorTable[COLOR_SELFRAME].cl;
}
else {
- clText = g_fontTable[fontid].cl;
+ webPage.clText = g_fontTable[fontid].cl;
+ webPage.clBack = g_colorTable[colorid].cl;
clLine = g_colorTable[COLOR_FRAME].cl;
- clBack = g_colorTable[colorid].cl;
}
- HBRUSH hbr = CreateSolidBrush(clBack);
+ HBRUSH hbr = CreateSolidBrush(webPage.clBack);
RECT rc = { 0, top, cachedWindowWidth, top + height };
FillRect(dib, &rc, hbr);
DeleteObject(hbr);
- SetTextColor(dib, clText);
SetBkMode(dib, TRANSPARENT);
pos.x = 2;
@@ -786,6 +785,9 @@ void NewstoryListData::Paint(simpledib::dib &dib, RECT *rcDraw)
RECT rc = { 0, 0, cachedWindowWidth, cachedWindowHeight };
DrawEdge(dib, &rc, BDR_SUNKENOUTER, BF_RECT);
}
+
+ cairo_destroy(cr);
+ cairo_surface_destroy(surface);
}
void NewstoryListData::RecalcScrollBar()
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index 3667a22d4e..41ee67ed1c 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -11,6 +11,7 @@ class NSWebPage : public windows_container
cairo_images_cache m_images;
cairo_surface_t *get_image(const std::string &url) override;
+ litehtml::string resolve_color(const litehtml::string &color) const;
void get_client_rect(litehtml::position &client) const override;
void import_css(litehtml::string &text, const litehtml::string &url, litehtml::string &baseurl) override;
@@ -28,7 +29,7 @@ public:
ctrl(_1)
{}
- litehtml::uint_ptr getRC() const { return (litehtml::uint_ptr)m_temp_cr; }
+ COLORREF clText = -1, clBack = -1;
};
struct NewstoryListData : public MZeroedObject
diff --git a/plugins/NewStory/src/templates.cpp b/plugins/NewStory/src/templates.cpp
index 9d73c35d1b..adf7870a50 100644
--- a/plugins/NewStory/src/templates.cpp
+++ b/plugins/NewStory/src/templates.cpp
@@ -135,7 +135,7 @@ CMStringA ItemData::formatHtml(const wchar_t *pwszStr)
auto &F = g_fontTable[fontID];
char szFont[100];
- str.AppendFormat("body {margin: 0px; text-align: left; %s; overflow: auto;}\n", font2html(F.lf, szFont));
+ str.AppendFormat("body {margin: 0px; text-align: left; %s; color: NSText; overflow: auto;}\n", font2html(F.lf, szFont));
str.AppendFormat(".nick {color: #%06X }\n", color2html(g_colorTable[(dbe.flags & DBEF_SENT) ? COLOR_OUTNICK : COLOR_INNICK].cl));
str.Append("</style></head><body class=\"body\">\n");
diff --git a/plugins/NewStory/src/webpage.cpp b/plugins/NewStory/src/webpage.cpp
index 1c74ea683c..f4b9be0c99 100644
--- a/plugins/NewStory/src/webpage.cpp
+++ b/plugins/NewStory/src/webpage.cpp
@@ -39,6 +39,18 @@ cairo_surface_t *dib_to_surface(CTxDIB &img)
return surface;
}
+litehtml::string NSWebPage::resolve_color(const litehtml::string &color) const
+{
+ char buf[20];
+
+ if (color == "NSText") {
+ mir_snprintf(buf, "#%02X%02X%02X", GetRValue(clText), GetGValue(clText), GetBValue(clText));
+ return buf;
+ }
+
+ return windows_container::resolve_color(color);
+}
+
void NSWebPage::on_image_loaded(const wchar_t *file, const wchar_t *url, bool redraw_only)
{
if (!mir_wstrncmp(file, L"file://", 7))