1999-02-03 19:39:50 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-02 08:38:33 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-02-03 19:39:50 +03:00
|
|
|
*
|
1999-11-02 08:38:33 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-02-03 19:39:50 +03:00
|
|
|
*
|
1999-11-02 08:38:33 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-02-03 19:39:50 +03:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-02 08:38:33 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-02-03 19:39:50 +03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// WizardMachine.cpp : Defines the class behaviors for the application.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
1999-10-12 05:54:00 +04:00
|
|
|
#include "afxmt.h"
|
1999-02-03 19:39:50 +03:00
|
|
|
#include <iostream.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <direct.h>
|
1999-10-23 03:42:02 +04:00
|
|
|
#include "globals.h"
|
|
|
|
#include "WizardMachine.h"
|
1999-05-19 07:31:11 +04:00
|
|
|
#include "HelpDlg.h"
|
|
|
|
#include "WizHelp.h"
|
1999-10-02 05:28:27 +04:00
|
|
|
#include "ImgDlg.h"
|
|
|
|
#include "SumDlg.h"
|
|
|
|
#include "NavText.h"
|
|
|
|
#include "NewDialog.h"
|
|
|
|
#include "NewConfigDialog.h"
|
|
|
|
#include "ProgDlgThread.h"
|
1999-10-12 04:56:51 +04:00
|
|
|
#include "PropSheet.h"
|
1999-10-12 05:54:00 +04:00
|
|
|
#include "WizardUI.h"
|
|
|
|
#include "Interpret.h"
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-05 06:22:36 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
#ifdef _DEBUG
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
#undef THIS_FILE
|
|
|
|
static char THIS_FILE[] = __FILE__;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CWizardMachineApp
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CWizardMachineApp, CWinApp)
|
|
|
|
//{{AFX_MSG_MAP(CWizardMachineApp)
|
1999-05-19 07:31:11 +04:00
|
|
|
// NOTE - the Class\ard will add and remove mapping macros here.
|
1999-02-03 19:39:50 +03:00
|
|
|
// DO NOT EDIT what you see in these blocks of generated code!
|
|
|
|
//}}AFX_MSG
|
1999-05-19 07:31:11 +04:00
|
|
|
ON_COMMAND(ID_HELP, CWizardMachineApp::HelpWiz)
|
1999-02-03 19:39:50 +03:00
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CWizardMachineApp construction
|
|
|
|
|
|
|
|
CWizardMachineApp::CWizardMachineApp()
|
|
|
|
{
|
|
|
|
// TODO: add construction code here,
|
|
|
|
// Place all significant initialization in InitInstance
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// The one and only CWizardMachineApp object
|
|
|
|
CPropSheet* PropertySheetDlg;
|
1999-10-12 05:54:00 +04:00
|
|
|
CInterpret *theInterpreter;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
CWizardMachineApp theApp;
|
|
|
|
NODE *GlobalDefaults;
|
|
|
|
NODE *WizardTree;
|
|
|
|
NODE *CurrentNode;
|
|
|
|
|
|
|
|
int CurrentPageBaseIndex=100;
|
|
|
|
|
|
|
|
CString Path;
|
|
|
|
char currDirPath[MAX_SIZE];
|
|
|
|
char iniFilePath[MAX_SIZE];
|
|
|
|
char imagesPath[MAX_SIZE];
|
|
|
|
char rootPath[MAX_SIZE];
|
|
|
|
char customizationPath[MAX_SIZE];
|
1999-09-30 04:39:06 +04:00
|
|
|
char asePath[MAX_SIZE];
|
|
|
|
char nciPath[MAX_SIZE];
|
|
|
|
char tmpPath[MAX_SIZE];
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-13 04:28:10 +04:00
|
|
|
BOOL IsNewValue = FALSE;
|
|
|
|
BOOL IsSameCache = TRUE;
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
CString CacheFile;
|
1999-08-30 01:30:16 +04:00
|
|
|
CString CachePath;
|
1999-02-03 19:39:50 +03:00
|
|
|
BOOL UseCache = FALSE;
|
|
|
|
extern CSingleLock prevLock;
|
|
|
|
extern BOOL isBuildInstaller;
|
|
|
|
//Output file pointer for QA purposes
|
1999-06-17 08:42:40 +04:00
|
|
|
// Optimize here on global pointers. This many not needed.
|
|
|
|
FILE *out, *globs, *filePtr;;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CWizardMachineApp initialization
|
|
|
|
|
|
|
|
BOOL CWizardMachineApp::InitInstance()
|
|
|
|
{
|
|
|
|
// Standard initialization
|
|
|
|
// If you are not using these features and wish to reduce the size
|
|
|
|
// of your final executable, you should remove from the following
|
|
|
|
// the specific initialization routines you do not need.
|
|
|
|
|
|
|
|
#ifdef _AFXDLL
|
|
|
|
Enable3dControls(); // Call this when using MFC in a shared DLL
|
|
|
|
#else
|
|
|
|
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CWnd myWnd;
|
|
|
|
|
|
|
|
//Do initializations
|
|
|
|
//Check for comm existence
|
|
|
|
//declare a tree for nodes
|
|
|
|
|
1999-10-12 05:54:00 +04:00
|
|
|
theInterpreter = new CInterpret();
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
Path = GetModulePath();
|
|
|
|
|
1999-02-05 04:02:27 +03:00
|
|
|
strcpy(currDirPath, Path);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-07 05:39:34 +04:00
|
|
|
CString Root = Path;
|
|
|
|
|
|
|
|
WIDGET* wroot = SetGlobal("Root",Root);
|
|
|
|
if (wroot)
|
|
|
|
wroot->cached = TRUE;
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
CString outputFile = Path + "output.dat";
|
1999-08-30 23:56:34 +04:00
|
|
|
out = fopen(outputFile, "w");
|
|
|
|
if (!out)
|
|
|
|
exit( 3 );
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
//char buffer[MID_SIZE];
|
|
|
|
char **argv;
|
|
|
|
int argc;
|
|
|
|
|
|
|
|
// 10 argument limit
|
1999-10-19 22:58:38 +04:00
|
|
|
argv = (char **) GlobalAlloc(0, sizeof(char **) * 10);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
int i=0;
|
|
|
|
// Each argument limited to 100 chars
|
|
|
|
argv[i] = strtok(m_lpCmdLine," ");
|
1999-10-19 22:58:38 +04:00
|
|
|
while(i<10 && argv[i])
|
1999-10-19 07:46:54 +04:00
|
|
|
argv[++i] = strtok(NULL," ");
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
argc = --i;
|
|
|
|
|
1999-11-04 01:22:31 +03:00
|
|
|
char tempini[MAX_SIZE];
|
1999-02-03 19:39:50 +03:00
|
|
|
CString iniFile;
|
|
|
|
CString action;
|
1999-11-04 01:22:31 +03:00
|
|
|
CString DefaultIni = Root + "WizardMachine.ini";
|
|
|
|
|
|
|
|
GetPrivateProfileString("Default", "inifile", "", tempini, MAX_SIZE, DefaultIni);
|
|
|
|
iniFile = CString(tempini);
|
|
|
|
if(iniFile.IsEmpty() || (iniFile.Right(4) != ".ini"))
|
|
|
|
{
|
|
|
|
AfxMessageBox("Please enter a valid App name in the WizardMachine.ini file", MB_OK);
|
|
|
|
exit(1);
|
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
for (i=0; i < argc; i++)
|
|
|
|
{
|
|
|
|
if (!strcmp(argv[i], "-i"))
|
|
|
|
iniFile = argv[i+1];
|
|
|
|
if (!strcmp(argv[i], "-p"))
|
|
|
|
action = argv[i+1];
|
|
|
|
}
|
1999-11-04 01:22:31 +03:00
|
|
|
#if 0
|
1999-10-19 22:58:38 +04:00
|
|
|
//GlobalFree(argv);
|
1999-06-17 08:42:40 +04:00
|
|
|
if ((iniFile.IsEmpty()) || (iniFile.GetLength() < 5) || (iniFile.Right(4) != ".ini"))
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
// Make life easier on us for now
|
|
|
|
iniFile = "cck.ini";
|
|
|
|
|
|
|
|
/*
|
1999-02-03 19:39:50 +03:00
|
|
|
myWnd.MessageBox("Please provide a valid inifile name.", "ERROR", MB_OK);
|
|
|
|
fprintf(out, "----------------** TERMINATED - Invalid INI file name **---------------\n");
|
|
|
|
exit(1);
|
1999-10-02 05:28:27 +04:00
|
|
|
*/
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-11-04 01:22:31 +03:00
|
|
|
#endif
|
1999-02-05 07:05:43 +03:00
|
|
|
for (i=iniFile.GetLength() -1; i >= 0 && iniFile[i] != '\\'; i--)
|
|
|
|
{
|
|
|
|
if (iniFile.GetAt(i) == '/' ) {
|
|
|
|
iniFile.SetAt(i,(TCHAR)'\\');
|
|
|
|
}
|
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
// Take care of absolute path to iniFiles and bitmaps
|
|
|
|
if (iniFile[1] == ':' && iniFile[2] == '\\')
|
|
|
|
{
|
|
|
|
int len = 0;
|
|
|
|
strcpy(iniFilePath, iniFile);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
int extractPosition = iniFile.ReverseFind('\\');
|
|
|
|
extractPosition++;
|
|
|
|
extractPosition = (iniFile.GetLength()) - extractPosition;
|
|
|
|
iniFile = iniFile.Right(extractPosition);
|
1999-02-05 04:02:27 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
len = strlen(iniFilePath);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
while(iniFilePath[len] != '\\')
|
|
|
|
{
|
|
|
|
iniFilePath[len] = '\0';
|
|
|
|
len--;
|
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
strcpy(imagesPath, iniFilePath);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
len--;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
while(imagesPath[len] != '\\')
|
|
|
|
{
|
|
|
|
imagesPath[len] = '\0';
|
|
|
|
len--;
|
|
|
|
}
|
|
|
|
|
1999-09-30 04:39:06 +04:00
|
|
|
strcpy(asePath,imagesPath);
|
|
|
|
|
|
|
|
strcat(asePath,"ase\\");
|
|
|
|
|
|
|
|
strcpy(nciPath,asePath);
|
|
|
|
|
|
|
|
strcat(nciPath,"NCIFiles\\");
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
strcat(imagesPath, "bitmaps\\");
|
1999-09-30 04:39:06 +04:00
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// Take care of relative path to iniFiles and bitmaps
|
|
|
|
|
|
|
|
strcpy(iniFilePath, currDirPath);
|
|
|
|
strcat(iniFilePath, "iniFiles\\");
|
|
|
|
strcpy(imagesPath, currDirPath);
|
|
|
|
strcat(imagesPath, "bitmaps\\");
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
strcpy(customizationPath, currDirPath);
|
1999-10-07 04:11:01 +04:00
|
|
|
strcat(customizationPath, "Configs\\");
|
1999-06-17 08:42:40 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
CString cacheExt = ".che";
|
1999-06-17 08:42:40 +04:00
|
|
|
CacheFile = CString(iniFile);
|
1999-02-03 19:39:50 +03:00
|
|
|
CacheFile = CacheFile.GetBufferSetLength(CacheFile.Find(".ini")) + cacheExt;
|
1999-08-30 01:30:16 +04:00
|
|
|
CachePath = Path + CacheFile;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
char buffer[MAX_SIZE] = {'\0'};
|
1999-08-30 01:30:16 +04:00
|
|
|
if (FileExists(CachePath))
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
UseCache = TRUE;
|
1999-08-30 23:56:34 +04:00
|
|
|
if (!FillGlobalWidgetArray(CachePath))
|
|
|
|
exit(10);
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(out, "___________________________________________________________\n\n");
|
|
|
|
fprintf(out, "ACTION SEQUENCE : %s\n", action);
|
|
|
|
fprintf(out, "___________________________________________________________\n\n");
|
|
|
|
|
|
|
|
SetGlobalDefaults();
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
InitializeTree(CString(iniFile));
|
|
|
|
CreateFirstLeaf(WizardTree, CString(iniFilePath) + CString(iniFile));
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
//BEGIN - Command line QA enable code
|
|
|
|
/**
|
|
|
|
i=0;
|
|
|
|
while(i < action.GetLength())
|
|
|
|
{
|
|
|
|
ExecuteAction(action.GetAt(i));
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateNewCache();
|
|
|
|
|
|
|
|
fprintf(out, "---------------------**** END ****-------------------------\n");
|
|
|
|
|
|
|
|
myWnd.MessageBox(CurrentNode->localVars->pageName, "Netscape", MB_OK);
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
**/
|
|
|
|
//END - Command line QA enable code
|
|
|
|
|
|
|
|
//CProgressDialog ProgressDialog;
|
|
|
|
PropertySheetDlg = new CPropSheet(IDD_WIZARDMACHINE_DIALOG);
|
|
|
|
//CWizardMachineDlg* myWndTmp;
|
|
|
|
|
|
|
|
CWizardUI* pages[99];
|
|
|
|
//CMyProgressDlg ProgressDialog(myWndTmp);
|
|
|
|
//ProgressDialog.Create(IDD_PROGRESS_DLG);
|
|
|
|
//CMyProgressDlg *pProgressDlg = &ProgressDialog;
|
|
|
|
|
|
|
|
for (int x = 0; x < 99; x++) {
|
|
|
|
pages[x] = new CWizardUI;
|
|
|
|
PropertySheetDlg->AddPage (pages[x]);
|
|
|
|
}
|
|
|
|
|
|
|
|
PropertySheetDlg->SetWizardMode();
|
|
|
|
int PageReturnValue = PropertySheetDlg->DoModal();
|
|
|
|
delete(PropertySheetDlg);
|
|
|
|
|
|
|
|
if (PageReturnValue == ID_WIZFINISH)
|
|
|
|
{
|
1999-11-16 06:14:13 +03:00
|
|
|
// CreateRshell(); //Creation of Rshell is a CCK specific task to be done by the install builder.
|
1999-10-29 22:35:58 +04:00
|
|
|
//removing the isbuildinstaller from the routine.
|
|
|
|
// if (!isBuildInstaller) {
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-29 22:35:58 +04:00
|
|
|
NODE* tmpNode = WizardTree->childNodes[0];
|
|
|
|
while (!tmpNode->numWidgets)
|
|
|
|
{
|
|
|
|
tmpNode = tmpNode->childNodes[0];
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-10-29 22:35:58 +04:00
|
|
|
|
|
|
|
CurrentNode = tmpNode;
|
|
|
|
// }
|
1999-06-17 08:42:40 +04:00
|
|
|
theApp.CreateNewCache();
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (PageReturnValue == IDCANCEL)
|
|
|
|
{
|
1999-10-16 05:40:06 +04:00
|
|
|
AfxMessageBox("All changed data excluding those on the current page will be saved", MB_OK);
|
|
|
|
|
1999-05-19 07:31:11 +04:00
|
|
|
theApp.CreateNewCache();
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-05-19 07:31:11 +04:00
|
|
|
if (PageReturnValue == ID_HELP)
|
|
|
|
{
|
|
|
|
|
|
|
|
CWnd Mywnd;
|
|
|
|
Mywnd.MessageBox("hello","hello",MB_OK);
|
|
|
|
}
|
|
|
|
//
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
//CreateNewCache();
|
|
|
|
|
|
|
|
fprintf(out, "---------------------**** END ****-------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
// Since the dialog has been closed, return FALSE so that we exit the
|
|
|
|
// application, rather than start the application's message pump.
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::InitializeTree(CString rootIniFile)
|
|
|
|
{
|
|
|
|
WizardTree = CreateNode(GlobalDefaults, rootIniFile);
|
|
|
|
PrintNodeInfo(WizardTree);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Create Node
|
|
|
|
NODE* CWizardMachineApp::CreateNode(NODE *parentNode, CString iniFile)
|
|
|
|
{
|
|
|
|
|
|
|
|
char buffer[MAX_SIZE]= { '\0' };
|
|
|
|
char visibility[MIN_SIZE] = {'\0'};
|
|
|
|
CString pagesSection = "Sub Pages";
|
|
|
|
CString varSection = "Local Variables";
|
|
|
|
CString navCtrlSection = "Navigation Controls";
|
|
|
|
CString widgetSection = "Widget";
|
|
|
|
CString imageSection = "Image";
|
|
|
|
CStringArray bufferArray;
|
|
|
|
NODE* NewNode = (NODE *) GlobalAlloc(0,sizeof(NODE) * 1);
|
|
|
|
|
1999-09-24 04:25:10 +04:00
|
|
|
// Initialize all the extra fields here...
|
|
|
|
NewNode->isWidgetsSorted = FALSE;
|
1999-05-19 07:31:11 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
NewNode->parent = parentNode;
|
|
|
|
|
|
|
|
iniFile = CString(iniFilePath)+iniFile; //Path+iniFile;
|
|
|
|
|
|
|
|
CheckIniFileExistence(iniFile);
|
|
|
|
|
|
|
|
GetPrivateProfileString(pagesSection, NULL, "", buffer, MAX_SIZE, iniFile);
|
|
|
|
|
|
|
|
NewNode->numChildNodes = GetBufferCount(buffer);
|
|
|
|
NewNode->currNodeIndex = 0;
|
|
|
|
|
|
|
|
NewNode->subPages = new PAGE;
|
|
|
|
|
|
|
|
int numHidePages = 0;
|
|
|
|
for (int i=0; i < NewNode->numChildNodes ; i++)
|
|
|
|
{
|
|
|
|
CString page = GetBufferElement(buffer, i);
|
|
|
|
|
|
|
|
GetPrivateProfileString(pagesSection, page, "", visibility, MAX_SIZE, iniFile);
|
|
|
|
|
|
|
|
CString visible = CString(visibility);
|
|
|
|
CString tmpVisible = CString(visibility);
|
|
|
|
visible.MakeUpper();
|
|
|
|
visible.TrimRight();
|
|
|
|
if ( visible != "HIDE")
|
|
|
|
{
|
|
|
|
NewNode->subPages->pages.Add(page);
|
|
|
|
NewNode->subPages->visibility.Add(tmpVisible);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
numHidePages++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NewNode->numChildNodes = NewNode->numChildNodes - numHidePages;
|
|
|
|
|
1999-10-19 07:46:54 +04:00
|
|
|
NewNode->childNodes = (NODE **) GlobalAlloc(0,(NewNode->numChildNodes+1) * sizeof(NODE **));
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-19 07:46:54 +04:00
|
|
|
for (i=0; i <= NewNode->numChildNodes ; i++)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
NewNode->childNodes[i] = NULL;
|
|
|
|
}
|
|
|
|
|
1999-10-16 02:55:06 +04:00
|
|
|
NewNode->localVars = new VARS;
|
|
|
|
GetPrivateProfileString(varSection, "Title", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->title = buffer;
|
|
|
|
if (NewNode->localVars->title == "")
|
|
|
|
{
|
|
|
|
NewNode->localVars->title = parentNode->localVars->title;
|
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
GetPrivateProfileString(varSection, "Caption", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->caption = buffer;
|
1999-10-19 05:30:18 +04:00
|
|
|
/* Obsolete...
|
1999-02-03 19:39:50 +03:00
|
|
|
GetPrivateProfileString(varSection, "Function", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->functionality = buffer;
|
1999-10-19 05:30:18 +04:00
|
|
|
*/
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-10-16 02:55:06 +04:00
|
|
|
NewNode->localVars->wizbut = new WIZBUT;
|
|
|
|
GetPrivateProfileString(varSection, "Back", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->wizbut->back = buffer;
|
|
|
|
if (NewNode->localVars->wizbut->back == "")
|
|
|
|
{
|
|
|
|
NewNode->localVars->wizbut->back = parentNode->localVars->wizbut->back;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetPrivateProfileString(varSection, "Next", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->wizbut->next = buffer;
|
|
|
|
if (NewNode->localVars->wizbut->next == "")
|
|
|
|
{
|
|
|
|
NewNode->localVars->wizbut->next = parentNode->localVars->wizbut->next;
|
|
|
|
}
|
|
|
|
GetPrivateProfileString(varSection, "Cancel", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->wizbut->cancel = buffer;
|
|
|
|
if (NewNode->localVars->wizbut->cancel == "")
|
|
|
|
{
|
|
|
|
NewNode->localVars->wizbut->cancel = parentNode->localVars->wizbut->cancel;
|
|
|
|
}
|
|
|
|
|
1999-10-27 01:10:39 +04:00
|
|
|
GetPrivateProfileString(varSection, "Help", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->wizbut->help = buffer;
|
|
|
|
if (NewNode->localVars->wizbut->help == "")
|
|
|
|
{
|
|
|
|
NewNode->localVars->wizbut->help = parentNode->localVars->wizbut->help;
|
|
|
|
}
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
CString tempPageVar = "";
|
|
|
|
|
|
|
|
int index = iniFile.ReverseFind('\\');
|
|
|
|
if (index != -1)
|
|
|
|
{
|
|
|
|
for (int j=index+1 ; j < iniFile.GetLength() ; j++)
|
|
|
|
{
|
|
|
|
char element = iniFile.GetAt(j);
|
|
|
|
if (element == '.')
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tempPageVar += element;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NewNode->localVars->pageName = tempPageVar;
|
|
|
|
|
|
|
|
|
|
|
|
GetPrivateProfileString(varSection, "image", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->image = buffer;
|
|
|
|
GetPrivateProfileString(varSection, "Visibility", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->localVars->visibility = buffer;
|
|
|
|
|
|
|
|
NewNode->navControls = new CONTROLS;
|
|
|
|
GetPrivateProfileString(navCtrlSection, "OnNext", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->navControls->onNextAction = buffer;
|
1999-09-30 04:39:06 +04:00
|
|
|
GetPrivateProfileString(navCtrlSection, "onEnter", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->navControls->onEnter = buffer;
|
1999-10-13 05:19:23 +04:00
|
|
|
// AfxMessageBox((LPCTSTR)(buffer),MB_OK);
|
1999-02-03 19:39:50 +03:00
|
|
|
GetPrivateProfileString(navCtrlSection, "Help", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->navControls->helpFile = buffer;
|
|
|
|
|
|
|
|
NewNode->pageWidgets = (WIDGET **) GlobalAlloc(0, MIN_SIZE * sizeof(WIDGET *));
|
|
|
|
NewNode->numWidgets = 0;
|
|
|
|
NewNode->currWidgetIndex = 0;
|
|
|
|
|
|
|
|
NewNode->pageBaseIndex = CurrentPageBaseIndex;
|
|
|
|
CurrentPageBaseIndex += MIN_SIZE;
|
|
|
|
|
|
|
|
// MAX 20 images/page ....?
|
|
|
|
NewNode->images = (IMAGE **) GlobalAlloc(0, 20 * sizeof(IMAGE *));
|
|
|
|
NewNode->numImages = 0;
|
|
|
|
|
|
|
|
char sectionBuffer[MID_SIZE];
|
|
|
|
GetPrivateProfileString(NULL, NULL, "", sectionBuffer, MAX_SIZE, iniFile);
|
|
|
|
char iniSection[MID_SIZE];
|
|
|
|
|
|
|
|
int idCounter=0;
|
1999-10-19 22:58:38 +04:00
|
|
|
for (i=0; NewNode->numImages < 20 &&
|
|
|
|
NewNode->numWidgets < MIN_SIZE &&
|
|
|
|
i < GetBufferCount(sectionBuffer);
|
|
|
|
i++)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
strcpy(iniSection,GetBufferElement(sectionBuffer, i));
|
|
|
|
|
|
|
|
if(strstr(iniSection, widgetSection))
|
|
|
|
{
|
|
|
|
char localBuffer[MAX_SIZE] = {'\0'};
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Name", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
strcpy(localBuffer, buffer);
|
|
|
|
|
|
|
|
WIDGET* widgetEntry = findWidget(buffer);
|
|
|
|
|
|
|
|
if (widgetEntry)
|
|
|
|
{
|
|
|
|
if (!widgetEntry->cached)
|
|
|
|
{
|
|
|
|
prevLock.Lock();
|
|
|
|
CWnd myWnd;
|
|
|
|
myWnd.MessageBox("Duplicate Widget Entry " + CString(buffer) + " detected : "+ NewNode->localVars->pageName , "Error", MB_ICONSTOP | MB_SYSTEMMODAL);
|
|
|
|
prevLock.Unlock();
|
|
|
|
exit(7);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-08-30 02:07:39 +04:00
|
|
|
BOOL readValue = (widgetEntry->value == "");
|
1999-02-03 19:39:50 +03:00
|
|
|
BuildWidget(widgetEntry, iniSection, iniFile, NewNode->pageBaseIndex, readValue);
|
|
|
|
|
|
|
|
widgetEntry->cached = FALSE;
|
|
|
|
NewNode->pageWidgets[NewNode->numWidgets] = widgetEntry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
BOOL readValue = TRUE;
|
|
|
|
GlobalWidgetArray[GlobalArrayIndex].cached = TRUE;
|
|
|
|
|
|
|
|
BuildWidget(&GlobalWidgetArray[GlobalArrayIndex], iniSection, iniFile, NewNode->pageBaseIndex, readValue);
|
|
|
|
GlobalWidgetArray[GlobalArrayIndex].cached = FALSE;
|
|
|
|
|
|
|
|
NewNode->pageWidgets[NewNode->numWidgets] = &GlobalWidgetArray[GlobalArrayIndex];
|
|
|
|
GlobalArrayIndex++;
|
|
|
|
}
|
|
|
|
|
|
|
|
(NewNode->numWidgets)++;
|
|
|
|
|
|
|
|
}
|
|
|
|
else if(strstr(iniSection, imageSection))
|
|
|
|
{
|
|
|
|
int index = NewNode->numImages;
|
|
|
|
|
|
|
|
// This allows dynamic buffer allocation to CString vars
|
|
|
|
NewNode->images[index] = new IMAGE;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Name", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->name = CString(imagesPath) + CString(buffer);
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Value", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->value = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "start_X", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->location.x = atoi(buffer);
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "start_Y", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->location.y = atoi(buffer);
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "width", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->size.width = atoi(buffer);
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "height", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
NewNode->images[index]->size.height = atoi(buffer);
|
|
|
|
|
|
|
|
NewNode->images[index]->hBitmap = (HBITMAP)LoadImage(NULL, NewNode->images[index]->name, IMAGE_BITMAP, 0, 0,
|
|
|
|
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
|
|
|
|
|
|
|
|
(NewNode->numImages)++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
parentNode->childNodes[parentNode->currNodeIndex] = NewNode;
|
|
|
|
|
|
|
|
CurrentNode = NewNode;
|
|
|
|
|
|
|
|
//PrintNodeInfo(CurrentNode);
|
|
|
|
|
|
|
|
return NewNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
//Create Node
|
|
|
|
void CWizardMachineApp::CreateNode()
|
|
|
|
{
|
|
|
|
GlobalDefaults = (NODE *) GlobalAlloc(0,sizeof(NODE) * 1);
|
|
|
|
|
|
|
|
GlobalDefaults->parent = NULL;
|
|
|
|
|
|
|
|
GlobalDefaults->childNodes = (NODE **) GlobalAlloc(0,1 * sizeof(NODE *));
|
|
|
|
GlobalDefaults->numChildNodes = 1;
|
|
|
|
GlobalDefaults->currNodeIndex = 0;
|
|
|
|
GlobalDefaults->childNodes[GlobalDefaults->currNodeIndex] = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
GlobalDefaults->localVars = new VARS;
|
|
|
|
GlobalDefaults->localVars->title = "Globals";
|
|
|
|
GlobalDefaults->localVars->caption = "Globals";
|
|
|
|
GlobalDefaults->localVars->pageName = "Globals";
|
|
|
|
GlobalDefaults->localVars->image = "Globals";
|
1999-10-16 02:55:06 +04:00
|
|
|
GlobalDefaults->localVars->wizbut = new WIZBUT;
|
|
|
|
GlobalDefaults->localVars->wizbut->back = "<Back";
|
|
|
|
GlobalDefaults->localVars->wizbut->next = "Next>";
|
|
|
|
GlobalDefaults->localVars->wizbut->cancel = "Exit";
|
1999-10-27 01:10:39 +04:00
|
|
|
GlobalDefaults->localVars->wizbut->help = "Offline";
|
1999-02-03 19:39:50 +03:00
|
|
|
GlobalDefaults->subPages = NULL;
|
|
|
|
GlobalDefaults->navControls = NULL;
|
|
|
|
GlobalDefaults->pageWidgets = NULL;
|
|
|
|
GlobalDefaults->numWidgets = 0;
|
|
|
|
GlobalDefaults->currWidgetIndex = 0;
|
|
|
|
|
|
|
|
CurrentNode = GlobalDefaults;
|
|
|
|
|
|
|
|
PrintNodeInfo(CurrentNode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CWizardMachineApp::SetGlobalDefaults()
|
|
|
|
{
|
|
|
|
CreateNode();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::CreateFirstLeaf(NODE *parent, CString iniFile)
|
|
|
|
{
|
|
|
|
NODE* currNode = parent;
|
|
|
|
CString section = "Sub Pages";
|
|
|
|
char buffer[MAX_SIZE] = {'\0'};
|
|
|
|
CString iniName;
|
|
|
|
|
|
|
|
|
|
|
|
iniName = iniFile;
|
|
|
|
|
|
|
|
while (SectionFound(iniName, section))
|
|
|
|
{
|
|
|
|
CString visibleChild;
|
|
|
|
char localBuffer[MAX_SIZE];
|
|
|
|
int i = 0;
|
|
|
|
GetPrivateProfileString(section, NULL, "", buffer, MAX_SIZE, iniName);
|
|
|
|
GetPrivateProfileString(section, GetBufferElement(buffer, i), "", localBuffer, MAX_SIZE, iniName);
|
|
|
|
|
|
|
|
CString visible = CString(localBuffer);
|
|
|
|
visible.MakeUpper();
|
|
|
|
visible.TrimRight();
|
|
|
|
|
|
|
|
while (visible == "HIDE")
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
GetPrivateProfileString(section, GetBufferElement(buffer, i), "", localBuffer, MAX_SIZE, iniName);
|
|
|
|
|
|
|
|
visible = CString(localBuffer);
|
|
|
|
visible.MakeUpper();
|
|
|
|
}
|
|
|
|
|
|
|
|
visibleChild = GetBufferElement(buffer, i);
|
|
|
|
|
|
|
|
if (visibleChild + ".ini" == ".ini")
|
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
CString message = "No pages to display.....!";
|
|
|
|
myWnd.MessageBox(message, "ERROR", MB_OK);
|
|
|
|
fprintf(out, "------------** TERMINATED - No pages to display **----------------\n");
|
|
|
|
exit(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
currNode->childNodes[0] = CreateNode(currNode, visibleChild + ".ini");
|
|
|
|
currNode = currNode->childNodes[0];
|
|
|
|
|
|
|
|
iniName = iniFilePath + visibleChild + ".ini";
|
|
|
|
|
|
|
|
PrintNodeInfo(CurrentNode);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardMachineApp::SectionFound(CString iniFile, CString section)
|
|
|
|
{
|
|
|
|
char buffer[MAX_SIZE] = {'\0'};
|
|
|
|
|
|
|
|
CheckIniFileExistence(iniFile);
|
|
|
|
|
|
|
|
GetPrivateProfileString(section, NULL, "", buffer, MIN_SIZE, iniFile);
|
|
|
|
|
|
|
|
return (buffer[0] != '\0');
|
|
|
|
}
|
|
|
|
|
|
|
|
int CWizardMachineApp::GetBufferCount(char *buffer)
|
|
|
|
{
|
|
|
|
int i=0;
|
|
|
|
int j=0;
|
|
|
|
|
|
|
|
if (!buffer[1] && !buffer[2])
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
BOOL streamEnd = FALSE;
|
|
|
|
while (!streamEnd)
|
|
|
|
{
|
|
|
|
while (buffer[++i])
|
|
|
|
;
|
|
|
|
j++;
|
|
|
|
|
|
|
|
if (buffer[i+1] == '\0')
|
|
|
|
streamEnd = TRUE;
|
|
|
|
}
|
|
|
|
return j;
|
|
|
|
}
|
|
|
|
|
|
|
|
char* CWizardMachineApp::GetBufferElement(const char *buffer, int index)
|
|
|
|
{
|
|
|
|
static char localBuffer[MID_SIZE];
|
|
|
|
|
|
|
|
for (int i=0; i < MID_SIZE; i++)
|
|
|
|
localBuffer[i] = '\0';
|
|
|
|
|
|
|
|
int j=0, k=0;
|
|
|
|
i=0;
|
|
|
|
BOOL streamEnd = FALSE;
|
|
|
|
BOOL elementFound = FALSE;
|
|
|
|
while (!streamEnd)
|
|
|
|
{
|
|
|
|
while (buffer[i])
|
|
|
|
{
|
|
|
|
if (j == index)
|
|
|
|
{
|
|
|
|
localBuffer[k] = buffer[i];
|
|
|
|
elementFound = TRUE;
|
|
|
|
k++;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (elementFound)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
j++;
|
|
|
|
|
|
|
|
if (buffer[i+1] == '\0')
|
|
|
|
streamEnd = TRUE;
|
|
|
|
else
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return localBuffer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
char* CWizardMachineApp::GetSectionBuffer(CString iniFile, CString section)
|
|
|
|
{
|
|
|
|
static char localBuffer[MID_SIZE];
|
|
|
|
|
|
|
|
CheckIniFileExistence(iniFile);
|
|
|
|
|
|
|
|
for (int i=0; i < MID_SIZE; i++)
|
|
|
|
localBuffer[i] = '\0';
|
|
|
|
|
|
|
|
GetPrivateProfileString(section, NULL, "", localBuffer, MID_SIZE, iniFile);
|
|
|
|
|
|
|
|
return localBuffer;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::ExecuteAction(char action)
|
|
|
|
{
|
|
|
|
|
|
|
|
switch(action)
|
|
|
|
{
|
|
|
|
case 'n' :
|
|
|
|
fprintf(out, "** NEXT : Begin **\n");
|
|
|
|
fprintf(out, "-----------------------------------------------------------\n");
|
|
|
|
GoToNextNode();
|
|
|
|
fprintf(out, "** NEXT : End **\n");
|
|
|
|
fprintf(out, "-----------------------------------------------------------\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'b' :
|
|
|
|
fprintf(out, "** BACK : Begin **\n");
|
|
|
|
fprintf(out, "-----------------------------------------------------------\n");
|
|
|
|
GoToPrevNode();
|
|
|
|
fprintf(out, "** BACK : End **\n");
|
|
|
|
fprintf(out, "-----------------------------------------------------------\n");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 'c':
|
|
|
|
fprintf(out, "---------------------*** CANCEL ***------------------------\n");
|
|
|
|
fprintf(out, "-----------------** TERMINATED - User Cancelled App **-----------------\n");
|
|
|
|
ExitApp();
|
|
|
|
exit(0);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default :
|
|
|
|
CWnd myWnd;
|
|
|
|
char temp[MIN_SIZE] = {action};
|
|
|
|
myWnd.MessageBox(strcat("Unknown Action : ", temp), "ERROR", MB_OK);
|
|
|
|
fprintf(out, "---------------** TERMINATED - Invalid Action Element **---------------\n");
|
|
|
|
exit(6);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-09-30 04:39:06 +04:00
|
|
|
BOOL CWizardMachineApp::GoToNextNode()
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
//check if it is a container node
|
|
|
|
//for now check existence of display information
|
|
|
|
//go to first child and so on
|
|
|
|
|
1999-08-30 01:30:16 +04:00
|
|
|
//----------------------------------------------------------------------------------------------
|
|
|
|
// Handle OnNext processing before doing anything else
|
|
|
|
//----------------------------------------------------------------------------------------------
|
|
|
|
if (CurrentNode->navControls->onNextAction)
|
1999-10-12 05:54:00 +04:00
|
|
|
if (!theInterpreter->interpret(CurrentNode->navControls->onNextAction, NULL))
|
1999-09-30 04:39:06 +04:00
|
|
|
return TRUE;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-08-30 01:30:16 +04:00
|
|
|
//----------------------------------------------------------------------------------------------
|
1999-10-13 04:28:10 +04:00
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
NODE* tempNode = CurrentNode;
|
1999-10-13 04:28:10 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
NODE* tmpParentNode;
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
tmpParentNode = tempNode->parent;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
while (tmpParentNode->localVars->pageName != "Globals")
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintNodeInfo(tmpParentNode);
|
|
|
|
|
|
|
|
if ((tmpParentNode->currNodeIndex + 1) < tmpParentNode->numChildNodes)
|
|
|
|
{
|
|
|
|
tmpParentNode->currNodeIndex++;
|
|
|
|
|
|
|
|
NODE* siblingNode = tmpParentNode->childNodes[tmpParentNode->currNodeIndex];
|
|
|
|
|
|
|
|
if (siblingNode)
|
|
|
|
{
|
1999-10-13 04:28:10 +04:00
|
|
|
tempNode = siblingNode;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-10-13 04:28:10 +04:00
|
|
|
tempNode = CreateNode(tmpParentNode,
|
1999-09-30 04:39:06 +04:00
|
|
|
tmpParentNode->subPages->pages.GetAt(tmpParentNode->currNodeIndex) + ".ini");
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
1999-10-13 04:28:10 +04:00
|
|
|
if (!tempNode)
|
1999-10-02 05:28:27 +04:00
|
|
|
0; /* ??? */
|
1999-10-13 04:28:10 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
BOOL isAContainerNode;
|
|
|
|
BOOL haveChildNodes = TRUE;
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
isAContainerNode = (tempNode->numWidgets == 0);
|
1999-02-03 19:39:50 +03:00
|
|
|
while(isAContainerNode && haveChildNodes)
|
|
|
|
{
|
1999-10-13 05:19:23 +04:00
|
|
|
NODE* containerNode = tempNode;
|
1999-02-03 19:39:50 +03:00
|
|
|
if (containerNode->numChildNodes > 0)
|
|
|
|
{
|
1999-10-13 05:19:23 +04:00
|
|
|
tempNode = containerNode->childNodes[0];
|
|
|
|
if (!tempNode)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-13 05:19:23 +04:00
|
|
|
tempNode = CreateNode(containerNode,
|
1999-09-30 04:39:06 +04:00
|
|
|
containerNode->subPages->pages.GetAt(0) + ".ini");
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-10-13 05:19:23 +04:00
|
|
|
isAContainerNode = (tempNode->numWidgets == 0);
|
1999-02-03 19:39:50 +03:00
|
|
|
PrintNodeInfo(containerNode);
|
|
|
|
haveChildNodes = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
haveChildNodes = FALSE;
|
|
|
|
}
|
|
|
|
}
|
1999-10-13 05:19:23 +04:00
|
|
|
PrintNodeInfo(tempNode);
|
1999-02-03 19:39:50 +03:00
|
|
|
if (haveChildNodes)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmpParentNode = tmpParentNode->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tmpParentNode->localVars->pageName == "Globals")
|
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
myWnd.MessageBox("Can't go past the last node", "Error", MB_OK);
|
|
|
|
fprintf(out, "------------** TERMINATED - Can't go past the last page **----------------\n");
|
|
|
|
exit(10);
|
|
|
|
}
|
1999-10-06 05:32:00 +04:00
|
|
|
|
1999-10-13 04:28:10 +04:00
|
|
|
if (IsNewValue)
|
|
|
|
CreateNewCache();
|
1999-10-06 05:32:00 +04:00
|
|
|
|
1999-10-14 01:30:51 +04:00
|
|
|
CurrentNode = tempNode;
|
|
|
|
|
|
|
|
if (!theInterpreter->interpret(CurrentNode->navControls->onEnter, NULL))
|
1999-10-13 05:19:23 +04:00
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
1999-09-30 04:39:06 +04:00
|
|
|
return TRUE;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-09-30 04:39:06 +04:00
|
|
|
BOOL CWizardMachineApp::GoToPrevNode()
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
//check if it is a container node
|
|
|
|
//for now check existence of display information
|
|
|
|
//go to last child and so on
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
NODE* tempNode = CurrentNode;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
NODE* tmpParentNode;
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
tmpParentNode = tempNode->parent;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
while (tmpParentNode->localVars->pageName != "Globals")
|
|
|
|
{
|
|
|
|
|
|
|
|
PrintNodeInfo(tmpParentNode);
|
|
|
|
|
|
|
|
if (tmpParentNode->currNodeIndex > 0)
|
|
|
|
{
|
|
|
|
tmpParentNode->currNodeIndex--;
|
|
|
|
|
|
|
|
NODE* siblingNode = tmpParentNode->childNodes[tmpParentNode->currNodeIndex];
|
|
|
|
|
|
|
|
if (siblingNode)
|
|
|
|
{
|
1999-10-13 04:28:10 +04:00
|
|
|
tempNode = siblingNode;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-10-13 04:28:10 +04:00
|
|
|
tempNode = CreateNode(tmpParentNode,
|
1999-09-30 04:39:06 +04:00
|
|
|
tmpParentNode->subPages->pages.GetAt(tmpParentNode->currNodeIndex) + ".ini");
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
1999-10-13 04:28:10 +04:00
|
|
|
if (!tempNode)
|
1999-10-02 05:28:27 +04:00
|
|
|
0;/*then what*/
|
1999-09-30 04:39:06 +04:00
|
|
|
|
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
BOOL isAContainerNode;
|
|
|
|
BOOL haveChildNodes = TRUE;
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
isAContainerNode = (tempNode->numWidgets == 0);
|
1999-02-03 19:39:50 +03:00
|
|
|
while(isAContainerNode && haveChildNodes)
|
|
|
|
{
|
1999-10-13 05:19:23 +04:00
|
|
|
NODE* containerNode = tempNode;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
if (containerNode->numChildNodes > 0)
|
|
|
|
{
|
|
|
|
int index = containerNode->currNodeIndex;
|
1999-10-13 05:19:23 +04:00
|
|
|
tempNode = containerNode->childNodes[index];
|
|
|
|
if (!tempNode)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-13 05:19:23 +04:00
|
|
|
tempNode = CreateNode(containerNode,
|
1999-09-30 04:39:06 +04:00
|
|
|
containerNode->subPages->pages.GetAt(index) + ".ini");
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-10-13 05:19:23 +04:00
|
|
|
isAContainerNode = (tempNode->numWidgets == 0);
|
1999-02-03 19:39:50 +03:00
|
|
|
PrintNodeInfo(containerNode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
haveChildNodes = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-13 05:19:23 +04:00
|
|
|
PrintNodeInfo(tempNode);
|
1999-02-03 19:39:50 +03:00
|
|
|
if (haveChildNodes)
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tmpParentNode = tmpParentNode->parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (tmpParentNode->localVars->pageName == "Globals")
|
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
myWnd.MessageBox("Can't go back from first node", "Error", MB_OK);
|
|
|
|
fprintf(out, "------------** TERMINATED - Can't go back from first page **----------------\n");
|
|
|
|
exit(9);
|
|
|
|
}
|
1999-10-13 04:28:10 +04:00
|
|
|
|
|
|
|
if (IsNewValue)
|
|
|
|
CreateNewCache();
|
1999-10-13 05:19:23 +04:00
|
|
|
CurrentNode = tempNode;
|
1999-10-13 04:28:10 +04:00
|
|
|
|
1999-10-14 01:30:51 +04:00
|
|
|
if (!theInterpreter->interpret(CurrentNode->navControls->onEnter, NULL))
|
|
|
|
return FALSE;
|
|
|
|
|
1999-09-30 04:39:06 +04:00
|
|
|
return TRUE;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::ExitApp()
|
|
|
|
{
|
|
|
|
CreateNewCache();
|
|
|
|
}
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
|
1999-08-30 23:56:34 +04:00
|
|
|
/*
|
|
|
|
This routine isn't useful since the messagebox isn't usually appropriate anymore
|
1999-02-03 19:39:50 +03:00
|
|
|
FILE* CWizardMachineApp::OpenAFile(CString outputFile, CString mode)
|
|
|
|
{
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
if( !( filePtr = fopen( outputFile, mode ) ) )
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
myWnd.MessageBox("Unable to open file" + outputFile, "ERROR", MB_OK);
|
|
|
|
}
|
|
|
|
|
1999-06-17 08:42:40 +04:00
|
|
|
return filePtr;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-08-30 23:56:34 +04:00
|
|
|
*/
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
void CWizardMachineApp::PrintNodeInfo(NODE* node)
|
|
|
|
{
|
|
|
|
if (node)
|
|
|
|
{
|
|
|
|
fprintf(out, "Node name : " + node->localVars->pageName + "\n\n");
|
|
|
|
fprintf(out, "Number of Sub pages : %d\n", node->numChildNodes);
|
|
|
|
fprintf(out, "Number of Widgets : %d\n", node->numWidgets);
|
|
|
|
|
|
|
|
/**
|
|
|
|
for (int i=0; i< node->numWidgets; i++)
|
|
|
|
{
|
|
|
|
fprintf(out, "Widget%d Name : " + node->pageWidgets[i]->name + "\n", i+1);
|
|
|
|
fprintf(out, "Widget%d Value : " + node->pageWidgets[i]->value + "\n", i+1);
|
|
|
|
|
|
|
|
}
|
|
|
|
**/
|
|
|
|
fprintf(out, "-----------------------------------------------------------\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::CheckIniFileExistence(CString file)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
//BOOL CheckIniFileExistence = FALSE;
|
|
|
|
|
|
|
|
if (! (f = fopen(file, "r") ))
|
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
CString message = "File " + file + " could not be opened ";
|
|
|
|
|
|
|
|
myWnd.MessageBox(message, "ERROR", MB_OK);
|
|
|
|
fprintf(out, "------------** TERMINATED - Missing File : " + file + " **----------------\n");
|
|
|
|
exit(4);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
fclose(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardMachineApp::FileExists(CString file)
|
|
|
|
{
|
|
|
|
FILE *f;
|
|
|
|
|
|
|
|
if (! (f = fopen(file, "r") ))
|
|
|
|
return FALSE;
|
|
|
|
else
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
1999-08-30 23:56:34 +04:00
|
|
|
BOOL CWizardMachineApp::FillGlobalWidgetArray(CString file)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
char buffer[MAX_SIZE] = {'\0'};
|
1999-08-30 01:30:16 +04:00
|
|
|
CString name = "";
|
|
|
|
CString value = "";
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-08-30 23:56:34 +04:00
|
|
|
globs = fopen(file, "r");
|
|
|
|
if (!globs)
|
|
|
|
return FALSE;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
while(!feof(globs))
|
|
|
|
{
|
|
|
|
while(fgets(buffer, MAX_SIZE, globs))
|
|
|
|
{
|
|
|
|
if (strstr(buffer, "="))
|
|
|
|
{
|
1999-08-30 01:30:16 +04:00
|
|
|
name = CString(strtok(buffer,"="));
|
|
|
|
value = CString(strtok(NULL,"="));
|
|
|
|
value.TrimRight();
|
1999-10-07 05:39:34 +04:00
|
|
|
if (value.Find("%") >= 0)
|
1999-10-12 05:54:00 +04:00
|
|
|
value=theInterpreter->replaceVars((char *) (LPCSTR) value,NULL);
|
1999-02-03 19:39:50 +03:00
|
|
|
|
1999-08-30 01:30:16 +04:00
|
|
|
WIDGET* w = SetGlobal(name, value);
|
|
|
|
if (w)
|
|
|
|
w->cached = TRUE;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-08-30 01:30:16 +04:00
|
|
|
|
|
|
|
fclose(globs);
|
1999-08-30 23:56:34 +04:00
|
|
|
|
|
|
|
return TRUE;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
1999-08-30 23:56:34 +04:00
|
|
|
BOOL CWizardMachineApp::FillGlobalWidgetArray()
|
1999-08-30 01:30:16 +04:00
|
|
|
{
|
1999-08-30 23:56:34 +04:00
|
|
|
return FillGlobalWidgetArray(CachePath);
|
1999-08-30 01:30:16 +04:00
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
void CWizardMachineApp::CreateNewCache()
|
|
|
|
{
|
1999-08-30 23:56:34 +04:00
|
|
|
globs = fopen(CachePath, "w");
|
|
|
|
if (!globs)
|
|
|
|
{
|
|
|
|
fprintf(out, "--------------** TERMINATED - Can't open cache file **----------------\n");
|
|
|
|
exit( 3 );
|
|
|
|
}
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
for(int i=0; i< GlobalArrayIndex; i++)
|
|
|
|
{
|
|
|
|
if (GlobalWidgetArray[i].type != "RadioButton"
|
|
|
|
&& GlobalWidgetArray[i].type != "Text"
|
1999-10-19 00:22:21 +04:00
|
|
|
&& GlobalWidgetArray[i].type != "BoldText"
|
1999-02-03 19:39:50 +03:00
|
|
|
&& GlobalWidgetArray[i].type != "Button"
|
|
|
|
&& GlobalWidgetArray[i].type != "GroupBox" )
|
|
|
|
{
|
1999-11-04 01:44:24 +03:00
|
|
|
if( (GlobalWidgetArray[i].name != "") && (GlobalWidgetArray[i].name != "Root"))
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
fprintf(globs, GlobalWidgetArray[i].name + "=" + GlobalWidgetArray[i].value);
|
|
|
|
fprintf(globs, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fclose(globs);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardMachineApp::IsLastNode(NODE* treeNode)
|
|
|
|
{
|
|
|
|
|
|
|
|
NODE* tmpParent;
|
|
|
|
BOOL lastNode = TRUE;
|
|
|
|
|
|
|
|
if (treeNode)
|
|
|
|
{
|
|
|
|
tmpParent = treeNode->parent;
|
|
|
|
|
|
|
|
while(tmpParent->localVars->pageName != "Globals")
|
|
|
|
{
|
|
|
|
if (tmpParent->numChildNodes == (tmpParent->currNodeIndex+1))
|
|
|
|
tmpParent = tmpParent->parent;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lastNode = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
lastNode = FALSE;
|
|
|
|
}
|
|
|
|
return lastNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardMachineApp::IsFirstNode(NODE* treeNode)
|
|
|
|
{
|
|
|
|
|
|
|
|
NODE* tmpParent;
|
|
|
|
NODE* tmpNode;
|
|
|
|
BOOL firstNode = TRUE;
|
|
|
|
|
|
|
|
tmpNode = treeNode;
|
|
|
|
tmpParent = treeNode->parent;
|
|
|
|
|
|
|
|
if (tmpParent->childNodes[0] == tmpNode)
|
|
|
|
{
|
|
|
|
while((tmpParent->localVars->pageName != "Globals"))
|
|
|
|
{
|
|
|
|
tmpNode = tmpParent;
|
|
|
|
tmpParent = tmpParent->parent;
|
|
|
|
|
|
|
|
if (!(tmpParent->childNodes[0] == tmpNode))
|
|
|
|
{
|
|
|
|
firstNode = FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
firstNode = FALSE;
|
|
|
|
}
|
|
|
|
return firstNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
CString CWizardMachineApp::GetModulePath()
|
|
|
|
{
|
|
|
|
char currPath[MID_SIZE];
|
|
|
|
int i,numBytes;
|
|
|
|
|
|
|
|
// Get the path of the file that was executed
|
|
|
|
numBytes = GetModuleFileName(m_hInstance, currPath, MIN_SIZE);
|
|
|
|
|
|
|
|
// get the cmd path
|
|
|
|
// Remove the filename from the path
|
1999-02-05 07:05:43 +03:00
|
|
|
for (i=numBytes-1;i >= 0 && currPath[i] != '\\';i--);
|
1999-02-03 19:39:50 +03:00
|
|
|
// Terminate command line with 0
|
|
|
|
if (i >= 0)
|
|
|
|
currPath[i+1]= '\0';
|
|
|
|
|
|
|
|
return CString(currPath);
|
|
|
|
}
|
|
|
|
|
|
|
|
CString CWizardMachineApp::GetGlobalOptions(CString theName)
|
|
|
|
{
|
|
|
|
CString temp="";
|
|
|
|
|
1999-10-06 03:17:07 +04:00
|
|
|
for (int i = 0; i < GlobalArrayIndex; i++)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
|
|
|
if (GlobalWidgetArray[i].name == theName) {
|
|
|
|
if (GlobalWidgetArray[i].numOfOptions > 0) {
|
|
|
|
for (int j = 0; j < GlobalWidgetArray[i].numOfOptions; j++) {
|
|
|
|
strcat((char*)(LPCTSTR)(temp), GlobalWidgetArray[i].options.value[j]);
|
|
|
|
strcat((char*)(LPCTSTR)(temp), ";");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
temp = GlobalWidgetArray[i].items;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue)
|
|
|
|
{
|
|
|
|
static int idCounter = 0;
|
1999-02-26 21:36:04 +03:00
|
|
|
char buffer[MAX_SIZE] = {'\0'};
|
|
|
|
char largeBuffer[EXTD_MAX_SIZE] = {'\0'};
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
idCounter++;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Name", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->name = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Type", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->type = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Options", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->items = buffer;
|
|
|
|
|
|
|
|
if (readValue)
|
|
|
|
{
|
1999-02-26 21:36:04 +03:00
|
|
|
GetPrivateProfileString(iniSection, "Value", "", largeBuffer, EXTD_MAX_SIZE, iniFile);
|
|
|
|
aWidget->value = largeBuffer;
|
1999-02-03 19:39:50 +03:00
|
|
|
aWidget->value.TrimRight();
|
|
|
|
}
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Title", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->title = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Group", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->group = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Target", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->target = buffer;
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Start_x", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->location.x = atoi(buffer);
|
|
|
|
|
|
|
|
GetPrivateProfileString(iniSection, "Start_y", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->location.y = atoi(buffer);
|
1999-10-06 05:32:00 +04:00
|
|
|
|
1999-02-03 19:39:50 +03:00
|
|
|
//aWidget->size = new DIMENSION;
|
|
|
|
GetPrivateProfileString(iniSection, "Width", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->size.width = atoi(buffer);
|
|
|
|
GetPrivateProfileString(iniSection, "Height", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->size.height = atoi(buffer);
|
|
|
|
|
1999-10-06 05:32:00 +04:00
|
|
|
//Fieldlen is of struct FIELDLEN - containing min,max,and length.
|
|
|
|
GetPrivateProfileString(iniSection, "MaxLen", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->fieldlen.max_len = atoi(buffer);
|
|
|
|
GetPrivateProfileString(iniSection, "MinLen", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->fieldlen.min_len = atoi(buffer);
|
|
|
|
|
|
|
|
if (aWidget->fieldlen.max_len)
|
|
|
|
aWidget->fieldlen.length = aWidget->fieldlen.max_len;
|
|
|
|
else if (aWidget->fieldlen.min_len)
|
1999-10-12 04:12:10 +04:00
|
|
|
aWidget->fieldlen.length = MAX_SIZE;
|
1999-10-06 05:32:00 +04:00
|
|
|
else
|
|
|
|
aWidget->fieldlen.length = MAX_SIZE;
|
|
|
|
|
1999-10-19 05:30:18 +04:00
|
|
|
/* Obsolete...
|
1999-02-03 19:39:50 +03:00
|
|
|
GetPrivateProfileString(iniSection, "dll", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->action.dll = buffer;
|
|
|
|
GetPrivateProfileString(iniSection, "function", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->action.function = buffer;
|
|
|
|
GetPrivateProfileString(iniSection, "parameters", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
strcpy(aWidget->action.parameters, buffer);
|
1999-10-19 05:30:18 +04:00
|
|
|
*/
|
|
|
|
GetPrivateProfileString(iniSection, "onInit", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->action.onInit = buffer;
|
|
|
|
GetPrivateProfileString(iniSection, "onCommand", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
aWidget->action.onCommand = buffer;
|
1999-02-03 19:39:50 +03:00
|
|
|
|
|
|
|
/// Dynamic ID allocation
|
|
|
|
aWidget->widgetID = pageBaseIndex + idCounter;
|
|
|
|
|
|
|
|
|
|
|
|
// As the number of entries in the subsection are not known, a generic loop
|
|
|
|
// has been created to read all existing name/value pairs in the subsection
|
|
|
|
// and store them in the options component of the control.
|
1999-10-20 00:30:18 +04:00
|
|
|
int counter = 0;
|
1999-02-03 19:39:50 +03:00
|
|
|
GetPrivateProfileString(iniSection, "subsection", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
if (strcmp(buffer, "") != 0) {
|
|
|
|
char* subSection;
|
|
|
|
subSection = new char[sizeof(buffer)];
|
|
|
|
strcpy(subSection, buffer);
|
|
|
|
|
1999-10-20 00:30:18 +04:00
|
|
|
int i = 0;
|
|
|
|
char* ComponentKey;
|
|
|
|
char ComponentKeyBuffer[MAX_SIZE];
|
|
|
|
if (GetPrivateProfileString(subSection, NULL, "", buffer, MAX_SIZE, iniFile) > 0)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-20 00:30:18 +04:00
|
|
|
while (counter < 25 && buffer[i] != 0)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-20 00:30:18 +04:00
|
|
|
ComponentKey = &buffer[i];
|
|
|
|
if (GetPrivateProfileString(subSection, ComponentKey, "", ComponentKeyBuffer, MAX_SIZE, iniFile) > 0)
|
1999-02-03 19:39:50 +03:00
|
|
|
{
|
1999-10-20 00:30:18 +04:00
|
|
|
aWidget->options.name[counter] = new char[sizeof(ComponentKey)];
|
|
|
|
strcpy(aWidget->options.name[counter],ComponentKey);
|
|
|
|
aWidget->options.value[counter] = new char[sizeof(ComponentKeyBuffer)];
|
|
|
|
strcpy(aWidget->options.value[counter],ComponentKeyBuffer);
|
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
while (buffer[i] != 0)
|
1999-02-03 19:39:50 +03:00
|
|
|
i++;
|
1999-10-20 00:30:18 +04:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
delete subSection;
|
|
|
|
}
|
|
|
|
aWidget->numOfOptions = counter;
|
|
|
|
|
|
|
|
// As the number of entries in the subsection are not known, a generic loop
|
|
|
|
// has been created to read all existing name/value pairs in the subsection
|
|
|
|
// and store them in the options component of the control.
|
|
|
|
counter = 0;
|
|
|
|
GetPrivateProfileString(iniSection, "OptionDescriptions", "", buffer, MAX_SIZE, iniFile);
|
|
|
|
if (strcmp(buffer, "") != 0) {
|
|
|
|
char* subSection;
|
|
|
|
subSection = new char[sizeof(buffer)];
|
|
|
|
strcpy(subSection, buffer);
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
char* ComponentKey;
|
|
|
|
char ComponentKeyBuffer[MAX_SIZE];
|
|
|
|
if (GetPrivateProfileString(subSection, NULL, "", buffer, MAX_SIZE, iniFile) > 0)
|
|
|
|
{
|
|
|
|
while (counter < 25 && buffer[i] != 0)
|
|
|
|
{
|
|
|
|
ComponentKey = &buffer[i];
|
|
|
|
if (GetPrivateProfileString(subSection, ComponentKey, "", ComponentKeyBuffer, MAX_SIZE, iniFile) > 0)
|
|
|
|
{
|
|
|
|
aWidget->optDesc.name[counter] = new char[sizeof(ComponentKey)];
|
|
|
|
strcpy(aWidget->optDesc.name[counter],ComponentKey);
|
|
|
|
aWidget->optDesc.value[counter] = new char[sizeof(ComponentKeyBuffer)];
|
|
|
|
strcpy(aWidget->optDesc.value[counter],ComponentKeyBuffer);
|
|
|
|
counter++;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-10-20 00:30:18 +04:00
|
|
|
while (buffer[i] != 0)
|
|
|
|
i++;
|
|
|
|
i++;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
}
|
1999-10-20 00:30:18 +04:00
|
|
|
delete subSection;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
1999-10-20 00:30:18 +04:00
|
|
|
aWidget->numOfOptDesc = counter;
|
1999-02-03 19:39:50 +03:00
|
|
|
}
|
|
|
|
|
1999-05-19 07:31:11 +04:00
|
|
|
|
|
|
|
void CWizardMachineApp::HelpWiz()
|
|
|
|
{
|
1999-10-27 01:10:39 +04:00
|
|
|
CString helpvalue = (CurrentNode->localVars->wizbut->help);
|
|
|
|
CString helpvar = helpvalue.Left(6);
|
|
|
|
if (helpvar.CompareNoCase("Online")== 0)
|
|
|
|
{
|
|
|
|
helpvalue.Delete(0,7);
|
|
|
|
// AfxMessageBox("online",MB_OK);
|
|
|
|
theInterpreter->OpenBrowser((char*)(LPCTSTR)helpvalue);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CWizHelp hlpdlg;
|
|
|
|
hlpdlg.DoModal();
|
|
|
|
}
|
1999-08-30 01:30:16 +04:00
|
|
|
}
|