Modified Preview Canvas

- Now the Preview can show free space around the image (the image's
corner will coincide with the center of the preview area)
- Editing objects can now be manipulated in this free space
- The editing mechanism has been split : it was completely handled in
rtengine before, now rtengine still handle the pipette's data provider,
but rtgui now handle the objects data provider.
- Bugfix: when using coarse rotate in the Editor panel, the Gradient
widgets are now correctly displayed
This commit is contained in:
Hombre
2016-01-29 22:09:56 +01:00
parent 8c3e6eab95
commit 4665b88788
22 changed files with 1413 additions and 848 deletions

View File

@@ -28,6 +28,7 @@
#include <list>
#include "cropguilistener.h"
#include "pointermotionlistener.h"
#include "edit.h"
class CropWindow;
class CropWindowListener
@@ -42,12 +43,13 @@ public:
};
class ImageArea;
class CropWindow : public LWButtonListener, public CropHandlerListener, public EditCoordSystem
class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer
{
// state management
ImgEditState state; // current state of user (see enum State)
int action_x, action_y, press_x, press_y;
ImgEditState state; // current state of user (see enum State)
int press_x, press_y; // position of the cursor in the GUI space on button press
int action_x, action_y; // parameter that will evolve during a pan or drag action
double rot_deg;
bool onResizeArea;
bool deleted;
@@ -85,7 +87,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E
PointerMotionListener* pmhlistener;
std::list<CropWindowListener*> listeners;
CropWindow* observedCropWin;
CropWindow* observedCropWin; // Pointer to the currently active detail CropWindow
rtengine::StagedImageProcessor* ipc;
bool onArea (CursorArea a, int x, int y);
@@ -95,7 +97,9 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E
void drawScaledSpotRectangle (Cairo::RefPtr<Cairo::Context> cr, int rectSize);
void drawUnscaledSpotRectangle (Cairo::RefPtr<Cairo::Context> cr, int rectSize);
void drawObservedFrame (Cairo::RefPtr<Cairo::Context> cr, int rw = 0, int rh = 0);
void changeZoom (int zoom, bool notify = true, int centerx = -1, int centery = -1, bool skipZoomIfUnchanged = true);
void changeZoom (int zoom, bool notify = true, int centerx = -1, int centery = -1);
// Used by the mainCropWindow only
void getObservedFrameArea (int& x, int& y, int& w, int& h, int rw = 0, int rh = 0);
public:
@@ -117,15 +121,16 @@ public:
void screenCoordToCropBuffer (int phyx, int phyy, int& cropx, int& cropy);
void screenCoordToImage (int phyx, int phyy, int& imgx, int& imgy);
void screenCoordToPreview (int phyx, int phyy, int& prevx, int& prevy);
void screenCoordToCropCanvas (int phyx, int phyy, int& prevx, int& prevy);
void imageCoordToCropCanvas (int imgx, int imgy, int& phyx, int& phyy);
void imageCoordToScreen (int imgx, int imgy, int& phyx, int& phyy);
void imageCoordToCropBuffer (int imgx, int imgy, int& phyx, int& phyy);
int scaleValueToImage (int value);
float scaleValueToImage (float value);
double scaleValueToImage (double value);
int scaleValueToScreen (int value);
float scaleValueToScreen (float value);
double scaleValueToScreen (double value);
int scaleValueToCanvas (int value);
float scaleValueToCanvas (float value);
double scaleValueToCanvas (double value);
double getZoomFitVal ();
void setPosition (int x, int y);
void getPosition (int& x, int& y);
@@ -140,14 +145,13 @@ public:
void zoomIn (bool toCursor = false, int cursorX = -1, int cursorY = -1);
void zoomOut (bool toCursor = false, int cursorX = -1, int cursorY = -1);
void zoom11 ();
void zoomFit (bool skipZoomIfUnchanged = true);
void zoomFit ();
void zoomFitCrop ();
double getZoom ();
bool isMinZoom ();
bool isMaxZoom ();
void setZoom (double zoom);
void findCenter (int deltaZoom, int& x, int& y);
bool isInside (int x, int y);
@@ -157,15 +161,20 @@ public:
void expose (Cairo::RefPtr<Cairo::Context> cr);
void setEditSubscriber (EditSubscriber* newSubscriber);
// interface lwbuttonlistener
void buttonPressed (LWButton* button, int actionCode, void* actionData);
void redrawNeeded (LWButton* button);
// crop handling
void getCropRectangle (int& x, int& y, int& w, int& h);
void getCropPosition (int& x, int& y);
void setCropPosition (int x, int y, bool update = true);
void getCropSize (int& w, int& h);
void getCropRectangle (int& x, int& y, int& w, int& h);
void getCropPosition (int& x, int& y);
void setCropPosition (int x, int y, bool update = true);
void centerCrop (bool update = true);
void getCropSize (int& w, int& h);
void getCropAnchorPosition (int& w, int& h);
void setCropAnchorPosition (int& w, int& h);
// listeners
void setCropGUIListener (CropGUIListener* cgl)
@@ -192,6 +201,7 @@ public:
void cropImageUpdated ();
void cropWindowChanged ();
void initialImageArrived ();
void setDisplayPosition (int x, int y);
void remoteMove (int deltaX, int deltaY);
void remoteMoveReady ();