home *** CD-ROM | disk | FTP | other *** search
- // HTBLineChart.cpp : Defines the initialization routines for the DLL.
- //
-
- #include "stdafx.h"
- #include "HTBLineChart.h"
- #include "dialogthread.h"
- #include "linechartdlg.h"
- #include "chartline.h"
-
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
-
- //
- // Note!
- //
- // If this DLL is dynamically linked against the MFC
- // DLLs, any functions exported from this DLL which
- // call into MFC must have the AFX_MANAGE_STATE macro
- // added at the very beginning of the function.
- //
- // For example:
- //
- // extern "C" BOOL PASCAL EXPORT ExportedFunction()
- // {
- // AFX_MANAGE_STATE(AfxGetStaticModuleState());
- // // normal function body here
- // }
- //
- // It is very important that this macro appear in each
- // function, prior to any calls into MFC. This means that
- // it must appear as the first statement within the
- // function, even before any object variable declarations
- // as their constructors may generate calls into the MFC
- // DLL.
- //
- // Please see MFC Technical Notes 33 and 58 for additional
- // details.
- //
-
- /////////////////////////////////////////////////////////////////////////////
- // CHTBLineChartApp
-
- BEGIN_MESSAGE_MAP(CHTBLineChartApp, CWinApp)
- //{{AFX_MSG_MAP(CHTBLineChartApp)
- // NOTE - the ClassWizard will add and remove mapping macros here.
- // DO NOT EDIT what you see in these blocks of generated code!
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CHTBLineChartApp construction
-
- CHTBLineChartApp::CHTBLineChartApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CHTBLineChartApp object
-
- CHTBLineChartApp theApp;
-
- LineChartDlg* g_pLCDlg = NULL;
- int g_UpperBound = 100;
- int g_LowerBound = 0;
- int g_Timer = 100;
- CChartLine * g_pChartLines = NULL;
- int g_Width;
- int g_Height;
- CString g_Title;
- CString g_Label;
-
- void Linechart(char * Title,char * Label,int Width,int Height,int Lower, int Upper, long Timer)
- { if (g_pLCDlg != NULL)
- { return;
- }
-
- g_Title = Title;
- g_Label = Label;
- g_Width = Width;
- g_Height = Height;
- g_LowerBound = Lower;
- g_UpperBound = Upper;
- g_Timer = Timer;
-
- CWinThread * pThread = AfxBeginThread(RUNTIME_CLASS (DialogThread)); // create thread to execute dialog
- }
-
- short Addline(short LineNumber,short red, short blue, short green,long * pData)
- { CChartLine * pLine=NULL;
-
- if (g_pLCDlg == NULL)
- { return(-1);
- }
-
- if (red < 0 || red > 255)
- { return(-1);
- }
-
- if (blue < 0 || blue > 255)
- { return (-1);
- }
-
- if (green < 0 || green > 255)
- { return (-1);
- }
-
- if (pData == NULL)
- { return(-1);
- }
-
- pLine = new CChartLine(LineNumber,pData);
- if (g_pChartLines != NULL)
- { g_pChartLines->AddToList(pLine);
- }
- else
- { g_pChartLines = pLine;
- }
-
-
- g_pLCDlg->Chartline(red,blue,green);
-
-
- return(0);
- }
-
- void Viewlinechart()
- { if (g_pLCDlg == NULL)
- { return;
- }
-
- g_pLCDlg->SetForegroundWindow();
- }
-
- void Closelinechart()
- { if (g_pLCDlg == NULL)
- { return;
- }
-
- g_pLCDlg->KillTimer(1);
-
- g_pLCDlg->EndDialog(0);
-
- g_pLCDlg = NULL;
- }
-
- void Signalabove(short LineNumber, int Value,short signal)
- { if (g_pChartLines != NULL)
- { g_pChartLines->SetSignalAbove(LineNumber,Value,signal);
- }
- }
-
- void Signalbelow(short LineNumber, int Value,short signal)
- { if (g_pChartLines != NULL)
- { g_pChartLines->SetSignalBelow(LineNumber,Value,signal);
- }
- }
-