2013/7/17 Arshdeep Singh <moduli16@...400...>:
> In my attempts to operate in the mode when the wheel is being used:This is an awful hack and completely unnecessary. You should do the following:
> 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 ?
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