home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 1 / Mecomp-CD.iso / amiga / grafic / cyberblanker / source-code / app.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-05  |  4.7 KB  |  205 lines

  1.  
  2.    /***********************************************************************
  3.    *                                                                      *
  4.    *                            COPYRIGHTS                                *
  5.    *                                                                      *
  6.    *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
  7.    *   This file was modified by © Zinneberg-Soft.                        *
  8.    ***********************************************************************/
  9.  
  10. /* custom.c This file contains the custom code for a commodity */
  11. /* you should be able to write a new commodity by changing only */
  12. /* custom.c and custom.h */
  13.  
  14. #include "app.h"
  15. #if WINDOW
  16. struct EasyStruct aboutcybereasy =
  17.     {
  18.  
  19.     sizeof(struct EasyStruct),
  20.    
  21.     0,
  22.     "About CyberBlanker",
  23.     "CyberBlanker ©97 Zinneberg-Soft\n"
  24.     "Version 1.0  68020/30/40 29 May 97\n"
  25.     "V = vertical blank. \n"
  26.     "H = horizontal blank. \n"
  27.     "H/V = vertical/horizontal blank. \n"
  28.     "Spell the word immortal  (Five letters.)\n"
  29.     "                  enjoy.",
  30.     "OK",
  31.  };
  32.  
  33. /*************/
  34. struct EasyStruct progconfig =
  35.     {
  36.  
  37.     sizeof(struct EasyStruct),
  38.  
  39.     0,
  40.     "CyberBlanker Configuration",
  41.     "The following Tooltypes can also\n"
  42.     "be given as Shell parameters.\n"
  43.     " \n"
  44.     "PUBSCREEN=DOPUS.1 \n"
  45.     "FONTNAME=helvetica.font \n"
  46.     "FONTSIZE=15 \n"
  47.     "SECONDS=120 \n"
  48.     "CX_POPUP=YES  (YES/NO) \n"
  49.     "CX_PRIORITY=0 \n"
  50.     "CX_POPKEY=SHIFT F1 \n"
  51.     "DPMS=OFF  (H/V/OFF) \n"
  52.     "            enjoy.",
  53.     "OK",
  54.  
  55.  };
  56.  
  57. /************/
  58. #define V(x) ((VOID *)x)
  59.  
  60.  
  61. VOID setupCustomGadgets(gad)
  62. struct Gadget **gad;
  63. {
  64.    mysetupCustomGadgets(gad);
  65. }
  66. VOID HandleGadget(gad,code)
  67. ULONG gad,code;
  68. {
  69.    myHandleGadget(gad,code);
  70. }
  71. VOID setupCustomMenu()
  72. {
  73.    struct NewMenu mynewmenu [] =
  74. {
  75.     { NM_TITLE, "Project",   0 ,  0, 0, 0,            },
  76.     { NM_ITEM,  "Hide",     "X",  0, 0, V(MENU_HIDE), },
  77.     { NM_ITEM, "DPMS LEVEL", 0 ,  0, 0, 0,            },
  78.     { NM_SUB,   "OFF",      "O",  0, 0, V(SHOW_V_H),  },
  79.     { NM_SUB, "V/BLANK",    "V",  0, 0, V(SHOW_V),    },
  80.     { NM_SUB, "H/BLANK",    "H",  0, 0, V(SHOW_H),    },
  81.     { NM_ITEM, "About",     "?",  0, 0, V(SHOW_ABOUT),},
  82.     { NM_ITEM, "Config",    "C",  0, 0, V(CONFIG),    },
  83.     { NM_ITEM, NM_BARLABEL,  0 ,  0, 0, 0,            },
  84.     { NM_ITEM, "Quit",      "Q",  0, 0, V(MENU_DIE),  },
  85.     { NM_END,  0,            0,   0, 0, 0             },
  86. };
  87.  
  88.  
  89.    menu=CreateMenus(mynewmenu,TAG_DONE);
  90.    D( kprintf("custom: CreateMenus returns menu =  %lx\n",menu); )
  91. }
  92.  
  93.  
  94. VOID handleCustomMenu(code)
  95.    ULONG code;
  96. {
  97.    struct MenuItem *item;
  98.    BOOL terminated=FALSE;
  99.  
  100.    D( kprintf("custom: handleCustomMenu(code=%lx)\n",code); )
  101.    while((code!=MENUNULL)&&(!terminated))
  102.    {
  103.       item=ItemAddress(menu,code);
  104.       switch((int)MENU_USERDATA(item))
  105.       {
  106.          case MENU_HIDE:
  107.                shutdownWindow();
  108.                terminated=TRUE; /* since window is gone NextSelect is invalid so...*/
  109.                break;
  110.  
  111.          case SHOW_ABOUT:
  112.                SHOWABOUT();
  113.                break;
  114.  
  115.          case CONFIG:
  116.                SHOWCONFIG();
  117.                break;
  118.  
  119.            case SHOW_V:
  120.                  {
  121.                   SSET_DPMS_SUSPEND();
  122.                   break;
  123.                  }
  124.              
  125.  
  126.           case SHOW_H:
  127.                {
  128.                 SSET_DPMS_STANDBY();
  129.                 break;
  130.                 }
  131.  
  132.           case SHOW_V_H:
  133.                 {
  134.                 
  135.                 
  136.                  SSET_DPMS_OFF();
  137.                  break;
  138.                  }
  139.  
  140.          case MENU_DIE:
  141.                terminate();
  142.                break;
  143.          default:
  144.                break;
  145.       }
  146.       code=item->NextSelect;
  147.       D( kprintf("custom: handleCustomMenu next code=%lx\n",code); )
  148.    }
  149.    D( kprintf("custom: handleCustomMenu exits"); )
  150. }
  151. VOID refreshWindow()
  152. {
  153.    if(window)
  154.    {
  155.       if(IDCMPRefresh)
  156.          GT_BeginRefresh( window );
  157.       if(IDCMPRefresh)
  158.          GT_EndRefresh( window, 1L );
  159.  
  160.       /* It is possible that the user has selected a font so large */
  161.       /* that our imagery will fall off the bottom of the window   */
  162.       /* we RefreshWindowFrame here incase our borders were overwritten */
  163.       if((topborder+WINDOW_INNERHEIGHT) > window->Height)
  164.          RefreshWindowFrame(window);
  165.    }
  166.    return;
  167. }
  168.  
  169. #endif /* WINDOW */
  170.  
  171. BOOL setupCustomCX()
  172. {
  173.    return(setupBlanker());
  174. }
  175. VOID shutdownCustomCX()
  176. {
  177. }
  178. VOID handleCustomCXMsg(id)
  179. ULONG id;
  180. {
  181.    switch(id)
  182.    {
  183.       case 0:
  184.       default:
  185.             break;
  186.    }
  187. }
  188.  
  189. VOID handleCustomCXCommand(id)
  190. ULONG id;
  191. {
  192.    switch(id)
  193.    {
  194.       case 0:
  195.       default:
  196.             break;
  197.    }
  198. }
  199. #if CSIGNAL
  200. VOID handleCustomSignal(VOID)
  201. {
  202.    MyHandleCustomSignal();
  203. }
  204. #endif
  205.