Optimize SaveFormat selection (#4789)
This commit is contained in:
parent
6969303878
commit
ddfe7e0c18
@ -55,6 +55,26 @@ struct SaveFormat {
|
|||||||
saveParams (true)
|
saveParams (true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
SaveFormat(
|
||||||
|
const Glib::ustring& _format,
|
||||||
|
int _png_bits,
|
||||||
|
int _jpeg_quality,
|
||||||
|
int _jpeg_sub_samp,
|
||||||
|
int _tiff_bits,
|
||||||
|
bool _tiff_float,
|
||||||
|
bool _tiff_uncompressed,
|
||||||
|
bool _save_params
|
||||||
|
) :
|
||||||
|
format(_format),
|
||||||
|
pngBits(_png_bits),
|
||||||
|
jpegQuality(_jpeg_quality),
|
||||||
|
jpegSubSamp(_jpeg_sub_samp),
|
||||||
|
tiffBits(_tiff_bits),
|
||||||
|
tiffFloat(_tiff_float),
|
||||||
|
tiffUncompressed(_tiff_uncompressed),
|
||||||
|
saveParams(_save_params)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Glib::ustring format;
|
Glib::ustring format;
|
||||||
int pngBits;
|
int pngBits;
|
||||||
@ -272,7 +292,7 @@ public:
|
|||||||
int cropPPI;
|
int cropPPI;
|
||||||
enum CropGuidesMode { CROP_GUIDE_NONE, CROP_GUIDE_FRAME, CROP_GUIDE_FULL };
|
enum CropGuidesMode { CROP_GUIDE_NONE, CROP_GUIDE_FRAME, CROP_GUIDE_FULL };
|
||||||
CropGuidesMode cropGuides;
|
CropGuidesMode cropGuides;
|
||||||
bool cropAutoFit;
|
bool cropAutoFit;
|
||||||
|
|
||||||
// Performance options
|
// Performance options
|
||||||
Glib::ustring clutsDir;
|
Glib::ustring clutsDir;
|
||||||
|
@ -16,10 +16,90 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include <array>
|
||||||
|
|
||||||
#include "saveformatpanel.h"
|
#include "saveformatpanel.h"
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
const std::array<SaveFormat, 7> sf_templates = {
|
||||||
|
SaveFormat(
|
||||||
|
"jpg",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
8,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"tif",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
8,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"tif",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
16,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"tif",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
16,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"tif",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
32,
|
||||||
|
true,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"png",
|
||||||
|
8,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
8,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
),
|
||||||
|
SaveFormat(
|
||||||
|
"png",
|
||||||
|
16,
|
||||||
|
90,
|
||||||
|
2,
|
||||||
|
8,
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SaveFormatPanel::SaveFormatPanel () : listener (nullptr)
|
SaveFormatPanel::SaveFormatPanel () : listener (nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -45,14 +125,6 @@ SaveFormatPanel::SaveFormatPanel () : listener (nullptr)
|
|||||||
format->append ("PNG (8-bit)");
|
format->append ("PNG (8-bit)");
|
||||||
format->append ("PNG (16-bit)");
|
format->append ("PNG (16-bit)");
|
||||||
|
|
||||||
fstr[0] = "jpg";
|
|
||||||
fstr[1] = "tif";
|
|
||||||
fstr[2] = "tif";
|
|
||||||
fstr[3] = "tif";
|
|
||||||
fstr[4] = "tif";
|
|
||||||
fstr[5] = "png";
|
|
||||||
fstr[6] = "png";
|
|
||||||
|
|
||||||
hb1->attach (*flab, 0, 0, 1, 1);
|
hb1->attach (*flab, 0, 0, 1, 1);
|
||||||
hb1->attach (*format, 1, 0, 1, 1);
|
hb1->attach (*format, 1, 0, 1, 1);
|
||||||
hb1->show_all();
|
hb1->show_all();
|
||||||
@ -148,45 +220,31 @@ void SaveFormatPanel::init (SaveFormat &sf)
|
|||||||
|
|
||||||
SaveFormat SaveFormatPanel::getFormat ()
|
SaveFormat SaveFormatPanel::getFormat ()
|
||||||
{
|
{
|
||||||
|
|
||||||
SaveFormat sf;
|
SaveFormat sf;
|
||||||
|
|
||||||
int sel = format->get_active_row_number();
|
const unsigned int sel = format->get_active_row_number();
|
||||||
sf.format = fstr[sel];
|
|
||||||
|
|
||||||
if (sel == 6) {
|
if (sel < sf_templates.size()) {
|
||||||
sf.pngBits = 16;
|
sf = sf_templates[sel];
|
||||||
} else {
|
|
||||||
sf.pngBits = 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sel == 2 || sel == 3) {
|
sf.jpegQuality = jpegQual->getValue();
|
||||||
sf.tiffBits = 16;
|
sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1;
|
||||||
} else if (sel == 4) {
|
|
||||||
sf.tiffBits = 32;
|
|
||||||
} else {
|
|
||||||
sf.tiffBits = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
sf.tiffFloat = sel == 4 || sel == 3;
|
|
||||||
|
|
||||||
sf.jpegQuality = (int) jpegQual->getValue ();
|
|
||||||
sf.jpegSubSamp = jpegSubSamp->get_active_row_number() + 1;
|
|
||||||
sf.tiffUncompressed = tiffUncompressed->get_active();
|
sf.tiffUncompressed = tiffUncompressed->get_active();
|
||||||
sf.saveParams = savesPP->get_active ();
|
sf.saveParams = savesPP->get_active();
|
||||||
|
|
||||||
return sf;
|
return sf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveFormatPanel::formatChanged ()
|
void SaveFormatPanel::formatChanged ()
|
||||||
{
|
{
|
||||||
|
const unsigned int act = format->get_active_row_number();
|
||||||
|
|
||||||
int act = format->get_active_row_number();
|
if (act >= sf_templates.size()) {
|
||||||
|
|
||||||
if (act < 0 || act > 6) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Glib::ustring fr = fstr[act];
|
const Glib::ustring& fr = sf_templates[act].format;
|
||||||
|
|
||||||
if (fr == "jpg") {
|
if (fr == "jpg") {
|
||||||
jpegOpts->show_all();
|
jpegOpts->show_all();
|
||||||
@ -206,14 +264,13 @@ void SaveFormatPanel::formatChanged ()
|
|||||||
|
|
||||||
void SaveFormatPanel::adjusterChanged (Adjuster* a, double newval)
|
void SaveFormatPanel::adjusterChanged (Adjuster* a, double newval)
|
||||||
{
|
{
|
||||||
|
const unsigned int act = format->get_active_row_number();
|
||||||
|
|
||||||
int act = format->get_active_row_number();
|
if (act >= sf_templates.size()) {
|
||||||
|
|
||||||
if (act < 0 || act > 4) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listener) {
|
if (listener) {
|
||||||
listener->formatChanged (fstr[act]);
|
listener->formatChanged(sf_templates[act].format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ protected:
|
|||||||
Gtk::Grid* jpegOpts;
|
Gtk::Grid* jpegOpts;
|
||||||
Gtk::Label* jpegSubSampLabel;
|
Gtk::Label* jpegSubSampLabel;
|
||||||
FormatChangeListener* listener;
|
FormatChangeListener* listener;
|
||||||
Glib::ustring fstr[7];
|
|
||||||
Gtk::CheckButton* savesPP;
|
Gtk::CheckButton* savesPP;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user