home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / dynamicp / bdraw / dcominit.c < prev    next >
Text File  |  1997-04-02  |  3KB  |  84 lines

  1. /*====START_GENERATED_PROLOG======================================
  2.  */
  3. /*
  4.  *   COMPONENT_NAME: oddynamicpart
  5.  *
  6.  *   CLASSES: none
  7.  *
  8.  *   ORIGINS: 82,27
  9.  *
  10.  *
  11.  *   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  12.  *   All Rights Reserved
  13.  *   Licensed Materials - Property of IBM
  14.  *   US Government Users Restricted Rights - Use, duplication or
  15.  *   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  16.  *       
  17.  *   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  18.  *   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  19.  *   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  20.  *   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  21.  *   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  22.  *   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  23.  *   OR PERFORMANCE OF THIS SOFTWARE.
  24.  */
  25. /*====END_GENERATED_PROLOG========================================
  26.  */
  27. /* @(#) 1.4 com/src/samples/dynamicp/bdraw/dcominit.c, oddynamicpart, od96os2, odos29712d 11/1/96 08:48:37 [3/21/97 17:44:34]
  28. *******************************************************************
  29. ** Name: void CommonInit
  30. **
  31. ** Description:  Initialize instance variables needed to draw the
  32. **               part.
  33. **
  34. *******************************************************************
  35. */
  36. try {
  37.     // Setting the Background and Fill color for the Graphic Context I draw to
  38.     IdColor TextColor1(IColor::red);
  39.     _TextColor   = TextColor1;
  40.     IdColor TextColor2(IColor::white);
  41.     _BackColor = TextColor2;
  42.    // number of pixels skipped each time interval
  43.     _JumpRate = drawXdimension / 80;
  44.     // start scroll position at right edge of frame
  45.     _ScrollPos=   drawXdimension;
  46.  
  47.     string  ModulePathName = kDynamicPartFileName;
  48.     // or, you can use the following code to gather the dll name at runtime
  49.     //   SOMClassMgrObject->somLocateClassFile(
  50.     //                                   SOM_IdFromString(kPartHandlerName),
  51.     //                                   DynamicPart_MajorVersion, DynamicPart_MinorVersion);
  52.     // load bitmap resources
  53.     if (_ODBitmap)
  54.       delete _ODBitmap;
  55. #ifdef _PLATFORM_WIN32_
  56.     // loading from a resource loses colors, so load from a file
  57.     char bitmapname[256];
  58.     bitmapname[0] = '\0';
  59.     _searchenv("ioddynam.bmp", "PATH", bitmapname);
  60.     if (bitmapname[0] == '\0') {
  61. #endif
  62.       IDynamicLinkLibrary x(ModulePathName);
  63.       IBitmapHandle ibh = x.loadBitmap(ODBMP);
  64.       _ODBitmap = new IGBitmap(ibh);
  65. #ifdef _PLATFORM_WIN32_
  66.     } else {
  67.       _ODBitmap = new IGBitmap(IString(bitmapname));
  68.     } /* endif */
  69. #endif
  70.     // Determine font for message strings
  71.     long FontSize = drawYdimension/20;
  72.     if (_Font)
  73.        delete _Font;
  74.     _Font = new IFont("",FontSize,FALSE,TRUE);
  75.     _Font->setPointSize(FontSize);
  76.     _Font->useBitmapOnly(false);
  77.     _Font->useNonPropOnly(false);
  78.     _Font->useVectorOnly(true);
  79.     // load string resources
  80.     _Message =new IGString(_Resources->loadString(DYNAMICPART_DEFAULTMESSAGE), IPoint(0,0), *_Font );
  81. } catch (IException &exc) {
  82.    reportIException(exc);
  83. } /* end try */
  84.