Merge branch 'master' into gtk3
This commit is contained in:
@@ -111,47 +111,49 @@ void PreviewWindow::on_resized (Gtk::Allocation& req)
|
||||
bool PreviewWindow::on_draw(const ::Cairo::RefPtr< Cairo::Context> &cr)
|
||||
{
|
||||
|
||||
if (backBuffer) {
|
||||
int bufferW, bufferH;
|
||||
bufferW = backBuffer->getWidth();
|
||||
bufferH = backBuffer->getHeight();
|
||||
if (!backBuffer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!mainCropWin && imageArea) {
|
||||
mainCropWin = imageArea->getMainCropWindow ();
|
||||
int bufferW, bufferH;
|
||||
bufferW = backBuffer->getWidth();
|
||||
bufferH = backBuffer->getHeight();
|
||||
|
||||
if (mainCropWin) {
|
||||
mainCropWin->addCropWindowListener (this);
|
||||
}
|
||||
if (!mainCropWin && imageArea) {
|
||||
mainCropWin = imageArea->getMainCropWindow ();
|
||||
|
||||
if (mainCropWin) {
|
||||
mainCropWin->addCropWindowListener (this);
|
||||
}
|
||||
}
|
||||
|
||||
if ((get_width() != bufferW && get_height() != bufferH) || needsUpdate) {
|
||||
needsUpdate = false;
|
||||
updatePreviewImage ();
|
||||
}
|
||||
if ((get_width() != bufferW && get_height() != bufferH) || needsUpdate) {
|
||||
needsUpdate = false;
|
||||
updatePreviewImage ();
|
||||
}
|
||||
|
||||
backBuffer->copySurface(cr, NULL);
|
||||
backBuffer->copySurface(cr, NULL);
|
||||
|
||||
if (mainCropWin && zoom > 0.0) {
|
||||
if(mainCropWin->getZoom() > mainCropWin->cropHandler.getFitZoom()) {
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
double rectX = x + 0.5;
|
||||
double rectY = y + 0.5;
|
||||
double rectW = std::min(w, (int)(imgW - (x - imgX) - 1));
|
||||
double rectH = std::min(h, (int)(imgH - (y - imgY) - 1));
|
||||
if (mainCropWin && zoom > 0.0) {
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
if (x>imgX || y>imgY || w < imgW || h < imgH) {
|
||||
double rectX = x + 0.5;
|
||||
double rectY = y + 0.5;
|
||||
double rectW = std::min(w, (int)(imgW - (x - imgX) - 1));
|
||||
double rectH = std::min(h, (int)(imgH - (y - imgY) - 1));
|
||||
|
||||
// draw a black "shadow" line
|
||||
cr->set_source_rgba (0.0, 0.0, 0.0, 0.65);
|
||||
cr->set_line_width (1.);
|
||||
cr->set_line_join(Cairo::LINE_JOIN_MITER);
|
||||
cr->rectangle (rectX + 1., rectY + 1, rectW, rectH);
|
||||
cr->stroke ();
|
||||
// draw a black "shadow" line
|
||||
cr->set_source_rgba (0.0, 0.0, 0.0, 0.65);
|
||||
cr->set_line_width (1.);
|
||||
cr->set_line_join(Cairo::LINE_JOIN_MITER);
|
||||
cr->rectangle (rectX + 1., rectY + 1, rectW, rectH);
|
||||
cr->stroke ();
|
||||
|
||||
// draw a "frame" line. Color of frame line can be set in preferences
|
||||
cr->set_source_rgba(options.navGuideBrush[0], options.navGuideBrush[1], options.navGuideBrush[2], options.navGuideBrush[3]); //( 1.0, 1.0, 1.0, 1.0);
|
||||
cr->rectangle (rectX, rectY, rectW, rectH);
|
||||
cr->stroke ();
|
||||
}
|
||||
// draw a "frame" line. Color of frame line can be set in preferences
|
||||
cr->set_source_rgba(options.navGuideBrush[0], options.navGuideBrush[1], options.navGuideBrush[2], options.navGuideBrush[3]); //( 1.0, 1.0, 1.0, 1.0);
|
||||
cr->rectangle (rectX, rectY, rectW, rectH);
|
||||
cr->stroke ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,10 +203,9 @@ bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(mainCropWin->getZoom() > mainCropWin->cropHandler.getFitZoom()) {
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
if (x>imgX || y>imgY || w < imgW || h < imgH) {
|
||||
bool inside = event->x > x - 6 && event->x < x + w - 1 + 6 && event->y > y - 6 && event->y < y + h - 1 + 6;
|
||||
bool moreInside = event->x > x + 6 && event->x < x + w - 1 - 6 && event->y > y + 6 && event->y < y + h - 1 - 6;
|
||||
|
||||
@@ -212,6 +213,8 @@ bool PreviewWindow::on_motion_notify_event (GdkEventMotion* event)
|
||||
|
||||
if (isMoving) {
|
||||
mainCropWin->remoteMove ((event->x - press_x) / zoom, (event->y - press_y) / zoom);
|
||||
press_x = event->x;
|
||||
press_y = event->y;
|
||||
} else if (inside && !moreInside) {
|
||||
newType = CSClosedHand;
|
||||
} else {
|
||||
@@ -234,9 +237,9 @@ bool PreviewWindow::on_button_press_event (GdkEventButton* event)
|
||||
return true;
|
||||
}
|
||||
|
||||
if(mainCropWin->getZoom() > mainCropWin->cropHandler.getFitZoom()) {
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
int x, y, w, h;
|
||||
getObservedFrameArea (x, y, w, h);
|
||||
if (x>imgX || y>imgY || w < imgW || h < imgH) {
|
||||
bool inside = event->x > x - 6 && event->x < x + w - 1 + 6 && event->y > y - 6 && event->y < y + h - 1 + 6;
|
||||
bool moreInside = event->x > x + 6 && event->x < x + w - 1 - 6 && event->y > y + 6 && event->y < y + h - 1 - 6;
|
||||
|
||||
|
Reference in New Issue
Block a user