home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 January
/
usenetsourcesnewsgroupsinfomagicjanuary1994.iso
/
sources
/
x
/
volume8
/
xfig2.8
/
part03
/
msgsw.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-07-02
|
3KB
|
142 lines
/*
* FIG : Facility for Interactive Generation of figures
*
* Copyright (c) 1985 by Supoj Sutanthavibul (supoj@sally.UTEXAS.EDU)
* January 1985.
* 1st revision : Aug 1985.
* 2nd revision : Feb 1988.
*
* %W% %G%
*/
#include "fig.h"
#include "resources.h"
#include "const.h"
#include "font.h"
#include "paintop.h"
#include "psfonts.h"
extern int errno;
extern int action_on;
extern null_proc();
extern int CANVAS_WIDTH;
extern int PANEL_WID;
extern int SIDERULER_WIDTH;
extern char prefix[], suffix[];
extern int leng_prefix, leng_suffix;
extern int cur_x, cur_y;
extern (*canvas_kbd_proc)();
extern (*canvas_locmove_proc)();
extern (*canvas_leftbut_proc)();
extern (*canvas_middlebut_proc)();
extern (*canvas_rightbut_proc)();
/***************** exported variables and procedures *****************/
extern int put_msg();
extern int put_fmsg();
extern int init_msgreceiving();
/************************ local variables and routines ******************/
#define BUF_SIZE 80
static char prompt[BUF_SIZE];
static msg_selected();
static msg_sighandler();
static Arg msg_args[] =
{
/* 0 */ { XtNwidth, (XtArgVal) 0 },
/* 1 */ { XtNheight, (XtArgVal)MSG_HEIGHT },
/* 2 */ { XtNlabel, (XtArgVal)"" },
/* 3 */ { XtNfromHoriz, (XtArgVal)NULL },
/* 4 */ { XtNhorizDistance, (XtArgVal) 2 },
/* 5 */ { XtNfromVert, (XtArgVal)NULL },
/* 6 */ { XtNvertDistance, (XtArgVal) -1 },
/* 7 */ { XtNleft, (XtArgVal) XtChainLeft },
/* 8 */ { XtNinput, (XtArgVal) True },
};
int init_msg(tool)
TOOL tool;
{
/* width */
msg_args[0].value = PANEL_WID+CANVAS_WIDTH+SIDERULER_WIDTH -
FONT_PANE_WIDTH;
msg_args[3].value = (XtArgVal)psfont; /* to the right of font ind. */
msg_args[5].value = (XtArgVal)canvas_sw; /* just below the canvas */
msg_sw = XtCreateManagedWidget("message", commandWidgetClass, tool,
msg_args, XtNumber(msg_args));
return (1);
}
/*
** We have to do this after realizing the widget otherwise
** the width is computed wrong and you get a tiny text box.
*/
setup_msg()
{
static Arg addn_args[] =
{
{ XtNfont, (XtArgVal)NULL },
};
if (bold_font != NULL)
{
addn_args[0].value = (XtArgVal)bold_font;
XtSetValues(msg_sw, addn_args, XtNumber(addn_args));
}
msg_win = XtWindow(msg_sw);
XDefineCursor(tool_d, msg_win, (Cursor)pencil_cursor.bitmap);
}
/*VARARGS1*/
put_msg(format, arg1, arg2, arg3, arg4, arg5)
char *format;
int arg1, arg2, arg3, arg4, arg5;
{
sprintf(prompt, format, arg1, arg2, arg3, arg4, arg5);
msg_args[2].value = (XtArgVal)prompt;
XtSetValues(msg_sw, &msg_args[2], 1);
}
/* floating point version - MIPS (DEC3100) doesn't like ints where floats are used */
/*VARARGS1*/
put_fmsg(format, arg1, arg2, arg3, arg4, arg5)
char *format;
double arg1, arg2, arg3, arg4, arg5;
{
sprintf(prompt, format, arg1, arg2, arg3, arg4, arg5);
msg_args[2].value = (XtArgVal)prompt;
XtSetValues(msg_sw, &msg_args[2], 1);
}
clear_message()
{
msg_args[2].value = (XtArgVal)"";
XtSetValues(msg_sw, &msg_args[2], 1);
}
init_msg_receiving(msg_recipient, p)
int (*msg_recipient)();
char *p;
{
char reply[100];
prompt_string(p, reply);
(*msg_recipient)(reply);
}
blink_msg()
{
int i;
for (i = 0; i < 2000; i++)
;
clear_message();
}