HexEdit/CalcDlg.cpp
void CCalcBits::calc_widths(CRect & rct)
{
	m_ww = rct.Width()/70;                 // width of display for one bit
	ASSERT(m_ww > 3);
	m_hh = 4 + (rct.Height() - 6)/2;
	if (m_hh < 7)
		m_hh = 7;
	else if (m_hh > 16)
		m_hh = 16;
	if (m_hh > rct.Height() - 1)
		m_hh = rct.Height() - 1;
	m_nn = (rct.Width()-m_ww*64)/22;             // sep between nybbles = half of rest split ~15 ways
	m_bb = (rct.Width()-m_ww*64-m_nn*16)/10;     // sep between bytes = half of rest split ~7 ways
	m_cc = (rct.Width()-m_ww*64-m_nn*16-m_bb*8)/3; // sep between words = rest of space split 3 ways
	ASSERT(m_nn > 0 && m_bb > 0 && m_cc > 0);      // sanity check
}
// Work out where the bit images are to be displayed based on the width of the control

Work out where the bit images are to be displayed based on the width of the control
Work out where the bit images are to be displayed based on the width of the control
void CCalcBits::calc_widths(CRect & rct)
{
	m_ww = rct.Width()/70;                 
	ASSERT(m_ww > 3);
	m_hh = 4 + (rct.Height() - 6)/2;
	if (m_hh < 7)
		m_hh = 7;
	else if (m_hh > 16)
		m_hh = 16;
	if (m_hh > rct.Height() - 1)
		m_hh = rct.Height() - 1;
	m_nn = (rct.Width()-m_ww*64)/22;             
	m_bb = (rct.Width()-m_ww*64-m_nn*16)/10;     
	m_cc = (rct.Width()-m_ww*64-m_nn*16-m_bb*8)/3; 
	ASSERT(m_nn > 0 && m_bb > 0 && m_cc > 0);      
}
void CCalcBits :: calc_widths ( CRect & rct ) { m_ww = rct . Width ( ) / 70 ; ASSERT ( m_ww > 3 ) ; m_hh = 4 + ( rct . Height ( ) - 6 ) / 2 ; if ( m_hh < 7 ) m_hh = 7 ; else if ( m_hh > 16 ) m_hh = 16 ; if ( m_hh > rct . Height ( ) - 1 ) m_hh = rct . Height ( ) - 1 ; m_nn = ( rct . Width ( ) - m_ww * 64 ) / 22 ; m_bb = ( rct . Width ( ) - m_ww * 64 - m_nn * 16 ) / 10 ; m_cc = ( rct . Width ( ) - m_ww * 64 - m_nn * 16 - m_bb * 8 ) / 3 ; ASSERT ( m_nn > 0 && m_bb > 0 && m_cc > 0 ) ; }
Work out where the bit images are to be displayed based on the width of the control
Work out where the bit images are to be displayed based on the width of the control
// width of display for one bit
 // sep between nybbles = half of rest split ~15 ways
 // sep between bytes = half of rest split ~7 ways
 // sep between words = rest of space split 3 ways
 // sanity check
