Commit graph

382 commits

Author SHA1 Message Date
Sophie Herold
8b3cfd000a cargo: Remove gtk-macros dependency
Using the crate is depreacted. Replaced spawn! macro
with our own spawn function
2023-04-06 21:08:33 +00:00
Sophie Herold
1b18486826 image: Move background color guess to other thread
Also, skip it completely for JPEG and BMP

Issue #111
2023-04-04 22:13:36 +00:00
Sophie Herold
5d7cbe026f image: Remove debug prints from bg color guesser
Closes #111
2023-04-03 16:56:54 +02:00
Sophie Herold
7bf9baa581 image: Ensure contrast for transparent images
Determine if the image is transparent and has low
contrast with default background color. If so,
use a different background color.

Closes #31

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/151>
2023-04-02 23:08:51 +00:00
Sophie Herold
533158bb69 image: Request tiles on size_allocate
Fixes tiles for SVG might be missing when enlarging window.

Closes #104

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/155>
2023-04-02 21:36:24 +00:00
Sophie Herold
750fbfd305 image: Settle with either rotate or zoom gesture
Add thresholds after which the gesture is assumed to be
only zoom or rotate.

Closes #95, #29

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/145>
2023-04-02 16:47:57 +00:00
Sophie Herold
7b7ece1dc3 slidingView: Allocate LpImage more correctly
Allocate the ScrolledWindow instead of the LpImage
to include non-overlayed scrollbars.

General cleanup how we measure things.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/150>
2023-04-02 15:42:42 +00:00
Sophie Herold
e5fc4bc85c image: Add high DPI support
Always interpret the scaling percentag in physical pixels.
This makes 100% show the image 1:1 in screen pixels.

Closes #37
2023-04-02 15:22:12 +00:00
Sophie Herold
67207bb215 image: Use mipmaps for zoom-out and NN for zoom-in
Before we always used "linear" filtering. This gave
a harsh image with moire patterns when zooming out
and washed out images when zooming in.

Closes #68, #71

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/125>
2023-03-25 15:32:31 +00:00
Sophie Herold
0e24f347e6 imagePage: Move popover out of LpImage
It cause 'not measured' errors and we have enough
things to handle in LpImage already.

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/146>
2023-03-18 21:24:45 +00:00
Sophie Herold
f33c4bd470 decoder: Support animated formats (GIF, WEBP, APNG)
Closes #27
2023-03-18 20:23:08 +00:00
Sophie Herold
889c818c14 code: Use pub(super) in GObject impl structs
This helps with getting warnings for fields we no longer use

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/143>
2023-03-14 21:25:45 +00:00
Sophie Herold
e93020d9ab propertiesView: Unify localized DateTime format
Closes #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/141>
2023-03-14 03:50:22 +00:00
Sophie Herold
b8d5f833f3 decoder: Cleanup and better image format detection
Closes #97

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/140>
2023-03-14 03:59:21 +01:00
Sophie Herold
42d558d22f propertiesView: Use image dimensions from decoder
This also shows the units for SVG dimensions if not pixels.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/136>
2023-03-14 02:31:07 +00:00
Sophie Herold
a2a9b4134b propertiesView: Use decoder format
Use the format that we actually used when decoding.
The mime type is usually derived from the file extension
which might not always be correct.

Issue #43

Part-of: <https://gitlab.gnome.org/Incubator/loupe/-/merge_requests/132>
2023-03-14 00:50:40 +00:00
Sophie Herold
a0ce234946 image: Limit SVG zoom to RSVG limits
See <https://gitlab.gnome.org/GNOME/librsvg/-/issues/938>
for details about the problem.

Closes #88
2023-03-11 00:06:51 +00:00
Sophie Herold
9b532f93f3 propertiesView: Use strong file reference
This fixes issues with file info not loading.

Closes #96
2023-03-09 23:46:04 +01:00
Sophie Herold
6a4ee11c76 imageView: Add only viewed images to recently used
Only adding images expclicitly opened via file browser
or drag and drop. Do not add images while browsing
SlidingView to avoid spamming recently used files.

Closes #53
2023-03-08 02:24:27 +00:00
Sophie Herold
05ef429b86 image: Add newly designed thumbnail for DnD
The old method stopped working with the new decoder setup.

The new design features a frame for contrast and rotates
images based on EXIF information.

Closes #89
2023-03-08 01:48:34 +00:00
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
Christopher Davis
3d445f25fe window: Use GSignalGroup to watch zoom levels
This allows us to git rid of more expression code.
2023-03-05 02:13:41 +00:00
Christopher Davis
aab50af31a image_view: Switch from expressions to signal groups
Expressions have the leak issue mentioned in the previous
commit, but we were using them in a few scenarios where
they couldn't be used in UI files.

Since these expressions don't set a property but instead
trigger behavior, the appropriate API to use is GSignalGroup.
This commit switches the expressions on the image to use
GSignalGroup instead.
2023-03-05 02:13:41 +00:00
Christopher Davis
ae41a77521 properties_view: Move expressions to UI files
Currently Loupe leaks expressions created in-code. This
is because expressions need to be unwatched in order to be
dropped. Since we'd need to hold a reference to the watch
ourselves and unwatch them in dispose, our code would
become more cumbersome if we were to try to handle this properly.

This commit moves the expressions on LpPropertiesView to the
UI file, as GTK handles cleaning up the expressions it creates,
without any extra consideration on the app side.
2023-03-05 02:13:41 +00:00
Christopher Davis
34b3fb12de sliding_view: Unparent all children on dispose
This is something all GtkWidget subclasses are supposed to do
with all direct children.
2023-03-05 02:13:41 +00: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
70d8d00a3d imageView: Reset zoom and rotation on page change
Keeping zoom or rotation would be inconsistent since it's
only preserved while images are cached.

Close #65
2023-02-12 20:39:40 +00: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
19c8d69dca code: Fix clippy warnings 2023-02-12 19:31:22 +01:00
Sophie Herold
75cb4ad58f slidingView: Fix swiping on touchscreens
The width of one page is measure by a unit of 1.0.
So this is the correct value
2023-02-10 21:45:34 +01:00
Sophie Herold
cf03d357a0 slidingView: Add space between images 2023-02-10 17:35:26 +00:00
Sophie Herold
caefec74b4 image: Limit rubberbanding zoom and add stiffness 2023-02-07 21:56:00 +01:00
Sophie Herold
69889820cd window: Add Home/End shortcuts for first/last img
This is the same as in EOG.
Also add PageUp/Down for image navigation from EOG.
Cleanup the navigation enums as well.
2023-02-06 19:14:55 +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
7cf04d290a clipboard: Use same ContentProvider as for D+D
FileList is working in more cases than PNGs and has fewer drawbacks.
Also, it's the same that has been used elsewhere for a long time.

Closes #50
2023-01-31 05:17:39 +00:00
Sophie Herold
4eb8b939b3 application: Add shortcuts for paning the view
Closes #54
2023-01-31 04:56:58 +00:00
Sophie Herold
ce1cb0d299 slidingView: Add RTL support
Issue #38
2023-01-31 01:08:56 +00:00
Sophie Herold
d533124daa slidingView: Implement swipe gesture (AdwSwipeable) 2023-01-31 01:08:56 +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
Christopher Davis
7b7435f50a general: Use spawn! less
Because widgets can install async actions, we can simply
turn our callbacks into async functions.
2023-01-22 19:55:42 +00:00
Christopher Davis
9d7dae408b properties_view: Use GtkFileLauncher for opening directory
GtkFileLauncher handles opening the containing folder for
us, using the portal when appropriate
2023-01-18 20:21:15 -05:00
Sophie Herold
36000ff65c window: Put prev/next accels at window level
Tried to make things more stateless and RefCell usage for robust
- Use object properties to control the action enabled/disabled
- Borrow model RefCell for only one line or use .replace()
- Don't pass models around and borrow as short as possible instead

Fixes #20
2022-12-16 18:27:45 +00:00