home *** CD-ROM | disk | FTP | other *** search
- /*
- * Source machine generated by GadToolsBox V2.0b
- * which is (c) Copyright 1991-1993 Jaba Development
- *
- * GUI Designed by : Andreas R. Kleinert
- */
-
- #include <exec/types.h>
- #include <intuition/intuition.h>
- #include <intuition/classes.h>
- #include <intuition/classusr.h>
- #include <intuition/imageclass.h>
- #include <intuition/gadgetclass.h>
- #include <libraries/gadtools.h>
- #include <graphics/displayinfo.h>
- #include <graphics/gfxbase.h>
- #include <clib/exec_protos.h>
- #include <clib/intuition_protos.h>
- #include <clib/gadtools_protos.h>
- #include <clib/graphics_protos.h>
- #include <clib/utility_protos.h>
- #include <string.h>
- #include "SuperPlay_Main.h"
-
- struct Screen *Scr = NULL;
- UBYTE *PubScreenName = "Workbench";
- APTR VisualInfo = NULL;
- struct Window *SP_Main_Wnd = NULL;
- struct Gadget *SP_Main_GList = NULL;
- struct Gadget *SP_Main_Gadgets[9];
- UWORD SP_Main_Left = 0;
- UWORD SP_Main_Top = 11;
- UWORD SP_Main_Width = 501;
- UWORD SP_Main_Height = 54;
- UBYTE *SP_Main_Wdt = (UBYTE *)"SuperPlay V4.5 - © 1994-96 by Andreas R. Kleinert";
- struct TextAttr *Font, Attr;
- UWORD FontX, FontY;
- UWORD OffX, OffY;
-
- extern struct MinList SPOGad0List;
-
- struct Node SPOGad0Nodes[] = {
- &SPOGad0Nodes[1], ( struct Node * )&SPOGad0List.mlh_Head, 0, 0, "8SVX",
- &SPOGad0Nodes[2], &SPOGad0Nodes[0], 0, 0, "VOC",
- &SPOGad0Nodes[3], &SPOGad0Nodes[1], 0, 0, "WAV",
- ( struct Node * )&SPOGad0List.mlh_Tail, &SPOGad0Nodes[2], 0, 0, "SPO" };
-
- struct MinList SPOGad0List = {
- ( struct MinNode * )&SPOGad0Nodes[0], ( struct MinNode * )NULL, ( struct MinNode * )&SPOGad0Nodes[3] };
-
- struct IntuiText SP_Main_IText[] = {
- 2, 0, JAM1,155, 48, NULL, (UBYTE *)"Sample/Module Tool. Freeware.", NULL };
-
- #define SP_Main__TNUM 1
-
- UWORD SP_Main_GTypes[] = {
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- BUTTON_KIND,
- LISTVIEW_KIND
- };
-
- struct NewGadget SP_Main_NGad[] = {
- 83, 29, 207, 12, (UBYTE *)"Load and _Convert to :", NULL, GD_ConvertGad, PLACETEXT_IN, NULL, NULL,
- 3, 1, 113, 12, (UBYTE *)"Load and _Play", NULL, GD_PlayGad, PLACETEXT_IN, NULL, NULL,
- 3, 13, 45, 12, (UBYTE *)"_Stop", NULL, GD_StopGad, PLACETEXT_IN, NULL, NULL,
- 49, 13, 82, 12, (UBYTE *)"Con_tinue", NULL, GD_ContGad, PLACETEXT_IN, NULL, NULL,
- 132, 13, 76, 12, (UBYTE *)"_Forward", NULL, GD_ForGad, PLACETEXT_IN, NULL, NULL,
- 209, 13, 82, 12, (UBYTE *)"_Backward", NULL, GD_BackGad, PLACETEXT_IN, NULL, NULL,
- 117, 1, 174, 12, (UBYTE *)"Get File _Information", NULL, GD_InfoGad, PLACETEXT_IN, NULL, NULL,
- 3, 29, 79, 12, (UBYTE *)"_LED", NULL, GD_LEDGad, PLACETEXT_IN, NULL, NULL,
- 291, 1, 209, 40, NULL, NULL, GD_SPOGad, 0, NULL, NULL
- };
-
- ULONG SP_Main_GTags[] = {
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GT_Underscore), '_', (TAG_DONE),
- (GTLV_Labels), (ULONG)&SPOGad0List, (GTLV_ShowSelected), NULL, (LAYOUTA_Spacing), 1, (TAG_DONE)
- };
-
- static UWORD ComputeX( UWORD value )
- {
- return(( UWORD )((( FontX * value ) + 4 ) / 8 ));
- }
-
- static UWORD ComputeY( UWORD value )
- {
- return(( UWORD )((( FontY * value ) + 4 ) / 8 ));
- }
-
- static void ComputeFont( UWORD width, UWORD height )
- {
- Font = &Attr;
- Font->ta_Name = (STRPTR)Scr->RastPort.Font->tf_Message.mn_Node.ln_Name;
- Font->ta_YSize = FontY = Scr->RastPort.Font->tf_YSize;
- FontX = Scr->RastPort.Font->tf_XSize;
-
- OffX = Scr->WBorLeft;
- OffY = Scr->RastPort.TxHeight + Scr->WBorTop + 1;
-
- if ( width && height ) {
- if (( ComputeX( width ) + OffX + Scr->WBorRight ) > Scr->Width )
- goto UseTopaz;
- if (( ComputeY( height ) + OffY + Scr->WBorBottom ) > Scr->Height )
- goto UseTopaz;
- }
- return;
-
- UseTopaz:
- Font->ta_Name = (STRPTR)"topaz.font";
- FontX = FontY = Font->ta_YSize = 8;
- }
-
- int SetupScreen( void )
- {
- if ( ! ( Scr = LockPubScreen( PubScreenName )))
- return( 1L );
-
- ComputeFont( 0, 0 );
-
- if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
- return( 2L );
-
- return( 0L );
- }
-
- void CloseDownScreen( void )
- {
- if ( VisualInfo ) {
- FreeVisualInfo( VisualInfo );
- VisualInfo = NULL;
- }
-
- if ( Scr ) {
- UnlockPubScreen( NULL, Scr );
- Scr = NULL;
- }
- }
-
- void SP_Main_Render( void )
- {
- struct IntuiText it;
- UWORD cnt;
-
- ComputeFont( SP_Main_Width, SP_Main_Height );
-
-
- for ( cnt = 0; cnt < SP_Main__TNUM; cnt++ ) {
- CopyMem(( char * )&SP_Main_IText[ cnt ], ( char * )&it, (long)sizeof( struct IntuiText ));
- it.ITextFont = Font;
- it.LeftEdge = OffX + ComputeX( it.LeftEdge ) - ( IntuiTextLength( &it ) >> 1 );
- it.TopEdge = OffY + ComputeY( it.TopEdge ) - ( Font->ta_YSize >> 1 );
- PrintIText( SP_Main_Wnd->RPort, &it, 0, 0 );
- }
- }
-
- int OpenSP_Main_Window( void )
- {
- struct NewGadget ng;
- struct Gadget *g;
- UWORD lc, tc;
- UWORD wleft = SP_Main_Left, wtop = SP_Main_Top, ww, wh;
-
- ComputeFont( SP_Main_Width, SP_Main_Height );
-
- ww = ComputeX( SP_Main_Width );
- wh = ComputeY( SP_Main_Height );
-
- if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
- if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
-
- if ( ! ( g = CreateContext( &SP_Main_GList )))
- return( 1L );
-
- for( lc = 0, tc = 0; lc < SP_Main__CNT; lc++ ) {
-
- CopyMem((char * )&SP_Main_NGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
-
- ng.ng_VisualInfo = VisualInfo;
- ng.ng_TextAttr = Font;
- ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
- ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
- ng.ng_Width = ComputeX( ng.ng_Width );
- ng.ng_Height = ComputeY( ng.ng_Height);
-
- SP_Main_Gadgets[ lc ] = g = CreateGadgetA((ULONG)SP_Main_GTypes[ lc ], g, &ng, ( struct TagItem * )&SP_Main_GTags[ tc ] );
-
- while( SP_Main_GTags[ tc ] ) tc += 2;
- tc++;
-
- if ( NOT g )
- return( 2L );
- }
-
- if ( ! ( SP_Main_Wnd = OpenWindowTags( NULL,
- WA_Left, wleft,
- WA_Top, wtop,
- WA_Width, ww + OffX + Scr->WBorRight,
- WA_Height, wh + OffY + Scr->WBorBottom,
- WA_IDCMP, BUTTONIDCMP|LISTVIEWIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
- WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
- WA_Gadgets, SP_Main_GList,
- WA_Title, SP_Main_Wdt,
- WA_ScreenTitle, "SuperPlay",
- TAG_DONE )))
- return( 4L );
-
- GT_RefreshWindow( SP_Main_Wnd, NULL );
-
- SP_Main_Render();
-
- return( 0L );
- }
-
- void CloseSP_Main_Window( void )
- {
- if ( SP_Main_Wnd ) {
- CloseWindow( SP_Main_Wnd );
- SP_Main_Wnd = NULL;
- }
-
- if ( SP_Main_GList ) {
- FreeGadgets( SP_Main_GList );
- SP_Main_GList = NULL;
- }
- }
-
-