home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / odtlktv4.zip / ODTLKT / TOOLKIT / SAMPLES / OPENDOC / PARTS / TTAPE1 / TTAPE1.CPP < prev    next >
C/C++ Source or Header  |  1995-12-15  |  90KB  |  2,483 lines

  1.  
  2. /*
  3.  *  This file was generated by the SOM Compiler and Emitter Framework.
  4.  *  Generated using:
  5.  *      SOM Emitter emitxtm: 2.41
  6.  */
  7.  
  8. /***********************************************************************
  9. *
  10. *  File Name   : TTAPE1.CPP
  11. *
  12. *  Description : This module contains the implementation of the Ticker-
  13. *                Tape1 SOM class.  TickerTape1 is an example of an
  14. *                OpenDoc part handler.
  15. *
  16. *                The part is a Ticker Tape, which is a rectangular
  17. *                window containing text which scrolls from right to
  18. *                left.
  19. *
  20. *                The Ticker Tape has the following features:
  21. *
  22. *                1. The text adjusts when the size of the rectangle is
  23. *                   adjusted, so that the height of the text always
  24. *                   fills the height of the rectangle.
  25. *                2. The background color can be selected by selecting
  26. *                   "Background" from the Pop-up menu, which appears
  27. *                   when the mouse is clicked over the part with mouse
  28. *                   button 2.
  29. *                3. A text file can be selected to replace the displayed
  30. *                   Ticker Tape text.  The text file is selected by
  31. *                   selecting "Open Text File" from the Pop-up menu.
  32. *                4. Because the TickerTape1's parent class is a container
  33. *                   part handler, the TickerTape1 part handler allows the
  34. *                   embedding of OpenDoc parts within the Ticker Tape
  35. *                   text window.
  36. *
  37. *  Notes       : N/A
  38. *
  39. *  Utility routine entry points:
  40. *                MessageBox
  41. *                FrameWndProc
  42. *                MenuColorFromRGBColor
  43. *
  44. *  TickerTape1Part class entry points:
  45. *                TickerTape1CommonInitPart
  46. *                TickerTape1SetOrigin
  47. *                TickerTape1FileOpenDialog
  48. *                TickerTape1DrawFrameOrThumbnailView
  49. *                TickerTape1DrawIconView
  50. *                TickerTape1SetFrameSize
  51. *                TickerTape1GetTextData
  52. *                TickerTape1IsNewText
  53. *                TickerTape1LoadPopupMenu
  54. *                TickerTape1CheckAndAddProperties
  55. *                TickerTape1ExternalizeContent
  56. *                TickerTape1somInit
  57. *                TickerTape1somUninit
  58. *                TickerTape1Draw
  59. *                TickerTape1Externalize
  60. *                TickerTape1FrameShapeChanged
  61. *                TickerTape1HandleEvent
  62. *                TickerTape1FacetAdded
  63. *                TickerTape1FacetRemoved
  64. *                TickerTape1FocusAcquired
  65. *                TickerTape1FocusLost
  66. *                TickerTape1InitPart
  67. *                TickerTape1InitPartFromStorage
  68. *                TickerTape1ViewTypeChanged
  69. *
  70. *  M_TickerTape1 metaclass entry points:
  71. *                M_TickerTape1clsGetODPartHandlerName
  72. *                M_TickerTape1clsGetODPartHandlerDisplayName
  73. *                M_TickerTape1clsGetODPartKinds
  74. *                M_TickerTape1clsGetOLE2ClassId
  75. *                M_TickerTape1clsGetWindowsIconFileName
  76. *
  77. *      (C) COPYRIGHT International Business Machines Corp. 1995
  78. *      All Rights Reserved
  79. *      Licensed Materials - Property of IBM
  80. *
  81. *      US Government Users Restricted Rights - Use, duplication or
  82. *      disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  83. *
  84. *      DISCLAIMER OF WARRANTIES.  The following [enclosed] code is
  85. *      sample code created by IBM Corporation. This sample code is not
  86. *      part of any standard or IBM product and is provided to you solely
  87. *      for the purpose of assisting you in the development of your
  88. *      applications.  The code is provided "AS IS", without
  89. *      warranty of any kind.  IBM shall not be liable for any damages
  90. *      arising out of your use of the sample code, even if they have
  91. *      been advised of the possibility of such damages.
  92. *
  93. ***********************************************************************/
  94. #ifndef SOM_Module_ttape1_Source
  95. #define SOM_Module_ttape1_Source
  96. #endif
  97. #define TickerTape1_Class_Source
  98. #define M_TickerTape1_Class_Source
  99.  
  100. /*
  101.  *  Allow use of underscore prefix to the TickerTape1's instance
  102.  *  variables.  The underscore prefix replaces the use of "somThis->".
  103.  */
  104. #define VARIABLE_MACROS
  105.  
  106. #define INCL_WIN
  107. #define INCL_WINSYS
  108. #define INCL_WINERRORS
  109. #define INCL_GPI
  110. #define INCL_GPIERRORS
  111. #define INCL_DOS
  112. #define INCL_DOSMODULEMGR
  113. #define INCL_DOSRESOURCES
  114. #define INCL_ODAPI
  115. #define INCL_ODCANVAS
  116. #define INCL_ODALTPOINT
  117. #define INCL_ODFACET
  118. #define INCL_ODDRAFT
  119. #define INCL_ODFOCUSSET
  120. #define INCL_ODFRAME
  121. #define INCL_ODSHAPE
  122. #define INCL_ODTRANSFORM
  123. #define INCL_ODSESSION
  124. #define INCL_ODSTORAGEUNIT
  125. #define INCL_ODWINDOW
  126. #define INCL_ODWINDOWSTATE
  127.  
  128. #include <stdio.h>
  129. #include <string.h>
  130. #include <fstream.h>
  131. #include <os2.h>
  132.  
  133. #ifndef SOM_ODPopup_xh  /* Definition for ODPopup */
  134. #include <popup.xh>
  135. #endif
  136.  
  137. #include "ttape1.xih"
  138.  
  139. #include "textdata.hpp"
  140. #include "ttape1.hpp"
  141.  
  142. /*
  143.  *   Prototypes for the utility routines.
  144.  */
  145. void MessageBox(HMODULE, HWND, ULONG, PSZ);
  146. MRESULT EXPENTRY FrameWndProc(HWND, ULONG, MPARAM, MPARAM);
  147. USHORT MenuColorFromRGBColor(RGBColor bgColor);
  148.  
  149. /*
  150.  *
  151.  *    Method(s) :  MessageBox
  152.  *
  153.  *  Description :  A utility routine which displays a message box.  The
  154.  *                 message is obtained from the MessageTable resource
  155.  *                 when provided the message ID.
  156.  *
  157.  *   Parameters :  HMODULE hmod       - Handle to TickerTape1 module.
  158.  *                 HWND    hwndClient - Client window handle.
  159.  *                 ULONG   ulID       - ID which identifies the message.
  160.  *                 PSZ     pszTitle   - Message box title string.
  161.  *
  162.  *      Returns :  VOID
  163.  *
  164.  *        Notes :  N/A
  165.  */
  166. void MessageBox(HMODULE hmMod, HWND hwndClient, ULONG ulID, PSZ pszTitle)
  167. {
  168.     CHAR msg[MESSAGESIZE];
  169.  
  170.     /*
  171.      *  Load the message from the module's message table resource.
  172.      */
  173.     WinLoadMessage(WinQueryAnchorBlock(HWND_DESKTOP),
  174.                    hmMod,
  175.                    ulID,
  176.                    MESSAGESIZE,
  177.                    msg);
  178.  
  179.     /*
  180.      *  Display the message in a PM message box.
  181.      */
  182.     WinMessageBox(HWND_DESKTOP,
  183.                   hwndClient,
  184.                   msg,
  185.                   pszTitle,
  186.                   0,
  187.                   MB_CANCEL|MB_MOVEABLE|MB_ICONEXCLAMATION);
  188. }
  189.  
  190. /*
  191.  *
  192.  *    Method(s) :  FrameWndProc
  193.  *
  194.  *  Description :  A utility routine which handles messages sent to the
  195.  *                 TickerTape1 facet's PM timer window.
  196.  *
  197.  *   Parameters :  HWND    hWnd    - Handle to the PM timer window.
  198.  *                 ULONG   message - The message identity.
  199.  *                 MPARAM  mp1     - The message parameter 1.
  200.  *                 MPARAM  mp2     - The message parameter 2.
  201.  *
  202.  *      Returns :  MRESULT         - Message-return data.
  203.  *
  204.  *        Notes :  N/A
  205.  */
  206. MRESULT EXPENTRY FrameWndProc(HWND   hWnd,
  207.                               ULONG  message,
  208.                               MPARAM mp1,
  209.                               MPARAM mp2)
  210. {
  211.     MRESULT    mresult;
  212.     TickerTape1Part *somSelf; /* Reference to the TickerTape1 SOM object. */
  213.  
  214.     /*
  215.      *  Get the SOM environment information variable.
  216.      */
  217.     Environment *ev = somGetGlobalEnvironment();
  218.  
  219.     ODFacet *facet;      /* The TickerTape1 part's facet. */
  220.  
  221.     /*
  222.      *  Get the reference to the TickerTape1 SOM object.
  223.      */
  224.     somSelf = (TickerTape1Part *)WinQueryWindowULong(hWnd, 0);
  225.  
  226.     /*
  227.      *  Get the reference to the Ticker Tape 1 part's current facet.
  228.      */
  229.     facet = (ODFacet *)WinQueryWindowULong(hWnd, sizeof(ULONG));
  230.  
  231.     /*
  232.      *  Handle the event based on the message sent to the timer window.
  233.      */
  234.     switch (message)
  235.     {
  236.         case WM_DESTROY:   /* About to close the PM timer window. */
  237.             WinStopTimer(WinQueryAnchorBlock(hWnd), hWnd, 0);
  238.             mresult = (MRESULT)0;
  239.             break;
  240.  
  241.         case WM_TIMER:     /* Message from Timer.  Draw the part. */
  242.             somSelf->DrawFrameOrThumbnailView(ev, facet);
  243.             mresult = (MRESULT)1;
  244.             break;
  245.  
  246.         default:
  247.  
  248.             /*
  249.              *  Invoke the default routine for handling messages.
  250.              */
  251.             mresult = frameProc(hWnd, message, mp1, mp2);
  252.     }
  253.  
  254.     return mresult;
  255. }
  256.  
  257. /*
  258.  *
  259.  *    Method(s) :  MenuColorFromRGBColor
  260.  *
  261.  *  Description :  A utility routine which converts the given RGBColor value
  262.  *                 to its corresponding value as a MENUITEM resource.
  263.  *
  264.  *   Parameters :  RGBColor   - The color as an RGB value.
  265.  *
  266.  *      Returns :  USHORT     - the MENUITEM resource value.
  267.  *
  268.  *        Notes :  N/A
  269.  */
  270. USHORT MenuColorFromRGBColor(RGBColor bgColor)
  271. {
  272.     USHORT   usColorItem;  /* The identifier for the menu item. */
  273.     switch (bgColor)
  274.     {
  275.         case CLR_DARKGRAY: /*  Set the identifier to dark gray. */
  276.             usColorItem = IDMA_COLOR_GRAY;
  277.             break;
  278.         case CLR_RED:      /*  Set the identifier to red.       */
  279.             usColorItem = IDMA_COLOR_RED;
  280.             break;
  281.         case CLR_GREEN:    /*  Set the identifier to green.     */
  282.             usColorItem = IDMA_COLOR_GREEN;
  283.             break;
  284.         case CLR_YELLOW:   /*  Set the identifier to yellow.    */
  285.             usColorItem = IDMA_COLOR_YELLOW;
  286.             break;
  287.         case CLR_BLUE:     /*  Set the identifier to blue.      */
  288.             usColorItem = IDMA_COLOR_BLUE;
  289.             break;
  290.         case CLR_DARKPINK: /*  Set the identifier to magenta.   */
  291.             usColorItem = IDMA_COLOR_MAGENTA;
  292.             break;
  293.         case CLR_CYAN:     /*  Set the identifier to cyan.      */
  294.             usColorItem = IDMA_COLOR_CYAN;
  295.             break;
  296.         default:           /*  Set the identifier to white.     */
  297.             usColorItem = IDMA_COLOR_WHITE;
  298.     }
  299.     return usColorItem;
  300. }
  301.  
  302. /*
  303.  *
  304.  *    Method(s) :  TickerTape1CommonInitPart
  305.  *
  306.  *  Description :  Ticker Tape 1 Part initialization common to both the
  307.  *                 InitPart and InitPartFromStorage methods.
  308.  *
  309.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  310.  *                 Environment *ev          - References the SOM environment
  311.  *                                            information.
  312.  *                 CHAR *text               - The initial Ticker Tape text.
  313.  *                 CHAR *filename           - The initial text starting pos.
  314.  *                 TEXTATTRIBUTES textAttr  - Text attributes:
  315.  *                                              - position of first character
  316.  *                                                of text in the window.
  317.  *                                              - index position of first
  318.  *                                                character to display.
  319.  *                                              - Text background color.
  320.  *
  321.  *      Returns :  VOID
  322.  *
  323.  *        Notes :  N/A
  324.  */
  325. SOM_Scope void  SOMLINK TickerTape1CommonInitPart(TickerTape1Part *somSelf,
  326.                                                    Environment *ev,
  327.                                                   char* text,
  328.                                                   char* fileName,
  329.                                                   TEXTATTRIBUTES textAttr)
  330. {
  331.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  332.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1CommonInitPart");
  333.  
  334.     /*
  335.      * Get session in which the TickerTape1's storage unit is running.
  336.      */
  337.     _fSession = somSelf->GetStorageUnit(ev)->GetSession(ev);
  338.  
  339.     /*
  340.      *  Get the selection focus token from the TickerTape1's session.
  341.      */
  342.     _fSelectionFocus = _fSession->Tokenize(ev, kODSelectionFocus);
  343.  
  344.     /*
  345.      *  Obtain tokens representing the frame, large icon, small icon,
  346.      *  and thumbnail views, respectively, of the Ticker Tape 1 part.
  347.      */
  348.     _FrameView       = _fSession->Tokenize(ev, kODViewAsFrame);
  349.     _LargeIconView   = _fSession->Tokenize(ev, kODViewAsLargeIcon);
  350.     _SmallIconView   = _fSession->Tokenize(ev, kODViewAsSmallIcon);
  351.     _ThumbnailView   = _fSession->Tokenize(ev, kODViewAsThumbnail);
  352.  
  353.     /*
  354.      *  Create and initialize the _textArea class, which maintains
  355.      *  the Ticker Tape text and text attributes.
  356.      */
  357.     _textArea = new TextData();
  358.     _textArea->SetTextBuffer(text, textAttr.sGap, textAttr.sScrollPos);
  359.     _textArea->SetBackText(textAttr.lBackText);  /* background color. */
  360.  
  361.     /*
  362.      *  Create and initialize a new File Dialog record.  Initialize with
  363.      *  the filename obtained from InitPart (empty) or InitPartFromStorage.
  364.      */
  365.     memset(&_fild, 0, sizeof(FILEDLG));
  366.     strcpy (_fild.szFullFile, fileName);  /* The text file name. */
  367.     _fild.cbSize = sizeof(FILEDLG);
  368.     _fild.fl = FDS_CENTER | FDS_OPEN_DIALOG;
  369.  
  370.     /*
  371.      *  Load the Popup menu - displayed when user mouse-clicks with MB2.
  372.      */
  373.     somSelf->LoadPopupMenu(ev);
  374. }
  375.  
  376. /*
  377.  *
  378.  *   Method(s) : SetOrigin
  379.  *
  380.  * Description : This method sets the origin coordinates of the facet
  381.  *               in preparation of drawing the Ticker Tape 1 part.
  382.  *
  383.  *  Parameters : TickerTape1Part *somSelf - References the object.
  384.  *               Environment *ev          - References SOM environment
  385.  *                                          information.
  386.  *               ODFacet *facet  - References the facet for this object.
  387.  *               HPS     hpsDraw - Presentation screen handle.
  388.  *
  389.  *     Returns : VOID
  390.  *
  391.  *       Notes : N/A
  392.  */
  393. SOM_Scope void  SOMLINK TickerTape1SetOrigin(TickerTape1Part *somSelf,
  394.                                               Environment *ev,
  395.                                              ODFacet* facet,
  396.                                              HPS hpsDraw)
  397. {
  398.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  399.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1SetOrigin");
  400.  
  401.     /*
  402.      *  Obtain the content transform associated with the part's facet.
  403.      */
  404.      ODCanvas* canvas = facet->GetCanvas(ev);  /* The facet's bias canvas. */
  405.      ODTransform* localToGlobal = facet->AcquireContentTransform(ev, canvas);
  406.  
  407.     /*
  408.      *  Get the transformation matrix from the transform.
  409.      */
  410.     MATRIXLF mtx;
  411.     localToGlobal->GetMATRIXLF(ev, &mtx);
  412.     ODReleaseObject(ev, localToGlobal);
  413.  
  414.     /*
  415.      *  Replace the current model transform in the Presentation Manager with
  416.      *  the one obtained from the transform above.  The transform acts on each
  417.      *  point (x,y).
  418.      */
  419.     GpiSetModelTransformMatrix(hpsDraw, 9, &mtx, TRANSFORM_REPLACE);
  420. }
  421.  
  422. /*
  423.  *
  424.  *    Method(s) :  TickerTape1FileOpenDialog
  425.  *
  426.  *  Description :  This method sets up a Font Dialog Box, which is opened
  427.  *                 for the user to select a new text font and scroll rate.
  428.  *
  429.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  430.  *                 Environment *ev          - References the SOM environment
  431.  *                                            information.
  432.  *
  433.  *      Returns :  VOID
  434.  *
  435.  *        Notes :  N/A
  436.  */
  437. SOM_Scope void  SOMLINK TickerTape1FileOpenDialog(TickerTape1Part *somSelf,
  438.                                                    Environment *ev,
  439.                                                   HWND hwndClient)
  440. {
  441.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  442.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1FileOpenDialog");
  443.  
  444.     HFILE   hfFileHandle;       /* Handle address of the text file.   */
  445.     ULONG   ulAction,           /* Receives action taken by DosOpen.  */
  446.             cbRead;             /* New logical size of the file.      */
  447.     APIRET  rc;                 /* Return code from the file routine. */
  448.     FILESTATUS FileInfo;        /* File Information record.           */
  449.     CHAR   cTitle[MESSAGESIZE]; /* Title of PM dialog & message box.  */
  450.     CHAR  *pszBuf;              /* Temporary buffer for text file.    */
  451.  
  452.     /*
  453.      *  Get the Title string for the "Open Text file" dialog box.
  454.      */
  455.     WinLoadMessage(WinQueryAnchorBlock(HWND_DESKTOP),
  456.                    _hmMod,
  457.                    IDM_OPENTEXTFILE,
  458.                    MESSAGESIZE,
  459.                    cTitle);
  460.  
  461.     /*
  462.      *  Initialize the File Dialog record.
  463.      */
  464.     _fild.pszTitle = cTitle;
  465.  
  466.     /*
  467.      *  Display the File Open Dialog box and get the selected file.
  468.      */
  469.     HWND hwndDlg = WinFileDlg(HWND_DESKTOP, hwndClient, &_fild);
  470.     if ((hwndDlg != NULL) && (_fild.lReturn == DID_OK))
  471.     {
  472.  
  473.         /*
  474.          *  Open the file selected via the File Open Dialog box.
  475.          *  The path name returned is in _fild.szFullFile.
  476.          */
  477.         rc = DosOpen(_fild.szFullFile,    /* File name                */
  478.                      &hfFileHandle,       /* Returned to us           */
  479.                      &ulAction,           /* Action taken             */
  480.                      0,                   /* File Size (N/A)          */
  481.                      FILE_NORMAL,         /* File attributes          */
  482.                      FILE_OPEN,
  483.                      OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE,
  484.                      NULL);               /* EA buffer (N/A)          */
  485.  
  486.         if (rc != 0)  /* If DosOpen failed, display error message.    */
  487.         {
  488.             MessageBox(_hmMod, hwndClient, IDM_ERROROPENING, cTitle);
  489.             return;
  490.         }
  491.  
  492.         /*
  493.          *  Get the file information, specifically the file size.
  494.          */
  495.         DosQueryFileInfo(hfFileHandle,
  496.                           FIL_STANDARD,   /* File Information level   */
  497.                           &FileInfo,
  498.                           sizeof(FileInfo));
  499.  
  500.         /*
  501.          *  If the file size is greater than 32,000 bytes, display
  502.          *  the error message in message box.
  503.          */
  504.         if (FileInfo.cbFile > MAXSIZETEXTFILE)
  505.         {
  506.             MessageBox(_hmMod, hwndClient, IDM_ERRORSIZEFILE, cTitle);
  507.         }
  508.         else
  509.         {
  510.             /*
  511.              *  Allocate a temporary buffer for the text file.
  512.              *  Read the entire text file into this buffer.
  513.              */
  514.             pszBuf = new CHAR[FileInfo.cbFile+1];
  515.             if (pszBuf != NULL)
  516.             {
  517.                 rc = DosRead(hfFileHandle,
  518.                              (PVOID)pszBuf,
  519.                              FileInfo.cbFile,
  520.                              &cbRead);
  521.                 pszBuf[FileInfo.cbFile] = 0;
  522.             }
  523.  
  524.             /*
  525.              * If read failed then display Read failed message.
  526.              */
  527.             if ((rc != 0) || (pszBuf == NULL))
  528.             {
  529.                 MessageBox(_hmMod, hwndClient, IDM_ERRORREADING, cTitle);
  530.             }
  531.             else
  532.             {
  533.                 /*
  534.                  *  Success.  Set the _textArea's text buffer to
  535.                  *  the contents of the temporary buffer.  Set
  536.                  *  "New Ticker Tape Text" to true.
  537.                  */
  538.                 if (_textArea->SetTextBuffer(pszBuf,0,MAXSIZETEXTFILE+1) == 1)
  539.                     _fNewTickerTapeText = kODTrue;
  540.                 else
  541.                     MessageBox(_hmMod, hwndClient, IDM_ERRORREADING, cTitle);
  542.  
  543.             }
  544.             delete [] pszBuf;  /* Delete the temporary buffer. */
  545.         }
  546.         DosClose(hfFileHandle);    /* Close the text file. */
  547.     }
  548. }
  549.  
  550. /*
  551.  *
  552.  *    Method(s) :  TickerTape1DrawFrameOrThumbnailView
  553.  *
  554.  *  Description :  Draw the Ticker Tape 1 part either within its frame or as
  555.  *                 a thumbnail (ie, a thumbnail-size frame).  Draw the Ticker
  556.  *                 Tape content in the provided facet.  Only the visible
  557.  *                 portion of the part needs to be drawn, based on the
  558.  *                 obtained aggregate clip shape.
  559.  *
  560.  *                 This method is invoked whenever the Ticker Tape timer
  561.  *                 window handler receives a TIMER message.
  562.  *
  563.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  564.  *                 Environment *ev          - References the SOM environment
  565.  *                                            information.
  566.  *                 ODFacet *facet           - References the part's facet.
  567.  *
  568.  *      Returns :  VOID
  569.  *
  570.  *        Notes :  N/A
  571.  */
  572. SOM_Scope void  SOMLINK TickerTape1DrawFrameOrThumbnailView(
  573.                                                    TickerTape1Part *somSelf,
  574.                                                    Environment *ev,
  575.                                                    ODFacet* facet)
  576. {
  577.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  578.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1DrawFrameView");
  579.  
  580.     /*
  581.      *  Get PM Presentation Space from the facet.
  582.      */
  583.     ODCanvas * canvas = facet->GetCanvas(ev);
  584.     HPS hpsDraw = canvas->GetPlatformCanvas(ev, kODGPI)->GetPS(ev, facet);
  585.  
  586.     /*
  587.      *  Set the origin for the part's content for PM drawing.
  588.      */
  589.     somSelf->SetOrigin(ev, facet, hpsDraw);
  590.  
  591.     /*
  592.      *  Set up clipping due to overlapping OpenDoc parts.  The clip
  593.      *  shape is initialized by copying the aggregate clip shape
  594.      *  associated with this part's facet.
  595.      */
  596.     ODRgnHandle saveClip;
  597.  
  598.     ODShape *clipShape = facet->GetFrame(ev)->CreateShape(ev);
  599.     ODShape *tempShape = facet->AcquireAggregateClipShape(ev, canvas);
  600.     clipShape->CopyFrom(ev, tempShape);
  601.     ODReleaseObject(ev, tempShape);
  602.  
  603.     /*
  604.      *  The clip shape is transformed by the Frame transform object
  605.      *  to the frame coordinate space of the facet.
  606.      */
  607.     ODTransform* transform = facet->AcquireFrameTransform(ev, canvas);
  608.     clipShape->Transform(ev, transform);
  609.  
  610.     /*
  611.      *  Put the clipping in PM terms.  Set the PM Clip Region.
  612.      *  Save the old PM region handle so the drawing environment can
  613.      *  be restored after the part is drawn.
  614.      */
  615.     ODRgnHandle clip = clipShape->GetRegion(ev);
  616.  
  617.     /*
  618.      *  Free the OpenDoc Shape object created above.
  619.      */
  620.     GpiSetClipRegion(hpsDraw, clip, &saveClip);
  621.  
  622.     /*
  623.      *  Draw the text on PM presentation screen at origin of facet.
  624.      */
  625.     _textArea->DrawTape(hpsDraw);
  626.  
  627.     /*
  628.      *  Reset the Presentation Manager-specific clip region.
  629.      */
  630.     GpiSetClipRegion(hpsDraw, 0, &saveClip);
  631.  
  632.     /*
  633.      *  Release access to the platform-specific drawing structure
  634.      *  (i.e., the Presentation Manager Presentation screen).
  635.      */
  636.     ODReleaseObject(ev, transform);
  637.     ODReleaseObject(ev, clipShape);
  638.     canvas->GetPlatformCanvas(ev, kODGPI)->ReleasePS(ev, facet);
  639. }
  640.  
  641. /*
  642.  *
  643.  *    Method(s) :  TickerTape1DrawIconView
  644.  *
  645.  *  Description :  Draw the Ticker Tape 1 part as a large or small icon.
  646.  *
  647.  *   Parameters :  TickerTape1Part *somSelf - Reference the SOM object.
  648.  *                 Environment *ev          - References the SOM environment
  649.  *                                            information.
  650.  *                 ODFacet *facet   - References the part's facet.
  651.  *                 ODULong size     - The icon size in pixels.  Size is
  652.  *                                    actually the length of one side,
  653.  *                                    either 32 (large), or 16 (small).
  654.  *
  655.  *      Returns :  VOID
  656.  *
  657.  *        Notes :  N/A
  658.  */
  659. SOM_Scope void  SOMLINK TickerTape1DrawIconView(TickerTape1Part *somSelf,
  660.                                                  Environment *ev,
  661.                                                 ODFacet* facet,
  662.                                                 ODULong size)
  663. {
  664.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  665.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1DrawIconView");
  666.  
  667.     BITMAPINFOHEADER2 bmp;   /* Bitmap information header structure. */
  668.     HBITMAP hbm;     /* bitmap handle associated with load from resource.  */
  669.     POINTL aptl[4];  /* target/source coordinate pair array.               */
  670.  
  671.     /*
  672.      *  Get the facet's frame and bias canvas.
  673.      */
  674.     ODFrame* displayFrame = facet->GetFrame(ev);
  675.     ODCanvas* canvas = facet->GetCanvas(ev);
  676.  
  677.     /*
  678.      *  Get the icon's dimensions in terms of OpenDoc's coordinate system.
  679.      */
  680.     ODRect rect;
  681.     ODShape *usedShape = displayFrame->AcquireUsedShape(ev, canvas);
  682.     usedShape->GetBoundingBox(ev, &rect);
  683.     ODRECTL frameRect(rect);
  684.     ODReleaseObject(ev, usedShape);
  685.  
  686.     /*
  687.      *  Get PM Presentation Space from the facet.
  688.      */
  689.     HPS hps = canvas->GetPlatformCanvas(ev, kODGPI)->GetPS(ev, facet);
  690.  
  691.     /*
  692.      *  Set the origin for rendering the icon within the facet.
  693.      */
  694.     somSelf->SetOrigin(ev, facet, hps);
  695.  
  696.     /*
  697.      *  Load the bitmap as a resource identified by IDB_BMP1.
  698.      */
  699.     hbm = GpiLoadBitmap(hps, _hmMod, IDB_BMP1, size, size);
  700.  
  701.     /*
  702.      *  Query the contents of the bitmap information header and,
  703.      *  if successful, perform a BitBlt to the target PS.
  704.      */
  705.     bmp.cbFix = sizeof(bmp);
  706.     if (GpiQueryBitmapInfoHeader(hbm, &bmp) == GPI_OK)
  707.     {
  708.         aptl[0].x = frameRect.xLeft;   /* target rectangle left.            */
  709.         aptl[0].y = frameRect.yBottom; /* target rectangle bottom.          */
  710.         aptl[1].x = frameRect.xRight;  /* target rectangle right.           */
  711.         aptl[1].y = frameRect.yTop;    /* target rectangle top.             */
  712.         aptl[2].x = aptl[2].y = 0;     /* source rectangle left and bottom. */
  713.         aptl[3].x = bmp.cx;            /* source rectangle left.            */
  714.         aptl[3].y = bmp.cy;            /* source rectangle right.           */
  715.  
  716.         /*
  717.          *  Perform a BitBlt of the bitmap to the target PS.
  718.          */
  719.         if (GpiWCBitBlt(hps, hbm, 4, aptl, ROP_SRCCOPY, BBO_IGNORE)==GPI_ERROR)
  720.         {
  721.             DosBeep(700UL, 500UL);
  722.         }
  723.       }
  724.  
  725.     /*
  726.      *  Release access to the platform-specific drawing structure
  727.      *  (i.e., the Presentation Manager Presentation screen).
  728.      */
  729.     canvas->GetPlatformCanvas(ev, kODGPI)->ReleasePS(ev, facet);
  730. }
  731.  
  732. /*
  733.  *
  734.  *    Method(s) :  TickerTape1SetFrameSize
  735.  *
  736.  *  Description :  Set the size of the rectangle the Ticker Tape text is
  737.  *                 drawn in.  The text height is set to the rectangle height.
  738.  *
  739.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  740.  *                 Environment *ev          - References the SOM environment
  741.  *                                            information.
  742.  *                 ODRect  *Rect            - the frame size in terms of an
  743.  *                                            OpenDoc rectangle.
  744.  *
  745.  *      Returns :  VOID
  746.  *
  747.  *        Notes :  N/A
  748.  */
  749. SOM_Scope void  SOMLINK TickerTape1SetFrameSize(TickerTape1Part *somSelf,
  750.                                                  Environment *ev,
  751.                                                 ODRect* Rect)
  752. {
  753.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  754.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1SetFrameSize");
  755.  
  756.     /*
  757.      *  Convert the frame's bounding box coordinates to PM coordinates.
  758.      */
  759.     RECTL rclFrame;
  760.  
  761.     rclFrame.xLeft   = FIXED2LONG(Rect->left);
  762.     rclFrame.xRight  = FIXED2LONG(Rect->right);
  763.     rclFrame.yTop    = FIXED2LONG(Rect->top);
  764.     rclFrame.yBottom = FIXED2LONG(Rect->bottom);
  765.  
  766.     /*
  767.      *  Set the size of the Ticker Tape text box stored in _textArea.
  768.      */
  769.     _textArea->SetSize(&rclFrame);
  770. }
  771.  
  772. /*
  773.  *
  774.  *    Method(s) :  TickerTape1GetTextData
  775.  *
  776.  *  Description :  Get the TextData text-maintenance object owned by Ticker
  777.  *                 Tape 1. This is an accessor method provided for classes
  778.  *                 subclassing from the TickerTape1 class.
  779.  *
  780.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  781.  *                 Environment *ev          - References the SOM environment
  782.  *                                            information.
  783.  *
  784.  *      Returns :  TextData* - the TextData class object.
  785.  *
  786.  *        Notes :  N/A
  787.  */
  788. SOM_Scope TextData*  SOMLINK TickerTape1GetTextData(TickerTape1Part *somSelf,
  789.                                                      Environment *ev)
  790. {
  791.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  792.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1GetTextData");
  793.  
  794.     /* Return statement to be customized: */
  795.     return _textArea;
  796. }
  797.  
  798. /*
  799.  *
  800.  *    Method(s) :  TickerTape1IsNewText
  801.  *
  802.  *  Description :  Returns the value of the fNewTickerTape text variable.
  803.  *                 Allows a subclass to determine if the Ticker Tape text
  804.  *                 has been replaced by text from a file. This is an
  805.  *                 accessor method provided for classes subclassing from
  806.  *                 the TickerTape1 class.
  807.  *
  808.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  809.  *                 Environment *ev          - References the SOM environment
  810.  *                                            information.
  811.  *
  812.  *      Returns :   ODBoolean - the value of fNewTickerTapeText.
  813.  *
  814.  *        Notes :  N/A
  815.  */
  816. SOM_Scope ODBoolean  SOMLINK TickerTape1IsNewText(TickerTape1Part *somSelf,
  817.                                                    Environment *ev)
  818. {
  819.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  820.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1IsNewText");
  821.  
  822.     /* Return statement to be customized: */
  823.     return _fNewTickerTapeText;
  824. }
  825.  
  826. /*
  827.  *
  828.  *    Method(s) :  TickerTape1LoadPopupMenu
  829.  *
  830.  *  Description :  Loads the Popup menu which will be displayed when the
  831.  *                 user mouse-clicks with mouse button 2 over the part.
  832.  *
  833.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  834.  *                 Environment *ev          - References the SOM environment
  835.  *                                            information.
  836.  *
  837.  *      Returns :  VOID
  838.  *
  839.  *        Notes :  N/A
  840.  */
  841. SOM_Scope void  SOMLINK TickerTape1LoadPopupMenu(TickerTape1Part *somSelf,
  842.                                                   Environment *ev)
  843. {
  844.  
  845.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  846.     TickerTape1PartMethodDebug("TickerTape1Part","TickerTape1LoadPopupMenu");
  847.  
  848.     /*
  849.      *  Copy the default popup menu from the session's window state.
  850.      */
  851.     _fPopup = _fSession->GetWindowState(ev)->CopyBasePopup(ev);
  852.  
  853.     /*
  854.      *  If the base popup menu is not NULL customize the Popup menu.
  855.      */
  856.     if (_fPopup != kODNULL)
  857.     {
  858.  
  859.         HWND hwndMenu = NULLHANDLE;  /* The handle to the menu resource. */
  860.         ODPlatformMenuItem mi;       /* The menu item structure.         */
  861.  
  862.         /*
  863.          *  Remove the "Open As" and "Properties" menu items.
  864.          */
  865.         _fPopup->RemoveMenuItem(ev, kODNULL, VIEW_OPENAS);
  866.         _fPopup->RemoveMenuItem(ev, kODNULL, VIEW_PROPERTIES);
  867.  
  868.         /*
  869.          *  Add the "Open Text File..." menu item before the "Show As" item.
  870.          */
  871.         memset((PCH)&mi, 0, sizeof(MENUITEM));
  872.         mi.id = IDMP_FILE_OPEN;
  873.         mi.afStyle = MIS_TEXT;
  874.         _fPopup->AddMenuItemBefore(ev, kODNULL, kODNULL, &mi, VIEW_SHOWAS);
  875.         _fPopup->SetMenuItemText(ev, kODNULL, IDMP_FILE_OPEN,
  876.                                                       "~Open Text File...");
  877.  
  878.         /*
  879.          *  Load up our background color menu from our resource module.
  880.          */
  881.         hwndMenu = WinLoadMenu(HWND_OBJECT, _hmMod, ID_POPUPMENU);
  882.  
  883.         /*
  884.          *  Add the "Background" menu item for selecting background color.
  885.          */
  886.         mi.id = ID_POPUPMENU;
  887.         mi.hwndSubMenu = hwndMenu;
  888.         _fPopup->AddMenuItemBefore(ev, kODNULL, kODNULL, &mi, VIEW_SHOWAS);
  889.         _fPopup->SetMenuItemText(ev, kODNULL, ID_POPUPMENU, "~Background");
  890.  
  891.         /*
  892.          *  Put a check in front of the current view (eg, frame, because the
  893.          *  Popup menu is not accessible when the view type is not frame).
  894.          */
  895.         _fPopup->CheckMenuItem(ev, VIEW_SHOWAS, VIEW_SAFRAME, kODTrue);
  896.  
  897.         /*
  898.          *  Get the current background color.
  899.          */
  900.         RGBColor bgColor = (RGBColor)_textArea->GetBackText();
  901.  
  902.         /*
  903.          *  Get the menu item value corresponding to the color.
  904.          */
  905.         USHORT usColorItem = MenuColorFromRGBColor(bgColor);
  906.  
  907.         /*
  908.          *  Put a check in front of the current background color.
  909.          */
  910.         _fPopup->CheckMenuItem(ev, ID_POPUPMENU, usColorItem, kODTrue);
  911.  
  912.     } /* endif */
  913. }
  914.  
  915. /*
  916.  *
  917.  *    Method(s) :  TickerTape1CheckAndAddProperties
  918.  *
  919.  *  Description :  If the Ticker Tape 1 Part storage unit properties are not
  920.  *                 already there, the properties and their corresponding
  921.  *                 values are added.
  922.  *
  923.  *   Parameters :  TickerTape1Part *somSelf   - References the SOM object.
  924.  *                 Environment *ev            - References the SOM environment
  925.  *                                              information.
  926.  *                 ODStorageUnit *storageUnit - A storage unit belonging
  927.  *                                              either to the part or to a
  928.  *                                              drag and drop operation.
  929.  *
  930.  *      Returns :  VOID
  931.  *
  932.  *        Notes :  N/A
  933.  */
  934. SOM_Scope void  SOMLINK TickerTape1CheckAndAddProperties(
  935.                                                    TickerTape1Part *somSelf,
  936.                                                    Environment *ev,
  937.                                                    ODStorageUnit* storageUnit)
  938. {
  939.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  940.     TickerTape1PartMethodDebug("TickerTape1Part","TickerTape1CheckAndAddProperties");
  941.  
  942.     /*
  943.      *  Add the Contents Property (kODPropContents) to the storage unit.
  944.      *  The Ticker Tape 1 part's contents is the Ticker Tape text which
  945.      *  is displayed within the Ticker Tape window.
  946.      */
  947.     if (!storageUnit->Exists(ev, kODPropContents, kODNULL, 0))
  948.         storageUnit->AddProperty(ev, kODPropContents);
  949.  
  950.     if (!storageUnit->Exists(ev, kODPropContents, kTickerTape1TextType, 0))
  951.         storageUnit->AddValue(ev, kTickerTape1TextType);
  952.  
  953.     /*
  954.      *  Add a Ticker Tape Attributes property (kODPropTickerTapeAttr).
  955.      *  The Ticker Tape 1 part's attribute data includes:
  956.      *  1. the frame negotiation flag - whether an initial frame size has
  957.      *     been negotiated with its containing part.
  958.      *  2. Ticker Tape text attributes, which include:
  959.      *     - the "Gap", or starting position of text within the Ticker
  960.      *       Tape window.
  961.      *     - the "Scroll Position", or position of the starting character
  962.      *       of text to display within the Ticker Tape window.
  963.      *     - the text background color.
  964.      *  3. the file name of the file which contained the Ticker Tape text.
  965.      */
  966.     if (!storageUnit->Exists(ev, kODPropTickerTapeAttr, kODNULL, 0))
  967.         storageUnit->AddProperty(ev, kODPropTickerTapeAttr);
  968.  
  969.     if (!storageUnit->Exists(ev, kODPropTickerTapeAttr,
  970.                                  kTickerTape1AttrType, 0))
  971.         storageUnit->AddValue(ev, kTickerTape1AttrType);
  972.  
  973. }
  974.  
  975. /*
  976.  *
  977.  *    Method(s) :  TickerTape1ExternalizeContent
  978.  *
  979.  *  Description :  Put the Ticker Tape 1 part's intrinsic data into the
  980.  *                 specified storage unit.
  981.  *
  982.  *   Parameters :  TickerTape1Part *somSelf   - References the SOM object.
  983.  *                 Environment *ev            - References the SOM environment
  984.  *                                              information.
  985.  *                 ODStorageUnit *storageUnit - A storage unit belonging either
  986.  *                                              to the part or to a drag and
  987.  *                                              drop operation.
  988.  *                 ODBoolean isPartStorage    - Flag to determine if the
  989.  *                                              storage unit belongs to the
  990.  *                                              part of to a drag and drop
  991.  *                                              operation.
  992.  *
  993.  *      Returns :  VOID
  994.  *
  995.  *        Notes :  N/A
  996.  */
  997. SOM_Scope void  SOMLINK TickerTape1ExternalizeContent(TickerTape1Part *somSelf,
  998.                                                        Environment *ev,
  999.                                                    ODStorageUnit* storageUnit,
  1000.                                                    ODBoolean isPartStorage)
  1001. {
  1002.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1003.     TickerTape1PartMethodDebug("TickerTape1Part",
  1004.                                "TickerTape1ExternalizeContent");
  1005.  
  1006.     /*
  1007.      *  Focus the storage unit on the kODPropTickerTapeAttr contents
  1008.      *  property and the kTickerTape1AttrType property value.
  1009.      */
  1010.     storageUnit->Focus(ev, kODPropTickerTapeAttr, kODPosUndefined,
  1011.                   kTickerTape1AttrType, 0, kODPosUndefined);
  1012.  
  1013.     /*
  1014.      *  Write the contents of the fFrameNegotiated flag (true or false,
  1015.      *  true if an initial frame size has been negotiated).
  1016.      */
  1017.     StorageUnitSetValue(storageUnit,
  1018.                         ev, sizeof(ODBoolean), &_fFrameNegotiated);
  1019.  
  1020.     TEXTATTRIBUTES textAttr;
  1021.     textAttr.sGap       = _textArea->GetGap();
  1022.     textAttr.sScrollPos = _textArea->GetScrollPos();
  1023.     textAttr.lBackText  = _textArea->GetBackText();
  1024.  
  1025.     /*
  1026.      *  Write the position of the text in the window, index position of
  1027.      *  the first character displayed in the window, and the background
  1028.      *  text color to document storage.
  1029.      */
  1030.     StorageUnitSetValue(storageUnit, ev, sizeof(textAttr), &textAttr);
  1031.  
  1032.     /*
  1033.      *  If the Ticker Tape text has been modified, externalize it.
  1034.      */
  1035.     if (_fNewTickerTapeText == kODTrue || isPartStorage == kODFalse)
  1036.     {
  1037.  
  1038.         /*
  1039.          *  Strip the drive and directory path from the text file name.
  1040.          */
  1041.         char *ptr = strrchr(_fild.szFullFile, '\\');
  1042.         if (ptr != NULL)
  1043.             ++ptr;
  1044.         else
  1045.             ptr = _fild.szFullFile;
  1046.  
  1047.         /*
  1048.          *  Write the Ticker Tape text filename to its location in the
  1049.          *  part's storage unit.
  1050.          */
  1051.         StorageUnitSetValue(storageUnit, ev, CCHMAXPATH, ptr);
  1052.  
  1053.         /*
  1054.          *  Focus the storage unit on the kODPropContents contents
  1055.          *  property and the kTickerTape1TextType property value.
  1056.          */
  1057.         storageUnit->Focus(ev, kODPropContents, kODPosUndefined,
  1058.                       kTickerTape1TextType, 0, kODPosUndefined);
  1059.  
  1060.         /*
  1061.          *  Delete the text currently stored in the storage unit.
  1062.          */
  1063.         storageUnit->DeleteValue(ev, storageUnit->GetSize(ev));
  1064.  
  1065.         /*
  1066.          *  Get the Ticker Tape Text length and write the Ticker Tape text.
  1067.          */
  1068.         SHORT sTextSize = _textArea->GetTextFileSize() + 1;
  1069.         StorageUnitSetValue(storageUnit,
  1070.                             ev, sTextSize, _textArea->GetTextBuffer(0));
  1071.  
  1072.         /*
  1073.          *  Because the text has been written to document storage, the
  1074.          *  new ticker tape text flag is now false.
  1075.          */
  1076.         if (isPartStorage == kODTrue)
  1077.             _fNewTickerTapeText = kODFalse;
  1078.     }
  1079. }
  1080.  
  1081. /*
  1082.  *
  1083.  *    Method(s) :  TickerTape1somInit
  1084.  *
  1085.  *  Description :  TickerTape1somInit initializes the newly created
  1086.  *                 Ticker Tape Base object's instance variables.
  1087.  *
  1088.  *   Parameters :  TickerTape1Part *somSelf  - References the SOM object.
  1089.  *
  1090.  *      Returns :  VOID
  1091.  *
  1092.  *        Notes :  N/A
  1093.  */
  1094. SOM_Scope void  SOMLINK TickerTape1somInit(TickerTape1Part *somSelf)
  1095. {
  1096.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1097.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1somInit");
  1098.  
  1099.     /*
  1100.      *  Call the parent (Container Part) somInit method.
  1101.      */
  1102.     TickerTape1Part_parent_ContainerPart_somInit(somSelf);
  1103.  
  1104.     _textArea           = 0;        /* Ticker Tape text data class.   */
  1105.  
  1106.     _fNewTickerTapeText = kODFalse; /* Need to externalize our text?  */
  1107.     _fFrameNegotiated   = kODFalse; /* Was a frame size negotiated?   */
  1108.     _fIsActivated       = kODFalse; /* Has the part been activated?   */
  1109.     _msgWnd             = 0;        /* Handle to PM timer window.     */
  1110.     _fSession           = kODNULL;  /* Our storage unit's session.    */
  1111.  
  1112.     /*
  1113.      *  Get handle to the TickerTape1 class module ("TTAPE1.DLL").
  1114.      */
  1115.     DosQueryModuleHandle(MODULENAME, &_hmMod);
  1116. }
  1117.  
  1118. /*
  1119.  *
  1120.  *    Method(s) :  TickerTape1somUninit
  1121.  *
  1122.  *  Description :  This method uninitializes the TickerTape1 SOM object.
  1123.  *
  1124.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1125.  *
  1126.  *      Returns :  VOID
  1127.  *
  1128.  *        Notes :  N/A
  1129.  */
  1130. SOM_Scope void  SOMLINK TickerTape1somUninit(TickerTape1Part *somSelf)
  1131. {
  1132.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1133.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1somUninit");
  1134.  
  1135.     /*
  1136.      *  Delete the Ticker Tape text-maintenance object.
  1137.      */
  1138.     delete _textArea;
  1139.  
  1140.     /*
  1141.      *  Call the parent (Container Part) somUninit method.
  1142.      */
  1143.     TickerTape1Part_parent_ContainerPart_somUninit(somSelf);
  1144. }
  1145.  
  1146. /*
  1147.  *
  1148.  *    Method(s) :  TickerTape1Draw
  1149.  *
  1150.  *  Description :  This method draws the Ticker Tape 1 part when invoked
  1151.  *                 by OpenDoc.  Draw is invoked whenever the part's
  1152.  *                 contents need to be rendered onto a canvas.  The
  1153.  *                 contents must be rendered whenever it is moved,
  1154.  *                 resized, or loses its focus.
  1155.  *
  1156.  *                 For simplicity, this method does not differentiate
  1157.  *                 between the displaying of the part's content based on
  1158.  *                 whether the canvas is static or dynamic, or onscreen
  1159.  *                 or offscreen.
  1160.  *
  1161.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1162.  *                 Environment *ev          - References the SOM environment
  1163.  *                                            information.
  1164.  *                 ODFacet* facet           - References the part's facet
  1165.  *                 ODShape* invalidShape    - References the update shape,
  1166.  *                                            or the shape to be rendered,
  1167.  *                                            expressed in the facet's
  1168.  *                                            frame coordinate system.
  1169.  *
  1170.  *      Returns :  VOID
  1171.  *
  1172.  *        Notes :  N/A
  1173.  */
  1174. SOM_Scope void  SOMLINK TickerTape1Draw(TickerTape1Part *somSelf,
  1175.                                          Environment *ev, ODFacet* facet,
  1176.                                         ODShape* invalidShape)
  1177. {
  1178.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1179.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1Draw");
  1180.  
  1181.     /*
  1182.      *  Get the current view type - how the part is currently displayed.
  1183.      */
  1184.     ODTypeToken view = facet->GetFrame(ev)->GetViewType(ev);
  1185.  
  1186.     /*
  1187.      *  If the view is large icon invoke DrawIconView with size (length
  1188.      *  of one side) set to LARGEICONSIZE (32 pixels).
  1189.      */
  1190.     if (view == _LargeIconView)
  1191.     {
  1192.         somSelf->DrawIconView(ev, facet, LARGEICONSIZE);
  1193.     }
  1194.  
  1195.     /*
  1196.      *  If the view is small icon invoke DrawIconView with size (length
  1197.      *  of one side) set to SMALLICONSIZE (16 pixels).
  1198.      */
  1199.     else if (view == _SmallIconView)
  1200.     {
  1201.         somSelf->DrawIconView(ev, facet, SMALLICONSIZE);
  1202.     }
  1203.  
  1204.     /*
  1205.      *  If the view is either frame or thumbnail (thumbnail-size frame),
  1206.      *  invoke DrawFrameOrThumbnail view after drawing the parent part.
  1207.      */
  1208.     else
  1209.     {
  1210.         /*
  1211.          *  Draw the container part and its embedded parts.
  1212.          */
  1213.         TickerTape1Part_parent_ContainerPart_Draw(somSelf, ev, facet,
  1214.                                                   invalidShape);
  1215.  
  1216.         somSelf->DrawFrameOrThumbnailView(ev, facet);
  1217.     }
  1218. }
  1219.  
  1220. /*
  1221.  *
  1222.  *    Method(s) :  TickerTape1Externalize
  1223.  *
  1224.  *  Description :  This method writes the Ticker Tape 1 part's persistent
  1225.  *                 information to its OpenDoc storage unit.  The data
  1226.  *                 written to its storage unit includes:
  1227.  *
  1228.  *                 - The Ticker Tape Text.
  1229.  *                 - The text's starting position within the window.
  1230.  *                 - The position of the first character to display
  1231.  *                   within the window.
  1232.  *
  1233.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1234.  *                 Environment *ev          - References the SOM environment
  1235.  *                                            information.
  1236.  *
  1237.  *      Returns :  VOID
  1238.  *
  1239.  *        Notes :  N/A
  1240.  */
  1241. SOM_Scope void  SOMLINK TickerTape1Externalize(TickerTape1Part *somSelf,
  1242.                                                 Environment *ev)
  1243. {
  1244.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1245.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1Externalize");
  1246.  
  1247.     /*
  1248.      *  Externalize the Container Part's persistent data.
  1249.      */
  1250.     TickerTape1Part_parent_ContainerPart_Externalize(somSelf, ev);
  1251.  
  1252.     /*
  1253.      *  Obtain a reference to the TickerTape1 part's storage unit.
  1254.      */
  1255.     ODStorageUnit* su = somSelf->GetStorageUnit(ev);
  1256.  
  1257.     /*
  1258.      *  If not already there, add the Ticker Tape 1 part's properties to
  1259.      *  its storage unit.
  1260.      */
  1261.     somSelf->CheckAndAddProperties(ev, su);
  1262.  
  1263.     /*
  1264.      *  Externalize the Ticker Tape 1 part's intrinsic data to its
  1265.      *  storage unit.
  1266.      */
  1267.     somSelf->ExternalizeContent(ev, su, kODTrue);
  1268.  
  1269. }
  1270.  
  1271. /*
  1272.  *
  1273.  *    Method(s) :  TickerTape1FrameShapeChanged
  1274.  *
  1275.  *  Description :  This method is invoked by OpenDoc when the shape of
  1276.  *                 the Ticker Tape 1 part's frame has changed. The dimensions
  1277.  *                 of the rectangle the Ticker Tape text is drawn in is
  1278.  *                 updated, if the current view of the part is frame view.
  1279.  *
  1280.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1281.  *                 Environment *ev          - References the SOM environment
  1282.  *                                            information.
  1283.  *                 ODFrame *frame   - References the part's display frame.
  1284.  *
  1285.  *      Returns :  VOID
  1286.  *
  1287.  *        Notes :  N/A
  1288.  */
  1289. SOM_Scope void  SOMLINK TickerTape1FrameShapeChanged(TickerTape1Part *somSelf,
  1290.                                                       Environment *ev,
  1291.                                                      ODFrame* frame)
  1292. {
  1293.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1294.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1FrameShapeChanged");
  1295.  
  1296.     /*
  1297.      *  Call the parent (Container Part) FrameShapeChanged method.
  1298.      */
  1299.     TickerTape1Part_parent_ContainerPart_FrameShapeChanged(somSelf,
  1300.                                                           ev,
  1301.                                                           frame);
  1302.  
  1303.     /*
  1304.      *  Get the current view type - how the part is currently displayed.
  1305.      */
  1306.     ODTypeToken view = frame->GetViewType(ev);
  1307.  
  1308.     /*
  1309.      *  If the view is Frame view, update the dimensions of the rectangle
  1310.      *  the Ticker Tape text is drawn in.
  1311.      */
  1312.     if (view == _FrameView)
  1313.     {
  1314.         ODRect Rect;       /* The frame's new rectangle coordinates. */
  1315.         ODCanvas* canvas = kODNULL; /* The frame's drawing space.    */
  1316.  
  1317.         /*
  1318.          *  Get the frame's bounding box coordinates.
  1319.          */
  1320.         ODShape *frameShape = frame->AcquireFrameShape(ev, canvas);
  1321.         frameShape->GetBoundingBox(ev, &Rect);
  1322.         ODReleaseObject(ev, frameShape);
  1323.  
  1324.         /*
  1325.          *  Set the dimensions of the Ticker Tape text's rectangle to
  1326.          *  the dimensions stored in Rect.
  1327.          */
  1328.         somSelf->SetFrameSize(ev, &Rect);
  1329.     }
  1330. }
  1331.  
  1332. /*
  1333.  *
  1334.  *    Method(s) :  TickerTape1HandleEvent
  1335.  *
  1336.  *  Description :  This method handles significant events sent from the
  1337.  *                 OpenDoc Dispatcher  to the Ticker Tape par handler.
  1338.  *                 Handled events include the creation of a Pop-up menu
  1339.  *                 (after the user clicks over the part with mouse
  1340.  *                 button 2) and the selection of the Open Text File
  1341.  *                 dialog box.  All other events are handled by the
  1342.  *                 parent (Container) part handler.
  1343.  *
  1344.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1345.  *                 Environment *ev          - References the SOM environment
  1346.  *                                            information.
  1347.  *                 ODEventData *event       - References event data which
  1348.  *                                            indicates the type of event.
  1349.  *                 ODFrame *frame           - References the part's display
  1350.  *                                            frame.
  1351.  *                 ODFacet *facet           - References the part's facet.
  1352.  *
  1353.  *      Returns :  ODBoolean - kODTrue if the event was handled by this
  1354.  *                             method.  kODFalse if the event was not
  1355.  *                             handled by this method.
  1356.  *
  1357.  *        Notes :  N/A
  1358.  */
  1359. SOM_Scope ODBoolean  SOMLINK TickerTape1HandleEvent(TickerTape1Part *somSelf,
  1360.                                                      Environment *ev,
  1361.                                                     ODEventData* event,
  1362.                                                     ODFrame* frame,
  1363.                                                     ODFacet* facet,
  1364.                                                     ODEventInfo* eventInfo)
  1365. {
  1366.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1367.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1HandleEvent");
  1368.  
  1369.     /*
  1370.      *  Initialize the result flag to indicate that initially no
  1371.      *  event has been handled.
  1372.      */
  1373.     ODBoolean handled = kODFalse;
  1374.     ODCanvas* canvas  = kODNULL;
  1375.  
  1376.     /*
  1377.      *  Handle the event based on the identity of the message provided
  1378.      *  with the event information.  Only certain messages are important
  1379.      *  to this method.
  1380.      */
  1381.     switch (event->msg)
  1382.     {
  1383.  
  1384.         case WM_CONTEXTMENU:
  1385.         {
  1386.             /*
  1387.              *  If the part is not already activated, activate it.
  1388.              */
  1389.             if (_fIsActivated == kODFalse)
  1390.                 somSelf->ActivateFrame(ev, frame);
  1391.  
  1392.             /*
  1393.              *  Display the Popup menu.
  1394.              */
  1395.             _fPopup->Display(ev);
  1396.             handled = kODTrue;
  1397.             event->result = (MRESULT)1; // handled
  1398.         }
  1399.         break;
  1400.  
  1401.         /*
  1402.          *  Command message.  The user has selected from Pop-up menu.
  1403.          */
  1404.         case WM_COMMAND:
  1405.         {
  1406.  
  1407.             /*
  1408.              *  Determine whether the Ticker Tape 1 part is the root part.
  1409.              */
  1410.             ODBoolean isRoot = frame->IsRoot(ev);
  1411.  
  1412.             /*
  1413.              *  Initialize bgColor to black.  If it stays black, then the
  1414.              *  user did not select a new background color.
  1415.              */
  1416.             RGBColor bgColor = CLR_BLACK;
  1417.             LONG  lItem = LONGFROMMP(event->mp1);
  1418.             switch (lItem)
  1419.             {
  1420.                 /*
  1421.                  *  'Open Text File' was selected from the Pop-up Menu.
  1422.                  *  Display the Open Text File dialog box and get the text
  1423.                  *  file the user selects.
  1424.                  */
  1425.                 case IDMP_FILE_OPEN:
  1426.                 {
  1427.                     /*
  1428.                      *  The provided facet is NULL (why?).  Get the facet
  1429.                      *  by iterating thru the frame's facets.
  1430.                      */
  1431.                     ODFrameFacetIterator* facets =
  1432.                     frame->CreateFacetIterator(ev);
  1433.  
  1434.                     /*
  1435.                      *  Get the facet's window handle - use as client window.
  1436.                      */
  1437.                     HWND hwndFacet = facets->First(ev)->GetFacetHWND(ev);
  1438.  
  1439.                     /*
  1440.                      *  Open dialog to allow user to select a text file.
  1441.                      */
  1442.                     somSelf->FileOpenDialog(ev, hwndFacet);
  1443.  
  1444.                     /*
  1445.                      *  If a new text file has been selected, prepare
  1446.                      *  for redraw of text by invalidating the facet.
  1447.                      */
  1448.                     if (_fNewTickerTapeText == kODTrue)
  1449.                     {
  1450.                         canvas = facets->First(ev)->GetCanvas(ev);
  1451.  
  1452.                         /*
  1453.                          *  Force redraw by invalidating the facet.
  1454.                          */
  1455.                         facets->First(ev)->Invalidate(ev, kODNULL, canvas);
  1456.                     }
  1457.  
  1458.                     /*
  1459.                      *  Set handled flag to indicate event was handled.
  1460.                      */
  1461.                     handled = kODTrue;
  1462.                     delete facets;
  1463.                 }
  1464.                 break;
  1465.  
  1466.                 /*
  1467.                  *  'Show as Large Icon' was selected from either the
  1468.                  *  Popup menu or menu bar.  Change view type to Large Icon.
  1469.                  */
  1470.                 case VIEW_SALARGEICON:
  1471.  
  1472.                     if ((_CurrentView != _LargeIconView) &&
  1473.                         (isRoot == kODFalse))
  1474.                         frame->ChangeViewType(ev, _LargeIconView);
  1475.  
  1476.                     /*
  1477.                      *  Set handled flag to indicate event was handled.
  1478.                      */
  1479.                     handled = kODTrue;
  1480.                     break;
  1481.  
  1482.                 /*
  1483.                  *  'Show as Small Icon' was selected from either the
  1484.                  *  Popup menu or menu bar.  Change view type to Small Icon.
  1485.                  */
  1486.                 case VIEW_SASMALLICON:
  1487.  
  1488.                     if ((_CurrentView != _SmallIconView) &&
  1489.                         (isRoot == kODFalse))
  1490.                         frame->ChangeViewType(ev, _SmallIconView);
  1491.  
  1492.                     /*
  1493.                      *  Set handled flag to indicate event was handled.
  1494.                      */
  1495.                     handled = kODTrue;
  1496.                     break;
  1497.  
  1498.                 /*
  1499.                  *  'Show as Thumbnail' was selected from either the
  1500.                  *  Popup menu or menu bar.  Change view type to Thumbnail.
  1501.                  */
  1502.                 case VIEW_SATHUMBNAIL:
  1503.  
  1504.                     if ((_CurrentView != _ThumbnailView) &&
  1505.                         (isRoot == kODFalse))
  1506.                         frame->ChangeViewType(ev, _ThumbnailView);
  1507.  
  1508.                     /*
  1509.                      *  Set handled flag to indicate event was handled.
  1510.                      */
  1511.                     handled = kODTrue;
  1512.                     break;
  1513.  
  1514.                 /*
  1515.                  *  'Show as Frame' was selected from either the
  1516.                  *  Popup menu or menu bar.  Change view type to Frame.
  1517.                  */
  1518.                 case VIEW_SAFRAME:
  1519.  
  1520.                     if (_CurrentView != _FrameView)
  1521.                         frame->ChangeViewType(ev, _FrameView);
  1522.  
  1523.                     /*
  1524.                      *  Set handled flag to indicate event was handled.
  1525.                      */
  1526.                     handled = kODTrue;
  1527.                     break;
  1528.  
  1529.                 default: ; /* Do nothing. */
  1530.             }
  1531.  
  1532.         }
  1533.         break;
  1534.  
  1535.         default: ;  /* Do nothing. */
  1536.     }
  1537.  
  1538.     /*
  1539.      *  If the event wasn't handled here, pass the event to the parent.
  1540.      */
  1541.     if (handled == kODFalse)
  1542.         handled = TickerTape1Part_parent_ContainerPart_HandleEvent(somSelf,
  1543.                                                                ev,
  1544.                                                                event,
  1545.                                                                frame,
  1546.                                                                facet,
  1547.                                                                eventInfo);
  1548.  
  1549.     RGBColor bgColor     = somSelf->GetBGColor(ev);
  1550.     RGBColor currentColor = (RGBColor)_textArea->GetBackText();
  1551.  
  1552.     /*
  1553.      *  If a color was selected then change the background color.  The
  1554.      *  color is changed by calling the parent's set background color
  1555.      *  method.  This is necessary because the parent doesn't provide a
  1556.      *  a background color accessor method.
  1557.      */
  1558.     if (bgColor != currentColor)
  1559.     {
  1560.         /*
  1561.          *  Get the menu item value corresponding to the color.
  1562.          */
  1563.         USHORT usColorItem = MenuColorFromRGBColor(currentColor);
  1564.  
  1565.         /*
  1566.          *  Remove the check in front of the current background color.
  1567.          */
  1568.         _fPopup->CheckMenuItem(ev, ID_POPUPMENU, usColorItem, kODFalse);
  1569.  
  1570.         usColorItem = MenuColorFromRGBColor(bgColor);
  1571.  
  1572.         /*
  1573.          *  Add a check in front of the new background color.
  1574.          */
  1575.         _fPopup->CheckMenuItem(ev, ID_POPUPMENU, usColorItem, kODTrue);
  1576.  
  1577.         /*
  1578.          *  Set the background color for both the ticker tape text and
  1579.          *  he parent container part.
  1580.          */
  1581.         _textArea->SetBackText(bgColor);
  1582.     }
  1583.  
  1584.     return handled;  /* return whether event was handled. */
  1585. }
  1586.  
  1587. /*
  1588.  *
  1589.  *    Method(s) :  TickerTape1FacetAdded
  1590.  *
  1591.  *  Description :  This method handles the addition of a facet to the
  1592.  *                 Ticker Tape Base part's frame.
  1593.  *
  1594.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object
  1595.  *                 Environment *ev          - References the SOM environment
  1596.  *                 ODFacet *facet           - References the added facet.
  1597.  *
  1598.  *      Returns :  VOID
  1599.  *
  1600.  *        Notes :  N/A
  1601.  */
  1602. SOM_Scope void  SOMLINK TickerTape1FacetAdded(TickerTape1Part *somSelf,
  1603.                                                Environment *ev,
  1604.                                               ODFacet* facet)
  1605. {
  1606.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1607.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1FacetAdded");
  1608.  
  1609.     /*
  1610.      *  Notify the parent (Container) part handler that a facet has
  1611.      *  been added to one of its frames.
  1612.      */
  1613.     TickerTape1Part_parent_ContainerPart_FacetAdded(somSelf, ev, facet);
  1614.  
  1615.     /*
  1616.      *  Get the facet's frame and bias canvas.
  1617.      */
  1618.     ODFrame*  frame  = facet->GetFrame(ev);
  1619.     ODCanvas* canvas = facet->GetCanvas(ev);
  1620.  
  1621.     /*
  1622.      *  If the frame is the root frame, activate the frame to prevent OpenDoc
  1623.      *  from getting into an ambiguous state.
  1624.      */
  1625.     if (frame->IsRoot(ev) == kODTrue)     /* Is this frame the root frame? */
  1626.     {
  1627.         somSelf->ActivateFrame(ev, frame);
  1628.  
  1629.         /*
  1630.          *  If frame is the root frame, remove the "Show As" submenu.
  1631.          *  The frame view is the only possible view for the root frame.
  1632.          */
  1633.        _fPopup->RemoveMenuItem(ev, kODNULL, VIEW_SHOWAS);
  1634.     }
  1635.     else
  1636.     {
  1637.         /*
  1638.          *  Negotiate an initial frame size - for a "ticker tape" shape.
  1639.          */
  1640.         if (_fFrameNegotiated == kODFalse)
  1641.         {
  1642.             /*
  1643.              *  Set up initial Ticker Tape size using PM coordinates
  1644.              *  and place in a new OpenDoc shape object.
  1645.              */
  1646.             ODRect newRect = {0, MAKEFIXED(TTAPE1_HEIGHT,0),
  1647.                                  MAKEFIXED(TTAPE1_WIDTH,0), 0};
  1648.  
  1649.             ODShape* newShape = frame->CreateShape(ev);
  1650.             newShape->SetRectangle(ev, &newRect);
  1651.  
  1652.             /*
  1653.              *  Negotiate the display frame size with its containing part.
  1654.              */
  1655.             frame->RequestFrameShape(ev, newShape, canvas);
  1656.             ODReleaseObject(ev, newShape);
  1657.  
  1658.             /*
  1659.              *  Set frame negotiated to True.  If the part was instantiated
  1660.              *  either from its template or as a root part this flag was false.
  1661.              */
  1662.             _fFrameNegotiated = kODTrue;
  1663.         }
  1664.     }
  1665.  
  1666.     /*
  1667.      *  Get the text background color, and invoke the parent's set background
  1668.      *  color method.  This is necessary because the parent doesn't provide
  1669.      *  a background color accessor method.
  1670.      */
  1671.     RGBColor bgColor = (RGBColor)_textArea->GetBackText();
  1672.     somSelf->SetBGColor2(ev, frame, bgColor);
  1673.  
  1674.     /*
  1675.      *  Create and initialize the PM timer window.
  1676.      */
  1677.     if ((_msgWnd = WinCreateWindow(HWND_OBJECT,
  1678.                                    WC_FRAME,
  1679.                                    (PSZ)0,
  1680.                                    0L,
  1681.                                    0,0,0,0,
  1682.                                    HWND_OBJECT,
  1683.                                    HWND_TOP,
  1684.                                    67L,
  1685.                                    (PVOID)0,
  1686.                                    (PVOID)0)) != NULL)
  1687.     {
  1688.  
  1689.         /*
  1690.          *  Install the FrameWndProc routine to handle the messages
  1691.          *  sent to the PM timer window.
  1692.          */
  1693.         frameProc = WinSubclassWindow(_msgWnd, (PFNWP)FrameWndProc);
  1694.  
  1695.         /*
  1696.          *  Store both a reference to the Ticker Tape SOM object and a
  1697.          *  reference to its facet in the PM timer window.
  1698.          */
  1699.         WinSetWindowULong(_msgWnd, 0, (ULONG)somSelf);
  1700.         WinSetWindowULong(_msgWnd, sizeof(ULONG), (ULONG)facet);
  1701.     }
  1702.  
  1703.     /*
  1704.      *  The view type?  Don't know what it is so handle it..
  1705.      */
  1706.     somSelf->ViewTypeChanged(ev, frame);
  1707. }
  1708.  
  1709. /*
  1710.  *
  1711.  *    Method(s) :  TickerTape1FacetRemoved
  1712.  *
  1713.  *  Description :  This method handles the removal of a facet from the
  1714.  *                 Ticker Tape Base part's frame.
  1715.  *
  1716.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1717.  *                 Environment *ev          - References the SOM environment
  1718.  *                                            information.
  1719.  *                 ODFacet *facet           - References the removed facet.
  1720.  *
  1721.  *      Returns :  VOID
  1722.  *
  1723.  *        Notes :  N/A
  1724.  */
  1725. SOM_Scope void  SOMLINK TickerTape1FacetRemoved(TickerTape1Part *somSelf,
  1726.                                                  Environment *ev,
  1727.                                                 ODFacet* facet)
  1728. {
  1729.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1730.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1FacetRemoved");
  1731.  
  1732.     /*
  1733.      *  Close the PM timer window.  Text scrolling is active only while
  1734.      *  the facet is alive.
  1735.      */
  1736.     if (_msgWnd != NULL)
  1737.         WinDestroyWindow(_msgWnd);
  1738.  
  1739.     /*
  1740.      *  Notify the parent (Container) part handler that a facet has
  1741.      *  been removed from one of its frames.
  1742.      */
  1743.     TickerTape1Part_parent_ContainerPart_FacetRemoved(somSelf, ev, facet);
  1744. }
  1745.  
  1746. /*
  1747.  *
  1748.  *    Method(s) :  TickerTape1FocusAcquired
  1749.  *
  1750.  *  Description :  This method handles the acquiring of the focus by the
  1751.  *                 Ticker Tape Base part's frame.
  1752.  *
  1753.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1754.  *                 Environment *ev          - References the SOM environment
  1755.  *                                            information.
  1756.  *                 ODTypeToken focus        - Tokenized representation of the
  1757.  *                                            type of focus acquired.
  1758.  *                 ODFrame *ownerFrame      - Reference to the frame owning
  1759.  *                                            the focus.
  1760.  *
  1761.  *      Returns :  VOID
  1762.  *
  1763.  *        Notes :  N/A
  1764.  */
  1765. SOM_Scope void  SOMLINK TickerTape1FocusAcquired(TickerTape1Part *somSelf,
  1766.                                                   Environment *ev,
  1767.                                                  ODTypeToken focus,
  1768.                                                  ODFrame* ownerFrame)
  1769. {
  1770.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1771.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1FocusAcquired");
  1772.  
  1773.     /*
  1774.      *  Notify the parent (Container) part handler that one of its
  1775.      *  embedded frames has acquired the focus.
  1776.      */
  1777.     TickerTape1Part_parent_ContainerPart_FocusAcquired(somSelf,
  1778.                                                       ev, focus,
  1779.                                                       ownerFrame);
  1780.  
  1781.     /*
  1782.      *  The focus was acquired when the user selected the part.
  1783.      */
  1784.     if (focus == _fSelectionFocus)
  1785.     {
  1786.  
  1787.         _fIsActivated = kODTrue;  /* The part has been activated. */
  1788.  
  1789.         /*
  1790.          *  Stop the text scrolling by stopping the timer.
  1791.          */
  1792.         WinStopTimer(WinQueryAnchorBlock(_msgWnd), _msgWnd, 0);
  1793.  
  1794.         /*
  1795.          *  Tell the _textArea's draw method not to draw the Ticker
  1796.          *  Tape text at a new scroll position.
  1797.          */
  1798.         _textArea->SetNeedToScroll(kODFalse);
  1799.  
  1800.         /*
  1801.          *  Set up redraw of Ticker Tape, which will show any
  1802.          *  embedded parts within the Ticker Tape window.
  1803.          */
  1804.          ODFrameFacetIterator* facets = ownerFrame->CreateFacetIterator(ev);
  1805.  
  1806.          /*
  1807.           *  Force redraw the Ticker Tape by invalidating the facet.
  1808.           */
  1809.          ODCanvas* canvas = facets->First(ev)->GetCanvas(ev);
  1810.          facets->First(ev)->Invalidate(ev, kODNULL, canvas);
  1811.          delete facets;
  1812.     }
  1813. }
  1814.  
  1815. /*
  1816.  *
  1817.  *    Method(s) :  TickerTape1FocusLost
  1818.  *
  1819.  *  Description :  This method handles the losing the focus by the
  1820.  *                 Ticker Tape Base part's frame.
  1821.  *
  1822.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  1823.  *                 Environment *ev          - References the SOM environment
  1824.  *                                            information.
  1825.  *                 ODTypeToken focus        - Tokenized representation of the
  1826.  *                                            type of focus acquired.
  1827.  *                 ODFrame *ownerFrame      - Reference to the frame owning
  1828.  *                                            the focus.
  1829.  *
  1830.  *      Returns :  VOID
  1831.  *
  1832.  *        Notes :  N/A
  1833.  */
  1834. SOM_Scope void  SOMLINK TickerTape1FocusLost(TickerTape1Part *somSelf,
  1835.                                               Environment *ev,
  1836.                                              ODTypeToken focus,
  1837.                                              ODFrame* ownerFrame)
  1838. {
  1839.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1840.     TickerTape1PartMethodDebug("TickerTape1", "TickerTape1FocusLost");
  1841.  
  1842.     /*
  1843.      *  Notify the parent (Container) part handler that one of its
  1844.      *  embedded frames has lost the focus.
  1845.      */
  1846.     TickerTape1Part_parent_ContainerPart_FocusLost(somSelf,
  1847.                                                   ev, focus, ownerFrame);
  1848.  
  1849.     /*
  1850.      *  The focus was lost when the user activated another part.
  1851.      */
  1852.     if (focus == _fSelectionFocus)
  1853.     {
  1854.  
  1855.         _fIsActivated = kODFalse; /* The part is no longer activated. */
  1856.  
  1857.         /*
  1858.          *  Scrolling should be started only if the current view is either
  1859.          *  frame or thumbnail (ie, a thumbnail-size frame).
  1860.          */
  1861.         if ((_CurrentView == _FrameView) || (_CurrentView == _ThumbnailView))
  1862.         {
  1863.             /*
  1864.              *  Get the text scroll rate from the text maintenance object.
  1865.              */
  1866.             LONG lScrollRate = _textArea->GetScrollRate();
  1867.  
  1868.             /*
  1869.              *  Start the text scrolling by starting the timer.
  1870.              */
  1871.             WinStartTimer(WinQueryAnchorBlock(_msgWnd),_msgWnd,0,lScrollRate);
  1872.  
  1873.             /*
  1874.              *  Tell the _textArea's draw method to draw the Ticker Tape
  1875.              *  text at a new scroll position.
  1876.              */
  1877.             _textArea->SetNeedToScroll(kODTrue);
  1878.         }
  1879.     }
  1880. }
  1881.  
  1882. /*
  1883.  *
  1884.  *    Method(s) :  TickerTape1InitPart
  1885.  *
  1886.  *  Description :  This method handles the initialization of the SOM
  1887.  *                 object as a newly-instantiated OpenDoc part.
  1888.  *
  1889.  *                 This method is only called once in the lifetime of
  1890.  *                 the part, when the part is first created for an
  1891.  *                 OpenDoc document and has no persistent data from
  1892.  *                 a previously externalized OpenDoc document.
  1893.  *
  1894.  *   Parameters :  TickerTape1Part *somSelf   - References the SOM object
  1895.  *                 Environment *ev            - References the SOM environment
  1896.  *                 ODStorageUnit *storageUnit - References the part's
  1897.  *                                              document storage unit.
  1898.  *
  1899.  *      Returns :  VOID
  1900.  *
  1901.  *        Notes :  N/A
  1902.  */
  1903. SOM_Scope void  SOMLINK TickerTape1InitPart(TickerTape1Part *somSelf,
  1904.                                              Environment *ev,
  1905.                                             ODStorageUnit* storageUnit,
  1906.                                             ODPart* partWrapper)
  1907. {
  1908.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1909.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1InitPart");
  1910.  
  1911.     /*
  1912.      *  The parent's (Container) part handler InitPart method must be
  1913.      *  called to initialize the parent.
  1914.      */
  1915.     TickerTape1Part_parent_ContainerPart_InitPart(somSelf, ev, storageUnit,
  1916.                                                     partWrapper);
  1917.  
  1918.     CHAR    msg[MESSAGESIZE]; /* Buffer for initial Ticker Tape text. */
  1919.  
  1920.     /*
  1921.     **  Load the welcome message from the message table resource.
  1922.     */
  1923.     WinLoadMessage(WinQueryAnchorBlock(HWND_DESKTOP),
  1924.                    _hmMod, IDM_WELCOME, MESSAGESIZE, msg);
  1925.  
  1926.     /*
  1927.      *  Set the text attributes to the defaults.  The initial gap and
  1928.      *  scroll position values indicate that they must be calculated
  1929.      *  when it comes time to draw the part.
  1930.      */
  1931.     TEXTATTRIBUTES textAttr;
  1932.     textAttr.sGap = 0;
  1933.     textAttr.sScrollPos = MAXSIZETEXTFILE+1;
  1934.     textAttr.lBackText  = CLR_RED;  /* The background color is RED. */
  1935.  
  1936.     /*
  1937.      *  CommonInitPart performs the part initialization which is
  1938.      *  common to both InitPart and InitPartFromStorage.
  1939.      */
  1940.     somSelf->CommonInitPart(ev, msg, "", textAttr);
  1941.  
  1942.     /*
  1943.      *  The new text is the welcome message loaded from the resource file.
  1944.      */
  1945.     _fNewTickerTapeText = kODTrue;
  1946. }
  1947.  
  1948. /*
  1949.  *
  1950.  *    Method(s) :  TickerTape1InitPartFromStorage
  1951.  *
  1952.  *  Description :  This method handles messages the initialization of the
  1953.  *                 SOM object as an OpenDoc part from OpenDoc storage.
  1954.  *
  1955.  *                 This method retrieve's the part's persistent storage
  1956.  *                 data from OpenDoc storage.
  1957.  *
  1958.  *   Parameters :  TickerTape1Part *somSelf   - References the SOM object.
  1959.  *                 Environment *ev            - References the SOM environment
  1960.  *                                              information.
  1961.  *                 ODStorageUnit *storageUnit - References the part's
  1962.  *                                              document storage unit.
  1963.  *
  1964.  *      Returns :  VOID
  1965.  *
  1966.  *        Notes :  N/A
  1967.  */
  1968. SOM_Scope void  SOMLINK TickerTape1InitPartFromStorage(
  1969.                                                      TickerTape1Part *somSelf,
  1970.                                                      Environment *ev,
  1971.                                                     ODStorageUnit* storageUnit,
  1972.                                                      ODPart* partWrapper)
  1973. {
  1974.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  1975.     TickerTape1PartMethodDebug("TickerTape1",
  1976.                                "TickerTape1InitPartFromStorage");
  1977.  
  1978.     /*
  1979.      *  The parent's (Container) part handler InitPartFromStorage
  1980.      *  method must be called initialize the parent from storage.
  1981.      */
  1982.     TickerTape1Part_parent_ContainerPart_InitPartFromStorage(somSelf,
  1983.                                                           ev, storageUnit,
  1984.                                                           partWrapper);
  1985.  
  1986.     CHAR* text;                 /* Temporary buffer for the retrieved text. */
  1987.     CHAR  filename[CCHMAXPATH]; /* file name which contained the text.      */
  1988.  
  1989.     /*
  1990.      *  Focus the part's storage unit on the kODPropTickerTapeAttr
  1991.      *  Property and the kTickerTape1AttrType value type.
  1992.      */
  1993.     storageUnit->Focus(ev, kODPropTickerTapeAttr, kODPosUndefined,
  1994.                        kTickerTape1AttrType, 0, kODPosUndefined);
  1995.  
  1996.     /*
  1997.      *  Read the starting position of the text within the Ticker Tape
  1998.      *  window from the part's storage unit.
  1999.      */
  2000.     StorageUnitGetValue(storageUnit,ev,sizeof(ODBoolean), &_fFrameNegotiated);
  2001.  
  2002.     /*
  2003.      *  Read the starting position of the text within the Ticker Tape
  2004.      *  window from the part's storage unit.
  2005.      */
  2006.     TEXTATTRIBUTES textAttr;
  2007.     StorageUnitGetValue(storageUnit, ev, sizeof(textAttr), &textAttr);
  2008.  
  2009.     /*
  2010.      *  Read the text information, which will be displayed in the
  2011.      *  Ticker Tape window, from the part's storage unit.
  2012.      */
  2013.     StorageUnitGetValue(storageUnit, ev, CCHMAXPATH, filename);
  2014.  
  2015.     /*
  2016.      *  Focus the part's storage unit on the kODPropContents Property
  2017.      *  and the kTickerTape1TextType value type.
  2018.      */
  2019.     storageUnit->Focus(ev, kODPropContents, kODPosUndefined,
  2020.                        kTickerTape1TextType, 0, kODPosUndefined);
  2021.  
  2022.     /*
  2023.      *  Get the size of the text stored in the part's storage unit.
  2024.      */
  2025.     ULONG ulTextSize = storageUnit->GetSize(ev);
  2026.  
  2027.     /*
  2028.      *  Create a temporary buffer for storing the Ticker Tape text.
  2029.      */
  2030.     text = new CHAR [ulTextSize];
  2031.  
  2032.     /*
  2033.      *  Read the text information, which will be displayed in the
  2034.      *  Ticker Tape window, from the part's storage unit.
  2035.      */
  2036.     StorageUnitGetValue(storageUnit, ev, ulTextSize, text);
  2037.  
  2038.     /*
  2039.      *  Mark this draft of the storage unit dirty.  This ensures that
  2040.      *  the draft will be externalized when the document is closed.
  2041.      */
  2042.     storageUnit->GetDraft(ev)->SetChangedFromPrev(ev);
  2043.  
  2044.     /*
  2045.      *  CommonInitPart performs the part initialization which is
  2046.      *  common to both InitPart and InitPartFromStorage.
  2047.      */
  2048.     somSelf->CommonInitPart(ev, text, filename, textAttr);
  2049.  
  2050.     delete [] text;     /* Delete the temporary Ticker Tape text buffer. */
  2051. }
  2052.  
  2053. /*
  2054.  *
  2055.  *    Method(s) :  TickerTape1CloneInto
  2056.  *
  2057.  *  Description :  This method handles the deep copy of the Ticker Tape
  2058.  *                 1 Part's intrinsic data to a storage unit.  This occurs
  2059.  *                 when the Ticker Tape 1 part is being registered as well
  2060.  *                 when it is participating in a drag and drop operation.
  2061.  *
  2062.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  2063.  *                 Environment *ev          - References the SOM environment
  2064.  *                                            information.
  2065.  *                 ODDraftKey  key          - The key for clone operation.
  2066.  *                 ODStorageUnit *toSu      - The storage unit to which the
  2067.  *                                            cloned data will go.
  2068.  *                 ODFrame     *scope       - The scope of the clone.
  2069.  *
  2070.  *      Returns :  VOID
  2071.  *
  2072.  *        Notes :  N/A
  2073.  */
  2074. SOM_Scope void  SOMLINK TickerTape1CloneInto(TickerTape1Part *somSelf,
  2075.                                               Environment *ev,
  2076.                                              ODDraftKey key,
  2077.                                              ODStorageUnit* toSU,
  2078.                                              ODFrame* scope)
  2079. {
  2080.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  2081.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1CloneInto");
  2082.  
  2083.     TickerTape1Part_parent_ContainerPart_CloneInto(somSelf, ev, key, toSU,
  2084.                                                    scope);
  2085.  
  2086.     /*
  2087.      *  If not already there, add the Ticker Tape 1 part's properties to
  2088.      *  the storage unit.
  2089.      */
  2090.     somSelf->CheckAndAddProperties(ev, toSU);
  2091.  
  2092.  
  2093.     /*
  2094.      *  Externalize the Ticker Tape 1 part's intrinsic data to the
  2095.      *  storage unit.
  2096.      */
  2097.     somSelf->ExternalizeContent(ev, toSU, kODFalse);
  2098.  
  2099. }
  2100.  
  2101. /*
  2102.  *
  2103.  *    Method(s) :  TickerTape1ViewTypeChanged
  2104.  *
  2105.  *  Description :  Handle change in view type (eg, from frame to icon, or
  2106.  *                 icon to thumbnail);
  2107.  *
  2108.  *   Parameters :  TickerTape1Part *somSelf - References the SOM object.
  2109.  *                 Environment *ev          - References the SOM environment
  2110.  *                                            information.
  2111.  *                 ODFrame *frame           - References the part's persistent
  2112.  *                                            layout information.
  2113.  *
  2114.  *      Returns :  VOID
  2115.  *
  2116.  *        Notes :  N/A
  2117.  */
  2118. SOM_Scope void  SOMLINK TickerTape1ViewTypeChanged(TickerTape1Part *somSelf,
  2119.                                                     Environment *ev,
  2120.                                                    ODFrame* frame)
  2121. {
  2122.     TickerTape1PartData *somThis = TickerTape1PartGetData(somSelf);
  2123.     TickerTape1PartMethodDebug("TickerTape1","TickerTape1ViewTypeChanged");
  2124.  
  2125.     /*
  2126.      *  Get the new view type - how the part is to be displayed.
  2127.      */
  2128.     ODTypeToken  view = frame->GetViewType(ev);
  2129.  
  2130.     /*
  2131.      *  If the view is null have the part displayed in its frame view.
  2132.      */
  2133.     if (view == kODNullTypeToken)
  2134.     {
  2135.         frame->SetViewType(ev, _FrameView);
  2136.         view = _FrameView;
  2137.     }
  2138.  
  2139.     /*
  2140.      *  If the new view type is either Frame or Thumbnail, and the current
  2141.      *  view is a large or small icon, then start the text scrolling.
  2142.      */
  2143.     if ((view == _FrameView) || (view == _ThumbnailView))
  2144.     {
  2145.  
  2146.         if ((_fIsActivated == kODFalse) || (view == _ThumbnailView))
  2147.         {
  2148.             /*
  2149.              *  Get the text scroll rate from the text maintenance object.
  2150.              */
  2151.             LONG lScrollRate = _textArea->GetScrollRate();
  2152.  
  2153.             /*
  2154.              *  Start the text scrolling by starting the timer.
  2155.              */
  2156.             WinStartTimer(WinQueryAnchorBlock(_msgWnd),_msgWnd,0, lScrollRate);
  2157.  
  2158.             /*
  2159.              *  Set need to scroll to true to invalidate the background.
  2160.              */
  2161.             _textArea->SetNeedToScroll(kODTrue);
  2162.  
  2163.         }
  2164.         else
  2165.         {
  2166.             _textArea->SetNeedToScroll(kODFalse);
  2167.         }
  2168.     }
  2169.  
  2170.     /*
  2171.      *  If the new view type is either a small or large icon, and the current
  2172.      *  view is a frame or thumbnail, then stop the text scrolling.
  2173.      */
  2174.     else if ((view == _LargeIconView) || (view == _SmallIconView))
  2175.     {
  2176.         /*
  2177.          *  Stop the text scrolling by stopping the timer.
  2178.          */
  2179.         WinStopTimer(WinQueryAnchorBlock(_msgWnd), _msgWnd, 0);
  2180.     }
  2181.  
  2182.     /*
  2183.      *  Get the facet from the frame's facet iterator.
  2184.      *  Get the facet's bias canvas.
  2185.      */
  2186.     ODFrameFacetIterator* facets = frame->CreateFacetIterator(ev);
  2187.     ODFacet*  facet  = facets->First(ev);
  2188.     ODCanvas* canvas = kODNULL;
  2189.  
  2190.     ODRect Rect = {0, 0, 0, 0}; /* Rectangle containing the used shape size. */
  2191.  
  2192.     /*
  2193.      *  If the new view is Frame View then set the used shape back to the
  2194.      *  frame shape.  Get the frame's bounding box and set the Ticker Tape
  2195.      *  text's rectangle to the bounding box dimensions.
  2196.      */
  2197.     if (view == _FrameView)
  2198.     {
  2199.         // Reset used shape to frame shape
  2200.         frame->ChangeUsedShape(ev, kODNULL, canvas);
  2201.  
  2202.         /*
  2203.          *  Get the frame's bounding box coordinates.
  2204.          */
  2205.         ODShape *frameShape = frame->AcquireFrameShape(ev, canvas);
  2206.         frameShape->GetBoundingBox(ev, &Rect);
  2207.         somSelf->SetFrameSize(ev, &Rect);
  2208.         ODReleaseObject(ev, frameShape);
  2209.  
  2210.         /*
  2211.          *  The current view is now the large icon view.
  2212.          */
  2213.         _CurrentView = _FrameView;
  2214.     }
  2215.     else
  2216.     {
  2217.  
  2218.         /*
  2219.          *  Create a new used shape.  The new shape is initially a copy
  2220.          *  of the frame shape.
  2221.          */
  2222.         ODShape* newUsedShape = frame->CreateShape(ev);
  2223.         ODShape* tempShape    = frame->AcquireFrameShape(ev, canvas);
  2224.         newUsedShape->CopyFrom(ev, tempShape);
  2225.         ODReleaseObject(ev, tempShape);
  2226.  
  2227.         /*
  2228.          *  If the new view is the large icon view set the new used shape
  2229.          *  rectangle dimensions to the Large icon size dimensions.
  2230.          */
  2231.         if (view == _LargeIconView)
  2232.         {
  2233.             Rect.right  = MAKEFIXED(LARGEICONSIZE,0);
  2234.             Rect.top    = MAKEFIXED(LARGEICONSIZE,0);
  2235.  
  2236.             /*
  2237.              *  The current view is now the large icon view.
  2238.              */
  2239.             _CurrentView = _LargeIconView;
  2240.         }
  2241.  
  2242.         /*
  2243.          *  If the new view is the small icon view set the new used shape
  2244.          *  rectangle dimensions to the small icon size dimensions.
  2245.          */
  2246.         else if (view == _SmallIconView)
  2247.         {
  2248.             Rect.right  = MAKEFIXED(SMALLICONSIZE,0);
  2249.             Rect.top    = MAKEFIXED(SMALLICONSIZE,0);
  2250.  
  2251.             /*
  2252.              *  The current view is now the small icon view.
  2253.              */
  2254.             _CurrentView = _SmallIconView;
  2255.         }
  2256.  
  2257.         /*
  2258.          *  If the new view is the thumbnail view set the new used shape
  2259.          *  rectangle dimensions to the thumbnail size dimensions.
  2260.          */
  2261.         else if (view == _ThumbnailView)
  2262.         {
  2263.             Rect.right  = MAKEFIXED(THUMBNAILSIZE,0);
  2264.             Rect.top    = MAKEFIXED(THUMBNAILSIZE,0);
  2265.  
  2266.             somSelf->SetFrameSize(ev, &Rect);
  2267.  
  2268.             /*
  2269.              *  The current view is now the thumbnail view.
  2270.              */
  2271.             _CurrentView = _ThumbnailView;
  2272.         }
  2273.  
  2274.         /*
  2275.          *  Set the rectangle dimensions of the new used shape.
  2276.          */
  2277.         newUsedShape->SetRectangle(ev, &Rect);
  2278.  
  2279.         /*
  2280.          *  Set the used shape to the new used shape created above.
  2281.          */
  2282.         frame->ChangeUsedShape(ev, newUsedShape, canvas);
  2283.         ODReleaseObject(ev, newUsedShape);
  2284.     }
  2285.  
  2286.     /*
  2287.      *  Force a redraw of the containing part.
  2288.      */
  2289.     ODFrame *containingFrame = frame->AcquireContainingFrame(ev);
  2290.     if (containingFrame != kODNULL)
  2291.     {
  2292.         containingFrame->Invalidate(ev, kODNULL, canvas);
  2293.         ODReleaseObject(ev, containingFrame);
  2294.     }
  2295.     delete facets;
  2296. }
  2297.  
  2298. /*
  2299.  *
  2300.  *    Method(s) :  M_TickerTape1clsGetODPartHandlerName
  2301.  *
  2302.  *  Description :  Return the SOM class name (TickerTape1) to the registration
  2303.  *                 process.
  2304.  *
  2305.  *   Parameters :  M_TickerTape1 *somSelf - References the SOM object.
  2306.  *                 Environment *ev        - References the SOM environment
  2307.  *                                          information.
  2308.  *
  2309.  *      Returns :  VOID
  2310.  *
  2311.  *        Notes :  N/A
  2312.  */
  2313. SOM_Scope ISOString  SOMLINK M_TickerTape1clsGetODPartHandlerName(
  2314.                                                      M_TickerTape1 *somSelf,
  2315.                                                      Environment *ev)
  2316. {
  2317.     /* M_TickerTape1PartData *somThis = M_TickerTape1GetData(somSelf); */
  2318.     M_TickerTape1MethodDebug("M_TickerTape1",
  2319.                                       "M_TickerTape1clsGetODPartHandlerName");
  2320.  
  2321.     /*
  2322.      *  Set string to the Part Handler, or SOM class, name ("TickerTape1").
  2323.      */
  2324.     string handlerName = kPartHandlerName;
  2325.     return (ISOString) handlerName;   /* return the SOM class name. */
  2326. }
  2327.  
  2328. /*
  2329.  *
  2330.  *    Method(s) :  M_TickerTape1clsGetODPartHandlerDisplayName
  2331.  *
  2332.  *  Description :  Return the part handler name OpenDoc will associate with
  2333.  *                 its template (Ticker Tape 1 Part) to the registration
  2334.  *                 process.
  2335.  *
  2336.  *   Parameters :  M_TickerTape1 *somSelf - References the SOM object.
  2337.  *                 Environment *ev        - References the SOM environment
  2338.  *                                          information.
  2339.  *
  2340.  *      Returns :  VOID
  2341.  *
  2342.  *        Notes :  N/A
  2343.  */
  2344. SOM_Scope string  SOMLINK M_TickerTape1clsGetODPartHandlerDisplayName(
  2345.                                                      M_TickerTape1 *somSelf,
  2346.                                                      Environment *ev)
  2347. {
  2348.     /* M_TickerTape1PartData *somThis = M_TickerTape1GetData(somSelf); */
  2349.     M_TickerTape1MethodDebug("M_TickerTape1",
  2350.                               "M_TickerTape1clsGetODPartHandlerDisplayName");
  2351.  
  2352.     /*
  2353.      *  Set string to the Part Handler Display name ("Ticker Tape 1 Part").
  2354.      */
  2355.     string displayName =  kPartHandlerDisplayName;
  2356.     return displayName;   /* Return the Part Handler Display name. */
  2357. }
  2358.  
  2359. /*
  2360.  *
  2361.  *    Method(s) :  M_TickerTape1clsGetODPartKinds
  2362.  *
  2363.  *  Description :  Return the Ticker Tape 1 part handler's Part Kind data to
  2364.  *                 the registration process.  Place the data in a record
  2365.  *                 structure _IDL_SEQUENCE_PartKindInfo and return the record.
  2366.  *
  2367.  *   Parameters :  M_TickerTape1 *somSelf - References the SOM object.
  2368.  *                 Environment *ev        - References the SOM environment
  2369.  *                                          information.
  2370.  *
  2371.  *      Returns :  VOID
  2372.  *
  2373.  *        Notes :  N/A
  2374.  */
  2375. SOM_Scope _IDL_SEQUENCE_PartKindInfo  SOMLINK M_TickerTape1clsGetODPartKinds(
  2376.                                                       M_TickerTape1 *somSelf,
  2377.                                                       Environment *ev)
  2378. {
  2379.     /* M_TickerTape1Data *somThis = M_TickerTape1GetData(somSelf); */
  2380.     M_TickerTape1MethodDebug("M_TickerTape1","M_TickerTape1clsGetODPartKinds");
  2381.  
  2382.     /*
  2383.      *  Structure which contains the part's part kind information.  This is
  2384.      *  information about the data types the part supports.
  2385.      */
  2386.     _IDL_SEQUENCE_PartKindInfo TickerTape1Info;
  2387.  
  2388.     /*
  2389.      *  Create structure PartKindInfo and allocate memory for its data items.
  2390.      */
  2391.     PartKindInfo * info = (PartKindInfo *)SOMMalloc(sizeof(PartKindInfo));
  2392.     info->partKindName = (ISOString) SOMMalloc(strlen(kKindTickerTape1Part)+1);
  2393.  
  2394.     info->partKindDisplayName =
  2395.                       (string)SOMMalloc(strlen(kTickerTape1KindDisplayName)+1);
  2396.     info->filenameFilters =  (string)SOMMalloc(strlen("")+1);
  2397.     info->filenameTypes =  (string)SOMMalloc(strlen("")+1);
  2398.     info->categories =  (string)SOMMalloc(strlen(kODCategoryPlainText)+1);
  2399.     info->categoryDisplayName = (string)SOMMalloc(strlen("Text")+1);
  2400.  
  2401.     info->objectID =  (string)SOMMalloc(strlen("") + 1);
  2402.  
  2403.     /*
  2404.      *  Copy the information into the structure.
  2405.      */
  2406.     strcpy(info->partKindName , kKindTickerTape1Part);
  2407.     strcpy(info->partKindDisplayName, kTickerTape1KindDisplayName);
  2408.     strcpy(info->filenameFilters, "");
  2409.     strcpy(info->filenameTypes, "");
  2410.     strcpy(info->categories, kODCategoryPlainText);
  2411.     strcpy(info->categoryDisplayName, "Text");
  2412.     strcpy(info->objectID, "");
  2413.  
  2414.     /*
  2415.      *  The number of items stored in the TickerTape1Info record is 1.
  2416.      */
  2417.     TickerTape1Info._maximum = 1;
  2418.     TickerTape1Info._length = 1;
  2419.     TickerTape1Info._buffer = info;
  2420.  
  2421.     return TickerTape1Info;  /*  Return the part kind data information. */
  2422. }
  2423.  
  2424. /*
  2425.  *
  2426.  *    Method(s) :  M_TickerTape1clsGetOLE2ClassId
  2427.  *
  2428.  *  Description :  Return the OLE 2 Identifier to the registration process.
  2429.  *
  2430.  *   Parameters :  M_TickerTape1 *somSelf - References the SOM object.
  2431.  *                 Environment *ev        - References the SOM environment
  2432.  *                                          information.
  2433.  *
  2434.  *      Returns :  VOID
  2435.  *
  2436.  *        Notes :  N/A
  2437.  */
  2438. SOM_Scope string  SOMLINK M_TickerTape1clsGetOLE2ClassId(
  2439.                                                       M_TickerTape1 *somSelf,
  2440.                                                          Environment *ev)
  2441. {
  2442.     /* M_TickerTape1Data *somThis = M_TickerTape1GetData(somSelf); */
  2443.     M_TickerTape1MethodDebug("M_TickerTape1","M_TickerTape1clsGetOLE2ClassId");
  2444.  
  2445.     /*
  2446.      *  The OLE 2 class identifier is currently empty.
  2447.      */
  2448.     string classID = "";
  2449.     return classID;  /*  Return the empty string. */
  2450. }
  2451.  
  2452. /*
  2453.  *
  2454.  *    Method(s) :  M_TickerTape1clsGetWindowsIconFileName
  2455.  *
  2456.  *  Description :  Return the file name of the icon to be associated with
  2457.  *                 the Ticker Tape 1 part handler's template to the
  2458.  *                 registration process.
  2459.  *
  2460.  *   Parameters :  M_TickerTape1 *somSelf - References the SOM object.
  2461.  *                 Environment *ev        - References the SOM environment
  2462.  *                                          information.
  2463.  *
  2464.  *      Returns :  VOID
  2465.  *
  2466.  *        Notes :  N/A
  2467.  */
  2468. SOM_Scope string  SOMLINK M_TickerTape1clsGetWindowsIconFileName(
  2469.                                                      M_TickerTape1 *somSelf,
  2470.                                                      Environment *ev)
  2471. {
  2472.     /* M_TickerTape1Data *somThis = M_TickerTape1GetData(somSelf); */
  2473.     M_TickerTape1MethodDebug("M_TickerTape1",
  2474.                              "M_TickerTape1clsGetWindowsIconFileName");
  2475.  
  2476.     /*
  2477.      *  There is no icon associated with the Ticker Tape 1 part handler.
  2478.      */
  2479.     string fileName = "";
  2480.     return fileName;  /*  Return the empty string. */
  2481. }
  2482.  
  2483.