From 0d57900a3b9857bf56f86000c8aa65d0f6bc5bc2 Mon Sep 17 00:00:00 2001 From: "Hombrenatureh.510" Date: Sat, 15 Mar 2014 17:00:44 +0100 Subject: [PATCH] Fix the incorrect display behavior of the pipette cursor + add tooltip to Edit buttons --- rtdata/languages/Francais | 2 ++ rtdata/languages/default | 2 ++ rtgui/cropwindow.cc | 43 +++++++++++++++++----------- rtgui/cropwindow.h | 2 ++ rtgui/diagonalcurveeditorsubgroup.cc | 3 ++ rtgui/flatcurveeditorsubgroup.cc | 1 + rtgui/gradient.cc | 1 + rtgui/imagearea.cc | 28 +++++++++++++++--- rtgui/imagearea.h | 1 + 9 files changed, 63 insertions(+), 20 deletions(-) diff --git a/rtdata/languages/Francais b/rtdata/languages/Francais index e70c95d9e..e1b38d668 100644 --- a/rtdata/languages/Francais +++ b/rtdata/languages/Francais @@ -31,6 +31,8 @@ CURVEEDITOR_TOOLTIPPASTE;Colle la courbe du presse-papier CURVEEDITOR_TOOLTIPSAVE;Enregistrer la courbe actuelle CURVEEDITOR_TYPE;Type: EDITWINDOW_TITLE;Édition d'image +EDIT_OBJECT_TOOLTIP;Cliquez sur ce ce bouton pour afficher des éléments graphiques dans la fenêtre de prévisualisation, que vous pourrez utiliser pour éditer les/certains réglages de cet outil. +EDIT_PIPETTE_TOOLTIP;Pour ajouter ou sélectionner un point d'ajustement de la courbe, maintenez la touche Ctrl préssé et cliquez dans l'image avec le bouton gauche de la souris. Tout en gardant ce bouton appuyé, déplacez ensuite le curseur vers le haut ou le bas pour ajuster la position du point (Ctrl peut être relâché).\nClic droit pour sortir du mode pipette. EXIFFILTER_APERTURE;Ouverture EXIFFILTER_CAMERA;Appareil photo EXIFFILTER_EXPOSURECOMPENSATION;Compensation d'exposition (EV) diff --git a/rtdata/languages/default b/rtdata/languages/default index 1ae3dafde..574030713 100644 --- a/rtdata/languages/default +++ b/rtdata/languages/default @@ -33,6 +33,8 @@ CURVEEDITOR_TOOLTIPPASTE;Paste curve from clipboard. CURVEEDITOR_TOOLTIPSAVE;Save current curve. CURVEEDITOR_TYPE;Type: EDITWINDOW_TITLE;Image Edit +EDIT_OBJECT_TOOLTIP;Click on this button to display graphical element on the preview window, that you can use to edit the/some tool's settings. +EDIT_PIPETTE_TOOLTIP;To add or select a curve adjustment point, hold the Ctrl key while left-clicking on the image preview. While holding this button pressed, control the adjustment by moving the mouse up and down (the Ctrl key can be released).\nRight-click to exit pipette-mode. EXIFFILTER_APERTURE;Aperture EXIFFILTER_CAMERA;Camera EXIFFILTER_EXPOSURECOMPENSATION;Exposure Compensation (EV) diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 59c981722..b4f3695f8 100755 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -223,18 +223,19 @@ bool CropWindow::isInside (int x, int y) { } void CropWindow::leaveNotify (GdkEventCrossing* event) { - printf("LeaveNotify\n"); EditSubscriber* subscriber = iarea->getCurrSubscriber(); if (state==SNormal && subscriber && subscriber->getEditingType()==ET_PIPETTE) { - printf("Values\n"); iarea->pipetteVal[0] = iarea->pipetteVal[1] = iarea->pipetteVal[2] = -1.f; if (subscriber->mouseOver(0)) { - printf("Redraw\n"); iarea->redraw(); } } } +void CropWindow::flawnOver (bool isFlawnOver) { + this->isFlawnOver = isFlawnOver; +} + void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) { iarea->grabFocus (this); @@ -324,11 +325,6 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) { press_x = x; action_x = cropHandler.cropParams.w; } - else if (onArea (CropObserved, x, y)) { - state = SObservedMove; - press_x = x; - press_y = y; - } else if ((bstate & GDK_SHIFT_MASK) && onArea (CropInside, x, y)) { state = SCropMove; press_x = x; @@ -345,10 +341,24 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y) { EditSubscriber *editSubscriber = iarea->getCurrSubscriber(); - if (button==1 && editSubscriber && cropgl && cropgl->inImageArea(iarea->posImage.x, iarea->posImage.y) && ( (editSubscriber->getEditingType() == ET_PIPETTE && (bstate & GDK_CONTROL_MASK)) || (editSubscriber->getEditingType() == ET_OBJECTS && iarea->object>-1)) ) { + if (button==1 && editSubscriber && cropgl && cropgl->inImageArea(iarea->posImage.x, iarea->posImage.y) && (editSubscriber->getEditingType()==ET_OBJECTS && iarea->object>-1) ) { editSubscriber->button1Pressed(bstate); state=SEditDrag; } + else if (onArea (CropObserved, x, y)) { + state = SObservedMove; + press_x = x; + press_y = y; + } + else if (button==1 && editSubscriber && cropgl && cropgl->inImageArea(iarea->posImage.x, iarea->posImage.y) && (editSubscriber->getEditingType()==ET_PIPETTE && (bstate & GDK_CONTROL_MASK)) ) { + editSubscriber->button1Pressed(bstate); + state=SEditDrag; + } + } + else if (onArea (CropObserved, x, y)) { + state = SObservedMove; + press_x = x; + press_y = y; } else if (iarea->getToolMode () == TMStraighten) { state = SRotateSelecting; @@ -579,7 +589,7 @@ void CropWindow::pointerMoved (int bstate, int x, int y) { Coord cropPos; screenCoordToCropBuffer(x, y, cropPos.x, cropPos.y); if (editSubscriber->getEditingType()==ET_PIPETTE) { - iarea->object = onArea (CropImage, x, y) ? 1 : 0; + iarea->object = onArea (CropImage, x, y) && !onArea (CropObserved, x, y) ? 1 : 0; //iarea->object = cropgl && cropgl->inImageArea(iarea->posImage.x, iarea->posImage.y) ? 1 : 0; if (iarea->object) { crop->getPipetteData(iarea->pipetteVal, cropPos.x, cropPos.y, iarea->getPipetteRectSize()); @@ -780,7 +790,7 @@ void CropWindow::updateCursor (int x, int y) { if (state==SNormal) { if (onArea (CropWinButtons, x, y)) cursorManager.setCursor (iarea->get_window(), CSArrow); - else if (onArea (CropToolBar, x, y)) + else if (onArea (CropToolBar, x, y)) cursorManager.setCursor (iarea->get_window(), CSMove); else if (onArea (CropResize, x, y)) cursorManager.setCursor (iarea->get_window(), CSResizeDiagonal); @@ -955,9 +965,10 @@ void CropWindow::expose (Cairo::RefPtr cr) { float sum_L, sum_L2; float sumsq_L, sumsq_L2; //sum of deviations squared float stdDev_L, stdDev_L2; - float focus_thresh, focus_thresh2; + float focus_thresh; + //float focus_thresh2; int kernel_size, kernel_size2;// count of pixels in the blur kernel - float opacity = 0.9;//TODO: implement opacity + //float opacity = 0.9;//TODO: implement opacity //TODO: evaluate effects of altering sampling frequency @@ -966,7 +977,7 @@ void CropWindow::expose (Cairo::RefPtr cr) { focus_thresh=80; blur_radius2 = blur_radius/4; // Band2 - focus_thresh2 = focus_thresh/2; // Band 2 threshold + //focus_thresh2 = focus_thresh/2; // Band 2 threshold if (j>blur_radius && jget_width()-blur_radius && i>blur_radius && iget_height()-blur_radius){ //stay within image area @@ -1245,9 +1256,9 @@ void CropWindow::expose (Cairo::RefPtr cr) { } if (state==SRotateSelecting) drawStraightenGuide (cr); - if (state==SNormal) { + if (state==SNormal && isFlawnOver) { EditSubscriber *editSubscriber = iarea->getCurrSubscriber(); - if (iarea->getToolMode () == TMHand && editSubscriber && editSubscriber->getEditingType()==ET_PIPETTE) + if (iarea->getToolMode () == TMHand && editSubscriber && editSubscriber->getEditingType()==ET_PIPETTE && iarea->object) drawUnscaledSpotRectangle (cr, iarea->getPipetteRectSize ()); else if (iarea->getToolMode () == TMSpotWB) drawScaledSpotRectangle (cr, iarea->getSpotWBRectSize ()); diff --git a/rtgui/cropwindow.h b/rtgui/cropwindow.h index 27a59be17..4676d2145 100755 --- a/rtgui/cropwindow.h +++ b/rtgui/cropwindow.h @@ -60,6 +60,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E Glib::ustring cropLabel; int backColor; bool decorated; + bool isFlawnOver; // crop frame description int titleHeight, sideBorderWidth, lowerBorderWidth, upperBorderWidth, sepWidth, minWidth; @@ -121,6 +122,7 @@ class CropWindow : public LWButtonListener, public CropHandlerListener, public E void getSize (int& w, int& h); void leaveNotify (GdkEventCrossing* event); + void flawnOver (bool isFlawnOver); // zoomlistener interface void zoomIn (bool toCursor=false, int cursorX=-1, int cursorY=-1); diff --git a/rtgui/diagonalcurveeditorsubgroup.cc b/rtgui/diagonalcurveeditorsubgroup.cc index ca96738d5..2c524e80c 100644 --- a/rtgui/diagonalcurveeditorsubgroup.cc +++ b/rtgui/diagonalcurveeditorsubgroup.cc @@ -63,6 +63,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, loadCustom->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editCustom = Gtk::manage (new Gtk::ToggleButton()); editCustom->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editCustom->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); editCustom->hide(); custombbox->pack_end (*pasteCustom, Gtk::PACK_SHRINK, 0); custombbox->pack_end (*copyCustom, Gtk::PACK_SHRINK, 0); @@ -108,6 +109,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, loadNURBS->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editNURBS = Gtk::manage (new Gtk::ToggleButton()); editNURBS->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editNURBS->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); editNURBS->hide(); NURBSbbox->pack_end (*pasteNURBS, Gtk::PACK_SHRINK, 0); NURBSbbox->pack_end (*copyNURBS, Gtk::PACK_SHRINK, 0); @@ -158,6 +160,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt, loadParam->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editParam = Gtk::manage (new Gtk::ToggleButton()); editParam->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editParam->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); editParam->hide(); parambbox->pack_end (*pasteParam, Gtk::PACK_SHRINK, 0); parambbox->pack_end (*copyParam, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/flatcurveeditorsubgroup.cc b/rtgui/flatcurveeditorsubgroup.cc index cf77ed9d0..84d3c3ccc 100644 --- a/rtgui/flatcurveeditorsubgroup.cc +++ b/rtgui/flatcurveeditorsubgroup.cc @@ -58,6 +58,7 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u loadCPoints->add (*Gtk::manage (new RTImage ("gtk-open.png"))); editCPoints = Gtk::manage (new Gtk::ToggleButton()); editCPoints->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + editCPoints->set_tooltip_text(M("EDIT_PIPETTE_TOOLTIP")); editCPoints->hide(); CPointsbbox->pack_end (*pasteCPoints, Gtk::PACK_SHRINK, 0); diff --git a/rtgui/gradient.cc b/rtgui/gradient.cc index dacba208d..30e4d8495 100644 --- a/rtgui/gradient.cc +++ b/rtgui/gradient.cc @@ -19,6 +19,7 @@ Gradient::Gradient () : Gtk::VBox(), FoldableToolPanel(this), EditSubscriber(ET_ edit = Gtk::manage (new Gtk::ToggleButton()); edit->add (*Gtk::manage (new RTImage ("editmodehand.png"))); + edit->set_tooltip_text(M("EDIT_OBJECT_TOOLTIP")); editConn = edit->signal_toggled().connect( sigc::mem_fun(*this, &Gradient::editToggled) ); strength = Gtk::manage (new Adjuster (M("TP_GRADIENT_STRENGTH"), -5, 5, 0.01, 0)); diff --git a/rtgui/imagearea.cc b/rtgui/imagearea.cc index b41482be0..42598bb7d 100644 --- a/rtgui/imagearea.cc +++ b/rtgui/imagearea.cc @@ -33,6 +33,7 @@ ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) { pmlistener = NULL; pmhlistener = NULL; focusGrabber = NULL; + flawnOverWindow = NULL; mainCropWindow = NULL; previewHandler = NULL; lastClosedX = -1; @@ -44,6 +45,8 @@ ImageArea::ImageArea (ImageAreaPanel* p) : parent(p) { indClippedPanel = Gtk::manage (new IndicateClippedPanel (this)); previewModePanel = Gtk::manage (new PreviewModePanel (this)); + add_events(Gdk::LEAVE_NOTIFY_MASK); + signal_style_changed().connect( sigc::mem_fun(*this, &ImageArea::styleChanged) ); signal_size_allocate().connect( sigc::mem_fun(*this, &ImageArea::on_resized) ); @@ -209,8 +212,19 @@ bool ImageArea::on_motion_notify_event (GdkEventMotion* event) { focusGrabber->pointerMoved (event->state, event->x, event->y); else { CropWindow* cw = getCropWindow (event->x, event->y); - if (cw) + if (cw) { + if (cw != flawnOverWindow) { + if (flawnOverWindow) + flawnOverWindow->flawnOver(false); + cw->flawnOver(true); + flawnOverWindow = cw; + } cw->pointerMoved (event->state, event->x, event->y); + } + else if (flawnOverWindow) { + flawnOverWindow->flawnOver(false); + flawnOverWindow = NULL; + } } return true; } @@ -259,13 +273,19 @@ bool ImageArea::on_button_release_event (GdkEventButton* event) { } bool ImageArea::on_leave_notify_event (GdkEventCrossing* event) { - if (focusGrabber) + if (flawnOverWindow) { + flawnOverWindow->flawnOver(false); + flawnOverWindow = NULL; + } + if (focusGrabber) { + focusGrabber->flawnOver(false); focusGrabber->leaveNotify (event); + } else { - printf("ImageArea::1\n"); CropWindow* cw = getCropWindow (event->x, event->y); + if (cw) { - printf("ImageArea::appel\n"); + cw->flawnOver(false); cw->leaveNotify (event); } } diff --git a/rtgui/imagearea.h b/rtgui/imagearea.h index 0aed665cc..64836db1e 100644 --- a/rtgui/imagearea.h +++ b/rtgui/imagearea.h @@ -55,6 +55,7 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi bool dirty; CropWindow* focusGrabber; + CropWindow* flawnOverWindow; CropGUIListener* cropgl; PointerMotionListener* pmlistener; PointerMotionListener* pmhlistener;