Bug 170364

Summary: Editor Canvas : Expand selection rectangle by dragging sides in image editor [patch]
Product: [Applications] digikam Reporter: Stephen Cantini <stephen.cantini>
Component: Usability-Drag&DropAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: caulier.gilles, languitar
Priority: NOR    
Version: 1.0.0   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 4.0.0
Sentry Crash Report:
Attachments: the patch allows to expand selection by dragging sides
patch #2

Description Stephen Cantini 2008-09-04 09:41:58 UTC
Version:            (using KDE 3.5.9)
OS:                Linux
Installed from:    Ubuntu Packages

When editing an image, it would also be nice to be able to expand the selection box from the sides by dragging them.
Comment 1 caulier.gilles 2008-12-06 14:29:05 UTC
Already implemented. Work perfectly with 0.10.0

Gilles Caulier
Comment 2 Mikolaj Machowski 2008-12-06 21:44:25 UTC
I am afraid I cannot agree.. 0.10-beta7svn

Still can change selected area by dragging corners.
Comment 3 Andi Clemens 2008-12-06 22:03:33 UTC
> I am afraid I cannot agree.. 0.10-beta7svn
> Still can change selected area by dragging corners.

Typo?

I can only say it works perfectly here...
Comment 4 Mikolaj Machowski 2008-12-07 14:11:43 UTC
For me works only in corners :(
Comment 5 caulier.gilles 2008-12-10 19:01:38 UTC
ok only from the corner, not from H/V sides.

Gilles
Comment 6 Johannes Wienke 2009-10-16 13:58:50 UTC
*** Bug 203843 has been marked as a duplicate of this bug. ***
Comment 7 Ignat Semenov 2009-10-17 21:49:51 UTC
Created attachment 37639 [details]
the patch allows to expand selection by dragging sides

I suggest a patch for this. The patch allows to expand selection by dragging horizontal and vertical sides with a 10-pixel snap zone (same as corners). Tested against trunk and it works.
Comment 8 caulier.gilles 2009-10-17 22:33:25 UTC
Thanks Ignat for the patch. It's very appreciate.

I will test your patch soon.

Just a question: Zoom in to canvas at different level, make a selection. Zoom in or out without to deselect. Selection still here ? if yes, change it again. Selection is not broken on screen ?

Gilles Caulier
Comment 9 Ignat Semenov 2009-10-17 22:42:18 UTC
Well, I zoomed into the canvas, selected a region, zoomed out, the selection was fine. Resized it and zoomed in/out a few times - everything was fine.
Comment 10 caulier.gilles 2009-10-18 12:06:25 UTC
Ignat,

Excelent patch. Thanks again...

To be homogeneous, can you take a look to Ratio Crop Tool which has also a selection widget which do not have yet this feature.

http://websvn.kde.org/trunk/extragear/graphics/digikam/imageplugins/coreplugin/ratiocrop/imageselectionwidget.cpp?revision=1030990&view=markup

Thanks in advance

Gilles Caulier
Comment 11 caulier.gilles 2009-10-18 12:17:00 UTC
SVN commit 1037030 by cgilles:

apply patch # 37639 from Ignat Semenov
CCBUGS: 170364


 M  +106 -33   canvas.cpp  
 M  +17 -17    canvas.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1037030
Comment 12 Ignat Semenov 2009-10-18 16:30:59 UTC
After looking at the Ratio Crop Tool, I've found quite some inconsistencies between the two widgets. The main question is: Selection Widget has an active area of 10 pixels, 5px inside, 5px outside, while Ratio Crop Widget has an active area of 10 pixels inside the rectangle. Which behavior is preferred for both widgets?
Comment 13 caulier.gilles 2009-10-18 17:28:03 UTC
Editor canvas sound better for me... But it just my viewpoint...

Gilles
Comment 14 Ignat Semenov 2009-10-20 12:28:16 UTC
Created attachment 37682 [details]
patch #2

Here is one more patch (against SVN trunk).
-changed selection area from 10 to 8 pixels for consistency with Ratio Crop Tool
-nicer corner drag rectangles
-it is now possible to drag the selection around with mouse; dragging is restricted by the picture
-it solves the problem of wrong sides expanding (my way)) the code is basically simpler
Please test
Should the bug be closed?
Comment 15 Andi Clemens 2009-10-20 12:41:10 UTC
Why not use a const var for the selection area (8px)?
This way it can be easily changed and even set with some value from a settings option, if we should ever provide one.

I'll test the patch...
Comment 16 Andi Clemens 2009-10-20 12:55:41 UTC
SVN commit 1037972 by aclemens:

Apply patch from Ignat Semenov

CCBUG:170364

 M  +83 -47    canvas.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1037972
Comment 17 caulier.gilles 2009-10-20 13:00:59 UTC
Ignat,

For consistency, Ratio crop tool selection widget, which is not canvas.cpp as i explain in #10 must be patched in the same way to support resizement of selection using top/bottom/right/left side (currently only by corners is possible)...

Thanks in advance

Gilles Caulier
Comment 18 Ignat Semenov 2009-10-21 15:44:44 UTC
I've started to work on this, but there are a few more differences between the two widgets.
1)In Ratio Crop, you click some area and it moves the selection to that point. No such thing in Simple Crop. Should I add it or remove it? (I haven't seen this in any other editor, it's kind of unusual - correct me if I'm wrong)
2)Ratio Crop grays out the image automatically and during resizing/dragging. Simple crop doesn't. What's preferred for both?
Comment 19 Andi Clemens 2009-10-21 15:52:39 UTC
My suggestions:

1) Click should NOT move the selection (like in editor)
2) Always grayed out (I spent quite some time optimizing this in RatioCrop, so I wouldn't want it to be removed again :-))
Also it is more visible, it always confuses me if you change the selection and the grayed out background disappears, but re-appears when you stop modifying the selection. This is too turbulent in my eyes.
Comment 20 caulier.gilles 2009-10-21 16:15:53 UTC
>1) Click should NOT move the selection (like in editor)

Agree...

>2) Always grayed out

Agree too...

Gilles
Comment 21 Ignat Semenov 2009-10-21 16:21:59 UTC
Now, the code. These two widgets do (almost) the same. But the code for resizing and moving in the Ratio Crop Tool is (form my POV, maybe I simply don't get something)) quite a mess. Shouldn't the resizing/moving code be similar to that of Simple selectio widget (except for the ratio part)? And if yes, I'd like to bring the code of the two widgets in sync. (Apologies if I'm wrong, I'm quite new to Digikam code you see)
Comment 22 caulier.gilles 2009-10-21 16:27:56 UTC
It's difficult to factorize it. 

Editor Canvas is based on Q3ScrollView : It's not a pure QT4 class.

Ratio Crop selection widget is not a Qt4::QScrollArea but Qt4::QWidget...

We have planed with Andi to factorize image editor tool preview widget using QScroolArea, but it will a lots of job to do...

Gilles
Comment 23 Ignat Semenov 2009-10-21 16:45:49 UTC
Ah, so that's why it always maximizes/minimizes the image and never scrolls?)
Well, anyway, I'll try to simplify the Ratio Crop selection widget resizing if you don't mind.
Comment 24 caulier.gilles 2009-10-21 17:00:18 UTC
Editor Canvas can scroll
Ratio Crop tool Preview Cannot.

Gilles
Comment 25 Ignat Semenov 2009-10-21 18:43:42 UTC
Got it, Ratio Crop doesn't scroll by design. Fine.
I've got a couple more questions (patches will follow, I promise :-))
1)You'd like to port Canvas class from Q3ScrollView to Qt4 QScrollArea, right?
2)What about Shift+click (resize to a given point) and Ctrl+drag (resize symmerically) - do you want these in Simple Crop?
Comment 26 Ignat Semenov 2009-10-22 20:06:56 UTC
Ping?
Shift+click to resize seems a bit obscure feature to me, maybe remove it at all?
Comment 27 caulier.gilles 2009-10-23 10:28:37 UTC
No, it's not obscur. it's used in pro imagery software and implemented by a contributor few year ago. Please do not remove it.

Gilles
Comment 28 caulier.gilles 2010-10-22 13:41:18 UTC
Ignat,

Are you always there ? 

Do you have planed a patch for Ratio Crop tool selection to be homogeneous with editor canvas selection ?

Gilles Caulier
Comment 29 caulier.gilles 2011-11-24 11:11:46 UTC
to Ignat, comment #25,

1/ yes, porting canvas class to qt4 is the plan. We have already a class named GraphicsDImgView that i already use with editor Raw Import tool preview. Creating a new Canvas class for editor based on this class can be fine. 

^^^
Marcel ?

2/ Shift+click and Ctrl+drag are very important to be homogenous with gimp and photoshop which provide this selection behavior

Gilles Caulier
Comment 30 caulier.gilles 2011-12-18 17:31:55 UTC
Ignat,

Do you see my comment #29 ?

Gilles Caulier
Comment 31 caulier.gilles 2014-01-30 10:11:54 UTC
Selection over editor canvas use now Qt4 model/view and respect wish from this bug entry.

I close this file now.

Gilles Caulier