[squeak-dev] The Inbox: MorphicExtras-dtl.215.mcz
commits at source.squeak.org
commits at source.squeak.org
Sun Nov 12 15:49:23 UTC 2017
David T. Lewis uploaded a new version of MorphicExtras to project The Inbox:
http://source.squeak.org/inbox/MorphicExtras-dtl.215.mcz
==================== Summary ====================
Name: MorphicExtras-dtl.215
Author: dtl
Time: 12 November 2017, 10:49:12.947981 am
UUID: f2cff994-4297-4693-8d24-3c78b286a1ca
Ancestors: MorphicExtras-dtl.214
Use "self world" instead of "Project current word" in Morph methods, and update a couple more methods.
=============== Diff against MorphicExtras-dtl.214 ===============
Item was changed:
----- Method: BookMorph>>loadImagesIntoBook (in category 'menu') -----
loadImagesIntoBook
"PowerPoint stores GIF presentations as individual slides named Slide1, Slide2, etc.
Load these into the book. mjg 9/99"
| directory filenumber form newpage |
directory := ((StandardFileMenu oldFileFrom: FileDirectory default)
ifNil: [^nil]) directory.
directory isNil ifTrue: [^nil].
"Start loading 'em up!!"
filenumber := 1.
[directory fileExists: 'Slide' , filenumber asString] whileTrue:
[Transcript
show: 'Slide' , filenumber asString;
cr.
Smalltalk bytesLeft < 1000000
ifTrue:
["Make some room"
(self valueOfProperty: #url) isNil
ifTrue: [self savePagesOnURL]
ifFalse: [self saveAsNumberedURLs]].
form := Form
fromFileNamed: (directory fullNameFor: 'Slide' , filenumber asString).
newpage := PasteUpMorph new extent: form extent.
+ newpage addMorph: (self world drawingClass withForm: form).
- newpage addMorph: (Project current world drawingClass withForm: form).
self pages addLast: newpage.
filenumber := filenumber + 1].
"After adding all, delete the first page."
self goToPage: 1.
self deletePageBasic.
"Save the book"
(self valueOfProperty: #url) isNil
ifTrue: [self savePagesOnURL]
ifFalse: [self saveAsNumberedURLs]!
Item was changed:
----- Method: GeePrinterPage>>fullDrawPostscriptOn: (in category 'Postscript Canvases') -----
fullDrawPostscriptOn: aCanvas
| s |
s := TextMorph new
beAllFont: (TextStyle default fontOfSize: 30);
contentsAsIs: ' Drawing page ',pageNumber printString,' of ',totalPages printString,' '.
s layoutChanged; fullBounds.
s := AlignmentMorph newRow
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
addMorph: s;
color: Color yellow.
s position: Display center - (s width // 2 @ 0).
+ Project current world addMorphFront: s;
+ displayWorld.
- World addMorphFront: s.
- World displayWorld.
printSpecs drawAsBitmapFlag ifTrue: [
aCanvas paintImage: self pageAsForm at: 0 at 0
] ifFalse: [
aCanvas
translateTo: bounds origin negated
clippingTo: (0 at 0 extent: bounds extent)
during: [ :c |
pasteUp fullDrawForPrintingOn: c
].
].
s delete.
!
Item was changed:
RectangleMorph subclass: #GradientFillMorph
instanceVariableNames: 'fillColor2 gradientDirection colorArray colorDepth'
classVariableNames: ''
poolDictionaries: ''
category: 'MorphicExtras-Widgets'!
+ !GradientFillMorph commentStamp: 'dtl 11/11/2017 22:32' prior: 0!
- !GradientFillMorph commentStamp: 'nice 3/25/2010 23:01' prior: 0!
Class GradientFillMorph is obsolete. For getting gradient fills use a BorderedMorph with an appropriate fill style, e.g.,
| morph fs |
morph := BorderedMorph new.
fs := GradientFillStyle ramp: {0.0 -> Color red. 1.0 -> Color green}.
fs origin: morph bounds center.
fs direction: (morph bounds width // 2) @ 0.
fs radial: true.
morph fillStyle: fs.
+ Project current world primaryHand attachMorph: morph.
- World primaryHand attachMorph: morph.
Here's the old (obsolete) comment:
GradientFills cache an array of bitpatterns for the colors across their rectangle. It costs a bit of space, but makes display fast enough to eschew the use of a bitmap. The array must be recomputed whenever the colors, dimensions or display depth change.!
Item was changed:
----- Method: GraphicalDictionaryMenu>>handMeOne (in category 'menu commands') -----
handMeOne
+ self currentHand attachMorph: (self world drawingClass new form: (formChoices at: currentIndex))!
- self currentHand attachMorph: (Project current world drawingClass new form: (formChoices at: currentIndex))!
Item was changed:
----- Method: ProjectSorterMorph>>addControls (in category 'initialization') -----
addControls
"Add the control bar at the top of the tool."
| b r partsBinButton newButton aWrapper |
+ newButton := ImageMorph new image: (World project makeThumbnail scaledToSize: 48 at 36).
- newButton := ImageMorph new image: (Project current makeThumbnail scaledToSize: 48 at 36).
newButton on: #mouseDown send: #insertNewProject: to: self.
newButton setBalloonText: 'Make a new Project' translated.
(partsBinButton := UpdatingThreePhaseButtonMorph checkBox)
target: self;
actionSelector: #togglePartsBinStatus;
arguments: #();
getSelector: #getPartsBinStatus.
(r := AlignmentMorph newRow)
color: Color transparent;
borderWidth: 0;
layoutInset: 0;
cellInset: 10 at 0;
wrapCentering: #center;
cellPositioning: #leftCenter;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap;
extent: 5 at 5.
b := SimpleButtonMorph new target: self; color: self defaultColor darker;
borderColor: Color black.
r addMorphBack: (self wrapperFor: (b label: 'Okay' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #acceptSort)).
b := SimpleButtonMorph new target: self; color: self defaultColor darker;
borderColor: Color black.
r addMorphBack: (self wrapperFor: (b label: 'Cancel' translated font: ScriptingSystem fontForEToyButtons; actionSelector: #delete));
addTransparentSpacerOfSize: 8 @ 0;
addMorphBack: (self wrapperFor: (newButton));
addTransparentSpacerOfSize: 8 @ 0.
aWrapper := AlignmentMorph newRow beTransparent.
aWrapper cellInset: 0; layoutInset: 0; borderWidth: 0.
aWrapper
addMorphBack: (self wrapperFor: partsBinButton);
addMorphBack: (self wrapperFor: (StringMorph contents: 'Parts bin' translated font: ScriptingSystem fontForEToyButtons) lock).
r addMorphBack: aWrapper.
self addMorphFront: r.
!
Item was changed:
----- Method: SpeakerMorph>>addGraphic (in category 'initialization') -----
addGraphic
| graphic |
+ graphic := self world drawingClass withForm: self speakerGraphic.
- graphic := Project current world drawingClass withForm: self speakerGraphic.
graphic position: bounds center - (graphic extent // 2).
self addMorph: graphic.
!
Item was changed:
----- Method: TabbedPalette class>>authoringPrototype (in category 'scripting') -----
authoringPrototype
| aTabbedPalette aBook aTab |
aTabbedPalette := self new markAsPartsDonor.
aTabbedPalette pageSize: 200 @ 300.
aTabbedPalette tabsMorph highlightColor: Color red regularColor: Color blue.
aTabbedPalette addMenuTab.
aBook := BookMorph new setNameTo: 'one'; pageSize: aTabbedPalette pageSize.
aBook color: Color blue muchLighter.
aBook removeEverything; insertPage; showPageControls.
+ aBook currentPage addMorphBack: (self world drawingClass withForm: ScriptingSystem squeakyMouseForm).
- aBook currentPage addMorphBack: (Project current world drawingClass withForm: ScriptingSystem squeakyMouseForm).
aTab := aTabbedPalette addTabForBook: aBook.
aBook := BookMorph new setNameTo: 'two'; pageSize: aTabbedPalette pageSize.
aBook color: Color red muchLighter.
aBook removeEverything; insertPage; showPageControls.
aBook currentPage addMorphBack: CurveMorph authoringPrototype.
aTabbedPalette addTabForBook: aBook.
aTabbedPalette selectTab: aTab.
aTabbedPalette beSticky.
aTabbedPalette tabsMorph hResizing: #spaceFill.
^ aTabbedPalette!
Item was changed:
----- Method: TabbedPalette>>addMenuTab (in category 'palette menu') -----
addMenuTab
"Add the menu tab. This is ancient code, not much in the spirit of anything current"
| aMenu aTab aGraphic sk |
aMenu := MenuMorph new defaultTarget: self.
aMenu stayUp: true.
"aMenu add: 'clear' translated action: #showNoPalette."
aMenu add: 'sort tabs' translated action: #sortTabs:.
aMenu add: 'choose new colors for tabs' translated action: #recolorTabs.
aMenu setProperty: #paletteMenu toValue: true.
"aMenu add: 'make me the Standard palette' translated action: #becomeStandardPalette."
aTab := self addTabForBook: aMenu withBalloonText: 'a menu of palette-related controls' translated.
aTab highlightColor: tabsMorph highlightColor; regularColor: tabsMorph regularColor.
tabsMorph laySubpartsOutInOneRow; layoutChanged.
aGraphic := ScriptingSystem formAtKey: 'TinyMenu'.
aGraphic ifNotNil:
[aTab removeAllMorphs.
+ aTab addMorph: (sk := self world drawingClass withForm: aGraphic).
- aTab addMorph: (sk := Project current world drawingClass withForm: aGraphic).
sk position: aTab position.
sk lock.
aTab fitContents].
self layoutChanged!
More information about the Squeak-dev
mailing list
|