-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscreen.h
More file actions
93 lines (67 loc) · 2.19 KB
/
Copy pathscreen.h
File metadata and controls
93 lines (67 loc) · 2.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef SCREEN_H
#define SCREEN_H
#include "types.h"
enum {
SCREEN_ACTIVE = 1 << 0,
SCREEN_HAS_DIRTY = 1 << 1,
};
enum {
GRAPH_HIST_MAX = 2048,
GRAPH_IDS_MAX = 32,
};
typedef struct {
int id;
int used;
int count;
int head;
long mn, mx;
int32_t v[GRAPH_HIST_MAX];
} GraphSeries;
struct Screen {
size_t cols, rows;
Line *line;
Line *alt;
int dirty_x1, dirty_y1, dirty_x2, dirty_y2;
int dirty_gen;
int border_gen;
int scroll_top, scroll_bot, scroll_n, scroll_state;
unsigned flags;
size_t *used;
Cell filler;
int blink_count;
GraphSeries graphs[GRAPH_IDS_MAX];
int ngraphs;
};
typedef struct Screen Screen;
size_t screen_cols(const Screen *s);
size_t screen_rows(const Screen *s);
Cell screen_get(const Screen *s, int x, int y);
const Cell *screen_row(const Screen *s, int y);
void screen_set(Screen *s, int x, int y, Cell c);
Screen *screen_new(size_t cols, size_t rows);
void screen_free(Screen *s);
void screen_resize(Screen *s, size_t cols, size_t rows);
void screen_shift_up(Screen *s, size_t n);
void screen_clear(Screen *s);
void screen_clear_region(Screen *s, int x1, int y1, int x2, int y2,
Cell filler);
void screen_put_cells(Screen *s, int x, int y, const Cell *cells,
size_t n);
void screen_scroll_up(Screen *s, int top, int bot, size_t n);
void screen_scroll_down(Screen *s, int top, int bot, size_t n);
void screen_insert_blank(Screen *s, int x, int y, size_t n);
void screen_delete_char(Screen *s, int x, int y, size_t n);
void screen_insert_lines(Screen *s, int y, int top, int bot, size_t n);
void screen_delete_lines(Screen *s, int y, int top, int bot, size_t n);
void screen_swap(Screen *s);
int screen_is_alt(const Screen *s);
void screen_dirty_all(Screen *s);
int screen_border_gen(const Screen *s);
int screen_dirty_get(const Screen *s, int *x1, int *y1, int *x2, int *y2);
void screen_clean(Screen *s);
int screen_scroll_get(const Screen *s, int *top, int *bot, int *n);
int screen_has_blink(const Screen *s);
void screen_graph_push(Screen *s, int id, long value, long mn, long mx);
int screen_graph_read(const Screen *s, int id, int n, float *out);
void screen_graph_clear(Screen *s);
#endif