Merge pull request #5239 from Beep6581/splitted-edit-file

"edit.h/.cc" splitted to limit rebuilding dependencies
This commit is contained in:
Jean-Christophe 2019-03-22 09:39:21 +01:00 committed by GitHub
commit f62470f407
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
45 changed files with 2206 additions and 2045 deletions

View File

@ -23,6 +23,7 @@
#include "procparams.h"
#include "refreshmap.h"
#include "rt_math.h"
#include "../rtgui/editcallbacks.h"
namespace
{

View File

@ -44,6 +44,7 @@
#include "procparams.h"
#include "../rtgui/ppversion.h"
#include "../rtgui/guiutils.h"
#include "../rtgui/editcallbacks.h"
#undef CLIPD
#define CLIPD(a) ((a)>0.0f?((a)<1.0f?(a):1.0f):0.0f)

View File

@ -18,6 +18,8 @@
*/
#include "pipettebuffer.h"
#include "../rtgui/editcallbacks.h"
#include "imagefloat.h"
namespace rtengine
{

View File

@ -19,7 +19,7 @@
#ifndef _PIPETTEBUFFER_H_
#define _PIPETTEBUFFER_H_
#include "../rtgui/edit.h"
#include "../rtgui/editbuffer.h"
#include "array2D.h"
#include "iimage.h"
#include "coord.h"
@ -27,6 +27,8 @@
namespace rtengine
{
class Imagefloat;
/// @brief Structure that contains information about and pointers to the Edit buffer
class PipetteBuffer
{

View File

@ -1,7 +1,7 @@
# Common source files for both CLI and non-CLI execautables
set(CLISOURCEFILES
alignedmalloc.cc
edit.cc
editcallbacks.cc
main-cli.cc
multilangmgr.cc
options.cc
@ -49,8 +49,10 @@ set(NONCLISOURCEFILES
dirpyrequalizer.cc
distortion.cc
dynamicprofilepanel.cc
edit.cc
editbuffer.cc
editcallbacks.cc
editorpanel.cc
editwidgets.cc
editwindow.cc
epd.cc
exiffiltersettings.cc

View File

@ -21,6 +21,7 @@
#include "bayerpreprocess.h"
#include "eventmapper.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -19,6 +19,7 @@
#include "bayerrawexposure.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -21,7 +21,6 @@
#include "blackwhite.h"
#include "edit.h"
#include "guiutils.h"
#include "rtimage.h"

View File

@ -28,6 +28,8 @@
#include "mycurve.h"
#include "colorprovider.h"
class EditDataProvider;
class BlackWhite final :
public ToolParamBlock,
public AdjusterListener,

View File

@ -567,7 +567,7 @@ void ColorToning::read (const ProcParams* pp, const ParamsEdited* pedited)
labRegionData = pp->colorToning.labregions;
if (labRegionData.empty()) {
labRegionData.emplace_back(rtengine::ColorToningParams::LabCorrectionRegion());
labRegionData.emplace_back(rtengine::procparams::ColorToningParams::LabCorrectionRegion());
}
if (pp->colorToning.labregionsShowMask >= 0) {
labRegionSelected = pp->colorToning.labregionsShowMask;
@ -1441,7 +1441,7 @@ void ColorToning::labRegionGet(int idx)
void ColorToning::labRegionAddPressed()
{
labRegionSelected = labRegionData.size();
labRegionData.push_back(rtengine::ColorToningParams::LabCorrectionRegion());
labRegionData.push_back(rtengine::procparams::ColorToningParams::LabCorrectionRegion());
labRegionPopulateList();
labRegionShow(labRegionSelected);
@ -1525,7 +1525,7 @@ void ColorToning::labRegionPopulateList()
{
ConnectionBlocker b(labRegionSelectionConn);
labRegionList->clear_items();
rtengine::ColorToningParams::LabCorrectionRegion dflt;
rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt;
for (size_t i = 0; i < labRegionData.size(); ++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));
const char *ch = "";
switch (r.channel) {
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_R:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_R:
ch = "\n[Red]"; break;
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_G:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_G:
ch = "\n[Green]"; break;
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_B:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_B:
ch = "\n[Blue]"; break;
default:
ch = "";
@ -1560,7 +1560,7 @@ void ColorToning::labRegionShow(int idx, bool list_only)
if (disable) {
disableListener();
}
rtengine::ColorToningParams::LabCorrectionRegion dflt;
rtengine::procparams::ColorToningParams::LabCorrectionRegion dflt;
auto &r = labRegionData[idx];
if (!list_only) {
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));
const char *ch = "";
switch (r.channel) {
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_R:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_R:
ch = "\n[Red]"; break;
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_G:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_G:
ch = "\n[Green]"; break;
case rtengine::ColorToningParams::LabCorrectionRegion::CHAN_B:
case rtengine::procparams::ColorToningParams::LabCorrectionRegion::CHAN_B:
ch = "\n[Blue]"; break;
default:
ch = "";

View File

@ -13,6 +13,7 @@
#include "thresholdadjuster.h"
#include "colorprovider.h"
#include "labgrid.h"
#include "../rtengine/procparams.h"
class ColorToning final :
public ToolParamBlock,
@ -160,7 +161,7 @@ private:
FlatCurveEditor *labRegionLightnessMask;
Adjuster *labRegionMaskBlur;
Gtk::CheckButton *labRegionShowMask;
std::vector<rtengine::ColorToningParams::LabCorrectionRegion> labRegionData;
std::vector<rtengine::procparams::ColorToningParams::LabCorrectionRegion> labRegionData;
int labRegionSelected;
sigc::connection labRegionSelectionConn;

View File

@ -26,11 +26,13 @@
#include <gtkmm.h>
#include "../rtengine/rtengine.h"
#include "editbuffer.h"
#include "edit.h"
#include "lockablecolorpicker.h"
#include "threadutils.h"
class EditSubscriber;
class CropDisplayHandler
{

View File

@ -27,6 +27,9 @@
#include "options.h"
#include "rtimage.h"
#include "threadutils.h"
#include "editcallbacks.h"
#include "editbuffer.h"
#include "editwidgets.h"
#include "../rtengine/dcrop.h"
#include "../rtengine/mytime.h"

View File

@ -29,7 +29,8 @@
#include "cropguilistener.h"
#include "pointermotionlistener.h"
#include "cursormanager.h"
#include "edit.h"
#include "editbuffer.h"
#include "editcoordsys.h"
class CropWindow;

View File

@ -22,7 +22,7 @@
#include "popuptogglebutton.h"
#include "../rtengine/LUT.h"
#include "coloredbar.h"
#include "edit.h"
#include "editcallbacks.h"
#include "mydiagonalcurve.h"
#include "myflatcurve.h"

View File

@ -21,10 +21,10 @@
#include "dirpyrdenoise.h"
#include "edit.h"
#include "guiutils.h"
#include "../rtengine/procparams.h"
#include "editbuffer.h"
using namespace rtengine;
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"));
//curveEditorG = new CurveEditorGroup (options.lastLabCurvesDir);
NoiscurveEditorG->setCurveListener (this);
defaultCurve = rtengine::DirPyrDenoiseParams().lcurve;
defaultCurve = rtengine::procparams::DirPyrDenoiseParams().lcurve;
lshape = static_cast<FlatCurveEditor*>(NoiscurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
lshape->setIdentityValue(0.);
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->setCurveListener (this);
defaultCurve = rtengine::DirPyrDenoiseParams().cccurve;
defaultCurve = rtengine::procparams::DirPyrDenoiseParams().cccurve;
ccshape = static_cast<FlatCurveEditor*>(CCcurveEditorG->addCurve(CT_Flat, "", nullptr, false, false));
ccshape->setIdentityValue(0.);
ccshape->setResetCurve(FlatCurveType(defaultCurve.at(0)), defaultCurve);

View File

@ -28,6 +28,8 @@
#include "guiutils.h"
#include "options.h"
class EditDataProvider;
class DirPyrDenoise final :
public ToolParamBlock,
public AdjusterListener,

129
rtgui/editbuffer.cc Normal file
View 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
View 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
View 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
View 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
View 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

View File

@ -20,6 +20,7 @@
#include "guiutils.h"
#include "rtimage.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -3,6 +3,7 @@
*/
#include "gradient.h"
#include "editwidgets.h"
#include "rtimage.h"
#include "../rtengine/procparams.h"

View File

@ -6,8 +6,8 @@
#include <gtkmm.h>
#include "adjuster.h"
#include "editcallbacks.h"
#include "toolpanel.h"
#include "edit.h"
#include "guiutils.h"
class Gradient : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public EditSubscriber

View File

@ -27,10 +27,10 @@
#include "previewhandler.h"
#include "imageareatoollistener.h"
#include "cropwindow.h"
#include "editcallbacks.h"
#include "zoompanel.h"
#include "indclippedpanel.h"
#include "previewmodepanel.h"
#include "edit.h"
class ImageAreaPanel;
class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public EditDataProvider, public LockablePickerToolListener

View File

@ -20,10 +20,9 @@
#include "labcurve.h"
#include "edit.h"
#include "../rtengine/improcfun.h"
#include "../rtengine/procparams.h"
#include "editcallbacks.h"
using namespace rtengine;
using namespace rtengine::procparams;

View File

@ -26,6 +26,8 @@
#include "curveeditorgroup.h"
#include "colorprovider.h"
class EditDataProvider;
class LCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public CurveListener, public ColorProvider
{

View File

@ -38,6 +38,8 @@
#include "labgrid.h"
#include "options.h"
using rtengine::Color;

View File

@ -26,6 +26,7 @@
#include "guiutils.h"
#include "rtimage.h"
#include "options.h"
#include "../rtengine/lcp.h"
#include "../rtengine/procparams.h"

View File

@ -23,7 +23,6 @@
#include "../rtengine/coord.h"
#include "guiutils.h"
#include "edit.h"
class CropWindow;

View File

@ -18,6 +18,7 @@
*/
#include "mydiagonalcurve.h"
#include "../rtengine/curves.h"
#include "editcallbacks.h"
#include <cstring>
#include <gdkmm/types.h>

View File

@ -18,6 +18,7 @@
*/
#include "myflatcurve.h"
#include "../rtengine/curves.h"
#include "editcallbacks.h"
#include <cstring>
#include <gdkmm/types.h>

View File

@ -21,6 +21,7 @@
#include "preprocess.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -21,6 +21,7 @@
#include "eventmapper.h"
#include "guiutils.h"
#include "rtimage.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -21,6 +21,7 @@
#include "rawexposure.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -22,6 +22,7 @@
#include "sharpenedge.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"

View File

@ -23,11 +23,11 @@
#include "tonecurve.h"
#include "adjuster.h"
#include "edit.h"
#include "eventmapper.h"
#include "ppversion.h"
#include "../rtengine/procparams.h"
#include "editcallbacks.h"
using namespace rtengine;
using namespace rtengine::procparams;

View File

@ -27,6 +27,8 @@
#include "mycurve.h"
#include "guiutils.h"
class EditDataProvider;
class ToneCurve : public ToolParamBlock, public AdjusterListener, public FoldableToolPanel, public rtengine::AutoExpListener, public CurveListener
{
private:

View File

@ -22,10 +22,10 @@
#include <gtkmm.h>
#include <glibmm.h>
#include "../rtengine/rtengine.h"
#include "editbuffer.h"
#include "guiutils.h"
#include "multilangmgr.h"
#include "paramsedited.h"
#include "edit.h"
class ToolPanel;
class FoldableToolPanel;

View File

@ -19,7 +19,8 @@
#include "wavelet.h"
#include <cmath>
#include "edit.h"
#include "editcallbacks.h"
#include "guiutils.h"
#include "rtimage.h"

View File

@ -29,6 +29,8 @@
#include "guiutils.h"
#include "options.h"
class EditDataProvider;
class Wavelet :
public ToolParamBlock,
public ThresholdAdjusterListener,

View File

@ -21,6 +21,7 @@
#include "xtransrawexposure.h"
#include "guiutils.h"
#include "options.h"
#include "../rtengine/procparams.h"