[squeak-dev] The Trunk: Morphic-ar.355.mcz
commits at source.squeak.org
commits at source.squeak.org
Fri Feb 26 15:39:14 UTC 2010
Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ar.355.mcz
==================== Summary ====================
Name: Morphic-ar.355
Author: ar
Time: 26 February 2010, 4:35:51.83 pm
UUID: 3290131d-f753-7a42-9860-6bf8f6eb7b02
Ancestors: Morphic-HenrikSperreJohansen.354
Newspeak-style frame adornments (like triangle in the top right corner to indicate dirty state). Polymorph had a nice procedural version for different colors so we don't need to use the original art.
=============== Diff against Morphic-HenrikSperreJohansen.354 ===============
Item was added:
+ ----- Method: PluggableTextMorph>>drawFrameAdornment:on: (in category 'drawing') -----
+ drawFrameAdornment: aColor on: aCanvas
+ "Indicate edit status for the text editor"
+
+ | form |
+ "The old frame adornment style in case you care"
+ false ifTrue:[^aCanvas frameRectangle: self innerBounds width: 2 color: aColor].
+
+ "Class-side adornment cache is currently using pre-multiplied alpha,
+ so we need to use rule 34 which works for < 32bpp, too."
+ form := self class adornmentWithColor: aColor.
+ aCanvas image: form at: (self innerBounds topRight - (form width at 0))
+ sourceRect: form boundingBox rule: 34.
+ !
Item was changed:
ScrollPane subclass: #PluggableTextMorph
instanceVariableNames: 'textMorph getTextSelector setTextSelector getSelectionSelector hasUnacceptedEdits askBeforeDiscardingEdits selectionInterval hasEditingConflicts'
+ classVariableNames: 'AdornmentCache'
- classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Pluggable Widgets'!
Item was added:
+ ----- Method: PluggableTextMorph class>>flushAdornmentCache (in category 'frame adornments') -----
+ flushAdornmentCache
+ "Cache for frame adornments"
+
+ AdornmentCache := nil!
Item was added:
+ ----- Method: PluggableTextMorph class>>adornmentCache (in category 'frame adornments') -----
+ adornmentCache
+ "Cache for frame adornments"
+
+ ^AdornmentCache ifNil:[AdornmentCache := Dictionary new].!
Item was added:
+ ----- Method: PluggableTextMorph class>>adornmentWithColor: (in category 'frame adornments') -----
+ adornmentWithColor: aColor
+ "Create and return a frame adornment with the given color"
+
+ | size box form fillStyle |
+ ^self adornmentCache at: aColor ifAbsentPut:[
+ size := 25.
+ box := 0 at 0 extent: size asPoint.
+ form := Form extent: size at size depth: 32.
+ fillStyle := (GradientFillStyle ramp: {
+ 0.0->(Color white alpha: 0.01).
+ 0.8->aColor.
+ 1.0->aColor})
+ origin: box topRight - (size at 0);
+ direction: (size @ size negated) // 4;
+ radial: false.
+ form getCanvas drawPolygon: {
+ box topRight.
+ box topRight + (0 at size).
+ box topRight - (size at 0)
+ } fillStyle: fillStyle.
+ form].
+ !
Item was changed:
----- Method: PluggableTextMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
"Include a thin red inset border for unaccepted edits, or, if the unaccepted edits are known to conflict with a change made somewhere else to the same method (typically), put a thick red frame"
super drawOn: aCanvas.
self wantsFrameAdornments ifTrue:
[(model notNil and: [model refusesToAcceptCode])
ifTrue: "Put up feedback showing that code cannot be submitted in this state"
+ [self drawFrameAdornment: Color tan on: aCanvas]
- [aCanvas frameRectangle: self innerBounds width: 2 color: Color tan]
ifFalse:
[self hasEditingConflicts
ifTrue:
+ [self drawFrameAdornment: Color red on: aCanvas]
- [aCanvas frameRectangle: self innerBounds width: 3 color: Color red]
ifFalse:
[self hasUnacceptedEdits
ifTrue:
[model wantsDiffFeedback
ifTrue:
+ [self drawFrameAdornment: Color yellow on: aCanvas]
- [aCanvas frameRectangle: self innerBounds width: 3 color: Color green]
ifFalse:
+ [self drawFrameAdornment: Color orange on: aCanvas]]
- [aCanvas frameRectangle: self innerBounds width: 1 color: Color red]]
ifFalse:
[model wantsDiffFeedback
ifTrue:
+ [self drawFrameAdornment: Color green on: aCanvas]]]]]!
- [aCanvas frameRectangle: self innerBounds width: 1 color: Color green]]]]]!
More information about the Squeak-dev
mailing list
|