home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
500-599
/
ff589.lza
/
Term
/
TermSrc.lha
/
DialPanel.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-12-01
|
25KB
|
1,080 lines
/* $Revision Header * Header built automatically - do not edit! *************
*
* (C) Copyright 1991 by Olaf 'Olsen' Barthel & MXM
*
* Name .....: DialPanel.c
* Created ..: Monday 21-Jan-91 20:12
* Revision .: 0
*
* Date Author Comment
* ========= ======== ====================
* 01-Sep-91 Olsen Major rewrite.
* 21-Jan-91 Olsen Created this file!
*
* $Revision Header ********************************************************/
#include "TermGlobal.h"
/* Dimensions of the panel window. */
#define WIDTH 451
#define HEIGHT 99
/* Rendering offsets into the window. */
#define ORIGIN_X 14
#define ORIGIN_Y 14
/* Panel gadget IDs. */
enum { GAD_SKIP,GAD_ONLINE,GAD_ABORT };
/* Menu item IDs. */
enum { MEN_SKIP=1,MEN_ONLINE,MEN_ABORT,MEN_QUITPANEL };
/* The menu attached to the dial window. */
STATIC struct NewMenu DialMenu[] =
{
{ NM_TITLE, "Project", 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Skip", "S", 0, 0, (APTR)MEN_SKIP},
{ NM_ITEM, "Go To Online", "G", 0, 0, (APTR)MEN_ONLINE},
{ NM_ITEM, "Abort Dialing", "A", 0, 0, (APTR)MEN_ABORT},
{ NM_ITEM, NM_BARLABEL, 0 , 0, 0, (APTR)0},
{ NM_ITEM, "Quit", "Q", 0, 0, (APTR)MEN_QUITPANEL},
{ NM_END, 0, 0 , 0, 0, (APTR)0}
};
/* CreateAllGadgets():
*
* Create all gadgets required by the dial panel.
*/
STATIC struct Gadget *
CreateAllGadgets(struct Gadget **GadgetArray,struct Gadget **GadgetList,APTR VisualInfo,UWORD TopEdge)
{
struct Gadget *Gadget;
struct NewGadget NewGadget;
UWORD Counter = 0;
memset(&NewGadget,0,sizeof(struct NewGadget));
if(Gadget = CreateContext(GadgetList))
{
NewGadget . ng_Height = 12;
NewGadget . ng_GadgetText = "_Skip";
NewGadget . ng_Width = 15 * 8;
NewGadget . ng_TextAttr = &DefaultFont;
NewGadget . ng_VisualInfo = VisualInfo;
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_LeftEdge = 10;
NewGadget . ng_Flags = 0;
NewGadget . ng_TopEdge = HEIGHT - 3 - NewGadget . ng_Height;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
GT_Underscore, '_',
TAG_DONE);
NewGadget . ng_GadgetText = "_Go To Online";
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_LeftEdge = (WIDTH - NewGadget . ng_Width) >> 1;
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
GT_Underscore, '_',
TAG_DONE);
NewGadget . ng_GadgetText = "_Abort Dialing";
NewGadget . ng_GadgetID = Counter;
NewGadget . ng_LeftEdge = WIDTH - (10 + NewGadget . ng_Width);
GadgetArray[Counter++] = Gadget = CreateGadget(BUTTON_KIND,Gadget,&NewGadget,
GT_Underscore, '_',
TAG_DONE);
}
return(Gadget);
}
/* PrintInfo(struct Window *SomeWindow,WORD X,WORD Y,BYTE *String,...):
*
* Print a string at a given position into the panel window.
*/
STATIC VOID
PrintInfo(struct Window *SomeWindow,WORD X,WORD Y,BYTE *String,...)
{
va_list VarArgs;
va_start(VarArgs,String);
VSPrintf(SharedBuffer,String,VarArgs);
va_end(VarArgs);
Move(SomeWindow -> RPort,ORIGIN_X + X * 8,ORIGIN_Y + 6 + Y * 8);
Text(SomeWindow -> RPort,SharedBuffer,strlen(SharedBuffer));
}
/* DialPanel():
*
* This routine opens a small window in the middle of the
* console window and walks down the list of numbers to
* dial.
*/
VOID
DialPanel()
{
STATIC WORD PositionX = -1,PositionY = -1;
struct Gadget *GadgetList = NULL;
struct Gadget *GadgetArray[3];
struct Window *PanelWindow;
struct Menu *PanelMenu;
struct PhoneNode *SubNode;
BaudBuffer[0] = 0;
/* We are dialing. */
Status = STATUS_DIALING;
/* Create the gadgets. */
if(CreateAllGadgets(&GadgetArray[0],&GadgetList,VisualInfo,Screen -> WBorTop + Screen -> Font -> ta_YSize + 1))
{
/* Create the menu. */
if(PanelMenu = CreateMenus(DialMenu,
GTMN_FrontPen, 0,
TAG_DONE))
{
/* Layout the menu items to fit on the
* screen.
*/
if(LayoutMenus(PanelMenu,VisualInfo,
GTMN_TextAttr,&DefaultFont,
TAG_DONE))
{
if(PositionX == -1)
PositionX = (Screen -> Width - WIDTH) >> 1;
if(PositionY == -1)
PositionY = (Screen -> Height - HEIGHT) >> 1;
/* At last, open the window. */
if(PanelWindow = OpenWindowTags(NULL,
WA_Width, WIDTH,
WA_Height, HEIGHT,
WA_Left, PositionX,
WA_Top, PositionY,
WA_Activate, TRUE,
WA_DragBar, TRUE,
WA_DepthGadget, TRUE,
WA_CloseGadget, TRUE,
WA_RMBTrap, TRUE,
WA_CustomScreen,Screen,
WA_IDCMP, IDCMP_CLOSEWINDOW | BUTTONIDCMP | IDCMP_MENUPICK,
WA_Title, "Dialing...",
TAG_DONE))
{
struct IntuiMessage *Massage;
ULONG Class,Code;
struct Gadget *Gadget;
LONG RedialDelay = 0,DialTimeout,DialRetries,DialAttempt;
BYTE Dialing,Terminated = FALSE,BaudWasPending = FALSE;
UBYTE SomeBuffer[300],*ExitString = NULL;
BYTE Pen1,Pen2,RunCount = 0;
DrawBevelBox(PanelWindow -> RPort,10,12,431,68,
GTBB_Recessed, TRUE,
GT_VisualInfo, VisualInfo,
TAG_DONE);
/* Determine the colours to use for display. */
switch(Config . ColourMode)
{
case COLOUR_AMIGA: Pen1 = 1;
Pen2 = 3;
break;
case COLOUR_EIGHT: Pen1 = 4;
Pen2 = 7;
break;
case COLOUR_SIXTEEN: Pen1 = 15;
Pen2 = 8;
break;
case COLOUR_MONO: Pen1 = Pen2 = 1;
break;
}
/* Make the current one the active one. */
PushWindow(PanelWindow);
/* Make a backup of the current configuration. */
CopyMem(&Config,&PrivateConfig,sizeof(struct Configuration));
/* Add the gadgets and refresh them. */
AddGList(PanelWindow,GadgetList,(UWORD)-1,(UWORD)-1,NULL);
RefreshGList(GadgetList,PanelWindow,NULL,(UWORD)-1);
GT_RefreshWindow(PanelWindow,NULL);
/* Attach the menu to the window. */
SetMenuStrip(PanelWindow,PanelMenu);
PanelWindow -> Flags &= ~WFLG_RMBTRAP;
/* Print someinformation into the
* panel window.
*/
SetAPen(PanelWindow -> RPort,Pen1);
SetBPen(PanelWindow -> RPort,0);
SetDrMd(PanelWindow -> RPort,JAM2);
PrintInfo(PanelWindow,0,0,"Calling...:");
PrintInfo(PanelWindow,0,1,"Number....:");
PrintInfo(PanelWindow,0,2,"Next......:");
PrintInfo(PanelWindow,0,4,"Timeout...:");
PrintInfo(PanelWindow,0,5,"Attempt...:");
PrintInfo(PanelWindow,0,7,"Message...:");
SetAPen(PanelWindow -> RPort,Pen2);
/* Don't echo serial output. */
Quiet = TRUE;
/* Perform full sequence check. */
FullCheck = TRUE;
/* Reset the number of dial attempts. */
DialAttempt = 0;
/* Get the first dial list entry. */
SubNode = (struct PhoneNode *)SubList -> lh_Head;
/* The big dialing loop, implemented as a goto -> mark
* loop rather than one of those classical while .. do
* loops.
*/
Dial: Dialing = TRUE;
/* Reset the sequence scanner, the user may have skipped
* the previous dial attempt causing the modem to return
* `NO CARRIER'. To prevent the dialer from skipping the
* next dial entry as well as the previous we have to
* have to flush any data pending on the serial line.
*/
HandleSerial();
FlowInit();
FullCheck = TRUE;
FlushSerial();
/* If SubNode -> Entry is nonzero it has
* a configuration attached.
*/
if(SubNode -> Entry)
{
DialTimeout = SubNode -> Entry -> Config . DialTimeout;
DialRetries = SubNode -> Entry -> Config . DialRetries;
/* We will need to change the serial parameters
* in order to establish a connection.
*/
if(memcmp(&Config,&SubNode -> Entry -> Config,58))
{
CopyMem(&Config,&PrivateConfig,58);
CopyMem(&SubNode -> Entry -> Config,&Config,58);
ConfigSetup();
WaitTime(0,MILLION / 2);
SerWrite("\rAT\r",4);
WaitTime(0,MILLION / 2);
}
if(ExitString)
{
SerialCommand(ExitString);
WaitTime(0,MILLION / 2);
}
if(SubNode -> Entry -> Config . ModemInit[0])
{
SerialCommand(SubNode -> Entry -> Config . ModemInit);
WaitTime(0,MILLION / 2);
}
if(SubNode -> Entry -> Config . ModemExit[0])
ExitString = SubNode -> Entry -> Config . ModemExit;
else
ExitString = NULL;
PrintInfo(PanelWindow,12,0,"%-40.40s",SubNode -> Entry -> Name);
Say("Now calling: %s",SubNode -> Entry -> Name);
strcpy(SomeBuffer,SubNode -> Entry -> Config . DialPrefix);
PrintInfo(PanelWindow,12,1,"%-40.40s",SubNode -> Entry -> Number);
strcat(SomeBuffer,SubNode -> Entry -> Number);
}
else
{
DialTimeout = Config . DialTimeout;
DialRetries = Config . DialRetries;
if(ExitString)
{
SerialCommand(ExitString);
WaitTime(0,MILLION / 2);
}
if(Config . ModemExit[0])
ExitString = Config . ModemExit;
else
ExitString = NULL;
PrintInfo(PanelWindow,12,0,"%-40.40s","-- Unknown --");
Say("Now calling: %s",SubNode -> VanillaNode . ln_Name);
strcpy(SomeBuffer,Config . DialPrefix);
PrintInfo(PanelWindow,12,1,"%-40.40s",SubNode -> VanillaNode . ln_Name);
strcat(SomeBuffer,SubNode -> VanillaNode . ln_Name);
}
if(SubNode -> VanillaNode . ln_Succ -> ln_Succ)
PrintInfo(PanelWindow,12,2,"%-40.40s",((struct PhoneNode *)SubNode -> VanillaNode . ln_Succ) -> Entry -> Name);
else
PrintInfo(PanelWindow,12,2,"%-40.40s","-- None --");
strcat(SomeBuffer,"\r");
PrintInfo(PanelWindow,12,7,"%-40.40s","Dialing...");
/* Dial the number. */
SerialCommand(SomeBuffer);
/* Reset the signal. */
SetSignal(NULL,SIGBREAKF_CTRL_F);
while(!Terminated)
{
if(Dialing)
{
PrintInfo(PanelWindow,12,4,"%2ld:%02ld",DialTimeout / 60,DialTimeout % 60);
PrintInfo(PanelWindow,12,5,"%5ld of %5ld",DialAttempt + 1,DialRetries);
}
else
PrintInfo(PanelWindow,12,4,"%2ld:%02ld",RedialDelay / 60,RedialDelay % 60);
WaitTime(0,MILLION / 2);
/* The following commands are executed each second */
if((RunCount++) && !Terminated)
{
RunCount = 0;
/* Are we dialing or waiting? */
if(Dialing)
{
/* No chance, the dial timeout
* has elapsed and no connection
* was made.
*/
if(!(--DialTimeout))
{
PrintInfo(PanelWindow,12,7,"%-40.40s","Dial Attempt Timeout.");
Skip1: WaitTime(0,MILLION / 2);
SerWrite("\r",1);
WaitTime(0,MILLION / 2);
/* Is this one the last entry? */
if(SubNode -> VanillaNode . ln_Succ -> ln_Succ)
{
/* Proceed to the next entry. */
SubNode = (struct SubNode *)SubNode -> VanillaNode . ln_Succ;
goto Dial;
}
else
{
/* Is this one the last dial
* attempt to be made?
*/
if(++DialAttempt >= DialRetries)
{
PrintInfo(PanelWindow,12,7,"%-40.40s","Maximum Number Of Dial Retries Reached!");
Say("Maximum number of dial retries reached.");
WaitTime(2,0);
Terminated = TRUE;
}
else
{
/* Get the first list entry. */
SubNode = (struct PhoneNode *)SubList -> lh_Head;
/* Get the redial delay. */
if(SubNode -> Entry)
RedialDelay = 60 * SubNode -> Entry -> Config . RedialDelay;
else
RedialDelay = 60 * Config . RedialDelay;
/* No redial delay? Restart dialing... */
if(!RedialDelay)
{
WaitTime(1,0);
goto Dial;
}
else
{
/* Go into redial delay. */
PrintInfo(PanelWindow,12,7,"%-40.40s","Redial Delay...");
Dialing = FALSE;
}
}
}
}
}
else
{
if(!(--RedialDelay))
{
/* Get the first list entry. */
Skip2: SubNode = (struct PhoneNode *)SubList -> lh_Head;
/* We are once again dialing. */
Dialing = TRUE;
goto Dial;
}
}
}
/* Handle serial data flow. */
HandleSerial();
/* Something has changed in the flow
* info structure.
*/
if(FlowInfo . Changed)
{
/* We had a connect and the
* baud rate has been transferred.
*/
if(BaudWasPending && !BaudPending)
{
ULONG Value;
if(Value = atol(BaudBuffer))
{
if(SubNode -> Entry)
CopyMem(&SubNode -> Entry -> Config,&Config,sizeof(struct Configuration));
PrivateConfig . BaudRate = Config . BaudRate = Value;
ClearSerial();
SetParameters();
ReadRequest -> IOSer . io_Command = CMD_READ;
ReadRequest -> IOSer . io_Data = ReadBuffer;
ReadRequest -> IOSer . io_Length = 1;
SendIO(ReadRequest);
}
goto ConnectIt;
}
/* Current number is busy. */
if(FlowInfo . Busy || FlowInfo . NoCarrier)
{
FlowInit();
FullCheck = TRUE;
FlowInfo . Busy = FALSE;
FlowInfo . NoCarrier = FALSE;
FlowInfo . Changed = FALSE;
if(Dialing)
{
PrintInfo(PanelWindow,12,7,"%-40.40s","Line Is Busy.");
Say("Line is busy.");
WaitTime(1,0);
goto Skip1;
}
}
/* Somebody tries to call us. */
if(FlowInfo . Ring && !Terminated)
{
FlowInit();
PrintInfo(PanelWindow,12,7,"%-40.40s","Incoming Call!");
WakeUp(PanelWindow);
Say("Incoming call.");
Terminated = TRUE;
}
/* Somebody's talking. */
if(FlowInfo . Voice && !Terminated)
{
FlowInit();
PrintInfo(PanelWindow,12,7,"%-40.40s","Incoming Voice Call!");
WakeUp(PanelWindow);
Say("Icoming voice call.");
Terminated = TRUE;
}
/* We got a connect. */
if(FlowInfo . Connect && !Terminated)
{
FlowInfo . Connect = FALSE;
FlowInfo . Changed = FALSE;
/* Auto-baud feature enabled?
* If yes, wait for the number.
*/
if(BaudPending)
{
if(Config . ConnectAutoBaud)
BaudWasPending = TRUE;
else
BaudPending = FALSE;
}
/* Seems that we've received
* a number.
*/
ConnectIt: if(!BaudPending)
{
/* Install the new configuration. */
if(!BaudWasPending)
{
if(SubNode -> Entry)
CopyMem(&SubNode -> Entry -> Config,&Config,sizeof(struct Configuration));
}
/* Convert the baud rate. */
if(BaudBuffer[0])
{
LONG TestRate = atol(BaudBuffer);
if(TestRate >= 110)
{
Config . BaudRate = TestRate;
SetParameters();
}
}
/* Reset the scanner. */
FlowInit();
/* Copy the remaining data. */
if(SubNode -> Entry)
{
PayPerUnit[0] = SubNode -> Entry -> PayPerUnit[0];
PayPerUnit[1] = SubNode -> Entry -> PayPerUnit[1];
SecPerUnit[0] = SubNode -> Entry -> SecPerUnit[0];
SecPerUnit[1] = SubNode -> Entry -> SecPerUnit[1];
TimeOfDay[0] = SubNode -> Entry -> TimeOfDay[0];
TimeOfDay[1] = SubNode -> Entry -> TimeOfDay[1];
CurrentPay = 0;
SendStartup = TRUE;
strcpy(Password,SubNode -> Entry -> Password);
}
else
{
CurrentPay = 0;
SecPerUnit[0] = SecPerUnit[1] = 0;
PayPerUnit[0] = PayPerUnit[1] = 0;
TimeOfDay[0] = TimeOfDay[1];
Password[0] = 0;
SendStartup = FALSE;
}
/* We are now online. */
Online = TRUE;
Terminated = TRUE;
/* Add another logfile entry. */
if(SubNode -> Entry)
LogAction("Connected to \"%s\" (%s).",SubNode -> Entry -> Name,SubNode -> Entry -> Number);
else
LogAction("Connected to %s.",SubNode -> VanillaNode . ln_Name);
/* Open auto-capture file if necessary. */
if(Config . ConnectAutoCapture && Config . CapturePath[0])
{
UBYTE SharedBuffer[256],Name[50],Date[20];
struct DateTime DateTime;
DateStamp(&DateTime . dat_Stamp);
DateTime . dat_Format = FORMAT_DOS;
DateTime . dat_Flags = 0;
DateTime . dat_StrDay = NULL;
DateTime . dat_StrDate = Date;
DateTime . dat_StrTime = NULL;
strcpy(SharedBuffer,Config . CapturePath);
if(DateToStr(&DateTime))
{
if(SubNode -> Entry)
{
WORD i;
strcpy(Name,SubNode -> Entry -> Name);
for(i = 0 ; i < strlen(Name) ; i++)
{
if(Name[i] == ' ')
Name[i] = '_';
}
}
else
strcpy(Name,"Capture");
strcat(Name,"_");
strcat(Name,Date);
if(AddPart(SharedBuffer,Name,256))
{
struct MenuItem *Item;
Item = FindThisItem(MEN_CAPTUREDISK);
Item -> Flags &= ~CHECKED;
if(FileCapture)
{
BufferClose(FileCapture);
if(!GetFileSize(CaptureName))
DeleteFile(CaptureName);
else
SetProtection(CaptureName,FIBF_EXECUTE);
}
if(FileCapture = BufferOpen(SharedBuffer,"a"))
{
Item -> Flags |= CHECKED;
strcpy(CaptureName,SharedBuffer);
}
}
}
}
/* Remove the node from the
* dialing list.
*/
RemSub(SubNode);
/* Wake the user up. */
PrintInfo(PanelWindow,12,7,"%-40.40s","Connection Established.");
WakeUp(PanelWindow);
Say("Connection established.");
/* Perform system initialization. */
ConfigSetup();
}
}
}
/* Look for the hotkey. */
if(SetSignal(NULL,NULL) & SIGBREAKF_CTRL_F)
{
SetSignal(NULL,SIGBREAKF_CTRL_F);
/* Are we dialing or waiting? */
if(Dialing)
{
DialTimeout = 0;
goto Skip1;
}
else
{
RedialDelay = 0;
goto Skip2;
}
}
/* Pick up the window input. */
while(!Terminated && (Massage = (struct IntuiMessage *)GT_GetIMsg(PanelWindow -> UserPort)))
{
Class = Massage -> Class;
Code = Massage -> Code;
Gadget = (struct Gadget *)Massage -> IAddress;
GT_ReplyIMsg(Massage);
/* Handle the menu events. */
if(Class == MENUPICK)
{
struct MenuItem *MenuItem;
while(Code != MENUNULL)
{
MenuItem = ItemAddress(PanelMenu,Code);
switch((ULONG)GTMENUITEM_USERDATA(MenuItem))
{
case MEN_QUITPANEL: Class = IDCMP_CLOSEWINDOW;
break;
case MEN_SKIP: Class = IDCMP_GADGETUP;
Gadget = GadgetArray[GAD_SKIP];
break;
case MEN_ONLINE: Class = IDCMP_GADGETUP;
Gadget = GadgetArray[GAD_ONLINE];
break;
case MEN_ABORT: Class = IDCMP_GADGETUP;
Gadget = GadgetArray[GAD_ABORT];
break;
default: break;
}
Code = MenuItem -> NextSelect;
}
}
/* Close the window, hang up the line. */
if(Class == IDCMP_CLOSEWINDOW)
{
Terminated = TRUE;
WaitTime(0,MILLION / 2);
SerWrite("\r",1);
WaitTime(0,MILLION / 2);
}
if(Class == IDCMP_GADGETUP)
{
switch(Gadget -> GadgetID)
{
case GAD_SKIP: if(Dialing)
{
DialTimeout = 0;
goto Skip1;
}
else
{
RedialDelay = 0;
goto Skip2;
}
/* Forced online,
* install new configuration
* first.
*/
case GAD_ONLINE:if(SubNode -> Entry)
CopyMem(&SubNode -> Entry -> Config,&Config,sizeof(struct Configuration));
/* Copy the remaining information. */
if(SubNode -> Entry)
{
PayPerUnit[0] = SubNode -> Entry -> PayPerUnit[0];
PayPerUnit[1] = SubNode -> Entry -> PayPerUnit[1];
SecPerUnit[0] = SubNode -> Entry -> SecPerUnit[0];
SecPerUnit[1] = SubNode -> Entry -> SecPerUnit[1];
TimeOfDay[0] = SubNode -> Entry -> TimeOfDay[0];
TimeOfDay[1] = SubNode -> Entry -> TimeOfDay[1];
CurrentPay = 0;
SendStartup = TRUE;
strcpy(Password,SubNode -> Entry -> Password);
}
else
{
CurrentPay = 0;
SecPerUnit[0] = SecPerUnit[1] = 0;
PayPerUnit[0] = PayPerUnit[1] = 0;
TimeOfDay[0] = TimeOfDay[1];
Password[0] = 0;
SendStartup = FALSE;
}
/* We are now online. */
Online = TRUE;
Terminated = TRUE;
/* Add a new log action. */
if(SubNode -> Entry)
LogAction("Connected to \"%s\" (%s).",SubNode -> Entry -> Name,SubNode -> Entry -> Number);
else
LogAction("Connected to %s.",SubNode -> VanillaNode . ln_Name);
/* Open auto-capture file. */
if(Config . ConnectAutoCapture && Config . CapturePath[0])
{
UBYTE SharedBuffer[256],Name[50],Date[20];
struct DateTime DateTime;
DateStamp(&DateTime . dat_Stamp);
DateTime . dat_Format = FORMAT_DOS;
DateTime . dat_Flags = 0;
DateTime . dat_StrDay = NULL;
DateTime . dat_StrDate = Date;
DateTime . dat_StrTime = NULL;
strcpy(SharedBuffer,Config . CapturePath);
if(DateToStr(&DateTime))
{
if(SubNode -> Entry)
{
WORD i;
strcpy(Name,SubNode -> Entry -> Name);
for(i = 0 ; i < strlen(Name) ; i++)
{
if(Name[i] == ' ')
Name[i] = '_';
}
}
else
strcpy(Name,"Capture");
strcat(Name,"_");
strcat(Name,Date);
if(AddPart(SharedBuffer,Name,256))
{
struct MenuItem *Item;
Item = FindThisItem(MEN_CAPTUREDISK);
Item -> Flags &= ~CHECKED;
if(FileCapture)
{
BufferClose(FileCapture);
if(!GetFileSize(CaptureName))
DeleteFile(CaptureName);
else
SetProtection(CaptureName,FIBF_EXECUTE);
}
if(FileCapture = BufferOpen(SharedBuffer,"a"))
{
Item -> Flags |= CHECKED;
strcpy(CaptureName,SharedBuffer);
}
}
}
}
/* Remove node from
* dialing list and
* perform system
* setup.
*/
RemSub(SubNode);
ConfigSetup();
break;
/* Abort the dialing process. */
case GAD_ABORT: Terminated = TRUE;
PrintInfo(PanelWindow,12,7,"%-40.40s","Aborting...");
WaitTime(0,MILLION / 2);
SerWrite("\r",1);
WaitTime(0,MILLION / 2);
break;
}
}
}
}
/* Are we perhaps not online? */
if(!Online)
{
/* Is the serial setup different? */
if(memcmp(&PrivateConfig,&Config,58))
{
/* Swap the serial data. */
swmem(&PrivateConfig,&Config,58);
/* Set up the old serial configuration. */
ConfigSetup();
/* Reinitialize... */
WaitTime(0,MILLION / 2);
SerWrite("\rAT\r",4);
WaitTime(0,MILLION / 2);
}
/* Do we have a valid modem exit string? */
if(ExitString)
{
SerialCommand(ExitString);
WaitTime(0,MILLION / 2);
}
}
/* Reset the scanner. */
FlowInit();
PanelWindow -> Flags |= WFLG_RMBTRAP;
ClearMenuStrip(PanelWindow);
RemoveGList(PanelWindow,GadgetList,(UWORD)-1);
PopWindow();
PositionX = PanelWindow -> LeftEdge;
PositionY = PanelWindow -> TopEdge;
CloseWindow(PanelWindow);
}
}
FreeMenus(PanelMenu);
}
}
FreeGadgets(GadgetList);
/* We are done now, restart echoing serial */
Quiet = FALSE;
}