diff options
Diffstat (limited to 'src/screen.h')
| -rw-r--r-- | src/screen.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/screen.h b/src/screen.h new file mode 100644 index 0000000..5762009 --- /dev/null +++ b/src/screen.h @@ -0,0 +1,103 @@ +#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_CURR 0xff + +/**** public API ****/ + +/* the screen that's currently displaying */ +extern char scr_current; + +/* 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_active[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); + +/* 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); + +/* 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. + +*/ |
