home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d5xx
/
d534
/
term.lha
/
Term
/
Source.LZH
/
UploadPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-07-06
|
4KB
|
181 lines
/* $Revision Header * Header built automatically - do not edit! *************
*
* (C) Copyright 1990 by Olaf 'Olsen' Barthel & MXM
*
* Name .....: UploadPanel.c
* Created ..: Friday 03-May-91 17:43
* Revision .: 0
*
* Date Author Comment
* ========= ======== ====================
* 03-May-91 Olsen Created this file!
*
* $Revision Header ********************************************************/
#include "TermGlobal.h"
STATIC struct NewMenu UploadMenu[] =
{
{ NM_TITLE, "Project", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Text Upload", "T", 0, 0, (APTR)1},
{ NM_ITEM, "Binary Upload", "B", 0, 0, (APTR)2},
{ NM_END, 0, 0 , 0, 0, (APTR)0}
};
#define WIDTH (236)
#define HEIGHT (53)
STATIC struct Gadget *
CreateAllGadgets(struct Gadget **GadgetArray,struct Gadget **GadgetList,APTR VisualInfo,UWORD TopEdge)
{
struct Gadget *Gadget;
struct NewGadget NewGadget;
UWORD Counter = 0;
if(Gadget = CreateContext(GadgetList))
{
NewGadget . ng_Width = 216;
NewGadget . ng_Height = 12;
NewGadget . ng_GadgetText = NULL;
NewGadget . ng_TextAttr = &DefaultFont;
NewGadget . ng_VisualInfo = VisualInfo;
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_Flags = NG_HIGHLABEL;
NewGadget . ng_LeftEdge = 10;
NewGadget . ng_TopEdge = 1 + TopEdge;
GadgetArray[Counter++] = Gadget = CreateGadget(TEXT_KIND,Gadget,&NewGadget,
GTTX_Text, "Select ZModem Upload Type:",
GTTX_Border, TRUE,
TAG_DONE);
NewGadget . ng_GadgetText = "_Text Upload";
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_TopEdge = Gadget -> TopEdge + Gadget -> Height + 1;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
GT_Underscore, '_',
TAG_DONE);
NewGadget . ng_GadgetText = "_Binary Upload";
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_TopEdge = Gadget -> TopEdge + Gadget -> Height + 1;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
GT_Underscore, '_',
TAG_DONE);
}
return(Gadget);
}
BYTE
UploadPanel()
{
struct Window *PanelWindow;
struct Menu *PanelMenu;
struct Gadget *GadgetList;
struct Gadget *GadgetArray[3];
BYTE Selection;
if(CreateAllGadgets(&GadgetArray[0],&GadgetList,VisualInfo,Screen -> WBorTop + Screen -> Font -> ta_YSize + 1))
{
if(PanelMenu = CreateMenus(UploadMenu,
GTMN_FrontPen, 0,
TAG_DONE))
{
if(LayoutMenus(PanelMenu,VisualInfo,
GTMN_TextAttr,&DefaultFont,
TAG_DONE))
{
if(PanelWindow = OpenWindowTags(NULL,
WA_Left, (Screen -> Width - WIDTH) >> 1,
WA_Top, (Screen -> Height - HEIGHT) >> 1,
WA_Width, WIDTH,
WA_Height, HEIGHT,
WA_Activate, TRUE,
WA_DragBar, TRUE,
WA_DepthGadget, TRUE,
WA_RMBTrap, TRUE,
WA_DepthGadget, TRUE,
WA_CustomScreen,Screen,
WA_IDCMP, IDCMP_MENUPICK | BUTTONIDCMP,
WA_Title, "Upload Type",
TAG_DONE))
{
struct IntuiMessage *Massage;
ULONG Class,Code;
struct Gadget *Gadget;
BYTE Terminated = FALSE;
PushWindow(PanelWindow);
AddGList(PanelWindow,GadgetList,(UWORD)-1,(UWORD)-1,NULL);
RefreshGList(GadgetList,PanelWindow,NULL,(UWORD)-1);
GT_RefreshWindow(PanelWindow,NULL);
SetMenuStrip(PanelWindow,PanelMenu);
PanelWindow -> Flags &= ~WFLG_RMBTRAP;
while(!Terminated)
{
WaitPort(PanelWindow -> UserPort);
while(!Terminated && (Massage = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort)))
{
Class = Massage -> Class;
Code = Massage -> Code;
Gadget = (struct Gadget *)Massage -> IAddress;
GT_ReplyIMsg(Massage);
if(Class == IDCMP_MENUPICK)
{
struct MenuItem *MenuItem;
while(Code != MENUNULL)
{
MenuItem = ItemAddress(PanelMenu,Code);
Selection = (ULONG)MENU_USERDATA(MenuItem);
Terminated = TRUE;
Code = MenuItem -> NextSelect;
}
}
if(Class == IDCMP_GADGETUP)
{
Selection = Gadget -> GadgetID;
Terminated = TRUE;
}
}
}
PanelWindow -> Flags |= WFLG_RMBTRAP;
ClearMenuStrip(PanelWindow);
RemoveGList(PanelWindow,GadgetList,(UWORD)-1);
PopWindow();
CloseWindow(PanelWindow);
}
}
FreeMenus(PanelMenu);
}
FreeGadgets(GadgetList);
}
return(Selection);
}