Several files astylized.
This commit is contained in:
parent
fb5466bc8c
commit
8c309d0f04
@ -25,7 +25,8 @@
|
|||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
const int ISO_MAX = 512000;
|
const int ISO_MAX = 512000;
|
||||||
const double FNUMBER_MAX = 100.0;
|
const double FNUMBER_MAX = 100.0;
|
||||||
@ -43,6 +44,7 @@ bool DynamicProfileRule::Optional::operator()(const Glib::ustring &val) const
|
|||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value.find ("re:") == 0) {
|
if (value.find ("re:") == 0) {
|
||||||
// this is a regexp
|
// this is a regexp
|
||||||
return Glib::Regex::match_simple (value.substr (3), val, Glib::REGEX_CASELESS);
|
return Glib::Regex::match_simple (value.substr (3), val, Glib::REGEX_CASELESS);
|
||||||
@ -81,7 +83,8 @@ bool DynamicProfileRule::matches(const rtengine::ImageMetaData *im) const
|
|||||||
&& lens (im->getLens()));
|
&& lens (im->getLens()));
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
void get_int_range (DynamicProfileRule::Range<int> &dest,
|
void get_int_range (DynamicProfileRule::Range<int> &dest,
|
||||||
const Glib::KeyFile &kf, const Glib::ustring &group,
|
const Glib::KeyFile &kf, const Glib::ustring &group,
|
||||||
@ -90,6 +93,7 @@ void get_int_range(DynamicProfileRule::Range<int> &dest,
|
|||||||
try {
|
try {
|
||||||
int min = kf.get_integer (group, key + "_min");
|
int min = kf.get_integer (group, key + "_min");
|
||||||
int max = kf.get_integer (group, key + "_max");
|
int max = kf.get_integer (group, key + "_max");
|
||||||
|
|
||||||
if (min <= max) {
|
if (min <= max) {
|
||||||
dest.min = min;
|
dest.min = min;
|
||||||
dest.max = max;
|
dest.max = max;
|
||||||
@ -106,6 +110,7 @@ void get_double_range(DynamicProfileRule::Range<double> &dest,
|
|||||||
try {
|
try {
|
||||||
double min = kf.get_double (group, key + "_min");
|
double min = kf.get_double (group, key + "_min");
|
||||||
double max = kf.get_double (group, key + "_max");
|
double max = kf.get_double (group, key + "_max");
|
||||||
|
|
||||||
if (min <= max) {
|
if (min <= max) {
|
||||||
dest.min = min;
|
dest.min = min;
|
||||||
dest.max = max;
|
dest.max = max;
|
||||||
@ -121,6 +126,7 @@ void get_optional(DynamicProfileRule::Optional &dest,
|
|||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
bool e = kf.get_boolean (group, key + "_enabled");
|
bool e = kf.get_boolean (group, key + "_enabled");
|
||||||
|
|
||||||
if (e) {
|
if (e) {
|
||||||
Glib::ustring s = kf.get_string (group, key + "_value");
|
Glib::ustring s = kf.get_string (group, key + "_value");
|
||||||
dest.enabled = e;
|
dest.enabled = e;
|
||||||
@ -160,6 +166,7 @@ bool DynamicProfileRules::loadRules()
|
|||||||
{
|
{
|
||||||
dynamicRules.clear();
|
dynamicRules.clear();
|
||||||
Glib::KeyFile kf;
|
Glib::KeyFile kf;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!kf.load_from_file (Glib::build_filename (Options::rtdir, "dynamicprofile.cfg"))) {
|
if (!kf.load_from_file (Glib::build_filename (Options::rtdir, "dynamicprofile.cfg"))) {
|
||||||
return false;
|
return false;
|
||||||
@ -167,20 +174,26 @@ bool DynamicProfileRules::loadRules()
|
|||||||
} catch (Glib::Error &e) {
|
} catch (Glib::Error &e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf ("loading dynamic profiles...\n");
|
printf ("loading dynamic profiles...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
auto groups = kf.get_groups();
|
auto groups = kf.get_groups();
|
||||||
|
|
||||||
for (auto group : groups) {
|
for (auto group : groups) {
|
||||||
// groups are of the form "rule N", where N is a positive integer
|
// groups are of the form "rule N", where N is a positive integer
|
||||||
if (group.find ("rule ") != 0) {
|
if (group.find ("rule ") != 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::istringstream buf (group.c_str() + 5);
|
std::istringstream buf (group.c_str() + 5);
|
||||||
int serial = 0;
|
int serial = 0;
|
||||||
|
|
||||||
if (! (buf >> serial) || !buf.eof()) {
|
if (! (buf >> serial) || !buf.eof()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf (" loading rule %d\n", serial);
|
printf (" loading rule %d\n", serial);
|
||||||
}
|
}
|
||||||
@ -195,12 +208,14 @@ bool DynamicProfileRules::loadRules()
|
|||||||
get_double_range (rule.expcomp, kf, group, "expcomp");
|
get_double_range (rule.expcomp, kf, group, "expcomp");
|
||||||
get_optional (rule.camera, kf, group, "camera");
|
get_optional (rule.camera, kf, group, "camera");
|
||||||
get_optional (rule.lens, kf, group, "lens");
|
get_optional (rule.lens, kf, group, "lens");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rule.profilepath = kf.get_string (group, "profilepath");
|
rule.profilepath = kf.get_string (group, "profilepath");
|
||||||
} catch (Glib::KeyFileError &) {
|
} catch (Glib::KeyFileError &) {
|
||||||
dynamicRules.pop_back();
|
dynamicRules.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::sort (dynamicRules.begin(), dynamicRules.end());
|
std::sort (dynamicRules.begin(), dynamicRules.end());
|
||||||
rulesLoaded = true;
|
rulesLoaded = true;
|
||||||
return true;
|
return true;
|
||||||
@ -211,7 +226,9 @@ bool DynamicProfileRules::storeRules()
|
|||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf ("saving dynamic profiles...\n");
|
printf ("saving dynamic profiles...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::KeyFile kf;
|
Glib::KeyFile kf;
|
||||||
|
|
||||||
for (auto &rule : dynamicRules) {
|
for (auto &rule : dynamicRules) {
|
||||||
std::ostringstream buf;
|
std::ostringstream buf;
|
||||||
buf << "rule " << rule.serial_number;
|
buf << "rule " << rule.serial_number;
|
||||||
@ -225,6 +242,7 @@ bool DynamicProfileRules::storeRules()
|
|||||||
set_optional (kf, group, "lens", rule.lens);
|
set_optional (kf, group, "lens", rule.lens);
|
||||||
kf.set_string (group, "profilepath", rule.profilepath);
|
kf.set_string (group, "profilepath", rule.profilepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
return kf.save_to_file (Glib::build_filename (Options::rtdir, "dynamicprofile.cfg"));
|
return kf.save_to_file (Glib::build_filename (Options::rtdir, "dynamicprofile.cfg"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../rtgui/options.h"
|
#include "../rtgui/options.h"
|
||||||
|
|
||||||
class DynamicProfileRule {
|
class DynamicProfileRule
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
template <class T>
|
template <class T>
|
||||||
struct Range {
|
struct Range {
|
||||||
@ -61,7 +62,8 @@ public:
|
|||||||
Glib::ustring profilepath;
|
Glib::ustring profilepath;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DynamicProfileRules {
|
class DynamicProfileRules
|
||||||
|
{
|
||||||
protected:
|
protected:
|
||||||
/** cache for dynamic profile rules */
|
/** cache for dynamic profile rules */
|
||||||
std::vector<DynamicProfileRule> dynamicRules;
|
std::vector<DynamicProfileRule> dynamicRules;
|
||||||
|
@ -507,7 +507,9 @@ PartialProfile *ProfileStore::loadDynamicProfile(const ImageMetaData *im)
|
|||||||
if (options.rtSettings.verbose) {
|
if (options.rtSettings.verbose) {
|
||||||
printf ("found matching profile %s\n", rule.profilepath.c_str());
|
printf ("found matching profile %s\n", rule.profilepath.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
const PartialProfile *p = getProfile (rule.profilepath);
|
const PartialProfile *p = getProfile (rule.profilepath);
|
||||||
|
|
||||||
if (p != nullptr) {
|
if (p != nullptr) {
|
||||||
p->applyTo (ret->pparams);
|
p->applyTo (ret->pparams);
|
||||||
} else {
|
} else {
|
||||||
@ -515,6 +517,7 @@ PartialProfile *ProfileStore::loadDynamicProfile(const ImageMetaData *im)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,14 +30,12 @@
|
|||||||
// DynamicProfilePanel::EditDialog
|
// DynamicProfilePanel::EditDialog
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
DynamicProfilePanel::EditDialog::EditDialog(const Glib::ustring &title,
|
DynamicProfilePanel::EditDialog::EditDialog (const Glib::ustring &title, Gtk::Window &parent):
|
||||||
Gtk::Window &parent):
|
|
||||||
Gtk::Dialog (title, parent)
|
Gtk::Dialog (title, parent)
|
||||||
{
|
{
|
||||||
profilepath_ = Gtk::manage (new ProfileStoreComboBox());
|
profilepath_ = Gtk::manage (new ProfileStoreComboBox());
|
||||||
Gtk::HBox *hb = Gtk::manage (new Gtk::HBox());
|
Gtk::HBox *hb = Gtk::manage (new Gtk::HBox());
|
||||||
hb->pack_start(*Gtk::manage(new Gtk::Label(M("DYNPROFILEEDITOR_PROFILE"))),
|
hb->pack_start (*Gtk::manage (new Gtk::Label (M ("DYNPROFILEEDITOR_PROFILE"))), false, false, 4);
|
||||||
false, false, 4);
|
|
||||||
hb->pack_start (*profilepath_, true, true, 2);
|
hb->pack_start (*profilepath_, true, true, 2);
|
||||||
get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4);
|
get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4);
|
||||||
|
|
||||||
@ -84,12 +82,12 @@ void DynamicProfilePanel::EditDialog::set_rule(
|
|||||||
lens_->set_text (rule.lens.value);
|
lens_->set_text (rule.lens.value);
|
||||||
|
|
||||||
profilepath_->updateProfileList();
|
profilepath_->updateProfileList();
|
||||||
|
|
||||||
if (!profilepath_->setActiveRowFromFullPath (rule.profilepath)) {
|
if (!profilepath_->setActiveRowFromFullPath (rule.profilepath)) {
|
||||||
profilepath_->setInternalEntry();
|
profilepath_->setInternalEntry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
DynamicProfileRule DynamicProfilePanel::EditDialog::get_rule()
|
DynamicProfileRule DynamicProfilePanel::EditDialog::get_rule()
|
||||||
{
|
{
|
||||||
DynamicProfileRule ret;
|
DynamicProfileRule ret;
|
||||||
@ -165,15 +163,12 @@ void DynamicProfilePanel::EditDialog::add_range(const Glib::ustring &name,
|
|||||||
from->set_numeric (true);
|
from->set_numeric (true);
|
||||||
to->set_numeric (true);
|
to->set_numeric (true);
|
||||||
hb->pack_start (*from, true, true, 2);
|
hb->pack_start (*from, true, true, 2);
|
||||||
hb->pack_start(*Gtk::manage(new Gtk::Label(" - ")),
|
hb->pack_start (*Gtk::manage (new Gtk::Label (" - ")), false, false, 4);
|
||||||
false, false, 4);
|
|
||||||
hb->pack_start (*to, true, true, 2);
|
hb->pack_start (*to, true, true, 2);
|
||||||
get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4);
|
get_content_area()->pack_start (*hb, Gtk::PACK_SHRINK, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicProfilePanel::EditDialog::add_optional (const Glib::ustring &name, Gtk::CheckButton *&check, Gtk::Entry *&field)
|
||||||
void DynamicProfilePanel::EditDialog::add_optional(const Glib::ustring &name,
|
|
||||||
Gtk::CheckButton *&check, Gtk::Entry *&field)
|
|
||||||
{
|
{
|
||||||
check = Gtk::manage (new Gtk::CheckButton (name));
|
check = Gtk::manage (new Gtk::CheckButton (name));
|
||||||
Gtk::HBox *hb = Gtk::manage (new Gtk::HBox());
|
Gtk::HBox *hb = Gtk::manage (new Gtk::HBox());
|
||||||
@ -229,67 +224,81 @@ DynamicProfilePanel::DynamicProfilePanel():
|
|||||||
treeview_.set_model (treemodel_);
|
treeview_.set_model (treemodel_);
|
||||||
|
|
||||||
auto cell = Gtk::manage (new Gtk::CellRendererText());
|
auto cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
int cols_count = treeview_.append_column(
|
int cols_count = treeview_.append_column ( M ("DYNPROFILEEDITOR_PROFILE"), *cell);
|
||||||
M("DYNPROFILEEDITOR_PROFILE"), *cell);
|
|
||||||
auto col = treeview_.get_column (cols_count - 1);
|
auto col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_profilepath));
|
*this, &DynamicProfilePanel::render_profilepath));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (
|
cols_count = treeview_.append_column (
|
||||||
M ("EXIFFILTER_CAMERA"), *cell);
|
M ("EXIFFILTER_CAMERA"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_camera));
|
*this, &DynamicProfilePanel::render_camera));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (M ("EXIFFILTER_LENS"), *cell);
|
cols_count = treeview_.append_column (M ("EXIFFILTER_LENS"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_lens));
|
*this, &DynamicProfilePanel::render_lens));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (M ("EXIFFILTER_ISO"), *cell);
|
cols_count = treeview_.append_column (M ("EXIFFILTER_ISO"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_iso));
|
*this, &DynamicProfilePanel::render_iso));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (M ("EXIFFILTER_APERTURE"), *cell);
|
cols_count = treeview_.append_column (M ("EXIFFILTER_APERTURE"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_fnumber));
|
*this, &DynamicProfilePanel::render_fnumber));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (M ("EXIFFILTER_FOCALLEN"), *cell);
|
cols_count = treeview_.append_column (M ("EXIFFILTER_FOCALLEN"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_focallen));
|
*this, &DynamicProfilePanel::render_focallen));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (M ("EXIFFILTER_SHUTTER"), *cell);
|
cols_count = treeview_.append_column (M ("EXIFFILTER_SHUTTER"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
*this, &DynamicProfilePanel::render_shutterspeed));
|
*this, &DynamicProfilePanel::render_shutterspeed));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell = Gtk::manage (new Gtk::CellRendererText());
|
cell = Gtk::manage (new Gtk::CellRendererText());
|
||||||
cols_count = treeview_.append_column (
|
cols_count = treeview_.append_column (
|
||||||
M ("EXIFFILTER_EXPOSURECOMPENSATION"), *cell);
|
M ("EXIFFILTER_EXPOSURECOMPENSATION"), *cell);
|
||||||
col = treeview_.get_column (cols_count - 1);
|
col = treeview_.get_column (cols_count - 1);
|
||||||
|
|
||||||
if (col) {
|
if (col) {
|
||||||
col->set_cell_data_func (
|
col->set_cell_data_func (
|
||||||
*cell, sigc::mem_fun (
|
*cell, sigc::mem_fun (
|
||||||
@ -348,6 +357,7 @@ void DynamicProfilePanel::render_profilepath(
|
|||||||
Gtk::CellRendererText *ct = static_cast<Gtk::CellRendererText *> (cell);
|
Gtk::CellRendererText *ct = static_cast<Gtk::CellRendererText *> (cell);
|
||||||
auto value = row[columns_.profilepath];
|
auto value = row[columns_.profilepath];
|
||||||
auto pse = ProfileStore::getInstance()->findEntryFromFullPath (value);
|
auto pse = ProfileStore::getInstance()->findEntryFromFullPath (value);
|
||||||
|
|
||||||
if (pse != nullptr) {
|
if (pse != nullptr) {
|
||||||
ct->property_text() = pse->label;
|
ct->property_text() = pse->label;
|
||||||
} else {
|
} else {
|
||||||
@ -369,7 +379,8 @@ void DynamicProfilePanel::render_profilepath(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
template <class V>
|
template <class V>
|
||||||
Glib::ustring to_str (V n, int precision = 1)
|
Glib::ustring to_str (V n, int precision = 1)
|
||||||
@ -392,9 +403,10 @@ void DynamicProfilePanel::render_fnumber(
|
|||||||
Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
|
Gtk::CellRenderer *cell, const Gtk::TreeModel::iterator &iter)
|
||||||
{
|
{
|
||||||
RENDER_RANGE_ (double, fnumber,
|
RENDER_RANGE_ (double, fnumber,
|
||||||
[](double f)
|
[] (double f) {
|
||||||
{ return std::string("f/") +
|
return std::string ("f/") +
|
||||||
rtengine::ImageMetaData::apertureToString(f); });
|
rtengine::ImageMetaData::apertureToString (f);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -449,10 +461,13 @@ void DynamicProfilePanel::render_lens(
|
|||||||
void DynamicProfilePanel::on_button_up()
|
void DynamicProfilePanel::on_button_up()
|
||||||
{
|
{
|
||||||
auto s = treeview_.get_selection();
|
auto s = treeview_.get_selection();
|
||||||
|
|
||||||
if (!s->count_selected_rows()) {
|
if (!s->count_selected_rows()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = s->get_selected();
|
auto it = s->get_selected();
|
||||||
|
|
||||||
if (it != treemodel_->children().begin()) {
|
if (it != treemodel_->children().begin()) {
|
||||||
auto it2 = it;
|
auto it2 = it;
|
||||||
--it2;
|
--it2;
|
||||||
@ -463,12 +478,15 @@ void DynamicProfilePanel::on_button_up()
|
|||||||
void DynamicProfilePanel::on_button_down()
|
void DynamicProfilePanel::on_button_down()
|
||||||
{
|
{
|
||||||
auto s = treeview_.get_selection();
|
auto s = treeview_.get_selection();
|
||||||
|
|
||||||
if (!s->count_selected_rows()) {
|
if (!s->count_selected_rows()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = s->get_selected();
|
auto it = s->get_selected();
|
||||||
auto it2 = it;
|
auto it2 = it;
|
||||||
++it2;
|
++it2;
|
||||||
|
|
||||||
if (it2 != treemodel_->children().end()) {
|
if (it2 != treemodel_->children().end()) {
|
||||||
treemodel_->iter_swap (it, it2);
|
treemodel_->iter_swap (it, it2);
|
||||||
}
|
}
|
||||||
@ -478,9 +496,11 @@ void DynamicProfilePanel::on_button_down()
|
|||||||
void DynamicProfilePanel::on_button_delete()
|
void DynamicProfilePanel::on_button_delete()
|
||||||
{
|
{
|
||||||
auto s = treeview_.get_selection();
|
auto s = treeview_.get_selection();
|
||||||
|
|
||||||
if (!s->count_selected_rows()) {
|
if (!s->count_selected_rows()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto it = s->get_selected();
|
auto it = s->get_selected();
|
||||||
treemodel_->erase (it);
|
treemodel_->erase (it);
|
||||||
}
|
}
|
||||||
@ -491,6 +511,7 @@ void DynamicProfilePanel::on_button_new()
|
|||||||
EditDialog d (M ("DYNPROFILEEDITOR_NEW_RULE"),
|
EditDialog d (M ("DYNPROFILEEDITOR_NEW_RULE"),
|
||||||
static_cast<Gtk::Window &> (*get_toplevel()));
|
static_cast<Gtk::Window &> (*get_toplevel()));
|
||||||
int status = d.run();
|
int status = d.run();
|
||||||
|
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
DynamicProfileRule rule = d.get_rule();
|
DynamicProfileRule rule = d.get_rule();
|
||||||
add_rule (rule);
|
add_rule (rule);
|
||||||
@ -501,14 +522,17 @@ void DynamicProfilePanel::on_button_new()
|
|||||||
void DynamicProfilePanel::on_button_edit()
|
void DynamicProfilePanel::on_button_edit()
|
||||||
{
|
{
|
||||||
auto s = treeview_.get_selection();
|
auto s = treeview_.get_selection();
|
||||||
|
|
||||||
if (!s->count_selected_rows()) {
|
if (!s->count_selected_rows()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditDialog d (M ("DYNPROFILEEDITOR_EDIT_RULE"),
|
EditDialog d (M ("DYNPROFILEEDITOR_EDIT_RULE"),
|
||||||
static_cast<Gtk::Window &> (*get_toplevel()));
|
static_cast<Gtk::Window &> (*get_toplevel()));
|
||||||
Gtk::TreeModel::Row row = * (s->get_selected());
|
Gtk::TreeModel::Row row = * (s->get_selected());
|
||||||
d.set_rule (to_rule (row));
|
d.set_rule (to_rule (row));
|
||||||
int status = d.run();
|
int status = d.run();
|
||||||
|
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
update_rule (row, d.get_rule());
|
update_rule (row, d.get_rule());
|
||||||
}
|
}
|
||||||
@ -519,6 +543,7 @@ void DynamicProfilePanel::save()
|
|||||||
{
|
{
|
||||||
std::vector<DynamicProfileRule> rules;
|
std::vector<DynamicProfileRule> rules;
|
||||||
int serial = 1;
|
int serial = 1;
|
||||||
|
|
||||||
for (auto row : treemodel_->children()) {
|
for (auto row : treemodel_->children()) {
|
||||||
rules.emplace_back (to_rule (row, serial++));
|
rules.emplace_back (to_rule (row, serial++));
|
||||||
}
|
}
|
||||||
|
@ -23,14 +23,14 @@
|
|||||||
#include "../rtengine/dynamicprofile.h"
|
#include "../rtengine/dynamicprofile.h"
|
||||||
#include "profilestorecombobox.h"
|
#include "profilestorecombobox.h"
|
||||||
|
|
||||||
class DynamicProfilePanel: public Gtk::VBox {
|
class DynamicProfilePanel: public Gtk::VBox
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DynamicProfilePanel();
|
DynamicProfilePanel();
|
||||||
void save();
|
void save();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void update_rule(Gtk::TreeModel::Row row,
|
void update_rule (Gtk::TreeModel::Row row, const DynamicProfileRule &rule);
|
||||||
const DynamicProfileRule &rule);
|
|
||||||
void add_rule (const DynamicProfileRule &rule);
|
void add_rule (const DynamicProfileRule &rule);
|
||||||
DynamicProfileRule to_rule (Gtk::TreeModel::Row row, int serial = 0);
|
DynamicProfileRule to_rule (Gtk::TreeModel::Row row, int serial = 0);
|
||||||
|
|
||||||
@ -41,7 +41,8 @@ private:
|
|||||||
void on_button_edit();
|
void on_button_edit();
|
||||||
void on_button_delete();
|
void on_button_delete();
|
||||||
|
|
||||||
class DynamicProfileColumns: public Gtk::TreeModel::ColumnRecord {
|
class DynamicProfileColumns: public Gtk::TreeModel::ColumnRecord
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
DynamicProfileColumns()
|
DynamicProfileColumns()
|
||||||
{
|
{
|
||||||
@ -66,24 +67,17 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
// cell renderers
|
// cell renderers
|
||||||
void render_iso(Gtk::CellRenderer* cell,
|
void render_iso (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
const Gtk::TreeModel::iterator& iter);
|
void render_fnumber (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
void render_fnumber(Gtk::CellRenderer* cell,
|
void render_focallen (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
const Gtk::TreeModel::iterator& iter);
|
void render_shutterspeed (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
void render_focallen(Gtk::CellRenderer* cell,
|
void render_expcomp (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
const Gtk::TreeModel::iterator& iter);
|
void render_camera (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
void render_shutterspeed(Gtk::CellRenderer* cell,
|
void render_lens (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
const Gtk::TreeModel::iterator& iter);
|
void render_profilepath (Gtk::CellRenderer* cell, const Gtk::TreeModel::iterator& iter);
|
||||||
void render_expcomp(Gtk::CellRenderer* cell,
|
|
||||||
const Gtk::TreeModel::iterator& iter);
|
|
||||||
void render_camera(Gtk::CellRenderer* cell,
|
|
||||||
const Gtk::TreeModel::iterator& iter);
|
|
||||||
void render_lens(Gtk::CellRenderer* cell,
|
|
||||||
const Gtk::TreeModel::iterator& iter);
|
|
||||||
void render_profilepath(Gtk::CellRenderer* cell,
|
|
||||||
const Gtk::TreeModel::iterator& iter);
|
|
||||||
|
|
||||||
class EditDialog: public Gtk::Dialog {
|
class EditDialog: public Gtk::Dialog
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
EditDialog (const Glib::ustring &title, Gtk::Window &parent);
|
EditDialog (const Glib::ustring &title, Gtk::Window &parent);
|
||||||
void set_rule (const DynamicProfileRule &rule);
|
void set_rule (const DynamicProfileRule &rule);
|
||||||
@ -91,10 +85,8 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void set_ranges();
|
void set_ranges();
|
||||||
void add_range(const Glib::ustring &name,
|
void add_range (const Glib::ustring &name, Gtk::SpinButton *&from, Gtk::SpinButton *&to);
|
||||||
Gtk::SpinButton *&from, Gtk::SpinButton *&to);
|
void add_optional (const Glib::ustring &name, Gtk::CheckButton *&check, Gtk::Entry *&field);
|
||||||
void add_optional(const Glib::ustring &name,
|
|
||||||
Gtk::CheckButton *&check, Gtk::Entry *&field);
|
|
||||||
|
|
||||||
Gtk::SpinButton *iso_min_;
|
Gtk::SpinButton *iso_min_;
|
||||||
Gtk::SpinButton *iso_max_;
|
Gtk::SpinButton *iso_max_;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user