The Trunk: Morphic-mt.1034.mcz

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

The Trunk: Morphic-mt.1034.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1034.mcz

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

Name: Morphic-mt.1034
Author: mt
Time: 12 November 2015, 10:10:27.351 am
UUID: c4e7c7d2-2f19-4f9f-b059-59f07edbe975
Ancestors: Morphic-mt.1033

Adds support for a text color to list morphs.

=============== Diff against Morphic-mt.1033 ===============

Item was changed:
  ----- Method: LazyListMorph>>display:atRow:on: (in category 'drawing') -----
  display: item atRow: row on: canvas
  "display the given item at row row"
 
  | drawBounds emphasized rowColor itemAsText |
  itemAsText := item asStringOrText.
 
  "If it is a text, we will only use the first character's emphasis."
  emphasized := itemAsText isText
  ifTrue: [font emphasized: (itemAsText emphasisAt: 1)]
  ifFalse: [font].
 
+ rowColor := itemAsText isText
+ ifTrue: [itemAsText colorAt: 1 ifNone: [self colorForRow: row]]
+ ifFalse: [self colorForRow: row].
- rowColor := self colorForRow: row.
 
  drawBounds := (self drawBoundsForRow: row) translateBy: (self hMargin @ 0).
  drawBounds := drawBounds intersect: self bounds.
 
  "Draw icon if existing. Adjust draw bounds in that case."
  (self icon: row) ifNotNil: [ :icon || top |
  top := drawBounds top + ((drawBounds height - icon height) // 2).
  canvas translucentImage: icon at: drawBounds left @ top.
  drawBounds := drawBounds left: drawBounds left + icon width + 2 ].
 
  "Draw filter matches if any."
  (self filterOffsets: row) do: [:offset |
  canvas
  frameAndFillRoundRect: ((drawBounds left + offset first) @ drawBounds top corner: (drawBounds left + offset last) @ drawBounds bottom)
  radius: 3
  fillStyle: self class listFilterHighlightColor
  borderWidth: 1
  borderColor: self class listFilterHighlightColor twiceDarker].
 
  "We will only draw strings here."
  canvas
  drawString: itemAsText asString
  in: drawBounds
  font: emphasized
  color: rowColor.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1034.mcz

Chris Muller-3
Rock on!  Great fix!

On Thu, Nov 12, 2015 at 3:10 AM,  <[hidden email]> wrote:

> Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-mt.1034.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-mt.1034
> Author: mt
> Time: 12 November 2015, 10:10:27.351 am
> UUID: c4e7c7d2-2f19-4f9f-b059-59f07edbe975
> Ancestors: Morphic-mt.1033
>
> Adds support for a text color to list morphs.
>
> =============== Diff against Morphic-mt.1033 ===============
>
> Item was changed:
>   ----- Method: LazyListMorph>>display:atRow:on: (in category 'drawing') -----
>   display: item atRow: row on: canvas
>         "display the given item at row row"
>
>         | drawBounds emphasized rowColor itemAsText |
>         itemAsText := item asStringOrText.
>
>         "If it is a text, we will only use the first character's emphasis."
>         emphasized := itemAsText isText
>                 ifTrue: [font emphasized: (itemAsText emphasisAt: 1)]
>                 ifFalse: [font].
>
> +       rowColor := itemAsText isText
> +               ifTrue: [itemAsText colorAt: 1 ifNone: [self colorForRow: row]]
> +               ifFalse: [self colorForRow: row].
> -       rowColor := self colorForRow: row.
>
>         drawBounds := (self drawBoundsForRow: row) translateBy: (self hMargin @ 0).
>         drawBounds := drawBounds intersect: self bounds.
>
>         "Draw icon if existing. Adjust draw bounds in that case."
>         (self icon: row) ifNotNil: [ :icon || top |
>                 top := drawBounds top + ((drawBounds height - icon height) // 2).
>                 canvas translucentImage: icon at: drawBounds left @ top.
>                 drawBounds := drawBounds left: drawBounds left + icon width + 2 ].
>
>         "Draw filter matches if any."
>         (self filterOffsets: row) do: [:offset |
>                 canvas
>                         frameAndFillRoundRect: ((drawBounds left + offset first) @ drawBounds top corner: (drawBounds left + offset last) @ drawBounds bottom)
>                         radius: 3
>                         fillStyle: self class listFilterHighlightColor
>                         borderWidth: 1
>                         borderColor: self class listFilterHighlightColor twiceDarker].
>
>         "We will only draw strings here."
>         canvas
>                 drawString: itemAsText asString
>                 in: drawBounds
>                 font: emphasized
>                 color: rowColor.!
>
>