diff --git a/rtdata/languages/Deutsch b/rtdata/languages/Deutsch index 176b8513c..e891b58a0 100644 --- a/rtdata/languages/Deutsch +++ b/rtdata/languages/Deutsch @@ -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 diff --git a/rtdata/languages/default b/rtdata/languages/default index 09191ecdf..2654c5e94 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -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 diff --git a/rtgui/clipboard.h b/rtgui/clipboard.h index e9a43bd54..f07bf2e46 100644 --- a/rtgui/clipboard.h +++ b/rtgui/clipboard.h @@ -28,6 +28,9 @@ class Clipboard { std::vector iptc; bool _hasProcParams; rtengine::procparams::ProcParams procParams; + bool _hasCurveData; + std::vector curve; + public: void setIPTC (const std::vector& 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& p ) { curve = p; _hasCurveData = true; return; } + const std::vector & getCurveData () { return curve; } + bool hasCurveData () { return _hasCurveData; } + + }; extern Clipboard clipboard; diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index be11431d6..beb891645 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -17,6 +17,7 @@ * along with RawTherapee. If not, see . */ +#include #include #include #include @@ -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 curve; + + switch (parent->displayedCurve->selected) { + case DCT_Spline: // custom + curve = customCurve->getPoints (); + clipboard.setCurveData (curve); + break; + } + +} + +void DiagonalCurveEditorSubGroup::pastePressed () { + + std::vector 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 */ diff --git a/rtgui/diagonalcurveeditorsubgroup.h b/rtgui/diagonalcurveeditorsubgroup.h index 4edfce825..7638c858f 100644 --- a/rtgui/diagonalcurveeditorsubgroup.h +++ b/rtgui/diagonalcurveeditorsubgroup.h @@ -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 ();