parent
5b0cea2be3
commit
765c20d64a
@ -1,277 +1,277 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of RawTherapee.
|
* This file is part of RawTherapee.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
*
|
*
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RawTherapee is distributed in the hope that it will be useful,
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "editcallbacks.h"
|
#include "editcallbacks.h"
|
||||||
|
|
||||||
EditSubscriber::EditSubscriber (EditType editType) :
|
EditSubscriber::EditSubscriber (EditType editType) :
|
||||||
ID(EUID_None),
|
ID(EUID_None),
|
||||||
editingType(editType),
|
editingType(editType),
|
||||||
bufferType(BT_SINGLEPLANE_FLOAT),
|
bufferType(BT_SINGLEPLANE_FLOAT),
|
||||||
provider(nullptr),
|
provider(nullptr),
|
||||||
action(EditSubscriber::Action::NONE)
|
action(EditSubscriber::Action::NONE)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EditSubscriber::setEditProvider(EditDataProvider *provider)
|
void EditSubscriber::setEditProvider(EditDataProvider *provider)
|
||||||
{
|
{
|
||||||
this->provider = provider;
|
this->provider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditSubscriber::setEditID(EditUniqueID ID, BufferType buffType)
|
void EditSubscriber::setEditID(EditUniqueID ID, BufferType buffType)
|
||||||
{
|
{
|
||||||
this->ID = ID;
|
this->ID = ID;
|
||||||
bufferType = buffType;
|
bufferType = buffType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::isCurrentSubscriber() const
|
bool EditSubscriber::isCurrentSubscriber() const
|
||||||
{
|
{
|
||||||
//if (provider && provider->getCurrSubscriber())
|
//if (provider && provider->getCurrSubscriber())
|
||||||
// return provider->getCurrSubscriber()->getEditID() == ID;
|
// return provider->getCurrSubscriber()->getEditID() == ID;
|
||||||
|
|
||||||
if (provider) {
|
if (provider) {
|
||||||
return provider->getCurrSubscriber() == this;
|
return provider->getCurrSubscriber() == this;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditSubscriber::subscribe()
|
void EditSubscriber::subscribe()
|
||||||
{
|
{
|
||||||
if (provider) {
|
if (provider) {
|
||||||
provider->subscribe(this);
|
provider->subscribe(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditSubscriber::unsubscribe()
|
void EditSubscriber::unsubscribe()
|
||||||
{
|
{
|
||||||
if (provider) {
|
if (provider) {
|
||||||
provider->unsubscribe();
|
provider->unsubscribe();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditSubscriber::switchOffEditMode()
|
void EditSubscriber::switchOffEditMode()
|
||||||
{
|
{
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
}
|
}
|
||||||
|
|
||||||
EditUniqueID EditSubscriber::getEditID() const
|
EditUniqueID EditSubscriber::getEditID() const
|
||||||
{
|
{
|
||||||
return ID;
|
return ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditType EditSubscriber::getEditingType() const
|
EditType EditSubscriber::getEditingType() const
|
||||||
{
|
{
|
||||||
return editingType;
|
return editingType;
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferType EditSubscriber::getPipetteBufferType() const
|
BufferType EditSubscriber::getPipetteBufferType() const
|
||||||
{
|
{
|
||||||
return bufferType;
|
return bufferType;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::isDragging() const
|
bool EditSubscriber::isDragging() const
|
||||||
{
|
{
|
||||||
return action == EditSubscriber::Action::DRAGGING;
|
return action == EditSubscriber::Action::DRAGGING;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::isPicking() const
|
bool EditSubscriber::isPicking() const
|
||||||
{
|
{
|
||||||
return action == EditSubscriber::Action::PICKING;
|
return action == EditSubscriber::Action::PICKING;
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
EditDataProvider::EditDataProvider() :
|
EditDataProvider::EditDataProvider() :
|
||||||
currSubscriber(nullptr),
|
currSubscriber(nullptr),
|
||||||
object(0),
|
object(0),
|
||||||
pipetteVal1(0.f),
|
pipetteVal1(0.f),
|
||||||
pipetteVal2(0.f),
|
pipetteVal2(0.f),
|
||||||
pipetteVal3(0.f),
|
pipetteVal3(0.f),
|
||||||
posScreen(-1, -1),
|
posScreen(-1, -1),
|
||||||
posImage(-1, -1),
|
posImage(-1, -1),
|
||||||
deltaScreen(0, 0),
|
deltaScreen(0, 0),
|
||||||
deltaImage(0, 0),
|
deltaImage(0, 0),
|
||||||
deltaPrevScreen(0, 0),
|
deltaPrevScreen(0, 0),
|
||||||
deltaPrevImage(0, 0)
|
deltaPrevImage(0, 0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void EditDataProvider::subscribe(EditSubscriber *subscriber)
|
void EditDataProvider::subscribe(EditSubscriber *subscriber)
|
||||||
{
|
{
|
||||||
if (currSubscriber) {
|
if (currSubscriber) {
|
||||||
currSubscriber->switchOffEditMode();
|
currSubscriber->switchOffEditMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
currSubscriber = subscriber;
|
currSubscriber = subscriber;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::unsubscribe()
|
void EditDataProvider::unsubscribe()
|
||||||
{
|
{
|
||||||
currSubscriber = nullptr;
|
currSubscriber = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::switchOffEditMode()
|
void EditDataProvider::switchOffEditMode()
|
||||||
{
|
{
|
||||||
if (currSubscriber) {
|
if (currSubscriber) {
|
||||||
currSubscriber->switchOffEditMode ();
|
currSubscriber->switchOffEditMode ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int EditDataProvider::getObject() const
|
int EditDataProvider::getObject() const
|
||||||
{
|
{
|
||||||
return object;
|
return object;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::setObject(int newObject)
|
void EditDataProvider::setObject(int newObject)
|
||||||
{
|
{
|
||||||
object = newObject;
|
object = newObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
float EditDataProvider::getPipetteVal1() const
|
float EditDataProvider::getPipetteVal1() const
|
||||||
{
|
{
|
||||||
return pipetteVal1;
|
return pipetteVal1;
|
||||||
}
|
}
|
||||||
|
|
||||||
float EditDataProvider::getPipetteVal2() const
|
float EditDataProvider::getPipetteVal2() const
|
||||||
{
|
{
|
||||||
return pipetteVal2;
|
return pipetteVal2;
|
||||||
}
|
}
|
||||||
|
|
||||||
float EditDataProvider::getPipetteVal3() const
|
float EditDataProvider::getPipetteVal3() const
|
||||||
{
|
{
|
||||||
return pipetteVal3;
|
return pipetteVal3;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::setPipetteVal1(float newVal)
|
void EditDataProvider::setPipetteVal1(float newVal)
|
||||||
{
|
{
|
||||||
pipetteVal1 = newVal;
|
pipetteVal1 = newVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::setPipetteVal2(float newVal)
|
void EditDataProvider::setPipetteVal2(float newVal)
|
||||||
{
|
{
|
||||||
pipetteVal2 = newVal;
|
pipetteVal2 = newVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditDataProvider::setPipetteVal3(float newVal)
|
void EditDataProvider::setPipetteVal3(float newVal)
|
||||||
{
|
{
|
||||||
pipetteVal3 = newVal;
|
pipetteVal3 = newVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorShape EditDataProvider::getCursor(int objectID) const
|
CursorShape EditDataProvider::getCursor(int objectID) const
|
||||||
{
|
{
|
||||||
if (currSubscriber) {
|
if (currSubscriber) {
|
||||||
currSubscriber->getCursor(objectID);
|
currSubscriber->getCursor(objectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return CSHandOpen;
|
return CSHandOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditSubscriber* EditDataProvider::getCurrSubscriber() const
|
EditSubscriber* EditDataProvider::getCurrSubscriber() const
|
||||||
{
|
{
|
||||||
return currSubscriber;
|
return currSubscriber;
|
||||||
}
|
}
|
||||||
|
|
||||||
EditDataProvider* EditSubscriber::getEditProvider()
|
EditDataProvider* EditSubscriber::getEditProvider()
|
||||||
{
|
{
|
||||||
return provider;
|
return provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
CursorShape EditSubscriber::getCursor(int objectID) const
|
CursorShape EditSubscriber::getCursor(int objectID) const
|
||||||
{
|
{
|
||||||
return CSHandOpen;
|
return CSHandOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::mouseOver(int modifierKey)
|
bool EditSubscriber::mouseOver(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button1Pressed(int modifierKey)
|
bool EditSubscriber::button1Pressed(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button1Released()
|
bool EditSubscriber::button1Released()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button2Pressed(int modifierKey)
|
bool EditSubscriber::button2Pressed(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button2Released()
|
bool EditSubscriber::button2Released()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button3Pressed(int modifierKey)
|
bool EditSubscriber::button3Pressed(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::button3Released()
|
bool EditSubscriber::button3Released()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::drag1(int modifierKey)
|
bool EditSubscriber::drag1(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::drag2(int modifierKey)
|
bool EditSubscriber::drag2(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::drag3(int modifierKey)
|
bool EditSubscriber::drag3(int modifierKey)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::pick1(bool picked)
|
bool EditSubscriber::pick1(bool picked)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::pick2(bool picked)
|
bool EditSubscriber::pick2(bool picked)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EditSubscriber::pick3(bool picked)
|
bool EditSubscriber::pick3(bool picked)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Geometry*>& EditSubscriber::getVisibleGeometry()
|
const std::vector<Geometry*>& EditSubscriber::getVisibleGeometry()
|
||||||
{
|
{
|
||||||
return visibleGeometry;
|
return visibleGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::vector<Geometry*>& EditSubscriber::getMouseOverGeometry()
|
const std::vector<Geometry*>& EditSubscriber::getMouseOverGeometry()
|
||||||
{
|
{
|
||||||
return mouseOverGeometry;
|
return mouseOverGeometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
int EditDataProvider::getPipetteRectSize() const
|
int EditDataProvider::getPipetteRectSize() const
|
||||||
{
|
{
|
||||||
return 8; // TODO: make a GUI
|
return 8; // TODO: make a GUI
|
||||||
}
|
}
|
||||||
|
@ -1,195 +1,195 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of RawTherapee.
|
* This file is part of RawTherapee.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
*
|
*
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RawTherapee is distributed in the hope that it will be useful,
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "editid.h"
|
#include "editid.h"
|
||||||
#include "cursormanager.h"
|
#include "cursormanager.h"
|
||||||
#include "../rtengine/coord.h"
|
#include "../rtengine/coord.h"
|
||||||
|
|
||||||
class Geometry;
|
class Geometry;
|
||||||
class EditDataProvider;
|
class EditDataProvider;
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* See editwidgets.h for documentation
|
* See editwidgets.h for documentation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/// @brief Method for client tools needing Edit information
|
/// @brief Method for client tools needing Edit information
|
||||||
class EditSubscriber
|
class EditSubscriber
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
private:
|
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
|
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;
|
EditType editingType;
|
||||||
BufferType bufferType;
|
BufferType bufferType;
|
||||||
EditDataProvider *provider;
|
EditDataProvider *provider;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::vector<Geometry*> visibleGeometry; /// displayed geometry
|
std::vector<Geometry*> visibleGeometry; /// displayed geometry
|
||||||
std::vector<Geometry*> mouseOverGeometry; /// mouseOver geometry, drawn in a hidden buffer
|
std::vector<Geometry*> mouseOverGeometry; /// mouseOver geometry, drawn in a hidden buffer
|
||||||
enum class Action {
|
enum class Action {
|
||||||
NONE, ///
|
NONE, ///
|
||||||
DRAGGING, /// set action to this value in the buttonPressed event to start dragging and ask for drag event
|
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 !
|
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
|
Action action; /// object mode only, ignored in Pipette mode
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditSubscriber (EditType editType);
|
explicit EditSubscriber (EditType editType);
|
||||||
virtual ~EditSubscriber () = default;
|
virtual ~EditSubscriber () = default;
|
||||||
|
|
||||||
void setEditProvider(EditDataProvider *provider);
|
void setEditProvider(EditDataProvider *provider);
|
||||||
EditDataProvider* getEditProvider ();
|
EditDataProvider* getEditProvider ();
|
||||||
void setEditID(EditUniqueID ID, BufferType buffType);
|
void setEditID(EditUniqueID ID, BufferType buffType);
|
||||||
bool isCurrentSubscriber() const;
|
bool isCurrentSubscriber() const;
|
||||||
virtual void subscribe();
|
virtual void subscribe();
|
||||||
virtual void unsubscribe();
|
virtual void unsubscribe();
|
||||||
virtual void switchOffEditMode(); /// Occurs when the user want to stop the editing mode
|
virtual void switchOffEditMode(); /// Occurs when the user want to stop the editing mode
|
||||||
EditUniqueID getEditID() const;
|
EditUniqueID getEditID() const;
|
||||||
EditType getEditingType() const;
|
EditType getEditingType() const;
|
||||||
BufferType getPipetteBufferType() 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 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
|
bool isPicking() const; /// Returns true if something is being picked
|
||||||
|
|
||||||
/** @brief Get the cursor to be displayed when above handles
|
/** @brief Get the cursor to be displayed when above handles
|
||||||
@param objectID object currently "hovered" */
|
@param objectID object currently "hovered" */
|
||||||
virtual CursorShape getCursor (int objectID) const;
|
virtual CursorShape getCursor (int objectID) const;
|
||||||
|
|
||||||
/** @brief Triggered when the mouse is moving over an object
|
/** @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
|
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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool mouseOver (int modifierKey);
|
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
|
/** @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
|
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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button1Pressed (int modifierKey);
|
virtual bool button1Pressed (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when mouse button 1 is released
|
/** @brief Triggered when mouse button 1 is released
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button1Released ();
|
virtual bool button1Released ();
|
||||||
|
|
||||||
/** @brief Triggered when mouse button 2 is pressed (middle button)
|
/** @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
|
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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button2Pressed (int modifierKey);
|
virtual bool button2Pressed (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when mouse button 2 is released (middle button)
|
/** @brief Triggered when mouse button 2 is released (middle button)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button2Released ();
|
virtual bool button2Released ();
|
||||||
|
|
||||||
/** @brief Triggered when mouse button 3 is pressed (right button)
|
/** @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
|
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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button3Pressed (int modifierKey);
|
virtual bool button3Pressed (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when mouse button 3 is released (right button)
|
/** @brief Triggered when mouse button 3 is released (right button)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool button3Released ();
|
virtual bool button3Released ();
|
||||||
|
|
||||||
/** @brief Triggered when the user is moving while holding down mouse button 1
|
/** @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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool drag1 (int modifierKey);
|
virtual bool drag1 (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when the user is moving while holding down mouse button 2
|
/** @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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool drag2 (int modifierKey);
|
virtual bool drag2 (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when the user is moving while holding down mouse button 3
|
/** @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 | ...)
|
@param modifierKey Gtk's event modifier key (GDK_CONTROL_MASK | GDK_SHIFT_MASK | ...)
|
||||||
@return true if the preview has to be redrawn, false otherwise */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool drag3 (int modifierKey);
|
virtual bool drag3 (int modifierKey);
|
||||||
|
|
||||||
/** @brief Triggered when the user is releasing mouse button 1 while in action==ES_ACTION_PICKING mode
|
/** @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.
|
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.
|
@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.
|
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 */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool pick1 (bool picked);
|
virtual bool pick1 (bool picked);
|
||||||
|
|
||||||
/** @brief Triggered when the user is releasing mouse button 2 while in action==ES_ACTION_PICKING mode
|
/** @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.
|
@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.
|
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 */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool pick2 (bool picked);
|
virtual bool pick2 (bool picked);
|
||||||
|
|
||||||
/** @brief Triggered when the user is releasing mouse button 3 while in action==ES_ACTION_PICKING mode
|
/** @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.
|
@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.
|
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 */
|
@return true if the preview has to be redrawn, false otherwise */
|
||||||
virtual bool pick3 (bool picked);
|
virtual bool pick3 (bool picked);
|
||||||
|
|
||||||
/** @brief Get the geometry to be shown to the user */
|
/** @brief Get the geometry to be shown to the user */
|
||||||
const std::vector<Geometry*>& getVisibleGeometry ();
|
const std::vector<Geometry*>& getVisibleGeometry ();
|
||||||
|
|
||||||
/** @brief Get the geometry to be drawn in the "mouse over" channel, hidden from the user */
|
/** @brief Get the geometry to be drawn in the "mouse over" channel, hidden from the user */
|
||||||
const std::vector<Geometry*>& getMouseOverGeometry ();
|
const std::vector<Geometry*>& getMouseOverGeometry ();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Class to handle the furniture of data to the subscribers.
|
/** @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
|
* 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.
|
* trigger the usual event so that the image will be reprocessed to compute the buffer of the current subscriber.
|
||||||
*/
|
*/
|
||||||
class EditDataProvider
|
class EditDataProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EditSubscriber *currSubscriber;
|
EditSubscriber *currSubscriber;
|
||||||
int object; /// ET_OBJECTS mode: Object detected under the cursor, 0 otherwise; ET_PIPETTE mode: 1 if above the image, 0 otherwise
|
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 pipetteVal1; /// Current pipette values
|
||||||
float pipetteVal2; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
|
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
|
float pipetteVal3; /// Current pipette values; if bufferType==BT_SINGLEPLANE_FLOAT, will be set to 0
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
rtengine::Coord posScreen; /// Location of the mouse button press, in preview image space
|
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 posImage; /// Location of the mouse button press, in the full image space
|
||||||
rtengine::Coord deltaScreen; /// Delta relative to posScreen
|
rtengine::Coord deltaScreen; /// Delta relative to posScreen
|
||||||
rtengine::Coord deltaImage; /// Delta relative to posImage
|
rtengine::Coord deltaImage; /// Delta relative to posImage
|
||||||
rtengine::Coord deltaPrevScreen; /// Delta relative to the previous mouse location, in preview image space
|
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
|
rtengine::Coord deltaPrevImage; /// Delta relative to the previous mouse location, in the full image space
|
||||||
|
|
||||||
EditDataProvider();
|
EditDataProvider();
|
||||||
virtual ~EditDataProvider() = default;
|
virtual ~EditDataProvider() = default;
|
||||||
|
|
||||||
virtual void subscribe(EditSubscriber *subscriber);
|
virtual void subscribe(EditSubscriber *subscriber);
|
||||||
virtual void unsubscribe(); /// Occurs when the subscriber has been switched off first
|
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 void switchOffEditMode (); /// Occurs when the user want to stop the editing mode
|
||||||
int getObject() const;
|
int getObject() const;
|
||||||
void setObject(int newObject);
|
void setObject(int newObject);
|
||||||
float getPipetteVal1() const;
|
float getPipetteVal1() const;
|
||||||
float getPipetteVal2() const;
|
float getPipetteVal2() const;
|
||||||
float getPipetteVal3() const;
|
float getPipetteVal3() const;
|
||||||
void setPipetteVal1(float newVal);
|
void setPipetteVal1(float newVal);
|
||||||
void setPipetteVal2(float newVal);
|
void setPipetteVal2(float newVal);
|
||||||
void setPipetteVal3(float newVal);
|
void setPipetteVal3(float newVal);
|
||||||
virtual CursorShape getCursor(int objectID) const;
|
virtual CursorShape getCursor(int objectID) const;
|
||||||
int getPipetteRectSize () const;
|
int getPipetteRectSize () const;
|
||||||
EditSubscriber* getCurrSubscriber() const;
|
EditSubscriber* getCurrSubscriber() const;
|
||||||
virtual void getImageSize (int &w, int&h) = 0;
|
virtual void getImageSize (int &w, int&h) = 0;
|
||||||
};
|
};
|
||||||
|
@ -1,61 +1,61 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of RawTherapee.
|
* This file is part of RawTherapee.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
* Copyright (c) 2019 Jean-Christophe FRISCH <natureh.510@gmail.com>
|
||||||
*
|
*
|
||||||
* RawTherapee is free software: you can redistribute it and/or modify
|
* RawTherapee is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* RawTherapee is distributed in the hope that it will be useful,
|
* RawTherapee is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @file
|
/** @file
|
||||||
* See editwidgets.h for documentation
|
* See editwidgets.h for documentation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @brief Coordinate system where the widgets will be drawn
|
/** @brief Coordinate system where the widgets will be drawn
|
||||||
*
|
*
|
||||||
* The EditCoordSystem is used to define a screen and an image coordinate system.
|
* The EditCoordSystem is used to define a screen and an image coordinate system.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
class EditCoordSystem
|
class EditCoordSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~EditCoordSystem() {}
|
virtual ~EditCoordSystem() {}
|
||||||
|
|
||||||
/// Convert the widget's DrawingArea (i.e. preview area) coords to the edit buffer coords
|
/// 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;
|
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
|
/// 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;
|
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
|
/// 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;
|
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)
|
/// 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;
|
virtual void imageCoordToCropCanvas (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
/// Convert the image coords to the edit buffer coords (includes borders)
|
/// Convert the image coords to the edit buffer coords (includes borders)
|
||||||
virtual void imageCoordToCropBuffer (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
virtual void imageCoordToCropBuffer (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
||||||
/// Convert the image coords to the displayed image coords (no borders here)
|
/// Convert the image coords to the displayed image coords (no borders here)
|
||||||
virtual void imageCoordToCropImage (int imgx, int imgy, int& phyx, int& phyy) = 0;
|
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
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
virtual int scaleValueToImage (int value) = 0;
|
virtual int scaleValueToImage (int value) = 0;
|
||||||
/// Convert a size value from the preview's scale to the image's scale
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
virtual float scaleValueToImage (float value) = 0;
|
virtual float scaleValueToImage (float value) = 0;
|
||||||
/// Convert a size value from the preview's scale to the image's scale
|
/// Convert a size value from the preview's scale to the image's scale
|
||||||
virtual double scaleValueToImage (double value) = 0;
|
virtual double scaleValueToImage (double value) = 0;
|
||||||
/// Convert a size value from the image's scale to the preview's scale
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
virtual int scaleValueToCanvas (int value) = 0;
|
virtual int scaleValueToCanvas (int value) = 0;
|
||||||
/// Convert a size value from the image's scale to the preview's scale
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
virtual float scaleValueToCanvas (float value) = 0;
|
virtual float scaleValueToCanvas (float value) = 0;
|
||||||
/// Convert a size value from the image's scale to the preview's scale
|
/// Convert a size value from the image's scale to the preview's scale
|
||||||
virtual double scaleValueToCanvas (double value) = 0;
|
virtual double scaleValueToCanvas (double value) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
1870
rtgui/editwidgets.cc
1870
rtgui/editwidgets.cc
File diff suppressed because it is too large
Load Diff
1084
rtgui/editwidgets.h
1084
rtgui/editwidgets.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user