Skip to content

Commit

Permalink
updated for Cuis 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
jvuletich committed Feb 26, 2013
1 parent 046c91f commit e01cf43
Show file tree
Hide file tree
Showing 5 changed files with 235 additions and 179 deletions.
47 changes: 24 additions & 23 deletions ExtendedClipboard.pck 100644 → 100755
@@ -1,4 +1,4 @@
'From Cuis 4.0 of 3 April 2012 [latest update: #1260] on 17 April 2012 at 11:21:08 pm'!
'From Cuis 4.1 of 12 December 2012 [latest update: #1616] on 25 February 2013 at 3:44:13 pm'!
'Description Please enter a description for this package.'!
!classDefinition: #ExtendedClipboardInterface category: #ExtendedClipboard!
Object subclass: #ExtendedClipboardInterface
Expand Down Expand Up @@ -119,9 +119,10 @@ fromRefStreamBytes: bytes
fromTIFFBytes: bytes
^ (TIFFReadWriter on: bytes readStream) nextImage! !

!ExtendedClipboardInterface methodsFor: 'object from raw data' stamp: 'jmv 3/13/2012 16:23'!
!ExtendedClipboardInterface methodsFor: 'object from raw data' stamp: 'jmv 2/25/2013 14:34'!
fromUTF8Bytes: bytes
^ bytes asString utf8ToISO8859s15 withCuisLineEndings! !

^(String fromUtf8: bytes hex: false trimLastNull: true) withCuisLineEndings! !

!ExtendedClipboardInterface methodsFor: 'private' stamp: 'jmv 1/18/2011 14:47'!
getClipboardFormat: formatNumber
Expand Down Expand Up @@ -286,13 +287,13 @@ storeForm: aForm id: otherString
"
self addClipboardData: otherString dataFormat: 'cuis-id'! !

!ExtendedClipboardMacInterface methodsFor: 'api - store' stamp: 'jmv 3/14/2012 09:33'!
!ExtendedClipboardMacInterface methodsFor: 'api - store' stamp: 'jmv 2/14/2013 12:21'!
storeString: aString id: otherString
"I presume the order is: most preferred format first, least desirable format last.
Cuis object id at the end."
self clearClipboard.
self
addClipboardData: aString iso8859s15ToUtf8
addClipboardData: aString asUtf8
dataFormat: 'public.utf8-plain-text'.
"Could be done in addition (maybe with cr line ending?)
self
Expand All @@ -301,7 +302,7 @@ storeString: aString id: otherString
"
self addClipboardData: otherString dataFormat: 'cuis-id'! !

!ExtendedClipboardMacInterface methodsFor: 'api - store' stamp: 'jmv 3/14/2012 09:29'!
!ExtendedClipboardMacInterface methodsFor: 'api - store' stamp: 'jmv 2/14/2013 12:21'!
storeText: aText id: otherString
"I presume the order is: most preferred format first, least desirable format last.
Cuis object id is usually at the end, but don't include it if we include a streamed representation."
Expand All @@ -315,7 +316,7 @@ storeText: aText id: otherString

"Just the string"
self
addClipboardData: aText asString iso8859s15ToUtf8
addClipboardData: aText asString asUtf8
dataFormat: 'public.utf8-plain-text'.

"If we store a streamed representation, don't store the id. In these cases, we prefer rebuilding the object, regardless of
Expand Down Expand Up @@ -436,15 +437,15 @@ Tom\u225? ag\u252?ita, \u241?and\u250?. \u209?and\u250?. \par \u339?\u381?\u174?
addClipboardData: text rtfString dataFormat: 'public.rtf'.
self assert: Clipboard default retrieveObject = text.! !

!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 4/6/2011 14:29'!
!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 12/7/2012 22:27'!
testStar16BitToAndFromImageClipboard
"
ExtendedClipboardTest new testStar16BitToAndFromImageClipboard
"
| form form1 form2 |
form _ (StarMorph new
extent: 100@100;
imageForm) asFormOfDepth: 16.
form _ EllipseMorph new
morphExtent: 100@100;
imageForm: 16.

"This will use a refStreamed object"
Clipboard default storeObject: form.
Expand All @@ -462,15 +463,15 @@ testStar16BitToAndFromImageClipboard
form1 addDeltasFrom: form2.
self assert: form1 primCountBits = 0 description: 'Form copyPasted from Clipboard appears to be bad.'.! !

!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 4/6/2011 14:29'!
!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 12/7/2012 22:27'!
testStar8BitToAndFromImageClipboard
"
ExtendedClipboardTest new testStar8BitToAndFromImageClipboard
"
| form form1 form2 |
form _ (StarMorph new
extent: 100@100;
imageForm) asFormOfDepth: 8.
form _ EllipseMorph new
morphExtent: 100@100;
imageForm: 8.

"This will use a refStreamed object"
Clipboard default storeObject: form.
Expand All @@ -488,15 +489,15 @@ testStar8BitToAndFromImageClipboard
form1 addDeltasFrom: form2.
self assert: form1 primCountBits = 0 description: 'Form copyPasted from Clipboard appears to be bad.'.! !

!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 4/6/2011 14:29'!
!ExtendedClipboardTest methodsFor: 'testing' stamp: 'jmv 12/7/2012 22:28'!
testStarToAndFromImageClipboard
"
ExtendedClipboardTest new testStarToAndFromImageClipboard
"
| form form1 form2 |
form _ StarMorph new
extent: 100@100;
imageForm.
form _ EllipseMorph new
morphExtent: 100@100;
imageForm: 32.

"This will use a refStreamed object"
Clipboard default storeObject: form.
Expand Down Expand Up @@ -566,17 +567,17 @@ storeForm: aForm id: otherString
self addClipboardData: (PNGReadWriter bytesFor: aForm) dataFormat: 'image/png'.
self addClipboardData: otherString dataFormat: 'cuis-id'! !

!ExtendedClipboardUnixInterface methodsFor: 'api - store' stamp: 'jmv 3/14/2012 09:30'!
!ExtendedClipboardUnixInterface methodsFor: 'api - store' stamp: 'jmv 2/14/2013 12:21'!
storeString: aString id: otherString
"I presume the order is: most preferred format first, least desirable format last.
Cuis object id at the end."
self clearClipboard.
self
addClipboardData: aString iso8859s15ToUtf8
addClipboardData: aString asUtf8
dataFormat: 'UTF8_STRING'.
self addClipboardData: otherString dataFormat: 'cuis-id'! !

!ExtendedClipboardUnixInterface methodsFor: 'api - store' stamp: 'jmv 3/14/2012 09:31'!
!ExtendedClipboardUnixInterface methodsFor: 'api - store' stamp: 'jmv 2/14/2013 12:21'!
storeText: aText id: otherString
"I presume the order is: most preferred format first, least desirable format last.
Cuis object id is usually at the end, but don't include it if we include a streamed representation."
Expand All @@ -592,7 +593,7 @@ storeText: aText id: otherString
dataFormat: '????'
"
self
addClipboardData: aText asString iso8859s15ToUtf8
addClipboardData: aText asString asUtf8
dataFormat: 'UTF8_STRING'.

"If we store a streamed representation, don't store the id. In these cases, we prefer rebuilding the object, regardless of
Expand Down
6 changes: 4 additions & 2 deletions RTFImporting.pck 100644 → 100755
Expand Up @@ -253,7 +253,8 @@ To do:
(el builder es solo para StyledText... Yo quisiera que esto sea mas general!!)!

!RTFTextConverter commentStamp: '<historical>' prior: 0!
The abstract class for all different type of text converters. nextFromStream: and nextPut:toStream: are the public accessible methods. If you are going to make a subclass for a stateful text conversion, you should override restoreStateOf:with: and saveStateOf: along the line of CompoundTextConverter.!
The abstract class for all different type of text converters. nextFromStream: and nextPut:toStream: are the public accessible methods. If you are going to make a subclass for a stateful text conversion, you should override restoreStateOf:with: and saveStateOf: along the line of CompoundTextConverter.
!

!RTFToken commentStamp: '<historical>' prior: 0!
token types:
Expand All @@ -275,7 +276,8 @@ At initialization last is nil. Must getToken to get first
newline is a Mac-hack. No newlines are expected in a RTF, but Mac makes escaped newlines!

!RTFUnicode commentStamp: '<historical>' prior: 0!
Not a real Unicode implementation. Just compatibility for Sophie-RTF. Answers instances of Character (i.e. ISO-8859-15).Based on http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT!
Not a real Unicode implementation. Just compatibility for Sophie-RTF. Answers instances of Character (i.e. ISO-8859-15).
Based on http://www.unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT!

!RTFCP1250UnicodeTextConverter methodsFor: 'conversion' stamp: 'tat 8/2/2006 22:49'!
toSqueak: char
Expand Down
6 changes: 3 additions & 3 deletions RTFTests.pck 100644 → 100755
@@ -1,4 +1,4 @@
'From Cuis 4.0 of 3 April 2012 [latest update: #1260] on 17 April 2012 at 11:21:18 pm'!
'From Cuis 4.0 of 21 April 2012 [latest update: #1510] on 7 December 2012 at 10:46:06 pm'!
'Description Please enter a description for this package.'!
!classDefinition: #RTFConversionTest category: #RTFtests!
TestCase subclass: #RTFConversionTest
Expand Down Expand Up @@ -678,15 +678,15 @@ textSample4
(Text string: 'normal ' attributes: #())
)! !

!RTFConversionTest class methodsFor: 'text samples' stamp: 'jmv 3/30/2011 11:23'!
!RTFConversionTest class methodsFor: 'text samples' stamp: 'jmv 12/7/2012 22:38'!
textSample5
"
| text |
text _ RTFConversionTest textSample5.
text edit.
Clipboard default storeObject: text
"
^'Hello', (Text withForm: EllipseMorph new imageForm), 'world'! !
^'Hello', (Text withForm: (EllipseMorph new imageForm: 32)), 'world'! !

!RTFConversionTest class methodsFor: 'text samples' stamp: 'jmv 11/22/2011 15:00'!
textSample6
Expand Down

0 comments on commit e01cf43

Please sign in to comment.