summaryrefslogtreecommitdiff
path: root/plugins/NewStory
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2023-09-05 16:10:48 +0300
committerGeorge Hazan <george.hazan@gmail.com>2023-09-05 16:10:48 +0300
commit90e682bbe7b3be96b741fe32ec11cc26f58ab5a2 (patch)
tree2e8a9d651d6cbc26132d7e49414f7a60a2d65211 /plugins/NewStory
parent64c2fb8c4329d430a4894f154b47269693e31102 (diff)
NewStory: event quoting
Diffstat (limited to 'plugins/NewStory')
-rw-r--r--plugins/NewStory/src/history_control.cpp9
-rw-r--r--plugins/NewStory/src/history_control.h1
-rw-r--r--plugins/NewStory/src/history_menus.cpp18
-rw-r--r--plugins/NewStory/src/utils.h7
4 files changed, 28 insertions, 7 deletions
diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp
index 8cca15f272..313d8bd3ea 100644
--- a/plugins/NewStory/src/history_control.cpp
+++ b/plugins/NewStory/src/history_control.cpp
@@ -52,7 +52,7 @@ void NewstoryListData::OnContextMenu(int index, POINT pt)
if (item == nullptr)
return;
- HMENU hMenu = NSMenu_Build(item);
+ HMENU hMenu = NSMenu_Build(this, item);
if (pMsgDlg != nullptr && pMsgDlg->isChat()) {
EnableMenuItem(hMenu, 2, MF_BYPOSITION | MF_GRAYED);
@@ -588,6 +588,13 @@ void NewstoryListData::RecalcScrollBar()
}
}
+void NewstoryListData::Quote()
+{
+ if (pMsgDlg)
+ if (auto *pItem = LoadItem(caret))
+ pMsgDlg->SetMessageText(Srmm_Quote(pItem->wtext));
+}
+
void NewstoryListData::ScheduleDraw()
{
bWasAtBottom = AtBottom();
diff --git a/plugins/NewStory/src/history_control.h b/plugins/NewStory/src/history_control.h
index 6716b99273..00762259ee 100644
--- a/plugins/NewStory/src/history_control.h
+++ b/plugins/NewStory/src/history_control.h
@@ -79,6 +79,7 @@ struct NewstoryListData : public MZeroedObject
void PageUp();
void PageDown();
int PaintItem(HDC hdc, int index, int top, int width);
+ void Quote();
void RecalcScrollBar();
void ScheduleDraw();
void ScrollTop();
diff --git a/plugins/NewStory/src/history_menus.cpp b/plugins/NewStory/src/history_menus.cpp
index 3226f73e05..394ede04a3 100644
--- a/plugins/NewStory/src/history_menus.cpp
+++ b/plugins/NewStory/src/history_menus.cpp
@@ -2,7 +2,7 @@
enum
{
- MENU_COPY, MENU_COPYTEXT,
+ MENU_COPY, MENU_COPYTEXT, MENU_QUOTE,
MENU_SAVEAS, MENU_DOWNLOAD,
MENU_EDIT, MENU_DELETE,
MENU_SELECTALL, MENU_BOOKMARK,
@@ -10,9 +10,9 @@ enum
static int hMenuObject;
static HANDLE hEventPreBuildMenu;
-static HGENMENU hmiHistory, hmiCopy, hmiSaveAs, hmiDownload;
+static HGENMENU hmiHistory, hmiCopy, hmiSaveAs, hmiDownload, hmiQuote;
-HMENU NSMenu_Build(ItemData *item)
+HMENU NSMenu_Build(NewstoryListData *data, ItemData *item)
{
if (item->m_bOfflineFile) {
Menu_ModifyItem(hmiCopy, (item->m_bOfflineDownloaded) ? TranslateT("Copy file name") : TranslateT("Copy URL"));
@@ -24,6 +24,8 @@ HMENU NSMenu_Build(ItemData *item)
Menu_ShowItem(hmiDownload, false);
}
+ Menu_ShowItem(hmiQuote, data->pMsgDlg != nullptr);
+
NotifyEventHooks(hEventPreBuildMenu, item->hContact, (LPARAM)&item->dbe);
HMENU hMenu = CreatePopupMenu();
@@ -58,6 +60,10 @@ static INT_PTR NSMenuHelper(WPARAM wParam, LPARAM lParam)
pData->Copy(true);
break;
+ case MENU_QUOTE:
+ pData->Quote();
+ break;
+
case MENU_EDIT:
pData->BeginEditItem(pData->caret, false);
break;
@@ -179,10 +185,14 @@ void InitMenus()
hmiCopy = Menu_AddNewStoryMenuItem(&mi, MENU_COPYTEXT);
mi.position = 100002;
+ mi.name.a = LPGEN("Quote");
+ hmiQuote = Menu_AddNewStoryMenuItem(&mi, MENU_QUOTE);
+
+ mi.position = 100003;
mi.name.a = LPGEN("Save as");
hmiSaveAs = Menu_AddNewStoryMenuItem(&mi, MENU_SAVEAS);
- mi.position = 100003;
+ mi.position = 100004;
mi.name.a = LPGEN("Download");
hmiDownload = Menu_AddNewStoryMenuItem(&mi, MENU_DOWNLOAD);
diff --git a/plugins/NewStory/src/utils.h b/plugins/NewStory/src/utils.h
index 9e9c74b55b..91f8fa92af 100644
--- a/plugins/NewStory/src/utils.h
+++ b/plugins/NewStory/src/utils.h
@@ -1,7 +1,10 @@
+struct ItemData;
+struct NewstoryListData;
+
uint32_t toggleBit(uint32_t dw, uint32_t bit);
bool CheckFilter(wchar_t *buf, wchar_t *filter);
-HMENU NSMenu_Build(struct ItemData *item);
-bool NSMenu_Process(int iCommand, struct NewstoryListData *data);
+HMENU NSMenu_Build(NewstoryListData *data, ItemData *item);
+bool NSMenu_Process(int iCommand, NewstoryListData *data);
void RemoveBbcodes(wchar_t *pwszText);