summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src
diff options
context:
space:
mode:
authorMataes <mataes2007@gmail.com>2020-04-29 22:26:29 +0300
committerMataes <mataes2007@gmail.com>2020-04-29 22:26:29 +0300
commit541b745c3cbe85c363c02ac8846b0fe425b35f93 (patch)
tree58e7b896d2ed83771e846111c33c24f8fcb3fdab /plugins/NewStory/src
parentd781cfdb76e0e81e0990208514e614d1b785d803 (diff)
newstory: small cleanup
Diffstat (limited to 'plugins/NewStory/src')
-rw-r--r--plugins/NewStory/src/calendartool.cpp12
-rw-r--r--plugins/NewStory/src/history.cpp4
-rw-r--r--plugins/NewStory/src/history_array.h2
-rw-r--r--plugins/NewStory/src/history_control.cpp14
-rw-r--r--plugins/NewStory/src/utils.cpp3
5 files changed, 12 insertions, 23 deletions
diff --git a/plugins/NewStory/src/calendartool.cpp b/plugins/NewStory/src/calendartool.cpp
index 24fe7e059d..ec3a4cabce 100644
--- a/plugins/NewStory/src/calendartool.cpp
+++ b/plugins/NewStory/src/calendartool.cpp
@@ -14,18 +14,6 @@ INT_PTR CALLBACK CalendarToolDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
PostMessage(hwnd, WM_CLOSE, 0, 0);
break;
- case WM_COMMAND:
- switch (LOWORD(wParam)) {
- case IDOK:
- EndDialog(hwnd, 0);
- return TRUE;
-
- case IDCANCEL:
- EndDialog(hwnd, 0);
- return TRUE;
- }
- break;
-
case WM_NOTIFY:
{
LPNMHDR hdr = (LPNMHDR)lParam;
diff --git a/plugins/NewStory/src/history.cpp b/plugins/NewStory/src/history.cpp
index eb29b2e624..bc199defb4 100644
--- a/plugins/NewStory/src/history.cpp
+++ b/plugins/NewStory/src/history.cpp
@@ -99,7 +99,7 @@ void LayoutFilterBar(HDWP hDwp, int x, int y, int w, InfoBarEvents *ib)
hDwp = DeferWindowPos(hDwp, ib->hwndIcoOut, 0,
x + 16, y + (16 + WND_SPACING) * 2, 16, 16, SWP_NOZORDER);
- hDwp = DeferWindowPos(hDwp, ib->hwndTxtOut, 0,
+ DeferWindowPos(hDwp, ib->hwndTxtOut, 0,
x + 32 + WND_SPACING, y + (16 + WND_SPACING) * 2, w - WND_SPACING - 32, 16, SWP_NOZORDER);
}
@@ -810,7 +810,7 @@ public:
case WM_COMMAND:
if (Clist_MenuProcessCommand(LOWORD(wParam), MPCF_CONTACTMENU, m_hContact))
- return true;
+ return TRUE;
break;
/*
diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h
index 50e6fb1c97..8b670fce8f 100644
--- a/plugins/NewStory/src/history_array.h
+++ b/plugins/NewStory/src/history_array.h
@@ -86,7 +86,7 @@ public:
{
if (!-- * refCount) {
delete refCount;
- if (text) delete[] text;
+ delete[] text;
}
}
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index a7b6327a96..312f2296f8 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -275,8 +275,10 @@ static int LayoutItem(HWND hwnd, HistoryArray *items, int index)
int width = rc.right - rc.left;
ItemData *item = items->get(index, ItemData::ELM_DATA);
- if (!item)
+ if (!item) {
+ DeleteDC(hdc);
return 0;
+ }
int tpl;
int fontid;
@@ -480,7 +482,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_SELECTITEMS:
{
- int start = min(data->items.getCount() - 1, max(0, wParam));
+ int start = min(data->items.getCount() - 1, wParam);
int end = min(data->items.getCount() - 1, max(0, lParam));
if (start > end)
std::swap(start, end);
@@ -496,7 +498,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_TOGGLEITEMS:
{
- int start = min(data->items.getCount() - 1, max(0, wParam));
+ int start = min(data->items.getCount() - 1, wParam);
int end = min(data->items.getCount() - 1, max(0, lParam));
if (start > end)
std::swap(start, end);
@@ -512,7 +514,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_SELECTITEMS2:
{
- int start = min(data->items.getCount() - 1, max(0, wParam));
+ int start = min(data->items.getCount() - 1, wParam);
int end = min(data->items.getCount() - 1, max(0, lParam));
if (start > end)
std::swap(start, end);
@@ -532,7 +534,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
case NSM_DESELECTITEMS:
{
- int start = min(data->items.getCount() - 1, max(0, wParam));
+ int start = min(data->items.getCount() - 1, wParam);
int end = min(data->items.getCount() - 1, max(0, lParam));
if (start > end) {
start ^= end;
@@ -573,7 +575,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
}
case NSM_SETCARET:
- if ((wParam >= 0) && (wParam < data->items.getCount())) {
+ if (wParam < data->items.getCount()) {
data->caret = wParam;
if (lParam)
SendMessage(hwnd, NSM_ENSUREVISIBLE, data->caret, 0);
diff --git a/plugins/NewStory/src/utils.cpp b/plugins/NewStory/src/utils.cpp
index a413a75e8c..a112d23514 100644
--- a/plugins/NewStory/src/utils.cpp
+++ b/plugins/NewStory/src/utils.cpp
@@ -22,11 +22,10 @@ void CopyText(HWND hwnd, const wchar_t *text)
{
OpenClipboard(hwnd);
EmptyClipboard();
- HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * (int)(mir_wstrlen(text) + 1));
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, sizeof(wchar_t) * (mir_wstrlen(text) + 1));
wchar_t *s = (wchar_t *)GlobalLock(hMem);
mir_wstrcpy(s, text);
GlobalUnlock(hMem);
SetClipboardData(CF_UNICODETEXT, hMem);
CloseClipboard();
- // GlobalFree(hMem);
}