aboutsummaryrefslogtreecommitdiff
path: root/src/screen.h
blob: e0aad317497740df34ad0c9bf04ba3c5d1f6e750 (plain)
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
120
121
122
123
124
125
126
127
128
129
#include "addrs.h"
#include "pool.h"

#define LINE_SIZE 40
#define SCR_VIS_HEIGHT 23

#define SCR_UNUSED 0
#define SCR_INACTIVE 1
#define SCR_OTHER 2
#define SCR_ACTIVE 3
#define SCR_HILITE 4

#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;

/* 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 0 (aka the server screen). on success,
   returns the screen number (2-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);

/* destroys a screen (frees up its slot). */
void scr_destroy(char s);

/* switch display to screen s. updates the display list. clears
   s's active flag. calls scr_show_status(). */
void scr_display(char s);

/* display the backscroll (top 25 lines) of the current screen.
   note that it's a bad idea to write to the screen while it's
   scrolled back!  */
void scr_scrollback(void);
void scr_scrollback_bonus(void);

/* end scrollback mode (display the bottom 23 lines + status) */
void scr_end_scrollback(void);

/* 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);
void scr_putc_active(char c);
void scr_eol_active(void);
void scr_eol_current(void);

/* 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);

/*
	// these were never used, so commented out.
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);

char *scr_get_cur_name(void);

/* XXX: this really should be in a utils.c or common.c... */
void scr_waitvcount_116(void);

/* print decimal numbers (see printnum.s) */
void scr_cur_printnum(u16 c);
void scr_act_printnum(u16 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.

*/