progbar: remove egcs options

pull/1212/head
nick black 4 years ago committed by Nick Black
parent c3b5069eae
commit d56ea8b5e7

@ -1,6 +1,9 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.1.1 (not yet released)
* Progress bars via `ncprogbar`. Standard widget API.
* 2.1.0 (2020-12-13)
* `cell` has been renamed `nccell`. The old name has been kept as an alias,
but ought be considered deprecated. It will be removed in Notcurses 3.0.

@ -2380,10 +2380,6 @@ lower values. The procession will take place along the longer dimension (at
the time of each redraw), with the horizontal length scaled by 2 for
purposes of comparison. I.e. for a plane of 20 rows and 50 columns, the
progress will be to the right (50 > 40) or left with `OPTION_RETROGRADE`.
If `NCPROGBAR_OPTION_LOCK_ORIENTATION` is provided, the initial orientation
is locked in, despite any resizes. It locks horizontal progression by
default; `NCPROGBAR_OPTION_FORCE_VERTICAL` locks vertical progression. These
are recommended if you provide custom EGCs.
```
// Takes ownership of the ncplane 'n', which will be destroyed by
@ -2392,22 +2388,15 @@ struct ncprogbar* ncprogbar_create(struct ncplane* n, const ncprogbar_options* o
// Return a reference to the ncprogbar's underlying ncplane.
#define NCPROGBAR_OPTION_RETROGRADE 0x0001u // proceed left/down
#define NCPROGBAR_OPTION_LOCK_ORIENTATION 0x0002u // lock in orientation
#define NCPROGBAR_OPTION_FORCE_VERTICAL 0x0003u // lock in vert
typedef struct ncprogbar_options {
// channels for the maximum and minimum points. linear interpolation will be
// applied across the domain between these two.
uint64_t maxchannels;
uint64_t minchannels;
// provide NULL for default (geometric) glyphs. otherwise, provide one or
// more EGCs to be used for the progress bar. the last EGC provided will be
// at the head of the progress. the first will be used for the entirety of
// the tail. i.e. "▃▅🭂🭍" might yield "▃▃▃▃▅🭂🭍". note that such a set of EGCs
// would not work well for a vertical progress bar.
const char egcs;
uint64_t flags;
} ncprogbar_options;
struct ncplane* ncprogbar_plane(struct ncprogbar* n);
// Set the progress bar's completion, a double 0 <= 'p' <= 1.

@ -18,7 +18,6 @@ struct ncprogbar;
typedef struct ncprogbar_options {
uint64_t maxchannels;
uint64_t minchannels;
const char egcs;
uint64_t flags;
} ncprogbar_options;
```

@ -3037,12 +3037,6 @@ typedef struct ncprogbar_options {
// and max must either be RGB, or both default, and alphas must match.
uint64_t maxchannels;
uint64_t minchannels;
// provide NULL for default (geometric) glyphs. otherwise, provide one or
// more EGCs to be used for the progress bar. the last EGC provided will be
// at the head of the progress. the first will be used for the entirety of
// the tail. i.e. "▃▅🭂🭍" might yield "▃▃▃▃▅🭂🭍". note that such a set of EGCs
// would not work well for a vertical progress bar.
const char egcs;
uint64_t flags;
} ncprogbar_options;

@ -59,7 +59,9 @@ progbar_redraw(ncprogbar* n){
}
while(progress > 0 && progress < range){
// FIXME lerp min->max
ncplane_putchar_yx(ncprogbar_plane(n), 0, progress, 'X');
if(ncplane_putegc_yx(ncprogbar_plane(n), 0, progress, "", NULL) <= 0){
return -1;
}
progress += delt;
}
return 0;

Loading…
Cancel
Save