KisCanvasSubject and color choosers

Patrick Julien freak at codepimps.org
Fri Feb 13 21:05:54 CET 2004


On February 13, 2004 02:13 pm, Sven Langkamp wrote:
> Hi,
>
> I'm currently searching a better solution for the management of the color
> choosers. Krita has at moment four ways to change the back/foreground color
> and will get more in the future (cymk, palette, ...)
> My idea was to use KisCanvasSubject from KisView as an observer for the
> color choosers. Do you think this is ok or should KisCanvasSubject only be
> used for the tools?

It depends what your goals are...

Do you mind if your widgets are bound by Krita's data structures?  If yes, 
then, this is an excellent choice, however, it also means 3rd parties can no 
longer use your widget directly since they must implement the interface 
KisCanvasSubject.

Some of the members in KisCanvasSubject might not have any meaningful 
representation in other applications.

You may want to offer signals from your controls and an API to set the current 
color.  When KisView is setting up, it can connect the appropriate signals to 
private slots.

Now the problem is that KisView doesn't know anything about widgets that might 
be added dynamically.  If you want to be able to this... abuse the EI pattern 
more... offer an even narrower interface to what you want and inherit 
privately from KisView.  Then, on initialization you can offer only this 
narrow interface.

That being said, I think #2, using signals from your widgets is probably want 
you want.  The KisView, which also inherits privately from 
KisToolControllerInterface, would notify tools internally that the color set 
has changed when it slots are called, etc.

This way, any other application can just pick up your widgets directly, they 
know nothing of the internals of Krita.



More information about the kimageshop mailing list