/*
*******************************************************************************
* Copyright (c) 1996-97 Digi International Inc., All Rights Reserved          *
*                                                                             *
* This  software  contains  proprietary  and  confidential   information   of *
* Digi International  Inc.   By  accepting  transfer  of this copy, Recipient *
* agrees to retain this software in  confidence,  to  prevent  disclosure  to *
* others,  and  to make no  use of this software other than that for which it *
* was delivered.  This is an unpublished copyright work  Digi   International *
* Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is *
* strictly prohibited.                                                        *
*                                                                             *
* Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc. *
* Confidential  when   combined   with   the   aggregated  modules  for  this *
* product) OBJECT CODE ONLY SOURCE MATERIALS                                  *
*                                                                             *
* (C) COPYRIGHT Digi International Inc. 1996-97                               *
*                                                                             *
* All Rights Reserved                                                         *
*                                                                             *
* US   Government   Users   Restricted   Rights   -   Use,   duplication   or *
* disclosure  restricted by GSA ADP Schedule Contract with Digi International *
* Inc.                                                                        *
*                                                                             *
*******************************************************************************

// PacketByteView.h : header file
//

Revision History:

   $History: PacketByteView.h $
 * 
 * *****************  Version 15  *****************
 * User: Mikez        Date: 7/11/97    Time: 5:02p
 * Branched in $/Components/Windows/NT/Sync/Build/Diag
 * 
 * *****************  Version 14  *****************
 * User: Rodgerb      Date: 1/27/97    Time: 1:18p
 * Updated in $/Components/Windows/NT/Sync/rev2diag
 * 1) documentation
 * 2) added some new params to Physical layer stats
*/

#if !NT5_BUILD && !_M_IA64
// NT5 and newer DDKs define these types.  They float (at compile time) from 32 to 64
// bit width depending on the size of pointers in the system being compiled for.
// Define it for NT4.
typedef DWORD        DWORD_PTR, *PDWORD_PTR;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPacketByteView view

class CPacketByteView : public CScrollView
{
protected:
	CPacketByteView();           // protected constructor used by dynamic creation
	DECLARE_DYNCREATE(CPacketByteView)
	CString m_Text;
	WORD selStart, selEnd;
	int m_Width;
	int m_Height;
	CFont *m_Font;
	inline void SwapBkText(CDC *dc, BOOL& mode);
	CRect m_Size;
	BOOL m_bActive;

	HTREEITEM m_Found;
	int m_MinSep;
	int m_ByteIndex;
	static BOOL FindItemFunc(CTreeCtrl&, HTREEITEM, LPVOID);

	COLORREF m_HighlightColor;
	COLORREF m_WindowColor;
	COLORREF m_TextColor;

// Attributes
public:
	CDiagDoc* GetDocument();
	void PrintHex(CString& str, PUCHAR dp, int len);
	void SizeText();

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPacketByteView)
	protected:
	virtual void OnDraw(CDC* pDC);      // overridden to draw this view
	virtual void OnInitialUpdate();     // first time after construct
	virtual void OnUpdate(CView* pSender, LPARAM lHint, CObject* pHint);
	virtual void OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView);
	//}}AFX_VIRTUAL

// Implementation
protected:
	virtual ~CPacketByteView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

	// Generated message map functions
	//{{AFX_MSG(CPacketByteView)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	//}}AFX_MSG
	afx_msg LRESULT OnCommandHelp(WPARAM wParam, LPARAM lParam);
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in DiagView.cpp
inline CDiagDoc* CPacketByteView::GetDocument()
   { return (CDiagDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////
