/* MRBackup Pathname Specifications "Requester" * Filename: PathRequest.c * History: (most recent change first) * * 09/20/87 -MRR- V1.3: The pathname gadgets were formerly attached to * a requester. I have removed the requester stuff, since * it did nothing to enhance the functionality of the * pathname specification window. */ /********************************************************************** * Gadget Structure Definitions * * Some of the following structures were defined using the Gadget Editor * created by the Programmer's Network. * The credits for the Gadget Editor are: * * John Draper - Initial design, coordination, and integration. * Ray Larson - Images and Intuitext. * Brent Southard - Saving and restoring gadgets in binary form. * Dave Milligan - Gadget Editor Main menu. * * **********************************************************************/ /* The header files needed for gadget definitions */ #include #include #include #include #include #include #include #include #include #include #include "gadget.h" #define PATHGADTYPE STRGADGET /********************************************************************** * Text attribute structures used in rendering IntuiTexts **********************************************************************/ /* A note to the fastidious: These things are duplicated in the menu * package. Some ambitious soul should consolidate them into a single * definition. */ char def_font[] ="topaz.font"; struct TextAttr TxtAt_Plain = { (UBYTE *)def_font, 8, FS_NORMAL, FPF_ROMFONT}; struct TextAttr TxtAt_BIU = {(UBYTE *)def_font, 8, FSF_BOLD | FSF_ITALIC | FSF_UNDERLINED, FPF_ROMFONT}; struct TextAttr TxtAt_BU = {(UBYTE *)def_font, 8, FSF_BOLD | FSF_UNDERLINED, FPF_ROMFONT}; struct TextAttr TxtAt_BI = {(UBYTE *)def_font, 8, FSF_BOLD | FSF_ITALIC, FPF_ROMFONT}; struct TextAttr TxtAt_B ={(UBYTE *)def_font, 8, FSF_BOLD, FPF_ROMFONT}; struct TextAttr TxtAt_IU ={(UBYTE *)def_font, 8, FSF_ITALIC | FSF_UNDERLINED, FPF_ROMFONT}; struct TextAttr TxtAt_I ={(UBYTE *)def_font, 8, FSF_ITALIC, FPF_ROMFONT}; struct TextAttr TxtAt_U ={(UBYTE *)def_font, 8, FSF_UNDERLINED, FPF_ROMFONT}; /* STOP gadget definition */ /***************************************************************/ /* The following data structure contains the image data */ /***************************************************************/ USHORT StopGadImg_dat[]= { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x00ff, 0xffff, 0xffe0, 0x0000, 0x0006, 0x0000, 0x03ff, 0xffff, 0xfff8, 0x0000, 0x0006, 0x0000, 0x07ff, 0xffff, 0xfffc, 0x0000, 0x0027, 0x0000, 0x1fff, 0xffff, 0xffff, 0x0000, 0x0021, 0x0000, 0x3fff, 0xffff, 0xffff, 0x8000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xe000, 0x0026, 0x0001, 0xffff, 0xffff, 0xffff, 0xf000, 0x0000, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0020, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0038, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0010, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0000, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0036, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0020, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0006, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x003c, 0x000f, 0xffff, 0xffff, 0xffff, 0xfe00, 0x0006, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0031, 0x0001, 0xffff, 0xffff, 0xffff, 0xf000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xe000, 0x0000, 0x0000, 0x3fff, 0xffff, 0xffff, 0x8000, 0x000f, 0x0000, 0x1fff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x07ff, 0xffff, 0xfffc, 0x0000, 0x0000, 0x0000, 0x03ff, 0xffff, 0xfff8, 0x0000, 0x0000, 0x0000, 0x00ff, 0xffff, 0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x00ff, 0xffff, 0xffe0, 0x0000, 0x0000, 0x0000, 0x03ff, 0xffff, 0xfff8, 0x0000, 0x0000, 0x0000, 0x07ff, 0xffff, 0xfffc, 0x0000, 0x0000, 0x0000, 0x1fff, 0xffff, 0xffff, 0x0000, 0x0020, 0x0000, 0x3fff, 0xffff, 0xffff, 0x8000, 0x0000, 0x0000, 0xffff, 0xffff, 0xffff, 0xe000, 0x003f, 0x0001, 0xffff, 0xffff, 0xffff, 0xf000, 0x0006, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0001, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0026, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0000, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0001, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0006, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0006, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0003, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0001, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0000, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0024, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0000, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0006, 0x0007, 0xffff, 0xffff, 0xffff, 0xfc00, 0x0000, 0x0001, 0xffff, 0xffff, 0xffff, 0xf000, 0x0001, 0x0000, 0xffff, 0xffff, 0xffff, 0xe000, 0x0000, 0x0000, 0x3fff, 0xffff, 0xffff, 0x8000, 0x0001, 0x0000, 0x1fff, 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x07ff, 0xffff, 0xfffc, 0x0000, 0x0000, 0x0000, 0x03ff, 0xffff, 0xfff8, 0x0000, 0x0000, 0x0000, 0x00ff, 0xffff, 0xffe0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0007, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0006, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0002 }; /***************************************************************/ /* The following data structure defines the image */ /***************************************************************/ struct Image StopGadImg = { 0, 0, /* Left, Top */ 90, 38, /* Width, Height */ 2, /* Depth */ (USHORT *)&StopGadImg_dat, /* ImageData */ 0xff, /* PlanePick */ 0x00, /* PlaneOnOff */ NULL /* Next Image */ }; /********************************************************************** * IntuiTexts for the StopGad gadget. **********************************************************************/ struct IntuiText StopGad_Text_0 = { 0, 3, /* FrontPen, BackPen */ JAM2, /* DrawMode */ 26, 13, /* LeftEdge, TopEdge */ &TxtAt_B, /* ITextFont Pointer - bold */ /* The IText */ (UBYTE *)"STOP", NULL }; /********************************************************************** * Gadget Structure definition for the StopGad gadget. **********************************************************************/ struct Gadget StopGad = { NULL, /* NextGadget pointer */ 76, 30, /* LeftEdge, TopEdge */ 90, 38, /* Width, Height */ GADGIMAGE, /* Gadget Flags */ RELVERIFY, /* Activation Flags */ BOOLGADGET, /* GadgetType */ (APTR)&StopGadImg, /* GadgetRender */ NULL, /* SelectRender */ &StopGad_Text_0, /* GadgetText */ 0x0, /* MutualExclude */ NULL, /* SpecialInfo */ STOPGAD, /* GadgetID */ 0x0 /* UserData Pointer */ }; #define REQUESTWIDTH 260 #define REQUESTHEIGHT 70 /* New window structure */ static struct NewWindow pathreqnw = { 640 - REQUESTWIDTH - 8, /* LeftEdge */ 12, /* TopEdge */ REQUESTWIDTH + 4, /* Width */ REQUESTHEIGHT + 10, /* Height */ 0, /* DetailPen */ 1, /* BlockPen */ GADGETDOWN | GADGETUP , /* IDCMP Flags */ WINDOWDEPTH | WINDOWDRAG | ACTIVATE ,/* Flags */ NULL, /* First gadget */ NULL, /* Checkmark */ (UBYTE *)"Pathname Specifications", /* Window title */ NULL, /* No custom streen */ NULL, /* Not a super bitmap window */ REQUESTWIDTH+4, /* MinWidth */ REQUESTHEIGHT + 10, /* MinHeight */ 640, /* MaxWidth */ 200, /* MaxHeight */ WBENCHSCREEN }; /********************************************************************** * IntuiTexts for the excludepat gadget. **********************************************************************/ struct IntuiText excludepath_Text_0 = { 3, 0, /* FrontPen, BackPen */ JAM2, /* DrawMode */ -112, 0, /* LeftEdge, TopEdge */ &TxtAt_Plain, /* ITextFont Pointer */ (UBYTE *)"Exclude Path:", /* The IText */ NULL }; /********************************************************************** * String information for the excludepat string gadget. **********************************************************************/ static UBYTE excludepath_sbuf_1[81]; static UBYTE excludepath_ubuf_1[81]; struct StringInfo excludepath_txstr_1 = { excludepath_sbuf_1, /* Buffer */ excludepath_ubuf_1, /* UndoBuffer */ 0, 80, 0, /* BufferPos, MaxChars, DispPos */ 0, 0, /* UndoPos, NumChars */ 0, 0, 0, /* DispCount, CLeft, CTop */ 0x0, 0, /* LayerPtr, LongInt */ 0x0 /* AltKeyMap */ }; /********************************************************************** * Gadget Structure definition for the excludepat gadget. **********************************************************************/ struct Gadget excludepathgad = { NULL, /* NextGadget pointer */ 144, 60, /* LeftEdge, TopEdge */ 100, 9, /* Width, Height */ GADGHCOMP, /* Gadget Flags */ GADGIMMEDIATE | RELVERIFY, /* Activation Flags */ PATHGADTYPE, /* GadgetType */ NULL, /* GadgetRender */ NULL, /* SelectRender */ &excludepath_Text_0, /* GadgetText */ 0x0, /* MutualExclude */ (APTR)&excludepath_txstr_1, /* SpecialInfo */ XCLDPATHGAD, /* GadgetID */ NULL /* UserData Pointer */ }; /********************************************************************** * IntuiTexts for the listpath gadget. **********************************************************************/ struct IntuiText listpath_Text_0 = { 3, 0, /* FrontPen, BackPen */ JAM2, /* DrawMode */ -112, 0, /* LeftEdge, TopEdge */ &TxtAt_Plain, /* ITextFont Pointer */ (UBYTE *)"Listing Path:", /* The IText */ NULL }; /********************************************************************** * String information for the listpath string gadget. **********************************************************************/ UBYTE listpath_sbuf_1[81] = "PRT:"; UBYTE listpath_ubuf_1[81]; struct StringInfo listpath_txstr_1 = { listpath_sbuf_1, listpath_ubuf_1, /* Buffer, UndoBuffer */ 0, 80, 0, /* BufferPos, MaxChars, DispPos */ 0, 4, /* UndoPos, NumChars */ 0, 0, 0, /* DispCount, CLeft, CTop */ 0x0, 0, /* LayerPtr, LongInt */ 0x0 /* AltKeyMap */ }; /********************************************************************** * Gadget Structure definition for the listpath gadget. **********************************************************************/ struct Gadget listpathgad = { NULL, /* NextGadget pointer */ 144, 48, /* LeftEdge, TopEdge */ 100, 9, /* Width, Height */ GADGHCOMP, /* Gadget Flags */ GADGIMMEDIATE | RELVERIFY , /* Activation Flags */ PATHGADTYPE, /* GadgetType */ NULL, /* GadgetRender */ NULL, /* SelectRender */ &listpath_Text_0, /* GadgetText */ 0x0, /* MutualExclude */ (APTR)&listpath_txstr_1, /* SpecialInfo */ LISTPATHGAD, /* GadgetID */ NULL /* UserData Pointer */ }; /********************************************************************** * IntuiTexts for the backpath gadget. **********************************************************************/ struct IntuiText backpath_Text_0 = { 3, 0, /* FrontPen, BackPen */ JAM2, /* DrawMode */ -104, 0, /* LeftEdge, TopEdge */ &TxtAt_Plain, /* ITextFont Pointer */ (UBYTE *)"Backup Path:", /* The IText */ NULL }; /********************************************************************** * String information for the backpath string gadget. **********************************************************************/ UBYTE backpath_sbuf_1[81] = "DF0:"; UBYTE backpath_ubuf_1[81]; struct StringInfo backpath_txstr_1 = { backpath_sbuf_1, /* Buffer */ backpath_ubuf_1, /* UndoBuffer */ 0, 80, 0, /* BufferPos, MaxChars, DispPos */ 0, 4, /* UndoPos, NumChars */ 0, 0, 0, /* DispCount, CLeft, CTop */ 0x0, 0, /* LayerPtr, LongInt */ 0x0 /* AltKeyMap */ }; /********************************************************************** * Gadget Structure definition for the backpath gadget. **********************************************************************/ struct Gadget backpathgad = { NULL, /* NextGadget pointer */ 144, 36, /* LeftEdge, TopEdge */ 100, 9, /* Width, Height */ GADGHCOMP, /* Flags */ GADGIMMEDIATE | RELVERIFY , /* Activation */ PATHGADTYPE, /* GadgetType */ NULL, /* GadgetRender */ NULL, /* SelectRender */ &backpath_Text_0, /* GadgetText */ 0x0, /* MutualExclude */ (APTR)&backpath_txstr_1, /* SpecialInfo */ BACKPATHGAD, /* GadgetID */ NULL /* UserData Pointer */ }; /********************************************************************** * IntuiTexts for the homepath gadget. **********************************************************************/ struct IntuiText homepath_Text_0 = { 3, 0, /* FrontPen, BackPen */ JAM2, /* DrawMode */ -88, 0, /* LeftEdge, TopEdge */ &TxtAt_Plain, /* ITextFont Pointer */ (UBYTE *)"Home Path:", /* The IText */ NULL }; /********************************************************************** * String information for the homepath string gadget. **********************************************************************/ UBYTE homepath_sbuf_1[81] = "DH0:"; UBYTE homepath_ubuf_1[81]; struct StringInfo homepath_txstr_1 = { homepath_sbuf_1, /* Buffer */ homepath_ubuf_1, /* UndoBuffer */ 0, 80, 0, /* BufferPos, MaxChars, DispPos */ 0, 4, /* UndoPos, NumChars */ 0, 0, 0, /* DispCount, CLeft, CTop */ 0x0, 0, /* LayerPtr, LongInt */ 0x0 /* AltKeyMap */ }; /********************************************************************** * Gadget Structure definition for the homepath gadget. **********************************************************************/ struct Gadget homepathgad = { NULL, /* NextGadget pointer */ 144, 24, /* LeftEdge, TopEdge */ 100, 9, /* Width, Height */ GADGHCOMP, /* Gadget Flags */ GADGIMMEDIATE | RELVERIFY, /* Activation Flags */ PATHGADTYPE, /* GadgetType */ NULL, /* GadgetRender */ NULL, /* SelectRender */ &homepath_Text_0, /* GadgetText */ 0x0, /* MutualExclude */ (APTR)&homepath_txstr_1, /* SpecialInfo */ HOMEPATHGAD, /* GadgetID */ NULL /* UserData Pointer */ }; struct Requester *pathrequest; struct Window *pathwindow; /* Initialize the pathname requester. */ int InitPathRequest() { int status = 0; if (pathwindow = OpenWindow(&pathreqnw)) { /* I used AddGList here - got a crash. Problems with fullword * alignment, maybe? */ AddGadget(pathwindow, homepathgad, -1L); AddGadget(pathwindow, backpathgad, -1L); AddGadget(pathwindow, listpathgad, -1L); AddGadget(pathwindow, excludepathgad, -1L); } else { status = IoErr(); TypeAndSpeak("I couldn't open the pathname window!\n"); } return status; } /* Shut down the pathname requester mechanisms. */ CancelPathRequest() { if (pathwindow) CloseWindow(pathwindow); }