diff -r 416e6abb408f -r e0e5da9b080b Cursor.st --- a/Cursor.st Thu Dec 19 14:36:49 1996 +0100 +++ b/Cursor.st Thu Dec 19 14:51:31 1996 +0100 @@ -22,7 +22,7 @@ category:'Graphics-Support' ! -!Cursor class methodsFor:'documentation'! +!Cursor class methodsFor:'documentation'! copyright " @@ -223,7 +223,7 @@ " ! ! -!Cursor class methodsFor:'initialization'! +!Cursor class methodsFor:'initialization'! flushDeviceCursors "unassign all cursors from their device" @@ -255,7 +255,7 @@ "Created: 15.6.1996 / 15:18:47 / cg" ! ! -!Cursor class methodsFor:'instance creation'! +!Cursor class methodsFor:'instance creation'! extent:extent fromArray:array offset:offset "create a new bitmap cursor from bits in the array argument @@ -284,14 +284,16 @@ |cursorBits maskBits| - cursorBits := Form fromFile:(cursorName , '_bits.bit'). + cursorBits := Image fromFile:('bitmaps/' , cursorName , '_bits.bit'). cursorBits notNil ifTrue:[ - maskBits := Form fromFile:(cursorName , '_mask.bit'). - maskBits notNil ifTrue:[ - ^ self sourceForm:cursorBits maskForm:maskBits - ] + maskBits := Image fromFile:('bitmaps/' , cursorName , '_mask.bit'). + maskBits notNil ifTrue:[ + ^ self sourceForm:cursorBits maskForm:maskBits + ] ]. ^ nil + + "Modified: 1.1.1970 / 13:57:27 / cg" ! imageArray:imageBits maskArray:maskBits @@ -473,7 +475,7 @@ ^ newCursor ! ! -!Cursor class methodsFor:'class initialization'! +!Cursor class methodsFor:'class initialization'! initializeNewCursors "Create the new cursors @@ -1379,7 +1381,7 @@ "Modified: 29.5.1996 / 15:03:44 / cg" ! ! -!Cursor class methodsFor:'default access'! +!Cursor class methodsFor:'default access'! defaultFgColor:fgColor defaultBgColor:bgColor "set the default colors used for cursors" @@ -1388,7 +1390,7 @@ DefaultBgColor := bgColor ! ! -!Cursor class methodsFor:'standard cursors'! +!Cursor class methodsFor:'standard cursors'! arrow "return an arrow (up-left-arrow) cursor" @@ -1875,79 +1877,81 @@ "ask that device for the cursor" shape notNil ifTrue:[ - id := aDevice createCursorShape:shape. - id isNil ifTrue:[ - 'CURSOR: no cursor with shape:' errorPrint. shape errorPrintNL. - ^ self - ]. + id := aDevice createCursorShape:shape. + id isNil ifTrue:[ + 'CURSOR: no cursor with shape:' errorPrint. shape errorPrintNL. + ^ self + ]. ] ifFalse:[ - aDevice needDeviceFormsForCursor ifTrue:[ - sourceForm notNil ifTrue:[ - sF := sourceForm on:aDevice. - ]. - maskForm notNil ifTrue:[ - mF := maskForm on:aDevice. - ]. - (sF notNil and:[mF notNil]) ifTrue:[ - sourceForm := sF. - maskForm := mF. - ]. - ] ifFalse:[ - sourceForm notNil ifTrue:[ - sF := sourceForm bits - ]. - maskForm notNil ifTrue:[ - mF := maskForm bits. - ]. - ]. - (sF isNil or:[mF isNil]) ifTrue:[ - 'CURSOR: cursor has no form' errorPrintNL. - ^ self - ]. - w := sourceForm width. - h := sourceForm height. + aDevice needDeviceFormsForCursor ifTrue:[ + sourceForm notNil ifTrue:[ + sF := sourceForm asFormOn:aDevice. + ]. + maskForm notNil ifTrue:[ + mF := maskForm asFormOn:aDevice. + ]. + (sF notNil and:[mF notNil]) ifTrue:[ + sourceForm := sF. + maskForm := mF. + ]. + ] ifFalse:[ + sourceForm notNil ifTrue:[ + sF := sourceForm bits + ]. + maskForm notNil ifTrue:[ + mF := maskForm bits. + ]. + ]. + (sF isNil or:[mF isNil]) ifTrue:[ + 'CURSOR: cursor has no form' errorPrintNL. + ^ self + ]. + w := sourceForm width. + h := sourceForm height. - id := aDevice createCursorSourceForm:sF - maskForm:mF - hotX:hotX - hotY:hotY - width:w - height:h. - id isNil ifTrue:[ - 'CURSOR: cannot create pixmap cursor' errorPrintNL. - ^ self - ]. + id := aDevice createCursorSourceForm:sF + maskForm:mF + hotX:hotX + hotY:hotY + width:w + height:h. + id isNil ifTrue:[ + 'CURSOR: cannot create pixmap cursor' errorPrintNL. + ^ self + ]. ]. "goody for IRIXs red cursor" DefaultFgColor notNil ifTrue:[ - aDevice colorCursor:id foreground:DefaultFgColor - background:DefaultBgColor + aDevice colorCursor:id foreground:DefaultFgColor + background:DefaultBgColor ]. device isNil ifTrue:[ - "receiver was not associated - do it now" - device := aDevice. - cursorId := id. + "receiver was not associated - do it now" + device := aDevice. + cursorId := id. - "must re-register, the old registration had a nil cursorId in it" - Lobby registerChange:self. - ^ self + "must re-register, the old registration had a nil cursorId in it" + Lobby registerChange:self. + ^ self ]. "receiver was already associated to another device - need a new cursor" newCursor := self class basicNew. shape notNil ifTrue:[ - newCursor setShape:shape. + newCursor setShape:shape. ] ifFalse:[ - newCursor setSourceForm:sourceForm - maskForm:maskForm - hotX:hotX - hotY:hotY + newCursor setSourceForm:sourceForm + maskForm:maskForm + hotX:hotX + hotY:hotY ]. newCursor setDevice:aDevice id:id. Lobby register:newCursor. ^ newCursor + + "Modified: 19.12.1996 / 13:52:55 / cg" ! restored @@ -1981,9 +1985,9 @@ hotY := hy. ! ! -!Cursor class methodsFor:'documentation'! +!Cursor class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.39 1996-07-23 14:25:58 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.40 1996-12-19 13:51:31 cg Exp $' ! ! Cursor initialize!