home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
disks
/
disk376.lzh
/
Matrix
/
src
/
NTSC
/
Intui2.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-10-10
|
7KB
|
265 lines
/********************************************************************/
/**** ****/
/**** ****/
/**** Program : Intui2.c ****/
/**** ****/
/**** Version : 01.00 ****/
/**** ****/
/**** Erstversion : 01.07.1990 ****/
/**** ****/
/**** Letzte Änderung : 09.08.1990 ****/
/**** ****/
/**** Compiliert mit : siehe MAKEFILE ****/
/**** ****/
/**** Gelinkt mit : siehe MAKEFILE ****/
/**** ****/
/********************************************************************/
/**** ****/
/**** ****/
/**** Copyright by Rüdiger Dreier ****/
/**** ****/
/**** ****/
/********************************************************************/
char Gleichungen[4],Variablen[4];
struct Window *Window2;
extern LONG Breite,Hoehe;
SHORT paare3[]=
{
0,0,0,9,33,9,33,0,0,0
};
SHORT paare1[]=
{
-2,-2,122,-2,122,10,-2,10,-2,-2
};
struct Border Rand=
{
0,0,2,3,JAM2,5,(SHORT *)&paare1,NULL
};
struct Border Rand1 =
{
-1,-1,2,3,JAM2,5,paare3,0
};
struct IntuiText Bedeutung2=
{
1,0,JAM1,-110,0,NULL,"Equations :",NULL
};
struct IntuiText Bedeutung1=
{
1,0,JAM1,-110,0,NULL,"Variables :",NULL
};
struct StringInfo VariablenString=
{
Gleichungen,NULL,0,3,0,0,5,0,0,0,NULL,0,NULL
};
struct StringInfo GleichungenString=
{
Variablen,NULL,0,3,0,0,5,0,0,0,NULL,0,NULL
};
struct IntuiText Texte=
{
2,3,JAM2,0,0,0," OK ",0
};
struct Gadget OKgadget=
{
NULL ,86,70,32,8,GADGHCOMP,RELVERIFY|GADGIMMEDIATE,BOOLGADGET,(APTR)&Rand1,0,&Texte,NULL,NULL,4,0
};
struct Gadget gadget2=
{
&OKgadget,140,30,32,8,GADGHCOMP,GADGIMMEDIATE|RELVERIFY|STRINGCENTER|LONGINT,STRGADGET,(APTR)&Rand1,0,&Bedeutung2,0,(APTR)&GleichungenString,1,0
};
struct Gadget gadget1=
{
&gadget2 ,140,45,32,8,GADGHCOMP,GADGIMMEDIATE|RELVERIFY|STRINGCENTER|LONGINT,STRGADGET,(APTR)&Rand1,0,&Bedeutung1,0,(APTR)&VariablenString,0,0
};
struct NewWindow Fenster2=
{
210,110,200,90,0,1,GADGETUP,ACTIVATE|WINDOWDRAG,
&gadget1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,
CUSTOMSCREEN
};
VOID NeueWerte(VOID)
{
USHORT GadgetID;
SHORT ENDE=1;
VariablenString.LongInt =0;
VariablenString.BufferPos=0;
GleichungenString.LongInt=0;
GleichungenString.BufferPos=0;
Gleichungen[0]=0;
Variablen[0]=0;
if(!(Window2=(struct Window *)OpenWindow(&Fenster2)))return;
ActivateGadget(&gadget2,Window2,NULL); /* Direkte Eingabe ermöglichen */
while(ENDE)
{
Wait(1L<<Window2->UserPort->mp_SigBit);
while(EventAbfrage(Window2,&msgInfo))
{
/* Es gibt nur das Ereignis GADGETDOWN */
GadgetID=((struct Gadget *)msgInfo.IAddress)->GadgetID;
switch(GadgetID)
{
case 1:
{
ActivateGadget(&gadget1,Window2,NULL);
break;
}
case 4:
case 0:
{
if(GleichungenString.LongInt<=10 && VariablenString.LongInt<=7 &&
GleichungenString.LongInt> 0 && VariablenString.LongInt >0)
{
ENDE=0;
}
else
{
ActivateGadget(&gadget2,Window2,NULL);
}
break;
}
}
}
}
Spalten=VariablenString.LongInt+1;
Zeilen =GleichungenString.LongInt;
Breite=620/Spalten;
Hoehe =80/Zeilen;
CloseWindow(Window2);
}
#define CANCELID FALSE
#define OKID TRUE
SHORT Paare1[]=
{
-1,-1,48,-1,48,8,-1,8,-1,-1
};
SHORT Paare2[]=
{
0,0,320,0,320,98,0,98,0,0
};
SHORT Paare3[]=
{
-2,-2,280,-2,280,9,-2,9,-2,-2
};
char __FileName[40],__UFileName[40];
struct Border textrand=
{
0,0,1,2,JAM2,5,Paare1,NULL
};
struct Border Reqrand =
{
0,0,1,2,JAM2,5,Paare2,NULL
};
struct Border filerand=
{
0,0,1,2,JAM2,5,Paare3,NULL
};
struct StringInfo __FileNameInfo =
{
__FileName,__UFileName,0,40,0,0,0,0,0,0,0,0,0
};
struct IntuiText oktext =
{
1,3,JAM2,0,0,NULL," OK ",0
};
struct IntuiText canceltext=
{
1,3,JAM2,0,0,NULL,"Cancel",0
};
struct IntuiText Reqtext3 =
{
1,3,JAM2,25,45,NULL,NULL,0
};
struct IntuiText Reqtext2 =
{
1,3,JAM1,25,30,NULL,"Enter a name for the fil:",&Reqtext3
};
struct IntuiText Reqtext =
{
1,3,JAM2,104,15,NULL,"File-Requester",&Reqtext2
};
struct Gadget filegadget =
{
0 ,20,65,280,8,SELECTED|GADGHCOMP,STRINGCENTER|GADGIMMEDIATE|RELVERIFY,REQGADGET|STRGADGET ,(APTR)&filerand,NULL,NULL ,0,(APTR)&__FileNameInfo,OKID ,0
};
struct Gadget okgadget =
{
&filegadget,20,80,48,8, GADGHCOMP,GADGIMMEDIATE|RELVERIFY,REQGADGET|BOOLGADGET,(APTR)&textrand,NULL,&oktext ,0,0 ,OKID ,0
};
struct Gadget cancelgadget =
{
&okgadget ,252,80,48,8,GADGHCOMP,GADGIMMEDIATE|RELVERIFY,REQGADGET|BOOLGADGET,(APTR)&textrand,NULL,&canceltext,0,0 ,CANCELID,0
};
struct Requester Req=
{
0,20,20,321,99,0,0,&cancelgadget,&Reqrand,&Reqtext,0,2,0,0,0
};
SHORT FileRequest(struct Window *Window,
char *ReqText,
SHORT x,
SHORT y,
char *Ziel)
{
SHORT laenge,ENDE=1;
long Rueckgabe;
Req.LeftEdge=x;
Req.TopEdge=y;
laenge=strlen(ReqText)*8;
Reqtext3.LeftEdge=(321-laenge)/2;
Reqtext3.IText=ReqText;
Request(&Req,Window);
Delay(5);
ActivateGadget(&filegadget,Window,&Req);
while(ENDE)
{
Wait(1L<<Window->UserPort->mp_SigBit);
while(laenge=EventAbfrage(Window,&msgInfo))
{
Rueckgabe=((struct Gadget *)msgInfo.IAddress)->GadgetID;
if(laenge==GADGETUP)
{
ENDE=0;
}
}
}
EndRequest(&Req,Window);
if(Rueckgabe==OKID)
{
strcpy(Ziel,__FileName);
return(TRUE);
}
else
{
strcpy(Ziel,"");
return(FALSE);
}
}