Proper check for rawzor libraries.
[rawtherapee-fixes.git] / rtgui / partialpastedlg.cc
blob21641b61422323f923057d66f59809d1bc3de433
1 /*
2 * This file is part of RawTherapee.
4 * Copyright (c) 2004-2010 Gabor Horvath <hgabor@rawtherapee.com>
6 * RawTherapee is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * RawTherapee is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
19 #include <partialpastedlg.h>
20 #include <multilangmgr.h>
22 PartialPasteDlg::PartialPasteDlg () {
24 set_modal (true);
25 set_title (M("PARTIALPASTE_DIALOGLABEL"));
27 basic = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_BASICGROUP")));
28 luminance = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LUMINANCEGROUP")));
29 color = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COLORGROUP")));
30 lens = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LENSGROUP")));
31 composition = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COMPOSITIONGROUP")));
32 metaicm = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_METAICMGROUP")));
34 // options in basic:
35 wb = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_WHITEBALANCE")));
36 exposure = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EXPOSURE")));
37 hlrec = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_HLRECOVERY")));
39 // options in luminance:
40 sharpen = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_SHARPENING")));
41 lumaden = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LUMADENOISE")));
42 lumacurve = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_LUMACURVE")));
43 sh = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_SHADOWSHIGHLIGHTS")));
45 // options in color:
46 colormixer = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COLORMIXER")));
47 colorshift = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COLORSHIFT")));
48 colorboost = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COLORBOOST")));
49 colorden = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COLORDENOISE")));
51 // options in lens:
52 distortion = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_DISTORTION")));
53 cacorr = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_CACORRECTION")));
54 vignetting = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_VIGNETTING")));
56 // options in composition:
57 coarserot = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_COARSETRANS")));
58 finerot = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_ROTATION")));
59 crop = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_CROP")));
60 resize = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_RESIZE")));
62 // options in metaicm:
63 exifch = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_EXIFCHANGES")));
64 iptc = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_IPTCINFO")));
65 icm = Gtk::manage (new Gtk::CheckButton (M("PARTIALPASTE_ICMSETTINGS")));
67 Gtk::VBox* vboxes[6];
68 Gtk::HSeparator* hseps[6];
69 for (int i=0; i<6; i++) {
70 vboxes[i] = Gtk::manage (new Gtk::VBox ());
71 vboxes[i]->set_border_width (16);
72 hseps[i] = Gtk::manage (new Gtk::HSeparator ());
75 vboxes[0]->pack_start (*basic, Gtk::PACK_SHRINK, 2);
76 vboxes[0]->pack_start (*hseps[0], Gtk::PACK_SHRINK, 2);
77 vboxes[0]->pack_start (*wb, Gtk::PACK_SHRINK, 2);
78 vboxes[0]->pack_start (*exposure, Gtk::PACK_SHRINK, 2);
79 vboxes[0]->pack_start (*hlrec, Gtk::PACK_SHRINK, 2);
81 vboxes[1]->pack_start (*luminance, Gtk::PACK_SHRINK, 2);
82 vboxes[1]->pack_start (*hseps[1], Gtk::PACK_SHRINK, 2);
83 vboxes[1]->pack_start (*sharpen, Gtk::PACK_SHRINK, 2);
84 vboxes[1]->pack_start (*lumaden, Gtk::PACK_SHRINK, 2);
85 vboxes[1]->pack_start (*lumacurve, Gtk::PACK_SHRINK, 2);
86 vboxes[1]->pack_start (*sh, Gtk::PACK_SHRINK, 2);
88 vboxes[2]->pack_start (*color, Gtk::PACK_SHRINK, 2);
89 vboxes[2]->pack_start (*hseps[2], Gtk::PACK_SHRINK, 2);
90 vboxes[2]->pack_start (*colormixer, Gtk::PACK_SHRINK, 2);
91 vboxes[2]->pack_start (*colorshift, Gtk::PACK_SHRINK, 2);
92 vboxes[2]->pack_start (*colorboost, Gtk::PACK_SHRINK, 2);
93 vboxes[2]->pack_start (*colorden, Gtk::PACK_SHRINK, 2);
96 vboxes[3]->pack_start (*lens, Gtk::PACK_SHRINK, 2);
97 vboxes[3]->pack_start (*hseps[3], Gtk::PACK_SHRINK, 2);
98 vboxes[3]->pack_start (*distortion, Gtk::PACK_SHRINK, 2);
99 vboxes[3]->pack_start (*cacorr, Gtk::PACK_SHRINK, 2);
100 vboxes[3]->pack_start (*vignetting, Gtk::PACK_SHRINK, 2);
102 vboxes[4]->pack_start (*composition, Gtk::PACK_SHRINK, 2);
103 vboxes[4]->pack_start (*hseps[4], Gtk::PACK_SHRINK, 2);
104 vboxes[4]->pack_start (*coarserot, Gtk::PACK_SHRINK, 2);
105 vboxes[4]->pack_start (*finerot, Gtk::PACK_SHRINK, 2);
106 vboxes[4]->pack_start (*crop, Gtk::PACK_SHRINK, 2);
107 vboxes[4]->pack_start (*resize, Gtk::PACK_SHRINK, 2);
109 vboxes[5]->pack_start (*metaicm, Gtk::PACK_SHRINK, 2);
110 vboxes[5]->pack_start (*hseps[5], Gtk::PACK_SHRINK, 2);
111 vboxes[5]->pack_start (*exifch, Gtk::PACK_SHRINK, 2);
112 vboxes[5]->pack_start (*iptc, Gtk::PACK_SHRINK, 2);
113 vboxes[5]->pack_start (*icm, Gtk::PACK_SHRINK, 2);
115 Gtk::VBox* vbleft = Gtk::manage (new Gtk::VBox ());
116 Gtk::VBox* vbright = Gtk::manage (new Gtk::VBox ());
118 vbleft->set_border_width (16);
119 vbright->set_border_width (16);
121 for (int i=0; i<3; i++)
122 vbleft->pack_start (*vboxes[i]);
123 for (int i=3; i<6; i++)
124 vbright->pack_start (*vboxes[i]);
126 Gtk::HBox* hbmain = Gtk::manage (new Gtk::HBox ());
127 hbmain->pack_start (*vbleft);
128 hbmain->pack_start (*(Gtk::manage (new Gtk::VSeparator ())));
129 hbmain->pack_start (*vbright);
131 get_vbox()->pack_start (*hbmain);
133 basicConn = basic->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::basicToggled));
134 luminanceConn = luminance->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::luminanceToggled));
135 colorConn = color->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::colorToggled));
136 lensConn = lens->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::lensToggled));
137 compositionConn = composition->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::compositionToggled));
138 metaicmConn = metaicm->signal_toggled().connect (sigc::mem_fun(*this, &PartialPasteDlg::metaicmToggled));
140 wbConn = wb->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
141 exposureConn = exposure->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
142 hlrecConn = hlrec->signal_toggled().connect (sigc::bind (sigc::mem_fun(*basic, &Gtk::CheckButton::set_inconsistent), true));
144 sharpenConn = sharpen->signal_toggled().connect (sigc::bind (sigc::mem_fun(*luminance, &Gtk::CheckButton::set_inconsistent), true));
145 lumadenConn = lumaden->signal_toggled().connect (sigc::bind (sigc::mem_fun(*luminance, &Gtk::CheckButton::set_inconsistent), true));
146 lumacurveConn = lumacurve->signal_toggled().connect (sigc::bind (sigc::mem_fun(*luminance, &Gtk::CheckButton::set_inconsistent), true));
147 shConn = sh->signal_toggled().connect (sigc::bind (sigc::mem_fun(*luminance, &Gtk::CheckButton::set_inconsistent), true));
149 colormixerConn = colormixer->signal_toggled().connect (sigc::bind (sigc::mem_fun(*color, &Gtk::CheckButton::set_inconsistent), true));
150 colorshiftConn = colorshift->signal_toggled().connect (sigc::bind (sigc::mem_fun(*color, &Gtk::CheckButton::set_inconsistent), true));
151 colorboostConn = colorboost->signal_toggled().connect (sigc::bind (sigc::mem_fun(*color, &Gtk::CheckButton::set_inconsistent), true));
152 colordenConn = colorden->signal_toggled().connect (sigc::bind (sigc::mem_fun(*color, &Gtk::CheckButton::set_inconsistent), true));
154 distortionConn = distortion->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
155 cacorrConn = cacorr->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
156 vignettingConn = vignetting->signal_toggled().connect (sigc::bind (sigc::mem_fun(*lens, &Gtk::CheckButton::set_inconsistent), true));
158 coarserotConn = coarserot->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
159 finerotConn = finerot->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
160 cropConn = crop->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
161 resizeConn = resize->signal_toggled().connect (sigc::bind (sigc::mem_fun(*composition, &Gtk::CheckButton::set_inconsistent), true));
163 exifchConn = exifch->signal_toggled().connect (sigc::bind (sigc::mem_fun(*metaicm, &Gtk::CheckButton::set_inconsistent), true));
164 iptcConn = iptc->signal_toggled().connect (sigc::bind (sigc::mem_fun(*metaicm, &Gtk::CheckButton::set_inconsistent), true));
165 icmConn = icm->signal_toggled().connect (sigc::bind (sigc::mem_fun(*metaicm, &Gtk::CheckButton::set_inconsistent), true));
167 add_button (Gtk::StockID("gtk-ok"), 1);
168 add_button (Gtk::StockID("gtk-cancel"), 0);
169 set_response_sensitive (1);
170 set_default_response (1);
171 show_all_children ();
174 void PartialPasteDlg::basicToggled () {
176 wbConn.block (true);
177 exposureConn.block (true);
178 hlrecConn.block (true);
180 basic->set_inconsistent (false);
182 wb->set_active (basic->get_active ());
183 exposure->set_active (basic->get_active ());
184 hlrec->set_active (basic->get_active ());
186 wbConn.block (false);
187 exposureConn.block (false);
188 hlrecConn.block (false);
191 void PartialPasteDlg::luminanceToggled () {
193 sharpenConn.block (true);
194 lumadenConn.block (true);
195 lumacurveConn.block (true);
196 shConn.block (true);
198 luminance->set_inconsistent (false);
200 sharpen->set_active (luminance->get_active ());
201 lumaden->set_active (luminance->get_active ());
202 lumacurve->set_active (luminance->get_active ());
203 sh->set_active (luminance->get_active ());
205 sharpenConn.block (false);
206 lumadenConn.block (false);
207 lumacurveConn.block (false);
208 shConn.block (false);
211 void PartialPasteDlg::colorToggled () {
213 colormixerConn.block (true);
214 colorshiftConn.block (true);
215 colorboostConn.block (true);
216 colordenConn.block (true);
218 color->set_inconsistent (false);
220 colormixer->set_active (color->get_active ());
221 colorshift->set_active (color->get_active ());
222 colorboost->set_active (color->get_active ());
223 colorden->set_active (color->get_active ());
225 colormixerConn.block (false);
226 colorshiftConn.block (false);
227 colorboostConn.block (false);
228 colordenConn.block (false);
231 void PartialPasteDlg::lensToggled () {
233 distortionConn.block (true);
234 cacorrConn.block (true);
235 vignettingConn.block (true);
237 lens->set_inconsistent (false);
239 distortion->set_active (lens->get_active ());
240 cacorr->set_active (lens->get_active ());
241 vignetting->set_active (lens->get_active ());
243 distortionConn.block (false);
244 cacorrConn.block (false);
245 vignettingConn.block (false);
248 void PartialPasteDlg::compositionToggled () {
250 coarserotConn.block (true);
251 finerotConn.block (true);
252 cropConn.block (true);
253 resizeConn.block (true);
255 composition->set_inconsistent (false);
257 coarserot->set_active (composition->get_active ());
258 finerot->set_active (composition->get_active ());
259 crop->set_active (composition->get_active ());
260 resize->set_active (composition->get_active ());
262 coarserotConn.block (false);
263 finerotConn.block (false);
264 cropConn.block (false);
265 resizeConn.block (false);
268 void PartialPasteDlg::metaicmToggled () {
270 exifchConn.block (true);
271 iptcConn.block (true);
272 icmConn.block (true);
274 metaicm->set_inconsistent (false);
276 exifch->set_active (metaicm->get_active ());
277 iptc->set_active (metaicm->get_active ());
278 icm->set_active (metaicm->get_active ());
280 exifchConn.block (false);
281 iptcConn.block (false);
282 icmConn.block (false);
286 void PartialPasteDlg::applyPaste (rtengine::procparams::ProcParams* dst, const rtengine::procparams::ProcParams* src) {
288 if (wb->get_active ()) dst->wb = src->wb;
289 if (exposure->get_active ()) dst->toneCurve = src->toneCurve;
290 if (hlrec->get_active ()) dst->hlrecovery = src->hlrecovery;
292 if (sharpen->get_active ()) dst->sharpening = src->sharpening;
293 if (lumaden->get_active ()) dst->lumaDenoise = src->lumaDenoise;
294 if (lumacurve->get_active ()) dst->lumaCurve = src->lumaCurve;
295 if (sh->get_active ()) dst->sh = src->sh;
297 if (colormixer->get_active ()) dst->chmixer = src->chmixer;
298 if (colorshift->get_active ()) dst->colorShift = src->colorShift;
299 if (colorboost->get_active ()) dst->colorBoost = src->colorBoost;
300 if (colorden->get_active ()) dst->colorDenoise = src->colorDenoise;
302 if (distortion->get_active ()) dst->distortion = src->distortion;
303 if (cacorr->get_active ()) dst->cacorrection = src->cacorrection;
304 if (vignetting->get_active ()) dst->vignetting = src->vignetting;
306 if (coarserot->get_active ()) dst->coarse = src->coarse;
307 if (finerot->get_active ()) dst->rotate = src->rotate;
308 if (crop->get_active ()) dst->crop = src->crop;
309 if (resize->get_active ()) dst->resize = src->resize;
311 if (exifch->get_active ()) dst->exif = src->exif;
312 if (iptc->get_active ()) dst->iptc = src->iptc;
313 if (icm->get_active ()) dst->icm = src->icm;