Removed effect methods

This commit is contained in:
Bob Polis 2021-12-13 15:01:38 +01:00
parent bacc189d99
commit 0539d600a0
2 changed files with 7 additions and 180 deletions

View File

@ -44,8 +44,7 @@ void term::progress(int prefixlen,
int steps = round(cur * maxsteps / total);
int perc = round(100 * cur / total);
int fill_len = barwidth - steps / 8;
*_out << '\r' << std::setw(prefixlen) << prefix.substr(0, prefixlen) << ' ';
grayf(8);
*_out << '\r' << std::setw(prefixlen) << prefix.substr(0, prefixlen) << ' ' << io::grayf(8);
for (int i = 0; i < steps / 8; ++i) {
*_out << bar[7];
}
@ -57,144 +56,12 @@ void term::progress(int prefixlen,
*_out << ' ' << std::setw(3) << perc << '%';
}
void term::hide_cursor() const {
// ------------------------------------------------------------------------
cursor_hider::cursor_hider(std::ostream* out) : _out {out} {
*_out << io::hide_cursor;
}
void term::show_cursor() const {
cursor_hider::~cursor_hider() {
*_out << io::show_cursor;
}
void term::reset() const {
*_out << io::reset;
}
void term::bold() const {
*_out << io::bold;
}
void term::italic() const {
*_out << io::italic;
}
void term::underline() const {
*_out << io::underline;
}
void term::overline() const {
*_out << io::overline;
}
void term::strikethru() const {
*_out << io::strikethru;
}
void term::blinkslow() const {
*_out << io::blinkslow;
}
void term::blinkfast() const {
*_out << io::blinkfast;
}
void term::reverse() const {
*_out << io::reverse;
}
void term::blackf() const {
*_out << io::blackf;
}
void term::redf() const {
*_out << io::redf;
}
void term::greenf() const {
*_out << io::greenf;
}
void term::yellowf() const {
*_out << io::yellowf;
}
void term::bluef() const {
*_out << io::bluef;
}
void term::magentaf() const {
*_out << io::magentaf;
}
void term::cyanf() const {
*_out << io::cyanf;
}
void term::whitef() const {
*_out << io::whitef;
}
void term::defaultf() const {
*_out << io::defaultf;
}
void term::grayf(int val) const {
*_out << io::grayf(val);
}
void term::rgbf(int r, int g, int b) const {
*_out << io::rgbf(r, g, b);
}
void term::blackb() const {
*_out << io::blackb;
}
void term::redb() const {
*_out << io::redb;
}
void term::greenb() const {
*_out << io::greenb;
}
void term::yellowb() const {
*_out << io::yellowb;
}
void term::blueb() const {
*_out << io::blueb;
}
void term::magentab() const {
*_out << io::magentab;
}
void term::cyanb() const {
*_out << io::cyanb;
}
void term::whiteb() const {
*_out << io::whiteb;
}
void term::defaultb() const {
*_out << io::defaultb;
}
void term::grayb(int val) const {
*_out << io::grayb(val);
}
void term::rgbb(int r, int g, int b) const {
*_out << io::rgbb(r, g, b);
}
// ------------------------------------------------------------------------
cursor_hider::cursor_hider(int fd) : _t {fd} {
_t.hide_cursor();
}
cursor_hider::~cursor_hider() {
_t.show_cursor();
}

View File

@ -23,53 +23,13 @@ namespace sc {
const std::string& prefix,
double cur,
double total) const;
void hide_cursor() const;
void show_cursor() const;
void reset() const;
void bold() const;
void italic() const;
void underline() const;
void overline() const;
void strikethru() const;
void blinkslow() const;
void blinkfast() const;
void reverse() const;
void blackf() const;
void redf() const;
void greenf() const;
void yellowf() const;
void bluef() const;
void magentaf() const;
void cyanf() const;
void whitef() const;
void defaultf() const;
void grayf(int val) const; // val = 0..23
void rgbf(int r, int g, int b) const; // r,g,b = 0..5
void blackb() const;
void redb() const;
void greenb() const;
void yellowb() const;
void blueb() const;
void magentab() const;
void cyanb() const;
void whiteb() const;
void defaultb() const;
void grayb(int val) const; // val = 0..23
void rgbb(int r, int g, int b) const; // r,g,b = 0..5
};
class cursor_hider {
term _t;
std::ostream* _out {nullptr};
public:
cursor_hider(int fd);
cursor_hider(std::ostream* out);
~cursor_hider();
};