The Trunk: Collections-mt.710.mcz

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

The Trunk: Collections-mt.710.mcz

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

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

Name: Collections-mt.710
Author: mt
Time: 13 August 2016, 1:04:17.836735 pm
UUID: dd858f23-f52e-0440-af76-9431683dd8e9
Ancestors: Collections-mt.709

To avoid code duplication, add a simple attribute check to texts (in addition to #unembellished).

=============== Diff against Collections-mt.709 ===============

Item was added:
+ ----- Method: Text>>hasClickableAttribute (in category 'testing') -----
+ hasClickableAttribute
+
+ ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
+ attr respondsTo: #mayActOnClick]]!

Item was added:
+ ----- Method: Text>>hasColorAttribute (in category 'testing') -----
+ hasColorAttribute
+
+ ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
+ attr respondsTo: #color]]!

Item was added:
+ ----- Method: Text>>hasFontAttribute (in category 'testing') -----
+ hasFontAttribute
+
+ ^ self runs anySatisfy: [:attrs | attrs anySatisfy: [:attr |
+ (attr respondsTo: #fontNumber) or: [attr respondsTo: #font]]]!

Item was changed:
+ ----- Method: Text>>isText (in category 'testing') -----
- ----- Method: Text>>isText (in category 'comparing') -----
  isText
  ^ true!

Item was changed:
+ ----- Method: Text>>unembellished (in category 'testing') -----
- ----- Method: Text>>unembellished (in category 'attributes') -----
  unembellished
  "Return true if the only emphases are the default font and bold"
  | font1 bold |
  font1 := TextFontChange defaultFontChange.
  bold := TextEmphasis bold.
  Text ignoreStyleIfOnlyBold ifFalse:
  ["Ignore font1 only or font1-bold followed by font1-plain"
  ^ (runs values = (Array with: (Array with: font1)))
  or: [runs values = (Array with: (Array with: font1 with: bold)
    with: (Array with: font1))]].
 
  "If preference is set, then ignore any combo of font1 and bold"
  runs withStartStopAndValueDo:
  [:start :stop :emphArray |
  emphArray do:
  [:emph | (font1 = emph or: [bold = emph]) ifFalse: [^ false]]].
  ^ true!