From 92029c855827bd8039fffd544b8794b883d2737d Mon Sep 17 00:00:00 2001 From: joostverburg Date: Sun, 15 Dec 2002 20:29:28 +0000 Subject: [PATCH] new documentation git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1957 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/InstallOptions/Changelog.txt | 81 +++ Contrib/InstallOptions/Install Options.html | 429 ---------------- Contrib/InstallOptions/Readme.html | 523 ++++++++++++++++++++ 3 files changed, 604 insertions(+), 429 deletions(-) create mode 100644 Contrib/InstallOptions/Changelog.txt delete mode 100644 Contrib/InstallOptions/Install Options.html create mode 100644 Contrib/InstallOptions/Readme.html diff --git a/Contrib/InstallOptions/Changelog.txt b/Contrib/InstallOptions/Changelog.txt new file mode 100644 index 00000000..a8ec79f0 --- /dev/null +++ b/Contrib/InstallOptions/Changelog.txt @@ -0,0 +1,81 @@ +DLL version 2.0 (12/14/2002) +* Supports custom font and DPI settings (by Joost Verburg) +* INI files should contain dialog units now, no pixels (by Joost Verburg) +* RESIZETOFIT flag for Bitmap control (by Amir Szekely) +* New documentation (by Joost Verburg) + +DLL version 1.7 beta (11/2/2002) +* Added initDialog and show DLL functions + +DLL version 1.6 beta (9/30/2002) +* CancelConfirmIcon becomes CancelConfirmFlags and can now take the other common MessageBox flags + +DLL version 1.5 beta (9/26/2002) +* Made close [x] button behave like Cancel (thanks brainsucker) + +DLL version 1.4 beta (9/4/2002) +* Added Icon and Bitmap controls (by Amir Szekely) + +DLL version 1.3 beta (8/15/2002) +* Added CancelShow (by ORTIM) +* Added pixel transformation for widgets (by ORTIM) + +DLL version 1.2 beta (7/31/2002) +* Added CancelEnabled (by ORTIM) +* Added CancelConfirmCaption and CancelConfirmIcon (by Amir Szekely) + +DLL version 1.1 beta (7/22/2002) +* Font is now taken from the main NSIS window (by Amir Szekely) + +DLL version 1.0 beta (12/16/2001) +* Moved to DLL, no longer need parentwnd ini writing +* Tons of changes - no longer fully compatible (see source for a big list) +* removed support for silent installers (it seems the old version would bring up it's own dialog) + +version 1.4 (11/18/2001) +* Added Listbox controls. +* Added MULTISELECT flag. +* Made the HWND list for the parent window controls dynamically allocated. This prevents a crash if NSIS ever gets more than 150 controls on it's main window. +* The TEXT property of DirRequest control can be used to specify an initial directory. The current directory is automatically selected when clicking the browse button of the DirRequest control. +* Added ROOT property to DirRequest which can be used to set the root directory (mostly due to felfert) +* Edit controls will now auto scroll (thanks felfert) +* Fixed a problem where the window wouldn't draw properly on some systems (thanks felfert) + +version 1.3 (11/03/2001) +* Got rid of the call to RedrawWindow() because it's no longer needed with the WS_CLIPCHILDREN flag for NSIS. +* Removed a few hardcoded limits of buffer sizes +* Added Checkbox and RadioButton controls +* Added RIGHT and CHECKED flags + +version 1.2.2 (10/30/2001) +* Additional size reductions. Further reduced the size down to 8k. +* The text parameter to a combobox can now be used to specify the initial value +* Changed from InvalidateRect() to RedrawWindow() to force a redraw after a browse dialog +* On startup, set the flags of the NSIS window to include WS_CLIPCHILDREN. Otherwise, our controls don't get drawn right. + +version 1.2.1 (10/28/2001) +* Bug fix. ControlID for the caption and the OK button were reused by the first two controls. (Thanks Schultz) + +version 1.2j (10/28/2001) +* 8.5kb from 44kb. heh. (by Justin Frankel) + +version 1.2 (10/28/2001) +* Still 44k +* Added the "FileRequest" and "DirRequest" control types (thanks Schultz) +* Added "MinLen", "MaxLen", and "ValidateText" properties to fields +* Added "Flags" as a way to specifiy additional parameters for controls +* Few more changes to the documentation +* Cleaned the code in a few places...still trying to make it smaller + +version 1.1 (10/27/2001) +* Added the "Title" option (thanks Alex) +* Moved the OK button so it is in the same location as the buttons on the main NSIS window (thanks Alex) +* Pressing "ENTER" will now automatically select the OK button (thanks Alex) +* Slightly improved the documentation + +version 1.01 (10/25/2001) +* Fixed the SetFocus loop so it exits after the first control like it was supposed to +* Added the license to the documentation + +version 1.0 (10/25/2001) +* Barely qualifies as a distribution \ No newline at end of file diff --git a/Contrib/InstallOptions/Install Options.html b/Contrib/InstallOptions/Install Options.html deleted file mode 100644 index 84b717ec..00000000 --- a/Contrib/InstallOptions/Install Options.html +++ /dev/null @@ -1,429 +0,0 @@ -Install Options/DLL Documentation - -
Install -Options (/DLL)
Copyright © 2001 Michael -Bishop (original version) and Nullsoft, Inc. (DLL conversion and integration) -
- -
-Introduction:
Installer Options was a quick -application Michael Bishop threw together so he could prompt the user for some information -during the install process. This version is a highly modified version of it that is designed -as a NSIS extension DLL for the
NSIS installer. Installer Options will create a -dialog box which will be displayed inside of the NSIS window. The dialog box is -defined by an INI file, which allows you to define the layout of controls by -changing the INI file. -

Using the new NSIS 2 plugin system, you don't have to worry about extracting and removing -the DLL anymore. You can also use the Plugins directory to store the INI files. The contents -of the directory will be removed when the installer is being closed. - -Example:

-	;Extract INI File to Plugins directory
-	InitPluginsDir
-	File /oname=$PLUGINSDIR\test.ini test.ini
-	
-	InstallOptions::dialog $PLUGINSDIR\test.ini
-	Pop $0
-	; ($0 would be "success" "cancel" "back" or some other value on error)
-
-	ReadINIStr $1 $R0 "Field 1" State ; $1 = Field #1's state
-
-It is often very useful to call InstallOptions from a NSIS custom page callback function. -
-INI File Settings: -

The INI file has one required section. This section includes the number of controls to -be created as well as general window attributes. The INI file also includes a variable number -of Field sections which are used to create the controls to be displayed. -

The required section is named "Settings". It will contain the -following values: -

-

Each field section has the heading "Field #" where # must be sequential -numbers from 1 to NumFields. Each Field section contains the following values: -

-
-
Fonts and colors: -

InstallOptions supports the new UI enhancements in the new NSIS 2. To support them, -InstallOptions now has two new functions, initDialog, and show. -The first creates the dialog but doesn't show it. It pushes the HWND of the custom dialog to the stack. -To get the HWND of any of the controls use:

-

	GetDlgItem (output var) (hwnd of the custom dialog) (1200 + field number - 1)
-To finally show the tweaked dialog use the show function. - -Here is a little example: -
-	# we don't want the DLL to unload so it will remember
-	# our ini file when we are trying to show it
-	InstallOptions::initDialog /NOUNLOAD file.ini
-	Pop $0
-	IntCmp $0 0 error
-		; $0 is now the IO dialog HWND
-		; use getdlgitem with it and sendmessage
-		GetDlgItem $1 $0 1200 ; 1200 + field number - 1
-		; $1 is now the HWND of the first field
-		CreateFont $2 "Tahoma" 10 700 
-		SendMessage $1 ${WM_SETFONT} $2 0
-		InstallOptions::show
-		Pop $0
-		StrCmp $0 "success" done
-		StrCmp $0 "back" done
-		StrCmp $0 "cancel" done
-	error:
-		MessageBox MB_OK|MB_ICONSTOP "IO error: $0"
-		Quit
-	done:
-
-
History: -

-

-
-
  Copyright © 2001 Michael Bishop
-  Portions Copyright © 2001 Nullsoft, Inc.
-
-  This software is provided 'as-is', without any express or implied
-  warranty.  In no event will the authors be held liable for any damages
-  arising from the use of this software.
-
-  Permission is granted to anyone to use this software for any purpose,
-  including commercial applications, and to alter it and redistribute it
-  freely, subject to the following restrictions:
-
-  1. The origin of this software must not be misrepresented; you must not
-     claim that you wrote the original software. If you use this software
-     in a product, an acknowledgment in the product documentation would be
-     appreciated but is not required.
-  2. Altered source versions must be plainly marked as such, and must not be
-     misrepresented as being the original software.
-  3. This notice may not be removed or altered from any source distribution.
-
diff --git a/Contrib/InstallOptions/Readme.html b/Contrib/InstallOptions/Readme.html new file mode 100644 index 00000000..2e220278 --- /dev/null +++ b/Contrib/InstallOptions/Readme.html @@ -0,0 +1,523 @@ + + + + +InstallOptions 2 + + + + + + + + + +
+ + +
+ + + + + + + + +

InstallOptions 2

+

Introduction

+

InstallOptions is a NSIS plugin which allows you to create custom +pages for NSIS installers, to prompt the user for extra information.

+

InstallerOptions will create a dialog which will be displayed inside +the NSIS window. The controls on the dialog can be defined in an INI file.

+

NSIS 2 has a new page system, which allows you to add custom pages +to your installer without messing with Prev/Next functions. With the new plugin +system, you also don't have to worry anymore about extracting and deleting the DLL +file. When you store the INI files in the plugins directory, NSIS will also delete +them automatically.

+

This new version of InstallOptions has been designed for NSIS 2. +It supports customized user interfaces and custom font and DPI settings.

+

INI File

+

The INI file has one required section. This section includes the +number of controls to be created as well as general window attributes. +The INI file also includes a variable number of Field sections which are used to +create the controls to be displayed.

+

The required section is named "Settings". +It can contain the following values:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NumFields(required)The number of control elements to be + displayed on the dialog window.
Title(optional)If specified, gives the text to set the + titlebar to. Otherwise, the titlebar text is not changed.
CancelEnabled(optional)If specified, overrides NSIS settings and enables or disables the cancel button. + If set to 1, the cancel button will be enabled. If set to 0, the cancel button will be disabled.
CancelShow(optional)If specified, overrides NSIS settings and shows or hides the cancel button + If set to 1, the cancel button will be shown. If set to 0, the cancel button will be hidden.
BackEnabled(optional)If specified, overrides NSIS settings and enables or disables the back button. + If set to 1, the back button will be enabled. If set to 0, the back button will be disabled.
CancelButtonText(optional)Overrides the text for the cancel button. If not specified, the cancel button + text will not be changed. Recommended value: "Cancel"
NextButtonText(optional)Overrides the text for the next button. If not specified, the next button text + will not be changed. Recommended value: "Next >"
BackButtonText(optional)Overrides the text for the back button. If not specified, the back button text + will not be changed. Recommended value: "< Back"
Rect(optional)Overrides the default rect ID to run over. This will make IO resize itself + according to a different rect than NSIS's dialogs rect.
+

Each field section has the heading "Field #" where # must be sequential +numbers from 1 to NumFields. Each Field section can contain the following values:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Type(required)Type of control to be created. Valid + values are "Label", "Text", + "Password", "Combobox", + "DropList", "Listbox", + "CheckBox", "RadioButton", + "FileRequest", "DirRequest" + "Icon" or "Bitmap",.

A + "Label" is used to display static text. (i.e. a caption for a + textbox)
A "Textbox" and "Password" + accept text input from the user. "Password" masks the input + with * characters.
A "Combobox" allows the user to type text + not in the popup list, a "Droplist" only allows selection of + items in the list.
A "listbox" shows multiple items and can + optionally allow the user to select more than one item.
A + "CheckBox" control displays a check box with label.
+ A "RadioButton" control displays a radio button with label.
+ A "FileRequest" control displays + a textbox and a browse button. Clicking the browse button will display a + file requester where the user can browse for a file.
A + "DirRequest" control displays a textbox and a browse button. + Clicking the browse button will display a directory requester where the + user can browse for a directory.
+ "Icon" control displays an icon. + Use no Text to use the installer icon.
+ "Bitmap" control displays a bitmap.
Text(optional)Specifies the caption of a label, checkbox, or radio button control. + For icon and bitmaps control this specifies the path to the image.

+ Note: \r\n will be replaced by a newline. +
State(optional)Specifies the state of the control. This is updated when the user + closes the window, so you can read from it from NSIS. For edit texts and dir and file + request boxes, this is the string that is specified. For radio button and check boxes, + this can be '0' or '1' (for unchecked or checked). +
ListItems(optional)A list of items to display in a combobox, + droplist, or listbox.
This is a single line of text with each item + separated by a pipe character '|'
MaxLen(optional)Causes validation on the selected control + to limit the maximum length of text.
If the user specifies more text + than this, a message box will appear when they click "OK" and the dialog + will not be dismissed.
You should not use this on a + "combobox" since the user can not control what is + selected.
This should be set to a maximum of 260 + for "FileRequest" and "DirRequest" + controls.
Ignored on "label" + controls.
MinLen(optional)Causes validation on the selected control + to force the user to enter a minimum amount of text.
If the user + specifies less text than this, a message box will appear when they click + "OK" and the dialog will not be dismissed.
Unlike MaxLen, this is + useful for "Combobox" controls. + By setting this to a value of "1" the program will force the user to + select an item.
Ignored on "Label" + controls.
ValidateText(optional)If a particular field fails the test for + "MinLen" or "MaxLen", + a messagebox will be displayed with this text.

+ Note: The only formatting performed on this text is "\n" will be + replaced with a newline in the messagebox.
Left
Right
Top
Bottom
(required)The position on the dialog where this + control appears.
Sorry, no GUI here to help you.

+ Note: For combobox or droplist, the + "bottom" value is not used in the + same way.
In this case, the bottom value is the maximum + size of the window when the pop-up list is being displayed. All other + times, the combobox is automatically szed to be one element tall. If you + have trouble where you can not see the combobox drop-down, then check + the bottom value and ensure it is large enough.

+ Note (2): + FileRequest and DirRequest controls will allocate 20 pixels to the + browse button. Make this control wide enough the contents of the textbox + can be seen. Note that you can specify negative coordinates to specify the + distance from the right or bottom edge.
Filter(optional)Specifies the filter to be used in the + "FileRequest" control.
This is constructed + by putting pairs of entries together, each item seperated by a | character. +
The first value in each pair is the text to display for the filter. +
The second value is the pattern to use to match files.
+ For example, you might specify:
+ Filter=Text Files|*.txt|Programs|*.exe;*.com|All Files|*.*
+ If not specified, then the filter defaults to All + Files|*.*

Note: you should not put + any extra spaces around the | characters.
Root(optional)Used by DirRequest controls to + specify the root directory of the search. By default, this allows the + user to browse any directory on the computer. This will limit the search + to a particular directory on the system.
Flags(optional)This specifies additional flags for the + display of different controls. Each value should be seperated by a | + character, and you should be careful not to put any spaces around the | + character.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ValueMeaning
REQ_SAVEThis causes "FileRequest" + controls to display a Save As dialog. If not specified, an Open dialog + is used.
FILE_MUST_EXISTUsed by "FileRequest" to + determine if the selected file must exist.
This only applies + if an "Open" dialog is being displayed.
This currently does not force + the file to exist other than through the browse button.
FILE_EXPLORERUsed by "FileRequest", + enables new file request look (recommended)
FILE_HIDEREADONLYUsed by "FileRequest", + hides "open read only" checkbox in open dialog.
WARN_IF_EXISTUsed by "FileRequest" + to display a warning message if the selected file already exists.
+ The warning message is only displayed for files selected with the + browse button.
PATH_MUST_EXISTUsed by "FileRequest" + to force the path to + exist. Prevents the user from typing a non-existant path into the + browse dialog window.
This only validates path's + selected with the browse button.
PROMPT_CREATEUsed by "FileRequest" + to display a warning + if the selected file does not exist. However, it still allows the + user to select the file.
This only displays the + warning for files selected with the browse button.
RIGHTUsed by "Checkbox" + and "Radiobutton" controls to specify you + want the checkbox to the right of the text instead of the left as is + the default.
MULTISELECTUsed by "Listbox" + controls to specify if more than item may be selected. If this flag + is not specified,only one item may be selected from the list.
RESIZETOFITThis causes "Bitmap" + controls to resize the image to the size of the control. + Also useful to support custom DPI settings.
+

How to use

+

Modern UI

+

For information about using InstallOptions with +the Modern UI, have a look at the +Modern UI documentation.

+

Extract the INI File

+

First, you have to extract the INI files for the dialogs +in the .onInit function: +

+Function .onInit
+
+  InitPluginsDir
+  File /oname=$PLUGINSDIR\test.ini test.ini
+  
+FunctionEnd
+
+

Call the DLL

+

You can call InstallOptions in a page function, +check the NSIS documentation +for information about the page system. +

The InstallOptions DLL has three functions:

+
    +
  • dialog - Creates the dialog immidiately +
  • initDialog - Creates the in dialog memory, does not show it +
  • show - Shows a dialog created in memory +
+

Usually, you only need to use the dialog function:

+
+Function FunctionName ;FunctionName defined with Page command
+
+  ;Display the Install Options dialog
+
+  Push $R0
+
+  InstallOptions::dialog $PLUGINSDIR\test.ini
+  Pop $R0
+
+FunctionEnd
+
+

Get the output

+

In most cases, you will need the output from the INI File +in a section. Get it using ReadINIStr:

+
+ReadINIStr $R0 "$PLUGINSDIR\test.ini" "Field 1" "State"
+
+

Fonts and colors

+

If you want to use custom fonts or colors on your InstallOptions +dialogs, you should use the initDialog and show functions. initDialog creates the +dialog in memory, but does not show it. After calling initDialog, you can set +the fonts and colors, and call show to show the dialog. + +initDialog pushes the HWND of the custom dialog to the stack. To get the HWND +of the controls use:

+
+GetDlgItem (output var) (hwnd of the custom dialog) (1200 + Field number - 1)
+
+

Example of using a custom font:

+
+Function FunctionName ;FunctionName defined with Page command
+
+  ;Display the Install Options dialog
+
+  Push $R0
+  Push $R1
+  Push $R2
+
+    InstallOptions::initDialog $PLUGINSDIR\test.ini
+    Pop $R0
+    
+    GetDlgItem $R1 $R0 1200 ;1200 + Field number - 1
+    
+    ;$R1 contains the HWND of the first field
+    CreateFont $R2 "Tahoma" 10 700 
+    SendMessage $R1 ${WM_SETFONT} $R2 0
+	
+    InstallOptions::show
+	
+  Pop $R1
+  Pop $R1
+  Pop $R0
+
+FunctionEnd
+
+

Version history

+
    +
  • DLL version 2.0 (12/14/2002) +
      +
    • Supports custom font and DPI settings (by Joost Verburg)
    • +
    • INI files should contain dialog units now, no pixels (by Joost Verburg)
    • +
    • RESIZETOFIT flag for Bitmap control (by Amir Szekely)
    • +
    • New documentation (by Joost Verburg)
    • +
    +
  • +
+

Complete version history

+

Credits

+

Original version by Michael Bishop
+ DLL version by Nullsoft, Inc.
+ DLL version 2 by Amir Szekely, ORTIM, Joost Verburg
+ New documentation by Joost Verburg

+

License

+
Copyright © 2002 Michael Bishop
+
+Portions Copyright © 2002:
+- Nullsoft, Inc.
+- Amir Szekely
+- ORTIM
+- Joost Verburg
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute
+it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; 
+   you must not claim that you wrote the original software.
+   If you use this software in a product, an acknowledgment in the
+   product documentation would be appreciated but is not required.
+2. Altered versions must be plainly marked as such,
+   and must not be misrepresented as being the original software.
+3. This notice may not be removed or altered from any distribution.
+
+
+
+
+ + + \ No newline at end of file