static char rcsid[] = "@(#)$Id: screen.c,v 1.20 2006/04/09 07:37:37 hurtta Exp $";
/******************************************************************************
* The Elm (ME+) Mail System - $Revision: 1.20 $ $State: Exp $
*
* Author: Kari Hurtta <hurtta+elm@posti.FMI.FI> (was hurtta+elm@ozone.FMI.FI)
******************************************************************************
* Some code copied from ../curses.c. It have following copyright:
*
* Copyright (c) 1988-1992 USENET Community Trust
* Copyright (c) 1986,1987 Dave Taylor
*
* However on that code there is no practically Elm 2.4 code (from where that
* copyright is) left. Only function names are same.
*****************************************************************************/
#include "def_screen.h"
DEBUG_VAR(Debug,__FILE__,"screen");
#include <errno.h>
static struct menu_context * sync_ctx = NULL;
#define SYNC(x) while (x != sync_ctx) { Syncronize(x); }
static void StartSyncronize P_((struct menu_context *ctx));
static void PutLineS P_((struct string *S));
static void PutLineS(S)
struct string *S;
{
DPRINT(Debug,49, (&Debug, "PutLineS(\"%S\")\n",S));
SYNC(default_context);
cur_PutLineS(S,NULL);
}
static void Raw0 P_((int state));
static void Raw0(state)
int state;
{
Raw(state);
}
static void ClearScreen0 P_((void));
static void ClearScreen0()
{
ClearScreen(0);
}
int InitScreen(struct menu_context **page)
{
int r;
int lines,columns;
DPRINT(Debug,49, (&Debug, "InitScreen(...)\n"));
r = cur_InitScreen();
set_start_run_hooks(print_status,RawState,Raw0,
start_run_tty_init,ClearScreen0,
PutLineS, print_status_cooked);
/* Real lines .. not lines-1 !!! */
cur_ScreenSize(&lines,&columns);
set_root_menu(lines,columns);
*page = new_menu_context();
return r;
}
/* This assumes one byte charset */
void Writechar(ch)
int ch;
{
DPRINT(Debug,49, (&Debug, "Writechar('%c')\n",ch));
SYNC(default_context);
cur_Writechar(ch, NULL);
}
void menu_Writechar(ctx,ch)
struct menu_context * ctx;
int ch;
{
DPRINT(Debug,49, (&Debug, "menu_Writechar(%p,'%c')\n",ctx,ch));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_Writechar",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_Writechar",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_Writechar(ctx,ch);
}
/*VARARGS2*/
void Write_to_screen (
#if ANSI_C
CONST char *format, CONST char *msg, ...
#else
format, msg, va_alist
#endif
)
#if !ANSI_C
CONST char *format;
CONST char *msg;
va_dcl
#endif
{
va_list vl;
struct string *text;
DPRINT(Debug,49, (&Debug, "Write_to_screen(format=\"%s\",...)\n",format));
SYNC(default_context);
Va_start(vl, msg); /* defined in defs.h */
/** This routine writes to the screen at the current location.
when done, it increments lines & columns accordingly by
looking for "\n" sequences... **/
text = elm_smessage(0,format,msg,vl);
PutLineS(text);
free_string(&text);
va_end(vl);
}
/*VARARGS2*/
void menu_Write_to_screen (
#if ANSI_C
struct menu_context * ctx,
CONST char *format, CONST char *msg, ...
#else
ctx, format, msg, va_alist
#endif
)
#if !ANSI_C
struct menu_context * ctx;
CONST char *format;
CONST char *msg;
va_dcl
#endif
{
va_list vl;
struct string *text;
DPRINT(Debug,49, (&Debug,
"menu_Write_to_screen(%p,format=\"%s\",...)\n",
ctx,format));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_Write_to_screen",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_Write_to_screen",
"Bad draw magic number",0);
SYNC(ctx);
Va_start(vl, msg); /* defined in defs.h */
/** This routine writes to the screen at the current location.
when done, it increments lines & columns accordingly by
looking for "\n" sequences... **/
text = elm_smessage(0,format,msg,vl);
ctx->routine->wra_PutLineS(ctx,text);
free_string(&text);
va_end(vl);
}
void PutLine0(x, y, line)
int x,y;
CONST char *line;
{
DPRINT(Debug,49, (&Debug, "PutLine0(%d,%d,\"%s\")\n",x,y,line));
SYNC(default_context);
cur_PutLine0(x,y,line,NULL);
}
void menu_PutLine0(ctx, x, y, line)
struct menu_context * ctx;
int x,y;
CONST char *line;
{
DPRINT(Debug,49, (&Debug,
"menu_PutLine0(%p,%d,%d,\"%s\")\n",
ctx,x,y,line));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_PutLine0",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_PutLine0",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_PutLine0(ctx,x,y,line);
}
void PutLineX(
#if ANSI_C
int x, int y, const char *format, const char *line, ...
#else
x, y, format, line, va_alist
#endif
)
#if !ANSI_C
int x;
int y;
CONST char *format;
CONST char *line;
va_dcl
#endif
{
va_list vl;
struct string *text;
DPRINT(Debug,49, (&Debug, "PutLineX(%d,%d,format=\"%s\",...)\n",x,y,format));
SYNC(default_context);
Va_start(vl, line); /* defined in defs.h */
MoveCursor(x,y);
text = elm_smessage(0,format,line,vl);
PutLineS(text);
free_string(&text);
va_end(vl);
}
void menu_PutLineX(
#if ANSI_C
struct menu_context * ctx,
int x, int y, const char *format, const char *line, ...
#else
ctx, x, y, format, line, va_alist
#endif
)
#if !ANSI_C
struct menu_context * ctx;
int x;
int y;
CONST char *format;
CONST char *line;
va_dcl
#endif
{
va_list vl;
struct string *text;
DPRINT(Debug,49, (&Debug,
"menu_PutLineX(%p,%d,%d,format=\"%s\",...)\n",
ctx, x,y,format));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_PutLineX",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_PutLineX",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_MoveCursor(ctx, x, y);
Va_start(vl, line); /* defined in defs.h */
text = elm_smessage(0,format,line,vl);
ctx->routine->wra_PutLineS(ctx,text);
free_string(&text);
va_end(vl);
}
void CleartoEOLN()
{
DPRINT(Debug,49, (&Debug, "CleartoEOLN()\n"));
SYNC(default_context);
cur_CleartoEOLN();
}
void menu_CleartoEOLN(ctx)
struct menu_context * ctx;
{
DPRINT(Debug,49, (&Debug, "menu_CleartoEOLN(%p)\n",ctx));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_CleartoEOLN",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_CleartoEOLN",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_CleartoEOLN(ctx);
}
void CleartoEOS()
{
DPRINT(Debug,49, (&Debug, "CleartoEOS()\n"));
SYNC(default_context);
cur_CleartoEOS();
}
void menu_CleartoEOS(ctx)
struct menu_context * ctx;
{
DPRINT(Debug,49, (&Debug, "menu_CleartoEOS(%p)\n",ctx));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_CleartoEOS",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_CleartoEOS",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_CleartoEOS(ctx);
}
int RawState()
{
int r;
DPRINT(Debug,49, (&Debug, "RawState()\n"));
r = cur_RawState();
return r;
}
struct menu_context * Raw(state)
int state;
{
int sig = state & RAW_FROM_SIGNAL;
int tite = !(state & NO_TITE);
int on_cooked = default_context == &COOKED_MENU;
SIGDPRINT(Debug,4, (&Debug, "Raw(%d): sig = %d tite=%d on_cooked=%d\n",
state,sig,tite,on_cooked));
cur_Raw(state);
if (sig) {
SIGDPRINT(Debug,4, (&Debug,
"Raw: Switching menu context on signal handler disabled\n"));
} else {
if (cur_RawState() && tite && on_cooked) {
DPRINT(Debug,4, (&Debug, "Raw: Switching from COOKED MENU\n"));
default_context = ROOT_MENU.next_menu;
if (!default_context) {
default_context = &ROOT_MENU;
DPRINT(Debug,4, (&Debug, " ... To ROOT MENU\n"));
}
DPRINT(Debug,9, (&Debug,
"Raw: default context to %p\n",
default_context));
StartSyncronize(default_context);
return default_context;
}
if (! cur_RawState() && tite && !on_cooked) {
EndSyncronize(default_context);
DPRINT(Debug,4, (&Debug, "Raw: Switching TO COOKED MENU\n"));
default_context = &COOKED_MENU;
DPRINT(Debug,9, (&Debug,
"Raw: default context to %p\n",
default_context));
return default_context;
}
}
if (!cur_RawState()) {
SIGDPRINT(Debug,4, (&Debug, "Raw: returning COOKED MENU\n"));
return &COOKED_MENU;
}
return default_context;
}
struct charset_state * ReadCh2(flags)
int flags;
{
struct charset_state *st;
DPRINT(Debug,49, (&Debug, "ReadCh2(%d)\n",flags));
SYNC(default_context);
st = cur_ReadCh2(flags,InGetPrompt);
return st;
}
struct charset_state * menu_ReadCh2(ptr,flags)
struct menu_context *ptr;
int flags;
{
struct charset_state *st;
DPRINT(Debug,49, (&Debug, "menu_ReadCh2(%p,...,%d)\n",ptr,flags));
if (MENU_CONTEXT_magic != ptr->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ReadCh2",
"Bad type magic number",0);
if (MENU_DRAW_magic != ptr->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ReadCh2",
"Bad draw magic number",0);
SYNC(ptr);
if (ptr->redraw && (flags & READCH_MASK)) {
set_last_state(system_charset);
reset_state(last_state,1);
last_state->caller_flags = (flags & READCH_MASK);
return last_state; /* cur_ReadCh2 checks now default_contect
*/
}
if (ptr->changed && (flags & READCH_resize)) {
set_last_state(system_charset);
reset_state(last_state,1);
last_state->caller_flags = RESIZE_MARK;
return last_state; /* cur_ReadCh2 checks now default_contect
*/
}
st = ptr->routine->wra_ReadCh2(ptr,flags,InGetPrompt);
return st;
}
int menu_ReadCh(ptr,flags)
struct menu_context *ptr;
int flags;
{
int c;
DPRINT(Debug,49, (&Debug, "menu_ReadCh(%p,...,%d)\n",ptr,flags));
if (ptr->magic != MENU_CONTEXT_magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ReadCh",
"Bad type magic number",0);
if (MENU_DRAW_magic != ptr->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ReadCh",
"Bad draw magic number",0);
SYNC(ptr);
if (ptr->redraw && (flags & READCH_MASK)) {
c = (flags & READCH_MASK);
DPRINT(Debug,50, (&Debug, "menu_ReadCh=0x%02x (REDRAW_MARK)\n",c));
return c; /* cur_ReadCh2 checks now
default_contect
*/
}
if (ptr->changed && (flags & READCH_resize)) {
c = RESIZE_MARK;
DPRINT(Debug,50, (&Debug, "menu_ReadCh=0x%02x (RESIZE_MARK)\n",c));
return c;
}
do {
struct charset_state *ch = ptr->routine->wra_ReadCh2(ptr,flags,InGetPrompt);
if (!ch) {
c = EOF;
DPRINT(Debug,4,(&Debug,
"menu_ReadCh==EOF (errno=%d)\n",errno));
} else if (ch -> caller_flags) {
c = ch -> caller_flags;
DPRINT(Debug,4,(&Debug,
"menu_ReadCh==%d (flags)\n",c));
} else
c = state_is_onebyte(ch);
if (!c) {
DPRINT(Debug,4,(&Debug,
"menu_ReadCh: Not a one byte character or zero byte!"));
/* Ring a bell */
ptr->routine->wra_Writechar(ptr,'\007');
} else {
DPRINT(Debug,4,(&Debug,
"menu_ReadCh==%d (one byte character)\n",
c));
}
if (!c && (flags & READCH_poll)) {
c = TIMEOUT_MARK;
DPRINT(Debug,4, (&Debug, "menu_ReadCh==TIMEOUT_MARK\n"));
}
} while (0 == c);
DPRINT(Debug,50, (&Debug, "menu_ReadCh=0x%02x\n",c));
return c;
}
void ScreenSize(lines, columns)
int *lines, *columns;
{
DPRINT(Debug,49, (&Debug, "ScreenSize(*,*)\n"));
/* cur_ScreenSize DO NOT return lines-1 (as ScreenSize() did) */
cur_ScreenSize(lines,columns);
((*lines)--);
}
void menu_ScreenSize(ctx,lines, columns)
struct menu_context *ctx;
int *lines, *columns;
{
DPRINT(Debug,49, (&Debug, "ScreenSize(%p,*,*)\n",ctx));
if (ctx->magic != MENU_CONTEXT_magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ScreenSize",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ScreenSize",
"Bad draw magic number",0);
/* menu_ScreenSize DO NOT return lines-1 (as ScreenSize() did) */
ctx->routine->wra_ScreenSize(ctx,lines,columns);
}
void GetXYLocation(x,y)
int *x,*y;
{
DPRINT(Debug,49, (&Debug, "GetXYLocation(*,*)\n"));
SYNC(default_context);
cur_GetXYLocation(x,y);
}
void menu_GetXYLocation(ctx,row,col)
struct menu_context *ctx;
int *row,*col;
{
DPRINT(Debug,49, (&Debug, "menu_GetXYLocation(%p,*,*)\n",ctx));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetXYLocation",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetXYLocation",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_GetXYLocation(ctx,row,col);
/* WARNING:
row,col != ctx->row, ctx->col
because row,col are relative and ctc->row, ctx->col
are absolute
*/
}
/* NOTE: Is called fron interrupt! */
void ClearScreen(interrupt)
int interrupt;
{
if (interrupt) {
SIGDPRINT(Debug,49, (&Debug, "ClearScreen() -- interrupt\n"));
} else {
DPRINT(Debug,49, (&Debug, "ClearScreen() -- no interrupt\n"));
SYNC(default_context);
}
cur_ClearScreen();
}
void menu_ClearScreen(ptr)
struct menu_context *ptr;
{
int r;
DPRINT(Debug,49, (&Debug, "menu_ClearScreen(%p,...)\n",ptr));
if (ptr->magic != MENU_CONTEXT_magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_ClearScreen",
"Bad type magic number",0);
if (MENU_DRAW_magic != ptr->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetXYLocation",
"Bad draw magic number",0);
SYNC(ptr);
ptr->routine->wra_ClearScreen(ptr);
}
void MoveCursor(row, col)
int row, col;
{
DPRINT(Debug,49, (&Debug, "MoveCursor(%d,%d)\n",row,col));
SYNC(default_context);
cur_MoveCursor(row, col, NULL);
}
void menu_MoveCursor(ctx,row, col)
struct menu_context *ctx;
int row, col;
{
DPRINT(Debug,49, (&Debug, "MoveCursor(%p,%d,%d)\n",ctx,row,col));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetXYLocation",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetXYLocation",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_MoveCursor(ctx, row, col);
}
int menu_GetAbsLine(ctx,row)
struct menu_context *ctx;
int row;
{
int result;
DPRINT(Debug,49, (&Debug, "menu_GetAbsLine(%p,%d)\n",ctx,row));
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetAbsLine",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_GetAbsLine",
"Bad draw magic number",0);
ctx->routine->wra_calculate_line(ctx,row,&result);
DPRINT(Debug,49, (&Debug, "menu_GetAbsLine=%d\n",result));
return result;
}
void CarriageReturn()
{
DPRINT(Debug,49, (&Debug, "CarriageReturn()\n"));
SYNC(default_context);
/** move the cursor to the beginning of the current line **/
Writechar('\r');
}
void NewLine()
{
DPRINT(Debug,49, (&Debug, "NewLine()\n"));
/** move the cursor to the beginning of the next line **/
SYNC(default_context);
Writechar('\r');
Writechar('\n');
FlushBuffer();
}
int CUR_modes = 0;
void StartBold()
{
DPRINT(Debug,49, (&Debug, "StartBold()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, pg_BOLD,0);
}
void EndBold()
{
DPRINT(Debug,49, (&Debug, "EndBold()\n"));
/** compliment of startbold **/
SYNC(default_context);
cur_changemode(&CUR_modes, 0, pg_BOLD);
}
void StartInverse()
{
DPRINT(Debug,49, (&Debug, "StartInverse()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, pg_INVERSE,0);
}
void EndInverse()
{
DPRINT(Debug,49, (&Debug, "EndInverse()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, 0, pg_INVERSE);
}
void StartUnderline()
{
DPRINT(Debug,49, (&Debug, "StartUnderline()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, pg_UNDERLINE,0);
}
void EndUnderline()
{
DPRINT(Debug,49, (&Debug, "EndUnderline()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, 0, pg_UNDERLINE);
}
void StartHalfbright()
{
DPRINT(Debug,49, (&Debug, "StartHalfbright()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, pg_HALFBRIGHT,0);
}
void EndHalfbright()
{
DPRINT(Debug,49, (&Debug, "EndHalfbright()\n"));
SYNC(default_context);
cur_changemode(&CUR_modes, 0, pg_HALFBRIGHT);
}
void menu_StartXX(ctx,f)
struct menu_context *ctx;
int f;
{
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_StartXX",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_StartXX",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_changemode(ctx, f, 0);
}
void menu_EndXX(ctx,f)
struct menu_context *ctx;
int f;
{
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_EndXX",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_EndXX",
"Bad draw magic number",0);
SYNC(ctx);
ctx->routine->wra_changemode(ctx, 0, f);
}
void EndSyncronize(ctx)
struct menu_context *ctx;
{
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"EndSyncronize",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"EndSyncronize",
"Bad draw magic number",0);
if (sync_ctx != ctx)
return; /* Nothing need to do */
if (ctx == &COOKED_MENU) {
DPRINT(Debug,9, (&Debug, "EndSyncronize: Skippig cooked meny syncronize\n"));
sync_ctx = NULL;
return;
}
DPRINT(Debug,9, (&Debug, "EndSyncronize: Syncronize from %p\n",ctx));
ctx->routine->wra_SyncLeave(ctx);
sync_ctx = NULL;
}
static void StartSyncronize(ctx)
struct menu_context *ctx;
{
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"EndSyncronize",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"EndSyncronize",
"Bad draw magic number",0);
if (sync_ctx == ctx)
return; /* Nothing need to do */
if (ctx == &COOKED_MENU) {
DPRINT(Debug,9, (&Debug, "StartSyncronize: Skippig cooked menu syncronize\n"));
sync_ctx = ctx;
return;
}
DPRINT(Debug,9, (&Debug, "StartSyncronize: Syncronize to %p\n",ctx));
ctx->routine->wra_SyncEnter(ctx);
sync_ctx = ctx;
}
void Syncronize(ctx)
struct menu_context *ctx;
{
if (sync_ctx == ctx)
return; /* Nothing need to do */
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"Syncronize",
"Bad type magic number",0);
if (MENU_DRAW_magic != ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"Syncronize",
"Bad draw magic number",0);
if (sync_ctx == &COOKED_MENU) {
DPRINT(Debug,9, (&Debug, "Syncronize: Skippig cooked menu syncronize\n"));
sync_ctx = NULL;
}
if (sync_ctx) {
if (MENU_CONTEXT_magic != sync_ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"Syncronize",
"Bad type magic number",0);
if (MENU_DRAW_magic != sync_ctx->routine->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"Syncronize",
"Bad draw magic number",0);
DPRINT(Debug,9, (&Debug, "Syncronize: Syncronize from %p\n",sync_ctx));
sync_ctx->routine->wra_SyncLeave(sync_ctx);
}
if (ctx == &COOKED_MENU) {
DPRINT(Debug,9, (&Debug, "Syncronize: Skippig cooked menu syncronize\n"));
sync_ctx = ctx;
return;
}
DPRINT(Debug,9, (&Debug, "Syncronize: Syncronize to %p\n",ctx));
ctx->routine->wra_SyncEnter(ctx);
sync_ctx = ctx;
}
void menu_set_default(ctx)
struct menu_context *ctx;
{
if (default_context == ctx)
return;
if (MENU_CONTEXT_magic != ctx->magic)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_set_default",
"Bad type magic number",0);
if (sync_ctx->routine != &CURSES_ROUTINES)
panic("SCREEN PANIC",__FILE__,__LINE__,"menu_set_default",
"Not a main menu",0);
SYNC(ctx);
default_context = ctx;
DPRINT(Debug,9, (&Debug, "menu_set_default: Clearing screen, and setting redraw flag\n"));
cur_ClearScreen();
ctx->redraw = 1;
DPRINT(Debug,9, (&Debug,
"menu_set_default: default context to %p\n",
default_context));
}
int get_tabspacing()
{
DPRINT(Debug,49, (&Debug, "get_tabspacing()\n"));
return cur_tabspacing;
}
#ifdef TERMIOS
static struct tf_state ttysig_state;
#endif
void cancel_set_ttysig_X()
{
DPRINT(Debug,49, (&Debug, "cancel_set_ttysig_X()\n"));
#ifdef TERMIOS
toggle_lflag(&ttysig_state,ISIG,0);
#endif
}
void cancel_reset_ttysig_X()
{
DPRINT(Debug,49, (&Debug, "cancel_reset_ttysig_X()\n"));
#ifdef TERMIOS
reset_lfag(&ttysig_state);
#endif
}
/*
* Local Variables:
* mode:c
* c-basic-offset:4
* buffer-file-coding-system: iso-8859-1
* End:
*/
syntax highlighted by Code2HTML, v. 0.9.1