From 74dd3a6a103455c4df019d877fbed79cef73e829 Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Mon, 18 Jun 2018 19:21:57 +0200 Subject: [PATCH] Correction of code format with AStyle --- rtgui/CMakeLists.txt | 2 +- rtgui/controlspotpanel.cc | 1492 ++++++++++++++++++------------------- rtgui/controlspotpanel.h | 186 ++--- rtgui/edit.cc | 138 ++-- rtgui/locallab.cc | 86 +-- 5 files changed, 952 insertions(+), 952 deletions(-) diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index 467b622ec..47a7837c8 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -34,7 +34,7 @@ set(NONCLISOURCEFILES colorappearance.cc coloredbar.cc colortoning.cc - controlspotpanel.cc + controlspotpanel.cc coordinateadjuster.cc crop.cc crophandler.cc diff --git a/rtgui/controlspotpanel.cc b/rtgui/controlspotpanel.cc index 60c5f3d16..c86eae49f 100644 --- a/rtgui/controlspotpanel.cc +++ b/rtgui/controlspotpanel.cc @@ -14,99 +14,99 @@ using namespace rtengine; //----------------------------------------------------------------------------- ControlSpotPanel::ControlSpotPanel(): - EditSubscriber(ET_OBJECTS), + EditSubscriber(ET_OBJECTS), - button_add_ ("Add"), - button_delete_ ("Delete"), - button_rename_ ("Rename"), + button_add_ ("Add"), + button_delete_ ("Delete"), + button_rename_ ("Rename"), - shape_ (Gtk::manage (new MyComboBoxText ())), - spotMethod_ (Gtk::manage (new MyComboBoxText ())), - shapeMethod_ (Gtk::manage (new MyComboBoxText ())), - qualityMethod_ (Gtk::manage (new MyComboBoxText ())), + shape_ (Gtk::manage (new MyComboBoxText ())), + spotMethod_ (Gtk::manage (new MyComboBoxText ())), + shapeMethod_ (Gtk::manage (new MyComboBoxText ())), + qualityMethod_ (Gtk::manage (new MyComboBoxText ())), - 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))), - 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))), - transit_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), - thresh_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_THRES"), 1, 35, 1, 18))), - iter_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_PROXI"), 0, 60, 1, 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))), + 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))), + transit_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_TRANSIT"), 5, 95, 1, 60))), + thresh_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_THRES"), 1, 35, 1, 18))), + iter_ (Gtk::manage (new Adjuster (M ("TP_LOCALLAB_PROXI"), 0, 60, 1, 0))), - lastObject_ (-1), - lastCoord_ (new Coord ()) + lastObject_ (-1), + lastCoord_ (new Coord ()) { - treeview_.set_grid_lines (Gtk::TREE_VIEW_GRID_LINES_VERTICAL); + treeview_.set_grid_lines (Gtk::TREE_VIEW_GRID_LINES_VERTICAL); - scrolledwindow_.add (treeview_); - scrolledwindow_.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); - scrolledwindow_.set_min_content_height(150); + scrolledwindow_.add (treeview_); + scrolledwindow_.set_policy (Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + scrolledwindow_.set_min_content_height(150); - pack_start (buttonbox_); - pack_start (scrolledwindow_); + pack_start (buttonbox_); + pack_start (scrolledwindow_); - buttonbox_.pack_start(button_add_, Gtk::PACK_SHRINK, 4); - buttonbox_.pack_start(button_delete_, Gtk::PACK_SHRINK, 4); - buttonbox_.pack_start(button_rename_); - buttonbox_.set_layout(Gtk::BUTTONBOX_START); + buttonbox_.pack_start(button_add_, Gtk::PACK_SHRINK, 4); + buttonbox_.pack_start(button_delete_, Gtk::PACK_SHRINK, 4); + buttonbox_.pack_start(button_rename_); + buttonbox_.set_layout(Gtk::BUTTONBOX_START); - button_add_.signal_clicked().connect ( - sigc::mem_fun (*this, &ControlSpotPanel::on_button_add)); - button_delete_.signal_clicked().connect ( - sigc::mem_fun (*this, &ControlSpotPanel::on_button_delete)); - button_rename_.signal_clicked().connect ( - sigc::mem_fun (*this, &ControlSpotPanel::on_button_rename)); + button_add_.signal_clicked().connect ( + sigc::mem_fun (*this, &ControlSpotPanel::on_button_add)); + button_delete_.signal_clicked().connect ( + sigc::mem_fun (*this, &ControlSpotPanel::on_button_delete)); + button_rename_.signal_clicked().connect ( + sigc::mem_fun (*this, &ControlSpotPanel::on_button_rename)); - treemodel_ = Gtk::ListStore::create (spots_); + treemodel_ = Gtk::ListStore::create (spots_); - treeview_.set_model (treemodel_); - treeview_.get_selection()->signal_changed().connect( - sigc::mem_fun ( - *this, &ControlSpotPanel::controlspotChanged)); + treeview_.set_model (treemodel_); + treeview_.get_selection()->signal_changed().connect( + sigc::mem_fun ( + *this, &ControlSpotPanel::controlspotChanged)); - auto cell = Gtk::manage (new Gtk::CellRendererText()); - int cols_count = treeview_.append_column ("ID", *cell); - auto col = treeview_.get_column(cols_count - 1); - if (col) { - col->set_cell_data_func ( - *cell, sigc::mem_fun ( - *this, &ControlSpotPanel::render_id)); - } + auto cell = Gtk::manage (new Gtk::CellRendererText()); + int cols_count = treeview_.append_column ("ID", *cell); + auto col = treeview_.get_column(cols_count - 1); + if (col) { + col->set_cell_data_func ( + *cell, sigc::mem_fun ( + *this, &ControlSpotPanel::render_id)); + } - cell = Gtk::manage (new Gtk::CellRendererText()); - cols_count = treeview_.append_column("Name", *cell); - col = treeview_.get_column(cols_count - 1); - if (col) { - col->set_cell_data_func ( - *cell, sigc::mem_fun ( - *this, &ControlSpotPanel::render_name)); - } + cell = Gtk::manage (new Gtk::CellRendererText()); + cols_count = treeview_.append_column("Name", *cell); + col = treeview_.get_column(cols_count - 1); + if (col) { + col->set_cell_data_func ( + *cell, sigc::mem_fun ( + *this, &ControlSpotPanel::render_name)); + } - cell = Gtk::manage (new Gtk::CellRendererText()); - cols_count = treeview_.append_column("Status", *cell); - col = treeview_.get_column(cols_count - 1); - if (col) { - col->set_cell_data_func ( - *cell, sigc::mem_fun ( - *this, &ControlSpotPanel::render_isvisible)); - } + cell = Gtk::manage (new Gtk::CellRendererText()); + cols_count = treeview_.append_column("Status", *cell); + col = treeview_.get_column(cols_count - 1); + if (col) { + col->set_cell_data_func ( + *cell, sigc::mem_fun ( + *this, &ControlSpotPanel::render_isvisible)); + } - // TODO Reload saved control spots (don't forget autosize) + // TODO Reload saved control spots (don't forget autosize) - // TODO Rectangle + // TODO Rectangle Gtk::HBox* const ctboxshape = Gtk::manage (new Gtk::HBox ()); Gtk::Label* const labelshape = Gtk::manage (new Gtk::Label (M ("TP_LOCALLAB_SHAPETYPE") + ":")); ctboxshape->pack_start (*labelshape, Gtk::PACK_SHRINK, 4); - shape_->append (M ("TP_LOCALLAB_ELI")); + shape_->append (M ("TP_LOCALLAB_ELI")); shape_->append (M ("TP_LOCALLAB_RECT")); shape_->set_active (0); shapeconn_ = shape_->signal_changed ().connect ( - sigc::mem_fun ( - *this, &ControlSpotPanel::shapeChanged)); + sigc::mem_fun ( + *this, &ControlSpotPanel::shapeChanged)); ctboxshape->pack_start (*shape_); pack_start (*ctboxshape); @@ -118,8 +118,8 @@ ControlSpotPanel::ControlSpotPanel(): spotMethod_->append (M ("TP_LOCALLAB_EXECLU")); spotMethod_->set_active (0); spotMethodconn_ = spotMethod_->signal_changed ().connect ( - sigc::mem_fun ( - *this, &ControlSpotPanel::save_ControlSpot_param)); + sigc::mem_fun ( + *this, &ControlSpotPanel::save_ControlSpot_param)); ctboxspotmethod->pack_start(*spotMethod_); pack_start(*ctboxspotmethod); @@ -133,30 +133,30 @@ ControlSpotPanel::ControlSpotPanel(): shapeMethod_->append (M ("TP_LOCALLAB_SYMSL")); shapeMethod_->set_active (0); shapeMethodconn_ = shapeMethod_->signal_changed ().connect ( - sigc::mem_fun ( - *this, &ControlSpotPanel::shapeMethodeChanged)); + sigc::mem_fun ( + *this, &ControlSpotPanel::shapeMethodeChanged)); ctboxshapemethod->pack_start (*shapeMethod_); pack_start (*ctboxshapemethod); pack_start (*locX_); locX_->setAdjusterListener (this); - pack_start (*locXL_); + pack_start (*locXL_); locXL_->setAdjusterListener (this); - pack_start (*locY_); + pack_start (*locY_); locY_->setAdjusterListener (this); - pack_start (*locYT_); + pack_start (*locYT_); locYT_->setAdjusterListener (this); - pack_start (*centerX_); + pack_start (*centerX_); centerX_->setAdjusterListener (this); - pack_start (*centerY_); + pack_start (*centerY_); centerY_->setAdjusterListener (this); - pack_start (*circrad_); + pack_start (*circrad_); circrad_->setAdjusterListener (this); Gtk::HBox* const ctboxqualitymethod = Gtk::manage (new Gtk::HBox ()); @@ -168,8 +168,8 @@ ControlSpotPanel::ControlSpotPanel(): qualityMethod_->append (M ("TP_LOCALLAB_ENHDEN")); qualityMethod_->set_active(0); qualityMethodconn_ = qualityMethod_->signal_changed ().connect ( - sigc::mem_fun ( - *this, &ControlSpotPanel::save_ControlSpot_param)); + sigc::mem_fun ( + *this, &ControlSpotPanel::save_ControlSpot_param)); ctboxqualitymethod->pack_start (*qualityMethod_); pack_start (*ctboxqualitymethod); @@ -188,20 +188,20 @@ ControlSpotPanel::ControlSpotPanel(): artifFrame->add (*artifBox); pack_start (*artifFrame); - // Set param widgets sensitive if there is at least one control spot - auto s = treeview_.get_selection(); - if (!s->count_selected_rows ()) { - setParamEditable (false); - } else { - setParamEditable (true); - } + // Set param widgets sensitive if there is at least one control spot + auto s = treeview_.get_selection(); + if (!s->count_selected_rows ()) { + setParamEditable (false); + } else { + setParamEditable (true); + } - show_all (); + show_all (); } void ControlSpotPanel::setEditProvider (EditDataProvider* provider) { - EditSubscriber::setEditProvider (provider); + EditSubscriber::setEditProvider (provider); } namespace @@ -218,457 +218,457 @@ Glib::ustring to_str (V n, int precision = 1) } // namespace void ControlSpotPanel::render_id ( - Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) + Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) { - auto row = *iter; - Gtk::CellRendererText *ct = static_cast (cell); - int value = row[spots_.id]; - ct->property_text() = to_str (value); + auto row = *iter; + Gtk::CellRendererText *ct = static_cast (cell); + int value = row[spots_.id]; + ct->property_text() = to_str (value); } void ControlSpotPanel::render_name ( - Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) + Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) { - auto row = *iter; - Gtk::CellRendererText *ct = static_cast (cell); - auto value = row[spots_.name]; - ct->property_text() = value; + auto row = *iter; + Gtk::CellRendererText *ct = static_cast (cell); + auto value = row[spots_.name]; + ct->property_text() = value; } void ControlSpotPanel::render_isvisible ( - Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) + Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter) { - auto row = *iter; - Gtk::CellRendererText *ct = static_cast (cell); - auto value = row[spots_.isvisible]; - if (value) { - ct->property_text () = "Visible"; - } else { - ct->property_text () = "Not visible"; - } + auto row = *iter; + Gtk::CellRendererText *ct = static_cast (cell); + auto value = row[spots_.isvisible]; + if (value) { + ct->property_text () = "Visible"; + } else { + ct->property_text () = "Not visible"; + } } void ControlSpotPanel::on_button_add () { - printf("on_button_add\n"); - // Looking for maximum used id - int max_row_id = 0; - Gtk::TreeModel::Children children = treemodel_->children (); - Gtk::TreeModel::Children::iterator iter; - for (iter = children.begin (); iter != children.end (); iter++) - { - Gtk::TreeModel::Row row = *iter; - int iter_id = row[spots_.id]; - max_row_id = std::max (max_row_id, iter_id); - } + printf("on_button_add\n"); + // Looking for maximum used id + int max_row_id = 0; + Gtk::TreeModel::Children children = treemodel_->children (); + Gtk::TreeModel::Children::iterator iter; + for (iter = children.begin (); iter != children.end (); iter++) + { + Gtk::TreeModel::Row row = *iter; + int iter_id = row[spots_.id]; + max_row_id = std::max (max_row_id, iter_id); + } - // Adding row - Gtk::TreeModel::Row row = * (treemodel_->append ()); - row[spots_.id] = max_row_id + 1; - row[spots_.name] = "Control Spot #" + to_str(row[spots_.id]); - row[spots_.isvisible] = true; - row[spots_.curveid] = 0; // No associated curve - row[spots_.shape] = 0; - row[spots_.spotMethod] = 0; - row[spots_.shapeMethod] = 2; - row[spots_.locX] = 250; - row[spots_.locXL] = 250; - row[spots_.locY] = 250; - row[spots_.locYT] = 250; - row[spots_.centerX] = 0; - row[spots_.centerY] = 0; - row[spots_.circrad] = 18; - row[spots_.qualityMethod] = 0; - row[spots_.transit] = 60; - row[spots_.thresh] = 18; - row[spots_.iter] = 0; - setParamEditable (true); + // Adding row + Gtk::TreeModel::Row row = * (treemodel_->append ()); + row[spots_.id] = max_row_id + 1; + row[spots_.name] = "Control Spot #" + to_str(row[spots_.id]); + row[spots_.isvisible] = true; + row[spots_.curveid] = 0; // No associated curve + row[spots_.shape] = 0; + row[spots_.spotMethod] = 0; + row[spots_.shapeMethod] = 2; + row[spots_.locX] = 250; + row[spots_.locXL] = 250; + row[spots_.locY] = 250; + row[spots_.locYT] = 250; + row[spots_.centerX] = 0; + row[spots_.centerY] = 0; + row[spots_.circrad] = 18; + row[spots_.qualityMethod] = 0; + row[spots_.transit] = 60; + row[spots_.thresh] = 18; + row[spots_.iter] = 0; + setParamEditable (true); - // Select newly added row - treeview_.set_cursor (treemodel_->get_path (row)); + // Select newly added row + treeview_.set_cursor (treemodel_->get_path (row)); - // Add associated control spot curve - addControlSpotCurve (row); - updateControlSpotCurve (row); - subscribe (); + // Add associated control spot curve + addControlSpotCurve (row); + updateControlSpotCurve (row); + subscribe (); } void ControlSpotPanel::on_button_delete () { - auto s = treeview_.get_selection (); - if (!s->count_selected_rows ()) { - return; - } - auto iter = s->get_selected (); - Gtk::TreeModel::Row row = *iter; - deleteControlSpotCurve (row); - treemodel_->erase (iter); + auto s = treeview_.get_selection (); + if (!s->count_selected_rows ()) { + return; + } + auto iter = s->get_selected (); + Gtk::TreeModel::Row row = *iter; + deleteControlSpotCurve (row); + treemodel_->erase (iter); - // Set param widgets unsensitive and unsubscribe if there is no more control spot - s = treeview_.get_selection (); - if (!s->count_selected_rows ()) { - unsubscribe (); - setParamEditable (false); - } + // Set param widgets unsensitive and unsubscribe if there is no more control spot + s = treeview_.get_selection (); + if (!s->count_selected_rows ()) { + unsubscribe (); + setParamEditable (false); + } } void ControlSpotPanel::on_button_rename () { - // Get actual control spot name - const auto s = treeview_.get_selection (); - if (!s->count_selected_rows ()) { - return; - } - const auto iter = s->get_selected (); - const Gtk::TreeModel::Row row = *iter; - const Glib::ustring actualname = row[spots_.name]; + // Get actual control spot name + const auto s = treeview_.get_selection (); + if (!s->count_selected_rows ()) { + return; + } + const auto iter = s->get_selected (); + const Gtk::TreeModel::Row row = *iter; + const Glib::ustring actualname = row[spots_.name]; - RenameDialog d (actualname, - static_cast (*get_toplevel ())); - int status = d.run (); + RenameDialog d (actualname, + static_cast (*get_toplevel ())); + int status = d.run (); - if (status == 1) { - const auto newname = d.get_new_name (); - row[spots_.name] = newname; - } + if (status == 1) { + const auto newname = d.get_new_name (); + row[spots_.name] = newname; + } - treeview_.columns_autosize (); + treeview_.columns_autosize (); } void ControlSpotPanel::save_ControlSpot_param () { - printf("save_ControlSpot_param\n"); - // Get selected control spot - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return; - } - const auto iter = s->get_selected(); - const Gtk::TreeModel::Row row = *iter; + printf("save_ControlSpot_param\n"); + // Get selected control spot + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return; + } + const auto iter = s->get_selected(); + const Gtk::TreeModel::Row row = *iter; - // Save param in selected control spot - row[spots_.shape] = shape_->get_active_row_number (); - row[spots_.spotMethod] = spotMethod_->get_active_row_number (); - row[spots_.shapeMethod] = shapeMethod_->get_active_row_number (); - row[spots_.locX] = static_cast (locX_->getValue ()); - row[spots_.locXL] = static_cast (locXL_->getValue ()); - row[spots_.locY] = static_cast (locY_->getValue ()); - row[spots_.locYT] = static_cast (locYT_->getValue ()); - row[spots_.centerX] = static_cast (centerX_->getValue ()); - row[spots_.centerY] = static_cast (centerY_->getValue ()); - row[spots_.circrad] = static_cast (circrad_->getValue ()); - row[spots_.qualityMethod] = qualityMethod_->get_active_row_number (); - row[spots_.transit] = static_cast (transit_->getValue ()); - row[spots_.thresh] = static_cast (thresh_->getValue ()); - row[spots_.iter] = static_cast (iter_->getValue ()); + // Save param in selected control spot + row[spots_.shape] = shape_->get_active_row_number (); + row[spots_.spotMethod] = spotMethod_->get_active_row_number (); + row[spots_.shapeMethod] = shapeMethod_->get_active_row_number (); + row[spots_.locX] = static_cast (locX_->getValue ()); + row[spots_.locXL] = static_cast (locXL_->getValue ()); + row[spots_.locY] = static_cast (locY_->getValue ()); + row[spots_.locYT] = static_cast (locYT_->getValue ()); + row[spots_.centerX] = static_cast (centerX_->getValue ()); + row[spots_.centerY] = static_cast (centerY_->getValue ()); + row[spots_.circrad] = static_cast (circrad_->getValue ()); + row[spots_.qualityMethod] = qualityMethod_->get_active_row_number (); + row[spots_.transit] = static_cast (transit_->getValue ()); + row[spots_.thresh] = static_cast (thresh_->getValue ()); + row[spots_.iter] = static_cast (iter_->getValue ()); } void ControlSpotPanel::load_ControlSpot_param() { - printf("load_ControlSpot_param\n"); - // Get selected control spot - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return; - } - const auto iter = s->get_selected(); - const Gtk::TreeModel::Row row = *iter; + printf("load_ControlSpot_param\n"); + // Get selected control spot + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return; + } + const auto iter = s->get_selected(); + const Gtk::TreeModel::Row row = *iter; - // Listener are deactivated to avoid unexpected even during param load - disableParamlistener (true); + // Listener are deactivated to avoid unexpected even during param load + disableParamlistener (true); - // Load param in selected control spot - shape_->set_active (row[spots_.shape]); - spotMethod_->set_active (row[spots_.spotMethod]); - shapeMethod_->set_active (row[spots_.shapeMethod]); - locX_->setValue (static_cast (row[spots_.locX])); - locXL_->setValue (static_cast (row[spots_.locXL])); - locY_->setValue (static_cast (row[spots_.locY])); - locYT_->setValue (static_cast (row[spots_.locYT])); - centerX_->setValue (static_cast (row[spots_.centerX])); - centerY_->setValue (static_cast (row[spots_.centerY])); - circrad_->setValue (static_cast (row[spots_.circrad])); - qualityMethod_->set_active (row[spots_.qualityMethod]); - transit_->setValue (static_cast (row[spots_.transit])); - thresh_->setValue (static_cast (row[spots_.thresh])); - iter_->setValue (static_cast (row[spots_.iter])); + // Load param in selected control spot + shape_->set_active (row[spots_.shape]); + spotMethod_->set_active (row[spots_.spotMethod]); + shapeMethod_->set_active (row[spots_.shapeMethod]); + locX_->setValue (static_cast (row[spots_.locX])); + locXL_->setValue (static_cast (row[spots_.locXL])); + locY_->setValue (static_cast (row[spots_.locY])); + locYT_->setValue (static_cast (row[spots_.locYT])); + centerX_->setValue (static_cast (row[spots_.centerX])); + centerY_->setValue (static_cast (row[spots_.centerY])); + circrad_->setValue (static_cast (row[spots_.circrad])); + qualityMethod_->set_active (row[spots_.qualityMethod]); + transit_->setValue (static_cast (row[spots_.transit])); + thresh_->setValue (static_cast (row[spots_.thresh])); + iter_->setValue (static_cast (row[spots_.iter])); - // Listener are reactivated - disableParamlistener (false); + // Listener are reactivated + disableParamlistener (false); - updateParamVisibility (); + updateParamVisibility (); } void ControlSpotPanel::controlspotChanged () { - printf("controlspotChanged\n"); - load_ControlSpot_param(); + printf("controlspotChanged\n"); + load_ControlSpot_param(); } void ControlSpotPanel::shapeChanged () { - save_ControlSpot_param(); + save_ControlSpot_param(); - printf("shapeChanged\n"); - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return; - } - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; - updateControlSpotCurve (row); + printf("shapeChanged\n"); + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return; + } + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + updateControlSpotCurve (row); } void ControlSpotPanel::shapeMethodeChanged () { - printf("shapeMethodeChanged\n"); - const int method = shapeMethod_->get_active_row_number (); + printf("shapeMethodeChanged\n"); + const int method = shapeMethod_->get_active_row_number (); - if (method == 1 || method == 3) { // Symmetrical cases - locXL_->setValue (locX_->getValue ()); - locYT_->setValue (locY_->getValue ()); + if (method == 1 || method == 3) { // Symmetrical cases + locXL_->setValue (locX_->getValue ()); + locYT_->setValue (locY_->getValue ()); - // Update associated control spot curve - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return; - } - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; - save_ControlSpot_param (); - updateControlSpotCurve (row); - } else { - save_ControlSpot_param (); - } + // Update associated control spot curve + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return; + } + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + save_ControlSpot_param (); + updateControlSpotCurve (row); + } else { + save_ControlSpot_param (); + } - updateParamVisibility (); + updateParamVisibility (); } void ControlSpotPanel::updateParamVisibility () { - printf("updateParamVisibility\n"); - const int method = shapeMethod_->get_active_row_number (); + printf("updateParamVisibility\n"); + const int method = shapeMethod_->get_active_row_number (); - if (method == 1 || method == 3) { // Symmetrical cases - locXL_->hide (); - locYT_->hide (); - if (method == 1) { // 1 = Symmetrical (mouse) - locX_->hide (); - locY_->hide (); - centerX_->hide (); - centerY_->hide (); - } else { // 3 = Symmetrical (mouse + sliders) - locX_->show (); - locY_->show (); - centerX_->show (); - centerY_->show (); - } - } else { // Independent cases - if (method == 0) { // 0 = Independent (mouse) - locX_->hide (); - locXL_->hide (); - locY_->hide (); - locYT_->hide (); - centerX_->hide (); - centerY_->hide (); - } else { // 2 = Independent (mouse + sliders) - locX_->show (); - locXL_->show (); - locY_->show (); - locYT_->show (); - centerX_->show (); - centerY_->show (); - } - } + if (method == 1 || method == 3) { // Symmetrical cases + locXL_->hide (); + locYT_->hide (); + if (method == 1) { // 1 = Symmetrical (mouse) + locX_->hide (); + locY_->hide (); + centerX_->hide (); + centerY_->hide (); + } else { // 3 = Symmetrical (mouse + sliders) + locX_->show (); + locY_->show (); + centerX_->show (); + centerY_->show (); + } + } else { // Independent cases + if (method == 0) { // 0 = Independent (mouse) + locX_->hide (); + locXL_->hide (); + locY_->hide (); + locYT_->hide (); + centerX_->hide (); + centerY_->hide (); + } else { // 2 = Independent (mouse + sliders) + locX_->show (); + locXL_->show (); + locY_->show (); + locYT_->show (); + centerX_->show (); + centerY_->show (); + } + } } void ControlSpotPanel::adjusterChanged(Adjuster* a, double newval) { - printf("adjusterChanged\n"); - const int method = shapeMethod_->get_active_row_number (); - if (method == 1 || method == 3) { // Symmetrical cases - locXL_->setValue (locX_->getValue ()); - locYT_->setValue (locY_->getValue ()); - } + printf("adjusterChanged\n"); + const int method = shapeMethod_->get_active_row_number (); + if (method == 1 || method == 3) { // Symmetrical cases + locXL_->setValue (locX_->getValue ()); + locYT_->setValue (locY_->getValue ()); + } - save_ControlSpot_param(); + save_ControlSpot_param(); - // Update associated control spot curve - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return; - } - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; - updateControlSpotCurve (row); + // Update associated control spot curve + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return; + } + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; + updateControlSpotCurve (row); } void ControlSpotPanel::disableParamlistener(bool cond) { - printf("disableParamlistener: %d\n", cond); - shapeconn_.block(cond); - spotMethodconn_.block(cond); - shapeMethodconn_.block(cond); - locX_->block(cond); - locXL_->block(cond); - locY_->block(cond); - locYT_->block(cond); - centerX_->block(cond); - centerY_->block(cond); - circrad_->block(cond); - qualityMethodconn_.block(cond); - transit_->block(cond); - thresh_->block(cond); - iter_->block(cond); + printf("disableParamlistener: %d\n", cond); + shapeconn_.block(cond); + spotMethodconn_.block(cond); + shapeMethodconn_.block(cond); + locX_->block(cond); + locXL_->block(cond); + locY_->block(cond); + locYT_->block(cond); + centerX_->block(cond); + centerY_->block(cond); + circrad_->block(cond); + qualityMethodconn_.block(cond); + transit_->block(cond); + thresh_->block(cond); + iter_->block(cond); } void ControlSpotPanel::setParamEditable(bool cond) { - printf("setParamEditable: %d\n", cond); - shape_->set_sensitive(cond); - spotMethod_->set_sensitive(cond); - shapeMethod_->set_sensitive(cond); - locX_->set_sensitive(cond); - locXL_->set_sensitive(cond); - locY_->set_sensitive(cond); - locYT_->set_sensitive(cond); - centerX_->set_sensitive(cond); - centerY_->set_sensitive(cond); - circrad_->set_sensitive(cond); - qualityMethod_->set_sensitive(cond); - transit_->set_sensitive(cond); - thresh_->set_sensitive(cond); - iter_->set_sensitive(cond); + printf("setParamEditable: %d\n", cond); + shape_->set_sensitive(cond); + spotMethod_->set_sensitive(cond); + shapeMethod_->set_sensitive(cond); + locX_->set_sensitive(cond); + locXL_->set_sensitive(cond); + locY_->set_sensitive(cond); + locYT_->set_sensitive(cond); + centerX_->set_sensitive(cond); + centerY_->set_sensitive(cond); + circrad_->set_sensitive(cond); + qualityMethod_->set_sensitive(cond); + transit_->set_sensitive(cond); + thresh_->set_sensitive(cond); + iter_->set_sensitive(cond); } void ControlSpotPanel::addControlSpotCurve (Gtk::TreeModel::Row row) { - printf("addControlSpotCurve\n"); - if (row[spots_.curveid] > 0) { // Row has already an associated curve - return; - } + printf("addControlSpotCurve\n"); + if (row[spots_.curveid] > 0) { // Row has already an associated curve + return; + } - // Creation of visibleGeometry - Line* lineX; - lineX = new Line (); - lineX->innerLineWidth = 2.5; - lineX->datum = Geometry::IMAGE; - Line* lineXL; - lineXL = new Line (); - lineXL->innerLineWidth = 2.5; - lineXL->datum = Geometry::IMAGE; - Line* lineY; - lineY = new Line (); - lineY->innerLineWidth = 2.5; - lineY->datum = Geometry::IMAGE; - Line* lineYT; - lineYT = new Line (); - lineYT->innerLineWidth = 2.5; - lineYT->datum = Geometry::IMAGE; - Circle* centerCircle; - 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 + // Creation of visibleGeometry + Line* lineX; + lineX = new Line (); + lineX->innerLineWidth = 2.5; + lineX->datum = Geometry::IMAGE; + Line* lineXL; + lineXL = new Line (); + lineXL->innerLineWidth = 2.5; + lineXL->datum = Geometry::IMAGE; + Line* lineY; + lineY = new Line (); + lineY->innerLineWidth = 2.5; + lineY->datum = Geometry::IMAGE; + Line* lineYT; + lineYT = new Line (); + lineYT->innerLineWidth = 2.5; + lineYT->datum = Geometry::IMAGE; + Circle* centerCircle; + 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 - // Creation of mouseOverGeometry - lineX = new Line (); - lineX->innerLineWidth = 2.5; - lineX->datum = Geometry::IMAGE; - lineXL = new Line (); - lineXL->innerLineWidth = 2.5; - lineXL->datum = Geometry::IMAGE; - lineY = new Line (); - lineY->innerLineWidth = 2.5; - lineY->datum = Geometry::IMAGE; - lineYT = new Line (); - lineYT->innerLineWidth = 2.5; - lineYT->datum = Geometry::IMAGE; - 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 + // Creation of mouseOverGeometry + lineX = new Line (); + lineX->innerLineWidth = 2.5; + lineX->datum = Geometry::IMAGE; + lineXL = new Line (); + lineXL->innerLineWidth = 2.5; + lineXL->datum = Geometry::IMAGE; + lineY = new Line (); + lineY->innerLineWidth = 2.5; + lineY->datum = Geometry::IMAGE; + lineYT = new Line (); + lineYT->innerLineWidth = 2.5; + lineYT->datum = Geometry::IMAGE; + 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 - row[spots_.curveid] = EditSubscriber::visibleGeometry.size () / 10; + row[spots_.curveid] = EditSubscriber::visibleGeometry.size () / 10; } void ControlSpotPanel::updateControlSpotCurve (Gtk::TreeModel::Row row) { - const int curveid_ = static_cast (row[spots_.curveid]); - if (curveid_ == 0) { // Row has no associated curve - return; - } - const int centerX_ = static_cast (row[spots_.centerX]); - const int centerY_ = static_cast (row[spots_.centerY]); - const int circrad_ = static_cast (row[spots_.circrad]); - const int locX_ = static_cast (row[spots_.locX]); - const int locXL_ = static_cast (row[spots_.locXL]); - const int locY_ = static_cast (row[spots_.locY]); - const int locYT_ = static_cast (row[spots_.locYT]); - const int shape_ = static_cast (row[spots_.shape]); + const int curveid_ = static_cast (row[spots_.curveid]); + if (curveid_ == 0) { // Row has no associated curve + return; + } + const int centerX_ = static_cast (row[spots_.centerX]); + const int centerY_ = static_cast (row[spots_.centerY]); + const int circrad_ = static_cast (row[spots_.circrad]); + const int locX_ = static_cast (row[spots_.locX]); + const int locXL_ = static_cast (row[spots_.locXL]); + const int locY_ = static_cast (row[spots_.locY]); + const int locYT_ = static_cast (row[spots_.locYT]); + const int shape_ = static_cast (row[spots_.shape]); - printf("updateControlSpotCurve: %d\n", curveid_); + printf("updateControlSpotCurve: %d\n", curveid_); EditDataProvider* dataProvider = getEditProvider(); @@ -678,9 +678,9 @@ void ControlSpotPanel::updateControlSpotCurve (Gtk::TreeModel::Row row) int imW = 0; int imH = 0; dataProvider->getImageSize(imW, imH); - if (!imW || !imH) { - return; - } + if (!imW || !imH) { + return; + } const double decayX = (locX_) * (double (imW)) / 2000.; const double decayXL = (locXL_) * (double (imW)) / 2000.; @@ -712,11 +712,11 @@ void ControlSpotPanel::updateControlSpotCurve (Gtk::TreeModel::Row row) }; const auto updateRectangle = [&](Geometry * geometry) { - const auto rectangle = static_cast (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; + const auto rectangle = static_cast (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; }; updateLineWithDecay(visibleGeometry.at((curveid_ - 1) * 10), 500., 90., 0., decayX); @@ -734,216 +734,216 @@ void ControlSpotPanel::updateControlSpotCurve (Gtk::TreeModel::Row row) updateCircle(visibleGeometry.at((curveid_ - 1) * 10 + 4)); updateCircle(mouseOverGeometry.at((curveid_ - 1) * 10 + 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); + 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); - updateRectangle(visibleGeometry.at((curveid_ - 1) * 10 + 9)); - updateRectangle(mouseOverGeometry.at((curveid_ - 1) * 10 + 9)); + updateRectangle(visibleGeometry.at((curveid_ - 1) * 10 + 9)); + updateRectangle(mouseOverGeometry.at((curveid_ - 1) * 10 + 9)); - // Update Arcellipse/Rectangle visibility according to shape - 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 + // Update Arcellipse/Rectangle visibility according to shape + 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::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 - } 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::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 + } 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::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) * 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 + } } void ControlSpotPanel::deleteControlSpotCurve (Gtk::TreeModel::Row row) { - const int curveid_ = static_cast (row[spots_.curveid]); - if (curveid_ == 0) { // Row has no associated curve - return; - } - printf("deleteControlSpotCurve: %d\n", curveid_); + const int curveid_ = static_cast (row[spots_.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); + // 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); - // 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); + // 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); - row[spots_.curveid] = 0; // Reset associated curve id + row[spots_.curveid] = 0; // Reset associated curve id - // Reordering curve id - Gtk::TreeModel::Children children = treemodel_->children (); - for (auto iter = children.begin (); iter != children.end (); iter++) { - Gtk::TreeModel::Row r = *iter; - if (r[spots_.curveid] > curveid_) { - r[spots_.curveid] = r[spots_.curveid] - 1; - } - } + // Reordering curve id + Gtk::TreeModel::Children children = treemodel_->children (); + for (auto iter = children.begin (); iter != children.end (); iter++) { + Gtk::TreeModel::Row r = *iter; + if (r[spots_.curveid] > curveid_) { + r[spots_.curveid] = r[spots_.curveid] - 1; + } + } } CursorShape ControlSpotPanel::getCursor (int objectID) { - printf ("Object ID: %d\n", objectID); - int rem_ = objectID % 10; + printf ("Object ID: %d\n", objectID); + int rem_ = objectID % 10; - switch (rem_) { - case (0): // LocX: (curveid_ - 1) * 10 - return CSMove1DH; - case (1): // LocXL: (curveid_ - 1) * 10 + 1 - return CSMove1DH; - case (2): // LocY: (curveid_ - 1) * 10 + 2 - return CSMove1DV; - case (3): // LocYT: (curveid_ - 1) * 10 + 3 - return CSMove1DV; - case (4): // centerCircle: (curveid_ - 1) * 10 + 4 - return CSMove2D; - case (5): // arc1: (curveid_ - 1) * 10 + 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 - return CSMove2D; - default: - return CSOpenHand; - } + switch (rem_) { + case (0): // LocX: (curveid_ - 1) * 10 + return CSMove1DH; + case (1): // LocXL: (curveid_ - 1) * 10 + 1 + return CSMove1DH; + case (2): // LocY: (curveid_ - 1) * 10 + 2 + return CSMove1DV; + case (3): // LocYT: (curveid_ - 1) * 10 + 3 + return CSMove1DV; + case (4): // centerCircle: (curveid_ - 1) * 10 + 4 + return CSMove2D; + case (5): // arc1: (curveid_ - 1) * 10 + 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 + return CSMove2D; + default: + return CSOpenHand; + } } bool ControlSpotPanel::mouseOver (int modifierKey) { EditDataProvider* editProvider_ = getEditProvider(); if (!editProvider_) { - return false; + return false; } int object_ = editProvider_->object; if (object_ != lastObject_) { - if (object_ == -1) { - for (int it_ = 0; it_ < (int) EditSubscriber::visibleGeometry.size (); it_++) { - EditSubscriber::visibleGeometry.at(it_)->state = Geometry::NORMAL; - } - lastObject_ = object_; - return false; - } + if (object_ == -1) { + for (int it_ = 0; it_ < (int) EditSubscriber::visibleGeometry.size (); it_++) { + EditSubscriber::visibleGeometry.at(it_)->state = Geometry::NORMAL; + } + lastObject_ = object_; + return false; + } - int curveId_ = object_ / 10 + 1; - int rem = object_ % 10; - 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 - EditSubscriber::visibleGeometry.at(it_)->state = Geometry::NORMAL; - } - } + int curveId_ = object_ / 10 + 1; + int rem = object_ % 10; + 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 + EditSubscriber::visibleGeometry.at(it_)->state = Geometry::NORMAL; + } + } - const int method = shapeMethod_->get_active_row_number (); + const int method = shapeMethod_->get_active_row_number (); - // LocX - if (rem == 0) { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT; + // LocX + if (rem == 0) { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT; - if (method == 1 || method == 3) { // Symmetrical cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT; - } - } else { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::NORMAL; - } + if (method == 1 || method == 3) { // Symmetrical cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT; + } + } else { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::NORMAL; + } - // LocXL - if (rem == 1) { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT; + // LocXL + if (rem == 1) { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::PRELIGHT; - if (method == 1 || method == 3) { // Symmetrical cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT; - } - } else { - if (method == 0 || method == 2) { // Independent cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::NORMAL; - } - } + if (method == 1 || method == 3) { // Symmetrical cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10)->state = Geometry::PRELIGHT; + } + } else { + if (method == 0 || method == 2) { // Independent cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 1)->state = Geometry::NORMAL; + } + } - // LocY - if (rem == 2) { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT; + // LocY + if (rem == 2) { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT; - if (method == 1 || method == 3) { // Symmetrical cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT; - } - } else { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::NORMAL; - } + if (method == 1 || method == 3) { // Symmetrical cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT; + } + } else { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::NORMAL; + } - // LocYT - if (rem == 3) { - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT; + // LocYT + if (rem == 3) { + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::PRELIGHT; - if (method == 1 || method == 3) { // Symmetrical cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT; - } - } else { - if (method == 0 || method == 2) { // Independent cases - EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 3)->state = Geometry::NORMAL; - } - } + if (method == 1 || method == 3) { // Symmetrical cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 2)->state = Geometry::PRELIGHT; + } + } else { + if (method == 0 || method == 2) { // Independent cases + EditSubscriber::visibleGeometry.at((curveId_ - 1) * 10 + 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; - } 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; - } + // 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; + } 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; + } - lastObject_ = object_; - return true; + lastObject_ = object_; + return true; } return false; @@ -951,114 +951,114 @@ bool ControlSpotPanel::mouseOver (int modifierKey) bool ControlSpotPanel::button1Pressed (int modifierKey) { - printf("button1Pressed\n"); - EditDataProvider *provider = getEditProvider (); - if (!provider || lastObject_ == -1) { + printf("button1Pressed\n"); + EditDataProvider *provider = getEditProvider (); + if (!provider || lastObject_ == -1) { return false; } - // Select associated control spot - int curveId_ = lastObject_ / 10 + 1; - Gtk::TreeModel::Children children = treemodel_->children (); - for (auto iter = children.begin (); iter != children.end (); iter++) { - Gtk::TreeModel::Row r = *iter; - if (r[spots_.curveid] == curveId_) { - treeview_.set_cursor (treemodel_->get_path (r)); - break; - } - } + // Select associated control spot + int curveId_ = lastObject_ / 10 + 1; + Gtk::TreeModel::Children children = treemodel_->children (); + for (auto iter = children.begin (); iter != children.end (); iter++) { + Gtk::TreeModel::Row r = *iter; + if (r[spots_.curveid] == curveId_) { + treeview_.set_cursor (treemodel_->get_path (r)); + break; + } + } - lastCoord_->set (provider->posImage.x + provider->deltaImage.x, provider->posImage.y + provider->deltaImage.y); - EditSubscriber::action = ES_ACTION_DRAGGING; - return true; + lastCoord_->set (provider->posImage.x + provider->deltaImage.x, provider->posImage.y + provider->deltaImage.y); + EditSubscriber::action = ES_ACTION_DRAGGING; + return true; } bool ControlSpotPanel::button1Released () { - printf("button1Released\n"); - EditSubscriber::action = ES_ACTION_NONE; + printf("button1Released\n"); + EditSubscriber::action = ES_ACTION_NONE; return true; } bool ControlSpotPanel::drag1 (int modifierKey) { - printf("drag1\n"); + printf("drag1\n"); - EditDataProvider *provider = getEditProvider (); - if (!provider || lastObject_ == -1) { - return false; - } + EditDataProvider *provider = getEditProvider (); + if (!provider || lastObject_ == -1) { + return false; + } - // Get associated control spot - const auto s = treeview_.get_selection(); - if (!s->count_selected_rows()) { - return false; - } - const auto iter = s->get_selected(); - Gtk::TreeModel::Row row = *iter; + // Get associated control spot + const auto s = treeview_.get_selection(); + if (!s->count_selected_rows()) { + return false; + } + const auto iter = s->get_selected(); + Gtk::TreeModel::Row row = *iter; - int imW, imH; - provider->getImageSize (imW, imH); - int rem = lastObject_ % 10; - int method = shapeMethod_->get_active_row_number (); - Coord* newCoord = new Coord (provider->posImage.x + provider->deltaImage.x, provider->posImage.y + provider->deltaImage.y); + int imW, imH; + provider->getImageSize (imW, imH); + int rem = lastObject_ % 10; + int method = shapeMethod_->get_active_row_number (); + Coord* newCoord = new Coord (provider->posImage.x + provider->deltaImage.x, provider->posImage.y + provider->deltaImage.y); - // LocX - if (rem == 0) { - double deltaX = (double (newCoord->x) - double (lastCoord_->x)) * 2000. / double (imW); - locX_->setValue (locX_->getValue () + deltaX); - if (method == 1 || method == 3) { // Symmetrical cases - locXL_->setValue (locX_->getValue ()); - } - save_ControlSpot_param (); - updateControlSpotCurve (row); - } + // LocX + if (rem == 0) { + double deltaX = (double (newCoord->x) - double (lastCoord_->x)) * 2000. / double (imW); + locX_->setValue (locX_->getValue () + deltaX); + if (method == 1 || method == 3) { // Symmetrical cases + locXL_->setValue (locX_->getValue ()); + } + save_ControlSpot_param (); + updateControlSpotCurve (row); + } - // LocXL - if (rem == 1) { - double deltaXL = (double (lastCoord_->x) - double (newCoord->x)) * 2000. / double (imW); - locXL_->setValue (locXL_->getValue () + deltaXL); - if (method == 1 || method == 3) { // Symmetrical cases - locX_->setValue (locXL_->getValue ()); - } - save_ControlSpot_param (); - updateControlSpotCurve (row); - } + // LocXL + if (rem == 1) { + double deltaXL = (double (lastCoord_->x) - double (newCoord->x)) * 2000. / double (imW); + locXL_->setValue (locXL_->getValue () + deltaXL); + if (method == 1 || method == 3) { // Symmetrical cases + locX_->setValue (locXL_->getValue ()); + } + save_ControlSpot_param (); + updateControlSpotCurve (row); + } - // LocY - if (rem == 2) { - double deltaY = (double (newCoord->y) - double (lastCoord_->y)) * 2000. / double (imH); - locY_->setValue (locY_->getValue () + deltaY); - if (method == 1 || method == 3) { // Symmetrical cases - locYT_->setValue (locY_->getValue ()); - } - save_ControlSpot_param (); - updateControlSpotCurve (row); - } + // LocY + if (rem == 2) { + double deltaY = (double (newCoord->y) - double (lastCoord_->y)) * 2000. / double (imH); + locY_->setValue (locY_->getValue () + deltaY); + if (method == 1 || method == 3) { // Symmetrical cases + locYT_->setValue (locY_->getValue ()); + } + save_ControlSpot_param (); + updateControlSpotCurve (row); + } - // LocYT - if (rem == 3) { - double deltaYT = (double (lastCoord_->y) - double (newCoord->y)) * 2000. / double (imH); - locYT_->setValue (locYT_->getValue () + deltaYT); - if (method == 1 || method == 3) { // Symmetrical cases - locY_->setValue (locYT_->getValue ()); - } - save_ControlSpot_param (); - updateControlSpotCurve (row); - } + // LocYT + if (rem == 3) { + double deltaYT = (double (lastCoord_->y) - double (newCoord->y)) * 2000. / double (imH); + locYT_->setValue (locYT_->getValue () + deltaYT); + if (method == 1 || method == 3) { // Symmetrical cases + locY_->setValue (locYT_->getValue ()); + } + save_ControlSpot_param (); + updateControlSpotCurve (row); + } - // Circle, Arcellipses 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); - centerX_->setValue (centerX_->getValue () + deltaX); - centerY_->setValue (centerY_->getValue () + deltaY); - save_ControlSpot_param (); - updateControlSpotCurve (row); - } + // Circle, Arcellipses 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); + centerX_->setValue (centerX_->getValue () + deltaX); + centerY_->setValue (centerY_->getValue () + deltaY); + save_ControlSpot_param (); + updateControlSpotCurve (row); + } - lastCoord_->set (newCoord->x, newCoord->y); - return true; + lastCoord_->set (newCoord->x, newCoord->y); + return true; } //----------------------------------------------------------------------------- @@ -1067,24 +1067,24 @@ bool ControlSpotPanel::drag1 (int modifierKey) ControlSpotPanel::ControlSpots::ControlSpots() { - add (id); - add (name); - add (isvisible); - add (curveid); - add (shape); - add (spotMethod); - add (shapeMethod); - add (locX); - add (locXL); - add (locYT); - add (locY); - add (centerX); - add (centerY); - add (circrad); - add (qualityMethod); - add (transit); - add (thresh); - add (iter); + add (id); + add (name); + add (isvisible); + add (curveid); + add (shape); + add (spotMethod); + add (shapeMethod); + add (locX); + add (locXL); + add (locYT); + add (locY); + add (centerX); + add (centerY); + add (circrad); + add (qualityMethod); + add (transit); + add (thresh); + add (iter); } //----------------------------------------------------------------------------- @@ -1092,23 +1092,23 @@ ControlSpotPanel::ControlSpots::ControlSpots() //----------------------------------------------------------------------------- ControlSpotPanel::RenameDialog::RenameDialog(const Glib::ustring &actualname, Gtk::Window &parent): - Gtk::Dialog ("Renaming Control Spot", parent) + Gtk::Dialog ("Renaming Control Spot", parent) { - Gtk::HBox *hb = Gtk::manage (new Gtk::HBox()); - hb->pack_start (*Gtk::manage (new Gtk::Label ("Enter the new Control Spot name")), false, false, 4); + Gtk::HBox *hb = Gtk::manage (new Gtk::HBox()); + hb->pack_start (*Gtk::manage (new Gtk::Label ("Enter the new Control Spot name")), false, false, 4); - newname_.set_text(actualname); - hb->pack_start(newname_); + newname_.set_text(actualname); + hb->pack_start(newname_); - get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4); + get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4); - add_button (M ("GENERAL_OK"), 1); - add_button (M ("GENERAL_CANCEL"), 2); + add_button (M ("GENERAL_OK"), 1); + add_button (M ("GENERAL_CANCEL"), 2); - show_all_children(); + show_all_children(); } Glib::ustring ControlSpotPanel::RenameDialog::get_new_name() { - return newname_.get_text(); + return newname_.get_text(); } diff --git a/rtgui/controlspotpanel.h b/rtgui/controlspotpanel.h index d8aa6c068..c1400954b 100644 --- a/rtgui/controlspotpanel.h +++ b/rtgui/controlspotpanel.h @@ -14,118 +14,118 @@ #include class ControlSpotPanel: - public ToolParamBlock, - public AdjusterListener, - public EditSubscriber + public ToolParamBlock, + public AdjusterListener, + public EditSubscriber { public: - ControlSpotPanel(); - void setEditProvider(EditDataProvider* provider); + ControlSpotPanel(); + void setEditProvider(EditDataProvider* provider); private: - // cell renderer - void render_id (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); - void render_name (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); - void render_isvisible (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); + // cell renderer + void render_id (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); + void render_name (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); + void render_isvisible (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter); - void on_button_add(); - void on_button_delete(); - void on_button_rename(); - // TODO Add visibility button - // TODO Add duplication button + void on_button_add(); + void on_button_delete(); + void on_button_rename(); + // TODO Add visibility button + // TODO Add duplication button - void save_ControlSpot_param(); - void load_ControlSpot_param(); + void save_ControlSpot_param(); + void load_ControlSpot_param(); - void controlspotChanged(); + void controlspotChanged(); - void shapeChanged(); - void shapeMethodeChanged(); - void updateParamVisibility(); - void adjusterChanged(Adjuster* a, double newval); - void disableParamlistener(bool cond); - void setParamEditable(bool cond); + void shapeChanged(); + void shapeMethodeChanged(); + void updateParamVisibility(); + void adjusterChanged(Adjuster* a, double newval); + void disableParamlistener(bool cond); + void setParamEditable(bool cond); - void addControlSpotCurve(Gtk::TreeModel::Row row); - void updateControlSpotCurve(Gtk::TreeModel::Row row); - void deleteControlSpotCurve(Gtk::TreeModel::Row row); - CursorShape getCursor(int objectID); - bool mouseOver(int modifierKey); - bool button1Pressed(int modifierKey); - bool button1Released(); - bool drag1(int modifierKey); + void addControlSpotCurve(Gtk::TreeModel::Row row); + void updateControlSpotCurve(Gtk::TreeModel::Row row); + void deleteControlSpotCurve(Gtk::TreeModel::Row row); + CursorShape getCursor(int objectID); + bool mouseOver(int modifierKey); + bool button1Pressed(int modifierKey); + bool button1Released(); + bool drag1(int modifierKey); - class ControlSpots: - public Gtk::TreeModel::ColumnRecord - { - public: - ControlSpots(); + class ControlSpots: + public Gtk::TreeModel::ColumnRecord + { + public: + ControlSpots(); - Gtk::TreeModelColumn id; // Control spot id - Gtk::TreeModelColumn name; - Gtk::TreeModelColumn isvisible; - Gtk::TreeModelColumn curveid; // Associated curve id - Gtk::TreeModelColumn shape; // 0 = Ellipse, 1 = Rectangle - Gtk::TreeModelColumn spotMethod; // 0 = Normal, 1 = Excluding - Gtk::TreeModelColumn shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) - Gtk::TreeModelColumn locX; - Gtk::TreeModelColumn locXL; - Gtk::TreeModelColumn locY; - Gtk::TreeModelColumn locYT; - Gtk::TreeModelColumn centerX; - Gtk::TreeModelColumn centerY; - Gtk::TreeModelColumn circrad; - Gtk::TreeModelColumn qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise - Gtk::TreeModelColumn transit; - Gtk::TreeModelColumn thresh; - Gtk::TreeModelColumn iter; - }; + Gtk::TreeModelColumn id; // Control spot id + Gtk::TreeModelColumn name; + Gtk::TreeModelColumn isvisible; + Gtk::TreeModelColumn curveid; // Associated curve id + Gtk::TreeModelColumn shape; // 0 = Ellipse, 1 = Rectangle + Gtk::TreeModelColumn spotMethod; // 0 = Normal, 1 = Excluding + Gtk::TreeModelColumn shapeMethod; // 0 = Independent (mouse), 1 = Symmetrical (mouse), 2 = Independent (mouse + sliders), 3 = Symmetrical (mouse + sliders) + Gtk::TreeModelColumn locX; + Gtk::TreeModelColumn locXL; + Gtk::TreeModelColumn locY; + Gtk::TreeModelColumn locYT; + Gtk::TreeModelColumn centerX; + Gtk::TreeModelColumn centerY; + Gtk::TreeModelColumn circrad; + Gtk::TreeModelColumn qualityMethod; // 0 = Standard, 1 = Enhanced, 2 = Enhanced + chroma denoise + Gtk::TreeModelColumn transit; + Gtk::TreeModelColumn thresh; + Gtk::TreeModelColumn iter; + }; - class RenameDialog: - public Gtk::Dialog - { - public: - RenameDialog (const Glib::ustring &actualname, Gtk::Window &parent); - Glib::ustring get_new_name(); + class RenameDialog: + public Gtk::Dialog + { + public: + RenameDialog (const Glib::ustring &actualname, Gtk::Window &parent); + Glib::ustring get_new_name(); - private: - Gtk::Entry newname_; - }; + private: + Gtk::Entry newname_; + }; - ControlSpots spots_; + ControlSpots spots_; - // Child widgets - Gtk::ScrolledWindow scrolledwindow_; - Gtk::TreeView treeview_; - Glib::RefPtr treemodel_; + // Child widgets + Gtk::ScrolledWindow scrolledwindow_; + Gtk::TreeView treeview_; + Glib::RefPtr treemodel_; - Gtk::ButtonBox buttonbox_; - Gtk::Button button_add_; - Gtk::Button button_delete_; - Gtk::Button button_rename_; + Gtk::ButtonBox buttonbox_; + Gtk::Button button_add_; + Gtk::Button button_delete_; + Gtk::Button button_rename_; - MyComboBoxText* const shape_; - sigc::connection shapeconn_; - MyComboBoxText* const spotMethod_; - sigc::connection spotMethodconn_; - MyComboBoxText* const shapeMethod_; - sigc::connection shapeMethodconn_; - MyComboBoxText* const qualityMethod_; - sigc::connection qualityMethodconn_; + MyComboBoxText* const shape_; + sigc::connection shapeconn_; + MyComboBoxText* const spotMethod_; + sigc::connection spotMethodconn_; + MyComboBoxText* const shapeMethod_; + sigc::connection shapeMethodconn_; + MyComboBoxText* const qualityMethod_; + sigc::connection qualityMethodconn_; - Adjuster* const locX_; - Adjuster* const locXL_; - Adjuster* const locY_; - Adjuster* const locYT_; - Adjuster* const centerX_; - Adjuster* const centerY_; - Adjuster* const circrad_; - Adjuster* const transit_; - Adjuster* const thresh_; - Adjuster* const iter_; + Adjuster* const locX_; + Adjuster* const locXL_; + Adjuster* const locY_; + Adjuster* const locYT_; + Adjuster* const centerX_; + Adjuster* const centerY_; + Adjuster* const circrad_; + Adjuster* const transit_; + Adjuster* const thresh_; + Adjuster* const iter_; - int lastObject_; - rtengine::Coord* lastCoord_; + int lastObject_; + rtengine::Coord* lastCoord_; }; #endif // _CONTROLSPOTPANEL_H_ diff --git a/rtgui/edit.cc b/rtgui/edit.cc index 71870105b..006f2389b 100644 --- a/rtgui/edit.cc +++ b/rtgui/edit.cc @@ -41,21 +41,21 @@ void ObjectMOBuffer::setObjectMode (ObjectMode newType) if (w && h) { switch (newType) { - case (OM_255): - if (objectMode == OM_65535) { - objectMap->unreference(); - objectMap = Cairo::ImageSurface::create (Cairo::FORMAT_A8, w, h); - } + case (OM_255): + if (objectMode == OM_65535) { + objectMap->unreference(); + objectMap = Cairo::ImageSurface::create (Cairo::FORMAT_A8, w, h); + } - break; + break; - case (OM_65535): - if (objectMode == OM_255) { - objectMap->unreference(); - objectMap = Cairo::ImageSurface::create (Cairo::FORMAT_RGB16_565, w, h); - } + case (OM_65535): + if (objectMode == OM_255) { + objectMap->unreference(); + objectMap = Cairo::ImageSurface::create (Cairo::FORMAT_RGB16_565, w, h); + } - break; + break; } } @@ -382,13 +382,13 @@ void Arcellipse::drawInnerGeometry (Cairo::RefPtr &cr, ObjectMOB cr->save(); // To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale - // of rad2 / rad1 for y axis - // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one - // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis - // (Y = rad2 / rad1 * y and y = t + Y) - double scale_ = radius2_ / radius_; - cr->scale (1., scale_); - cr->translate (0., - center_.y * (1 - 1 / scale_)); + // of rad2 / rad1 for y axis + // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one + // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis + // (Y = rad2 / rad1 * y and y = t + Y) + double scale_ = radius2_ / radius_; + cr->scale (1., scale_); + cr->translate (0., - center_.y * (1 - 1 / scale_)); cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_); @@ -407,13 +407,13 @@ void Arcellipse::drawInnerGeometry (Cairo::RefPtr &cr, ObjectMOB cr->save(); // To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale - // of rad2 / rad1 for y axis - // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one - // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis - // (Y = rad2 / rad1 * y and y = t + Y) - double scale_ = radius2_ / radius_; - cr->scale (1., scale_); - cr->translate (0., - center_.y * (1 - 1 / scale_)); + // of rad2 / rad1 for y axis + // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one + // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis + // (Y = rad2 / rad1 * y and y = t + Y) + double scale_ = radius2_ / radius_; + cr->scale (1., scale_); + cr->translate (0., - center_.y * (1 - 1 / scale_)); cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_); @@ -463,13 +463,13 @@ void Arcellipse::drawToMOChannel (Cairo::RefPtr &cr, unsigned sh cr->save(); // To have an ellipse with radius of (rad1, rad2), a circle of radius rad1 shall be twisted with a scale - // of rad2 / rad1 for y axis - // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one - // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis - // (Y = rad2 / rad1 * y and y = t + Y) - double scale_ = radius2_ / radius_; - cr->scale (1., scale_); - cr->translate (0., - center_.y * (1 - 1 / scale_)); + // of rad2 / rad1 for y axis + // Center of coordinates (x, y) in previous coordinates system becomes (X, Y) = (x, rad2 / rad1 * y) in new one + // To go back to previous location, center shall be translated to t = -Y * (1 - rad1 / rad2) in y axis + // (Y = rad2 / rad1 * y and y = t + Y) + double scale_ = radius2_ / radius_; + cr->scale (1., scale_); + cr->translate (0., - center_.y * (1 - 1 / scale_)); cr->arc (center_.x + 0.5, center_.y + 0.5, radius_, begang_, endang_); @@ -1095,50 +1095,50 @@ void OPIcon::drivenPointToRectangle (const rtengine::Coord &pos, rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H) { switch (drivenPoint) { - case (DP_CENTERCENTER): - topLeft.x = pos.x - W / 2; - topLeft.y = pos.y - H / 2; - break; + case (DP_CENTERCENTER): + topLeft.x = pos.x - W / 2; + topLeft.y = pos.y - H / 2; + break; - case (DP_TOPLEFT): - topLeft.x = pos.x; - topLeft.y = pos.y; - break; + case (DP_TOPLEFT): + topLeft.x = pos.x; + topLeft.y = pos.y; + break; - case (DP_TOPCENTER): - topLeft.x = pos.x - W / 2; - topLeft.y = pos.y; - break; + case (DP_TOPCENTER): + topLeft.x = pos.x - W / 2; + topLeft.y = pos.y; + break; - case (DP_TOPRIGHT): - topLeft.x = pos.x - W; - topLeft.y = pos.y; - break; + case (DP_TOPRIGHT): + topLeft.x = pos.x - W; + topLeft.y = pos.y; + break; - case (DP_CENTERRIGHT): - topLeft.x = pos.x - W; - topLeft.y = pos.y - H / 2; - break; + case (DP_CENTERRIGHT): + topLeft.x = pos.x - W; + topLeft.y = pos.y - H / 2; + break; - case (DP_BOTTOMRIGHT): - topLeft.x = pos.x - W; - topLeft.y = pos.y - H; - break; + case (DP_BOTTOMRIGHT): + topLeft.x = pos.x - W; + topLeft.y = pos.y - H; + break; - case (DP_BOTTOMCENTER): - topLeft.x = pos.x - W / 2; - topLeft.y = pos.y - H; - break; + case (DP_BOTTOMCENTER): + topLeft.x = pos.x - W / 2; + topLeft.y = pos.y - H; + break; - case (DP_BOTTOMLEFT): - topLeft.x = pos.x; - topLeft.y = pos.y - H; - break; + case (DP_BOTTOMLEFT): + topLeft.x = pos.x; + topLeft.y = pos.y - H; + break; - case (DP_CENTERLEFT): - topLeft.x = pos.x; - topLeft.y = pos.y - H / 2; - break; + case (DP_CENTERLEFT): + topLeft.x = pos.x; + topLeft.y = pos.y - H / 2; + break; } bottomRight.x = topLeft.x + W - 1; diff --git a/rtgui/locallab.cc b/rtgui/locallab.cc index d56de590b..11a44497d 100644 --- a/rtgui/locallab.cc +++ b/rtgui/locallab.cc @@ -487,13 +487,13 @@ Locallab::Locallab(): lightness->setAdjusterListener(this); contrast->setAdjusterListener(this); -/* - Gtk::Image* iblueredL = Gtk::manage(new RTImage("ajd-wb-bluered1.png")); - Gtk::Image* iblueredR = Gtk::manage(new RTImage("ajd-wb-bluered2.png")); + /* + Gtk::Image* iblueredL = Gtk::manage(new RTImage("ajd-wb-bluered1.png")); + Gtk::Image* iblueredR = Gtk::manage(new RTImage("ajd-wb-bluered2.png")); - warm = Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., iblueredL, iblueredR)); - warm->setAdjusterListener(this); -*/ + warm = Gtk::manage(new Adjuster(M("TP_LOCALLAB_WARM"), -100., 100., 1., 0., iblueredL, iblueredR)); + warm->setAdjusterListener(this); + */ chroma->setAdjusterListener(this); sensi->set_tooltip_text(M("TP_LOCALLAB_SENSI_TOOLTIP")); @@ -3886,7 +3886,7 @@ void Locallab::inversChanged() } if (invers->get_active()) { - // warm->hide(); + // warm->hide(); sensi->show(); llCurveEditorG->hide(); curvactiv->hide(); @@ -3896,7 +3896,7 @@ void Locallab::inversChanged() } else { sensi->show(); - // warm->show(); + // warm->show(); llCurveEditorG->show(); curvactiv->show(); qualitycurveMethod->show(); @@ -4940,51 +4940,51 @@ void Locallab::colorForValue(double valX, double valY, enum ColorCaller::ElemTyp CursorShape Locallab::getCursor(int objectID) { switch (objectID) { - case (2): { - int angle = degree->getIntValue(); - - if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { - return CSMove1DV; - } - - return CSMove1DH; - } - - case (3): { - int angle = degree->getIntValue(); - - if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { - return CSMove1DV; - } - - return CSMove1DH; - } - - case (0): { - int angle = degree->getIntValue(); - - if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { - return CSMove1DH; - } + case (2): { + int angle = degree->getIntValue(); + if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { return CSMove1DV; } - case (1): { - int angle = degree->getIntValue(); + return CSMove1DH; + } - if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { - return CSMove1DH; - } + case (3): { + int angle = degree->getIntValue(); + if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { return CSMove1DV; } - case (4): - return CSMove2D; + return CSMove1DH; + } - default: - return CSOpenHand; + case (0): { + int angle = degree->getIntValue(); + + if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { + return CSMove1DH; + } + + return CSMove1DV; + } + + case (1): { + int angle = degree->getIntValue(); + + if (angle < -135 || (angle >= -45 && angle <= 45) || angle > 135) { + return CSMove1DH; + } + + return CSMove1DV; + } + + case (4): + return CSMove2D; + + default: + return CSOpenHand; } }