linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #04768
[Branch ~dcplusplus-team/dcplusplus/trunk] Rev 2666: require Common Controls 6
------------------------------------------------------------
revno: 2666
committer: poy <poy@xxxxxxxxxx>
branch nick: trunk
timestamp: Mon 2011-11-07 19:36:42 +0100
message:
require Common Controls 6
modified:
SConstruct
dcpp/compiler.h
dwarf/SConscript
dwt/include/dwt/LibraryLoader.h
dwt/include/dwt/WindowsHeaders.h
dwt/include/dwt/widgets/Table.h
dwt/src/LibraryLoader.cpp
dwt/src/widgets/Table.cpp
geoip/SConscript
miniupnpc/SConscript
natpmp/SConscript
--
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 'SConstruct'
--- SConstruct 2011-11-07 12:08:15 +0000
+++ SConstruct 2011-11-07 18:36:42 +0000
@@ -139,8 +139,17 @@
env.Append(CPPPATH = ['#/', '#/boost/', '#/intl/'])
-# boost defines
if dev.is_win32():
+ # Windows header defines <http://msdn.microsoft.com/en-us/library/aa383745(VS.85).aspx>
+ env.Append(CPPDEFINES = [
+ '_WIN32_WINNT=0x502', # Windows XP SP2
+ 'WINVER=0x502', # Windows XP SP2
+ '_WIN32_IE=0x600', # Common Controls 6
+
+ # other defs that influence Windows headers
+ 'NOMINMAX', 'STRICT', 'WIN32_LEAN_AND_MEAN'])
+
+ # boost defines
env.Append(CPPDEFINES = ['BOOST_ALL_NO_LIB', 'BOOST_USE_WINDOWS_H'])
if 'gcc' in env['TOOLS']:
=== modified file 'dcpp/compiler.h'
--- dcpp/compiler.h 2011-10-10 20:18:18 +0000
+++ dcpp/compiler.h 2011-11-07 18:36:42 +0000
@@ -66,30 +66,12 @@
#ifdef _WIN32
-#ifndef _WIN32_WINNT
-# define _WIN32_WINNT 0x0502
-#elif _WIN32_WINNT < 0x0502
-#error Version too low
-#endif
-
-#ifndef _WIN32_IE
-# define _WIN32_IE 0x0501
-#endif
-
-#ifndef WINVER
-# define WINVER 0x501
-#endif
-
-#ifndef STRICT
-#define STRICT 1
-#endif
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#ifndef NOMINMAX
-#define NOMINMAX 1
+#if _WIN32_WINNT < 0x502 || WINVER < 0x502
+#error _WIN32_WINNT / WINVER must require Windows XP SP2 (0x502)
+#endif
+
+#if _WIN32_IE < 0x600
+#error _WIN32_IE must require Common Controls 6 (0x600)
#endif
#endif
=== modified file 'dwarf/SConscript'
--- dwarf/SConscript 2011-10-16 23:06:25 +0000
+++ dwarf/SConscript 2011-11-07 18:36:42 +0000
@@ -7,7 +7,7 @@
env, target, sources = dev.prepare_build(source_path, 'dwarf', source_glob = '*.c', in_bin = False)
if dev.is_win32():
- env.Append(CPPDEFINES = ['WIN32', '_WIN32_WINNT=0x501', '_WIN32_IE=0x501', 'WINVER=0x501', 'WIN32_LEAN_AND_MEAN'])
+ env.Append(CPPDEFINES = ['WIN32'])
env.Append(CPPPATH = ['#/dwarf'])
ret = dev.build_lib(env, target, sources)
=== modified file 'dwt/include/dwt/LibraryLoader.h'
--- dwt/include/dwt/LibraryLoader.h 2011-01-02 17:12:02 +0000
+++ dwt/include/dwt/LibraryLoader.h 2011-11-07 18:36:42 +0000
@@ -114,11 +114,6 @@
*/
~LibraryLoader();
- #define PACK_COMCTL_VERSION(major,minor) MAKELONG(minor,major)
- static DWORD getCommonControlsVersion();
- /// @return whether we're running under Common Controls version >= 6.00
- static bool onComCtl6();
-
private:
HMODULE itsHMod;
};
=== modified file 'dwt/include/dwt/WindowsHeaders.h'
--- dwt/include/dwt/WindowsHeaders.h 2011-04-05 19:16:53 +0000
+++ dwt/include/dwt/WindowsHeaders.h 2011-11-07 18:36:42 +0000
@@ -40,30 +40,13 @@
#ifndef DWT_WindowsHeaders_h
#define DWT_WindowsHeaders_h
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0502
-#endif
-
-#ifndef _WIN32_IE
-# define _WIN32_IE 0x0501
-#endif
-
-#ifndef WINVER
-#define WINVER 0x502
-#endif
-
-#ifndef STRICT
-#define STRICT 1
-#endif
-
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN
-#endif
-
-#ifndef NOMINMAX
-#define NOMINMAX 1
-#endif
-
+#if _WIN32_WINNT < 0x502 || WINVER < 0x502
+#error _WIN32_WINNT / WINVER must require Windows XP SP2 (0x502)
+#endif
+
+#if _WIN32_IE < 0x600
+#error _WIN32_IE must require Common Controls 6 (0x600)
+#endif
#include <cstdint>
=== modified file 'dwt/include/dwt/widgets/Table.h'
--- dwt/include/dwt/widgets/Table.h 2011-11-07 17:59:57 +0000
+++ dwt/include/dwt/widgets/Table.h 2011-11-07 18:36:42 +0000
@@ -36,7 +36,6 @@
#ifndef DWT_TABLE_H
#define DWT_TABLE_H
-#include "../Point.h"
#include "../Rectangle.h"
#include "../resources/ImageList.h"
#include "../aspects/AspectClickable.h"
@@ -47,7 +46,6 @@
#include "../aspects/AspectScrollable.h"
#include "../aspects/AspectSelection.h"
#include "Control.h"
-#include "WidgetListViewEditBox.h"
#include <dwt/Theme.h>
#include <utility>
@@ -520,13 +518,9 @@
bool ascending;
SortFunction fun;
- static BitmapPtr upArrow;
- static BitmapPtr downArrow;
-
static int CALLBACK compareFunc( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
static int CALLBACK compareFuncCallback( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
- void createArrows();
void updateArrow();
#ifdef PORT_ME
// Private validate function, this ones returns the "read only" property of the list
=== modified file 'dwt/src/LibraryLoader.cpp'
--- dwt/src/LibraryLoader.cpp 2011-01-02 17:12:02 +0000
+++ dwt/src/LibraryLoader.cpp 2011-11-07 18:36:42 +0000
@@ -81,27 +81,4 @@
return ::GetProcAddress( itsHMod, (LPCSTR)0 + procedureOrdinal );
}
-DWORD LibraryLoader::getCommonControlsVersion() {
- static DWORD version = 0;
- if(version == 0) {
- try {
- LibraryLoader lib(_T("comctl32.dll"));
- DLLGETVERSIONPROC pDllGetVersion = (DLLGETVERSIONPROC)lib.getProcAddress(_T("DllGetVersion"));
- if(pDllGetVersion) {
- DLLVERSIONINFO dvi = { sizeof(dvi) };
- if(SUCCEEDED((*pDllGetVersion)(&dvi))) {
- version = PACK_COMCTL_VERSION(dvi.dwMajorVersion, dvi.dwMinorVersion);
- }
- }
- } catch(...) {
- // Ignore loading exceptions...
- }
- }
- return version;
-}
-
-bool LibraryLoader::onComCtl6() {
- return getCommonControlsVersion() >= PACK_COMCTL_VERSION(6, 00);
-}
-
}
=== modified file 'dwt/src/widgets/Table.cpp'
--- dwt/src/widgets/Table.cpp 2011-11-07 17:59:57 +0000
+++ dwt/src/widgets/Table.cpp 2011-11-07 18:36:42 +0000
@@ -32,7 +32,6 @@
#include <dwt/widgets/Table.h>
#include <dwt/CanvasClasses.h>
-#include <dwt/LibraryLoader.h>
#include <dwt/util/check.h>
#include <dwt/util/StringUtils.h>
#include <dwt/util/win32/Version.h>
@@ -46,9 +45,6 @@
const TCHAR Table::windowClass[] = WC_LISTVIEW;
-BitmapPtr Table::upArrow = 0;
-BitmapPtr Table::downArrow = 0;
-
Table::Seed::Seed() :
BaseType::Seed(WS_CHILD | WS_TABSTOP | LVS_REPORT),
font(0),
@@ -62,13 +58,6 @@
setFont(cs.font);
if(cs.lvStyle != 0)
setTableStyle(cs.lvStyle);
-
- // Setting default event handler for beenValidate to a function returning "read
- // only" property of control Note! If you supply a beenValidate event handler
- // this will have no effect
-#ifdef PORT_ME
- onValidate( Table::defaultValidate );
-#endif
}
Table::Table(dwt::Widget* parent) :
@@ -84,7 +73,6 @@
sortType(SORT_CALLBACK),
ascending(true)
{
- createArrows();
}
bool Table::HeaderDispatcher::operator()(const MSG& msg, LRESULT& ret) const {
@@ -115,28 +103,7 @@
}
void Table::updateArrow() {
- if(LibraryLoader::onComCtl6()) {
- int flag = isAscending() ? HDF_SORTUP : HDF_SORTDOWN;
- HWND header = ListView_GetHeader(handle());
- int count = Header_GetItemCount(header);
- for (int i=0; i < count; ++i)
- {
- HDITEM item;
- item.mask = HDI_FORMAT;
- Header_GetItem(header, i, &item);
- item.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
- if (i == this->getSortColumn())
- item.fmt |= flag;
- Header_SetItem(header, i, &item);
- }
- return;
- }
-
- if(!upArrow || !downArrow)
- return;
-
- HBITMAP bitmap = (isAscending() ? upArrow : downArrow)->handle();
-
+ int flag = isAscending() ? HDF_SORTUP : HDF_SORTDOWN;
HWND header = ListView_GetHeader(handle());
int count = Header_GetItemCount(header);
for (int i=0; i < count; ++i)
@@ -144,14 +111,9 @@
HDITEM item;
item.mask = HDI_FORMAT;
Header_GetItem(header, i, &item);
- item.mask = HDI_FORMAT | HDI_BITMAP;
- if (i == this->getSortColumn()) {
- item.fmt |= HDF_BITMAP | HDF_BITMAP_ON_RIGHT;
- item.hbm = bitmap;
- } else {
- item.fmt &= ~(HDF_BITMAP | HDF_BITMAP_ON_RIGHT);
- item.hbm = 0;
- }
+ item.fmt &= ~(HDF_SORTUP | HDF_SORTDOWN);
+ if (i == this->getSortColumn())
+ item.fmt |= flag;
Header_SetItem(header, i, &item);
}
}
@@ -338,7 +300,7 @@
}
void Table::setGroups(const std::vector<tstring>& groups) {
- grouped = LibraryLoader::onComCtl6() && (ListView_EnableGroupView(handle(), TRUE) >= 0);
+ grouped = ListView_EnableGroupView(handle(), TRUE) >= 0;
if(!grouped)
return;
@@ -568,49 +530,6 @@
return xOffset;
}
-void Table::createArrows() {
- if(LibraryLoader::onComCtl6() || upArrow || downArrow)
- return;
-
- const Point size(11, 6);
- const Rectangle rect(size);
-
- std::vector<Point> triangle;
- triangle.push_back(Point(5, 0));
- triangle.push_back(Point(0, 6));
- triangle.push_back(Point(10, 6));
-
- UpdateCanvas dc(this);
- CompatibleCanvas dc_compat(dc.handle());
-
- upArrow = BitmapPtr(new Bitmap(::CreateCompatibleBitmap(dc.handle(), size.x, size.y)));
- downArrow = BitmapPtr(new Bitmap(::CreateCompatibleBitmap(dc.handle(), size.x, size.y)));
-
- Brush brush_bg(Brush::BtnFace);
- Brush brush_arrow(Brush::BtnShadow);
-
- Region region(triangle);
-
- {
- // create up arrow
- auto select(dc_compat.select(*upArrow));
-
- dc_compat.fill(rect, brush_bg);
-
- dc_compat.fill(region, brush_arrow);
- }
-
- {
- // create down arrow
- auto select(dc_compat.select(*downArrow));
-
- dc_compat.fill(rect, brush_bg);
-
- XFORM xform = { 1, 0, 0, -1, 0, static_cast<FLOAT>(size.y) }; // horizontal reflection then downwards translation
- dc_compat.fill(*region.transform(&xform), brush_arrow);
- }
-}
-
std::pair<int, int> Table::hitTest(const ScreenCoordinate& pt) {
LVHITTESTINFO lvi = { ClientCoordinate(pt, this).getPoint() };
return ListView_SubItemHitTest(handle(), &lvi) == -1 ? std::make_pair(-1, -1) : std::make_pair(lvi.iItem, lvi.iSubItem);
=== modified file 'geoip/SConscript'
--- geoip/SConscript 2011-10-23 13:22:23 +0000
+++ geoip/SConscript 2011-11-07 18:36:42 +0000
@@ -3,7 +3,7 @@
env, target, sources = dev.prepare_build(source_path, 'geoip', source_glob = '*.c', in_bin = False)
if dev.is_win32():
- env.Append(CPPDEFINES = ['WIN32', '_WIN32_WINNT=0x501', '_WIN32_IE=0x501', 'WINVER=0x501', 'WIN32_LEAN_AND_MEAN', 'HAVE_STDINT_H=1', 'PACKAGE_VERSION=0'])
+ env.Append(CPPDEFINES = ['HAVE_STDINT_H=1', 'PACKAGE_VERSION=0'])
if 'msvc' in env['TOOLS']:
env.Append(CPPDEFINES = ['ssize_t=SSIZE_T'])
=== modified file 'miniupnpc/SConscript'
--- miniupnpc/SConscript 2011-10-16 23:06:25 +0000
+++ miniupnpc/SConscript 2011-11-07 18:36:42 +0000
@@ -3,7 +3,7 @@
env, target, sources = dev.prepare_build(source_path, 'miniupnpc', source_glob = '*.c', in_bin = False)
if dev.is_win32():
- env.Append(CPPDEFINES = ['STATICLIB', 'WIN32', '_WIN32_WINNT=0x501', '_WIN32_IE=0x501', 'WINVER=0x501', 'WIN32_LEAN_AND_MEAN'])
+ env.Append(CPPDEFINES = ['STATICLIB', 'WIN32'])
ret = dev.build_lib(env, target, sources, dev.c_lib)
Return('ret')
=== modified file 'natpmp/SConscript'
--- natpmp/SConscript 2011-10-16 23:06:25 +0000
+++ natpmp/SConscript 2011-11-07 18:36:42 +0000
@@ -3,7 +3,7 @@
env, target, sources = dev.prepare_build(source_path, 'natpmp', source_glob = '*.c', in_bin = False)
if dev.is_win32():
- env.Append(CPPDEFINES = ['errno="WSAGetLastError()"', 'STATICLIB', 'WIN32', '_WIN32_WINNT=0x501', '_WIN32_IE=0x501', 'WINVER=0x501', 'WIN32_LEAN_AND_MEAN'])
+ env.Append(CPPDEFINES = ['errno="WSAGetLastError()"', 'STATICLIB', 'WIN32'])
ret = dev.build_lib(env, target, sources, dev.c_lib)
Return('ret')