--- a/Make.spec Tue Mar 20 22:04:49 2007 +0100
+++ b/Make.spec Wed Apr 04 16:18:07 2007 +0200
@@ -1,6 +1,6 @@
-# $Header: /cvs/stx/stx/libview/Make.spec,v 1.17 2007-01-16 13:00:00 stefan Exp $
+# $Header: /cvs/stx/stx/libview/Make.spec,v 1.18 2007-04-04 14:18:07 stefan Exp $
#
-# DO NOT EDIT
+# DO NOT EDIT
# automagically generated from the projectDefinition: stx_libview.
#
# Warning: once you modify this file, do not rerun
@@ -107,5 +107,3 @@
$(OUTDIR)SynchronousWindowSensor.$(O) \
$(OUTDIR)WindowingTransformation.$(O) \
$(OUTDIR)stx_libview.$(O) \
-
-
--- a/WinWorkstation.st Tue Mar 20 22:04:49 2007 +0100
+++ b/WinWorkstation.st Wed Apr 04 16:18:07 2007 +0200
@@ -9,14 +9,17 @@
other person. No title to or ownership of the software is
hereby transferred.
"
+'From Smalltalk/X, Version:5.3.5 on 04-04-2007 at 15:55:25' !
+
"{ Package: 'stx:libview' }"
DeviceWorkstation subclass:#WinWorkstation
instanceVariableNames:'blackpixel whitepixel listOfFonts rootWin rootDC buttonsPressed
- eventTrace eventBuffer isWin95 isWinXP'
+ eventTrace eventBuffer isWin95 isWinXP
+ lastClipboardSequenceNumber'
classVariableNames:'BeepDuration NativeDialogs NativeWidgets NativeWidgetClassTable
StandardColorValues IgnoreSysColorChanges IgnoreFontChanges
- SystemColorValues ClipBoardObject'
+ SystemColorValues'
poolDictionaries:''
category:'Interface-Graphics'
!
@@ -8517,8 +8520,87 @@
!WinWorkstation methodsFor:'clipboard'!
+getClipboardObjectFor:drawableId
+ "answer an arbitrary object from the clipboard, or nil,
+ if there is no data that we are able to handle (decode)"
+
+ |currentSequenceNumber|
+
+ currentSequenceNumber := self getClipboardSequenceNumber.
+ lastClipboardSequenceNumber ~= currentSequenceNumber ifTrue:[
+ "copyBuffer is invalid, fill it from the windows clipboard.
+ Even if we could not decode the windows clipboard,
+ we intentionally set the copyBuffer to nil to get a consistent
+ behavior."
+ copyBuffer := self getClipboardData.
+ lastClipboardSequenceNumber := currentSequenceNumber.
+ ].
+ ^ copyBuffer
+!
+
+getClipboardText:selectionBufferSymbol for:drawableId
+ "get the contents of the clipboard and answer a String,
+ or nil, if there is no data that we can handle (decode)."
+
+ |currentSequenceNumber|
+
+ currentSequenceNumber := self getClipboardSequenceNumber.
+ lastClipboardSequenceNumber ~= currentSequenceNumber ifTrue:[
+ "copyBuffer is invalid, fill it from the windows clipboard.
+ Even if we could not decode the windows clipboard,
+ we intentionally set the copyBuffer to nil to get a consistent
+ behavior."
+ copyBuffer := self getClipboardData.
+ lastClipboardSequenceNumber := currentSequenceNumber.
+ ].
+ ^ self copyBufferAsString
+!
+
+setClipboardObject:something owner:drawableId
+ "store an arbitrary object into the clipboard.
+ Since we currently support only text, any other object
+ is stored only in our local copyBuffer and not made available
+ to other applications."
+
+ something isString ifTrue:[
+ self setClipboardText:something owner:drawableId.
+ ^ self
+ ].
+ something isStringCollection ifTrue:[
+ self setClipboardText:something asString owner:drawableId.
+ ^ self
+ ].
+
+ "copyBuffer is valid until the clipboard sequence number increases,
+ because new data has been put into the clipboard"
+ lastClipboardSequenceNumber := self getClipboardSequenceNumber.
+
+ "Created: / 13.7.1999 / 13:30:37 / cg"
+ "Modified: / 30.1.2000 / 11:59:41 / cg"
+!
+
+setClipboardText:something owner:drawableId
+ "store some text into the clipboard"
+
+ |result|
+
+ result := self setClipboardData:something asString string. "take care of StringCollections"
+
+ "as long as the sequence number doesn't change, our copyBuffer is valid"
+ lastClipboardSequenceNumber := self getClipboardSequenceNumber.
+ ^ result.
+
+
+ "Created: / 13.7.1999 / 13:36:43 / cg"
+ "Modified: / 30.1.2000 / 12:12:57 / cg"
+! !
+
+!WinWorkstation methodsFor:'clipboard-private'!
+
getClipboardData
- "caveat: for now, only Text is supported"
+ "get the contents of the windows clipboard.
+ Answer a string on success or nil otherwise.
+ Caveat: for now, only Text is supported"
%{
HANDLE hClip;
@@ -8641,36 +8723,41 @@
%}
!
-getClipboardObjectFor:drawableId
- ^ ClipBoardObject
-
- "Modified: / 30.1.2000 / 02:26:47 / cg"
-!
-
-getClipboardText:selectionBufferSymbol for:drawableId
- ^ self getCopyBuffer.
-!
-
-getCopyBuffer
- "return the copyBuffers contents."
-
- |clip|
-
- ClipBoardObject notNil ifTrue:[
- ^ ClipBoardObject
- ].
-
- (clip := (self getClipboardData)) notNil ifTrue:[
- ^ clip
- ].
- ^ copyBuffer
-
- "Created: / 13.7.1999 / 13:15:35 / cg"
- "Modified: / 30.1.2000 / 12:01:13 / cg"
+getClipboardOwner
+ "answer an handle telling us, who owns the clipboard."
+
+%{
+ HANDLE hWnd;
+
+ hWnd = GetClipboardOwner();
+ RETURN(__MKEXTERNALADDRESS(hWnd));
+%}
+
+ "
+ Screen current getClipboardOwner
+ "
+!
+
+getClipboardSequenceNumber
+ "answer the sequence number of the clioboard.
+ Each time, the keyboard is changed, the sequence number is incremented."
+
+%{
+ DWORD sequenceNumber;
+
+ sequenceNumber = GetClipboardSequenceNumber();
+ RETURN(__MKUINT(sequenceNumber));
+%}
+
+ "
+ Screen current getClipboardSequenceNumber
+ "
!
setClipboardData:aString
- "caveat: for now, only Text is supported"
+ "Set the contents of the windows clipboard.
+ Answer true, if the operation succeeded, false otherwise.
+ Caveat: for now, only Text is supported."
%{
HANDLE hClip;
@@ -8790,25 +8877,6 @@
}
%}.
self primitiveFailed.
-!
-
-setClipboardObject:something owner:drawableId
- something isString ifTrue:[
- self setClipboardText:something owner:drawableId.
- ^ self
- ].
- ClipBoardObject := something.
-
- "Created: / 13.7.1999 / 13:30:37 / cg"
- "Modified: / 30.1.2000 / 11:59:41 / cg"
-!
-
-setClipboardText:something owner:drawableId
- ClipBoardObject := nil.
- ^ self setClipboardData:something
-
- "Created: / 13.7.1999 / 13:36:43 / cg"
- "Modified: / 30.1.2000 / 12:12:57 / cg"
! !
!WinWorkstation methodsFor:'color stuff'!
@@ -16985,7 +17053,7 @@
!WinWorkstation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.341 2007-03-14 15:34:54 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WinWorkstation.st,v 1.342 2007-04-04 14:18:07 stefan Exp $'
! !
WinWorkstation initialize!
--- a/bc.mak Tue Mar 20 22:04:49 2007 +0100
+++ b/bc.mak Wed Apr 04 16:18:07 2007 +0200
@@ -1,6 +1,6 @@
-# $Header: /cvs/stx/stx/libview/bc.mak,v 1.57 2007-01-16 13:00:27 stefan Exp $
+# $Header: /cvs/stx/stx/libview/bc.mak,v 1.58 2007-04-04 14:18:07 stefan Exp $
#
-# DO NOT EDIT
+# DO NOT EDIT
# automagically generated from the projectDefinition: stx_libview.
#
# Warning: once you modify this file, do not rerun
@@ -35,7 +35,7 @@
OBJS= $(COMMON_OBJS) $(WIN32_OBJS)
-ALL:: $(LIBDIR)\$(LIBNAME).lib $(BINDIR)\$(LIBNAME).dll
+ALL:: $(BINDIR)\$(LIBNAME).dll
!INCLUDE $(TOP)\rules\stdRules_bc
@@ -90,5 +90,6 @@
$(OUTDIR)StandardSystemView.$(O) StandardSystemView.$(H): StandardSystemView.st $(INCLUDE_TOP)\stx\libview\TopView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)ModalBox.$(O) ModalBox.$(H): ModalBox.st $(INCLUDE_TOP)\stx\libview\StandardSystemView.$(H) $(INCLUDE_TOP)\stx\libview\TopView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)WinWorkstation.$(O) WinWorkstation.$(H): WinWorkstation.st $(INCLUDE_TOP)\stx\libview\DeviceWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\HostGraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libview\DeviceHandle.$(H) $(STCHDR)
+$(OUTDIR)WinPrinter.$(O) WinPrinter.$(H): WinPrinter.st $(INCLUDE_TOP)\stx\libview\WinWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\DeviceWorkstation.$(H) $(INCLUDE_TOP)\stx\libview\HostGraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsDevice.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
# ENDMAKEDEPEND --- do not remove this line