
   /***********************************************************************
   *                                                                      *
   *                            COPYRIGHTS                                *
   *                                                                      *
   *   Copyright (c) 1990  Commodore-Amiga, Inc.  All Rights Reserved.    *
   *   This file was modified by © Zinneberg-Soft.                        *
   ***********************************************************************/

/* custom.c This file contains the custom code for a commodity */
/* you should be able to write a new commodity by changing only */
/* custom.c and custom.h */

#include "app.h"
#if WINDOW
struct EasyStruct aboutcybereasy =
    {
 
    sizeof(struct EasyStruct),
   
    0,
    "About CyberBlanker",
    "CyberBlanker ©97 Zinneberg-Soft\n"
    "Version 1.0  68020/30/40 29 May 97\n"
    "V = vertical blank. \n"
    "H = horizontal blank. \n"
    "H/V = vertical/horizontal blank. \n"
    "Spell the word immortal  (Five letters.)\n"
    "                  enjoy.",
    "OK",
 };

/*************/
struct EasyStruct progconfig =
    {

    sizeof(struct EasyStruct),

    0,
    "CyberBlanker Configuration",
    "The following Tooltypes can also\n"
    "be given as Shell parameters.\n"
    " \n"
    "PUBSCREEN=DOPUS.1 \n"
    "FONTNAME=helvetica.font \n"
    "FONTSIZE=15 \n"
    "SECONDS=120 \n"
    "CX_POPUP=YES  (YES/NO) \n"
    "CX_PRIORITY=0 \n"
    "CX_POPKEY=SHIFT F1 \n"
    "DPMS=OFF  (H/V/OFF) \n"
    "            enjoy.",
    "OK",

 };

/************/
#define V(x) ((VOID *)x)
 

VOID setupCustomGadgets(gad)
struct Gadget **gad;
{
   mysetupCustomGadgets(gad);
}
VOID HandleGadget(gad,code)
ULONG gad,code;
{
   myHandleGadget(gad,code);
}
VOID setupCustomMenu()
{
   struct NewMenu mynewmenu [] =
{
    { NM_TITLE, "Project",   0 ,  0, 0, 0,            },
    { NM_ITEM,  "Hide",     "X",  0, 0, V(MENU_HIDE), },
    { NM_ITEM, "DPMS LEVEL", 0 ,  0, 0, 0,            },
    { NM_SUB,   "OFF",      "O",  0, 0, V(SHOW_V_H),  },
    { NM_SUB, "V/BLANK",    "V",  0, 0, V(SHOW_V),    },
    { NM_SUB, "H/BLANK",    "H",  0, 0, V(SHOW_H),    },
    { NM_ITEM, "About",     "?",  0, 0, V(SHOW_ABOUT),},
    { NM_ITEM, "Config",    "C",  0, 0, V(CONFIG),    },
    { NM_ITEM, NM_BARLABEL,  0 ,  0, 0, 0,            },
    { NM_ITEM, "Quit",      "Q",  0, 0, V(MENU_DIE),  },
    { NM_END,  0,            0,   0, 0, 0             },
};


   menu=CreateMenus(mynewmenu,TAG_DONE);
   D( kprintf("custom: CreateMenus returns menu =  %lx\n",menu); )
}


VOID handleCustomMenu(code)
   ULONG code;
{
   struct MenuItem *item;
   BOOL terminated=FALSE;

   D( kprintf("custom: handleCustomMenu(code=%lx)\n",code); )
   while((code!=MENUNULL)&&(!terminated))
   {
      item=ItemAddress(menu,code);
      switch((int)MENU_USERDATA(item))
      {
         case MENU_HIDE:
               shutdownWindow();
               terminated=TRUE; /* since window is gone NextSelect is invalid so...*/
               break;

         case SHOW_ABOUT:
               SHOWABOUT();
               break;

         case CONFIG:
               SHOWCONFIG();
               break;

           case SHOW_V:
                 {
                  SSET_DPMS_SUSPEND();
                  break;
                 }
             

          case SHOW_H:
               {
                SSET_DPMS_STANDBY();
                break;
                }

          case SHOW_V_H:
                {
                
                
                 SSET_DPMS_OFF();
                 break;
                 }

         case MENU_DIE:
               terminate();
               break;
         default:
               break;
      }
      code=item->NextSelect;
      D( kprintf("custom: handleCustomMenu next code=%lx\n",code); )
   }
   D( kprintf("custom: handleCustomMenu exits"); )
}
VOID refreshWindow()
{
   if(window)
   {
      if(IDCMPRefresh)
         GT_BeginRefresh( window );
      if(IDCMPRefresh)
         GT_EndRefresh( window, 1L );

      /* It is possible that the user has selected a font so large */
      /* that our imagery will fall off the bottom of the window   */
      /* we RefreshWindowFrame here incase our borders were overwritten */
      if((topborder+WINDOW_INNERHEIGHT) > window->Height)
         RefreshWindowFrame(window);
   }
   return;
}

#endif /* WINDOW */

BOOL setupCustomCX()
{
   return(setupBlanker());
}
VOID shutdownCustomCX()
{
}
VOID handleCustomCXMsg(id)
ULONG id;
{
   switch(id)
   {
      case 0:
      default:
            break;
   }
}

VOID handleCustomCXCommand(id)
ULONG id;
{
   switch(id)
   {
      case 0:
      default:
            break;
   }
}
#if CSIGNAL
VOID handleCustomSignal(VOID)
{
   MyHandleCustomSignal();
}
#endif
