diff --git a/rtgui/crop.cc b/rtgui/crop.cc index 92c2e1617..81077cf1b 100644 --- a/rtgui/crop.cc +++ b/rtgui/crop.cc @@ -7,7 +7,7 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * RawTherapee is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -74,12 +74,12 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) { h = Gtk::manage (new MySpinButton ()); h->set_size_request (60, -1); hb2->pack_start (*h); - + pack_start (*hb2, Gtk::PACK_SHRINK, 4); selectCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_SELECTCROP"))); selectCrop->set_image (*Gtk::manage (new RTImage ("crop.png"))); - + pack_start (*selectCrop, Gtk::PACK_SHRINK, 2); Gtk::HBox* hb3 = Gtk::manage (new Gtk::HBox ()); @@ -104,7 +104,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) { hb31->pack_start (*guide); pack_start (*hb31, Gtk::PACK_SHRINK, 4); - + // ppibox START ppibox = Gtk::manage (new Gtk::VBox()); ppibox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 2); @@ -125,13 +125,13 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) { sizebox->pack_start (*sizein, Gtk::PACK_SHRINK, 4); sizebox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 6); sizebox->pack_start (*hb4, Gtk::PACK_SHRINK, 2); - + ppibox->pack_start (*sizebox, Gtk::PACK_SHRINK, 1); pack_start (*ppibox, Gtk::PACK_SHRINK, 0); ppi->set_value (300); // ppibox END - + /**************** * Crop Ratio *****************/ @@ -166,7 +166,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) { cropratio[25].label = "45:35 - ePassport"; cropratio[25].value = 45.0/35.0; - + // populate the combobox for (int i=0; iappend_text (cropratio[i].label); @@ -250,7 +250,7 @@ void Crop::readOptions () { void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) { disableListener (); - + xconn.block (true); yconn.block (true); wconn.block (true); @@ -277,7 +277,7 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) { orientation->set_active (0); else if (pp->crop.orientation == "Portrait") orientation->set_active (1); - + if (pp->crop.guide == "None") guide->set_active (0); else if (pp->crop.guide == "Rule of thirds") @@ -308,7 +308,7 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) { ny = pp->crop.y; nw = pp->crop.w; nh = pp->crop.h; - + lastRotationDeg = pp->coarse.rotate; wDirty = false; @@ -440,8 +440,19 @@ void Crop::selectPressed () { void Crop::notifyListener () { - if (listener && enabled->get_active ()) - listener->panelChanged (EvCrop, Glib::ustring::compose ("%1=%2, %3=%4\n%5=%6, %7=%8", M("TP_CROP_X"), nx, M("TP_CROP_Y"), ny, M("TP_CROP_W"), nw, M("TP_CROP_H"), nh)); + if (listener && enabled->get_active ()) + if (nw == 1 && nh == 1) { + econn.block (true); + enabled->set_active (false); + econn.block (false); + nx = (int)x->get_value (); + ny = (int)x->get_value (); + nw = (int)w->get_value (); + nh = (int)h->get_value (); + listener->panelChanged (EvCrop, M("GENERAL_DISABLED")); + } + else + listener->panelChanged (EvCrop, Glib::ustring::compose ("%1=%2, %3=%4\n%5=%6, %7=%8", M("TP_CROP_X"), nx, M("TP_CROP_Y"), ny, M("TP_CROP_W"), nw, M("TP_CROP_H"), nh)); } void Crop::enabledChanged () { @@ -591,7 +602,7 @@ void Crop::ratioChanged () { // Correct current crop if it doesn't fit void Crop::adjustCropToRatio() { if (fixr->get_active() && !fixr->get_inconsistent()) { - + // int W = w->get_value (); // int H = h->get_value (); int W = nw; @@ -940,12 +951,10 @@ void Crop::cropInit (int &x, int &y, int &w, int &h) { nh = 1; w = 1; h = 1; - + econn.block (true); enabled->set_active (1); econn.block (false); - g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, false)); -// Glib::signal_idle().connect (sigc::mem_fun(*this, &Crop::refreshSpins)); } void Crop::cropResized (int &x, int &y, int& x2, int& y2) { @@ -989,21 +998,21 @@ void Crop::cropResized (int &x, int &y, int& x2, int& y2) { if (y<=y2) { int W2max = (int)round ((maxh-Y) * r); if (W>W2max) - W = W2max; + W = W2max; } else { int W2max = (int)round (y * r); if (W>W2max) - W = W2max; + W = W2max; } H = (int)round(W / r); if (x