Line endings in edit files converted to Unix format

This commit is contained in:
Hombre 2019-03-26 22:26:16 +01:00
parent 90e1480b7f
commit b76b630ec8
5 changed files with 2010 additions and 2010 deletions

View File

@ -1,277 +1,277 @@
/*
* 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(EditSubscriber::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() const
{
//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() const
{
return ID;
}
EditType EditSubscriber::getEditingType() const
{
return editingType;
}
BufferType EditSubscriber::getPipetteBufferType() const
{
return bufferType;
}
bool EditSubscriber::isDragging() const
{
return action == EditSubscriber::Action::DRAGGING;
}
bool EditSubscriber::isPicking() const
{
return action == EditSubscriber::Action::PICKING;
}
//--------------------------------------------------------------------------------------------------
EditDataProvider::EditDataProvider() :
currSubscriber(nullptr),
object(0),
pipetteVal1(0.f),
pipetteVal2(0.f),
pipetteVal3(0.f),
posScreen(-1, -1),
posImage(-1, -1),
deltaScreen(0, 0),
deltaImage(0, 0),
deltaPrevScreen(0, 0),
deltaPrevImage(0, 0)
{}
void EditDataProvider::subscribe(EditSubscriber *subscriber)
{
if (currSubscriber) {
currSubscriber->switchOffEditMode();
}
currSubscriber = subscriber;
}
void EditDataProvider::unsubscribe()
{
currSubscriber = nullptr;
}
void EditDataProvider::switchOffEditMode()
{
if (currSubscriber) {
currSubscriber->switchOffEditMode ();
}
}
int EditDataProvider::getObject() const
{
return object;
}
void EditDataProvider::setObject(int newObject)
{
object = newObject;
}
float EditDataProvider::getPipetteVal1() const
{
return pipetteVal1;
}
float EditDataProvider::getPipetteVal2() const
{
return pipetteVal2;
}
float EditDataProvider::getPipetteVal3() const
{
return pipetteVal3;
}
void EditDataProvider::setPipetteVal1(float newVal)
{
pipetteVal1 = newVal;
}
void EditDataProvider::setPipetteVal2(float newVal)
{
pipetteVal2 = newVal;
}
void EditDataProvider::setPipetteVal3(float newVal)
{
pipetteVal3 = newVal;
}
CursorShape EditDataProvider::getCursor(int objectID) const
{
if (currSubscriber) {
currSubscriber->getCursor(objectID);
}
return CSHandOpen;
}
EditSubscriber* EditDataProvider::getCurrSubscriber() const
{
return currSubscriber;
}
EditDataProvider* EditSubscriber::getEditProvider()
{
return provider;
}
CursorShape EditSubscriber::getCursor(int objectID) const
{
return CSHandOpen;
}
bool EditSubscriber::mouseOver(int modifierKey)
{
return false;
}
bool EditSubscriber::button1Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button1Released()
{
return false;
}
bool EditSubscriber::button2Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button2Released()
{
return false;
}
bool EditSubscriber::button3Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button3Released()
{
return false;
}
bool EditSubscriber::drag1(int modifierKey)
{
return false;
}
bool EditSubscriber::drag2(int modifierKey)
{
return false;
}
bool EditSubscriber::drag3(int modifierKey)
{
return false;
}
bool EditSubscriber::pick1(bool picked)
{
return false;
}
bool EditSubscriber::pick2(bool picked)
{
return false;
}
bool EditSubscriber::pick3(bool picked)
{
return false;
}
const std::vector<Geometry*>& EditSubscriber::getVisibleGeometry()
{
return visibleGeometry;
}
const std::vector<Geometry*>& EditSubscriber::getMouseOverGeometry()
{
return mouseOverGeometry;
}
int EditDataProvider::getPipetteRectSize() const
{
return 8; // TODO: make a GUI
}
/*
* 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(EditSubscriber::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() const
{
//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() const
{
return ID;
}
EditType EditSubscriber::getEditingType() const
{
return editingType;
}
BufferType EditSubscriber::getPipetteBufferType() const
{
return bufferType;
}
bool EditSubscriber::isDragging() const
{
return action == EditSubscriber::Action::DRAGGING;
}
bool EditSubscriber::isPicking() const
{
return action == EditSubscriber::Action::PICKING;
}
//--------------------------------------------------------------------------------------------------
EditDataProvider::EditDataProvider() :
currSubscriber(nullptr),
object(0),
pipetteVal1(0.f),
pipetteVal2(0.f),
pipetteVal3(0.f),
posScreen(-1, -1),
posImage(-1, -1),
deltaScreen(0, 0),
deltaImage(0, 0),
deltaPrevScreen(0, 0),
deltaPrevImage(0, 0)
{}
void EditDataProvider::subscribe(EditSubscriber *subscriber)
{
if (currSubscriber) {
currSubscriber->switchOffEditMode();
}
currSubscriber = subscriber;
}
void EditDataProvider::unsubscribe()
{
currSubscriber = nullptr;
}
void EditDataProvider::switchOffEditMode()
{
if (currSubscriber) {
currSubscriber->switchOffEditMode ();
}
}
int EditDataProvider::getObject() const
{
return object;
}
void EditDataProvider::setObject(int newObject)
{
object = newObject;
}
float EditDataProvider::getPipetteVal1() const
{
return pipetteVal1;
}
float EditDataProvider::getPipetteVal2() const
{
return pipetteVal2;
}
float EditDataProvider::getPipetteVal3() const
{
return pipetteVal3;
}
void EditDataProvider::setPipetteVal1(float newVal)
{
pipetteVal1 = newVal;
}
void EditDataProvider::setPipetteVal2(float newVal)
{
pipetteVal2 = newVal;
}
void EditDataProvider::setPipetteVal3(float newVal)
{
pipetteVal3 = newVal;
}
CursorShape EditDataProvider::getCursor(int objectID) const
{
if (currSubscriber) {
currSubscriber->getCursor(objectID);
}
return CSHandOpen;
}
EditSubscriber* EditDataProvider::getCurrSubscriber() const
{
return currSubscriber;
}
EditDataProvider* EditSubscriber::getEditProvider()
{
return provider;
}
CursorShape EditSubscriber::getCursor(int objectID) const
{
return CSHandOpen;
}
bool EditSubscriber::mouseOver(int modifierKey)
{
return false;
}
bool EditSubscriber::button1Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button1Released()
{
return false;
}
bool EditSubscriber::button2Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button2Released()
{
return false;
}
bool EditSubscriber::button3Pressed(int modifierKey)
{
return false;
}
bool EditSubscriber::button3Released()
{
return false;
}
bool EditSubscriber::drag1(int modifierKey)
{
return false;
}
bool EditSubscriber::drag2(int modifierKey)
{
return false;
}
bool EditSubscriber::drag3(int modifierKey)
{
return false;
}
bool EditSubscriber::pick1(bool picked)
{
return false;
}
bool EditSubscriber::pick2(bool picked)
{
return false;
}
bool EditSubscriber::pick3(bool picked)
{
return false;
}
const std::vector<Geometry*>& EditSubscriber::getVisibleGeometry()
{
return visibleGeometry;
}
const std::vector<Geometry*>& EditSubscriber::getMouseOverGeometry()
{
return mouseOverGeometry;
}
int EditDataProvider::getPipetteRectSize() const
{
return 8; // TODO: make a GUI
}

View File

@ -1,195 +1,195 @@
/*
* 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 class Action {
NONE, ///
DRAGGING, /// set action to this value in the buttonPressed event to start dragging and ask for drag event
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 action; /// object mode only, ignored in Pipette mode
public:
explicit EditSubscriber (EditType editType);
virtual ~EditSubscriber () = default;
void setEditProvider(EditDataProvider *provider);
EditDataProvider* getEditProvider ();
void setEditID(EditUniqueID ID, BufferType buffType);
bool isCurrentSubscriber() const;
virtual void subscribe();
virtual void unsubscribe();
virtual void switchOffEditMode(); /// Occurs when the user want to stop the editing mode
EditUniqueID getEditID() const;
EditType getEditingType() const;
BufferType getPipetteBufferType() const;
bool isDragging() const; /// Returns true if something is being dragged and drag events has to be sent (object mode only)
bool isPicking() const; /// 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 (int objectID) const;
/** @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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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;
int object; /// ET_OBJECTS mode: Object detected under the cursor, 0 otherwise; ET_PIPETTE mode: 1 if above the image, 0 otherwise
float pipetteVal1; /// Current pipette values
float pipetteVal2; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
float pipetteVal3; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
public:
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() = default;
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
int getObject() const;
void setObject(int newObject);
float getPipetteVal1() const;
float getPipetteVal2() const;
float getPipetteVal3() const;
void setPipetteVal1(float newVal);
void setPipetteVal2(float newVal);
void setPipetteVal3(float newVal);
virtual CursorShape getCursor(int objectID) const;
int getPipetteRectSize () const;
EditSubscriber* getCurrSubscriber() const;
virtual void getImageSize (int &w, int&h) = 0;
};
/*
* 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 class Action {
NONE, ///
DRAGGING, /// set action to this value in the buttonPressed event to start dragging and ask for drag event
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 action; /// object mode only, ignored in Pipette mode
public:
explicit EditSubscriber (EditType editType);
virtual ~EditSubscriber () = default;
void setEditProvider(EditDataProvider *provider);
EditDataProvider* getEditProvider ();
void setEditID(EditUniqueID ID, BufferType buffType);
bool isCurrentSubscriber() const;
virtual void subscribe();
virtual void unsubscribe();
virtual void switchOffEditMode(); /// Occurs when the user want to stop the editing mode
EditUniqueID getEditID() const;
EditType getEditingType() const;
BufferType getPipetteBufferType() const;
bool isDragging() const; /// Returns true if something is being dragged and drag events has to be sent (object mode only)
bool isPicking() const; /// 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 (int objectID) const;
/** @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 (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 (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 (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 (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 (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 (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 (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 (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 (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 (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;
int object; /// ET_OBJECTS mode: Object detected under the cursor, 0 otherwise; ET_PIPETTE mode: 1 if above the image, 0 otherwise
float pipetteVal1; /// Current pipette values
float pipetteVal2; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
float pipetteVal3; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
public:
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() = default;
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
int getObject() const;
void setObject(int newObject);
float getPipetteVal1() const;
float getPipetteVal2() const;
float getPipetteVal3() const;
void setPipetteVal1(float newVal);
void setPipetteVal2(float newVal);
void setPipetteVal3(float newVal);
virtual CursorShape getCursor(int objectID) const;
int getPipetteRectSize () const;
EditSubscriber* getCurrSubscriber() const;
virtual void getImageSize (int &w, int&h) = 0;
};

View File

@ -1,61 +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;
};
/*
* 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