linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #05564
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2911: Improve chat link menus
------------------------------------------------------------
revno: 2911
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2012-04-30 18:31:37 +0200
message:
Improve chat link menus
modified:
changelog.txt
win32/MainWindow.cpp
win32/RichTextBox.cpp
win32/RichTextBox.h
--
lp:dcplusplus
https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk
Your team Dcplusplus-team is subscribed to branch lp:dcplusplus.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcplusplus/trunk/+edit-subscription
=== modified file 'changelog.txt'
--- changelog.txt 2012-04-17 18:32:01 +0000
+++ changelog.txt 2012-04-30 16:31:37 +0000
@@ -1,3 +1,7 @@
+* Add icons (iceman50)
+* Fix table header column translations (emtee)
+* Improve chat link menus (poy)
+
-- 0.797 2012-04-17 --
* Save and restore partial file lists (poy)
* Apply ADL searches in partial file lists (poy)
=== modified file 'win32/MainWindow.cpp'
--- win32/MainWindow.cpp 2012-04-29 09:12:36 +0000
+++ win32/MainWindow.cpp 2012-04-30 16:31:37 +0000
@@ -1621,8 +1621,8 @@
menu->appendItem(T_("Open downloads directory"), [this] { handleOpenDownloadsDir(); }, WinUtil::menuIcon(IDI_OPEN_DL_DIR));
menu->appendSeparator();
menu->appendItem(T_("Settings"), [this] { handleSettings(); }, WinUtil::menuIcon(IDI_SETTINGS));
- fillLimiterMenu(menu->appendPopup(T_("Download limit")), false);
- fillLimiterMenu(menu->appendPopup(T_("Upload limit")), true);
+ fillLimiterMenu(menu->appendPopup(T_("Download limit"), WinUtil::menuIcon(IDI_DLIMIT), false), false);
+ fillLimiterMenu(menu->appendPopup(T_("Upload limit"), WinUtil::menuIcon(IDI_ULIMIT), false), true);
menu->appendSeparator();
menu->appendItem(T_("Exit"), [this] { close(true); }, WinUtil::menuIcon(IDI_EXIT));
=== modified file 'win32/RichTextBox.cpp'
--- win32/RichTextBox.cpp 2012-04-17 17:32:56 +0000
+++ win32/RichTextBox.cpp 2012-04-30 16:31:37 +0000
@@ -89,8 +89,17 @@
auto menu = BaseType::getMenu();
menu->appendSeparator();
- menu->appendItem(T_("&Find...\tCtrl+F"), [this] { findTextNew(); }, dwt::IconPtr(), !getText().empty());
- menu->appendItem(T_("Find &Next\tF3"), [this] { findTextNext(); }, dwt::IconPtr(), !getText().empty());
+ auto enabled = !getText().empty();
+ menu->appendItem(T_("&Find...\tCtrl+F"), [this] { findTextNew(); }, dwt::IconPtr(), enabled);
+ menu->appendItem(T_("Find &Next\tF3"), [this] { findTextNext(); }, dwt::IconPtr(), enabled);
+
+ if(!currentLink.empty()) {
+ menu->appendSeparator();
+ auto text = currentLink;
+ auto linkMenu = menu->appendPopup(T_("Link"), WinUtil::menuIcon(IDI_LINKS));
+ linkMenu->appendItem(T_("&Open"), [this, text] { openLink(text); }, WinUtil::menuIcon(IDI_RIGHT), true, true);
+ linkMenu->appendItem(T_("&Copy"), [this, text] { WinUtil::setClipboard(text); });
+ }
return menu;
}
@@ -136,7 +145,6 @@
switch(link.msg) {
case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
{
clickPos = link.lParam;
break;
@@ -147,27 +155,10 @@
if(link.lParam != clickPos)
break;
- auto text = getLinkText(link);
- if(!linkF || !linkF(text)) {
- WinUtil::parseLink(text);
- }
+ openLink(getLinkText(link));
break;
}
- case WM_RBUTTONUP:
- {
- if(link.lParam != clickPos)
- break;
-
- auto text = getLinkText(link);
-
- auto menu = dwt::WidgetCreator<dwt::Menu>::create(this, dwt::Menu::Seed());
- menu->setTitle(dwt::util::escapeMenu(text), WinUtil::menuIcon(IDI_LINKS));
- menu->appendItem(T_("&Open"), [text] { WinUtil::parseLink(text); }, WinUtil::menuIcon(IDI_RIGHT), true, true);
- menu->open(dwt::ClientCoordinate(dwt::Point::fromLParam(clickPos), this));
- return 1;
- }
-
case WM_SETCURSOR:
{
auto pos = ::GetMessagePos();
@@ -193,3 +184,9 @@
sendMessage(EM_GETTEXTRANGE, 0, reinterpret_cast<LPARAM>(&text));
return buf.get();
}
+
+void RichTextBox::openLink(const tstring& text) {
+ if(!linkF || !linkF(text)) {
+ WinUtil::parseLink(text);
+ }
+}
=== modified file 'win32/RichTextBox.h'
--- win32/RichTextBox.h 2012-04-16 19:46:18 +0000
+++ win32/RichTextBox.h 2012-04-30 16:31:37 +0000
@@ -63,6 +63,7 @@
void handleLinkTip(tstring& text);
tstring getLinkText(const ENLINK& link);
+ void openLink(const tstring& text);
ToolTipPtr linkTip;
DWORD linkTipPos;