home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / screen / scremo10.lha / ScreenMod / Source / save.c < prev    next >
C/C++ Source or Header  |  1991-06-06  |  2KB  |  84 lines

  1. /********************************************************************\
  2.  *                     SAVE SCREEN SETTINGS                         *
  3.  *                      for ScreenMod v1.0                          *
  4.  *                                                                  *
  5.  *Written by Syd L. Bolton  ©1991 Legendary Design Technologies Inc.*
  6.  *                                                                  *
  7.  *                Date: May 4, 1991  Time: 00:35                    *
  8. \********************************************************************/
  9.  
  10. #include "save.h"
  11.  
  12. save()
  13. {
  14. struct Window *SWindow;
  15. struct IntuiMessage *message;
  16. struct Gadget *igad;
  17. ULONG class;
  18. int gadgid,save_exit=0;
  19.  
  20. SaveWindow.Screen=Screen;
  21.  
  22. SWindow=OpenWindow(&SaveWindow);
  23. if (SWindow==NULL) return();
  24. ActivateGadget(&SGadget3,SWindow,NULL);
  25.  
  26. do {
  27.     WaitPort(SWindow->UserPort);
  28.         while ( ( message=(struct IntuiMessage *)
  29.             GetMsg(SWindow->UserPort) ) != NULL)
  30.         {
  31.         class=message->Class;
  32.         ReplyMsg(message);
  33.  
  34.         if (class==GADGETUP) save_exit=1;
  35.         }
  36.     } while (save_exit==0);
  37.  
  38. CloseWindow(SWindow);
  39.  
  40. igad=(struct Gadget *) message->IAddress;
  41. gadgid=igad->GadgetID;
  42.  
  43. switch(gadgid) {
  44.     case 2: return();
  45.         break;
  46.  
  47.     default: saveinfo(SGadget3SIBuff);
  48.          break;
  49.     }
  50. }
  51.  
  52. saveinfo(name)
  53. char *name[];
  54. {
  55. FILE *fp;
  56. int i,numcolors,depth;
  57. UWORD color;
  58.  
  59. fp=fopen(name,"w");
  60.  
  61. if (fp==NULL) return();
  62.  
  63. fprintf(fp,"SM1\n");
  64. if (origtitle[0]=='\0') fprintf(fp,"*NN\n");
  65.     else fprintf(fp,"%s\n",origtitle);
  66. fprintf(fp,"%4d%4d\n",origwidth,origheight);
  67. fprintf(fp,"%4d%4d%4d%4d%2d%2d\n",atoi(Gadget3SIBuff),atoi(Gadget4SIBuff),atoi(Gadget5SIBuff),atoi(Gadget6SIBuff),atoi(Gadget7SIBuff),atoi(Gadget8SIBuff));
  68. if (Screens[scr]->Title[0]=='\0') fprintf(fp,"*NN\n");
  69.     else fprintf(fp,"%s\n",Screens[scr]->Title);
  70. if (Screens[scr]->DefaultTitle[0]=='\0') fprintf(fp,"*NN\n");
  71.     else fprintf(fp,"%s\n",Screens[scr]->DefaultTitle);
  72. fprintf(fp,"%6d\n",Screens[scr]->ViewPort.Modes);
  73. depth=Screens[scr]->RastPort.BitMap->Depth;
  74. if (depth > 5) depth=5;
  75. numcolors= 1 << depth;
  76. fprintf(fp,"%2d\n",numcolors);
  77. for (i=0; i<numcolors; i++) {
  78.     color=GetRGB4(Screens[scr]->ViewPort.ColorMap,i);
  79.     fprintf(fp,"%4d\n",color);
  80.     }
  81. fclose(fp);
  82. }
  83.  
  84.