please stop using strings :)

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

please stop using strings :)

Tudor Girba-2
Hi,

The ColorPalette in Roassal2 is quite cool, but we should refactor the code to not rely on strings.

An example:
|n elements view|
n := RTBucketColor numberOfColors: 5 command: #asInteger scope: ($a to: $z).
n colorScheme: 'Blues'.
elements := (RTBox new size: 20; color: n) elementsOn: ($a to: $z).
view := RTView new.
view addAll: elements.
RTGridLayout on: view elements.
view open.

'Blues' is actually an identifier that is looked up in all the rawPalette keys returned by the subclasses of ColorPalette.

This is not nice. We should have for each palette a method with the same name, and the colorScheme: should work with an object like:
n colorScheme: CPSequential blues

Do we agree on this?

Doru

--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: please stop using strings :)

abergel
I perfectly agree. I think Pablo did this because of an algorithm he found and copied it. Untangling the whole thing is relatively straight forward.
The starting point is to look at the implementation of #rawPalette in the subclasses of ColorPalette.

I will put this on our todo list.

Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.



On May 18, 2014, at 8:46 AM, Tudor Girba <[hidden email]> wrote:

> Hi,
>
> The ColorPalette in Roassal2 is quite cool, but we should refactor the code to not rely on strings.
>
> An example:
> |n elements view|
> n := RTBucketColor numberOfColors: 5 command: #asInteger scope: ($a to: $z).
> n colorScheme: 'Blues'.
> elements := (RTBox new size: 20; color: n) elementsOn: ($a to: $z).
> view := RTView new.
> view addAll: elements.
> RTGridLayout on: view elements.
> view open.
>
> 'Blues' is actually an identifier that is looked up in all the rawPalette keys returned by the subclasses of ColorPalette.
>
> This is not nice. We should have for each palette a method with the same name, and the colorScheme: should work with an object like:
> n colorScheme: CPSequential blues
>
> Do we agree on this?
>
> Doru
>
> --
> www.tudorgirba.com
>
> "Every thing has its own flow"
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev