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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#include "addrs.h"
#define MAX_SCREENS 7
#define LINE_SIZE 40
#define SCREEN_SIZE 920
#define BOTTOM_LINE_OFFS 880
#define SCR_UNUSED 0
#define SCR_INACTIVE 1
#define SCR_ACTIVE 2
#define SCR_SERVER 0
#define SCR_PRIV 1
#define SCR_CURR 0xff
/**** public API ****/
/* the screen that's currently displaying */
extern char scr_current;
/* the screen that's currently being written to */
extern char scr_active;
/* which screens are "active". the screen being displayed is
never active. any screen that's not visible that's had anything
written to it gets marked active. switching the display to an
active screen clears its active flag. */
extern char scr_status[MAX_SCREENS];
/* call before using any of the other functions. sets up the
display list, clears all screen memory, selects screen 0
for display. */
void scr_init(void);
/* creates a screen, if possible. we only get 7; attempts to create
more that that will return -1. on success, returns the screen
number (0-6). the name gets copied to the 1st line of the screen's
status box.
if display is true, the new screen displays. otherwise it's created
"in the background".
*/
char scr_create(const char *name, char display);
/* destroys a screen (frees up its slot). */
void scr_destroy(char s);
/* sets the topic for a screen (the 2nd line of the status box).
this can't just be another argument to scr_create() because we
don't know the topic yet when we create a screen (also, the
server and msgs windows don't have topics anyway). */
void scr_set_topic(char s, const char *topic);
/* switch display to screen s. updates the display list. clears
s's active flag. calls scr_show_status(). */
void scr_display(char s);
/* XXX: does this need to be public? */
void scr_show_status(char s);
/* calls scr_display() on the currently-visible screen.
called by the edit box code, when closing the edit box (user has
pressed Enter or aborted the message). */
void scr_refresh(void);
/* given a channel name, find its screen. if there's no match,
returns 0 (the server messages screen) */
char scr_getbyname(const char *name);
void scr_activate_name(const char *name);
/* print one character to a screen. handles scrolling. will not
print an EOL at column 0 (just ignores it). */
void scr_putc(char s, char c);
/* print text to a screen. handles scrolling. this
doesn't have to be the screen being displayed, of course;
if it's not, it gets marked as active. */
void scr_print(char s, const char *text);
/* print to active screen (set with scr_activate())*/
void scr_print_active(const char *text);
/* print to the currently-displayed screen */
void scr_print_current(const char *text);
void scr_print_server(const char *text);
void scr_print_priv(const char *text);
/* set a screen's status to active, if it's not the currently-displayed
one. scr_print() sets it already, but anything that uses scr_putc()
will have to call this. */
void scr_activate(char s);
/* XXX: this really should be in a utils.c or common.c... */
void scr_waitvcount(u8 c);
/**** end of public API ****/
/* notes:
If a character gets printed to the bottom right corner of a screen,
it *doesn't* scroll yet. It will, the next time a character is printed
to that screen.
This thing uses a modified font that's in ASCII order rather than
Atari screencode order. So "printing" just means copying... except
for IRC formatting codes.
scr_print() has to handle formatting: at least it should print inverse
video for either bold or italic. It will print incoming inverse
video as-is; it's the caller's responsibility to replace unprintable
characters (e.g. any char >= 128 might become an inverse question
mark). This has to happen because nick highlighting will use inverse
video.
Also, scr_print() should eventually be smart enough to strip out color
codes.
*/
|