Merge pull request #5242 from Pandagrapher/newlocallab
Merge dev into newlocallab
This commit is contained in:
commit
25841f7dbc
@ -2425,6 +2425,11 @@ Camera constants:
|
|||||||
"ranges": { "black": 512, "white": 16300 }
|
"ranges": { "black": 512, "white": 16300 }
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ // Quality C
|
||||||
|
"make_model": [ "Sony DSC-R1" ],
|
||||||
|
"raw_crop": [ 0, 0, 3924, 2608 ]
|
||||||
|
},
|
||||||
|
|
||||||
{ // Quality A
|
{ // Quality A
|
||||||
"make_model": [ "Sony DSC-RX100M2", "Sony DSC-RX100M3", "Sony DSC-RX100M4", "Sony DSC-RX100M5" ],
|
"make_model": [ "Sony DSC-RX100M2", "Sony DSC-RX100M3", "Sony DSC-RX100M4", "Sony DSC-RX100M5" ],
|
||||||
"dcraw_matrix": [ 6596,-2079,-562,-4782,13016,1933,-970,1581,5181 ], // DNG_v9.8 D65
|
"dcraw_matrix": [ 6596,-2079,-562,-4782,13016,1933,-970,1581,5181 ], // DNG_v9.8 D65
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
//#include <chrono>
|
//#include <chrono>
|
||||||
// "ceil" rounding
|
// "ceil" rounding
|
||||||
//#define SKIPS(a,b) ((a) / (b) + ((a) % (b) > 0))
|
//#define SKIPS(a,b) ((a) / (b) + ((a) % (b) > 0))
|
||||||
|
#include "../rtgui/editcallbacks.h"
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "procparams.h"
|
#include "procparams.h"
|
||||||
#include "../rtgui/ppversion.h"
|
#include "../rtgui/ppversion.h"
|
||||||
#include "../rtgui/guiutils.h"
|
#include "../rtgui/guiutils.h"
|
||||||
|
#include "../rtgui/editcallbacks.h"
|
||||||
|
|
||||||
#undef CLIPD
|
#undef CLIPD
|
||||||
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)
|
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pipettebuffer.h"
|
#include "pipettebuffer.h"
|
||||||
|
#include "../rtgui/editcallbacks.h"
|
||||||
|
#include "imagefloat.h"
|
||||||
|
|
||||||
namespace rtengine
|
namespace rtengine
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#ifndef _PIPETTEBUFFER_H_
|
#ifndef _PIPETTEBUFFER_H_
|
||||||
#define _PIPETTEBUFFER_H_
|
#define _PIPETTEBUFFER_H_
|
||||||
|
|
||||||
#include "../rtgui/edit.h"
|
#include "../rtgui/editbuffer.h"
|
||||||
#include "array2D.h"
|
#include "array2D.h"
|
||||||
#include "iimage.h"
|
#include "iimage.h"
|
||||||
#include "coord.h"
|
#include "coord.h"
|
||||||
@ -27,6 +27,8 @@
|
|||||||
namespace rtengine
|
namespace rtengine
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class Imagefloat;
|
||||||
|
|
||||||
/// @brief Structure that contains information about and pointers to the Edit buffer
|
/// @brief Structure that contains information about and pointers to the Edit buffer
|
||||||
class PipetteBuffer
|
class PipetteBuffer
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# Common source files for both CLI and non-CLI execautables
|
# Common source files for both CLI and non-CLI execautables
|
||||||
set(CLISOURCEFILES
|
set(CLISOURCEFILES
|
||||||
alignedmalloc.cc
|
alignedmalloc.cc
|
||||||
edit.cc
|
editcallbacks.cc
|
||||||
main-cli.cc
|
main-cli.cc
|
||||||
multilangmgr.cc
|
multilangmgr.cc
|
||||||
options.cc
|
options.cc
|
||||||
@ -50,8 +50,10 @@ set(NONCLISOURCEFILES
|
|||||||
dirpyrequalizer.cc
|
dirpyrequalizer.cc
|
||||||
distortion.cc
|
distortion.cc
|
||||||
dynamicprofilepanel.cc
|
dynamicprofilepanel.cc
|
||||||
edit.cc
|
editbuffer.cc
|
||||||
|
editcallbacks.cc
|
||||||
editorpanel.cc
|
editorpanel.cc
|
||||||
|
editwidgets.cc
|
||||||
editwindow.cc
|
editwindow.cc
|
||||||
epd.cc
|
epd.cc
|
||||||
exiffiltersettings.cc
|
exiffiltersettings.cc
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "bayerpreprocess.h"
|
#include "bayerpreprocess.h"
|
||||||
#include "eventmapper.h"
|
#include "eventmapper.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
#include "bayerrawexposure.h"
|
#include "bayerrawexposure.h"
|
||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
#include "blackwhite.h"
|
#include "blackwhite.h"
|
||||||
|
|
||||||
#include "edit.h"
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include "mycurve.h"
|
#include "mycurve.h"
|
||||||
#include "colorprovider.h"
|
#include "colorprovider.h"
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
class BlackWhite final :
|
class BlackWhite final :
|
||||||
public ToolParamBlock,
|
public ToolParamBlock,
|
||||||
public AdjusterListener,
|
public AdjusterListener,
|
||||||
|
@ -567,7 +567,7 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
|
|||||||
|
|
||||||
labRegionData = pp->colorToning.labregions;
|
labRegionData = pp->colorToning.labregions;
|
||||||
if (labRegionData.empty()) {
|
if (labRegionData.empty()) {
|
||||||
labRegionData.emplace_back(rtengine::ColorToningParams::LabCorrectionRegion());
|
labRegionData.emplace_back(rtengine::procparams::ColorToningParams::LabCorrectionRegion());
|
||||||
}
|
}
|
||||||
if (pp->colorToning.labregionsShowMask >= 0) {
|
if (pp->colorToning.labregionsShowMask >= 0) {
|
||||||
labRegionSelected = pp->colorToning.labregionsShowMask;
|
labRegionSelected = pp->colorToning.labregionsShowMask;
|
||||||
@ -1441,7 +1441,7 @@ void ColorToning::labRegionGet(int idx)
|
|||||||
void ColorToning::labRegionAddPressed()
|
void ColorToning::labRegionAddPressed()
|
||||||
{
|
{
|
||||||
labRegionSelected = labRegionData.size();
|
labRegionSelected = labRegionData.size();
|
||||||
labRegionData.push_back(rtengine::ColorToningParams::LabCorrectionRegion());
|
labRegionData.push_back(rtengine::procparams::ColorToningParams::LabCorrectionRegion());
|
||||||
labRegionPopulateList();
|
labRegionPopulateList();
|
||||||
labRegionShow(labRegionSelected);
|
labRegionShow(labRegionSelected);
|
||||||
|
|
||||||
@ -1525,7 +1525,7 @@ void ColorToning::labRegionPopulateList()
|
|||||||
{
|
{
|
||||||
ConnectionBlocker b(labRegionSelectionConn);
|
ConnectionBlocker b(labRegionSelectionConn);
|
||||||
labRegionList->clear_items();
|
labRegionList->clear_items();
|
||||||
rtengine::ColorToningParams::LabCorrectionRegion dflt;
|
rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt;
|
||||||
|
|
||||||
for (size_t i = 0; i < labRegionData.size(); ++i) {
|
for (size_t i = 0; i < labRegionData.size(); ++i) {
|
||||||
auto &r = labRegionData[i];
|
auto &r = labRegionData[i];
|
||||||
@ -1533,11 +1533,11 @@ void ColorToning::labRegionPopulateList()
|
|||||||
labRegionList->set_text(j, 1, Glib::ustring::compose("a=%1 b=%2 S=%3\ns=%4 o=%5 p=%6", round_ab(r.a), round_ab(r.b), r.saturation, r.slope, r.offset, r.power));
|
labRegionList->set_text(j, 1, Glib::ustring::compose("a=%1 b=%2 S=%3\ns=%4 o=%5 p=%6", round_ab(r.a), round_ab(r.b), r.saturation, r.slope, r.offset, r.power));
|
||||||
const char *ch = "";
|
const char *ch = "";
|
||||||
switch (r.channel) {
|
switch (r.channel) {
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_R:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_R:
|
||||||
ch = "\n[Red]"; break;
|
ch = "\n[Red]"; break;
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_G:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_G:
|
||||||
ch = "\n[Green]"; break;
|
ch = "\n[Green]"; break;
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_B:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_B:
|
||||||
ch = "\n[Blue]"; break;
|
ch = "\n[Blue]"; break;
|
||||||
default:
|
default:
|
||||||
ch = "";
|
ch = "";
|
||||||
@ -1560,7 +1560,7 @@ void ColorToning::labRegionShow(int idx, bool list_only)
|
|||||||
if (disable) {
|
if (disable) {
|
||||||
disableListener();
|
disableListener();
|
||||||
}
|
}
|
||||||
rtengine::ColorToningParams::LabCorrectionRegion dflt;
|
rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt;
|
||||||
auto &r = labRegionData[idx];
|
auto &r = labRegionData[idx];
|
||||||
if (!list_only) {
|
if (!list_only) {
|
||||||
labRegionAB->setParams(0, 0, r.a, r.b, false);
|
labRegionAB->setParams(0, 0, r.a, r.b, false);
|
||||||
@ -1577,11 +1577,11 @@ void ColorToning::labRegionShow(int idx, bool list_only)
|
|||||||
labRegionList->set_text(idx, 1, Glib::ustring::compose("a=%1 b=%2 S=%3\ns=%4 o=%5 p=%6", round_ab(r.a), round_ab(r.b), r.saturation, r.slope, r.offset, r.power));
|
labRegionList->set_text(idx, 1, Glib::ustring::compose("a=%1 b=%2 S=%3\ns=%4 o=%5 p=%6", round_ab(r.a), round_ab(r.b), r.saturation, r.slope, r.offset, r.power));
|
||||||
const char *ch = "";
|
const char *ch = "";
|
||||||
switch (r.channel) {
|
switch (r.channel) {
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_R:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_R:
|
||||||
ch = "\n[Red]"; break;
|
ch = "\n[Red]"; break;
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_G:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_G:
|
||||||
ch = "\n[Green]"; break;
|
ch = "\n[Green]"; break;
|
||||||
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_B:
|
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_B:
|
||||||
ch = "\n[Blue]"; break;
|
ch = "\n[Blue]"; break;
|
||||||
default:
|
default:
|
||||||
ch = "";
|
ch = "";
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "thresholdadjuster.h"
|
#include "thresholdadjuster.h"
|
||||||
#include "colorprovider.h"
|
#include "colorprovider.h"
|
||||||
#include "labgrid.h"
|
#include "labgrid.h"
|
||||||
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
class ColorToning final :
|
class ColorToning final :
|
||||||
public ToolParamBlock,
|
public ToolParamBlock,
|
||||||
@ -160,7 +161,7 @@ private:
|
|||||||
FlatCurveEditor *labRegionLightnessMask;
|
FlatCurveEditor *labRegionLightnessMask;
|
||||||
Adjuster *labRegionMaskBlur;
|
Adjuster *labRegionMaskBlur;
|
||||||
Gtk::CheckButton *labRegionShowMask;
|
Gtk::CheckButton *labRegionShowMask;
|
||||||
std::vector<rtengine::ColorToningParams::LabCorrectionRegion> labRegionData;
|
std::vector<rtengine::procparams::ColorToningParams::LabCorrectionRegion> labRegionData;
|
||||||
int labRegionSelected;
|
int labRegionSelected;
|
||||||
sigc::connection labRegionSelectionConn;
|
sigc::connection labRegionSelectionConn;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "controlspotpanel.h"
|
#include "controlspotpanel.h"
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
|
#include "editwidgets.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
|
|
||||||
@ -2026,7 +2027,7 @@ void ControlSpotPanel::setEditedStates(SpotEdited* se)
|
|||||||
disableParamlistener(false);
|
disableParamlistener(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdited * pedited, int id)
|
void ControlSpotPanel::setDefaults(const rtengine::procparams::ProcParams * defParams, const ParamsEdited * pedited, int id)
|
||||||
{
|
{
|
||||||
// Find vector index of given spot id (index = -1 if not found)
|
// Find vector index of given spot id (index = -1 if not found)
|
||||||
int index = -1;
|
int index = -1;
|
||||||
@ -2040,7 +2041,7 @@ void ControlSpotPanel::setDefaults(const ProcParams * defParams, const ParamsEdi
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set default values for adjusters
|
// Set default values for adjusters
|
||||||
const LocallabParams::LocallabSpot* defSpot = new LocallabParams::LocallabSpot();
|
const rtengine::procparams::LocallabParams::LocallabSpot* defSpot = new rtengine::procparams::LocallabParams::LocallabSpot();
|
||||||
|
|
||||||
if (index != -1 && index < (int)defParams->locallab.spots.size()) {
|
if (index != -1 && index < (int)defParams->locallab.spots.size()) {
|
||||||
defSpot = &defParams->locallab.spots.at(index);
|
defSpot = &defParams->locallab.spots.at(index);
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "../rtengine/coord.h"
|
#include "../rtengine/coord.h"
|
||||||
#include "adjuster.h"
|
#include "adjuster.h"
|
||||||
#include "edit.h"
|
#include "editcallbacks.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "threadutils.h"
|
#include "threadutils.h"
|
||||||
#include "toolpanel.h"
|
#include "toolpanel.h"
|
||||||
|
@ -26,11 +26,13 @@
|
|||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
|
|
||||||
#include "../rtengine/rtengine.h"
|
#include "../rtengine/rtengine.h"
|
||||||
|
#include "editbuffer.h"
|
||||||
|
|
||||||
#include "edit.h"
|
|
||||||
#include "lockablecolorpicker.h"
|
#include "lockablecolorpicker.h"
|
||||||
#include "threadutils.h"
|
#include "threadutils.h"
|
||||||
|
|
||||||
|
class EditSubscriber;
|
||||||
|
|
||||||
class CropDisplayHandler
|
class CropDisplayHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
#include "threadutils.h"
|
#include "threadutils.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
|
#include "editbuffer.h"
|
||||||
|
#include "editwidgets.h"
|
||||||
|
|
||||||
#include "../rtengine/dcrop.h"
|
#include "../rtengine/dcrop.h"
|
||||||
#include "../rtengine/mytime.h"
|
#include "../rtengine/mytime.h"
|
||||||
|
@ -29,7 +29,8 @@
|
|||||||
#include "cropguilistener.h"
|
#include "cropguilistener.h"
|
||||||
#include "pointermotionlistener.h"
|
#include "pointermotionlistener.h"
|
||||||
#include "cursormanager.h"
|
#include "cursormanager.h"
|
||||||
#include "edit.h"
|
#include "editbuffer.h"
|
||||||
|
#include "editcoordsys.h"
|
||||||
|
|
||||||
class CropWindow;
|
class CropWindow;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "popuptogglebutton.h"
|
#include "popuptogglebutton.h"
|
||||||
#include "../rtengine/LUT.h"
|
#include "../rtengine/LUT.h"
|
||||||
#include "coloredbar.h"
|
#include "coloredbar.h"
|
||||||
#include "edit.h"
|
#include "editcallbacks.h"
|
||||||
#include "mydiagonalcurve.h"
|
#include "mydiagonalcurve.h"
|
||||||
#include "myflatcurve.h"
|
#include "myflatcurve.h"
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@
|
|||||||
|
|
||||||
#include "dirpyrdenoise.h"
|
#include "dirpyrdenoise.h"
|
||||||
|
|
||||||
#include "edit.h"
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
#include "editbuffer.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
@ -63,7 +63,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP
|
|||||||
NoiscurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_LUMINANCE_CURVE"));
|
NoiscurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_LUMINANCE_CURVE"));
|
||||||
//curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir);
|
//curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir);
|
||||||
NoiscurveEditorG->setCurveListener (this);
|
NoiscurveEditorG->setCurveListener (this);
|
||||||
defaultCurve = rtengine::DirPyrDenoiseParams().lcurve;
|
defaultCurve = rtengine::procparams::DirPyrDenoiseParams().lcurve;
|
||||||
lshape = static_cast<FlatCurveEditor*>(NoiscurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
|
lshape = static_cast<FlatCurveEditor*>(NoiscurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
|
||||||
lshape->setIdentityValue(0.);
|
lshape->setIdentityValue(0.);
|
||||||
lshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
|
lshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
|
||||||
@ -139,7 +139,7 @@ DirPyrDenoise::DirPyrDenoise () : FoldableToolPanel(this, "dirpyrdenoise", M("TP
|
|||||||
|
|
||||||
CCcurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_CHROMINANCE_CURVE"));
|
CCcurveEditorG = new CurveEditorGroup (options.lastDenoiseCurvesDir, M("TP_DIRPYRDENOISE_CHROMINANCE_CURVE"));
|
||||||
CCcurveEditorG->setCurveListener (this);
|
CCcurveEditorG->setCurveListener (this);
|
||||||
defaultCurve = rtengine::DirPyrDenoiseParams().cccurve;
|
defaultCurve = rtengine::procparams::DirPyrDenoiseParams().cccurve;
|
||||||
ccshape = static_cast<FlatCurveEditor*>(CCcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
|
ccshape = static_cast<FlatCurveEditor*>(CCcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
|
||||||
ccshape->setIdentityValue(0.);
|
ccshape->setIdentityValue(0.);
|
||||||
ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
|
ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
class DirPyrDenoise final :
|
class DirPyrDenoise final :
|
||||||
public ToolParamBlock,
|
public ToolParamBlock,
|
||||||
public AdjusterListener,
|
public AdjusterListener,
|
||||||
|
129
rtgui/editbuffer.cc
Normal file
129
rtgui/editbuffer.cc
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "editbuffer.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
|
|
||||||
|
ObjectMOBuffer::ObjectMOBuffer(EditDataProvider *dataProvider) : objectMap(nullptr), objectMode(OM_255), dataProvider(dataProvider) {}
|
||||||
|
|
||||||
|
ObjectMOBuffer::~ObjectMOBuffer()
|
||||||
|
{
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Upgrade or downgrade the objectModeType */
|
||||||
|
void ObjectMOBuffer::setObjectMode(ObjectMode newType)
|
||||||
|
{
|
||||||
|
if (!objectMap) {
|
||||||
|
objectMode = newType;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int w = objectMap->get_width ();
|
||||||
|
int h = objectMap->get_height ();
|
||||||
|
if (w && h) {
|
||||||
|
switch (newType) {
|
||||||
|
case (OM_255):
|
||||||
|
if (objectMode==OM_65535) {
|
||||||
|
objectMap->unreference();
|
||||||
|
objectMap = Cairo::ImageSurface::create(Cairo::FORMAT_A8, w, h);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case (OM_65535):
|
||||||
|
if (objectMode==OM_255) {
|
||||||
|
objectMap->unreference();
|
||||||
|
objectMap = Cairo::ImageSurface::create(Cairo::FORMAT_RGB16_565, w, h);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
objectMode = newType;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ObjectMOBuffer::flush()
|
||||||
|
{
|
||||||
|
if (objectMap ) {
|
||||||
|
objectMap.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditSubscriber *ObjectMOBuffer::getEditSubscriber () {
|
||||||
|
if (dataProvider) {
|
||||||
|
return dataProvider->getCurrSubscriber();
|
||||||
|
} else {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Resize buffers if they already exist
|
||||||
|
void ObjectMOBuffer::resize(int newWidth, int newHeight)
|
||||||
|
{
|
||||||
|
if (!dataProvider) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (const auto currSubscriber = dataProvider->getCurrSubscriber ()) {
|
||||||
|
if (currSubscriber->getEditingType() == ET_OBJECTS) {
|
||||||
|
if (objectMap && (objectMap->get_width() != newWidth || objectMap->get_height() != newHeight)) {
|
||||||
|
objectMap.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!objectMap && newWidth>0 && newHeight>0) {
|
||||||
|
objectMap = Cairo::ImageSurface::create(objectMode==OM_255?Cairo::FORMAT_A8:Cairo::FORMAT_RGB16_565, newWidth, newHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int ObjectMOBuffer::getObjectID(const rtengine::Coord& location)
|
||||||
|
{
|
||||||
|
int id = 0;
|
||||||
|
|
||||||
|
if (!objectMap || location.x < 0 || location.y < 0 || location.x >= objectMap->get_width() || location.y >= objectMap->get_height()) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objectMode == OM_255) {
|
||||||
|
id = (unsigned char)(*( objectMap->get_data() + location.y * objectMap->get_stride() + location.x ));
|
||||||
|
} else {
|
||||||
|
id = (unsigned short)(*( objectMap->get_data() + location.y * objectMap->get_stride() + location.x ));
|
||||||
|
}
|
||||||
|
|
||||||
|
return id - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ObjectMOBuffer::bufferCreated()
|
||||||
|
{
|
||||||
|
EditSubscriber* subscriber;
|
||||||
|
|
||||||
|
if (dataProvider && (subscriber = dataProvider->getCurrSubscriber())) {
|
||||||
|
return subscriber->getEditingType() == ET_OBJECTS ? bool(objectMap) : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
83
rtgui/editbuffer.h
Normal file
83
rtgui/editbuffer.h
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "editid.h"
|
||||||
|
#include "../rtengine/coord.h"
|
||||||
|
#include <cairomm/cairomm.h>
|
||||||
|
|
||||||
|
#ifdef GUIVERSION
|
||||||
|
#include "rtsurface.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
class EditSubscriber;
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* See editwidgets.h for documentation
|
||||||
|
*/
|
||||||
|
|
||||||
|
class ObjectMOBuffer
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Used to draw the objects where the color correspond to the object's ID, in order to find the correct object when hovering
|
||||||
|
Cairo::RefPtr<Cairo::ImageSurface> objectMap;
|
||||||
|
ObjectMode objectMode;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// To avoid duplicated information, we points to a EditDataProvider that contains the current EditSubscriber
|
||||||
|
// instead of pointing to the EditSubscriber directly
|
||||||
|
EditDataProvider* dataProvider;
|
||||||
|
|
||||||
|
void createBuffer(int width, int height);
|
||||||
|
void resize(int newWidth, int newHeight);
|
||||||
|
void flush();
|
||||||
|
EditSubscriber *getEditSubscriber ();
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit ObjectMOBuffer (EditDataProvider *dataProvider);
|
||||||
|
~ObjectMOBuffer();
|
||||||
|
|
||||||
|
EditDataProvider* getDataProvider ();
|
||||||
|
void setObjectMode (ObjectMode newType);
|
||||||
|
ObjectMode getObjectMode ();
|
||||||
|
|
||||||
|
Cairo::RefPtr<Cairo::ImageSurface>& getObjectMap ();
|
||||||
|
|
||||||
|
// return true if the buffer has been allocated
|
||||||
|
bool bufferCreated();
|
||||||
|
|
||||||
|
int getObjectID(const rtengine::Coord& location);
|
||||||
|
};
|
||||||
|
|
||||||
|
inline EditDataProvider* ObjectMOBuffer::getDataProvider () {
|
||||||
|
return dataProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline ObjectMode ObjectMOBuffer::getObjectMode () {
|
||||||
|
return objectMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline Cairo::RefPtr<Cairo::ImageSurface>& ObjectMOBuffer::getObjectMap () {
|
||||||
|
return objectMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
134
rtgui/editcallbacks.cc
Normal file
134
rtgui/editcallbacks.cc
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "editcallbacks.h"
|
||||||
|
|
||||||
|
EditSubscriber::EditSubscriber (EditType editType) : ID(EUID_None), editingType(editType), bufferType(BT_SINGLEPLANE_FLOAT), provider(nullptr), action(ES_ACTION_NONE) {}
|
||||||
|
|
||||||
|
void EditSubscriber::setEditProvider(EditDataProvider *provider)
|
||||||
|
{
|
||||||
|
this->provider = provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditSubscriber::setEditID(EditUniqueID ID, BufferType buffType)
|
||||||
|
{
|
||||||
|
this->ID = ID;
|
||||||
|
bufferType = buffType;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditSubscriber::isCurrentSubscriber()
|
||||||
|
{
|
||||||
|
//if (provider && provider->getCurrSubscriber())
|
||||||
|
// return provider->getCurrSubscriber()->getEditID() == ID;
|
||||||
|
|
||||||
|
if (provider) {
|
||||||
|
return provider->getCurrSubscriber() == this;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditSubscriber::subscribe()
|
||||||
|
{
|
||||||
|
if (provider) {
|
||||||
|
provider->subscribe(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditSubscriber::unsubscribe()
|
||||||
|
{
|
||||||
|
if (provider) {
|
||||||
|
provider->unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditSubscriber::switchOffEditMode()
|
||||||
|
{
|
||||||
|
unsubscribe();
|
||||||
|
}
|
||||||
|
|
||||||
|
EditUniqueID EditSubscriber::getEditID()
|
||||||
|
{
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditType EditSubscriber::getEditingType()
|
||||||
|
{
|
||||||
|
return editingType;
|
||||||
|
}
|
||||||
|
|
||||||
|
BufferType EditSubscriber::getPipetteBufferType()
|
||||||
|
{
|
||||||
|
return bufferType;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditSubscriber::isDragging()
|
||||||
|
{
|
||||||
|
return action == ES_ACTION_DRAGGING;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool EditSubscriber::isPicking()
|
||||||
|
{
|
||||||
|
return action == ES_ACTION_PICKING;
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
EditDataProvider::EditDataProvider() : currSubscriber(nullptr), object(0), posScreen(-1, -1), posImage(-1, -1),
|
||||||
|
deltaScreen(0, 0), deltaImage(0, 0), deltaPrevScreen(0, 0), deltaPrevImage(0, 0)
|
||||||
|
{
|
||||||
|
pipetteVal[0] = pipetteVal[1] = pipetteVal[2] = 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditDataProvider::subscribe(EditSubscriber *subscriber)
|
||||||
|
{
|
||||||
|
if (currSubscriber) {
|
||||||
|
currSubscriber->switchOffEditMode();
|
||||||
|
}
|
||||||
|
|
||||||
|
currSubscriber = subscriber;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditDataProvider::unsubscribe()
|
||||||
|
{
|
||||||
|
currSubscriber = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditDataProvider::switchOffEditMode()
|
||||||
|
{
|
||||||
|
if (currSubscriber) {
|
||||||
|
currSubscriber->switchOffEditMode ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CursorShape EditDataProvider::getCursor(int objectID)
|
||||||
|
{
|
||||||
|
if (currSubscriber) {
|
||||||
|
currSubscriber->getCursor(objectID);
|
||||||
|
}
|
||||||
|
|
||||||
|
return CSHandOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditSubscriber* EditDataProvider::getCurrSubscriber()
|
||||||
|
{
|
||||||
|
return currSubscriber;
|
||||||
|
}
|
||||||
|
|
256
rtgui/editcallbacks.h
Normal file
256
rtgui/editcallbacks.h
Normal file
@ -0,0 +1,256 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "editid.h"
|
||||||
|
#include "cursormanager.h"
|
||||||
|
#include "../rtengine/coord.h"
|
||||||
|
|
||||||
|
class Geometry;
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* See editwidgets.h for documentation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// @brief Method for client tools needing Edit information
|
||||||
|
class EditSubscriber
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
private:
|
||||||
|
EditUniqueID ID; /// this will be used in improcfun to locate the data that has to be stored in the buffer; it must be unique in RT
|
||||||
|
EditType editingType;
|
||||||
|
BufferType bufferType;
|
||||||
|
EditDataProvider *provider;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<Geometry*> visibleGeometry; /// displayed geometry
|
||||||
|
std::vector<Geometry*> mouseOverGeometry; /// mouseOver geometry, drawn in a hidden buffer
|
||||||
|
enum {
|
||||||
|
ES_ACTION_NONE, ///
|
||||||
|
ES_ACTION_DRAGGING, /// set action to this value in the buttonPressed event to start dragging and ask for drag event
|
||||||
|
ES_ACTION_PICKING /// set action to this value in the buttonPressed event whenever the user is picking something through a single click. In this case, the pickX events will be called INSTEAD of buttonXReleased !
|
||||||
|
} action; /// object mode only, ignored in Pipette mode
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit EditSubscriber (EditType editType);
|
||||||
|
virtual ~EditSubscriber () {}
|
||||||
|
|
||||||
|
void setEditProvider(EditDataProvider *provider);
|
||||||
|
EditDataProvider* getEditProvider ();
|
||||||
|
void setEditID(EditUniqueID ID, BufferType buffType);
|
||||||
|
bool isCurrentSubscriber();
|
||||||
|
virtual void subscribe();
|
||||||
|
virtual void unsubscribe();
|
||||||
|
virtual void switchOffEditMode (); /// Occurs when the user want to stop the editing mode
|
||||||
|
EditUniqueID getEditID();
|
||||||
|
EditType getEditingType();
|
||||||
|
BufferType getPipetteBufferType();
|
||||||
|
bool isDragging(); /// Returns true if something is being dragged and drag events has to be sent (object mode only)
|
||||||
|
bool isPicking(); /// Returns true if something is being picked
|
||||||
|
|
||||||
|
/** @brief Get the cursor to be displayed when above handles
|
||||||
|
@param objectID object currently "hovered" */
|
||||||
|
virtual CursorShape getCursor (const int objectID);
|
||||||
|
|
||||||
|
/** @brief Triggered when the mouse is moving over an object
|
||||||
|
This method is also triggered when the cursor is moving over the image in ET_PIPETTE mode
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool mouseOver (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 1 is pressed, together with the CTRL modifier key if the subscriber is of type ET_PIPETTE
|
||||||
|
Once the key is pressed, RT will enter in drag1 mode on subsequent mouse movements
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button1Pressed (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 1 is released
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button1Released ();
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 2 is pressed (middle button)
|
||||||
|
Once the key is pressed, RT will enter in drag2 mode on subsequent mouse movements
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button2Pressed (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 2 is released (middle button)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button2Released ();
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 3 is pressed (right button)
|
||||||
|
Once the key is pressed, RT will enter in drag3 mode on subsequent mouse movements
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button3Pressed (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when mouse button 3 is released (right button)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool button3Released ();
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is moving while holding down mouse button 1
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool drag1 (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is moving while holding down mouse button 2
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool drag2 (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is moving while holding down mouse button 3
|
||||||
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool drag3 (const int modifierKey);
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is releasing mouse button 1 while in action==ES_ACTION_PICKING mode
|
||||||
|
No modifier key is provided, since having a different modifier key than on button press will set picked to false.
|
||||||
|
@param picked True if the cursor is still above the the same object than on button pressed and with the same modifier keys.
|
||||||
|
If false, the user moved the cursor away or the modifier key is different, so the element is considered as NOT selected.
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool pick1 (const bool picked);
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is releasing mouse button 2 while in action==ES_ACTION_PICKING mode
|
||||||
|
@param picked True if the cursor is still above the the same object than on button pressed and with the same modifier keys.
|
||||||
|
If false, the user moved the cursor away or the modifier key is different, so the element is considered as NOT selected.
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool pick2 (const bool picked);
|
||||||
|
|
||||||
|
/** @brief Triggered when the user is releasing mouse button 3 while in action==ES_ACTION_PICKING mode
|
||||||
|
@param picked True if the cursor is still above the the same object than on button pressed and with the same modifier keys.
|
||||||
|
If false, the user moved the cursor away or the modifier key is different, so the element is considered as NOT selected.
|
||||||
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
|
virtual bool pick3 (const bool picked);
|
||||||
|
|
||||||
|
/** @brief Get the geometry to be shown to the user */
|
||||||
|
const std::vector<Geometry*>& getVisibleGeometry ();
|
||||||
|
|
||||||
|
/** @brief Get the geometry to be drawn in the "mouse over" channel, hidden from the user */
|
||||||
|
const std::vector<Geometry*>& getMouseOverGeometry ();
|
||||||
|
};
|
||||||
|
|
||||||
|
/** @brief Class to handle the furniture of data to the subscribers.
|
||||||
|
*
|
||||||
|
* It is admitted that only one Subscriber can ask data at a time. If the Subscriber is of type ET_PIPETTE, it will have to
|
||||||
|
* trigger the usual event so that the image will be reprocessed to compute the buffer of the current subscriber.
|
||||||
|
*/
|
||||||
|
class EditDataProvider
|
||||||
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
EditSubscriber *currSubscriber;
|
||||||
|
|
||||||
|
public:
|
||||||
|
int object; /// ET_OBJECTS mode: Object detected under the cursor, 0 otherwise; ET_PIPETTE mode: 1 if above the image, 0 otherwise
|
||||||
|
float pipetteVal[3]; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, #2 & #3 will be set to 0
|
||||||
|
|
||||||
|
rtengine::Coord posScreen; /// Location of the mouse button press, in preview image space
|
||||||
|
rtengine::Coord posImage; /// Location of the mouse button press, in the full image space
|
||||||
|
rtengine::Coord deltaScreen; /// Delta relative to posScreen
|
||||||
|
rtengine::Coord deltaImage; /// Delta relative to posImage
|
||||||
|
rtengine::Coord deltaPrevScreen; /// Delta relative to the previous mouse location, in preview image space
|
||||||
|
rtengine::Coord deltaPrevImage; /// Delta relative to the previous mouse location, in the full image space
|
||||||
|
|
||||||
|
EditDataProvider();
|
||||||
|
virtual ~EditDataProvider() {}
|
||||||
|
|
||||||
|
virtual void subscribe(EditSubscriber *subscriber);
|
||||||
|
virtual void unsubscribe(); /// Occurs when the subscriber has been switched off first
|
||||||
|
virtual void switchOffEditMode (); /// Occurs when the user want to stop the editing mode
|
||||||
|
virtual CursorShape getCursor(int objectID);
|
||||||
|
int getPipetteRectSize ();
|
||||||
|
EditSubscriber* getCurrSubscriber();
|
||||||
|
virtual void getImageSize (int &w, int&h) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline EditDataProvider* EditSubscriber::getEditProvider () {
|
||||||
|
return provider;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline CursorShape EditSubscriber::getCursor (const int objectID) {
|
||||||
|
return CSHandOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::mouseOver (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button1Pressed (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button1Released () {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button2Pressed (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button2Released () {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button3Pressed (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::button3Released () {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::drag1 (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::drag2 (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::drag3 (const int modifierKey) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::pick1 (const bool picked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::pick2 (const bool picked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline bool EditSubscriber::pick3 (const bool picked) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const std::vector<Geometry*>& EditSubscriber::getVisibleGeometry () {
|
||||||
|
return visibleGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const std::vector<Geometry*>& EditSubscriber::getMouseOverGeometry () {
|
||||||
|
return mouseOverGeometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline int EditDataProvider::getPipetteRectSize () {
|
||||||
|
return 8; // TODO: make a GUI
|
||||||
|
}
|
||||||
|
|
61
rtgui/editcoordsys.h
Normal file
61
rtgui/editcoordsys.h
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of RawTherapee.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
|
*
|
||||||
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @file
|
||||||
|
* See editwidgets.h for documentation
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** @brief Coordinate system where the widgets will be drawn
|
||||||
|
*
|
||||||
|
* The EditCoordSystem is used to define a screen and an image coordinate system.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
class EditCoordSystem
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~EditCoordSystem() {}
|
||||||
|
|
||||||
|
/// Convert the widget's DrawingArea (i.e. preview area) coords to the edit buffer coords
|
||||||
|
virtual void screenCoordToCropBuffer (int phyx, int phyy, int& cropx, int& cropy) = 0;
|
||||||
|
/// Convert the widget's DrawingArea (i.e. preview area) coords to the full image coords
|
||||||
|
virtual void screenCoordToImage (int phyx, int phyy, int& imgx, int& imgy) = 0;
|
||||||
|
/// Convert the image coords to the widget's DrawingArea (i.e. preview area) coords
|
||||||
|
virtual void imageCoordToScreen (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
|
/// Convert the image coords to the crop's canvas coords (full image + padding)
|
||||||
|
virtual void imageCoordToCropCanvas (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
|
/// Convert the image coords to the edit buffer coords (includes borders)
|
||||||
|
virtual void imageCoordToCropBuffer (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
|
/// Convert the image coords to the displayed image coords (no borders here)
|
||||||
|
virtual void imageCoordToCropImage (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
|
virtual int scaleValueToImage (int value) = 0;
|
||||||
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
|
virtual float scaleValueToImage (float value) = 0;
|
||||||
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
|
virtual double scaleValueToImage (double value) = 0;
|
||||||
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
|
virtual int scaleValueToCanvas (int value) = 0;
|
||||||
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
|
virtual float scaleValueToCanvas (float value) = 0;
|
||||||
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
|
virtual double scaleValueToCanvas (double value) = 0;
|
||||||
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "gradient.h"
|
#include "gradient.h"
|
||||||
|
|
||||||
|
#include "editwidgets.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include "adjuster.h"
|
#include "adjuster.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
#include "toolpanel.h"
|
#include "toolpanel.h"
|
||||||
#include "edit.h"
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
class Gradient : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber
|
class Gradient : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber
|
||||||
|
@ -27,10 +27,10 @@
|
|||||||
#include "previewhandler.h"
|
#include "previewhandler.h"
|
||||||
#include "imageareatoollistener.h"
|
#include "imageareatoollistener.h"
|
||||||
#include "cropwindow.h"
|
#include "cropwindow.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
#include "zoompanel.h"
|
#include "zoompanel.h"
|
||||||
#include "indclippedpanel.h"
|
#include "indclippedpanel.h"
|
||||||
#include "previewmodepanel.h"
|
#include "previewmodepanel.h"
|
||||||
#include "edit.h"
|
|
||||||
|
|
||||||
class ImageAreaPanel;
|
class ImageAreaPanel;
|
||||||
class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public EditDataProvider, public LockablePickerToolListener
|
class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public EditDataProvider, public LockablePickerToolListener
|
||||||
|
@ -20,10 +20,9 @@
|
|||||||
|
|
||||||
#include "labcurve.h"
|
#include "labcurve.h"
|
||||||
|
|
||||||
#include "edit.h"
|
|
||||||
|
|
||||||
#include "../rtengine/improcfun.h"
|
#include "../rtengine/improcfun.h"
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
|
@ -26,6 +26,8 @@
|
|||||||
#include "curveeditorgroup.h"
|
#include "curveeditorgroup.h"
|
||||||
#include "colorprovider.h"
|
#include "colorprovider.h"
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider
|
class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
|
|
||||||
#include "labgrid.h"
|
#include "labgrid.h"
|
||||||
|
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
using rtengine::Color;
|
using rtengine::Color;
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/lcp.h"
|
#include "../rtengine/lcp.h"
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include "../rtengine/rt_math.h"
|
#include "../rtengine/rt_math.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "edit.h"
|
#include "editcallbacks.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include "adjuster.h"
|
#include "adjuster.h"
|
||||||
#include "toolpanel.h"
|
#include "toolpanel.h"
|
||||||
#include "edit.h"
|
#include "editcallbacks.h"
|
||||||
#include "curveeditor.h"
|
#include "curveeditor.h"
|
||||||
#include "curveeditorgroup.h"
|
#include "curveeditorgroup.h"
|
||||||
#include "toolpanel.h"
|
#include "toolpanel.h"
|
||||||
@ -268,7 +268,7 @@ private:
|
|||||||
* Used to store the default ProcParams when setDefaults function is called
|
* Used to store the default ProcParams when setDefaults function is called
|
||||||
* When an other spot is selected, this default ProcParams is used to update adjusters default values
|
* When an other spot is selected, this default ProcParams is used to update adjusters default values
|
||||||
*/
|
*/
|
||||||
const rtengine::ProcParams* defparams;
|
const rtengine::procparams::ProcParams* defparams;
|
||||||
/**
|
/**
|
||||||
* Used to store the default ParamsEdited when setDefaults function is called
|
* Used to store the default ParamsEdited when setDefaults function is called
|
||||||
* When an other spot is selected, this default ParamsEdited is used to update adjusters default edited state
|
* When an other spot is selected, this default ParamsEdited is used to update adjusters default edited state
|
||||||
|
@ -23,7 +23,6 @@
|
|||||||
|
|
||||||
#include "../rtengine/coord.h"
|
#include "../rtengine/coord.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "edit.h"
|
|
||||||
|
|
||||||
class CropWindow;
|
class CropWindow;
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "mydiagonalcurve.h"
|
#include "mydiagonalcurve.h"
|
||||||
#include "../rtengine/curves.h"
|
#include "../rtengine/curves.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <gdkmm/types.h>
|
#include <gdkmm/types.h>
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "myflatcurve.h"
|
#include "myflatcurve.h"
|
||||||
#include "../rtengine/curves.h"
|
#include "../rtengine/curves.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <gdkmm/types.h>
|
#include <gdkmm/types.h>
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "preprocess.h"
|
#include "preprocess.h"
|
||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "eventmapper.h"
|
#include "eventmapper.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "rawexposure.h"
|
#include "rawexposure.h"
|
||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
#include "sharpenedge.h"
|
#include "sharpenedge.h"
|
||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
@ -23,11 +23,11 @@
|
|||||||
#include "tonecurve.h"
|
#include "tonecurve.h"
|
||||||
|
|
||||||
#include "adjuster.h"
|
#include "adjuster.h"
|
||||||
#include "edit.h"
|
|
||||||
#include "eventmapper.h"
|
#include "eventmapper.h"
|
||||||
#include "ppversion.h"
|
#include "ppversion.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
#include "editcallbacks.h"
|
||||||
|
|
||||||
using namespace rtengine;
|
using namespace rtengine;
|
||||||
using namespace rtengine::procparams;
|
using namespace rtengine::procparams;
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
#include "mycurve.h"
|
#include "mycurve.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
class ToneCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener
|
class ToneCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
@ -22,10 +22,10 @@
|
|||||||
#include <gtkmm.h>
|
#include <gtkmm.h>
|
||||||
#include <glibmm.h>
|
#include <glibmm.h>
|
||||||
#include "../rtengine/rtengine.h"
|
#include "../rtengine/rtengine.h"
|
||||||
|
#include "editbuffer.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "multilangmgr.h"
|
#include "multilangmgr.h"
|
||||||
#include "paramsedited.h"
|
#include "paramsedited.h"
|
||||||
#include "edit.h"
|
|
||||||
|
|
||||||
class ToolPanel;
|
class ToolPanel;
|
||||||
class FoldableToolPanel;
|
class FoldableToolPanel;
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
|
|
||||||
#include "wavelet.h"
|
#include "wavelet.h"
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include "edit.h"
|
|
||||||
|
#include "editcallbacks.h"
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "rtimage.h"
|
#include "rtimage.h"
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
||||||
|
class EditDataProvider;
|
||||||
|
|
||||||
class Wavelet :
|
class Wavelet :
|
||||||
public ToolParamBlock,
|
public ToolParamBlock,
|
||||||
public ThresholdAdjusterListener,
|
public ThresholdAdjusterListener,
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "xtransrawexposure.h"
|
#include "xtransrawexposure.h"
|
||||||
|
|
||||||
#include "guiutils.h"
|
#include "guiutils.h"
|
||||||
|
#include "options.h"
|
||||||
|
|
||||||
#include "../rtengine/procparams.h"
|
#include "../rtengine/procparams.h"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user