home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 351.lha / iff.library_v1.6 / putproject.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-26  |  2.2 KB  |  87 lines

  1. #include <intuition/intuition.h>
  2. #include <workbench/workbench.h>
  3.  
  4.  
  5. short PutProject(fname,tool,image,image2,tooltypes,stack)
  6. char *fname;         /* file name to save to */
  7. char *tool;         /* default tool */
  8. struct Image *image;     /* image for the Icon */
  9. struct Image *image2;     /* second image or NULL */
  10. char **tooltypes;     /* ToolTypes array */
  11. long stack;         /* stack size, zero for default */
  12. {
  13. long PutDiskObject();
  14. /* This is a static copy of the DiskObject
  15.  * structure that is used for the project. */
  16. static struct DiskObject d0 =
  17. {
  18. WB_DISKMAGIC,             /* do_Magic */
  19. WB_DISKVERSION,   /* do_Version */
  20.  
  21.    {          /* Gadget */
  22.    0L,                  /* NextGadget */
  23.    0,0,               /* LeftEdge TopEdge */
  24.    0,0,               /* Width Height */
  25.    GADGIMAGE,  /* Flags */
  26.    RELVERIFY | GADGIMMEDIATE, /* Activation */
  27.    BOOLGADGET,              /* GadgetType */
  28.    0L,                  /* GadgetRender */
  29.    0L,                  /* SelectRender */
  30.    0L,                  /* GadgetText */
  31.    0L,                  /* MutualExclude */
  32.    0L,                  /* SpecialInfo */
  33.    0,                  /* GadgetID */
  34.    0L,                  /* UserData */
  35.    },
  36. WBPROJECT,      /* do_Type */
  37. 0L,          /* do_DefaultTool */
  38. 0L,          /* do_ToolTypes */
  39. NO_ICON_POSITION, /* do_CurrentX */
  40. NO_ICON_POSITION, /* do_CurrentY */
  41. 0L,          /* do_DrawerData */
  42. 0L,          /* do_ToolWindow */
  43. 0L,          /* do_StackSize */
  44. };
  45.  
  46. /* This is a private copy of the DiskObject
  47.  * structure that is used to save the DiskObject. */
  48. struct DiskObject d;
  49. /* Private Image structure, it may be modified. */
  50. struct Image i, i2;
  51.  
  52. /* Initialize local copies */
  53. d= d0;
  54. i = *image;
  55.  
  56. /* Now fill in the DiskObject with the specifics
  57.  * for the application */
  58. d.do_Gadget.Width = i.Width;
  59. d.do_Gadget.Height = i.Height+1;
  60. d.do_Gadget.GadgetRender = (APTR)&i;
  61. if( image2 )
  62.    {
  63.    i2 = *image2;
  64.    d.do_Gadget.Flags |= GADGHIMAGE;
  65.    d.do_Gadget.SelectRender = (APTR)&i2;
  66.    i2.Depth = 2;
  67.    i2.PlanePick = 3;
  68.    i2.PlaneOnOff = 0;
  69.    i2.NextImage = 0L;
  70.    }
  71. else
  72.    d.do_Gadget.Flags |= GADGBACKFILL;
  73. i.Depth = 2;
  74. i.PlanePick = 3;
  75. i.PlaneOnOff = 0;
  76. i.NextImage = 0L;
  77. d.do_DefaultTool = tool;
  78. d.do_ToolTypes = tooltypes;
  79. d.do_StackSize = stack;
  80.  
  81. /* Save the disk object to the file */
  82. if( !PutDiskObject(fname,&d) )
  83.    return(1);
  84. return(0);
  85. }
  86.  
  87.