Fix wrong consts in editcallbacks.h (#5239)

This commit is contained in:
Flössie
2019-03-25 18:57:30 +01:00
parent 6747c5c7df
commit 14020ed356
6 changed files with 90 additions and 72 deletions

View File

@@ -31,12 +31,12 @@ class CurveTypePopUpButton: public PopUpToggleButton {
public: public:
CurveTypePopUpButton(const Glib::ustring &label=""): CurveTypePopUpButton(const Glib::ustring &label=""):
PopUpToggleButton(label) {} PopUpToggleButton(label) {}
void setPosIndexMap(const std::vector<int> &pmap) void setPosIndexMap(const std::vector<int> &pmap)
{ {
posidxmap_ = pmap; posidxmap_ = pmap;
} }
protected: protected:
int posToIndex(int pos) const override int posToIndex(int pos) const override
{ {
@@ -81,7 +81,7 @@ DiagonalCurveEditor::DiagonalCurveEditor (Glib::ustring text, CurveEditorGroup*
curveType->addEntry("curve-nurbs-small.png", M("CURVEEDITOR_NURBS")); // 3 NURBS curveType->addEntry("curve-nurbs-small.png", M("CURVEEDITOR_NURBS")); // 3 NURBS
static_cast<CurveTypePopUpButton *>(curveType)->setPosIndexMap({ 0, 1, 4, 2, 3 }); static_cast<CurveTypePopUpButton *>(curveType)->setPosIndexMap({ 0, 1, 4, 2, 3 });
curveType->setSelected(DCT_Linear); curveType->setSelected(DCT_Linear);
curveType->show(); curveType->show();
rangeLabels[0] = M("CURVEEDITOR_SHADOWS"); rangeLabels[0] = M("CURVEEDITOR_SHADOWS");
@@ -148,7 +148,7 @@ void DiagonalCurveEditor::setResetCurve(DiagonalCurveType cType, const std::vect
} }
break; break;
default: default:
break; break;
} }
@@ -449,7 +449,7 @@ void CurveEditor::switchOffEditMode ()
EditSubscriber::switchOffEditMode(); // disconnect EditSubscriber::switchOffEditMode(); // disconnect
} }
const bool CurveEditor::mouseOver(const int modifierKey) bool CurveEditor::mouseOver(int modifierKey)
{ {
EditDataProvider* provider = getEditProvider(); EditDataProvider* provider = getEditProvider();
subGroup->pipetteMouseOver(provider, modifierKey); subGroup->pipetteMouseOver(provider, modifierKey);
@@ -457,7 +457,7 @@ const bool CurveEditor::mouseOver(const int modifierKey)
return true; // return true will ask the preview to be redrawn, for the cursor return true; // return true will ask the preview to be redrawn, for the cursor
} }
bool CurveEditor::button1Pressed(const int modifierKey) bool CurveEditor::button1Pressed(int modifierKey)
{ {
EditDataProvider* provider = getEditProvider(); EditDataProvider* provider = getEditProvider();
@@ -482,7 +482,7 @@ bool CurveEditor::button1Released()
return true; return true;
} }
bool CurveEditor::drag1(const int modifierKey) bool CurveEditor::drag1(int modifierKey)
{ {
EditDataProvider* provider = getEditProvider(); EditDataProvider* provider = getEditProvider();
subGroup->pipetteDrag(provider, modifierKey); subGroup->pipetteDrag(provider, modifierKey);
@@ -490,7 +490,7 @@ bool CurveEditor::drag1(const int modifierKey)
return false; return false;
} }
const CursorShape CurveEditor::getCursor(const int objectID) const CursorShape CurveEditor::getCursor(int objectID) const
{ {
if (remoteDrag) { if (remoteDrag) {
return CSResizeHeight; return CSResizeHeight;

View File

@@ -128,11 +128,11 @@ public:
sigc::signal<void> signal_curvepoint_release(); sigc::signal<void> signal_curvepoint_release();
void switchOffEditMode () override; void switchOffEditMode () override;
const bool mouseOver(const int modifierKey) override; bool mouseOver(int modifierKey) override;
bool button1Pressed(const int modifierKey) override; bool button1Pressed(int modifierKey) override;
bool button1Released() override; bool button1Released() override;
bool drag1(const int modifierKey) override; bool drag1(int modifierKey) override;
const CursorShape getCursor(const int objectID) const override; CursorShape getCursor(int objectID) const override;
}; };

View File

@@ -38,7 +38,7 @@ void EditSubscriber::setEditID(EditUniqueID ID, BufferType buffType)
bufferType = buffType; bufferType = buffType;
} }
const 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;
@@ -69,27 +69,27 @@ void EditSubscriber::switchOffEditMode()
unsubscribe(); unsubscribe();
} }
const EditUniqueID EditSubscriber::getEditID() const EditUniqueID EditSubscriber::getEditID() const
{ {
return ID; return ID;
} }
const EditType EditSubscriber::getEditingType() const EditType EditSubscriber::getEditingType() const
{ {
return editingType; return editingType;
} }
const BufferType EditSubscriber::getPipetteBufferType() const BufferType EditSubscriber::getPipetteBufferType() const
{ {
return bufferType; return bufferType;
} }
const bool EditSubscriber::isDragging() const bool EditSubscriber::isDragging() const
{ {
return action == EditSubscriber::Action::DRAGGING; return action == EditSubscriber::Action::DRAGGING;
} }
const bool EditSubscriber::isPicking() const bool EditSubscriber::isPicking() const
{ {
return action == EditSubscriber::Action::PICKING; return action == EditSubscriber::Action::PICKING;
} }
@@ -132,7 +132,7 @@ void EditDataProvider::switchOffEditMode()
} }
} }
int EditDataProvider::getObject() int EditDataProvider::getObject() const
{ {
return object; return object;
} }
@@ -142,17 +142,17 @@ void EditDataProvider::setObject(int newObject)
object = newObject; object = newObject;
} }
float EditDataProvider::getPipetteVal1() float EditDataProvider::getPipetteVal1() const
{ {
return pipetteVal1; return pipetteVal1;
} }
float EditDataProvider::getPipetteVal2() float EditDataProvider::getPipetteVal2() const
{ {
return pipetteVal2; return pipetteVal2;
} }
float EditDataProvider::getPipetteVal3() float EditDataProvider::getPipetteVal3() const
{ {
return pipetteVal3; return pipetteVal3;
} }
@@ -172,7 +172,7 @@ void EditDataProvider::setPipetteVal3(float newVal)
pipetteVal3 = newVal; pipetteVal3 = newVal;
} }
const CursorShape EditDataProvider::getCursor(int objectID) const CursorShape EditDataProvider::getCursor(int objectID) const
{ {
if (currSubscriber) { if (currSubscriber) {
currSubscriber->getCursor(objectID); currSubscriber->getCursor(objectID);
@@ -186,74 +186,92 @@ EditSubscriber* EditDataProvider::getCurrSubscriber() const
return currSubscriber; return currSubscriber;
} }
EditDataProvider* EditSubscriber::getEditProvider () { EditDataProvider* EditSubscriber::getEditProvider()
{
return provider; return provider;
} }
const CursorShape EditSubscriber::getCursor (int objectID) const { CursorShape EditSubscriber::getCursor(int objectID) const
{
return CSHandOpen; return CSHandOpen;
} }
const bool EditSubscriber::mouseOver (const int modifierKey) { bool EditSubscriber::mouseOver(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::button1Pressed (const int modifierKey) { bool EditSubscriber::button1Pressed(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::button1Released () { bool EditSubscriber::button1Released()
{
return false; return false;
} }
bool EditSubscriber::button2Pressed (const int modifierKey) { bool EditSubscriber::button2Pressed(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::button2Released () { bool EditSubscriber::button2Released()
{
return false; return false;
} }
bool EditSubscriber::button3Pressed (const int modifierKey) { bool EditSubscriber::button3Pressed(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::button3Released () { bool EditSubscriber::button3Released()
{
return false; return false;
} }
bool EditSubscriber::drag1 (const int modifierKey) { bool EditSubscriber::drag1(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::drag2 (const int modifierKey) { bool EditSubscriber::drag2(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::drag3 (const int modifierKey) { bool EditSubscriber::drag3(int modifierKey)
{
return false; return false;
} }
bool EditSubscriber::pick1 (const bool picked) { bool EditSubscriber::pick1(bool picked)
{
return false; return false;
} }
bool EditSubscriber::pick2 (const bool picked) { bool EditSubscriber::pick2(bool picked)
{
return false; return false;
} }
bool EditSubscriber::pick3 (const 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;
} }
const int EditDataProvider::getPipetteRectSize () const { int EditDataProvider::getPipetteRectSize() const
{
return 8; // TODO: make a GUI return 8; // TODO: make a GUI
} }

View File

@@ -59,31 +59,31 @@ public:
void setEditProvider(EditDataProvider *provider); void setEditProvider(EditDataProvider *provider);
EditDataProvider* getEditProvider (); EditDataProvider* getEditProvider ();
void setEditID(EditUniqueID ID, BufferType buffType); void setEditID(EditUniqueID ID, BufferType buffType);
const 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
const EditUniqueID getEditID() const; EditUniqueID getEditID() const;
const EditType getEditingType() const; EditType getEditingType() const;
const BufferType getPipetteBufferType() const; BufferType getPipetteBufferType() const;
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)
const 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 const 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 const bool mouseOver (const 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 (const 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 */
@@ -93,7 +93,7 @@ public:
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 (const 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 */
@@ -103,7 +103,7 @@ public:
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 (const 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 */
@@ -112,36 +112,36 @@ public:
/** @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 (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 ();
@@ -180,16 +180,16 @@ public:
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(); int getObject() const;
void setObject(int newObject); void setObject(int newObject);
float getPipetteVal1(); float getPipetteVal1() const;
float getPipetteVal2(); float getPipetteVal2() const;
float getPipetteVal3(); 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 const CursorShape getCursor(int objectID) const; virtual CursorShape getCursor(int objectID) const;
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;
}; };

View File

@@ -331,7 +331,7 @@ void Gradient::editToggled ()
} }
} }
const CursorShape Gradient::getCursor(const int objectID) const CursorShape Gradient::getCursor(int objectID) const
{ {
switch (objectID) { switch (objectID) {
case (0): case (0):
@@ -357,7 +357,7 @@ const CursorShape Gradient::getCursor(const int objectID) const
} }
} }
const bool Gradient::mouseOver(const int modifierKey) bool Gradient::mouseOver(int modifierKey)
{ {
EditDataProvider* editProvider = getEditProvider(); EditDataProvider* editProvider = getEditProvider();
@@ -387,7 +387,7 @@ const bool Gradient::mouseOver(const int modifierKey)
return false; return false;
} }
bool Gradient::button1Pressed(const int modifierKey) bool Gradient::button1Pressed(int modifierKey)
{ {
if (lastObject < 0) { if (lastObject < 0) {
return false; return false;
@@ -466,7 +466,7 @@ bool Gradient::button1Released()
return true; return true;
} }
bool Gradient::drag1(const int modifierKey) bool Gradient::drag1(int modifierKey)
{ {
// compute the polar coordinate of the mouse position // compute the polar coordinate of the mouse position
EditDataProvider *provider = getEditProvider(); EditDataProvider *provider = getEditProvider();

View File

@@ -52,11 +52,11 @@ public:
void setEditProvider (EditDataProvider* provider) override; void setEditProvider (EditDataProvider* provider) override;
// EditSubscriber interface // EditSubscriber interface
const CursorShape getCursor(const int objectID) const override; CursorShape getCursor(int objectID) const override;
const bool mouseOver(const int modifierKey) override; bool mouseOver(int modifierKey) override;
bool button1Pressed(const int modifierKey) override; bool button1Pressed(int modifierKey) override;
bool button1Released() override; bool button1Released() override;
bool drag1(const int modifierKey) override; bool drag1(int modifierKey) override;
void switchOffEditMode () override; void switchOffEditMode () override;
}; };