summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-04-29 17:35:25 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-04-29 17:35:25 +0300
commit314930f98aac1dd2c482ff3b79d4810142dc25f9 (patch)
tree8d996edfd338ef0d992a573202967e7dc5f4ffb4 /plugins
parentaf9a1aaa8fc8582bd0d2635d3750894ade49b73a (diff)
NewStory: unused constants removed + code cleaning
Diffstat (limited to 'plugins')
-rw-r--r--plugins/NewStory/src/fonts.cpp18
-rw-r--r--plugins/NewStory/src/fonts.h18
-rw-r--r--plugins/NewStory/src/history.cpp2
-rw-r--r--plugins/NewStory/src/history_control.cpp16
4 files changed, 27 insertions, 27 deletions
diff --git a/plugins/NewStory/src/fonts.cpp b/plugins/NewStory/src/fonts.cpp
index 4c668411f5..f42881dfc9 100644
--- a/plugins/NewStory/src/fonts.cpp
+++ b/plugins/NewStory/src/fonts.cpp
@@ -1,6 +1,6 @@
#include "stdafx.h"
-MyColourID colors[] =
+MyColourID g_colorTable[COLOR_COUNT] =
{
{ "Incoming Messages", "ColorMsgIn", RGB(0xd6, 0xf5, 0xc0) },
{ "Outgoing Messages", "ColorMsgOut", RGB(0xf5, 0xe7, 0xd8) },
@@ -17,7 +17,7 @@ MyColourID colors[] =
{ "Selected Items (Text)", "ColorSelTxt", RGB(0xff, 0xff, 0xff) }
};
-MyFontID fonts[] =
+MyFontID g_fontTable[FONT_COUNT] =
{
{ "Incoming Messages", "FontMsgIn" },
{ "Outgoing Messages", "FontMsgOut" },
@@ -33,10 +33,10 @@ MyFontID fonts[] =
int evtFontsChanged(WPARAM, LPARAM)
{
- for (auto &it : colors)
+ for (auto &it : g_colorTable)
it.cl = Colour_Get(MODULENAME, it.szName);
- for (auto &it : fonts) {
+ for (auto &it : g_fontTable) {
it.cl = (COLORREF)Font_Get(MODULENAME, it.szName, &it.lf);
DeleteObject(it.hfnt);
@@ -58,8 +58,8 @@ void InitFonts()
strncpy_s(cid.group, MODULENAME, _TRUNCATE);
strncpy_s(cid.dbSettingsGroup, MODULENAME, _TRUNCATE);
- for (auto &it : colors) {
- cid.order = int(&it - colors);
+ for (auto &it : g_colorTable) {
+ cid.order = int(&it - g_colorTable);
strncpy_s(cid.name, it.szName, _TRUNCATE);
strncpy_s(cid.setting, it.szSetting, _TRUNCATE);
cid.defcolour = it.defaultValue;
@@ -71,8 +71,8 @@ void InitFonts()
strncpy_s(fontid.group, MODULENAME, _TRUNCATE);
strncpy_s(fontid.dbSettingsGroup, MODULENAME, _TRUNCATE);
- for (auto &it : fonts) {
- fontid.order = int(&it - fonts);
+ for (auto &it : g_fontTable) {
+ fontid.order = int(&it - g_fontTable);
strncpy_s(fontid.name, it.szName, _TRUNCATE);
strncpy_s(fontid.setting, it.szSetting, _TRUNCATE);
g_plugin.addFont(&fontid);
@@ -84,6 +84,6 @@ void InitFonts()
void DestroyFonts()
{
- for (auto &it : fonts)
+ for (auto &it : g_fontTable)
DeleteObject(it.hfnt);
}
diff --git a/plugins/NewStory/src/fonts.h b/plugins/NewStory/src/fonts.h
index 6003c01bfb..0216f155b9 100644
--- a/plugins/NewStory/src/fonts.h
+++ b/plugins/NewStory/src/fonts.h
@@ -1,14 +1,14 @@
#ifndef __fonts_h__
#define __fonts_h__
+/////////////////////////////////////////////////////////////////////////////////////////
+
enum
{
COLOR_INMSG,
COLOR_OUTMSG,
COLOR_INFILE,
COLOR_OUTFILE,
- COLOR_INURL,
- COLOR_OUTURL,
COLOR_STATUS,
COLOR_INOTHER,
COLOR_OUTOTHER,
@@ -19,13 +19,13 @@ enum
struct MyColourID
{
- const char* szName, * szSetting;
+ const char *szName, *szSetting;
COLORREF defaultValue, cl;
};
+extern MyColourID g_colorTable[COLOR_COUNT];
-
-extern MyColourID colors[];
+/////////////////////////////////////////////////////////////////////////////////////////
enum
{
@@ -33,8 +33,6 @@ enum
FONT_OUTMSG,
FONT_INFILE,
FONT_OUTFILE,
- FONT_INURL,
- FONT_OUTURL,
FONT_STATUS,
FONT_INOTHER,
FONT_OUTOTHER,
@@ -43,14 +41,16 @@ enum
struct MyFontID
{
- const char* szName, * szSetting;
+ const char *szName, *szSetting;
COLORREF cl;
LOGFONTA lf;
HFONT hfnt;
};
-extern MyFontID fonts[];
+extern MyFontID g_fontTable[FONT_COUNT];
+
+/////////////////////////////////////////////////////////////////////////////////////////
void InitFonts();
void DestroyFonts();
diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index 391e70fa02..c01e150e54 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -551,7 +551,7 @@ public:
SubContactsList.AppendFormat(L"\r\n%s", subid);
FirstTime = false;
}
- MessageText.AppendFormat(TranslateT("It is MetaContact. For export use one of this subcontacts:\r\n%s"), SubContactsList);
+ MessageText.AppendFormat(TranslateT("It is MetaContact. For export use one of this subcontacts:\r\n%s"), SubContactsList.c_str());
MessageBox(m_hwnd, MessageText, TranslateT("Export warning"), MB_OK | MB_ICONWARNING);
return;
}
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index ba1564b2a4..5a7e2c8128 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -247,7 +247,7 @@ static void BeginEditItem(HWND hwnd, NewstoryListData *data, int index)
ptrW text(TplFormatString(tpl, item->hContact, item));
data->hwndEditBox = CreateWindow(L"EDIT", text, WS_CHILD | WS_BORDER | ES_READONLY | ES_MULTILINE | ES_AUTOVSCROLL, 0, top, rc.right - rc.left, itemHeight, hwnd, NULL, g_plugin.getInst(), NULL);
OldEditWndProc = (WNDPROC)SetWindowLongPtr(data->hwndEditBox, GWLP_WNDPROC, (LONG_PTR)HistoryEditWndProc);
- SendMessage(data->hwndEditBox, WM_SETFONT, (WPARAM)fonts[fontid].hfnt, 0);
+ SendMessage(data->hwndEditBox, WM_SETFONT, (WPARAM)g_fontTable[fontid].hfnt, 0);
SendMessage(data->hwndEditBox, EM_SETMARGINS, EC_RIGHTMARGIN, 100);
SendMessage(data->hwndEditBox, EM_SETSEL, 0, (LPARAM)(-1));
ShowWindow(data->hwndEditBox, SW_SHOW);
@@ -315,7 +315,7 @@ static int LayoutItem(HWND hwnd, HistoryArray *items, int index)
break;
}
- HFONT hfnt = (HFONT)SelectObject(hdc, fonts[fontid].hfnt);
+ HFONT hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
if (!item->data)
item->data = MTextCreateW(htuLog, ptrW(TplFormatString(tpl, item->hContact, item)));
@@ -382,17 +382,17 @@ static int PaintItem(HDC hdc, HistoryArray *items, int index, int top, int width
colorid = !(item->dbe.flags & DBEF_SENT) ? COLOR_INOTHER : COLOR_OUTOTHER;
break;
}
- clText = fonts[fontid].cl;
+ clText = g_fontTable[fontid].cl;
if (item->flags & HIF_SELECTED) {
MTextSendMessage(0, item->data, EM_SETSEL, 0, -1);
- clText = colors[COLOR_SELTEXT].cl;
+ clText = g_colorTable[COLOR_SELTEXT].cl;
clLine = GetSysColor(COLOR_HIGHLIGHTTEXT);
clBack = GetSysColor(COLOR_HIGHLIGHT);
}
else {
MTextSendMessage(0, item->data, EM_SETSEL, 0, 0);
- clLine = colors[COLOR_SELECTED].cl;
- clBack = colors[colorid].cl;
+ clLine = g_colorTable[COLOR_SELECTED].cl;
+ clBack = g_colorTable[colorid].cl;
}
if (!item->data) {
@@ -405,7 +405,7 @@ static int PaintItem(HDC hdc, HistoryArray *items, int index, int top, int width
SIZE sz;
sz.cx = width - 6;
- HFONT hfnt = (HFONT)SelectObject(hdc, fonts[fontid].hfnt);
+ HFONT hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
MTextMeasure(hdc, &sz, (HANDLE)item->data);
SelectObject(hdc, hfnt);
int height = sz.cy + 5;
@@ -423,7 +423,7 @@ static int PaintItem(HDC hdc, HistoryArray *items, int index, int top, int width
POINT pos;
pos.x = 3;
pos.y = top + 2;
- hfnt = (HFONT)SelectObject(hdc, fonts[fontid].hfnt);
+ hfnt = (HFONT)SelectObject(hdc, g_fontTable[fontid].hfnt);
MTextDisplay(hdc, pos, sz, (HANDLE)item->data);
SelectObject(hdc, hfnt);