Fixes to make enable/disable work in checklist.ini

This commit is contained in:
selmer%netscape.com 1999-10-19 02:41:48 +00:00
Родитель 884a207b92
Коммит 8d1afc2f92
5 изменённых файлов: 49 добавлений и 12 удалений

Просмотреть файл

@ -125,7 +125,9 @@ Width=106
Height=67
onInit=GenerateFileList(self,Root%\NCIFiles\*.NCI)
onInit=GenerateFileList(self,%Root%NCIFiles\*.NCI)
onCommand=toggleEnabled2(%NCIFileList%,EditNCIButton,DeleteNCIButton)
@ -234,7 +236,7 @@ Width=51
Height=14
onCommand=NewNCIDialog(_NewNCIFileName);command(cmd.exe /c copy %Root%\NCItemplate "%Root%\NCIFiles\%_NewNCIFileName%");command(%NCIFileEditor% "%Root%\NCIFiles\%_NewNCIFileName%");inform(_NewNCIFileName,%Root%\NCIFiles);GenerateFileList(NCIFileList,%Root%\NCIFiles\*.NCI)
onCommand=NewNCIDialog(_NewNCIFileName);command(cmd.exe /c copy %Root%NCItemplate "%Root%NCIFiles\%_NewNCIFileName%");command(%NCIFileEditor% "%Root%NCIFiles\%_NewNCIFileName%");inform(_NewNCIFileName,%Root%NCIFiles);GenerateFileList(NCIFileList,%Root%NCIFiles\*.NCI)
Target=NCIFileList
@ -256,7 +258,8 @@ Width=51
Height=14
onCommand=IterateListBox(NCIFileList,SHOW,%NCIFileEditor% "%Root%\NCIFiles\%%")
onInit=Enable2(%NCIFileList%)
onCommand=IterateListBox(NCIFileList,SHOW,%NCIFileEditor% "%Root%NCIFiles\%%")
Target=NCIFileList
@ -278,7 +281,8 @@ Width=51
Height=14
onCommand=IterateListBox(NCIFileList,HIDE,cmd.exe /c del "%Root%\NCIFiles\%%");GenerateFileList(NCIFileList,%Root%\NCIFiles\*.NCI)
onInit=Enable2(%NCIFileList%)
onCommand=IterateListBox(NCIFileList,HIDE,cmd.exe /c del "%Root%NCIFiles\%%");GenerateFileList(NCIFileList,%Root%NCIFiles\*.NCI)
Target=NCIFileList

Просмотреть файл

@ -75,7 +75,8 @@ Start_y=220
Width=185
Height=99
subsection=Options for ComboBox1
onInit=GenerateDirList(self,%Root%\Configs\*.*)
onInit=GenerateDirList(self,%Root%Configs\*.*)
onCommand=toggleEnabled2(%CustomizationList%,Button8)
[Options for ComboBox1]
@ -206,7 +207,8 @@ Start_x=300
Start_y=218
Width=77
Height=17
onCommand=VerifySet(%CustomizationList%,Choose an existing configuration or create a new one);SetGlobal(_FromConfigName,%CustomizationList%);NewConfigDialog(_NewConfigName);CopyDir(%Root%\Configs\%_FromConfigName%,%Root%\Configs\%_NewConfigName%);Reload(%Root%\Configs\%_NewConfigName%)
onInit=Enable2(%CustomizationList%)
onCommand=VerifySet(%CustomizationList%,Choose an existing configuration or create a new one);SetGlobal(_FromConfigName,%CustomizationList%);NewConfigDialog(_NewConfigName);CopyDir(%Root%Configs\%_FromConfigName%,%Root%Configs\%_NewConfigName%);Reload(%Root%Configs\%_NewConfigName%)
; GenerateFileList not required due to the way NewConfigDialog works,
; but this should be changed at some point...

Просмотреть файл

@ -60,7 +60,7 @@ typedef struct WIDGET
OPTIONS options;
CString items;
BOOL cached;
int widgetID;
UINT widgetID;
CWnd *control;
}WIDGET;

Просмотреть файл

@ -341,7 +341,7 @@ BOOL CWizardUI::NewConfig(WIDGET *curWidget, CString globalsName)
theApp.GenerateList(tmpFunction, tmpWidget, params);
*/
if (tmpWidget->action.onInit)
theInterpreter->interpret(tmpWidget->action.onInit, curWidget);
theInterpreter->interpret(tmpWidget->action.onInit, tmpWidget);
((CComboBox*)tmpWidget->control)->SelectString(0, configField);
@ -467,13 +467,15 @@ BOOL CWizardUI::Progress()
BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
{
UINT nID = LOWORD(wParam);
// Get screen values exchanged
UpdateData(TRUE);
for(int i=0; i < CurrentNode->numWidgets; i++)
{
WIDGET* curWidget = CurrentNode->pageWidgets[i];
if (curWidget->widgetID != (int)wParam)
if (curWidget->widgetID != nID)
continue;
if (curWidget->action.onCommand)
@ -575,6 +577,8 @@ void CWizardUI::EnableWidget(WIDGET *curWidget)
// Cheat the interpret overhead since this is called a lot!
if (enableStr == "Enable(0)")
enabled = FALSE;
else if (enableStr == "Enable2()")
enabled = FALSE;
curWidget->control->EnableWindow(enabled);
}
}
@ -616,7 +620,7 @@ void CWizardUI::CreateControls()
int s_y = curWidget->location.y;
int s_width = curWidget->size.width;
int s_height = curWidget->size.height;
int ID = curWidget->widgetID;
UINT ID = curWidget->widgetID;
CRect tmpRect = CRect(s_x, s_y, (s_x + s_width), (s_y + s_height));
@ -923,7 +927,10 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
CString widgetType = curWidget->type;
CString rv("");
if (widgetType == "CheckBox") {
if (!curWidget->control)
rv = curWidget->value; // !!! Fix this so we're not copying strings all the time
// Should be able to just pass in an "assign" boolean
else if (widgetType == "CheckBox") {
// Mask off everything but the checked/not checked state
// Ignore indeterminate state
int state = ((CButton*)curWidget->control)->GetState() & 0x0003;
@ -940,7 +947,7 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget)
{
// Mask off everything but the checked/not checked state
// Ignore indeterminate state
int state = ((CButton*)curWidget->control)->GetState();
int state = ((CButton*)curWidget->control)->GetState() & 0x0003;
if (state == 2)
state = 0;

Просмотреть файл

@ -545,6 +545,30 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget)
}
}
}
else if (strcmp(pcmd, "toggleEnabled2") == 0)
{
// convert first parm into boolean...
char *p2 = strchr(parms, ',');
if (p2)
{
*p2++ = '\0';
CString value = replaceVars(parms, NULL);
BOOL newval = (!value.IsEmpty());
parms = p2;
p2 = strchr(parms, ',');
while (parms)
{
if (p2)
*p2++ = '\0';
WIDGET *w = theApp.findWidget(parms);
if (w)
w->control->EnableWindow(newval);
parms = p2;
if (parms)
p2 = strchr(parms, ',');
}
}
}
}
// This is an extra free...
//free(pcmd);