GNOME Bugzilla – Bug 131111
Aspect ratio in cropping tool
Last modified: 2004-10-29 22:28:00 UTC
I've modified the cropt tool to allow the redimension of the selected area, keeping the aspect ratio constant if desired. This feature allows the especification of the desired aspect ratio and the selected zone is automatically adjusted. You can press the <shift> key to activate or deactivate this option while you are selecting.
Created attachment 23208 [details] [review] This patch applies to gimp-2pre1 base
Nice patch (despite the use of // which isn't portable). Should be applied as soon as the code is branched for 2.2.
This was already reported as bug #61094, so I'm marking this as a duplicate and adding a note there pointing to this patch. We would be very grateful if the reporter can modify the patch so that the scale tool could benefit of the same property, as reported in bug #132274. *** This bug has been marked as a duplicate of 61094 ***
Given that the patch is here, it makes more sense to mark bug #61094 as a duplicate of this one. Dave.
*** Bug 61094 has been marked as a duplicate of this bug. ***
I've fixed the unportable code commented by Sven, and added the aspect-ratio functionality to the scale tool, as it have been requested by Pedro. Now there is another information field in the info box (aspect ratio), but it cannot be changed directly. The aspect ratio is fixed when the two options related to width and height are selected. Then the aspect ratio is conserved while dragging and while changing the values in the size text boxes. Now, the aspect-ratio is not recalculated at each event, so the scale tool is more accurate in the result when dragging or else.
Created attachment 24887 [details] [review] This patch applies to gimp-2.0pre1 base
Could you explain the part where you convert between strings and doubles. I wonder why you are using atof() and strtod(). This is ugly and shouldn't be necessary. Is there a particular reason you are not using a spinbutton here?
You are right. The use of those functions is not a good idea. Initially, I didn't want to use a spinbutton, but I've seen that the use of a spinbutton is the most elegant solution. So I've changed the patch again. Now, the aspect-ratio scaling feature is implemented with a spinbutton.
Created attachment 24915 [details] [review] This patch applies to gimp-2.0pre1 base
gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (widget), TRUE) is probably not the right thing to do. I guess you copied that from the rotate tool where it is used for angles that wrap from 360 to 0. Apart from that the patch looks nice. It doesn't even introduce a new string so we could even still accept it for 2.0. Someone should give this patch some testing then. I didn't yet around to do that.
Very nice patch - thank you very much. I still think this should be committed after we branch. It's a feature, after all, and we're a few days from a major release. Cheers, Dave.
*** Bug 139074 has been marked as a duplicate of this bug. ***
Created attachment 26689 [details] [review] scale tool part of the patch I am going to commit the crop tool change first, leaving the scale tool change out. The attached patch is the part of the patch that is not yet applied.
2004-04-15 Sven Neumann <sven@gimp.org> * app/tools/gimpcropoptions.[ch] * app/tools/gimpcroptool.[ch]: applied a patch from Jordi Gay that allows to keep the aspect ratio fixed. I am closing this report as FIXED now. If you want to see the scale tool change considered, then please open a new bug report for it.
Applied the scale tool part of the patch: 2004-08-05 Michael Natterer <mitch@gimp.org> * app/tools/gimpscaletool.c * app/tools/gimptransformtool.h: applied patch from Jordi Gay (attached to bug #131111) which adds an aspect ratio spinbutton to the scale dialog and keeps the aspect ratio intact when with or height are changed using the dialog. Fixes bug #132274. * app/tools/gimpcroptool.c * app/tools/gimpscaletool.c: don't set the aspect spinbuttons to "wrap" and decrease their climb_rate.
*** Bug 153941 has been marked as a duplicate of this bug. ***