mirror of https://github.com/fairyglade/ly.git
rename clock to bigclock
This commit is contained in:
parent
c4a3c91a76
commit
4f348f7a4a
|
|
@ -161,9 +161,9 @@ void config_load(const char *cfg_path)
|
||||||
{"animation", &config.animation, config_handle_u8},
|
{"animation", &config.animation, config_handle_u8},
|
||||||
{"asterisk", &config.asterisk, config_handle_char},
|
{"asterisk", &config.asterisk, config_handle_char},
|
||||||
{"bg", &config.bg, config_handle_u8},
|
{"bg", &config.bg, config_handle_u8},
|
||||||
|
{"bigclock", &config.bigclock, config_handle_bool},
|
||||||
{"blank_box", &config.blank_box, config_handle_bool},
|
{"blank_box", &config.blank_box, config_handle_bool},
|
||||||
{"blank_password", &config.blank_password, config_handle_bool},
|
{"blank_password", &config.blank_password, config_handle_bool},
|
||||||
{"clock", &config.clock, config_handle_bool},
|
|
||||||
{"console_dev", &config.console_dev, config_handle_str},
|
{"console_dev", &config.console_dev, config_handle_str},
|
||||||
{"default_input", &config.default_input, config_handle_u8},
|
{"default_input", &config.default_input, config_handle_u8},
|
||||||
{"fg", &config.fg, config_handle_u8},
|
{"fg", &config.fg, config_handle_u8},
|
||||||
|
|
@ -270,6 +270,7 @@ void config_defaults()
|
||||||
config.animation = 0;
|
config.animation = 0;
|
||||||
config.asterisk = '*';
|
config.asterisk = '*';
|
||||||
config.bg = 0;
|
config.bg = 0;
|
||||||
|
config.bigclock = false;
|
||||||
config.blank_box = true;
|
config.blank_box = true;
|
||||||
config.blank_password = false;
|
config.blank_password = false;
|
||||||
config.console_dev = strdup("/dev/console");
|
config.console_dev = strdup("/dev/console");
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ struct config
|
||||||
uint8_t animation;
|
uint8_t animation;
|
||||||
char asterisk;
|
char asterisk;
|
||||||
uint8_t bg;
|
uint8_t bg;
|
||||||
|
bool bigclock;
|
||||||
bool blank_box;
|
bool blank_box;
|
||||||
bool blank_password;
|
bool blank_password;
|
||||||
bool clock;
|
|
||||||
char* console_dev;
|
char* console_dev;
|
||||||
uint8_t default_input;
|
uint8_t default_input;
|
||||||
uint8_t fg;
|
uint8_t fg;
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ void draw_box(struct term_buf* buf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
char* get_clock_string()
|
char* bigclock_str()
|
||||||
{
|
{
|
||||||
time_t timer;
|
time_t timer;
|
||||||
char* buffer = malloc(6);
|
char* buffer = malloc(6);
|
||||||
|
|
@ -231,15 +231,15 @@ void alpha_blit(struct tb_cell* buf, uint16_t x, uint16_t y, uint16_t w, uint16_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_clock(struct term_buf* buf)
|
void draw_bigclock(struct term_buf* buf)
|
||||||
{
|
{
|
||||||
if (!config.clock)
|
if (!config.bigclock)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int xo = buf->box_x + buf->box_width / 2 - (5 * (CLOCK_W + 1)) / 2;
|
int xo = buf->box_x + buf->box_width / 2 - (5 * (CLOCK_W + 1)) / 2;
|
||||||
int yo = buf->box_y - CLOCK_H - 2;
|
int yo = buf->box_y - CLOCK_H - 2;
|
||||||
|
|
||||||
char* clockstr = get_clock_string();
|
char* clockstr = bigclock_str();
|
||||||
struct tb_cell* clockcell;
|
struct tb_cell* clockcell;
|
||||||
|
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,6 @@ void animate_init(struct term_buf* buf);
|
||||||
void animate(struct term_buf* buf);
|
void animate(struct term_buf* buf);
|
||||||
bool cascade(struct term_buf* buf, uint8_t* fails);
|
bool cascade(struct term_buf* buf, uint8_t* fails);
|
||||||
|
|
||||||
void draw_clock(struct term_buf *buf);
|
void draw_bigclock(struct term_buf *buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ int main(int argc, char** argv)
|
||||||
(*input_handles[active_input])(input_structs[active_input], NULL);
|
(*input_handles[active_input])(input_structs[active_input], NULL);
|
||||||
tb_clear();
|
tb_clear();
|
||||||
animate(&buf);
|
animate(&buf);
|
||||||
draw_clock(&buf);
|
draw_bigclock(&buf);
|
||||||
draw_box(&buf);
|
draw_box(&buf);
|
||||||
draw_labels(&buf);
|
draw_labels(&buf);
|
||||||
if(!config.hide_f1_commands)
|
if(!config.hide_f1_commands)
|
||||||
|
|
@ -211,7 +211,7 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
if (config.animate) {
|
if (config.animate) {
|
||||||
error = tb_peek_event(&event, config.min_refresh_delta);
|
error = tb_peek_event(&event, config.min_refresh_delta);
|
||||||
} else if (config.clock) {
|
} else if (config.bigclock) {
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
error = tb_peek_event(&event, (60 - tv.tv_sec % 60) * 1000 - tv.tv_usec / 1000);
|
error = tb_peek_event(&event, (60 - tv.tv_sec % 60) * 1000 - tv.tv_usec / 1000);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue