Clear crop with c+click, issue 392
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RawTherapee is distributed in the hope that it will be useful,
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* 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 = Gtk::manage (new MySpinButton ());
|
||||||
h->set_size_request (60, -1);
|
h->set_size_request (60, -1);
|
||||||
hb2->pack_start (*h);
|
hb2->pack_start (*h);
|
||||||
|
|
||||||
pack_start (*hb2, Gtk::PACK_SHRINK, 4);
|
pack_start (*hb2, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
selectCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_SELECTCROP")));
|
selectCrop = Gtk::manage (new Gtk::Button (M("TP_CROP_SELECTCROP")));
|
||||||
selectCrop->set_image (*Gtk::manage (new RTImage ("crop.png")));
|
selectCrop->set_image (*Gtk::manage (new RTImage ("crop.png")));
|
||||||
|
|
||||||
pack_start (*selectCrop, Gtk::PACK_SHRINK, 2);
|
pack_start (*selectCrop, Gtk::PACK_SHRINK, 2);
|
||||||
|
|
||||||
Gtk::HBox* hb3 = Gtk::manage (new Gtk::HBox ());
|
Gtk::HBox* hb3 = Gtk::manage (new Gtk::HBox ());
|
||||||
@@ -104,7 +104,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
|
|||||||
hb31->pack_start (*guide);
|
hb31->pack_start (*guide);
|
||||||
|
|
||||||
pack_start (*hb31, Gtk::PACK_SHRINK, 4);
|
pack_start (*hb31, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
// ppibox START
|
// ppibox START
|
||||||
ppibox = Gtk::manage (new Gtk::VBox());
|
ppibox = Gtk::manage (new Gtk::VBox());
|
||||||
ppibox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 2);
|
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 (*sizein, Gtk::PACK_SHRINK, 4);
|
||||||
sizebox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 6);
|
sizebox->pack_start (*Gtk::manage (new Gtk::HSeparator()), Gtk::PACK_SHRINK, 6);
|
||||||
sizebox->pack_start (*hb4, Gtk::PACK_SHRINK, 2);
|
sizebox->pack_start (*hb4, Gtk::PACK_SHRINK, 2);
|
||||||
|
|
||||||
ppibox->pack_start (*sizebox, Gtk::PACK_SHRINK, 1);
|
ppibox->pack_start (*sizebox, Gtk::PACK_SHRINK, 1);
|
||||||
pack_start (*ppibox, Gtk::PACK_SHRINK, 0);
|
pack_start (*ppibox, Gtk::PACK_SHRINK, 0);
|
||||||
|
|
||||||
ppi->set_value (300);
|
ppi->set_value (300);
|
||||||
// ppibox END
|
// ppibox END
|
||||||
|
|
||||||
/****************
|
/****************
|
||||||
* Crop Ratio
|
* 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;
|
cropratio[25].label = "45:35 - ePassport"; cropratio[25].value = 45.0/35.0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// populate the combobox
|
// populate the combobox
|
||||||
for (int i=0; i<NumberOfCropRatios; i++) {
|
for (int i=0; i<NumberOfCropRatios; i++) {
|
||||||
ratio->append_text (cropratio[i].label);
|
ratio->append_text (cropratio[i].label);
|
||||||
@@ -250,7 +250,7 @@ void Crop::readOptions () {
|
|||||||
void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
||||||
|
|
||||||
disableListener ();
|
disableListener ();
|
||||||
|
|
||||||
xconn.block (true);
|
xconn.block (true);
|
||||||
yconn.block (true);
|
yconn.block (true);
|
||||||
wconn.block (true);
|
wconn.block (true);
|
||||||
@@ -277,7 +277,7 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
|||||||
orientation->set_active (0);
|
orientation->set_active (0);
|
||||||
else if (pp->crop.orientation == "Portrait")
|
else if (pp->crop.orientation == "Portrait")
|
||||||
orientation->set_active (1);
|
orientation->set_active (1);
|
||||||
|
|
||||||
if (pp->crop.guide == "None")
|
if (pp->crop.guide == "None")
|
||||||
guide->set_active (0);
|
guide->set_active (0);
|
||||||
else if (pp->crop.guide == "Rule of thirds")
|
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;
|
ny = pp->crop.y;
|
||||||
nw = pp->crop.w;
|
nw = pp->crop.w;
|
||||||
nh = pp->crop.h;
|
nh = pp->crop.h;
|
||||||
|
|
||||||
lastRotationDeg = pp->coarse.rotate;
|
lastRotationDeg = pp->coarse.rotate;
|
||||||
|
|
||||||
wDirty = false;
|
wDirty = false;
|
||||||
@@ -440,8 +440,19 @@ void Crop::selectPressed () {
|
|||||||
|
|
||||||
void Crop::notifyListener () {
|
void Crop::notifyListener () {
|
||||||
|
|
||||||
if (listener && enabled->get_active ())
|
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 (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 () {
|
void Crop::enabledChanged () {
|
||||||
@@ -591,7 +602,7 @@ void Crop::ratioChanged () {
|
|||||||
// Correct current crop if it doesn't fit
|
// Correct current crop if it doesn't fit
|
||||||
void Crop::adjustCropToRatio() {
|
void Crop::adjustCropToRatio() {
|
||||||
if (fixr->get_active() && !fixr->get_inconsistent()) {
|
if (fixr->get_active() && !fixr->get_inconsistent()) {
|
||||||
|
|
||||||
// int W = w->get_value ();
|
// int W = w->get_value ();
|
||||||
// int H = h->get_value ();
|
// int H = h->get_value ();
|
||||||
int W = nw;
|
int W = nw;
|
||||||
@@ -940,12 +951,10 @@ void Crop::cropInit (int &x, int &y, int &w, int &h) {
|
|||||||
nh = 1;
|
nh = 1;
|
||||||
|
|
||||||
w = 1; h = 1;
|
w = 1; h = 1;
|
||||||
|
|
||||||
econn.block (true);
|
econn.block (true);
|
||||||
enabled->set_active (1);
|
enabled->set_active (1);
|
||||||
econn.block (false);
|
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) {
|
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) {
|
if (y<=y2) {
|
||||||
int W2max = (int)round ((maxh-Y) * r);
|
int W2max = (int)round ((maxh-Y) * r);
|
||||||
if (W>W2max)
|
if (W>W2max)
|
||||||
W = W2max;
|
W = W2max;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int W2max = (int)round (y * r);
|
int W2max = (int)round (y * r);
|
||||||
if (W>W2max)
|
if (W>W2max)
|
||||||
W = W2max;
|
W = W2max;
|
||||||
}
|
}
|
||||||
H = (int)round(W / r);
|
H = (int)round(W / r);
|
||||||
if (x<x2)
|
if (x<x2)
|
||||||
x2 = x + W - 1;
|
x2 = x + W - 1;
|
||||||
else
|
else
|
||||||
x2 = x - W + 1;
|
x2 = x - W + 1;
|
||||||
if (y<y2)
|
if (y<y2)
|
||||||
y2 = y + H - 1;
|
y2 = y + H - 1;
|
||||||
else
|
else
|
||||||
y2 = y - H + 1;
|
y2 = y - H + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user