зеркало из https://github.com/mozilla/pjs.git
CheckListBox supports descriptions (bug #4884)
This commit is contained in:
Родитель
4f0537b0f7
Коммит
07fe097926
|
@ -88,8 +88,12 @@ Width=119
|
|||
|
||||
Height=76
|
||||
|
||||
target=CheckListDescription
|
||||
|
||||
subsection=Options for CheckListBox11
|
||||
|
||||
OptionDescriptions=Option Descriptions for CheckListBox11
|
||||
|
||||
[Options for CheckListBox11]
|
||||
|
||||
opt1=Address Book sync tool
|
||||
|
@ -110,6 +114,25 @@ opt8=Internet Setup
|
|||
|
||||
opt9=RealPlayer 5.0
|
||||
|
||||
[Option Descriptions for CheckListBox11]
|
||||
|
||||
opt1=Description of the Address Book sync tool
|
||||
|
||||
opt2=Description of the AIM
|
||||
|
||||
opt3=Description of the Audio/Video Playback
|
||||
|
||||
opt4=Description of the Beatnik Stub Plug-in
|
||||
|
||||
opt5=Description of the Calendar
|
||||
|
||||
opt6=Description of the CalendarLink sync tool
|
||||
|
||||
opt7=Description of the Import Utility
|
||||
|
||||
opt8=Description of the Internet Setup
|
||||
|
||||
opt9=Description of the RealPlayer 5.0
|
||||
|
||||
[Widget 2]
|
||||
|
||||
|
@ -476,6 +499,22 @@ Width=118
|
|||
Height=40
|
||||
|
||||
|
||||
[Widget 1307]
|
||||
|
||||
Type=Text
|
||||
|
||||
Name=CheckListDescription
|
||||
|
||||
Value=
|
||||
|
||||
Start_x=14
|
||||
|
||||
Start_y=184
|
||||
|
||||
Width=110
|
||||
|
||||
Height=29
|
||||
|
||||
|
||||
[Widget 18]
|
||||
|
||||
|
|
|
@ -1370,46 +1370,72 @@ void CWizardMachineApp::BuildWidget(WIDGET* aWidget, CString iniSection, CString
|
|||
// As the number of entries in the subsection are not known, a generic loop
|
||||
// has been created to read all existing name/value pairs in the subsection
|
||||
// and store them in the options component of the control.
|
||||
int counter = 0;
|
||||
GetPrivateProfileString(iniSection, "subsection", "", buffer, MAX_SIZE, iniFile);
|
||||
if (strcmp(buffer, "") != 0) {
|
||||
char* subSection;
|
||||
subSection = new char[sizeof(buffer)];
|
||||
strcpy(subSection, buffer);
|
||||
|
||||
/* Don't tie options to functions...
|
||||
if (aWidget->action.function == "")
|
||||
int i = 0;
|
||||
char* ComponentKey;
|
||||
char ComponentKeyBuffer[MAX_SIZE];
|
||||
if (GetPrivateProfileString(subSection, NULL, "", buffer, MAX_SIZE, iniFile) > 0)
|
||||
{
|
||||
*/
|
||||
int counter = 0;
|
||||
int i = 0;
|
||||
char* ComponentKey;
|
||||
char ComponentKeyBuffer[MAX_SIZE];
|
||||
if (GetPrivateProfileString(subSection, NULL, "", buffer, MAX_SIZE, iniFile) > 0)
|
||||
while (counter < 25 && buffer[i] != 0)
|
||||
{
|
||||
while (buffer[i] != 0)
|
||||
ComponentKey = &buffer[i];
|
||||
if (GetPrivateProfileString(subSection, ComponentKey, "", ComponentKeyBuffer, MAX_SIZE, iniFile) > 0)
|
||||
{
|
||||
ComponentKey = &buffer[i];
|
||||
if (GetPrivateProfileString(subSection, ComponentKey, "", ComponentKeyBuffer, MAX_SIZE, iniFile) > 0)
|
||||
{
|
||||
aWidget->options.name[counter] = new char[sizeof(ComponentKey)];
|
||||
strcpy(aWidget->options.name[counter],ComponentKey);
|
||||
aWidget->options.value[counter] = new char[sizeof(ComponentKeyBuffer)];
|
||||
strcpy(aWidget->options.value[counter],ComponentKeyBuffer);
|
||||
counter++;
|
||||
}
|
||||
while (buffer[i] != 0)
|
||||
i++;
|
||||
i++;
|
||||
aWidget->options.name[counter] = new char[sizeof(ComponentKey)];
|
||||
strcpy(aWidget->options.name[counter],ComponentKey);
|
||||
aWidget->options.value[counter] = new char[sizeof(ComponentKeyBuffer)];
|
||||
strcpy(aWidget->options.value[counter],ComponentKeyBuffer);
|
||||
counter++;
|
||||
}
|
||||
while (buffer[i] != 0)
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
aWidget->numOfOptions = counter;
|
||||
/*
|
||||
}
|
||||
else {
|
||||
aWidget->numOfOptions = 0;
|
||||
}
|
||||
*/
|
||||
delete subSection;
|
||||
}
|
||||
aWidget->numOfOptions = counter;
|
||||
|
||||
// As the number of entries in the subsection are not known, a generic loop
|
||||
// has been created to read all existing name/value pairs in the subsection
|
||||
// and store them in the options component of the control.
|
||||
counter = 0;
|
||||
GetPrivateProfileString(iniSection, "OptionDescriptions", "", buffer, MAX_SIZE, iniFile);
|
||||
if (strcmp(buffer, "") != 0) {
|
||||
char* subSection;
|
||||
subSection = new char[sizeof(buffer)];
|
||||
strcpy(subSection, buffer);
|
||||
|
||||
int i = 0;
|
||||
char* ComponentKey;
|
||||
char ComponentKeyBuffer[MAX_SIZE];
|
||||
if (GetPrivateProfileString(subSection, NULL, "", buffer, MAX_SIZE, iniFile) > 0)
|
||||
{
|
||||
while (counter < 25 && buffer[i] != 0)
|
||||
{
|
||||
ComponentKey = &buffer[i];
|
||||
if (GetPrivateProfileString(subSection, ComponentKey, "", ComponentKeyBuffer, MAX_SIZE, iniFile) > 0)
|
||||
{
|
||||
aWidget->optDesc.name[counter] = new char[sizeof(ComponentKey)];
|
||||
strcpy(aWidget->optDesc.name[counter],ComponentKey);
|
||||
aWidget->optDesc.value[counter] = new char[sizeof(ComponentKeyBuffer)];
|
||||
strcpy(aWidget->optDesc.value[counter],ComponentKeyBuffer);
|
||||
counter++;
|
||||
}
|
||||
while (buffer[i] != 0)
|
||||
i++;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
delete subSection;
|
||||
}
|
||||
aWidget->numOfOptDesc = counter;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1589,11 +1615,17 @@ void CWizardMachineApp::GenerateList(CString action, WIDGET* targetWidget, CStri
|
|||
if (curWidget->value && curWidget->value != "")
|
||||
{
|
||||
char indices[MAX_SIZE];
|
||||
int i;
|
||||
|
||||
strcpy(indices, curWidget->value);
|
||||
char *s = strtok(indices, ",");
|
||||
for (; s; s=strtok(NULL, ","))
|
||||
((CCheckListBox*)curWidget->control)->SelectString(0, s);
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -58,6 +58,8 @@ typedef struct WIDGET
|
|||
ACTIONSET action;
|
||||
int numOfOptions;
|
||||
OPTIONS options;
|
||||
int numOfOptDesc;
|
||||
OPTIONS optDesc;
|
||||
CString items;
|
||||
BOOL cached;
|
||||
UINT widgetID;
|
||||
|
|
|
@ -304,6 +304,28 @@ BOOL CWizardUI::SortList(WIDGET *curWidget)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CWizardUI::SetDescription(WIDGET *w)
|
||||
{
|
||||
WIDGET *t = theApp.findWidget((char *) (LPCTSTR) w->target);
|
||||
if (!t || (t->type != "Text" && t->type != "BoldText"))
|
||||
return FALSE;
|
||||
|
||||
int selected = 0;
|
||||
if (w->type == "ListBox")
|
||||
selected = ((CListBox *)w->control)->GetCurSel();
|
||||
else if (w->type == "CheckListBox")
|
||||
selected = ((CCheckListBox *)w->control)->GetCurSel();
|
||||
else if (w->type == "ComboBox")
|
||||
selected = ((CComboBox *)w->control)->GetCurSel();
|
||||
|
||||
if (selected == -1 || selected >= w->numOfOptDesc)
|
||||
return FALSE;
|
||||
|
||||
((CEdit *)t->control)->SetWindowText(w->optDesc.value[selected]);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UINT nID = LOWORD(wParam);
|
||||
|
@ -320,6 +342,9 @@ BOOL CWizardUI::OnCommand(WPARAM wParam, LPARAM lParam)
|
|||
if (curWidget->action.onCommand)
|
||||
theInterpreter->interpret(curWidget->action.onCommand, curWidget);
|
||||
|
||||
if (curWidget->numOfOptDesc > 0)
|
||||
SetDescription(curWidget);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -589,7 +614,6 @@ void CWizardUI::CreateControls()
|
|||
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
|
||||
|
@ -613,6 +637,7 @@ void CWizardUI::CreateControls()
|
|||
((CListBox*)curWidget->control)->SelectString(0, s);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
*/
|
||||
//GlobalFree(selectedItems);
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
|
@ -632,7 +657,6 @@ void CWizardUI::CreateControls()
|
|||
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
|
||||
|
@ -659,7 +683,10 @@ void CWizardUI::CreateControls()
|
|||
((CCheckListBox*)curWidget->control)->SetCheck(i, 1);
|
||||
s = strtok( NULL, "," );
|
||||
}
|
||||
if (curWidget->numOfOptDesc > 0)
|
||||
SetDescription(curWidget);
|
||||
//GlobalFree(selectedItems);
|
||||
*/
|
||||
EnableWidget(curWidget);
|
||||
}
|
||||
else if (widgetType == "ComboBox") {
|
||||
|
@ -673,7 +700,6 @@ void CWizardUI::CreateControls()
|
|||
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
|
||||
|
@ -686,6 +712,7 @@ void CWizardUI::CreateControls()
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
EnableWidget(curWidget);
|
||||
|
||||
//((CComboBox*)curWidget->control)->SelectString(0, selectedCustomization);
|
||||
|
@ -723,6 +750,91 @@ void CWizardUI::CreateControls()
|
|||
curWidget->control->SetFont(m_pFont);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle initializations AFTER all controls created...
|
||||
for (x = 0; x < m_pControlCount; x++)
|
||||
{
|
||||
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);
|
||||
|
||||
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);
|
||||
else
|
||||
{
|
||||
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 i;
|
||||
BOOL selected = FALSE;
|
||||
char *s = strtok(selectedItems, ",");
|
||||
while (s)
|
||||
{
|
||||
if (!selected)
|
||||
{
|
||||
selected = TRUE;
|
||||
((CCheckListBox*)curWidget->control)->SelectString(0, s);
|
||||
}
|
||||
i = ((CCheckListBox*)curWidget->control)->FindString(0, s);
|
||||
if (i != -1)
|
||||
((CCheckListBox*)curWidget->control)->SetCheck(i, 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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CWizardUI::DisplayControls()
|
||||
|
|
|
@ -75,6 +75,7 @@ public:
|
|||
int m_pControlID;
|
||||
BOOL containsImage;
|
||||
|
||||
BOOL SetDescription(WIDGET *w);
|
||||
void SortWidgetsForTabOrder();
|
||||
void EnableWidget(WIDGET *curWidget);
|
||||
void CreateControls();
|
||||
|
|
Загрузка…
Ссылка в новой задаче