summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/NewStory/res/resource.rc2
-rw-r--r--plugins/NewStory/src/history.h4
-rw-r--r--plugins/NewStory/src/history_dlg.cpp113
-rw-r--r--plugins/NewStory/src/history_menus.cpp1
-rw-r--r--plugins/NewStory/src/resource.h4
-rw-r--r--protocols/Telegram/src/proto.cpp2
6 files changed, 107 insertions, 19 deletions
diff --git a/plugins/NewStory/res/resource.rc b/plugins/NewStory/res/resource.rc
index 9e0f885c67..759e388f1d 100644
--- a/plugins/NewStory/res/resource.rc
+++ b/plugins/NewStory/res/resource.rc
@@ -88,6 +88,7 @@ BEGIN
CONTROL "",IDC_EXPORT,"MButtonClass",0x0,90,99,16,14
CONTROL "",IDC_DELETE,"MButtonClass",0x0,104,99,16,14
CONTROL "",IDC_TIMETREE,"MButtonClass",0x0,118,99,16,14
+ CONTROL "",IDC_BOOKMARKS,"MButtonClass",0x0,132,99,16,14
CONTROL "",IDC_FILTER,"MButtonClass",0x0,132,99,16,14
CONTROL "",IDC_FINDPREV,"MButtonClass",0x0,364,305,16,14
CONTROL "",IDOK,"MButtonClass",0x0,337,305,16,14
@@ -95,6 +96,7 @@ BEGIN
ICON "",IDC_SEARCHICON,1,298,20,20,SS_CENTERIMAGE
CONTROL "",IDC_LOGOPTIONS,"MButtonClass",0x0,116,99,16,14
CONTROL "",IDC_TIMETREEVIEW,"SysTreeView32",TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_TRACKSELECT | TVS_FULLROWSELECT | TVS_SINGLEEXPAND | NOT WS_VISIBLE | WS_TABSTOP,0,134,84,160,WS_EX_STATICEDGE
+ CONTROL "",IDC_BOOKMARKSLIST,"SysListView32",LVS_REPORT | LVS_NOCOLUMNHEADER | NOT WS_VISIBLE | WS_TABSTOP,0,134,84,160,WS_EX_STATICEDGE
CONTROL "",IDC_SPLITTERY,"Static",SS_ENHMETAFILE,0,132,251,6
CONTROL "",IDC_DATEPOPUP,"MButtonClass",0x0,148,99,16,14
CONTROL "",IDC_HISTORYCONTROL,"NewstoryList",WS_TABSTOP,90,132,290,166
diff --git a/plugins/NewStory/src/history.h b/plugins/NewStory/src/history.h
index d93cd6dd3c..f71bab9fed 100644
--- a/plugins/NewStory/src/history.h
+++ b/plugins/NewStory/src/history.h
@@ -25,7 +25,9 @@ enum
UM_GETEVENT,
UM_GETEVENTTEXT,
UM_GETEVENTCONTACT,
- UM_GETEVENTHANDLE
+ UM_GETEVENTHANDLE,
+
+ UM_BOOKMARKS = WM_USER + 0x601,
};
extern MWindowList g_hNewstoryWindows, g_hNewstoryLogs;
diff --git a/plugins/NewStory/src/history_dlg.cpp b/plugins/NewStory/src/history_dlg.cpp
index 2271835929..f6e4026a79 100644
--- a/plugins/NewStory/src/history_dlg.cpp
+++ b/plugins/NewStory/src/history_dlg.cpp
@@ -37,9 +37,10 @@ enum
enum
{
- WND_OPT_TIMETREE = 0x01,
+ WND_OPT_TIMETREE = 0x01,
WND_OPT_SEARCHBAR = 0x02,
- WND_OPT_FILTERBAR = 0x04
+ WND_OPT_FILTERBAR = 0x04,
+ WND_OPT_BOOKMARKS = 0x08,
};
enum
@@ -117,16 +118,20 @@ class CHistoryDlg : public CDlgBase
std::vector<Button> m_toolbar;
// main controls
- HWND m_hwndTimeTree;
int m_iSplitter;
CCtrlBase m_histWindow;
NewstoryListData *m_histCtrl;
+ // bookmarks
+ HIMAGELIST hBookmarksIcons = 0;
+
// searchbar
HWND m_hwndBtnCloseSearch;
+
// statusbar
HWND m_hwndStatus;
+
// filter bar
HWND m_hwndChkDateFrom, m_hwndChkDateTo;
HWND m_hwndDateFrom, m_hwndDateTo;
@@ -157,7 +162,7 @@ class CHistoryDlg : public CDlgBase
m_histCtrl->AddResults(m_arResults);
m_arResults.destroy();
- TimeTreeBuild();
+ BuildTimeTree();
}
void DoSearchContact(MCONTACT hContact, const wchar_t *pwszPattern)
@@ -260,9 +265,11 @@ class CHistoryDlg : public CDlgBase
if (cmd)
SetFocus(edtSearchText.GetHwnd());
- cmd = (m_dwOptions & WND_OPT_TIMETREE) ? SW_SHOW : SW_HIDE;
- m_timeTree.Show(cmd);
- splitTime.Show(cmd);
+ bool bShowTime = (m_dwOptions & WND_OPT_TIMETREE) != 0;
+ bool bShowBookmarks = (m_dwOptions & WND_OPT_BOOKMARKS) != 0;
+ m_timeTree.Show(bShowTime);
+ m_bookmarks.Show(bShowBookmarks);
+ splitTime.Show(bShowTime || bShowBookmarks);
}
void UpdateTitle()
@@ -281,7 +288,28 @@ class CHistoryDlg : public CDlgBase
}
}
- void TimeTreeBuild()
+ void BuildBookmarksList()
+ {
+ if (!(m_dwOptions & WND_OPT_BOOKMARKS))
+ return;
+
+ m_bookmarks.DeleteAllItems();
+ if (hBookmarksIcons)
+ ImageList_Destroy(hBookmarksIcons);
+
+ hBookmarksIcons = ImageList_Create(16, 16, ILC_MASK | ILC_COLOR32, 1, 0);
+ ImageList_ReplaceIcon(hBookmarksIcons, -1, g_plugin.getIcon(IDI_BOOKMARK));
+ m_bookmarks.SetImageList(hBookmarksIcons, LVSIL_SMALL);
+
+ auto &pArray = m_histCtrl->items;
+ int numItems = pArray.getCount();
+ for (int i = numItems - 1; i >= 0; i--)
+ if (auto *pItem = pArray.get(i, true))
+ if (pItem->dbe.flags & DBEF_BOOKMARK)
+ m_bookmarks.AddItem(pItem->wtext, 0, i);
+ }
+
+ void BuildTimeTree()
{
if (!(m_dwOptions & WND_OPT_TIMETREE))
return;
@@ -341,7 +369,8 @@ class CHistoryDlg : public CDlgBase
CSplitter splitTime;
CCtrlEdit edtSearchText;
CCtrlMButton btnUserInfo, btnSendMsg, btnUserMenu, btnCopy, btnOptions, btnFilter;
- CCtrlMButton btnCalendar, btnSearch, btnExport, btnFindNext, btnFindPrev, btnDelete, btnTimeTree;
+ CCtrlMButton btnCalendar, btnSearch, btnExport, btnFindNext, btnFindPrev, btnDelete, btnTimeTree, btnBookmarks;
+ CCtrlListView m_bookmarks;
CCtrlTreeView m_timeTree;
public:
@@ -350,6 +379,7 @@ public:
m_arResults(10000),
m_hContact(_hContact),
m_iSplitter(g_splitter),
+ m_bookmarks(this, IDC_BOOKMARKSLIST),
m_timeTree(this, IDC_TIMETREEVIEW),
m_histWindow(this, IDC_HISTORYCONTROL),
splitTime(this, IDC_SPLITTERY),
@@ -366,7 +396,8 @@ public:
btnUserMenu(this, IDC_USERMENU, g_plugin.getIcon(IDI_USERMENU), LPGEN("User menu")),
btnFindNext(this, IDOK, g_plugin.getIcon(IDI_FINDNEXT), LPGEN("Find next")),
btnFindPrev(this, IDC_FINDPREV, g_plugin.getIcon(IDI_FINDPREV), LPGEN("Find previous")),
- btnTimeTree(this, IDC_TIMETREE, g_plugin.getIcon(IDI_TIMETREE), LPGEN("Conversations"))
+ btnTimeTree(this, IDC_TIMETREE, g_plugin.getIcon(IDI_TIMETREE), LPGEN("Conversations")),
+ btnBookmarks(this, IDC_BOOKMARKS, g_plugin.getIcon(IDI_BOOKMARK), LPGEN("Bookmarks"))
{
showFlags = g_plugin.getWord("showFlags", 0x7f);
m_dwOptions = g_plugin.getDword("dwOptions");
@@ -380,6 +411,7 @@ public:
}
m_toolbar.push_back(Button(btnTimeTree));
+ m_toolbar.push_back(Button(btnBookmarks));
m_toolbar.push_back(Button(btnSearch));
m_toolbar.push_back(Button(btnFilter));
m_toolbar.push_back(Button(btnCalendar, Button::SPACED));
@@ -389,6 +421,7 @@ public:
m_toolbar.push_back(Button(btnOptions, Button::RIGHT));
m_timeTree.OnSelChanged = Callback(this, &CHistoryDlg::onSelChanged_TimeTree);
+ m_bookmarks.OnClick = m_bookmarks.OnItemChanging = Callback(this, &CHistoryDlg::onSelChanged_Bookmarks);
edtSearchText.OnChange = Callback(this, &CHistoryDlg::onChange_SearchText);
@@ -406,6 +439,7 @@ public:
btnUserInfo.OnClick = Callback(this, &CHistoryDlg::onClick_UserInfo);
btnUserMenu.OnClick = Callback(this, &CHistoryDlg::onClick_UserMenu);
btnTimeTree.OnClick = Callback(this, &CHistoryDlg::onClick_TimeTree);
+ btnBookmarks.OnClick = Callback(this, &CHistoryDlg::onClick_Bookmarks);
m_hMenu = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_POPUPS));
TranslateMenu(m_hMenu);
@@ -428,6 +462,11 @@ public:
m_hwndStatus = CreateWindowEx(0, STATUSCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | SBARS_SIZEGRIP, 0, 0, 0, 0, m_hwnd, NULL, g_plugin.getInst(), NULL);
SendMessage(m_hwndStatus, SB_SETMINHEIGHT, GetSystemMetrics(SM_CYSMICON), 0);
+ // bookmarks
+ RECT rc;
+ GetClientRect(m_bookmarks.GetHwnd(), &rc);
+ m_bookmarks.AddColumn(0, TranslateT("Bookmarks"), rc.right - rc.left);
+
// filterbar
btnFilter.MakePush();
btnTimeTree.MakePush();
@@ -436,6 +475,11 @@ public:
if (m_dwOptions & WND_OPT_SEARCHBAR)
btnSearch.Push(true);
+ btnBookmarks.MakePush();
+ if (m_dwOptions & WND_OPT_BOOKMARKS)
+ btnBookmarks.Push(true);
+
+ // filters
m_hwndChkDateFrom = GetDlgItem(m_hwnd, IDC_CHK_DATE_FROM);
m_hwndChkDateTo = GetDlgItem(m_hwnd, IDC_CHK_DATE_TO);
m_hwndDateFrom = GetDlgItem(m_hwnd, IDC_DATE_FROM);
@@ -519,7 +563,8 @@ public:
m_histCtrl->AddEvent(m_hContact, 0, -1);
- TimeTreeBuild();
+ BuildTimeTree();
+ BuildBookmarksList();
SetFocus(m_histWindow.GetHwnd());
}
else Utils_RestoreWindowPosition(m_hwnd, 0, MODULENAME, "glb_");
@@ -577,7 +622,7 @@ public:
int w = rc.right - rc.left;
int h = rc.bottom - rc.top;
- HDWP hDwp = BeginDeferWindowPos(41 + (int)m_toolbar.size());
+ HDWP hDwp = BeginDeferWindowPos(43 + (int)m_toolbar.size());
// toolbar
int hToolBar = TBTN_SIZE + WND_SPACING;
@@ -688,10 +733,22 @@ public:
// time tree bar
int hTimeTree = 0;
- if (m_dwOptions & WND_OPT_TIMETREE) {
+ bool bShowTime = (m_dwOptions & WND_OPT_TIMETREE) != 0;
+ bool bShowBookmarks = (m_dwOptions & WND_OPT_BOOKMARKS) != 0;
+
+ if (bShowTime || bShowBookmarks) {
hTimeTree = m_iSplitter;
- hDwp = DeferWindowPos(hDwp, m_timeTree.GetHwnd(), 0, WND_SPACING, iClientTop, hTimeTree - WND_SPACING, iClientBottom, SWP_NOZORDER | SWP_NOACTIVATE);
hDwp = DeferWindowPos(hDwp, splitTime.GetHwnd(), 0, hTimeTree, iClientTop, WND_SPACING, iClientBottom, SWP_NOZORDER | SWP_NOACTIVATE);
+
+ if (bShowTime && bShowBookmarks) {
+ int hMiddle = (iClientBottom - iClientTop) / 2;
+ hDwp = DeferWindowPos(hDwp, m_timeTree.GetHwnd(), 0, WND_SPACING, iClientTop, hTimeTree - WND_SPACING, iClientTop + hMiddle, SWP_NOZORDER | SWP_NOACTIVATE);
+ hDwp = DeferWindowPos(hDwp, m_bookmarks.GetHwnd(), 0, WND_SPACING, iClientTop + hMiddle, hTimeTree - WND_SPACING, iClientBottom, SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+ else if (bShowTime)
+ hDwp = DeferWindowPos(hDwp, m_timeTree.GetHwnd(), 0, WND_SPACING, iClientTop, hTimeTree - WND_SPACING, iClientBottom, SWP_NOZORDER | SWP_NOACTIVATE);
+ else
+ hDwp = DeferWindowPos(hDwp, m_bookmarks.GetHwnd(), 0, WND_SPACING, iClientTop, hTimeTree - WND_SPACING, iClientBottom, SWP_NOZORDER | SWP_NOACTIVATE);
}
hDwp = DeferWindowPos(hDwp, m_histWindow.GetHwnd(), 0,
@@ -742,7 +799,7 @@ public:
m_histCtrl->Clear();
UpdateTitle();
- TimeTreeBuild();
+ BuildTimeTree();
}
}
@@ -755,7 +812,19 @@ public:
OnResize();
ShowHideControls();
- TimeTreeBuild();
+ BuildTimeTree();
+ }
+
+ void onClick_Bookmarks(CCtrlButton *)
+ {
+ if (m_dwOptions & WND_OPT_BOOKMARKS)
+ m_dwOptions &= ~WND_OPT_BOOKMARKS;
+ else
+ m_dwOptions |= WND_OPT_BOOKMARKS;
+
+ OnResize();
+ ShowHideControls();
+ BuildBookmarksList();
}
void onClick_Export(CCtrlButton *)
@@ -1054,6 +1123,10 @@ public:
PostMessage(m_hwnd, UM_REBUILDLIST, 0, 0);
break;*/
+ case UM_BOOKMARKS:
+ BuildBookmarksList();
+ break;
+
case WM_USER + 0x600:
if (wParam)
m_histWindow.SendMsg(NSM_SEEKTIME, wParam, 0);
@@ -1062,6 +1135,11 @@ public:
return CDlgBase::DlgProc(msg, wParam, lParam);
}
+ void onSelChanged_Bookmarks(CCtrlListView::TEventInfo *ev)
+ {
+ m_histCtrl->SetPos(m_bookmarks.GetItemData(ev->nmlv->iItem));
+ }
+
void onSelChanged_TimeTree(CCtrlTreeView::TEventInfo *)
{
wchar_t *val1, *val2, *val3;
@@ -1123,6 +1201,9 @@ public:
}
};
+/////////////////////////////////////////////////////////////////////////////////////////
+// Services
+
INT_PTR svcShowNewstory(WPARAM hContact, LPARAM)
{
HWND hwnd = (HWND)WindowList_Find(g_hNewstoryWindows, hContact);
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp
index 48d747b0f1..97739bb29f 100644
--- a/plugins/NewStory/src/history_menus.cpp
+++ b/plugins/NewStory/src/history_menus.cpp
@@ -124,6 +124,7 @@ static INT_PTR NSMenuHelper(WPARAM wParam, LPARAM lParam)
case MENU_BOOKMARK:
pData->ToggleBookmark();
+ PostMessage(GetParent(pData->m_hwnd), UM_BOOKMARKS, 0, 0);
break;
}
diff --git a/plugins/NewStory/src/resource.h b/plugins/NewStory/src/resource.h
index 5c821737b2..135868d80f 100644
--- a/plugins/NewStory/src/resource.h
+++ b/plugins/NewStory/src/resource.h
@@ -83,12 +83,14 @@
#define IDC_GPREVIEW 1051
#define IDC_RESET 1052
#define IDC_DISCARD 1053
+#define IDC_BOOKMARKS 1054
#define IDC_VARHELP 1055
#define IDC_VSCROLL 1056
#define IDC_DRAWEDGE 1057
#define IDC_SORT_ASCENDING 1058
#define IDC_HPP_COMPAT 1059
#define IDC_SORT_ASCENDING2 1059
+#define IDC_BOOKMARKSLIST 1060
#define ID_FILTER_SHOWALLEVENTS 40001
#define ID_FILTER_SHOWINCOMINGEVENTSONLY 40002
#define ID_FILTER_SHOWOUTGOINGEVENTSONLY 40003
@@ -110,7 +112,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 130
#define _APS_NEXT_COMMAND_VALUE 40019
-#define _APS_NEXT_CONTROL_VALUE 1058
+#define _APS_NEXT_CONTROL_VALUE 1061
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Telegram/src/proto.cpp b/protocols/Telegram/src/proto.cpp
index ab68b5eb26..f04e16f4e1 100644
--- a/protocols/Telegram/src/proto.cpp
+++ b/protocols/Telegram/src/proto.cpp
@@ -233,7 +233,7 @@ void CTelegramProto::OnEventEdited(MCONTACT hContact, MEVENT, const DBEVENTINFO
if (!pUser)
return;
- if (dbei.szId && dbei.cbBlob && dbei.eventType == EVENTTYPE_MESSAGE) {
+ if (dbei.szId && dbei.cbBlob && dbei.pBlob && dbei.eventType == EVENTTYPE_MESSAGE) {
auto text = TD::make_object<TD::formattedText>();
text->text_ = (char*)dbei.pBlob;