Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Brig/scaling redux #88

Merged
merged 17 commits into from
Jun 22, 2018
Merged

Conversation

IonoclastBrigham
Copy link
Collaborator

Ok, so this is a big one. Lots of cleanup and reorganization. Most notably, it completely purges all the manual image scaling junk, and moves ivy-canvas% into its own file and makes the whole thing a little more self-contained/modular.

Aside from just being fairly major in the changes department, it's probably worth making sure there's no half-done, dangling code.

Calculates new scale level + or - 0.1 based on mouse scroll
Clamps mouse zoom min 0.1x, max 4x.
Tries to re-center origin, but some more math and bookkeeping needed.
Properly sets dc origin to center.
Updates dc origin on canvas resize.
Adusts images to draw centered about origin.
New ivy-canvas% methods to handle zooming more generically.
Change zoom increment to ±0.05.
Simplifies all the scrollbar code.
General code cleanup and minor refactoring.

Known Issues:
* Saw centering get messed up for an animated gif (can't repro, may be fixed)
* Zoom action buttons haven't been touched.
Make zoom menu coarser.
Include 200 and 400% zoom in menu.
Switches zoom menu to use new style dc% zooming facilities.
Adds zoom in, zoom out, and reset menu options.
Reorganizes zoom menu with separators.
Hooks up zoom action buttons to ivy-canvas dc-based zoom methods.
New (zoom-to-fit) method.
New configure-scrollbars canvas method, called on zoom change.
TODO: looks like need to adjust image centering for zoomed virtual size?
Clean up the old commented-out image scaling code.
Fixes image centering, when zoomed beyond canvas client boundaries.
General cleanup and minor code refactoring.
[insert-tag-tfield-comma insert-tag-tfield-comma]
[status-bar-position status-bar-position]
[status-bar-zoom status-bar-zoom]
[set-fullscreen set-fullscreen]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of passing set-fullscreen and toggle-fullscreen as initialization parameters to the canvas? Wouldn't it be more appropriate to define/public them as member functions of the class?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if you look at what those functions actually do, you couldn't make them member functions, as-is. The two callbacks you mention, for example operate on the ivy-frame instance, which the ivy-canvas% class doesn't know anything about, per se.

We could call get-parent, but the frame may not always be the direct parent of the canvas. I'd be pretty bummed about a solution where fullscreen stopped working depending on where the canvas was in the layout hierarchy. Perhaps get-top-level-window would work here?

Really, though, the only reason the canvas wants to know about any of this at all is that it's the one intercepting the fullscreen accelerator keys. What would probably be a cleaner solution would be to expose more general on-key callbacks that can be registered from the outside, instead of the canvas knowing/caring about fullscreen stuff at all.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. That makes sense.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So short answer is there's a good, technical reason for it, but there's also a couple of alternatives that might be better but will require extra work. Guidance?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to say that having those be member functions is the "better" approach, since get-top-level-window will return the ivy frame, in this case.

Copy link
Owner

@lehitoskin lehitoskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inside frame.rkt, I think we can safely delete all the references to 'same inside a call to load-image as well as clean up all the #;(pict->bitmap image-pict).

@lehitoskin lehitoskin merged commit 9531217 into lehitoskin:master Jun 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants