/* * MandelVroom 2.0 * * (c) Copyright 1987,1989 Kevin L. Clague, San Jose, CA * * All rights reserved. * * Permission is hereby granted to distribute this program's source * executable, and documentation for non-comercial purposes, so long as the * copyright notices are not removed from the sources, executable or * documentation. This program may not be distributed for a profit without * the express written consent of the author Kevin L. Clague. * * This program is not in the public domain. * * Fred Fish is expressly granted permission to distribute this program's * source and executable as part of the "Fred Fish freely redistributable * Amiga software library." * * Permission is expressly granted for this program and it's source to be * distributed as part of the Amicus Amiga software disks, and the * First Amiga User Group's Hot Mix disks. * * contents: this file contains functions to open, display and close the * statistics window. */ #include "mandp.h" struct Window *StatsWind; UBYTE StatsOpen; static struct NewWindow NewStats = { 0,200-100, /* start position */ 90,120, /* width, height */ (UBYTE) 0, (UBYTE) 1, /* detail pen, block pen */ NULL, /* IDCMP flags */ /* MandWind flags */ WINDOWCLOSE | WINDOWDRAG | WINDOWDEPTH | SMART_REFRESH, (struct Gadget *) NULL, /* first gadget */ (struct Image *) NULL, /* user checkmark */ (UBYTE *) "Statistics", /* window title */ (struct Screen *) NULL, /* pointer to screen */ (struct BitMap *) NULL, /* pointer to superbitmap */ 80,80,80,80, /* sizing */ CUSTOMSCREEN /* type of screen */ }; static UBYTE StartString[80], EndString[80], GapString[80], SizeString[80]; static UBYTE MagString[30]; static struct IntuiText MagIntui = { 1, 0, JAM1, 8, 52, NULL, (UBYTE *) MagString, NULL }; static struct IntuiText SizeIntui = { 1, 0, JAM1, 8, 44, NULL, (UBYTE *) SizeString, &MagIntui }; static struct IntuiText GapIntui = { 1, 0, JAM1, 8, 36, NULL, (UBYTE *) GapString, &SizeIntui }; static struct IntuiText EndIntui = { 1, 0, JAM1, 8, 28, NULL, (UBYTE *) EndString, &GapIntui }; static struct IntuiText StartIntui = { 1, 0, JAM1, 8, 20, NULL, (UBYTE *) StartString, &EndIntui }; static struct IntuiText RealIntui = { 1, 0, JAM1, 8, 12, NULL, (UBYTE *) " Real Imag", &StartIntui }; /* * Open the statistics window */ OpenStatsWind( Pict ) struct Picture *Pict; { struct Window *OpenMyWind(); if (StatsWind == (struct Window *) NULL) { StatsWind = OpenMyWind( &NewStats, screen, NULL, 320, 80); } else { WindowToFront( StatsWind ); } ShowStats( Pict ); StatsOpen = 1; } /* OpenStatsWind */ /* * Close the statistics window */ CloseStatsWind() { if (StatsWind != (struct Window *) NULL) { CloseMyWind( StatsWind, NULL); StatsWind = (struct Window *) NULL; } } /* CloseStatsWind */ ShowStats( Pict ) register struct Picture *Pict; { register LONG Mag; if (StatsWind) { ClearWindow( StatsWind, 0); Mag = (LONG) 4.0 / (Pict->ImagHigh - Pict->ImagLow); sprintf( StartString, "Start %15.12f %15.12f", Pict->RealLow, Pict->ImagLow ); sprintf( EndString, "End %15.12f %15.12f", Pict->RealHigh, Pict->ImagHigh ); sprintf( GapString, "Gap %15.12f %15.12f", Pict->RealGap, Pict->ImagGap ); sprintf( SizeString, "Size %15d %15d", Pict->CountX, Pict->CountY ); sprintf( MagString, "Mag %15d", Mag ); PrintIText( StatsWind->RPort, &RealIntui, 0, 0 ); } } ClearWindow( Window, pen ) register struct Window *Window; int pen; { register struct RastPort *RPort; register LONG bot, right; RPort = Window->RPort; SetAPen( RPort, (long) pen); bot = Window->Height - Window->BorderBottom; right = Window->Width - Window->BorderRight; RectFill( RPort, Window->BorderLeft-1, Window->BorderTop-1, right, bot ); }