home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 632.lha / ParM_v3.6 / ParM_Src.lzh / ParM_Src / SetMouse.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-01-19  |  18.4 KB  |  578 lines

  1. /*
  2.  *    SetMouse.c - Copyright © 1990 by S.R. & P.C.
  3.  *
  4.  *    Created:    27 Oct 1991  18:04:16
  5.  *    Modified:    18 Jan 1992  19:31:40
  6.  *
  7.  *    Make>> make
  8.  */
  9.  
  10. #include "ParMBase.h"
  11.  
  12. extern struct ExecBase *SysBase;
  13.  
  14. struct ParMBase *ParMBase;
  15. struct ArpBase *ArpBase;
  16. struct ReqLib *ReqBase;
  17. struct IconBase *IconBase;
  18. struct IntuitionBase *IntuitionBase;
  19. struct LayersBase *LayersBase;
  20. struct GfxBase *GfxBase;
  21. struct WBStartup *WBenchMsg;
  22. int _argc;
  23. char **_argv;
  24. struct GetLongStruct GLS = {NULL, 0, 0, 0, 0, NULL, REQVERSION - 1, 0, 0};
  25. char ReqTitle[] = "SetMouse";
  26. char HelpUsage[] = "SetMouse V1.1 © 1991 by S.R. & P.C.\n";
  27. char Template[] = "Nothing";
  28.  
  29. long DosWrite(BPTR file, char *buffer, long length);
  30.  
  31. #pragma amicall(DOSBase, 0x30, DosWrite(d1,d2,d3))
  32.  
  33. static struct IntuiText IText10 =
  34. {
  35.     1, 1, JAM1,        /* front and back text pens, drawmode and fill byte */
  36.     2, 1,            /* XY origin relative to container TopLeft */
  37.     NULL,            /* font pointer or NULL for default */
  38.     (UBYTE *) "SaveOpt",    /* pointer to text */
  39.     NULL            /* next IntuiText structure */
  40. };
  41.  
  42. static struct MenuItem MenuItem10 =
  43. {
  44.     NULL,            /* next MenuItem structure */
  45.     0, 56,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  46.     123, 8,            /* hit box width and height */
  47.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  48.     0,            /* each bit mutually-excludes a same-level Item */
  49.     (APTR) & IText10,    /* Item render  (IntuiText or Image or NULL) */
  50.     NULL,            /* Select render */
  51.     NULL,            /* alternate command-key */
  52.     NULL,            /* SubItem list */
  53.     MENUNULL        /* filled in by Intuition for drag selections */
  54. };
  55.  
  56. static struct IntuiText IText9 =
  57. {
  58.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  59.     2, 1,            /* XY origin relative to container TopLeft */
  60.     NULL,            /* font pointer or NULL for default */
  61.     (UBYTE *) "Handler Pri",/* pointer to text */
  62.     NULL            /* next IntuiText structure */
  63. };
  64.  
  65. static struct MenuItem MenuItem9 =
  66. {
  67.     &MenuItem10,        /* next MenuItem structure */
  68.     0, 48,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  69.     123, 8,            /* hit box width and height */
  70.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  71.     0,            /* each bit mutually-excludes a same-level Item */
  72.     (APTR) & IText9,    /* Item render  (IntuiText or Image or NULL) */
  73.     NULL,            /* Select render */
  74.     NULL,            /* alternate command-key */
  75.     NULL,            /* SubItem list */
  76.     MENUNULL        /* filled in by Intuition for drag selections */
  77. };
  78.  
  79. static struct IntuiText IText8 =
  80. {
  81.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  82.     2, 1,            /* XY origin relative to container TopLeft */
  83.     NULL,            /* font pointer or NULL for default */
  84.     (UBYTE *) "ScreenBlank",    /* pointer to text */
  85.     NULL            /* next IntuiText structure */
  86. };
  87.  
  88. static struct MenuItem MenuItem8 =
  89. {
  90.     &MenuItem9,        /* next MenuItem structure */
  91.     0, 40,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  92.     123, 8,            /* hit box width and height */
  93.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  94.     0,            /* each bit mutually-excludes a same-level Item */
  95.     (APTR) & IText8,    /* Item render  (IntuiText or Image or NULL) */
  96.     NULL,            /* Select render */
  97.     NULL,            /* alternate command-key */
  98.     NULL,            /* SubItem list */
  99.     MENUNULL        /* filled in by Intuition for drag selections */
  100. };
  101.  
  102. static struct IntuiText IText7 =
  103. {
  104.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  105.     2, 1,            /* XY origin relative to container TopLeft */
  106.     NULL,            /* font pointer or NULL for default */
  107.     (UBYTE *) "MouseBlank",/* pointer to text */
  108.     NULL            /* next IntuiText structure */
  109. };
  110.  
  111. static struct MenuItem MenuItem7 =
  112. {
  113.     &MenuItem8,        /* next MenuItem structure */
  114.     0, 32,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  115.     123, 8,            /* hit box width and height */
  116.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  117.     0,            /* each bit mutually-excludes a same-level Item */
  118.     (APTR) & IText7,    /* Item render  (IntuiText or Image or NULL) */
  119.     NULL,            /* Select render */
  120.     NULL,            /* alternate command-key */
  121.     NULL,            /* SubItem list */
  122.     MENUNULL        /* filled in by Intuition for drag selections */
  123. };
  124.  
  125. static struct IntuiText IText6 =
  126. {
  127.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  128.     2, 1,            /* XY origin relative to container TopLeft */
  129.     NULL,            /* font pointer or NULL for default */
  130.     (UBYTE *) "Threshold",/* pointer to text */
  131.     NULL            /* next IntuiText structure */
  132. };
  133.  
  134. static struct MenuItem MenuItem6 =
  135. {
  136.     &MenuItem7,        /* next MenuItem structure */
  137.     0, 32,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  138.     123, 8,            /* hit box width and height */
  139.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  140.     0,            /* each bit mutually-excludes a same-level Item */
  141.     (APTR) & IText6,    /* Item render  (IntuiText or Image or NULL) */
  142.     NULL,            /* Select render */
  143.     NULL,            /* alternate command-key */
  144.     NULL,            /* SubItem list */
  145.     MENUNULL        /* filled in by Intuition for drag selections */
  146. };
  147.  
  148. static struct IntuiText IText5 =
  149. {
  150.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  151.     2, 1,            /* XY origin relative to container TopLeft */
  152.     NULL,            /* font pointer or NULL for default */
  153.     (UBYTE *) "Acceleration",/* pointer to text */
  154.     NULL            /* next IntuiText structure */
  155. };
  156.  
  157. static struct MenuItem MenuItem5 =
  158. {
  159.     &MenuItem6,        /* next MenuItem structure */
  160.     0, 32,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  161.     123, 8,            /* hit box width and height */
  162.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  163.     0,            /* each bit mutually-excludes a same-level Item */
  164.     (APTR) & IText5,    /* Item render  (IntuiText or Image or NULL) */
  165.     NULL,            /* Select render */
  166.     NULL,            /* alternate command-key */
  167.     NULL,            /* SubItem list */
  168.     MENUNULL        /* filled in by Intuition for drag selections */
  169. };
  170.  
  171. static struct IntuiText IText4 =
  172. {
  173.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  174.     19, 1,            /* XY origin relative to container TopLeft */
  175.     NULL,            /* font pointer or NULL for default */
  176.     (UBYTE *) "SunMouse",    /* pointer to text */
  177.     NULL            /* next IntuiText structure */
  178. };
  179.  
  180. static struct MenuItem MenuItem4 =
  181. {
  182.     &MenuItem5,        /* next MenuItem structure */
  183.     0, 24,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  184.     123, 8,            /* hit box width and height */
  185.     CHECKIT + ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  186.     0,            /* each bit mutually-excludes a same-level Item */
  187.     (APTR) & IText4,    /* Item render  (IntuiText or Image or NULL) */
  188.     NULL,            /* Select render */
  189.     NULL,            /* alternate command-key */
  190.     NULL,            /* SubItem list */
  191.     MENUNULL        /* filled in by Intuition for drag selections */
  192. };
  193.  
  194. static struct IntuiText IText3 =
  195. {
  196.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  197.     19, 1,            /* XY origin relative to container TopLeft */
  198.     NULL,            /* font pointer or NULL for default */
  199.     (UBYTE *) "ScreenToBack",    /* pointer to text */
  200.     NULL            /* next IntuiText structure */
  201. };
  202.  
  203. static struct MenuItem MenuItem3 =
  204. {
  205.     &MenuItem4,        /* next MenuItem structure */
  206.     0, 16,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  207.     123, 8,            /* hit box width and height */
  208.     CHECKIT + ITEMTEXT + MENUTOGGLE + ITEMENABLED + HIGHCOMP,    /* Item flags */
  209.     0,            /* each bit mutually-excludes a same-level Item */
  210.     (APTR) & IText3,    /* Item render  (IntuiText or Image or NULL) */
  211.     NULL,            /* Select render */
  212.     NULL,            /* alternate command-key */
  213.     NULL,            /* SubItem list */
  214.     MENUNULL        /* filled in by Intuition for drag selections */
  215. };
  216.  
  217. static struct IntuiText IText2 =
  218. {
  219.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  220.     19, 1,            /* XY origin relative to container TopLeft */
  221.     NULL,            /* font pointer or NULL for default */
  222.     (UBYTE *) "WindowToBack",    /* pointer to text */
  223.     NULL            /* next IntuiText structure */
  224. };
  225.  
  226. static struct MenuItem MenuItem2 =
  227. {
  228.     &MenuItem3,        /* next MenuItem structure */
  229.     0, 8,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  230.     123, 8,            /* hit box width and height */
  231.     CHECKIT + ITEMTEXT + MENUTOGGLE + ITEMENABLED + HIGHCOMP,    /* Item flags */
  232.     0,            /* each bit mutually-excludes a same-level Item */
  233.     (APTR) & IText2,    /* Item render  (IntuiText or Image or NULL) */
  234.     NULL,            /* Select render */
  235.     NULL,            /* alternate command-key */
  236.     NULL,            /* SubItem list */
  237.     MENUNULL        /* filled in by Intuition for drag selections */
  238. };
  239.  
  240. static struct IntuiText IText1 =
  241. {
  242.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  243.     19, 1,            /* XY origin relative to container TopLeft */
  244.     NULL,            /* font pointer or NULL for default */
  245.     (UBYTE *) "WindowToFront",    /* pointer to text */
  246.     NULL            /* next IntuiText structure */
  247. };
  248.  
  249. static struct MenuItem MenuItem1 =
  250. {
  251.     &MenuItem2,        /* next MenuItem structure */
  252.     0, 0,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  253.     123, 8,            /* hit box width and height */
  254.     CHECKIT + ITEMTEXT + MENUTOGGLE + ITEMENABLED + HIGHCOMP,    /* Item flags */
  255.     0,            /* each bit mutually-excludes a same-level Item */
  256.     (APTR) & IText1,    /* Item render  (IntuiText or Image or NULL) */
  257.     NULL,            /* Select render */
  258.     NULL,            /* alternate command-key */
  259.     NULL,            /* SubItem list */
  260.     MENUNULL        /* filled in by Intuition for drag selections */
  261. };
  262.  
  263. static struct IntuiText IText01 =
  264. {
  265.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  266.     2, 1,            /* XY origin relative to container TopLeft */
  267.     NULL,            /* font pointer or NULL for default */
  268.     (UBYTE *) "WinToFront Qual",    /* pointer to text */
  269.     NULL            /* next IntuiText structure */
  270. };
  271.  
  272. static struct MenuItem MenuItem01 =
  273. {
  274.     &MenuItem1,        /* next MenuItem structure */
  275.     0, 24,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  276.     123, 8,            /* hit box width and height */
  277.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  278.     0,            /* each bit mutually-excludes a same-level Item */
  279.     (APTR) & IText01,    /* Item render  (IntuiText or Image or NULL) */
  280.     NULL,            /* Select render */
  281.     NULL,            /* alternate command-key */
  282.     NULL,            /* SubItem list */
  283.     MENUNULL        /* filled in by Intuition for drag selections */
  284. };
  285.  
  286. static struct Menu Menu2 =
  287. {
  288.     NULL,            /* next Menu structure */
  289.     54, 0,            /* XY origin of Menu hit box relative to screen TopLeft */
  290.     71, 0,            /* Menu hit box width and height */
  291.     MENUENABLED,        /* Menu flags */
  292.     "SetMouse",        /* text of Menu name */
  293.     &MenuItem01        /* MenuItem linked list pointer */
  294. };
  295.  
  296. static struct IntuiText ITextQ =
  297. {
  298.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  299.     2, 1,            /* XY origin relative to container TopLeft */
  300.     NULL,            /* font pointer or NULL for default */
  301.     (UBYTE *) "Quit",    /* pointer to text */
  302.     NULL            /* next IntuiText structure */
  303. };
  304.  
  305. static struct MenuItem MenuItemQ =
  306. {
  307.     NULL,            /* next MenuItem structure */
  308.     0, 0,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  309.     64, 8,            /* hit box width and height */
  310.     ITEMTEXT+ITEMENABLED+HIGHCOMP+COMMSEQ,    /* Item flags */
  311.     0,            /* each bit mutually-excludes a same-level Item */
  312.     (APTR) & ITextQ,    /* Item render  (IntuiText or Image or NULL) */
  313.     NULL,            /* Select render */
  314.     'Q',            /* alternate command-key */
  315.     NULL,            /* SubItem list */
  316.     MENUNULL        /* filled in by Intuition for drag selections */
  317. };
  318.  
  319. static struct IntuiText IText0 =
  320. {
  321.     3, 1, COMPLEMENT,    /* front and back text pens, drawmode and fill byte */
  322.     2, 1,            /* XY origin relative to container TopLeft */
  323.     NULL,            /* font pointer or NULL for default */
  324.     (UBYTE *) "About...",    /* pointer to text */
  325.     NULL            /* next IntuiText structure */
  326. };
  327.  
  328. static struct MenuItem MenuItem0 =
  329. {
  330.     &MenuItemQ,            /* next MenuItem structure */
  331.     0, 0,            /* XY of Item hitbox relative to TopLeft of parent hitbox */
  332.     64, 8,            /* hit box width and height */
  333.     ITEMTEXT + ITEMENABLED + HIGHCOMP,    /* Item flags */
  334.     0,            /* each bit mutually-excludes a same-level Item */
  335.     (APTR) & IText0,    /* Item render  (IntuiText or Image or NULL) */
  336.     NULL,            /* Select render */
  337.     NULL,            /* alternate command-key */
  338.     NULL,            /* SubItem list */
  339.     MENUNULL        /* filled in by Intuition for drag selections */
  340. };
  341.  
  342. static struct Menu Menu1 =
  343. {
  344.     &Menu2,            /* next Menu structure */
  345.     0, 0,            /* XY origin of Menu hit box relative to screen TopLeft */
  346.     47, 0,            /* Menu hit box width and height */
  347.     MENUENABLED,        /* Menu flags */
  348.     "About",        /* text of Menu name */
  349.     &MenuItem0        /* MenuItem linked list pointer */
  350. };
  351.  
  352.  
  353. static struct NewWindow NWS = {
  354.     0, 0,        /* window XY origin relative to TopLeft of screen */
  355.     191, 10,        /* window width and height */
  356.     1, 0,            /* detail and block pens */
  357.     MENUPICK | CLOSEWINDOW,    /* IDCMP flags */
  358.     WINDOWDRAG + WINDOWDEPTH + WINDOWCLOSE + ACTIVATE + NOCAREREFRESH,    /* other window flags */
  359.     NULL,            /* first gadget in gadget list */
  360.     NULL,            /* custom CHECKMARK imagery */
  361.     (UBYTE *) "SetMouse V1.1",    /* window title */
  362.     NULL,            /* custom screen pointer */
  363.     NULL,            /* custom bitmap */
  364.     5, 5,            /* minimum width and height */
  365.     -1, -1,            /* maximum width and height */
  366.     WBENCHSCREEN        /* destination screen type */
  367. };
  368.  
  369.  
  370. int main(int argc, char **argv);
  371.  
  372. void exit(int code)
  373. {
  374.     if (WBenchMsg) {
  375.         Forbid();
  376.         ReplyMsg((struct Message *) WBenchMsg);
  377.     }
  378.     CloseLibrary(ParMBase);
  379.     Exit(code);
  380. }
  381.  
  382. void _main(long alen, char *aptr)
  383. {
  384.     struct Library *DOSBase;
  385.     struct Process *pp;
  386.  
  387.     pp = (struct Process *) SysBase->ThisTask;
  388.     if (!pp->pr_CLI) {
  389.         WaitPort(&pp->pr_MsgPort);
  390.         WBenchMsg = (struct WBStartup *) GetMsg(&pp->pr_MsgPort);
  391.     }
  392.     if (!(ParMBase = (struct ParMBase *) OpenLibrary("parm.library", 4L))) {
  393.         if (pp->pr_CLI && (DOSBase = OpenLibrary("dos.library", 0L))) {
  394.             DosWrite(pp->pr_COS, "You need parm.library V4+\n", 26L);
  395.             CloseLibrary(DOSBase);
  396.         }
  397.         if (WBenchMsg) {
  398.             Forbid();
  399.             ReplyMsg((struct Message *) WBenchMsg);
  400.         }
  401.         return;
  402.     }
  403.     ArpBase = ParMBase->ArpBase;
  404.     ReqBase = ParMBase->ReqBase;
  405.     IconBase = ParMBase->IconBase;
  406.     LayersBase = ParMBase->LayersBase;
  407.     IntuitionBase = (struct IntuitionBase *) ArpBase->IntuiBase;
  408.     GfxBase = (struct GfxBase *) ArpBase->GfxBase;
  409.  
  410.     if (WBenchMsg) {
  411.         CurrentDir(WBenchMsg->sm_ArgList->wa_Lock);
  412.         _argv = (char **) WBenchMsg;
  413.     }
  414.     else {
  415.         /*
  416.          *    WARNING: With that function, argv[] array will not start with the program
  417.          *    name but with it's first argument. If there's no args, argc will be zero.
  418.          */
  419.         _argv = ArpAlloc(sizeof(APTR) * 18);
  420.         _argc = (int) GADS(aptr, alen, HelpUsage, _argv, Template);
  421.         if (_argc < 0) {
  422.             Puts(_argv[0]);
  423.             exit(20);
  424.         }
  425.     }
  426.     exit(main(_argc, _argv));
  427. }
  428.  
  429.  
  430. void SaveMouseOpt(struct MouseOpt *MouseOpt)
  431. {
  432.     BPTR fh;
  433.  
  434.     if (fh = Open(DEFAULT_MOUSEOPT_FILE, MODE_NEWFILE)) {
  435.         Write(fh, (char *) MouseOpt, sizeof(struct MouseOpt));
  436.         Close(fh);
  437.     }
  438.     else
  439.         SimpleRequest(ReqTitle, "Couldn't save configuration.");
  440. }
  441.  
  442.  
  443. BOOL GetNumber(char *Title, long DefaultVal, long Min, long Max)
  444. {
  445.     GLS.titlebar = Title;
  446.     GLS.defaultval = DefaultVal;
  447.     GLS.minlimit = Min;
  448.     GLS.maxlimit = Max;
  449.     return GetLong(&GLS);
  450. }
  451.  
  452.  
  453. int main(int argc, char **argv)
  454. {
  455.     struct Window *Window;
  456.     struct IntuiMessage *IMsg;
  457.     struct MouseOpt MouseOpt;
  458.     /* allocate some stack space to prevent crashes if incompatible version
  459.      * of setmouse with current library */
  460.     char DummyBuffer[40];
  461.     struct TextAttr ScreenTextAttr;
  462.     BOOL DoNextSelect, Quit = FALSE;
  463.     ULONG Class;
  464.     USHORT Code;
  465.  
  466.     GetCurrentMouseOpt(&MouseOpt);
  467.     if (MouseOpt.Version != MOUSEOPT_VERSION) {
  468.         SimpleRequest(ReqTitle, "Invalid Mouse Opts version.");
  469.         return 20;
  470.     }
  471.     NWS.Height = OpenWorkBench()->BarHeight + (IntuitionBase->LibNode.lib_Version >= 36);
  472. /*    Center(&NWS, 0, 0); */
  473.     if (Window = OpenWindow(&NWS)) {
  474.         AskFont(&Window->WScreen->RastPort, &ScreenTextAttr);
  475.         NewCleanUp(&Menu1, &ScreenTextAttr, 0);
  476.         SetMenuStrip(Window, &Menu1);
  477.  
  478.         /* Set the CheckMark acording current MouseOpt */
  479.         if (MouseOpt.NClick)
  480.             MenuItem1.Flags |= CHECKED;
  481.         if (MouseOpt.Flags & MO_WINDOWTOBACK)
  482.             MenuItem2.Flags |= CHECKED;
  483.         if (MouseOpt.Flags & MO_SCREENTOBACK)
  484.             MenuItem3.Flags |= CHECKED;
  485.         if (MouseOpt.SunMouse >= 0)
  486.             MenuItem4.Flags |= CHECKED;
  487.  
  488.         while (!Quit) {
  489.             WaitPort(Window->UserPort);
  490.             while (IMsg = (struct IntuiMessage *)GetMsg(Window->UserPort)) {
  491.                 Class = IMsg->Class;
  492.                 Code = IMsg->Code;
  493.                 ReplyMsg((struct Message *)IMsg);
  494.                 switch (Class) {
  495.                 case CLOSEWINDOW:
  496.                     Quit = TRUE;
  497.                     break;
  498.                 case MENUPICK:
  499.                     DoNextSelect = TRUE;
  500.                     if (Code != MENUNULL) {
  501.                         do {
  502.                             switch (MENUNUM(Code)) {
  503.                             case 0:
  504.                                 if (ITEMNUM(Code) == 0)
  505.                                     SimpleRequest(ReqTitle, "ParM and BrowserII are\nCopyRight S.R. & P.C.\nand     ShareWare\nIf you use them, please send $20US to:\nSylvain Rougier\n39 rue carnot\n86000 Poitiers\nFrance.");
  506.                                 else {
  507.                                     Quit = TRUE;
  508.                                     DoNextSelect = FALSE;
  509.                                 }
  510.                                 break;
  511.                             case 1:
  512.                                 switch (ITEMNUM(Code)) {
  513.                                 case 0:    /* Win To Front Qualifier */
  514.                                     if (GetNumber("WToFront Qualifier", (long)(MouseOpt.WTFQual & ~(IEQUALIFIER_LEFTBUTTON|IEQUALIFIER_RELATIVEMOUSE)), 0, 32767))
  515.                                          MouseOpt.WTFQual = (USHORT)GLS.result | (IEQUALIFIER_LEFTBUTTON|IEQUALIFIER_RELATIVEMOUSE);
  516.                                 case 1:    /* WindowToFront */
  517.                                     MouseOpt.NClick = (MenuItem1.Flags & CHECKED) ? 2 : 0;
  518.                                     break;
  519.                                 case 2:    /* WindowToBack() */
  520.                                     if (MenuItem2.Flags & CHECKED)
  521.                                         MouseOpt.Flags |= MO_WINDOWTOBACK;
  522.                                     else
  523.                                         MouseOpt.Flags &= ~MO_WINDOWTOBACK;
  524.                                     break;
  525.                                 case 3:    /* ScreenToBack */
  526.                                     if (MenuItem3.Flags & CHECKED)
  527.                                         MouseOpt.Flags |= MO_SCREENTOBACK;
  528.                                     else
  529.                                         MouseOpt.Flags &= ~MO_SCREENTOBACK;
  530.                                     break;
  531.                                 case 4:    /* SunMouse */
  532.                                     if (GetNumber("Sun: -1 Disable", MouseOpt.SunMouse, -1, 100))
  533.                                         MouseOpt.SunMouse = (USHORT)GLS.result;
  534.                                     if (MouseOpt.SunMouse >= 0)
  535.                                         MenuItem4.Flags |= CHECKED;
  536.                                     else
  537.                                         MenuItem4.Flags &= ~CHECKED;
  538.                                     break;
  539.                                 case 5:    /* acclerator */
  540.                                     if (GetNumber("Accel: 0 disable.", MouseOpt.Acc, 0, 10))
  541.                                          MouseOpt.Acc = (USHORT)GLS.result;
  542.                                     break;
  543.                                 case 6:    /* Threshold */
  544.                                     if (GetNumber("Threshold", MouseOpt.Threshold, 1, 10))
  545.                                         MouseOpt.Threshold = (USHORT)GLS.result;
  546.                                     break;
  547.                                 case 7:    /* MouseBlank */
  548.                                     if (GetNumber("Delay in sec", MouseOpt.MouseBlank, 0, 65535))
  549.                                         MouseOpt.MouseBlank = (USHORT)GLS.result;
  550.                                     break;
  551.                                 case 8:    /* ScreenBlank */
  552.                                     if (GetNumber("Delay in sec", MouseOpt.ScreenBlank, 0, 65535))
  553.                                         MouseOpt.ScreenBlank = (USHORT)GLS.result;
  554.                                     break;
  555.                                 case 9:    /* HandlerPri */
  556.                                     if (GetNumber("HandlerPri, active next reset", MouseOpt.HandlerPri, 51, 127))
  557.                                         MouseOpt.HandlerPri = (USHORT)GLS.result;
  558.                                     break;
  559.                                 case 10:    /* SaveOpt */
  560.                                     SaveMouseOpt(&MouseOpt);
  561.                                     break;
  562.                                 }
  563.                                 break;
  564.                             }
  565.                         } while (DoNextSelect && (Code = ItemAddress(&Menu1, Code)->NextSelect) != MENUNULL);
  566.                     }
  567.                     break;
  568.                 }
  569.             }
  570.             UpdateMouseOpt(&MouseOpt);
  571.         }
  572.         CloseWindowSafely(Window, NULL);
  573.     }
  574.     return 0;
  575. }
  576.  
  577.  
  578.