Added new options page to the NSIS installer.

The supplied (default) 'tuxpaint.cfg' is now empty, but is safely appended
to by the NSIS script. NSIS now has a Mode (Windowed|Full-Screen) and a
Resolution (640x480|800x600) option which append the following lines to
'tuxpaint.cfg':

fullscreen=$mode
nofancycursors=$mode
800x600=$res
[Where $mode and $res are "yes"|"no".]

The added file 'options.ini' contains the GUI layout for the new page.
This commit is contained in:
John Popplewell 2004-09-28 02:39:03 +00:00
parent 32620562c8
commit 5dc92570f3
3 changed files with 112 additions and 16 deletions

59
visualc/options.ini Normal file
View file

@ -0,0 +1,59 @@
[Settings]
NumFields=6
[Field 1]
Type=LABEL
Text=" Start Tux Paint with these options: "
Left=0
Right=-1
Top=0
Bottom=35
[Field 2]
Type=GroupBox
Left=50
Right=-50
Top=36
Bottom=78
Text=" Display: "
[Field 3]
Type=LABEL
Text=Mode:
Left=58
Right=100
Top=46
Bottom=55
State=1
Flags=NOTABSTOP
[Field 4]
Type=DROPLIST
ListItems=Windowed|Full-Screen
State=Full-Screen
Left=115
Right=-55
Top=44
Bottom=80
Flags=NOTABSTOP
[Field 5]
Type=LABEL
Text=Resolution:
Left=58
Right=100
Top=62
Bottom=71
State=1
Flags=NOTABSTOP
[Field 6]
Type=DROPLIST
ListItems=640x480|800x600
State=800x600
Left=115
Right=-55
Top=60
Bottom=96
Flags=NOTABSTOP

View file

@ -1,3 +0,0 @@
fullscreen=no
nofancycursors=no

View file

@ -1,7 +1,7 @@
# vim: noai et ts=4 tw=0 # vim: noai et ts=4 tw=0
# with a few tiny modifications by Phil Harper(philh@theopencd.org) # with a few tiny modifications by Phil Harper(philh@theopencd.org)
!define PKG_VERSION "0.9.14-rc3" !define PKG_VERSION "0.9.14-rc4"
!define PKG_PREFIX "tuxpaint" !define PKG_PREFIX "tuxpaint"
!define APP_PREFIX "TuxPaint" !define APP_PREFIX "TuxPaint"
@ -9,6 +9,8 @@
!define APP_CFG_EXE "${APP_PREFIX}-config.exe" !define APP_CFG_EXE "${APP_PREFIX}-config.exe"
!define APP_NAME "Tux Paint" !define APP_NAME "Tux Paint"
!define TEMP1 $R0 ;Temp variable
SetCompressor lzma SetCompressor lzma
OutFile "${PKG_PREFIX}-${PKG_VERSION}-win32-installer.exe" OutFile "${PKG_PREFIX}-${PKG_VERSION}-win32-installer.exe"
Name "${APP_NAME}" Name "${APP_NAME}"
@ -42,15 +44,39 @@ AllowRootDirInstall false
# Install page stuff # Install page stuff
InstProgressFlags smooth InstProgressFlags smooth
AutoCloseWindow true AutoCloseWindow false
# Put plugin files used by the installer at the start of the archive
ReserveFile "${NSISDIR}\Plugins\InstallOptions.dll"
ReserveFile "options.ini"
Var FullscreenMode ; start TP in full-screen or windowed mode
Var Resolution ; resolution 800x600 or 640x480
Page license
Page components
Page custom SetOptions ValidateOptions ": Runtime Options" ;Custom page.
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section Section
SetOutPath $INSTDIR SetOutPath $INSTDIR
File "release\${APP_EXE}" File "release\${APP_EXE}"
File "..\..\tuxpaint-config\visualc\release\${APP_CFG_EXE}" File "..\..\tuxpaint-config\visualc\release\${APP_CFG_EXE}"
File "release\*.dll" File "release\*.dll"
File "tuxpaint.cfg" File "tuxpaint.cfg"
FileOpen $0 "tuxpaint.cfg" "a"
FileSeek $0 0 END
FileWrite $0 "fullscreen=$FullscreenMode$\r$\n"
FileWrite $0 "nofancycursors=$FullscreenMode$\r$\n"
FileWrite $0 "800x600=$Resolution$\r$\n"
FileClose $0
!include "filelist.inc" !include "filelist.inc"
SetOutPath $INSTDIR\locale SetOutPath $INSTDIR\locale
File /r "locale\*.*" File /r "locale\*.*"
SetOutPath $INSTDIR\userdata SetOutPath $INSTDIR\userdata
@ -62,7 +88,6 @@ Section
WriteUninstaller "uninstall.exe" WriteUninstaller "uninstall.exe"
SectionEnd SectionEnd
Section "Start Menu Shortcuts" Section "Start Menu Shortcuts"
SetOutPath $INSTDIR SetOutPath $INSTDIR
CreateDirectory "$SMPROGRAMS\${APP_NAME}" CreateDirectory "$SMPROGRAMS\${APP_NAME}"
@ -74,7 +99,6 @@ Section "Start Menu Shortcuts"
CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Remove ${APP_NAME}" CreateShortCut "$SMPROGRAMS\${APP_NAME}\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 "" "" "Remove ${APP_NAME}"
SectionEnd SectionEnd
Section "Desktop Shortcut" Section "Desktop Shortcut"
SetOutPath $INSTDIR SetOutPath $INSTDIR
CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 "" "" "Create a picture with ${APP_NAME}" CreateShortCut "$DESKTOP\${APP_NAME}.lnk" "$INSTDIR\${APP_EXE}" "" "$INSTDIR\${APP_EXE}" 0 "" "" "Create a picture with ${APP_NAME}"
@ -85,17 +109,33 @@ Section "View README"
ExecShell "open" "docs\html\README.html" ExecShell "open" "docs\html\README.html"
SectionEnd SectionEnd
;Function .onInstSuccess Function SetOptions
; BringToFront Push ${TEMP1}
; MessageBox MB_YESNO|MB_ICONQUESTION \ InstallOptions::dialog "$PLUGINSDIR\options.ini"
; "${APP_NAME} was installed. Would you like to run ${APP_NAME} now ?" \ Pop ${TEMP1}
; IDNO NoExec Pop ${TEMP1}
; Exec '$INSTDIR\${APP_EXE}' FunctionEnd
; NoExec:
;FunctionEnd Function ValidateOptions
StrCpy $FullscreenMode "yes"
ReadINIStr ${TEMP1} "$PLUGINSDIR\options.ini" "Field 4" "State"
StrCmp ${TEMP1} "Full-Screen" skip01
StrCpy $FullscreenMode "no"
skip01:
StrCpy $Resolution "yes"
ReadINIStr ${TEMP1} "$PLUGINSDIR\options.ini" "Field 6" "State"
StrCmp ${TEMP1} "800x600" skip02
StrCpy $Resolution "no"
skip02:
FunctionEnd
; init custom page
Function .onInit
InitPluginsDir
File /oname=$PLUGINSDIR\options.ini "options.ini"
FunctionEnd
; uninstall stuff ; uninstall stuff
UninstallText "This will uninstall ${APP_NAME}. Hit 'Uninstall' to continue." UninstallText "This will uninstall ${APP_NAME}. Hit 'Uninstall' to continue."
; special uninstall section. ; special uninstall section.