home *** CD-ROM | disk | FTP | other *** search
- #include <graphics/display.h>
- #include <libraries/dosextens.h>
- #include <libraries/diskfont.h>
- #include <exec/exec.h>
- #include <intuition/intuitionbase.h>
- #include <graphics/regions.h>
- #include <devices/keymap.h>
- #include <stdio.h>
- #include <workbench/startup.h>
- #include <intuition/intuition.h>
- #include <workbench/workbench.h>
- #include <graphics/gfxmacros.h>
- #include <graphics/gfxbase.h>
- #include <math.h>
-
- #include "struct.h"
- #include "ffp.h"
-
- USHORT DatIconImageData[] = {
- 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xffe0,
- 0x1fff, 0xffff, 0xe000,
- 0x1fff, 0xfffc, 0xfe0,
- 0x1fff, 0xfffd, 0xffc0,
- 0x1fff, 0xfffe, 0xff80,
- 0x1fff, 0xffff, 0x3e00,
- 0x1fff, 0xffff, 0xbc00,
- 0x1fff, 0xffff, 0x9000,
- 0x1fff, 0xffff, 0xc000,
- 0x0, 0x0, 0x0,
- 0x0, 0x0, 0x0,
- /*------ plane # 1: --------*/
-
- 0x0, 0x0, 0x0,
- 0x7fff, 0xffff, 0xfff8,
- 0x6000, 0x0, 0x18,
- 0x6000, 0x0, 0x18,
- 0x6000, 0x0, 0x18,
- 0x63f6, 0xf1ce, 0x3f18,
- 0x6200, 0x81, 0xc118,
- 0x6007, 0x90, 0x8118,
- 0x6202, 0x1fef, 0x8118,
- 0x6202, 0x2080, 0x8118,
- 0x6002, 0x41c1, 0xc118,
- 0x6207, 0x8000, 0x118,
- 0x623a, 0x0, 0x118,
- 0x6042, 0x0, 0x118,
- 0x62c7, 0x0, 0x118,
- 0x6200, 0x0, 0x118,
- 0x63f7, 0xfdfd, 0xff18,
- 0x6000, 0x0, 0x18,
- 0x6000, 0x0, 0x18,
- 0x6000, 0x0, 0x18,
- 0x6000, 0x0, 0x1ff8,
- 0x6000, 0x3, 0xf018,
- 0x6000, 0x2, 0x38,
- 0x6000, 0x1, 0x60,
- 0x6000, 0x0, 0xc1c0,
- 0x6000, 0x0, 0x4300,
- 0x6000, 0x0, 0x6e00,
- 0x6000, 0x0, 0x3800,
- 0x7fff, 0xffff, 0xe000,
- 0x0, 0x0, 0x0
- };
-
- #define ICONHEI 30
- #define ICONWID 46
- struct Image DatIconImage = {
- 0,
- 0,
- ICONWID,
- ICONHEI, 2,
- DatIconImageData,
- 3, 0,
- NULL
- };
-
-
- struct DiskObject DatIconDiskObject = {
- WB_DISKMAGIC,
- WB_DISKVERSION,
-
- NULL,
- 0, 0,
- ICONWID, ICONHEI+1,
- GADGIMAGE|GADGBACKFILL,
- RELVERIFY|GADGIMMEDIATE,
- BOOLGADGET,
- (APTR) &DatIconImage,
- NULL,
- NULL,
- 0,
- NULL,
- 0,
- NULL,
- WBPROJECT,
- "Multiplot:Multiplot",
- NULL,
- NO_ICON_POSITION,
- NO_ICON_POSITION,
- NULL,
- NULL,
- 10000
- };
-
- extern struct Window *window;
- extern char filename[150];
- extern struct Screen *screen;
- extern struct TextBox *ExtraText;
- extern int MAXHORIZ;
- extern int MAXVERT;
-
-
- SaveDat(Pict,saveas)
- struct Pict *Pict;
- short saveas;
- {
- struct Process *OurTask;
- struct Window *old_pr_WindowPtr;
- int i;
- FFP *xarray, *yarray, *earray;
- FILE *fp;
- struct Plot *Plot;
- struct TextBox *TempText;
- char plotname[150], def_drive[150], def_path[100], def_node[30],def_extn[20];
- static char mPlotNum = 0;
-
- strcpy(plotname,filename);
- if (saveas)
- {
- strsfn(plotname,def_drive,def_path,def_node,def_extn);
- strcat(def_drive,def_path);
- strcat(def_node,".dat");
- strcat(def_node,mPlotNum);
-
- OurTask = (struct Process *)FindTask(0L);
- old_pr_WindowPtr = (struct Window *)OurTask->pr_WindowPtr;
- OurTask->pr_WindowPtr = (APTR)window;
- if (get_fname(window,screen,"Save Data As...",def_node,def_drive)==NULL)
- { OurTask->pr_WindowPtr = (APTR)old_pr_WindowPtr; return(TRUE); }
- OurTask->pr_WindowPtr = (APTR)old_pr_WindowPtr;
- strmfp(plotname,def_drive,def_node);
- }
- if (!(fp = fopen(plotname,"w") ))
- {Message(" Can't write data file "); return(FALSE);}
-
- fprintf(fp,"*TITLE* %s\n*XLABEL* %s\n*YLABEL* %s\n", Pict->Title,Pict->XLabel->String,Pict->YLabel->String);
- fprintf(fp,"*AUTOSCRIPT* %d %d %d %d %d %d %.5g %.5g %.5g %.5g\n\n",
- Pict->ErrBar,Pict->ShowErr,Pict->Grid,Pict->Tics->NX,Pict->Tics->NY,Pict->RMargin,
- Pict->CurrReg->XMin,Pict->CurrReg->XMax,Pict->CurrReg->YMin, Pict->CurrReg->YMax);
- Plot = Pict->Plot;
- while (Plot)
- {
- fprintf(fp,"*LEGEND* %s\n",Plot->Legend->String);
- fprintf(fp,"*AUTOSCRIPT* %d %d %d %d %d %d %d %d\n",
- Plot->Color,Plot->PlotType,Plot->Lines,Plot->PointSize,Plot->PointType,Plot->Enabled,MAXHORIZ-Plot->Legend->x,Plot->Legend->y);
- do {
- xarray=Plot->x; yarray=Plot->y; earray=Plot->e;
- for (i=0;i<Plot->NPts;i++,xarray++,yarray++,earray++)
- {
- if (Pict->ErrBar) {fprintf(fp,"%.5g %.5g %.5g\n", *xarray,*yarray,*earray);}
- else {fprintf(fp,"%.5g %.5g\n", *xarray,*yarray);}
- }
- } while ((Plot->Continued)&&(Plot=Plot->NextPlot));
- fprintf(fp,"\n\n");
- Plot=Plot->NextPlot;
- }
- if (ExtraText)
- {
- fprintf(fp,"*EXTRATEXT*\n");
- TempText=ExtraText;
- while (TempText)
- {
- fprintf(fp,"%d %d %s\n",MAXHORIZ-TempText->x,MAXVERT-TempText->y,TempText->String);
- TempText=TempText->NextText;
- }
- }
- (void) fclose(fp);
- if (!PutDiskObject(plotname,&DatIconDiskObject))
- {Message(" Can't write icon file "); return(FALSE);}
-
- return(TRUE);
- }
-
-
-
-