void Plotter2DObj::enable(bool status) { if (!isFltkThread()) // run the method in FLTK if not in it { IndirectMemberProc<Plotter2DObj, bool> proxy(*this, &Plotter2DObj::enable, status); // registers the call runInFltkThread(proxy); return; } _drawOn = status; _suspended = (_drawOn) ? false : true; // override the suspended flag if ((pnot)_ownercb == nullptr) return; // return if not inserted MTOOLS_ASSERT(((Drawable2DInterface*)_di) != nullptr); _onOffButton->value(_drawOn); if (_drawOn) { if (_missedSetParam) { ((Drawable2DInterface*)_di)->setParam(_crange, _cwinSize); _missedSetParam = false; } _nameBox->activate(); if (!hasFavouriteRangeX()) { _useRangeX->deactivate(); } else { _useRangeX->activate(); } if (!hasFavouriteRangeY()) { _useRangeY->deactivate(); } else { _useRangeY->activate(); } if (!((hasFavouriteRangeX())&&(hasFavouriteRangeY()))) { _useRangeXY->deactivate(); } else { _useRangeXY->activate(); } _opacitySlider->activate(); if (_progBar != nullptr) _progBar->activate(); if (_nbthl != nullptr) _nbthl->activate(); if (_optionWin != nullptr) _optionWin->activate(); } else { _nameBox->deactivate(); _useRangeX->deactivate(); _useRangeY->deactivate(); _useRangeXY->deactivate(); _opacitySlider->deactivate(); if (_progBar != nullptr) _progBar->deactivate(); if (_nbthl != nullptr) _nbthl->deactivate(); if (_optionWin != nullptr) _optionWin->deactivate(); } ((Drawable2DInterface*)_di)->enableThreads(_drawOn); refresh(); yieldFocus(); }
void Plot2DAxes::graduations(bool show, RGBc color) { if (!isFLTKThread()) // run the method in FLTK if not in it { IndirectMemberProc<Plot2DAxes, bool, RGBc> proxy(*this, &Plot2DAxes::graduations, show, color); // registers the call runInFLTKThread(proxy); return; } _gradStatus = show; if (!_gradStatus) _numStatus = false; _gradColor = color; if (!isInserted()) return; // not inserted, we are done _gradButton->value(_gradStatus ? 1 : 0); _numButton->value(_numStatus ? 1 : 0); _gradColorButton->color(_gradColor); _gradColorButton->color2(_gradColor); _gradColorButton->redraw(); refresh(); yieldFocus(); }
void Plotter2DObj::setNameWidgetColor() { if (!isFltkThread()) // run the method in FLTK if not in it { IndirectMemberProc<Plotter2DObj> proxy(*this, &Plotter2DObj::setNameWidgetColor); // registers the call runInFltkThread(proxy); return; } if ((pnot)_ownercb == nullptr) return; // return if not inserted RGBc coul = nameWidgetColor(); if (coul.isTransparent()) { return; } _nameBox->color(toFlColor(coul)); if ((int)coul.comp.R + (int)coul.comp.G + (int)coul.comp.B < 300) { _nameBox->labelcolor(toFlColor(RGBc(230, 230, 230))); } else { _nameBox->labelcolor(toFlColor(RGBc::c_Black)); } _nameBox->redraw(); refresh(); yieldFocus(); }
void Plotter2DObj::suspend(bool status) { if (!isFltkThread()) // run the method in FLTK if not in it { IndirectMemberProc<Plotter2DObj,bool> proxy(*this, &Plotter2DObj::suspend,status); // registers the call runInFltkThread(proxy); return; } if ((_drawOn == false)||(_suspended == status)) return; // nothing to do _suspended = status; if ((pnot)_ownercb == nullptr) return; // return if not inserted MTOOLS_ASSERT(((Drawable2DInterface*)_di) != nullptr); ((Drawable2DInterface*)_di)->enableThreads(!status); if (!status) { // we resume activites if (_missedSetParam) { ((Drawable2DInterface*)_di)->setParam(_crange, _cwinSize); _missedSetParam = false; } refresh(); yieldFocus(); } }
void Plotter2DObjWithColor::colorCB(Fl_Widget * W) { RGBc coul = _color; coul.comp.A = 255; if (fl_color_chooser("Plot color", coul.comp.R, coul.comp.G, coul.comp.B, 1) != 0) { color(coul); } else { yieldFocus(); } }