void CTreePropSheetSplitter::OnMouseMove(UINT nFlags, CPoint point) 
{
  UNREFERENCED_PARAMETER(nFlags);

  if (GetCapture() != this) 
		return;
	InvertTracker();

  m_nTracker = (m_nOrientation == SSP_HORZ ? point.x : point.y) - m_nTrackerMouseOffset;
  ASSERT( m_nTrackIndex > 0 );
	if (m_nTracker > m_orig[m_nTrackIndex + 1] - m_nBarThickness - m_pzMinSize[m_nTrackIndex])
  {
    m_nTracker = m_orig[m_nTrackIndex + 1] - m_nBarThickness - m_pzMinSize[m_nTrackIndex];
  }
  else if (m_nTracker < m_orig[m_nTrackIndex - 1] + m_nBarThickness + m_pzMinSize[m_nTrackIndex-1])
  {
    m_nTracker = m_orig[m_nTrackIndex - 1] + m_nBarThickness + m_pzMinSize[m_nTrackIndex-1];
  }
  
  InvertTracker();

	CRect rcOuter;
	GetAdjustedClientRect(&rcOuter);
	// Real-time update.
  if( m_bRealtimeUpdate )
  {
    m_orig[m_nTrackIndex] = m_nTracker;
    ResizePanes();
  }
}
void CTreePropSheetSplitter::SetPaneHeight(int nIndex,int nHeight)
{
	ASSERT(nIndex >= 0 && nIndex < m_nPanes);

	if (m_nOrientation == SSP_VERT)
	{
		m_orig[nIndex + 1] = nHeight +  m_nBarThickness ;

		CRect rcClient;
		int mouse_pos = nHeight;
		for (m_nTrackIndex = 1; (m_nTrackIndex < m_nPanes && m_orig[m_nTrackIndex] < mouse_pos); m_nTrackIndex++);
		m_nTracker = m_orig[m_nTrackIndex];
		m_nTrackerMouseOffset = mouse_pos - m_nTracker;
		GetWindowRect(&rcClient);
		GetParent()->ScreenToClient(&rcClient);
		m_nTrackerLength = rcClient.Width();

		CRect rcOuter;
		int size_sum;
		GetAdjustedClientRect(&rcOuter);
		size_sum = m_nOrientation == SSP_HORZ ? rcOuter.Width() : rcOuter.Height();
		size_sum -= (m_nPanes - 1) * m_nBarThickness;
		m_orig[m_nTrackIndex] = m_nTracker;
		m_size[m_nTrackIndex - 1] = MulDivRound(m_orig[m_nTrackIndex] - m_orig[m_nTrackIndex - 1] - m_nBarThickness, FULL_SIZE, size_sum);
		m_size[m_nTrackIndex]     = MulDivRound(m_orig[m_nTrackIndex + 1] - m_orig[m_nTrackIndex] - m_nBarThickness, FULL_SIZE, size_sum);

		ResizePanes();
	}	
}
void CTreePropSheetSplitter::SetPaneSizes(const int* sizes)
{
	int i, total = 0, total_in = 0;
	
	for (i = 0; i < m_nPanes; i++)
	{
		ASSERT(sizes[i] >= 0);
		total += sizes[i];
	}
	for (i = 0; i < m_nPanes - 1; i++)
	{
		m_size[i] = MulDivRound(sizes[i], FULL_SIZE, total);
		total_in += m_size[i];
	}
	m_size[m_nPanes - 1] = FULL_SIZE - total_in;
	RecalcLayout();
	ResizePanes();
}
void CTreePropSheetSplitter::OnLButtonUp(UINT nFlags, CPoint point) 
{
  UNREFERENCED_PARAMETER(nFlags);
  UNREFERENCED_PARAMETER(point);

  if (GetCapture() != this) 
		return;

	CRect rcOuter;
	int size_sum;

	GetAdjustedClientRect(&rcOuter);
	size_sum = m_nOrientation == SSP_HORZ ? rcOuter.Width() : rcOuter.Height();
	size_sum -= (m_nPanes - 1) * m_nBarThickness;

  InvertTracker();
	ReleaseCapture();
	m_orig[m_nTrackIndex] = m_nTracker;
	m_size[m_nTrackIndex - 1] = MulDivRound(m_orig[m_nTrackIndex] - m_orig[m_nTrackIndex - 1] - m_nBarThickness, FULL_SIZE, size_sum);
	m_size[m_nTrackIndex]     = MulDivRound(m_orig[m_nTrackIndex + 1] - m_orig[m_nTrackIndex] - m_nBarThickness, FULL_SIZE, size_sum);
	ResizePanes();
}
void CTreePropSheetSplitter::OnSize(UINT nType, int cx, int cy) 
{
	CWnd::OnSize(nType, cx, cy);
	RecalcLayout();
	ResizePanes();
}