From ad5d16909ca3bc2a4b3d3bbe319334b39cd74cfa Mon Sep 17 00:00:00 2001 From: Douglas Lau Date: Sat, 28 Oct 2023 14:25:05 -0500 Subject: [PATCH] Vendor gelatin as a module; remove workspace (#194) * Vendor gelatin as a module; remove workspace * Restore winit to 0.28; glium to 0.32 * Update tiny-skia to 0.10 * Remove default features * Restore open to 5.0 --- Cargo.lock | 51 +++++----- Cargo.toml | 89 ++++++++++++++++-- LICENSE.txt | 1 + alloy/Cargo.toml | 75 --------------- alloy/build.rs => build.rs | 0 {gelatin/examples => examples}/hello.rs | 0 {alloy => examples}/resource/cogs.png | Bin gelatin/.gitignore | 3 - gelatin/.vscode/launch.json | 20 ---- gelatin/.vscode/tasks.json | 22 ----- gelatin/Cargo.toml | 18 ---- gelatin/LICENSE.txt | 21 ----- gelatin/README.md | 1 - {alloy/resource => resource}/1-light.png | Bin {alloy/resource => resource}/1.png | Bin .../examples/resource => resource}/cogs.png | Bin {alloy/resource => resource}/copy-failed.png | Bin {alloy/resource => resource}/copy-ready.png | Bin {alloy/resource => resource}/copy-started.png | Bin {alloy/resource => resource}/emulsion48.png | Bin .../resource => resource}/fit-min-light.png | Bin {alloy/resource => resource}/fit-min.png | Bin .../fit-stretch-light.png | Bin {alloy/resource => resource}/fit-stretch.png | Bin {alloy/resource => resource}/light-old.png | Bin {alloy/resource => resource}/light.png | Bin {alloy/resource => resource}/moon.png | Bin .../resource => resource}/question_button.png | Bin .../question_button_light.png | Bin {alloy/resource => resource}/usage.png | Bin .../resource => resource}/use-left-to-pan.png | Bin .../Usage Panel/DejaVuSans.ttf | Bin .../Usage Panel/Emulsion Usage.odt | Bin .../Usage Panel/FiraSans-Regular.ttf | Bin .../Usage Panel/HOW TO EDIT.txt | 0 {alloy/resource_dev => resource_dev}/copy.xcf | Bin .../emulsion.icns | Bin .../emulsion.ico | Bin .../emulsion.png | Bin .../emulsion.svg | 0 .../resource_dev => resource_dev}/light.png | Bin {alloy/resource_dev => resource_dev}/moon.png | Bin .../use-left-to-pan.xcf | Bin {alloy/src => src}/clipboard_handler.rs | 2 +- {alloy/src => src}/cmd_line.rs | 0 {alloy/src => src}/configuration.rs | 0 {gelatin/src => src/gelatin}/application.rs | 2 +- {gelatin/src => src/gelatin}/button.rs | 4 +- {gelatin/src => src/gelatin}/label.rs | 4 +- .../gelatin}/line_layout_container.rs | 4 +- {gelatin/src => src/gelatin}/misc.rs | 0 gelatin/src/lib.rs => src/gelatin/mod.rs | 0 {gelatin/src => src/gelatin}/picture.rs | 11 ++- {gelatin/src => src/gelatin}/shaders.rs | 0 .../gelatin}/shaders/color_f_110.glsl | 0 .../gelatin}/shaders/color_f_140.glsl | 0 .../gelatin}/shaders/color_shadow_f_110.glsl | 0 .../gelatin}/shaders/color_shadow_f_140.glsl | 0 .../shaders/texture_shadow_f_110.glsl | 0 .../shaders/texture_shadow_f_140.glsl | 0 .../gelatin}/shaders/vertex_110.glsl | 0 .../gelatin}/shaders/vertex_140.glsl | 0 {gelatin/src => src/gelatin}/slider.rs | 18 ++-- {gelatin/src => src/gelatin}/window.rs | 18 ++-- {alloy/src => src}/handle_panic.rs | 0 {alloy/src => src}/image_cache/directory.rs | 0 .../src => src}/image_cache/image_loader.rs | 6 +- {alloy/src => src}/image_cache/mod.rs | 15 +-- .../image_cache/pending_requests.rs | 0 {alloy/src => src}/input_handling.rs | 2 +- {alloy/src => src}/main.rs | 29 +++--- {alloy/src => src}/parallel_action.rs | 0 {alloy/src => src}/playback_manager.rs | 22 ++--- {alloy/src => src}/shaders.rs | 0 {alloy/src => src}/shaders/fragment_110.glsl | 0 {alloy/src => src}/shaders/fragment_140.glsl | 0 {gelatin/src => src}/shaders/vertex_110.glsl | 0 {gelatin/src => src}/shaders/vertex_140.glsl | 0 {alloy/src => src}/utils.rs | 2 +- {alloy/src => src}/version.rs | 0 {alloy/src => src}/widgets/bottom_bar.rs | 2 +- .../src => src}/widgets/copy_notification.rs | 2 +- {alloy/src => src}/widgets/help_screen.rs | 15 +-- {alloy/src => src}/widgets/mod.rs | 0 {alloy/src => src}/widgets/picture_widget.rs | 14 +-- 85 files changed, 188 insertions(+), 285 deletions(-) delete mode 100644 alloy/Cargo.toml rename alloy/build.rs => build.rs (100%) rename {gelatin/examples => examples}/hello.rs (100%) rename {alloy => examples}/resource/cogs.png (100%) delete mode 100644 gelatin/.gitignore delete mode 100644 gelatin/.vscode/launch.json delete mode 100644 gelatin/.vscode/tasks.json delete mode 100644 gelatin/Cargo.toml delete mode 100644 gelatin/LICENSE.txt delete mode 100644 gelatin/README.md rename {alloy/resource => resource}/1-light.png (100%) rename {alloy/resource => resource}/1.png (100%) rename {gelatin/examples/resource => resource}/cogs.png (100%) rename {alloy/resource => resource}/copy-failed.png (100%) rename {alloy/resource => resource}/copy-ready.png (100%) rename {alloy/resource => resource}/copy-started.png (100%) rename {alloy/resource => resource}/emulsion48.png (100%) rename {alloy/resource => resource}/fit-min-light.png (100%) rename {alloy/resource => resource}/fit-min.png (100%) rename {alloy/resource => resource}/fit-stretch-light.png (100%) rename {alloy/resource => resource}/fit-stretch.png (100%) rename {alloy/resource => resource}/light-old.png (100%) rename {alloy/resource => resource}/light.png (100%) rename {alloy/resource => resource}/moon.png (100%) rename {alloy/resource => resource}/question_button.png (100%) rename {alloy/resource => resource}/question_button_light.png (100%) rename {alloy/resource => resource}/usage.png (100%) rename {alloy/resource => resource}/use-left-to-pan.png (100%) rename {alloy/resource_dev => resource_dev}/Usage Panel/DejaVuSans.ttf (100%) rename {alloy/resource_dev => resource_dev}/Usage Panel/Emulsion Usage.odt (100%) rename {alloy/resource_dev => resource_dev}/Usage Panel/FiraSans-Regular.ttf (100%) rename {alloy/resource_dev => resource_dev}/Usage Panel/HOW TO EDIT.txt (100%) rename {alloy/resource_dev => resource_dev}/copy.xcf (100%) rename {alloy/resource_dev => resource_dev}/emulsion.icns (100%) rename {alloy/resource_dev => resource_dev}/emulsion.ico (100%) rename {alloy/resource_dev => resource_dev}/emulsion.png (100%) rename {alloy/resource_dev => resource_dev}/emulsion.svg (100%) rename {alloy/resource_dev => resource_dev}/light.png (100%) rename {alloy/resource_dev => resource_dev}/moon.png (100%) rename {alloy/resource_dev => resource_dev}/use-left-to-pan.xcf (100%) rename {alloy/src => src}/clipboard_handler.rs (99%) rename {alloy/src => src}/cmd_line.rs (100%) rename {alloy/src => src}/configuration.rs (100%) rename {gelatin/src => src/gelatin}/application.rs (99%) rename {gelatin/src => src/gelatin}/button.rs (99%) rename {gelatin/src => src/gelatin}/label.rs (98%) rename {gelatin/src => src/gelatin}/line_layout_container.rs (99%) rename {gelatin/src => src/gelatin}/misc.rs (100%) rename gelatin/src/lib.rs => src/gelatin/mod.rs (100%) rename {gelatin/src => src/gelatin}/picture.rs (95%) rename {gelatin/src => src/gelatin}/shaders.rs (100%) rename {gelatin/src => src/gelatin}/shaders/color_f_110.glsl (100%) rename {gelatin/src => src/gelatin}/shaders/color_f_140.glsl (100%) rename {gelatin/src => src/gelatin}/shaders/color_shadow_f_110.glsl (100%) rename {gelatin/src => src/gelatin}/shaders/color_shadow_f_140.glsl (100%) rename {gelatin/src => src/gelatin}/shaders/texture_shadow_f_110.glsl (100%) rename {gelatin/src => src/gelatin}/shaders/texture_shadow_f_140.glsl (100%) rename {alloy/src => src/gelatin}/shaders/vertex_110.glsl (100%) rename {alloy/src => src/gelatin}/shaders/vertex_140.glsl (100%) rename {gelatin/src => src/gelatin}/slider.rs (98%) rename {gelatin/src => src/gelatin}/window.rs (97%) rename {alloy/src => src}/handle_panic.rs (100%) rename {alloy/src => src}/image_cache/directory.rs (100%) rename {alloy/src => src}/image_cache/image_loader.rs (99%) rename {alloy/src => src}/image_cache/mod.rs (99%) rename {alloy/src => src}/image_cache/pending_requests.rs (100%) rename {alloy/src => src}/input_handling.rs (99%) rename {alloy/src => src}/main.rs (97%) rename {alloy/src => src}/parallel_action.rs (100%) rename {alloy/src => src}/playback_manager.rs (96%) rename {alloy/src => src}/shaders.rs (100%) rename {alloy/src => src}/shaders/fragment_110.glsl (100%) rename {alloy/src => src}/shaders/fragment_140.glsl (100%) rename {gelatin/src => src}/shaders/vertex_110.glsl (100%) rename {gelatin/src => src}/shaders/vertex_140.glsl (100%) rename {alloy/src => src}/utils.rs (99%) rename {alloy/src => src}/version.rs (100%) rename {alloy/src => src}/widgets/bottom_bar.rs (99%) rename {alloy/src => src}/widgets/copy_notification.rs (96%) rename {alloy/src => src}/widgets/help_screen.rs (94%) rename {alloy/src => src}/widgets/mod.rs (100%) rename {alloy/src => src}/widgets/picture_widget.rs (99%) diff --git a/Cargo.lock b/Cargo.lock index bc9eb268..3d3c38fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "ab_glyph" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5110f1c78cf582855d895ecd0746b653db010cec6d9f5575293f27934d980a39" +checksum = "b1061f3ff92c2f65800df1f12fc7b4ff44ee14783104187dd04dfee6f11b0fd2" dependencies = [ "ab_glyph_rasterizer", "owned_ttf_parser", @@ -48,9 +48,11 @@ version = "1.0.0" dependencies = [ "arboard", "backtrace", + "cgmath", "directories-next", "env_logger", - "gelatin", + "glium", + "image", "kamadak-exif", "lazy_static", "lexical-sort", @@ -63,16 +65,20 @@ dependencies = [ "serde", "sys-info", "thiserror", + "tiny-skia 0.10.0", "toml 0.7.5", "trash", + "typed-builder", + "usvg", + "winit 0.28.7", "winres", ] [[package]] name = "android-activity" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40bc1575e653f158cbdc6ebcd917b9564e66321c5325c232c3591269c257be69" +checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" dependencies = [ "android-properties", "bitflags 1.3.2", @@ -726,7 +732,7 @@ dependencies = [ "memmap2 0.6.2", "slotmap", "tinyvec", - "ttf-parser 0.19.1", + "ttf-parser 0.19.2", ] [[package]] @@ -814,17 +820,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" -[[package]] -name = "gelatin" -version = "0.7.0" -dependencies = [ - "cgmath", - "glium", - "image", - "typed-builder", - "winit 0.28.6", -] - [[package]] name = "gethostname" version = "0.2.3" @@ -1084,9 +1079,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] @@ -1590,9 +1585,9 @@ dependencies = [ [[package]] name = "orbclient" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221d488cd70617f1bd599ed8ceb659df2147d9393717954d82a0f5e8032a6ab1" +checksum = "8378ac0dfbd4e7895f2d2c1f1345cab3836910baf3a300b000d04250f0c8428f" dependencies = [ "redox_syscall 0.3.5", ] @@ -1612,7 +1607,7 @@ version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "706de7e2214113d63a8238d1910463cfce781129a6f263d13fdb09ff64355ba4" dependencies = [ - "ttf-parser 0.19.1", + "ttf-parser 0.19.2", ] [[package]] @@ -2071,9 +2066,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "smithay-client-toolkit" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f307c47d32d2715eb2e0ece5589057820e0e5e70d07c247d1063e844e107f454" +checksum = "870427e30b8f2cbe64bf43ec4b86e88fe39b0a84b3f15efd9c9c2d020bc86eb9" dependencies = [ "bitflags 1.3.2", "calloop", @@ -2363,9 +2358,9 @@ checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" [[package]] name = "ttf-parser" -version = "0.19.1" +version = "0.19.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a464a4b34948a5f67fddd2b823c62d9d92e44be75058b99939eae6c5b6960b33" +checksum = "49d64318d8311fc2668e48b63969f4343e0a85c4a109aa8460d6672e364b8bd1" [[package]] name = "typed-builder" @@ -2931,9 +2926,9 @@ dependencies = [ [[package]] name = "winit" -version = "0.28.6" +version = "0.28.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866db3f712fffba75d31bf0cdecf357c8aeafd158c5b7ab51dba2a2b2d47f196" +checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" dependencies = [ "android-activity", "bitflags 1.3.2", diff --git a/Cargo.toml b/Cargo.toml index 0e0584e1..7c282edf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,81 @@ -[workspace] -members = [ - "alloy", - "gelatin", +[package] +name = "alloy" +version = "1.0.0" +description = "A fast and minimalistic image viewer based on emulsion" +repository = "https://github.com/ardaku/alloy" +license = "MIT" +readme = "README.md" +edition = "2021" +build = "build.rs" + +[package.metadata.bundle] +name = "Emulsion" +identifier = "org.ardaku.alloy" +icon = ["resource_dev/emulsion.png"] +resources = ["LICENSE.txt"] +short_description = "A lightweight and minimalistic image viewer based on emulsion" +copyright = "Copyright (c) 2020 The Emulsion Contributors, Copyright (c) 2022 The Alloy Contributors" +linux_exec_args = "%f" +linux_mime_types = [ + "image/jpeg", + "image/jpg", + "image/pjpeg", + "image/png", + "image/apng", + "image/gif", + "image/webp", + "image/tiff", + "image/bmp", + "image/avif", + "image/svg+xml", + "image/svg", + "image/x-png", + "image/x-tga", + "image/x-targa", + "image/x-bmp", + "image/x-icon", + "image/vnd.microsoft.icon", + "image/vnd.radiance", + "image/x‑portable‑bitmap", + "image/x‑portable‑graymap", + "image/x‑portable‑pixmap", + "image/x‑portable‑anymap" ] -[profile.dev.package."*"] -opt-level = 1 -[profile.dev.build-override] -opt-level = 1 -[profile.release] -lto = "thin" +[features] +avif = ["libavif-image"] + +[target.'cfg(windows)'.build-dependencies] +winres = "0.1" + +[dependencies] +arboard = "3.2" +backtrace = "0.3" +cgmath = "0.18" +directories-next = "2.0" +env_logger = "0.10" +glium = "0.32" +image = "0.24" +kamadak-exif = "0.5" +lazy_static = "1.4" +lexical-sort = "0.3" +log = "0.4" +open = "5.0" +pico-args = "0.5" +rand = "0.8" +resvg = "0.35" +serde = { version = "1.0.159", features = ["derive"] } +sys-info = "0.9" +thiserror = "1.0" +tiny-skia = "0.10" +toml = "0.7" +trash = { version = "3.0", default-features = false } +typed-builder = "0.14" +usvg = "0.35" +winit = "0.28" + +[dependencies.libavif-image] +version = "0.10" +default-features = false +features = ["codec-dav1d"] +optional = true diff --git a/LICENSE.txt b/LICENSE.txt index dfaa2b59..64376077 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,7 @@ MIT License Copyright (c) 2020 The Emulsion Contributors +Copyright (c) 2020 Artúr Barnabás Kovács Copyright (c) 2022-2023 The Alloy Contributors Permission is hereby granted, free of charge, to any person obtaining a copy diff --git a/alloy/Cargo.toml b/alloy/Cargo.toml deleted file mode 100644 index 14380366..00000000 --- a/alloy/Cargo.toml +++ /dev/null @@ -1,75 +0,0 @@ -[package] -name = "alloy" -version = "1.0.0" -description = "A fast and minimalistic image viewer based on emulsion" -repository = "https://github.com/ardaku/alloy" -license = "MIT" -readme = "README.md" -edition = "2021" -build = "build.rs" - -[package.metadata.bundle] -name = "Emulsion" -identifier = "org.ardaku.alloy" -icon = ["resource_dev/emulsion.png"] -resources = ["LICENSE.txt"] -short_description = "A lightweight and minimalistic image viewer based on emulsion" -copyright = "Copyright (c) 2020 The Emulsion Contributors, Copyright (c) 2022 The Alloy Contributors" -linux_exec_args = "%f" -linux_mime_types = [ - "image/jpeg", - "image/jpg", - "image/pjpeg", - "image/png", - "image/apng", - "image/gif", - "image/webp", - "image/tiff", - "image/bmp", - "image/avif", - "image/svg+xml", - "image/svg", - "image/x-png", - "image/x-tga", - "image/x-targa", - "image/x-bmp", - "image/x-icon", - "image/vnd.microsoft.icon", - "image/vnd.radiance", - "image/x‑portable‑bitmap", - "image/x‑portable‑graymap", - "image/x‑portable‑pixmap", - "image/x‑portable‑anymap" -] - -[features] -avif = ["libavif-image"] - -[target.'cfg(windows)'.build-dependencies] -winres = "0.1" - -[dependencies] -gelatin = { path = "../gelatin", version = "0.7" } -lazy_static = "1.4" -directories-next = "2.0" -open = "5.0" -sys-info = "0.9" -backtrace = "0.3" -serde = { version = "1.0.159", features = ["derive"] } -toml = "0.7" -rand = "0.8" -lexical-sort = "0.3" -trash = { version = "3.0", default-features = false } -kamadak-exif = "0.5" -arboard = "3.2" -resvg = "0.35" -log = "0.4" -env_logger = "0.10" -pico-args = "0.5" -thiserror = "1.0" - -[dependencies.libavif-image] -version = "0.10" -default-features = false -features = ["codec-dav1d"] -optional = true diff --git a/alloy/build.rs b/build.rs similarity index 100% rename from alloy/build.rs rename to build.rs diff --git a/gelatin/examples/hello.rs b/examples/hello.rs similarity index 100% rename from gelatin/examples/hello.rs rename to examples/hello.rs diff --git a/alloy/resource/cogs.png b/examples/resource/cogs.png similarity index 100% rename from alloy/resource/cogs.png rename to examples/resource/cogs.png diff --git a/gelatin/.gitignore b/gelatin/.gitignore deleted file mode 100644 index 69369904..00000000 --- a/gelatin/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/target -**/*.rs.bk -Cargo.lock diff --git a/gelatin/.vscode/launch.json b/gelatin/.vscode/launch.json deleted file mode 100644 index ed32e553..00000000 --- a/gelatin/.vscode/launch.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "(Windows) Launch", - "type": "cppvsdbg", - "request": "launch", - "program": "${workspaceFolder}/target/debug/examples/hello.exe", - "args": [], - "stopAtEntry": false, - "cwd": "${workspaceFolder}", - "environment": [], - "externalConsole": false, - "preLaunchTask": "cargo build hello" - } - ] -} \ No newline at end of file diff --git a/gelatin/.vscode/tasks.json b/gelatin/.vscode/tasks.json deleted file mode 100644 index c051bd6e..00000000 --- a/gelatin/.vscode/tasks.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "2.0.0", - "tasks": [ - { - "label": "cargo build", - "type": "cargo", - "subcommand": "build", - "problemMatcher": [ - "$rustc" - ], - "group": "build" - }, - { - "label": "cargo build hello", - "type": "shell", - "command": "cargo build --example hello", - "group": "build", - } - ] -} \ No newline at end of file diff --git a/gelatin/Cargo.toml b/gelatin/Cargo.toml deleted file mode 100644 index e807f439..00000000 --- a/gelatin/Cargo.toml +++ /dev/null @@ -1,18 +0,0 @@ -[package] -name = "gelatin" -version = "0.7.0" -description = "A basic UI framework" -repository = "https://github.com/ArturKovacs/emulsion" -authors = ["Artur Barnabas "] -license = "MIT" -readme = "README.md" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[dependencies] -cgmath = "0.18" -typed-builder = "0.14" -image = "0.24" -glium = "0.32" -winit = "0.28" diff --git a/gelatin/LICENSE.txt b/gelatin/LICENSE.txt deleted file mode 100644 index 9c5c265c..00000000 --- a/gelatin/LICENSE.txt +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2020 Artúr Barnabás Kovács - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file diff --git a/gelatin/README.md b/gelatin/README.md deleted file mode 100644 index d223789b..00000000 --- a/gelatin/README.md +++ /dev/null @@ -1 +0,0 @@ -This crate is a minimal UI framework that was built to be used by the [Emulsion](https://github.com/ArturKovacs/emulsion) program. diff --git a/alloy/resource/1-light.png b/resource/1-light.png similarity index 100% rename from alloy/resource/1-light.png rename to resource/1-light.png diff --git a/alloy/resource/1.png b/resource/1.png similarity index 100% rename from alloy/resource/1.png rename to resource/1.png diff --git a/gelatin/examples/resource/cogs.png b/resource/cogs.png similarity index 100% rename from gelatin/examples/resource/cogs.png rename to resource/cogs.png diff --git a/alloy/resource/copy-failed.png b/resource/copy-failed.png similarity index 100% rename from alloy/resource/copy-failed.png rename to resource/copy-failed.png diff --git a/alloy/resource/copy-ready.png b/resource/copy-ready.png similarity index 100% rename from alloy/resource/copy-ready.png rename to resource/copy-ready.png diff --git a/alloy/resource/copy-started.png b/resource/copy-started.png similarity index 100% rename from alloy/resource/copy-started.png rename to resource/copy-started.png diff --git a/alloy/resource/emulsion48.png b/resource/emulsion48.png similarity index 100% rename from alloy/resource/emulsion48.png rename to resource/emulsion48.png diff --git a/alloy/resource/fit-min-light.png b/resource/fit-min-light.png similarity index 100% rename from alloy/resource/fit-min-light.png rename to resource/fit-min-light.png diff --git a/alloy/resource/fit-min.png b/resource/fit-min.png similarity index 100% rename from alloy/resource/fit-min.png rename to resource/fit-min.png diff --git a/alloy/resource/fit-stretch-light.png b/resource/fit-stretch-light.png similarity index 100% rename from alloy/resource/fit-stretch-light.png rename to resource/fit-stretch-light.png diff --git a/alloy/resource/fit-stretch.png b/resource/fit-stretch.png similarity index 100% rename from alloy/resource/fit-stretch.png rename to resource/fit-stretch.png diff --git a/alloy/resource/light-old.png b/resource/light-old.png similarity index 100% rename from alloy/resource/light-old.png rename to resource/light-old.png diff --git a/alloy/resource/light.png b/resource/light.png similarity index 100% rename from alloy/resource/light.png rename to resource/light.png diff --git a/alloy/resource/moon.png b/resource/moon.png similarity index 100% rename from alloy/resource/moon.png rename to resource/moon.png diff --git a/alloy/resource/question_button.png b/resource/question_button.png similarity index 100% rename from alloy/resource/question_button.png rename to resource/question_button.png diff --git a/alloy/resource/question_button_light.png b/resource/question_button_light.png similarity index 100% rename from alloy/resource/question_button_light.png rename to resource/question_button_light.png diff --git a/alloy/resource/usage.png b/resource/usage.png similarity index 100% rename from alloy/resource/usage.png rename to resource/usage.png diff --git a/alloy/resource/use-left-to-pan.png b/resource/use-left-to-pan.png similarity index 100% rename from alloy/resource/use-left-to-pan.png rename to resource/use-left-to-pan.png diff --git a/alloy/resource_dev/Usage Panel/DejaVuSans.ttf b/resource_dev/Usage Panel/DejaVuSans.ttf similarity index 100% rename from alloy/resource_dev/Usage Panel/DejaVuSans.ttf rename to resource_dev/Usage Panel/DejaVuSans.ttf diff --git a/alloy/resource_dev/Usage Panel/Emulsion Usage.odt b/resource_dev/Usage Panel/Emulsion Usage.odt similarity index 100% rename from alloy/resource_dev/Usage Panel/Emulsion Usage.odt rename to resource_dev/Usage Panel/Emulsion Usage.odt diff --git a/alloy/resource_dev/Usage Panel/FiraSans-Regular.ttf b/resource_dev/Usage Panel/FiraSans-Regular.ttf similarity index 100% rename from alloy/resource_dev/Usage Panel/FiraSans-Regular.ttf rename to resource_dev/Usage Panel/FiraSans-Regular.ttf diff --git a/alloy/resource_dev/Usage Panel/HOW TO EDIT.txt b/resource_dev/Usage Panel/HOW TO EDIT.txt similarity index 100% rename from alloy/resource_dev/Usage Panel/HOW TO EDIT.txt rename to resource_dev/Usage Panel/HOW TO EDIT.txt diff --git a/alloy/resource_dev/copy.xcf b/resource_dev/copy.xcf similarity index 100% rename from alloy/resource_dev/copy.xcf rename to resource_dev/copy.xcf diff --git a/alloy/resource_dev/emulsion.icns b/resource_dev/emulsion.icns similarity index 100% rename from alloy/resource_dev/emulsion.icns rename to resource_dev/emulsion.icns diff --git a/alloy/resource_dev/emulsion.ico b/resource_dev/emulsion.ico similarity index 100% rename from alloy/resource_dev/emulsion.ico rename to resource_dev/emulsion.ico diff --git a/alloy/resource_dev/emulsion.png b/resource_dev/emulsion.png similarity index 100% rename from alloy/resource_dev/emulsion.png rename to resource_dev/emulsion.png diff --git a/alloy/resource_dev/emulsion.svg b/resource_dev/emulsion.svg similarity index 100% rename from alloy/resource_dev/emulsion.svg rename to resource_dev/emulsion.svg diff --git a/alloy/resource_dev/light.png b/resource_dev/light.png similarity index 100% rename from alloy/resource_dev/light.png rename to resource_dev/light.png diff --git a/alloy/resource_dev/moon.png b/resource_dev/moon.png similarity index 100% rename from alloy/resource_dev/moon.png rename to resource_dev/moon.png diff --git a/alloy/resource_dev/use-left-to-pan.xcf b/resource_dev/use-left-to-pan.xcf similarity index 100% rename from alloy/resource_dev/use-left-to-pan.xcf rename to resource_dev/use-left-to-pan.xcf diff --git a/alloy/src/clipboard_handler.rs b/src/clipboard_handler.rs similarity index 99% rename from alloy/src/clipboard_handler.rs rename to src/clipboard_handler.rs index bd9df7ee..4545ddaa 100644 --- a/alloy/src/clipboard_handler.rs +++ b/src/clipboard_handler.rs @@ -6,7 +6,7 @@ use std::{ }, }; -use gelatin::image::imageops::{ +use image::imageops::{ flip_horizontal_in_place, flip_vertical_in_place, rotate180_in_place, rotate270, rotate90, }; diff --git a/alloy/src/cmd_line.rs b/src/cmd_line.rs similarity index 100% rename from alloy/src/cmd_line.rs rename to src/cmd_line.rs diff --git a/alloy/src/configuration.rs b/src/configuration.rs similarity index 100% rename from alloy/src/configuration.rs rename to src/configuration.rs diff --git a/gelatin/src/application.rs b/src/gelatin/application.rs similarity index 99% rename from gelatin/src/application.rs rename to src/gelatin/application.rs index 197288db..2302273b 100644 --- a/gelatin/src/application.rs +++ b/src/gelatin/application.rs @@ -11,7 +11,7 @@ use glium::glutin::{ window::WindowId, }; -use crate::{window::Window, NextUpdate}; +use crate::gelatin::{window::Window, NextUpdate}; const MAX_SLEEP_DURATION: std::time::Duration = std::time::Duration::from_millis(4); diff --git a/gelatin/src/button.rs b/src/gelatin/button.rs similarity index 99% rename from gelatin/src/button.rs rename to src/gelatin/button.rs index 1c127beb..a680ed6e 100644 --- a/gelatin/src/button.rs +++ b/src/gelatin/button.rs @@ -6,8 +6,8 @@ use glium::{ uniform, Frame, Surface, }; -use crate::{ - add_common_widget_functions, +use crate::add_common_widget_functions; +use crate::gelatin::{ misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement}, picture::Picture, window::RenderValidity, diff --git a/gelatin/src/label.rs b/src/gelatin/label.rs similarity index 98% rename from gelatin/src/label.rs rename to src/gelatin/label.rs index 7179d94f..e0a4a787 100644 --- a/gelatin/src/label.rs +++ b/src/gelatin/label.rs @@ -3,8 +3,8 @@ use std::{cell::RefCell, rc::Rc}; use cgmath::{Matrix4, Vector3}; use glium::{uniform, Frame, Surface}; -use crate::{ - add_common_widget_functions, +use crate::add_common_widget_functions; +use crate::gelatin::{ misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement}, picture::Picture, window::RenderValidity, diff --git a/gelatin/src/line_layout_container.rs b/src/gelatin/line_layout_container.rs similarity index 99% rename from gelatin/src/line_layout_container.rs rename to src/gelatin/line_layout_container.rs index 1269d076..fe8e4057 100644 --- a/gelatin/src/line_layout_container.rs +++ b/src/gelatin/line_layout_container.rs @@ -2,8 +2,8 @@ use std::{cell::RefCell, rc::Rc}; use glium::Frame; -use crate::{ - add_common_widget_functions, +use crate::add_common_widget_functions; +use crate::gelatin::{ misc::{ Alignment, HorDim, Length, LogicalRect, LogicalVector, PickDimension, VerDim, WidgetPlacement, diff --git a/gelatin/src/misc.rs b/src/gelatin/misc.rs similarity index 100% rename from gelatin/src/misc.rs rename to src/gelatin/misc.rs diff --git a/gelatin/src/lib.rs b/src/gelatin/mod.rs similarity index 100% rename from gelatin/src/lib.rs rename to src/gelatin/mod.rs diff --git a/gelatin/src/picture.rs b/src/gelatin/picture.rs similarity index 95% rename from gelatin/src/picture.rs rename to src/gelatin/picture.rs index e656ac76..020e2a72 100644 --- a/gelatin/src/picture.rs +++ b/src/gelatin/picture.rs @@ -4,7 +4,8 @@ use std::{ path, }; -use glium::texture::{RawImage2d, SrgbTexture2d}; +use glium::texture::{MipmapsOption, RawImage2d, SrgbTexture2d}; +use glium::Display; use image::{error::ImageError, RgbaImage}; pub struct PictureTextureRef<'a> { @@ -95,7 +96,7 @@ impl Picture { pub fn texture( &self, - display: &glium::Display, + display: &Display, ) -> Result { self.upload_to_texture(display)?; if let PictureData::Gpu(_) = &*self.data.borrow() { @@ -109,7 +110,7 @@ impl Picture { fn upload_to_texture( &self, - display: &glium::Display, + display: &Display, ) -> Result<(), ImageError> { let mut borrowed = self.data.borrow_mut(); let mut tmp_picture = PictureData::Path("".into()); @@ -142,14 +143,14 @@ impl Picture { fn cpu_to_texture( img: RgbaImage, - display: &glium::Display, + display: &Display, ) -> SrgbTexture2d { let image_dimensions = img.dimensions(); let image = RawImage2d::from_raw_rgba(img.into_raw(), image_dimensions); SrgbTexture2d::with_mipmaps( display, image, - glium::texture::MipmapsOption::AutoGeneratedMipmaps, + MipmapsOption::AutoGeneratedMipmaps, ) .unwrap() } diff --git a/gelatin/src/shaders.rs b/src/gelatin/shaders.rs similarity index 100% rename from gelatin/src/shaders.rs rename to src/gelatin/shaders.rs diff --git a/gelatin/src/shaders/color_f_110.glsl b/src/gelatin/shaders/color_f_110.glsl similarity index 100% rename from gelatin/src/shaders/color_f_110.glsl rename to src/gelatin/shaders/color_f_110.glsl diff --git a/gelatin/src/shaders/color_f_140.glsl b/src/gelatin/shaders/color_f_140.glsl similarity index 100% rename from gelatin/src/shaders/color_f_140.glsl rename to src/gelatin/shaders/color_f_140.glsl diff --git a/gelatin/src/shaders/color_shadow_f_110.glsl b/src/gelatin/shaders/color_shadow_f_110.glsl similarity index 100% rename from gelatin/src/shaders/color_shadow_f_110.glsl rename to src/gelatin/shaders/color_shadow_f_110.glsl diff --git a/gelatin/src/shaders/color_shadow_f_140.glsl b/src/gelatin/shaders/color_shadow_f_140.glsl similarity index 100% rename from gelatin/src/shaders/color_shadow_f_140.glsl rename to src/gelatin/shaders/color_shadow_f_140.glsl diff --git a/gelatin/src/shaders/texture_shadow_f_110.glsl b/src/gelatin/shaders/texture_shadow_f_110.glsl similarity index 100% rename from gelatin/src/shaders/texture_shadow_f_110.glsl rename to src/gelatin/shaders/texture_shadow_f_110.glsl diff --git a/gelatin/src/shaders/texture_shadow_f_140.glsl b/src/gelatin/shaders/texture_shadow_f_140.glsl similarity index 100% rename from gelatin/src/shaders/texture_shadow_f_140.glsl rename to src/gelatin/shaders/texture_shadow_f_140.glsl diff --git a/alloy/src/shaders/vertex_110.glsl b/src/gelatin/shaders/vertex_110.glsl similarity index 100% rename from alloy/src/shaders/vertex_110.glsl rename to src/gelatin/shaders/vertex_110.glsl diff --git a/alloy/src/shaders/vertex_140.glsl b/src/gelatin/shaders/vertex_140.glsl similarity index 100% rename from alloy/src/shaders/vertex_140.glsl rename to src/gelatin/shaders/vertex_140.glsl diff --git a/gelatin/src/slider.rs b/src/gelatin/slider.rs similarity index 98% rename from gelatin/src/slider.rs rename to src/gelatin/slider.rs index b4d51ed0..a4a61632 100644 --- a/gelatin/src/slider.rs +++ b/src/gelatin/slider.rs @@ -1,17 +1,18 @@ use std::{cell::RefCell, rc::Rc}; use cgmath::{Matrix4, Vector3}; -use glium::{ - glutin::event::{ElementState, MouseButton}, - uniform, Frame, Surface, -}; - -use crate::{ - add_common_widget_functions, +use crate::add_common_widget_functions; +use crate::gelatin::{ misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement}, window::RenderValidity, DrawContext, Event, EventKind, NextUpdate, Widget, WidgetData, WidgetError, }; +use glium::{ + glutin::event::{ElementState, MouseButton}, + DrawParameters, + Blend, BlendingFunction, LinearBlendingFactor, + uniform, Frame, Surface, +}; struct SliderData { placement: WidgetPlacement, @@ -112,7 +113,6 @@ impl Widget for Slider { target: &mut Frame, context: &DrawContext, ) -> Result { - use glium::{Blend, BlendingFunction, LinearBlendingFactor}; { let borrowed = self.data.borrow(); if !borrowed.visible { @@ -126,7 +126,7 @@ impl Widget for Slider { //let width = borrowed.drawn_bounds.size.vec.x; //let height = borrowed.drawn_bounds.size.vec.y; - let image_draw_params = glium::DrawParameters { + let image_draw_params = DrawParameters { viewport: Some(*context.viewport), blend: Blend { color: BlendingFunction::Addition { diff --git a/gelatin/src/window.rs b/src/gelatin/window.rs similarity index 97% rename from gelatin/src/window.rs rename to src/gelatin/window.rs index 0843567a..90b2449c 100644 --- a/gelatin/src/window.rs +++ b/src/gelatin/window.rs @@ -8,18 +8,20 @@ use std::{ use cgmath::{ortho, Matrix4, Vector3}; use glium::{ + index::PrimitiveType, glutin::{ self, dpi::{PhysicalPosition, PhysicalSize}, event::WindowEvent, window::{CursorIcon, Icon, WindowId}, }, - program, uniform, Blend, BlendingFunction, Display, Frame, IndexBuffer, + program, uniform, Blend, BlendingFunction, Display, DrawParameters, Frame, IndexBuffer, Program, Rect, Surface, VertexBuffer, }; use typed_builder::TypedBuilder; -use crate::{ +use crate::VerticalLayoutContainer; +use crate::gelatin::{ application::Application, misc::{FromPhysical, LogicalRect, LogicalVector}, shaders, DrawContext, Event, EventKind, NextUpdate, Vertex, Widget, @@ -84,7 +86,7 @@ pub struct WindowDescriptor { type WindowGlobalEventHandler = Box; struct WindowData { - display: glium::Display, + display: Display, size_before_fullscreen: PhysicalSize, fullscreen: bool, last_mouse_move_update_time: std::time::Instant, @@ -144,7 +146,7 @@ impl Window { .with_gl_profile(glutin::GlProfile::Core) .with_vsync(true); let display = - glium::Display::new(window, context, &application.event_loop) + Display::new(window, context, &application.event_loop) .unwrap(); if let Some(pos) = desc.position { @@ -158,7 +160,6 @@ impl Window { .set_cursor_icon(CursorIcon::Default); // All the draw stuff - use glium::index::PrimitiveType; let vertex_buffer = { VertexBuffer::new( &display, @@ -243,8 +244,7 @@ impl Window { validity: Rc::new(Cell::new(false)), }, root_widget: Rc::new( - crate::line_layout_container::VerticalLayoutContainer::new( - ), + VerticalLayoutContainer::new(), ), bg_color: [0.85, 0.85, 0.85, 1.0], @@ -473,7 +473,7 @@ impl Window { /// WARNING The window may not be changed during the drawing phase. /// This means that trying to borrow the window *mutably* in a widget's /// draw function will fail. - pub fn redraw(&self) -> crate::NextUpdate { + pub fn redraw(&self) -> NextUpdate { // Using a scope to only borrow the data mutable for the very beggining. { let mut borrowed = self.data.borrow_mut(); @@ -596,7 +596,7 @@ impl Window { let transform = Matrix4::from_translation(Vector3::new(-1.0, -1.0, 0.0)) * transform; - let image_draw_params = glium::DrawParameters { + let image_draw_params = DrawParameters { blend: Blend { color: BlendingFunction::Max, alpha: BlendingFunction::Max, diff --git a/alloy/src/handle_panic.rs b/src/handle_panic.rs similarity index 100% rename from alloy/src/handle_panic.rs rename to src/handle_panic.rs diff --git a/alloy/src/image_cache/directory.rs b/src/image_cache/directory.rs similarity index 100% rename from alloy/src/image_cache/directory.rs rename to src/image_cache/directory.rs diff --git a/alloy/src/image_cache/image_loader.rs b/src/image_cache/image_loader.rs similarity index 99% rename from alloy/src/image_cache/image_loader.rs rename to src/image_cache/image_loader.rs index d5170713..1c8637b6 100644 --- a/alloy/src/image_cache/image_loader.rs +++ b/src/image_cache/image_loader.rs @@ -10,7 +10,7 @@ use std::{ thread, }; -use gelatin::image::{ +use image::{ self, codecs::{gif::GifDecoder, png::PngDecoder}, AnimationDecoder, ImageFormat, @@ -23,9 +23,7 @@ use resvg::{ pub mod errors { use std::io; - - use gelatin::{glium::texture, image}; - use resvg::usvg; + use glium::texture; pub type Result = std::result::Result; diff --git a/alloy/src/image_cache/mod.rs b/src/image_cache/mod.rs similarity index 99% rename from alloy/src/image_cache/mod.rs rename to src/image_cache/mod.rs index e4cea807..f51210f1 100644 --- a/alloy/src/image_cache/mod.rs +++ b/src/image_cache/mod.rs @@ -13,13 +13,10 @@ use std::{ time::SystemTime, }; -use gelatin::{ - glium::{ - self, - texture::{MipmapsOption, RawImage2d, SrgbTexture2d}, - CapabilitiesSource, - }, - image, +use glium::{ + self, + texture::{MipmapsOption, RawImage2d, SrgbTexture2d}, + CapabilitiesSource, }; use log::trace; @@ -31,9 +28,7 @@ use self::{ pub mod errors { use std::io; - - use gelatin::{glium::texture, image}; - + use glium::texture; use crate::image_cache::image_loader; pub type Result = std::result::Result; diff --git a/alloy/src/image_cache/pending_requests.rs b/src/image_cache/pending_requests.rs similarity index 100% rename from alloy/src/image_cache/pending_requests.rs rename to src/image_cache/pending_requests.rs diff --git a/alloy/src/input_handling.rs b/src/input_handling.rs similarity index 99% rename from alloy/src/input_handling.rs rename to src/input_handling.rs index ed37558e..6ac0f28d 100644 --- a/alloy/src/input_handling.rs +++ b/src/input_handling.rs @@ -1,6 +1,6 @@ use std::{cell::RefCell, collections::HashMap, process::Command, rc::Rc}; -use gelatin::glium::glutin::event::ModifiersState; +use glium::glutin::event::ModifiersState; use lazy_static::lazy_static; use crate::configuration::Configuration; diff --git a/alloy/src/main.rs b/src/main.rs similarity index 97% rename from alloy/src/main.rs rename to src/main.rs index 54cf7bdb..ede10262 100644 --- a/alloy/src/main.rs +++ b/src/main.rs @@ -9,25 +9,25 @@ use std::{ }; use directories_next::ProjectDirs; -use gelatin::{ - application::*, - glium::glutin::{ - dpi::{PhysicalPosition, PhysicalSize}, - event::WindowEvent, - window::Icon, - }, - image, - label::*, - line_layout_container::*, - misc::*, - picture::*, - window::{Window, WindowDescriptor}, -}; use lazy_static::lazy_static; use log::trace; use crate::{ configuration::{Cache, ConfigWindowSection, Configuration, Theme}, + gelatin::{ + application::*, + glium::glutin::{ + dpi::{PhysicalPosition, PhysicalSize}, + event::WindowEvent, + window::Icon, + }, + image, + label::*, + line_layout_container::*, + misc::*, + picture::*, + window::{Window, WindowDescriptor}, + }, widgets::{ bottom_bar::BottomBar, copy_notification::CopyNotifications, help_screen::*, picture_widget::*, @@ -37,6 +37,7 @@ use crate::{ mod clipboard_handler; mod cmd_line; mod configuration; +mod gelatin; mod handle_panic; mod image_cache; mod input_handling; diff --git a/alloy/src/parallel_action.rs b/src/parallel_action.rs similarity index 100% rename from alloy/src/parallel_action.rs rename to src/parallel_action.rs diff --git a/alloy/src/playback_manager.rs b/src/playback_manager.rs similarity index 96% rename from alloy/src/playback_manager.rs rename to src/playback_manager.rs index 0d01f28f..839842cc 100644 --- a/alloy/src/playback_manager.rs +++ b/src/playback_manager.rs @@ -7,7 +7,7 @@ use std::{ time::{Duration, Instant}, }; -use gelatin::{glium::Display, window::Window}; +use crate::gelatin::{NextUpdate, glium::Display, window::Window}; use log::{debug, trace}; use rand::{seq::SliceRandom, thread_rng}; @@ -272,7 +272,7 @@ impl PlaybackManager { &self.folder_player.file_path } - pub fn update_image(&mut self, window: &Window) -> gelatin::NextUpdate { + pub fn update_image(&mut self, window: &Window) -> NextUpdate { let display = window.display_mut(); let prev_file = self.folder_player.image_texture(); let next_update = self @@ -379,7 +379,7 @@ impl ImgSequencePlayer

{ &mut self, display: &Display, image_cache: &mut ImageCache, - ) -> gelatin::NextUpdate { + ) -> NextUpdate { trace!( "Begin `update_image`. Curr image is: {:?}. Load request is {:?}", self.file_path, @@ -388,7 +388,7 @@ impl ImgSequencePlayer

{ let is_paused = matches!(self.playback_state, PlaybackState::Paused); let no_request = matches!(self.load_request, LoadRequest::None); if self.file_path.is_none() && no_request && is_paused { - return gelatin::NextUpdate::Latest; + return NextUpdate::Latest; } let now = Instant::now(); let few_millisecs_from_now = @@ -416,11 +416,11 @@ impl ImgSequencePlayer

{ LoadRequest::Jump(0) => { // Waiting on current image to be loaded. next_update = - gelatin::NextUpdate::WaitUntil(few_millisecs_from_now); + NextUpdate::WaitUntil(few_millisecs_from_now); } _ => { image_cache.prefetch_neighbors(); - next_update = gelatin::NextUpdate::Latest; + next_update = NextUpdate::Latest; } } } else if load_request == LoadRequest::None { @@ -432,7 +432,7 @@ impl ImgSequencePlayer

{ let nanos_til_next = frame_delta_time_nanos - elapsed_nanos; let millis_til_next = nanos_til_next / 1_000_000; - next_update = gelatin::NextUpdate::WaitUntil( + next_update = NextUpdate::WaitUntil( now.checked_add(Duration::from_millis( (millis_til_next / 2).max(1) as u64, )) @@ -484,7 +484,7 @@ impl ImgSequencePlayer

{ as i64 { // Just buisy wait if we are getting very close to the next frame swap - next_update = gelatin::NextUpdate::Soonest; + next_update = NextUpdate::Soonest; } else { match self.playback_state { PlaybackState::RandomPresent => { @@ -500,13 +500,13 @@ impl ImgSequencePlayer

{ } } else { next_update = - gelatin::NextUpdate::WaitUntil(few_millisecs_from_now); + NextUpdate::WaitUntil(few_millisecs_from_now); } match load_request { LoadRequest::None | LoadRequest::FilePath(..) => (), _ => { if image_cache.current_dir_len() == Some(0) { - return gelatin::NextUpdate::Latest; + return NextUpdate::Latest; } } } @@ -539,7 +539,7 @@ impl ImgSequencePlayer

{ // next time we attempt to load this again. self.load_request = LoadRequest::Jump(0); next_update = - gelatin::NextUpdate::WaitUntil(few_millisecs_from_now); + NextUpdate::WaitUntil(few_millisecs_from_now); } Err(err) => { self.image_texture = None; diff --git a/alloy/src/shaders.rs b/src/shaders.rs similarity index 100% rename from alloy/src/shaders.rs rename to src/shaders.rs diff --git a/alloy/src/shaders/fragment_110.glsl b/src/shaders/fragment_110.glsl similarity index 100% rename from alloy/src/shaders/fragment_110.glsl rename to src/shaders/fragment_110.glsl diff --git a/alloy/src/shaders/fragment_140.glsl b/src/shaders/fragment_140.glsl similarity index 100% rename from alloy/src/shaders/fragment_140.glsl rename to src/shaders/fragment_140.glsl diff --git a/gelatin/src/shaders/vertex_110.glsl b/src/shaders/vertex_110.glsl similarity index 100% rename from gelatin/src/shaders/vertex_110.glsl rename to src/shaders/vertex_110.glsl diff --git a/gelatin/src/shaders/vertex_140.glsl b/src/shaders/vertex_140.glsl similarity index 100% rename from gelatin/src/shaders/vertex_140.glsl rename to src/shaders/vertex_140.glsl diff --git a/alloy/src/utils.rs b/src/utils.rs similarity index 99% rename from alloy/src/utils.rs rename to src/utils.rs index 25d75f35..d448cde6 100644 --- a/alloy/src/utils.rs +++ b/src/utils.rs @@ -1,4 +1,4 @@ -use gelatin::glium::glutin::event::VirtualKeyCode; +use crate::gelatin::glium::glutin::event::VirtualKeyCode; pub fn virtual_keycode_is_char(vk: VirtualKeyCode) -> bool { #[allow(clippy::match_like_matches_macro)] diff --git a/alloy/src/version.rs b/src/version.rs similarity index 100% rename from alloy/src/version.rs rename to src/version.rs diff --git a/alloy/src/widgets/bottom_bar.rs b/src/widgets/bottom_bar.rs similarity index 99% rename from alloy/src/widgets/bottom_bar.rs rename to src/widgets/bottom_bar.rs index 4762a193..2a5dddad 100644 --- a/alloy/src/widgets/bottom_bar.rs +++ b/src/widgets/bottom_bar.rs @@ -1,6 +1,6 @@ use std::{f32, rc::Rc}; -use gelatin::{ +use crate::gelatin::{ button::Button, line_layout_container::HorizontalLayoutContainer, misc::{Alignment, Length}, diff --git a/alloy/src/widgets/copy_notification.rs b/src/widgets/copy_notification.rs similarity index 96% rename from alloy/src/widgets/copy_notification.rs rename to src/widgets/copy_notification.rs index 1df31f49..5f323da0 100644 --- a/alloy/src/widgets/copy_notification.rs +++ b/src/widgets/copy_notification.rs @@ -3,7 +3,7 @@ use std::{ time::{Duration, Instant}, }; -use gelatin::{label::Label, misc::*, picture::Picture, NextUpdate, Widget}; +use crate::gelatin::{label::Label, misc::*, picture::Picture, NextUpdate, Widget}; static COPY_STARTED: &[u8] = include_bytes!("../../resource/copy-started.png"); static COPY_READY: &[u8] = include_bytes!("../../resource/copy-ready.png"); diff --git a/alloy/src/widgets/help_screen.rs b/src/widgets/help_screen.rs similarity index 94% rename from alloy/src/widgets/help_screen.rs rename to src/widgets/help_screen.rs index afb10904..1b8972dc 100644 --- a/alloy/src/widgets/help_screen.rs +++ b/src/widgets/help_screen.rs @@ -1,7 +1,8 @@ use std::{cell::RefCell, rc::Rc}; -use gelatin::{ - add_common_widget_functions, +use crate::add_common_widget_functions; +use crate::gelatin::{ + glium, cgmath::{Matrix4, Vector3}, glium::{uniform, Frame, Surface}, misc::{Alignment, Length, LogicalRect, LogicalVector, WidgetPlacement}, @@ -70,7 +71,7 @@ impl Widget for HelpScreen { target: &mut Frame, context: &DrawContext, ) -> Result { - use gelatin::glium::{Blend, BlendingFunction, LinearBlendingFactor}; + use glium::{Blend, BlendingFunction, LinearBlendingFactor}; { let borrowed = self.data.borrow(); if !borrowed.visible { @@ -86,7 +87,7 @@ impl Widget for HelpScreen { Matrix4::from_translation(pos.extend(0.0)) * transform; // Projection let transform = context.projection_transform * transform; - let image_draw_params = gelatin::glium::DrawParameters { + let image_draw_params = glium::DrawParameters { viewport: Some(*context.viewport), blend: Blend { color: BlendingFunction::Addition { @@ -133,13 +134,13 @@ impl Widget for HelpScreen { let sampler = texture .sampled() .wrap_function( - gelatin::glium::uniforms::SamplerWrapFunction::Clamp, + glium::uniforms::SamplerWrapFunction::Clamp, ) .minify_filter( - gelatin::glium::uniforms::MinifySamplerFilter::Linear, + glium::uniforms::MinifySamplerFilter::Linear, ) .magnify_filter( - gelatin::glium::uniforms::MagnifySamplerFilter::Linear, + glium::uniforms::MagnifySamplerFilter::Linear, ); let uniforms = uniform! { matrix: Into::<[[f32; 4]; 4]>::into(transform), diff --git a/alloy/src/widgets/mod.rs b/src/widgets/mod.rs similarity index 100% rename from alloy/src/widgets/mod.rs rename to src/widgets/mod.rs diff --git a/alloy/src/widgets/picture_widget.rs b/src/widgets/picture_widget.rs similarity index 99% rename from alloy/src/widgets/picture_widget.rs rename to src/widgets/picture_widget.rs index a1fe57da..5064100d 100644 --- a/alloy/src/widgets/picture_widget.rs +++ b/src/widgets/picture_widget.rs @@ -6,11 +6,12 @@ use std::{ time::{Duration, Instant}, }; -use gelatin::{ - add_common_widget_functions, +use crate::gelatin::{ application::request_exit, + cgmath, cgmath::{Matrix4, Vector2, Vector3}, glium::{ + self, glutin::event::{ElementState, ModifiersState, MouseButton}, program, uniform, uniforms::MagnifySamplerFilter, @@ -26,6 +27,7 @@ use super::{ help_screen::HelpScreen, }; use crate::{ + add_common_widget_functions, clipboard_handler::ClipboardHandler, configuration::{Antialias, Cache, Configuration}, image_cache::{image_loader::Orientation, AnimationFrameTexture}, @@ -1087,10 +1089,10 @@ fn draw_tex_grid( ) { let size = data.drawn_bounds.size.vec; let projection_transform = - gelatin::cgmath::ortho(0.0, size.x, size.y, 0.0, -1.0, 1.0); + cgmath::ortho(0.0, size.x, size.y, 0.0, -1.0, 1.0); let viewport_rect = context.logical_rect_to_viewport(&data.drawn_bounds); - let image_draw_params = gelatin::glium::DrawParameters { + let image_draw_params = glium::DrawParameters { viewport: Some(viewport_rect), ..Default::default() }; @@ -1177,8 +1179,8 @@ fn draw_tex_grid( let sampler = cell_tex .tex .sampled() - .minify_filter(gelatin::glium::uniforms::MinifySamplerFilter::LinearMipmapLinear) - .wrap_function(gelatin::glium::uniforms::SamplerWrapFunction::Clamp); + .minify_filter(glium::uniforms::MinifySamplerFilter::LinearMipmapLinear) + .wrap_function(glium::uniforms::SamplerWrapFunction::Clamp); let filter = match data.antialiasing { Antialias::Auto