home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osp1.exe / src / dynamicp / binit / iexternz.c < prev    next >
Text File  |  1997-04-02  |  5KB  |  105 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/binit/iexternz.c, oddynamicpart, od96os2, odos29712d 11/1/96 08:49:37 [3/21/97 17:44:44]
  28. *******************************************************************
  29. ** Name: void Externalize
  30. **
  31. ** Description:  Saves intrinsic content to a storage unit.
  32. **
  33. *******************************************************************
  34. */
  35. try {
  36.  
  37.   // set up storage unit
  38.   // add property to store part identifier
  39.   ODSUForceFocus(ev, toSU, kODPropPart, kODISOStr);
  40.   StorageUnitSetValue(toSU, ev, strlen(kPartTestDynamicPart)+1, (ODValue)kPartTestDynamicPart);
  41.  
  42.   // add property for part kind
  43.   if (!toSU->Exists(ev, kODPropContents, kKindTestDynamicPart, 0)) {
  44.     toSU->AddProperty(ev, kODPropContents)->AddValue(ev, kKindTestDynamicPart);
  45.   } /* endif */
  46.  
  47.   // write values to storage unit
  48.  
  49.   toSU->Focus(ev, kODPropContents, kODPosUndefined, kKindTestDynamicPart, 0, kODPosUndefined);
  50.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, _scrollTimerRate);
  51.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, _rotateTimerRate);
  52.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, _JumpRate);
  53.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, _ScrollPos);
  54.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _fFrameNegotiated);
  55. // store color attributes.
  56.   ODSByte colorMix = 0;
  57.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _customBackground);
  58.   if (_customBackground) {
  59.     colorMix = _BackColor.redMix();   StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  60.     colorMix = _BackColor.greenMix(); StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  61.     colorMix = _BackColor.blueMix();  StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  62.   } /* endif */
  63.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _customTextColor);
  64.   if (_customTextColor) {
  65.     colorMix = _TextColor.redMix();   StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  66.     colorMix = _TextColor.greenMix(); StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  67.     colorMix = _TextColor.blueMix();  StorageUnitSetValue(toSU, ev, sizeof(colorMix), &colorMix);
  68.   } /* endif */
  69.   ODSLong degrees = 0;
  70. // store angles in degrees
  71.   degrees = _xRotAngle * 180 / pi;
  72.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, degrees);
  73.  
  74.   degrees = _xAngleDelta * 180 / pi;
  75.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, degrees);
  76.   degrees = _hShearAngle * 180 / pi;
  77.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, degrees);
  78.   degrees = _vShearAngle * 180 / pi;
  79.   ODSetSLongProp(ev, toSU, kODNULL, kODNULL, degrees);
  80.   // are we scrolling/rotating
  81.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _scrolling);
  82.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _xRotateActive);
  83.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _hShearActive);
  84.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _vShearActive);
  85.   // which directions
  86.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _xRotateClockwise);
  87.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _hShearRight);
  88.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _vShearUp);
  89.  
  90.   // save the font, if necessary
  91.   ODSetBooleanProp(ev, toSU, kODNULL, kODNULL, _customFont);
  92.   if (_customFont) {
  93.     ODSetISOStrProp(ev, toSU, kODNULL, kODNULL, (char *)_Font->name());
  94.   } /* endif */
  95.  
  96.   // add property for string representation
  97.   if (!toSU->Exists(ev, kODPropContents, kODISOStr, 0)) {
  98.     toSU->AddProperty(ev, kODPropContents)->AddValue(ev, kODISOStr);
  99.   } /* endif */
  100.   // now save the text
  101.   ODSetISOStrProp(ev, toSU, kODPropContents, kODISOStr, (char *)_Message->text() );
  102. } catch (...) {
  103.   reportAnyException(ev);
  104. } /* end try */
  105.