[Kst] Patch in progress with some questions

nicolas.brisset at free.fr nicolas.brisset at free.fr
Fri Dec 10 00:41:14 CET 2010


Hi,

I've just uploaded some sample files that make it easy to test the "change data file tool" and also the "assigne curve color per file" tool. But the latter tool has a problem right now: it changes color every time it is shown!

So I started changing that behavior in view of adding a sticky "color per file" option in the future, so that curves created later automatically get the right color. Attached is a patched that does the following:
- add a color to datasources
- load those colors when showing the assign color per file tool
- save the chosen colors when the user hits apply

It seems to work well, but I'd really appreciate some review before committing it. There may be memleaks, missing things or const-incorrect code.

Then I'd also like to have some advice to complete the feature and provide the sticky setting. Here is what I'm planning:
- save the datasource color to the .kst file
- add option to that tool to reuse the per-file colors for newly created curves
- datawizard.cpp l. 956 : setColor based on previous option
- curveappearance.cpp l. 318 enableSettings() : set right color + deactivate color selector if set from file 
- warning: the curve color needs to update when X or Y vectors change
- it would be nice to have an option to deactivate / reactivate color-per-file from the new curve dialog

Finally, there are still some open points:
- should the setting be stored in the .kst? Where? Is it bad if we change the format?
- is it OK to store the property (whether it is sticky) in the dialog itself and access it from qApp().mainWindow()->chooseColorDialog() (or smth like that)?
- how to handle curves where the vectors do not derive from a datasource. I tend to think we have to stop at some point, i.e. honor the setting only for curves displaying data from primitive vectors

And I'm not sure I've thought of everything. Comments welcome!
Looking back at the amount of work, I'm actually starting to wonder whether it's worth the effort. Maybe keeping the dialog around and reapplying every now and then is not so bad after all. Opinions?

Nicolas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix_color_per_file.patch
Type: text/x-patch
Size: 7933 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kst/attachments/20101210/6a4965f6/attachment.patch 


More information about the Kst mailing list