home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / warptlk3.zip / TOOLKIT / SAMPLES / WPS / BROWSE / BROWSE.C < prev    next >
C/C++ Source or Header  |  1995-08-24  |  40KB  |  1,165 lines

  1.  
  2. /*
  3.  *
  4.  *
  5.  *   Module Name: BROWSE
  6.  *
  7.  *   OS/2 Work Place Shell Sample Program
  8.  *
  9.  *   Copyright (C) 1993 IBM Corporation
  10.  *
  11.  *       DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  12.  *       sample code created by IBM Corporation. This sample code is not
  13.  *       part of any standard or IBM product and is provided to you solely
  14.  *       for  the purpose of assisting you in the development of your
  15.  *       applications.  The code is provided "AS IS", without
  16.  *       warranty of any kind.  IBM shall not be liable for any damages
  17.  *       arising out of your use of the sample code, even if they have been
  18.  *       advised of the possibility of such damages.
  19.  *
  20.  */
  21.  
  22.  
  23. #define Browse_O_Matic_Class_Source
  24. #include "browse.ih"
  25. #include "pmbrowse.h"
  26.  
  27. HMODULE hModule = NULLHANDLE;
  28.  
  29. /*
  30.  *
  31.  *  METHOD: BrowseOMatic                                   ( ) PRIVATE
  32.  *                                                         (X) PUBLIC
  33.  *  DESCRIPTION:
  34.  *
  35.  *    Displays a file in the specified format.
  36.  *
  37.  *       BOOL bMode   - Specifies the format of the view. Supported values:
  38.  *                      PMBROWSE_HEX_DISPLAY_MODE
  39.  *                      PMBROWSE_TEXT_DISPLAY_MODE
  40.  *
  41.  *       PSZ  pszName - The name of the file to display. Can't be NULL.
  42.  *
  43.  *  RETURN:
  44.  *
  45.  *       N/A
  46.  *
  47.  */
  48.  
  49.  
  50. /*
  51.  * SOM_Scope VOID  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
  52.  *                 BOOL bMode,
  53.  *                 PSZ pszName)
  54.  */
  55.  
  56. /*
  57.  * The prototype for Browse_O_Maticwps_BrowseOMatic was replaced by the following prototype:
  58.  */
  59. SOM_Scope void  SOMLINK Browse_O_Maticwps_BrowseOMatic(Browse_O_Matic *somSelf,
  60.                                                        BOOL bMode,
  61.                                                        PSZ pszName)
  62. {
  63.     HAB           hab;
  64.     HWND          hwndClient = NULLHANDLE;
  65.     HWND          hwndFrame  = NULLHANDLE;
  66.     FRAMECDATA    flFrameData;
  67.     PBROWSEDATA   pWindowData;
  68.  
  69.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  70.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_BrowseOMatic");
  71.  
  72.     if( NULLHANDLE == ( hab = WinQueryAnchorBlock( HWND_DESKTOP)))
  73.        _ErrorHandler( somSelf, "Unable to query the anchor block.", 0L);
  74.  
  75.     if( FALSE == WinRegisterClass( hab, BROWSE_WINDOW_CLASS, BrowseWndProc,
  76.                                                      0L, sizeof( PBROWSEDATA)))
  77.        _ErrorHandler( somSelf, "Unable to register window class", FALSE);
  78.  
  79.     /***************************************/
  80.     /* Set up the frame window information */
  81.     /***************************************/
  82.     flFrameData.cb            = sizeof( flFrameData );
  83.     flFrameData.hmodResources = hModule;
  84.     flFrameData.idResources   = ID_ICON;
  85.  
  86.     flFrameData.flCreateFlags = FCF_TITLEBAR | FCF_MINMAX | FCF_SIZEBORDER |
  87.                                FCF_SYSMENU | FCF_TASKLIST | FCF_SHELLPOSITION |
  88.                                                FCF_VERTSCROLL | FCF_HORZSCROLL;
  89.  
  90.     /***************************/
  91.     /* Create the frame window */
  92.     /***************************/
  93.     if( NULLHANDLE == ( hwndFrame = WinCreateWindow( HWND_DESKTOP, WC_FRAME,
  94.             APPL_NAME, 0, 0, 0, 0, 0, NULLHANDLE, HWND_TOP, (USHORT) ID_WINDOW,
  95.                                                   (PVOID)&flFrameData, NULL)))
  96.        _ErrorHandler( somSelf, "Unable to create frame window", FALSE);
  97.  
  98.     /***********************************/
  99.     /* Allocate the window data buffer */
  100.     /***********************************/
  101.     pWindowData = (PBROWSEDATA)_wpAllocMem( somSelf, sizeof(BROWSEDATA), NULL);
  102.  
  103.     /*************************/
  104.     /* Setup the window data */
  105.     /*************************/
  106.     memset( pWindowData, 0, sizeof( BROWSEDATA));
  107.  
  108.     pWindowData->cb              = sizeof( BROWSEDATA);
  109.     pWindowData->somSelf         = somSelf;
  110.     pWindowData->UseItem.type    = USAGE_OPENVIEW;
  111.     pWindowData->ViewItem.view   = bMode;
  112.     pWindowData->ViewItem.handle = hwndFrame;
  113.     pWindowData->bDisplay        = bMode;
  114.  
  115.     if( bMode == PMBROWSE_HEX_DISPLAY_MODE)
  116.          pWindowData->pszApplKey  = "HEX Key";
  117.     else
  118.          pWindowData->pszApplKey  = "TEXT Key";
  119.  
  120.     /*****************************************************************/
  121.     /* Ask the user for the name of the object if we didn't get one. */
  122.     /*****************************************************************/
  123.     if( pszName != NULL){
  124.          pWindowData->pszObjectName = _DuplicateString( somSelf, pszName);
  125.     }
  126.     else{
  127.          if( FALSE == _GetObjectName( somSelf, hwndFrame,
  128.                                                  &pWindowData->pszObjectName)){
  129.              WinDestroyWindow(hwndFrame);
  130.              return;
  131.          }
  132.     }
  133.  
  134.     /***************************/
  135.     /* Create the child window */
  136.     /***************************/
  137.     if( NULLHANDLE == ( hwndClient = WinCreateWindow( hwndFrame,
  138.             BROWSE_WINDOW_CLASS, NULL,0, 0, 0, 0, 0, hwndFrame, HWND_TOP,
  139.                                        (USHORT)FID_CLIENT, pWindowData, NULL)))
  140.        _ErrorHandler( somSelf, "Unable to create client window", FALSE);
  141.  
  142.     /******************************************/
  143.     /* Restore the window position and fonts. */
  144.     /******************************************/
  145.     WinRestoreWindowPos( APPL_NAME, pWindowData->pszApplKey, hwndFrame);
  146.     WinSendMsg( hwndClient, WM_PRESPARAMCHANGED, (MPARAM)PP_FONTNAMESIZE,
  147.                                                                     (MPARAM)0);
  148.     WinSendMsg( hwndFrame, WM_SETICON, MPFROMP( _wpQueryIcon( somSelf)), NULL);
  149.  
  150.     WinShowWindow( hwndFrame, TRUE);   /* Make the window visible */
  151. }
  152.  
  153. /*
  154.  *
  155.  *  METHOD: DuplicateString                                ( ) PRIVATE
  156.  *                                                         (X) PUBLIC
  157.  *  DESCRIPTION:
  158.  *
  159.  *    Duplicates a null terminated string. The buffer is allocated using
  160.  *    wpAllocMem() and must be freed using wpFreeMem().
  161.  *
  162.  *       PSZ  pszString - A NULL terminated string.
  163.  *
  164.  *  RETURN:
  165.  *
  166.  *       A pointer to the copy of pszString.
  167.  *
  168.  */
  169.  
  170. SOM_Scope PSZ   SOMLINK Browse_O_Maticwps_DuplicateString(Browse_O_Matic *somSelf,
  171.                 PSZ pszString)
  172. {
  173.     PSZ pszDuplicate;
  174.  
  175.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  176.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_DuplicateString");
  177.  
  178.     pszDuplicate = (PSZ)_wpAllocMem( somSelf, strlen( pszString), NULL);
  179.  
  180.     if( pszDuplicate)
  181.        strcpy( pszDuplicate, pszString);
  182.  
  183.     return( pszDuplicate);
  184. }
  185.  
  186. /*
  187.  *
  188.  *  METHOD: ErrorHandler                                   ( ) PRIVATE
  189.  *                                                         (X) PUBLIC
  190.  *  DESCRIPTION:
  191.  *
  192.  *    Displays error information in a PM window.
  193.  *
  194.  *       PSZ    pszInfo - A description of the error condition.
  195.  *       APIRET rc      - The error code from the failing method.
  196.  *
  197.  *  RETURN:
  198.  *
  199.  *       N/A
  200.  *
  201.  */
  202.  
  203.  
  204. /*
  205.  * SOM_Scope VOID   SOMLINK Browse_O_Maticwps_ErrorHandler(Browse_O_Matic *somSelf,
  206.  *                 PSZ pszInfo,
  207.  *                 APIRET rc)
  208.  */
  209.  
  210. /*
  211.  * The prototype for Browse_O_Maticwps_ErrorHandler was replaced by the following prototype:
  212.  */
  213. SOM_Scope void  SOMLINK Browse_O_Maticwps_ErrorHandler(Browse_O_Matic *somSelf,
  214.                                                        PSZ pszInfo,
  215.                                                        APIRET rc)
  216. {
  217.     char  pszOutputBuffer[ 100];
  218.  
  219.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  220.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_ErrorHandler");
  221.  
  222.     sprintf( pszOutputBuffer, "%s - %ld", pszInfo, rc);
  223.     WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, pszOutputBuffer,
  224.                                           "ERROR in BROWSE-O-MATIC", 0, MB_OK);
  225. }
  226.  
  227. /*
  228.  *
  229.  *  METHOD: FileExists                                     ( ) PRIVATE
  230.  *                                                         (X) PUBLIC
  231.  *  DESCRIPTION:
  232.  *
  233.  *    Determines if a file exists.
  234.  *
  235.  *       PSZ    pszFileName - A fully qualified path and file name.
  236.  *
  237.  *  RETURN:
  238.  *
  239.  *       TRUE  - The file exists.
  240.  *       FALSE - The file does not exist.
  241.  *
  242.  */
  243.  
  244. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_FileExists(Browse_O_Matic *somSelf,
  245.                 PSZ pszFileName)
  246. {
  247.     HDIR          FindHandle = 1;
  248.     FILEFINDBUF3  FindBuffer;
  249.     ULONG         FindCount = 1;
  250.     ULONG         ulFileAttribute = 1;     /* Normal Files */
  251.     BOOL          fExists = FALSE;
  252.     APIRET        rc;
  253.  
  254.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  255.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_FileExists");
  256.  
  257.     rc = DosFindFirst( pszFileName, &FindHandle, ulFileAttribute, &FindBuffer,
  258.                                 sizeof( FindBuffer), &FindCount, FIL_STANDARD);
  259.  
  260.     if( rc!=NO_ERROR && rc!=ERROR_FILE_NOT_FOUND && rc!=ERROR_NO_MORE_FILES){
  261.       _ErrorHandler( somSelf, "Opening log file", rc);
  262.       return( fExists);
  263.     }
  264.  
  265.     DosFindClose( FindHandle);
  266.  
  267.     if( rc == NO_ERROR)
  268.       fExists = TRUE;
  269.  
  270.     return( fExists);
  271. }
  272.  
  273. /*
  274.  *
  275.  *  METHOD: GetHexLine                                     ( ) PRIVATE
  276.  *                                                         (X) PUBLIC
  277.  *  DESCRIPTION:
  278.  *
  279.  *    Formats 16 bytes of the object for display.
  280.  *
  281.  *       USHORT usLine       - The number of the line to get.
  282.  *       PBYTE  pBuffer      - Pointer to the buffer where the file is loaded in
  283.  *       ULONG  ulFileLength - The size of the file.
  284.  *       PSZ    pszText      - Buffer to store the formated line in.
  285.  *
  286.  *  RETURN:
  287.  *
  288.  *       The length of the formated display line.
  289.  *
  290.  */
  291.  
  292. SOM_Scope UINT   SOMLINK Browse_O_Maticwps_GetHexLine(Browse_O_Matic *somSelf,
  293.                 USHORT usLine,
  294.                 PBYTE pBuffer,
  295.                 ULONG ulFileLength,
  296.                 PSZ pszText)
  297. {
  298.     PSZ    pObj;
  299.     USHORT usCount;
  300.     UINT   nLength = 0;
  301.  
  302.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  303.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_GetHexLine");
  304.  
  305.  
  306.     /**********************************/
  307.     /* Point to first byte to display */
  308.     /**********************************/
  309.     pObj = &pBuffer[ (usLine - 1) * HEX_BYTES_PER_LINE];
  310.  
  311.     sprintf( pszText, "│ %08X │", pObj - pBuffer);
  312.  
  313.     /**************************************/
  314.     /* Write the hex values to the buffer */
  315.     /**************************************/
  316.     for( usCount=0; usCount<HEX_BYTES_PER_LINE; usCount++){
  317.  
  318.        /********************************************/
  319.        /* Put a space after each 4 bytes displayed */
  320.        /********************************************/
  321.        if( usCount % sizeof( LONG) == 0)
  322.           strcat( pszText, " ");
  323.  
  324.        /********************************************************/
  325.        /* Don't display more bytes than there are in the file. */
  326.        /********************************************************/
  327.        if( usCount + (usLine-1)*HEX_BYTES_PER_LINE < ulFileLength)
  328.           sprintf( &pszText[ strlen( pszText)], "%02.2hx", pObj[ usCount]);
  329.        else
  330.           strcat( &pszText[ strlen( pszText)], "  ");
  331.     }
  332.  
  333.     strcat( pszText, " │ ");
  334.  
  335.     /******************************************************/
  336.     /* Copy the ASCII representation to the output buffer */
  337.     /******************************************************/
  338.     nLength = strlen( pszText);
  339.     memset( &pszText[ nLength], 0x20, HEX_BYTES_PER_LINE);
  340.     memcpy( &pszText[ nLength], pObj, min( HEX_BYTES_PER_LINE,
  341.                               ulFileLength - (usLine-1) * HEX_BYTES_PER_LINE));
  342.     nLength += HEX_BYTES_PER_LINE;
  343.     pszText[ nLength] = 0;
  344.     memcpy( &pszText[ nLength], " │", 3);
  345.     nLength += 2;
  346.  
  347.     return( nLength);
  348. }
  349.  
  350. /*
  351.  *
  352.  *  METHOD: GetLinesAndColumns                             ( ) PRIVATE
  353.  *                                                         (X) PUBLIC
  354.  *  DESCRIPTION:
  355.  *
  356.  *    Determines the maximum number of lines and columns based on the current
  357.  *    view mode.
  358.  *
  359.  *       BOOL   bDisplay       - The display mode. Supported values:
  360.  *                               PMBROWSE_TEXT_DISPLAY_MODE
  361.  *                               PMBROWSE_HEX_DISPLAY_MODE
  362.  *       PSHORT psTotalLines   - Return total number of lines.
  363.  *       PSHORT psTotalColumns - Return maximum number of columns.
  364.  *       USHORT usNumberOfTextLines - The total number of text lines.
  365.  *       USHORT usNumberOfTextColumns - The maximum number of text columns.
  366.  *       ULONG  ulFileLength   - The length of file.
  367.  *
  368.  *  RETURN:
  369.  *
  370.  *       N/A
  371.  *
  372.  */
  373.  
  374.  
  375. /*
  376.  * SOM_Scope VOID   SOMLINK Browse_O_Maticwps_GetLinesAndColumns(Browse_O_Matic *somSelf,
  377.  *                 BOOL bDisplay,
  378.  *                 PSHORT psTotalLines,
  379.  *                 PSHORT psTotalColumns,
  380.  *                 USHORT usNumberOfTextLines,
  381.  *                 USHORT usNumberOfTextColumns,
  382.  *                 ULONG ulFileLength)
  383.  */
  384.  
  385. /*
  386.  * The prototype for Browse_O_Maticwps_GetLinesAndColumns was replaced by the following prototype:
  387.  */
  388. SOM_Scope void  SOMLINK Browse_O_Maticwps_GetLinesAndColumns(Browse_O_Matic *somSelf,
  389.                                                              BOOL bDisplay,
  390.                                                              PSHORT psTotalLines,
  391.                                                              PSHORT psTotalColumns,
  392.                                                              USHORT usNumberOfTextLines,
  393.                                                              USHORT usNumberOfTextColumns,
  394.                                                              ULONG ulFileLength)
  395. {
  396.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  397.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_GetLinesAndColumns");
  398.  
  399.     /*************************************************************************/
  400.     /* Determine the maximum number of columns and the total number of lines */
  401.     /*************************************************************************/
  402.     if( bDisplay == PMBROWSE_TEXT_DISPLAY_MODE){
  403.        *psTotalLines   = usNumberOfTextLines;
  404.        *psTotalColumns = usNumberOfTextColumns;
  405.     }
  406.     else{
  407.        *psTotalLines = (SHORT)( ulFileLength / HEX_BYTES_PER_LINE +
  408.                                     ( ulFileLength % HEX_BYTES_PER_LINE != 0));
  409.        *psTotalColumns = HEX_LINE_LENGTH;
  410.     }
  411. }
  412.  
  413. /*
  414.  *
  415.  *  METHOD: GetObjectName                                  ( ) PRIVATE
  416.  *                                                         (X) PUBLIC
  417.  *  DESCRIPTION:
  418.  *
  419.  *    Prompts the user to enter the name of the object.
  420.  *
  421.  *       HWND   hwnd           - Handle to frame window.
  422.  *       PSZ*   ppszObjectName - Address of pointer for object name.
  423.  *
  424.  *  RETURN:
  425.  *
  426.  *       TRUE  - The user selected an valid file.
  427.  *       FALSE - The user selected cancel.
  428.  *
  429.  */
  430.  
  431. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_GetObjectName(Browse_O_Matic *somSelf,
  432.                 HWND hwnd,
  433.                 PSZ *ppszObjectName)
  434. {
  435.     FILEDLG  fild;
  436.     PSZ      pszDialogTitle = "Object Name";
  437.     PSZ      pszButton      = "Browse";
  438.     PSZ      pszInitialPath = "*.*";
  439.     HWND     hwndDlg;
  440.     BOOL     bOpenFile = FALSE;
  441.  
  442.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  443.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_GetObjectName");
  444.  
  445.     /*****************************************************************/
  446.     /* Initially set all fields to 0                                 */
  447.     /*****************************************************************/
  448.     memset( &fild, 0, sizeof(FILEDLG));
  449.  
  450.     fild.pszTitle    = pszDialogTitle;
  451.     fild.pszOKButton = pszButton;
  452.     fild.fl          = FDS_CENTER | FDS_OPEN_DIALOG;
  453.     fild.cbSize      = sizeof( FILEDLG);
  454.     fild.pfnDlgProc  = (PFNWP)OpenFilterProc;
  455.     strcpy( fild.szFullFile, pszInitialPath);
  456.  
  457.     /**********************************************/
  458.     /* Get the name of the log file from the user */
  459.     /**********************************************/
  460.     hwndDlg = WinFileDlg( HWND_DESKTOP, HWND_DESKTOP, &fild);
  461.     if( ( hwndDlg != 0) && ( fild.lReturn == DID_OK)){
  462.  
  463.        /*********************************/
  464.        /* Determine if the file exists. */
  465.        /*********************************/
  466.        if( _FileExists( somSelf, fild.szFullFile)){
  467.  
  468.           *ppszObjectName = _DuplicateString( somSelf, fild.szFullFile);
  469.           bOpenFile = TRUE;
  470.        }
  471.        else
  472.           WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, *ppszObjectName,
  473.                               "BROWSE-O-MATIC - Object Not Found", 0, MB_OK);
  474.     }
  475.  
  476.     return( bOpenFile);
  477. }
  478.  
  479. /*
  480.  *
  481.  *  METHOD: GetTextLine                                    ( ) PRIVATE
  482.  *                                                         (X) PUBLIC
  483.  *  DESCRIPTION:
  484.  *
  485.  *    Copies a line of text from the object to a buffer.
  486.  *
  487.  *       USHORT      usLine  - The number of the line to get.
  488.  *       LINERECORD* pLines  - Pointer to the line record array.
  489.  *       PSZ         pszText - Buffer to store the text in.
  490.  *
  491.  *  RETURN:
  492.  *
  493.  *       The length of the line to display.
  494.  *
  495.  */
  496.  
  497. SOM_Scope UINT   SOMLINK Browse_O_Maticwps_GetTextLine(Browse_O_Matic *somSelf,
  498.                 USHORT usLine,
  499.                 LINERECORD *pLines,
  500.                 PSZ pszText)
  501. {
  502.     UINT uLineLength;
  503.  
  504.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  505.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_GetTextLine");
  506.  
  507.     uLineLength = min( MAX_LINE_LENGTH, pLines[ usLine - 1].unLength);
  508.  
  509.     /*******************************************/
  510.     /* Copy the text line to the output buffer */
  511.     /*******************************************/
  512.     strncpy( pszText, pLines[ usLine-1].pszLine, uLineLength);
  513.  
  514.     return( uLineLength);
  515. }
  516.  
  517. /*
  518.  *
  519.  *  METHOD: LoadObject                                     ( ) PRIVATE
  520.  *                                                         (X) PUBLIC
  521.  *  DESCRIPTION:
  522.  *
  523.  *    Loads a file into memory and determines the number of text line and
  524.  *    maximum number of text columns.
  525.  *
  526.  *       PSZ     pszObjectName  - Name of the file to load.
  527.  *       PULONG  pulLength      - returns the length of the file.
  528.  *       PBYTE*  ppBuffer       - returns a pointer to the file in memory.
  529.  *       LINERECORD** pLines    - returns a pointer to a line record array.
  530.  *       PUSHORT pusNumberOfTextLines   - returns the number of text lines.
  531.  *       PUSHORT pusNumberOfTextColumns - returns the maximum number of text
  532.  *                                                                      columns.
  533.  *
  534.  *  RETURN:
  535.  *
  536.  *       TRUE  - Loaded object correctly
  537.  *       FALSE - Unable to load object
  538.  */
  539.  
  540. /*
  541.  *
  542.  * METHOD: LoadObject                                     ( ) PRIVATE
  543.  *                                                        (X) PUBLIC
  544.  * DESCRIPTION:
  545.  *
  546.  *   Loads a file into memory and determines the number of text line and
  547.  *   maximum number of text columns.
  548.  *
  549.  *      PSZ     pszObjectName  - Name of the file to load.
  550.  *      PULONG  pulLength      - returns the length of the file.
  551.  *      PBYTE*  ppBuffer       - returns a pointer to the file in memory.
  552.  *      LINERECORD** pLines    - returns a pointer to a line record array.
  553.  *      PUSHORT pusNumberOfTextLines   - returns the number of text lines.
  554.  *      PUSHORT pusNumberOfTextColumns - returns the maximum number of text
  555.  *                                                                     columns.
  556.  *
  557.  * RETURN:
  558.  *
  559.  *      N/A
  560.  *
  561.  */
  562.  
  563. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_LoadObject(Browse_O_Matic *somSelf,
  564.                 PSZ pszObjectName,
  565.                 PULONG pulLength,
  566.                 PBYTE *ppBuffer,
  567.                 LINERECORD **ppLines,
  568.                 PUSHORT pusNumberOfTextLines,
  569.                 PUSHORT pusNumberOfTextColumns)
  570. {
  571.     UINT        unLength = 0;
  572.     HFILE       hFile;
  573.     USHORT      usCount = 0;
  574.     ULONG       Action;
  575.     ULONG       ulOffset = 0;
  576.     ULONG       ulBytesRead = -1;
  577.     FILESTATUS3 FileInfo;
  578.  
  579.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  580.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_LoadObject");
  581.  
  582.     *pulLength              = 0;
  583.     *pusNumberOfTextLines   = 0;
  584.     *pusNumberOfTextColumns = 0;
  585.  
  586.     if( NO_ERROR != DosOpen( pszObjectName, &hFile, &Action, 0,
  587.              FILE_NORMAL, OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS,
  588.                                 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, 0))
  589.       return( FALSE);
  590.  
  591.     /*************************************************************/
  592.     /* Allocate a buffer large enough for the file system object */
  593.     /*************************************************************/
  594.     DosQueryFileInfo( hFile, FIL_STANDARD, &FileInfo, sizeof( FileInfo));
  595.     *pulLength = FileInfo.cbFile;
  596.     if(NULL == ( *ppBuffer = (PBYTE)_wpAllocMem( somSelf, *pulLength, NULL))){
  597.        DosClose( hFile);
  598.        return( FALSE);
  599.     }
  600.  
  601.     /**************************************/
  602.     /* Load the entire file system object */
  603.     /**************************************/
  604.     DosRead( hFile, *ppBuffer, *pulLength, &ulBytesRead);
  605.     DosClose( hFile);
  606.  
  607.     /************************************************/
  608.     /* Count the number of text lines in the object */
  609.     /************************************************/
  610.     for( ulOffset = 0; ulOffset < ulBytesRead; ulOffset++){
  611.  
  612.        if( (*ppBuffer)[ ulOffset] == '\n')
  613.           (*pusNumberOfTextLines)++;
  614.     }
  615.  
  616.     /***************************************************************/
  617.     /* Allocate a buffer for an array of character pointers. These */
  618.     /* point to the beginning of each line.                        */
  619.     /***************************************************************/
  620.     if( NULL == ( *ppLines = (LINERECORD*)_wpAllocMem( somSelf,
  621.                         sizeof( LINERECORD) * (*pusNumberOfTextLines), NULL))){
  622.        _wpFreeMem( somSelf, *ppBuffer);
  623.        return( FALSE);
  624.     }
  625.  
  626.     /****************************************************************/
  627.     /* Store the address of the beginning of each text line and the */
  628.     /* length of each text line in the array.                       */
  629.     /****************************************************************/
  630.     usCount = 0;
  631.     (*ppLines)[ usCount].pszLine = *ppBuffer;
  632.     *pusNumberOfTextColumns = 0;
  633.  
  634.     for( ulOffset=0; ulOffset<ulBytesRead; ulOffset++){
  635.  
  636.        if( (*ppBuffer)[ ulOffset] != '\r' && (*ppBuffer)[ ulOffset] != '\n')
  637.           unLength++;
  638.  
  639.        if( (*ppBuffer)[ ulOffset] == '\n'){
  640.  
  641.           (*ppLines)[ usCount].unLength = unLength;
  642.           usCount++;
  643.  
  644.           if( ulOffset+1<ulBytesRead && usCount <= *pusNumberOfTextLines){
  645.  
  646.              (*ppLines)[ usCount].pszLine = (PSZ)&(*ppBuffer)[ulOffset+1];
  647.              *pusNumberOfTextColumns = max( *pusNumberOfTextColumns, unLength);
  648.           }
  649.  
  650.           unLength = 0;
  651.        }
  652.     }
  653.  
  654.     return( TRUE);
  655. }
  656.  
  657. /*
  658.  *
  659.  * METHOD: ProductInformationView                         ( ) PRIVATE
  660.  *                                                        (X) PUBLIC
  661.  * DESCRIPTION:
  662.  *
  663.  *   Displays the product information view.
  664.  *
  665.  * RETURN:
  666.  *
  667.  *      N/A
  668.  *
  669.  */
  670.  
  671. SOM_Scope void  SOMLINK Browse_O_Maticwps_ProductInformationView(Browse_O_Matic *somSelf)
  672. {
  673.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  674.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_ProductInformationView");
  675.  
  676. }
  677.  
  678. /*
  679.  *
  680.  *  METHOD: UnloadObject                                   ( ) PRIVATE
  681.  *                                                         (X) PUBLIC
  682.  *  DESCRIPTION:
  683.  *
  684.  *    Unloads a file that was loaded. The buffer file and the LINERECORD array
  685.  *    are freed.
  686.  *
  687.  *       PBYTE      ppBuffer - a pointer to the file in memory.
  688.  *       LINERECORD pLines   - a pointer to a line record array.
  689.  *
  690.  *  RETURN:
  691.  *
  692.  *       N/A
  693.  *
  694.  */
  695.  
  696.  
  697. /*
  698.  * SOM_Scope VOID   SOMLINK Browse_O_Maticwps_UnloadObject(Browse_O_Matic *somSelf,
  699.  *                 PBYTE pBuffer,
  700.  *                 LINERECORD *pLines)
  701.  */
  702.  
  703. /*
  704.  * The prototype for Browse_O_Maticwps_UnloadObject was replaced by the following prototype:
  705.  */
  706. SOM_Scope void  SOMLINK Browse_O_Maticwps_UnloadObject(Browse_O_Matic *somSelf,
  707.                                                        PBYTE pBuffer,
  708.                                                        LINERECORD* pLines)
  709. {
  710.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  711.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_UnloadObject");
  712.  
  713.     if( pBuffer)
  714.        _wpFreeMem( somSelf, ( PBYTE)pBuffer);
  715.  
  716.     if( pLines)
  717.        _wpFreeMem( somSelf, ( PBYTE)pLines);
  718. }
  719.  
  720. /*
  721.  *
  722.  *  OVERRIDE: wpDragOver                                   ( ) PRIVATE
  723.  *                                                         (X) PUBLIC
  724.  *  DESCRIPTION:
  725.  *
  726.  *    Rejects objects that are not file system objects from being dropped
  727.  *    on the Browse_O_matic.
  728.  *
  729.  */
  730.  
  731. SOM_Scope MRESULT   SOMLINK Browse_O_Maticwps_wpDragOver(Browse_O_Matic *somSelf,
  732.                 HWND hwndCnr,
  733.                 PDRAGINFO pdrgInfo)
  734. {
  735.     MRESULT mResult;
  736.     ULONG   ulCount;
  737.     ULONG   ulNumberOfObjects;
  738.  
  739.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  740.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpDragOver");
  741.  
  742.     /********************************************************************/
  743.     /* Don't call the parent. Initialize mResult to allow the drag over */
  744.     /* to proceed.                                                      */
  745.     /********************************************************************/
  746.     mResult = MRFROM2SHORT( DOR_DROP, DO_MOVE);
  747.  
  748.     /*******************************************************************/
  749.     /* Determine the number of objects dragged over the Browse-O-Matic */
  750.     /*******************************************************************/
  751.     ulNumberOfObjects = DrgQueryDragitemCount( pdrgInfo);
  752.  
  753.     /*************************/
  754.     /* Check all the objects */
  755.     /*************************/
  756.     for( ulCount=0; ulCount < ulNumberOfObjects &&
  757.                            SHORT1FROMMR( mResult) != DOR_NEVERDROP; ulCount++){
  758.  
  759.         /*****************************************/
  760.         /* It must be a file system type object. */
  761.         /*****************************************/
  762.         if( DrgVerifyRMF( DrgQueryDragitemPtr( pdrgInfo, ulCount),
  763.                                                          "DRM_OS2FILE", NULL))
  764.             mResult = MRFROM2SHORT( DOR_DROP, SHORT2FROMMR( mResult));
  765.         else
  766.             mResult = MRFROM2SHORT( DOR_NEVERDROP, SHORT2FROMMR( mResult));
  767.     }
  768.  
  769.     return( mResult);
  770. }
  771.  
  772. /*
  773.  *
  774.  *  OVERRIDE: wpDrop                                       ( ) PRIVATE
  775.  *                                                         (X) PUBLIC
  776.  *  DESCRIPTION:
  777.  *
  778.  *    Rejects objects that are not file system objects from being dropped
  779.  *    on the Browse_O_matic.
  780.  *
  781.  */
  782.  
  783. SOM_Scope MRESULT   SOMLINK Browse_O_Maticwps_wpDrop(Browse_O_Matic *somSelf,
  784.                 HWND hwndCnr,
  785.                 PDRAGINFO pdrgInfo,
  786.                 PDRAGITEM pdrgItem)
  787. {
  788.     CHAR    pszBuffer[ 255];
  789.     MRESULT mResult;
  790.  
  791.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  792.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpDrop");
  793.  
  794.     mResult = MRFROM2SHORT( DOR_DROP, 0);
  795.  
  796.     /***************************************************************/
  797.     /* Don't call the parent. Initialize mResult to allow the drop */
  798.     /* to proceed.                                                 */
  799.     /***************************************************************/
  800.     if( DOR_NEVERDROP != SHORT1FROMMR( mResult) &&
  801.                                  DrgVerifyRMF( pdrgItem, "DRM_OS2FILE", NULL)){
  802.  
  803.         /* Get the path */
  804.         DrgQueryStrName( pdrgItem->hstrContainerName, sizeof( pszBuffer),
  805.                                                                     pszBuffer);
  806.         /* Append the name of the object to the path */
  807.         DrgQueryStrName( pdrgItem->hstrSourceName,
  808.                                        sizeof( pszBuffer) - strlen( pszBuffer),
  809.                                               &pszBuffer[ strlen( pszBuffer)]);
  810.         _wpViewObject( somSelf, NULLHANDLE, OPEN_DEFAULT, (ULONG)pszBuffer);
  811.  
  812.         mResult = MRFROM2SHORT( DOR_DROP, SHORT2FROMMR( mResult));
  813.     }
  814.     else
  815.         mResult = MRFROMSHORT( DOR_NEVERDROP);
  816.  
  817.     return( mResult);
  818. }
  819.  
  820. /*
  821.  *
  822.  *  OVERRIDE: wpMenuItemHelpSelected                       ( ) PRIVATE
  823.  *                                                         (X) PUBLIC
  824.  *  DESCRIPTION:
  825.  *
  826.  *    Provide help for the Hex and Text view popup menu selections.
  827.  *
  828.  */
  829.  
  830. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_wpMenuItemHelpSelected(Browse_O_Matic *somSelf,
  831.                 ULONG MenuId)
  832. {
  833.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  834.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpMenuItemHelpSelected");
  835.  
  836.     switch( MenuId){
  837.  
  838.       case ID_OPEN_TEXT:
  839.          return( _wpDisplayHelp( somSelf, PANEL_HELP_OPEN_TEXT, "browse.hlp"));
  840.  
  841.       case ID_OPEN_HEX:
  842.          return( _wpDisplayHelp( somSelf, PANEL_HELP_OPEN_HEX, "browse.hlp"));
  843.  
  844.       default:
  845.          break;
  846.     }
  847.  
  848.     return( FALSE);
  849. }
  850.  
  851. /*
  852.  *
  853.  *  OVERRIDE: wpMenuItemSelected                           ( ) PRIVATE
  854.  *                                                         (X) PUBLIC
  855.  *  DESCRIPTION:
  856.  *
  857.  *    Opens Hex and Text views.
  858.  *
  859.  */
  860.  
  861. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_wpMenuItemSelected(Browse_O_Matic *somSelf,
  862.                 HWND hwndFrame,
  863.                 ULONG ulMenuId)
  864. {
  865.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  866.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpMenuItemSelected");
  867.  
  868.     switch( ulMenuId){
  869.  
  870.        case ID_OPEN_TEXT:
  871.           _wpViewObject( somSelf, NULLHANDLE, ulMenuId, 0L);
  872.           break;
  873.  
  874.        case ID_OPEN_HEX:
  875.           _wpViewObject( somSelf, NULLHANDLE, ulMenuId, 0L);
  876.           break;
  877.  
  878.        case ID_OPEN_PRODUCTINFO:
  879.        case ID_PRODUCTINFOMENU:
  880.           _wpViewObject( somSelf, NULLHANDLE, ulMenuId, 0L);
  881.  
  882.        default:
  883.           return( parent_wpMenuItemSelected( somSelf, hwndFrame, ulMenuId));
  884.     }
  885.  
  886.     return( TRUE);
  887. }
  888.  
  889. /*
  890.  *
  891.  *  OVERRIDE: wpModifyPopupMenu                            ( ) PRIVATE
  892.  *                                                         (X) PUBLIC
  893.  *  DESCRIPTION:
  894.  *
  895.  *    Adds selections for Hex and Text view to the popup menu.
  896.  *
  897.  */
  898.  
  899. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_wpModifyPopupMenu(Browse_O_Matic *somSelf,
  900.                 HWND hwndMenu,
  901.                 HWND hwndCnr,
  902.                 ULONG iPosition)
  903. {
  904.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  905.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpModifyPopupMenu");
  906.  
  907.     /* Put open menu with the other views */
  908.     _wpInsertPopupMenuItems( somSelf, hwndMenu, 0,
  909.                                           hModule, ID_OPENMENU, WPMENUID_OPEN);
  910.  
  911.     /* Add product information */
  912.     _wpInsertPopupMenuItems( somSelf, hwndMenu, 0,
  913.                                    hModule, ID_PRODUCTINFOMENU, WPMENUID_HELP);
  914.  
  915.  
  916.     return (parent_wpModifyPopupMenu(somSelf,hwndMenu,hwndCnr,iPosition));
  917. }
  918.  
  919. /*
  920.  *
  921.  *  OVERRIDE: wpOpen                                       ( ) PRIVATE
  922.  *                                                         (X) PUBLIC
  923.  *  DESCRIPTION:
  924.  *
  925.  *    Opens the Hex and Text views.
  926.  *
  927.  */
  928.  
  929. SOM_Scope HWND   SOMLINK Browse_O_Maticwps_wpOpen(Browse_O_Matic *somSelf,
  930.                 HWND hwndCnr,
  931.                 ULONG ulView,
  932.                 ULONG param)
  933. {
  934.     HWND hwnd = NULLHANDLE;
  935.  
  936.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  937.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpOpen");
  938.  
  939.     switch( ulView){
  940.  
  941.         case ID_OPEN_HEX:
  942.           /*************************************************************/
  943.           /* param is the name of the object to open a view for. This  */
  944.           /* parameter is reserved for views supported by the WPObject */
  945.           /* class but can be used for views provided by new classes.  */
  946.           /*************************************************************/
  947.           _BrowseOMatic( somSelf, PMBROWSE_HEX_DISPLAY_MODE, (PSZ)param);
  948.           break;
  949.  
  950.         case ID_OPEN_TEXT:
  951.           /*************************************************************/
  952.           /* param is the name of the object to open a view for. This  */
  953.           /* parameter is reserved for views supported by the WPObject */
  954.           /* class but can be used for views provided by new classes.  */
  955.           /*************************************************************/
  956.           _BrowseOMatic( somSelf, PMBROWSE_TEXT_DISPLAY_MODE, (PSZ)param);
  957.           break;
  958.  
  959.         case ID_OPEN_PRODUCTINFO:
  960.           WinDlgBox( HWND_DESKTOP, HWND_DESKTOP, (PFNWP)AboutBoxDlgProc,
  961.                                          hModule, ID_PRODUCTINFO, (PVOID)NULL);
  962.  
  963.         default:
  964.            hwnd = parent_wpOpen( somSelf, hwndCnr, ulView, param);
  965.            break;
  966.     }
  967.  
  968.     return( hwnd);
  969. }
  970.  
  971. /*
  972.  *
  973.  *  OVERRIDE: wpSetup                                      ( ) PRIVATE
  974.  *                                                         (X) PUBLIC
  975.  *  DESCRIPTION:
  976.  *
  977.  *    Initializes the type of the instance of the Browse_O_Matic object to DLL.
  978.  *
  979.  */
  980.  
  981. SOM_Scope BOOL   SOMLINK Browse_O_Maticwps_wpSetup(Browse_O_Matic *somSelf,
  982.                 PSZ pszSetupString)
  983. {
  984.     /* Browse_O_MaticData *somThis = Browse_O_MaticGetData(somSelf); */
  985.     Browse_O_MaticMethodDebug("Browse_O_Matic","Browse_O_Maticwps_wpSetup");
  986.  
  987.     _wpSetType( somSelf, DRT_DLL, NULL);
  988.  
  989.     /************************************************/
  990.     /* Allow mulitple secondary views of the object */
  991.     /************************************************/
  992.     _wpSetConcurrentView( somSelf, CCVIEW_ON);
  993.  
  994.     return (parent_wpSetup(somSelf,pszSetupString));
  995. }
  996.  
  997. #undef SOM_CurrentClass
  998. #define SOM_CurrentClass SOMMeta
  999. /*
  1000.  *
  1001.  *  METHOD: clsQueryModuleHandle                           ( ) PRIVATE
  1002.  *                                                         (X) PUBLIC
  1003.  *  DESCRIPTION:
  1004.  *
  1005.  *    Gets the module handle.
  1006.  *
  1007.  *  RETURN:
  1008.  *       NULLHANDLE     - an error occured.
  1009.  *       Not NULLHANDLE - The handle for DLL containing the Browse_O_Matic
  1010.  *                        class.
  1011.  *
  1012.  */
  1013.  
  1014. SOM_Scope HMODULE   SOMLINK Browse_O_MaticM_clsQueryModuleHandle(M_Browse_O_Matic *somSelf)
  1015. {
  1016.     PSZ            pszLibraryName;
  1017.  
  1018.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1019.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_clsQueryModuleHandle");
  1020.  
  1021.     /* Only get the handle once */
  1022.     if( hModule == NULLHANDLE){
  1023.  
  1024.        /* Get the name of the library so we can get it's handle. */
  1025.        if( NULL != ( pszLibraryName = _somLocateClassFile( SOMClassMgrObject,
  1026.              SOM_IdFromString( "Browse_O_Matic"), Browse_O_Matic_MajorVersion,
  1027.                                                  Browse_O_Matic_MinorVersion)))
  1028.  
  1029.            /* Get the handle for the library. */
  1030.            DosQueryModuleHandle( pszLibraryName, &hModule);
  1031.     }
  1032.  
  1033.     return ( hModule);
  1034. }
  1035.  
  1036. /*
  1037.  *
  1038.  *  METHOD: wpclsInitData
  1039.  *
  1040.  *  DESCRIPTION:
  1041.  *
  1042.  *    Initalize the class data
  1043.  *
  1044.  */
  1045.  
  1046. SOM_Scope void   SOMLINK Browse_O_MaticM_wpclsInitData(M_Browse_O_Matic *somSelf)
  1047. {
  1048.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1049.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsInitData");
  1050.  
  1051.     hModule = _clsQueryModuleHandle( somSelf);
  1052.  
  1053.     parent_wpclsInitData(somSelf);
  1054. }
  1055.  
  1056. /*
  1057.  *
  1058.  *  METHOD: wpclsQueryDefaultHelp
  1059.  *
  1060.  *  DESCRIPTION:
  1061.  *
  1062.  *    Provides general help for the Browse_O_Matic instance.
  1063.  *
  1064.  */
  1065.  
  1066. SOM_Scope BOOL   SOMLINK Browse_O_MaticM_wpclsQueryDefaultHelp(M_Browse_O_Matic *somSelf,
  1067.                 PULONG pHelpPanelId,
  1068.                 PSZ pszHelpLibrary)
  1069. {
  1070.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1071.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsQueryDefaultHelp");
  1072.  
  1073.     if (pHelpPanelId)                           /* set default help panel id */
  1074.        *pHelpPanelId = PANEL_MAIN;
  1075.  
  1076.     if( pszHelpLibrary)                         /* copy help filename */
  1077.        strcpy( pszHelpLibrary, "browse.hlp");
  1078.  
  1079.     return( TRUE);
  1080. }
  1081.  
  1082. /*
  1083.  *
  1084.  *  METHOD: wpclsQueryDefaultView
  1085.  *
  1086.  *  DESCRIPTION:
  1087.  *
  1088.  *    Make the default view the Hex view. The user may change this through
  1089.  *    the settings for each instance of the Browse_O_Matic.
  1090.  *
  1091.  */
  1092.  
  1093. SOM_Scope ULONG   SOMLINK Browse_O_MaticM_wpclsQueryDefaultView(M_Browse_O_Matic *somSelf)
  1094. {
  1095.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1096.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsQueryDefaultView");
  1097.  
  1098.     return( ID_OPEN_HEX);
  1099. }
  1100.  
  1101. /*
  1102.  *
  1103.  *  METHOD: wpclsQueryIconData
  1104.  *
  1105.  *  DESCRIPTION:
  1106.  *
  1107.  *    Provide a icon for each instance of the Browse_O_Matic.
  1108.  *
  1109.  */
  1110.  
  1111. SOM_Scope ULONG   SOMLINK Browse_O_MaticM_wpclsQueryIconData(M_Browse_O_Matic *somSelf,
  1112.                 PICONINFO pIconInfo)
  1113. {
  1114.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1115.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsQueryIconData");
  1116.  
  1117.     if( pIconInfo){
  1118.  
  1119.        pIconInfo->fFormat = ICON_RESOURCE;
  1120.        pIconInfo->resid   = ID_ICON;
  1121.        pIconInfo->hmod    = hModule;
  1122.     }
  1123.  
  1124.     return ( sizeof( ICONINFO));
  1125. }
  1126.  
  1127. /*
  1128.  *
  1129.  *  METHOD: wpclsQueryStyle
  1130.  *
  1131.  *  DESCRIPTION:
  1132.  *
  1133.  *    Set style to never print so that Print is not available on the menu.
  1134.  *
  1135.  */
  1136.  
  1137. #undef SOM_CurrentClass
  1138. #define SOM_CurrentClass SOMMeta
  1139. SOM_Scope ULONG   SOMLINK Browse_O_MaticM_wpclsQueryStyle(M_Browse_O_Matic *somSelf)
  1140. {
  1141.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1142.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsQueryStyle");
  1143.  
  1144.     return (parent_wpclsQueryStyle(somSelf) | CLSSTYLE_NEVERPRINT);
  1145. }
  1146.  
  1147. /*
  1148.  *
  1149.  *  METHOD: wpclsQueryTitle
  1150.  *
  1151.  *  DESCRIPTION:
  1152.  *
  1153.  *    Provide a default title of "rowse-O-Matic".
  1154.  *
  1155.  */
  1156.  
  1157. SOM_Scope PSZ   SOMLINK Browse_O_MaticM_wpclsQueryTitle(M_Browse_O_Matic *somSelf)
  1158. {
  1159.     /* M_Browse_O_MaticData *somThis = M_Browse_O_MaticGetData(somSelf); */
  1160.     M_Browse_O_MaticMethodDebug("M_Browse_O_Matic","Browse_O_MaticM_wpclsQueryTitle");
  1161.  
  1162.     return( "Browse-O-Matic");
  1163. }
  1164.  
  1165.