You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
176 lines
4.2 KiB
176 lines
4.2 KiB
//----------------------------------------------------------------------------
|
|
// Laser Guard Ltd.
|
|
// Copyright © 2000-2002. All Rights Reserved.
|
|
// Version 1.0 01/01/2000
|
|
// Last modification: 02/11/2003
|
|
// PROJECT:
|
|
// SUBSYSTEM:
|
|
// FILE: LgSubScrollDlg.cpp
|
|
// AUTHOR: Sergey Chizhevskiy
|
|
// OVERVIEW
|
|
// ~~~~~~~~
|
|
// Source file of LgSubScrollDlg.cpp
|
|
//----------------------------------------------------------------------------
|
|
#include "stdafx.h"
|
|
#include "lglibreport.h"
|
|
#include "LgSubScrollDlg.h"
|
|
#include "LgReportDlg.h"
|
|
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
CLgSubScrollDlg::CLgSubScrollDlg(CWnd* pParent /*=NULL*/)
|
|
: CDialog(CLgSubScrollDlg::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CLgSubScrollDlg)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_pReportDlg = NULL;
|
|
memset( &m_ReportEvent, 0, sizeof(m_ReportEvent) );
|
|
}
|
|
|
|
|
|
void CLgSubScrollDlg::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CLgSubScrollDlg)
|
|
DDX_Control(pDX, IDC_SCROLLBAR_VIDEO, m_ScrollBarVideo);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CLgSubScrollDlg, CDialog)
|
|
//{{AFX_MSG_MAP(CLgSubScrollDlg)
|
|
ON_WM_SIZE()
|
|
ON_WM_HSCROLL()
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CLgSubScrollDlg message handlers
|
|
|
|
BOOL CLgSubScrollDlg::Create(CLgReportDlg *pReportDlg, CWnd *pParentWnd, CRect *pRect )
|
|
{
|
|
m_pReportDlg = pReportDlg;
|
|
|
|
if( !CDialog::Create( IDD, pParentWnd ) )
|
|
return FALSE;
|
|
|
|
ShowWindow( SW_SHOW );
|
|
|
|
CRect rect;
|
|
|
|
if( pRect )
|
|
rect = *pRect;
|
|
else
|
|
pParentWnd->GetClientRect( &rect );
|
|
|
|
MoveWindow( &rect );
|
|
|
|
return TRUE;
|
|
}
|
|
|
|
void CLgSubScrollDlg::OnSize(UINT nType, int cx, int cy)
|
|
{
|
|
CDialog::OnSize(nType, cx, cy);
|
|
|
|
if( m_ScrollBarVideo.GetSafeHwnd() )
|
|
m_ScrollBarVideo.MoveWindow( 0, 0, cx, cy );
|
|
}
|
|
|
|
void CLgSubScrollDlg::OnHScroll( UINT nSBCode, UINT nPos, CScrollBar* pScrollBar )
|
|
{
|
|
// Get the minimum and maximum scroll-bar positions.
|
|
int minpos;
|
|
int maxpos;
|
|
pScrollBar->GetScrollRange(&minpos, &maxpos);
|
|
maxpos = pScrollBar->GetScrollLimit();
|
|
|
|
// Get the current position of scroll box.
|
|
int curpos = pScrollBar->GetScrollPos();
|
|
|
|
// Determine the new position of scroll box.
|
|
switch (nSBCode)
|
|
{
|
|
case SB_LEFT: // Scroll to far left.
|
|
curpos = minpos;
|
|
break;
|
|
|
|
case SB_RIGHT: // Scroll to far right.
|
|
curpos = maxpos;
|
|
break;
|
|
|
|
case SB_ENDSCROLL: // End scroll.
|
|
break;
|
|
|
|
case SB_LINELEFT: // Scroll left.
|
|
if (curpos > minpos)
|
|
curpos--;
|
|
break;
|
|
|
|
case SB_LINERIGHT: // Scroll right.
|
|
if (curpos < maxpos)
|
|
curpos++;
|
|
break;
|
|
|
|
case SB_PAGELEFT: // Scroll one page left.
|
|
{
|
|
// Get the page size.
|
|
SCROLLINFO info;
|
|
pScrollBar->GetScrollInfo(&info, SIF_ALL);
|
|
|
|
if (curpos > minpos)
|
|
curpos = max(minpos, curpos - (int) info.nPage);
|
|
}
|
|
break;
|
|
|
|
case SB_PAGERIGHT: // Scroll one page right.
|
|
{
|
|
// Get the page size.
|
|
SCROLLINFO info;
|
|
pScrollBar->GetScrollInfo(&info, SIF_ALL);
|
|
|
|
if (curpos < maxpos)
|
|
curpos = min(maxpos, curpos + (int) info.nPage);
|
|
}
|
|
break;
|
|
|
|
case SB_THUMBPOSITION: // Scroll to absolute position. nPos is the position
|
|
curpos = nPos; // of the scroll box at the end of the drag
|
|
// operation.
|
|
break;
|
|
|
|
case SB_THUMBTRACK: // Drag scroll box to specified position. nPos is
|
|
// the
|
|
curpos = nPos; // position that the scroll box has been dragged
|
|
// to.
|
|
break;
|
|
}
|
|
|
|
// Set the new position of the thumb (scroll box).
|
|
pScrollBar->SetScrollPos( curpos );
|
|
|
|
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
|
|
|
|
m_pReportDlg->LoadSiteDateTimeImage( TRUE, &m_ReportEvent );
|
|
}
|
|
|
|
void CLgSubScrollDlg::SetEvent( REPORT_EVENT_BASE *pEvent )
|
|
{
|
|
if( pEvent )
|
|
m_ReportEvent = *pEvent;
|
|
else
|
|
memset( &m_ReportEvent, 0, sizeof(m_ReportEvent) );
|
|
|
|
if( pEvent && pEvent->bImageCount )
|
|
{
|
|
m_ScrollBarVideo.SetScrollRange( 0, pEvent->bImageCount - 1 );
|
|
m_ScrollBarVideo.SetScrollPos( 0 );
|
|
m_ScrollBarVideo.EnableWindow( TRUE );
|
|
}
|
|
else
|
|
m_ScrollBarVideo.EnableWindow( FALSE );
|
|
}
|