New issue 68 by 00a...@gmail.com: Respect color naming preference where
applicable
http://code.google.com/p/gpick/issues/detail?id=68
Attached is a patch which implements support for this in the Mix Colors
dialog.
The exact scope that this preference covers is not yet clear to me, however
I can see that at least the Generate Scheme tool should also support this.
Attachments:
mixtool_naming.diff 2.0 KB
This setting should affect Generate Scheme, Layout Preview and probably
other tools. Most of the tools from Secondary View menu are currently using
either specialized names or color names. Should I take care of this?
Certainly some of these I have no idea what 'tool-specific' name might be.
I'll have a go at Generate Scheme and Layout Preview.
In particular, the 'variations', 'brightness/darkness',and 'color mixer'
tools seem to be implemented in a way where the color calculation is
isolated from the actual naming; because of this I currently haven't
figured out how to implement tool-specific naming for them.
Attached is a patch which implements support in BlendColors, LayoutPreview,
DialogGenerate, and DialogMix. It includes some work on making the Scheme
Generation tab/secondary-tool conform, which is not effective yet.
In a process, I found a bug -- secondary tools don't update when the global
state does. This means you have to trigger a call to calc() -- eg. by
dropping a color or otherwise changing a parameter, when you change
the "tool color naming" preference, before it will take effect.
Attachments:
partial_toolcolornaming_pref_support.diff 10.9 KB
Scheme Generation now respects the preference.
In general for tool-specific naming, I've made the choice of "$COLORNAME
$OPERATIONNAME $OPERATIONPARAM".. for example 'Sunset Analogous 3'
Drag and Drop doesn't respect the preference yet, in the cases of Scheme
Generation and Scheme Preview.
Attachments:
partial_toolcolornaming_pref_support-schemes_fixed.diff 13.2 KB
Preference is now respected when drag&dropping in Scheme Generation and
Layout Preview. Double-clicking on colors in Scheme Generation tool doesn't
use the setting.
Attachments:
partial_toolcolornaming_pref_support-dragdrop_fixed.diff 16.2 KB
Attached patch shows three name assignment places in Brightness/Darkness
tool code. These are the places where preference dependent naming should be
used. Other tools should have similar functions.
Attachments:
brightness_darkness_naming.diff 1.0 KB
Thanks :)
I actually spotted where to do the naming easily, for all the tools I
haven't implemented this for yet. The problem was finding out the relevant
info needed to implement the tool-specific naming. I suspect I can look
this up from the Style or through the layout_preview API.
One interesting thing I noticed earlier was that I -didn't- implement the
naming scheme in BlendColors.cpp:source_get_color(), but all methods of
transferring colors to palette including DnD seem to conform correctly.
Oh, and thanks for the example of how to access the layout. I actually
missed that before, and the patch it was contained in :) It helps a lot.
'Blend Colors' uses a palette preview widget, which has all
the 'ColorObject's with names defined at insertion time. This means that
the name defined in the 'calc' function is used. I attached a little patch
which makes 'Blend Colors' update results on activation, because the naming
preference change is not respected until results are 'updated'.
Attachments:
blend_colors_update_naming_preference.diff 276 bytes
This is nearing completion.
Remaining work:
* Color Mixer still needs to respect the preference.
* For Tool-Specific naming, rather than setting the name to
`style->ident_name`,
I'd like to set it to $BASENAME $IDENT_NAME where BASENAME is the
color_names_get() name of the 'main' style item. If I don't find a better
way to do this (I was hoping for a way to 'find style by name'.) by the
time I finish the adjustments to Color Mixer, I'll use plain iteration to
find the base color.
Attachments:
tcnaming-rev6.diff 26.9 KB
* and refactor to be much less copy-paste-ish
I added a little helper class 'ToolColorNameAssigner' (revision
841090ddb4ca) to help avoid copy-pasting the same code multiple times.
Usage examples are in files 'BlendColors.cpp' and 'uiDialogVariations.cpp'.
Are you still working on this patch?
Yes, I am. I'd used macros to reduce code duplication, but it was looking a
bit ugly so I didn't want to commit it. Latest patch attached FYI; I'll
rework this to use the class instead.
Attachments:
tcnaming-rev7.diff 24.8 KB
Just dropping a note here that things are pretty busy in RL for me right
now; it could be a couple of weeks before I have time to finish this off.