'From Squeak3.7-m17n of 21 July 2004 [latest update: #19] on 25 July 2004 at 3:48:06 pm'! "Change Set: grabScreen-sw Date: 25 July 2004 Author: Scott Wallace Adds two new tools to the (Squeakland) plug-in's Supplies bin for screen-grabbing. These were formerly only available in the new-morph menu. Derived from Squeakland update 0214 dated 5 July 04; a number of integration issues arose relating to the flaps registry"! ImageMorph subclass: #GrabPatchMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Widgets'! !GrabPatchMorph commentStamp: 'sw 8/1/2004 13:27' prior: 0! When an instance of GrabPatchMorph is dropped by the user, it signals a desire to do a screen-grab of a rectangular area.! ImageMorph subclass: #LassoPatchMorph instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Morphic-Widgets'! !LassoPatchMorph commentStamp: 'sw 8/1/2004 13:27' prior: 0! When dropped by the user, a cursor is presented, allowing the user to grab a rectangular patch from the screen.! !Flaps class methodsFor: 'construction support' stamp: 'sw 7/5/2004 17:54'! possiblyReplaceEToyFlaps "If in eToyFriendly mode, and if it's ok to reinitialize flaps, replace the existing flaps with up-too-date etoy flaps. Caution: this is destructive of existing flaps. If preserving the contents of existing flaps is important, set the preference 'okToReinitializeFlaps' to true" PartsBin thumbnailForPartsDescription: StickyPadMorph descriptionForPartsBin. "Puts StickyPadMorph's custom icon back in the cache which typically will have been called" (Preferences eToyFriendly and: [Preferences okToReinitializeFlaps]) ifTrue: [Flaps disableGlobalFlaps: false. Flaps addAndEnableEToyFlaps. Smalltalk isMorphic ifTrue: [ActiveWorld enableGlobalFlaps]]. "PartsBin clearThumbnailCache" "Flaps possiblyReplaceEToyFlaps"! ! !Flaps class methodsFor: 'predefined flaps' stamp: 'sw 7/25/2004 00:52'! defaultsQuadsDefiningPlugInSuppliesFlap "Answer a list of quads which define the objects to appear in the default Supplies flap used in the Plug-in image" ^ #( (ObjectsTool newStandAlone 'Object Catalog' 'A tool that lets you browse the catalog of available objects') (AllScriptsTool allScriptsToolForActiveWorld 'All Scripts' 'Stop, Step, and Go buttons for controlling all your scripts at once. The tool can also be "opened up" to control each script in your project individually.') (TrashCanMorph new 'Trash' 'A tool for discarding objects') (GrabPatchMorph new 'Grab Patch' 'Allows you to create a new Sketch by grabbing a rectangular patch from the screen') (LassoPatchMorph new 'Lasso' 'Allows you to create a new Sketch by lassoing an area from the screen') (StickyPadMorph newStandAlone 'Sticky Pad' 'Each time you obtain one of these pastel, translucent, borderless rectangles, it will be a different color from the previous time.') "(PaintInvokingMorph new 'Paint' 'Drop this into an area to start making a fresh painting there')" (TextMorph authoringPrototype 'Text' 'Text that you can edit into anything you desire.') (RecordingControlsMorph authoringPrototype 'Sound' 'A device for making sound recordings.') (RectangleMorph authoringPrototype 'Rectangle' 'A rectangle') (RectangleMorph roundRectPrototype 'RoundRect' 'A rectangle with rounded corners') (EllipseMorph authoringPrototype 'Ellipse' 'An ellipse or circle') (StarMorph authoringPrototype 'Star' 'A star') (CurveMorph authoringPrototype 'Curve' 'A curve') (PolygonMorph authoringPrototype 'Polygon' 'A straight-sided figure with any number of sides') (ScriptableButton authoringPrototype 'Button' 'A Scriptable button') (BookMorph nextPageButton 'NextPage' 'A button that takes you to the next page') (BookMorph previousPageButton 'PreviousPage' 'A button that takes you to the previous page') (ScriptingSystem prototypicalHolder 'Holder' 'A place for storing alternative pictures in an animation, etc.') (PasteUpMorph authoringPrototype 'Playfield' 'A place for assembling parts or for staging animations') (SimpleSliderMorph authoringPrototype 'Slider' 'A slider for showing and setting numeric values.') (JoystickMorph authoringPrototype 'Joystick' 'A joystick-like control') (BookMorph authoringPrototype 'Book' 'A multi-paged structure') (ClockMorph authoringPrototype 'Clock' 'A simple digital clock') (RandomNumberTile new 'Random' 'A random-number tile for use with tile scripting')) asOrderedCollection! ! !Flaps class methodsFor: 'replacement' stamp: 'sw 7/25/2004 00:56'! replaceGlobalFlapwithID: flapID "If there is a global flap with flapID, replace it with an updated one." | replacement tabs | (tabs _ self globalFlapTabsWithID: flapID) size = 0 ifTrue: [^ self]. tabs do: [:tab | self removeFlapTab: tab keepInList: false]. flapID = 'Stack Tools' translated ifTrue: [replacement _ self newStackToolsFlap]. flapID = 'Supplies' translated ifTrue: [replacement _ self newSuppliesFlapFromQuads: (Preferences eToyFriendly ifFalse: [self quadsDefiningSuppliesFlap] ifTrue: [self quadsDefiningPlugInSuppliesFlap]) positioning: #right]. flapID = 'Tools' translated ifTrue: [replacement _ self newToolsFlap]. flapID = 'Widgets' translated ifTrue: [replacement _ self newWidgetsFlap]. flapID = 'Navigator' translated ifTrue: [replacement _ self newNavigatorFlap]. flapID = 'Squeak' translated ifTrue: [replacement _ self newSqueakFlap]. replacement ifNil: [^ self]. self addGlobalFlap: replacement. self currentWorld ifNotNil: [self currentWorld addGlobalFlaps] "Flaps replaceFlapwithID: 'Widgets' translated "! ! !GrabPatchMorph methodsFor: 'initialization' stamp: 'sw 7/5/2004 01:51'! initialize "Initialize the receiver. Emblazon the GrabPatch icon on its face" super initialize. self image: (ScriptingSystem formAtKey: 'GrabPatch')! ! !GrabPatchMorph methodsFor: 'initialization' stamp: 'sw 7/5/2004 01:51'! initializeToStandAlone "Initialize the receiver. Emblazon the GrabPatch icon on its face" super initializeToStandAlone. self image: (ScriptingSystem formAtKey: 'GrabPatch')! ! !GrabPatchMorph methodsFor: 'misc' stamp: 'sw 7/5/2004 01:49'! isCandidateForAutomaticViewing "Answer whether the receiver is a candidate for automatic viewing. Only relevant if a now-seldom-used feature, automaticViewing, is in play" ^ self isPartsDonor not! ! !GrabPatchMorph methodsFor: 'dropping' stamp: 'sw 4/6/2004 15:52'! justDroppedInto: aPasteUpMorph event: anEvent "This message is sent to a dropped morph after it has been dropped on--and been accepted by--a drop-sensitive morph" aPasteUpMorph isPartsBin ifFalse: [self delete. ActiveWorld displayWorldSafely; runStepMethods. "But the HW cursor stays up still ???" ^ aPasteUpMorph grabDrawingFromScreen: anEvent]. ^ super justDroppedInto: aPasteUpMorph event: anEvent! ! !GrabPatchMorph methodsFor: 'dropping' stamp: 'sw 4/6/2004 14:40'! wantsToBeDroppedInto: aMorph "Only into PasteUps that are not part bins" ^ aMorph isPlayfieldLike! ! !GrabPatchMorph class methodsFor: 'instance creation' stamp: 'sw 7/5/2004 01:53'! authoringPrototype "Answer a prototype for use in a parts bin" ^ self new image: (ScriptingSystem formAtKey: 'GrabPatch'); markAsPartsDonor; setBalloonText: 'Use this to grab a rectangular patch from the screen'; yourself! ! !GrabPatchMorph class methodsFor: 'parts bin' stamp: 'sw 7/5/2004 01:51'! descriptionForPartsBin "Answer a description of the receiver's instances for a parts bin" ^ self partName: 'Grab Patch' categories: #('Graphics') documentation: 'Use this to grab a rectangular patch from the screen'! ! !LassoPatchMorph methodsFor: 'initialization' stamp: 'sw 7/5/2004 01:43'! initialize "Initialize the receiver. Sets its image to the lasso picture" super initialize. self image: (ScriptingSystem formAtKey: 'Lasso')! ! !LassoPatchMorph methodsFor: 'initialization' stamp: 'sw 7/5/2004 01:44'! initializeToStandAlone "Initialize the receiver such that it can live on its own. Sets its image to the lasso picture" super initializeToStandAlone. self image: (ScriptingSystem formAtKey: 'Lasso')! ! !LassoPatchMorph methodsFor: 'misc' stamp: 'sw 7/5/2004 01:50'! isCandidateForAutomaticViewing "Answer whether the receiver is a candidate for automatic viewing. Only relevant if a now-seldom-used feature, automaticViewing, is in play" ^ self isPartsDonor not! ! !LassoPatchMorph methodsFor: 'dropping' stamp: 'sw 4/6/2004 15:43'! justDroppedInto: aPasteUpMorph event: anEvent "This message is sent to a dropped morph after it has been dropped on--and been accepted by--a drop-sensitive morph" aPasteUpMorph isPartsBin ifFalse: [self delete. ActiveWorld displayWorldSafely; runStepMethods. ^ aPasteUpMorph grabLassoFromScreen: anEvent]. ^ super justDroppedInto: aPasteUpMorph event: anEvent! ! !LassoPatchMorph methodsFor: 'dropping' stamp: 'sw 4/6/2004 13:19'! wantsToBeDroppedInto: aMorph "Only into PasteUps that are not part bins" ^ aMorph isPlayfieldLike! ! !LassoPatchMorph class methodsFor: 'parts bin' stamp: 'sw 7/5/2004 01:46'! descriptionForPartsBin "Answer a description of the receiver to be used in a parts bin" ^ self partName: 'Lasso' categories: #('Graphics') documentation: 'Drop this icon to grab a patch from the screen with a lasso.'! ! !LassoPatchMorph class methodsFor: 'instance creation' stamp: 'sw 7/5/2004 01:53'! authoringPrototype "Answer a prototype for use in a parts bin" ^ self new image: (ScriptingSystem formAtKey: 'Lasso'); markAsPartsDonor; setBalloonText: 'Drop this on the desktop and you can then grab a patch from the screen with a lasso.'; yourself! ! "Postscript:" ScriptingSystem saveForm: (Form extent: 23@27 depth: 16 fromArray: #( 0 0 0 0 623453481 623453481 623453481 623453481 0 0 0 0 0 0 9513 623453481 623453481 623453481 623453481 623453481 623453481 0 0 0 0 9513 623453481 623453481 623453481 623453481 623453481 623453481 623453481 623453481 0 0 0 623453481 623453481 623443968 0 0 0 0 9513 623453481 623443968 0 0 623453481 623443968 0 0 0 0 0 0 623453481 623443968 0 9513 623453481 0 0 0 0 0 0 0 9513 623453481 0 9513 623443968 0 0 0 0 0 0 0 9513 623453481 0 623453481 623443968 0 0 0 0 0 0 0 0 623453481 0 623453481 623443968 0 0 0 0 0 0 0 0 623453481 623443968 623453481 623443968 0 0 0 0 0 0 0 0 623453481 623443968 9513 623443968 0 0 0 0 0 0 0 0 623453481 623443968 9513 623443968 0 0 0 0 0 0 0 0 623453481 623443968 9513 623453481 0 0 0 0 0 0 0 0 623453481 623443968 9513 623453481 0 0 0 0 0 0 0 0 623453481 623443968 0 623453481 623443968 0 0 0 0 0 0 0 623453481 623443968 0 9513 623453481 0 0 0 0 0 0 0 623453481 0 0 623453481 623453481 623443968 0 0 0 0 0 9513 623453481 0 0 623453481 623453481 623453481 623443968 0 0 0 0 9513 623453481 0 9513 623453481 0 623453481 623453481 623443968 0 0 623453481 623453481 623443968 0 9513 623453481 0 9513 623453481 623453481 623453481 623453481 623453481 623453481 0 0 9513 623453481 0 0 9513 623453481 623453481 623453481 623453481 0 0 0 0 623453481 623443968 0 0 0 623453481 623443968 0 0 0 0 0 9513 623453481 0 0 0 0 0 0 0 0 0 0 0 623453481 623453481 0 0 0 0 0 0 0 0 0 0 9513 623453481 623453481 0 0 0 0 0 0 0 0 0 0 623453481 623453481 0 0 0 0 0 0 0 0 0 0 0 623453481 0 0 0 0 0 0 0) offset: 0@0) atKey: #Lasso. ScriptingSystem saveForm: (Form extent: 31@23 depth: 16 fromArray: #( 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384 1177634353 1177616384 0 0 0 0 0 0 0 0 0 0 0 0 1177634353 1177616384 1177634353 1177616384 0 0 0 0 0 0 0 0 0 0 0 0 1177634353 1177616384 1177634353 1177616384 0 0 0 0 0 0 0 0 0 0 0 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 0 0 0 0 0 0 17969 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 17969 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 0 1177634353 1177616384 1177634353 1177616384 0 0 0 0 0 0 0 0 0 0 0 0 1177634353 1177616384 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177634353 1177616384) offset: 0@0) atKey: #GrabPatch. PartsBin thumbnailForPartsDescription: StickyPadMorph descriptionForPartsBin. Flaps registeredFlapsQuads at: 'PlugIn Supplies' put: Flaps defaultsQuadsDefiningPlugInSuppliesFlap. Flaps possiblyReplaceEToyFlaps.!