Thankyou. This is great help. :)

Arshdeep.


On Thu, Jul 18, 2013 at 9:23 AM, Krzysztof Kosiński <tweenk.pl@...400...> wrote:
2013/7/17 Arshdeep Singh <moduli16@...400...>:
> In my attempts to operate in the mode when the wheel is being used:
> I made the following changes (the diff file)
>
> - added a 'gboolean _isWheel' to struct ColorSelector
> - added a function (public)  void set_isWheel {_isWheel = TRUE }
> - added a function (public) gboolean get_isWheel { return _isWheel; }
>
> -added a function to paint-selector.cpp 'gboolean isWheel' which returns the
> _isWheel attribute of its selector.
>
> Unfortunately, the value does not stick to TRUE.
>
> QuesA: Is this approach wrong ? Is there any intrinsic method by which I can
> get the information that the Wheel is active ?
> QuesB: Why is this approach failing ?

This is an awful hack and completely unnecessary. You should do the following:

1. Examine the 'mode' member of SPPaintSelector
2. If mode equals MODE_COLOR_RGB, the 'selector' member can be used to
obtain a pointer to ColorNotebook:
ColorNotebook *nb =
dynamic_cast<ColorNotebook*>(SP_COLOR_SELECTOR(selector)->base);
3. Now you can test whether the selector is in color wheel mode:
bool is_wheel = SP_IS_COLOR_WHEEL_SELECTOR(nb->getCurrentSelector());

complete snippet:

SPPaintSelector *psel;
bool is_wheel = false;

if (psel->mode == SPPaintSelector::MODE_COLOR_RGB) {
    ColorNotebook *nb =
dynamic_cast<ColorNotebook*>(SP_COLOR_SELECTOR(selector)->base);
    is_wheel = SP_IS_COLOR_WHEEL_SELECTOR(nb->getCurrentSelector());
}

PS: please follow the coding style: http://inkscape.org/doc/coding_style.php

Regards, Krzysztof



--
Arshdeep Singh
Third Year, Computer Engineering
Delhi Technological University
Ph: +91-9654115614
https://sites.google.com/site/adsingh1729/home