Пример #1
0
void SkeinWindow::DrawNodeTree(Skein::Node* node, Skein::Node* transcriptEnd, CDC& dc,
  CDibSection& bitmap, const CRect& client, const CPoint& parentCentre,
  const CPoint& siblingCentre, int spacing)
{
  // Draw the node
  CPoint nodeCentre(siblingCentre.x+node->GetX(),siblingCentre.y);
  DrawNode(node,dc,bitmap,client,nodeCentre);

  // Draw a line connecting the node to its parent
  if (node->GetParent() != NULL)
  {
    COLORREF colour = theApp.GetColour(
      node->GetTemporary() ? InformApp::ColourUnlocked : InformApp::ColourLocked);
    DrawNodeLine(dc,bitmap,client,parentCentre,nodeCentre,colour,
      m_skein->InThread(node,transcriptEnd),ShowLabel(node),node->GetTemporary());
  }

  // Draw all the node's children
  CPoint childSiblingCentre(siblingCentre.x,siblingCentre.y+spacing);
  for (int i = 0; i < node->GetNumChildren(); i++)
  {
    DrawNodeTree(node->GetChild(i),transcriptEnd,dc,bitmap,client,
      nodeCentre,childSiblingCentre,spacing);
  }
}
Пример #2
0
void
ZHD_Node::EraseNode( )
{
   CRect    rect;
   CBrush   *pBrush;
   CPen     *pPen;
   zBOOL    bRelease;

   // Erase the rectangle containing the entity
   rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
   rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
   rect.right  = rect.left + (tzHDNODEX * tzHDCELLSIZE) - 1;
   rect.bottom = rect.top  + (tzHDNODEY * tzHDCELLSIZE) - 1;

   if ( m_pHD_Diagram->m_hDC == 0 )
   {
      m_pHD_Diagram->GetDeviceContext( );
      bRelease = TRUE;
   }
   else
      bRelease = FALSE;

   // Unpaint the nodes line
   DrawNodeLine( 1 );

   // Now un-paint the rectangle where the entity was
   pBrush = new CBrush( tzHDCOLORBACKGROUND );
   pPen   = new CPen( PS_SOLID, 1, tzHDCOLORBACKGROUND );
   CPen *pPenOld = m_pHD_Diagram->m_hDC->SelectObject( pPen );
   CBrush *pBrushOld = m_pHD_Diagram->m_hDC->SelectObject( pBrush );

   m_pHD_Diagram->m_hDC->Rectangle( rect );

   m_pHD_Diagram->m_hDC->SelectObject( pPenOld );
   m_pHD_Diagram->m_hDC->SelectObject( pBrushOld );
   mDeleteInit( pBrush );
   mDeleteInit( pPen );

   if ( bRelease )
      m_pHD_Diagram->ReleaseDeviceContext( );
}
Пример #3
0
void SkeinWindow::DrawNodeLine(CDC& dc, CDibSection& bitmap, const CRect& client,
  const CPoint& from, const CPoint& to, COLORREF fore, bool bold, bool label, bool dashed)
{
  int p1x = from.x;
  int p1y = from.y+(int)(1.2*m_fontSize.cy);
  int p2x = to.x;
  int p2y = to.y-(int)(1.2*m_fontSize.cy);
  if (label)
    p2y -= (int)(1.5*m_fontSize.cy);

  // Check if we need to draw the line
  CRect lineArea(p1x,p1y,p2x+1,p2y);
  lineArea.NormalizeRect();
  if (lineArea.Width() == 0)
    lineArea.right++;
  if (lineArea.Height() == 0)
    lineArea.bottom++;
  CRect intersect;
  if (intersect.IntersectRect(client,lineArea) == FALSE)
    return;

  // Special case for a vertical line
  if (p1x == p2x)
  {
    COLORREF back = theApp.GetColour(InformApp::ColourBack);
    dc.SetBkColor(back);

    CPen pen1;
    pen1.CreatePen(dashed ? PS_DOT : PS_SOLID,0,fore);
    CPen* oldPen = dc.SelectObject(&pen1);
    dc.MoveTo(p1x,p1y);
    dc.LineTo(p2x,p2y);
    if (bold)
    {
      dc.MoveTo(p1x-1,p1y);
      dc.LineTo(p2x-1,p2y);
      dc.MoveTo(p1x+1,p1y);
      dc.LineTo(p2x+1,p2y);
    }

    CPen pen2;
    pen2.CreatePen(dashed ? PS_DOT : PS_SOLID,0,LinePixelColour(0.66,fore,back));
    dc.SelectObject(&pen2);
    if (bold)
    {
      dc.MoveTo(p1x-2,p1y);
      dc.LineTo(p2x-2,p2y);
      dc.MoveTo(p1x+2,p1y);
      dc.LineTo(p2x+2,p2y);
    }
    else
    {
      dc.MoveTo(p1x-1,p1y);
      dc.LineTo(p2x-1,p2y);
      dc.MoveTo(p1x+1,p1y);
      dc.LineTo(p2x+1,p2y);
    }

    dc.SelectObject(oldPen);
    return;
  }

  if (p2x < p1x)
  {
    int t;
    t = p2x;
    p2x = p1x;
    p1x = t;
    t = p2y;
    p2y = p1y;
    p1y = t;
  }

  int incMajor = 0, incMinor = 0;
  int d = 0, x = 0, y = 0, two_v_dx, two_v_dy;
  double invDenom, two_dx_invDenom, two_dy_invDenom;
  int count = 0;

  // Draw an anti-aliased line
  int dx = p2x - p1x;
  int dy = p2y - p1y;
  if ((dy >= 0) && (dy <= dx))
  {
    d = 2*dy-dx;
    incMajor = 2*dy;
    incMinor = 2*(dy-dx);

    two_v_dx = 0;
    invDenom = 1.0/(2.0*sqrt((double)((dx*dx)+(dy*dy))));
    two_dx_invDenom = 2.0*dx*invDenom;

    x = p1x;
    y = p1y;

    DrawLinePixel(dc,bitmap,x,y,0.0,fore);
    DrawLinePixel(dc,bitmap,x,y+1,(two_dx_invDenom/1.5),fore);
    DrawLinePixel(dc,bitmap,x,y-1,(two_dx_invDenom/1.5),fore);

    while (x < p2x)
    {
      if (d <= 0)
      {
        two_v_dx = d+dx;
        d += incMajor;
        x++;
      }
      else
      {
        two_v_dx = d-dx;
        d += incMinor;
        x++;
        y++;
      }
      if (!dashed || (count > 3))
      {
        DrawLinePixel(dc,bitmap,x,y,fabs((two_v_dx*invDenom)/1.5),fore);
        DrawLinePixel(dc,bitmap,x,y+1,fabs((two_dx_invDenom-(two_v_dx*invDenom))/1.5),fore);
        DrawLinePixel(dc,bitmap,x,y-1,fabs((two_dx_invDenom+(two_v_dx*invDenom))/1.5),fore);
      }
      count = (count > 6) ? 0 : count+1;
    }
  }

  if ((dy < 0) && (-dy <= dx))
  {
    d = 2*dy+dx;
    incMajor = 2*dy;
    incMinor = 2*(dy+dx);

    two_v_dx = 0;
    invDenom = 1.0/(2.0*sqrt((double)((dx*dx)+(dy*dy))));
    two_dx_invDenom = 2.0*dx*invDenom;

    x = p1x;
    y = p1y;

    DrawLinePixel(dc,bitmap,x,y,0.0,fore);
    DrawLinePixel(dc,bitmap,x,y+1,(two_dx_invDenom/1.5),fore);
    DrawLinePixel(dc,bitmap,x,y-1,(two_dx_invDenom/1.5),fore);

    while (x < p2x)
    {
      if (d <= 0)
      {
        two_v_dx = d+dx;
        d += incMinor;
        x++;
        y--;
      }
      else
      {
        two_v_dx = d-dx;
        d += incMajor;
        x++;
      }
      if (!dashed || (count > 3))
      {
        DrawLinePixel(dc,bitmap,x,y,fabs((two_v_dx*invDenom)/1.5),fore);
        DrawLinePixel(dc,bitmap,x,y+1,fabs((two_dx_invDenom-(two_v_dx*invDenom))/1.5),fore);
        DrawLinePixel(dc,bitmap,x,y-1,fabs((two_dx_invDenom+(two_v_dx*invDenom))/1.5),fore);
      }
      count = (count > 6) ? 0 : count+1;
    }
  }

  if ((dy > 0) && (dy > dx))
  {
    d = 2*dx-dy;
    incMajor = 2*dx;
    incMinor = 2*(dx-dy);

    two_v_dy = 0;
    invDenom = 1.0/(2.0*sqrt((double)((dx*dx)+(dy*dy))));
    two_dy_invDenom = 2.0*dy*invDenom;

    x = p1x;
    y = p1y;

    DrawLinePixel(dc,bitmap,x,y,0.0,fore);
    DrawLinePixel(dc,bitmap,x+1,y,(two_dy_invDenom/1.5),fore);
    DrawLinePixel(dc,bitmap,x-1,y,(two_dy_invDenom/1.5),fore);

    while (y < p2y)
    {
      if (d <= 0)
      {
        two_v_dy = d + dy;
        d += incMajor;
        y++;
      }
      else
      {
        two_v_dy = d - dy;
        d += incMinor;
        y++;
        x++;
      }
      if (!dashed || (count > 3))
      {
        DrawLinePixel(dc,bitmap,x,y,fabs((two_v_dy*invDenom)/1.5),fore);
        DrawLinePixel(dc,bitmap,x+1,y,fabs((two_dy_invDenom-(two_v_dy*invDenom))/1.5),fore);
        DrawLinePixel(dc,bitmap,x-1,y,fabs((two_dy_invDenom+(two_v_dy*invDenom))/1.5),fore);
      }
      count = (count > 6) ? 0 : count+1;
    }
  }

  if ((dy < 0) && (-dy > dx))
  {
    d = 2*dx+dy;
    incMajor = 2*dx;
    incMinor = 2*(dx+dy);

    two_v_dy = 0;
    invDenom = 1.0/(2.0*sqrt((double)((dx*dx)+(dy*dy))));
    two_dy_invDenom = 2.0*fabs((double)dy)*invDenom;

    x = p1x;
    y = p1y;

    DrawLinePixel(dc,bitmap,x,y,0.0,fore);
    DrawLinePixel(dc,bitmap,x+1,y,(two_dy_invDenom/1.5),fore);
    DrawLinePixel(dc,bitmap,x-1,y,(two_dy_invDenom/1.5),fore);

    while (y > p2y)
    {
      if (d <= 0)
      {
        two_v_dy = d-dy;
        d += incMajor;
        y--;
      }
      else
      {
        two_v_dy = d+dy;
        d += incMinor;
        y--;
        x++;
      }
      if (!dashed || (count > 3))
      {
        DrawLinePixel(dc,bitmap,x,y,fabs((two_v_dy*invDenom)/1.5),fore);
        DrawLinePixel(dc,bitmap,x+1,y,fabs((two_dy_invDenom-(two_v_dy*invDenom))/1.5),fore);
        DrawLinePixel(dc,bitmap,x-1,y,fabs((two_dy_invDenom+(two_v_dy*invDenom))/1.5),fore);
      }
      count = (count > 6) ? 0 : count+1;
    }
  }

  if (bold)
  {
    DrawNodeLine(dc,bitmap,client,from+CSize(1,0),to+CSize(1,0),fore,false,label,dashed);
    DrawNodeLine(dc,bitmap,client,from+CSize(0,1),to+CSize(0,1),fore,false,label,dashed);
    DrawNodeLine(dc,bitmap,client,from+CSize(1,1),to+CSize(1,1),fore,false,label,dashed);
  }
}
Пример #4
0
zSHORT
ZHD_Node::DrawNode( )
{
   CBrush   *pBrush = 0;    // but because we are a little neurotic
   CFont    *pFont = 0;     // we will do it regardless
   CPen     *pPen = 0;      // not sure we have to zero these out ...
   CRect    rect;
   CSize    Size;
   zBOOL    bRelease;
   zCHAR    szText[ 256 ];
   COLORREF colorOldText;
   zBOOL    bSpecialSelect = FALSE;

   // Now paint a rounded rectangle to represent the entity
   if ( !m_pHD_Diagram->PositionVisible( m_lPosIdx, m_lPosIdx + (tzHDNODEX - 1) + ((tzHDNODEY - 1) * tzHDDIAGRAMX) ) )
   {
      return( 0 );
   }

   if ( m_pHD_Diagram->m_hDC == 0 )
   {
      m_pHD_Diagram->GetDeviceContext( );
      bRelease = TRUE;
   }
   else
      bRelease = FALSE;

   if ( m_pHD_Diagram->m_bPrintDC )
   {
      if ( m_bSelected && m_pHD_Diagram->m_bShadeEnts )
         pBrush = new CBrush( COLORREF( tzHDCOLORSHADE ) );
      else
         pBrush = new CBrush( tzHDCOLORWHITE );

      pPen = new CPen( PS_SOLID, 1, tzHDCOLORBLACK );
      colorOldText = m_pHD_Diagram->m_hDC->SetTextColor( tzHDCOLORBLACK );
   }
   else
   {
      pPen = new CPen( PS_SOLID, 1, tzHDCOLORBOX );
      colorOldText = m_pHD_Diagram->m_hDC->SetTextColor( tzHDCOLORTEXT );
      if ( m_lColor >= 0 && m_lColor < 16 )
      {
         if ( m_bSelected )
            pBrush = new CBrush( tzHDCOLORSELECTED );
         else
            pBrush = new CBrush( tzHDCOLORNORMAL[ m_lColor ] );
      }
      else
      {
         pBrush = new CBrush( m_lColor );
         if ( m_bSelected )
            bSpecialSelect = TRUE;
      }
   }

   CPen   *pPenOld = m_pHD_Diagram->m_hDC->SelectObject( pPen );
   CBrush *pBrushOld = m_pHD_Diagram->m_hDC->SelectObject( pBrush );
   CFont  *pFontOld = 0;

   pFont = new CFont( );
   if ( pFont->CreateFont( (tzHDFONTHEIGHT * 5) / 4, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET,
                           OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, tzHDFONTFF, tzHDFONTNAME ) )
   {
      pFontOld = m_pHD_Diagram->m_hDC->SelectObject( pFont );
   }

   rect.left = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
   rect.top  = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
   if ( m_bHidden )
   {
      rect.right  = rect.left + tzHDCELLSIZE;
      rect.bottom = rect.top  + tzHDCELLSIZE;
      m_pHD_Diagram->m_hDC->Ellipse( rect.left, rect.top, rect.right, rect.bottom );
      if ( bSpecialSelect )
         m_pHD_Diagram->m_hDC->Ellipse( rect.left + 2, rect.top + 2, rect.right + 2, rect.bottom - 2 );

   }
   else
   {
      rect.right  = rect.left + ((tzHDNODEX * tzHDCELLSIZE) - 1);
      rect.bottom = rect.top  + ((tzHDNODEY * tzHDCELLSIZE) - 1);
      m_pHD_Diagram->m_hDC->RoundRect( rect.left, rect.top, rect.right, rect.bottom, tzHDARCSIZE, tzHDARCSIZE );
      if ( bSpecialSelect )
         m_pHD_Diagram->m_hDC->RoundRect( rect.left + 2, rect.top + 2, rect.right - 2, rect.bottom - 2, tzHDARCSIZE, tzHDARCSIZE );
      // Now that the rectangle is drawn, see if we need to draw the attributive or associative lines in the entity
      if ( m_chType == 'A' )
      {
         if ( m_pHD_Diagram->m_bPrintDC == FALSE )
         {
            CPen *pPen2 = pPen;
            pPen = new CPen( PS_SOLID, 1, tzHDCOLORGRAY );
            m_pHD_Diagram->m_hDC->SelectObject( pPen );
            mDeleteInit( pPen2 );
         }

         CPoint pt1;
         CPoint pt2;

         pt1.x = ((rect.left + rect.right) / 2);
         pt1.y = rect.top;
         m_pHD_Diagram->m_hDC->MoveTo( pt1.x, pt1.y );
         pt2.x = rect.left;
         pt2.y = rect.bottom - tzHDCELLSIZE;
         m_pHD_Diagram->m_hDC->LineTo( pt2.x, pt2.y );
         m_pHD_Diagram->m_hDC->MoveTo( pt1.x, pt1.y );
         pt2.x = rect.right;
         m_pHD_Diagram->m_hDC->LineTo( pt2.x, pt2.y );
      }
      else
      if ( m_chType == 'S' )
      {
         if ( m_pHD_Diagram->m_bPrintDC == FALSE )
         {
            CPen *pPen2 = pPen;
            pPen = new CPen( PS_SOLID, 1, tzHDCOLORGRAY );
            m_pHD_Diagram->m_hDC->SelectObject( pPen );
            mDeleteInit( pPen2 );
         }

         CPoint pt1;
         CPoint pt2;

         pt1.x = ((rect.left + rect.right) / 2);
         pt1.y = rect.top;
         m_pHD_Diagram->m_hDC->MoveTo( pt1.x, pt1.y );
         pt2.x = rect.left;
         pt2.y = (rect.top + rect.bottom) / 2;
         m_pHD_Diagram->m_hDC->LineTo( pt2.x, pt2.y );
         pt2.x = pt1.x;
         pt2.y = rect.bottom;
         m_pHD_Diagram->m_hDC->LineTo( pt2.x, pt2.y );
         pt2.x = rect.right;
         pt2.y = (rect.top + rect.bottom) / 2;
         m_pHD_Diagram->m_hDC->LineTo( pt2.x, pt2.y );
         m_pHD_Diagram->m_hDC->LineTo( pt1.x, pt1.y );
      }

      int nOldBkMode = m_pHD_Diagram->m_hDC->SetBkMode( TRANSPARENT );
      Size = m_pHD_Diagram->m_hDC->GetTextExtent( m_csText );
      rect.left   += 4;
      rect.right  -= 4;
      if ( Size.cx > (rect.right - rect.left) )
      {
         rect.top    += ((tzHDCELLSIZE * 3) / 4);
         rect.bottom -= ((tzHDCELLSIZE * 3) / 4);
//       rect.top    += tzHDCELLSIZE;
//       rect.bottom -= tzHDCELLSIZE;

         zSHORT nIdx = 0;
         zSHORT nLth = m_csText.GetLength( ) - 1;
         while ( nIdx < nLth && m_csText.GetAt( nIdx ) != ' ' )
            nIdx++;

         Size = m_pHD_Diagram->m_hDC->GetTextExtent( m_csText, nIdx );
         if ( Size.cx > (rect.right - rect.left) )
         {
            while ( nIdx && Size.cx > (rect.right - rect.left) )
            {
               nIdx--;
               Size = m_pHD_Diagram->m_hDC->GetTextExtent( m_csText, nIdx );
            }

            nIdx--;
            if ( nIdx > 0 )
            {
               HyphenateHD_Text( m_csText, szText, zsizeof( szText ), nIdx );
            }

            m_pHD_Diagram->m_hDC->DrawText( szText, -1, rect, DT_LEFT | DT_WORDBREAK );
   //                                                         DT_SINGLELINE | DT_LEFT | DT_VCENTER );
         }
         else
         {
   //       rect.top += ((tzHDCELLSIZE * 3) / 4);
            m_pHD_Diagram->m_hDC->DrawText( m_csText, -1, rect, DT_CENTER | DT_WORDBREAK );
         }
      }
      else
      {
         rect.left   -= 4;
         rect.right  += 4;
         m_pHD_Diagram->m_hDC->DrawText( m_csText, -1, rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
      }

      if ( m_pHD_Diagram->m_bCollapsable ||
           m_csTitle.IsEmpty( ) == FALSE  ||
           m_csDIL.IsEmpty( ) == FALSE    ||
           m_csOutsideText1.IsEmpty( ) == FALSE ||
           m_csOutsideText2.IsEmpty( ) == FALSE ||
           m_csOutsideText3.IsEmpty( ) == FALSE ||
           m_csOutsideText4.IsEmpty( ) == FALSE ||
           m_csOutsideText5.IsEmpty( ) == FALSE )
      {
         if ( pFontOld )
         {
            m_pHD_Diagram->m_hDC->SelectObject( pFontOld );
            pFontOld = 0;
         }

         mDeleteInit( pFont );
         pFont = new CFont( );
         if ( pFont->CreateFont( tzHDCELLSIZE - 1, 0, 0, 0, 0, 0, 0, 0, ANSI_CHARSET,
                                 OUT_TT_ONLY_PRECIS, CLIP_DEFAULT_PRECIS, PROOF_QUALITY, tzHDFONTFF, tzHDFONTNAME ) )
         {
            pFontOld = m_pHD_Diagram->m_hDC->SelectObject( pFont );
         }

         if ( m_csTitle.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.right  = rect.left + (tzHDNODEX * tzHDCELLSIZE) - 1;
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csTitle, -1, rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
         }

         if ( m_csDIL.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.right  = rect.left + (tzHDNODEX * tzHDCELLSIZE) - 1;
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.top    += ((tzHDNODEY - 1) * tzHDCELLSIZE);
            rect.bottom = rect.top + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csDIL, -1, rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
         }

         if ( m_csOutsideText1.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.left   = rect.left + (tzHDNODEX * tzHDCELLSIZE) + 1;
            rect.right  = rect.left + (tzHDNODEX * ((tzHDCELLSIZE + 1) / 2));
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csOutsideText1, -1, rect,  DT_SINGLELINE | DT_VCENTER );
         }

         if ( m_csOutsideText2.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.left   = rect.left + (tzHDNODEX * tzHDCELLSIZE) + 1;
            rect.right  = rect.left + (tzHDNODEX * ((tzHDCELLSIZE + 1) / 2));
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.top    += tzHDCELLSIZE;
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csOutsideText2, -1, rect, DT_SINGLELINE | DT_VCENTER );
         }

         if ( m_csOutsideText3.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.left   = rect.left + (tzHDNODEX * tzHDCELLSIZE) + 1;
            rect.right  = rect.left + (tzHDNODEX * ((tzHDCELLSIZE + 1) / 2));
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.top    += (2 * tzHDCELLSIZE);
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csOutsideText3, -1, rect,  DT_SINGLELINE | DT_VCENTER );
         }

         if ( m_csOutsideText4.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.left   = rect.left + (tzHDNODEX * tzHDCELLSIZE) + 1;
            rect.right  = rect.left + (tzHDNODEX * ((tzHDCELLSIZE + 1) / 2));
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.top    += (3 * tzHDCELLSIZE);
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csOutsideText4, -1, rect, DT_SINGLELINE | DT_VCENTER );
         }

         if ( m_csOutsideText5.IsEmpty( ) == FALSE )
         {
            rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.left   = rect.left + (tzHDNODEX * tzHDCELLSIZE) + 1;
            rect.right  = rect.left + (tzHDNODEX * ((tzHDCELLSIZE + 1) / 2));
            rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
            rect.top    += (4 * tzHDCELLSIZE);
            rect.bottom = rect.top  + tzHDCELLSIZE;
            m_pHD_Diagram->m_hDC->DrawText( m_csOutsideText5, -1, rect, DT_SINGLELINE | DT_VCENTER );
         }
      }

      if ( m_pHD_Diagram->m_bCollapsable )
      {
         rect.left   = (PosX( ) - PosX( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
         rect.top    = (PosY( ) - PosY( tzHDDISPLAYPOS )) * tzHDCELLSIZE;
         rect.right  = rect.left + tzHDCELLSIZE;
         rect.bottom = rect.top  + tzHDCELLSIZE;
         if ( m_bCollapsed )
         {
            if ( m_pHD_Diagram->m_bPrintDC == FALSE )
            {
               mDeleteInit( pBrush );
               if ( m_lColor >= 0 && m_lColor < 16 )
               {
                  if ( m_bSelected )
                     pBrush = new CBrush( tzHDCOLORNORMAL[ m_lColor ] );
                  else
                     pBrush = new CBrush( tzHDCOLORSELECTED );
               }
               else
               {
                  pBrush = new CBrush( m_lColor );
                  if ( m_bSelected )
                     bSpecialSelect = TRUE;
               }

               m_pHD_Diagram->m_hDC->SelectObject( pBrush );
               m_pHD_Diagram->m_hDC->SetBkMode( OPAQUE );
               m_pHD_Diagram->m_hDC->Ellipse( rect.left, rect.top, rect.right, rect.bottom );
               m_pHD_Diagram->m_hDC->SetBkMode( TRANSPARENT );
            }

            m_pHD_Diagram->m_hDC->DrawText( "+", -1, rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
         }
//       else
//       {
//          m_pHD_Diagram->m_hDC->DrawText( "-", -1, rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER );
//       }
      }

      m_pHD_Diagram->m_hDC->SetBkMode( nOldBkMode );
   }

   m_pHD_Diagram->m_hDC->SetTextColor( colorOldText );
   m_pHD_Diagram->m_hDC->SelectObject( pPenOld );
   if ( pFontOld )
      m_pHD_Diagram->m_hDC->SelectObject( pFontOld );

   m_pHD_Diagram->m_hDC->SelectObject( pBrushOld );
   mDeleteInit( pPen );
   mDeleteInit( pFont );
   mDeleteInit( pBrush );

   // Now that the node has been drawn, draw the line to the parent node if the node exists
   DrawNodeLine( );

   if ( bRelease )
      m_pHD_Diagram->ReleaseDeviceContext( );

   // return that entity was drawn
   return( 1 );
}