1999-02-03 19:49:10 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.0 (the "NPL"); you may not use this file except in
|
|
|
|
* compliance with the NPL. You may obtain a copy of the NPL at
|
|
|
|
* http://www.mozilla.org/NPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* NPL.
|
|
|
|
*
|
|
|
|
* The Initial Developer of this code under the NPL is Netscape
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
|
|
|
* Reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
// WizardUI.cpp : implementation file
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
1999-10-12 04:56:51 +04:00
|
|
|
#include "afxmt.h"
|
|
|
|
|
1999-02-03 19:49:10 +03:00
|
|
|
#include "WizardMachine.h"
|
1999-10-02 05:28:27 +04:00
|
|
|
#include "fstream.h"
|
1999-05-19 07:31:11 +04:00
|
|
|
#include "ImgDlg.h"
|
|
|
|
#include "SumDlg.h"
|
1999-02-03 19:49:10 +03:00
|
|
|
#include "NavText.h"
|
|
|
|
#include "NewDialog.h"
|
|
|
|
#include "NewConfigDialog.h"
|
|
|
|
#include "ProgDlgThread.h"
|
1999-10-12 04:56:51 +04:00
|
|
|
#include "PropSheet.h"
|
|
|
|
#include "WizardUI.h"
|
1999-10-12 05:54:00 +04:00
|
|
|
#include "Interpret.h"
|
1999-10-12 04:56:51 +04:00
|
|
|
|
1999-02-03 19:49:10 +03:00
|
|
|
#include <direct.h>
|
1999-06-17 08:44:53 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
1999-02-03 19:49:10 +03:00
|
|
|
// The following is included to make
|
|
|
|
// the browse for a dir code compile
|
|
|
|
#include <shlobj.h>
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
#undef THIS_FILE
|
|
|
|
static char THIS_FILE[] = __FILE__;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CWizardUI property page
|
|
|
|
extern CWizardMachineApp theApp;
|
1999-10-12 05:54:00 +04:00
|
|
|
extern CInterpret *theInterpreter;
|
1999-02-03 19:49:10 +03:00
|
|
|
extern NODE *CurrentNode;
|
|
|
|
extern HBITMAP hBitmap;
|
|
|
|
extern CString Path;
|
|
|
|
extern char iniFilePath[MAX_SIZE];
|
|
|
|
|
|
|
|
extern BOOL inNext;
|
|
|
|
extern BOOL inPrev;
|
|
|
|
extern NODE* WizardTree;
|
|
|
|
extern WIDGET GlobalWidgetArray[1000];
|
|
|
|
extern int GlobalArrayIndex;
|
|
|
|
extern char currDirPath[MAX_SIZE];
|
|
|
|
extern char customizationPath[MAX_SIZE];
|
|
|
|
|
|
|
|
extern _declspec (dllimport) WIDGET ptr_ga[1000];
|
|
|
|
CCriticalSection nextSyncCodeSegment;
|
|
|
|
CCriticalSection prevSyncCodeSegment;
|
|
|
|
|
|
|
|
CSingleLock nextLock(&nextSyncCodeSegment);
|
|
|
|
CSingleLock prevLock(&prevSyncCodeSegment);
|
|
|
|
|
|
|
|
BOOL isBuildInstaller;
|
|
|
|
BOOL isCDLayoutCreated;
|
|
|
|
|
|
|
|
//extern CProgDialog myProgDialog;
|
|
|
|
|
|
|
|
IMPLEMENT_DYNCREATE(CWizardUI, CPropertyPage)
|
|
|
|
|
|
|
|
CWizardUI::CWizardUI() : CPropertyPage(CWizardUI::IDD)
|
|
|
|
{
|
|
|
|
//{{AFX_DATA_INIT(CWizardUI)
|
|
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
|
|
//}}AFX_DATA_INIT
|
|
|
|
}
|
|
|
|
|
|
|
|
CWizardUI::~CWizardUI()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::DoDataExchange(CDataExchange* pDX)
|
|
|
|
{
|
|
|
|
CPropertyPage::DoDataExchange(pDX);
|
|
|
|
//{{AFX_DATA_MAP(CWizardUI)
|
|
|
|
// NOTE: the ClassWizard will add DDX and DDV calls here
|
|
|
|
//}}AFX_DATA_MAP
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CWizardUI, CPropertyPage)
|
|
|
|
//{{AFX_MSG_MAP(CWizardUI)
|
|
|
|
ON_WM_PAINT()
|
|
|
|
ON_WM_ERASEBKGND()
|
|
|
|
ON_WM_CTLCOLOR()
|
|
|
|
//}}AFX_MSG_MAP
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// CWizardUI message handlers
|
|
|
|
|
|
|
|
BOOL CWizardUI::OnSetActive()
|
|
|
|
{
|
1999-10-12 03:47:49 +04:00
|
|
|
SetForegroundWindow();
|
1999-06-17 08:44:53 +04:00
|
|
|
(AfxGetMainWnd( ))->SetWindowText(CurrentNode->localVars->title);
|
|
|
|
if (!(CurrentNode->isWidgetsSorted)) {
|
1999-02-03 19:49:10 +03:00
|
|
|
SortWidgetsForTabOrder();
|
|
|
|
}
|
|
|
|
|
|
|
|
CreateControls();
|
|
|
|
DisplayControls();
|
|
|
|
|
|
|
|
CPropSheet* pSheet = (CPropSheet*) GetParent();
|
|
|
|
ASSERT_VALID(pSheet);
|
|
|
|
|
1999-10-06 03:18:12 +04:00
|
|
|
// !!! Use an OnEnter for this instead !!!
|
1999-02-03 19:49:10 +03:00
|
|
|
if (CurrentNode->localVars->functionality == "BuildInstallers")
|
|
|
|
{
|
|
|
|
pSheet->GetDlgItem(ID_WIZNEXT)->SetWindowText("Build &Installers");
|
|
|
|
isBuildInstaller = TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
isBuildInstaller = FALSE;
|
|
|
|
pSheet->GetDlgItem(ID_WIZNEXT)->SetWindowText("&Next >");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (theApp.IsLastNode(CurrentNode)) {
|
|
|
|
pSheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
|
|
|
|
}
|
|
|
|
else if (theApp.IsFirstNode(CurrentNode)) {
|
|
|
|
pSheet->SetWizardButtons(PSWIZB_NEXT);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
pSheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
1999-05-19 07:31:11 +04:00
|
|
|
// SetModified(1);
|
1999-02-03 19:49:10 +03:00
|
|
|
return CPropertyPage::OnSetActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
BOOL CWizardUI::OnKillActive()
|
|
|
|
{
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
|
|
|
|
return CPropertyPage::OnKillActive();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LRESULT CWizardUI::OnWizardBack()
|
|
|
|
{
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
if (!prevLock.IsLocked())
|
|
|
|
{
|
|
|
|
prevLock.Lock();
|
|
|
|
|
|
|
|
UpdateGlobals();
|
|
|
|
DestroyCurrentScreenWidgets();
|
1999-09-30 04:44:28 +04:00
|
|
|
while (!theApp.GoToPrevNode())
|
1999-10-02 05:28:27 +04:00
|
|
|
0; /* do nothing */
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
prevLock.Unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CPropertyPage::OnWizardBack();
|
|
|
|
}
|
|
|
|
|
|
|
|
LRESULT CWizardUI::OnWizardNext()
|
|
|
|
{
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
if (!nextLock.IsLocked())
|
|
|
|
{
|
|
|
|
nextLock.Lock();
|
|
|
|
|
|
|
|
if (isBuildInstaller) {
|
|
|
|
isCDLayoutCreated = FALSE;
|
|
|
|
|
1999-02-04 03:01:38 +03:00
|
|
|
/**
|
1999-02-03 19:49:10 +03:00
|
|
|
VERIFY(hModule = ::LoadLibrary("IBEngine.dll"));
|
|
|
|
VERIFY(
|
|
|
|
pMyDllPath =
|
|
|
|
(MYDLLPATH*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "SetPath")
|
|
|
|
);
|
|
|
|
|
|
|
|
(*pMyDllPath)((char*)(LPCTSTR)Path);
|
|
|
|
LoadGlobals();
|
|
|
|
|
|
|
|
VERIFY(
|
|
|
|
pMyFunction =
|
|
|
|
(MYFUNCTION*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "BuildInstallers")
|
|
|
|
);
|
|
|
|
(*pMyFunction)();
|
1999-02-04 03:01:38 +03:00
|
|
|
**/
|
|
|
|
MessageBox("CD Image would be created", "OK", MB_OK);
|
1999-02-03 19:49:10 +03:00
|
|
|
isBuildInstaller = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
UpdateGlobals();
|
|
|
|
DestroyCurrentScreenWidgets();
|
1999-09-30 04:44:28 +04:00
|
|
|
while (!theApp.GoToNextNode())
|
1999-10-02 05:28:27 +04:00
|
|
|
0; /* do nothing */
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
nextLock.Unlock();
|
|
|
|
}
|
|
|
|
|
|
|
|
return CPropertyPage::OnWizardNext();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::OnPaint()
|
|
|
|
{
|
|
|
|
CPaintDC dc(this);
|
|
|
|
//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();
|
|
|
|
|
|
|
|
if (containsImage) {
|
|
|
|
CClientDC cdc(this);
|
|
|
|
HBITMAP hbmpOld;
|
|
|
|
CDC dcMem;
|
|
|
|
|
|
|
|
dcMem.CreateCompatibleDC(&cdc);
|
|
|
|
|
|
|
|
if (CurrentNode) {
|
|
|
|
for(int i=0; i < CurrentNode->numImages; i++)
|
|
|
|
{
|
|
|
|
hbmpOld = (HBITMAP)::SelectObject(dcMem, CurrentNode->images[i]->hBitmap);
|
|
|
|
|
|
|
|
dc.BitBlt((int)((float)(CurrentNode->images[i]->location.x) * (float)baseWidth / 4.0),
|
|
|
|
(int)((float)(CurrentNode->images[i]->location.y) * (float)baseHeight / 8.0),
|
|
|
|
(int)((float)(CurrentNode->images[i]->size.width) * (float)baseWidth / 4.0),
|
|
|
|
(int)((float)(CurrentNode->images[i]->size.height) * (float)baseHeight / 8.0),
|
|
|
|
&dcMem,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
SRCCOPY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do not call CPropertyPage::OnPaint() for painting messages
|
|
|
|
}
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::ActCommand(WIDGET *curWidget)
|
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
#ifdef USETHEOLDMETHODOFHANDLINGCOMMANDS
|
1999-09-30 04:29:48 +04:00
|
|
|
char params[MAX_SIZE];
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
UpdateGlobals();
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
CString function;
|
|
|
|
strcpy(params, curWidget->action.parameters);
|
|
|
|
int numCommands=0;
|
|
|
|
char target[MID_SIZE] = {'\0'};
|
|
|
|
char baseCommand[MID_SIZE] = {'\0'};
|
|
|
|
char *args[MAX_SIZE];
|
|
|
|
BOOL informAct = FALSE;
|
|
|
|
|
|
|
|
|
|
|
|
char *commands[MIN_SIZE];
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
commands[0] = (char *) GlobalAlloc(0, MAX_SIZE * sizeof(char));
|
|
|
|
commands[0] = strtok(params, ";");
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
int i=0;
|
|
|
|
while (commands[i])
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
commands[i] = strtok(NULL, ";");
|
|
|
|
if (commands[i])
|
|
|
|
{
|
|
|
|
if(!(strcmp(commands[i], "inform")))
|
|
|
|
{
|
|
|
|
informAct = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
numCommands = i;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (curWidget->target != "")
|
|
|
|
{
|
|
|
|
strcpy(target, curWidget->target);
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
|
|
|
CString tmpFunction = tmpWidget->action.function;
|
|
|
|
CString tmpParams = CString(tmpWidget->action.parameters);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
char localPath[MAX_SIZE] = {'\0'};
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (strrchr(tmpParams,'\\')) {
|
|
|
|
strncpy(localPath, tmpParams, strlen(tmpParams) - strlen(strrchr(tmpParams,'\\')));
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
char *commandList[MIN_SIZE];
|
|
|
|
int commandListLength = 0;
|
|
|
|
BOOL abortProcessing = FALSE;
|
|
|
|
BOOL newEntry = FALSE;
|
|
|
|
BOOL commandBuilt = FALSE;
|
|
|
|
CString entryName;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
for (int j=0; j < numCommands; j++)
|
|
|
|
{
|
|
|
|
commandListLength = 0;
|
|
|
|
if (!abortProcessing)
|
|
|
|
{
|
|
|
|
// Need to replace this gunk with replaceVars() call, but listbox iterator needs
|
|
|
|
// to be solved first.
|
|
|
|
int numArgs = 0;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
int x=0;
|
|
|
|
args[x] = (char *) GlobalAlloc(0, MAX_SIZE * sizeof(char));
|
|
|
|
args[x] = strtok((char *)(LPCTSTR) commands[j], " ");
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
commandList[commandListLength] = (char *) GlobalAlloc(0, MAX_SIZE * sizeof(char));
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
while (args[x])
|
|
|
|
{
|
|
|
|
x++;
|
|
|
|
args[x] = strtok(NULL, " ");
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
numArgs = x;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if ((strstr(args[0], "ConfigDialog")))
|
|
|
|
{
|
|
|
|
CNewDialog newDlg;
|
|
|
|
newDlg.DoModal();
|
|
|
|
entryName = newDlg.GetData();
|
|
|
|
newEntry = TRUE;
|
|
|
|
}
|
|
|
|
if (newEntry && entryName == "")
|
|
|
|
{
|
|
|
|
abortProcessing = TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (!newEntry)
|
|
|
|
{
|
|
|
|
for (int k=0; k < numArgs; k++)
|
|
|
|
{
|
|
|
|
if (!(strstr(args[k], "%")))
|
|
|
|
{
|
|
|
|
if (!commandBuilt)
|
1999-02-03 19:49:10 +03:00
|
|
|
{
|
1999-09-30 04:29:48 +04:00
|
|
|
strcpy(commandList[commandListLength], args[k]);
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1999-09-30 04:29:48 +04:00
|
|
|
strcat(commandList[commandListLength], args[k]);
|
|
|
|
}
|
|
|
|
strcat(commandList[commandListLength]," ");
|
|
|
|
commandBuilt = TRUE;
|
1999-06-17 08:44:53 +04:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (k+1 == numArgs)
|
|
|
|
commandListLength++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
args[k]++;
|
|
|
|
args[k][strlen(args[k])-1] = '\0';
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
WIDGET* aWidget = theApp.findWidget(args[k]);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (aWidget)
|
|
|
|
{
|
|
|
|
if (aWidget->type == "ListBox")
|
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
/* --- Broken at the moment due to listbox value overhaul ---
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
// Listbox iterator: apply command to each selected value
|
|
|
|
//
|
|
|
|
// Use this index value to find the string from the listbox
|
|
|
|
// If the index is a ',' separated list, iterate over each value
|
|
|
|
CString valueSet = aWidget->value;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
char *values[MIN_SIZE];
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
int numValues=0;
|
|
|
|
values[numValues] = (char *) GlobalAlloc(0, MAX_SIZE * sizeof(char));
|
|
|
|
values[numValues] = strtok((char *)(LPCTSTR)valueSet, ",");
|
|
|
|
while (values[numValues])
|
|
|
|
{
|
|
|
|
numValues++;
|
|
|
|
values[numValues] = strtok(NULL, ",");
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (strstr(commandList[0]," ")) {
|
|
|
|
strncpy(baseCommand, commandList[0], strlen(commandList[0]) - (strlen(strstr(commandList[0]," "))) );
|
|
|
|
strcat(baseCommand, " ");
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
for (int index=0; index < numValues; index++)
|
|
|
|
{
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
char valueBuffer[MAX_SIZE] = {'\0'};
|
|
|
|
((CListBox*)aWidget->control)->GetText(atoi(values[index]), valueBuffer);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (index >0)
|
|
|
|
{
|
|
|
|
commandList[commandListLength] = (char *) GlobalAlloc(0, MAX_SIZE * sizeof(char));
|
|
|
|
strcpy(commandList[commandListLength], baseCommand);
|
|
|
|
strcat(commandList[commandListLength], currDirPath);
|
|
|
|
if (localPath) {
|
|
|
|
strcat(commandList[commandListLength], localPath);
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
1999-09-30 04:29:48 +04:00
|
|
|
strcat(commandList[commandListLength], "\\");
|
|
|
|
strcat(commandList[commandListLength], valueBuffer);
|
|
|
|
strcat(commandList[commandListLength], " ");
|
|
|
|
commandListLength++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcat(commandList[commandListLength], currDirPath);
|
|
|
|
if (localPath) {
|
|
|
|
strcat(commandList[commandListLength], localPath);
|
|
|
|
}
|
|
|
|
strcat(commandList[commandListLength], "\\");
|
|
|
|
strcat(commandList[commandListLength], valueBuffer);
|
|
|
|
strcat(commandList[commandListLength], " ");
|
|
|
|
|
|
|
|
if (k+1 == numArgs)
|
1999-02-03 19:49:10 +03:00
|
|
|
{
|
1999-09-30 04:29:48 +04:00
|
|
|
commandListLength++;
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
}
|
1999-09-30 04:29:48 +04:00
|
|
|
}
|
1999-10-02 05:28:27 +04:00
|
|
|
*/
|
1999-09-30 04:29:48 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy(commandList[commandListLength], (char *) (LPCTSTR) aWidget->value);
|
|
|
|
strcat(commandList[commandListLength], " ");
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (k+1 == numArgs)
|
|
|
|
{
|
|
|
|
commandListLength++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (CString(args[k]) == "newEntry")
|
|
|
|
{
|
|
|
|
// Funky reference to newEntry as value just prompted for
|
|
|
|
strcat(commandList[commandListLength], currDirPath);
|
|
|
|
if (localPath) {
|
|
|
|
strcat(commandList[commandListLength], localPath);
|
|
|
|
}
|
|
|
|
strcat(commandList[commandListLength], "\\");
|
|
|
|
strcat(commandList[commandListLength], (char *) (LPCTSTR) entryName);
|
|
|
|
|
|
|
|
if (k+1 == numArgs)
|
|
|
|
{
|
|
|
|
commandListLength++;
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-06-17 08:44:53 +04:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newEntry = FALSE;
|
|
|
|
for (int listNum =0; listNum < commandListLength; listNum++)
|
1999-10-02 05:28:27 +04:00
|
|
|
theApp.ExecuteCommand(commandList[listNum]);
|
1999-09-30 04:29:48 +04:00
|
|
|
|
|
|
|
// This is the list of the target widget, but assumes the function
|
|
|
|
theApp.GenerateList(tmpFunction, tmpWidget, tmpParams);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Special dialog to show where the file was saved. Should be replaced with interpreted call in INI file
|
|
|
|
if (informAct)
|
|
|
|
{
|
|
|
|
CWnd myWnd;
|
|
|
|
char infoPath[MAX_SIZE] = {'\0'};
|
|
|
|
strcpy(infoPath, currDirPath);
|
|
|
|
if (localPath) {
|
|
|
|
strcat(infoPath, localPath);
|
|
|
|
}
|
1999-06-17 08:44:53 +04:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (entryName != "") {
|
|
|
|
myWnd.MessageBox( entryName + " is saved in " + CString(infoPath), "Information", MB_OK);
|
|
|
|
}
|
|
|
|
}
|
1999-10-02 05:28:27 +04:00
|
|
|
#endif
|
1999-06-17 08:44:53 +04:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::SortList(WIDGET *curWidget)
|
|
|
|
{
|
|
|
|
#ifdef ACTUALLYNEEDTODOSOMETHINGLIKETHIS
|
|
|
|
WIDGET* listWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
|
|
|
int count = ((CListBox*)(listWidget->control))->GetCount();
|
|
|
|
char* items[MAX_SIZE];
|
|
|
|
|
|
|
|
for (int i = 0; i < count; i++) {
|
|
|
|
items[i] = new char[MAX_SIZE];
|
|
|
|
((CListBox*)(listWidget->control))->GetText(i, items[i]);
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-05-19 07:31:11 +04:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
// Please use qsort() if this code becomes active again...
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (curWidget->action.function == "SortByName")
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (curWidget->action.function == "SortByPhone")
|
|
|
|
{
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
((CListBox*)(listWidget->control))->ResetContent();
|
|
|
|
for (int k = 0; k < count; k++) {
|
|
|
|
((CListBox*)(listWidget->control))->AddString(CString(items[k]));
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-06 03:18:12 +04:00
|
|
|
BOOL CWizardUI::NewConfig(WIDGET *curWidget, CString globalsName)
|
1999-09-30 04:29:48 +04:00
|
|
|
{
|
|
|
|
// This doesn't really belong here...
|
|
|
|
CNewConfigDialog newDlg;
|
|
|
|
newDlg.DoModal();
|
|
|
|
CString configField = newDlg.GetConfigName();
|
|
|
|
CString newDir = CString(customizationPath);
|
|
|
|
newDir += configField;
|
|
|
|
_mkdir(newDir);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
1999-10-06 03:18:12 +04:00
|
|
|
if (!tmpWidget)
|
|
|
|
return FALSE;
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
CString tmpFunction = tmpWidget->action.function;
|
|
|
|
CString params = CString(tmpWidget->action.parameters);
|
|
|
|
theApp.GenerateList(tmpFunction, tmpWidget, params);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
((CComboBox*)tmpWidget->control)->SelectString(0, configField);
|
1999-10-06 03:18:12 +04:00
|
|
|
|
|
|
|
theApp.SetGlobal(globalsName, configField);
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::BrowseFile(WIDGET *curWidget)
|
|
|
|
{
|
|
|
|
// This is to browse to a file
|
|
|
|
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_OVERWRITEPROMPT, NULL, NULL);
|
|
|
|
int retVal = fileDlg.DoModal();
|
|
|
|
CString fullFileName="";
|
|
|
|
|
|
|
|
|
|
|
|
//Checking to see if the open file dialog did get a value or was merely cancelled.
|
|
|
|
//If it was cancelled then the value of the edit box is not changed.
|
|
|
|
if (fileDlg.GetPathName() != "")
|
|
|
|
{
|
|
|
|
fullFileName = fileDlg.GetPathName();
|
|
|
|
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
1999-10-06 03:18:12 +04:00
|
|
|
if (tmpWidget && (CEdit*)tmpWidget->control)
|
1999-09-30 04:29:48 +04:00
|
|
|
((CEdit*)tmpWidget->control)->SetWindowText(fullFileName);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::BrowseDir(WIDGET *curWidget)
|
|
|
|
{
|
|
|
|
// The following code is used to browse to a dir
|
|
|
|
// CFileDialog does not allow this
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BROWSEINFO bi;
|
|
|
|
char szPath[MAX_PATH];
|
|
|
|
char szTitle[] = "Select Directory";
|
|
|
|
bi.hwndOwner = AfxGetMainWnd()->m_hWnd;
|
|
|
|
bi.pidlRoot = NULL;
|
|
|
|
bi.pszDisplayName = (char*)malloc(MAX_PATH);
|
|
|
|
bi.lpszTitle = szTitle;
|
|
|
|
|
|
|
|
// Enable this line to browse for a directory
|
|
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS;
|
|
|
|
|
|
|
|
// Enable this line to browse for a computer
|
|
|
|
bi.lpfn = NULL;
|
|
|
|
bi.lParam = NULL;
|
|
|
|
LPITEMIDLIST pidl= SHBrowseForFolder(&bi);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if(pidl != NULL)
|
|
|
|
{
|
|
|
|
SHGetPathFromIDList(pidl,szPath);
|
|
|
|
if( bi.ulFlags & BIF_BROWSEFORCOMPUTER )
|
|
|
|
{
|
|
|
|
// bi.pszDisplayName variable contains the computer name
|
|
|
|
}
|
|
|
|
else if( bi.ulFlags & BIF_RETURNONLYFSDIRS )
|
|
|
|
{
|
|
|
|
// szPath variable contains the path
|
|
|
|
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
|
|
|
if (tmpWidget)
|
|
|
|
((CEdit*)tmpWidget->control)->SetWindowText(szPath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
free( bi.pszDisplayName );
|
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::Progress()
|
|
|
|
{
|
|
|
|
#ifdef SUPPORTINGIBPROGRESS
|
|
|
|
CProgressDialog progressDlg(this);
|
|
|
|
progressDlg.Create(IDD_PROGRESS_DLG);
|
|
|
|
CProgressDialog *pProgressDlg = &progressDlg;
|
|
|
|
|
|
|
|
//CRuntimeClass *pProgDlgThread = RUNTIME_CLASS(CProgDlgThread); //This is the multi-threading stuff for the progress dialog
|
|
|
|
//AfxBeginThread(pProgDlgThread);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
pProgressDlg->m_ProgressText.SetWindowText("Creating a CD Layout...");
|
|
|
|
pProgressDlg->m_ProgressBar.SetPos(0);
|
|
|
|
pProgressDlg->m_ProgressBar.SetRange(0,4);
|
|
|
|
pProgressDlg->m_ProgressBar.SetStep(1);
|
|
|
|
|
|
|
|
if (curWidget->action.dll == "IBEngine.dll") {
|
|
|
|
VERIFY(hModule = ::LoadLibrary("IBEngine.dll"));
|
|
|
|
|
|
|
|
VERIFY(
|
|
|
|
pMyDllPath =
|
|
|
|
(MYDLLPATH*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "SetPath")
|
|
|
|
);
|
|
|
|
|
|
|
|
(*pMyDllPath)((char*)(LPCTSTR)Path);
|
|
|
|
|
|
|
|
pProgressDlg->m_ProgressText.SetWindowText("Loading Globals...");
|
|
|
|
LoadGlobals();
|
|
|
|
pProgressDlg->m_ProgressBar.StepIt();
|
|
|
|
pProgressDlg->UpdateWindow();
|
|
|
|
|
|
|
|
pProgressDlg->m_ProgressText.SetWindowText("Reading files...");
|
|
|
|
ReadIniFile();
|
|
|
|
pProgressDlg->m_ProgressBar.StepIt();
|
|
|
|
pProgressDlg->UpdateWindow();
|
|
|
|
|
|
|
|
pProgressDlg->m_ProgressText.SetWindowText("Merging files...");
|
|
|
|
MergeFiles();
|
|
|
|
pProgressDlg->m_ProgressBar.StepIt();
|
|
|
|
pProgressDlg->UpdateWindow();
|
|
|
|
|
|
|
|
pProgressDlg->m_ProgressText.SetWindowText("Creating CD Layout...");
|
|
|
|
CreateMedia();
|
|
|
|
pProgressDlg->m_ProgressBar.StepIt();
|
|
|
|
pProgressDlg->UpdateWindow();
|
|
|
|
|
|
|
|
MessageBox("CD Directory created", "OK", MB_OK);
|
|
|
|
}
|
|
|
|
#endif
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
return TRUE;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
|
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
// Get screen values exchanged
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
for(int i=0; i < CurrentNode->numWidgets; i++)
|
|
|
|
{
|
|
|
|
WIDGET* curWidget = CurrentNode->pageWidgets[i];
|
|
|
|
if (curWidget->widgetID != (int)wParam)
|
|
|
|
continue;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
if (curWidget->action.dll == "NULL")
|
|
|
|
{
|
|
|
|
if (curWidget->action.function == "command")
|
1999-10-12 05:54:00 +04:00
|
|
|
theInterpreter->interpret(curWidget->action.parameters, curWidget);
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
1999-09-30 04:29:48 +04:00
|
|
|
else
|
|
|
|
Progress();
|
|
|
|
|
|
|
|
break;
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return CPropertyPage::OnCommand(wParam, lParam);
|
|
|
|
}
|
|
|
|
|
1999-09-30 04:29:48 +04:00
|
|
|
// This is a comparison function for the TabOrder qsort() call
|
|
|
|
// Return -1 for "less than", 0 for "equals", and 1 for "greater than"
|
|
|
|
int TabSort(const void *w1, const void *w2)
|
|
|
|
{
|
|
|
|
WIDGET *widget1 = *((WIDGET **) w1);
|
|
|
|
WIDGET *widget2 = *((WIDGET **) w2);
|
|
|
|
|
|
|
|
// Primary key is y coordinate
|
|
|
|
if (widget1->location.y > widget2->location.y)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
if (widget1->location.y < widget2->location.y)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
// Primary key is equal, Secondary key is x coordinate
|
|
|
|
return (widget2->location.x - widget1->location.x);
|
|
|
|
}
|
|
|
|
|
1999-02-03 19:49:10 +03:00
|
|
|
void CWizardUI::SortWidgetsForTabOrder()
|
|
|
|
{
|
1999-09-30 04:29:48 +04:00
|
|
|
#ifdef USEOLDSORTCODEINSTEADOFBUILTINFUNCTION
|
1999-02-03 19:49:10 +03:00
|
|
|
// Sort on y-coordinate
|
|
|
|
int x = 0;
|
|
|
|
int y = 0;
|
|
|
|
int count = CurrentNode->numWidgets;
|
1999-09-30 04:29:48 +04:00
|
|
|
for (x = count-1; x >= 0; x--) {
|
1999-02-03 19:49:10 +03:00
|
|
|
BOOL flipped = FALSE;
|
|
|
|
|
|
|
|
for (int y = 0; y < x; y++) {
|
|
|
|
WIDGET* widgetOne = CurrentNode->pageWidgets[y];
|
|
|
|
WIDGET* widgetTwo = CurrentNode->pageWidgets[y+1];
|
|
|
|
|
|
|
|
if (widgetOne->location.y > widgetTwo->location.y)
|
|
|
|
{
|
|
|
|
WIDGET* T = widgetOne;
|
|
|
|
CurrentNode->pageWidgets[y] = widgetTwo;
|
|
|
|
CurrentNode->pageWidgets[y+1] = T;
|
|
|
|
|
|
|
|
flipped = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flipped) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Sort on x-coordinate
|
|
|
|
x = 0;
|
|
|
|
y = 0;
|
1999-09-30 04:29:48 +04:00
|
|
|
for (x = count-1; x >= 0; x--) {
|
1999-02-03 19:49:10 +03:00
|
|
|
BOOL flipped = FALSE;
|
|
|
|
|
|
|
|
for (int y = 0; y < x; y++) {
|
|
|
|
WIDGET* widgetOne = CurrentNode->pageWidgets[y];
|
|
|
|
WIDGET* widgetTwo = CurrentNode->pageWidgets[y+1];
|
|
|
|
|
|
|
|
if (widgetOne->location.y == widgetTwo->location.y)
|
|
|
|
{
|
|
|
|
if (widgetOne->location.x > widgetTwo->location.x)
|
|
|
|
{
|
|
|
|
WIDGET* T = widgetOne;
|
|
|
|
CurrentNode->pageWidgets[y] = widgetTwo;
|
|
|
|
CurrentNode->pageWidgets[y+1] = T;
|
|
|
|
|
|
|
|
flipped = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!flipped) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
1999-09-30 04:29:48 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
qsort(CurrentNode->pageWidgets, CurrentNode->numWidgets, sizeof(WIDGET *), TabSort);
|
1999-02-03 19:49:10 +03:00
|
|
|
CurrentNode->isWidgetsSorted = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void CWizardUI::CreateControls()
|
|
|
|
{
|
|
|
|
m_pFont = new CFont;
|
|
|
|
m_pFont->CreateFont(8, 0, 0, 0, FW_NORMAL,
|
|
|
|
0, 0, 0, ANSI_CHARSET,
|
|
|
|
OUT_DEFAULT_PRECIS,
|
|
|
|
CLIP_DEFAULT_PRECIS,
|
|
|
|
DEFAULT_QUALITY,
|
|
|
|
DEFAULT_PITCH|FF_DONTCARE,
|
|
|
|
"MS Sans Serif");
|
|
|
|
|
|
|
|
m_pNavFont = new CFont;
|
|
|
|
m_pNavFont->CreateFont(8, 0, 0, 0, FW_BOLD,
|
|
|
|
0, 0, 0, ANSI_CHARSET,
|
|
|
|
OUT_DEFAULT_PRECIS,
|
|
|
|
CLIP_DEFAULT_PRECIS,
|
|
|
|
DEFAULT_QUALITY,
|
|
|
|
DEFAULT_PITCH|FF_DONTCARE,
|
|
|
|
"MS Sans Serif");
|
|
|
|
|
|
|
|
//End Font Logic Start iniFile logic
|
|
|
|
containsImage = FALSE;
|
|
|
|
if (CurrentNode->numImages > 0) {
|
|
|
|
containsImage = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_pControlCount = CurrentNode->numWidgets;
|
|
|
|
|
|
|
|
for (int x = 0; x < m_pControlCount; x++)
|
|
|
|
{
|
|
|
|
WIDGET* curWidget = CurrentNode->pageWidgets[x];
|
|
|
|
CString widgetType = curWidget->type;
|
|
|
|
int s_x = curWidget->location.x;
|
|
|
|
int s_y = curWidget->location.y;
|
|
|
|
int s_width = curWidget->size.width;
|
|
|
|
int s_height = curWidget->size.height;
|
|
|
|
int ID = curWidget->widgetID;
|
|
|
|
|
|
|
|
CRect tmpRect = CRect(s_x, s_y, (s_x + s_width), (s_y + s_height));
|
|
|
|
|
|
|
|
if (widgetType == "Text") {
|
|
|
|
curWidget->control = new CStatic;
|
|
|
|
((CStatic*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
|
|
|
|
}
|
|
|
|
else if (widgetType == "Navigation Text") {
|
|
|
|
curWidget->control = new CNavText;
|
|
|
|
((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID);
|
|
|
|
}
|
|
|
|
else if (widgetType == "EditBox") {
|
1999-09-17 04:05:25 +04:00
|
|
|
curWidget->control = new CEdit;//Added new style parameter ES_AUTOHSCROLL- to allow *GASP* SCROLLING!!
|
1999-02-03 19:49:10 +03:00
|
|
|
((CEdit*)curWidget->control)->CreateEx(WS_EX_CLIENTEDGE,
|
|
|
|
_T("EDIT"),
|
|
|
|
NULL,
|
1999-09-17 04:05:25 +04:00
|
|
|
WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER |ES_AUTOHSCROLL ,
|
1999-02-03 19:49:10 +03:00
|
|
|
curWidget->location.x,
|
|
|
|
curWidget->location.y,
|
|
|
|
curWidget->size.width,
|
|
|
|
curWidget->size.height,
|
|
|
|
m_hWnd, 0, 0 );
|
1999-09-17 04:05:25 +04:00
|
|
|
//Set maximum number of characters allowed per line - limit set to 200
|
1999-10-06 05:32:00 +04:00
|
|
|
((CEdit*)curWidget->control)->SetLimitText(int(curWidget->fieldlen.length));
|
1999-02-03 19:49:10 +03:00
|
|
|
((CEdit*)curWidget->control)->SetWindowText(curWidget->value);
|
|
|
|
}
|
|
|
|
else if (widgetType == "Button") {
|
|
|
|
curWidget->control = new CButton;
|
|
|
|
((CButton*)curWidget->control)->Create(curWidget->value, BS_PUSHBUTTON | WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
}
|
|
|
|
else if (widgetType == "RadioButton") {
|
|
|
|
curWidget->control = new CButton;
|
|
|
|
((CButton*)curWidget->control)->Create(curWidget->title, BS_AUTORADIOBUTTON | WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
|
|
|
|
//char* widgetName = new char[sizeof(curWidget->name)];
|
|
|
|
char widgetName[MID_SIZE];
|
|
|
|
strcpy(widgetName, curWidget->name);
|
|
|
|
|
|
|
|
CString theVal = theApp.GetGlobal(curWidget->group);
|
|
|
|
|
|
|
|
//int newLineIndex = theVal.ReverseFind('\n');
|
|
|
|
//if (newLineIndex > -1)
|
|
|
|
//theVal.SetAt(newLineIndex, '\0');
|
|
|
|
|
|
|
|
theVal.TrimRight();
|
|
|
|
|
|
|
|
|
|
|
|
CString allOptions;
|
|
|
|
CString setBack;
|
|
|
|
allOptions = theApp.GetGlobalOptions(curWidget->group);
|
|
|
|
|
|
|
|
char* options[MAX_SIZE];
|
|
|
|
int numOfOptions = 0;
|
|
|
|
char* s = new char[MAX_SIZE];
|
|
|
|
s = strtok((char *) (LPCTSTR) allOptions, ",");
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
setBack = CString(s);
|
|
|
|
}
|
|
|
|
while (s)
|
|
|
|
{
|
|
|
|
setBack = setBack + ",";
|
|
|
|
options[numOfOptions] = new char[MAX_SIZE];
|
|
|
|
strcpy(options[numOfOptions], s);
|
|
|
|
s = strtok( NULL, "," );
|
|
|
|
numOfOptions++;
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
setBack = setBack + CString(s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int index = atoi((char *)(LPCTSTR)theVal);
|
|
|
|
index--;
|
|
|
|
|
|
|
|
if (index < 0) {
|
|
|
|
index = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (setBack != "") {
|
|
|
|
setBack.SetAt(setBack.GetLength()-1, '\0');
|
|
|
|
}
|
|
|
|
|
|
|
|
WIDGET* rWidget = theApp.findWidget((char *) (LPCTSTR) curWidget->group);
|
|
|
|
|
|
|
|
rWidget->items = setBack;
|
|
|
|
|
|
|
|
int tmpVal = atoi((char *)(LPCTSTR)theVal)-1;
|
|
|
|
|
|
|
|
if (tmpVal < 0) {
|
|
|
|
tmpVal = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (strcmp(options[tmpVal], widgetName) == 0) {
|
|
|
|
((CButton*)curWidget->control)->SetCheck(1);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
((CButton*)curWidget->control)->SetCheck(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (widgetType == "CheckBox") {
|
|
|
|
curWidget->control = new CButton;
|
|
|
|
((CButton*)curWidget->control)->Create(curWidget->title, BS_AUTOCHECKBOX | WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
((CButton*)curWidget->control)->SetCheck(atoi(curWidget->value));
|
|
|
|
}
|
|
|
|
else if (widgetType == "ListBox")
|
|
|
|
{
|
|
|
|
curWidget->control = new CListBox;
|
|
|
|
((CListBox*)curWidget->control)->Create(LBS_STANDARD | LBS_MULTIPLESEL | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
((CListBox*)curWidget->control)->ModifyStyleEx(NULL, WS_EX_CLIENTEDGE, 0);
|
|
|
|
|
|
|
|
if (curWidget->action.function == "GenerateFileList" ||
|
|
|
|
curWidget->action.function == "GenerateDirList")
|
|
|
|
{
|
|
|
|
CString ext = CString(curWidget->action.parameters);
|
|
|
|
theApp.GenerateList(curWidget->action.function, curWidget, ext);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int i = 0; i < curWidget->numOfOptions; i++)
|
|
|
|
{
|
|
|
|
if (curWidget->options.value[i])
|
|
|
|
{
|
|
|
|
((CListBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
char* selectedItems;
|
|
|
|
selectedItems = (char *) GlobalAlloc(0, 20 * sizeof(char));
|
|
|
|
strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value);
|
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
char *s = strtok(selectedItems, ",");
|
1999-02-03 19:49:10 +03:00
|
|
|
while (s)
|
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
((CListBox*)curWidget->control)->SelectString(0, s);
|
1999-02-03 19:49:10 +03:00
|
|
|
s = strtok( NULL, "," );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (widgetType == "ComboBox") {
|
|
|
|
curWidget->control = new CComboBox;
|
|
|
|
((CComboBox*)curWidget->control)->Create(CBS_DROPDOWNLIST | WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
|
|
|
|
if (curWidget->action.function == "GenerateFileList" ||
|
|
|
|
curWidget->action.function == "GenerateDirList")
|
|
|
|
{
|
|
|
|
CString ext = CString(curWidget->action.parameters);
|
|
|
|
theApp.GenerateList(curWidget->action.function, curWidget, ext);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for (int i = 0; i < curWidget->numOfOptions; i++)
|
|
|
|
{
|
|
|
|
if (curWidget->options.value[i])
|
|
|
|
{
|
|
|
|
((CComboBox*)curWidget->control)->AddString(curWidget->options.value[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//((CComboBox*)curWidget->control)->SelectString(0, selectedCustomization);
|
|
|
|
}
|
|
|
|
else if (widgetType == "GroupBox") {
|
|
|
|
curWidget->control = new CButton;
|
|
|
|
((CButton*)curWidget->control)->Create(curWidget->value, BS_GROUPBOX, tmpRect, this, ID);
|
|
|
|
}
|
|
|
|
else if (widgetType == "ProgressBar") {
|
|
|
|
curWidget->control = new CProgressCtrl;
|
|
|
|
((CProgressCtrl*)curWidget->control)->Create(WS_TABSTOP, tmpRect, this, ID);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Set the font of the widget and increment the dynamically assigned ID value
|
|
|
|
if ((curWidget->description == "Navigation Status")
|
|
|
|
|| (curWidget->description == "Current Page")) {
|
|
|
|
curWidget->control->SetFont(m_pNavFont);
|
|
|
|
}
|
|
|
|
else if (curWidget->control)
|
|
|
|
{
|
|
|
|
curWidget->control->SetFont(m_pFont);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::DisplayControls()
|
|
|
|
{
|
|
|
|
CRect rect(0, 0, 4, 8);
|
|
|
|
MapDialogRect(&rect);
|
|
|
|
|
|
|
|
int baseWidth = rect.Width();
|
|
|
|
int baseHeight = rect.Height();
|
|
|
|
|
|
|
|
extern NODE *CurrentNode;
|
|
|
|
|
|
|
|
WIDGET* curWidget;
|
|
|
|
for (int i = m_pControlCount-1; i >= 0; i--) {
|
|
|
|
curWidget = CurrentNode->pageWidgets[i];
|
|
|
|
|
|
|
|
if (curWidget->control)
|
|
|
|
{
|
|
|
|
curWidget->control->SetWindowPos(
|
|
|
|
&wndTop,
|
|
|
|
(int)((float)(curWidget->location.x) * (float)baseWidth / 4.0),
|
|
|
|
(int)((float)(curWidget->location.y) * (float)baseHeight / 8.0),
|
|
|
|
(int)((float)(curWidget->size.width) * (float)baseWidth / 4.0),
|
|
|
|
(int)((float)(curWidget->size.height) * (float)baseHeight / 8.0),
|
|
|
|
SWP_SHOWWINDOW);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::DestroyCurrentScreenWidgets()
|
|
|
|
{
|
|
|
|
WIDGET* curWidget;
|
|
|
|
for (int i = 0; i < m_pControlCount; i++) {
|
|
|
|
curWidget = CurrentNode->pageWidgets[i];
|
|
|
|
|
|
|
|
if (curWidget->control)
|
|
|
|
BOOL retFalg = curWidget->control->DestroyWindow();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
CString CWizardUI::GetScreenValue(WIDGET *curWidget)
|
1999-02-03 19:49:10 +03:00
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
//
|
|
|
|
// NOTE: Assumes caller has already done UpdateData(TRUE);
|
|
|
|
//
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
CString widgetType = curWidget->type;
|
|
|
|
CString rv("");
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
if (widgetType == "CheckBox") {
|
|
|
|
int state = ((CButton*)curWidget->control)->GetState();
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
char temp[MIN_SIZE];
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
itoa(state, temp, 10);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
rv = CString(temp);
|
|
|
|
}
|
|
|
|
else if (widgetType == "RadioButton")
|
|
|
|
{
|
|
|
|
int state = ((CButton*)curWidget->control)->GetState();
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
CString allOptions;
|
|
|
|
CString setBack;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
WIDGET* rWidget = theApp.findWidget((char *) (LPCTSTR) curWidget->group);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
allOptions = rWidget->items;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
char* options[MAX_SIZE];
|
|
|
|
int numOfOptions = 0;
|
|
|
|
char* s = new char[MAX_SIZE];
|
|
|
|
s = strtok((char *) (LPCTSTR) allOptions, ",");
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
if (curWidget->name == CString(s) && state == 1)
|
|
|
|
{
|
|
|
|
rWidget->value = "1";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (s)
|
|
|
|
{
|
|
|
|
setBack = CString(s);
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
int i=1;
|
|
|
|
while (s)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
setBack = setBack + ",";
|
|
|
|
options[numOfOptions] = new char[MID_SIZE];
|
|
|
|
strcpy(options[numOfOptions], s);
|
|
|
|
s = strtok( NULL, "," );
|
|
|
|
|
1999-02-03 19:49:10 +03:00
|
|
|
if (s)
|
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
setBack = setBack + CString(s);
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
char temp[MIN_SIZE];
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
itoa(i, temp, 10);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
if (curWidget->name == CString(s) && state == 1)
|
|
|
|
{
|
|
|
|
rWidget->value = CString(temp);
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
1999-10-02 05:28:27 +04:00
|
|
|
|
|
|
|
numOfOptions++;
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
setBack.SetAt(setBack.GetLength()-1, '\0');
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
rWidget->items = setBack;
|
|
|
|
}
|
|
|
|
else if (widgetType == "EditBox") {
|
|
|
|
char myLine[MAX_SIZE];
|
|
|
|
curWidget->control->GetWindowText(myLine, 250);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
CString line = (CString)myLine;
|
|
|
|
rv = line;
|
|
|
|
}
|
|
|
|
else if (widgetType == "ListBox")
|
|
|
|
{
|
|
|
|
LPINT choices;
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
int count;
|
|
|
|
count = (((CListBox *)curWidget->control))->GetSelCount();
|
|
|
|
choices = (int *) GlobalAlloc(0, count * sizeof(LPINT));
|
|
|
|
((CListBox *)curWidget->control)->GetSelItems(count, choices);
|
1999-02-03 19:49:10 +03:00
|
|
|
|
1999-10-02 05:28:27 +04:00
|
|
|
rv = "";
|
|
|
|
CString temp;
|
|
|
|
for (int i=0; i < count; i++)
|
|
|
|
{
|
|
|
|
((CListBox *)curWidget->control)->GetText(choices[i], temp);
|
|
|
|
rv = rv + temp;
|
|
|
|
if ( i+1 < count)
|
|
|
|
rv += ",";
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
1999-10-02 05:28:27 +04:00
|
|
|
}
|
|
|
|
else if (widgetType == "ComboBox")
|
|
|
|
{
|
|
|
|
int selectedIndex = ((CComboBox*)curWidget->control)->GetCurSel();
|
|
|
|
if (selectedIndex != -1)
|
1999-02-03 19:49:10 +03:00
|
|
|
{
|
1999-10-02 05:28:27 +04:00
|
|
|
char tmpStr[MIN_SIZE];
|
|
|
|
((CComboBox*)curWidget->control)->GetLBText(selectedIndex, tmpStr);
|
|
|
|
rv = tmpStr;
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
}
|
1999-10-02 05:28:27 +04:00
|
|
|
else
|
|
|
|
rv = curWidget->value; // !!! Fix this so we're not copying strings all the time
|
|
|
|
// Should be able to just pass in an "assign" boolean
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::UpdateGlobals()
|
|
|
|
{
|
|
|
|
UpdateData(TRUE); // Get data from screen into controls
|
|
|
|
|
|
|
|
|
|
|
|
WIDGET* curWidget;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < m_pControlCount; i++)
|
|
|
|
{
|
|
|
|
curWidget = CurrentNode->pageWidgets[i];
|
|
|
|
curWidget->value = GetScreenValue(curWidget);
|
|
|
|
}
|
1999-02-03 19:49:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::LoadGlobals()
|
|
|
|
{
|
|
|
|
VERIFY(hGlobal = ::LoadLibrary("GlobalApi.dll"));
|
|
|
|
VERIFY(
|
|
|
|
pMySetGlobal =
|
|
|
|
(MYSETGLOBAL*)::GetProcAddress(
|
|
|
|
(HMODULE) hGlobal, "SetGlobal")
|
|
|
|
);
|
|
|
|
|
|
|
|
//CString animatedLogo = theApp.GetGlobal("AnimatedLogoURL");
|
|
|
|
|
|
|
|
(*pMySetGlobal)("Platform", "32");
|
|
|
|
(*pMySetGlobal)("Custom Inbox Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\inbox"));
|
|
|
|
(*pMySetGlobal)("Overwrite CFG", "YES");
|
|
|
|
(*pMySetGlobal)("Custom Readme Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\readme.txt"));
|
|
|
|
(*pMySetGlobal)("Custom License Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\license.txt"));
|
|
|
|
(*pMySetGlobal)("Custom CFG Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\netscape.cfg"));
|
|
|
|
(*pMySetGlobal)("Custom Bookmark Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\bookmark.htm"));
|
|
|
|
(*pMySetGlobal)("Custom Addressbook Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\pab.na2"));
|
|
|
|
(*pMySetGlobal)("Install Splash Path", (char*)(LPCTSTR)(Path+"IBDemo\\source\\setup.bmp"));
|
|
|
|
|
|
|
|
// The command line specifies the output path
|
|
|
|
// If it is NULL, set a default output path
|
|
|
|
UpdateData(TRUE);
|
|
|
|
(*pMySetGlobal)("Output Path", (char*)(LPCTSTR)(Path+"Output"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::ReadIniFile()
|
|
|
|
{
|
|
|
|
// TODO: Add extra validation here
|
|
|
|
|
|
|
|
VERIFY(
|
|
|
|
pMyFunction =
|
|
|
|
(MYFUNCTION*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "ReadMyFile")
|
|
|
|
);
|
|
|
|
|
|
|
|
(*pMyFunction)();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::MergeFiles()
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO: Add your control notification handler code here
|
|
|
|
|
|
|
|
VERIFY(
|
|
|
|
pMyFunction =
|
|
|
|
(MYFUNCTION*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "MergeFiles")
|
|
|
|
);
|
|
|
|
|
|
|
|
(*pMyFunction)();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::CreateMedia()
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO: Add your control notification handler code here
|
|
|
|
|
|
|
|
VERIFY(
|
|
|
|
pMyFunction =
|
|
|
|
(MYFUNCTION*)::GetProcAddress(
|
|
|
|
(HMODULE) hModule, "CreateMedia")
|
|
|
|
);
|
|
|
|
|
|
|
|
(*pMyFunction)();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CWizardUI::ExitDemo()
|
|
|
|
{
|
|
|
|
|
|
|
|
// TODO: Add extra cleanup here
|
|
|
|
FreeLibrary(hModule);
|
|
|
|
FreeLibrary(hGlobal);
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardUI::OnEraseBkgnd(CDC* pDC)
|
|
|
|
{
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
HBRUSH CWizardUI::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
|
|
|
|
{
|
|
|
|
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
|
|
|
|
|
|
|
|
// TODO: Return a different brush if the default is not desired
|
|
|
|
return hbr;
|
|
|
|
}
|
|
|
|
|
|
|
|
BOOL CWizardUI::OnWizardFinish()
|
|
|
|
{
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
UpdateGlobals();
|
|
|
|
|
1999-10-11 23:23:25 +04:00
|
|
|
if (CurrentNode->navControls->onNextAction)
|
1999-10-12 05:54:00 +04:00
|
|
|
if (!theInterpreter->interpret(CurrentNode->navControls->onNextAction, NULL))
|
1999-10-11 23:23:25 +04:00
|
|
|
return FALSE;
|
1999-02-03 19:49:10 +03:00
|
|
|
return CPropertyPage::OnWizardFinish();
|
|
|
|
}
|
|
|
|
|
1999-05-19 07:31:11 +04:00
|
|
|
BOOL CWizardUI::OnApply()
|
|
|
|
{
|
|
|
|
// TODO: Add your specialized code here and/or call the base class
|
|
|
|
|
|
|
|
return CPropertyPage::OnApply();
|
|
|
|
}
|
|
|
|
|