diff --git a/mozilla/cck/driver/StdAfx.h b/mozilla/cck/driver/StdAfx.h index 12f69127c68..9576ba560b3 100644 --- a/mozilla/cck/driver/StdAfx.h +++ b/mozilla/cck/driver/StdAfx.h @@ -7,6 +7,7 @@ #include // MFC core and standard components #include // MFC extensions +#include // MFC support for Internet Explorer 4 Common Controls #ifndef _AFX_NO_AFXCMN_SUPPORT #include // MFC support for Windows Common Controls #endif // _AFX_NO_AFXCMN_SUPPORT diff --git a/mozilla/cck/driver/WizardMachine.aps b/mozilla/cck/driver/WizardMachine.aps index 98cd61d4caa..1f93fbe1ff1 100644 Binary files a/mozilla/cck/driver/WizardMachine.aps and b/mozilla/cck/driver/WizardMachine.aps differ diff --git a/mozilla/cck/driver/WizardMachine.cpp b/mozilla/cck/driver/WizardMachine.cpp index e8dffd9888d..39dd98d0596 100644 --- a/mozilla/cck/driver/WizardMachine.cpp +++ b/mozilla/cck/driver/WizardMachine.cpp @@ -115,6 +115,8 @@ BOOL CWizardMachineApp::InitInstance() // of your final executable, you should remove from the following // the specific initialization routines you do not need. + CoInitialize(NULL); + #ifdef _AFXDLL Enable3dControls(); // Call this when using MFC in a shared DLL #else @@ -1462,3 +1464,10 @@ void CWizardMachineApp::HelpWiz() hlpdlg.DoModal(); } } + +int CWizardMachineApp::ExitInstance() +{ + CoUninitialize(); + + return CWinApp::ExitInstance(); +} diff --git a/mozilla/cck/driver/WizardMachine.h b/mozilla/cck/driver/WizardMachine.h index d0a115ff66e..f9a2e508ed6 100644 --- a/mozilla/cck/driver/WizardMachine.h +++ b/mozilla/cck/driver/WizardMachine.h @@ -78,6 +78,7 @@ public: //{{AFX_VIRTUAL(CWizardMachineApp) public: virtual BOOL InitInstance(); + virtual int ExitInstance(); //}}AFX_VIRTUAL // Implementation diff --git a/mozilla/cck/driver/WizardMachine.ncb b/mozilla/cck/driver/WizardMachine.ncb index 07364eb3cf9..708d044083c 100644 Binary files a/mozilla/cck/driver/WizardMachine.ncb and b/mozilla/cck/driver/WizardMachine.ncb differ diff --git a/mozilla/cck/driver/WizardMachine.rc b/mozilla/cck/driver/WizardMachine.rc index 1909792f57c..093bb280a67 100644 --- a/mozilla/cck/driver/WizardMachine.rc +++ b/mozilla/cck/driver/WizardMachine.rc @@ -1,443 +1,571 @@ -//Microsoft Developer Studio generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "#define _AFX_NO_SPLITTER_RESOURCES\r\n" - "#define _AFX_NO_OLE_RESOURCES\r\n" - "#define _AFX_NO_TRACKER_RESOURCES\r\n" - "#define _AFX_NO_PROPERTY_RESOURCES\r\n" - "\r\n" - "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" - "#ifdef _WIN32\r\n" - "LANGUAGE 9, 1\r\n" - "#pragma code_page(1252)\r\n" - "#endif\r\n" - "#include ""res\\WizardMachine.rc2"" // non-Microsoft Visual C++ edited resources\r\n" - "#include ""afxres.rc"" // Standard components\r\n" - "#endif\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDR_MAINFRAME ICON DISCARDABLE "res\\WizardMachine.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "About WizardMachine" -FONT 8, "MS Sans Serif" -BEGIN - ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 - LTEXT "WizardMachine Version 1.0",IDC_STATIC,40,10,119,8, - SS_NOPREFIX - LTEXT "Copyright © 1998",IDC_STATIC,40,25,119,8 - DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP -END - -IDD_WIZARDMACHINE_DIALOG DIALOGEX 0, 0, 366, 252 -STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU -EXSTYLE WS_EX_APPWINDOW -CAPTION "WizardMachine" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - DEFPUSHBUTTON "Start",IDOK,90,107,50,14 - PUSHBUTTON "Exit",IDCANCEL,209,107,50,14 - LTEXT "This is going to provide a checklist in future.", - IDC_STATIC,112,45,138,8 - LTEXT "Demo Version",IDC_STATIC,159,68,44,8 -END - -IDD_BASE_DIALOG DIALOG DISCARDABLE 0, 0, 407, 245 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -FONT 8, "MS Sans Serif" -BEGIN -END - -1536 DIALOG DISCARDABLE 0, 0, 181, 132 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Directory" -FONT 8, "Helv" -BEGIN - LISTBOX 1120,5,32,104,68,LBS_SORT | LBS_OWNERDRAWFIXED | - LBS_HASSTRINGS | LBS_DISABLENOSCROLL | NOT WS_VISIBLE | - WS_VSCROLL | WS_TABSTOP - LTEXT "&Directories:",-1,6,6,104,9 - LTEXT "",1088,5,20,105,9,SS_NOPREFIX - LTEXT "Dri&ves:",1091,6,102,104,9 - COMBOBOX 1137,6,113,104,68,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | - CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | - WS_VSCROLL | WS_TABSTOP - DEFPUSHBUTTON "OK",IDOK,123,7,50,14,WS_GROUP - PUSHBUTTON "Cancel",IDCANCEL,123,25,50,14,WS_GROUP -END - -IDD_IMAGE_DIALOG DIALOG DISCARDABLE 0, 0, 336, 271 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Close",IDCANCEL,279,250,50,14 - PUSHBUTTON "Help",IDC_BUTTON1,209,250,50,14 -END - -IDD_NEWCONFIG_DIALOG DIALOG DISCARDABLE 0, 0, 266, 119 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Create New Configuration" -FONT 8, "MS Sans Serif" -BEGIN - EDITTEXT IDC_EDIT1,7,20,218,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "Create New Configuration",IDOK,109,98,94,14 - PUSHBUTTON "Cancel",IDCANCEL,209,98,50,14 - LTEXT "Name of new configuration:",IDC_STATIC,7,7,173,13 - LTEXT "The CCK tool creates a new configuration directory in C:\\CCK\\Configs. Within your new configuration directory, the CCK tool creates a \\Workspace directory, for example, C:\\CCK\\Configs\\CustomBuild01\\Workspace.", - IDC_STATIC1,7,39,253,26 - LTEXT "You can use the Workspace directory as a convenient place in which to store your custom files.", - IDC_STATIC2,7,69,248,17 -END - -IDD_DIALOG112 DIALOG DISCARDABLE 0, 0, 187, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Create a copy" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "Create",IDOK,130,74,50,14 - PUSHBUTTON "Cancel",IDCANCEL,78,74,50,14 - LTEXT "Name of copied configuration:",IDC_STATIC,7,7,173,13 - EDITTEXT IDC_EDIT1,7,20,152,13,ES_AUTOHSCROLL - LTEXT "The CCK wizard creates a new directory in which to store the copied configuration.", - IDC_STATIC,7,38,155,17 -END - -IDD_PROGRESS_DLG DIALOG DISCARDABLE 0, 0, 301, 58 -STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION -CAPTION "Creating Installation" -FONT 8, "MS Sans Serif" -BEGIN - CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER, - 20,30,261,10 - CTEXT "",IDC_PROGESSTEXT_STATIC,84,15,138,11 -END - -IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - DEFPUSHBUTTON "OK",IDOK,129,7,50,14 - PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 -END - -IDD_CREATE_DIALOG DIALOG DISCARDABLE 0, 0, 187, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "New Config Dialog" -FONT 8, "MS Sans Serif" -BEGIN -END - -IDD_NEW_DIALOG DIALOG DISCARDABLE 0, 0, 187, 95 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Create NCI File" -FONT 8, "MS Sans Serif" -BEGIN - EDITTEXT IDC_EDIT1,7,20,152,13,ES_AUTOHSCROLL - DEFPUSHBUTTON "Create",IDOK,77,74,50,14 - PUSHBUTTON "Cancel",IDCANCEL,130,74,50,14 - LTEXT "Please provide a name for the NCI file:",IDC_TITLE_TEXT, - 7,7,173,13 - LTEXT "Please note that the file name must end with .nci", - IDC_BASE_TEXT,7,39,173,17 -END - -IDD_IMG_DLG DIALOG DISCARDABLE 0, 0, 336, 271 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif" -BEGIN - PUSHBUTTON "Close",IDCANCEL,279,250,50,14 -END - -IDD_HELP_DLG DIALOGEX 0, 0, 336, 271 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - PUSHBUTTON "Close",IDCANCEL,279,250,50,14 - EDITTEXT IDC_EDIT1,15,14,296,202,ES_MULTILINE | ES_READONLY | - WS_VSCROLL,WS_EX_DLGMODALFRAME -END - -IDD_SUMMARY DIALOGEX 0, 0, 336, 271 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Show Configuration Information." -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - PUSHBUTTON "Close",IDCANCEL,279,250,50,14 - EDITTEXT IDC_EDIT1,20,16,300,225,ES_MULTILINE | ES_READONLY | - WS_VSCROLL | WS_HSCROLL,WS_EX_DLGMODALFRAME -END - -IDD_WIZ_HELP DIALOGEX 0, 0, 336, 271 -STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU -CAPTION "Dialog" -FONT 8, "MS Sans Serif", 0, 0, 0x1 -BEGIN - PUSHBUTTON "Close",IDCANCEL,279,250,50,14 - EDITTEXT ID_HELP_EDIT,18,16,287,125,ES_MULTILINE | ES_AUTOVSCROLL | - ES_READONLY | WS_VSCROLL,WS_EX_DLGMODALFRAME -END - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 6,2,0,0 - PRODUCTVERSION 6,2,0,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "CompanyName", "Netscape Communications Corporation\0" - VALUE "FileDescription", "CCK WIZARDMACHINE Application\0" - VALUE "FileVersion", "6.2.0.0\0" - VALUE "InternalName", "WIZARDMACHINE\0" - VALUE "LegalCopyright", "Copyright (c) Netscape Communications, 2001\0" - VALUE "LegalTrademarks", "Netscape, Mozilla\0" - VALUE "OriginalFilename", "WIZARDMACHINE.EXE\0" - VALUE "ProductName", "NETSCAPE CCK\0" - VALUE "ProductVersion", "6.2\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // !_MAC - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO DISCARDABLE -BEGIN - IDD_ABOUTBOX, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 210 - TOPMARGIN, 7 - BOTTOMMARGIN, 48 - END - - IDD_WIZARDMACHINE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 359 - TOPMARGIN, 7 - BOTTOMMARGIN, 245 - END - - IDD_BASE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 400 - TOPMARGIN, 7 - BOTTOMMARGIN, 238 - END - - IDD_IMAGE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 329 - TOPMARGIN, 7 - BOTTOMMARGIN, 264 - END - - IDD_NEWCONFIG_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 259 - TOPMARGIN, 7 - BOTTOMMARGIN, 112 - END - - IDD_DIALOG112, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 180 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END - - IDD_PROGRESS_DLG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 294 - TOPMARGIN, 7 - BOTTOMMARGIN, 50 - END - - IDD_DIALOG1, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 179 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END - - IDD_CREATE_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 180 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END - - IDD_NEW_DIALOG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 180 - TOPMARGIN, 7 - BOTTOMMARGIN, 88 - END - - IDD_IMG_DLG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 329 - TOPMARGIN, 7 - BOTTOMMARGIN, 264 - END - - IDD_HELP_DLG, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 329 - TOPMARGIN, 7 - BOTTOMMARGIN, 264 - END - - IDD_SUMMARY, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 329 - TOPMARGIN, 7 - BOTTOMMARGIN, 264 - END - - IDD_WIZ_HELP, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 329 - TOPMARGIN, 7 - BOTTOMMARGIN, 264 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// String Table -// - -STRINGTABLE DISCARDABLE -BEGIN - IDS_ABOUTBOX "&About WizardMachine..." - IDS_STRING102 "WizardMachine" - IDS_STRING103 "New Config Dialog" -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// -#define _AFX_NO_SPLITTER_RESOURCES -#define _AFX_NO_OLE_RESOURCES -#define _AFX_NO_TRACKER_RESOURCES -#define _AFX_NO_PROPERTY_RESOURCES - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE 9, 1 -#pragma code_page(1252) -#endif -#include "res\WizardMachine.rc2" // non-Microsoft Visual C++ edited resources -#include "afxres.rc" // Standard components -#endif -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - +//Microsoft Developer Studio generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE DISCARDABLE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE DISCARDABLE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE DISCARDABLE +BEGIN + "#define _AFX_NO_SPLITTER_RESOURCES\r\n" + "#define _AFX_NO_OLE_RESOURCES\r\n" + "#define _AFX_NO_TRACKER_RESOURCES\r\n" + "#define _AFX_NO_PROPERTY_RESOURCES\r\n" + "\r\n" + "#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r\n" + "#ifdef _WIN32\r\n" + "LANGUAGE 9, 1\r\n" + "#pragma code_page(1252)\r\n" + "#endif\r\n" + "#include ""res\\WizardMachine.rc2"" // non-Microsoft Visual C++ edited resources\r\n" + "#include ""afxres.rc"" // Standard components\r\n" + "#endif\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDR_MAINFRAME ICON DISCARDABLE "res\\WizardMachine.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOG DISCARDABLE 0, 0, 217, 55 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "About WizardMachine" +FONT 8, "MS Sans Serif" +BEGIN + ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20 + LTEXT "WizardMachine Version 1.0",IDC_STATIC,40,10,119,8, + SS_NOPREFIX + LTEXT "Copyright © 1998",IDC_STATIC,40,25,119,8 + DEFPUSHBUTTON "OK",IDOK,178,7,32,14,WS_GROUP +END + +IDD_WIZARDMACHINE_DIALOG DIALOGEX 0, 0, 366, 252 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION "WizardMachine" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "Start",IDOK,90,107,50,14 + PUSHBUTTON "Exit",IDCANCEL,209,107,50,14 + LTEXT "This is going to provide a checklist in future.", + IDC_STATIC,112,45,138,8 + LTEXT "Demo Version",IDC_STATIC,159,68,44,8 +END + +IDD_BASE_DIALOG DIALOG DISCARDABLE 0, 0, 407, 245 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Sans Serif" +BEGIN +END + +1536 DIALOG DISCARDABLE 0, 0, 181, 132 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Directory" +FONT 8, "Helv" +BEGIN + LISTBOX 1120,5,32,104,68,LBS_SORT | LBS_OWNERDRAWFIXED | + LBS_HASSTRINGS | LBS_DISABLENOSCROLL | NOT WS_VISIBLE | + WS_VSCROLL | WS_TABSTOP + LTEXT "&Directories:",-1,6,6,104,9 + LTEXT "",1088,5,20,105,9,SS_NOPREFIX + LTEXT "Dri&ves:",1091,6,102,104,9 + COMBOBOX 1137,6,113,104,68,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | + CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | + WS_VSCROLL | WS_TABSTOP + DEFPUSHBUTTON "OK",IDOK,123,7,50,14,WS_GROUP + PUSHBUTTON "Cancel",IDCANCEL,123,25,50,14,WS_GROUP +END + +IDD_IMAGE_DIALOG DIALOG DISCARDABLE 0, 0, 336, 271 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Close",IDCANCEL,279,250,50,14 + PUSHBUTTON "Help",IDC_BUTTON1,209,250,50,14 +END + +IDD_NEWCONFIG_DIALOG DIALOG DISCARDABLE 0, 0, 266, 119 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Create New Configuration" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT1,7,20,218,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "Create New Configuration",IDOK,109,98,94,14 + PUSHBUTTON "Cancel",IDCANCEL,209,98,50,14 + LTEXT "Name of new configuration:",IDC_STATIC,7,7,173,13 + LTEXT "The CCK tool creates a new configuration directory in C:\\CCK\\Configs. Within your new configuration directory, the CCK tool creates a \\Workspace directory, for example, C:\\CCK\\Configs\\CustomBuild01\\Workspace.", + IDC_STATIC1,7,39,253,26 + LTEXT "You can use the Workspace directory as a convenient place in which to store your custom files.", + IDC_STATIC2,7,69,248,17 +END + +IDD_DIALOG112 DIALOG DISCARDABLE 0, 0, 187, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Create a copy" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "Create",IDOK,130,74,50,14 + PUSHBUTTON "Cancel",IDCANCEL,78,74,50,14 + LTEXT "Name of copied configuration:",IDC_STATIC,7,7,173,13 + EDITTEXT IDC_EDIT1,7,20,152,13,ES_AUTOHSCROLL + LTEXT "The CCK wizard creates a new directory in which to store the copied configuration.", + IDC_STATIC,7,38,155,17 +END + +IDD_PROGRESS_DLG DIALOG DISCARDABLE 0, 0, 301, 58 +STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Creating Installation" +FONT 8, "MS Sans Serif" +BEGIN + CONTROL "Progress1",IDC_PROGRESS1,"msctls_progress32",WS_BORDER, + 20,30,261,10 + CTEXT "",IDC_PROGESSTEXT_STATIC,84,15,138,11 +END + +IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,129,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,129,24,50,14 +END + +IDD_CREATE_DIALOG DIALOG DISCARDABLE 0, 0, 187, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "New Config Dialog" +FONT 8, "MS Sans Serif" +BEGIN +END + +IDD_NEW_DIALOG DIALOG DISCARDABLE 0, 0, 187, 95 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Create NCI File" +FONT 8, "MS Sans Serif" +BEGIN + EDITTEXT IDC_EDIT1,7,20,152,13,ES_AUTOHSCROLL + DEFPUSHBUTTON "Create",IDOK,77,74,50,14 + PUSHBUTTON "Cancel",IDCANCEL,130,74,50,14 + LTEXT "Please provide a name for the NCI file:",IDC_TITLE_TEXT, + 7,7,173,13 + LTEXT "Please note that the file name must end with .nci", + IDC_BASE_TEXT,7,39,173,17 +END + +IDD_IMG_DLG DIALOG DISCARDABLE 0, 0, 336, 271 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif" +BEGIN + PUSHBUTTON "Close",IDCANCEL,279,250,50,14 +END + +IDD_HELP_DLG DIALOGEX 0, 0, 336, 271 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "Close",IDCANCEL,279,250,50,14 + EDITTEXT IDC_EDIT1,15,14,296,202,ES_MULTILINE | ES_READONLY | + WS_VSCROLL,WS_EX_DLGMODALFRAME +END + +IDD_SUMMARY DIALOGEX 0, 0, 336, 271 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Show Configuration Information." +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "Close",IDCANCEL,279,250,50,14 + EDITTEXT IDC_EDIT1,20,16,300,225,ES_MULTILINE | ES_READONLY | + WS_VSCROLL | WS_HSCROLL,WS_EX_DLGMODALFRAME +END + +IDD_WIZ_HELP DIALOGEX 0, 0, 336, 271 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Dialog" +FONT 8, "MS Sans Serif", 0, 0, 0x1 +BEGIN + PUSHBUTTON "Close",IDCANCEL,279,250,50,14 + EDITTEXT ID_HELP_EDIT,18,16,287,125,ES_MULTILINE | ES_AUTOVSCROLL | + ES_READONLY | WS_VSCROLL,WS_EX_DLGMODALFRAME +END + +IDD_EDITPREF DIALOG DISCARDABLE 0, 0, 294, 206 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Pref Properties" +FONT 8, "MS Sans Serif" +BEGIN + RTEXT "Pref Name:",IDC_STATIC,15,18,68,8 + LTEXT "",IDC_PREFNAME,93,18,184,8 + RTEXT "Description:",IDC_STATIC,15,33,68,8 + LTEXT "",IDC_DESCRIPTION,93,33,184,45 + RTEXT "Pref Value:",IDC_STATIC,15,103,68,8 + CONTROL "",IDC_VALCHECK,"Button",BS_AUTOCHECKBOX | NOT + WS_VISIBLE | WS_TABSTOP,93,103,184,10 + EDITTEXT IDC_VALUE,93,100,184,14,ES_AUTOHSCROLL + COMBOBOX IDC_VALLIST,93,100,184,67,CBS_DROPDOWNLIST | CBS_SORT | + NOT WS_VISIBLE | WS_VSCROLL | WS_TABSTOP + RTEXT "Pref Lock:",IDC_STATIC,15,120,68,8 + CONTROL "Locked from user changes",IDC_LOCKED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,93,120,184,10 + RTEXT "Pref File:",IDC_STATIC,15,138,68,8 + EDITTEXT IDC_PREFFILE,93,135,184,14,ES_AUTOHSCROLL + RTEXT "Installation Archive:",IDC_STATIC,15,156,68,8 + EDITTEXT IDC_INSTALLFILE,93,153,184,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,88,185,50,14 + PUSHBUTTON "Cancel",IDCANCEL,154,185,50,14 + GROUPBOX "About",IDC_STATIC,7,7,280,74 + GROUPBOX "Properties",IDC_STATIC,7,86,280,91 +END + +IDD_ADDPREF DIALOG DISCARDABLE 0, 0, 294, 165 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Add Pref" +FONT 8, "MS Sans Serif" +BEGIN + GROUPBOX "About",IDC_STATIC,7,10,280,126 + RTEXT "Pref Name:",IDC_STATIC,15,26,68,8 + EDITTEXT IDC_PREFNAME,93,22,184,14,ES_AUTOHSCROLL + RTEXT "Description:",IDC_STATIC,15,43,68,8 + EDITTEXT IDC_PREFDESC,93,41,184,33,ES_AUTOHSCROLL + RTEXT "Pref Type:",IDC_STATIC,15,86,68,8 + GROUPBOX "",IDC_PREFTYPEGROUP,94,79,183,47 + CONTROL "String",IDC_PREFTYPE_STRING,"Button",BS_AUTORADIOBUTTON | + WS_GROUP | WS_TABSTOP,99,88,34,10 + CONTROL "Int",IDC_PREFTYPE_INT,"Button",BS_AUTORADIOBUTTON,99,99, + 24,10 + CONTROL "Bool",IDC_PREFTYPE_BOOL,"Button",BS_AUTORADIOBUTTON,99, + 110,30,10 + DEFPUSHBUTTON "OK",IDOK,91,144,50,14 + PUSHBUTTON "Cancel",IDCANCEL,152,144,50,14 +END + +IDD_FIND DIALOG DISCARDABLE 0, 0, 268, 47 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Find" +FONT 8, "MS Sans Serif" +BEGIN + LTEXT "Fi&nd what:",IDC_STATIC,7,19,34,8 + EDITTEXT IDC_FIND,51,16,142,14,ES_AUTOHSCROLL + DEFPUSHBUTTON "OK",IDOK,211,7,50,14 + PUSHBUTTON "Cancel",IDCANCEL,211,24,50,14 +END + + +#ifndef _MAC +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 6,2,0,0 + PRODUCTVERSION 6,2,0,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "CompanyName", "Netscape Communications Corporation\0" + VALUE "FileDescription", "CCK WIZARDMACHINE Application\0" + VALUE "FileVersion", "6.2.0.0\0" + VALUE "InternalName", "WIZARDMACHINE\0" + VALUE "LegalCopyright", "Copyright (c) Netscape Communications, 2001\0" + VALUE "LegalTrademarks", "Netscape, Mozilla\0" + VALUE "OriginalFilename", "WIZARDMACHINE.EXE\0" + VALUE "ProductName", "NETSCAPE CCK\0" + VALUE "ProductVersion", "6.2\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // !_MAC + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO DISCARDABLE +BEGIN + IDD_ABOUTBOX, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 210 + TOPMARGIN, 7 + BOTTOMMARGIN, 48 + END + + IDD_WIZARDMACHINE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 359 + TOPMARGIN, 7 + BOTTOMMARGIN, 245 + END + + IDD_BASE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 400 + TOPMARGIN, 7 + BOTTOMMARGIN, 238 + END + + IDD_IMAGE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 329 + TOPMARGIN, 7 + BOTTOMMARGIN, 264 + END + + IDD_NEWCONFIG_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 259 + TOPMARGIN, 7 + BOTTOMMARGIN, 112 + END + + IDD_DIALOG112, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_PROGRESS_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 294 + TOPMARGIN, 7 + BOTTOMMARGIN, 50 + END + + IDD_DIALOG1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_CREATE_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_NEW_DIALOG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 180 + TOPMARGIN, 7 + BOTTOMMARGIN, 88 + END + + IDD_IMG_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 329 + TOPMARGIN, 7 + BOTTOMMARGIN, 264 + END + + IDD_HELP_DLG, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 329 + TOPMARGIN, 7 + BOTTOMMARGIN, 264 + END + + IDD_SUMMARY, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 329 + TOPMARGIN, 7 + BOTTOMMARGIN, 264 + END + + IDD_WIZ_HELP, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 329 + TOPMARGIN, 7 + BOTTOMMARGIN, 264 + END + + IDD_EDITPREF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 287 + TOPMARGIN, 7 + BOTTOMMARGIN, 199 + END + + IDD_ADDPREF, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 287 + TOPMARGIN, 5 + BOTTOMMARGIN, 158 + END + + IDD_FIND, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 261 + TOPMARGIN, 7 + BOTTOMMARGIN, 40 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Bitmap +// + +IDB_TREEIMAGES BITMAP DISCARDABLE "res\\bitmap1.bmp" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDR_POPUP_PREFTREE_MENU MENU DISCARDABLE +BEGIN + POPUP "PrefsTreeItemSubMenu" + BEGIN + MENUITEM "&Edit Pref", ID_EDITPREFITEM + MENUITEM "&Add Pref", ID_ADDPREF + MENUITEM SEPARATOR + MENUITEM "&Find Pref\tCtrl+F", ID_FINDPREF + MENUITEM "Find &Next\tF3", ID_FINDNEXTPREF + END + POPUP "PrefsTreeGroupSubMenu" + BEGIN + MENUITEM "&Add Pref", ID_ADDPREF + MENUITEM SEPARATOR + MENUITEM "&Find Pref\tCtrl+F", ID_FINDPREF + MENUITEM "Find &Next Pref\tF3", ID_FINDNEXTPREF + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDR_ACCELERATOR1 ACCELERATORS DISCARDABLE +BEGIN + VK_F3, ID_FINDNEXTPREF, VIRTKEY, NOINVERT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE DISCARDABLE +BEGIN + IDS_ABOUTBOX "&About WizardMachine..." + IDS_STRING102 "WizardMachine" + IDS_STRING103 "New Config Dialog" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#define _AFX_NO_SPLITTER_RESOURCES +#define _AFX_NO_OLE_RESOURCES +#define _AFX_NO_TRACKER_RESOURCES +#define _AFX_NO_PROPERTY_RESOURCES + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE 9, 1 +#pragma code_page(1252) +#endif +#include "res\WizardMachine.rc2" // non-Microsoft Visual C++ edited resources +#include "afxres.rc" // Standard components +#endif +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/mozilla/cck/driver/WizardUI.cpp b/mozilla/cck/driver/WizardUI.cpp index 8332d5088e6..8747adbd695 100644 --- a/mozilla/cck/driver/WizardUI.cpp +++ b/mozilla/cck/driver/WizardUI.cpp @@ -38,6 +38,7 @@ #include "PropSheet.h" #include "WizardUI.h" #include "Interpret.h" +#include "PrefEditView.h" #include #include @@ -438,6 +439,7 @@ void CWizardUI::EnableWidget(WIDGET *curWidget) } } +// Copy values from the widget object to the Windows control UI element. void CWizardUI::UpdateScreenWidget(WIDGET *curWidget) { int selRv = CB_ERR; @@ -566,6 +568,11 @@ void CWizardUI::UpdateScreenWidget(WIDGET *curWidget) if (selRv == CB_ERR) selRv = ((CComboBox*)curWidget->control)->SetCurSel(0); } + + else if(curWidget->type == "PrefsTree") + { + } + } void CWizardUI::CreateControls() @@ -778,8 +785,66 @@ void CWizardUI::CreateControls() else if (widgetType == "ProgressBar") { curWidget->control = new CProgressCtrl; rv = ((CProgressCtrl*)curWidget->control)->Create(WS_TABSTOP, tmpRect, this, ID); - } + } + else if (widgetType == "PrefsTree") { + /* + A PrefsTree is a tree control for editing prefs. The ini file section should look like: + [Widget 1] + Type=PrefsTree + Name=PrefsTreeName + Attrib=MetaPrefs.xml + etc... + + where... + Attrib is the xml file which describes the tree control layout. It should + not specifiy a path. If the file doesn't exist in the config directory, + the default in the app Root directory is used. Then it is saved in the + config directory with any modified pref values and used next time. + See PrefsTree.html for prefs file format details. + + You can also create buttons to act on the prefs tree. For example, the + following button open the selected pref for editing, or expands the + group if a group is selected instead of a pref. + + [Widget 4203] + Type=Button + Name=Button4203 + Value=Open + onCommand=OpenPrefTreeItem(PrefsTreeName) + ... + + The other commands are: + FindPrefTreeItem(PrefsTreeName) to open the search dialog + FindNextPrefTreeItem(PrefsTreeName) to find the next matching item + AddPrefTreeItem(PrefsTreeName) to open the add pref dialog + + + PrefsTree is a little different from other widgets, in that it's not derived from a control--it's a CView. + Also, it doesn't have a ->value like some widgets do. So be careful. + + */ + + // If the .XML file exists in the config directory, use it. Otherwise, use the + // default file found at the Root. + CString rootPath = GetGlobal("Root"); + CString configName = GetGlobal("CustomizationList"); + CString localPrefsFile = rootPath + "Configs\\" + configName + "\\" + curWidget->attrib; + CString prefsFile; + if (theApp.FileExists(localPrefsFile)) + prefsFile = localPrefsFile; + else + prefsFile = rootPath + curWidget->attrib; + + curWidget->control = new CPrefEditView(prefsFile); + + // Configure the PrefsTree with any existing globals + //((CPrefEditView*)curWidget->control)->SetPrefValues(curWidget->value); + + rv = ((CPrefEditView*)curWidget->control)->Create(NULL, NULL, WS_BORDER, tmpRect, this, ID); + + + } if (!rv) { @@ -855,15 +920,18 @@ void CWizardUI::DestroyCurrentScreenWidgets() { curWidget = CurrentNode->pageWidgets[i]; - if (curWidget->control) + if (curWidget->control) { BOOL retFalg = curWidget->control->DestroyWindow(); - delete curWidget->control; + if (curWidget->type != "PrefsTree") // PrefsTree is a CView, not a control, and is destroyed automatically above + delete curWidget->control; curWidget->control = NULL; } } } + +// Copies values from the Windows controls to the widgets objects. CString CWizardUI::GetScreenValue(WIDGET *curWidget) { // @@ -1076,6 +1144,12 @@ CString CWizardUI::GetScreenValue(WIDGET *curWidget) } */ + + else if (widgetType == "PrefsTree") + { + //rv = ((CPrefEditView*)curWidget->control)->GetModifiedPrefs(); + } + 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 @@ -1095,6 +1169,17 @@ void CWizardUI::UpdateGlobals() { curWidget = CurrentNode->pageWidgets[i]; curWidget->value = GetScreenValue(curWidget); + + // Save the prefs tree in a file local to the config. This is + // what gets read next time the prefs tree control is created. + if (curWidget->type == "PrefsTree") + { + CString rootPath = GetGlobal("Root"); + CString configName = GetGlobal("CustomizationList"); + CString localPrefsFile = rootPath + "Configs\\" + configName + "\\" + curWidget->attrib; + + ((CPrefEditView*)curWidget->control)->DoSavePrefsTree(localPrefsFile); + } } IsNewValue = TRUE; } diff --git a/mozilla/cck/driver/dlgadd.cpp b/mozilla/cck/driver/dlgadd.cpp new file mode 100644 index 00000000000..8ad7a947967 --- /dev/null +++ b/mozilla/cck/driver/dlgadd.cpp @@ -0,0 +1,46 @@ +// DlgAdd.cpp : implementation file +// + +#include "stdafx.h" +#include "DlgAdd.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDlgAdd dialog + + +CDlgAdd::CDlgAdd(CWnd* pParent /*=NULL*/) + : CDialog(CDlgAdd::IDD, pParent) +{ + //{{AFX_DATA_INIT(CDlgAdd) + m_strPrefDesc = _T(""); + m_strPrefName = _T(""); + m_intPrefType = 0; + //}}AFX_DATA_INIT +} + + +void CDlgAdd::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDlgAdd) + DDX_Text(pDX, IDC_PREFDESC, m_strPrefDesc); + DDX_Text(pDX, IDC_PREFNAME, m_strPrefName); + DDX_Radio(pDX, IDC_PREFTYPE_STRING, m_intPrefType); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDlgAdd, CDialog) + //{{AFX_MSG_MAP(CDlgAdd) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDlgAdd message handlers diff --git a/mozilla/cck/driver/dlgadd.h b/mozilla/cck/driver/dlgadd.h new file mode 100644 index 00000000000..7151c2f18ed --- /dev/null +++ b/mozilla/cck/driver/dlgadd.h @@ -0,0 +1,50 @@ +#if !defined(AFX_DLGADD_H__55B7BFE0_C8B7_43FA_AFD2_BCB1AA18E820__INCLUDED_) +#define AFX_DLGADD_H__55B7BFE0_C8B7_43FA_AFD2_BCB1AA18E820__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// DlgAdd.h : header file +// + +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CDlgAdd dialog + +class CDlgAdd : public CDialog +{ +// Construction +public: + CDlgAdd(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDlgAdd) + enum { IDD = IDD_ADDPREF }; + CString m_strPrefDesc; + CString m_strPrefName; + int m_intPrefType; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDlgAdd) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDlgAdd) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DLGADD_H__55B7BFE0_C8B7_43FA_AFD2_BCB1AA18E820__INCLUDED_) diff --git a/mozilla/cck/driver/dlgeditprefstr.cpp b/mozilla/cck/driver/dlgeditprefstr.cpp new file mode 100644 index 00000000000..37d753b731b --- /dev/null +++ b/mozilla/cck/driver/dlgeditprefstr.cpp @@ -0,0 +1,152 @@ +// DlgEditPrefStr.cpp : implementation file +// + +#include "stdafx.h" +#include "DlgEditPrefStr.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDlgEditPrefStr dialog + + +CDlgEditPrefStr::CDlgEditPrefStr(CWnd* pParent /*=NULL*/) + : CDialog(CDlgEditPrefStr::IDD, pParent), m_bChoose(FALSE) +{ + //{{AFX_DATA_INIT(CDlgEditPrefStr) + m_strDescription = _T(""); + m_strPrefName = _T(""); + m_strValue = _T(""); + m_bLocked = FALSE; + m_bValue = FALSE; + m_strInstallFile = _T(""); + m_strPrefFile = _T(""); + //}}AFX_DATA_INIT +} + + +void CDlgEditPrefStr::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDlgEditPrefStr) + DDX_Control(pDX, IDC_VALLIST, m_listValue); + DDX_Control(pDX, IDC_VALCHECK, m_checkValue); + DDX_Control(pDX, IDC_VALUE, m_editValue); + DDX_Text(pDX, IDC_DESCRIPTION, m_strDescription); + DDX_Text(pDX, IDC_PREFNAME, m_strPrefName); + DDX_Text(pDX, IDC_VALUE, m_strValue); + DDX_Check(pDX, IDC_LOCKED, m_bLocked); + DDX_Check(pDX, IDC_VALCHECK, m_bValue); + DDX_Text(pDX, IDC_INSTALLFILE, m_strInstallFile); + DDX_Text(pDX, IDC_PREFFILE, m_strPrefFile); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDlgEditPrefStr, CDialog) + //{{AFX_MSG_MAP(CDlgEditPrefStr) + ON_WM_CREATE() + ON_WM_CANCELMODE() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDlgEditPrefStr message handlers + +int CDlgEditPrefStr::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + if (CDialog::OnCreate(lpCreateStruct) == -1) + return -1; + + SetWindowText(m_strTitle); + + + + return 0; +} + + +BOOL CDlgEditPrefStr::PreCreateWindow(CREATESTRUCT& cs) +{ + BOOL retval = CDialog::PreCreateWindow(cs); + + // TODO: Add your specialized code here and/or call the base class + + + return retval; +} + +BOOL CDlgEditPrefStr::OnInitDialog() +{ + CDialog::OnInitDialog(); + + if (m_bChoose) + { + m_editValue.ShowWindow(SW_HIDE); + m_listValue.ShowWindow(SW_SHOW); + m_checkValue.ShowWindow(SW_HIDE); + + // The list of choices comes in as an array of CStrings, + // terminated with an empty one. + CString *pstrChoice = m_pstrChoices; + while(pstrChoice->GetLength() > 0) + { + m_listValue.AddString(*pstrChoice); + pstrChoice++; + } + + m_listValue.SelectString(0, m_strSelectedChoice); + } + + else if (m_strType.CompareNoCase("bool") == 0) + { + m_editValue.ShowWindow(SW_HIDE); + m_listValue.ShowWindow(SW_HIDE); + m_checkValue.ShowWindow(SW_SHOW); + m_checkValue.SetWindowText(m_strTitle); + + if (m_strValue.CompareNoCase("true") == 0) + m_checkValue.SetCheck(TRUE); + } + + else // string or int type + { + m_editValue.ShowWindow(SW_SHOW); + m_listValue.ShowWindow(SW_HIDE); + m_checkValue.ShowWindow(SW_HIDE); + } + + return TRUE; // return TRUE unless you set the focus to a control + // EXCEPTION: OCX Property Pages should return FALSE +} + +// Caller only has to get value from m_strValue for all types. +void CDlgEditPrefStr::OnOK() +{ + // For bool types, convert back to the data string. + if (m_strType.CompareNoCase("bool") == 0) + { + if (m_checkValue.GetCheck()) + m_editValue.SetWindowText("true"); + else + m_editValue.SetWindowText("false"); + } + // For choose, return the selected list string. + else if (m_bChoose) + { + CString strSelectString; + m_listValue.GetLBText(m_listValue.GetCurSel(), strSelectString); + m_editValue.SetWindowText(strSelectString); + } + + else // string, int type + { + + } + + CDialog::OnOK(); +} diff --git a/mozilla/cck/driver/dlgeditprefstr.h b/mozilla/cck/driver/dlgeditprefstr.h new file mode 100644 index 00000000000..36338479351 --- /dev/null +++ b/mozilla/cck/driver/dlgeditprefstr.h @@ -0,0 +1,65 @@ +#if !defined(AFX_DLGEDITPREFSTR_H__EA62EAF1_9CF9_474F_AC2E_7AE66DCAF863__INCLUDED_) +#define AFX_DLGEDITPREFSTR_H__EA62EAF1_9CF9_474F_AC2E_7AE66DCAF863__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// DlgEditPrefStr.h : header file +// + +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CDlgEditPrefStr dialog + +class CDlgEditPrefStr : public CDialog +{ +// Construction +public: + CString m_strSelectedChoice; + CString* m_pstrChoices; + CString m_strType; + CString m_strTitle; + CDlgEditPrefStr(CWnd* pParent = NULL); // standard constructor + BOOL m_bChoose; + +// Dialog Data + //{{AFX_DATA(CDlgEditPrefStr) + enum { IDD = IDD_EDITPREF }; + CComboBox m_listValue; + CButton m_checkValue; + CEdit m_editValue; + CString m_strDescription; + CString m_strPrefName; + CString m_strValue; + CString m_strInstallFile; + CString m_strPrefFile; + BOOL m_bLocked; + BOOL m_bValue; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDlgEditPrefStr) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDlgEditPrefStr) + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + virtual BOOL OnInitDialog(); + virtual void OnOK(); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DLGEDITPREFSTR_H__EA62EAF1_9CF9_474F_AC2E_7AE66DCAF863__INCLUDED_) diff --git a/mozilla/cck/driver/dlgfind.cpp b/mozilla/cck/driver/dlgfind.cpp new file mode 100644 index 00000000000..327baab9dfd --- /dev/null +++ b/mozilla/cck/driver/dlgfind.cpp @@ -0,0 +1,42 @@ +// DlgFind.cpp : implementation file +// + +#include "stdafx.h" +#include "DlgFind.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + +///////////////////////////////////////////////////////////////////////////// +// CDlgFind dialog + + +CDlgFind::CDlgFind(CWnd* pParent /*=NULL*/) + : CDialog(CDlgFind::IDD, pParent) +{ + //{{AFX_DATA_INIT(CDlgFind) + m_strFind = _T(""); + //}}AFX_DATA_INIT +} + + +void CDlgFind::DoDataExchange(CDataExchange* pDX) +{ + CDialog::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CDlgFind) + DDX_Text(pDX, IDC_FIND, m_strFind); + //}}AFX_DATA_MAP +} + + +BEGIN_MESSAGE_MAP(CDlgFind, CDialog) + //{{AFX_MSG_MAP(CDlgFind) + // NOTE: the ClassWizard will add message map macros here + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CDlgFind message handlers diff --git a/mozilla/cck/driver/dlgfind.h b/mozilla/cck/driver/dlgfind.h new file mode 100644 index 00000000000..581d0de15c8 --- /dev/null +++ b/mozilla/cck/driver/dlgfind.h @@ -0,0 +1,48 @@ +#if !defined(AFX_DLGFIND_H__1A85D3AB_C7B1_4F91_A9A9_6A1DEECD13E2__INCLUDED_) +#define AFX_DLGFIND_H__1A85D3AB_C7B1_4F91_A9A9_6A1DEECD13E2__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 +// DlgFind.h : header file +// + +#include "resource.h" + +///////////////////////////////////////////////////////////////////////////// +// CDlgFind dialog + +class CDlgFind : public CDialog +{ +// Construction +public: + CDlgFind(CWnd* pParent = NULL); // standard constructor + +// Dialog Data + //{{AFX_DATA(CDlgFind) + enum { IDD = IDD_FIND }; + CString m_strFind; + //}}AFX_DATA + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CDlgFind) + protected: + virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support + //}}AFX_VIRTUAL + +// Implementation +protected: + + // Generated message map functions + //{{AFX_MSG(CDlgFind) + // NOTE: the ClassWizard will add member functions here + //}}AFX_MSG + DECLARE_MESSAGE_MAP() +}; + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_DLGFIND_H__1A85D3AB_C7B1_4F91_A9A9_6A1DEECD13E2__INCLUDED_) diff --git a/mozilla/cck/driver/interpret.cpp b/mozilla/cck/driver/interpret.cpp index 5463fb98abd..8df2ec401ed 100644 --- a/mozilla/cck/driver/interpret.cpp +++ b/mozilla/cck/driver/interpret.cpp @@ -8,6 +8,7 @@ #include "SumDlg.h" #include "NewDialog.h" #include "NewConfigDialog.h" +#include "PrefEditView.h" // The following is included to make // the browse for a dir code compile @@ -346,6 +347,8 @@ BOOL CInterpret::ShowSection(WIDGET *curWidget) return TRUE; } + + BOOL CInterpret::GetRegistryKey( HKEY key, const char *subkey, char *retdata ) { long retval; @@ -1235,15 +1238,47 @@ BOOL CInterpret::interpret(CString cmds, WIDGET *curWidget) else if (strcmp(pcmd, "ShowSection") == 0) { // ShowSection is a way to use a listbox to choose a subset of widgets to display. - // To use, create a listbox widget, and fill it will sectionnames. + // To use, create a listbox widget, and fill it with sectionnames. // Set its onCommand=ShowSection. // Then give the widgets you want in each section a "ShowInSection=sectionname". // When "sectionname" is selected in the listbox, all widgets with matching ShowInSection // are shown, and all widgets with some other sectiion are hidden. Widgets without // the ShowInSection attribute are left alone. - ShowSection(curWidget); } + else if (strcmp(pcmd, "OpenPrefTreeItem") == 0) + { + WIDGET *w = findWidget(parms); + if (w->type == "PrefsTree") + ((CPrefEditView*)w->control)->DoOpenItem(); + + ((CPrefEditView*)w->control)->SetFocus(); + } + else if (strcmp(pcmd, "FindPrefTreeItem") == 0) + { + WIDGET *w = findWidget(parms); + if (w->type == "PrefsTree") + ((CPrefEditView*)w->control)->DoFindFirst(); + + ((CPrefEditView*)w->control)->SetFocus(); + } + else if (strcmp(pcmd, "FindNextPrefTreeItem") == 0) + { + WIDGET *w = findWidget(parms); + if (w->type == "PrefsTree") + ((CPrefEditView*)w->control)->DoFindNext(); + + ((CPrefEditView*)w->control)->SetFocus(); + } + else if (strcmp(pcmd, "AddPrefTreeItem") == 0) + { + WIDGET *w = findWidget(parms); + if (w->type == "PrefsTree") + ((CPrefEditView*)w->control)->DoAdd(); + + ((CPrefEditView*)w->control)->SetFocus(); + } + } // This is an extra free... //free(pcmd); diff --git a/mozilla/cck/driver/makefile.win b/mozilla/cck/driver/makefile.win index 72e263855c4..e60d8825e9c 100644 --- a/mozilla/cck/driver/makefile.win +++ b/mozilla/cck/driver/makefile.win @@ -48,6 +48,7 @@ INCS = -I. \ OBJS = \ + .\$(OBJDIR)\DlgEditPrefStr.obj \ .\$(OBJDIR)\HelpDlg.obj \ .\$(OBJDIR)\ImageDialog.obj \ .\$(OBJDIR)\ImgDlg.obj \ @@ -55,6 +56,8 @@ OBJS = \ .\$(OBJDIR)\NavText.obj \ .\$(OBJDIR)\NewConfigDialog.obj \ .\$(OBJDIR)\NewDialog.obj \ + .\$(OBJDIR)\PrefEditView.obj \ + .\$(OBJDIR)\PrefElement.obj \ .\$(OBJDIR)\ProgDlgThread.obj \ .\$(OBJDIR)\ProgressDialog.obj \ .\$(OBJDIR)\PropSheet.obj \ @@ -65,6 +68,10 @@ OBJS = \ .\$(OBJDIR)\WizardUI.obj \ .\$(OBJDIR)\WizHelp.obj \ .\$(OBJDIR)\wizshell.obj \ + .\$(OBJDIR)\XMLDOMHelper.obj \ + .\$(OBJDIR)\DlgFind.obj \ + .\$(OBJDIR)\DlgAdd.obj \ + .\$(OBJDIR)\PrefGroup.obj \ $(NULL) LLIBS = $(LLIBS) \ diff --git a/mozilla/cck/driver/prefeditview.cpp b/mozilla/cck/driver/prefeditview.cpp new file mode 100644 index 00000000000..4b4d8819c7d --- /dev/null +++ b/mozilla/cck/driver/prefeditview.cpp @@ -0,0 +1,715 @@ +// PrefEditView.cpp : implementation of the CPrefEditView class +// +// In this code, the "tree control" is the just that which lives in the view, +// and the "prefs tree" is an XML DOM tree representing the preferences and +// their layout. +// +// The key to go from a tree control item to it's corresponding object in the +// XML tree is the pref name, which is saved in the tree control item data +// area. The code assumes the pref names are unique. +// + +#include "stdafx.h" +#include "PrefElement.h" +#include "PrefEditView.h" +#include "DlgEditPrefStr.h" +#include "DlgFind.h" +#include "DlgAdd.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +///////////////////////////////////////////////////////////////////////////// +// CPrefEditView + +IMPLEMENT_DYNCREATE(CPrefEditView, CTreeView) + +BEGIN_MESSAGE_MAP(CPrefEditView, CTreeView) + //{{AFX_MSG_MAP(CPrefEditView) + ON_NOTIFY_REFLECT(NM_DBLCLK, OnDblclk) + ON_NOTIFY_REFLECT(NM_RCLICK, OnRclick) + ON_WM_CREATE() + ON_WM_DESTROY() + ON_COMMAND(ID_EDITPREFITEM, OnEditPrefItem) + ON_COMMAND(ID_FINDPREF, OnFindPref) + ON_COMMAND(ID_FINDNEXTPREF, OnFindNextPref) + ON_COMMAND(ID_ADDPREF, OnAddPref) + ON_WM_KEYDOWN() + //}}AFX_MSG_MAP +END_MESSAGE_MAP() + +///////////////////////////////////////////////////////////////////////////// +// CPrefEditView construction/destruction + +// Protected. +CPrefEditView::CPrefEditView() +: m_pPrefXMLTree(NULL), m_pPrefsList(NULL), m_iNextElement(-1) +{ + +} + + +CPrefEditView::CPrefEditView(CString strXMLFile) +: m_pPrefXMLTree(NULL), m_strXMLFile(strXMLFile), m_pPrefsList(NULL), m_iNextElement(-1) +{ + InitXMLTree(); +} + +CPrefEditView::~CPrefEditView() +{ + +} + +BOOL CPrefEditView::PreCreateWindow(CREATESTRUCT& cs) +{ + + cs.style |= TVS_HASLINES | TVS_LINESATROOT | TVS_HASBUTTONS; + return CTreeView::PreCreateWindow(cs); +} + +///////////////////////////////////////////////////////////////////////////// +// CPrefEditView public operations + +// expand the tree, or open the selected item for edit +void CPrefEditView::DoOpenItem() +{ + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hTreeCtrlItem = treeCtrl.GetSelectedItem(); + if (!treeCtrl.ItemHasChildren(hTreeCtrlItem)) // no children == leaf node == pref + { + EditSelectedPrefsItem(); + } + else + { + treeCtrl.Expand(hTreeCtrlItem, TVE_TOGGLE); + } + +} + +// open the Find Pref dialog +void CPrefEditView::DoFindFirst() +{ + OnFindPref(); +} + +// find next item +void CPrefEditView::DoFindNext() +{ + OnFindNextPref(); +} + +// open the Add Pref dialog +void CPrefEditView::DoAdd() +{ + OnAddPref(); +} + + + +///////////////////////////////////////////////////////////////////////////// +// CPrefEditView diagnostics + +#ifdef _DEBUG +void CPrefEditView::AssertValid() const +{ + CTreeView::AssertValid(); +} + +void CPrefEditView::Dump(CDumpContext& dc) const +{ + CTreeView::Dump(dc); +} + +#endif //_DEBUG + + +BOOL CPrefEditView::InitXMLTree() +{ + // Create XML DOM instance. + HRESULT hr = m_pPrefXMLTree.CreateInstance(__uuidof(DOMDocument)); + if (FAILED(hr)) + { + MessageBox("Error creating MS XML DOM.", "Error", MB_OK); + return FALSE; + } + + // Load the prefs metadata. This is a representation of the prefs tree as + // it should appear in the tree control. + if (m_pPrefXMLTree) + { + CString strPrefsFileURL; + strPrefsFileURL.Format("FILE://%s", m_strXMLFile); + + if (!m_pPrefXMLTree->load(strPrefsFileURL.GetBuffer(0))) + { + CString strError; + strError.Format("Error loading preferences metadata %s.", strPrefsFileURL); + MessageBox(strError, "Error", MB_OK); + m_pPrefXMLTree = NULL; + return FALSE; + } + if (m_pPrefXMLTree->parseError->errorCode != 0) + { + CString strError; + strError.Format("Bad XML in %s.", strPrefsFileURL); + MessageBox(strError, "Error", MB_OK); + m_pPrefXMLTree = NULL; + return FALSE; + } + } + + return TRUE; +} + +// ItemData in each tree control element was created with new, so we need to +// delete it. +void CPrefEditView::DeleteTreeCtrl(HTREEITEM hParent) +{ + ASSERT(hParent); + + CTreeCtrl &treeCtrl = GetTreeCtrl(); + + // Delete the CString ojbect we created with new. + CString* pstr = (CString*)treeCtrl.GetItemData(hParent); + delete pstr; + + // Now call recursively for all children. + HTREEITEM hCurrent = treeCtrl.GetNextItem(hParent, TVGN_CHILD); + while (hCurrent != NULL) + { + DeleteTreeCtrl(hCurrent); + hCurrent = treeCtrl.GetNextItem(hCurrent, TVGN_NEXT); + } +} + + +// Given a pref node, add it to the tree ctrl. The pref name is +// later used to search for the pref node when the name is selected +// for edit. +HTREEITEM CPrefEditView::AddNodeToTreeCtrl(IXMLDOMNodePtr prefsTreeNode, HTREEITEM hTreeCtrlParent) +{ + ASSERT(prefsTreeNode != NULL); + + HTREEITEM hNewItem = NULL; + + //MessageBox(prefsTreeNode->xml, "XML", MB_OK); + if (prefsTreeNode->nodeType == NODE_ELEMENT) + { + IXMLDOMElementPtr prefsTreeElement = (IXMLDOMElementPtr)prefsTreeNode; + CElementNode elementNode(prefsTreeElement); + CString strNodeName = elementNode.GetNodeName(); + + if ((strNodeName.CompareNoCase("PREFSGROUP") == 0) || (strNodeName.CompareNoCase("PREF") == 0)) + { + // Will contain the pref name for pref elements, saved in the tree ctrl. + CString* pstrPrefName = NULL; + + // Put this element in the tree ctrl. + CString strLabel = elementNode.GetAttribute("uiname"); + + int imageIndex = 0; // tree ctrl images + int imageIndexSel = 0; // 0 is a closed folder + + // If this is a PREF element, create tree ctrl text, and save with a + // different image. + if (strNodeName.CompareNoCase("PREF") == 0) + { + + CPrefElement prefElement(prefsTreeElement); + strLabel = prefElement.CreateTreeCtrlLabel(); + + if (prefElement.IsLocked()) + imageIndexSel = imageIndex = 2; // a locked padlock + else + imageIndexSel = imageIndex = 3; // an unlocked padlock + + + // This gets deleted in DeleteTreeCtrl(). This is how we get back to + // pref node when a tree ctrl node is selected for editing. + pstrPrefName = new CString(prefElement.GetAttribute("prefname")); + + } + + CTreeCtrl &treeCtrl = GetTreeCtrl(); + hNewItem = treeCtrl.InsertItem( strLabel, imageIndex, imageIndexSel, hTreeCtrlParent, TVI_LAST); + + // Save a pointer to the prefname string so we can find the node in the + // pref tree from the tree ctrl when the item is selected for edit. + treeCtrl.SetItemData(hNewItem, (DWORD)pstrPrefName); + + } + } + + // Recursively call for children. + IXMLDOMNodeListPtr children = prefsTreeNode->GetchildNodes(); + if (children) + { + int numChildren = children->Getlength(); + for (int i = 0; i < numChildren; i++) + { + IXMLDOMNodePtr child = children->Getitem(i); + AddNodeToTreeCtrl(child, hNewItem); + } + } + + return hNewItem; +} + +///////////////////////////////////////////////////////////////////////////// +// CPrefEditView message handlers + + +// Given the pref name, for example browser.general.example, returns the +// prefs tree element for that pref. +IXMLDOMElementPtr CPrefEditView::FindElementFromPrefname(CString& rstrPrefString) +{ + ASSERT(rstrPrefString.GetLength() > 0); + ASSERT(m_pPrefXMLTree != NULL); + + IXMLDOMNodeListPtr prefsList = m_pPrefXMLTree->getElementsByTagName("PREF"); + for(int i = 0; i < prefsList->length; i++) + { + IXMLDOMElementPtr element = prefsList->Getitem(i); + CPrefElement elementNode(element); + if (rstrPrefString.CompareNoCase(elementNode.GetPrefName()) == 0) + return element; + } + return NULL; +} + +// Given a pref element node, returns the tree control item for it. +HTREEITEM CPrefEditView::FindTreeItemFromPrefname(HTREEITEM hItem, CString& rstrPrefName) +{ + + if(!hItem) + return NULL; + + // Get the pref name associated with this tree ctrl item. + CTreeCtrl &treeCtrl = GetTreeCtrl(); + CString* pstrPrefName = (CString*)treeCtrl.GetItemData(hItem); + + if (pstrPrefName && pstrPrefName->CompareNoCase(rstrPrefName) == 0) + return hItem; + + HTREEITEM hRet = NULL; + HTREEITEM hChild = treeCtrl.GetChildItem(hItem); + if(hChild) + hRet = FindTreeItemFromPrefname(hChild, rstrPrefName); + + if(hRet == NULL) + { + HTREEITEM hSibling = treeCtrl.GetNextSiblingItem(hItem); + if(hSibling) + hRet = FindTreeItemFromPrefname(hSibling, rstrPrefName); + } + + return hRet; + +} + + +// Open a dialog to edit the pref. +void CPrefEditView::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult) +{ + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hTreeCtrlItem = treeCtrl.GetSelectedItem(); + if (!treeCtrl.ItemHasChildren(hTreeCtrlItem)) // no children == leaf node == pref + { + EditSelectedPrefsItem(); + *pResult = 0; + } + +} + +int CPrefEditView::OnCreate(LPCREATESTRUCT lpCreateStruct) +{ + // InitXMLTree() has to complete successfully first. + ASSERT(m_pPrefXMLTree != NULL); + + if (m_pPrefXMLTree == NULL) + return -1; + + if (CTreeView::OnCreate(lpCreateStruct) == -1) + return -1; + + // Get the tree control. + CTreeCtrl &treeCtrl = GetTreeCtrl(); + + // create the image list for the tree control + m_imageList.Create(IDB_TREEIMAGES, 17, 1, RGB(0,255,255)); + treeCtrl.SetImageList (&m_imageList, TVSIL_NORMAL); + + + HTREEITEM hRoot = treeCtrl.GetRootItem(); + if (hRoot) + DeleteTreeCtrl(hRoot); + + ASSERT(m_pPrefXMLTree != NULL); + + + // Load the tree control so it matches the XML tree. + AddNodeToTreeCtrl(m_pPrefXMLTree->documentElement, NULL); + + treeCtrl.Expand(treeCtrl.GetRootItem(), TVE_EXPAND); + + return 0; +} + + +void CPrefEditView::OnDestroy() +{ + // Clean up tree ctrl pref name memory allocations. + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hRoot = treeCtrl.GetRootItem(); + if (hRoot) + DeleteTreeCtrl(hRoot); + + CTreeView::OnDestroy(); + +} + +// Find a pref containing a string in one of its fields. +BOOL CPrefEditView::FindFirst(CString& rstrFind) +{ + ASSERT(m_pPrefXMLTree != NULL); + + m_pPrefsList = m_pPrefXMLTree->getElementsByTagName("PREF"); + m_iNextElement = 0; + m_strFind = rstrFind; + + return FindNext(); +} + + +// Assumes FindFirst was called first. +BOOL CPrefEditView::FindNext() +{ + ASSERT(m_pPrefXMLTree != NULL); + + if (m_pPrefsList == NULL || m_iNextElement == -1) + return FALSE; + + while (m_iNextElement < m_pPrefsList->length) + { + IXMLDOMElementPtr pElement = m_pPrefsList->Getitem(m_iNextElement); + + CPrefElement elementNode(pElement); + + // Find the string in any field (pref name, value, description, etc.) + if (elementNode.FindString(m_strFind)) + { + // Select this item. + SelectPref(elementNode.GetPrefName()); + m_iNextElement++; + return TRUE; + } + + m_iNextElement++; + } + + m_iNextElement = -1; + + AfxMessageBox("No more matches.", MB_OK); + + return FALSE; +} + + + +// Save the XML to a file. +BOOL CPrefEditView::DoSavePrefsTree(CString strFile) +{ + ASSERT(m_pPrefXMLTree != NULL); + + CElementNode root(m_pPrefXMLTree->documentElement); + CString strXML = root.GetXML(); + + FILE* fp = fopen(strFile, "w"); + if (!fp) + return FALSE; + + CString strPreamble(""); + if (!fwrite(strPreamble, strPreamble.GetLength(), 1, fp)) + return FALSE; + + if (!fwrite(strXML, strXML.GetLength(), 1, fp)) + return FALSE; + + fclose(fp); + + return TRUE; +} + + + +// Pop up menu for Pref items. +void CPrefEditView::ShowPopupMenu( CPoint& point, int submenu ) +{ + if (point.x == -1 && point.y == -1) + { + //keystroke invocation + CRect rect; + GetClientRect(rect); + ClientToScreen(rect); + + point = rect.TopLeft(); + point.Offset(5, 5); + } + + CMenu menu; + VERIFY(menu.LoadMenu(IDR_POPUP_PREFTREE_MENU)); + + CMenu* pPopup = menu.GetSubMenu(submenu); + ASSERT(pPopup != NULL); + CWnd* pWndPopupOwner = this; + + pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, point.x, point.y, pWndPopupOwner); +} + +// "Edit Pref" context menu command selected. +void CPrefEditView::OnEditPrefItem() +{ + EditSelectedPrefsItem(); +} + +// "Find Pref" context menu command selected. +void CPrefEditView::OnFindPref() +{ + CDlgFind dlg; + if (dlg.DoModal() == IDOK) + if (!dlg.m_strFind.IsEmpty()) + FindFirst(dlg.m_strFind); +} + +// "Find Next Pref" context menu command selected. +void CPrefEditView::OnFindNextPref() +{ + // If FindFirst not done before FindNext, call FindFirst first. + if (m_iNextElement == -1) + OnFindPref(); + else + FindNext(); +} + + +// User added prefs go into the root group. +HTREEITEM CPrefEditView::AddPref(CString& rstrPrefName, CString& rstrPrefDesc, CString& rstrPrefType) +{ + IXMLDOMNodePtr prefsTreeRootNode = m_pPrefXMLTree->documentElement; + + // Make sure the node is the root node element. + if (prefsTreeRootNode->nodeType == NODE_ELEMENT) + { + // and that it's a group. + CElementNode group(prefsTreeRootNode); + CString strNodeName = group.GetNodeName(); + if (strNodeName.CompareNoCase("PREFSGROUP") == 0) + { + + // Create an XML element node. + IXMLDOMNodePtr newNode = group.AddNode("PREF"); + + // Modify it. + CPrefElement newPref(newNode); + newPref.Initialize(rstrPrefName, rstrPrefDesc, rstrPrefType); + + // Add it to the tree. + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hRoot = treeCtrl.GetRootItem(); + ASSERT(hRoot); + if (hRoot) + { + HTREEITEM hNewItem = AddNodeToTreeCtrl(newNode, hRoot); + treeCtrl.SelectItem(hNewItem); + + EditSelectedPrefsItem(); + } + } + } + + + + return NULL; + + +} + +// Open dialog to add a new pref, then open another to edit it. +void CPrefEditView::OnAddPref() +{ + CDlgAdd dlg; + if (dlg.DoModal() == IDOK) + { + if (dlg.m_strPrefName.IsEmpty()) + return; + + CString strPrefType; + if (dlg.m_intPrefType == 0) + strPrefType = "string"; + else if (dlg.m_intPrefType == 1) + strPrefType = "int"; + else + strPrefType = "bool"; + + // Disallow if the pref name already exists. + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hRoot = treeCtrl.GetRootItem(); + HTREEITEM hTreeCtrlItem = FindTreeItemFromPrefname(hRoot, dlg.m_strPrefName); + if (hTreeCtrlItem) + { + MessageBox("A pref of this name already exists.", MB_OK); + treeCtrl.SelectItem(hTreeCtrlItem); + } + else + { + AddPref(dlg.m_strPrefName, dlg.m_strPrefDesc, strPrefType); + } + + + } + +} + +// Open the edit dialog box for the selected pref item. A pref should be selected, +// not a group. +void CPrefEditView::EditSelectedPrefsItem() +{ + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hTreeCtrlItem = treeCtrl.GetSelectedItem(); + + ASSERT(!treeCtrl.ItemHasChildren(hTreeCtrlItem)); // no children == leaf node == pref + + // Can't edit a pref group--only a pref (leaf). + if (treeCtrl.ItemHasChildren(hTreeCtrlItem)) + return; + + // Get the pref name associated with this tree ctrl item. + CString* pstrPrefName = (CString*)treeCtrl.GetItemData(hTreeCtrlItem); + + // All prefs should specify the prefname attribute in the XML pref element. + // This assertion means that the pref's prefname attribute was not set, or + // that perhaps a prefgroup doesn't have any children (if should, otherwise + // it shouldn't be a group.) + ASSERT(pstrPrefName); + + if (!pstrPrefName) + return; + + // Get the pref tree node with that same pref name. + IXMLDOMElementPtr prefsTreeElement = FindElementFromPrefname(*pstrPrefName); + if (prefsTreeElement) + { + CPrefElement elementNode(prefsTreeElement); + CString* pstrChoices = elementNode.MakeChoiceStringArray(); + + CDlgEditPrefStr dlg; + dlg.m_strType = elementNode.GetPrefType(); + dlg.m_strTitle = elementNode.GetUIName(); + dlg.m_strDescription = elementNode.GetPrefDescription(); + dlg.m_strPrefName = *pstrPrefName; + dlg.m_strValue = elementNode.GetPrefValue(); + dlg.m_bLocked = elementNode.IsLocked(); + dlg.m_pstrChoices = pstrChoices; + dlg.m_strSelectedChoice = elementNode.GetSelectedChoiceString(); + dlg.m_strPrefFile = elementNode.GetPrefFile(); + dlg.m_strInstallFile = elementNode.GetInstallFile(); + dlg.m_bChoose = elementNode.IsChoose(); + + + if (dlg.DoModal() == IDOK) + { + + // Adjust the prefs tree to reflect the changes. The dialog always + // sets m_strValue to a string which can go directly into the prefs + // tree element. For example, bools set 'true' or 'false' and choices + // set '0' or '1' or whatever the value for the selected choice. + elementNode.SetPrefValue(dlg.m_strValue); + elementNode.SetLocked(dlg.m_bLocked); + elementNode.SetPrefFile(dlg.m_strPrefFile); + elementNode.SetInstallFile(dlg.m_strInstallFile); + + // Adjust the tree control to reflect the changes. + treeCtrl.SetItemText(hTreeCtrlItem, elementNode.CreateTreeCtrlLabel()); + treeCtrl.SetItemImage(hTreeCtrlItem, dlg.m_bLocked? 2 : 3, dlg.m_bLocked? 2 : 3); + + } + + delete [] pstrChoices; + + } +} + +// This is to make context menus work properly--there is a quirk in +// CTreeView where you have to double-right click for context menus +// to work. +void CPrefEditView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult) +{ + CTreeCtrl & treeCtrl = GetTreeCtrl(); + + // Get the cursor position for this message + DWORD dwPos = GetMessagePos(); + + // Convert the coords into a CPoint structure + CPoint pt(LOWORD( dwPos ), HIWORD( dwPos )); + CPoint spt; + + spt = pt; + + // convert to screen coords for the hittesting to work + treeCtrl.ScreenToClient( &spt ); + + UINT test; + HTREEITEM hTreeCtrlItem = treeCtrl.HitTest(spt, &test); + + if (hTreeCtrlItem != NULL) + { + // Is the click actually *on* the item? + if (test & TVHT_ONITEM) + { + // Select the item. + treeCtrl.SelectItem(hTreeCtrlItem); + + int submenu; + if (!treeCtrl.ItemHasChildren(hTreeCtrlItem)) // no children == leaf node == pref + submenu = 0; + else + submenu = 1; + + ShowPopupMenu(pt, submenu); + } + } + + *pResult = 0; +} + +// Given a pref name, select the tree control item with that pref name. +void CPrefEditView::SelectPref(CString& rstrPrefName) +{ + CTreeCtrl &treeCtrl = GetTreeCtrl(); + HTREEITEM hRoot = treeCtrl.GetRootItem(); + + HTREEITEM hTreeCtrlItem = FindTreeItemFromPrefname(hRoot, rstrPrefName); + treeCtrl.SelectItem(hTreeCtrlItem); +} + +void CPrefEditView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags) +{ + if (nChar == VK_F3) + { + OnFindNextPref(); + } + + else if ((nChar == 0x46) && GetAsyncKeyState(VK_CONTROL)) // Ctrl+F + { + OnFindPref(); + } + + else + { + CTreeView::OnKeyDown(nChar, nRepCnt, nFlags); + } +} diff --git a/mozilla/cck/driver/prefeditview.h b/mozilla/cck/driver/prefeditview.h new file mode 100644 index 00000000000..2b367aad2c8 --- /dev/null +++ b/mozilla/cck/driver/prefeditview.h @@ -0,0 +1,106 @@ +// PrefEditView.h : interface of the CPrefEditView class +// +///////////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PREFEDITVIEW_H__6ACBEE69_AA14_43BA_B736_DF17EA66A7CE__INCLUDED_) +#define AFX_PREFEDITVIEW_H__6ACBEE69_AA14_43BA_B736_DF17EA66A7CE__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#import "msxml.dll" +using namespace MSXML; + +#include +#include "XMLDOMHelper.h" + + +class CPrefEditView : public CTreeView +{ +protected: + CPrefEditView(); + +// Attributes +public: + + CPrefEditView(CString strXMLFile); + DECLARE_DYNCREATE(CPrefEditView) + +// Operations +public: + + BOOL DoSavePrefsTree(CString strFileName); // save the XML to a file + void DoOpenItem(); // expand the tree, or open the selected item for edit + void DoFindFirst(); // open the Find Pref dialog + void DoFindNext(); // find next item + void DoAdd(); // open the Add Pref dialog + + +// Overrides + // ClassWizard generated virtual function overrides + //{{AFX_VIRTUAL(CPrefEditView) + public: + virtual BOOL PreCreateWindow(CREATESTRUCT& cs); + //}}AFX_VIRTUAL + +// Implementation +public: + virtual ~CPrefEditView(); +#ifdef _DEBUG + virtual void AssertValid() const; + virtual void Dump(CDumpContext& dc) const; +#endif + +protected: + +// Generated message map functions +protected: + //{{AFX_MSG(CPrefEditView) + afx_msg void OnDblclk(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); + afx_msg void OnDestroy(); + afx_msg void OnEditPrefItem(); + afx_msg void OnFindPref(); + afx_msg void OnFindNextPref(); + afx_msg void OnAddPref(); + afx_msg void OnRclick(NMHDR* pNMHDR, LRESULT* pResult); + afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags); + + //}}AFX_MSG + DECLARE_MESSAGE_MAP() + +private: + CImageList m_imageList; // padlocks to show which prefs are locked + IXMLDOMDocumentPtr m_pPrefXMLTree; // the actual XML tree which describes the tree control contents + CString m_strXMLFile; // the XML file used to load the m_pPrefXMLTree, and hence the tree control + + // Stuff for Find and FindNext. + IXMLDOMNodeListPtr m_pPrefsList; + int m_iNextElement; + CString m_strFind; + BOOL FindFirst(CString& rstrFind); + BOOL FindNext(); + + + BOOL InitXMLTree(); + HTREEITEM AddNodeToTreeCtrl(IXMLDOMNodePtr prefsTreeNode, HTREEITEM hTreeCtrlParent); + HTREEITEM FindTreeItemFromPrefname(HTREEITEM hItem, CString& rstrPrefName); + IXMLDOMElementPtr FindElementFromPrefname(CString& rstrPrefString); + void SelectPref(CString& rstrPrefName); + void DeleteTreeCtrl(HTREEITEM hParent); + + HTREEITEM AddPref(CString& rstrPrefName, CString& rstrPrefDesc, CString& rstrPrefType); + + void ShowPopupMenu( CPoint& point, int submenu ); + void EditSelectedPrefsItem(); + +}; + + +///////////////////////////////////////////////////////////////////////////// + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_PREFEDITVIEW_H__6ACBEE69_AA14_43BA_B736_DF17EA66A7CE__INCLUDED_) diff --git a/mozilla/cck/driver/prefelement.cpp b/mozilla/cck/driver/prefelement.cpp new file mode 100644 index 00000000000..fa06526696f --- /dev/null +++ b/mozilla/cck/driver/prefelement.cpp @@ -0,0 +1,292 @@ +// PrefElement.cpp: implementation of the CPrefElement class. +// +// This is a class with helper functions for the preferences metadata +// XML. +// +// XML Conventions: +// Element tags are in CAPS. +// Attribute names are in lower case. +// When writing bools, use lower case "true" and "false". +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "PrefElement.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + + + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CPrefElement::CPrefElement(IXMLDOMElementPtr element) +: CElementNode(element) +{ + +} + +CPrefElement::~CPrefElement() +{ + +} + +// For a newly created node, initialize it's settings. +void CPrefElement::Initialize(CString strPrefName, CString strPrefDesc, CString strPrefType) +{ + SetAttribute("uiname", strPrefName); + SetAttribute("prefname", strPrefName); + SetAttribute("description", strPrefDesc); + SetAttribute("type", strPrefType); + SetAttribute("lockable", "true"); + + SetLocked(FALSE); + SetInstallFile("browser.xpi"); + SetPrefFile("bin/defaults/pref/all-ns.js"); + + if (strPrefType.CompareNoCase("int") == 0) + SetPrefValue("0"); + else if (strPrefType.CompareNoCase("bool") == 0) + SetPrefValue("true"); + else + SetPrefValue(""); +} + +// For a pref node element, returns a string which is used for the tree ctrl +// label. +CString CPrefElement::CreateTreeCtrlLabel() +{ + CString strLabel = GetAttribute("uiname"); + CString strValue = GetChildElementValue("VALUE"); + + if (IsChoose()) + { + strValue = GetSelectedChoiceString(); + } + + CString strRetVal; + + strRetVal.Format("%s [%s]", strLabel, strValue); + + return strRetVal; +} + +// Check to see if the pref element is locked. +BOOL CPrefElement::IsLocked() +{ + CString strVal = GetChildElementValue("LOCKED"); + return (strVal.CompareNoCase("true") == 0); +} + +// Lock the pref element. +void CPrefElement::SetLocked(BOOL bLocked) +{ + SetChildElementValue("LOCKED", bLocked? "true": "false"); +} + + +// Build a list of choices from the element to pass to the edit dialog. +// Returns an array of CStrings. Caller must delete. +CString* CPrefElement::MakeChoiceStringArray() +{ + CString* choices = NULL; + + IXMLDOMNodeListPtr choiceNodes = m_element->getElementsByTagName("CHOICE"); + if (choiceNodes) + { + // Create an array of CString pointers. + int numChoices = choiceNodes->length; + choices = new CString[numChoices + 1]; + for (int i = 0; i < numChoices; i++) + { + IXMLDOMElementPtr element = choiceNodes->Getitem(i); + CElementNode elementNode(element); + choices[i] = elementNode.GetAttribute("uiname"); + } + choices[numChoices] = ""; + } + + return choices; +} + +// Get the ui name of the selected choice for this pref. +CString CPrefElement::GetSelectedChoiceString() +{ + CString strVal = GetPrefValue(); + + IXMLDOMNodeListPtr choiceNodes = m_element->getElementsByTagName("CHOICE"); + if (choiceNodes) + { + int numChoices = choiceNodes->length; + for (int i = 0; i < numChoices; i++) + { + IXMLDOMElementPtr element = choiceNodes->Getitem(i); + CElementNode elementNode(element); + if (strVal.CompareNoCase(elementNode.GetAttribute("value")) == 0) + { + return elementNode.GetAttribute("uiname"); + } + } + } + + return ""; +} + +CString CPrefElement::GetValueFromChoiceString(CString strChoiceString) +{ + IXMLDOMNodeListPtr choiceNodes = m_element->getElementsByTagName("CHOICE"); + if (choiceNodes) + { + int numChoices = choiceNodes->length; + for (int i = 0; i < numChoices; i++) + { + IXMLDOMElementPtr element = choiceNodes->Getitem(i); + CElementNode elementNode(element); + if (strChoiceString.CompareNoCase(elementNode.GetAttribute("uiname")) == 0) + { + return elementNode.GetAttribute("value"); + } + } + } + return ""; +} + +// Get the ui name of the pref. +CString CPrefElement::GetUIName() +{ + return GetAttribute("uiname"); +} + +// Get the value of the pref. +CString CPrefElement::GetPrefValue() +{ + return GetChildElementValue("VALUE"); +} + +// Set the value of the pref. For "choose", pass +// the uiname string, and this fuction will convert +// to the correct value. +void CPrefElement::SetPrefValue(CString strValue) +{ + if (IsChoose()) + { + SetChildElementValue("VALUE", GetValueFromChoiceString(strValue)); + } + + else + { + SetChildElementValue("VALUE", strValue); + } +} + + + +// Get the Mozilla name of the pref. +CString CPrefElement::GetPrefName() +{ + return GetAttribute("prefname"); +} + +// Get the type of the pref. bool, string, int +CString CPrefElement::GetPrefType() +{ + return GetAttribute("type"); +} + +// Get a long description of the pref. +CString CPrefElement::GetPrefDescription() +{ + return GetAttribute("description"); +} + + +// Return name of installation file. +CString CPrefElement::GetInstallFile() +{ + return GetChildElementValue("INSTALLATIONFILE"); +} + +// Set name of installation file. +void CPrefElement::SetInstallFile(CString strInstallFile) +{ + SetChildElementValue("INSTALLATIONFILE", strInstallFile); +} + +// Return name of pref file. +CString CPrefElement::GetPrefFile() +{ + return GetChildElementValue("PREFFILE"); +} + +// Set name of pref file. +void CPrefElement::SetPrefFile(CString strPrefFile) +{ + SetChildElementValue("PREFFILE", strPrefFile); +} + +// Return true if this is a chooser type pref. +BOOL CPrefElement::IsChoose() +{ + return ChildExists("CHOICES"); +} + +// Return TRUE if the search string exists in any +// of the prefs fields. +BOOL CPrefElement::FindString(CString strFind) +{ + strFind.MakeUpper(); + + CString str = GetUIName(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetPrefValue(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetPrefName(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetPrefType(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetPrefDescription(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetInstallFile(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + str = GetPrefFile(); + str.MakeUpper(); + if (str.Find(strFind) >= 0) + return TRUE; + + return FALSE; +} + +void CPrefElement::SetSelected(BOOL bSelected) +{ + SetChildElementValue("SELECTED", bSelected?"true":"false"); +} + + +BOOL CPrefElement::IsSelected() +{ + CString strVal = GetChildElementValue("SELECTED"); + return (strVal.CompareNoCase("true") == 0); +} diff --git a/mozilla/cck/driver/prefelement.h b/mozilla/cck/driver/prefelement.h new file mode 100644 index 00000000000..04e761bbccb --- /dev/null +++ b/mozilla/cck/driver/prefelement.h @@ -0,0 +1,43 @@ +// PrefElement.h: interface for the CPrefElement class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PREFELEMENT_H__C93E84F5_104A_4218_972D_E2A384749B59__INCLUDED_) +#define AFX_PREFELEMENT_H__C93E84F5_104A_4218_972D_E2A384749B59__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "XMLDOMHelper.h" + +class CPrefElement : public CElementNode +{ +public: + CPrefElement(IXMLDOMElementPtr element); + virtual ~CPrefElement(); + + void Initialize(CString strPrefName, CString strPrefDesc, CString strPrefType); + CString CreateTreeCtrlLabel(); + BOOL IsLocked(); + void SetLocked(BOOL bLocked); + CString* MakeChoiceStringArray(); + CString GetSelectedChoiceString(); + CString GetUIName(); + CString GetPrefValue(); + void SetPrefValue(CString strValue); + CString GetPrefName(); + CString GetPrefType(); + CString GetPrefDescription(); + CString GetValueFromChoiceString(CString strChoiceString); + CString GetInstallFile(); + void SetInstallFile(CString strInstallFile); + CString GetPrefFile(); + void SetPrefFile(CString strPrefFile); + BOOL IsChoose(); + BOOL FindString(CString strFind); + void SetSelected(BOOL bExpanded); + BOOL IsSelected(); +}; + +#endif // !defined(AFX_PREFELEMENT_H__C93E84F5_104A_4218_972D_E2A384749B59__INCLUDED_) diff --git a/mozilla/cck/driver/prefgroup.cpp b/mozilla/cck/driver/prefgroup.cpp new file mode 100644 index 00000000000..af7ad570823 --- /dev/null +++ b/mozilla/cck/driver/prefgroup.cpp @@ -0,0 +1,33 @@ +// PrefGroup.cpp: implementation of the CPrefGroup class. +// +////////////////////////////////////////////////////////////////////// + +#include "stdafx.h" +#include "PrefGroup.h" + +#ifdef _DEBUG +#undef THIS_FILE +static char THIS_FILE[]=__FILE__; +#define new DEBUG_NEW +#endif + +////////////////////////////////////////////////////////////////////// +// Construction/Destruction +////////////////////////////////////////////////////////////////////// + +CPrefGroup::CPrefGroup(IXMLDOMElementPtr element) +: CElementNode(element) +{ + +} + +CPrefGroup::~CPrefGroup() +{ + +} + +CString CPrefGroup::GetUIName() +{ + return GetAttribute("uiname"); +} + diff --git a/mozilla/cck/driver/prefgroup.h b/mozilla/cck/driver/prefgroup.h new file mode 100644 index 00000000000..bb732380e01 --- /dev/null +++ b/mozilla/cck/driver/prefgroup.h @@ -0,0 +1,23 @@ +// PrefGroup.h: interface for the CPrefGroup class. +// +////////////////////////////////////////////////////////////////////// + +#if !defined(AFX_PREFGROUP_H__D81DF6AF_427E_4AE4_84E8_86ACFEDBE6D3__INCLUDED_) +#define AFX_PREFGROUP_H__D81DF6AF_427E_4AE4_84E8_86ACFEDBE6D3__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#include "XMLDOMHelper.h" + +class CPrefGroup : public CElementNode +{ +public: + CPrefGroup(IXMLDOMElementPtr element); + virtual ~CPrefGroup(); + + CString GetUIName(); +}; + +#endif // !defined(AFX_PREFGROUP_H__D81DF6AF_427E_4AE4_84E8_86ACFEDBE6D3__INCLUDED_) diff --git a/mozilla/cck/driver/res/bitmap1.bmp b/mozilla/cck/driver/res/bitmap1.bmp index 6e8e840620a..6f7e1a243e7 100644 Binary files a/mozilla/cck/driver/res/bitmap1.bmp and b/mozilla/cck/driver/res/bitmap1.bmp differ diff --git a/mozilla/cck/driver/resource.h b/mozilla/cck/driver/resource.h index fa21e991612..a265f52ae39 100644 --- a/mozilla/cck/driver/resource.h +++ b/mozilla/cck/driver/resource.h @@ -10,37 +10,61 @@ #define IDS_STRING103 103 #define IDR_MAINFRAME 128 #define IDD_BASE_DIALOG 129 +#define IDD_EDITPREF 130 +#define IDB_TREEIMAGES 131 #define IDD_IMAGE_DIALOG 136 #define IDD_DIALOG1 137 #define IDD_CREATE_DIALOG 138 #define IDD_NEW_DIALOG 140 #define IDD_IMG_DLG 141 +#define IDR_POPUP_PREFTREE_MENU 143 +#define IDD_FIND 144 +#define IDR_ACCELERATOR1 145 #define IDD_PROGRESS_DLG 146 +#define IDD_ADDPREF 147 #define IDD_DIALOG112 153 #define IDD_NEWCONFIG_DIALOG 159 #define IDD_DIALOG131 161 +#define IDC_VALUE 1000 +#define IDC_DESCRIPTION 1001 #define IDC_EDIT1 1001 +#define IDC_PREFNAME 1002 +#define IDC_LOCKED 1003 #define IDC_TITLE_TEXT 1003 +#define IDC_VALCHECK 1004 #define IDC_BASE_TEXT 1004 +#define IDC_VALLIST 1005 #define IDC_HELP_BUTTON 1005 #define IDC_BUTTON1 1007 #define ID_HELP_EDIT 1007 #define IDC_STATIC1 1008 #define IDC_STATIC2 1009 +#define IDC_INSTALLFILE 1010 +#define IDC_FIND 1011 +#define IDC_PREFFILE 1012 +#define IDC_PREFDESC 1014 +#define IDC_PREFTYPE_STRING 1015 +#define IDC_PREFTYPE_INT 1016 +#define IDC_PREFTYPE_BOOL 1017 +#define IDC_PREFTYPEGROUP 1018 #define IDC_PROGRESS1 1036 #define IDC_PROGESSTEXT_STATIC 1037 #define IDD_HELP_DLG 1537 #define IDD_SUMMARY 1538 #define IDD_WIZ_HELP 1539 -#define IDC_FEEDBACK_BUTTON 0x02000 +#define IDC_FEEDBACK_BUTTON 0x02000 +#define ID_EDITPREFITEM 32773 +#define ID_FINDPREF 32774 +#define ID_FINDNEXTPREF 32776 +#define ID_ADDPREF 32777 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 142 -#define _APS_NEXT_COMMAND_VALUE 32771 -#define _APS_NEXT_CONTROL_VALUE 1010 +#define _APS_NEXT_RESOURCE_VALUE 148 +#define _APS_NEXT_COMMAND_VALUE 32778 +#define _APS_NEXT_CONTROL_VALUE 1019 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/mozilla/cck/driver/xmldomhelper.cpp b/mozilla/cck/driver/xmldomhelper.cpp new file mode 100644 index 00000000000..25f37a46241 --- /dev/null +++ b/mozilla/cck/driver/xmldomhelper.cpp @@ -0,0 +1,123 @@ +#include "stdafx.h" +#include "XMLDOMHelper.h" + +#ifdef _DEBUG +#define new DEBUG_NEW +#undef THIS_FILE +static char THIS_FILE[] = __FILE__; +#endif + + +CElementNode::CElementNode(IXMLDOMElementPtr element) +: m_element(element) +{ +} + +BOOL CElementNode::ChildExists(CString strTag) +{ + IXMLDOMNodeListPtr prefValNodes = m_element->getElementsByTagName(strTag.GetBuffer(0)); + if (prefValNodes) + return prefValNodes->Getlength() > 0; + else + return FALSE; +} + +CString CElementNode::GetChildElementValue(CString strTag) +{ + _variant_t value; + + IXMLDOMNodeListPtr prefValNodes = m_element->getElementsByTagName(strTag.GetBuffer(0)); + if (prefValNodes) + { + IXMLDOMNodePtr prefValNode = prefValNodes->Getitem(0); // should be only one + if (prefValNode) + { + if (prefValNode->childNodes->Getlength() > 0) + value = prefValNode->childNodes->Getitem(0)->GetnodeValue(); // get the text node child, which contains the text we want. + } + } + + return (char*)_bstr_t(value); +} + +// Set the text of the child element with the tag strTag. Assumes only one child with this tag. +void CElementNode::SetChildElementValue(CString strTag, CString strValue) +{ + _variant_t value = strValue; + + IXMLDOMNodeListPtr prefValNodes = m_element->getElementsByTagName(strTag.GetBuffer(0)); + if (prefValNodes) + { + IXMLDOMNodePtr prefValNode = prefValNodes->Getitem(0); // should be only one + + if (prefValNode == NULL) + { + _variant_t tag = strTag; + prefValNode = m_element->GetownerDocument()->createElement(_bstr_t(tag)); + m_element->appendChild(prefValNode); + } + + if (prefValNode) + { + if (prefValNode->childNodes->Getlength() == 0) + { + IXMLDOMNodePtr newNode = prefValNode->GetownerDocument()->createTextNode(_bstr_t(value)); + prefValNode->appendChild(newNode); + } + else + { + prefValNode->childNodes->Getitem(0)->PutnodeValue(value); // get the text node child, which contains the text we want. + } + } + } + + return; +} + +IXMLDOMNodePtr CElementNode::AddNode(CString strTag) +{ + _variant_t tag = strTag; + IXMLDOMNodePtr newNode = m_element->GetownerDocument()->createElement(_bstr_t(tag)); + m_element->appendChild(newNode); + return newNode; +} + +// Return the value of the specified attribute. +CString CElementNode::GetAttribute(CString strAttributeName) +{ + _variant_t attribValue = m_element->getAttribute(strAttributeName.GetBuffer(0)); + + if (attribValue.vt == VT_NULL) + return ""; + else + return (char*)_bstr_t(attribValue); +} + +void CElementNode::SetAttribute(CString strAttributeName, CString strAttributeValue) +{ + _variant_t attributeName = strAttributeName; + _variant_t attributeValue = strAttributeValue; + + IXMLDOMAttributePtr attribNode = m_element->getAttributeNode(strAttributeName.GetBuffer(0)); + if (attribNode == NULL) + { + + attribNode = m_element->GetownerDocument()->createAttribute(_bstr_t(attributeName)); + m_element->setAttributeNode(attribNode); + } + + m_element->setAttribute(_bstr_t(attributeName), _bstr_t(attributeValue)); +} + +// The name of the node. +CString CElementNode::GetNodeName() +{ + _bstr_t nodeName = m_element->GetnodeName(); + return (char*)nodeName; +} + +CString CElementNode::GetXML() +{ + _bstr_t xml = m_element->xml; + return (char*)xml; +} \ No newline at end of file diff --git a/mozilla/cck/driver/xmldomhelper.h b/mozilla/cck/driver/xmldomhelper.h new file mode 100644 index 00000000000..a88bdd0fec6 --- /dev/null +++ b/mozilla/cck/driver/xmldomhelper.h @@ -0,0 +1,33 @@ +#ifndef XMLDOMHELPER_H +#define XMLDOMHELPER_H + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + +#import "msxml.dll" +using namespace MSXML; + +// This is a little class for helping to deal with the XML DOM elements. +// It takes care of funny string types and returns everything as CString for +// the class user. +class CElementNode +{ +public: + CElementNode(IXMLDOMElementPtr element); + + CString GetNodeName(); + CString GetChildElementValue(CString strTag); + void SetChildElementValue(CString strTag, CString strValue); + CString GetAttribute(CString strAttributeName); + void SetAttribute(CString strAttributeName, CString strAttributeValue); + CString GetXML(); + IXMLDOMNodePtr AddNode(CString strTag); + BOOL ChildExists(CString strTag); + +protected: + IXMLDOMElementPtr m_element; + +}; + +#endif \ No newline at end of file diff --git a/mozilla/cck/ib/ib.cpp b/mozilla/cck/ib/ib.cpp index b8ce8f162bb..b1dfdf139fc 100644 --- a/mozilla/cck/ib/ib.cpp +++ b/mozilla/cck/ib/ib.cpp @@ -1,3 +1,5 @@ + +// Includes #include "stdafx.h" #include #include @@ -15,6 +17,10 @@ #define CRVALUE 0x0D #define BUF_SIZE 4096 +// for the xml parser used for PrefsTree +#import "msxml.dll" +using namespace MSXML; + // Required disk space for Win build #define WDISK_SPACE 27577549 // Required disk space for Linux build @@ -690,6 +696,122 @@ int ModifyHashedPref(CString HashedPrefsFile, CString PrefName, CString NewPrefV return TRUE; } +// XML DOM helper. Returns the value of a specified child element. +CString GetElementValue(IXMLDOMElementPtr element, CString strTag) +{ + _variant_t value; + + IXMLDOMNodeListPtr prefValNodes = element->getElementsByTagName(strTag.GetBuffer(0)); + if (prefValNodes) + { + IXMLDOMNodePtr prefValNode = prefValNodes->Getitem(0); // should be only one + if (prefValNode) + { + if (prefValNode->childNodes->Getlength() > 0) + value = prefValNode->childNodes->Getitem(0)->GetnodeValue(); // get the text node child, which contains the text we want. + } + } + + return (char*)_bstr_t(value); +} + +// XML DOM helper. Returns the value of the specified attribute. +CString GetAttribute(IXMLDOMElementPtr element, CString strAttributeName) +{ + _variant_t attribValue = element->getAttribute(strAttributeName.GetBuffer(0)); + + if (attribValue.vt == VT_NULL) + return ""; + else + return (char*)_bstr_t(attribValue); +} + +// This processes a prefs tree XML file, adding preferences to install files +// as specified in the prefs tree XML file. See PrefsTree.html for file +// format details. +// +// This function can easily be rewriten to parse the XML file by hand if it +// needs to be ported to a non-MS OS. The XML is pretty simple. +BOOL ProcessPrefsTree(CString strPrefsTreeFile) +{ + + // Create XML DOM instance. + IXMLDOMDocumentPtr prefXMLTree; + HRESULT hr = prefXMLTree.CreateInstance(__uuidof(DOMDocument)); + if (FAILED(hr)) + { + AfxMessageBox("Error creating MS XML DOM.", MB_OK); + return FALSE; + } + + // Load the prefs metadata. This is a representation of the prefs tree as + // it should appear in the tree control. + if (prefXMLTree) + { + CString strPrefsFileURL; + strPrefsFileURL.Format("FILE://%s", strPrefsTreeFile); + + if (!prefXMLTree->load(strPrefsFileURL.GetBuffer(0))) + { + CString strError; + strError.Format("Error loading preferences metadata %s.", strPrefsFileURL); + AfxMessageBox(strError, MB_OK); + prefXMLTree = NULL; + return FALSE; + } + if (prefXMLTree->parseError->errorCode != 0) + { + CString strError; + strError.Format("Bad XML in %s.", strPrefsFileURL); + AfxMessageBox(strError, MB_OK); + prefXMLTree = NULL; + return FALSE; + } + } + + // Go through the list of prefs in the xml and write to prefs file for each one. + IXMLDOMNodeListPtr prefsList = prefXMLTree->getElementsByTagName("PREF"); + for(int i = 0; i < prefsList->length; i++) + { + IXMLDOMElementPtr element = prefsList->Getitem(i); + + CString strPrefName = GetAttribute(element, "prefname"); + CString strPrefType = GetAttribute(element, "type"); + CString strPrefValue = GetElementValue(element, "VALUE"); + CString strLocked = GetElementValue(element, "LOCKED"); + CString strInstallFile = GetElementValue(element, "INSTALLATIONFILE"); + CString strPrefFile = GetElementValue(element, "PREFFILE"); + + if (strPrefName.IsEmpty() || + strPrefType.IsEmpty() || + strInstallFile.IsEmpty() || + strPrefFile.IsEmpty() ) + continue; + + ExtractXPIFile(strInstallFile, strPrefFile); + + BOOL bLocked = (strLocked == "true"); + + // Should go into a hashed file if prefs file is .cfg. + if (strPrefFile.Find(".cfg") > 0) + { + // hashed + ModifyHashedPref(strPrefFile, strPrefName, strPrefValue, strPrefType, bLocked); + + } + else + { + // not hashed + if ((strPrefType == "int") || (strPrefType == "bool") || (strPrefType == "choose")) + ModifyJS2(strPrefFile, strPrefName, strPrefValue, bLocked); + + else // string + ModifyJS(strPrefFile, strPrefName, strPrefValue, bLocked); + + } + } + return TRUE; +} int interpret(char *cmd) @@ -870,7 +992,7 @@ int interpret(char *cmd) ModifyHashedPref(xpifile,entity,newvalue, "string", bLockPref); else if (strcmp(cmdname, "modifyHashedPrefInt") == 0) ModifyHashedPref(xpifile,entity,newvalue, "int", bLockPref); - else if (strcmp(cmdname, "modifyHashedPrefInt") == 0) + else if (strcmp(cmdname, "modifyHashedPrefBool") == 0) ModifyHashedPref(xpifile,entity,newvalue, "bool", bLockPref); else if (strcmp(cmdname, "modifyJS") == 0) ModifyJS(xpifile,entity,newvalue, bLockPref); @@ -893,6 +1015,13 @@ int interpret(char *cmd) else if (strcmp(cmdname, "wrapXPI") == 0) { } + else if (strcmp(cmdname, "processPrefsTree") == 0) + { + + char *prefsTreeFile = strtok(NULL, ",)"); + CString fileWithPath = configPath + "\\" + prefsTreeFile; + ProcessPrefsTree(fileWithPath); + } else return FALSE;//*** We have to handle this condition better.