home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / toolbgpf.zip / TB.C < prev    next >
Text File  |  1995-01-01  |  68KB  |  1,637 lines

  1. /********     tb C Program Source Code File (.C)           ********/
  2. /*                                      */
  3. /* PROGRAM NAME: tb          Application (tb)                  */
  4. /* -------------                              */
  5. /* Generated by GPF (Gui Programming Facility) Version 2.1 Level(00)  */
  6. /*                                      */
  7. /* SUBSYSTEM:                                  */
  8. /* ----------                                  */
  9. /* Presentation Manager (32-Bit) - IBM C Set/2                  */
  10. /*                                      */
  11. /* DATABASE NAME: No DBM                          */
  12. /* -------------                              */
  13. /*                                      */
  14. /* DATE AND TIME: Sun Jan  1 14:11:35 1995                  */
  15. /* -------------                              */
  16. /*                                      */
  17. /* COPYRIGHT:                                  */
  18. /* ----------                                  */
  19. /*                                      */
  20. /*                                      */
  21. /* REVISION LEVEL: 1.0                              */
  22. /* ---------------                              */
  23. /*                                      */
  24. /* WHAT YOU NEED TO COMPILE THIS PROGRAM:                  */
  25. /* --------------------------------------                  */
  26. /*                                      */
  27. /*  REQUIRED FILES:                              */
  28. /*  ---------------                              */
  29. /*                                      */
  30. /*    tb.C          - Source code                      */
  31. /*    tb.Cmd          - Command file to build this program          */
  32. /*    tb.Mak          - Make file for this program              */
  33. /*    tb.Def          - Module definition file                  */
  34. /*    tb.Ext          - External definition file              */
  35. /*    tb.H          - Application header file               */
  36. /*    tb.Ids          - Pm header file                      */
  37. /*    tb.L          - Linker automatic response file              */
  38. /*    tb.Rc          - Resource file                      */
  39. /*                                      */
  40. /*    OS2.H          - Presentation Manager include file          */
  41. /*    STDLIB.H          - Miscellaneous function declarations          */
  42. /*    STDIO.H          - Declarations for standard I/O routines          */
  43. /*    STRING.H          - String function declarations              */
  44. /*    MALLOC.H          - Definitions for memory allocation functions   */
  45. /*    PROCESS.H       - Definitions for process control functions     */
  46. /*                                      */
  47. /*  REQUIRED LIBRARIES:                           */
  48. /*  -------------------                           */
  49. /*                                      */
  50. /*    OS2386.LIB      - Presentation  Manager/OS2 library          */
  51. /*                                      */
  52. /*  REQUIRED PROGRAMS:                              */
  53. /*  ------------------                              */
  54. /*                                      */
  55. /*    C Compiler (32-Bit)                          */
  56. /*    Linker (32-Bit)                              */
  57. /*    Resource Compiler (32-Bit)                      */
  58. /*                                      */
  59. /**********************************************************************/
  60.  
  61. /**********************************************************************/
  62. /*                                      */
  63. /* Include relevant sections of the DOS header file.              */
  64. /*                                      */
  65. /**********************************************************************/
  66.  
  67. /*====================================================================*/
  68. /*                                      */
  69. /*   #define:             To include:                  */
  70. /*                                      */
  71. /* + INCL_DOSPROCESS         Process and thread support           */
  72. /* + INCL_DOSFILEMGR         File Management                  */
  73. /* + INCL_DOSMEMMGR         Memory Management                  */
  74. /* + INCL_DOSSEMAPHORES      Semaphore support                  */
  75. /* + INCL_DOSDATETIME         Date/Time and Timer support          */
  76. /*   INCL_DOSMODULEMGR         Module manager                  */
  77. /* + INCL_DOSRESOURCES         Resource support                  */
  78. /*   INCL_DOSNLS         National Language Support              */
  79. /*   INCL_DOSSIGNALS         Signals                      */
  80. /*   INCL_DOSMISC         Miscellaneous                  */
  81. /*   INCL_DOSMONITORS         Monitors                      */
  82. /*   INCL_DOSQUEUES         Queues                      */
  83. /*   INCL_DOSSESMGR         Session Manager Support              */
  84. /*   INCL_DOSDEVICES         Device specific, ring 2 support          */
  85. /*   INCL_DOSNMPIPES         Named Pipes Support              */
  86. /*   INCL_DOSPROFILE         DosProfile API                  */
  87. /*   INCL_DOSMVDM         MVDM support                  */
  88. /*   INCL_DOSEXCEPTIONS      Exception Management Support          */
  89. /**********************************************************************/
  90.  
  91. /**********************************************************************/
  92. /*                                      */
  93. /* Include relevant sections of the PM header file.              */
  94. /*                                      */
  95. /**********************************************************************/
  96.  
  97. /*====================================================================*/
  98. /*                                      */
  99. /*   #define:             To include:                  */
  100. /*                                      */
  101. /* + INCL_WINWINDOWMGR         General window management              */
  102. /* + INCL_WINMESSAGEMGR      Message management               */
  103. /* + INCL_WININPUT         Mouse and keyboard input              */
  104. /* + INCL_WINDIALOGS         Dialog boxes                  */
  105. /* + INCL_WINSTATICS         Static controls                  */
  106. /* + INCL_WINBUTTONS         Button controls                  */
  107. /* + INCL_WINENTRYFIELDS     Entry Fields                  */
  108. /*   INCL_WINMLE         Multiple Line Entry Fields           */
  109. /* + INCL_WINLISTBOXES         List box controls                  */
  110. /* + INCL_WINMENUS         Menu controls                  */
  111. /* + INCL_WINSCROLLBARS      Scroll bar controls              */
  112. /* + INCL_WINFRAMEMGR         Frame manager                  */
  113. /*   INCL_WINFRAMECTLS         Frame controls (title bars & size border)*/
  114. /*   INCL_WINRECTANGLES      Rectangle routines               */
  115. /*   INCL_WINSYS         System values (and colors)           */
  116. /*   INCL_WINTIMER         Timer routines                  */
  117. /* + INCL_WINACCELERATORS    Keyboard accelerators              */
  118. /*   INCL_WINTRACKRECT         WinTrackRect() function              */
  119. /*   INCL_WINCLIPBOARD         Clipboard manager                  */
  120. /* + INCL_WINCURSORS         Text cursors                  */
  121. /* + INCL_WINPOINTERS         Mouse pointers                  */
  122. /*   INCL_WINHOOKS         Hook manager                  */
  123. /* + INCL_WINSWITCHLIST      Shell Switch List API              */
  124. /*   INCL_WINPROGRAMLIST     Shell Program List API              */
  125. /*   INCL_WINSHELLDATA         Shell Data (?)                  */
  126. /*   INCL_WINCOUNTRY         Country support                  */
  127. /*   INCL_WINATOM         Atom Manager                  */
  128. /*   INCL_WINCATCHTHROW      WinCatch/WinThrow support              */
  129. /*   INCL_WINERRORS         Error code definitions              */
  130. /*   INCL_NLS             DBCS window manager definition          */
  131. /* + INCL_WINHELP         Help Manager definitions              */
  132. /*   INCL_WINSEI         Set Error Info API               */
  133. /*   INCL_WINLOAD         Load/Delete Library/Procedure          */
  134. /*   INCL_WINTYPES         Definitions for Datatypes              */
  135. /*   INCL_WINSTDDLGS         OS/2 Standard Dialog definitions          */
  136. /*                                      */
  137. /* ===================================================================*/
  138. /*                                      */
  139. /* INCL_GPI           Include all of the GPI              */
  140. /* INCL_GPICONTROL       Basic PS control                  */
  141. /* INCL_GPICORRELATION       Picking, Boundary and Correlation          */
  142. /* INCL_GPISEGMENTS       Segment Control and Drawing              */
  143. /* INCL_GPISEGEDITING       Segment Editing via Elements           */
  144. /* INCL_GPITRANSFORMS       Transform and Transform Conversion          */
  145. /* INCL_GPIPATHS       Paths and Clipping with Paths          */
  146. /* INCL_GPILOGCOLORTABLE   Logical Color Tables               */
  147. /* INCL_GPIPRIMITIVES       Drawing Primitives and Primitive Attributes*/
  148. /* INCL_GPILCIDS       Phyical and Logical Fonts with Lcids       */
  149. /* INCL_GPIBITMAPS       Bitmaps and Pel Operations              */
  150. /* INCL_GPIREGIONS       Regions and Clipping with Regions          */
  151. /* INCL_GPIMETAFILES       Metafiles                      */
  152. /* INCL_GPIDEFAULTS       Default Primitive Attributes           */
  153. /* INCL_GPIERRORS       defined if INCL_ERRORS defined          */
  154. /*                                      */
  155. /**********************************************************************/
  156.  
  157. #define INCL_DOS        /*   Need DOS support              */
  158. #define INCL_DOSERRORS
  159. #define INCL_DOSEXCEPTIONS    /*   Exception Management Support     */
  160.  
  161. #define INCL_WINWINDOWMGR    /*   General window management          */
  162. #define INCL_WINMESSAGEMGR    /*   Message management           */
  163. #define INCL_WININPUT        /*   Mouse and keyboard input          */
  164. #define INCL_WINDIALOGS     /*   Dialog boxes              */
  165. #define INCL_WINSTATICS     /*   Static controls              */
  166. #define INCL_WINBUTTONS     /*   Button controls              */
  167. #define INCL_WINENTRYFIELDS    /*   Entry Fields              */
  168. #define INCL_WINMLE        /*   Multiple Line Entry Fields       */
  169. #define INCL_WINLISTBOXES    /*   List box controls              */
  170. #define INCL_WINMENUS        /*   Menu controls              */
  171. #define INCL_WINSCROLLBARS    /*   Scroll bar controls          */
  172. #define INCL_WINFRAMEMGR    /*   Frame manager              */
  173. #define INCL_WINRECTANGLES    /*   Rectangle routines           */
  174. #define INCL_WINSYS        /*   System values (and colors)       */
  175. #define INCL_WINACCELERATORS    /*   Keyboard accelerators          */
  176. #define INCL_WINCLIPBOARD    /*   Clipboard manager              */
  177. #define INCL_WINCURSORS     /*   Text cursors              */
  178. #define INCL_WINPOINTERS    /*   Mouse pointers              */
  179. #define INCL_WINSWITCHLIST    /*   Shell Switch List API          */
  180. #define INCL_WINPROGRAMLIST    /*   Shell Program List API          */
  181. #define INCL_WINSHELLDATA    /*   Shell Data (?)              */
  182. #define INCL_WINERRORS        /*   Error code definitions          */
  183. #define INCL_WINHELP        /*   Help Manager definitions          */
  184. #define INCL_WINTIMER        /*   Timer routines              */
  185. #define INCL_WINSTDDLGS     /*   OS/2 Standard Dialog definitions */
  186.  
  187. #define INCL_GPIPRIMITIVES    /*   Drawing Primitives and Attributes*/
  188. #define INCL_GPILCIDS        /*   Phyical and Logical Fonts Lcids  */
  189. #define INCL_GPIBITMAPS     /*   Bitmaps and Pel Operations       */
  190.  
  191. #include <os2.h>        /* Presentation Manager include file  */
  192.  
  193. /**********************************************************************/
  194. /*                                      */
  195. /* Include C library routine header files                  */
  196. /*                                      */
  197. /**********************************************************************/
  198.  
  199. #include <stdlib.h>     /* Miscellaneous function declarations       */
  200. #include <stdio.h>     /* Declarations for standard I/O routines    */
  201. #include <string.h>     /* String function declarations          */
  202. #include <malloc.h>     /* Definitions for memory allocation          */
  203. #include <process.h>     /* Definitions for process control functions */
  204.  
  205. /**********************************************************************/
  206. /*                                      */
  207. /*  Miscellaneous constants                          */
  208. /*                                      */
  209. /**********************************************************************/
  210.  
  211. #define EXTRAWORDS (4 * sizeof(PVOID))    /* Extra window words          */
  212. #define GPF_P2C_LEVEL 2         /* GpfP2C.lib Level          */
  213. #define COMMAND       0 /* Process commands received from the user    */
  214. #define EXTERN
  215. #define STACKSIZE 40960
  216.  
  217. /**********************************************************************/
  218. /*                                      */
  219. /* Miscellaneous constants Ids                          */
  220. /*                                      */
  221. /**********************************************************************/
  222.  
  223. #include "tb.Ids"
  224.  
  225. /**********************************************************************/
  226. /*                                      */
  227. /* Function prototypes for C functions                      */
  228. /*                                      */
  229. /**********************************************************************/
  230.  
  231. #include "tb.Ext"
  232.  
  233. /**********************************************************************/
  234. /*                                      */
  235. /* STATIC Function prototypes for private C functions              */
  236. /*                                      */
  237. /**********************************************************************/
  238.  
  239. static    VOID InitializeApplication( VOID );
  240. static    VOID EndApplication( VOID );
  241. static    VOID WmCreateMain( PGPFPARMS pGpfParms );
  242. static    VOID WmCmdOtherMain( PGPFPARMS pGpfParms );
  243. static    VOID ActionMAIN_PB_DEL( PGPFPARMS pGpfParms );
  244. static    VOID ActionMAIN_PB_ADD( PGPFPARMS pGpfParms );
  245. static    VOID ActionPullDownExit( PGPFPARMS pGpfParms );
  246. static    VOID ActionPullDownHelpIndex( PGPFPARMS pGpfParms );
  247. static    VOID ActionPullDownExtendedHelp( PGPFPARMS pGpfParms );
  248. static    VOID ActionPullDownHelpForHelp( PGPFPARMS pGpfParms );
  249. static    VOID ActionPullDownKeysHelp( PGPFPARMS pGpfParms );
  250. static    MRESULT ProcessMain( PGPFPARMS pGpfParms );
  251. static    VOID CommandMain( PGPFPARMS pGpfParms );
  252.  
  253. /**********************************************************************/
  254. /*                                      */
  255. /* Miscellaneous constants tb.H                       */
  256. /*                                      */
  257. /**********************************************************************/
  258.  
  259. #include "tb.H"
  260.  
  261.  
  262. /****************** Start of main procedure ***************************/
  263. /**********************************************************************/
  264. /*                                      */
  265. /*  FUNCTION: main                              */
  266. /*                                      */
  267. /*  This is a typical PM main function.                   */
  268. /*  It initializes PM, creates a message queue, loads some strings ,  */
  269. /*  registers some window classes, creates a main window, gets and    */
  270. /*  dispatches messages to its window procedure until the time to     */
  271. /*  quit, and then tidies up before terminating.              */
  272. /*                                      */
  273. /*  It sets the values of the following globals:-              */
  274. /*                                      */
  275. /*  habMainTask, hwndFrameMain, hwndMain                  */
  276. /*                                      */
  277. /**********************************************************************/
  278.  
  279. INT _CENTRY main( LONG argc, PCHAR *argv )
  280. {
  281.  QMSG      qmsg;               /* Message structure          */
  282.  PID      Pid;                  /* Process Id              */
  283.  TID      Tid;                  /* Thread Id              */
  284.  HELPINIT hinit;              /* Help init              */
  285.  HPOINTER hptrIcon;              /* Handle of the Icon          */
  286.  
  287.   Argc = argc;
  288.   Argv = argv;
  289.  
  290.   hmodtb      = (HMODULE)NULL;   /* hMod Inline              */
  291.   hwndHelp      = (HWND)0;         /* Help Hwnd              */
  292.   szTaskList      = (PCHAR)"tb";
  293.   EndOfAppl      = FALSE;         /* Switch Accept End Application */
  294.  
  295.   /********************************************************************/
  296.   /* Initialize PM and Create application msg queue              */
  297.   /********************************************************************/
  298.                       /* Initialize PM              */
  299.   habMainTask = WinInitialize( 0 );
  300.                       /* Create application msg queue */
  301.   hmqMainTask = WinCreateMsgQueue( habMainTask, 1024 );
  302.  
  303.   WinSetPointer( HWND_DESKTOP,
  304.          WinQuerySysPointer( HWND_DESKTOP, SPTR_WAIT,FALSE ) );
  305.  
  306.   /********************************************************************/
  307.   /* Query System preferences set by the user from the Control Panel  */
  308.   /********************************************************************/
  309.  
  310.   LogoTimer = PrfQueryProfileInt( HINI_PROFILE,
  311.            (PSZ)"PM_ControlPanel", (PSZ)"LogoDisplayTime", -1 );
  312.   PrfQueryProfileString( HINI_PROFILE, (PSZ)"PM_National", (PSZ)"sDecimal",
  313.                  (PSZ)".", sDecimal, sizeof(sDecimal) );
  314.   strncpy( Swctl.szSwtitle, szTaskList, sizeof(Swctl.szSwtitle)-1 );
  315.  
  316.   /********************************************************************/
  317.   /*   Initialize Application                          */
  318.   /********************************************************************/
  319.  
  320.   InitializeApplication();
  321.  
  322.   /********************************************************************/
  323.   /* Initialize the help manager initialization structure, create an  */
  324.   /* instance of the help manager, and associate that instance with   */
  325.   /* the frame.                               */
  326.   /********************************************************************/
  327.                  /* size of initialization structure  */
  328.   hinit.cb             = sizeof(hinit);
  329.                  /* store HM return code from init.   */
  330.   hinit.ulReturnCode         = (ULONG)NULL;
  331.                  /* no tutorial program           */
  332.   hinit.pszTutorialName      = (PSZ)NULL;
  333.                  /* indicates help table is defined   */
  334.                  /* in the RC file.              */
  335.   hinit.phtHelpTable         = (PHELPTABLE)(0xFFFF0000 |
  336.                    ID_TB);
  337.                   /* help table in Exe or a DLL       */
  338.   hinit.hmodHelpTableModule     = hmodtb;
  339.   hinit.hmodAccelActionBarModule = (HMODULE)NULL;
  340.   hinit.idAccelTable         = (USHORT)NULL;
  341.                   /* action bar is not tailored       */
  342.   hinit.idActionBar         = (USHORT)NULL;
  343.                   /* help window title              */
  344.   hinit.pszHelpWindowTitle     = (PSZ)szTaskList;
  345.                  /* help panels ID is not displayed   */
  346.   hinit.fShowPanelId         = CMIC_HIDE_PANEL_ID;
  347.                   /* library with help panels          */
  348.   hinit.pszHelpLibraryName     = (PSZ)"tb.Hlp";
  349.  
  350.   /********************************************************************/
  351.   /* Control Gpf Library Level                          */
  352.   /********************************************************************/
  353.   if (GpfP2CLevel() != GPF_P2C_LEVEL)
  354.      {
  355.       WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
  356.              (PSZ) "Gpf Verion Error",
  357.              (PSZ) "Invalid P2C Level",
  358.              1,
  359.              MB_OK | MB_APPLMODAL | MB_MOVEABLE );
  360.       WinDestroyMsgQueue( hmqMainTask );
  361.       WinTerminate( habMainTask );
  362.       DosExit( EXIT_PROCESS, 0 );
  363.      }
  364.   /********************************************************************/
  365.   /* Create Instance of IPF, pass Anchor Block handle and address of  */
  366.   /* of IPF initialization structure, and check  that creation was    */
  367.   /* successful.                              */
  368.   /********************************************************************/
  369.   hwndHelp = WinCreateHelpInstance( habMainTask, &hinit );
  370.   if (!hwndHelp)
  371.      {
  372.       WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
  373.              (PSZ) "Help Not Available",
  374.              (PSZ) "Help Creation Error",
  375.              1,
  376.              MB_OK | MB_APPLMODAL | MB_MOVEABLE );
  377.      }
  378.   else
  379.      {
  380.       if (hinit.ulReturnCode)
  381.      {
  382.       WinMessageBox( HWND_DESKTOP, HWND_DESKTOP,
  383.              (PSZ) "Help Terminated Due to Error",
  384.              (PSZ) "Help Creation Error",
  385.              1,
  386.              MB_OK | MB_APPLMODAL | MB_MOVEABLE );
  387.       WinDestroyHelpInstance( hwndHelp );
  388.       hwndHelp = (HWND)NULL;
  389.      }
  390.      }
  391.  
  392.   /********************************************************************/
  393.   /*   Create the window "Main".                      */
  394.   /********************************************************************/
  395.   CreateMain( (PVOID) NULL );
  396.  
  397.   /********************************************************************/
  398.   /* Make sure the window was created.                      */
  399.   /********************************************************************/
  400.   if ((!hwndFrameMain) || (!hwndMain))
  401.      {
  402.       WinDestroyMsgQueue( hmqMainTask );
  403.       WinTerminate( habMainTask );
  404.       DosExit( EXIT_PROCESS, 0 );
  405.      }
  406.  
  407.   hptrIcon = (HPOINTER) WinSendMsg( hwndFrameMain,
  408.                  WM_QUERYICON, (MPARAM)NULL, (MPARAM)NULL );
  409.   /********************************************************************/
  410.   /* Set the window title (Task List)                      */
  411.   /********************************************************************/
  412.   WinQueryWindowProcess( hwndFrameMain, &Pid, &Tid );
  413.   Swctl.hwnd = hwndFrameMain;
  414.   Swctl.hwndIcon = hptrIcon;
  415.   Swctl.hprog = (HPROGRAM)NULL;
  416.   Swctl.idProcess = Pid;
  417.   Swctl.idSession = (USHORT)NULL;
  418.   Swctl.uchVisibility = SWL_VISIBLE;
  419.   Swctl.fbJump = SWL_JUMPABLE;
  420.   strncpy( Swctl.szSwtitle, szTaskList, sizeof(Swctl.szSwtitle)-1 );
  421.   hSwitch = WinAddSwitchEntry( &Swctl );
  422.  
  423.   /********************************************************************/
  424.   /*   Show the window "Main".                          */
  425.   /********************************************************************/
  426.   ShowMain( (PVOID) NULL );            /* Show Main Window   */
  427.  
  428.   /********************************************************************/
  429.   /* Main message-processing loop - get and dispatch messages until   */
  430.   /* WM_QUIT received and Accepted (EndOfAppl = TRUE)              */
  431.   /********************************************************************/
  432.  
  433.   while(!EndOfAppl)
  434.        {
  435.     if (! WinGetMsg( habMainTask, &qmsg, (HWND)NULL, 0, 0 ) )
  436.         EndApplication();
  437.     else
  438.         WinDispatchMsg( habMainTask, &qmsg );
  439.        }
  440.  
  441.   /********************************************************************/
  442.   /* Tidy up and terminate                          */
  443.   /********************************************************************/
  444.  
  445.   WinDestroyWindow( hwndFrameMain );
  446.   if (hwndHelp != (HWND)NULL)
  447.       WinDestroyHelpInstance( hwndHelp );
  448.   WinDestroyMsgQueue( hmqMainTask );
  449.   WinTerminate( habMainTask );
  450.  
  451.   /********************************************************************/
  452.   /* Dos Exit                                  */
  453.   /********************************************************************/
  454.   DosExit( EXIT_PROCESS, 0 );
  455.   return(0);
  456. }
  457. /**********************************************************************/
  458. /* End of main procedure                          */
  459. /**********************************************************************/
  460. /**********************************************************************/
  461.  
  462.  
  463. /**********************************************************************/
  464. /**********************************************************************/
  465. /*                                      */
  466. /*  WinProc: GpfDefWindowProc                          */
  467. /*                                      */
  468. /*  Controls the "DefaultWindowProc" Area.                  */
  469. /*                                      */
  470. /*                                      */
  471. /**********************************************************************/
  472.  
  473. MRESULT EXPENTRY GpfDefWindowProc(
  474.               HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  475. {
  476.   LONG        Color;           /* Work BackGround Color          */
  477.   PGPFPARMS pGpfParms;           /* Far Pointer              */
  478.   SHORT     Short;           /* Work Short              */
  479.  
  480.   /********************************************************************/
  481.   /* Initialize Gpf Parameters                          */
  482.   /********************************************************************/
  483.   pGpfParms = (PGPFPARMS) WinQueryWindowULong( hwnd, QWL_USER );
  484.   if (!pGpfParms)
  485.       return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  486.  
  487.   switch(msg)
  488.   {
  489.  
  490.     /**************************************************************/
  491.     /* Things to do when the Window is first initalized          */
  492.     /**************************************************************/
  493.    case WM_INITDLG:
  494.     /**************************************************************/
  495.     /*  Save CreateUserParms                      */
  496.     /**************************************************************/
  497.     pGpfParms->pCrtParms = (PVOID)mp2;
  498.     /**************************************************************/
  499.     /*  Associate Help Instance                      */
  500.     /**************************************************************/
  501.     WinAssociateHelpInstance( hwndHelp, GpfGetHwndFrame( hwnd ) );
  502.     /**************************************************************/
  503.     /*  Save Default Button                       */
  504.     /**************************************************************/
  505.     pGpfParms->hwndDefaultBtn = GpfQueryDefaultButton( hwnd );
  506.     /**************************************************************/
  507.     /*  Set Default BackGroundColor                   */
  508.     /**************************************************************/
  509.     pGpfParms->BgColor = SYSCLR_WINDOW;
  510.     /**************************************************************/
  511.     /*  Query Presentation Parameters BackGroundColor          */
  512.     /**************************************************************/
  513.     if (WinQueryPresParam( hwnd, PP_BACKGROUNDCOLOR,
  514.                    (ULONG)NULL, (PULONG)NULL,
  515.                    4L, &Color, (USHORT)NULL ) )
  516.         pGpfParms->BgColor = Color;
  517.     /**************************************************************/
  518.     /*  Query Presentation Parameters BackGroundColor Index       */
  519.     /**************************************************************/
  520.     if (WinQueryPresParam( hwnd, (ULONG)NULL,
  521.                    PP_BACKGROUNDCOLORINDEX, (PULONG)NULL,
  522.                    4L, &Color, QPF_ID1COLORINDEX))
  523.        pGpfParms->BgColor = Color;
  524.     /**************************************************************/
  525.     /*  Set Default ForeGroundColor                   */
  526.     /**************************************************************/
  527.     pGpfParms->FgColor = SYSCLR_WINDOWTEXT;
  528.     /**************************************************************/
  529.     /*  Query Presentation Parameters ForeGroundColor          */
  530.     /**************************************************************/
  531.     if (WinQueryPresParam( hwnd, PP_FOREGROUNDCOLOR,
  532.                    (ULONG)NULL, (PULONG)NULL,
  533.                    4L, &Color, (USHORT)NULL ) )
  534.         pGpfParms->FgColor = Color;
  535.     /**************************************************************/
  536.     /*  Query Presentation Parameters ForeGroundColor Index       */
  537.     /**************************************************************/
  538.     if (WinQueryPresParam( hwnd, (ULONG)NULL,
  539.                    PP_FOREGROUNDCOLORINDEX, (PULONG)NULL,
  540.                4L, &Color, QPF_ID1COLORINDEX ) )
  541.        pGpfParms->FgColor = Color;
  542.     /**************************************************************/
  543.     /*  Return pGpfParms Mresult                      */
  544.     /**************************************************************/
  545.     return (pGpfParms->mresult);
  546.  
  547.     /**************************************************************/
  548.     /* The application has asked for the window to be destroyed.  */
  549.     /**************************************************************/
  550.    case WM_DESTROY:
  551.     GpfDestroyTemplate( hwnd );           /* Destroy Template    */
  552.     WinSetWindowULong( hwnd, QWL_USER, (ULONG)NULL );
  553.                  /* Extract selector from far pointer */
  554.     free( pGpfParms );               /* FreeMain (GpfParms) */
  555.     break;
  556.  
  557.     /**************************************************************/
  558.     /* Let frame control erase background for us              */
  559.     /**************************************************************/
  560.    case WM_ERASEBACKGROUND:
  561.             /* The client window is cleared to SYSCLR_WINDOW. */
  562.     return (MRESULT)(FALSE);       /*  No background windows. */
  563.  
  564.        /***************************************************************/
  565.        /* The window needs painting.                      */
  566.        /***************************************************************/
  567.    case WM_PAINT:
  568.     Short = pGpfParms->ShortMsgId;               /* Save    MsgId */
  569.     pGpfParms->ShortMsgId = -1;               /* Reset MsgId */
  570.     GpfSendMsgInformation( pGpfParms, Short );
  571.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  572.  
  573.     /**************************************************************/
  574.     /*  Resize & Reposition all the BASE windows.              */
  575.     /*  WM_SIZE message was generated when window was created.    */
  576.     /**************************************************************/
  577.    case WM_SIZE:
  578.     if (pGpfParms->Options & GPF_OP_ADJUSTSIZE)
  579.         GpfAdjustControlSize( hwnd, mp1, mp2 ); /* Adjust Size    */
  580.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  581.  
  582.     /**************************************************************/
  583.     /* Receive Char ( Set Tabulation )                  */
  584.     /**************************************************************/
  585.    case WM_CHAR:
  586.     pGpfParms->mresult = GpfSetTabulation( hwnd, msg, mp1, mp2 );
  587.     Short = WinQueryWindowUShort( WinQueryFocus( HWND_DESKTOP ),
  588.                       QWS_ID );
  589.     if (!pGpfParms->mresult)
  590.        {
  591.         if (pGpfParms->pGpfPage)
  592.         WinSendMsg(pGpfParms->pGpfPage->hwndNoteBook,
  593.                msg, mp1, mp2 );
  594.        }
  595.     GpfSendMsgInformation( pGpfParms, Short );
  596.     return (pGpfParms->mresult);
  597.  
  598.     /**************************************************************/
  599.     /* Process MouseMove for Information Msg              */
  600.     /**************************************************************/
  601.    case WM_MOUSEMOVE:
  602.     Short = WinQueryWindowUShort( GpfGetHwndFrame( hwnd ),QWS_ID );
  603.     GpfSendMsgInformation( pGpfParms, Short );
  604.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  605.  
  606.     /**************************************************************/
  607.     /* Process ControlPointer & MenuSelected for Information Msg  */
  608.     /**************************************************************/
  609.    case WM_CONTROLPOINTER:
  610.    case WM_MENUSELECT:
  611.     GpfSendMsgInformation( pGpfParms, SHORT1FROMMP(mp1));
  612.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  613.  
  614.     /**************************************************************/
  615.     /* Process MenuEnd for Information Msg                  */
  616.     /**************************************************************/
  617.    case WM_MENUEND:
  618.     if (SHORT1FROMMP(mp1) == FID_MENU)
  619.        {
  620.         pGpfParms->ShortMsgId = -1;            /* Reset MsgId */
  621.         GpfSendMsgInformation( pGpfParms, 0);
  622.        }
  623.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  624.  
  625.     /**************************************************************/
  626.     /* Things to do when the Window is Moved              */
  627.     /**************************************************************/
  628.    case WM_MOVE:
  629.     if ((pGpfParms->Options & GPF_OP_MSGINFO))
  630.         WinPostMsg( hwnd, WM_PAINT, (MPARAM)NULL, (MPARAM)NULL );
  631.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  632.  
  633.        /***************************************************************/
  634.        /*  The List Box needs to know how big to make an Item.          */
  635.        /***************************************************************/
  636.    case WM_MEASUREITEM:
  637.     return (MRESULT)GpfMeasureItem( hwnd, mp1, mp2 );
  638.  
  639.     /**************************************************************/
  640.     /*  The List Box wants us to Draw an Item              */
  641.     /**************************************************************/
  642.    case WM_DRAWITEM:
  643.     return (MRESULT)GpfDrawItem( hwnd, mp1, mp2 );
  644.  
  645.     /**************************************************************/
  646.     /* Things to do when the Window is End LogoTimer          */
  647.     /**************************************************************/
  648.    case WM_TIMER:
  649.     if (SHORT1FROMMP(mp1) != TID_USERMAX)    /* LogoTimer...       */
  650.         break;                /* No... Ignore Timer */
  651.     WinStopTimer( WinQueryAnchorBlock( hwnd ),
  652.              hwnd, TID_USERMAX );    /* Stop LogoTimer     */
  653.     /**************************************************************/
  654.     /* Simulate CANCEL - Post WM_CLOSE to Window              */
  655.     /**************************************************************/
  656.     WinPostMsg( hwnd, WM_CLOSE, (MPARAM)NULL, (MPARAM)NULL );
  657.     break;
  658.  
  659.    case HM_HELPSUBITEM_NOT_FOUND:
  660.     /**************************************************************/
  661.     /* Help manager couldn't find a help panel for an item.       */
  662.     /* Returning FALSE will display the extended help for that    */
  663.     /* window.                              */
  664.     /* Returning TRUE Tells the Help Manager to do nothing.       */
  665.     /**************************************************************/
  666.     Short = WinQueryWindowUShort( GpfGetHwndFrame( hwnd ),QWS_ID );
  667.     if (SHORT1FROMMP(mp1) == 0xFFFD)         /* HLPM_MENU */
  668.        {
  669.         if (WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  670.                 MPFROMSHORT(SHORT1FROMMP(mp2)),
  671.                 MPFROMSHORT(HM_RESOURCEID) ))
  672.         if (WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  673.                 MPFROMSHORT(Short),
  674.                 MPFROMSHORT(HM_RESOURCEID) ))
  675.             WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  676.                 MPFROMSHORT( ID_TB ),
  677.                 MPFROMSHORT(HM_RESOURCEID) );
  678.        }
  679.     else
  680.        {
  681.         if (WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  682.                 MPFROMSHORT(SHORT1FROMMP(mp2)),
  683.                 MPFROMSHORT(HM_RESOURCEID) ))
  684.            GpfDisplayHelp( WinQueryFocus( HWND_DESKTOP ));
  685.        }
  686.     return (MRESULT)(TRUE);
  687.  
  688.    case HM_QUERY_KEYS_HELP:
  689.     /**************************************************************/
  690.     /* Return Keys help panel ID for the help manager          */
  691.     /**************************************************************/
  692.     /**************************************************************/
  693.     /*     QUERY_KEYS_HELP                          */
  694.     /*                                  */
  695.     /* If the user requests KEYS HELP from the help pull-down,    */
  696.     /* IPF sends the HM_QUERY_KEYS_HELP message to the application*/
  697.     /* which should return the panel id of the keys_help panel,   */
  698.     /* or a 0 to tell IPF to do nothing.                  */
  699.     /**************************************************************/
  700.     return (MRESULT)(ID_TB - 1);
  701.  
  702.     case HM_EXT_HELP_UNDEFINED:
  703.      /*************************************************************/
  704.      /* This message is sent to the application by Help Manager   */
  705.      /* to notify it that an extended help panel has not been     */
  706.      /* defined.                              */
  707.      /*************************************************************/
  708.      WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  709.              MPFROMSHORT( ID_TB ),
  710.              MPFROMSHORT( HM_RESOURCEID ) );
  711.      return ((MRESULT) FALSE);
  712.  
  713.     case HM_ERROR:
  714.      /*************************************************************/
  715.      /* If an error occurs using IPF, an HM_ERROR msg will be     */
  716.      /* sent to the application.                      */
  717.      /*************************************************************/
  718.      if ( (ULONG) mp1 == HMERR_NO_MEMORY )
  719.         {
  720.          WinMessageBox( HWND_DESKTOP, hwnd,
  721.                 (PSZ) "Help Terminated Due to Error",
  722.                 (PSZ) "Help Error",
  723.                 1,
  724.                 MB_OK | MB_APPLMODAL | MB_MOVEABLE );
  725.          WinDestroyHelpInstance( hwndHelp );
  726.          hwndHelp = (HWND)NULL;
  727.         }
  728.      return ((MRESULT) FALSE);
  729.  
  730.        /***************************************************************/
  731.        /* Other messages are handled by the default window procedure. */
  732.        /***************************************************************/
  733.    default:
  734.     /* Pass all other messages to the default window procedure    */
  735.     return WinDefWindowProc( hwnd, msg, mp1, mp2 );
  736.   }
  737.   return ((MRESULT) FALSE);
  738. }
  739. /**********************************************************************/
  740. /* End of window procedure - WinProc: GpfDefWindowProc              */
  741. /**********************************************************************/
  742. /**********************************************************************/
  743.  
  744.  
  745. /**********************************************************************/
  746. /**********************************************************************/
  747. /*                                      */
  748. /*  FUNCTION : GpfDisplayHelp                          */
  749. /*                                      */
  750. /**********************************************************************/
  751.  
  752. VOID APIENTRY GpfDisplayHelp( HWND hwnd )
  753. {
  754.   HWND        hwndDesktop;    /* hwnd Desktop            */
  755.   HWND        hwndWrk;        /* hwnd Work               */
  756.   USHORT    uShort;        /* Work uShort               */
  757.   HAB        hab;        /* Anchor block handle           */
  758.  
  759.    hab = WinQueryAnchorBlock(hwnd);
  760.    if ((!hab) || (!hwndHelp))    /* Verify hwnd, hab, and hwndHelp     */
  761.        return;
  762.    hwndWrk = hwnd;
  763.    hwndDesktop = WinQueryDesktopWindow(hab,(HDC)NULL);
  764.    while(hwndWrk != hwndDesktop)
  765.     {
  766.      uShort = WinQueryWindowUShort(hwndWrk,QWS_ID);
  767.      if ( uShort != FID_CLIENT )
  768.         {
  769.          if (!WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  770.                   MPFROMSHORT(uShort),
  771.                   MPFROMSHORT(HM_RESOURCEID) ))
  772.          return;
  773.         }
  774.      hwndWrk = WinQueryWindow( hwndWrk, QW_PARENT);
  775.     }
  776.    WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  777.            MPFROMSHORT( ID_TB ),
  778.            MPFROMSHORT( HM_RESOURCEID ) );
  779.    return;
  780. }
  781. /**********************************************************************/
  782. /* End of GpfDisplayHelp Function                      */
  783. /**********************************************************************/
  784. /**********************************************************************/
  785.  
  786.  
  787.  
  788. /******************* Start of GpfSendMsg Function *********************/
  789. /**********************************************************************/
  790. /*                                      */
  791. /* FUNCTION : GpfSendMsg                          */
  792. /*                                      */
  793. /* Display, and operate the message box window                  */
  794. /**********************************************************************/
  795. SHORT APIENTRY GpfSendMsg( SHORT Id )
  796. {
  797.  CHAR       String[256];
  798.  HWND       SysModalWindow;
  799.  HWND       hwndActive;           /* Query Active Window (ApplModal) */
  800.  USHORT    Reply = 0;
  801.  SHORT       Alarm = -1;
  802.  SHORT       Style = 0;
  803.  PCHAR       Token1 = 0;
  804.  PCHAR       Token2 = 0;
  805.  
  806.  /*********************************************************************/
  807.  /* Save Window (System Modal)                          */
  808.  /*********************************************************************/
  809.  SysModalWindow = WinQuerySysModalWindow( HWND_DESKTOP );
  810.  
  811.  /*********************************************************************/
  812.  /* Load Msg strings                              */
  813.  /*********************************************************************/
  814.  WinLoadString( habMainTask, hmodtb,
  815.         Id, sizeof(String),(PSZ)String );
  816.  
  817.  Token1 = strchr( String, ':' );
  818.  if (Token1)
  819.     {
  820.      *Token1 = 0;
  821.      Alarm = atoi( String );
  822.      Token2 = strchr( ++Token1, ' ' );
  823.      if (Token2)
  824.     {
  825.      *(Token2++) = 0;
  826.      Style = atoi( Token1 );
  827.      /*************************************************************/
  828.      /* Set Alarm                              */
  829.      /*************************************************************/
  830.      if (Alarm != -1)
  831.          WinAlarm( HWND_DESKTOP, Alarm );
  832.      /*************************************************************/
  833.      /* Query HwndOwner                          */
  834.      /*************************************************************/
  835.      hwndActive = WinQueryActiveWindow( HWND_DESKTOP );
  836.      /*************************************************************/
  837.      /* Now, display the message, save the button press for a     */
  838.      /* return code.                          */
  839.      /* Pop up a Message box.                      */
  840.      /*************************************************************/
  841.      Reply = WinMessageBox( HWND_DESKTOP, hwndActive,
  842.             (PSZ) Token2, (PSZ)Swctl.szSwtitle, Id, Style );
  843.      /*************************************************************/
  844.      /* Restore Window (System Modal)                  */
  845.      /*************************************************************/
  846.      WinSetSysModalWindow( HWND_DESKTOP, SysModalWindow );
  847.      /*************************************************************/
  848.      /* Reset Information Message                      */
  849.      /*************************************************************/
  850.      hwndActive = WinWindowFromID( hwndActive, FID_CLIENT );
  851.      WinPostMsg( hwndActive, WM_MOUSEMOVE,
  852.              (MPARAM) NULL, (MPARAM) NULL );
  853.     }
  854.     }
  855.  return(Reply);
  856. }
  857.  
  858. /**********************************************************************/
  859. /* End of GpfSendMsg Function                          */
  860. /**********************************************************************/
  861. /**********************************************************************/
  862.  
  863.  
  864.  
  865.  
  866. /**********************************************************************/
  867. /**********************************************************************/
  868. /*                                      */
  869. /*   STATIC PRIVATE FUNCTION: Initialize Application              */
  870. /*                                      */
  871. /**********************************************************************/
  872.  
  873. static VOID InitializeApplication( VOID )
  874.  {
  875.     GpfInitThread(habMainTask,hmqMainTask);
  876.     GpfGetVunitHunit(&Vunits,&Hunits);
  877.     return;
  878.  
  879.  }
  880. /**********************************************************************/
  881. /* End of Private Function: Initialize Application              */
  882. /**********************************************************************/
  883. /**********************************************************************/
  884.  
  885.  
  886.  
  887. /**********************************************************************/
  888. /**********************************************************************/
  889. /*                                      */
  890. /*   STATIC PRIVATE FUNCTION: End Application                  */
  891. /*                                      */
  892. /**********************************************************************/
  893.  
  894. static VOID EndApplication( VOID )
  895.  {
  896.     EndOfAppl = TRUE;
  897.     return;
  898.  }
  899. /**********************************************************************/
  900. /* End of Private Function: End Application                  */
  901. /**********************************************************************/
  902. /**********************************************************************/
  903.  
  904.  
  905.  
  906. /**********************************************************************/
  907. /**********************************************************************/
  908. /*                                      */
  909. /*   STATIC PRIVATE FUNCTION: WmCreateMain                  */
  910. /*                                      */
  911. /*   WM_CREATE - Create - "Main".                      */
  912. /*                                      */
  913. /**********************************************************************/
  914.  
  915. static VOID WmCreateMain ( PGPFPARMS pGpfParms )
  916.  {
  917.     pGpfParms->mresult = (MRESULT) FALSE;       /* Set Return Code */
  918.     UfMainCreate(pGpfParms);
  919.     return;
  920.  
  921.  }
  922. /**********************************************************************/
  923. /* End of Function: WmCreateMain                      */
  924. /**********************************************************************/
  925. /**********************************************************************/
  926.  
  927.  
  928.  
  929. /**********************************************************************/
  930. /**********************************************************************/
  931. /*                                      */
  932. /*   STATIC PRIVATE FUNCTION: WmCmdOtherMain                  */
  933. /*                                      */
  934. /*   WM_COMMAND/CONTROL - CmdOther - "Main".                  */
  935. /*                                      */
  936. /**********************************************************************/
  937.  
  938. static VOID WmCmdOtherMain ( PGPFPARMS pGpfParms )
  939.  {
  940.     pGpfParms->mresult = (MRESULT) FALSE;       /* Set Return Code */
  941.     UfMainCommand(pGpfParms);
  942.     return;
  943.  
  944.  }
  945. /**********************************************************************/
  946. /* End of Function: WmCmdOtherMain                      */
  947. /**********************************************************************/
  948. /**********************************************************************/
  949.  
  950.  
  951. /**********************************************************************/
  952. /**********************************************************************/
  953. /*                                      */
  954. /*   FUNCTION: ShowMain                           */
  955. /*                                      */
  956. /*   Show Window "Main".                          */
  957. /*                                      */
  958. /**********************************************************************/
  959.  
  960. BOOL EXPENTRY ShowMain( PVOID pCrtParms )
  961.  {
  962.   GpfExecAsyncProc((PFNASYNCPROC)AsynShowMain,
  963.             pCrtParms,hmqMainTask);
  964.   return(FALSE);
  965.  }
  966. /**********************************************************************/
  967. /* End of ShowMain Function                          */
  968. /**********************************************************************/
  969. /**********************************************************************/
  970.  
  971.  
  972.  
  973. /**********************************************************************/
  974. /**********************************************************************/
  975. /*                                      */
  976. /*   FUNCTION: AsynShowMain                          */
  977. /*                                      */
  978. /*   AsynShow Window "Main".                          */
  979. /*                                      */
  980. /**********************************************************************/
  981.  
  982. VOID APIENTRY AsynShowMain( PVOID pCrtParms )
  983.  {
  984.                  /* Make sure the window was not created. */
  985.    if (!hwndFrameMain)
  986.     CreateMain( pCrtParms );
  987.  
  988.    WinSetWindowPos( hwndFrameMain,
  989.             HWND_TOP, 0, 0, 0, 0,
  990.             SWP_ZORDER | SWP_ACTIVATE | SWP_SHOW );
  991.    WinShowWindow( hwndMain, TRUE );
  992.  
  993.    return;
  994.  }
  995. /**********************************************************************/
  996. /* End of AsynShowMain Function                       */
  997. /**********************************************************************/
  998. /**********************************************************************/
  999.  
  1000.  
  1001.  
  1002. /**********************************************************************/
  1003. /**********************************************************************/
  1004. /*                                      */
  1005. /*   FUNCTION: DismissMain                          */
  1006. /*                                      */
  1007. /*   Dismiss Window Hide - Window "Main".                  */
  1008. /*                                      */
  1009. /**********************************************************************/
  1010.  
  1011. VOID APIENTRY DismissMain( BOOL Rcode )
  1012.  {
  1013.  
  1014.    Rcode = Rcode;  /* Null , For Delete Unreferenced Formal Parameter */
  1015.                                /* Hide Window */
  1016.    WinSetWindowPos( hwndFrameMain,
  1017.             (HWND)NULL, 0, 0, 0, 0,
  1018.             SWP_DEACTIVATE | SWP_HIDE );
  1019.    WinShowWindow( hwndMain, FALSE );
  1020.  
  1021.    return;
  1022.  }
  1023. /**********************************************************************/
  1024. /* End of DismissMain Function                          */
  1025. /**********************************************************************/
  1026. /**********************************************************************/
  1027.  
  1028.  
  1029.  
  1030. /**********************************************************************/
  1031. /**********************************************************************/
  1032. /*                                      */
  1033. /*   FUNCTION: CreateMain                          */
  1034. /*                                      */
  1035. /*   Create the window "Main" And Controls.                  */
  1036. /*                                      */
  1037. /**********************************************************************/
  1038.  
  1039. HWND APIENTRY CreateMain( PVOID pCrtParms )
  1040.  {
  1041.   /********************************************************************/
  1042.   /*   Register the window class "Main".                  */
  1043.   /********************************************************************/
  1044.   WinRegisterClass(                 /* Register window class */
  1045.       habMainTask,                 /* Anchor block handle   */
  1046.       (PSZ)"Main",                 /* Window class name     */
  1047.       (PFNWP)fnwpMain,             /* Address window proc   */
  1048.       CS_CLIPSIBLINGS | CS_SAVEBITS |    /* Class style          */
  1049.       CS_MOVENOTIFY |             /* Class style          */
  1050.       CS_SIZEREDRAW | CS_SYNCPAINT,      /* Class style          */
  1051.       EXTRAWORDS                 /* Extra window words    */
  1052.       );
  1053.  
  1054.   /********************************************************************/
  1055.   /*   Create the window "Main".                      */
  1056.   /********************************************************************/
  1057.   hwndFrameMain =                      /* Save Hwnd    */
  1058.   GpfCreateTemplate( ID_MAIN,                  /* Ressource Id */
  1059.              hmodtb,                  /* Ressource Md */
  1060.              HWND_DESKTOP,              /* Hwnd Parent  */
  1061.              HWND_DESKTOP,              /* Hwnd Owner   */
  1062.              pCrtParms,               /* User Parms   */
  1063.              0,0L);                  /* Reserved     */
  1064.   return (hwndFrameMain);
  1065.  }
  1066. /**********************************************************************/
  1067. /* End of CreateMain Function                          */
  1068. /**********************************************************************/
  1069. /**********************************************************************/
  1070.  
  1071.  
  1072.  
  1073.  
  1074. /**********************************************************************/
  1075. /**********************************************************************/
  1076. /*                                      */
  1077. /*  WinProc: fnwpMain                              */
  1078. /*                                      */
  1079. /*  Controls the "Main" Area.                          */
  1080. /*                                      */
  1081. /*                                      */
  1082. /**********************************************************************/
  1083.  
  1084. MRESULT  EXPENTRY fnwpMain(
  1085.           HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 )
  1086. {
  1087.   PGPFPARMS pGpfParms;        /* Far Pointer            */
  1088.   MPARAM    SvMp2;        /* 2nd (packed) parms        */
  1089.   MPARAM    SvMp1;        /* 1st (packed) parms        */
  1090.   ULONG     SvMsg;        /* message number        */
  1091.   MRESULT   SvMresult;        /* Mresult            */
  1092.   USHORT    SvCommand;        /* Command From mp1 (SHORT 1)    */
  1093.   USHORT    SvNotify;        /* Notify  From mp1 (SHORT 2)    */
  1094.   HWND        SvHwndControl;    /* Control hwnd         */
  1095.   LONG        SvVsComponentId;    /* ValueSet Component ID    */
  1096.   MRESULT   PmMresult;
  1097.  
  1098.   /*******************************************************************/
  1099.   /* Query Gpf Parameters                         */
  1100.   /*******************************************************************/
  1101.   pGpfParms = (PGPFPARMS) WinQueryWindowULong( hwnd, QWL_USER );
  1102.   if ((!pGpfParms) && (msg == WM_CREATE))
  1103.      {
  1104.       pGpfParms = malloc( sizeof(GPFPARMS) );          /* Set Pointer*/
  1105.       WinSetWindowULong( hwnd, QWL_USER, (ULONG)pGpfParms );
  1106.       memset( pGpfParms, 0, sizeof(GPFPARMS) );       /* Clear Area */
  1107.      }
  1108.  
  1109.   if (!pGpfParms)
  1110.       return GpfDefWindowProc( hwnd, msg, mp1, mp2 );
  1111.  
  1112.   /********************************************************************/
  1113.   /* Save Gpf Parameters                          */
  1114.   /********************************************************************/
  1115.   SvMsg = pGpfParms->msg;
  1116.   SvMp1 = pGpfParms->mp1;
  1117.   SvMp2 = pGpfParms->mp2;
  1118.   SvMresult = pGpfParms->mresult;
  1119.   SvCommand = pGpfParms->Command;
  1120.   SvNotify  = pGpfParms->Notify;
  1121.   SvHwndControl = pGpfParms->hwndControl;
  1122.   SvVsComponentId = pGpfParms->VsComponentId;
  1123.  
  1124.   /********************************************************************/
  1125.   /* Initialize Gpf Parameters                          */
  1126.   /********************************************************************/
  1127.   pGpfParms->hwnd    = hwnd;           /* window handle           */
  1128.   pGpfParms->msg     = msg;           /* message number          */
  1129.   pGpfParms->mp1     = mp1;           /* 1st (packed) parms          */
  1130.   pGpfParms->mp2     = mp2;           /* 2nd (packed) parms          */
  1131.   pGpfParms->mresult = (MRESULT) FALSE; /* Mresult              */
  1132.   pGpfParms->Command = 0;           /* Command From mp1 (SHORT 1)  */
  1133.   pGpfParms->Notify  = 0;           /* Notify  From mp1 (SHORT 2)  */
  1134.   PmMresult = ProcessMain( pGpfParms );
  1135.  
  1136.   /*******************************************************************/
  1137.   /* Query Gpf Parameters                         */
  1138.   /*******************************************************************/
  1139.   pGpfParms = (PGPFPARMS) WinQueryWindowULong( hwnd, QWL_USER );
  1140.   if (pGpfParms)
  1141.      {
  1142.       /****************************************************************/
  1143.       /* Restore Gpf Parameters                       */
  1144.       /****************************************************************/
  1145.       pGpfParms->msg   = SvMsg;
  1146.       pGpfParms->mp1   = SvMp1;
  1147.       pGpfParms->mp2   = SvMp2;
  1148.       pGpfParms->mresult   = SvMresult;
  1149.       pGpfParms->Command = SvCommand;
  1150.       pGpfParms->Notify  = SvNotify;
  1151.       pGpfParms->hwndControl  = SvHwndControl;
  1152.       pGpfParms->VsComponentId    = SvVsComponentId;
  1153.      }
  1154.  
  1155.   return PmMresult;
  1156. }
  1157. /**********************************************************************/
  1158. /* End of window procedure - WinProc: fnwpMain                  */
  1159. /**********************************************************************/
  1160. /**********************************************************************/
  1161.  
  1162.  
  1163.  
  1164. /**********************************************************************/
  1165. /**********************************************************************/
  1166. /*                                      */
  1167. /*  FUNCTION : ProcessMain                          */
  1168. /*                                      */
  1169. /*  Process "Main".                              */
  1170. /*                                      */
  1171. /**********************************************************************/
  1172.  
  1173. static MRESULT ProcessMain( PGPFPARMS pGpfParms )
  1174. {
  1175.  
  1176.   switch(pGpfParms->msg)
  1177.   {
  1178.     /**************************************************************/
  1179.     /* Things to do when the Window is first initalized          */
  1180.     /* This message occurs when a dialog box is being created.    */
  1181.     /**************************************************************/
  1182.    case WM_INITDLG:
  1183.     /**************************************************************/
  1184.     /*  Initialize Window 'Main'                      */
  1185.     /**************************************************************/
  1186.     GpfDefWindowProc( pGpfParms->hwnd, pGpfParms->msg,
  1187.               pGpfParms->mp1, pGpfParms->mp2 );
  1188.     /**************************************************************/
  1189.     /*  Return pGpfParms Mresult                      */
  1190.     /**************************************************************/
  1191.     return (pGpfParms->mresult);
  1192.  
  1193.     /**************************************************************/
  1194.     /* The application has asked for the window to be created.    */
  1195.     /**************************************************************/
  1196.    case WM_CREATE:
  1197.     pGpfParms->Options |= GPF_OP_MAINWINDOW; /* Set MainWindow    */
  1198.     hwndMain = pGpfParms->hwnd;             /* Save Hwnd */
  1199.     hwndFrameMain = GpfGetHwndFrame( pGpfParms->hwnd );
  1200.     pGpfParms->hmod = hmodtb;
  1201.     pGpfParms->hab    = habMainTask;           /* Anchor block handle */
  1202.     WmCreateMain( pGpfParms );           /* Create  Window      */
  1203.     break;
  1204.  
  1205.     /**************************************************************/
  1206.     /* The application has asked for the window to be destroyed.  */
  1207.     /* Always sent to the window being destroyed after the window */
  1208.     /* has been hidden on the device, but before its children     */
  1209.     /* have been destroyed. The message is sent first to the      */
  1210.     /* window being destroyed, then to the children as they are   */
  1211.     /* destroyed. Therefore, during processing the WM_DESTROY it  */
  1212.     /* can be assumed that all the children still exist.          */
  1213.     /**************************************************************/
  1214.    case WM_DESTROY:
  1215.     hwndFrameMain = (HWND)NULL;            /* Reset HwndFrm  */
  1216.     hwndMain = (HWND)NULL;                /* Reset Hwnd     */
  1217.     /* Destroy Template , Help Instance and GpfParms          */
  1218.     return GpfDefWindowProc( pGpfParms->hwnd, pGpfParms->msg,
  1219.                  pGpfParms->mp1, pGpfParms->mp2 );
  1220.  
  1221.     /**************************************************************/
  1222.     /* The window needs painting.                      */
  1223.     /**************************************************************/
  1224.    case WM_PAINT:
  1225.     /**************************************************************/
  1226.     /* Obtain a cache PS                          */
  1227.     /**************************************************************/
  1228.     pGpfParms->hps = WinBeginPaint( pGpfParms->hwnd, (HPS)NULL,
  1229.                     (PRECTL)&pGpfParms->rcl );
  1230.     WinFillRect(pGpfParms->hps,&pGpfParms->rcl,pGpfParms->BgColor);
  1231.     WinEndPaint( pGpfParms->hps );        /* Release cache PS   */
  1232.     return GpfDefWindowProc( pGpfParms->hwnd, pGpfParms->msg,
  1233.                  pGpfParms->mp1, pGpfParms->mp2 );
  1234.  
  1235.     /**************************************************************/
  1236.     /* Process ScrollBar received from the user              */
  1237.     /**************************************************************/
  1238.    case WM_VSCROLL:
  1239.    case WM_HSCROLL:
  1240.     /* Set Command From mp1 */
  1241.     pGpfParms->Command = SHORT1FROMMP( pGpfParms->mp1 );
  1242.     /* Set Notify From mp2    */
  1243.     pGpfParms->Notify = SHORT2FROMMP( pGpfParms->mp2 );
  1244.     if ((pGpfParms->Command != FID_VERTSCROLL) &&
  1245.         (pGpfParms->Command != FID_HORZSCROLL))
  1246.        CommandMain( pGpfParms );          /* Process the command  */
  1247.     return (pGpfParms->mresult);
  1248.  
  1249.     /**************************************************************/
  1250.     /* Process Controls received from the user              */
  1251.     /**************************************************************/
  1252.    case WM_CONTROL:
  1253.     /* Set Command From mp1 */
  1254.     pGpfParms->Command = SHORT1FROMMP( pGpfParms->mp1 );
  1255.     /* Set Notify From mp1    */
  1256.     pGpfParms->Notify = SHORT2FROMMP( pGpfParms->mp1 );
  1257.     CommandMain( pGpfParms );          /* Process the command  */
  1258.     return (pGpfParms->mresult);
  1259.  
  1260.     /**************************************************************/
  1261.     /* This message occurs when a control has a significant event */
  1262.     /* to its owner or when a key stroke has been              */
  1263.     /* translated by an accelerator table into a WM_COMMAND.      */
  1264.     /**************************************************************/
  1265.    case WM_SYSCOMMAND:
  1266.    case WM_HELP:
  1267.    case WM_COMMAND:
  1268.     /* Set Command From mp1 */
  1269.     pGpfParms->Command = SHORT1FROMMP(pGpfParms->mp1);
  1270.     pGpfParms->Notify = COMMAND;          /* Set Notify From mp1  */
  1271.     CommandMain( pGpfParms );          /* Process the command  */
  1272.     if (!(pGpfParms->Flag & GPF_FL_PROCESSED))
  1273.         return GpfDefWindowProc( pGpfParms->hwnd, pGpfParms->msg,
  1274.                      pGpfParms->mp1, pGpfParms->mp2 );
  1275.     return (pGpfParms->mresult);
  1276.  
  1277.     /**************************************************************/
  1278.     /* This message is sent to a frame window to indicate that    */
  1279.     /* the window is being closed by the user.              */
  1280.     /**************************************************************/
  1281.    case WM_CLOSE:
  1282.     pGpfParms->Command = DID_CANCEL;      /* simulate CANCEL      */
  1283.     pGpfParms->Notify = COMMAND;          /* Set Notify          */
  1284.     CommandMain( pGpfParms );          /* Process the command  */
  1285.     if (!(pGpfParms->Flag & GPF_FL_PROCESSED))
  1286.         WinPostMsg( pGpfParms->hwnd,      /* Cause termination    */
  1287.             WM_QUIT, (MPARAM) NULL, (MPARAM) NULL);
  1288.     return (pGpfParms->mresult);
  1289.  
  1290.     /**************************************************************/
  1291.     /* All other messages are passed to the default procedure.    */
  1292.     /**************************************************************/
  1293.    default:
  1294.     /* Pass all other messages to the default window procedure    */
  1295.     return GpfDefWindowProc( pGpfParms->hwnd, pGpfParms->msg,
  1296.                  pGpfParms->mp1, pGpfParms->mp2 );
  1297.   }
  1298.   return ((MRESULT) FALSE);
  1299. }
  1300. /**********************************************************************/
  1301. /* End of ProcessMain Function                          */
  1302. /**********************************************************************/
  1303. /**********************************************************************/
  1304.  
  1305.  
  1306.  
  1307.  
  1308. /**********************************************************************/
  1309. /**********************************************************************/
  1310. /*                                      */
  1311. /*   STATIC PRIVATE FUNCTION: CommandMain                  */
  1312. /*                                      */
  1313. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1314. /*   received by the window procedure.                      */
  1315. /*   Window "Main".                              */
  1316. /*                                      */
  1317. /**********************************************************************/
  1318.  
  1319. static VOID CommandMain ( PGPFPARMS pGpfParms )
  1320. {
  1321.   pGpfParms->Flag |=  GPF_FL_PROCESSED;      /* Set Processed Flag    */
  1322.   pGpfParms->hwndControl = WinWindowFromID( pGpfParms->hwnd,
  1323.                         pGpfParms->Command );
  1324.   /* Switch according to Control chosen                   */
  1325.   switch( pGpfParms->Command )
  1326.   {
  1327.     /******************************************************************/
  1328.     /* Name  "MAIN_PB_DEL".                          */
  1329.     /* Text  "~Delete IX".                          */
  1330.     /******************************************************************/
  1331.     case ID_MAIN_PB_DEL:
  1332.      ActionMAIN_PB_DEL( pGpfParms );
  1333.      return;
  1334.     /******************************************************************/
  1335.     /* Name  "MAIN_PB_ADD".                          */
  1336.     /* Text  "~Add Tool".                          */
  1337.     /******************************************************************/
  1338.     case ID_MAIN_PB_ADD:
  1339.      ActionMAIN_PB_ADD( pGpfParms );
  1340.      return;
  1341.     /******************************************************************/
  1342.     /* Name  "PullDownExit".                          */
  1343.     /* Text  "~Exit\tF3".                          */
  1344.     /******************************************************************/
  1345.     case ID_PULLDOWNEXIT:
  1346.      ActionPullDownExit( pGpfParms );
  1347.      return;
  1348.     /******************************************************************/
  1349.     /* Name  "PullDownHelpIndex".                      */
  1350.     /* Text  "Help ~index".                          */
  1351.     /******************************************************************/
  1352.     case ID_PULLDOWNHELPINDEX:
  1353.      ActionPullDownHelpIndex( pGpfParms );
  1354.      return;
  1355.     /******************************************************************/
  1356.     /* Name  "PullDownExtendedHelp".                      */
  1357.     /* Text  "~General help".                          */
  1358.     /******************************************************************/
  1359.     case ID_PULLDOWNEXTENDEDHELP:
  1360.      ActionPullDownExtendedHelp( pGpfParms );
  1361.      return;
  1362.     /******************************************************************/
  1363.     /* Name  "PullDownHelpForHelp".                      */
  1364.     /* Text  "~Using help".                          */
  1365.     /******************************************************************/
  1366.     case ID_PULLDOWNHELPFORHELP:
  1367.      ActionPullDownHelpForHelp( pGpfParms );
  1368.      return;
  1369.     /******************************************************************/
  1370.     /* Name  "PullDownKeysHelp".                      */
  1371.     /* Text  "~Keys help".                          */
  1372.     /******************************************************************/
  1373.     case ID_PULLDOWNKEYSHELP:
  1374.      ActionPullDownKeysHelp( pGpfParms );
  1375.      return;
  1376.   }
  1377.   /* Pass all other Command/Control to the default Cmd/Cntrl function */
  1378.   WmCmdOtherMain( pGpfParms );
  1379.   return;
  1380. }
  1381. /**********************************************************************/
  1382. /* End of Private Function: CommandMain                   */
  1383. /**********************************************************************/
  1384. /**********************************************************************/
  1385.  
  1386.  
  1387. /**********************************************************************/
  1388. /**********************************************************************/
  1389. /*                                      */
  1390. /*   STATIC PRIVATE FUNCTION: ActionPullDownExit              */
  1391. /*                                      */
  1392. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1393. /*   received by the window procedure.                      */
  1394. /*   Window "Main".                              */
  1395. /*                                      */
  1396. /**********************************************************************/
  1397.  
  1398. static VOID ActionPullDownExit( PGPFPARMS pGpfParms )
  1399. {
  1400.   /* Switch according to Control chosen                   */
  1401.   switch( pGpfParms->Notify )
  1402.   {
  1403.    case COMMAND:
  1404.     /**************************************************************/
  1405.     /* Exit selected                          */
  1406.     /**************************************************************/
  1407.     WinPostMsg( hwndMain, WM_QUIT,
  1408.             (MPARAM) NULL, (MPARAM) NULL );
  1409.     return;
  1410.   }
  1411.   /* Take no action for any other selections                  */
  1412.   return;
  1413.  
  1414. }
  1415. /**********************************************************************/
  1416. /* End of Private Function                          */
  1417. /**********************************************************************/
  1418. /**********************************************************************/
  1419.  
  1420.  
  1421. /**********************************************************************/
  1422. /**********************************************************************/
  1423. /*                                      */
  1424. /*   STATIC PRIVATE FUNCTION: ActionPullDownHelpIndex              */
  1425. /*                                      */
  1426. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1427. /*   received by the window procedure.                      */
  1428. /*   Window "Main".                              */
  1429. /*                                      */
  1430. /**********************************************************************/
  1431.  
  1432. static VOID ActionPullDownHelpIndex( PGPFPARMS pGpfParms )
  1433. {
  1434.   /* Switch according to Control chosen                   */
  1435.   switch( pGpfParms->Notify )
  1436.   {
  1437.    case COMMAND:
  1438.     /**************************************************************/
  1439.     /* Help Index.                              */
  1440.     /**************************************************************/
  1441.     if (hwndHelp)
  1442.         WinSendMsg( hwndHelp, HM_HELP_INDEX,
  1443.             (MPARAM) NULL, (MPARAM) NULL );
  1444.     return;
  1445.   }
  1446.   /* Take no action for any other selections                  */
  1447.   return;
  1448.  
  1449. }
  1450. /**********************************************************************/
  1451. /* End of Private Function                          */
  1452. /**********************************************************************/
  1453. /**********************************************************************/
  1454.  
  1455.  
  1456. /**********************************************************************/
  1457. /**********************************************************************/
  1458. /*                                      */
  1459. /*   STATIC PRIVATE FUNCTION: ActionPullDownExtendedHelp          */
  1460. /*                                      */
  1461. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1462. /*   received by the window procedure.                      */
  1463. /*   Window "Main".                              */
  1464. /*                                      */
  1465. /**********************************************************************/
  1466.  
  1467. static VOID ActionPullDownExtendedHelp( PGPFPARMS pGpfParms )
  1468. {
  1469.   /* Switch according to Control chosen                   */
  1470.   switch( pGpfParms->Notify )
  1471.   {
  1472.    case COMMAND:
  1473.     /**************************************************************/
  1474.     /* Help Extended.                          */
  1475.     /**************************************************************/
  1476.     if (hwndHelp)
  1477.         WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  1478.             MPFROMSHORT( ID_TB ),
  1479.             MPFROMSHORT( HM_RESOURCEID ) );
  1480.     return;
  1481.   }
  1482.   /* Take no action for any other selections                  */
  1483.   return;
  1484.  
  1485. }
  1486. /**********************************************************************/
  1487. /* End of Private Function                          */
  1488. /**********************************************************************/
  1489. /**********************************************************************/
  1490.  
  1491.  
  1492. /**********************************************************************/
  1493. /**********************************************************************/
  1494. /*                                      */
  1495. /*   STATIC PRIVATE FUNCTION: ActionPullDownHelpForHelp           */
  1496. /*                                      */
  1497. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1498. /*   received by the window procedure.                      */
  1499. /*   Window "Main".                              */
  1500. /*                                      */
  1501. /**********************************************************************/
  1502.  
  1503. static VOID ActionPullDownHelpForHelp( PGPFPARMS pGpfParms )
  1504. {
  1505.   /* Switch according to Control chosen                   */
  1506.   switch( pGpfParms->Notify )
  1507.   {
  1508.    case COMMAND:
  1509.     /**************************************************************/
  1510.     /* Help For Help.                          */
  1511.     /**************************************************************/
  1512.     if (hwndHelp)
  1513.         WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  1514.             (MPARAM) NULL, MPFROMSHORT(HM_RESOURCEID) );
  1515.     return;
  1516.   }
  1517.   /* Take no action for any other selections                  */
  1518.   return;
  1519.  
  1520. }
  1521. /**********************************************************************/
  1522. /* End of Private Function                          */
  1523. /**********************************************************************/
  1524. /**********************************************************************/
  1525.  
  1526.  
  1527. /**********************************************************************/
  1528. /**********************************************************************/
  1529. /*                                      */
  1530. /*   STATIC PRIVATE FUNCTION: ActionPullDownKeysHelp              */
  1531. /*                                      */
  1532. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1533. /*   received by the window procedure.                      */
  1534. /*   Window "Main".                              */
  1535. /*                                      */
  1536. /**********************************************************************/
  1537.  
  1538. static VOID ActionPullDownKeysHelp( PGPFPARMS pGpfParms )
  1539. {
  1540.   /* Switch according to Control chosen                   */
  1541.   switch( pGpfParms->Notify )
  1542.   {
  1543.    case COMMAND:
  1544.     /**************************************************************/
  1545.     /* Help Keys.                              */
  1546.     /**************************************************************/
  1547.     if (hwndHelp)
  1548.        {
  1549.         if (WinSendMsg( hwndHelp, HM_KEYS_HELP,
  1550.                 (MPARAM) NULL, (MPARAM) NULL ))
  1551.         WinSendMsg( hwndHelp, HM_DISPLAY_HELP,
  1552.                 MPFROMSHORT( ID_TB ),
  1553.                 MPFROMSHORT( HM_RESOURCEID ) );
  1554.        }
  1555.     return;
  1556.   }
  1557.   /* Take no action for any other selections                  */
  1558.   return;
  1559.  
  1560. }
  1561. /**********************************************************************/
  1562. /* End of Private Function                          */
  1563. /**********************************************************************/
  1564. /**********************************************************************/
  1565.  
  1566.  
  1567. /**********************************************************************/
  1568. /**********************************************************************/
  1569. /*                                      */
  1570. /*   STATIC PRIVATE FUNCTION: ActionMAIN_PB_DEL               */
  1571. /*                                      */
  1572. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1573. /*   received by the window procedure.                      */
  1574. /*   Window "Main".                              */
  1575. /*                                      */
  1576. /**********************************************************************/
  1577.  
  1578. static VOID ActionMAIN_PB_DEL( PGPFPARMS pGpfParms )
  1579. {
  1580.   /* Switch according to Control chosen                   */
  1581.   switch( pGpfParms->Notify )
  1582.   {
  1583.    case COMMAND:
  1584.    case BN_CLICKED:
  1585.    case BN_DBLCLICKED:
  1586.     UfPBDel(pGpfParms);
  1587.     /**************************************************************/
  1588.     /* Disable Control "MAIN_PB_DEL".                  */
  1589.     /* Window "Main".                          */
  1590.     /**************************************************************/
  1591.     WinEnableWindow( WinWindowFromID( hwndMain,
  1592.              ID_MAIN_PB_DEL ),
  1593.              FALSE );
  1594.     return;
  1595.   }
  1596.   /* Take no action for any other selections                  */
  1597.   return;
  1598.  
  1599. }
  1600. /**********************************************************************/
  1601. /* End of Private Function                          */
  1602. /**********************************************************************/
  1603. /**********************************************************************/
  1604.  
  1605.  
  1606. /**********************************************************************/
  1607. /**********************************************************************/
  1608. /*                                      */
  1609. /*   STATIC PRIVATE FUNCTION: ActionMAIN_PB_ADD               */
  1610. /*                                      */
  1611. /*   Takes appropriate action when a WM_COMMAND/WM_CONTROL message is */
  1612. /*   received by the window procedure.                      */
  1613. /*   Window "Main".                              */
  1614. /*                                      */
  1615. /**********************************************************************/
  1616.  
  1617. static VOID ActionMAIN_PB_ADD( PGPFPARMS pGpfParms )
  1618. {
  1619.   /* Switch according to Control chosen                   */
  1620.   switch( pGpfParms->Notify )
  1621.   {
  1622.    case COMMAND:
  1623.    case BN_CLICKED:
  1624.    case BN_DBLCLICKED:
  1625.     UfPBAdd(pGpfParms);
  1626.     return;
  1627.   }
  1628.   /* Take no action for any other selections                  */
  1629.   return;
  1630.  
  1631. }
  1632. /**********************************************************************/
  1633. /* End of Private Function                          */
  1634. /**********************************************************************/
  1635. /**********************************************************************/
  1636.  
  1637.