Advice from Adam taken in account.

This commit is contained in:
Hombre
2016-03-08 00:50:01 +01:00
parent 18764846da
commit 30b5949fd5
3 changed files with 48 additions and 44 deletions

View File

@@ -269,7 +269,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y)
{ {
bool needRedraw = true; // most common case ; not redrawing are exceptions bool needRedraw = true; // most common case ; not redrawing are exceptions
EditSubscriber *editSubscriber = iarea->getCurrSubscriber(); const auto editSubscriber = iarea->getCurrSubscriber();
iarea->grabFocus (this); iarea->grabFocus (this);

View File

@@ -747,7 +747,7 @@ void Rectangle::drawToMOChannel(Cairo::RefPtr<Cairo::Context> &cr, unsigned shor
} }
} }
void OPIcon::drivenPointToRectangle(rtengine::Coord &pos, void OPIcon::drivenPointToRectangle(const rtengine::Coord &pos,
rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H) rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H)
{ {
switch (drivenPoint) { switch (drivenPoint) {
@@ -801,37 +801,37 @@ void OPIcon::drivenPointToRectangle(rtengine::Coord &pos,
bottomRight.y = topLeft.y + H - 1; bottomRight.y = topLeft.y + H - 1;
} }
OPIcon::OPIcon(Cairo::RefPtr<Cairo::ImageSurface> *normal, OPIcon::OPIcon(const Cairo::RefPtr<Cairo::ImageSurface> &normal,
Cairo::RefPtr<Cairo::ImageSurface> *active, const Cairo::RefPtr<Cairo::ImageSurface> &active,
Cairo::RefPtr<Cairo::ImageSurface> *prelight, const Cairo::RefPtr<Cairo::ImageSurface> &prelight,
Cairo::RefPtr<Cairo::ImageSurface> *dragged, const Cairo::RefPtr<Cairo::ImageSurface> &dragged,
Cairo::RefPtr<Cairo::ImageSurface> *insensitive, const Cairo::RefPtr<Cairo::ImageSurface> &insensitive,
enum DrivenPoint drivenPoint) : DrivenPoint drivenPoint) :
drivenPoint(drivenPoint) drivenPoint(drivenPoint)
{ {
if (normal) { if (normal) {
normalImg = *normal; normalImg = normal;
} }
if (prelight) { if (prelight) {
prelightImg = *prelight; prelightImg = prelight;
} }
if (active) { if (active) {
activeImg = *active; activeImg = active;
} }
if (dragged) { if (dragged) {
draggedImg = *active; draggedImg = active;
} }
if (insensitive) { if (insensitive) {
insensitiveImg = *insensitive; insensitiveImg = insensitive;
} }
} }
OPIcon::OPIcon(Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustring prelightImage, OPIcon::OPIcon(Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustring prelightImage,
Glib::ustring draggedImage, Glib::ustring insensitiveImage, enum DrivenPoint drivenPoint) : drivenPoint(drivenPoint) Glib::ustring draggedImage, Glib::ustring insensitiveImage, DrivenPoint drivenPoint) : drivenPoint(drivenPoint)
{ {
if (!normalImage.empty()) { if (!normalImage.empty()) {
normalImg = Cairo::ImageSurface::create_from_png( RTImage::findIconAbsolutePath(normalImage) ); normalImg = Cairo::ImageSurface::create_from_png( RTImage::findIconAbsolutePath(normalImage) );
@@ -854,28 +854,28 @@ OPIcon::OPIcon(Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustri
} }
} }
Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getNormalImg() const Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getNormalImg()
{ {
return normalImg; return normalImg;
} }
Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getPrelightImg() const Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getPrelightImg()
{ {
return prelightImg; return prelightImg;
} }
Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getActiveImg() const Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getActiveImg()
{ {
return activeImg; return activeImg;
} }
Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getDraggedImg() const Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getDraggedImg()
{ {
return draggedImg; return draggedImg;
} }
Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getInsensitiveImg() const Cairo::RefPtr<Cairo::ImageSurface> OPIcon::getInsensitiveImg()
{ {
return insensitiveImg; return insensitiveImg;
} }
void OPIcon::drawImage(Cairo::RefPtr<Cairo::ImageSurface> img, void OPIcon::drawImage(const Cairo::RefPtr<Cairo::ImageSurface> &img,
Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer,
EditCoordSystem &coordSystem) EditCoordSystem &coordSystem)
{ {
@@ -901,7 +901,7 @@ void OPIcon::drawImage(Cairo::RefPtr<Cairo::ImageSurface> img,
cr->fill(); cr->fill();
} }
void OPIcon::drawMOImage(Cairo::RefPtr<Cairo::ImageSurface> img, Cairo::RefPtr<Cairo::Context> &cr, void OPIcon::drawMOImage(const Cairo::RefPtr<Cairo::ImageSurface> &img, Cairo::RefPtr<Cairo::Context> &cr,
unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem) unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem)
{ {
// test of F_HOVERABLE has already been done // test of F_HOVERABLE has already been done
@@ -1078,27 +1078,27 @@ void EditSubscriber::switchOffEditMode()
unsubscribe(); unsubscribe();
} }
const EditUniqueID EditSubscriber::getEditID() EditUniqueID EditSubscriber::getEditID()
{ {
return ID; return ID;
} }
const EditType EditSubscriber::getEditingType() EditType EditSubscriber::getEditingType()
{ {
return editingType; return editingType;
} }
const BufferType EditSubscriber::getPipetteBufferType() BufferType EditSubscriber::getPipetteBufferType()
{ {
return bufferType; return bufferType;
} }
const bool EditSubscriber::isDragging() bool EditSubscriber::isDragging()
{ {
return action == ES_ACTION_DRAGGING; return action == ES_ACTION_DRAGGING;
} }
const bool EditSubscriber::isPicking() bool EditSubscriber::isPicking()
{ {
return action == ES_ACTION_PICKING; return action == ES_ACTION_PICKING;
} }

View File

@@ -400,7 +400,7 @@ public:
class OPIcon : public Geometry // OP stands for "On Preview" class OPIcon : public Geometry // OP stands for "On Preview"
{ {
protected: private:
Cairo::RefPtr<Cairo::ImageSurface> normalImg; Cairo::RefPtr<Cairo::ImageSurface> normalImg;
Cairo::RefPtr<Cairo::ImageSurface> prelightImg; Cairo::RefPtr<Cairo::ImageSurface> prelightImg;
Cairo::RefPtr<Cairo::ImageSurface> activeImg; Cairo::RefPtr<Cairo::ImageSurface> activeImg;
@@ -411,22 +411,26 @@ protected:
static void updateImages(); static void updateImages();
void changeImage(Glib::ustring &newImage); void changeImage(Glib::ustring &newImage);
static Glib::ustring findIconAbsolutePath(const Glib::ustring &iconFName); static Glib::ustring findIconAbsolutePath(const Glib::ustring &iconFName);
void drawImage (Cairo::RefPtr<Cairo::ImageSurface> img, Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drawImage (const Cairo::RefPtr<Cairo::ImageSurface> &img, Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drawMOImage (Cairo::RefPtr<Cairo::ImageSurface> img, Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drawMOImage (const Cairo::RefPtr<Cairo::ImageSurface> &img, Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drivenPointToRectangle(rtengine::Coord &pos, rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H); void drivenPointToRectangle(const rtengine::Coord &pos, rtengine::Coord &topLeft, rtengine::Coord &bottomRight, int W, int H);
public: public:
enum DrivenPoint drivenPoint; DrivenPoint drivenPoint;
rtengine::Coord position; rtengine::Coord position;
OPIcon (Cairo::RefPtr<Cairo::ImageSurface> *normal, Cairo::RefPtr<Cairo::ImageSurface> *active, Cairo::RefPtr<Cairo::ImageSurface> *prelight = NULL, Cairo::RefPtr<Cairo::ImageSurface> *dragged = NULL, Cairo::RefPtr<Cairo::ImageSurface> *insensitive = NULL, OPIcon (const Cairo::RefPtr<Cairo::ImageSurface> &normal,
enum DrivenPoint drivenPoint = DP_CENTERCENTER); const Cairo::RefPtr<Cairo::ImageSurface> &active,
OPIcon (Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustring prelightImage = "", Glib::ustring draggedImage = "", Glib::ustring insensitiveImage = "", enum DrivenPoint drivenPoint = DP_CENTERCENTER); const Cairo::RefPtr<Cairo::ImageSurface> &prelight = Cairo::RefPtr<Cairo::ImageSurface> (),
Cairo::RefPtr<Cairo::ImageSurface> getNormalImg(); const Cairo::RefPtr<Cairo::ImageSurface> &dragged = Cairo::RefPtr<Cairo::ImageSurface> (),
Cairo::RefPtr<Cairo::ImageSurface> getPrelightImg(); const Cairo::RefPtr<Cairo::ImageSurface> &insensitive = Cairo::RefPtr<Cairo::ImageSurface> (),
Cairo::RefPtr<Cairo::ImageSurface> getActiveImg(); DrivenPoint drivenPoint = DP_CENTERCENTER);
Cairo::RefPtr<Cairo::ImageSurface> getDraggedImg(); OPIcon (Glib::ustring normalImage, Glib::ustring activeImage, Glib::ustring prelightImage = "", Glib::ustring draggedImage = "", Glib::ustring insensitiveImage = "", DrivenPoint drivenPoint = DP_CENTERCENTER);
Cairo::RefPtr<Cairo::ImageSurface> getInsensitiveImg(); const Cairo::RefPtr<Cairo::ImageSurface> getNormalImg();
const Cairo::RefPtr<Cairo::ImageSurface> getPrelightImg();
const Cairo::RefPtr<Cairo::ImageSurface> getActiveImg();
const Cairo::RefPtr<Cairo::ImageSurface> getDraggedImg();
const Cairo::RefPtr<Cairo::ImageSurface> getInsensitiveImg();
void drawOuterGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drawOuterGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drawInnerGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drawInnerGeometry (Cairo::RefPtr<Cairo::Context> &cr, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
void drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem); void drawToMOChannel (Cairo::RefPtr<Cairo::Context> &cr, unsigned short id, ObjectMOBuffer *objectBuffer, EditCoordSystem &coordSystem);
@@ -469,11 +473,11 @@ public:
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(); EditUniqueID getEditID();
const EditType getEditingType(); EditType getEditingType();
const BufferType getPipetteBufferType(); BufferType getPipetteBufferType();
const bool isDragging(); /// Returns true if something is being dragged and drag events has to be sent (object mode only) bool isDragging(); /// Returns true if something is being dragged and drag events has to be sent (object mode only)
const bool isPicking(); /// Returns true if something is being picked bool isPicking(); /// 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" */