This commit is contained in:
varada%netscape.com 1999-05-19 03:17:50 +00:00
Родитель 63fe3036ab
Коммит ac464a5c91
6 изменённых файлов: 709 добавлений и 0 удалений

140
cck/driver/HelpDlg.cpp Normal file
Просмотреть файл

@ -0,0 +1,140 @@
// HelpDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WizardMachine.h"
#include "HelpDlg.h"
#include "stdio.h"
#include "fstream.h"
#include "WizHelp.h"
extern NODE *CurrentNode;
extern char iniFilePath[MAX_SIZE];
extern CString iniTracker;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CHelpDlg dialog
CHelpDlg::CHelpDlg(CWnd* pParent /*=NULL*/)
: CDialog(CHelpDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CHelpDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
//DoModal();
}
BOOL CHelpDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// CWnd ThatWind;
// char buffer[MAX_SIZE];
FILE *fPtr;
CString Helptext = CString(iniFilePath) + "\\" + iniTracker;
// ThatWind.MessageBox(Helptext,"something",MB_OK);
if( !( fPtr = fopen(Helptext, "r") ) )
{
CWnd myWnd;
myWnd.MessageBox("Unable to open file" + Helptext, "ERROR", MB_OK);
exit( 3 );
}
else
fseek(fPtr, 0,2);
long f_size = ftell(fPtr);
fseek (fPtr,0,0);
char *file_buffer;
file_buffer = (char *) malloc (f_size);
fread (file_buffer,1,f_size,fPtr);
file_buffer[f_size]=NULL;
// ThatWind.MessageBox(file_buffer,"buffer",MB_OK);
CEdit *ebptr =(CEdit *) GetDlgItem(IDC_EDIT1);
ebptr->SetWindowText(file_buffer);
return TRUE;
}
void CHelpDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CHelpDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CHelpDlg, CDialog)
//{{AFX_MSG_MAP(CHelpDlg)
ON_WM_CREATE()
ON_WM_CTLCOLOR()
ON_WM_PAINT()
ON_WM_LBUTTONDBLCLK()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CHelpDlg message handlers
BOOL CHelpDlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
BOOL CHelpDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::OnCommand(wParam, lParam);
}
int CHelpDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
HBRUSH CHelpDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
}
void CHelpDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CDialog::OnPaint() for painting messages
}
int CHelpDlg::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DoModal();
}
void CHelpDlg::OnLButtonDblClk(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDblClk(nFlags, point);
}

54
cck/driver/HelpDlg.h Normal file
Просмотреть файл

@ -0,0 +1,54 @@
#if !defined(AFX_HELPDLG_H__3C5A5EA1_0257_11D3_B1F4_006008A6BBCE__INCLUDED_)
#define AFX_HELPDLG_H__3C5A5EA1_0257_11D3_B1F4_006008A6BBCE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// HelpDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CHelpDlg dialog
class CHelpDlg : public CDialog
{
// Construction
public:
CHelpDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CHelpDlg)
enum { IDD = IDD_HELP_DLG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CHelpDlg)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual int DoModal();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
virtual BOOL OnInitDialog();
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CHelpDlg)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg void OnPaint();
afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_HELPDLG_H__3C5A5EA1_0257_11D3_B1F4_006008A6BBCE__INCLUDED_)

192
cck/driver/ImgDlg.cpp Normal file
Просмотреть файл

@ -0,0 +1,192 @@
// ImgDlg.cpp : implementation file
//
#include "stdafx.h"
#include "WizardMachine.h"
#include "ImgDlg.h"
#include "HelpDlg.h"
#include "WizHelp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CImgDlg dialog
extern char iniFilePath[MAX_SIZE];
extern char imagesPath[MAX_SIZE];
extern CString iniTracker;
CImgDlg::CImgDlg(CWnd* pParent /*=NULL*/)
: CDialog(CImgDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CImgDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CImgDlg::CImgDlg(CString theIniFileName, CWnd* pParent /*=NULL*/)
: CDialog(CImgDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CImageDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
imageSectionName = "IMAGE";
// All the images to be displayed on button clicks are
// in this iniFile. So iniFileName is initialized thus.
iniFileName = CString(iniFilePath) + theIniFileName;
ReadImageFromIniFile();
}
void CImgDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CImgDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CImgDlg, CDialog)
//{{AFX_MSG_MAP(CImgDlg)
ON_BN_CLICKED(IDC_HELP_BUTTON, OnHelpButton)
ON_WM_CREATE()
ON_WM_PAINT()
ON_WM_CTLCOLOR()
ON_WM_HELPINFO()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CImgDlg message handlers
void CImgDlg::OnHelpButton()
{
// TODO: Add your control notification handler code here
// CWnd Mywnd;
// Mywnd.MessageBox("hello","hello",MB_OK);
CHelpDlg hlpdlg;
int retVal = hlpdlg.DoModal();
}
int CImgDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CImgDlg::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect(0, 0, 4, 8);
MapDialogRect(&rect);
int baseWidth = rect.Width();
int baseHeight = rect.Height();
CClientDC cdc(this);
HBITMAP hbmpOld;
CDC dcMem;
dcMem.CreateCompatibleDC(&cdc);
hbmpOld = (HBITMAP)::SelectObject(dcMem, image.hBitmap);
dc.BitBlt((int)((float)(image.location.x) * (float)baseWidth / 4.0),
(int)((float)(image.location.y) * (float)baseHeight / 8.0),
(int)((float)(image.size.width) * (float)baseWidth / 4.0),
(int)((float)(image.size.height) * (float)baseHeight / 8.0),
&dcMem,
0,
0,
SRCCOPY);
// Do not call CDialog::OnPaint() for painting messages
}
void CImgDlg::ReadImageFromIniFile()
{
char buffer[500];
GetPrivateProfileString(imageSectionName, "Name", "", buffer, 250, iniFileName);
image.name = CString(imagesPath) + CString(buffer);
GetPrivateProfileString(imageSectionName, "start_X", "", buffer, 250, iniFileName);
image.location.x = atoi(buffer);
GetPrivateProfileString(imageSectionName, "start_Y", "", buffer, 250, iniFileName);
image.location.y = atoi(buffer);
GetPrivateProfileString(imageSectionName, "width", "", buffer, 250, iniFileName);
image.size.width = atoi(buffer);
GetPrivateProfileString(imageSectionName, "height", "", buffer, 250, iniFileName);
image.size.height = atoi(buffer);
image.hBitmap = (HBITMAP)LoadImage(NULL, image.name, IMAGE_BITMAP, 0, 0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
GetPrivateProfileString(imageSectionName, "Help", "", buffer, 250, iniFileName);
iniTracker = CString(buffer);
}
BOOL CImgDlg::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::OnCommand(wParam, lParam);
}
int CImgDlg::DoModal()
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::DoModal();
}
BOOL CImgDlg::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
HBRUSH CImgDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
// TODO: Return a different brush if the default is not desired
return hbr;
}
BOOL CImgDlg::OnHelpInfo(HELPINFO* pHelpInfo)
{
// TODO: Add your message handler code here and/or call default
return CDialog::OnHelpInfo(pHelpInfo);
}
BOOL CImgDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}

77
cck/driver/ImgDlg.h Normal file
Просмотреть файл

@ -0,0 +1,77 @@
#if !defined(AFX_IMGDLG_H__53403F00_0198_11D3_B1F3_006008A6BBCE__INCLUDED_)
#define AFX_IMGDLG_H__53403F00_0198_11D3_B1F3_006008A6BBCE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ImgDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CImgDlg dialog
class CImgDlg : public CDialog
{
// Construction
public:
CImgDlg(CWnd* pParent = NULL); // standard constructor
CImgDlg(CString theIniFileName, CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CImgDlg)
enum { IDD = IDD_IMG_DLG };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CImgDlg)
public:
virtual int DoModal();
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
typedef struct DIMENSION
{
int width;
int height;
}DIMENSION;
typedef struct IMAGE
{
CString name;
POINT location;
DIMENSION size;
HBITMAP hBitmap;
}IMAGE;
CString imageSectionName;
CString iniFileName;
IMAGE image;
void ReadImageFromIniFile();
protected:
// Generated message map functions
//{{AFX_MSG(CImgDlg)
afx_msg void OnHelpButton();
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnPaint();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_IMGDLG_H__53403F00_0198_11D3_B1F3_006008A6BBCE__INCLUDED_)

181
cck/driver/WizHelp.cpp Normal file
Просмотреть файл

@ -0,0 +1,181 @@
// WizHelp.cpp : implementation file
//
#include "stdafx.h"
#include "WizardMachine.h"
#include "WizHelp.h"
#include "HelpDlg.h"
#include "stdio.h"
#include "fstream.h"
extern NODE *CurrentNode;
extern char iniFilePath[MAX_SIZE];
CString varSection = "Local Variables";
CString navCtrlSection = "Navigation Controls";
CString widgetSection = "Widget";
char buffer[MAX_SIZE];
WID GlobalWid[5];
char *secarray[5]={"Wid1","Wid2","Wid3","Wid4","Wid5"};
char *buttarray[5]={"Butt1","Butt2","Butt3","Butt4","Butt5"};
int number;
CString iniTracker;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CWizHelp dialog
CWizHelp::CWizHelp(CWnd* pParent /*=NULL*/)
: CDialog(CWizHelp::IDD, pParent)
{
//{{AFX_DATA_INIT(CWizHelp)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CWizHelp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CWizHelp)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CWizHelp, CDialog)
//{{AFX_MSG_MAP(CWizHelp)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CWizHelp message handlers
BOOL CWizHelp::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
return CDialog::Create(IDD, pParentWnd);
}
int CWizHelp::DoModal()
{
return CDialog::DoModal();
}
BOOL CWizHelp::OnInitDialog()
{
CDialog::OnInitDialog();
FILE *fPtr;
CWnd newb;
CString pagename = CurrentNode->localVars->pageName;
CString fname = pagename + ".ini";
CString inifilename = CString(iniFilePath) + "\\" + fname;
CString Hfilename;
CString Helpfilename;
GetPrivateProfileString(navCtrlSection, "Help", "", buffer, MAX_SIZE,inifilename );
Hfilename =buffer;
Helpfilename = CString(iniFilePath)+"\\" +Hfilename;
// newb.MessageBox(Helpfilename,inifilename,MB_OK);
if( !( fPtr = fopen( Helpfilename, "r") ) )
{
CWnd myWnd;
myWnd.MessageBox("Unable to open file" + Helpfilename, "ERROR", MB_OK);
exit( 3 );
}
else
GetPrivateProfileString(varSection, "Number", "", buffer, MAX_SIZE,Helpfilename );
number = atoi(buffer);
for (int count =0; count < number; count ++)
{
GetPrivateProfileString(secarray[count], "Value", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].value=buffer;
GetPrivateProfileString(secarray[count], "Target", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].target=buffer;
// newb.MessageBox(GlobalWid[count].value,secarray[count],MB_OK);
// newb.MessageBox(GlobalWid[count].target,secarray[count],MB_OK);
GetPrivateProfileString(secarray[count], "Start_x", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].location.x=atoi(buffer);
// newb.MessageBox(buffer,secarray[count],MB_OK);
GetPrivateProfileString(secarray[count], "Start_y", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].location.y=atoi(buffer);
// newb.MessageBox(buffer,secarray[count],MB_OK);
GetPrivateProfileString(secarray[count], "Width", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].size.width=atoi(buffer);
// newb.MessageBox(buffer,secarray[count],MB_OK);
GetPrivateProfileString(secarray[count], "Height", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].size.height=atoi(buffer);
// newb.MessageBox(buffer,secarray[count],MB_OK);
GetPrivateProfileString(secarray[count], "ButtonID", "", buffer, MAX_SIZE,Helpfilename );
GlobalWid[count].ButtonID=atoi(buffer);
CButton* Button1;
Button1= new CButton;
CRect tmpRect = CRect(GlobalWid[count].location.x, GlobalWid[count].location.y, (GlobalWid[count].location.x + GlobalWid[count].size.width), (GlobalWid[count].location.y + GlobalWid[count].size.height));
// int k=((CButton*)Button1)->Create("Button1", BS_PUSHBUTTON | WS_TABSTOP|WS_VISIBLE | WS_CHILD, tmpRect, this, ID);
int k=Button1->Create("GlobalWid[count].value", BS_PUSHBUTTON | WS_TABSTOP|WS_VISIBLE, tmpRect, this, GlobalWid[count].ButtonID);
}
/* fseek(fPtr, 0,2);
long f_size = ftell(fPtr);
fseek (fPtr,0,0);
char *file_buffer;
file_buffer = (char *) malloc (f_size);
fread (file_buffer,1,f_size,fPtr);
file_buffer[f_size]=NULL;
*/
// ReadIniFile
// TODO: Add extra initialization here
// TODO: Add your specialized code here and/or call the base class
/* int s_x = 10;
int s_y = 10;
int s_width = 60;
int s_height = 25;
int ID = 9999;
// CWnd* Button1;
CButton* Button1;
Button1= new CButton;
CRect tmpRect = CRect(s_x, s_y, (s_x + s_width), (s_y + s_height));
// int k=((CButton*)Button1)->Create("Button1", BS_PUSHBUTTON | WS_TABSTOP|WS_VISIBLE | WS_CHILD, tmpRect, this, ID);
int k=Button1->Create("Button", BS_PUSHBUTTON | WS_TABSTOP|WS_VISIBLE, tmpRect, this, ID);
*/
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CWizHelp::OnCommand(WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
for (int integ =0; integ <number; integ ++)
{
if (GlobalWid[integ].ButtonID== (int)wParam)
{//CWnd newwindow;
// newwindow.MessageBox(GlobalWid[integ].target,"newbox",MB_OK);
iniTracker = GlobalWid[integ].target;
// newwindow.MessageBox(iniTracker,"newbox",MB_OK);
CHelpDlg helpdlg;
helpdlg.DoModal();
}
}
return CDialog::OnCommand(wParam, lParam);
}

65
cck/driver/WizHelp.h Normal file
Просмотреть файл

@ -0,0 +1,65 @@
#if !defined(AFX_WIZHELP_H__8A0EF609_08A7_11D3_B200_006008A6BBCE__INCLUDED_)
#define AFX_WIZHELP_H__8A0EF609_08A7_11D3_B200_006008A6BBCE__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// WizHelp.h : header file
//
typedef struct AREA
{
int width;
int height;
}AREA;
typedef struct WID
{
CString value;
CString target;
POINT location;
AREA size;
int ButtonID;
}WID;
/////////////////////////////////////////////////////////////////////////////
// CWizHelp dialog
class CWizHelp : public CDialog
{
// Construction
public:
CWizHelp(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CWizHelp)
enum { IDD = IDD_WIZ_HELP };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CWizHelp)
public:
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext = NULL);
virtual int DoModal();
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CWizHelp)
virtual BOOL OnInitDialog();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_WIZHELP_H__8A0EF609_08A7_11D3_B200_006008A6BBCE__INCLUDED_)