From 2ba7fd0536452e21da57bc13fdf83bd0ac67b467 Mon Sep 17 00:00:00 2001 From: Sijmen Schoon Date: Wed, 28 Nov 2018 02:00:50 +0100 Subject: [PATCH] Implement early sprite and palette editors --- Cargo.lock | 536 +++++++++++++++--------------------------- Cargo.toml | 10 +- src/main.rs | 60 +++-- src/palette_editor.rs | 120 ++++++++++ src/sprite_editor.rs | 95 ++++++++ src/util.rs | 36 +++ 6 files changed, 478 insertions(+), 379 deletions(-) create mode 100644 src/palette_editor.rs create mode 100644 src/sprite_editor.rs create mode 100644 src/util.rs diff --git a/Cargo.lock b/Cargo.lock index 8bc2100..cabb11d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,19 +1,10 @@ -[[package]] -name = "aho-corasick" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "atk-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -23,253 +14,204 @@ name = "bitflags" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "byteorder" -version = "1.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "bytes" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "c_vec" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cairo-rs" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cairo-sys-rs" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "cc" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cfg-if" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "env_logger" -version = "0.4.3" +name = "fragile" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "futures" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "futures-glib" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", - "slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] [[package]] name = "gdk" -version = "0.7.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-pixbuf-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gdk-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio" -version = "0.3.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gio-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "glib-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gobject-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk" -version = "0.3.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "gtk-sys" -version = "0.5.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "iovec" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lazy_static" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "lazy_static" version = "1.2.0" @@ -280,14 +222,6 @@ name = "libc" version = "0.2.44" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "log" version = "0.4.6" @@ -296,47 +230,27 @@ dependencies = [ "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "memchr" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "net2" -version = "0.2.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "pango" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pango-sys" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", + "pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "pango-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -347,183 +261,124 @@ version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "quote" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "regex" -version = "0.2.11" +name = "proc-macro2" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", - "utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "regex-syntax" -version = "0.5.6" +name = "quote" +version = "0.6.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures-glib 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", - "glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-state 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-state 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-attributes" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-gen-widget 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-gen-widget 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-core" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-glib 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", + "glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-derive" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-derive-common 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-gen-widget 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-derive-common 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-gen-widget 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-derive-common" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-gen-widget 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-gen-widget 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-gen-widget" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "relm-state" -version = "0.11.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "futures-glib 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "slab" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "snes_sprite_edit" version = "0.1.0" dependencies = [ - "gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "relm 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-attributes 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "relm-derive 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-attributes 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "relm-derive 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "syn" -version = "0.11.11" +version = "0.14.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)", - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "synom" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "thread_local" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "tokio-io" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "ucd-util" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "unicode-xid" -version = "0.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "utf8-ranges" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "version_check" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "winapi" -version = "0.2.8" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -546,60 +401,41 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e" -"checksum atk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "33a67fd81e1922dddc335887516f2f5254534e89c9d39fa89bca5d79bd150d34" +"checksum atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7017e53393e713212aed7aea336b6553be4927f58c37070a56c2fe3d107e489" "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" -"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d" -"checksum bytes 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "40ade3d27603c2cb345eb0912aec461a6dec7e06a4ae48589904e808335c7afa" -"checksum c_vec 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "6237ac5a4b1e81c213c24c6437964c61e646df910a914b4ab1487b46df20bd13" -"checksum cairo-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b6b5695f59fd036fe5741bc5a4eb20c78fbe42256e3b08a2af26bbcbe8070bf3" -"checksum cairo-sys-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c6e18fecaeac51809db57f45f4553cc0975225a7eb435a7a7e91e5e8113a84d" +"checksum cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd940f0d609699e343ef71c4af5f66423afbf30d666f796dabd8fd15229cf5b6" +"checksum cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d25596627380be4381247dba06c69ad05ca21b3b065bd9827e416882ac41dcd2" +"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" -"checksum env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3ddf21e73e016298f5cb37d6ef8e8da8e39f91f9ec8b0df44b7deb16a9f8cd5b" -"checksum futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)" = "49e7653e374fe0d0c12de4250f0bdb60680b8c80eed558c5c7538eec9c89e21b" -"checksum futures-glib 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "fce6cfbf26d780bf8ddad369ad4cd2be7837c8d0bf65025e35bd75d6c7f4fc76" -"checksum gdk 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e51db95be6565011bcd5cd99f9b17fdd585001057a999b21e09f1e8c28deb9" -"checksum gdk-pixbuf 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "16160d212ae91abe9f3324c3fb233929ba322dde63585d15cda3336f8c529ed1" -"checksum gdk-pixbuf-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "798f97101eea8180da363d0e80e07ec7ec6d1809306601c0100c1de5bc8b4f52" -"checksum gdk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d4ee916f5f25c5f4b21bd9dcb12a216ae697406940ff9476358c308a8ececada" -"checksum gio 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "84ba5a2beb559059a0c9c2bd3681743cdede8d9a36c775840bca800333b22867" -"checksum gio-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a303bbf7a5e75ab3b627117ff10e495d1b9e97e1d68966285ac2b1f6270091bc" -"checksum glib 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b9b0452824cc63066940f01adc721804919f0b76cdba3cfab977b00b87f16d4a" -"checksum glib-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9693049613ff52b93013cc3d2590366d8e530366d288438724b73f6c7dc4be8" -"checksum gobject-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60d507c87a71b1143c66ed21a969be9b99a76df234b342d733e787e6c9c7d7c2" -"checksum gtk 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0847c507e52c1feaede13ef56fb4847742438602655449d5f1f782e8633f146f" -"checksum gtk-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "905fcfbaaad1b44ec0b4bba9e4d527d728284c62bc2ba41fccedace2b096766f" -"checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73" +"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9" +"checksum gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc52c7244046df9d959df87289f1fc5cca23f9f850bab0c967963e2ecb83a96" +"checksum gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc3aa730cb4df3de5d9fed59f43afdf9e5fb2d3d10bfcbd04cec031435ce87f5" +"checksum gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08284f16ce4d909b10d785a763ba190e222d2c1557b29908bf0a661e27a8ac3b" +"checksum gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "108548ebf5329b551f2b97ab356908d14627905abb74b936c3372de1535aee81" +"checksum gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "29a44b051990573448edc80b1995237f8b97b5734d2aec05105b9242aa10af11" +"checksum gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6975ada29f7924dc1c90b30ed3b32d777805a275556c05e420da4fbdc22eb250" +"checksum glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "740f7fda8dde5f5e3944dabdb4a73ac6094a8a7fdf0af377468e98ca93733e61" +"checksum glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3573351e846caed9f11207b275cd67bc07f0c2c94fb628e5d7c92ca056c7882d" +"checksum gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08475e4a08f27e6e2287005950114735ed61cec2cb8c1187682a5aec8c69b715" +"checksum gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a6b30f194f09a17bb7ffa95c3ecdb405abd3b75ff981f831b1f6d18fe115ff" +"checksum gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d487d333a4b87072e6bf9f2e55befa0ebef01b9496c2e263c0f4a1ff3d6c04b1" "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" "checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16" -"checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum pango 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3e81c404ab81ea7ea2fc2431a0a7672507b80e4b8bf4b41eac3fc83cc665104e" -"checksum pango-sys 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34f34a1be107fe16abb2744e0e206bee4b3b07460b5fddd3009a6aaf60bd69ab" +"checksum pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c2cb169402a3eb1ba034a7cc7d95b8b1c106e9be5ba4be79a5a93dc1a2795f4" +"checksum pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6eb49268e69dd0c1da5d3001a61aac08e2e9d2bfbe4ae4b19b9963c998f6453" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" -"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a" -"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384" -"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7" -"checksum relm 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "29bdde2164a4b2ea3cfbe89f73648176938d36654b57611e7bfea44fd71a6c40" -"checksum relm-attributes 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "698fb45ee55278de6c4717cbda0037c0ae04eff4c7f8a7d35fe5042debe2d112" -"checksum relm-core 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6be30f39af38a853b7695d81b6fdd0c69ffdd4bb4ef3d3fd0d1617fcffdfa002" -"checksum relm-derive 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "41ff9e92f6f3d88f942a78793469c203e425b813c99e18efbdf869cb90695900" -"checksum relm-derive-common 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ef68c4d05df4bc5986f9807cc126840b82760920c4d7224495aeb20a6d7b299" -"checksum relm-gen-widget 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3b59b1f20942f3885b57be7346f927896a2cdc12220e62a53a080dee2b41f2cf" -"checksum relm-state 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "87d21bb589ca286655b37a4f15bb178e8adf49220f19c7a49c4328ed140e2905" -"checksum slab 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5f9776d6b986f77b35c6cf846c11ad986ff128fe0b2b63a3628e3755e8d3102d" -"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" -"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" -"checksum tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "7392fe0a70d5ce0c882c4778116c519bd5dbaa8a7c3ae3d04578b3afafdcda21" -"checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" -"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" -"checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737" -"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" -"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" +"checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" +"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" +"checksum relm 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f0e436c1a6c2bb24461c24459db5286bec585dcb633222306d972aa9371f0ace" +"checksum relm-attributes 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bc17da924f12f137ec48e7aac5e2a23ece4beaa44c638c53dfe126aed2512ad" +"checksum relm-core 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f0b2155c285ae2ae4c111a1b9b22fdbd1aa7f45194474e62a092e5025dcccdd" +"checksum relm-derive 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ba5280a61b4f9c0f41f6c54333f73263d94ea39f6dee7c538ddc1de22578a" +"checksum relm-derive-common 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0ffcfd0e3a79304cdb1f744021dc1c6bcb2b55f8c232ca6b2a859ed294cf08f9" +"checksum relm-gen-widget 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5e55bebf48df7db74f73a37461bcc87d7ec181cfc6bf571c195fdd3a4c889679" +"checksum relm-state 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94ba35978d79950efd33d04d19b2209c923bb15a954200788a2052e9f0bf6630" +"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741" +"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" diff --git a/Cargo.toml b/Cargo.toml index b3124d9..c6365a0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,9 @@ authors = ["Sijmen Schoon "] edition = "2018" [dependencies] -gtk = "^0.3.0" -relm = "^0.11.0" -relm-derive = "^0.11.0" -relm-attributes = "^0.11.0" +gtk = "^0.5.0" +gtk-sys = "0.7.0" +gdk = "^0.9.0" +relm = "^0.15.0" +relm-derive = "^0.15.0" +relm-attributes = "^0.15.0" diff --git a/src/main.rs b/src/main.rs index c0c0604..d89d05b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,52 +8,62 @@ use gtk::prelude::*; use relm::Widget; use relm_attributes::widget; -pub struct Model { - counter: u32, +mod palette_editor; +mod sprite_editor; +pub mod util; + +use self::palette_editor::PaletteEditorMsg::{Initialize as PEInitialize, PaletteUpdate}; +use self::palette_editor::PaletteEditorWidget; + +use self::sprite_editor::SpriteEditorMsg::{self, Initialize as SEInitialize}; +use self::sprite_editor::SpriteEditorWidget; + +pub struct WinModel { + palette: Vec, } #[derive(Msg)] -pub enum Msg { - Decrement, - Increment, +pub enum WinMsg { Quit, } #[widget] impl Widget for Win { - fn model() -> Model { - Model { counter: 0 } + fn model() -> WinModel { + WinModel { + palette: vec![ + 0x7fe0, 0x7fff, 0x0000, 0x446b, 0x6cf4, 0x7ddb, 0x7f1a, 0x76c0, 0x2800, 0x7dc8, + 0x1226, 0x2270, 0x433b, 0x5985, 0x7dae, 0x7c1f, + ], + } } - fn update(&mut self, event: Msg) { + fn update(&mut self, event: WinMsg) { match event { - Msg::Decrement => self.model.counter -= 1, - Msg::Increment => self.model.counter += 1, - Msg::Quit => gtk::main_quit(), + WinMsg::Quit => gtk::main_quit(), } } view! { + #[name="window"] gtk::Window { gtk::Box { orientation: gtk::Orientation::Horizontal, - gtk::Button { - clicked => Msg::Increment, - label: "Increment", - }, + gtk::Box { + orientation: gtk::Orientation::Vertical, + child: { expand: true }, - gtk::Label { - text: &self.model.counter.to_string(), - }, + #[name="sprite_editor"] + SpriteEditorWidget { SEInitialize: self.model.palette.clone() }, - gtk::Button { - clicked => Msg::Decrement, - label: "Decrement", - }, - - delete_event(_, _) => (Msg::Quit, Inhibit(false)), - } + PaletteEditorWidget { + PEInitialize: (window.clone(), self.model.palette.clone()), + PaletteUpdate(i, color) => sprite_editor@SpriteEditorMsg::Palette(i, color), + }, + } + }, + delete_event(_, _) => (WinMsg::Quit, Inhibit(false)), } } diff --git a/src/palette_editor.rs b/src/palette_editor.rs new file mode 100644 index 0000000..56069da --- /dev/null +++ b/src/palette_editor.rs @@ -0,0 +1,120 @@ +use gdk; +use gtk; +use gtk::prelude::*; +use gtk_sys; +use relm::{DrawHandler, Relm, Widget}; +use relm_attributes::widget; + +use super::util; + +#[derive(Msg)] +pub enum PaletteEditorMsg { + Draw, + ButtonPress(gdk::EventButton), + Initialize((gtk::Window, Vec)), + PaletteUpdate(u8, u16), +} + +pub struct PaletteEditorModel { + draw_handler: DrawHandler, + palette: Vec, + window: Option, + relm: Relm, +} + +#[widget] +impl Widget for PaletteEditorWidget { + fn model(relm: &Relm, _: ()) -> PaletteEditorModel { + PaletteEditorModel { + draw_handler: DrawHandler::new().unwrap(), + palette: vec![0; 16], + window: None, + relm: relm.clone(), + } + } + + fn init_view(&mut self) { + self.model.draw_handler.init(&self.drawing_area); + self.drawing_area + .add_events(gdk::EventMask::BUTTON_PRESS_MASK.bits() as i32); + } + + fn get_scale(&self) -> f64 { + let allocation = self.drawing_area.get_allocation(); + allocation.width as f64 / 8.0 + } + + fn update(&mut self, event: PaletteEditorMsg) { + match event { + PaletteEditorMsg::Draw => { + // Determine the scale we should render at + // (i.e. the size of the pixels). + let scale = self.get_scale(); + let context = self.model.draw_handler.get_context(); + + for (i, color) in self.model.palette.iter().enumerate() { + if i == 0 { + continue; + } + + let x = (i % 8) as f64 * scale; + let y = (i / 8) as f64 * scale; + + let (r, g, b) = util::r5g5b5_to_rgb(*color); + context.set_source_rgb(r, g, b); + + context.rectangle(x, y, scale, scale); + context.fill(); + } + } + + PaletteEditorMsg::ButtonPress(event) => { + let scale = self.get_scale(); + let (x, y) = event.get_coords().unwrap(); + + let i = (x / scale) as u8 + (y / scale) as u8 * 8; + if i == 0 { + return; + } + + if let Some(window) = &self.model.window { + let dialog = gtk::ColorChooserDialog::new(Some("Select a color"), Some(window)); + dialog.set_rgba(&util::palette_to_gdk_rgba(&self.model.palette, i)); + + let result = dialog.run(); + if result == gtk_sys::GTK_RESPONSE_OK { + let new_color = util::gdk_rgba_to_r5g5b5(&dialog.get_rgba()); + self.model + .relm + .stream() + .emit(PaletteEditorMsg::PaletteUpdate(i, new_color)); + } + + dialog.destroy(); + } + } + + PaletteEditorMsg::Initialize((window, palette)) => { + self.model.window = Some(window); + self.model.palette = palette; + } + + PaletteEditorMsg::PaletteUpdate(i, color) => self.model.palette[i as usize] = color, + } + } + + view! { + #[container] + gtk::AspectFrame { + child: { expand: true }, + property_ratio: 8.0 / 2.0, + property_obey_child: false, + + #[name="drawing_area"] + gtk::DrawingArea { + draw(_, _) => (PaletteEditorMsg::Draw, Inhibit(false)), + button_press_event(_, event) => (PaletteEditorMsg::ButtonPress(event.clone()), Inhibit(false)), + } + } + } +} diff --git a/src/sprite_editor.rs b/src/sprite_editor.rs new file mode 100644 index 0000000..ca0fde5 --- /dev/null +++ b/src/sprite_editor.rs @@ -0,0 +1,95 @@ +use gtk; +use gtk::prelude::*; +use relm::DrawHandler; +use relm::Widget; +use relm_attributes::widget; + +use super::util; + +#[derive(Msg)] +pub enum SpriteEditorMsg { + UpdateDrawBuffer, + Palette(u8, u16), + Initialize(Vec), +} + +pub struct SpriteEditorModel { + draw_handler: DrawHandler, + sprite_data: Vec>, + sprite_size: i32, + palette: Vec, +} + +#[widget] +impl Widget for SpriteEditorWidget { + fn model() -> SpriteEditorModel { + SpriteEditorModel { + draw_handler: DrawHandler::new().unwrap(), + sprite_data: vec![ + vec![0, 2, 2, 2, 2, 2, 2, 2], + vec![0, 0, 0, 0, 14, 2, 14, 2], + vec![0, 0, 3, 3, 6, 2, 6, 2], + vec![0, 3, 6, 6, 6, 6, 6, 6], + vec![0, 3, 14, 14, 14, 14, 14, 2], + vec![0, 0, 2, 2, 2, 2, 2, 2], + vec![0, 0, 0, 2, 2, 2, 2, 14], + vec![0, 0, 0, 0, 0, 10, 3, 3], + ], + sprite_size: 8, + palette: vec![0; 16], + } + } + + fn init_view(&mut self) { + self.model.draw_handler.init(&self.drawing_area); + } + + fn update(&mut self, event: SpriteEditorMsg) { + match event { + SpriteEditorMsg::UpdateDrawBuffer => { + // Determine the scale we should render at + // (i.e. the size of the pixels). + let allocation = self.drawing_area.get_allocation(); + let scale = allocation.width as f64 / self.model.sprite_size as f64; + let context = self.model.draw_handler.get_context(); + + // TODO Might want to look into making this more efficient. + // Looping over pixels is never a good idea. + for (y, row) in self.model.sprite_data.iter().enumerate() { + let ypos = y as f64 * scale; + + for (x, pixel) in row.iter().enumerate() { + if *pixel == 0 { + continue; + } + + let xpos = x as f64 * scale; + + let (r, g, b) = util::palette_to_rgb(&self.model.palette, *pixel); + context.set_source_rgb(r, g, b); + + // Draw the pixel. + context.rectangle(xpos, ypos, scale, scale); + context.fill(); + } + } + } + + SpriteEditorMsg::Initialize(palette) => self.model.palette = palette, + SpriteEditorMsg::Palette(i, color) => self.model.palette[i as usize] = color, + } + } + + view! { + gtk::AspectFrame { + child: { expand: true }, + property_ratio: 1.0, + property_obey_child: false, + + #[name="drawing_area"] + gtk::DrawingArea { + draw(_, _) => (SpriteEditorMsg::UpdateDrawBuffer, Inhibit(false)), + } + } + } +} diff --git a/src/util.rs b/src/util.rs new file mode 100644 index 0000000..cd6c6ca --- /dev/null +++ b/src/util.rs @@ -0,0 +1,36 @@ +use gdk::RGBA; + +pub fn palette_to_rgb(palette: &Vec, c: u8) -> (f64, f64, f64) { + let color = palette[c as usize]; + r5g5b5_to_rgb(color) +} + +pub fn r5g5b5_to_rgb(color: u16) -> (f64, f64, f64) { + let r = ((color >> 10) & 0x1Fu16) as f64 / 31.0; + let g = ((color >> 5) & 0x1Fu16) as f64 / 31.0; + let b = ((color >> 0) & 0x1Fu16) as f64 / 31.0; + + (r, g, b) +} + +pub fn palette_to_gdk_rgba(palette: &Vec, c: u8) -> RGBA { + let (r, g, b) = palette_to_rgb(&palette, c); + RGBA { + red: r, + green: g, + blue: b, + alpha: 1.0, + } +} + +pub fn rgb_to_r5g5b5(red: f64, green: f64, blue: f64) -> u16 { + let r = (red * 31.0) as u16; + let g = (green * 31.0) as u16; + let b = (blue * 31.0) as u16; + + r << 10 | g << 5 | b << 0 +} + +pub fn gdk_rgba_to_r5g5b5(rgba: &RGBA) -> u16 { + rgb_to_r5g5b5(rgba.red, rgba.green, rgba.blue) +}