Merge branch 'master' of github.com:dankamongmen/notcurses
commit
e276a36264
@ -0,0 +1,67 @@
|
|||||||
|
#ifndef __NCPP_PLOT_HH
|
||||||
|
#define __NCPP_PLOT_HH
|
||||||
|
|
||||||
|
#include <notcurses/notcurses.h>
|
||||||
|
|
||||||
|
#include "Root.hh"
|
||||||
|
#include "NCAlign.hh"
|
||||||
|
|
||||||
|
namespace ncpp
|
||||||
|
{
|
||||||
|
class Plane;
|
||||||
|
|
||||||
|
class NCPP_API_EXPORT Plot : public Root
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static plot_options default_options;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit Plot (Plane *plane, const plot_options *opts = nullptr)
|
||||||
|
: Plot (reinterpret_cast<ncplane*>(plane), opts)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Plot (Plane const* plane, const plot_options *opts = nullptr)
|
||||||
|
: Plot (const_cast<Plane*>(plane), opts)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Plot (Plane &plane, const plot_options *opts = nullptr)
|
||||||
|
: Plot (reinterpret_cast<ncplane*>(&plane), opts)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Plot (Plane const& plane, const plot_options *opts = nullptr)
|
||||||
|
: Plot (const_cast<Plane*>(&plane), opts)
|
||||||
|
{}
|
||||||
|
|
||||||
|
explicit Plot (ncplane *plane, const plot_options *opts = nullptr)
|
||||||
|
{
|
||||||
|
if (plane == nullptr)
|
||||||
|
throw invalid_argument ("'plane' must be a valid pointer");
|
||||||
|
|
||||||
|
plot = ncplot_create (plane, opts == nullptr ? &default_options : opts);
|
||||||
|
if (plot == nullptr)
|
||||||
|
throw init_error ("notcurses failed to create a new plot");
|
||||||
|
}
|
||||||
|
|
||||||
|
~Plot ()
|
||||||
|
{
|
||||||
|
if (!is_notcurses_stopped ())
|
||||||
|
ncplot_destroy (plot);
|
||||||
|
}
|
||||||
|
|
||||||
|
int add_sample(uint64_t x, uint64_t y)
|
||||||
|
{
|
||||||
|
return ncplot_add_sample (plot, x, y) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_sample(uint64_t x, uint64_t y)
|
||||||
|
{
|
||||||
|
return ncplot_set_sample (plot, x, y) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
Plane* get_plane () const noexcept;
|
||||||
|
|
||||||
|
private:
|
||||||
|
ncplot *plot;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,410 +0,0 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
|
||||||
# It is not intended for manual editing.
|
|
||||||
[[package]]
|
|
||||||
name = "aho-corasick"
|
|
||||||
version = "0.7.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ansi_term"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "atty"
|
|
||||||
version = "0.2.14"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bindgen"
|
|
||||||
version = "0.52.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bitflags"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.0.50"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cexpr"
|
|
||||||
version = "0.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cfg-if"
|
|
||||||
version = "0.1.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clang-sys"
|
|
||||||
version = "0.28.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clap"
|
|
||||||
version = "2.33.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "colloquy"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"notcurses 1.2.4",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "env_logger"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glob"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hermit-abi"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "humantime"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazy_static"
|
|
||||||
version = "1.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "lazycell"
|
|
||||||
version = "1.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc"
|
|
||||||
version = "0.2.66"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libc-stdhandle"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libloading"
|
|
||||||
version = "0.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libnotcurses-sys"
|
|
||||||
version = "1.2.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bindgen 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "log"
|
|
||||||
version = "0.4.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memchr"
|
|
||||||
version = "2.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "nom"
|
|
||||||
version = "4.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "notcurses"
|
|
||||||
version = "1.2.4"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc-stdhandle 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "peeking_take_while"
|
|
||||||
version = "0.1.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "pkg-config"
|
|
||||||
version = "0.3.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "proc-macro2"
|
|
||||||
version = "1.0.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quick-error"
|
|
||||||
version = "1.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "quote"
|
|
||||||
version = "1.0.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex"
|
|
||||||
version = "1.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.6.17"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc-hash"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shlex"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "strsim"
|
|
||||||
version = "0.8.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "termcolor"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "textwrap"
|
|
||||||
version = "0.11.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thread_local"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-width"
|
|
||||||
version = "0.1.7"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-xid"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vec_map"
|
|
||||||
version = "0.8.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "version_check"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "which"
|
|
||||||
version = "3.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi"
|
|
||||||
version = "0.3.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-i686-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-util"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winapi-x86_64-pc-windows-gnu"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "yaml-rust"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[metadata]
|
|
||||||
"checksum aho-corasick 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "8716408b8bc624ed7f65d223ddb9ac2d044c0547b6fa4b0d554f3a9540496ada"
|
|
||||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
|
||||||
"checksum atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
|
||||||
"checksum bindgen 0.52.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1c85344eb535a31b62f0af37be84441ba9e7f0f4111eb0530f43d15e513fe57"
|
|
||||||
"checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
|
||||||
"checksum cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)" = "95e28fa049fda1c330bcf9d723be7663a899c4679724b34c81e9f5a326aab8cd"
|
|
||||||
"checksum cexpr 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fce5b5fb86b0c57c20c834c1b412fd09c77c8a59b9473f86272709e78874cd1d"
|
|
||||||
"checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
|
|
||||||
"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
|
|
||||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
|
||||||
"checksum env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36"
|
|
||||||
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
|
||||||
"checksum hermit-abi 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "e2c55f143919fbc0bc77e427fe2d74cf23786d7c1875666f2fde3ac3c659bb67"
|
|
||||||
"checksum humantime 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
|
||||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|
||||||
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
|
||||||
"checksum libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)" = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558"
|
|
||||||
"checksum libc-stdhandle 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6dac2473dc28934c5e0b82250dab231c9d3b94160d91fe9ff483323b05797551"
|
|
||||||
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
|
||||||
"checksum libnotcurses-sys 1.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "69cd13c04e971783d60cc48e307d2dfd47f6cad8a1519d0c2439316db7eb31f8"
|
|
||||||
"checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7"
|
|
||||||
"checksum memchr 2.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
|
|
||||||
"checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6"
|
|
||||||
"checksum peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
|
||||||
"checksum pkg-config 0.3.17 (registry+https://github.com/rust-lang/crates.io-index)" = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677"
|
|
||||||
"checksum proc-macro2 1.0.9 (registry+https://github.com/rust-lang/crates.io-index)" = "6c09721c6781493a2a492a96b5a5bf19b65917fe6728884e7c44dd0c60ca3435"
|
|
||||||
"checksum quick-error 1.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0"
|
|
||||||
"checksum quote 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2bdc6c187c65bca4260c9011c9e3132efe4909da44726bad24cf7572ae338d7f"
|
|
||||||
"checksum regex 1.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7f6946991529684867e47d86474e3a6d0c0ab9b82d5821e314b1ede31fa3a4b3"
|
|
||||||
"checksum regex-syntax 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "7fe5bd57d1d7414c6b5ed48563a2c855d995ff777729dcd91c369ec7fea395ae"
|
|
||||||
"checksum rustc-hash 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
||||||
"checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2"
|
|
||||||
"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
|
|
||||||
"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
|
|
||||||
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
|
||||||
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
|
||||||
"checksum unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "caaa9d531767d1ff2150b9332433f32a24622147e5ebb1f26409d5da67afd479"
|
|
||||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
|
||||||
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
|
||||||
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
|
||||||
"checksum which 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724"
|
|
||||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
|
||||||
"checksum winapi-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4ccfbf554c6ad11084fb7517daca16cfdcaccbdadba4fc336f032a8b12c2ad80"
|
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
|
||||||
"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992"
|
|
@ -1,19 +0,0 @@
|
|||||||
[package]
|
|
||||||
name = "colloquy"
|
|
||||||
version = "0.1.0"
|
|
||||||
authors = ["nick black <dankamongmen@gmail.com>"]
|
|
||||||
edition = "2018"
|
|
||||||
repository = "https://github.com/dankamongmen/notcurses"
|
|
||||||
license = "Apache-2.0"
|
|
||||||
description = "Notcurses-based utility for command-line TUI widgets"
|
|
||||||
homepage = "https://nick-black.com/dankwiki/index.php/Notcurses"
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
libc = ">= 0.2.66"
|
|
||||||
notcurses = ">= 1.2.5"
|
|
||||||
libnotcurses-sys = ">= 1.2.5"
|
|
||||||
|
|
||||||
[dependencies.clap]
|
|
||||||
version = ">= 2.33.0"
|
|
||||||
default-features = false
|
|
||||||
features = ["yaml", "color", "suggestions"]
|
|
@ -1,31 +0,0 @@
|
|||||||
name: colloquy
|
|
||||||
version: "0.1.0"
|
|
||||||
about: Attractive Notcurses UI widgets from the shell
|
|
||||||
author: Nick Black <dankamongmen@gmail.com>
|
|
||||||
args:
|
|
||||||
- verbose:
|
|
||||||
long: verbose
|
|
||||||
short: v
|
|
||||||
help: Verbose mode
|
|
||||||
# - file:
|
|
||||||
# long: file
|
|
||||||
# short: f
|
|
||||||
# help: Read configuration options from this file
|
|
||||||
# takes_value: true
|
|
||||||
- title:
|
|
||||||
long: title
|
|
||||||
short: t
|
|
||||||
help: Set the title text
|
|
||||||
- msgbox:
|
|
||||||
long: msgbox
|
|
||||||
help: Display arbitrary text with a single button to accept it
|
|
||||||
requires: text
|
|
||||||
- text:
|
|
||||||
help: The contents of the widget
|
|
||||||
index: 1
|
|
||||||
- height:
|
|
||||||
help: The height of the widget, 0 for screen height
|
|
||||||
index: 2
|
|
||||||
- width:
|
|
||||||
help: The width of the widget, 0 for screen width
|
|
||||||
index: 3
|
|
@ -1,45 +0,0 @@
|
|||||||
extern crate notcurses;
|
|
||||||
extern crate libnotcurses_sys as ffi;
|
|
||||||
|
|
||||||
extern {
|
|
||||||
fn libc_stdout() -> *mut ffi::_IO_FILE;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
use clap::{load_yaml, App};
|
|
||||||
let yaml = load_yaml!("cli.yml");
|
|
||||||
let matches = App::from_yaml(yaml).get_matches();
|
|
||||||
|
|
||||||
unsafe{
|
|
||||||
let _ = libc::setlocale(libc::LC_ALL, std::ffi::CString::new("").unwrap().as_ptr());
|
|
||||||
let opts: ffi::notcurses_options = ffi::notcurses_options {
|
|
||||||
inhibit_alternate_screen: true,
|
|
||||||
loglevel: 0,
|
|
||||||
termtype: std::ptr::null(),
|
|
||||||
retain_cursor: false,
|
|
||||||
suppress_banner: false,
|
|
||||||
no_winch_sighandler: false,
|
|
||||||
no_quit_sighandlers: false,
|
|
||||||
renderfp: std::ptr::null_mut(),
|
|
||||||
margin_t: 4,
|
|
||||||
margin_r: 4,
|
|
||||||
margin_b: 4,
|
|
||||||
margin_l: 4,
|
|
||||||
};
|
|
||||||
let nc = ffi::notcurses_init(&opts, libc_stdout());
|
|
||||||
let stdplane = ffi::notcurses_stdplane(nc);
|
|
||||||
let mut dimy = 0;
|
|
||||||
let mut dimx = 0;
|
|
||||||
ffi::ncplane_dim_yx(stdplane, &mut dimy, &mut dimx);
|
|
||||||
if matches.is_present("msgbox") {
|
|
||||||
ffi::ncplane_new(nc, dimy, dimx, 0, 0, std::ptr::null_mut());
|
|
||||||
}else{
|
|
||||||
eprintln!("Needed a widget type");
|
|
||||||
ffi::notcurses_stop(nc);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
let mut ni: ffi::ncinput = std::mem::zeroed();
|
|
||||||
notcurses::getc_blocking(nc, &mut ni);
|
|
||||||
ffi::notcurses_stop(nc);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
void MoveRight() {
|
|
||||||
const std::lock_guard<std::mutex> lock(mtx_);
|
|
||||||
int y, x;
|
|
||||||
if(PrepForMove(&y, &x)){
|
|
||||||
if(!curpiece_->move(y, x + 2)){
|
|
||||||
throw TetrisNotcursesErr("move()");
|
|
||||||
}
|
|
||||||
if(InvalidMove()){
|
|
||||||
if(!curpiece_->move(y, x)){
|
|
||||||
throw TetrisNotcursesErr("move()");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
x += 2;
|
|
||||||
if(!nc_.render()){
|
|
||||||
throw TetrisNotcursesErr("render()");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,120 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include <array>
|
||||||
|
#include <cstdlib>
|
||||||
|
#include "internal.h"
|
||||||
|
|
||||||
|
TEST_CASE("Scrolling") {
|
||||||
|
if(getenv("TERM") == nullptr){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
notcurses_options nopts{};
|
||||||
|
nopts.inhibit_alternate_screen = true;
|
||||||
|
nopts.suppress_banner = true;
|
||||||
|
FILE* outfp_ = fopen("/dev/tty", "wb");
|
||||||
|
REQUIRE(outfp_);
|
||||||
|
struct notcurses* nc_ = notcurses_init(&nopts, outfp_);
|
||||||
|
REQUIRE(nc_);
|
||||||
|
struct ncplane* n_ = notcurses_stdplane(nc_);
|
||||||
|
REQUIRE(n_);
|
||||||
|
|
||||||
|
// verify that the standard plane has scrolling disabled initially, and that
|
||||||
|
// we can enable it at runtime.
|
||||||
|
SUBCASE("ScollingDisabledStdplane"){
|
||||||
|
CHECK(!ncplane_set_scrolling(n_, true));
|
||||||
|
CHECK(ncplane_set_scrolling(n_, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
SUBCASE("ScrollingStr"){
|
||||||
|
struct ncplane* n = ncplane_new(nc_, 2, 20, 1, 1, nullptr);
|
||||||
|
REQUIRE(n);
|
||||||
|
// verify that the new plane was started without scrolling
|
||||||
|
CHECK(!ncplane_set_scrolling(n, false));
|
||||||
|
// try to write 40 EGCs; it ought fail
|
||||||
|
CHECK(-20 == ncplane_putstr(n, "0123456789012345678901234567890123456789"));
|
||||||
|
int y, x;
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(0 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == ncplane_cursor_move_yx(n, 0, 0));
|
||||||
|
CHECK(!ncplane_set_scrolling(n, true)); // enable scrolling
|
||||||
|
// try to write 40 EGCs; it ought succeed
|
||||||
|
CHECK(40 == ncplane_putstr(n, "0123456789012345678901234567890123456789"));
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(1 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
}
|
||||||
|
|
||||||
|
// even when scrolling is enabled, you aren't allowed to move the cursor
|
||||||
|
// off-plane, or initiate output there
|
||||||
|
SUBCASE("NoScrollingManually"){
|
||||||
|
struct ncplane* n = ncplane_new(nc_, 2, 20, 1, 1, nullptr);
|
||||||
|
REQUIRE(n);
|
||||||
|
CHECK(!ncplane_set_scrolling(n, true)); // enable scrolling
|
||||||
|
CHECK(0 > ncplane_cursor_move_yx(n, 0, 20));
|
||||||
|
CHECK(0 > ncplane_cursor_move_yx(n, 1, 20));
|
||||||
|
CHECK(0 > ncplane_cursor_move_yx(n, 2, 2));
|
||||||
|
CHECK(0 > ncplane_putsimple_yx(n, 0, 20, 'c'));
|
||||||
|
CHECK(0 > ncplane_putsimple_yx(n, 1, 20, 'c'));
|
||||||
|
CHECK(0 > ncplane_putsimple_yx(n, 2, 0, 'c'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that two strings, each the length of the plane, can be output when
|
||||||
|
// scrolling is enabled (the second ought get an error without scrolling)
|
||||||
|
SUBCASE("ScrollingSplitStr"){
|
||||||
|
struct ncplane* n = ncplane_new(nc_, 2, 20, 1, 1, nullptr);
|
||||||
|
REQUIRE(n);
|
||||||
|
CHECK(20 == ncplane_putstr(n, "01234567890123456789"));
|
||||||
|
int y, x;
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(0 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == ncplane_putstr(n, "01234567890123456789"));
|
||||||
|
CHECK(!ncplane_set_scrolling(n, true)); // enable scrolling
|
||||||
|
CHECK(20 == ncplane_putstr(n, "01234567890123456789"));
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(1 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that a single string the size of the plane can be output when
|
||||||
|
// scrolling is enabled (it ought be an error without scrolling)
|
||||||
|
SUBCASE("ScrollingEGC"){
|
||||||
|
const char* out = "0123456789012345678901234567890123456789";
|
||||||
|
struct ncplane* n = ncplane_new(nc_, 2, 20, 1, 1, nullptr);
|
||||||
|
REQUIRE(n);
|
||||||
|
// verify that the new plane was started without scrolling
|
||||||
|
CHECK(!ncplane_set_scrolling(n, false));
|
||||||
|
// try to write 40 EGCs; the last 20 ought fail
|
||||||
|
for(const char* c = out ; *c ; ++c){
|
||||||
|
int ret = ncplane_putsimple(n, *c);
|
||||||
|
if(c - out < 20){
|
||||||
|
CHECK(1 == ret);
|
||||||
|
}else{
|
||||||
|
CHECK(0 > ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int y, x;
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(0 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == ncplane_cursor_move_yx(n, 0, 0));
|
||||||
|
CHECK(!ncplane_set_scrolling(n, true)); // enable scrolling
|
||||||
|
// try to write 40 EGCs; all ought succeed
|
||||||
|
for(const char* c = out ; *c ; ++c){
|
||||||
|
CHECK(1 == ncplane_putsimple(n, *c));
|
||||||
|
}
|
||||||
|
ncplane_cursor_yx(n, &y, &x);
|
||||||
|
CHECK(1 == y);
|
||||||
|
CHECK(20 == x);
|
||||||
|
CHECK(0 == notcurses_render(nc_));
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME add one verifying boxes don't exceed the right side
|
||||||
|
// FIXME add one where we go past the end of the plane
|
||||||
|
|
||||||
|
CHECK(0 == notcurses_stop(nc_));
|
||||||
|
CHECK(0 == fclose(outfp_));
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,50 @@
|
|||||||
|
Name: notcurses
|
||||||
|
Version: 1.2.5
|
||||||
|
Release: 1
|
||||||
|
Summary: Character graphics and TUI library
|
||||||
|
License: ASL 2.0
|
||||||
|
Source0: https://github.com/dankamongmen/%{name}/archive/v%{version}.tar.gz
|
||||||
|
Source1: https://github.com/dankamongmen/%{name}/releases/v%{version}/v%{version}.tar.gz.asc
|
||||||
|
Source2: https://dank.qemfd.net/dankamongmen.gpg
|
||||||
|
BuildRequires: gnupg2 cmake make gcc-c++ ncurses-devel pandoc python3-devel
|
||||||
|
|
||||||
|
%description
|
||||||
|
notcurses facilitates the creation of modern TUI programs,
|
||||||
|
making full use of Unicode and 24-bit direct color. It presents
|
||||||
|
an API similar to that of Curses, and rides atop libtinfo.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
|
||||||
|
%setup
|
||||||
|
|
||||||
|
%build
|
||||||
|
%cmake -DUSE_FFMPEG=off -DUSE_TEST=off .
|
||||||
|
%make_build
|
||||||
|
|
||||||
|
%install
|
||||||
|
%make_install
|
||||||
|
|
||||||
|
%files
|
||||||
|
/usr/bin/notcurses-demo
|
||||||
|
/usr/bin/notcurses-input
|
||||||
|
/usr/bin/notcurses-keyplot
|
||||||
|
/usr/bin/notcurses-ncreel
|
||||||
|
/usr/bin/notcurses-pydemo
|
||||||
|
/usr/bin/notcurses-tester
|
||||||
|
/usr/bin/notcurses-tetris
|
||||||
|
/usr/bin/notcurses-view
|
||||||
|
/usr/include/notcurses/nckeys.h
|
||||||
|
/usr/include/notcurses/notcurses.h
|
||||||
|
/usr/lib/x86_64-linux-gnu/libnotcurses.so.{version}
|
||||||
|
/usr/lib/x86_64-linux-gnu/libnotcurses.so.1
|
||||||
|
/usr/lib/x86_64-linux-gnu/libnotcurses.so
|
||||||
|
/usr/lib/x86_64-linux-gnu/cmake/notcurses/notcursesConfig.cmake
|
||||||
|
/usr/lib/x86_64-linux-gnu/cmake/notcurses/notcursesConfigVersion.cmake
|
||||||
|
/usr/lib/x86_64-linux-gnu/libnotcurses.a
|
||||||
|
/usr/lib/x86_64-linux-gnu/pkgconfig
|
||||||
|
/usr/lib/x86_64-linux-gnu/pkgconfig/notcurses.pc
|
||||||
|
%license LICENSE
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Tue, Apr 07 2020 Nick Black <dankamongmen@gmail.com> - 1.2.5-1
|
||||||
|
- Initial Fedora packaging
|
Loading…
Reference in New Issue