/***************************************************************************** * * Copyright (c) 1999, KL GROUP INC. All Rights Reserved. * http://www.klgroup.com * * This file is provided for demonstration and educational uses only. * Permission to use, copy, modify and distribute this file for * any purpose and without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all * copies, and that the name of KL Group not be used in advertising * or publicity pertaining to this material without the specific, * prior written permission of an authorized representative of * KL Group. * * KL GROUP MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED * TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE, OR NON-INFRINGEMENT. KL GROUP SHALL NOT BE LIABLE FOR ANY * DAMAGES SUFFERED BY USERS AS A RESULT OF USING, MODIFYING OR * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. */ // ScrollTimeView.h : interface of the CScrollTimeView class // ///////////////////////////////////////////////////////////////////////////// //{{AFX_INCLUDES() #include "chart2d.h" //}}AFX_INCLUDES #if !defined(AFX_SCROLLTIMEVIEW_H__07C5BA30_4603_11D1_AA18_00A0245E13F3__INCLUDED_) #define AFX_SCROLLTIMEVIEW_H__07C5BA30_4603_11D1_AA18_00A0245E13F3__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 #include #include #include #include "Axis.h" #include "AxisCollection.h" #include "ChartGroup.h" #include "ChartGroupCollection.h" #include "Chart2DData.h" #include "Marker.h" #include "MarkerCollection.h" #define MAXSTOREDZOOMS 24 #define HOURS (60 * 60) #define SECOND (1.0 / (60 * 60)) #define MINUTE (1.0 / 60) #define HOUR (1) #define DAY (HOUR * 24) #define WEEK (DAY * 7) #define MONTH (DAY * 31) #define YEAR (DAY * 365) #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) > (a) : (b)) #define CLAMP(x, Lo, Hi) ((x) > (Hi) ? (Hi) : ((x) < (Lo) ? (Lo) : (x))) typedef struct { int NDays; int Lo; int Hi; } TEMPS; class CScrollTimeView : public CFormView { protected: // create from serialization only CScrollTimeView(); DECLARE_DYNCREATE(CScrollTimeView) //Storage for generating the Time Data static TEMPS m_TempRange[12]; int m_BaseTime; //Storage for the Scrollbar int m_HScrollLargePageValue; //Storage for zooming in on the Chart int m_StoredZooms[MAXSTOREDZOOMS][2]; int m_CurrentZoom; //Storage for doing the Zoom Rectangle CRect m_MyRect; CRect m_InvRect; CPoint m_StartPoint; CPoint m_EndPoint; long m_TotalPoints; //Storage for the Form's background color CBrush m_hBackColor; //Other Storage bool m_bDoubleClickCapture; bool m_bMaxZoomsReached; CChartGroup m_cGroup; CAxis m_AxisX; CAxis m_AxisY; CMarker m_MarkerX; //Functions double VRAND(double Range); double GenTemp(long XValue); void GenerateTimeData(); struct tm * Convert_Time(int y, int m, int d, int h, int mn, int s); void SetDataRange(int First, int Last); time_t DataToSeconds(int Hours); void SetZoom(long Level); public: //{{AFX_DATA(CScrollTimeView) enum { IDD = IDD_SCROLLTIME_FORM }; CButton m_UpOneZoom; CButton m_ResetZoom; CStatic m_lblDateTemp; CScrollBar m_hScroll; CChart2D m_chart; //}}AFX_DATA // Attributes public: CScrollTimeDoc* GetDocument(); // Operations public: // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CScrollTimeView) public: virtual BOOL PreCreateWindow(CREATESTRUCT& cs); virtual void OnInitialUpdate(); protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation public: virtual ~CScrollTimeView(); #ifdef _DEBUG virtual void AssertValid() const; virtual void Dump(CDumpContext& dc) const; #endif protected: // Generated message map functions protected: //{{AFX_MSG(CScrollTimeView) afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar); afx_msg void Chart_OnMouseDown(short Button, short Shift, long x, long y); afx_msg void Chart_OnMouseMove(short Button, short Shift, long x, long y); afx_msg void Chart_OnMouseUp(short Button, short Shift, long x, long y); afx_msg void OnDestroy(); afx_msg void OnUpOneZoom(); afx_msg void OnResetZoom(); afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor); afx_msg void Chart_OnDblClick(); DECLARE_EVENTSINK_MAP() //}}AFX_MSG DECLARE_MESSAGE_MAP() }; #ifndef _DEBUG // debug version in ScrollTimeView.cpp inline CScrollTimeDoc* CScrollTimeView::GetDocument() { return (CScrollTimeDoc*)m_pDocument; } #endif ///////////////////////////////////////////////////////////////////////////// //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #endif // !defined(AFX_SCROLLTIMEVIEW_H__07C5BA30_4603_11D1_AA18_00A0245E13F3__INCLUDED_)