home *** CD-ROM | disk | FTP | other *** search
- // LineChartDlg.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "HTBLineChart.h"
- #include "LineChartDlg.h"
- #include "Chartline.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- #define TEXTHEIGHT 25
- #define WIDTHADJUST 30
- #define HEIGHTADJUST 75
-
- /////////////////////////////////////////////////////////////////////////////
- // LineChartDlg dialog
-
-
- LineChartDlg::LineChartDlg(CWnd* pParent /*=NULL*/)
- : CDialog(LineChartDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(LineChartDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
-
-
- void LineChartDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(LineChartDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(LineChartDlg, CDialog)
- //{{AFX_MSG_MAP(LineChartDlg)
- ON_WM_TIMER()
- ON_WM_CLOSE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // LineChartDlg message handlers
-
- BOOL LineChartDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- SetWindowText(g_Title); // set window title
- SetDlgItemText(IDC_LABEL,g_Label); // set static text control text
-
- CWnd* pStaticText = GetDlgItem(IDC_LABEL); // get pointer to static text control text
- pStaticText->SetWindowPos(NULL,0,0,g_Width,TEXTHEIGHT,SWP_NOZORDER | SWP_NOMOVE); // set width of static text control
-
- m_wndLineChart.SubclassDlgItem(IDC_LINE_CHART_CTRL, this);
-
- CWnd* pLineChart = GetDlgItem(IDC_LINE_CHART_CTRL); // get pointer to static text control text
- pLineChart->SetWindowPos(NULL,0,0,g_Width,g_Height,SWP_NOZORDER | SWP_NOMOVE); // set width of static text control
-
- // set window size
- SetWindowPos(NULL,0,0,g_Width+WIDTHADJUST,g_Height+HEIGHTADJUST,SWP_NOZORDER );
-
- SetForegroundWindow();
-
- SetTimer(1, m_TimerValue, NULL);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
-
- void LineChartDlg::OnTimer(UINT nIDEvent)
- { CChartLine * pCurrent = g_pChartLines;
-
- BringWindowToTop();
-
- if (pCurrent != NULL)
- { do
- { m_wndLineChart.SetPos(pCurrent->GetID(),*(pCurrent->GetDataPtr()));
- pCurrent->SendSignals();
- pCurrent = pCurrent->GetNextLine();
- } while(pCurrent != NULL);
-
- m_wndLineChart.Go();
- }
- CDialog::OnTimer(nIDEvent);
- }
-
- void LineChartDlg::SetBounds(int Lower, int Upper)
- { m_LowerBound = Lower;
- m_UpperBound = Upper;
-
- }
-
- void LineChartDlg::Chartline(short red, short blue, short green)
- {
-
-
- m_wndLineChart.Add(RGB(red,blue,green),m_UpperBound,m_LowerBound);
-
- }
-
- void LineChartDlg::SetTimerValue(long Timer)
- {
- m_TimerValue = Timer;
- }
-
- void LineChartDlg::OnClose()
- { g_pLCDlg = NULL;
-
- KillTimer(1);
-
- CDialog::OnClose();
- }
-