home *** CD-ROM | disk | FTP | other *** search
- /**********************************************************************/
- /* Gadtools addition code */
- /**********************************************************************/
- #include "psx.h"
- #include <intuition/gadgetclass.h>
- #include <Exec/memory.h>
-
- #define SIZEINIT(ng,x,y,w,h,text) ng.ng_LeftEdge=x; ng.ng_TopEdge=y; ng.ng_Width=w; ng.ng_Height=h;
-
- extern char NewPubScreenName[MAXPUBSCREENNAME];
-
- char *XDimLabels[] = { "Hires", "Lores", NULL, };
- char *YDimLabels[] = { "Non-Interlace", "Interlace", NULL, };
- char *DepthLabels[] =
- {
- "1 Bitplane (2 Colours)",
- "2 Bitplanes (4 Colours)",
- "3 Bitplanes (8 Colours)",
- "4 Bitplanes (16 Colours)",
- NULL,
- };
-
- char *ShanghaiLabels[] = { "Shanghai On", "Shanghai Off", NULL};
- char *PopLabels[] = { "PopPubScreen On", "PopPubScreen Off", NULL};
-
- Tag ListViewTags[] =
- {
- GTLV_Labels, &ScreenList,
- GTLV_Top, 0,
- LAYOUTA_SPACING, 1,
- GTLV_ShowSelected, NULL,
- GTLV_Selected, 0,
- GTLV_ScrollWidth, 18,
- TAG_DONE
- };
-
- Tag TextTags[] =
- {
- GTST_String, &MessageText,
- GTST_MaxChars, 255,
- GTBB_Recessed, TRUE,
- TAG_DONE
- };
-
- Tag TVTag[] =
- {
- GTTX_Text, &MessageText[0],
- GTTX_Border, TRUE,
- TAG_DONE,
- };
-
- struct Gadget *TextDisplayGad;
-
- /**********************************************************************/
- /* Change the PSX Message */
- /**********************************************************************/
- void
- SetMessage(char *text)
- {
- if (text)
- strcpy(MessageText, text);
-
- GT_SetGadgetAttrsA(TextDisplayGad, Window, 0, (struct TagItem *)TVTag);
- }
-
- /**********************************************************************/
- /* Add the gadgets to the PSX Window */
- /**********************************************************************/
- int
- CreatePSXGadgets(struct GadList **GList, void *VI, UWORD TopBorder, struct TextAttr *TA)
- {
- struct NewGadget NG;
- struct Gadget *Gad;
- int GHeight, GSpace;
- int WHeight;
- int GadYPos, TopGadYPos;
- int RowWidth;
- short FontY=TA->ta_YSize;
- int index;
-
- TopBorder+=FontY;
-
- WHeight=TopBorder+(FontY);
- GadYPos=TopBorder+(FontY/2);
- GHeight=FontY+((FontY/4)*2);
- if (FontY>14) GSpace=5;
- else GSpace=3;
- Gad=CreateContext(GList);
- TopGadYPos=GadYPos;
-
- RowWidth=TextLength(&Screen->RastPort, " Dummy String Ya ", 21);
-
- NG.ng_VisualInfo=VI;
- NG.ng_TextAttr=TA;
- NG.ng_Flags=PLACETEXT_IN;
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Open New Screen";
- NG.ng_GadgetID=GADID_OPENSCREEN;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Close Screen";
- NG.ng_GadgetID=GADID_CLOSESCREEN;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Move To Screen";
- NG.ng_GadgetID=GADID_MOVEPSX;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Make Default";
- NG.ng_GadgetID=GADID_MAKEDEFAULT;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Refresh List";
- NG.ng_GadgetID=GADID_REFRESH;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- NG.ng_Flags=PLACETEXT_IN|NG_HIGHLABEL;
- NG.ng_GadgetText=NULL;
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=GADID_SHANGHAI;
- ShanghaiGad=Gad=CreateGadget(CYCLE_KIND, Gad, &NG, GTCY_Labels, ShanghaiLabels, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=GADID_POP;
- PopGad=Gad=CreateGadget(CYCLE_KIND, Gad, &NG, GTCY_Labels, PopLabels, TAG_DONE);
-
- NG.ng_Flags=PLACETEXT_IN;
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetText="Quit";
- NG.ng_GadgetID=GADID_QUIT;
- Gad=CreateGadgetA(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, WIN_WIDTH-40, GHeight);
- index=GadYPos-GSpace;
- WHeight+=(GHeight+GSpace);
- NG.ng_GadgetText=MessageText;
- NG.ng_Flags=NG_HIGHLABEL;
- NG.ng_GadgetID=0;
- MessageText[0]=0;
- TextDisplayGad=Gad=CreateGadgetA(TEXT_KIND, Gad, &NG, (struct TagItem *)&TVTag[0]);
-
- SIZEINIT(NG, 20+RowWidth+20, TopGadYPos, WIN_WIDTH-(60+RowWidth), index-TopGadYPos);
- NG.ng_GadgetText=NULL;
- NG.ng_GadgetID=GADID_SCREENLIST;
- NG.ng_Flags=PLACETEXT_IN;
- LVGad=Gad=CreateGadgetA(LISTVIEW_KIND, Gad, &NG, (struct TagItem *)&ListViewTags[0]);
-
- if (Gad==0) return(0);
- else return(WHeight);
- }
-
-
-
-
- /**********************************************************************/
- /* Create the Screen Requester gadgets */
- /**********************************************************************/
- int
- CreateScreenGadgets(struct GadList **GList, void *VI, UWORD TopBorder, struct TextAttr *TA, int *WinWidth)
- {
- struct NewGadget NG;
- struct Gadget *Gad;
- int GHeight, GSpace;
- int WHeight;
- int GadYPos, TopGadYPos;
- int RowWidth;
- short FontY=TA->ta_YSize;
-
- TopBorder+=FontY;
-
- WHeight=TopBorder+(FontY);
- GadYPos=TopBorder+(FontY/2);
- GHeight=FontY+((FontY/4)*2);
- if (FontY>14) GSpace=5;
- else GSpace=3;
- Gad=CreateContext(GList);
-
- RowWidth=TextLength(&Screen->RastPort, "This is a rather long screen name.", 34);
- *WinWidth=RowWidth+40;
-
- NG.ng_VisualInfo=VI;
- NG.ng_TextAttr=TA;
- NG.ng_Flags=PLACETEXT_IN|NG_HIGHLABEL;
- NG.ng_GadgetText=NULL;
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight+GSpace);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace)+GSpace;
- NG.ng_GadgetID=SGID_NAME;
- Gad=CreateGadget(STRING_KIND, Gad, &NG, GTST_String, &NewPubScreenName, GTST_MaxChars, MAXPUBSCREENNAME, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=SGID_XDIM;
- Gad=CreateGadget(CYCLE_KIND, Gad, &NG, GTCY_Labels, XDimLabels, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=SGID_YDIM;
- Gad=CreateGadget(CYCLE_KIND, Gad, &NG, GTCY_Labels, YDimLabels, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=SGID_DEPTH;
- Gad=CreateGadget(CYCLE_KIND, Gad, &NG, GTCY_Labels, DepthLabels, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- GadYPos+=(GHeight+GSpace);
- NG.ng_GadgetID=SGID_OPEN;
- NG.ng_GadgetText="Open Screen";
- NG.ng_Flags=PLACETEXT_IN;
- Gad=CreateGadget(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- SIZEINIT(NG, 20, GadYPos, RowWidth, GHeight);
- WHeight+=(GHeight+GSpace);
- NG.ng_GadgetID=SGID_CANCEL;
- NG.ng_GadgetText="Cancel";
- NG.ng_Flags=PLACETEXT_IN;
- Gad=CreateGadget(BUTTON_KIND, Gad, &NG, TAG_DONE);
-
- WHeight+=GSpace;
-
- if (Gad==0) return(0);
- else return(WHeight);
- }
-
-
-