linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #00610
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2114: Add user commands to the chat menu
------------------------------------------------------------
revno: 2114
committer: poy <poy@xxxxxxxxxx>
branch nick: repo
timestamp: Fri 2010-03-26 23:49:37 +0100
message:
Add user commands to the chat menu
modified:
changelog.txt
dcpp/FavoriteManager.cpp
dcpp/UserCommand.h
dwt/src/widgets/TextBox.cpp
win32/CommandDlg.cpp
win32/HubFrame.cpp
win32/HubFrame.h
win32/PrivateFrame.cpp
--
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 2010-03-26 21:55:05 +0000
+++ changelog.txt 2010-03-26 22:49:37 +0000
@@ -5,6 +5,7 @@
* Parse separators in titles of user command param boxes (poy)
* Fix painting issues with /clear <n> (poy)
* Smooth text-box menus (poy)
+* Add user commands to the chat menu (poy)
-- 0.761 2010-03-14 --
* [L#533840] Fix crashes with themed menus (poy)
=== modified file 'dcpp/FavoriteManager.cpp'
--- dcpp/FavoriteManager.cpp 2010-02-11 21:44:13 +0000
+++ dcpp/FavoriteManager.cpp 2010-03-26 22:49:37 +0000
@@ -422,11 +422,11 @@
// Add NMDC standard op commands
static const char kickstr[] =
"$To: %[userNI] From: %[myNI] $<%[myNI]> You are being kicked because: %[line:Reason]|<%[myNI]> %[myNI] is kicking %[userNI] because: %[line:Reason]|$Kick %[userNI]|";
- addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE,
+ addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_USER | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE,
_("Kick user(s)"), kickstr, "", "op");
static const char redirstr[] =
"$OpForceMove $Who:%[userNI]$Where:%[line:Target Server]$Msg:%[line:Message]|";
- addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_CHAT | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE,
+ addUserCommand(UserCommand::TYPE_RAW_ONCE, UserCommand::CONTEXT_USER | UserCommand::CONTEXT_SEARCH, UserCommand::FLAG_NOSAVE,
_("Redirect user(s)"), redirstr, "", "op");
try {
=== modified file 'dcpp/UserCommand.h'
--- dcpp/UserCommand.h 2010-03-23 16:16:37 +0000
+++ dcpp/UserCommand.h 2010-03-26 22:49:37 +0000
@@ -40,10 +40,10 @@
enum {
CONTEXT_HUB = 0x01,
- CONTEXT_CHAT = 0x02,
+ CONTEXT_USER = 0x02,
CONTEXT_SEARCH = 0x04,
CONTEXT_FILELIST = 0x08,
- CONTEXT_MASK = CONTEXT_HUB | CONTEXT_CHAT | CONTEXT_SEARCH | CONTEXT_FILELIST
+ CONTEXT_MASK = CONTEXT_HUB | CONTEXT_USER | CONTEXT_SEARCH | CONTEXT_FILELIST
};
enum {
=== modified file 'dwt/src/widgets/TextBox.cpp'
--- dwt/src/widgets/TextBox.cpp 2010-03-26 21:55:05 +0000
+++ dwt/src/widgets/TextBox.cpp 2010-03-26 22:49:37 +0000
@@ -213,7 +213,7 @@
MenuPtr menu(WidgetCreator<Menu>::create(getParent(), menuSeed));
addCommands(menu);
- menu->open(pt, TPM_LEFTALIGN | TPM_RIGHTBUTTON);
+ menu->open(pt);
return true;
}
=== modified file 'win32/CommandDlg.cpp'
--- win32/CommandDlg.cpp 2010-02-11 21:44:13 +0000
+++ win32/CommandDlg.cpp 2010-03-26 22:49:37 +0000
@@ -196,7 +196,7 @@
if(ctx & UserCommand::CONTEXT_HUB)
hubMenu->setChecked(true);
- if(ctx & UserCommand::CONTEXT_CHAT)
+ if(ctx & UserCommand::CONTEXT_USER)
userMenu->setChecked(true);
if(ctx & UserCommand::CONTEXT_SEARCH)
searchMenu->setChecked(true);
@@ -231,7 +231,7 @@
if(hubMenu->getChecked())
ctx |= UserCommand::CONTEXT_HUB;
if(userMenu->getChecked())
- ctx |= UserCommand::CONTEXT_CHAT;
+ ctx |= UserCommand::CONTEXT_USER;
if(searchMenu->getChecked())
ctx |= UserCommand::CONTEXT_SEARCH;
if(fileListMenu->getChecked())
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2010-03-06 22:24:26 +0000
+++ win32/HubFrame.cpp 2010-03-26 22:49:37 +0000
@@ -1060,10 +1060,7 @@
return insert;
}
-bool HubFrame::handleChatContextMenu(dwt::ScreenCoordinate pt) {
- if(pt.x() == -1 || pt.y() == -1) {
- pt = chat->getContextMenuPos();
- }
+bool HubFrame::userClick(const dwt::ScreenCoordinate& pt) {
tstring txt = chat->textUnderCursor(pt);
if(txt.empty())
return false;
@@ -1080,7 +1077,25 @@
return false;
}
- return handleUsersContextMenu(pt);
+ return true;
+}
+
+bool HubFrame::handleChatContextMenu(dwt::ScreenCoordinate pt) {
+ if(pt.x() == -1 || pt.y() == -1) {
+ pt = chat->getContextMenuPos();
+ }
+
+ if(userClick(pt) && handleUsersContextMenu(pt))
+ return true;
+
+ // imitate TextBoxBase's menu creation
+ MenuPtr menu(dwt::WidgetCreator<Menu>::create(chat->getParent(), WinUtil::Seeds::menu));
+ chat->addCommands(menu);
+
+ prepareMenu(menu, UserCommand::CONTEXT_HUB, url);
+
+ inTabMenu = false;
+ menu->open(pt);
}
bool HubFrame::handleUsersContextMenu(dwt::ScreenCoordinate pt) {
@@ -1097,10 +1112,10 @@
for(int j=0; j<COLUMN_LAST; j++) {
copyMenu->appendItem(T_(usersColumns[j].name), std::tr1::bind(&HubFrame::handleMultiCopy, this, j));
}
- prepareMenu(menu, UserCommand::CONTEXT_CHAT, client->getHubUrl());
+
+ prepareMenu(menu, UserCommand::CONTEXT_USER, url);
inTabMenu = false;
-
menu->open(pt);
return true;
}
=== modified file 'win32/HubFrame.h'
--- win32/HubFrame.h 2010-02-11 21:44:13 +0000
+++ win32/HubFrame.h 2010-03-26 22:49:37 +0000
@@ -225,6 +225,8 @@
void addAsFavorite();
void removeFavoriteHub();
+ bool userClick(const dwt::ScreenCoordinate& pt);
+
void runUserCommand(const UserCommand& uc);
bool handleMessageChar(int c);
=== modified file 'win32/PrivateFrame.cpp'
--- win32/PrivateFrame.cpp 2010-03-06 22:24:26 +0000
+++ win32/PrivateFrame.cpp 2010-03-26 22:49:37 +0000
@@ -313,7 +313,7 @@
void PrivateFrame::tabMenuImpl(dwt::MenuPtr& menu) {
appendUserItems(getParent(), menu, false, false);
- prepareMenu(menu, UserCommand::CONTEXT_CHAT, ClientManager::getInstance()->getHubs(replyTo.getUser().user->getCID(),
+ prepareMenu(menu, UserCommand::CONTEXT_USER, ClientManager::getInstance()->getHubs(replyTo.getUser().user->getCID(),
replyTo.getUser().hint, priv));
menu->appendSeparator();
}