home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / lib / mac / UserInterface / CPatternProgressBar.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  15.1 KB  |  518 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19. #ifdef PowerPlant_PCH
  20. #include PowerPlant_PCH
  21. #endif
  22.  
  23. #include <LView.h>
  24. #include <UDrawingState.h>
  25.  
  26. #include "CPatternProgressBar.h"
  27. #include "CSharedPatternWorld.h"
  28. #include "CGWorld.h"
  29. #include "UGraphicGizmos.h"
  30. #ifdef MOZ_OFFLINE
  31. #include "UOffline.h"
  32. #endif
  33.  
  34. const ResIDT cOfflineListID = 16010;
  35. const Int16 cOfflineStrIndex = 3;
  36.  
  37. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  38. //
  39. #pragma mark --- CPatternProgressBar ---
  40. //
  41. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  42.  
  43. CPatternProgressBar::CPatternProgressBar(LStream* inStream)
  44.     :    LPane(inStream)
  45. {
  46.     ResIDT thePatternID;
  47.     *inStream >> thePatternID;
  48.     *inStream >> mOrientation;
  49.             
  50.     mPatternWorld = CSharedPatternWorld::CreateSharedPatternWorld(thePatternID);
  51.     ThrowIfNULL_(mPatternWorld);
  52.     mPatternWorld->AddUser(this);
  53.  
  54.     mPatOffset = 0;
  55.     mValue = eSeamless;
  56. }
  57.  
  58. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  59. //    Ñ
  60. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  61.  
  62. CPatternProgressBar::~CPatternProgressBar()
  63. {
  64.     mPatternWorld->RemoveUser(this);
  65. }
  66.  
  67. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  68. //    Ñ
  69. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  70.  
  71. void CPatternProgressBar::FinishCreateSelf(void)
  72. {
  73.     LPane::FinishCreateSelf();
  74. //    SetValueRange(Range32T(0,100));
  75.     mValueRange = 100;
  76.     RecalcPoleMasks();
  77. }
  78.  
  79. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  80. //    Ñ
  81. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  82.  
  83. void CPatternProgressBar::ActivateSelf(void)
  84. {
  85.     if (FocusExposed())
  86.         Refresh(); //Draw(NULL);
  87. }
  88.  
  89. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  90. //    Ñ
  91. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  92.  
  93. void CPatternProgressBar::DeactivateSelf(void)
  94. {
  95.     if (FocusExposed())
  96.         Refresh(); //Draw(NULL);
  97. }
  98.  
  99. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  100. //    Ñ
  101. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  102.  
  103. void CPatternProgressBar::DrawSelf(void)
  104. {
  105.     Rect theFrame;
  106.     CalcLocalFrameRect(theFrame);
  107.     
  108.     Int32 theValue = GetValue();
  109.     if (theValue == eIndefinite)
  110.         DrawIndefiniteBar(theFrame);
  111.     else if (theValue == eSeamless)
  112.         DrawSeamlessBar(theFrame);
  113.     else
  114.         DrawPercentageBar(theFrame);
  115. }
  116.  
  117. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  118. //    Ñ
  119. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  120.  
  121. void CPatternProgressBar::DrawIndefiniteBar(const Rect& inBounds)
  122. {
  123.     Rect theBoundsCopy = inBounds;
  124.  
  125.     // First we need to fill, bevel and recess the bar area
  126.     Point theAlignment;
  127.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  128.  
  129.     CGrafPtr thePort;
  130.     ::GetPort(&(GrafPtr)thePort);
  131.     mPatternWorld->Fill(thePort, inBounds, theAlignment);
  132.     UGraphicGizmos::BevelTintRect(theBoundsCopy, -1, 0x4000, 0x4000);
  133.     ::InsetRect(&theBoundsCopy, 1, 1);
  134.     UGraphicGizmos::LowerColorVolume(theBoundsCopy, 0x2000);
  135.  
  136.     // Get our drawing port, and save the origin state.
  137.     // Don't assume we are onscreen (GetMacPort() would do that).
  138.     StPortOriginState theOriginSaver((GrafPtr)thePort);
  139.  
  140.     // fake the pattern into thinking it's drawn somewhere else    
  141.     Point theOrigin;
  142.     theOrigin.h = thePort->portRect.left;
  143.     theOrigin.v = thePort->portRect.top;
  144.     ::SetOrigin(theOrigin.h - mPatOffset, theOrigin.v);
  145.  
  146.     // Adjust the drawing frame for the shift in port origin
  147.     ::OffsetRect(&theBoundsCopy, -mPatOffset, 0);
  148.  
  149.     // changing the origion means that we must offset the clip region
  150.     StClipRgnState theClipSaver;
  151.     ::ClipRect(&theBoundsCopy);
  152.  
  153.     RGBColor theFillPin = { 0x2000, 0x2000, 0x2000 };
  154.     ::RGBForeColor(&theFillPin);
  155.     ::OpColor(&UGraphicGizmos::sLighter);
  156.     ::PenMode(addPin);
  157.     ::PaintRgn(mFillMask);
  158.  
  159.     RGBColor theBevelPin = { 0x4000, 0x4000, 0x4000 };
  160.     ::RGBForeColor(&theBevelPin);
  161.     ::PaintRgn(mTopBevelMask);
  162.     
  163.     ::OpColor(&UGraphicGizmos::sDarker);
  164.     ::PenMode(subPin);
  165.     ::PaintRgn(mBottomBevelMask);
  166.  
  167.     mPatOffset = (mPatOffset + 1) % mPatWidth;
  168. }
  169.  
  170. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  171. //    Ñ
  172. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  173.  
  174. void CPatternProgressBar::DrawSeamlessBar(const Rect& inBounds)
  175. {
  176. #if 1
  177.     mValue = mValueRange;
  178.     DrawPercentageBar(inBounds);
  179. #else
  180.     Point theAlignment;
  181.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  182.  
  183.     CGrafPtr thePort;
  184.     ::GetPort(&(GrafPtr)thePort);
  185.     mPatternWorld->Fill(thePort, inBounds, theAlignment);
  186. #endif
  187. }
  188.  
  189. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  190. //    Ñ
  191. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  192.  
  193. void CPatternProgressBar::DrawPercentageBar(const Rect& inBounds)
  194. {
  195.     Int32 theStart = 0;
  196.     Int32 theEnd = mValueRange;
  197.  
  198.     Int32 theValue = GetValue();
  199.     if (theValue < theStart)
  200.         theValue = theStart;
  201.     else if (theValue > theEnd)
  202.         theValue = theEnd;
  203.         
  204.     Int32 thePercentage = ((theValue * 100) / theEnd);
  205.  
  206.     Rect theBoundsCopy = inBounds;
  207.     ::InsetRect(&theBoundsCopy, 1, 1);
  208.     
  209.     Rect theLeftBox = theBoundsCopy;
  210.     theLeftBox.right = theLeftBox.left + (thePercentage * RectWidth(theBoundsCopy)) / 100;
  211.     
  212.     Rect theRightBox = theBoundsCopy;
  213.     theRightBox.left = theLeftBox.right;
  214.     
  215.     Point theAlignment;
  216.     CSharedPatternWorld::CalcRelativePoint(this, CSharedPatternWorld::eOrientation_Port, theAlignment);
  217.  
  218.     CGrafPtr thePort;
  219.     ::GetPort(&(GrafPtr)thePort);
  220.  
  221.     mPatternWorld->Fill(thePort, inBounds, theAlignment);
  222.     UGraphicGizmos::BevelTintRect(inBounds, -1, 0x4000, 0x6000);
  223.     
  224.     if (RectWidth(theLeftBox) >= 5)
  225.         {
  226.         UGraphicGizmos::BevelTintRect(theLeftBox, 1, 0x4000, 0x6000);
  227.         ::InsetRect(&theLeftBox, 1, 1);
  228.         UGraphicGizmos::LowerColorVolume(theLeftBox, 0x1000);
  229.         }
  230.     else
  231.         theRightBox.left = theLeftBox.left;
  232.     
  233.     UGraphicGizmos::LowerColorVolume(theRightBox, 0x3000);
  234. }
  235.  
  236. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  237. //    Ñ
  238. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  239.  
  240. Int32 CPatternProgressBar::GetValue() const
  241. {
  242.     return mValue;
  243. }
  244.  
  245. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  246. //    Ñ
  247. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  248.  
  249. void CPatternProgressBar::SetValue(Int32 inValue)
  250. {
  251.     if ((inValue != mValue) || (inValue == eIndefinite))
  252.         {
  253.         mValue = inValue;
  254.         if (FocusExposed())
  255.             Draw(NULL);
  256.         }
  257. }
  258.  
  259. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  260. //    Ñ
  261. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  262. #if 0
  263. void CPatternProgressBar::SetValueRange(const Range32T& inRange)
  264. {
  265.     mValueRange = inRange;
  266. }
  267. #endif
  268.  
  269. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  270. //    Ñ
  271. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  272.  
  273. void CPatternProgressBar::Draw(RgnHandle inSuperDrawRgnH)
  274. {
  275.     Rect theFrame;
  276.     if ((mVisible == triState_On) && CalcPortFrameRect(theFrame) &&
  277.             ((inSuperDrawRgnH == nil) || RectInRgn(&theFrame, inSuperDrawRgnH)) && FocusDraw())
  278.         {
  279.         PortToLocalPoint(topLeft(theFrame));    // Get Frame in Local coords
  280.         PortToLocalPoint(botRight(theFrame));
  281.  
  282.         if (ExecuteAttachments(msg_DrawOrPrint, &theFrame))
  283.             {
  284.             Boolean bDidDraw = false;
  285.  
  286.             StColorPenState thePenSaver;
  287.             StColorPenState::Normalize();
  288.             
  289.             // Fail safe offscreen drawing
  290.             StValueChanger<EDebugAction> okayToFail(gDebugThrow, debugAction_Nothing);
  291.             try
  292.                 {            
  293.                 LGWorld theOffWorld(theFrame, 0, useTempMem);
  294.  
  295.                 if (!theOffWorld.BeginDrawing())
  296.                     throw memFullErr;
  297.                     
  298.                 DrawSelf();
  299.                     
  300.                 theOffWorld.EndDrawing();
  301.                 theOffWorld.CopyImage(GetMacPort(), theFrame);
  302.                 bDidDraw = true;
  303.                 }
  304.             catch (...)
  305.                 {
  306.                 //     & draw onscreen
  307.                 }
  308.  
  309.             if (!bDidDraw)
  310.                 DrawSelf();
  311.             }
  312.         }
  313. }
  314.  
  315. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  316. //    Ñ    
  317. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  318.  
  319. void CPatternProgressBar::ResizeFrameBy(
  320.     Int16             inWidthDelta,
  321.     Int16            inHeightDelta,
  322.     Boolean            inRefresh)
  323. {
  324.     LPane::ResizeFrameBy(inWidthDelta, inHeightDelta, inRefresh);
  325.     RecalcPoleMasks();
  326. }
  327.  
  328. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  329. //    Ñ
  330. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  331.  
  332. void CPatternProgressBar::RecalcPoleMasks(void)
  333. {
  334.     StColorPenState::Normalize();
  335.  
  336.     Rect theFrame;
  337.     CalcLocalFrameRect(theFrame);
  338.     ::InsetRect(&theFrame, 1, 1);
  339.     theFrame.right += RectHeight(theFrame) * 2;
  340.     theFrame.left -= RectHeight(theFrame) * 2;
  341.     
  342.     // mjc begin
  343.     // handle case where bar is resized to zero or negative width (in narrow windows).
  344.     // Make the mask one pixel wide so we don't throw on creating a mask with negative width.
  345.     if (theFrame.right <= theFrame.left) theFrame.right = theFrame.left + 1;
  346.     // mjc end
  347.     
  348.     CGWorld theMaskWorld(theFrame, 1, useTempMem);
  349.  
  350.     Int16 theHeight = RectHeight(theFrame);
  351.     Int16 theHalfHeight = RectHeight(theFrame) / 2;
  352.     
  353.     Rect theStamp = theFrame;
  354.     theStamp.right = theStamp.left + RectHeight(theStamp) + theHalfHeight;
  355.  
  356.     StRegion theStampRgn;
  357.     ::OpenRgn();
  358. // 97-05-11 pkc -- reverse indefinite bar slant to comply with MacOS standard
  359.     ::MoveTo(theStamp.left, theStamp.top);
  360.     ::LineTo(theStamp.left + theHalfHeight, theStamp.top);
  361.     ::LineTo(theStamp.right - 1, theStamp.bottom - 1);
  362.     ::LineTo(theStamp.right - (1 + theHalfHeight), theStamp.bottom - 1);
  363.     ::LineTo(theStamp.left, theStamp.top);
  364. //    ::MoveTo(theStamp.left, theStamp.bottom - 1);
  365. //    ::LineTo(theStamp.left + theHalfHeight, theStamp.top);
  366. //    ::LineTo(theStamp.right - 1, theStamp.top);
  367. //    ::LineTo(theStamp.right - (1 + theHalfHeight), theStamp.bottom - 1);
  368. //    ::LineTo(theStamp.left, theStamp.bottom - 1);
  369.     ::CloseRgn(theStampRgn);
  370.  
  371.     GWorldPtr theMacWorld = theMaskWorld.GetMacGWorld();
  372.     if (theMaskWorld.BeginDrawing())
  373.         {
  374.         ::EraseRect(&theFrame);
  375.         while (theStamp.left < theFrame.right)
  376.             {
  377.             ::FillRgn(theStampRgn, &qd.black);
  378.             ::OffsetRgn(theStampRgn,theHeight, 0);
  379.             ::OffsetRect(&theStamp, theHeight, 0);
  380.             }        
  381.     
  382.         theMaskWorld.EndDrawing();
  383.         OSErr theErr = ::BitMapToRegion(mFillMask, &((GrafPtr)theMacWorld)->portBits);
  384.         ThrowIfOSErr_(theErr);
  385.         }
  386.  
  387.     theStamp = theFrame;
  388.     theStamp.right = theStamp.left + RectHeight(theStamp) + theHalfHeight;
  389.         
  390.     if (theMaskWorld.BeginDrawing())
  391.         {
  392.         ::EraseRect(&theFrame);
  393.         while (theStamp.left < theFrame.right)
  394.             {
  395.             // 97-05-11 pkc -- reverse indefinite bar slant to comply with MacOS standard
  396.             ::MoveTo(theStamp.left, theStamp.top);
  397.             ::LineTo(theStamp.left + theHalfHeight, theStamp.top);
  398.             ::LineTo(theStamp.right - 1, theStamp.bottom - 1);
  399. //            ::MoveTo(theStamp.left, theStamp.bottom - 1);
  400. //            ::LineTo(theStamp.left + theHalfHeight, theStamp.top);
  401. //            ::LineTo(theStamp.right - 1, theStamp.top);
  402.             ::OffsetRect(&theStamp,theHeight, 0);
  403.             }
  404.  
  405.         theMaskWorld.EndDrawing();
  406.         OSErr theErr = ::BitMapToRegion(mTopBevelMask, &((GrafPtr)theMacWorld)->portBits);
  407.         ThrowIfOSErr_(theErr);
  408.         }
  409.  
  410.     theStamp = theFrame;
  411.     theStamp.right = theStamp.left + RectHeight(theStamp) + theHalfHeight;
  412.         
  413.     if (theMaskWorld.BeginDrawing())
  414.         {
  415.         ::EraseRect(&theFrame);
  416.         while (theStamp.left < theFrame.right)
  417.             {
  418.             // 97-05-11 pkc -- reverse indefinite bar slant to comply with MacOS standard
  419.             ::MoveTo(theStamp.right - 1, theStamp.bottom - 1);
  420.             ::LineTo(theStamp.right - (1 + theHalfHeight), theStamp.bottom - 1);
  421.             ::LineTo(theStamp.left, theStamp.top);
  422. //            ::MoveTo(theStamp.right - 1, theStamp.top);
  423. //            ::LineTo(theStamp.right - (1 + theHalfHeight), theStamp.bottom - 1);
  424. //            ::LineTo(theStamp.left, theStamp.bottom - 1);
  425.             ::OffsetRect(&theStamp, theHeight, 0);
  426.             }
  427.  
  428.         theMaskWorld.EndDrawing();
  429.         OSErr theErr = ::BitMapToRegion(mBottomBevelMask, &((GrafPtr)theMacWorld)->portBits);
  430.         ThrowIfOSErr_(theErr);
  431.         }
  432.  
  433.     mPatWidth = theHeight;
  434. }
  435.  
  436.  
  437.  
  438. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  439. //
  440. #pragma mark --- CPatternProgressCaption ---
  441. //
  442. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  443.  
  444. CPatternProgressCaption::CPatternProgressCaption(LStream* inStream)
  445.     :    CPatternProgressBar(inStream)
  446. {
  447.     *inStream >> mTraitsID;
  448. }
  449.  
  450. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  451. //    Ñ
  452. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  453.  
  454. void CPatternProgressCaption::SetDescriptor(ConstStringPtr inDescriptor)
  455. {
  456.     if (inDescriptor == NULL)
  457.         mText = "\p";
  458.     else
  459.         mText = inDescriptor;
  460.     
  461.     if (FocusExposed())
  462.         Draw(NULL);
  463. }
  464.  
  465. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  466. //    Ñ
  467. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  468.  
  469. void CPatternProgressCaption::SetDescriptor(const char* inCDescriptor)
  470. {
  471.     if (inCDescriptor == NULL)
  472.         mText = "\p";
  473.     else
  474.         mText = inCDescriptor;
  475.  
  476.     if (FocusExposed())
  477.         Draw(NULL);
  478. }
  479.  
  480. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  481. //    Ñ
  482. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  483.  
  484. StringPtr CPatternProgressCaption::GetDescriptor(Str255 outDescriptor) const
  485. {
  486.     return LString::CopyPStr(mText, outDescriptor);
  487. }
  488.  
  489. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  490. //    Ñ
  491. // ╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤╤
  492.  
  493. void CPatternProgressCaption::DrawSelf(void)
  494. {
  495.     CPatternProgressBar::DrawSelf();
  496.  
  497.     Rect theFrame;
  498.     CalcLocalFrameRect(theFrame);
  499.  
  500. //    UGraphicGizmos::BevelTintRect(theFrame, -1, 0x4000, 0x6000);
  501.  
  502.     ::InsetRect(&theFrame, 5, 0);
  503.     Int16 theJust = UTextTraits::SetPortTextTraits(mTraitsID);
  504.  
  505.     if (mText.Length() > 0)
  506.         {
  507.         UGraphicGizmos::PlaceStringInRect(mText, theFrame, theJust);
  508.         }
  509. #ifdef MOZ_OFFLINE
  510.     else if (!UOffline::AreCurrentlyOnline())
  511.         {
  512.         LStr255 offlineString(cOfflineListID, cOfflineStrIndex);
  513.         UGraphicGizmos::PlaceStringInRect(offlineString, theFrame, theJust);
  514.         }
  515. #endif // MOZ_OFFLINE
  516. }
  517.  
  518.