home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 20 / amigaformatcd20.iso / -readerstuff- / steve_glover / source-code / app.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-09-20  |  5.2 KB  |  229 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.    #if CYBER68060
  17. struct EasyStruct aboutcybereasy =
  18.     {
  19.  
  20.     sizeof(struct EasyStruct),
  21.    
  22.     0,
  23.     "About CyberBlanker",
  24.     "CyberBlanker ©97 Zinneberg-Soft\n"
  25.     "Version 1.2  68060 15 August 97\n"
  26.     "V = vertical blank. \n"
  27.     "H = horizontal blank. \n"
  28.     "H/V = horizontal/vertical blank. \n"
  29.     "Spell the word immortal  (Five letters.)\n"
  30.     "                  enjoy.",
  31.     "OK",
  32.  };
  33.  #endif /* CYBER68060 */
  34.  
  35.  
  36.  
  37.   #if CYBER680203040
  38. struct EasyStruct aboutcybereasy =
  39.     {
  40.  
  41.     sizeof(struct EasyStruct),
  42.  
  43.     0,
  44.     "About CyberBlanker",
  45.     "CyberBlanker ©97 Zinneberg-Soft\n"
  46.     "Version 1.2  68020/30/40 15 August 97\n"
  47.     "V = vertical blank. \n"
  48.     "H = horizontal blank. \n"
  49.     "H/V = horizontal/vertical blank. \n"
  50.     "Spell the word immortal  (Five letters.)\n"
  51.     "                  enjoy.",
  52.     "OK",
  53.  };
  54.  #endif /* CYBER680203040 */
  55.  
  56. /*************/
  57. struct EasyStruct progconfig =
  58.     {
  59.  
  60.     sizeof(struct EasyStruct),
  61.  
  62.     0,
  63.     "CyberBlanker Configuration",
  64.     "The following Tooltypes can also\n"
  65.     "be given as Shell parameters.\n"
  66.     " \n"
  67.     "DONOTWAIT \n"
  68.     "PUBSCREEN=DOPUS.1 \n"
  69.     "FONTNAME=helvetica.font \n"
  70.     "FONTSIZE=15 \n"
  71.     "SECONDS=120 \n"
  72.     "CX_POPUP=YES  (YES/NO) \n"
  73.     "CX_PRIORITY=0 \n"
  74.     "CX_POPKEY=SHIFT F1 \n"
  75.     "DPMS=OFF  (H/V/OFF) \n"
  76.     "            enjoy.",
  77.     "OK",
  78.  
  79.  };
  80.  
  81. /************/
  82. #define V(x) ((VOID *)x)
  83.  
  84.  
  85. VOID setupCustomGadgets(gad)
  86. struct Gadget **gad;
  87. {
  88.    mysetupCustomGadgets(gad);
  89. }
  90. VOID HandleGadget(gad,code)
  91. ULONG gad,code;
  92. {
  93.    myHandleGadget(gad,code);
  94. }
  95. VOID setupCustomMenu()
  96. {
  97.    struct NewMenu mynewmenu [] =
  98. {
  99.     { NM_TITLE, "Project",   0 ,  0, 0, 0,            },
  100.     { NM_ITEM,  "Hide",     "X",  0, 0, V(MENU_HIDE), },
  101.     { NM_ITEM, "DPMS LEVEL", 0 ,  0, 0, 0,            },
  102.     { NM_SUB,   "OFF",      "O",  0, 0, V(SHOW_V_H),  },
  103.     { NM_SUB, "V/BLANK",    "V",  0, 0, V(SHOW_V),    },
  104.     { NM_SUB, "H/BLANK",    "H",  0, 0, V(SHOW_H),    },
  105.     { NM_ITEM, "About",     "?",  0, 0, V(SHOW_ABOUT),},
  106.     { NM_ITEM, "Config",    "C",  0, 0, V(CONFIG),    },
  107.     { NM_ITEM, NM_BARLABEL,  0 ,  0, 0, 0,            },
  108.     { NM_ITEM, "Quit",      "Q",  0, 0, V(MENU_DIE),  },
  109.     { NM_END,  0,            0,   0, 0, 0             },
  110. };
  111.  
  112.  
  113.    menu=CreateMenus(mynewmenu,TAG_DONE);
  114.    D( kprintf("custom: CreateMenus returns menu =  %lx\n",menu); )
  115. }
  116.  
  117.  
  118. VOID handleCustomMenu(code)
  119.    ULONG code;
  120. {
  121.    struct MenuItem *item;
  122.    BOOL terminated=FALSE;
  123.  
  124.    D( kprintf("custom: handleCustomMenu(code=%lx)\n",code); )
  125.    while((code!=MENUNULL)&&(!terminated))
  126.    {
  127.       item=ItemAddress(menu,code);
  128.       switch((int)MENU_USERDATA(item))
  129.       {
  130.          case MENU_HIDE:
  131.                shutdownWindow();
  132.                terminated=TRUE; /* since window is gone NextSelect is invalid so...*/
  133.                break;
  134.  
  135.          case SHOW_ABOUT:
  136.                SHOWABOUT();
  137.                break;
  138.  
  139.          case CONFIG:
  140.                SHOWCONFIG();
  141.                break;
  142.  
  143.            case SHOW_V:
  144.                  {
  145.                   SSET_DPMS_SUSPEND();
  146.                   break;
  147.                  }
  148.              
  149.  
  150.           case SHOW_H:
  151.                {
  152.                 SSET_DPMS_STANDBY();
  153.                 break;
  154.                 }
  155.  
  156.           case SHOW_V_H:
  157.                 {
  158.                 
  159.                 
  160.                  SSET_DPMS_OFF();
  161.                  break;
  162.                  }
  163.  
  164.          case MENU_DIE:
  165.                terminate();
  166.                break;
  167.          default:
  168.                break;
  169.       }
  170.       code=item->NextSelect;
  171.       D( kprintf("custom: handleCustomMenu next code=%lx\n",code); )
  172.    }
  173.    D( kprintf("custom: handleCustomMenu exits"); )
  174. }
  175. VOID refreshWindow()
  176. {
  177.    if(window)
  178.    {
  179.       if(IDCMPRefresh)
  180.          GT_BeginRefresh( window );
  181.       if(IDCMPRefresh)
  182.          GT_EndRefresh( window, 1L );
  183.  
  184.       /* It is possible that the user has selected a font so large */
  185.       /* that our imagery will fall off the bottom of the window   */
  186.       /* we RefreshWindowFrame here incase our borders were overwritten */
  187.       if((topborder+WINDOW_INNERHEIGHT) > window->Height)
  188.          RefreshWindowFrame(window);
  189.    }
  190.    return;
  191. }
  192.  
  193. #endif /* WINDOW */
  194.  
  195. BOOL setupCustomCX()
  196. {
  197.    return(setupBlanker());
  198. }
  199. VOID shutdownCustomCX()
  200. {
  201. }
  202. VOID handleCustomCXMsg(id)
  203. ULONG id;
  204. {
  205.    switch(id)
  206.    {
  207.       case 0:
  208.       default:
  209.             break;
  210.    }
  211. }
  212.  
  213. VOID handleCustomCXCommand(id)
  214. ULONG id;
  215. {
  216.    switch(id)
  217.    {
  218.       case 0:
  219.       default:
  220.             break;
  221.    }
  222. }
  223. #if CSIGNAL
  224. VOID handleCustomSignal(VOID)
  225. {
  226.    MyHandleCustomSignal();
  227. }
  228. #endif
  229.