Removed unnecesarry references

This commit is contained in:
Dániel Battyányi 2023-07-20 12:38:17 +02:00
parent 0ab53c39d1
commit c79b75cea8
4 changed files with 64 additions and 58 deletions

View File

@ -209,10 +209,10 @@ FilmNegative::FilmNegative() :
greenExp(createExponentAdjuster(this, M("TP_FILMNEGATIVE_GREEN"), 0.3, 4, 0.01, 1.5)), // master exponent (green channel)
redRatio(createExponentAdjuster(this, M("TP_FILMNEGATIVE_RED"), 0.3, 5, 0.01, (2.04 / 1.5))), // ratio of red exponent to master exponent
blueRatio(createExponentAdjuster(this, M("TP_FILMNEGATIVE_BLUE"), 0.3, 5, 0.01, (1.29 / 1.5))), // ratio of blue exponent to master exponent
picker(Gtk::manage(new SpotPicker(DEFAULT_SPOT_WIDTH, M("TP_FILMNEGATIVE_PICK"), M("TP_FILMNEGATIVE_GUESS_TOOLTIP"), M("TP_FILMNEGATIVE_PICK_SIZE")))),
picker(DEFAULT_SPOT_WIDTH, M("TP_FILMNEGATIVE_PICK"), M("TP_FILMNEGATIVE_GUESS_TOOLTIP"), M("TP_FILMNEGATIVE_PICK_SIZE")),
refInputLabel(Gtk::manage(new Gtk::Label(Glib::ustring::compose(M("TP_FILMNEGATIVE_REF_LABEL"), "- - -")))),
refPicker(Gtk::manage(new SpotPicker(DEFAULT_SPOT_WIDTH, M("TP_FILMNEGATIVE_REF_PICK"), M("TP_FILMNEGATIVE_REF_TOOLTIP"), M("TP_FILMNEGATIVE_REF_SIZE")))),
displayRectWidth(&(picker->_associatedVar)),
refPicker(DEFAULT_SPOT_WIDTH, M("TP_FILMNEGATIVE_REF_PICK"), M("TP_FILMNEGATIVE_REF_TOOLTIP"), M("TP_FILMNEGATIVE_REF_SIZE")),
displayRectWidth(&(picker._associatedVar)),
outputLevel(createLevelAdjuster(this, M("TP_FILMNEGATIVE_OUT_LEVEL"))), // ref level
greenBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_GREENBALANCE"), -3.0, 3.0, 0.0, "circle-magenta-small.png", "circle-green-small.png")), // green balance
blueBalance(createBalanceAdjuster(this, M("TP_FILMNEGATIVE_BLUEBALANCE"), -3.0, 3.0, 0.0, "circle-blue-small.png", "circle-yellow-small.png")) // blue balance
@ -241,7 +241,7 @@ FilmNegative::FilmNegative() :
pack_start(*greenExp, Gtk::PACK_SHRINK, 0);
pack_start(*redRatio, Gtk::PACK_SHRINK, 0);
pack_start(*blueRatio, Gtk::PACK_SHRINK, 0);
pack_start(*picker, Gtk::PACK_SHRINK, 0);
pack_start(picker, Gtk::PACK_SHRINK, 0);
// pack_start(*spotButton, Gtk::PACK_SHRINK, 0);
// pack_start(*oldMethod, Gtk::PACK_SHRINK, 0);
@ -260,11 +260,11 @@ FilmNegative::FilmNegative() :
pack_start(*blueBalance, Gtk::PACK_SHRINK, 0);
pack_start(*greenBalance, Gtk::PACK_SHRINK, 0);
pack_start(*refPicker, Gtk::PACK_SHRINK, 0);
pack_start(refPicker, Gtk::PACK_SHRINK, 0);
picker->_spotButton->signal_toggled().connect(sigc::mem_fun(*this, &FilmNegative::editToggled));
picker._spotButton.signal_toggled().connect(sigc::mem_fun(*this, &FilmNegative::editToggled));
refPicker->_spotButton->signal_toggled().connect(sigc::mem_fun(*this, &FilmNegative::refSpotToggled));
refPicker._spotButton.signal_toggled().connect(sigc::mem_fun(*this, &FilmNegative::refSpotToggled));
// Editing geometry; create the spot rectangle
// TODO: Change behaviour to match that of the white balance spot picker (rectangle disappears behind right toolbar)
@ -432,8 +432,8 @@ void FilmNegative::setBatchMode(bool batchMode)
ToolPanel::setBatchMode(batchMode);
if (batchMode) {
removeIfThere(this, picker->_spotButton, false);
removeIfThere(this, refPicker->_spotButton, false);
removeIfThere(this, &picker._spotButton, false);
removeIfThere(this, &refPicker._spotButton, false);
colorSpace->append(M("GENERAL_UNCHANGED"));
colorSpace->set_active_text(M("GENERAL_UNCHANGED"));
redRatio->showEditedCB();
@ -554,7 +554,7 @@ bool FilmNegative::button1Pressed(int modifierKey)
EditSubscriber::action = EditSubscriber::Action::NONE;
if (listener) {
if (picker->get_active()) {
if (picker.get_active()) {
refSpotCoords.push_back(provider->posImage);
@ -564,8 +564,8 @@ bool FilmNegative::button1Pressed(int modifierKey)
RGB ref1, ref2, dummy;
if (fnp->getFilmNegativeSpot(refSpotCoords[0], picker->_associatedVar, ref1, dummy) &&
fnp->getFilmNegativeSpot(refSpotCoords[1], picker->_associatedVar, ref2, dummy)) {
if (fnp->getFilmNegativeSpot(refSpotCoords[0], picker._associatedVar, ref1, dummy) &&
fnp->getFilmNegativeSpot(refSpotCoords[1], picker._associatedVar, ref2, dummy)) {
disableListener();
@ -597,7 +597,7 @@ bool FilmNegative::button1Pressed(int modifierKey)
}
} else if (refPicker->get_active()) {
} else if (refPicker.get_active()) {
disableListener();
@ -611,7 +611,7 @@ bool FilmNegative::button1Pressed(int modifierKey)
}
RGB refOut;
fnp->getFilmNegativeSpot(provider->posImage, refPicker->_associatedVar, refInputValues, refOut);
fnp->getFilmNegativeSpot(provider->posImage, refPicker._associatedVar, refInputValues, refOut);
// Output luminance of the sampled spot
float spotLum = rtengine::Color::rgbLuminance(refOut.r, refOut.g, refOut.b);
@ -675,17 +675,17 @@ void FilmNegative::switchOffEditMode()
{
refSpotCoords.clear();
unsubscribe();
picker->set_active(false);
refPicker->set_active(false);
picker.set_active(false);
refPicker.set_active(false);
}
void FilmNegative::editToggled()
{
if (picker->get_active()) {
if (picker.get_active()) {
refPicker->set_active(false);
refPicker.set_active(false);
refSpotCoords.clear();
displayRectWidth = &(picker->_associatedVar);
displayRectWidth = &(picker._associatedVar);
// if (spotlistener)
// spotlistener->spotNegRequested(spotWidth);
@ -707,11 +707,11 @@ void FilmNegative::editToggled()
void FilmNegative::refSpotToggled()
{
if (refPicker->get_active()) {
if (refPicker.get_active()) {
picker->set_active(false);
picker.set_active(false);
refSpotCoords.clear();
displayRectWidth = &(refPicker->_associatedVar);
displayRectWidth = &(refPicker._associatedVar);
// if (spotlistener)
// spotlistener->spotNegRequested(refSpotWidth);

View File

@ -137,10 +137,10 @@ private:
#define DEFAULT_SPOT_WIDTH 8
SpotPicker* const picker;
SpotPicker picker;
Gtk::Label* const refInputLabel;
SpotPicker* const refPicker;
SpotPicker refPicker;
int* displayRectWidth;

View File

@ -1927,14 +1927,12 @@ void BackBuffer::copySurface(Cairo::RefPtr<Cairo::Context> crDest, Gdk::Rectangl
SpotPicker::SpotPicker(int const defaultValue, Glib::ustring const &buttonKey, Glib::ustring const &buttonTooltip, Glib::ustring const &labelKey) :
Gtk::Grid(),
_associatedVar(defaultValue),
_spotLabel(Gtk::manage(new Gtk::Label(M(labelKey)))),
_spotSizeSetter(Gtk::manage(selecterSetup())),
_spotButton(Gtk::manage(spotButtonTemplate(buttonKey, buttonTooltip)))
_spotLabel(labelSetup(labelKey)),
_spotSizeSetter(new MyComboBoxText(selecterSetup())),
_spotButton(spotButtonTemplate(buttonKey, buttonTooltip))
{
setExpandAlignProperties(_spotLabel, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
Gtk::Grid* spotSizeHelper(Gtk::manage(new Gtk::Grid()));
Gtk::Grid* spotSizeHelper = new Gtk::Grid();
spotSizeHelper->set_name("Spot-Size-Helper");
setExpandAlignProperties(spotSizeHelper, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
@ -1943,59 +1941,66 @@ SpotPicker::SpotPicker(int const defaultValue, Glib::ustring const &buttonKey, G
spotSizeHelper->attach (*_spotSizeSetter, 0, 0, 1, 1);
this->attach (*_spotButton, 0, 0, 1, 1);
this->attach (*_spotLabel, 1, 0, 1, 1);
this->attach (_spotButton, 0, 0, 1, 1);
this->attach (_spotLabel, 1, 0, 1, 1);
this->attach (*spotSizeHelper, 2, 0, 1, 1);
_spotSizeSetter->signal_changed().connect( sigc::mem_fun(*this, &SpotPicker::spotSizeChanged));
}
SpotPicker::~SpotPicker()
{
delete _spotSizeSetter;
}
MyComboBoxText* SpotPicker::selecterSetup()
Gtk::Label SpotPicker::labelSetup(Glib::ustring const &key)
{
MyComboBoxText* spotSize(new MyComboBoxText ());
setExpandAlignProperties(spotSize, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
Gtk::Label label(key);
setExpandAlignProperties(&label, false, false, Gtk::ALIGN_START, Gtk::ALIGN_CENTER);
return label;
}
spotSize->append ("2");
MyComboBoxText SpotPicker::selecterSetup()
{
MyComboBoxText spotSize = MyComboBoxText();
setExpandAlignProperties(&spotSize, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
spotSize.append ("2");
if (_associatedVar == 2) {
spotSize->set_active(0);
spotSize.set_active(0);
}
spotSize->append ("4");
spotSize.append ("4");
if (_associatedVar == 4) {
spotSize->set_active(1);
spotSize.set_active(1);
}
spotSize->append ("8");
spotSize.append ("8");
if (_associatedVar == 8) {
spotSize->set_active(2);
spotSize.set_active(2);
}
spotSize->append ("16");
spotSize.append ("16");
if (_associatedVar == 16) {
spotSize->set_active(3);
spotSize.set_active(3);
}
spotSize->append ("32");
spotSize.append ("32");
if (_associatedVar == 32) {
spotSize->set_active(4);
spotSize.set_active(4);
}
return spotSize;
}
Gtk::ToggleButton* SpotPicker::spotButtonTemplate(Glib::ustring const &key, const Glib::ustring &tooltip)
Gtk::ToggleButton SpotPicker::spotButtonTemplate(Glib::ustring const &key, const Glib::ustring &tooltip)
{
Gtk::ToggleButton *spotButton(new Gtk::ToggleButton(key));
setExpandAlignProperties(spotButton, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
spotButton->get_style_context()->add_class("independent");
spotButton->set_tooltip_text(tooltip);
spotButton->set_image(*Gtk::manage(new RTImage("color-picker-small.png")));
Gtk::ToggleButton spotButton = Gtk::ToggleButton(key);
setExpandAlignProperties(&spotButton, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
spotButton.get_style_context()->add_class("independent");
spotButton.set_tooltip_text(tooltip);
spotButton.set_image(*Gtk::manage(new RTImage("color-picker-small.png")));
return spotButton;
}

View File

@ -696,24 +696,25 @@ class SpotPicker : public Gtk::Grid
{
public:
int _associatedVar;
Gtk::Label* const _spotLabel;
Gtk::Label _spotLabel;
MyComboBoxText* const _spotSizeSetter;
Gtk::ToggleButton* const _spotButton;
Gtk::ToggleButton _spotButton;
SpotPicker(int const defaultValue, Glib::ustring const &buttonKey, Glib::ustring const &buttonTooltip, Glib::ustring const &labelKey);
~SpotPicker();
inline bool get_active()
{
return _spotButton->get_active();
return _spotButton.get_active();
}
void set_active(bool b)
{
_spotButton->set_active(b);
_spotButton.set_active(b);
}
protected:
MyComboBoxText* selecterSetup();
static Gtk::ToggleButton *spotButtonTemplate(Glib::ustring const &key, const Glib::ustring &tooltip);
static Gtk::Label labelSetup(Glib::ustring const &key);
MyComboBoxText selecterSetup();
static Gtk::ToggleButton spotButtonTemplate(Glib::ustring const &key, const Glib::ustring &tooltip);
void spotSizeChanged();
};