home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xmeasure / help.c < prev    next >
Text File  |  1998-10-28  |  16KB  |  457 lines

  1. /*
  2.                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\
  3.                 %% \___________________________________%% \
  4.                 %% |                                   %%  \
  5.                 %% |              Measure              %%   \
  6.                 %% |          Help.c    c1995          %%    \
  7.                 %% |            Lyle W. West           %%    |
  8.                 %% |                                   %%    |
  9.                 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%    |
  10.                 \                                        \   |
  11.                  \                                        \  |
  12.                   \                                        \ |
  13.                    \________________________________________\|
  14.  
  15.  
  16.  
  17.      Copyright (C) 1995 Lyle W. West, All Rights Reserved.
  18.      Permission is granted to copy and use this program so long as [1] this
  19.      copyright notice is preserved, and [2] no financial gain is involved
  20.      in copying the program.  This program may not be sold as "shareware"
  21.      or "public domain" software without the express, written permission
  22.      of the author.
  23. */
  24.  
  25. #include "includes.h"
  26. #include "externs.h"
  27.  
  28.  
  29.  
  30.  
  31. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  32.  *    CreateOvHelp         create Overview help window
  33.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  34. Widget CreateOvHelp(Widget parent)  /*  parent widget    */
  35. {
  36.     Widget button;
  37.     Widget message_box;        /*  Message Dialog     */
  38.  
  39.     static char message[BUFSIZ];/*  help text    */
  40.     XmString genstr_string = NULL;
  41.     XmString message_string = NULL;
  42.     XmString button_string = NULL;
  43.  
  44.  
  45.  
  46.  /*
  47.   *    Generate message to display.
  48.   */
  49.     sprintf(message, "Xmeasure is a tool which provides X-Y cursor \n\
  50. location information (in pixel units) for the \n\
  51. Root Window OR a user selected window in both \n\
  52. Simple X-Y and Delta X-Y modes. Mode selection \n\
  53. is via the Option Menu located at the bottom \n\
  54. edge of the tool. \n");
  55.  
  56.     message_string = XmStringCreateLtoR(message, charset);
  57.     button_string = XmStringCreateLtoR("Close", charset);
  58.     genstr_string = XmStringCreateLtoR("XMeasure - Overview", charset);
  59.  
  60.  
  61.  /*
  62.   *    Create message box dialog.
  63.   */
  64.     n = 0;
  65.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  66.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  67.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  68.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  69.     message_box = XmCreateMessageDialog(parent, "helpbox", args, n);
  70.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  71.     XtUnmanageChild(button);
  72.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  73.     XtUnmanageChild(button);
  74.  
  75.  /*
  76.   *    Free strings and return message box.
  77.   */
  78.     if (genstr_string) XtFree(genstr_string);
  79.     if (message_string) XtFree(message_string);
  80.     if (button_string) XtFree(button_string);
  81.     XmStringFree(message_string);
  82.     XmStringFree(button_string);
  83.     XmStringFree(genstr_string);
  84.     return (message_box);
  85. }
  86.  
  87.  
  88. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  89.  *    CreateRootHelp        - create Root help window
  90.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  91. Widget CreateRootHelp(Widget parent)
  92. {
  93.     Widget button;
  94.     Widget message_box;        /*  Message Dialog     */
  95.  
  96.     static char message[BUFSIZ];/*  help text    */
  97.     XmString genstr_string = NULL;
  98.     XmString message_string = NULL;
  99.     XmString button_string = NULL;
  100.  
  101.  /*
  102.   *    Generate message to display.
  103.   */
  104.     sprintf(message, "The Root option in the Option Menu permits users to \n\
  105. obtain pixel unit information referencing the Root window. \n\
  106. At entry the cursor will change to the Xtoolkit Crosshair \n\
  107. pattern. The Xmeasure display will indicate the 'Root Window' \n\
  108. label, its ID, and the display Width/Height information. \n\
  109.    \n\
  110. Pressing MB1 and holding it down will provide continuous \n\
  111. X-Y coordinates relative to the Northwest gravity (0, 0).\n\
  112. MB2 locks the current X-Y cursor pixel coordinates when \n\
  113. released. MB3 exits measure mode.\n");
  114.  
  115.  
  116.     message_string = XmStringCreateLtoR(message, charset);
  117.     button_string = XmStringCreateLtoR("Close", charset);
  118.     genstr_string = XmStringCreateLtoR("XMeasure - Root X-Y", charset);
  119.  
  120.  
  121.  /*
  122.   *    Create message box dialog.
  123.   */
  124.     n = 0;
  125.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  126.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  127.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  128.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  129.     message_box = XmCreateMessageDialog(parent, "helpbox", args, n);
  130.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  131.     XtUnmanageChild(button);
  132.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  133.     XtUnmanageChild(button);
  134.  
  135.  /*
  136.   *    Free strings and return message box.
  137.   */
  138.     if (genstr_string) XtFree(genstr_string);
  139.     if (message_string) XtFree(message_string);
  140.     if (button_string) XtFree(button_string);
  141.     XmStringFree(message_string);
  142.     XmStringFree(button_string);
  143.     XmStringFree(genstr_string);
  144.     return (message_box);
  145. }
  146.  
  147.  
  148. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  149.  *    CreateSimpleHelp        - create SimpleXY help window
  150.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  151. Widget CreateSimpleHelp(Widget parent)
  152. {
  153.     Widget button;
  154.     Widget message_box;        /*  Message Dialog     */
  155.  
  156.     static char message[BUFSIZ];/*  help text    */
  157.     XmString genstr_string = NULL;
  158.     XmString message_string = NULL;
  159.     XmString button_string = NULL;
  160.  
  161.  /*
  162.   *    Generate message to display.
  163.   */
  164.     sprintf(message, "The Simple X-Y option is used to select a particular \n\
  165. window to perform pixel location measurements. Once \n\
  166. user selects the Simple X-Y button from the Option Menu, \n\
  167. the Cursor will change to a Fluer pattern, indicating \n\
  168. Xmeasure is ready for the user to select a target \n\
  169. area. Move the pointer into target area and Press MB1.\n\
  170.    \n\
  171. The cursor will then change to the Crosshair pattern.\n\
  172. The Xmeasure window will display the window title, the \n\
  173. window ID, and the Width/Height information. Pressing \n\n\
  174. MB1 and holding it down will provide continuous X-Y \n\
  175. pixel coordinates. MB2 locks the current X-Y coordinates \n\
  176. when released. Pressing MB3 exits the measure mode.\n");
  177.  
  178.  
  179.     message_string = XmStringCreateLtoR(message, charset);
  180.     button_string = XmStringCreateLtoR("Close", charset);
  181.     genstr_string = XmStringCreateLtoR("XMeasure - Simple X-Y", charset);
  182.  
  183.  
  184.  /*
  185.   *    Create message box dialog.
  186.   */
  187.     n = 0;
  188.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  189.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  190.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  191.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  192.     message_box = XmCreateMessageDialog(parent, "helpbox", args, n);
  193.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  194.     XtUnmanageChild(button);
  195.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  196.     XtUnmanageChild(button);
  197.  
  198.  /*
  199.   *    Free strings and return message box.
  200.   */
  201.     if (genstr_string) XtFree(genstr_string);
  202.     if (message_string) XtFree(message_string);
  203.     if (button_string) XtFree(button_string);
  204.     XmStringFree(message_string);
  205.     XmStringFree(button_string);
  206.     XmStringFree(genstr_string);
  207.     return (message_box);
  208. }
  209.  
  210.  
  211. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  212.  *    CreateDeltaHelp        - create DeltaXY help window
  213.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  214. Widget CreateDeltaHelp(Widget parent)
  215. {
  216.     Widget button;
  217.     Widget message_box;        /*  Message Dialog     */
  218.  
  219.     static char message[BUFSIZ];/*  help text    */
  220.     XmString genstr_string = NULL;
  221.     XmString message_string = NULL;
  222.     XmString button_string = NULL;
  223.  
  224.  /*
  225.   *    Generate message to display.
  226.   */
  227.     sprintf(message, "The Delta X-Y option is used to select a particular \n\
  228. window to perform delta pixel location measurements. \n\
  229. Once user selects Delta X-Y from the Option Menu, \n\
  230. the cursor will change to a Fluer pattern, indicating \n\
  231. Xmeasure is ready for the user to select a target \n\
  232. window. Move the pointer into the desired window and \n\
  233. press MB1. \n\
  234.     \n\
  235. The cursor then changes to the Crosshair pattern.\n\
  236. The Xmeasure window will display the window title, the \n\
  237. window ID, and the Width/Height information. Pressing \n\n\
  238. MB1 will initialize the Start location. Pressing MB2 \n\
  239. provides the X/Y difference from the Start point (Mark \n\
  240. point). Pressing MB3 will exit the measure mode.\n");
  241.  
  242.  
  243.     message_string = XmStringCreateLtoR(message, charset);
  244.     button_string = XmStringCreateLtoR("Close", charset);
  245.     genstr_string = XmStringCreateLtoR("XMeasure - Delta X-Y", charset);
  246.  
  247.  
  248.  /*
  249.   *    Create message box dialog.
  250.   */
  251.     n = 0;
  252.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  253.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  254.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  255.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  256.     message_box = XmCreateMessageDialog(parent, "helpbox", args, n);
  257.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  258.     XtUnmanageChild(button);
  259.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  260.     XtUnmanageChild(button);
  261.  
  262.  /*
  263.   *    Free strings and return message box.
  264.   */
  265.     if (genstr_string) XtFree(genstr_string);
  266.     if (message_string) XtFree(message_string);
  267.     if (button_string) XtFree(button_string);
  268.     return (message_box);
  269. }
  270.  
  271.  
  272. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  273.  *    CreateOptionsHelp        - create Options help window
  274.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  275. Widget CreateOptionsHelp(Widget parent)
  276. {
  277.     Widget button;
  278.     Widget message_box;        /*  Message Dialog     */
  279.  
  280.     static char message[BUFSIZ];/*  help text    */
  281.     XmString genstr_string = NULL;
  282.     XmString message_string = NULL;
  283.     XmString button_string = NULL;
  284.  
  285.  /*
  286.   *    Generate message to display.
  287.   */
  288.     sprintf(message, "The 'Options' MenuBar permits the user to select \n\
  289. the Menu Offset mode applicable to the target window   \n\
  290. and the MB1 set value for the Delta X-Y mode: \n\
  291.     \n\
  292.   Three offset modes are available: \n\
  293.        Motif35 - Sets the Y zero point 35 pixels down \n\
  294.                  from 0,0 to compensate for the MenuBar \n\
  295.        Motif40 - Sets the Y zero point 40 pixels down \n\
  296.                  from 0,0 (the additional 5 pixels are \n\
  297.                  added for  resource borderWidth = 1) \n\
  298.        None    - Zero point is at 0,0 of the selected window \n\
  299.     \n\
  300.   Relative mode provides X-Y values relative to the MB1 \n\
  301.     selection location (Delta Mode) when MB2 is released. \n\
  302.     Absolute mode displays the X-Y value relative to the\n\
  303.     selected window's 0,0 location when MB2 is released. \n");
  304.  
  305.     message_string = XmStringCreateLtoR(message, charset);
  306.     button_string = XmStringCreateLtoR("Close", charset);
  307.     genstr_string = XmStringCreateLtoR("XMeasure - Options Menu", charset);
  308.  
  309.  
  310.  /*
  311.   *    Create message box dialog.
  312.   */
  313.     n = 0;
  314.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  315.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  316.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  317.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  318.     message_box = XmCreateMessageDialog(parent, "helpbox", args, n);
  319.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  320.     XtUnmanageChild(button);
  321.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  322.     XtUnmanageChild(button);
  323.  
  324.  /*
  325.   *    Free strings and return message box.
  326.   */
  327.     if (genstr_string) XtFree(genstr_string);
  328.     if (message_string) XtFree(message_string);
  329.     if (button_string) XtFree(button_string);
  330.     XmStringFree(message_string);
  331.     XmStringFree(button_string);
  332.     XmStringFree(genstr_string);
  333.     return (message_box);
  334. }
  335.  
  336.  
  337.  
  338. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  339.  *  CreateVersion    - create version window
  340.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  341. Widget CreateVersion(Widget parent)     /*  parent widget  */
  342. {
  343.     Widget button;
  344.     Widget message_box;        /*  Message Dialog   */
  345.  
  346.     static char message[BUFSIZ];/*  help text  */
  347.     XmString genstr_string = NULL;
  348.     XmString message_string = NULL;
  349.     XmString button_string = NULL;
  350.     char verstext[50];
  351.     char authtext[30] = "    by Lyle W. West   ";
  352.  
  353.  
  354.     strcpy(verstext, &verstr);
  355.  /*  Generate message to display. */
  356.     sprintf(message, "%s\n%s", verstext, authtext);
  357.  
  358.  /* Create the compound strings */
  359.     message_string = XmStringCreateLtoR(message, charset);
  360.     button_string = XmStringCreateLtoR("Close", charset);
  361.     genstr_string = XmStringCreateLtoR("XMeasure - Version", charset);
  362.  
  363.  
  364.  /*  Create message box dialog. */
  365.     n = 0;
  366.     XtSetArg(args[n], XmNdialogTitle, genstr_string); n++;
  367.     XtSetArg(args[n], XmNokLabelString, button_string); n++;
  368.     XtSetArg(args[n], XmNmessageString, message_string); n++;
  369.     XtSetArg(args[n], XmNdialogStyle, XmDIALOG_FULL_APPLICATION_MODAL); n++;
  370.     message_box = XmCreateMessageDialog(parent, "versionbox", args, n);
  371.  
  372.     button = XmMessageBoxGetChild(message_box, XmDIALOG_CANCEL_BUTTON);
  373.     XtUnmanageChild(button);
  374.     button = XmMessageBoxGetChild(message_box, XmDIALOG_HELP_BUTTON);
  375.     XtUnmanageChild(button);
  376.  
  377.  
  378.  /*  Free strings and return message box. */
  379.     if (genstr_string) XtFree(genstr_string);
  380.     if (message_string) XtFree(message_string);
  381.     if (button_string) XtFree(button_string);
  382.     return (message_box);
  383. }
  384.  
  385.  
  386. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  387.  *  HelpOvCB    callback for Overview menu help 
  388.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  389. void HelpOvCB(Widget w, XtPointer client_data, XtPointer call_data)
  390. {
  391.     Widget message_box;
  392.  
  393.     message_box = CreateOvHelp(w);
  394.     XtManageChild(message_box);
  395. }
  396.  
  397.  
  398. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  399.  *  HelpRootCB   - callback for Root menu help 
  400.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  401. void HelpRootCB(Widget w, XtPointer client_data, XtPointer call_data)
  402. {
  403.     Widget message_box;
  404.  
  405.     message_box = CreateRootHelp(w);
  406.     XtManageChild(message_box);
  407. }
  408.  
  409.  
  410. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  411.  *  HelpSimpleCB   - callback for SimpleXY menu help 
  412.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  413. void HelpSimpleCB(Widget w, XtPointer client_data, XtPointer call_data)
  414. {
  415.     Widget message_box;
  416.  
  417.     message_box = CreateSimpleHelp(w);
  418.     XtManageChild(message_box);
  419. }
  420.  
  421.  
  422. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  423.  *  HelpDeltaCB   - callback for DeltaXY menu help 
  424.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  425. void HelpDeltaCB(Widget w, XtPointer client_data, XtPointer call_data)
  426. {
  427.     Widget message_box;
  428.  
  429.     message_box = CreateDeltaHelp(w);
  430.     XtManageChild(message_box);
  431. }
  432.  
  433. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  434.  *  HelpOffsetCB   - callback for Offset menu help 
  435.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  436. void HelpOffsetCB(Widget w, XtPointer client_data, XtPointer call_data)
  437. {
  438.     Widget message_box;
  439.  
  440.     message_box = CreateOptionsHelp(w);
  441.     XtManageChild(message_box);
  442. }
  443.  
  444.  
  445. /************************************************************
  446.  * VersionCB      - callback for Version help button
  447.  ************************************************************/
  448. void VersionCB(Widget w, XtPointer client_data, XtPointer call_data)
  449. {
  450.     Widget message_box;
  451.  
  452.     message_box = CreateVersion(w);
  453.     XtManageChild(message_box);
  454. }
  455.  
  456.