home *** CD-ROM | disk | FTP | other *** search
- //************************************
- //
- // Name : GuiExtras.c
- //
- //************************************
-
- //**** Header files
-
- //** OS Include files
- #include <intuition/intuition.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/asl.h>
- #include <libraries/gadtools.h>
-
- //** OS function prototypes
- #include <clib/asl_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
-
- //** OS function inline calls
- #include <pragmas/asl_pragmas.h>
- #include <pragmas/intuition_pragmas.h>
- #include <pragmas/gadtools_pragmas.h>
-
- //** ANSI C includes
- #include <string.h>
-
- //** Application includes
- #include "Librarian.h"
- #include "GadToolsBox.h"
- #include "Node.h"
- #include "GuiExtras.h"
-
-
- //**** Local storage
-
- static struct Requester waitReq;
-
- UWORD __chip waitPointer[] = {
- 0x0000, 0x0000, /* reserved, must be NULL */
- 0x0400, 0x07C0, 0x0000, 0x07C0, 0x0100, 0x0380, 0x0000, 0x07E0,
- 0x07C0, 0x1FF8, 0x1FF0, 0x3FEC, 0x3FF8, 0x7FDE, 0x3FF8, 0x7FBE,
- 0x7FFC, 0xFF7F, 0x7EFC, 0xFFFF, 0x7FFC, 0xFFFF, 0x3FF8, 0x7FFE,
- 0x3FF8, 0x7FFE, 0x1FF0, 0x3FFC, 0x07C0, 0x1FF8, 0x0000, 0x07E0,
- 0x0000, 0x0000, /* reserved, must be NULL */
- }; // waitPointer
-
- LONG sig_g;
-
-
- //**** wait code
-
- BOOL beginWait(struct Window *win) {
- InitRequester(&waitReq);
- if (Request(&waitReq, win)) {
- SetPointer(win, waitPointer, 16, 16, -6, 0);
- return(TRUE);
- } else
- return(FALSE);
- } // beginWait
-
- VOID endWait(struct Window *win) {
- ClearPointer(win);
- EndRequest(&waitReq, win);
- } // endWait
-
-
- //**** Requesters
-
- void Request_About(void) {
- static struct EasyStruct myES = {
- sizeof(struct EasyStruct),
- 0,
- "EasyTM Prefs - About",
- "EasyTM Prefs version 1.0\n"
- "\n"
- "Copyright © 1996 Tak Tang\n"
- "All Rights Reserved.",
- "Ok",
- }; // myES
-
- beginWait(ETMPWnd);
- EasyRequest(ETMPWnd, &myES, NULL);
- endWait(ETMPWnd);
- } // Request_About
-
-
- void Request_StackLow(void) {
- static struct EasyStruct myES = {
- sizeof(struct EasyStruct),
- 0,
- "EasyTM Prefs - Stack",
- "Minimum stack is 4096 bytes\n",
- "Ok",
- }; // myES
-
- beginWait(ETMPWnd);
- EasyRequest(ETMPWnd, &myES, NULL);
- endWait(ETMPWnd);
- } // Request_StackLow
-
- void Request_PriRange(void) {
- static struct EasyStruct myES = {
- sizeof(struct EasyStruct),
- 0,
- "EasyTM Prefs - Priority",
- "Priorities range from -128 to 127\n",
- "Ok",
- }; // myES
-
- beginWait(ETMPWnd);
- EasyRequest(ETMPWnd, &myES, NULL);
- endWait(ETMPWnd);
- } // Request_PriRange
-
- void Request_FileTrouble(char *op, char *file) {
- static struct EasyStruct myES = {
- sizeof(struct EasyStruct),
- 0,
- "EasyTM Prefs",
- "Help! Trouble %s\n"
- "\"%s\"",
- "Ok",
- }; // myES
-
- beginWait(ETMPWnd);
- EasyRequest(ETMPWnd, &myES, NULL,op,file);
- endWait(ETMPWnd);
- } // Request_FileTrouble
-
- int Request_File(char *Hail,char *File, char *Dir) {
- struct FileRequester *fr;
- int rc=0;
- if (fr = (struct FileRequester *) AllocAslRequestTags(ASL_FileRequest,
- ASL_Hail, Hail,
- ASL_File, File,
- ASL_Dir, Dir,
- TAG_DONE))
- {
- if (AslRequest(fr, NULL)) {
- strcpy(File,fr->rf_File);
- strcpy(Dir ,fr->rf_Dir );
- rc=1;
- }
- FreeAslRequest(fr);
- } // if Alloc
- return rc;
- } // RequestOpen
-
-
- //**** Window
-
- void CX_Show(void) {
- if ( (NULL==sig_g) && (0==OpenETMPWindow()) ) {
- sig_g = 1 << ETMPWnd->UserPort->mp_SigBit;
- GT_SetGadgetAttrs(ETMPGadgets[GDX_MenuItems],ETMPWnd,NULL,GTLV_Labels, List, TAG_END);
- }
- } // CX_Show
-
- void CX_Hide(void) {
- if (NULL!=sig_g) {
- CloseETMPWindow();
- sig_g=NULL;
- }
- } // CX_Hide
-
-
- //**** Display
-
- void DisplayNode(struct ProgNode *pn) {
- if (pn) {
- GT_SetGadgetAttrs(ETMPGadgets[GD_Tool],ETMPWnd,NULL,GTST_String,pn->pn_Filename);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Drawer],ETMPWnd,NULL,GTST_String,pn->pn_Directory);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Stack],ETMPWnd,NULL,GTIN_Number,pn->pn_Stack);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Pri],ETMPWnd,NULL,GTIN_Number,pn->pn_Priority);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Args],ETMPWnd,NULL,GTCY_Active,pn->pn_LaunchCode & LC_ARG_MASK);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Env],ETMPWnd,NULL,GTCY_Active,((pn->pn_LaunchCode & LC_ENV_MASK)>>4)-1);
- } else {
- GT_SetGadgetAttrs(ETMPGadgets[GD_Tool],ETMPWnd,NULL,GTST_String,NULL);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Drawer],ETMPWnd,NULL,GTST_String,NULL);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Stack],ETMPWnd,NULL,GTIN_Number,4096L);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Pri],ETMPWnd,NULL,GTIN_Number,0L);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Args],ETMPWnd,NULL,GTCY_Active,0);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Env],ETMPWnd,NULL,GTCY_Active,0);
- }
- } // DisplayNode
-
- void PropertyAble(BOOL b) {
- BOOL d;
- d=(TRUE==b)?FALSE:TRUE;
- GT_SetGadgetAttrs(ETMPGadgets[GD_Del],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Up],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Down],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Args],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Env],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_GetFile],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_GetS],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_GetP],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Tool],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Drawer],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Stack],ETMPWnd,NULL,GA_Disabled,d);
- GT_SetGadgetAttrs(ETMPGadgets[GD_Pri],ETMPWnd,NULL,GA_Disabled,d);
- } // PropertyAble
-
- //**** End of file
-