home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
206.lha
/
Flist_v1.2
/
Sources
/
misc.c
< prev
next >
Wrap
C/C++ Source or Header
|
1988-12-28
|
3KB
|
143 lines
/*
String gadgets and misc functions.
Written by: Steve (Raz) Berry
*/
#include "flist.h"
char strbuf[256];
char undo[256];
struct IntuiText AutoText = {
REDP, WHTP,
JAM2, 15,
5, NL,
" Flist ", NULL
};
/** TRUE TEXT **/
struct IntuiText TRUEtext = {
BLUP, WHTP,
JAM2,
7, /* LeftEdge */
3, /* TopEdge */
NL, /* Default font */
"OK", /* Text */
NL /* No pointer to next text */
};
/** FALSE TEXT **/
struct IntuiText FALSEtext = {
REDP, WHTP,
JAM2,
7, /* LeftEdge */
3, /* TopEdge */
NL, /* Default font */
"NO!", /* Text */
NL
};
struct StringInfo strinfo = {
strbuf,
undo,
0,
200,
0, 0,
0, 0,
0, 0,
0, 0,
0
};
struct Gadget str = {
NULL,
20, 20, 240, 10,
GADGHCOMP,
GADGIMMEDIATE|RELVERIFY,
STRGADGET,
NULL,
NULL,
NULL,
NULL,
(APTR)&strinfo,
0, NULL
};
struct NewWindow strwin = {
140,70, /* LeftEdge and TopEdge */
300, 40, /* Width and Height */
0, 1, /* DetailPen and BlockPen */
CLOSEWINDOW|GADGETUP, /* IDCMP Flags */
WINDOWDEPTH|WINDOWDRAG|WINDOWCLOSE /* Flags */
|SMART_REFRESH|ACTIVATE,
&str, NULL, /* Gadget and Image pointers */
NULL, /* Title string */
NULL, /* Screen ptr null (this screen) */
NULL, /* BitMap pointer */
50, 20, /* MinWidth and MinHeight */
320, 200, /* MaxWidth and MaxHeight */
WBENCHSCREEN /* Type of window */
};
/* Make a string gadget in it's own window */
struct Window *make_gadget(title)
char *title;
{
struct Window *strptr;
strwin.Title = title;
strptr = OpenWindow(&strwin);
if(strptr != NULL) {
RefreshGadgets(&str, strptr, NULL);
ActivateGadget(&str, strptr, NULL);
}
return strptr;
}
/* Wait for one event from a window, then return */
wait_for_event(win)
struct Window *win;
{
ULONG imask,signals;
struct IntuiMessage *imsg;
imask = 1 << win->UserPort->mp_SigBit;
signals = Wait(imask);
if(signals & imask) {
while(imsg = (struct IntuiMessage *)GetMsg(win->UserPort))
ReplyMsg(imsg);
}
if (win) {
while(imsg = (struct IntuiMessage *)GetMsg(win->UserPort))
ReplyMsg(imsg);
CloseWindow(win);
}
}
int auto_req();
/***************************************************************************
HANDLE AUTO-REQUESTS
***************************************************************************/
int auto_req (text)
char *text; /* Pointer to the text */
{
struct Process *proc;
int val, temp;
AutoText.IText = text; /* Text pointer */
temp = ((CHARW + 1) * strlen(text)) + (4 * CHARW);
temp = (temp < 150) ? 150: temp;
proc = (struct Process *)FindTask(NULL);
val = AutoRequest(proc->pr_WindowPtr, &AutoText, &TRUEtext, &FALSEtext,
0L, 0L, (LONG)temp, 60L );
return val;
}