← Back to team overview

linuxdcpp-team team mailing list archive

[Branch ~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin] Rev 9: update dwt

 

------------------------------------------------------------
revno: 9
committer: poy <poy@xxxxxxxxxx>
branch nick: DevPlugin
timestamp: Thu 2012-12-27 16:38:11 +0100
message:
  update dwt
removed:
  dwt/include/dwt/ClipBoard.h
added:
  dwt/include/dwt/Clipboard.h
  dwt/src/Clipboard.cpp
  dwt/src/SConscript
  dwt/src/util/SConscript
  dwt/src/util/win32/SConscript
  dwt/src/widgets/SConscript


--
lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin
https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin

Your team Dcplusplus-team is subscribed to branch lp:~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin.
To unsubscribe from this branch go to https://code.launchpad.net/~dcplusplus-team/dcpp-plugin-sdk-cpp/DevPlugin/+edit-subscription
=== removed file 'dwt/include/dwt/ClipBoard.h'
--- dwt/include/dwt/ClipBoard.h	2012-12-27 13:46:36 +0000
+++ dwt/include/dwt/ClipBoard.h	1970-01-01 00:00:00 +0000
@@ -1,180 +0,0 @@
-/*
-  DC++ Widget Toolkit
-
-  Copyright (c) 2007-2012, Jacek Sieka
-
-  SmartWin++
-
-  Copyright (c) 2005 Thomas Hansen
-
-  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.
-*/
-
-#ifndef DWT_ClipBoard_h
-#define DWT_ClipBoard_h
-
-#include "WindowsHeaders.h"
-#include "tstring.h"
-#include "DWTException.h"
-
-namespace dwt {
-
-/// Class for commonalities between the different specializations of the ClipBoard
-/// class
-/** Class is not directly instantiable, you must derive from it or use one of the
-  * ClipBoard specialized classes.
-  */
-class ClipBoardBase
-{
-public:
-	/// Types of clipboard format
-	/** Basically just maps to the defines from winuser.h which is prefixed with CF_
-	  * in front of the name
-	  */
-	enum ClipBoardFormat
-	{ TEXT = CF_TEXT, BITMAP = CF_BITMAP, PALETTE = CF_PALETTE, WAVE = CF_WAVE, UNICODETEXT = CF_UNICODETEXT
-	};
-
-	/// Checks to see if the queried clipboard format is available
-	/** Returns true if the queried clipboard format is available, otherwise false.
-	  */
-	bool isClipBoardFormatAvailable( ClipBoardFormat format )
-	{
-		return ::IsClipboardFormatAvailable( static_cast< unsigned >( format ) ) == TRUE;
-	}
-
-protected:
-	virtual ~ClipBoardBase()
-	{}
-	ClipBoardBase()
-	{}
-
-private:
-	// Private and never implemented since we try to avoid slicing, there is
-	// basically no point in having a copy of this object.
-	ClipBoardBase( const ClipBoardBase & );
-	ClipBoardBase & operator =( const ClipBoardBase & );
-};
-
-// The generic version is "uninstantiable".
-template< class Type >
-class ClipBoard
-{
-	// Private Constructor, Supposed to be "uninstantiabble".
-	ClipBoard();
-};
-
-/// Class for manipulating the clipboard, specialized for tstring
-/// clipboard operations.
-/** At the moment SmartWin only supports tstring clipboard operations.
-  * <br>
-  * More clipboard formats will be supported in later version. <br>
-  * Every clipboard class is a Singleton to make access easy. <br>
-  * <b>Just remember that if you stuff things into the clipboard then access it again
-  * later as the type you stuffed it in as!</b>
-  */
-template< >
-class ClipBoard< tstring > : public ClipBoardBase
-{
-public:
-	/// Returns the actual instance of the object
-	/** Every clipboard specialized class is a singleton, partially too be easily
-	  * accessible but also to ensure serial access to the object. <br>
-	  * SmartWin uses "instance" all through the library to access the instance
-	  * object of singleton classes, use this function to retrieve the instance
-	  * object.
-	  */
-	static ClipBoard & instance()
-	{
-		static ClipBoard retVal;
-		return retVal;
-	}
-
-	/// Sets clipboard data to given string
-	/** Takes a "parent" window which will "own" the clipboard and a
-	  * tstring which will be stuffed into the clipboard and made <br>
-	  * accessible for other applications as CF_TEXT or your own application. <br>
-	  * Just remember that if you use this specialized instance of the clipboard
-	  * class you must access the clipboard again (through getClipBoardData) <br>
-	  * through the same specialization (tstring specialization).
-	  */
-	void setClipBoardData( const tstring & str, const Widget * owner )
-	{
-		if ( !::OpenClipboard( owner->handle() ) )
-			throw Win32Excepction( "Couldn't open the clipboard" );
-
-		::EmptyClipboard();
-		HGLOBAL handle = ::GlobalAlloc( GMEM_MOVEABLE, sizeof( TCHAR ) * str.size() + 1 );
-		if ( 0 == handle )
-			throw Win32Exception( "Couldn't allocate memory to hold clipboard data" );
-		TCHAR * buffer = reinterpret_cast< TCHAR * >( GlobalLock( handle ) );
-		memcpy( buffer, str.c_str(), sizeof( TCHAR ) * str.size() );
-		GlobalUnlock( handle );
-		SetClipboardData( CF_TEXT, handle );
-		CloseClipboard();
-	}
-
-	/// Retrieves clipboard data from the clipboard (assumes clipboard format is string)
-	/** When accessing the clipboard we need to "send a rquest" from a specific
-	  * window. <br>
-	  * The "owner" parameter defines this window. <br>
-	  * If you try to access the clipboard you will get an empty string ("") returned
-	  * if the clipboard is either empty or if the clipboard data was of the wrong
-	  * format.
-	  */
-	tstring getClipBoardData( const Widget * owner ) const
-	{
-		if ( !::IsClipboardFormatAvailable( CF_TEXT ) )
-			return _T( "" );
-		if ( !::OpenClipboard( owner->handle() ) )
-			return _T( "" );
-		HANDLE handle = ::GetClipboardData( CF_TEXT );
-		if ( 0 == handle )
-			return _T( "" );
-		tstring retVal( reinterpret_cast< TCHAR * >( GlobalLock( handle ) ) );
-		GlobalUnlock( handle );
-		CloseClipboard();
-		return retVal;
-	}
-
-private:
-	// Private and never implemented since we try to avoid slicing, there is
-	// basically no point in having a copy of this object.
-	ClipBoard( const ClipBoard & );
-	ClipBoard & operator =( const ClipBoard & );
-
-	// Private Constructor to ensure Singleton logic
-	ClipBoard()
-	{}
-};
-
-/// \ingroup GlobalStuff
-// For easy access of the most common ClipBoard specializations.
-typedef ClipBoard< tstring > ClipBoardString;
-
-}
-
-#endif

=== added file 'dwt/include/dwt/Clipboard.h'
--- dwt/include/dwt/Clipboard.h	1970-01-01 00:00:00 +0000
+++ dwt/include/dwt/Clipboard.h	2012-12-27 15:38:11 +0000
@@ -0,0 +1,48 @@
+/*
+  DC++ Widget Toolkit
+
+  Copyright (c) 2007-2012, Jacek Sieka
+
+  SmartWin++
+
+  Copyright (c) 2005 Thomas Hansen
+
+  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.
+*/
+
+#ifndef DWT_CLIPBOARD_H
+#define DWT_CLIPBOARD_H
+
+#include <dwt/forward.h>
+#include <dwt/tstring.h>
+
+namespace dwt { namespace Clipboard {
+
+void setData(const tstring& str, Control* w);
+
+} }
+
+#endif

=== added file 'dwt/src/Clipboard.cpp'
--- dwt/src/Clipboard.cpp	1970-01-01 00:00:00 +0000
+++ dwt/src/Clipboard.cpp	2012-12-27 15:38:11 +0000
@@ -0,0 +1,68 @@
+/*
+  DC++ Widget Toolkit
+
+  Copyright (c) 2007-2012, 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/Clipboard.h>
+
+#include <dwt/util/check.h>
+#include <dwt/widgets/Control.h>
+
+namespace dwt { namespace Clipboard {
+
+void setData(const tstring& str, Control* w) {
+	dwtassert(w, "Clipboard::setData: invalid widget");
+
+	if(!::OpenClipboard(w->handle())) {
+		dwtWin32DebugFail("Clipboard::setData: OpenClipboard failed");
+		return;
+	}
+
+	::EmptyClipboard();
+
+	auto handle = ::GlobalAlloc(GMEM_MOVEABLE, (str.size() + 1) * sizeof(TCHAR));
+	if(!handle) {
+		::CloseClipboard();
+		return;
+	}
+
+	auto buf = reinterpret_cast<TCHAR*>(::GlobalLock(handle));
+	_tcscpy(buf, str.c_str());
+	::GlobalUnlock(handle);
+
+#ifdef _UNICODE
+	::SetClipboardData(CF_UNICODETEXT, handle);
+#else
+	::SetClipboardData(CF_TEXT, handle);
+#endif
+
+	::CloseClipboard();
+}
+
+} }

=== added file 'dwt/src/SConscript'
--- dwt/src/SConscript	1970-01-01 00:00:00 +0000
+++ dwt/src/SConscript	2012-12-27 15:38:11 +0000
@@ -0,0 +1,19 @@
+Import('dev source_path')
+
+env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False, recursive=True)
+
+env.Append(CPPPATH = ['#/dwt/include'])
+
+def get_msvcproj_files(env):
+	def parse_patterns(patterns):
+		array = []
+		for pattern in patterns:
+			for file in env.Glob('#/dwt/' + pattern):
+				array.append(file)
+		return array
+	return (parse_patterns(['include/dwt/*.h', 'include/dwt/*/*.h', 'include/dwt/*/*/*.h']),
+			parse_patterns(['src/*.cpp', 'src/*/*.cpp', 'src/*/*/*.cpp']))
+
+ret = dev.build_lib(env, target, sources, get_msvcproj_files, 'dwt')
+
+Return('ret')

=== added file 'dwt/src/util/SConscript'
--- dwt/src/util/SConscript	1970-01-01 00:00:00 +0000
+++ dwt/src/util/SConscript	2012-12-27 15:38:11 +0000
@@ -0,0 +1,8 @@
+Import('dev source_path')
+
+env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False)
+
+env.Append(CPPPATH = ['#/dwt/include'])
+
+ret = [dev.build_lib(env, target, sources), dev.build('win32/')]
+Return('ret')

=== added file 'dwt/src/util/win32/SConscript'
--- dwt/src/util/win32/SConscript	1970-01-01 00:00:00 +0000
+++ dwt/src/util/win32/SConscript	2012-12-27 15:38:11 +0000
@@ -0,0 +1,8 @@
+Import('dev source_path')
+
+env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False)
+
+env.Append(CPPPATH = ['#/dwt/include'])
+
+ret = dev.build_lib(env, target, sources)
+Return('ret')

=== added file 'dwt/src/widgets/SConscript'
--- dwt/src/widgets/SConscript	1970-01-01 00:00:00 +0000
+++ dwt/src/widgets/SConscript	2012-12-27 15:38:11 +0000
@@ -0,0 +1,8 @@
+Import('dev source_path')
+
+env, target, sources = dev.prepare_build(source_path, 'dwt', in_bin = False)
+
+env.Append(CPPPATH = ['#/dwt/include'])
+
+ret = dev.build_lib(env, target, sources)
+Return('ret')