Merge branch 'ref/rust' into 'main'
refactor: rewrite codebase to Rust Closes #2 and #7 See merge request EchidnaHQ/Echidna!8merge-requests/9/merge
commit
70b8a456e5
|
@ -0,0 +1,65 @@
|
|||
#
|
||||
# Stolen from https://github.com/kigster/cmake-project-template/blob/master/.gitignore
|
||||
#
|
||||
|
||||
# Compiled Object files
|
||||
**/.DS_Store
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
**/cmake-build-debug
|
||||
**/CMakeCache.txt
|
||||
**/cmake_install.cmake
|
||||
**/install_manifest.txt
|
||||
**/CMakeFiles/
|
||||
**/CTestTestfile.cmake
|
||||
**/Makefile
|
||||
**/*.cbp
|
||||
**/CMakeScripts
|
||||
**/compile_commands.json
|
||||
|
||||
include/divisible/*
|
||||
|
||||
|
||||
## Local
|
||||
|
||||
.idea/*.xml
|
||||
|
||||
build/**/*
|
||||
|
||||
include/*
|
||||
lib/*
|
||||
bin/*
|
||||
test/test_runner
|
||||
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
|
@ -0,0 +1,947 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
|
||||
[[package]]
|
||||
name = "anyhow"
|
||||
version = "1.0.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1"
|
||||
|
||||
[[package]]
|
||||
name = "autocfg"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
||||
|
||||
[[package]]
|
||||
name = "bumpalo"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.14.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9164355c892b026d6257e696dde5f3cb39beb3718297f0f161b562fe2ee3ab86"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-sys-rs",
|
||||
"glib",
|
||||
"libc",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cairo-sys-rs"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-expr"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-expr"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "edae0b9625d1fce32f7d64b71784d9b1bf8469ec1a9c417e44aaf16a9cbd7571"
|
||||
dependencies = [
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cfg-if"
|
||||
version = "1.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||
|
||||
[[package]]
|
||||
name = "echidna"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"gdk4",
|
||||
"gio",
|
||||
"glib",
|
||||
"gtk4",
|
||||
"once_cell",
|
||||
"relative-path",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sourceview5",
|
||||
"webbrowser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
|
||||
[[package]]
|
||||
name = "field-offset"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92"
|
||||
dependencies = [
|
||||
"memoffset",
|
||||
"rustc_version",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-channel"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-core"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d"
|
||||
|
||||
[[package]]
|
||||
name = "futures-executor"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c"
|
||||
dependencies = [
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"futures-util",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "futures-io"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377"
|
||||
|
||||
[[package]]
|
||||
name = "futures-task"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99"
|
||||
|
||||
[[package]]
|
||||
name = "futures-util"
|
||||
version = "0.3.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
"futures-core",
|
||||
"futures-task",
|
||||
"pin-project-lite",
|
||||
"pin-utils",
|
||||
"slab",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-pixbuf"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
|
||||
dependencies = [
|
||||
"gdk-pixbuf-sys",
|
||||
"gio",
|
||||
"glib",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-pixbuf-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
|
||||
dependencies = [
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk4"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c0f7f98ad25b81ac9462f74a091b0e4c0983ed1e74d19a38230c772b4dcef81"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"gdk-pixbuf",
|
||||
"gdk4-sys",
|
||||
"gio",
|
||||
"glib",
|
||||
"libc",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk4-sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "262a79666b42e1884577f11a050439a964b95dec55343ac6ace7930e1415fa18"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"graphene-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps 4.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.14.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f3a29d8062af72045518271a2cd98b4e1617ce43f5b4223ad0fb9a0eff8f718c"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-io",
|
||||
"gio-sys",
|
||||
"glib",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"thiserror",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4a930b7208e6e0ab839eea5f65ac2b82109f729621430d47fe905e2e09d33f4"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"futures-channel",
|
||||
"futures-core",
|
||||
"futures-executor",
|
||||
"futures-task",
|
||||
"glib-macros",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"smallvec",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-macros"
|
||||
version = "0.14.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "graphene-rs"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1460a39f06e491e6112f27e71e51435c833ba370723224dd1743dfd1f201f19"
|
||||
dependencies = [
|
||||
"glib",
|
||||
"graphene-sys",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "graphene-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e7d23fb7a9547e5f072a7e0cd49cd648fedeb786d122b106217511980cbb8962"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gsk4"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20b71f2e2cc699c2e0fbfa22899eeaffd84f9c1dc01e9263deac8664eec22dc0"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"gdk4",
|
||||
"glib",
|
||||
"graphene-rs",
|
||||
"gsk4-sys",
|
||||
"libc",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gsk4-sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "30468aff80e4faadf22f9ba164ea17511a69a9995d7a13827a13424ef47b2472"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk4-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"graphene-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps 4.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk4"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "906f9308d15789d96a736881582181d710ae0937197119df459f3d2b46ef6776"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"field-offset",
|
||||
"futures-channel",
|
||||
"gdk-pixbuf",
|
||||
"gdk4",
|
||||
"gio",
|
||||
"glib",
|
||||
"graphene-rs",
|
||||
"gsk4",
|
||||
"gtk4-macros",
|
||||
"gtk4-sys",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"pango",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk4-macros"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4d0d008cdf23214c697482415dd20f666bdf3cc9f5e803b017223c17c5b59a6e"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"heck",
|
||||
"itertools",
|
||||
"proc-macro-crate",
|
||||
"proc-macro-error",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk4-sys"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d06be0a6322aa77dd372f726e97efbcbb192d9a824a414a8874f238effd7747c"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk4-sys",
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"graphene-sys",
|
||||
"gsk4-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps 4.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c"
|
||||
dependencies = [
|
||||
"unicode-segmentation",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "itoa"
|
||||
version = "0.4.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
|
||||
|
||||
[[package]]
|
||||
name = "js-sys"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
|
||||
dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.102"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2a5ac8f984bfcf3a823267e5fde638acc3325f6496633a5da6bb6eb2171e103"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memoffset"
|
||||
version = "0.6.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
|
||||
dependencies = [
|
||||
"autocfg",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "once_cell"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
|
||||
|
||||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.14.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1fc88307d9797976ea62722ff2ec5de3fae279c6e20100ed3f49ca1a4bf3f96"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"glib",
|
||||
"libc",
|
||||
"once_cell",
|
||||
"pango-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
|
||||
dependencies = [
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"libc",
|
||||
"system-deps 3.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pest"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53"
|
||||
dependencies = [
|
||||
"ucd-trie",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project-lite"
|
||||
version = "0.2.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443"
|
||||
|
||||
[[package]]
|
||||
name = "pin-utils"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.19"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-crate"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83"
|
||||
dependencies = [
|
||||
"thiserror",
|
||||
"toml",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
|
||||
dependencies = [
|
||||
"proc-macro-error-attr",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro-error-attr"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9f5105d4fdaab20335ca9565e106a5d9b82b6219b5ba735731124ac6711d23d"
|
||||
dependencies = [
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3d0b9745dc2debf507c8422de05d7226cc1f0644216dfdfead988f9b1ab32a7"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "relative-path"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9629de8974fd69c97684736786b807edd3da456d3e3f95341dd9d4cbd8f5ad6"
|
||||
|
||||
[[package]]
|
||||
name = "rustc_version"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee"
|
||||
dependencies = [
|
||||
"semver",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e"
|
||||
|
||||
[[package]]
|
||||
name = "semver"
|
||||
version = "0.11.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6"
|
||||
dependencies = [
|
||||
"semver-parser",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "semver-parser"
|
||||
version = "0.10.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7"
|
||||
dependencies = [
|
||||
"pest",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.130"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.130"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.68"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "slab"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c307a32c1c5c437f38c7fd45d753050587732ba8628319fbdf12a7e289ccc590"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "1.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e"
|
||||
|
||||
[[package]]
|
||||
name = "sourceview-sys"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/EchidnaHQ/sourceview#06d42d92effc5cebbc225f4795c52a8d9583d9aa"
|
||||
dependencies = [
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk4-sys",
|
||||
"gio-sys",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"gtk4-sys",
|
||||
"libc",
|
||||
"pango-sys",
|
||||
"system-deps 5.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sourceview5"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/EchidnaHQ/sourceview#06d42d92effc5cebbc225f4795c52a8d9583d9aa"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"cairo-rs",
|
||||
"cairo-sys-rs",
|
||||
"gdk-pixbuf",
|
||||
"gdk-pixbuf-sys",
|
||||
"gdk4",
|
||||
"gdk4-sys",
|
||||
"gio",
|
||||
"gio-sys",
|
||||
"glib",
|
||||
"glib-sys",
|
||||
"gobject-sys",
|
||||
"gtk4",
|
||||
"gtk4-sys",
|
||||
"libc",
|
||||
"pango",
|
||||
"pango-sys",
|
||||
"sourceview-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.21.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2"
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.76"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6f107db402c2c2055242dbf4d2af0e69197202e9faacbef9571bbe47f5a1b84"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"unicode-xid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "3.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"cfg-expr 0.8.1",
|
||||
"heck",
|
||||
"itertools",
|
||||
"pkg-config",
|
||||
"strum",
|
||||
"strum_macros",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "4.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6c1889ab44c2a423ba9ba4d64cd04989b25c0280ca7ade813f05368418722a04"
|
||||
dependencies = [
|
||||
"cfg-expr 0.9.0",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "system-deps"
|
||||
version = "5.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e"
|
||||
dependencies = [
|
||||
"cfg-expr 0.9.0",
|
||||
"heck",
|
||||
"pkg-config",
|
||||
"toml",
|
||||
"version-compare",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "602eca064b2d83369e2b2f34b09c70b605402801927c65c11071ac911d299b88"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bad553cc2c78e8de258400763a647e80e6d1b31ee237275d756f6836d204494c"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "toml"
|
||||
version = "0.5.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ucd-trie"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
|
||||
|
||||
[[package]]
|
||||
name = "version-compare"
|
||||
version = "0.0.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
|
||||
|
||||
[[package]]
|
||||
name = "version_check"
|
||||
version = "0.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe"
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"wasm-bindgen-macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
|
||||
dependencies = [
|
||||
"quote",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.78"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
|
||||
|
||||
[[package]]
|
||||
name = "web-sys"
|
||||
version = "0.3.55"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
|
||||
dependencies = [
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webbrowser"
|
||||
version = "0.5.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ecad156490d6b620308ed411cfee90d280b3cbd13e189ea0d3fada8acc89158a"
|
||||
dependencies = [
|
||||
"web-sys",
|
||||
"widestring",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "widestring"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
@ -0,0 +1,18 @@
|
|||
[package]
|
||||
name = "echidna"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
gtk = { version = "^0.3.0", package = "gtk4" }
|
||||
gio = { version = "^0.14.6", package = "gio" }
|
||||
glib = "^0.14.5"
|
||||
serde_json = "^1.0.68"
|
||||
serde = { version = "^1.0.130", features = ["derive"] }
|
||||
relative-path = "^1.5.0"
|
||||
gdk = { version = "^0.3.0", package = "gdk4"}
|
||||
sourceview = { package = "sourceview5", version = "^0.1.0", git = "https://github.com/EchidnaHQ/sourceview" }
|
||||
webbrowser = { version = "^0.5.5" }
|
||||
once_cell = "1"
|
386
LICENSE
386
LICENSE
|
@ -1,21 +1,373 @@
|
|||
MIT License
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
Copyright (c) 2021 Operation Codebreaker
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
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:
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
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.
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
"clippy::style" = "deny"
|
|
@ -0,0 +1,45 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
use super::super::window::menubar::MenubarImplementedEditor;
|
||||
use super::super::window::EchidnaWindow;
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
use gtk::Application;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
pub struct EchidnaEditor {
|
||||
pub name: &'static str,
|
||||
pub app_id: &'static str,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaEditor {
|
||||
const NAME: &'static str = "EchidnaEditorApplication";
|
||||
type Type = super::EchidnaEditor;
|
||||
type ParentType = Application;
|
||||
|
||||
fn new() -> Self {
|
||||
Self {
|
||||
name: "Echidna Code Editor",
|
||||
app_id: "land.echidna.editor",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaEditor {}
|
||||
|
||||
impl ApplicationImpl for EchidnaEditor {
|
||||
fn activate(&self, app: &Self::Type) {
|
||||
let window = EchidnaWindow::new(app);
|
||||
|
||||
window.setup_menubar();
|
||||
window.set_application(Some(app));
|
||||
|
||||
window.present();
|
||||
}
|
||||
}
|
||||
|
||||
impl GtkApplicationImpl for EchidnaEditor {}
|
|
@ -0,0 +1,34 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub mod imp;
|
||||
|
||||
use glib::wrapper;
|
||||
|
||||
wrapper! {
|
||||
pub struct EchidnaEditor(ObjectSubclass<imp::EchidnaEditor>)
|
||||
@extends gio::Application, gtk::Application,
|
||||
@implements gio::ActionGroup, gio::ActionMap;
|
||||
|
||||
}
|
||||
|
||||
impl Default for EchidnaEditor {
|
||||
fn default() -> Self {
|
||||
Self::new("land.echidna.editor")
|
||||
}
|
||||
}
|
||||
|
||||
impl EchidnaEditor {
|
||||
pub fn new(app_id: &'static str) -> Self {
|
||||
let object = glib::Object::new(&[
|
||||
("application-id", &app_id),
|
||||
("flags", &gio::ApplicationFlags::empty()),
|
||||
]);
|
||||
|
||||
match object {
|
||||
Ok(o) => o,
|
||||
Err(e) => panic!("Error in making EchidnaApplication {}", e),
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<interface>
|
||||
<template class="EchidnaCoreEditor">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
||||
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<child>
|
||||
<object class="GtkSourceView" id="sourceview">
|
||||
<property name="vexpand">1</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="buffer">
|
||||
<object class="GtkSourceBuffer"></object>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSourceMap" id="minimap">
|
||||
<property name="vexpand">1</property>
|
||||
</object>
|
||||
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
|
@ -0,0 +1,72 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use glib::{ParamFlags, ParamSpec, Value};
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
use once_cell::sync::Lazy;
|
||||
use std::cell::RefCell;
|
||||
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(file = "./editor.ui")]
|
||||
pub struct EchidnaCoreEditor {
|
||||
#[template_child]
|
||||
pub minimap: TemplateChild<sourceview::Map>,
|
||||
#[template_child]
|
||||
pub sourceview: TemplateChild<sourceview::View>,
|
||||
pub file: RefCell<sourceview::File>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaCoreEditor {
|
||||
const NAME: &'static str = "EchidnaCoreEditor";
|
||||
type Type = super::EchidnaCoreEditor;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(class: &mut Self::Class) {
|
||||
Self::bind_template(class);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaCoreEditor {
|
||||
fn properties() -> &'static [ParamSpec] {
|
||||
static PROPERTIES: Lazy<Vec<ParamSpec>> = Lazy::new(|| {
|
||||
vec![ParamSpec::new_object(
|
||||
"file",
|
||||
"file",
|
||||
"the file of the editor",
|
||||
sourceview::File::static_type(),
|
||||
ParamFlags::READWRITE,
|
||||
)]
|
||||
});
|
||||
|
||||
PROPERTIES.as_ref()
|
||||
}
|
||||
|
||||
fn set_property(&self, _obj: &Self::Type, _id: usize, value: &Value, spec: &ParamSpec) {
|
||||
match spec.name() {
|
||||
"file" => {
|
||||
let file: sourceview::File = value
|
||||
.get()
|
||||
.expect("The file needs to be a sourceview::File");
|
||||
self.file.replace(file);
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn property(&self, _obj: &Self::Type, _id: usize, spec: &ParamSpec) -> Value {
|
||||
match spec.name() {
|
||||
"file" => self.file.borrow().to_value(),
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl WidgetImpl for EchidnaCoreEditor {}
|
||||
impl BoxImpl for EchidnaCoreEditor {}
|
|
@ -0,0 +1,86 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub mod imp;
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use sourceview::{prelude::*, Buffer, FileExt as SourceFileExt, FileLoader, LanguageManager};
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct EchidnaCoreEditor(ObjectSubclass<imp::EchidnaCoreEditor>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl EchidnaCoreEditor {
|
||||
pub fn new(file: Option<sourceview::File>) -> Self {
|
||||
let this: Self =
|
||||
glib::Object::new(&[]).expect("Failed to create 'EchidnaCoreEditor' component.");
|
||||
let this_imp = this.to_imp();
|
||||
// Without cloning it, for some reasons the Rust compiler complains about &this.to_imp().sourceview not being IsA<sourceview::View>
|
||||
this_imp.minimap.set_view(&this_imp.sourceview.clone());
|
||||
|
||||
if file.is_some() {
|
||||
let file = file.unwrap();
|
||||
let file_location = file
|
||||
.location()
|
||||
.expect("file is required to have a location");
|
||||
|
||||
this.set_property("file", &file)
|
||||
.expect("Could not set the 'file' property of EchidnaCoreEditor");
|
||||
|
||||
let cancellable = gio::Cancellable::new();
|
||||
let filepath = file_location.path().expect("No filepath");
|
||||
let info = file_location
|
||||
.query_info("*", gio::FileQueryInfoFlags::NONE, Some(&cancellable))
|
||||
.expect("Could not query the info for file");
|
||||
|
||||
let content_type = info
|
||||
.content_type()
|
||||
.expect(format!("It does not seem like {:?} has a type", filepath).as_str());
|
||||
{
|
||||
println!(
|
||||
"Opened {} and found its content type is {}.",
|
||||
"file",
|
||||
content_type.to_string()
|
||||
);
|
||||
let buffer = this_imp.sourceview.buffer().downcast::<Buffer>().expect("Cannot downcast the sourceview's buffer. Maybe the sourceview's buffer is not IsA<sourceview::Buffer>.");
|
||||
let language_manager = LanguageManager::new();
|
||||
let language = language_manager.guess_language(
|
||||
Some(&info.name().to_str().expect(
|
||||
"Could not open the file because its name is not supported by Unicode.",
|
||||
)),
|
||||
None,
|
||||
);
|
||||
|
||||
match language {
|
||||
Some(lang) => buffer.set_language(Some(&lang)),
|
||||
None => {}
|
||||
}
|
||||
|
||||
let file_loader: FileLoader = FileLoader::new(&buffer, &file);
|
||||
|
||||
file_loader.load_async(
|
||||
glib::Priority::default(),
|
||||
Some(&cancellable),
|
||||
|_, _| {},
|
||||
|result| {
|
||||
if result.is_err() {
|
||||
panic!(result.err());
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
this
|
||||
}
|
||||
|
||||
pub fn to_imp(&self) -> &imp::EchidnaCoreEditor {
|
||||
imp::EchidnaCoreEditor::from_instance(self)
|
||||
}
|
||||
|
||||
pub fn file(&self) -> sourceview::File {
|
||||
self.property("file").expect("Could not get property 'file' of EchidnaCoreEditor").get::<sourceview::File>().expect("Could not get property 'file' of EchidnaCoreEditor because its type is not IsA<sourceview::File>")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
pub mod app;
|
||||
pub mod editor;
|
||||
pub mod sidebar;
|
||||
pub mod window;
|
|
@ -0,0 +1,30 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
#[derive(Default, CompositeTemplate)]
|
||||
#[template(file = "./sidebar.ui")]
|
||||
pub struct EchidnaSidebar {}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaSidebar {
|
||||
const NAME: &'static str = "EchidnaSidebar";
|
||||
type Type = super::EchidnaSidebar;
|
||||
type ParentType = gtk::Box;
|
||||
|
||||
fn class_init(klass: &mut Self::Class) {
|
||||
Self::bind_template(klass);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaSidebar {}
|
||||
impl WidgetImpl for EchidnaSidebar {}
|
||||
impl BoxImpl for EchidnaSidebar {}
|
|
@ -0,0 +1,13 @@
|
|||
pub mod imp;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct EchidnaSidebar(ObjectSubclass<imp::EchidnaSidebar>)
|
||||
@extends gtk::Box, gtk::Widget,
|
||||
@implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
|
||||
}
|
||||
|
||||
impl EchidnaSidebar {
|
||||
pub fn new() -> Self {
|
||||
glib::Object::new(&[]).expect("Failed to create 'EchidnaSidebar' component.")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="4.5.0" />
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<template class="EchidnaSidebar">
|
||||
<child>
|
||||
<object class="GtkStackSidebar">
|
||||
<property name="stack">
|
||||
<object class="GtkStack">
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<!-- Explorer Tab -->
|
||||
<property name="name">explorer</property>
|
||||
<property name="title">Explorer</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview">
|
||||
<property name="model">liststore1</property>
|
||||
<child></child>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection" id="selection">
|
||||
<signal name="changed" handler="on_treeview_selection_changed" />
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<!-- Search Tab -->
|
||||
<property name="name">search</property>
|
||||
<property name="title">Search</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Search</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackPage">
|
||||
<!-- Extensions Tab -->
|
||||
<property name="name">extensions</property>
|
||||
<property name="title">Extensions</property>
|
||||
<property name="child">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">GTK_ORIENTATION_VERTICAL</property>
|
||||
</object>
|
||||
</property>
|
||||
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
|
@ -0,0 +1,140 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use crate::components::editor::EchidnaCoreEditor;
|
||||
use gio::Cancellable;
|
||||
use glib::{clone, Priority};
|
||||
use gtk::{
|
||||
prelude::*, subclass::prelude::*, FileChooserAction, FileChooserDialog, Label, ResponseType,
|
||||
};
|
||||
use sourceview::{prelude::*, Buffer, File, FileSaver};
|
||||
|
||||
pub trait FileImplementedEditor {
|
||||
fn action_open_file(&self);
|
||||
fn open_file(notebook: >k::Notebook, file: gio::File);
|
||||
fn action_save_file_as(&self);
|
||||
}
|
||||
|
||||
impl FileImplementedEditor for super::EchidnaWindow {
|
||||
/*
|
||||
Open a file and put it in an editor and the opened files bar.
|
||||
|
||||
- Open a file chooser dialog.
|
||||
- Connect a signal to it and get the file choosen.
|
||||
- Read th file's information and
|
||||
- TODO: if it's a plain text,
|
||||
- TODO: Load the file's content
|
||||
- TODO: Create an editor
|
||||
- TODO: Set the editor's content to the file's content.
|
||||
- TODO: Somehow keep track of what file belongs to what editor/opened file bar widget.
|
||||
- TODO: If the user enables Autosave, listen to the editor's changes and automatically save the editor's content.
|
||||
- TODO: Close the editor and the tab widget when the file is closed (triggered by the X button on them).
|
||||
|
||||
Perhaps some of the last points should not be implemented in this function but rather in another function that keeps track of every files.
|
||||
*/
|
||||
fn action_open_file(&self) {
|
||||
let dialog: FileChooserDialog = FileChooserDialog::new(
|
||||
Some("Open a file"),
|
||||
Some(self),
|
||||
FileChooserAction::Open,
|
||||
&[
|
||||
("Cancel", ResponseType::Cancel),
|
||||
("Open", ResponseType::Accept),
|
||||
],
|
||||
);
|
||||
|
||||
dialog.set_visible(true);
|
||||
|
||||
// TODO: Somehow inserts self to this function.
|
||||
// This function sets the callback function as 'static, which for some reasons ban cloning self into it. Idk why.
|
||||
dialog.connect_response(clone!( @weak self as window, =>
|
||||
move |dialog, response| {
|
||||
if response == ResponseType::Accept {
|
||||
let file = dialog.file().expect("");
|
||||
Self::open_file(&super::imp::EchidnaWindow::from_instance(&window).notebook, file);
|
||||
|
||||
}
|
||||
|
||||
dialog.destroy();
|
||||
|
||||
}));
|
||||
}
|
||||
|
||||
fn open_file(notebook: >k::Notebook, file_location: gio::File) {
|
||||
let file = File::builder().location(&file_location).build();
|
||||
let editor_page = EchidnaCoreEditor::new(Some(file));
|
||||
notebook.prepend_page(
|
||||
&editor_page,
|
||||
Some(&Label::new(Some(
|
||||
&file_location
|
||||
.path()
|
||||
.expect("The file's path is missing")
|
||||
.file_name()
|
||||
.expect("Could not get the file name, as it ends with ..")
|
||||
.to_str()
|
||||
.expect("Could not parse the file name, as it is not a valid Unicode."),
|
||||
))),
|
||||
);
|
||||
}
|
||||
|
||||
fn action_save_file_as(&self) {
|
||||
let dialog = FileChooserDialog::new(
|
||||
Some("Save File As"),
|
||||
Some(self),
|
||||
FileChooserAction::Save,
|
||||
&[
|
||||
("Cancel", ResponseType::Cancel),
|
||||
("Save", ResponseType::Accept),
|
||||
],
|
||||
);
|
||||
|
||||
dialog.set_current_name("untitled");
|
||||
|
||||
dialog.show();
|
||||
|
||||
dialog.connect_response(clone!( @weak self as window, =>
|
||||
move |dialog, response| {
|
||||
if response == ResponseType::Accept {
|
||||
let file = dialog.file().expect("");
|
||||
let window_imp = window.to_imp();
|
||||
let page: EchidnaCoreEditor;
|
||||
|
||||
match window_imp.notebook
|
||||
.nth_page(
|
||||
Some(window_imp.notebook
|
||||
.current_page()
|
||||
.expect(
|
||||
"No tabs is the current tab, probably all tabs closed. No files to save"
|
||||
)
|
||||
)
|
||||
).expect(
|
||||
"Couldn't get the page of the current index. Try again."
|
||||
).downcast::<EchidnaCoreEditor>() {
|
||||
Ok(res) => page = res,
|
||||
Err(e) => panic!(format!("We got an error when trying to downcast the current tab page into EchidnaCoreEditor:\n{}", e))
|
||||
}
|
||||
|
||||
let buffer: Buffer = page.to_imp().sourceview.buffer().downcast().expect("Could not downcast the editor's buffer to GtkSourceBuffer.");
|
||||
let cancellable = Cancellable::new();
|
||||
|
||||
let file_saver = FileSaver::with_target(
|
||||
&buffer,
|
||||
&page.file(), &file);
|
||||
file_saver.save_async(
|
||||
Priority::default(),
|
||||
Some(&cancellable),
|
||||
|_, _| {},
|
||||
|result| {
|
||||
if result.is_err() {
|
||||
panic!(format!("Found an error while saving the file:\n{}", result.err().expect("No error")))
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
dialog.destroy();
|
||||
|
||||
}));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use gtk::prelude::*;
|
||||
use gtk::subclass::prelude::*;
|
||||
use gtk::CompositeTemplate;
|
||||
|
||||
#[derive(Debug, Default, CompositeTemplate)]
|
||||
#[template(file = "./window.ui")]
|
||||
pub struct EchidnaWindow {
|
||||
#[template_child]
|
||||
pub notebook: TemplateChild<gtk::Notebook>,
|
||||
#[template_child]
|
||||
pub sidebar: TemplateChild<super::super::sidebar::EchidnaSidebar>,
|
||||
}
|
||||
|
||||
#[glib::object_subclass]
|
||||
impl ObjectSubclass for EchidnaWindow {
|
||||
const NAME: &'static str = "EchidnaWindow";
|
||||
type Type = super::EchidnaWindow;
|
||||
type ParentType = gtk::ApplicationWindow;
|
||||
|
||||
fn class_init(class: &mut Self::Class) {
|
||||
Self::bind_template(class);
|
||||
}
|
||||
|
||||
fn instance_init(obj: &glib::subclass::InitializingObject<Self>) {
|
||||
obj.init_template();
|
||||
}
|
||||
}
|
||||
|
||||
impl ObjectImpl for EchidnaWindow {}
|
||||
|
||||
impl WidgetImpl for EchidnaWindow {}
|
||||
|
||||
impl WindowImpl for EchidnaWindow {}
|
||||
|
||||
impl ApplicationWindowImpl for EchidnaWindow {}
|
||||
|
||||
impl BuildableImpl for EchidnaWindow {}
|
|
@ -0,0 +1,179 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="4.5.0" />
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
<menu id="menu">
|
||||
<submenu>
|
||||
<attribute name="label">File</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">New File</attribute>
|
||||
<attribute name="action">win.new-file</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">New Window</attribute>
|
||||
<attribute name="action">app.new-window</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Open File</attribute>
|
||||
<attribute name="action">win.open-file</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Open Folder</attribute>
|
||||
<attribute name="action">win.open-folder</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Open Workspace</attribute>
|
||||
<attribute name="action">win.open-workspace</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Add Folder to Workspace</attribute>
|
||||
<attribute name="action">win.add-folder-to-workspace</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Save Workspace As</attribute>
|
||||
<attribute name="action">win.save-workspace</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Duplicate Workspace</attribute>
|
||||
<attribute name="action">win.duplicate-workspace</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Save</attribute>
|
||||
<attribute name="action">win.save</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Save As...</attribute>
|
||||
<attribute name="action">win.save-file-as</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Save All</attribute>
|
||||
<attribute name="action">win.save-all</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Close Window</attribute>
|
||||
<attribute name="action">win.close</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Exit</attribute>
|
||||
<attribute name="action">app.exit</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Edit</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Undo</attribute>
|
||||
<attribute name="action">win.undo</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Redo</attribute>
|
||||
<attribute name="action">win.redo</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Cut</attribute>
|
||||
<attribute name="action">win.cut</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Selection</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Select All</attribute>
|
||||
<attribute name="action">win.select-all</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">View</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Open Command Palette</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Go</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Switch Editor</attribute>
|
||||
<attribute name="action">win.switch-editor</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Run</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Start Debugging</attribute>
|
||||
<attribute name="action">win.start-debugging</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Terminal</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">New Terminal</attribute>
|
||||
<attribute name="action">win.new-terminal</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
<submenu>
|
||||
<attribute name="label">Help</attribute>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Get Started</attribute>
|
||||
<attribute name="action">window.get-started</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Show All Commands</attribute>
|
||||
<attribute name="action">win.show-all-commands</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Documentation</attribute>
|
||||
<attribute name="action">app.open-docs</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">View License</attribute>
|
||||
<attribute name="action">app.view-license</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">Search Feature Requests</attribute>
|
||||
<attribute name="action">app.search-feature-requests</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label">Report Issue</attribute>
|
||||
<attribute name="action">app.report-issue</attribute>
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label">About</attribute>
|
||||
<attribute name="action">app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</submenu>
|
||||
</menu>
|
||||
</interface>
|
|
@ -0,0 +1,124 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use super::file::FileImplementedEditor;
|
||||
use super::EchidnaWindow;
|
||||
use gio::{MenuModel, SimpleAction};
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk::AboutDialog;
|
||||
|
||||
pub trait MenubarImplementedEditor {
|
||||
fn setup_menubar(&self);
|
||||
}
|
||||
|
||||
impl MenubarImplementedEditor for EchidnaWindow {
|
||||
fn setup_menubar(&self) {
|
||||
let app = self
|
||||
.application()
|
||||
.expect("self does not have an application set.");
|
||||
let menubuilder = gtk::Builder::from_string(include_str!("./menu.ui"));
|
||||
let menubar: MenuModel = menubuilder
|
||||
.object("menu")
|
||||
.expect("Could not get object 'menu' from builder.");
|
||||
app.set_menubar(Some(&menubar));
|
||||
self.set_show_menubar(true);
|
||||
{
|
||||
let act_exit: SimpleAction = SimpleAction::new("exit", None);
|
||||
app.add_action(&act_exit);
|
||||
|
||||
act_exit.connect_activate(clone!(@weak app =>
|
||||
move |_action, _value| {
|
||||
app.quit();
|
||||
}
|
||||
));
|
||||
}
|
||||
{
|
||||
let act_about: SimpleAction = SimpleAction::new("about", None);
|
||||
app.add_action(&act_about);
|
||||
act_about.connect_activate(|_action, _value| {
|
||||
let about_dialog: AboutDialog = AboutDialog::new();
|
||||
|
||||
about_dialog.set_license_type(gtk::License::Mpl20);
|
||||
about_dialog.set_program_name(Some("Echidna Code Editor"));
|
||||
about_dialog.set_website(Some("https://gitlab.com/EchidnaHQ/Echidna"));
|
||||
about_dialog.set_authors(&["FortressValkriye"]);
|
||||
about_dialog.set_copyright(Some("Made with by ❤️ Echidna contributors"));
|
||||
about_dialog.set_visible(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
//app.notebook = Some(Rc::new(RefCell::new(notebook)));
|
||||
let act_exit: SimpleAction = SimpleAction::new("exit", None);
|
||||
app.add_action(&act_exit);
|
||||
|
||||
act_exit.connect_activate(clone!(@weak app =>
|
||||
move |_action, _value| {
|
||||
app.quit();
|
||||
}
|
||||
));
|
||||
}
|
||||
{
|
||||
let act_about: SimpleAction = SimpleAction::new("about", None);
|
||||
app.add_action(&act_about);
|
||||
act_about.connect_activate(|_action, _value| {
|
||||
let about_dialog: AboutDialog = AboutDialog::new();
|
||||
|
||||
about_dialog.set_license_type(gtk::License::Mpl20);
|
||||
about_dialog.set_program_name(Some("Echidna Code Editor"));
|
||||
about_dialog.set_website(Some("https://github.com/EchidnaHQ/Echidna"));
|
||||
about_dialog.set_authors(&["FortressValkriye"]);
|
||||
about_dialog.set_copyright(Some("Made with by ❤️ Echidna contributors"));
|
||||
about_dialog.set_visible(true);
|
||||
});
|
||||
}
|
||||
{
|
||||
let act_report_issue = SimpleAction::new("report-issue", None);
|
||||
|
||||
app.add_action(&act_report_issue);
|
||||
|
||||
act_report_issue.connect_activate(|_action, _variant| {
|
||||
webbrowser::open("https://github.com/EchidnaHQ/Echidna/issues/new");
|
||||
});
|
||||
}
|
||||
{
|
||||
let act_search_feature_requests = SimpleAction::new("search-feature-requests", None);
|
||||
|
||||
app.add_action(&act_search_feature_requests);
|
||||
|
||||
act_search_feature_requests.connect_activate(|_action, _variant| {
|
||||
webbrowser::open("https://github.com/EchidnaHQ/Echidna/issues?q=is%3Aopen+is%3Aissue+label%3Aenhancement");
|
||||
});
|
||||
}
|
||||
{
|
||||
let act_window_close = SimpleAction::new("close", None);
|
||||
|
||||
self.add_action(&act_window_close);
|
||||
let window = self.clone();
|
||||
|
||||
act_window_close.connect_activate(move |_action, _variant| {
|
||||
window.close();
|
||||
});
|
||||
}
|
||||
{
|
||||
let action_open_file: SimpleAction = SimpleAction::new("open-file", None);
|
||||
|
||||
self.add_action(&action_open_file);
|
||||
action_open_file.connect_activate(clone!(@weak self as window =>
|
||||
move |_action, _variant| {
|
||||
window.action_open_file();
|
||||
}));
|
||||
}
|
||||
{
|
||||
let action_save_file_as = SimpleAction::new("save-file-as", None);
|
||||
|
||||
self.add_action(&action_save_file_as);
|
||||
|
||||
action_save_file_as.connect_activate(clone!(@weak self as window =>
|
||||
move |_action, _variant| {
|
||||
window.action_save_file_as();
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
mod file;
|
||||
|
||||
mod imp;
|
||||
pub mod menubar;
|
||||
|
||||
use glib::object::IsA;
|
||||
use gtk::subclass::prelude::*;
|
||||
|
||||
glib::wrapper! {
|
||||
pub struct EchidnaWindow(ObjectSubclass<imp::EchidnaWindow>)
|
||||
@extends gtk::Widget, gtk::Window, gtk::ApplicationWindow,
|
||||
@implements gio::ActionGroup, gio::ActionMap, gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Native, gtk::Root, gtk::ShortcutManager;
|
||||
}
|
||||
|
||||
impl EchidnaWindow {
|
||||
pub fn new<P: IsA<gtk::Application>>(application: &P) -> Self {
|
||||
let object = glib::Object::new(&[("application", &application)]);
|
||||
|
||||
match object {
|
||||
Ok(o) => o,
|
||||
Err(e) => panic!("Error in making EchidnaApplication {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_imp(&self) -> &imp::EchidnaWindow {
|
||||
imp::EchidnaWindow::from_instance(self)
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
trait SidebarImplementedEditor {
|
||||
fn setup_sidebar();
|
||||
}
|
||||
|
||||
impl SidebarImplementedEditor for super::imp::EchidnaEditor {
|
||||
fn setup_sidebar() {}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at https://mozilla.org/MPL/2.0/. -->
|
||||
<interface>
|
||||
<requires lib="gtk" version="4.0" />
|
||||
<template class="EchidnaWindow">
|
||||
<property name="title">Echidna Code Editor</property>
|
||||
<property name="default-width">800</property>
|
||||
<property name="default-height">600</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="echidna-root">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="bars-box">
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="EchidnaSidebar" id="sidebar"></object>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder />
|
||||
</child>
|
||||
<child>
|
||||
<!-- <object class="GtkGrid" id="editor-tabs">
|
||||
<property name="hexpand">1</property>
|
||||
<child>
|
||||
-->
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="hexpand">1</property>
|
||||
<child>
|
||||
<object id="getting-started" class="GtkLabel">
|
||||
<property name="label">Hello from Echidna!</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="notebook-welcome">
|
||||
<property name="label">Welcome</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<!-- </child>
|
||||
</object> -->
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status-bar">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-start">10</property>
|
||||
<property name="margin-end">10</property>
|
||||
<property name="margin-top">6</property>
|
||||
<property name="margin-bottom">6</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
|
@ -0,0 +1,175 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use super::imp::EchidnaEditor;
|
||||
use gio::Cancellable;
|
||||
use gio::{File, FileQueryInfoFlags, FileType, SimpleAction};
|
||||
use glib::clone;
|
||||
use glib::subclass::types::ObjectSubclassExt;
|
||||
use glib::types::Type;
|
||||
use gtk::prelude::*;
|
||||
use gtk::{ApplicationWindow, FileChooserAction, FileChooserDialog, ResponseType, TreeStore};
|
||||
use relative_path::RelativePath;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::path::Path;
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct MonacoFolder {
|
||||
path: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Serialize)]
|
||||
struct MonacoWorkspace {
|
||||
folders: Vec<MonacoFolder>,
|
||||
}
|
||||
|
||||
trait WorkspaceImplementedEditor {
|
||||
fn action_open_workspace(
|
||||
&self,
|
||||
window: ApplicationWindow,
|
||||
app: super::EchidnaEditor,
|
||||
_action: &SimpleAction,
|
||||
_variant: Option<&glib::Variant>,
|
||||
);
|
||||
|
||||
fn open_workspace(&self, file: File);
|
||||
fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore);
|
||||
fn open_folder(&self, file: File);
|
||||
}
|
||||
|
||||
impl WorkspaceImplementedEditor for EchidnaEditor {
|
||||
fn action_open_workspace(
|
||||
&self,
|
||||
window: ApplicationWindow,
|
||||
app: super::EchidnaEditor,
|
||||
_action: &SimpleAction,
|
||||
_variant: Option<&glib::Variant>,
|
||||
) {
|
||||
let dialog: FileChooserDialog = FileChooserDialog::new(
|
||||
Some("Open a file"),
|
||||
Some(&window),
|
||||
FileChooserAction::Open,
|
||||
&[
|
||||
("Cancel", ResponseType::Cancel),
|
||||
("Open", ResponseType::Accept),
|
||||
],
|
||||
);
|
||||
dialog.set_visible(true);
|
||||
dialog.connect_response(clone!(@weak window, @weak app =>
|
||||
move |dialog, response| {
|
||||
if response == ResponseType::Accept {
|
||||
let file_option = dialog.file();
|
||||
match file_option {
|
||||
Some(file) => {
|
||||
dialog.destroy();
|
||||
Self::from_instance(&app).open_workspace(file);
|
||||
},
|
||||
None => {}
|
||||
}
|
||||
} else if response == ResponseType::Cancel {
|
||||
dialog.destroy();
|
||||
}
|
||||
}
|
||||
));
|
||||
}
|
||||
/**
|
||||
* __Open Workspace__
|
||||
*
|
||||
* Basically, this is just the same as Open Folder, but it's many folders.
|
||||
*
|
||||
* - Open a FileChooserDialog, set to only view .code-workspace files.
|
||||
* - If the user pressed cancel, destroy the dialog. If the user opened a .code-workspace file:
|
||||
* - Get the workspace file, load and parse its content, .code-workspace files are in JSON with comments. But JSON only should be fine, for now.
|
||||
* - Iterate over folders listed in the workspace file.
|
||||
* - Find the absolute path of the folder: Relative to the workspace file.
|
||||
* - Create a GFile instance of that path, and call open_folder(file: File) and pass the GFile instance to it.
|
||||
*
|
||||
*/
|
||||
fn open_workspace(&self, file: File) {
|
||||
let cancellable = Cancellable::new();
|
||||
let filepath_raw = &file
|
||||
.path()
|
||||
.expect("Could not get the file path of the file.");
|
||||
let filepath = Path::new(&filepath_raw);
|
||||
let info = file
|
||||
.query_info("*", gio::FileQueryInfoFlags::NONE, Some(&cancellable))
|
||||
.expect(format!(
|
||||
"Could not retrieve file information for {:?}",
|
||||
filepath
|
||||
));
|
||||
let content_type = info
|
||||
.content_type()
|
||||
.expect(format!("Found no content type for {:?}", filepath));
|
||||
println!(
|
||||
"Opened {} and found its content type is {}.",
|
||||
"file",
|
||||
content_type.to_string()
|
||||
);
|
||||
let content_cancellable = Cancellable::new();
|
||||
let content = file
|
||||
.load_contents(Some(&content_cancellable))
|
||||
.expect("Could not load the file contents for {:?}", filepath);
|
||||
|
||||
let (int_vec, _byte_string) = content;
|
||||
let workspace = serde_json::from_slice::<MonacoWorkspace>(&int_vec).expect(format!(
|
||||
"Could not parse the workspace file of {:?}",
|
||||
filepath
|
||||
));
|
||||
|
||||
for folder in workspace.folders {
|
||||
let path = RelativePath::new(&folder.path);
|
||||
let folder = File::for_path(path.to_path(filepath));
|
||||
|
||||
// Do something with the folder, perhaps lists its child and .
|
||||
self.open_folder(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
fn recursive_add_files_into_tree_store(&self, parent_file: File, tree: &TreeStore) {
|
||||
let child_enumerate_cancellable = Cancellable::new();
|
||||
let child_files = parent_file
|
||||
.enumerate_children(
|
||||
"*",
|
||||
FileQueryInfoFlags::NONE,
|
||||
Some(&child_enumerate_cancellable),
|
||||
)
|
||||
.expect(
|
||||
format!(
|
||||
"Could not look up the children files of {:?} because:\n{:#?}",
|
||||
filepath
|
||||
)
|
||||
.as_str(),
|
||||
);
|
||||
let filepath = &parent_file
|
||||
.path()
|
||||
.expect("Could not get the file path of the file.");
|
||||
|
||||
for file_iter in files {
|
||||
let file_info = file_iter.expect();
|
||||
let file = parent_file.child(file_info.name());
|
||||
let tree_iter = tree.append(None);
|
||||
tree.set_value(&tree_iter, 2, &file_info.name().to_str().to_value());
|
||||
|
||||
if file_info.file_type() == FileType::Directory {
|
||||
self.recursive_add_files_into_tree_store(file, tree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Loads a folder into the tree view.
|
||||
|
||||
- Create a new tree
|
||||
- Enumerate over child files of 'file'. (PS: In the Unix family of OS-es, directories are files too)
|
||||
*/
|
||||
fn open_folder(&self, file: File) {
|
||||
let tree = TreeStore::new(&[gdk::Texture::static_type(), Type::STRING]);
|
||||
self.recursive_add_files_into_tree_store(file, &tree);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||
|
||||
mod components;
|
||||
|
||||
use app::EchidnaEditor;
|
||||
use components::app;
|
||||
use gtk::prelude::ApplicationExtManual;
|
||||
|
||||
fn main() {
|
||||
let app = EchidnaEditor::new("land.echidna.editor");
|
||||
|
||||
std::process::exit(app.run());
|
||||
}
|
238
ui/echidna.ui
238
ui/echidna.ui
|
@ -1,238 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>559</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QWidget" name="statusBar" native="true">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>490</y>
|
||||
<width>801</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: #191A21</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="langFeaturesTab">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>270</x>
|
||||
<y>290</y>
|
||||
<width>531</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="problemsTab">
|
||||
<attribute name="title">
|
||||
<string>Problems</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="outputTab">
|
||||
<attribute name="title">
|
||||
<string>Output</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="terminalTab">
|
||||
<attribute name="title">
|
||||
<string>Terminal</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="debugConsoleTab">
|
||||
<attribute name="title">
|
||||
<string>Debug Console</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>271</width>
|
||||
<height>491</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QTabBar::tab {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
|
||||
}
|
||||
|
||||
</string>
|
||||
</property>
|
||||
<property name="tabPosition">
|
||||
<enum>QTabWidget::West</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Tab 1</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
<attribute name="title">
|
||||
<string>Tab 2</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>770</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuEdiut">
|
||||
<property name="title">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<addaction name="actionUndo"/>
|
||||
<addaction name="actionRedo"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuSelection">
|
||||
<property name="title">
|
||||
<string>Selection</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuView">
|
||||
<property name="title">
|
||||
<string>View</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuTabs">
|
||||
<property name="title">
|
||||
<string>Tabs</string>
|
||||
</property>
|
||||
<addaction name="actionProblem"/>
|
||||
<addaction name="actionOutput"/>
|
||||
<addaction name="actionTerminal"/>
|
||||
<addaction name="actionTerminal_2"/>
|
||||
</widget>
|
||||
<addaction name="menuTabs"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuGo">
|
||||
<property name="title">
|
||||
<string>Go</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuRun">
|
||||
<property name="title">
|
||||
<string>Run</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuTerminal">
|
||||
<property name="title">
|
||||
<string>Terminal</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuEchidna">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuNew">
|
||||
<property name="title">
|
||||
<string>New</string>
|
||||
</property>
|
||||
<addaction name="actionFile"/>
|
||||
<addaction name="actionWindow"/>
|
||||
</widget>
|
||||
<addaction name="menuNew"/>
|
||||
<addaction name="actionOpen"/>
|
||||
<addaction name="actionSave"/>
|
||||
</widget>
|
||||
<addaction name="menuEchidna"/>
|
||||
<addaction name="menuEdiut"/>
|
||||
<addaction name="menuSelection"/>
|
||||
<addaction name="menuView"/>
|
||||
<addaction name="menuGo"/>
|
||||
<addaction name="menuRun"/>
|
||||
<addaction name="menuTerminal"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="actionNew_File">
|
||||
<property name="text">
|
||||
<string>New File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionUndo">
|
||||
<property name="text">
|
||||
<string>Undo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRedo">
|
||||
<property name="text">
|
||||
<string>Redo</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionProblem">
|
||||
<property name="text">
|
||||
<string>Problems</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOutput">
|
||||
<property name="text">
|
||||
<string>Output</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTerminal">
|
||||
<property name="text">
|
||||
<string>Debug Console</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTerminal_2">
|
||||
<property name="text">
|
||||
<string>Terminal</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFile">
|
||||
<property name="text">
|
||||
<string>File</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen">
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionWindow">
|
||||
<property name="text">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave">
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
Loading…
Reference in New Issue