The Trunk: MorphicExtras-ul.94.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: MorphicExtras-ul.94.mcz

commits-2
Levente Uzonyi uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-ul.94.mcz

==================== Summary ====================

Name: MorphicExtras-ul.94
Author: ul
Time: 16 November 2010, 5:23:10.252 am
UUID: 76d7c3ca-a550-3b4c-9fce-50f56da22c63
Ancestors: MorphicExtras-ul.93

- use #= for integer comparison instead of #== (http://bugs.squeak.org/view.php?id=2788 )

=============== Diff against MorphicExtras-ul.93 ===============

Item was changed:
  ----- Method: CommandHistory>>undoTo (in category 'called from the ui') -----
  undoTo
  "Not yet functional, and not yet sent.  Allow the user to choose a point somewhere in the undo/redo tape, and undo his way to there.   Applicable only if infiniteUndo is set. "
 
  | anIndex commandList reply |
+ (anIndex := self historyIndexOfLastCommand) = 0 ifTrue: [^ Beeper beep].
- (anIndex := self historyIndexOfLastCommand) == 0 ifTrue: [^ Beeper beep].
  commandList := history
  copyFrom: ((anIndex - 10) max: 1)
  to: ((anIndex + 10) min: history size).
  reply := UIManager default chooseFrom: (commandList collect: [:cmd | cmd cmdWording truncateWithElipsisTo: 20]) values: commandList title: 'undo or redo to...'.
  reply ifNotNil: [self inform: #deferred]
 
  "ActiveWorld commandHistory undoTo"
  !

Item was changed:
  ----- Method: FrameRateMorph>>step (in category 'stepping and presenter') -----
  step
  "Compute and display (every half second or so) the current framerate"
 
  | now mSecs mSecsPerFrame framesPerSec newContents |
  framesSinceLastDisplay := framesSinceLastDisplay + 1.
  now := Time millisecondClockValue.
  mSecs := now - lastDisplayTime.
  (mSecs > 500 or: [mSecs < 0 "clock wrap-around"]) ifTrue:
  [mSecsPerFrame := mSecs // framesSinceLastDisplay.
  framesPerSec := (framesSinceLastDisplay * 1000) // mSecs.
+ newContents := mSecsPerFrame printString, ' mSecs (', framesPerSec printString, ' frame', (framesPerSec = 1 ifTrue: [''] ifFalse: ['s']), '/sec)'.
- newContents := mSecsPerFrame printString, ' mSecs (', framesPerSec printString, ' frame', (framesPerSec == 1 ifTrue: [''] ifFalse: ['s']), '/sec)'.
  self contents: newContents.
  lastDisplayTime := now.
  framesSinceLastDisplay := 0]!

Item was changed:
  ----- Method: PostscriptCanvas class>>postscriptFontInfoForFont: (in category 'font mapping') -----
  postscriptFontInfoForFont: font
 
  | decoded decodedName keys match fontName |
 
  fontName := font textStyleName asString.
  decoded := TextStyle decodeStyleName: fontName.
  decodedName := decoded second.
  keys := self fontMap keys asArray sort: [ :a :b | a size > b size ].
 
  match := keys select: [ :k | decoded first = k or: [ fontName = k ] ].
  match do: [ :key | | subD desired mask |
  subD := self fontMap at: key.
  desired := font emphasis.
  mask := 31.
  [
  desired := desired bitAnd: mask.
  subD at: desired ifPresent: [ :answer | ^answer].
  mask := mask bitShift: -1.
  desired > 0
  ] whileTrue.
  ].
 
  "No explicit lookup found; try to convert the style name into the canonical Postscript name.
  This name will probably still be wrong."
 
  fontName := String streamContents: [ :s |
  s nextPutAll: decodedName.
  decoded third do: [ :nm | s nextPut: $-; nextPutAll: nm ].
 
+ (font emphasis = 0 and: [ (decoded last includes: 0) not ])
- (font emphasis == 0 and: [ (decoded last includes: 0) not ])
  ifTrue: [ s nextPutAll:  '-Regular' ].
 
+ (font emphasis = 1 and: [ (decoded first anyMask: 1) not ])
- (font emphasis == 1 and: [ (decoded first anyMask: 1) not ])
  ifTrue: [ s nextPutAll:  '-Bold' ].
 
+ (font emphasis = 2 and: [ (decoded first anyMask: 2) not ])
- (font emphasis == 2 and: [ (decoded first anyMask: 2) not ])
  ifTrue: [ s nextPutAll:  '-Italic' ].
 
+ (font emphasis = 3 and: [ (decoded first anyMask: 3) not ])
- (font emphasis == 3 and: [ (decoded first anyMask: 3) not ])
  ifTrue: [ s nextPutAll:  '-BoldItalic' ].
  ].
 
  ^ {fontName. 1.0}
  !

Item was changed:
  ----- Method: PostscriptCanvas>>endGStateForMorph: (in category 'private') -----
  endGStateForMorph: aMorph
 
+ morphLevel = 1
- morphLevel == 1
  ifTrue: [ target showpage; print: 'grestore'; cr ]!

Item was changed:
  ----- Method: PostscriptCanvas>>setupGStateForMorph: (in category 'private') -----
  setupGStateForMorph: aMorph
 
+ morphLevel = 1
- morphLevel == 1
  ifTrue: [self writePageSetupFor: aMorph]!

Item was changed:
  ----- Method: ReferenceMorph>>fitContents (in category 'misc') -----
  fitContents
+ submorphs size = 1 ifTrue:
- submorphs size == 1 ifTrue:
  [self extent: submorphs first extent + (2 * self borderWidth).
  submorphs first position: self position + self borderWidth]!

Item was changed:
  ----- Method: SketchEditorMorph>>setRotations: (in category 'start & finish') -----
  setRotations: num
  "Tell the palette what number of rotations (or background) to show.  "
 
  | key |
  key := 'ItTurns'. "default and value for num > 1"
+ num = 1 ifTrue: [key := 'JustAsIs'].
+ num = 18 ifTrue: [key := 'ItTurns'].
+ num = 99 ifTrue: [key := 'ToAndFro'].
- num == 1 ifTrue: [key := 'JustAsIs'].
- num == 18 ifTrue: [key := 'ItTurns'].
- num == 99 ifTrue: [key := 'ToAndFro'].
  num == #Background ifTrue: [key := 'Background'].
  num == #Repeated ifTrue: [key := 'Repeated'].
  palette setRotations: (palette contentsAtKey: key).!

Item was changed:
  ----- Method: SorterTokenMorph>>fitContents (in category 'as yet unclassified') -----
  fitContents
+ submorphs size = 1 ifTrue: [self bounds: (submorphs first bounds insetBy: (-1 @ -1))]!
- submorphs size == 1 ifTrue: [self bounds: (submorphs first bounds insetBy: (-1 @ -1))]!