зеркало из https://github.com/mozilla/pjs.git
globals into a dll
This commit is contained in:
Родитель
0631e9253c
Коммит
14c0e312ce
|
@ -2,6 +2,7 @@
|
|||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "globals.h"
|
||||
#include "WizardMachine.h"
|
||||
#include "SumDlg.h"
|
||||
|
||||
|
@ -10,10 +11,6 @@
|
|||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
extern WIDGET GlobalWidgetArray[1000];
|
||||
|
||||
extern int GlobalArrayIndex;
|
||||
|
||||
|
||||
CString stringerx1 ="name1";
|
||||
|
||||
|
|
|
@ -22,11 +22,12 @@
|
|||
|
||||
#include "stdafx.h"
|
||||
#include "afxmt.h"
|
||||
#include "WizardMachine.h"
|
||||
#include <iostream.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <direct.h>
|
||||
#include "globals.h"
|
||||
#include "WizardMachine.h"
|
||||
#include "HelpDlg.h"
|
||||
#include "WizHelp.h"
|
||||
#include "ImgDlg.h"
|
||||
|
@ -75,9 +76,7 @@ CWizardMachineApp theApp;
|
|||
NODE *GlobalDefaults;
|
||||
NODE *WizardTree;
|
||||
NODE *CurrentNode;
|
||||
WIDGET GlobalWidgetArray[1000];
|
||||
|
||||
int GlobalArrayIndex=0;
|
||||
int CurrentPageBaseIndex=100;
|
||||
|
||||
CString Path;
|
||||
|
@ -339,15 +338,6 @@ BOOL CWizardMachineApp::InitInstance()
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
////Add Wizard machine functions here.
|
||||
//Define OnEnter function
|
||||
//Define OnExit function
|
||||
//Define ExitApp function
|
||||
//Define GoToNextNode function
|
||||
//Define GoToPrevNode function
|
||||
//Define GetGlobal function
|
||||
//Define SetGlobal function
|
||||
|
||||
void CWizardMachineApp::InitializeTree(CString rootIniFile)
|
||||
{
|
||||
WizardTree = CreateNode(GlobalDefaults, rootIniFile);
|
||||
|
@ -1223,16 +1213,6 @@ CString CWizardMachineApp::GetModulePath()
|
|||
return CString(currPath);
|
||||
}
|
||||
|
||||
CString CWizardMachineApp::GetGlobal(CString theName)
|
||||
{
|
||||
WIDGET *w = findWidget((char *) (LPCSTR) theName);
|
||||
|
||||
if (w)
|
||||
return w->value;
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
CString CWizardMachineApp::GetGlobalOptions(CString theName)
|
||||
{
|
||||
CString temp="";
|
||||
|
@ -1256,42 +1236,6 @@ CString CWizardMachineApp::GetGlobalOptions(CString theName)
|
|||
return temp;
|
||||
}
|
||||
|
||||
WIDGET* CWizardMachineApp::SetGlobal(CString theName, CString theValue)
|
||||
{
|
||||
WIDGET* w = findWidget((char *)(LPCTSTR) theName);
|
||||
if (w == NULL)
|
||||
{
|
||||
// Make sure we can add this value
|
||||
if (GlobalArrayIndex >= sizeof(GlobalWidgetArray))
|
||||
{
|
||||
fprintf(out, "----------------** TERMINATED - Out of Global Space **---------------\n");
|
||||
exit(11);
|
||||
}
|
||||
|
||||
GlobalWidgetArray[GlobalArrayIndex].name = theName;
|
||||
GlobalWidgetArray[GlobalArrayIndex].value = theValue;
|
||||
w = &GlobalWidgetArray[GlobalArrayIndex];
|
||||
GlobalArrayIndex++;
|
||||
}
|
||||
else
|
||||
w->value = theValue;
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
WIDGET* CWizardMachineApp::findWidget(char *theName)
|
||||
{
|
||||
|
||||
for (int i = 0; i < GlobalArrayIndex; i++)
|
||||
{
|
||||
if (GlobalWidgetArray[i].name == theName) {
|
||||
return (&GlobalWidgetArray[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue)
|
||||
{
|
||||
static int idCounter = 0;
|
||||
|
|
|
@ -66,10 +66,7 @@ public:
|
|||
BOOL IsLastNode(NODE* treeNode);
|
||||
BOOL IsFirstNode(NODE* treeNode);
|
||||
CString GetModulePath();
|
||||
CString GetGlobal(CString theName);
|
||||
WIDGET* SetGlobal(CString theName, CString theValue);
|
||||
CString GetGlobalOptions(CString theName);
|
||||
WIDGET* findWidget(char *name);
|
||||
void BuildWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex, BOOL readValue);
|
||||
// void BuildHelpWidget(WIDGET* aWidget, CString iniSection, CString iniFile, int pageBaseIndex);
|
||||
void GenerateList(CString action, WIDGET* targetWidget, CString ext);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "afxmt.h"
|
||||
|
||||
#include "globals.h"
|
||||
#include "WizardMachine.h"
|
||||
#include "fstream.h"
|
||||
#include "ImgDlg.h"
|
||||
|
@ -56,8 +57,6 @@ 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];
|
||||
|
||||
|
@ -276,7 +275,7 @@ BOOL CWizardUI::ActCommand(WIDGET *curWidget)
|
|||
BOOL CWizardUI::SortList(WIDGET *curWidget)
|
||||
{
|
||||
#ifdef ACTUALLYNEEDTODOSOMETHINGLIKETHIS
|
||||
WIDGET* listWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
WIDGET* listWidget = findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
int count = ((CListBox*)(listWidget->control))->GetCount();
|
||||
char* items[MAX_SIZE];
|
||||
|
||||
|
@ -306,7 +305,7 @@ BOOL CWizardUI::SortList(WIDGET *curWidget)
|
|||
|
||||
BOOL CWizardUI::SetDescription(WIDGET *w)
|
||||
{
|
||||
WIDGET *t = theApp.findWidget((char *) (LPCTSTR) w->target);
|
||||
WIDGET *t = findWidget((char *) (LPCTSTR) w->target);
|
||||
if (!t || (t->type != "Text" && t->type != "BoldText"))
|
||||
return FALSE;
|
||||
|
||||
|
@ -531,7 +530,7 @@ void CWizardUI::CreateControls()
|
|||
char widgetName[MID_SIZE];
|
||||
strcpy(widgetName, curWidget->name);
|
||||
|
||||
CString theVal = theApp.GetGlobal(curWidget->group);
|
||||
CString theVal = GetGlobal(curWidget->group);
|
||||
|
||||
//int newLineIndex = theVal.ReverseFind('\n');
|
||||
//if (newLineIndex > -1)
|
||||
|
@ -576,7 +575,7 @@ void CWizardUI::CreateControls()
|
|||
setBack.SetAt(setBack.GetLength()-1, '\0');
|
||||
}
|
||||
|
||||
WIDGET* rWidget = theApp.findWidget((char *) (LPCTSTR) curWidget->group);
|
||||
WIDGET* rWidget = findWidget((char *) (LPCTSTR) curWidget->group);
|
||||
|
||||
rWidget->items = setBack;
|
||||
|
||||
|
@ -916,7 +915,7 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
|
|||
CString allOptions;
|
||||
CString setBack;
|
||||
|
||||
WIDGET* rWidget = theApp.findWidget((char *) (LPCTSTR) curWidget->group);
|
||||
WIDGET* rWidget = findWidget((char *) (LPCTSTR) curWidget->group);
|
||||
|
||||
allOptions = rWidget->items;
|
||||
|
||||
|
@ -1051,7 +1050,7 @@ void CWizardUI::LoadGlobals()
|
|||
(HMODULE) hGlobal, "SetGlobal")
|
||||
);
|
||||
|
||||
//CString animatedLogo = theApp.GetGlobal("AnimatedLogoURL");
|
||||
//CString animatedLogo = GetGlobal("AnimatedLogoURL");
|
||||
|
||||
(*pMySetGlobal)("Platform", "32");
|
||||
(*pMySetGlobal)("Custom Inbox Path", (char*)(LPCTSTR)(Path+"IBDemo\\defaults\\inbox"));
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
#include <direct.h>
|
||||
#include "stdafx.h"
|
||||
#include "globals.h"
|
||||
#include "WizardMachine.h"
|
||||
#include "Interpret.h"
|
||||
#include "WizardUI.h"
|
||||
|
@ -6,7 +8,6 @@
|
|||
#include "SumDlg.h"
|
||||
#include "NewDialog.h"
|
||||
#include "NewConfigDialog.h"
|
||||
#include <direct.h>
|
||||
|
||||
// for CopyDir
|
||||
#include "winbase.h"
|
||||
|
@ -30,8 +31,6 @@ 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 BOOL IsSameCache;
|
||||
|
@ -46,8 +45,8 @@ extern _declspec (dllimport) WIDGET ptr_ga[1000];
|
|||
CInterpret::CInterpret()
|
||||
{
|
||||
// Init linked list to avoid messy operations on the linked list
|
||||
m_DLLs.dllName = "";
|
||||
m_DLLs.procName = "";
|
||||
m_DLLs.dllName = NULL;
|
||||
m_DLLs.procName = NULL;
|
||||
m_DLLs.next = NULL;
|
||||
}
|
||||
|
||||
|
@ -92,7 +91,7 @@ BOOL CInterpret::NewConfig(WIDGET *curWidget, CString globalsName)
|
|||
}
|
||||
|
||||
|
||||
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
WIDGET* tmpWidget = findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
if (!tmpWidget)
|
||||
return FALSE;
|
||||
|
||||
|
@ -102,7 +101,7 @@ BOOL CInterpret::NewConfig(WIDGET *curWidget, CString globalsName)
|
|||
if (!configField.IsEmpty())
|
||||
((CComboBox*)tmpWidget->control)->SelectString(0, configField);
|
||||
|
||||
theApp.SetGlobal(globalsName, configField);
|
||||
SetGlobal(globalsName, configField);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -120,7 +119,7 @@ BOOL CInterpret::BrowseFile(WIDGET *curWidget)
|
|||
if (fileDlg.GetPathName() != "")
|
||||
{
|
||||
fullFileName = fileDlg.GetPathName();
|
||||
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
WIDGET* tmpWidget = findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
if (tmpWidget && (CEdit*)tmpWidget->control)
|
||||
((CEdit*)tmpWidget->control)->SetWindowText(fullFileName);
|
||||
}
|
||||
|
@ -159,7 +158,7 @@ BOOL CInterpret::BrowseDir(WIDGET *curWidget)
|
|||
else if( bi.ulFlags & BIF_RETURNONLYFSDIRS )
|
||||
{
|
||||
// szPath variable contains the path
|
||||
WIDGET* tmpWidget = theApp.findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
WIDGET* tmpWidget = findWidget((char*) (LPCTSTR)curWidget->target);
|
||||
if (tmpWidget)
|
||||
((CEdit*)tmpWidget->control)->SetWindowText(szPath);
|
||||
}
|
||||
|
@ -285,7 +284,7 @@ BOOL CInterpret::IterateListBox(char *parms)
|
|||
char *target = strtok(parms, ",");
|
||||
char *showstr = strtok(NULL, ",");
|
||||
char *cmd = strtok(NULL, "");
|
||||
WIDGET *w = theApp.findWidget(target);
|
||||
WIDGET *w = findWidget(target);
|
||||
char indices[MAX_SIZE];
|
||||
int showflag;
|
||||
|
||||
|
@ -354,7 +353,7 @@ CString CInterpret::replaceVars(char *str, char *listval)
|
|||
v = listval;
|
||||
else
|
||||
{
|
||||
WIDGET *w = theApp.findWidget(x);
|
||||
WIDGET *w = findWidget(x);
|
||||
if (w)
|
||||
{
|
||||
if (w->control && w->control->m_hWnd)
|
||||
|
@ -394,13 +393,15 @@ BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms)
|
|||
// the handling of the linked list by allowing us to otherwise
|
||||
// ignore the difference in the first node.
|
||||
|
||||
CString dllStr = CString(dll);
|
||||
CString procStr = CString(proc);
|
||||
DLLINFO *last = &m_DLLs;
|
||||
DLLINFO *dllp = m_DLLs.next;
|
||||
int found = FALSE;
|
||||
while (!found && dllp)
|
||||
{
|
||||
last = dllp;
|
||||
if (strcmp(dllp->dllName, dll) == 0 && strcmp(dllp->procName, proc) == 0)
|
||||
if (*dllp->dllName == dllStr && *dllp->procName == procStr)
|
||||
found = TRUE;
|
||||
else
|
||||
dllp = dllp->next;
|
||||
|
@ -411,14 +412,20 @@ BOOL CInterpret::CallDLL(char *dll, char *proc, char *parms)
|
|||
if (!found)
|
||||
{
|
||||
dllp = (DLLINFO *) GlobalAlloc(0, sizeof(DLLINFO));
|
||||
dllp->dllName = CString(dll);
|
||||
dllp->procName = CString(proc);
|
||||
dllp->dllName = new CString(dll);
|
||||
dllp->procName = new CString(proc);
|
||||
VERIFY(dllp->hDLL = ::LoadLibrary(dll));
|
||||
if (!dllp->hDLL)
|
||||
{
|
||||
DWORD e = GetLastError();
|
||||
return FALSE;
|
||||
}
|
||||
VERIFY(dllp->procAddr = (DLLPROC *) ::GetProcAddress(dllp->hDLL, proc));
|
||||
if (!dllp->procAddr)
|
||||
{
|
||||
DWORD e = GetLastError();
|
||||
return FALSE;
|
||||
}
|
||||
dllp->next = NULL;
|
||||
|
||||
last->next = dllp;
|
||||
|
@ -588,7 +595,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
CNewDialog newDlg;
|
||||
newDlg.DoModal();
|
||||
entryName = newDlg.GetData();
|
||||
theApp.SetGlobal(parms, entryName);
|
||||
SetGlobal(parms, entryName);
|
||||
}
|
||||
else if (strcmp(pcmd, "inform") == 0)
|
||||
{
|
||||
|
@ -601,7 +608,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
|
||||
CString entryName;
|
||||
CWnd myWnd;
|
||||
entryName = theApp.GetGlobal(parms);
|
||||
entryName = GetGlobal(parms);
|
||||
CString p2path = replaceVars(p2,NULL);
|
||||
if (entryName != "") {
|
||||
myWnd.MessageBox( entryName + " is saved in " + p2path, "Information", MB_OK);
|
||||
|
@ -620,7 +627,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
if (strcmp(parms, "self") == 0)
|
||||
w = curWidget;
|
||||
else
|
||||
w = theApp.findWidget(parms);
|
||||
w = findWidget(parms);
|
||||
|
||||
if (w)
|
||||
{
|
||||
|
@ -666,7 +673,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
CString name = replaceVars(parms, NULL);
|
||||
CString value = replaceVars(p2, NULL);
|
||||
value.TrimRight();
|
||||
theApp.SetGlobal(name, value);
|
||||
SetGlobal(name, value);
|
||||
}
|
||||
}
|
||||
else if (strcmp(pcmd, "ShowDescription") == 0)
|
||||
|
@ -674,7 +681,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
if (curWidget)
|
||||
{
|
||||
int i = ((CCheckListBox*)curWidget->control)->GetCurSel();
|
||||
WIDGET *t = theApp.findWidget((char *)(LPCSTR) curWidget->target);
|
||||
WIDGET *t = findWidget((char *)(LPCSTR) curWidget->target);
|
||||
CString msg(i);
|
||||
((CEdit*)t->control)->SetWindowText(msg);
|
||||
}
|
||||
|
@ -694,7 +701,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
{
|
||||
if (p2)
|
||||
*p2++ = '\0';
|
||||
WIDGET *w = theApp.findWidget(parms);
|
||||
WIDGET *w = findWidget(parms);
|
||||
if (w)
|
||||
w->control->EnableWindow(newval);
|
||||
parms = p2;
|
||||
|
@ -718,7 +725,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
|
|||
{
|
||||
if (p2)
|
||||
*p2++ = '\0';
|
||||
WIDGET *w = theApp.findWidget(parms);
|
||||
WIDGET *w = findWidget(parms);
|
||||
if (w)
|
||||
w->control->EnableWindow(newval);
|
||||
parms = p2;
|
||||
|
|
|
@ -39,6 +39,7 @@ LLFLAGS = \
|
|||
$(LLFLAGS)
|
||||
|
||||
INCS = -I. \
|
||||
-I..\include \
|
||||
$(INCS)
|
||||
|
||||
|
||||
|
@ -62,6 +63,22 @@ OBJS = \
|
|||
.\$(OBJDIR)\wizshell.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS = $(LLIBS) \
|
||||
..\lib\globals.lib \
|
||||
$(NULL)
|
||||
|
||||
#
|
||||
# ----- Add your extension libraries here -----
|
||||
#
|
||||
!if "$(MAKEFLAGS)" == "install"
|
||||
LLIBS = $(LLIBS) \
|
||||
..\lib\ibengine.lib \
|
||||
$(NULL)
|
||||
!endif
|
||||
#
|
||||
# ---------------------------------------------
|
||||
#
|
||||
|
||||
#################################################################
|
||||
|
||||
MAKE_OBJ_TYPE = EXE
|
||||
|
@ -79,6 +96,9 @@ PROGRAM = .\$(OBJDIR)\$(EXENAME).EXE
|
|||
|
||||
!include "$(DEPTH)\config\rules.mak"
|
||||
|
||||
export::$(PROGRAM)
|
||||
$(MAKE_INSTALL) $(OBJDIR)\$(EXENAME).lib ..\lib
|
||||
|
||||
install::$(PROGRAM)
|
||||
$(MAKE_INSTALL) $(PROGRAM) ..\cckwiz
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "stdafx.h"
|
||||
#include "globals.h"
|
||||
#include "WizardMachine.h"
|
||||
#include "fstream.h"
|
||||
#include "direct.h"
|
||||
|
@ -24,10 +25,10 @@ void CreateRshell (void)
|
|||
// FILE* rshell = theApp.OpenAFile(CDdir +"rshell.ini", "w");
|
||||
|
||||
ofstream rshell(Rsh);
|
||||
CString fvalue1=theApp.GetGlobal("ShellTitleText");
|
||||
CString fvalue2=theApp.GetGlobal("ShellBgBitmap");
|
||||
CString fvalue1=GetGlobal("ShellTitleText");
|
||||
CString fvalue2=GetGlobal("ShellBgBitmap");
|
||||
// char *fvalue3=GetGlobal("dialog_title_text");
|
||||
CString fvalue4=theApp.GetGlobal("ShellInstallTextFile");
|
||||
CString fvalue4=GetGlobal("ShellInstallTextFile");
|
||||
char jsprefname[200];
|
||||
|
||||
if(!part1) {
|
||||
|
@ -56,4 +57,4 @@ void CreateRshell (void)
|
|||
}
|
||||
rshell.close();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче