home *** CD-ROM | disk | FTP | other *** search
/ The AGA Experience 1 / agavol1.iso / aga_utilities / ready_to_run / wb_tools / palreq24 / palette_temp.c next >
Encoding:
Text File  |  1978-06-28  |  2.0 KB  |  94 lines

  1. /* This file contains empty template routines that
  2.  * the IDCMP handler will call uppon. Fill out these
  3.  * routines with your code or use them as a reference
  4.  * to create your program.
  5.  */
  6.  
  7. int
  8. SetTable()
  9. {
  10.     table[0] = (1l<<16) + index;
  11.     table[1] = red<<24  | 0x00FFFFFF;
  12.     table[2] = green<<24| 0x00FFFFFF;
  13.     table[3] = blue<<24 | 0x00FFFFFF;
  14.     table[4] = NULL;
  15.  
  16. //    SetRGB32(&Scr->ViewPort, index, table[1], table[2], table[3]);
  17.     LoadRGB32(&Scr->ViewPort, table);
  18.     return(0);
  19. }
  20.  
  21. int BlueSliderGClicked( struct IntuiMessage *m )
  22. {
  23.     blue = m->Code;
  24.     SetTable();
  25.     return(TRUE);
  26. }
  27.  
  28. int GreenSliderGClicked( struct IntuiMessage *m )
  29. {
  30.     green = m->Code;
  31.     SetTable();
  32.     return(TRUE);
  33. }
  34.  
  35. int RedSliderGClicked( struct IntuiMessage *m )
  36. {
  37.     red = m->Code;
  38.     SetTable();
  39.     return(TRUE);
  40. }
  41.  
  42. int UseGClicked( struct IntuiMessage *m )
  43. {
  44.     /* routine when gadget "_Use" is clicked. */
  45.  
  46.      return(FALSE);
  47. }
  48.  
  49. int ResetGClicked( struct IntuiMessage *m )
  50. {
  51.     /* routine when gadget "r_Eset" is clicked. */
  52.  
  53.     ResetPalette();
  54.     return(TRUE);
  55. }
  56.  
  57. int CancelGClicked( struct IntuiMessage *m )
  58. {
  59.     /* routine when gadget "_Cancel" is clicked. */
  60.  
  61.     ResetPalette();
  62.     return(FALSE);
  63. }
  64.  
  65. int
  66. PaletteGClicked( struct IntuiMessage *m )
  67. {
  68.     index = m->Code;
  69.     GetRGB32(Scr->ViewPort.ColorMap, index, 1, &table[1]);
  70.     red   = table[1]>>24;
  71.     green = table[2]>>24;
  72.     blue  = table[3]>>24;
  73.     SetDrMd(PReqWnd->RPort, JAM2);
  74.     SetAPen(PReqWnd->RPort, index);
  75.     RectFill(PReqWnd->RPort, PReqWnd->BorderLeft+9, PReqWnd->BorderTop+29,
  76.                               PReqWnd->BorderLeft+41, PReqWnd->BorderTop+61);
  77.      GT_SetGadgetAttrs(PReqGadgets[2], PReqWnd, NULL,
  78.                        GTSL_Level, red, TAG_END);
  79.      GT_SetGadgetAttrs(PReqGadgets[1], PReqWnd, NULL,
  80.                        GTSL_Level, green, TAG_END);
  81.      GT_SetGadgetAttrs(PReqGadgets[0], PReqWnd, NULL,
  82.                        GTSL_Level, blue, TAG_END);
  83.     return(TRUE);
  84. }
  85.  
  86. int PReqCloseWindow( void )
  87. {
  88.     /* routine for "IDCMP_CLOSEWINDOW". */
  89.  
  90.     ResetPalette();
  91.     return(FALSE);
  92. }
  93.  
  94.