Esempio n. 1
0
int OpenBlankerWindow( void )
{
	struct NewGadget	ng;
	struct Gadget	*g;
	UWORD		lc, tc;
	UWORD		wleft = BlankerLeft, wtop = BlankerTop, ww, wh;

	ComputeFont( BlankerWidth, BlankerHeight );

	ww = ComputeX( BlankerWidth );
	wh = ComputeY( BlankerHeight );

	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 ( ! ( BlankerFont = OpenDiskFont( Font )))
		return( 5L );

	if ( ! ( g = CreateContext( &BlankerGList )))
		return( 1L );

	for( lc = 0, tc = 0; lc < Blanker_CNT; lc++ ) {

		CopyMem((char * )&BlankerNGad[ 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);

		BlankerGadgets[ lc ] = g = CreateGadgetA((ULONG)BlankerGTypes[ lc ], g, &ng, ( struct TagItem * )&BlankerGTags[ tc ] );

		while( BlankerGTags[ tc ] ) tc += 2;
		tc++;

		if ( NOT g )
			return( 2L );
	}

	if ( ! ( BlankerWnd = 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_MENUPICK|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
				WA_Flags,	WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SIZEBBOTTOM|WFLG_SMART_REFRESH|WFLG_ACTIVATE|WFLG_RMBTRAP,
				WA_Gadgets,	BlankerGList,
				WA_Title,	BlankerWdt,
				WA_ScreenTitle,	"Garshneblanker",
				WA_PubScreen,	Scr,
				TAG_DONE )))
	return( 4L );

	GT_RefreshWindow( BlankerWnd, NULL );

	return( 0L );
}
Esempio n. 2
0
// varargs CreateGadget
struct Gadget *__stdargs CreateGadget(
	ULONG kind,
	struct Gadget *previous,
	struct NewGadget *newgad,
	Tag tag,...)
{
	return CreateGadgetA(kind,previous,newgad,(struct TagItem *)&tag);
}
Esempio n. 3
0
int OpenBlockSelectWindow( void )
{
	struct NewGadget	ng;
	struct Gadget	*g;
	UWORD		lc, tc;
	UWORD		offx = Scr->WBorLeft, offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;

	if ( ! ( g = CreateContext( &BlockSelectGList ))){
		CloseBlockSelectWindow();
		return( 1L );
	}

	for( lc = 0, tc = 0; lc < BlockSelect_CNT; lc++ ) {

		CopyMem((char * )&BlockSelectNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));

		ng.ng_VisualInfo = VisualInfo;
		ng.ng_TextAttr   = &topaz8;
		ng.ng_LeftEdge  += offx;
		ng.ng_TopEdge   += offy;

		BlockSelectGadgets[ lc ] = g = CreateGadgetA((ULONG)BlockSelectGTypes[ lc ], g, &ng, ( struct TagItem * )&BlockSelectGTags[ tc ] );

		while( BlockSelectGTags[ tc ] ) tc += 2;
		tc++;

		if ( NOT g ){
			CloseBlockSelectWindow();
			return( 2L );
		}
	}

	if ( ! ( BlockSelectWnd = OpenWindowTags( NULL,
				WA_Left,	BlockSelectLeft,
				WA_Top,		BlockSelectTop,
				WA_Width,	BlockSelectWidth,
				WA_Height,	BlockSelectHeight + offy,
				WA_IDCMP,	LISTVIEWIDCMP | BUTTONIDCMP | IDCMP_NEWSIZE | IDCMP_REFRESHWINDOW | IDCMP_RAWKEY,
				WA_Flags,	WFLG_SIZEGADGET|WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_SMART_REFRESH,
				WA_Gadgets,	BlockSelectGList,
				WA_Title,	BlockSelectWdt,
				WA_MinWidth,	160,
				WA_MinHeight,	60,
				WA_MaxWidth,	720,
				WA_MaxHeight,	467,
				WA_AutoAdjust,	TRUE,
				WA_PubScreen,Scr,
				TAG_DONE )))
	{
		CloseBlockSelectWindow();
		return( 4L );
	}

	GT_RefreshWindow( BlockSelectWnd, NULL );

	return( 0L );
}
Esempio n. 4
0
ULONG CREATE_Gadget(piClass *cl,piObject *o,struct piWindow *msg)
{
	WORD x,y,w,h;
	struct TagItem *ti;
	struct Node_Gadget *ng;
	struct Node_Window *nw;
	struct GadToolsData *gtd;
	struct NewGadget newg;

	piGetAttr(o,OBJ_Node,(ULONG *)&ng);
	if(ng->ng_Type==GTYPE_GADTOOLS)
	{
		piGetAttr(ng->ng_Window,OBJ_Node,(ULONG *)&nw);
		piGetAttr(o,GAOBJ_NodeData,(ULONG *)&gtd);
		piGetAttr(o,GAOBJ_Tags,(ULONG *)&ti);
//		gtd=(struct GadToolsData *) GadgetData(ng);

		if(ng->ng_RelX) x=-(nw->nw_Window->Width-nw->nw_Window->BorderLeft-ng->ng_X-1);
		else x=piCX(o);
		if(ng->ng_RelY) y=-(nw->nw_Window->Height-nw->nw_Window->BorderTop-ng->ng_Y-1);
		else y=piCY(o);
		if(ng->ng_RelWidth) w=-(nw->nw_Window->BorderLeft+nw->nw_Window->BorderRight+ng->ng_X+(nw->nw_Window->Width-nw->nw_Window->BorderLeft-nw->nw_Window->BorderRight-ng->ng_Width)-1);
		else w=piCW(o)+1;
		if(ng->ng_RelHeight) h=-(nw->nw_Window->BorderTop+nw->nw_Window->BorderBottom+ng->ng_Y+(nw->nw_Window->Height-nw->nw_Window->BorderTop-nw->nw_Window->BorderBottom-ng->ng_Height)-1);
		else h=piCH(o)+1;

		newg.ng_LeftEdge=x;
		newg.ng_TopEdge=y;
		newg.ng_Width=w;
		newg.ng_Height=h;
		newg.ng_GadgetText=gtd->g_Text;
		newg.ng_TextAttr=&EditFontTA;
		newg.ng_GadgetID=0;
		newg.ng_Flags=gtd->g_Flags;
		newg.ng_VisualInfo=VisualInfo;
		newg.ng_UserData=NULL;

		ng->ng_Gadget=CreateGadgetA(gtd->g_Kind,(struct Gadget *)msg->Window,&newg,ti);
		if(ng->ng_RelX) ng->ng_Gadget->Flags|=GFLG_RELRIGHT;
		if(ng->ng_RelY) ng->ng_Gadget->Flags|=GFLG_RELBOTTOM;
		if(ng->ng_RelWidth) ng->ng_Gadget->Flags|=GFLG_RELWIDTH;
		if(ng->ng_RelHeight) ng->ng_Gadget->Flags|=GFLG_RELHEIGHT;
		return (ULONG) (ng->ng_Gadget);
	}
	return NULL;
}