Replace Arcellipse widget by Ellipse widget
This simplifies spot management because only one widget instead of four is now managed to draw an ellipse Bugfixes: - Mouse cursor is now correctly managed according to widget when mouse-overing - Ellipse radius are now saturated at minimum at 2 to avoid ellipse to disapear at small radius values
This commit is contained in:
@@ -50,10 +50,10 @@ ControlSpotPanel::ControlSpotPanel():
|
||||
structexclu_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_STRUCCOL"), 0, 100, 1, 0))),
|
||||
|
||||
struc_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_THRES"), 1.0, 12.0, 0.1, 4.0))),
|
||||
locX_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 0, 2250, 1, 250))),
|
||||
locXL_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 0, 2250, 1, 250))),
|
||||
locY_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 0, 2250, 1, 250))),
|
||||
locYT_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT_T"), 0, 2250, 1, 250))),
|
||||
locX_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH"), 2, 2250, 1, 250))),
|
||||
locXL_(Gtk::manage(new Adjuster(M("TP_LOCAL_WIDTH_L"), 2, 2250, 1, 250))),
|
||||
locY_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT"), 2, 2250, 1, 250))),
|
||||
locYT_(Gtk::manage(new Adjuster(M("TP_LOCAL_HEIGHT_T"), 2, 2250, 1, 250))),
|
||||
centerX_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_X"), -1000, 1000, 1, 0))),
|
||||
centerY_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CENTER_Y"), -1000, 1000, 1, 0))),
|
||||
circrad_(Gtk::manage(new Adjuster(M("TP_LOCALLAB_CIRCRADIUS"), 2, 150, 1, 18))),
|
||||
@@ -1046,40 +1046,22 @@ void ControlSpotPanel::addControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
centerCircle = new Circle();
|
||||
centerCircle->datum = Geometry::IMAGE;
|
||||
centerCircle->radiusInImageSpace = true;
|
||||
Arcellipse* arc1;
|
||||
arc1 = new Arcellipse();
|
||||
arc1->innerLineWidth = 0.7;
|
||||
arc1->datum = Geometry::IMAGE;
|
||||
arc1->radiusInImageSpace = true;
|
||||
Arcellipse* arc2;
|
||||
arc2 = new Arcellipse();
|
||||
arc2->innerLineWidth = 0.7;
|
||||
arc2->datum = Geometry::IMAGE;
|
||||
arc2->radiusInImageSpace = true;
|
||||
Arcellipse* arc3;
|
||||
arc3 = new Arcellipse();
|
||||
arc3->innerLineWidth = 0.7;
|
||||
arc3->datum = Geometry::IMAGE;
|
||||
arc3->radiusInImageSpace = true;
|
||||
Arcellipse* arc4;
|
||||
arc4 = new Arcellipse();
|
||||
arc4->innerLineWidth = 0.7;
|
||||
arc4->datum = Geometry::IMAGE;
|
||||
arc4->radiusInImageSpace = true;
|
||||
Rectangle* rec;
|
||||
rec = new Rectangle();
|
||||
rec->innerLineWidth = 0.7;
|
||||
rec->datum = Geometry::IMAGE;
|
||||
EditSubscriber::visibleGeometry.push_back(lineX); // (curveid - 1) * 10
|
||||
EditSubscriber::visibleGeometry.push_back(lineXL); // (curveid - 1) * 10 + 1
|
||||
EditSubscriber::visibleGeometry.push_back(lineY); // (curveid - 1) * 10 + 2
|
||||
EditSubscriber::visibleGeometry.push_back(lineYT); // (curveid - 1) * 10 + 3
|
||||
EditSubscriber::visibleGeometry.push_back(centerCircle); // (curveid - 1) * 10 + 4
|
||||
EditSubscriber::visibleGeometry.push_back(arc1); // (curveid - 1) * 10 + 5
|
||||
EditSubscriber::visibleGeometry.push_back(arc2); // (curveid - 1) * 10 + 6
|
||||
EditSubscriber::visibleGeometry.push_back(arc3); // (curveid - 1) * 10 + 7
|
||||
EditSubscriber::visibleGeometry.push_back(arc4); // (curveid - 1) * 10 + 8
|
||||
EditSubscriber::visibleGeometry.push_back(rec); // (curveid - 1) * 10 + 9
|
||||
Ellipse* shape_ellipse;
|
||||
shape_ellipse = new Ellipse();
|
||||
shape_ellipse->innerLineWidth = 0.7;
|
||||
shape_ellipse->datum = Geometry::IMAGE;
|
||||
shape_ellipse->radiusInImageSpace = true;
|
||||
Rectangle* shape_rectangle;
|
||||
shape_rectangle = new Rectangle();
|
||||
shape_rectangle->innerLineWidth = 0.7;
|
||||
shape_rectangle->datum = Geometry::IMAGE;
|
||||
EditSubscriber::visibleGeometry.push_back(lineX); // (curveid - 1) * 7
|
||||
EditSubscriber::visibleGeometry.push_back(lineXL); // (curveid - 1) * 7 + 1
|
||||
EditSubscriber::visibleGeometry.push_back(lineY); // (curveid - 1) * 7 + 2
|
||||
EditSubscriber::visibleGeometry.push_back(lineYT); // (curveid - 1) * 7 + 3
|
||||
EditSubscriber::visibleGeometry.push_back(centerCircle); // (curveid - 1) * 7 + 4
|
||||
EditSubscriber::visibleGeometry.push_back(shape_ellipse); // (curveid - 1) * 7 + 5
|
||||
EditSubscriber::visibleGeometry.push_back(shape_rectangle); // (curveid - 1) * 7 + 6
|
||||
|
||||
// Creation of mouseOverGeometry
|
||||
lineX = new Line();
|
||||
@@ -1097,62 +1079,32 @@ void ControlSpotPanel::addControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
centerCircle = new Circle();
|
||||
centerCircle->datum = Geometry::IMAGE;
|
||||
centerCircle->radiusInImageSpace = true;
|
||||
arc1 = new Arcellipse();
|
||||
arc1->innerLineWidth = 0.7;
|
||||
arc1->datum = Geometry::IMAGE;
|
||||
arc1->radiusInImageSpace = true;
|
||||
arc2 = new Arcellipse();
|
||||
arc2->innerLineWidth = 0.7;
|
||||
arc2->datum = Geometry::IMAGE;
|
||||
arc2->radiusInImageSpace = true;
|
||||
arc3 = new Arcellipse();
|
||||
arc3->innerLineWidth = 0.7;
|
||||
arc3->datum = Geometry::IMAGE;
|
||||
arc3->radiusInImageSpace = true;
|
||||
arc4 = new Arcellipse();
|
||||
arc4->innerLineWidth = 0.7;
|
||||
arc4->datum = Geometry::IMAGE;
|
||||
arc4->radiusInImageSpace = true;
|
||||
rec = new Rectangle();
|
||||
rec->innerLineWidth = 0.7;
|
||||
rec->datum = Geometry::IMAGE;
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineX); // (curveid - 1) * 10
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineXL); // (curveid - 1) * 10 + 1
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineY); // (curveid - 1) * 10 + 2
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineYT); // (curveid - 1) * 10 + 3
|
||||
EditSubscriber::mouseOverGeometry.push_back(centerCircle); // (curveid - 1) * 10 + 4
|
||||
EditSubscriber::mouseOverGeometry.push_back(arc1); // (curveid - 1) * 10 + 5
|
||||
EditSubscriber::mouseOverGeometry.push_back(arc2); // (curveid - 1) * 10 + 6
|
||||
EditSubscriber::mouseOverGeometry.push_back(arc3); // (curveid - 1) * 10 + 7
|
||||
EditSubscriber::mouseOverGeometry.push_back(arc4); // (curveid - 1) * 10 + 8
|
||||
EditSubscriber::mouseOverGeometry.push_back(rec); // (curveid - 1) * 10 + 9
|
||||
shape_ellipse = new Ellipse();
|
||||
shape_ellipse->innerLineWidth = 0.7;
|
||||
shape_ellipse->datum = Geometry::IMAGE;
|
||||
shape_ellipse->radiusInImageSpace = true;
|
||||
shape_rectangle = new Rectangle();
|
||||
shape_rectangle->innerLineWidth = 0.7;
|
||||
shape_rectangle->datum = Geometry::IMAGE;
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineX); // (curveid - 1) * 7
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineXL); // (curveid - 1) * 7 + 1
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineY); // (curveid - 1) * 7 + 2
|
||||
EditSubscriber::mouseOverGeometry.push_back(lineYT); // (curveid - 1) * 7 + 3
|
||||
EditSubscriber::mouseOverGeometry.push_back(centerCircle); // (curveid - 1) * 7 + 4
|
||||
EditSubscriber::mouseOverGeometry.push_back(shape_ellipse); // (curveid - 1) * 7 + 5
|
||||
EditSubscriber::mouseOverGeometry.push_back(shape_rectangle); // (curveid - 1) * 7 + 6
|
||||
|
||||
row[spots_.curveid] = EditSubscriber::visibleGeometry.size() / 10;
|
||||
row[spots_.curveid] = EditSubscriber::visibleGeometry.size() / 7;
|
||||
}
|
||||
|
||||
void ControlSpotPanel::updateControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
{
|
||||
const int curveid_ = static_cast<int>(row[spots_.curveid]);
|
||||
|
||||
if (curveid_ == 0) { // Row has no associated curve
|
||||
return;
|
||||
}
|
||||
|
||||
const int centerX_ = static_cast<int>(row[spots_.centerX]);
|
||||
const int centerY_ = static_cast<int>(row[spots_.centerY]);
|
||||
const int circrad_ = static_cast<int>(row[spots_.circrad]);
|
||||
const int locX_ = static_cast<int>(row[spots_.locX]);
|
||||
const int locXL_ = static_cast<int>(row[spots_.locXL]);
|
||||
const int locY_ = static_cast<int>(row[spots_.locY]);
|
||||
const int locYT_ = static_cast<int>(row[spots_.locYT]);
|
||||
const int shape_ = static_cast<int>(row[spots_.shape]);
|
||||
const bool isvisible_ = static_cast<bool>(row[spots_.isvisible]);
|
||||
const int curveid_ = row[spots_.curveid];
|
||||
EditDataProvider* const dataProvider = getEditProvider();
|
||||
|
||||
// printf("updateControlSpotCurve: %d\n", curveid_);
|
||||
|
||||
EditDataProvider* dataProvider = getEditProvider();
|
||||
|
||||
if (!dataProvider) {
|
||||
if (curveid_ == 0 || !dataProvider) { // Row has no associated curve or there is no EditProvider
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1160,15 +1112,25 @@ void ControlSpotPanel::updateControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
int imH = 0;
|
||||
dataProvider->getImageSize(imW, imH);
|
||||
|
||||
if (!imW || !imH) {
|
||||
if (!imW || !imH) { // No image loaded
|
||||
return;
|
||||
}
|
||||
|
||||
const double decayX = (locX_) * (double (imW)) / 2000.;
|
||||
const double decayXL = (locXL_) * (double (imW)) / 2000.;
|
||||
const double decayY = (locY_) * double (imH) / 2000.;
|
||||
const double decayYT = (locYT_) * double (imH) / 2000.;
|
||||
rtengine::Coord origin(imW / 2 + centerX_ * imW / 2000.f, imH / 2 + centerY_ * imH / 2000.f);
|
||||
const int centerX_ = row[spots_.centerX];
|
||||
const int centerY_ = row[spots_.centerY];
|
||||
const int circrad_ = row[spots_.circrad];
|
||||
const int locX_ = row[spots_.locX];
|
||||
const int locXL_ = row[spots_.locXL];
|
||||
const int locY_ = row[spots_.locY];
|
||||
const int locYT_ = row[spots_.locYT];
|
||||
const int shape_ = row[spots_.shape];
|
||||
const bool isvisible_ = row[spots_.isvisible];
|
||||
|
||||
const int decayX = locX_ * (imW / 2000);
|
||||
const int decayXL = locXL_ * (imW / 2000);
|
||||
const int decayY = locY_ * (imH / 2000);
|
||||
const int decayYT = locYT_ * (imH / 2000);
|
||||
rtengine::Coord origin(imW / 2 + centerX_ * imW / 2000, imH / 2 + centerY_ * imH / 2000);
|
||||
|
||||
const auto updateLineWithDecay = [&](Geometry * geometry, const float radius, const float decal, const float offSetAngle, const double decay) {
|
||||
const auto line = static_cast<Line*>(geometry); // 180
|
||||
@@ -1184,147 +1146,117 @@ void ControlSpotPanel::updateControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
circle->radius = circrad_;
|
||||
};
|
||||
|
||||
const auto updateArcellipse = [&](Geometry * geometry, const double dRad_, const double dRad2_, const double begang_, const double endang_) {
|
||||
const auto arcellipse = static_cast<Arcellipse*>(geometry);
|
||||
arcellipse->center = origin;
|
||||
arcellipse->begang = begang_;
|
||||
arcellipse->endang = endang_;
|
||||
arcellipse->radius = dRad_;
|
||||
arcellipse->radius2 = dRad2_;
|
||||
const auto updateEllipse = [&](Geometry * geometry) {
|
||||
const auto ellipse = static_cast<Ellipse*>(geometry);
|
||||
ellipse->center = origin;
|
||||
ellipse->radX = decayX;
|
||||
ellipse->radXL = decayXL;
|
||||
ellipse->radY = decayY;
|
||||
ellipse->radYT = decayYT;
|
||||
};
|
||||
|
||||
const auto updateRectangle = [&](Geometry * geometry) {
|
||||
const auto rectangle = static_cast<Rectangle*>(geometry);
|
||||
rectangle->bottomRight.x = origin.x + (int) decayX;
|
||||
rectangle->bottomRight.y = origin.y + (int) decayY;
|
||||
rectangle->topLeft.x = origin.x - (int) decayXL;
|
||||
rectangle->topLeft.y = origin.y - (int) decayYT;
|
||||
rectangle->bottomRight.x = origin.x + decayX;
|
||||
rectangle->bottomRight.y = origin.y + decayY;
|
||||
rectangle->topLeft.x = origin.x - decayXL;
|
||||
rectangle->topLeft.y = origin.y - decayYT;
|
||||
};
|
||||
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 10), 500., 90., 0., decayX);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 10), 500., 90., 0., decayX);
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 7), 500., 90., 0., decayX);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 7), 500., 90., 0., decayX);
|
||||
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 10 + 1), 500., 90., 180., decayXL);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 10 + 1), 500., 90., 180., decayXL);
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 7 + 1), 500., 90., 180., decayXL);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 7 + 1), 500., 90., 180., decayXL);
|
||||
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 10 + 2), 500., 180., 90., decayY);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 10 + 2), 500., 180., 90., decayY);
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 7 + 2), 500., 180., 90., decayY);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 7 + 2), 500., 180., 90., decayY);
|
||||
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 10 + 3), 500., 180., 270., decayYT);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 10 + 3), 500., 180., 270., decayYT);
|
||||
updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 7 + 3), 500., 180., 270., decayYT);
|
||||
updateLineWithDecay(mouseOverGeometry.at((curveid_ - 1) * 7 + 3), 500., 180., 270., decayYT);
|
||||
|
||||
updateCircle(visibleGeometry.at((curveid_ - 1) * 10 + 4));
|
||||
updateCircle(mouseOverGeometry.at((curveid_ - 1) * 10 + 4));
|
||||
updateCircle(visibleGeometry.at((curveid_ - 1) * 7 + 4));
|
||||
updateCircle(mouseOverGeometry.at((curveid_ - 1) * 7 + 4));
|
||||
|
||||
updateArcellipse(visibleGeometry.at((curveid_ - 1) * 10 + 5), decayX, decayYT, 3 * RT_PI_2, 2 * RT_PI);
|
||||
updateArcellipse(visibleGeometry.at((curveid_ - 1) * 10 + 6), decayXL, decayYT, RT_PI, 3 * RT_PI_2);
|
||||
updateArcellipse(visibleGeometry.at((curveid_ - 1) * 10 + 7), decayXL, decayY, RT_PI_2, RT_PI);
|
||||
updateArcellipse(visibleGeometry.at((curveid_ - 1) * 10 + 8), decayX, decayY, 0., RT_PI_2);
|
||||
updateArcellipse(mouseOverGeometry.at((curveid_ - 1) * 10 + 5), decayX, decayYT, 3 * RT_PI_2, 2 * RT_PI);
|
||||
updateArcellipse(mouseOverGeometry.at((curveid_ - 1) * 10 + 6), decayXL, decayYT, RT_PI, 3 * RT_PI_2);
|
||||
updateArcellipse(mouseOverGeometry.at((curveid_ - 1) * 10 + 7), decayXL, decayY, RT_PI_2, RT_PI);
|
||||
updateArcellipse(mouseOverGeometry.at((curveid_ - 1) * 10 + 8), decayX, decayY, 0., RT_PI_2);
|
||||
updateEllipse(visibleGeometry.at((curveid_ - 1) * 7 + 5));
|
||||
updateEllipse(mouseOverGeometry.at((curveid_ - 1) * 7 + 5));
|
||||
|
||||
updateRectangle(visibleGeometry.at((curveid_ - 1) * 10 + 9));
|
||||
updateRectangle(mouseOverGeometry.at((curveid_ - 1) * 10 + 9));
|
||||
updateRectangle(visibleGeometry.at((curveid_ - 1) * 7 + 6));
|
||||
updateRectangle(mouseOverGeometry.at((curveid_ - 1) * 7 + 6));
|
||||
|
||||
// Update Arcellipse/Rectangle visibility according to shape and visibility
|
||||
if (isvisible_) {
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 1)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 2)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 3)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 4)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 1)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 2)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 3)->setActive(true);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 4)->setActive(true);
|
||||
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 1)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 2)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 3)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 4)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 1)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 2)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 3)->setActive(true);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 4)->setActive(true);
|
||||
|
||||
if (shape_ == 0) { // 0 = Ellipse
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 5)->setActive(true); // arc1
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 6)->setActive(true); // arc2
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 7)->setActive(true); // arc3
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 8)->setActive(true); // arc4
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 9)->setActive(false); // rec
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 5)->setActive(true); // shape_ellipse
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 6)->setActive(false); // shape_rectangle
|
||||
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 5)->setActive(true); // arc1
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 6)->setActive(true); // arc2
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 7)->setActive(true); // arc3
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 8)->setActive(true); // arc4
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 9)->setActive(false); // rec
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 5)->setActive(true); // shape_ellipse
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 6)->setActive(false); // shape_rectangle
|
||||
} else { // 1 = Rectangle
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 5)->setActive(false); // arc1
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 6)->setActive(false); // arc2
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 7)->setActive(false); // arc3
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 8)->setActive(false); // arc4
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 9)->setActive(true); // rec
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 5)->setActive(false); // shape_ellipse
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 6)->setActive(true); // shape_rectangle
|
||||
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 5)->setActive(false); // arc1
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 6)->setActive(false); // arc2
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 7)->setActive(false); // arc3
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 8)->setActive(false); // arc4
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 9)->setActive(true); // rec
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 5)->setActive(false); // shape_ellipse
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 6)->setActive(true); // shape_rectangle
|
||||
}
|
||||
} else {
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 1)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 2)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 3)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 4)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 5)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 6)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 7)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 8)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 10 + 9)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 1)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 2)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 3)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 4)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 5)->setActive(false);
|
||||
EditSubscriber::visibleGeometry.at((curveid_ - 1) * 7 + 6)->setActive(false);
|
||||
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 1)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 2)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 3)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 4)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 5)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 6)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 7)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 8)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 10 + 9)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 1)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 2)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 3)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 4)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 5)->setActive(false);
|
||||
EditSubscriber::mouseOverGeometry.at((curveid_ - 1) * 7 + 6)->setActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ControlSpotPanel::deleteControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
{
|
||||
const int curveid_ = static_cast<int>(row[spots_.curveid]);
|
||||
const int curveid_ = row[spots_.curveid];
|
||||
|
||||
// printf("deleteControlSpotCurve: %d\n", curveid_);
|
||||
|
||||
if (curveid_ == 0) { // Row has no associated curve
|
||||
return;
|
||||
}
|
||||
|
||||
// printf("deleteControlSpotCurve: %d\n", curveid_);
|
||||
|
||||
// visibleGeometry
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 9);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 8);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 7);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 6);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 5);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 4);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 3);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 2);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10 + 1);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 10);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 6);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 5);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 4);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 3);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 2);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7 + 1);
|
||||
EditSubscriber::visibleGeometry.erase(EditSubscriber::visibleGeometry.begin() + (curveid_ - 1) * 7);
|
||||
|
||||
// mouseOverGeometry
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 9);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 8);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 7);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 6);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 5);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 4);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 3);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 2);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10 + 1);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 10);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 6);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 5);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 4);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 3);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 2);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7 + 1);
|
||||
EditSubscriber::mouseOverGeometry.erase(EditSubscriber::mouseOverGeometry.begin() + (curveid_ - 1) * 7);
|
||||
|
||||
row[spots_.curveid] = 0; // Reset associated curve id
|
||||
|
||||
@@ -1340,7 +1272,7 @@ void ControlSpotPanel::deleteControlSpotCurve(Gtk::TreeModel::Row row)
|
||||
}
|
||||
}
|
||||
|
||||
CursorShape ControlSpotPanel::getCursor(int objectID)
|
||||
CursorShape ControlSpotPanel::getCursor(int objectID) const
|
||||
{
|
||||
// printf("Object ID: %d\n", objectID);
|
||||
|
||||
@@ -1350,37 +1282,28 @@ CursorShape ControlSpotPanel::getCursor(int objectID)
|
||||
return CSHandOpen;
|
||||
}
|
||||
|
||||
int rem_ = objectID % 10;
|
||||
int rem_ = objectID % 7;
|
||||
|
||||
switch (rem_) {
|
||||
case (0): // LocX: (curveid_ - 1) * 10
|
||||
case (0): // LocX: (curveid_ - 1) * 7
|
||||
return CSMove1DH;
|
||||
|
||||
case (1): // LocXL: (curveid_ - 1) * 10 + 1
|
||||
case (1): // LocXL: (curveid_ - 1) * 7 + 1
|
||||
return CSMove1DH;
|
||||
|
||||
case (2): // LocY: (curveid_ - 1) * 10 + 2
|
||||
case (2): // LocY: (curveid_ - 1) * 7 + 2
|
||||
return CSMove1DV;
|
||||
|
||||
case (3): // LocYT: (curveid_ - 1) * 10 + 3
|
||||
case (3): // LocYT: (curveid_ - 1) * 7 + 3
|
||||
return CSMove1DV;
|
||||
|
||||
case (4): // centerCircle: (curveid_ - 1) * 10 + 4
|
||||
case (4): // centerCircle: (curveid_ - 1) * 7 + 4
|
||||
return CSMove2D;
|
||||
|
||||
case (5): // arc1: (curveid_ - 1) * 10 + 5
|
||||
case (5): // shape_ellipse: (curveid_ - 1) * 7 + 5
|
||||
return CSMove2D;
|
||||
|
||||
case (6): // arc2: (curveid_ - 1) * 10 + 6
|
||||
return CSMove2D;
|
||||
|
||||
case (7): // arc3: (curveid_ - 1) * 10 + 7
|
||||
return CSMove2D;
|
||||
|
||||
case (8): // arc4: (curveid_ - 1) * 10 + 8
|
||||
return CSMove2D;
|
||||
|
||||
case (9): // rec: (curveid_ - 1) * 10 + 9
|
||||
case (6): // shape_rectangle: (curveid_ - 1) * 7 + 6
|
||||
return CSMove2D;
|
||||
|
||||
default:
|
||||
@@ -1424,8 +1347,8 @@ bool ControlSpotPanel::mouseOver(int modifierKey)
|
||||
return false;
|
||||
}
|
||||
|
||||
int curveId_ = object_ / 10 + 1;
|
||||
int rem = object_ % 10;
|
||||
int curveId_ = object_ / 7 + 1;
|
||||
int rem = object_ % 7;
|
||||
|
||||
// Manage mouseOver preview for TreeView
|
||||
Gtk::TreeModel::Children children = treemodel_->children();
|
||||
@@ -1440,7 +1363,7 @@ bool ControlSpotPanel::mouseOver(int modifierKey)
|
||||
}
|
||||
|
||||
for (int it_ = 0; it_ < (int) EditSubscriber::visibleGeometry.size(); it_++) {
|
||||
if ((it_ < ((curveId_ - 1) * 10)) || (it_ > ((curveId_ - 1) * 10) + 9)) { // it_ does not belong to cursor pointed curve
|
||||
if ((it_ < ((curveId_ - 1) * 7)) || (it_ > ((curveId_ - 1) * 7) + 6)) { // it_ does not belong to cursor pointed curve
|
||||
EditSubscriber::visibleGeometry.at(it_)->state = Geometry::NORMAL;
|
||||
}
|
||||
}
|
||||
@@ -1449,67 +1372,61 @@ bool ControlSpotPanel::mouseOver(int modifierKey)
|
||||
|
||||
// LocX
|
||||
if (rem == 0) {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7)->state = Geometry::PRELIGHT;
|
||||
|
||||
if (method == 1 || method == 3) { // Symmetrical cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 1)->state = Geometry::PRELIGHT;
|
||||
}
|
||||
} else {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7)->state = Geometry::NORMAL;
|
||||
}
|
||||
|
||||
// LocXL
|
||||
if (rem == 1) {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 1)->state = Geometry::PRELIGHT;
|
||||
|
||||
if (method == 1 || method == 3) { // Symmetrical cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7)->state = Geometry::PRELIGHT;
|
||||
}
|
||||
} else {
|
||||
if (method == 0 || method == 2) { // Independent cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 1)->state = Geometry::NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
// LocY
|
||||
if (rem == 2) {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 2)->state = Geometry::PRELIGHT;
|
||||
|
||||
if (method == 1 || method == 3) { // Symmetrical cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 3)->state = Geometry::PRELIGHT;
|
||||
}
|
||||
} else {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 2)->state = Geometry::NORMAL;
|
||||
}
|
||||
|
||||
// LocYT
|
||||
if (rem == 3) {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 3)->state = Geometry::PRELIGHT;
|
||||
|
||||
if (method == 1 || method == 3) { // Symmetrical cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 2)->state = Geometry::PRELIGHT;
|
||||
}
|
||||
} else {
|
||||
if (method == 0 || method == 2) { // Independent cases
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 3)->state = Geometry::NORMAL;
|
||||
}
|
||||
}
|
||||
|
||||
// Circle, Arcellipses and Rectangle
|
||||
if (rem >= 4) {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 4)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 5)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 6)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 7)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 8)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 9)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 4)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 5)->state = Geometry::PRELIGHT;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 6)->state = Geometry::PRELIGHT;
|
||||
} else {
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 4)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 5)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 6)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 7)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 8)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 9)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 4)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 5)->state = Geometry::NORMAL;
|
||||
EditSubscriber::visibleGeometry.at((curveId_ - 1) * 7 + 6)->state = Geometry::NORMAL;
|
||||
}
|
||||
|
||||
lastObject_ = object_;
|
||||
@@ -1531,7 +1448,7 @@ bool ControlSpotPanel::button1Pressed(int modifierKey)
|
||||
}
|
||||
|
||||
// Select associated control spot
|
||||
int curveId_ = lastObject_ / 10 + 1;
|
||||
int curveId_ = lastObject_ / 7 + 1;
|
||||
Gtk::TreeModel::Children children = treemodel_->children();
|
||||
|
||||
for (auto iter = children.begin(); iter != children.end(); iter++) {
|
||||
@@ -1571,7 +1488,7 @@ bool ControlSpotPanel::drag1(int modifierKey)
|
||||
|
||||
int imW, imH;
|
||||
provider->getImageSize(imW, imH);
|
||||
int rem = lastObject_ % 10;
|
||||
int rem = lastObject_ % 7;
|
||||
int method = shapeMethod_->get_active_row_number();
|
||||
Coord* newCoord = new Coord(provider->posImage.x + provider->deltaImage.x, provider->posImage.y + provider->deltaImage.y);
|
||||
|
||||
@@ -1655,7 +1572,7 @@ bool ControlSpotPanel::drag1(int modifierKey)
|
||||
}
|
||||
}
|
||||
|
||||
// Circle, Arcellipses and Rectangle
|
||||
// Circle, Ellipses and Rectangle
|
||||
if (rem >= 4) {
|
||||
double deltaX = (double (newCoord->x) - double (lastCoord_->x)) * 2000. / double (imW);
|
||||
double deltaY = (double (newCoord->y) - double (lastCoord_->y)) * 2000. / double (imH);
|
||||
|
Reference in New Issue
Block a user