linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #02811
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2367: add a bot icon; balloon tooltips
Merge authors:
poy (poy)
------------------------------------------------------------
revno: 2367 [merge]
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2010-12-27 15:59:37 +0100
message:
add a bot icon; balloon tooltips
added:
dwt/src/util/win32/ApiHelpers.cpp
res/UserBot.ico
modified:
changelog.txt
dwt/include/dwt/util/win32/ApiHelpers.h
dwt/src/Widget.cpp
dwt/src/widgets/TabView.cpp
dwt/src/widgets/Table.cpp
dwt/src/widgets/ToolBar.cpp
dwt/src/widgets/ToolTip.cpp
help/faq_different_icons.html
win32/DCPlusPlus.rc
win32/HubFrame.cpp
win32/WinUtil.cpp
win32/WinUtil.h
win32/resource.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 2010-12-26 22:20:59 +0000
+++ changelog.txt 2010-12-27 14:59:37 +0000
@@ -51,6 +51,7 @@
* [ADC] Dispatch the amount of free slots with INF FS (poy)
* [ADC] Dispatch away mode changes (poy)
* Add a user icon modifier for users with no free slot (when INF FS is available) (poy)
+* Add a user icon to represent bots (poy)
* [L#534242] Better looking settings dialog (fleetcommand, poy)
* Allow regular expressions in ADL searches (poy)
* [L#395464] [ADC] Send "000" as the STA success code
@@ -62,6 +63,7 @@
* Update MiniUPnPc (poy)
* Ameliorate the MiniUPnPc device selection
* Prevent an endless loop on connection failure (thanks bigmuscle)
+* [L#694167] Balloon-style tooltips (iceman50, poy)
-- 0.770 2010-07-05 --
* [L#550300] Catch more potential file corruptions (thanks bigmuscle)
=== modified file 'dwt/include/dwt/util/win32/ApiHelpers.h'
--- dwt/include/dwt/util/win32/ApiHelpers.h 2010-02-11 21:44:13 +0000
+++ dwt/include/dwt/util/win32/ApiHelpers.h 2010-12-26 18:16:35 +0000
@@ -29,6 +29,7 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include "../../WindowsHeaders.h"
#include "../../tstring.h"
// This file contains various win32 api helpers / converters used to c++-ify win32 some
@@ -47,4 +48,6 @@
return retVal;
}
+void updateStyle(HWND hwnd, int which, DWORD style, bool add);
+
} } }
=== modified file 'dwt/src/Widget.cpp'
--- dwt/src/Widget.cpp 2010-12-20 17:40:42 +0000
+++ dwt/src/Widget.cpp 2010-12-26 18:16:35 +0000
@@ -49,6 +49,7 @@
#include <dwt/DWTException.h>
#include <dwt/util/check.h>
+#include <dwt/util/win32/ApiHelpers.h>
namespace dwt {
@@ -97,31 +98,12 @@
::SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WindowProc::wndProc));
}
-static void updateStyle(HWND hwnd, int which, DWORD style, bool add) {
- DWORD newStyle = ::GetWindowLong(hwnd, which);
- bool mustUpdate = false;
- if(add && (newStyle & style) != style) {
- mustUpdate = true;
- newStyle |= style;
- } else if(!add && (newStyle & style) == style) {
- mustUpdate = true;
- newStyle ^= style;
- }
-
- if(mustUpdate) {
- ::SetWindowLong(hwnd, which, newStyle);
-
- // Faking a recheck in the window to read new style... (hack)
- ::SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
- }
-}
-
void Widget::addRemoveStyle(DWORD addStyle, bool add) {
- updateStyle(handle(), GWL_STYLE, addStyle, add);
+ util::win32::updateStyle(handle(), GWL_STYLE, addStyle, add);
}
void Widget::addRemoveExStyle(DWORD addStyle, bool add) {
- updateStyle(handle(), GWL_EXSTYLE, addStyle, add);
+ util::win32::updateStyle(handle(), GWL_EXSTYLE, addStyle, add);
}
Widget::CallbackIter Widget::addCallback(const Message& msg, const CallbackType& callback) {
=== added file 'dwt/src/util/win32/ApiHelpers.cpp'
--- dwt/src/util/win32/ApiHelpers.cpp 1970-01-01 00:00:00 +0000
+++ dwt/src/util/win32/ApiHelpers.cpp 2010-12-26 18:16:35 +0000
@@ -0,0 +1,55 @@
+/*
+ DC++ Widget Toolkit
+
+ Copyright (c) 2007-2010, Jacek Sieka
+
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the DWT nor SmartWin++ nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <dwt/util/win32/ApiHelpers.h>
+
+namespace dwt { namespace util { namespace win32 {
+
+void updateStyle(HWND hwnd, int which, DWORD style, bool add) {
+ DWORD newStyle = ::GetWindowLong(hwnd, which);
+ bool mustUpdate = false;
+ if(add && (newStyle & style) != style) {
+ mustUpdate = true;
+ newStyle |= style;
+ } else if(!add && (newStyle & style) == style) {
+ mustUpdate = true;
+ newStyle ^= style;
+ }
+
+ if(mustUpdate) {
+ ::SetWindowLong(hwnd, which, newStyle);
+
+ // Faking a recheck in the window to read new style... (hack)
+ ::SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
+ }
+}
+
+} } }
=== modified file 'dwt/src/widgets/TabView.cpp'
--- dwt/src/widgets/TabView.cpp 2010-12-19 12:02:38 +0000
+++ dwt/src/widgets/TabView.cpp 2010-12-27 14:59:37 +0000
@@ -139,6 +139,7 @@
if(cs.style & TCS_TOOLTIPS) {
tip = WidgetCreator<ToolTip>::attach(this, TabCtrl_GetToolTips(handle())); // created and managed by the tab control thanks to the TCS_TOOLTIPS style
+ tip->addRemoveStyle(TTS_BALLOON, true);
tip->addRemoveStyle(TTS_NOPREFIX, true);
tip->onRaw([this](WPARAM, LPARAM lParam) { return handleToolTip(lParam); }, Message(WM_NOTIFY, TTN_GETDISPINFO));
}
=== modified file 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp 2010-12-12 23:10:36 +0000
+++ dwt/src/widgets/Table.cpp 2010-12-27 14:59:37 +0000
@@ -574,6 +574,7 @@
addRemoveTableExtendedStyle(LVS_EX_INFOTIP, true);
HWND tip = ListView_GetToolTips(handle());
if(tip) {
+ util::win32::updateStyle(tip, GWL_STYLE, TTS_BALLOON, true);
// make tooltips last longer
::SendMessage(tip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELPARAM(::SendMessage(tip, TTM_GETDELAYTIME, TTDT_AUTOPOP, 0) * 3, 0));
}
=== modified file 'dwt/src/widgets/ToolBar.cpp'
--- dwt/src/widgets/ToolBar.cpp 2010-12-23 15:57:01 +0000
+++ dwt/src/widgets/ToolBar.cpp 2010-12-27 14:59:37 +0000
@@ -31,6 +31,8 @@
#include <dwt/widgets/ToolBar.h>
+#include <dwt/util/win32/ApiHelpers.h>
+
namespace dwt {
const TCHAR ToolBar::windowClass[] = TOOLBARCLASSNAME;
@@ -59,6 +61,12 @@
//// Telling the toolbar what the size of the TBBUTTON struct is
sendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON));
+ if((cs.style & TBSTYLE_TOOLTIPS) == TBSTYLE_TOOLTIPS) {
+ HWND tip = reinterpret_cast<HWND>(sendMessage(TB_GETTOOLTIPS));
+ if(tip)
+ util::win32::updateStyle(tip, GWL_STYLE, TTS_BALLOON, true);
+ }
+
onRaw([this](WPARAM, LPARAM lParam) { return handleDropDown(lParam); }, Message(WM_NOTIFY, TBN_DROPDOWN));
onRaw([this](WPARAM, LPARAM lParam) { return handleToolTip(lParam); }, Message(WM_NOTIFY, TBN_GETINFOTIP));
=== modified file 'dwt/src/widgets/ToolTip.cpp'
--- dwt/src/widgets/ToolTip.cpp 2010-09-02 18:16:12 +0000
+++ dwt/src/widgets/ToolTip.cpp 2010-12-26 18:16:35 +0000
@@ -36,7 +36,7 @@
const TCHAR ToolTip::windowClass[] = TOOLTIPS_CLASS;
ToolTip::Seed::Seed() :
- BaseType::Seed(WS_POPUP | TTS_ALWAYSTIP | TTS_NOPREFIX, WS_EX_TRANSPARENT)
+ BaseType::Seed(WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON | TTS_NOPREFIX, WS_EX_TRANSPARENT)
{
}
=== modified file 'help/faq_different_icons.html'
--- help/faq_different_icons.html 2010-12-26 22:20:59 +0000
+++ help/faq_different_icons.html 2010-12-27 14:59:37 +0000
@@ -11,8 +11,10 @@
<dl style="margin-left: 40px;">
<dt><img src="User.ico" width="16" height="16" alt="Green"/> Green</dt>
<dd>Standard user icon (no particular attribute).</dd>
- <dt><img src="UserAway.ico" width="16" height="16" alt="Grey"/> Grey</dt>
+ <dt><img src="UserAway.ico" width="16" heighi="16" alt="Grey"/> Grey</dt>
<dd>The user is in away mode.</dd>
+ <dt><img src="UserBot.ico" width="16" heighi="16" alt="Robot"/> Robot</dt>
+ <dd>The user represents a bot the hub uses to issue automatic commands.</dd>
</dl>
Icon modifiers:
<dl style="margin-left: 40px;">
=== added file 'res/UserBot.ico'
Binary files res/UserBot.ico 1970-01-01 00:00:00 +0000 and res/UserBot.ico 2010-12-27 14:59:37 +0000 differ
=== modified file 'win32/DCPlusPlus.rc'
--- win32/DCPlusPlus.rc 2010-12-26 22:20:59 +0000
+++ win32/DCPlusPlus.rc 2010-12-27 14:59:37 +0000
@@ -94,6 +94,7 @@
IDI_RIGHT ICON "res/Right.ico"
IDI_USER ICON "res/User.ico"
IDI_USER_AWAY ICON "res/UserAway.ico"
+IDI_USER_BOT ICON "res/UserBot.ico"
IDI_USER_OP ICON "res/UserOp.ico"
IDI_USER_NOCON ICON "res/UserNoCon.ico"
IDI_USER_NOSLOT ICON "res/UserNoSlot.ico"
=== modified file 'win32/HubFrame.cpp'
--- win32/HubFrame.cpp 2010-12-26 22:20:59 +0000
+++ win32/HubFrame.cpp 2010-12-27 14:59:37 +0000
@@ -703,22 +703,23 @@
}
int HubFrame::UserInfo::getImage() const {
- int image = identity.isAway() ? WinUtil::USER_ICON_AWAY : WinUtil::USER_ICON;
+ int image = identity.isBot() ? WinUtil::USER_ICON_BOT : identity.isAway() ? WinUtil::USER_ICON_AWAY : WinUtil::USER_ICON;
+ image *= WinUtil::USER_ICON_MOD_START * WinUtil::USER_ICON_MOD_START;
if(identity.isOp()) {
- image += 1 << (WinUtil::USER_ICON_OP - 1);
+ image += 1 << (WinUtil::USER_ICON_OP - WinUtil::USER_ICON_MOD_START);
}
if(SETTING(INCOMING_CONNECTIONS) == SettingsManager::INCOMING_FIREWALL_PASSIVE &&
- !identity.isTcpActive() && !identity.supports(AdcHub::NAT0_FEATURE))
+ !identity.isBot() && !identity.isTcpActive() && !identity.supports(AdcHub::NAT0_FEATURE))
{
// Users we can't connect to
- image += 1 << (WinUtil::USER_ICON_NOCON - 1);
+ image += 1 << (WinUtil::USER_ICON_NOCON - WinUtil::USER_ICON_MOD_START);
}
string freeSlots = identity.get("FS");
if(!freeSlots.empty() && Util::toUInt(freeSlots) == 0) {
- image += 1 << (WinUtil::USER_ICON_NOSLOT - 1);
+ image += 1 << (WinUtil::USER_ICON_NOSLOT - WinUtil::USER_ICON_MOD_START);
}
return image;
=== modified file 'win32/WinUtil.cpp'
--- win32/WinUtil.cpp 2010-12-26 22:20:59 +0000
+++ win32/WinUtil.cpp 2010-12-27 14:59:37 +0000
@@ -160,16 +160,19 @@
{
userImages = dwt::ImageListPtr(new dwt::ImageList(dwt::Point(16, 16)));
auto userIcon = [](unsigned id) { return createIcon(id, 16); };
- dwt::IconPtr user = userIcon(IDI_USER), away = userIcon(IDI_USER_AWAY);
+ const unsigned baseCount = USER_ICON_MOD_START;
const unsigned modifierCount = USER_ICON_LAST - USER_ICON_MOD_START;
+ dwt::IconPtr bases[baseCount] = { userIcon(IDI_USER), userIcon(IDI_USER_AWAY), userIcon(IDI_USER_BOT) };
dwt::IconPtr modifiers[modifierCount] = { userIcon(IDI_USER_OP), userIcon(IDI_USER_NOCON), userIcon(IDI_USER_NOSLOT) };
- for(size_t i = 0, n = USER_ICON_MOD_START * modifierCount * modifierCount; i < n; ++i) {
- vector<dwt::IconPtr> icons;
- icons.push_back((i & USER_ICON_AWAY) ? away : user);
- for(size_t iMod = 0; iMod < modifierCount; ++iMod)
- if(i & (1 << (iMod + 1)))
- icons.push_back(modifiers[iMod]);
- userImages->add(*dwt::util::merge(icons));
+ for(size_t iBase = 0; iBase < baseCount; ++iBase) {
+ for(size_t i = 0, n = modifierCount * modifierCount; i < n; ++i) {
+ vector<dwt::IconPtr> icons;
+ icons.push_back(bases[iBase]);
+ for(size_t iMod = 0; iMod < modifierCount; ++iMod)
+ if(i & (1 << iMod))
+ icons.push_back(modifiers[iMod]);
+ userImages->add(*dwt::util::merge(icons));
+ }
}
}
=== modified file 'win32/WinUtil.h'
--- win32/WinUtil.h 2010-12-26 22:20:59 +0000
+++ win32/WinUtil.h 2010-12-27 14:59:37 +0000
@@ -52,6 +52,7 @@
// base icons
USER_ICON,
USER_ICON_AWAY,
+ USER_ICON_BOT,
// modifiers
USER_ICON_MOD_START,
=== modified file 'win32/resource.h'
--- win32/resource.h 2010-12-26 22:20:59 +0000
+++ win32/resource.h 2010-12-27 14:59:37 +0000
@@ -53,11 +53,12 @@
#define IDI_RIGHT 145
#define IDI_USER 146
#define IDI_USER_AWAY 147
-#define IDI_USER_OP 148
-#define IDI_USER_NOCON 149
-#define IDI_USER_NOSLOT 150
+#define IDI_USER_BOT 148
+#define IDI_USER_OP 149
+#define IDI_USER_NOCON 150
+#define IDI_USER_NOSLOT 151
-#define IDB_FOLDERS 151
+#define IDB_FOLDERS 200
// Stuff that uses multiple id's