Opened 9 years ago

Closed 6 years ago

#28 closed enhancement (fixed)

Stronger zoom commands

Reported by: finticemo Owned by: Thomas Bernard
Priority: major Milestone: 2.5
Component: GrafX2 Version: 2.4
Keywords: Cc:

Description

After using GIMP's 'Zoom in a lot /Zoom out a lot' commands primarily for the last few weeks, I've realized they are a vast improvement from a usability point of view.

More mild(typical) zoom commands zoom by a factor of about 100% each time. GIMP's 'Zoom in/Out a Lot' zoom by about 300% each time -- which is less 'smooth feeling' but much more practical, as it does not require you to sit on the zoom key for a second or two to get to the approximate level of zoom you want -- instead, you press the key once to change level of detail, and that's all that's needed.

From my point of view, it is a much more sensible and easier workflow, to primarily use strong zooming and only occasionally use weak zooming to finetune.

A step towards that would be providing two additional zoom actions, which step through the ZOOM_FACTOR array by 3.
That is, the ZOOM_FACTOR definition I see in the source is this:

word ZOOM_FACTOR[NB_ZOOM_FACTORS]={2,3,4,5,6,8,10,12,14,16,18,20, 24, 28, 32};

Supposing we start at ZOOM_FACTOR[0] -- that is, 2x. Normal zoom adds one to the index and becomes 3x. Strong zoom should add three to the index and become 5.

Which gives Strong zoom an overall 'zoom series' which looks like

2 5 10 16 24 32

( or 3 6 12 18 28 32, etc.)

The only caveat here is, I guess, that clipping at the end -- if you zoom in all the way to 32, and zoom out, then you will get different zoom levels than you had zooming in:
(32, 20, 14, 8, 4, 2}.
That could be ameliorated by changing the length of the ZOOM_FACTOR array,
but it's a pretty minor issue.

A simple way to test out what stronger zoom commands would be like -- If you don't have GIMP on hand -- is to change the values on lines 1036 and 1040 of src/engine.c to +3 and -3 respectively.

On reflection, it might even be better just to make the normal zoom commands just zoom by large increments (with the zoom levels menu providing access to the others.).

Anyway, obviously this needs some testing to see if this feels better to others or just me. Whatever solution we end up deciding is good, I'm confident it can be made significantly easier to use than what we currently have.

Attachments (1)

changes.diff (3.9 KB ) - added by finticemo 9 years ago.
First reasonable attempt at implementation.

Download all attachments as: .zip

Change History (10)

comment:1 by finticemo, 9 years ago

Thinking about this more, another way to do this, that might be best, is a configuration option that specifies a 'minimum zoom threshold'. I thought of this when I was considering the fact that usually, if you're already at 2-4x zoom, changing from 2 to 3 or 3 to 4 or 4 to 3 or 3 to 2 is not a significant change; either you are already approximately at the level you want to be, or not.

So the idea behind 'minimum zoom threshold' is like this:

  • Suppose your current zoom level is 2x, and your minimum zoom threshold is three.
  • You press the Zoom in key
  • the Zoom() function walks forward through the ZOOM_FACTOR array, finding the first item that is >= (current_zoom_level * minimum_zoom_threshold).
  • The first item it finds matching these criteria is 6.

Zooming out would work in reverse -- it would walk backwards through the ZOOM_FACTOR array, finding the first item that is <= (current_zoom_level / minimum_zoom_threshold).

If either of these operations reach the end or start of the array, then they should clip (eg. if current_zoom_level = 24, and minimum_zoom_threshold=3, zooming in should still select 32, as it is the only zoom factor remaining in that direction.)

Finally, I note that it might be more usable to specify minimum_zoom_threshold as a percentage instead, since smaller thresholds (eg 1.5x) that might be desirable are otherwise not available.

comment:2 by pulkomandy, 9 years ago

Hi,
There are several ways to change zoom levels quickly already:

  • In GrafX2 there is always a x1 view on the left, which means you don't really need to go to a "low" zoom to see your work. If you think it is too small, you can use the "double", "triple" or "quad" modes in the video modes window, which makes it bigger.
  • You can easily reach any zoom level by right click on the zoom button.
  • You can use the mousewheel to easily and quickly change zoom levels.

I think I never used the keyboard shortcuts to swithc zoom levels. That being said, we can have "faster" zoom shortcuts just like we have for scrolling (shift + normal shortcut).

comment:3 by finticemo, 9 years ago

Thanks for replying.

  • Yes, I make use of the pixel-multiplying modes, and they are good for the purpose you mention. However, I never plot pixels in the unzoomed side, because it is too inaccurate. IMO the main value of zooming is to get as much accuracy as possible by making the area you are drawing upon as large as possible; that is certainly my focus in proposing stronger zoom commands
  • While this menu is fairly convenient for tuning the zoom level on occasion. it lacks both the ease and simplicity of a 'just zoom in a lot more' command, in which all that one needs to think about is 'do I want more zoom or less zoom?'
  • Being a graphics tablet user, mousewheel actions are not available to me. That said, after digging up a mouse, I have tried using the scrollwheel, and it does not effect zoom (or anything, AFAICS) in Grafx2, although it works normally in other apps. I have used xev and verified that it is producing normal Button4/Button5 events. Do you want me to file a ticket for that?

Since you have affirmed that 'faster' zoom shortcut is okay, I'll begin working on implementing that.

Version 0, edited 9 years ago by finticemo (next)

comment:4 by finticemo, 9 years ago

Edit: never mind about point 3 above. It seems that I changed the configuration for that, which is why zooming via wheel wasn't working.

I've made a basic patch, but I suspect there is something missing -- when I run Grafx2 for the first time after compiling with this patch, it says 'main.c 651 Init_program | Corrupted CFG file. : 0###'.

I also am not sure whether the IDs I am using in ConfigKey definition are correct / won't interfere with others.

I have attached the patch. I'd appreciate any feedback you can give me.

Last edited 9 years ago by finticemo (previous) (diff)

by finticemo, 9 years ago

Attachment: changes.diff added

First reasonable attempt at implementation.

comment:5 by Thomas Bernard, 6 years ago

works for me.
indeed old gfx2.cfg need to be deleted before running

comment:6 by PulkoMandy, 6 years ago

Old .cfg files should be migrated when the format changes.

This happens in https://gitlab.com/GrafX2/grafX2/blob/master/src/init.c#L2077 and the change to NB_SHORTCUTS is a problem here because the file format is modified.

So you should review the code in Load_CFG and Save_CFG to make sure they handle this properly.

also, new shortcuts should always be added at the end of the table in hotkeys.c, not inserted in the middle, and it seems the indices there (you used 209 and 210) should match the ordering in the Ordering table.

I don't really remember how this all works...

comment:7 by Thomas Bernard, 6 years ago

Owner: changed from Adrien Destugues to Thomas Bernard
Status: newaccepted

OK, I will fix this.

comment:8 by Thomas Bernard, 6 years ago

Status: acceptedassigned

I have fixed the code and verified that loading old gfx2.cfg file works well.

https://gitlab.com/GrafX2/grafX2/merge_requests/11

comment:9 by Thomas Bernard, 6 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.