Clipboard for tone curve, on behalf of Wolfgang; see issue #631

This commit is contained in:
Oliver Duis
2011-04-17 09:39:42 +02:00
parent 41b3987cb4
commit 9320f1ce4a
5 changed files with 59 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ CURVEEDITOR_SHADOWS;Schatten
CURVEEDITOR_TOOLTIPLINEAR;Kurve zurücksetzen (Linear)
CURVEEDITOR_TOOLTIPLOAD;Kurve aus Datei laden
CURVEEDITOR_TOOLTIPSAVE;Kurve speichern
CURVEEDITOR_TOOLTIPCOPY;Kurve in Zwischenablage kopieren
CURVEEDITOR_TOOLTIPPASTE;Kurve aus Zwischenablage einfügen
CURVEEDITOR_TYPE;Typ
EDITWINDOW_TITLE;Bildbearbeitung
EXIFFILTER_APERTURE;Blende

View File

@@ -25,6 +25,8 @@ CURVEEDITOR_SHADOWS;Shadows
CURVEEDITOR_TOOLTIPLINEAR;Reset curve to linear
CURVEEDITOR_TOOLTIPLOAD;Load a curve from file
CURVEEDITOR_TOOLTIPSAVE;Save current curve
CURVEEDITOR_TOOLTIPCOPY;Copy current curve to clipboard
CURVEEDITOR_TOOLTIPPASTE;Paste curve from clipboard
CURVEEDITOR_TYPE;Type:
EDITWINDOW_TITLE;Image Edit
EXIFFILTER_APERTURE;Aperture

View File

@@ -28,6 +28,9 @@ class Clipboard {
std::vector<rtengine::procparams::IPTCPair> iptc;
bool _hasProcParams;
rtengine::procparams::ProcParams procParams;
bool _hasCurveData;
std::vector<double> curve;
public:
void setIPTC (const std::vector<rtengine::procparams::IPTCPair>& iptcc) { iptc = iptcc; _hasIPTC = true;}
@@ -37,6 +40,12 @@ class Clipboard {
void setProcParams (const rtengine::procparams::ProcParams& pparams) { procParams = pparams; _hasProcParams = true; }
const rtengine::procparams::ProcParams& getProcParams () { return procParams; }
bool hasProcParams () { return _hasProcParams; }
void setCurveData (std::vector<double>& p ) { curve = p; _hasCurveData = true; return; }
const std::vector<double> & getCurveData () { return curve; }
bool hasCurveData () { return _hasCurveData; }
};
extern Clipboard clipboard;

View File

@@ -17,6 +17,7 @@
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <clipboard.h>
#include <gtkmm.h>
#include <fstream>
#include <string>
@@ -53,17 +54,31 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt)
saveCustom->add (*Gtk::manage (new Gtk::Image (Gtk::StockID("gtk-save"), Gtk::ICON_SIZE_BUTTON)));
loadCustom = Gtk::manage (new Gtk::Button ());
loadCustom->add (*Gtk::manage (new Gtk::Image (Gtk::StockID("gtk-open"), Gtk::ICON_SIZE_BUTTON)));
copyCustom = Gtk::manage (new Gtk::Button ());
copyCustom->add (*Gtk::manage (new Gtk::Image (Gtk::StockID("gtk-copy"), Gtk::ICON_SIZE_BUTTON)));
pasteCustom = Gtk::manage (new Gtk::Button ());
pasteCustom->add (*Gtk::manage (new Gtk::Image (Gtk::StockID("gtk-paste"), Gtk::ICON_SIZE_BUTTON)));
custombbox->pack_end (*saveCustom, Gtk::PACK_SHRINK, 0);
custombbox->pack_end (*loadCustom, Gtk::PACK_SHRINK, 0);
custombbox->pack_end (*copyCustom, Gtk::PACK_SHRINK, 0);
custombbox->pack_end (*pasteCustom, Gtk::PACK_SHRINK, 0);
customCurveBox->pack_end (*custombbox, Gtk::PACK_SHRINK, 0);
customCurveBox->show_all ();
saveCustom->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::savePressed) );
loadCustom->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::loadPressed) );
copyCustom->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::copyPressed) );
pasteCustom->signal_clicked().connect( sigc::mem_fun(*this, &DiagonalCurveEditorSubGroup::pastePressed) );
saveCustom->set_tooltip_text (M("CURVEEDITOR_TOOLTIPSAVE"));
loadCustom->set_tooltip_text (M("CURVEEDITOR_TOOLTIPLOAD"));
copyCustom->set_tooltip_text (M("CURVEEDITOR_TOOLTIPCOPY"));
pasteCustom->set_tooltip_text (M("CURVEEDITOR_TOOLTIPPASTE"));
// NURBS curve
NURBSCurveBox = new Gtk::HBox ();
@@ -298,6 +313,33 @@ void DiagonalCurveEditorSubGroup::loadPressed () {
}
}
void DiagonalCurveEditorSubGroup::copyPressed () {
std::vector<double> curve;
switch (parent->displayedCurve->selected) {
case DCT_Spline: // custom
curve = customCurve->getPoints ();
clipboard.setCurveData (curve);
break;
}
}
void DiagonalCurveEditorSubGroup::pastePressed () {
std::vector<double> curve;
if (!clipboard.hasCurveData()) {
return; }
curve = clipboard.getCurveData ();
customCurve->setPoints (curve);
customCurve->queue_draw ();
customCurve->notifyListener ();
}
/*
* Store the curves of the currently displayed type from the widgets to the CurveEditor object
*/

View File

@@ -45,6 +45,8 @@ protected:
Gtk::Button* saveCustom;
Gtk::Button* loadCustom;
Gtk::Button* copyCustom;
Gtk::Button* pasteCustom;
Gtk::Button* saveNURBS;
Gtk::Button* loadNURBS;
@@ -64,6 +66,8 @@ protected:
void restoreDisplayedHistogram ();
void savePressed ();
void loadPressed ();
void copyPressed ();
void pastePressed ();
void switchGUI();
bool curveReset (int cType);
void removeEditor ();