Little fixed crop usability enhancement
see issue 837
This commit is contained in:
@@ -198,7 +198,7 @@ Crop::Crop (): Gtk::VBox(), FoldableToolPanel(this) {
|
|||||||
wconn = w->signal_value_changed().connect ( sigc::mem_fun(*this, &Crop::widthChanged), true);
|
wconn = w->signal_value_changed().connect ( sigc::mem_fun(*this, &Crop::widthChanged), true);
|
||||||
hconn = h->signal_value_changed().connect ( sigc::mem_fun(*this, &Crop::heightChanged), true);
|
hconn = h->signal_value_changed().connect ( sigc::mem_fun(*this, &Crop::heightChanged), true);
|
||||||
econn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &Crop::enabledChanged) );
|
econn = enabled->signal_toggled().connect( sigc::mem_fun(*this, &Crop::enabledChanged) );
|
||||||
fconn = fixr->signal_toggled().connect( sigc::mem_fun(*this, &Crop::ratioChanged) );
|
fconn = fixr->signal_toggled().connect( sigc::mem_fun(*this, &Crop::ratioFixedChanged) );
|
||||||
rconn = ratio->signal_changed().connect( sigc::mem_fun(*this, &Crop::ratioChanged) );
|
rconn = ratio->signal_changed().connect( sigc::mem_fun(*this, &Crop::ratioChanged) );
|
||||||
oconn = orientation->signal_changed().connect( sigc::mem_fun(*this, &Crop::ratioChanged) );
|
oconn = orientation->signal_changed().connect( sigc::mem_fun(*this, &Crop::ratioChanged) );
|
||||||
gconn = guide->signal_changed().connect( sigc::mem_fun(*this, &Crop::notifyListener) );
|
gconn = guide->signal_changed().connect( sigc::mem_fun(*this, &Crop::notifyListener) );
|
||||||
@@ -305,7 +305,7 @@ void Crop::read (const ProcParams* pp, const ParamsEdited* pedited) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
lastEnabled = pp->crop.enabled;
|
lastEnabled = pp->crop.enabled;
|
||||||
lastAspect = pp->crop.fixratio;
|
lastFixRatio = pp->crop.fixratio;
|
||||||
|
|
||||||
xconn.block (false);
|
xconn.block (false);
|
||||||
yconn.block (false);
|
yconn.block (false);
|
||||||
@@ -527,23 +527,34 @@ void Crop::heightChanged () {
|
|||||||
g_idle_add (notifyListenerUI, this);
|
g_idle_add (notifyListenerUI, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fixed ratio toggle button
|
||||||
void Crop::ratioChanged () {
|
void Crop::ratioFixedChanged () {
|
||||||
|
// Batch mode handling when enabling/disabling fixed crop
|
||||||
if (batchMode && lastAspect != fixr->get_active ()) {
|
if (batchMode && lastFixRatio != fixr->get_active ()) {
|
||||||
if (fixr->get_inconsistent()) {
|
if (fixr->get_inconsistent()) {
|
||||||
fixr->set_inconsistent (false);
|
fixr->set_inconsistent (false);
|
||||||
fconn.block (true);
|
fconn.block (true);
|
||||||
fixr->set_active (false);
|
fixr->set_active (false);
|
||||||
fconn.block (false);
|
fconn.block (false);
|
||||||
}
|
}
|
||||||
else if (lastAspect)
|
else if (lastFixRatio)
|
||||||
fixr->set_inconsistent (true);
|
fixr->set_inconsistent (true);
|
||||||
|
|
||||||
lastAspect = fixr->get_active ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lastFixRatio = fixr->get_active ();
|
||||||
|
adjustCropToRatio();
|
||||||
|
}
|
||||||
|
|
||||||
|
// change to orientation or ration
|
||||||
|
void Crop::ratioChanged () {
|
||||||
|
if (!fixr->get_active ())
|
||||||
|
fixr->set_active(true); // will ajust ratio anyway
|
||||||
|
else
|
||||||
|
adjustCropToRatio();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Correct current crop if it doesn't fit
|
||||||
|
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 ();
|
||||||
@@ -556,10 +567,11 @@ void Crop::ratioChanged () {
|
|||||||
cropWidth2Resized (X, Y, W, H);
|
cropWidth2Resized (X, Y, W, H);
|
||||||
else
|
else
|
||||||
cropHeight2Resized (X, Y, W, H);
|
cropHeight2Resized (X, Y, W, H);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This will safe the options
|
||||||
g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, true));
|
g_idle_add (refreshSpinsUI, new RefreshSpinHelper (this, true));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Crop::refreshSize () {
|
void Crop::refreshSize () {
|
||||||
|
|
||||||
|
@@ -54,7 +54,8 @@ class Crop : public Gtk::VBox, public CropGUIListener, public FoldableToolPanel,
|
|||||||
int nx, ny, nw, nh;
|
int nx, ny, nw, nh;
|
||||||
int lastRotationDeg;
|
int lastRotationDeg;
|
||||||
sigc::connection xconn, yconn, wconn, hconn, econn, fconn, rconn, oconn, gconn;
|
sigc::connection xconn, yconn, wconn, hconn, econn, fconn, rconn, oconn, gconn;
|
||||||
bool wDirty, hDirty, xDirty, yDirty, lastEnabled, lastAspect;
|
bool wDirty, hDirty, xDirty, yDirty, lastEnabled, lastFixRatio;
|
||||||
|
void adjustCropToRatio();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ class Crop : public Gtk::VBox, public CropGUIListener, public FoldableToolPanel,
|
|||||||
void setBatchMode (bool batchMode);
|
void setBatchMode (bool batchMode);
|
||||||
|
|
||||||
void ratioChanged ();
|
void ratioChanged ();
|
||||||
|
void ratioFixedChanged (); // The toggle button
|
||||||
void refreshSize ();
|
void refreshSize ();
|
||||||
void selectPressed ();
|
void selectPressed ();
|
||||||
void setDimensions (int mw, int mh);
|
void setDimensions (int mw, int mh);
|
||||||
|
Reference in New Issue
Block a user