/********************************************************************\ * SAVE SCREEN SETTINGS * * for ScreenMod v1.0 * * * *Written by Syd L. Bolton ©1991 Legendary Design Technologies Inc.* * * * Date: May 4, 1991 Time: 00:35 * \********************************************************************/ #include "save.h" save() { struct Window *SWindow; struct IntuiMessage *message; struct Gadget *igad; ULONG class; int gadgid,save_exit=0; SaveWindow.Screen=Screen; SWindow=OpenWindow(&SaveWindow); if (SWindow==NULL) return(); ActivateGadget(&SGadget3,SWindow,NULL); do { WaitPort(SWindow->UserPort); while ( ( message=(struct IntuiMessage *) GetMsg(SWindow->UserPort) ) != NULL) { class=message->Class; ReplyMsg(message); if (class==GADGETUP) save_exit=1; } } while (save_exit==0); CloseWindow(SWindow); igad=(struct Gadget *) message->IAddress; gadgid=igad->GadgetID; switch(gadgid) { case 2: return(); break; default: saveinfo(SGadget3SIBuff); break; } } saveinfo(name) char *name[]; { FILE *fp; int i,numcolors,depth; UWORD color; fp=fopen(name,"w"); if (fp==NULL) return(); fprintf(fp,"SM1\n"); if (origtitle[0]=='\0') fprintf(fp,"*NN\n"); else fprintf(fp,"%s\n",origtitle); fprintf(fp,"%4d%4d\n",origwidth,origheight); fprintf(fp,"%4d%4d%4d%4d%2d%2d\n",atoi(Gadget3SIBuff),atoi(Gadget4SIBuff),atoi(Gadget5SIBuff),atoi(Gadget6SIBuff),atoi(Gadget7SIBuff),atoi(Gadget8SIBuff)); if (Screens[scr]->Title[0]=='\0') fprintf(fp,"*NN\n"); else fprintf(fp,"%s\n",Screens[scr]->Title); if (Screens[scr]->DefaultTitle[0]=='\0') fprintf(fp,"*NN\n"); else fprintf(fp,"%s\n",Screens[scr]->DefaultTitle); fprintf(fp,"%6d\n",Screens[scr]->ViewPort.Modes); depth=Screens[scr]->RastPort.BitMap->Depth; if (depth > 5) depth=5; numcolors= 1 << depth; fprintf(fp,"%2d\n",numcolors); for (i=0; iViewPort.ColorMap,i); fprintf(fp,"%4d\n",color); } fclose(fp); }