Commit graph

38 commits

Author SHA1 Message Date
Sophie Herold
f12ff1ea4d widgets: Add some widget descriptions 2023-03-06 22:59:40 +01:00
Sophie Herold
f80ec7db56 decoder: Use image-rs, libheif-rs, librsvg
This adds proper support for a lot of image formats including SVGs.
It will be the basis for many features to come. The technical core
is an asynchronous renderer that can arrange textures in smaller tiles
which might be generated on demand.

Closes #34, #40, #41, #49

Basis for fixing the following issues #7, #27, #36, #43, #68, #71
2023-03-04 21:48:51 -05:00
Sophie Herold
257d154f08 image: Fix high-res mouse wheel zoom
High res scrolling is reported as wheel deltas < 1. Use a
formula that works for all delta values.

Closes #63
2023-03-01 20:31:56 +01:00
Lubosz Sarnecki
30136f9050 code: Fix some typos.
Fix some typos, mainly in comments with the power of
Builder's spell correction.
2023-02-21 00:19:05 +01:00
Sophie Herold
449742173b image: Fix pan direction for pinch on touchscreen 2023-02-19 01:45:57 +00:00
Sophie Herold
004ebd5615 cargo: Update dependencies 2023-02-15 17:04:59 +01:00
Sophie Herold
9c51dea6d1 image: Fix rotation gesture on touchscreens
Use angle-delta instead of total angle. Total angle is
absolute on touchscreens.
2023-02-12 20:24:28 +00:00
Sophie Herold
caefec74b4 image: Limit rubberbanding zoom and add stiffness 2023-02-07 21:56:00 +01:00
Sophie Herold
169dd454cc image: Add double click for zoom/fullscreen
Zooms on touchscreens and fullscreens otherwise.
Using the fullscreen behavior for now, since that's what
a lot of other apps do.
2023-02-06 18:40:32 +01:00
Sophie Herold
4eb8b939b3 application: Add shortcuts for paning the view
Closes #54
2023-01-31 04:56:58 +00:00
Sophie Herold
74d148572f image: Fix image centering creates blur
Ensure to only move by physical pixel values
2023-01-30 04:25:01 +00:00
Sophie Herold
fc553d108c image: Fix minimal scrollbar with best-fit
For larger images minimal float errors can add up to having
an image size being minimally larger than the widget.
This leads to fake scrollbars that don't even scroll.
Rounding to physical pixel size fixes this.

Fixes #47
2023-01-30 04:25:01 +00:00
Sophie Herold
f2357513da imageView: Use custom slide widget and IndexSet
Use IndexSet to allow direct access by Path and also allow
an arbitrary ordering that was not possible with Vec. Also
add monitoring of file changes in the directory.

Use a custom LpSlidingView instead of AdwCarousel because
Carousel was never designed for this job and suffered of
bugs. LpSlidingView does not support swiping gestures yet
since they currently don't work yet anyways #24.

Use a new algorithm to fill the LpSlidingView that is
stateless and covers all potential changes in the directory.
This not only fixes bugs but would also work with changed
sorting orders.

This also adds build time template XML validation since it
was useful for the refactoring #46.

Closes #9, #11, #30, #33, #42
2023-01-30 01:08:57 +00:00
Christopher Davis
6c59e21264 image: Load Texture directly
`gdk::Texture::from_file ()` automatically falls back to
GdkPixbuf for file types Texture doesn't support natively.
2023-01-22 20:16:55 +00:00
Christopher Davis
469e721d2b image: Use async function to load file info
GdkPixbuf provides `file_info_future ()` to load the file
info asynchronously, using the gio thread pool. That
means we don't need to spawn a thread ourselves for it.
2023-01-22 20:16:55 +00:00
Sophie Herold
65808f5894 propertiesView: Show basic EXIF data
Use libgweather to determine the city for EXIF GPS coordinates.
Make ImageMetadata a GObject to use it's properties in UI.
2022-12-12 11:31:27 -05:00
Sophie Herold
e04992b46d window: Adjust to image size when opening
Give LpImage a native with that should feel nice.
When opening a new window with a new image the window size
is determined by LpImage's natural width.
The image size and EXIF data is loaded before the image such
that the window can be shown in the right dimension while
loading the actual image.
2022-12-12 15:54:24 +00:00
Sophie Herold
ccfbcf60a8 image: Calculate next zoom step from target
This fixes that clicking a button/key during an animation
does not give you the expected zoom speedup.
2022-11-29 00:04:13 +01:00
Sophie Herold
78e528d299 image: Also snap into 'best-fit' if close to it
If only 1/4 of a zoom step zoomed in, assume best-fit.
This helps with floating point precision when zooming in and
out again. It also removes akward other minimal zoom steps.
This change centralizes part of the best-fit detection.
2022-11-28 23:43:56 +01:00
Sophie Herold
c1a3cc353d image: Limit zoom to 2000% 2022-11-28 23:24:12 +01:00
Sophie Herold
d6ab100062 image: Use FileList in ContentProvider
Makes dragging an image out of Loupe work in most cases.
There seems to be an issue with dragging from flatpak to host.
Removing the png from the provider seems to avoid gdk crashes
but not 100% sure that was the cause.
2022-11-28 19:34:18 +01:00
Sophie Herold
f1593203a0 window: Add missing shortcuts
Add shortcuts
- F9 Image properties
- F10 Main menu
- Ctrl +/- for zoom
- Ctrl 0 for best fit
- Ctrl [Shift] R for rotate
- Escape to leave fullscrenen
Updated help overlay accordingly.
2022-11-25 15:46:35 +01:00
Sophie Herold
029c0c9244 image: Add zoom and scrolling support
Zoom via
- Scroll event controller
- Zoom gesture
- Overlay buttons
- Fixed zoom level shortcuts (1=100%, 2=200%)
Scrolling via
- Scrolled window
- Drag gesture
Changes
- Implement best-fit via calculating a zoom level
- Gesture for carousel no longer working because of scrolled window
- Split control overlays into two to not steal inputs in area between

Closes #17
2022-11-23 00:57:43 +01:00
Sophie Herold
49e595cda2 image: Support rotate gesture 2022-11-10 20:25:11 +01:00
Sophie Herold
c2e3bb2f83 menus: Add rotate left and right buttons 2022-11-06 17:58:02 +01:00
Sophie Herold
0f7115fe8b imageMetadata: Implement debug 2022-11-04 20:12:44 +01:00
Sophie Herold
a2e6767584 image: Add rotation and auto rotate based on exif 2022-11-04 18:52:33 +01:00
Sophie Herold
3d6564377a cargo: Update dependencies 2022-11-03 00:57:18 +01:00
Christopher Davis
2aa480eee5 widgets: Rework image_view with AdwCarousel, add ImagePage
Previously we loaded images synchronously and manually
changed `LpImage`. This could cause freezes when loading
large images and SVGs. We also had no proper feedback for
when a corrupted or unsupported image was loaded.

This commit introduces a major rework to how we handle
images and the gallery. It introduces a swipeable gallery
that loads files asynchronously via a new widget: LpImagePage.

LpImagePage owns the file and information related to the file,
and on creation it spawns a future that either loads an error
page when it can't load something (file deleted, corrupted, or
unsupported) or the actual image via LpImage. LpImagePage
now holds the right-click popover and the associated gestures.

The gestures needed to be moved to LpImagePage in order to
rework LpImageView's overlay - instead of having an overlay
child that's a box with a few buttons, we now have the buttons
as individual overlay children. This could cause them
to overlap each other at certain sizes, but it's required
in order to allow input to reach the carousel below.

Right now this comes with a few regressions:

* Occasionally input gets blocked across the applications. It's
hard to tell if this is caused by swipes or right clicking. This
input issue can cause a crash - no Rust backtrace, so a debugger
is needed.

* The "current" page doesn't seem to be properly loaded by the
time `set_image_from_file ()` finishes, so we need to rework
resizing from image dimensions

* We need to re-implement loading different directories and
files within directories

There also seems to be an issue on touchscreens, swiping between
images on a touchscreen causes responsiveness issues not present
when swiping on a touchpad. My guess is that it's related to
the long press gesture.
2022-04-20 13:12:45 -07:00
Christopher Davis
69e9c1b4fc image: Remove new()
Since we already `#[derive(Default)]`, we don't need
a `new()` function to do the same thing
2022-02-04 15:48:14 -08:00
Christopher Davis
4c81f4d286 image: Use clearer ratio names
`ratio` and `pic_ratio` were confusing names. Rename
them to `widget_ratio` and `texture_ratio` to be
more clear.
2022-01-19 19:16:57 -08:00
Maximiliano Sandoval R
13d7a21501 Implement drag source on images
Using a 128x128 thumbnail.
2022-01-09 00:22:50 -08:00
Maximiliano Sandoval R
be09d49756
image: Implement Copy to clipboard 2022-01-08 23:59:56 +01:00
Christopher Davis
56a47fb447 Update gtk-rs
This brings us a neat new function, `imp()`,
that lets us drop `from_instance()` everywhere.
2021-12-29 14:02:48 -08:00
Christopher Davis
5893d4b764 cargo: Use gtk-rs master
Needed to take advantage of template callbacks
and new APIs.
2021-12-22 18:17:38 -08:00
Christopher Davis
1ae7316b32 general: Consolidate explicit dependencies down to adw and gtk4
Use the exported dependencies for everything else.
2021-12-21 16:09:48 -08:00
Christopher Davis
d4fca8aae3 general: Iv* to Lp*
We're probably going to be keeping `loupe` as the codename
and binary name going forward.
2021-12-21 10:55:02 -08:00
Christopher Davis
4d1141a675 widgets: split view and image
This will make implementing a more comprehensive photo view simpler.
2021-12-20 08:37:50 -08:00