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:
@@ -56,8 +56,8 @@ ImageArea::ImageArea (ImageAreaPanel* p) : parent(p), firstOpen(true)
|
||||
ImageArea::~ImageArea ()
|
||||
{
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
delete *i;
|
||||
for (auto cropWin : cropWins) {
|
||||
delete cropWin;
|
||||
}
|
||||
|
||||
cropWins.clear ();
|
||||
@@ -110,10 +110,9 @@ void ImageArea::setImProcCoordinator (rtengine::StagedImageProcessor* ipc_)
|
||||
{
|
||||
if( !ipc_ ) {
|
||||
focusGrabber = NULL;
|
||||
std::list<CropWindow*>::iterator i = cropWins.begin();
|
||||
|
||||
for( ; i != cropWins.end(); i++ ) {
|
||||
delete *i;
|
||||
for (auto cropWin : cropWins) {
|
||||
delete cropWin;
|
||||
}
|
||||
|
||||
cropWins.clear();
|
||||
@@ -170,10 +169,11 @@ CropWindow* ImageArea::getCropWindow (int x, int y)
|
||||
|
||||
CropWindow* cw = mainCropWindow;
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++)
|
||||
if ((*i)->isInside (x, y)) {
|
||||
return *i;
|
||||
for (auto cropWin : cropWins) {
|
||||
if (cropWin->isInside (x, y)) {
|
||||
return cropWin;
|
||||
}
|
||||
}
|
||||
|
||||
return cw;
|
||||
}
|
||||
@@ -200,7 +200,6 @@ bool ImageArea::on_expose_event(GdkEventExpose* event)
|
||||
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
|
||||
|
||||
if (mainCropWindow) {
|
||||
//printf("MainCropWindow (%d x %d)\n", window->get_width(), window->get_height());
|
||||
mainCropWindow->expose (cr);
|
||||
}
|
||||
|
||||
@@ -275,11 +274,11 @@ bool ImageArea::on_scroll_event (GdkEventScroll* event)
|
||||
int newCenterX = (int)event->x;
|
||||
int newCenterY = (int)event->y;
|
||||
|
||||
cw->screenCoordToImage(newCenterX, newCenterY, newCenterX, newCenterY);
|
||||
|
||||
if (event->direction == GDK_SCROLL_UP && !cw->isMaxZoom()) {
|
||||
cw->findCenter (1, newCenterX, newCenterY);
|
||||
cw->zoomIn (true, newCenterX, newCenterY);
|
||||
} else if (!cw->isMinZoom()) {
|
||||
cw->findCenter (-1, newCenterX, newCenterY);
|
||||
cw->zoomOut (true, newCenterX, newCenterY);
|
||||
}
|
||||
}
|
||||
@@ -327,10 +326,10 @@ bool ImageArea::on_leave_notify_event (GdkEventCrossing* event)
|
||||
|
||||
void ImageArea::subscribe(EditSubscriber *subscriber)
|
||||
{
|
||||
mainCropWindow->cropHandler.setEditSubscriber(subscriber);
|
||||
mainCropWindow->setEditSubscriber(subscriber);
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
(*i)->cropHandler.setEditSubscriber(subscriber);
|
||||
for (auto cropWin : cropWins) {
|
||||
cropWin->setEditSubscriber(subscriber);
|
||||
}
|
||||
|
||||
EditDataProvider::subscribe(subscriber);
|
||||
@@ -339,7 +338,7 @@ void ImageArea::subscribe(EditSubscriber *subscriber)
|
||||
listener->getToolBar()->startEditMode ();
|
||||
}
|
||||
|
||||
if (subscriber->getEditingType() == ET_OBJECTS) {
|
||||
if (subscriber && subscriber->getEditingType() == ET_OBJECTS) {
|
||||
// In this case, no need to reprocess the image, so we redraw the image to display the geometry
|
||||
queue_draw();
|
||||
}
|
||||
@@ -358,8 +357,8 @@ void ImageArea::unsubscribe()
|
||||
// Ask the Crops to free-up edit mode buffers
|
||||
mainCropWindow->cropHandler.setEditSubscriber(NULL);
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
(*i)->cropHandler.setEditSubscriber(NULL);
|
||||
for (auto cropWin : cropWins) {
|
||||
cropWin->cropHandler.setEditSubscriber(NULL);
|
||||
}
|
||||
|
||||
setToolHand();
|
||||
@@ -473,12 +472,10 @@ void ImageArea::addCropWindow ()
|
||||
|
||||
y = cropheight * (N % maxRows);
|
||||
cw->setPosition (x, y);
|
||||
cw->setEditSubscriber (getCurrSubscriber());
|
||||
cw->enable(); // start processing!
|
||||
|
||||
int x0, y0, w, h, wc, hc;
|
||||
mainCropWindow->getCropRectangle(x0, y0, w, h );
|
||||
cw->getCropSize(wc, hc);
|
||||
cw->setCropPosition(x0 + w / 2 - wc / 2, y0 + h / 2 - hc / 2);
|
||||
cw->centerCrop();
|
||||
mainCropWindow->setObservedCropWin (cropWins.front());
|
||||
|
||||
if(cropWins.size() == 1) { // after first detail window we already have high quality
|
||||
@@ -539,9 +536,8 @@ void ImageArea::getScrollImageSize (int& w, int& h)
|
||||
{
|
||||
|
||||
if (mainCropWindow && ipc) {
|
||||
double z = mainCropWindow->getZoom ();
|
||||
w = ipc->getFullWidth() * z;
|
||||
h = ipc->getFullHeight() * z;
|
||||
w = ipc->getFullWidth();
|
||||
h = ipc->getFullHeight();
|
||||
} else {
|
||||
w = h = 0;
|
||||
}
|
||||
@@ -551,10 +547,7 @@ void ImageArea::getScrollPosition (int& x, int& y)
|
||||
{
|
||||
|
||||
if (mainCropWindow) {
|
||||
int cropX, cropY;
|
||||
mainCropWindow->getCropPosition (cropX, cropY);
|
||||
x = cropX * mainCropWindow->getZoom ();
|
||||
y = cropY * mainCropWindow->getZoom ();
|
||||
mainCropWindow->getCropAnchorPosition (x, y);
|
||||
} else {
|
||||
x = y = 0;
|
||||
}
|
||||
@@ -565,7 +558,7 @@ void ImageArea::setScrollPosition (int x, int y)
|
||||
|
||||
if (mainCropWindow) {
|
||||
mainCropWindow->delCropWindowListener (this);
|
||||
mainCropWindow->setCropPosition (x / mainCropWindow->getZoom (), y / mainCropWindow->getZoom ());
|
||||
mainCropWindow->setCropAnchorPosition (x, y);
|
||||
mainCropWindow->addCropWindowListener (this);
|
||||
}
|
||||
}
|
||||
@@ -618,19 +611,18 @@ void ImageArea::initialImageArrived (CropWindow* cw)
|
||||
|
||||
if (mainCropWindow) {
|
||||
if(firstOpen || options.prevdemo != PD_Sidecar || (!options.rememberZoomAndPan) ) {
|
||||
mainCropWindow->zoomFit (false);
|
||||
mainCropWindow->zoomFit ();
|
||||
firstOpen = false;
|
||||
mainCropWindow->cropHandler.getFullImageSize(fullImageWidth, fullImageHeight);
|
||||
} else {
|
||||
int w, h;
|
||||
mainCropWindow->cropHandler.getFullImageSize(w, h);
|
||||
|
||||
if(w == fullImageWidth && h == fullImageHeight) { // && mainCropWindow->getZoom() != mainCropWindow->getZoomFitVal()) {
|
||||
int x, y;
|
||||
mainCropWindow->getCropPosition(x, y);
|
||||
mainCropWindow->setCropPosition(x, y, false);
|
||||
if(w != fullImageWidth || h != fullImageHeight) {
|
||||
printf("zoomFit !\n");
|
||||
mainCropWindow->zoomFit ();
|
||||
} else {
|
||||
mainCropWindow->zoomFit (false);
|
||||
printf("no-zoomFit\n");
|
||||
}
|
||||
|
||||
fullImageWidth = w;
|
||||
@@ -649,8 +641,8 @@ void ImageArea::setCropGUIListener (CropGUIListener* l)
|
||||
|
||||
cropgl = l;
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
(*i)->setCropGUIListener (cropgl);
|
||||
for (auto cropWin : cropWins) {
|
||||
cropWin->setCropGUIListener (cropgl);
|
||||
}
|
||||
|
||||
if (mainCropWindow) {
|
||||
@@ -663,8 +655,8 @@ void ImageArea::setPointerMotionListener (PointerMotionListener* pml)
|
||||
|
||||
pmlistener = pml;
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
(*i)->setPointerMotionListener (pml);
|
||||
for (auto cropWin : cropWins) {
|
||||
cropWin->setPointerMotionListener (pml);
|
||||
}
|
||||
|
||||
if (mainCropWindow) {
|
||||
@@ -677,8 +669,8 @@ void ImageArea::setPointerMotionHListener (PointerMotionListener* pml)
|
||||
|
||||
pmhlistener = pml;
|
||||
|
||||
for (std::list<CropWindow*>::iterator i = cropWins.begin(); i != cropWins.end(); i++) {
|
||||
(*i)->setPointerMotionHListener (pml);
|
||||
for (auto cropWin : cropWins) {
|
||||
cropWin->setPointerMotionHListener (pml);
|
||||
}
|
||||
|
||||
if (mainCropWindow) {
|
||||
|
Reference in New Issue
Block a user