diff --git a/rtengine/colortemp.cc b/rtengine/colortemp.cc index a7a769d93..a22caddb8 100644 --- a/rtengine/colortemp.cc +++ b/rtengine/colortemp.cc @@ -1088,11 +1088,11 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, //}; gmul /= green; //printf("rmul=%f gmul=%f bmul=%f\n",rmul, gmul, bmul); - double max = rtengine::max(rmul, gmul, bmul); + double maxRGB = rtengine::max(rmul, gmul, bmul); - rmul /= max; - gmul /= max; - bmul /= max; + rmul /= maxRGB; + gmul /= maxRGB; + bmul /= maxRGB; if(settings->CRI_color != 0) { //activate if CRi_color !=0 @@ -1104,7 +1104,6 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, // and calcul with : blackbody at equivalent temp of lamp // CRI_color-1 = display Lab values of color CRI_color -1 const double whiteD50[3] = {0.9646019585, 1.0, 0.8244507152}; //calculate with this tool : spect 5nm - double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02 double Xchk[50], Ychk[50], Zchk[50]; //50 : I think it's a good limit for number of color : for CRI and Palette double Xcam02[50], Ycam02[50], Zcam02[50]; @@ -1113,9 +1112,6 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, const double epsilon = 0.008856; //Lab double xr[50], yr[50], zr[50]; - double fx[50], fy[50], fz[50]; - double x, y, z; - double Ywb = 1.0; int illum; int numero_color = settings->CRI_color - 1; @@ -1223,6 +1219,9 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, } if (CRI_type) { + double x, y, z; + double Ywb = 1.0; + const double* spect_illum[] = { Daylight5300_spect, Cloudy6200_spect, Shade7600_spect, A2856_spect, FluoF1_spect, FluoF2_spect, FluoF3_spect, FluoF4_spect, FluoF5_spect, FluoF6_spect, FluoF7_spect, FluoF8_spect, FluoF9_spect, FluoF10_spect, FluoF11_spect, @@ -1281,6 +1280,7 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, //calculate Matrix CAM02 : better than Von Kries and Bradford==> for Lamp double adap = 1.0; + double CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22; //for CIECAT02 cieCAT02(Xwb, Ywb, Zwb, CAM02BB00, CAM02BB01, CAM02BB02, CAM02BB10, CAM02BB11, CAM02BB12, CAM02BB20, CAM02BB21, CAM02BB22, adap); //here new value of X,Y,Z for lamp with chromatic CAM02 adaptation @@ -1306,6 +1306,7 @@ void ColorTemp::temp2mul (double temp, double green, double equal, double& rmul, //now conversion to Lab // Lamp + double fx[50], fy[50], fz[50]; for(int i = 0; i < N_c; i++) { xr[i] = Xcam02Lamp[i] / whiteD50[0]; diff --git a/rtgui/gradient.cc b/rtgui/gradient.cc index d7b2cb7c2..3f13dfe4d 100644 --- a/rtgui/gradient.cc +++ b/rtgui/gradient.cc @@ -422,9 +422,7 @@ bool Gradient::button1Pressed(int modifierKey) double diagonal = sqrt(double(imW) * double(imW) + double(imH) * double(imH)); // trick to get the correct angle (clockwise/counter-clockwise) - int p = centerPos.y; - centerPos.y = currPos.y; - currPos.y = p; + std::swap(centerPos.y, currPos.y); draggedPoint = currPos - centerPos; // compute the projected value of the dragged point diff --git a/rtgui/guiutils.cc b/rtgui/guiutils.cc index eda07af03..ec0bf6588 100644 --- a/rtgui/guiutils.cc +++ b/rtgui/guiutils.cc @@ -952,38 +952,27 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event) Gtk::Scrollbar *scroll = get_vscrollbar(); if (adjust && scroll) { - double upper = adjust->get_upper(); - double lower = adjust->get_lower(); + const double upperBound = adjust->get_upper(); + const double lowerBound = adjust->get_lower(); double value = adjust->get_value(); double step = adjust->get_step_increment(); double value2 = 0.; -// printf("MyScrolledwindow::on_scroll_event / delta_x=%.5f, delta_y=%.5f, direction=%d, type=%d, send_event=%d\n", -// event->delta_x, event->delta_y, (int)event->direction, (int)event->type, event->send_event); - if (event->direction == GDK_SCROLL_DOWN) { - value2 = value + step; - - if (value2 > upper) { - value2 = upper; - } + value2 = rtengine::min(value + step, upperBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_UP) { - value2 = value - step; - - if (value2 < lower) { - value2 = lower; - } + value2 = rtengine::max(value - step, lowerBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_SMOOTH) { if (abs(event->delta_y) > 0.1) { - value2 = rtengine::LIM(value + (event->delta_y > 0 ? step : -step), lower, upper); + value2 = rtengine::LIM(value + (event->delta_y > 0 ? step : -step), lowerBound, upperBound); } if (value2 != value) { scroll->set_value(value2); @@ -1032,8 +1021,8 @@ bool MyScrolledToolbar::on_scroll_event (GdkEventScroll* event) Gtk::Scrollbar *scroll = get_hscrollbar(); if (adjust && scroll) { - double upper = adjust->get_upper(); - double lower = adjust->get_lower(); + const double upperBound = adjust->get_upper(); + const double lowerBound = adjust->get_lower(); double value = adjust->get_value(); double step = adjust->get_step_increment() * 2; double value2 = 0.; @@ -1042,20 +1031,20 @@ bool MyScrolledToolbar::on_scroll_event (GdkEventScroll* event) // event->delta_x, event->delta_y, (int)event->direction, (int)event->type, event->send_event); if (event->direction == GDK_SCROLL_DOWN) { - value2 = rtengine::min(value + step, upper); + value2 = rtengine::min(value + step, upperBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_UP) { - value2 = rtengine::max(value - step, lower); + value2 = rtengine::max(value - step, lowerBound); if (value2 != value) { scroll->set_value(value2); } } else if (event->direction == GDK_SCROLL_SMOOTH) { if (event->delta_x) { // if the user use a pad, it can scroll horizontally - value2 = rtengine::LIM(value + (event->delta_x > 0 ? 30 : -30), lower, upper); + value2 = rtengine::LIM(value + (event->delta_x > 0 ? 30 : -30), lowerBound, upperBound); } else if (event->delta_y) { - value2 = rtengine::LIM(value + (event->delta_y > 0 ? 30 : -30), lower, upper); + value2 = rtengine::LIM(value + (event->delta_y > 0 ? 30 : -30), lowerBound, upperBound); } if (value2 != value) { scroll->set_value(value2); diff --git a/rtgui/mydiagonalcurve.cc b/rtgui/mydiagonalcurve.cc index 8dc8aca56..cb96c039f 100644 --- a/rtgui/mydiagonalcurve.cc +++ b/rtgui/mydiagonalcurve.cc @@ -685,12 +685,9 @@ bool MyDiagonalCurve::handleEvents (GdkEvent* event) stopNumericalAdjustment(); } } - - retval = true; } } } - retval = true; } diff --git a/rtgui/placesbrowser.cc b/rtgui/placesbrowser.cc index 9935064ee..6fb04ac53 100644 --- a/rtgui/placesbrowser.cc +++ b/rtgui/placesbrowser.cc @@ -230,15 +230,15 @@ void PlacesBrowser::refreshPlacesList () } for (size_t i = 0; i < options.favoriteDirs.size(); i++) { - Glib::RefPtr hfile = Gio::File::create_for_path (options.favoriteDirs[i]); + Glib::RefPtr fav = Gio::File::create_for_path (options.favoriteDirs[i]); - if (hfile && hfile->query_exists()) { + if (fav && fav->query_exists()) { try { - if (auto info = hfile->query_info ()) { + if (auto info = fav->query_info ()) { Gtk::TreeModel::Row newrow = *(placesModel->append()); newrow[placesColumns.label] = info->get_display_name (); newrow[placesColumns.icon] = info->get_icon (); - newrow[placesColumns.root] = hfile->get_parse_name (); + newrow[placesColumns.root] = fav->get_parse_name (); newrow[placesColumns.type] = 5; newrow[placesColumns.rowSeparator] = false; } diff --git a/rtgui/preferences.cc b/rtgui/preferences.cc index b7d10c8de..16a58f334 100644 --- a/rtgui/preferences.cc +++ b/rtgui/preferences.cc @@ -56,6 +56,7 @@ Glib::RefPtr fontcss; Preferences::Preferences (RTWindow *rtwindow) : Gtk::Dialog (M ("MAIN_BUTTON_PREFERENCES"), *rtwindow, true) + , regex(Glib::Regex::create (THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS)) , splash (nullptr) , rprofiles (nullptr) , iprofiles (nullptr) @@ -63,7 +64,6 @@ Preferences::Preferences (RTWindow *rtwindow) , newFont (false) , newCPFont (false) { - regex = Glib::Regex::create (THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS); moptions.copyFrom (&options);