diff --git a/mozilla/cck/driver/WizardMachine.cpp b/mozilla/cck/driver/WizardMachine.cpp index b170bbb869d..8d443b09b59 100644 --- a/mozilla/cck/driver/WizardMachine.cpp +++ b/mozilla/cck/driver/WizardMachine.cpp @@ -1405,126 +1405,6 @@ void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString } -void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CString parentDirPath) -{ - WIDGET* curWidget = targetWidget; - - CFileFind fileList; - BOOL dirFound = fileList.FindFile(parentDirPath); - - if(curWidget->type == "CheckListBox") - { - ((CCheckListBox*)curWidget->control)->ResetContent(); - } - - if(curWidget->type == "ListBox") - { - ((CListBox*)curWidget->control)->ResetContent(); - } - - if(curWidget->type == "ComboBox") - { - ((CComboBox*)curWidget->control)->ResetContent(); - } - - - while (dirFound) - { - dirFound = fileList.FindNextFile(); - - if (action == "GenerateFileList") - { - if (!fileList.IsDirectory()) // skip if this is a dir - { - CString tmpFile = fileList.GetFileName(); - if(curWidget->type == "CheckListBox") - { - ((CCheckListBox*)curWidget->control)->AddString(tmpFile); - } - - if(curWidget->type == "ListBox") - { - ((CListBox*)curWidget->control)->AddString(tmpFile); - } - - if(curWidget->type == "ComboBox") - { - ((CComboBox*)curWidget->control)->AddString(tmpFile); - } - } - } - - if (action == "GenerateDirList") - { - if (fileList.IsDirectory()) // skip if this is not a dir - { - CString tmpFile = fileList.GetFileName(); - if (!(tmpFile == "." || tmpFile == "..")) { - if(curWidget->type == "CheckListBox") - { - ((CCheckListBox*)curWidget->control)->AddString(tmpFile); - } - - if(curWidget->type == "ListBox") - { - ((CListBox*)curWidget->control)->AddString(tmpFile); - } - - if(curWidget->type == "ComboBox") - { - ((CComboBox*)curWidget->control)->AddString(tmpFile); - } - } - } - } - - } - - fileList.Close(); - - if(curWidget->type == "CheckListBox") - { - if (curWidget->value && curWidget->value != "") - { - char indices[MAX_SIZE]; - int i; - - strcpy(indices, curWidget->value); - char *s = strtok(indices, ","); - for (; s; s=strtok(NULL, ",")) - { - i = ((CCheckListBox*)curWidget->control)->FindString(0, s); - if (i != -1) - ((CCheckListBox*)curWidget->control)->SetCheck(i, 1); - } - ((CCheckListBox*)curWidget->control)->SetCurSel(0); - } - else - ((CCheckListBox*)curWidget->control)->SetCurSel(0); - } - if(curWidget->type == "ListBox") - { - if (curWidget->value && curWidget->value != "") - { - char indices[MAX_SIZE]; - - strcpy(indices, curWidget->value); - char *s = strtok(indices, ","); - for (; s; s=strtok(NULL, ",")) - ((CListBox*)curWidget->control)->SelectString(0, s); - } - else - ((CListBox*)curWidget->control)->SetCurSel(0); - } - else if(curWidget->type == "ComboBox") - { - if (curWidget->value && curWidget->value != "") - ((CComboBox*)curWidget->control)->SelectString(-1, curWidget->value); - else - ((CComboBox*)curWidget->control)->SetCurSel(0); - } -} - void CWizardMachineApp::HelpWiz() { CString helpvalue = (CurrentNode->localVars->wizbut->help); diff --git a/mozilla/cck/driver/WizardMachine.h b/mozilla/cck/driver/WizardMachine.h index 8b6db25290c..20412732371 100644 --- a/mozilla/cck/driver/WizardMachine.h +++ b/mozilla/cck/driver/WizardMachine.h @@ -73,7 +73,6 @@ public: CString GetGlobalOptions(CString theName); 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); void HelpWiz(); // Overrides // ClassWizard generated virtual function overrides diff --git a/mozilla/cck/driver/WizardUI.cpp b/mozilla/cck/driver/WizardUI.cpp index beda715ff66..97be4f3edb7 100644 --- a/mozilla/cck/driver/WizardUI.cpp +++ b/mozilla/cck/driver/WizardUI.cpp @@ -341,6 +341,8 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam) { nID = LOWORD(wParam); wNotifyCode = HIWORD(wParam); + WIDGET *w; + // Get screen values exchanged UpdateData(TRUE); @@ -364,8 +366,22 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam) else { if (curWidget->action.onCommand) + { + // Save any screen changes to affected widgets + w = findWidget(curWidget->target); + if (w) + w->value = GetScreenValue(w); + curWidget->value = GetScreenValue(curWidget); + + // Evaluate new state theInterpreter->interpret(curWidget->action.onCommand, curWidget); + // Reflect new state into screen + UpdateScreenWidget(curWidget); + if (w) + UpdateScreenWidget(w); + } + if (curWidget->numOfOptDesc > 0) SetDescription(curWidget); } @@ -395,62 +411,6 @@ int TabSort(const void *w1, const void *w2) void CWizardUI::SortWidgetsForTabOrder() { -#ifdef USEOLDSORTCODEINSTEADOFBUILTINFUNCTION - // Sort on y-coordinate - int x = 0; - int y = 0; - int count = CurrentNode->numWidgets; - for (x = count-1; x >= 0; x--) { - 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; - for (x = count-1; x >= 0; x--) { - 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; - } - } -#endif - qsort(CurrentNode->pageWidgets, CurrentNode->numWidgets, sizeof(WIDGET *), TabSort); CurrentNode->isWidgetsSorted = TRUE; } @@ -461,8 +421,8 @@ void CWizardUI::EnableWidget(WIDGET *curWidget) int enabled = TRUE; if (!curWidget->action.onInit.IsEmpty()) { - CString enableStr = theInterpreter->replaceVars(curWidget->action.onInit,NULL); // Cheat the interpret overhead since this is called a lot! + CString enableStr = theInterpreter->replaceVars(curWidget->action.onInit,NULL); if (enableStr == "Enable(0)") enabled = FALSE; else if (enableStr == "Enable2()") @@ -471,6 +431,93 @@ void CWizardUI::EnableWidget(WIDGET *curWidget) } } +void CWizardUI::UpdateScreenWidget(WIDGET *curWidget) +{ + int selRv = CB_ERR; + int selectedSomething = FALSE; + + if(curWidget->type == "CheckListBox") + { + int selected = ((CCheckListBox*)curWidget->control)->GetCurSel(); + if (selected == CB_ERR) + selected = 0; + + ((CCheckListBox*)curWidget->control)->ResetContent(); + + for (int i = 0; i < curWidget->numOfOptions; i++) + if (curWidget->options.value[i]) + ((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]); + + if (curWidget->value && curWidget->value != "") + { + char indices[MAX_SIZE]; + int i; + + strcpy(indices, curWidget->value); + char *s = strtok(indices, ","); + for (; s; s=strtok(NULL, ",")) + { + i = ((CCheckListBox*)curWidget->control)->FindString(0, s); + if (i != -1) + { + ((CCheckListBox*)curWidget->control)->SetCheck(i, 1); + } + } + } + + selRv = ((CCheckListBox*)curWidget->control)->SetCurSel(selected); + if (selRv == CB_ERR) + ((CCheckListBox*)curWidget->control)->SetCurSel(0); + + if (curWidget->numOfOptDesc > 0) + SetDescription(curWidget); + } + if(curWidget->type == "ListBox") + { + ((CListBox*)curWidget->control)->ResetContent(); + + for (int i = 0; i < curWidget->numOfOptions; i++) + if (curWidget->options.value[i]) + ((CListBox*)curWidget->control)->AddString(curWidget->options.value[i]); + + if (curWidget->value && curWidget->value != "") + { + char indices[MAX_SIZE]; + + strcpy(indices, curWidget->value); + char *s = strtok(indices, ","); + for (; s; s=strtok(NULL, ",")) + { + selRv = ((CListBox*)curWidget->control)->SelectString(0, s); + if (selRv != LB_ERR) + selectedSomething = TRUE; + } + } + if (!selectedSomething) + selRv = ((CListBox*)curWidget->control)->SetCurSel(0); + } + else if(curWidget->type == "ComboBox") + { + int selected = ((CComboBox*)curWidget->control)->GetCurSel(); + if (selected == CB_ERR) + selected = 0; + + ((CComboBox*)curWidget->control)->ResetContent(); + + for (int i = 0; i < curWidget->numOfOptions; i++) + if (curWidget->options.value[i]) + ((CComboBox*)curWidget->control)->AddString(curWidget->options.value[i]); + + if (curWidget->value && curWidget->value != "") + selRv = ((CComboBox*)curWidget->control)->SelectString(-1, curWidget->value); + + if (selRv == CB_ERR) + selRv = ((CComboBox*)curWidget->control)->SetCurSel(selected); + if (selRv == CB_ERR) + ((CComboBox*)curWidget->control)->SetCurSel(0); + } +} + void CWizardUI::CreateControls() { int rv; @@ -517,12 +564,10 @@ void CWizardUI::CreateControls() if (widgetType == "Text" || widgetType == "BoldText" || widgetType == "DynamicText") { curWidget->control = new CStatic; rv = ((CStatic*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID); - EnableWidget(curWidget); } else if (widgetType == "Navigation Text") { curWidget->control = new CNavText; rv = ((CNavText*)curWidget->control)->Create(curWidget->value, SS_LEFT, tmpRect, this, ID); - EnableWidget(curWidget); } else if (widgetType == "EditBox") { curWidget->control = new CEdit;//Added new style parameter ES_AUTOHSCROLL- to allow *GASP* SCROLLING!! @@ -545,14 +590,12 @@ void CWizardUI::CreateControls() //Set maximum number of characters allowed per line - limit set to 200 ((CEdit*)curWidget->control)->SetLimitText(int(curWidget->fieldlen.length)); ((CEdit*)curWidget->control)->SetWindowText(curWidget->value); - EnableWidget(curWidget); ((CEdit*)curWidget->control)->SetModify(FALSE); } } else if (widgetType == "Button") { curWidget->control = new CButton; rv = ((CButton*)curWidget->control)->Create(curWidget->value, BS_PUSHBUTTON | WS_TABSTOP, tmpRect, this, ID); - EnableWidget(curWidget); } else if (widgetType == "RadioButton") { curWidget->control = new CButton; @@ -624,53 +667,21 @@ void CWizardUI::CreateControls() else { ((CButton*)curWidget->control)->SetCheck(0); } - EnableWidget(curWidget); } else if (widgetType == "CheckBox") { curWidget->control = new CButton; rv = ((CButton*)curWidget->control)->Create(curWidget->title, BS_AUTOCHECKBOX | WS_TABSTOP, tmpRect, this, ID); ((CButton*)curWidget->control)->SetCheck(atoi(curWidget->value)); - EnableWidget(curWidget); } else if (widgetType == "ListBox") { curWidget->control = new CListBox; - rv = ((CListBox*)curWidget->control)->Create(LBS_STANDARD | LBS_MULTIPLESEL | WS_HSCROLL | WS_VSCROLL | WS_TABSTOP, tmpRect, this, ID); + rv = ((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.onInit == "GenerateFileList" || - curWidget->action.onInit == "GenerateDirList") - { - CString ext = theInterpreter->replaceVars(curWidget->action.parameters,NULL); - theApp.GenerateList(curWidget->action.onInit, curWidget, ext); - } - if (!curWidget->action.onInit.IsEmpty()) - theInterpreter->interpret(curWidget->action.onInit, curWidget); - 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, curWidget->value.GetLength()+1); - strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value); - - char *s = strtok(selectedItems, ","); - while (s) - { - ((CListBox*)curWidget->control)->SelectString(0, s); - s = strtok( NULL, "," ); - } - */ - //GlobalFree(selectedItems); - EnableWidget(curWidget); } else if (widgetType == "CheckListBox") { @@ -682,23 +693,19 @@ void CWizardUI::CreateControls() tmpRect, this, ID); ((CCheckListBox*)curWidget->control)->ModifyStyleEx(NULL, WS_EX_CLIENTEDGE, 0); - EnableWidget(curWidget); } else if (widgetType == "ComboBox") { curWidget->control = new CComboBox; rv = ((CComboBox*)curWidget->control)->Create(CBS_DROPDOWNLIST | WS_TABSTOP, tmpRect, this, ID); - EnableWidget(curWidget); } else if (widgetType == "GroupBox") { curWidget->control = new CButton; rv = ((CButton*)curWidget->control)->Create(curWidget->value, BS_GROUPBOX, tmpRect, this, ID); - EnableWidget(curWidget); } else if (widgetType == "ProgressBar") { curWidget->control = new CProgressCtrl; rv = ((CProgressCtrl*)curWidget->control)->Create(WS_TABSTOP, tmpRect, this, ID); - EnableWidget(curWidget); } @@ -709,11 +716,7 @@ void CWizardUI::CreateControls() } else - // Set the font of the widget and increment the dynamically assigned ID value - /* - if ((curWidget->description == "Navigation Status") - || (curWidget->description == "Current Page")) { - */ + // Set the font of the widget if (curWidget->type == "BoldText") { curWidget->control->SetFont(m_pNavFont); @@ -730,81 +733,15 @@ void CWizardUI::CreateControls() WIDGET* curWidget = CurrentNode->pageWidgets[x]; CString widgetType = curWidget->type; - if (widgetType == "ListBox") - { - if (!curWidget->action.onInit.IsEmpty()) - theInterpreter->interpret(curWidget->action.onInit, curWidget); - 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, curWidget->value.GetLength()+1); - strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value); + if (!curWidget->action.onInit.IsEmpty()) + theInterpreter->interpret(curWidget->action.onInit, curWidget); - char *s = strtok(selectedItems, ","); - while (s) - { - ((CListBox*)curWidget->control)->SelectString(0, s); - s = strtok( NULL, "," ); - } - } - else if (widgetType == "CheckListBox") - { - if (!curWidget->action.onInit.IsEmpty()) - theInterpreter->interpret(curWidget->action.onInit, curWidget); - for (int i = 0; i < curWidget->numOfOptions; i++) - { - if (curWidget->options.value[i]) - { - ((CCheckListBox*)curWidget->control)->AddString(curWidget->options.value[i]); - } - } - - char* selectedItems; - selectedItems = (char *) GlobalAlloc(0, curWidget->value.GetLength()+1); - strcpy(selectedItems, (char *) (LPCTSTR) curWidget->value); - - int idx; - BOOL selected = FALSE; - char *s = strtok(selectedItems, ","); - while (s) - { - if (!selected) - { - selected = TRUE; - ((CCheckListBox*)curWidget->control)->SelectString(0, s); - } - idx = ((CCheckListBox*)curWidget->control)->FindString(0, s); - if (idx != -1) - ((CCheckListBox*)curWidget->control)->SetCheck(idx, 1); - s = strtok( NULL, "," ); - } - if (curWidget->numOfOptDesc > 0) - SetDescription(curWidget); - } - else if (widgetType == "ComboBox") { - if (!curWidget->action.onInit.IsEmpty()) - theInterpreter->interpret(curWidget->action.onInit, curWidget); - else - { - for (int i = 0; i < curWidget->numOfOptions; i++) - { - if (curWidget->options.value[i]) - { - ((CComboBox*)curWidget->control)->AddString(curWidget->options.value[i]); - } - } - } - } + UpdateScreenWidget(curWidget); } + + // Handle enablement AFTER all initializations completed... + for (x = 0; x < m_pControlCount; x++) + EnableWidget(CurrentNode->pageWidgets[x]); } void CWizardUI::DisplayControls() @@ -946,21 +883,31 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget) { LPINT choices; - int count; - count = (((CListBox *)curWidget->control))->GetSelCount(); - choices = (int *) GlobalAlloc(0, count * sizeof(LPINT)); - ((CListBox *)curWidget->control)->GetSelItems(count, choices); - - rv = ""; - CString temp; - for (int i=0; i < count; i++) + if (FALSE /* MULTIPLESEL something or other */ ) { - ((CListBox *)curWidget->control)->GetText(choices[i], temp); - rv = rv + temp; - if ( i+1 < count) - rv += ","; + int count; + count = (((CListBox *)curWidget->control))->GetSelCount(); + choices = (int *) GlobalAlloc(0, count * sizeof(LPINT)); + ((CListBox *)curWidget->control)->GetSelItems(count, choices); + + 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 += ","; + } + } + else + { + int selected = ((CListBox *)curWidget->control)->GetCurSel(); + if (selected == LB_ERR) + rv = ""; + else + ((CListBox *)curWidget->control)->GetText(selected, rv); } - //GlobalFree(choices); } else if (widgetType == "CheckListBox") { diff --git a/mozilla/cck/driver/WizardUI.h b/mozilla/cck/driver/WizardUI.h index f2b894f8037..06151786562 100644 --- a/mozilla/cck/driver/WizardUI.h +++ b/mozilla/cck/driver/WizardUI.h @@ -82,6 +82,7 @@ public: BOOL SetDescription(WIDGET *w); void SortWidgetsForTabOrder(); void EnableWidget(WIDGET *curWidget); + void UpdateScreenWidget(WIDGET *curWidget); void CreateControls(); void DisplayControls(); void UpdateGlobals(); diff --git a/mozilla/cck/driver/interpret.cpp b/mozilla/cck/driver/interpret.cpp index 1d53ae80220..0bf9a4419c5 100644 --- a/mozilla/cck/driver/interpret.cpp +++ b/mozilla/cck/driver/interpret.cpp @@ -330,6 +330,33 @@ BOOL CInterpret::OpenBrowser(const char *url) return retflag; } + +void CInterpret::GenerateList(CString action, WIDGET* curWidget, CString parentDirPath) +{ + CFileFind fileList; + BOOL dirFound = fileList.FindFile(parentDirPath); + CString tmpFile; + int i = 0; + + while (dirFound) + { + dirFound = fileList.FindNextFile(); + tmpFile = fileList.GetFileName(); + + if (action == "GenerateFileList" && !fileList.IsDirectory() || + action == "GenerateDirList" && fileList.IsDirectory() && + !(tmpFile == "." || tmpFile == "..")) + { + curWidget->options.value[i] = new char[tmpFile.GetLength()+1]; + strcpy(curWidget->options.value[i], (char *)(LPCTSTR) tmpFile); + i++; + } + } + curWidget->numOfOptions = i; + + fileList.Close(); +} + CString CInterpret::replaceVars(CString str, char *listval) { char *theStr = (char *) (LPCTSTR) str; @@ -752,7 +779,8 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) } // Delete the global var now... } - else if (strcmp(pcmd, "GenerateFileList") == 0 || strcmp(pcmd, "GenerateDirList") == 0) + else if (strcmp(pcmd, "GenerateFileList") == 0 || + strcmp(pcmd, "GenerateDirList") == 0) { char *p2 = strchr(parms, ','); @@ -769,7 +797,7 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) if (w) { CString p2path = replaceVars(p2,NULL); - theApp.GenerateList(pcmd, w, p2path); + GenerateList(pcmd, w, p2path); } } else if (strcmp(pcmd, "BrowseFile") == 0) diff --git a/mozilla/cck/driver/interpret.h b/mozilla/cck/driver/interpret.h index c04c393f109..979a0ab3963 100644 --- a/mozilla/cck/driver/interpret.h +++ b/mozilla/cck/driver/interpret.h @@ -40,6 +40,7 @@ public: BOOL NewConfig(WIDGET *curWidget, CString globalsName, CString DialogTitle); BOOL BrowseFile(WIDGET *curWidget); CString BrowseDir(WIDGET *curWidget); + void GenerateList(CString action, WIDGET* curWidget, CString ext); BOOL Progress(); // Not actually used right now BOOL IterateListBox(char *parms); CString replaceVars(CString str, char *listval); diff --git a/mozilla/cck/ib/comp.cpp b/mozilla/cck/ib/comp.cpp index 9289b9adcb9..77d35f7da4c 100644 --- a/mozilla/cck/ib/comp.cpp +++ b/mozilla/cck/ib/comp.cpp @@ -1,80 +1,107 @@ #include "stdafx.h" -/* -#include -#include -*/ #include "globals.h" #include "ib.h" +#include "comp.h" #define MAX_SIZE 1024 +extern CString rootPath; +extern CString configName; +extern CString configPath; +extern CString workspacePath; +extern CString cdPath; +extern CString tempPath; +extern CString iniPath; +extern CString scriptPath; +extern CString nscpxpiPath; + +extern COMPONENT SelectedComponents[100]; +extern int numComponents; + extern "C" __declspec(dllexport) -int GenerateComponentList(CString parms, WIDGET *curWidget) +int BuildComponentList(COMPONENT *comps, int *compNum) { - CString rootPath = GetGlobal("Root"); - CString configName = GetGlobal("CustomizationList"); - CString configPath = rootPath + "Configs\\" + configName; - CString workspacePath = configPath + "\\Workspace"; - CString nscpxpiPath; - if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL)) - nscpxpiPath = workspacePath + "\\NSCPXPI"; - else - nscpxpiPath = rootPath + "NSCPXPI"; - CString iniPath = nscpxpiPath + "\\config.ini"; + *compNum = 0; // Get all the component info from each component section - int i=0; - int optNum = 0; CString component; char archive[MAX_SIZE]; char name[MAX_SIZE]; char desc[MAX_SIZE]; char attr[MAX_SIZE]; - CString WidgetValue(""); - component.Format("Component%d", i); + component.Format("Component%d", *compNum); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniPath); while (*archive) { - // Organize all the data into the checklistbox widget data sections - // - be sure to look at selected and visible attributes - GetPrivateProfileString(component, "Description Short", "", name, MAX_SIZE, iniPath); - GetPrivateProfileString(component, "Description Long", "", desc, MAX_SIZE, iniPath); - GetPrivateProfileString(component, "Attributes", "", attr, MAX_SIZE, iniPath); + GetPrivateProfileString(component, "Description Short", "", + name, MAX_SIZE, iniPath); + GetPrivateProfileString(component, "Description Long", "", + desc, MAX_SIZE, iniPath); + GetPrivateProfileString(component, "Attributes", "", + attr, MAX_SIZE, iniPath); - curWidget->options.name[optNum] = new char[strlen(component)+1]; - strcpy(curWidget->options.name[optNum], component); + comps[*compNum].compname = component; + comps[*compNum].name = CString(name); + comps[*compNum].desc = CString(desc); + comps[*compNum].selected = (strstr(attr, "SELECTED") != NULL); + comps[*compNum].invisible = (strstr(attr, "INVISIBLE") != NULL); + comps[*compNum].launchapp = (strstr(attr, "LAUNCHAPP") != NULL); - curWidget->options.value[optNum] = new char[strlen(name)+1]; - strcpy(curWidget->options.value[optNum], name); - - curWidget->optDesc.name[optNum] = new char[strlen(component)+1]; - strcpy(curWidget->optDesc.name[optNum], component); - - curWidget->optDesc.value[optNum] = new char[strlen(desc)+1]; - strcpy(curWidget->optDesc.value[optNum], desc); - - // INVISIBLE just means not selected, let user decide whether to - // include them again. SELECTED components get checkmarks. - if (strstr(attr, "SELECTED")) - { - WidgetValue += ","; - WidgetValue += name; - } - - optNum++; - - component.Format("Component%d", ++i); + (*compNum)++; + component.Format("Component%d", *compNum); GetPrivateProfileString(component, "Archive", "", archive, MAX_SIZE, iniPath); } - curWidget->numOfOptions = optNum; - curWidget->numOfOptDesc = optNum; - - if (curWidget->value.IsEmpty()) - curWidget->value = WidgetValue; - - // Force it to redraw somehow??? return TRUE; } +extern "C" __declspec(dllexport) +int GenerateComponentList(CString parms, WIDGET *curWidget) +{ + rootPath = GetGlobal("Root"); + configName = GetGlobal("CustomizationList"); + configPath = rootPath + "Configs\\" + configName; + workspacePath = configPath + "\\Workspace"; + nscpxpiPath; + if (SearchPath(workspacePath, "NSCPXPI", NULL, 0, NULL, NULL)) + nscpxpiPath = workspacePath + "\\NSCPXPI"; + else + nscpxpiPath = rootPath + "NSCPXPI"; + iniPath = nscpxpiPath + "\\config.ini"; + + BuildComponentList(SelectedComponents, &numComponents); + + int i; + CString WidgetValue(""); + for (i=0; ioptions.name[i] = new char[strlen(SelectedComponents[i].compname)+1]; + strcpy(curWidget->options.name[i], SelectedComponents[i].compname); + + curWidget->options.value[i] = new char[strlen(SelectedComponents[i].name)+1]; + strcpy(curWidget->options.value[i], SelectedComponents[i].name); + + curWidget->optDesc.name[i] = new char[strlen(SelectedComponents[i].compname)+1]; + strcpy(curWidget->optDesc.name[i], SelectedComponents[i].compname); + + curWidget->optDesc.value[i] = new char[strlen(SelectedComponents[i].desc)+1]; + strcpy(curWidget->optDesc.value[i], SelectedComponents[i].desc); + + // INVISIBLE just means not selected, let user decide whether to + // include them again. SELECTED components get checkmarks. + if (SelectedComponents[i].selected) + { + WidgetValue += ","; + WidgetValue += SelectedComponents[i].name; + } + } + + curWidget->numOfOptions = numComponents; + curWidget->numOfOptDesc = numComponents; + + if (curWidget->value.IsEmpty()) + curWidget->value = WidgetValue; + + return TRUE; +} diff --git a/mozilla/cck/ib/ib.cpp b/mozilla/cck/ib/ib.cpp index 57aa684304a..58e4dee0dc3 100644 --- a/mozilla/cck/ib/ib.cpp +++ b/mozilla/cck/ib/ib.cpp @@ -2,7 +2,7 @@ #include #include #include "globals.h" -#include "ifuncns.h" +#include "comp.h" #include "ib.h" #define MAX_SIZE 1024 @@ -23,6 +23,9 @@ char buffer[50000]; XPI xpiList[100]; int xpiLen = -1; +COMPONENT SelectedComponents[100]; +int numComponents; + int findXPI(CString xpiname, CString filename) { int found = FALSE; @@ -252,6 +255,20 @@ int interpret(char *cmd) return TRUE; } + +void init_components() +{ + int i; + WIDGET *w = findWidget("SelectedComponents"); + BuildComponentList(SelectedComponents, &numComponents); + + // Turn off components that aren't selected + for (i=0; ivalue) == NULL) + SelectedComponents[i].selected = FALSE; + +} + extern "C" __declspec(dllexport) int StartIB(CString parms, WIDGET *curWidget) { @@ -272,6 +289,8 @@ int StartIB(CString parms, WIDGET *curWidget) else nscpxpiPath = rootPath + "NSCPXPI"; + init_components(); + _mkdir((char *)(LPCTSTR) cdPath); _mkdir((char *)(LPCTSTR) tempPath); _mkdir((char *)(LPCTSTR) workspacePath); diff --git a/mozilla/cck/ib/makefile.win b/mozilla/cck/ib/makefile.win index bf8393973ca..13359120630 100644 --- a/mozilla/cck/ib/makefile.win +++ b/mozilla/cck/ib/makefile.win @@ -34,10 +34,11 @@ OBJS= \ .\$(OBJDIR)\comp.obj \ $(NULL) +# -I$(DEPTH)\xpinstall\wizard\windows\setup \ + LINCS= $(LINCS) \ -I..\include \ -I$(DIST)\$(OBJDIR)\include \ - -I$(DEPTH)\xpinstall\wizard\windows\setup \ $(NULL) MAKE_OBJ_TYPE = DLL