From 0225a7f109e8ca32fd99ee33ccd413c2ff8b05f3 Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Tue, 2 Apr 2019 19:09:10 +0200 Subject: [PATCH] Manages Locallab spot opacity according to selected one --- rtgui/controlspotpanel.cc | 20 ++++++++++++++++++++ rtgui/controlspotpanel.h | 1 + rtgui/editwidgets.cc | 20 ++++++++++---------- rtgui/editwidgets.h | 3 ++- 4 files changed, 33 insertions(+), 11 deletions(-) diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 1fb1406e9..9b8e618c9 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -1274,6 +1274,25 @@ void ControlSpotPanel::deleteControlSpotCurve(Gtk::TreeModel::Row row) } } +void ControlSpotPanel::updateCurveOpacity(Gtk::TreeModel::Row selectedRow) +{ + const int curveid_ = selectedRow[spots_.curveid]; + + // printf("updateCurveOpacity: %d\n", curveid_); + + if (curveid_ == 0) { // Row has no associated curve + return; + } + + for (int it_ = 0; it_ < (int) EditSubscriber::visibleGeometry.size(); it_++) { + if ((it_ < ((curveid_ - 1) * 7)) || (it_ > ((curveid_ - 1) * 7) + 6)) { // it_ does not belong to selected curve + EditSubscriber::visibleGeometry.at(it_)->opacity = 25.; + } else { + EditSubscriber::visibleGeometry.at(it_)->opacity = 75.; + } + } +} + CursorShape ControlSpotPanel::getCursor(int objectID) const { // printf("Object ID: %d\n", objectID); @@ -1698,6 +1717,7 @@ void ControlSpotPanel::setSelectedSpot(int id) treeview_.set_cursor(treemodel_->get_path(row)); load_ControlSpot_param(); updateParamVisibility(); + updateCurveOpacity(row); } } diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index 47f7a3bc5..45afdb23d 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -248,6 +248,7 @@ private: void addControlSpotCurve(Gtk::TreeModel::Row row); void updateControlSpotCurve(Gtk::TreeModel::Row row); void deleteControlSpotCurve(Gtk::TreeModel::Row row); + void updateCurveOpacity(Gtk::TreeModel::Row selectedRow); CursorShape getCursor(int objectID) const; bool mouseOver(int modifierKey); bool button1Pressed(int modifierKey); diff --git a/rtgui/editwidgets.cc b/rtgui/editwidgets.cc index 6c1ef892b..444ad5a65 100644 --- a/rtgui/editwidgets.cc +++ b/rtgui/editwidgets.cc @@ -74,7 +74,7 @@ void Circle::drawOuterGeometry(Cairo::RefPtr &cr, ObjectMOBuffer color = outerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); cr->set_line_width( getOuterLineWidth() ); rtengine::Coord center_ = center; @@ -105,7 +105,7 @@ void Circle::drawInnerGeometry(Cairo::RefPtr &cr, ObjectMOBuffer color = innerLineColor; } - cr->set_source_rgb(color.getR(), color.getG(), color.getB()); + cr->set_source_rgba(color.getR(), color.getG(), color.getB(), opacity / 100.); } cr->set_line_width( innerLineWidth ); @@ -197,7 +197,7 @@ void Line::drawOuterGeometry(Cairo::RefPtr &cr, ObjectMOBuffer * color = outerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.0); cr->set_line_width( getOuterLineWidth() ); rtengine::Coord begin_ = begin; @@ -232,7 +232,7 @@ void Line::drawInnerGeometry(Cairo::RefPtr &cr, ObjectMOBuffer * color = innerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); } cr->set_line_width(innerLineWidth); @@ -311,7 +311,7 @@ void Polyline::drawOuterGeometry(Cairo::RefPtr &cr, ObjectMOBuff color = outerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); cr->set_line_width( getOuterLineWidth() ); rtengine::Coord currPos; @@ -355,7 +355,7 @@ void Polyline::drawInnerGeometry(Cairo::RefPtr &cr, ObjectMOBuff color = innerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); } cr->set_line_width( innerLineWidth ); @@ -504,7 +504,7 @@ void Rectangle::drawOuterGeometry(Cairo::RefPtr &cr, ObjectMOBuf color = outerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); cr->set_line_width( getOuterLineWidth() ); rtengine::Coord tl, br; @@ -548,7 +548,7 @@ void Rectangle::drawInnerGeometry(Cairo::RefPtr &cr, ObjectMOBuf color = innerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); } cr->set_line_width( innerLineWidth ); @@ -655,7 +655,7 @@ void Ellipse::drawOuterGeometry (Cairo::RefPtr &cr, ObjectMOBuff color = outerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); cr->set_line_width ( getOuterLineWidth() ); rtengine::Coord center_ = center; @@ -728,7 +728,7 @@ void Ellipse::drawInnerGeometry (Cairo::RefPtr &cr, ObjectMOBuff color = innerLineColor; } - cr->set_source_rgb (color.getR(), color.getG(), color.getB()); + cr->set_source_rgba (color.getR(), color.getG(), color.getB(), opacity / 100.); } cr->set_line_width ( innerLineWidth ); diff --git a/rtgui/editwidgets.h b/rtgui/editwidgets.h index 9c8cdacba..dda661cfe 100644 --- a/rtgui/editwidgets.h +++ b/rtgui/editwidgets.h @@ -232,6 +232,7 @@ public: float innerLineWidth; // ...outerLineWidth = innerLineWidth+2 Datum datum; State state; // set by the Subscriber + float opacity; // Percentage of opacity Geometry (); virtual ~Geometry() {} @@ -493,7 +494,7 @@ inline Geometry::Geometry () : innerLineColor (char (255), char (255), char (255)), outerLineColor ( char (0), char (0), char (0)), flags ( F_VISIBLE | F_HOVERABLE | F_AUTO_COLOR), innerLineWidth (1.5f), datum ( - IMAGE), state (NORMAL) { + IMAGE), state (NORMAL), opacity(100.) { } inline RGBAColor::RGBAColor () :