support for direct debug output

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@16084 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Joost Verburg 2006-11-27 22:56:56 +00:00
parent ee631de7c6
commit 859e121079

View File

@ -5,17 +5,19 @@ Author: Joost Verburg
This will be installed as lyx.exe.
The application will setup the environment variables and geometry based
on registry settings and obtain the command line output of lyxc.exe,
which can be shown in case of a crash. Version information and an icon are
also included.
The application will setup the environment variables and geometry based on
registry settings and obtain the command line output of lyxc.exe, which can be
shown while debugging or in case of a crash. Version information and an icon
are also included.
*/
!include "MUI.nsh"
!include "LogicLib.nsh"
!include "FileFunc.nsh"
!include "StrFunc.nsh"
!insertmacro GetParameters
${StrStr}
!include "..\packaging\installer\settings.nsh" ;Version info from installer
@ -23,16 +25,25 @@ Caption "${APP_NAME} ${APP_VERSION}"
OutFile lyx.exe
BrandingText " "
;--------------------------------
;Variables
Var Parameters
Var Debug
Var LyXLanguage
Var Geometry
Var ReturnValue
Var ResultText
Var ResultSubText
;--------------------------------
;User interface for debug output
!define MUI_ICON "..\packaging\icons\lyx_32x32.ico"
!define MUI_CUSTOMFUNCTION_GUIINIT InitInterface
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT "Error Information"
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT "See Chapter 3 of the LyX Introduction \
(Help > Introduction) for information about reporting this issue."
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT $ResultText
!define MUI_INSTFILESPAGE_FINISHHEADER_SUBTEXT $ResultSubText
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_LANGUAGE English
@ -49,14 +60,6 @@ ShowInstDetails show
!define SM_CXSIZEFRAME 32
!define SM_CYSIZEFRAME 33
;--------------------------------
;Variables
Var Parameters
Var LyXLanguage
Var Geometry
Var ReturnValue
;--------------------------------
;Version information
@ -89,11 +92,21 @@ VIAddVersionKey /LANG=${LANG_ENGLISH} "LegalCopyright" "${APP_COPYRIGHT}"
Section -Prepare
${if} $Debug == ${FALSE}
HideWindow
${endif}
;Command line parameters
Call GetParameters
Pop $Parameters
;Hide controls we don't need
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1004
ShowWindow $R0 ${SW_HIDE}
;Debug info
!insertmacro MUI_HEADER_TEXT "Debugging LyX" "The events you have chosen \
are being logged."
SetDetailsPrint textonly
DetailPrint "Debug log:"
SetDetailsPrint listonly
;LyX Language
!insertmacro GetLyXSetting "Language" $LyXLanguage
@ -172,6 +185,8 @@ SectionEnd
Section -Debug
${if} $Debug == ${FALSE}
;Check whether something went wrong
${if} $ReturnValue == "error"
@ -198,33 +213,61 @@ Section -Debug
debug:
;The interface with debug information will be shown
SetDetailsPrint textonly
DetailPrint "The following details are available about the error:"
SetDetailsPrint none
;Hide controls we don't need
FindWindow $R0 "#32770" "" $HWNDPARENT
GetDlgItem $R0 $R0 1004
ShowWindow $R0 ${SW_HIDE}
${endif}
${if} $ReturnValue != 0
StrCpy $ResultText "Error Information"
StrCpy $ResultSubText "See Chapter 3 of the LyX Introduction \
(Help > Introduction) for information about reporting this issue."
${else}
StrCpy $ResultText "Debugging Completed"
StrCpy $ResultSubText "The events you have chosen are logged below."
${endif}
${if} $Debug == ${FALSE}
;Put the log window on the screen again
Push "user32::SetWindowPos(i $HWNDPARENT, i 0, i 133, i 100, i 0, i 0, i ${SWP_NOSIZE})"
CallInstDLL "$EXEDIR\System.dll" Call
BringToFront
${endif}
SectionEnd
;--------------------------------
;Functions
Function InitInterface
;Command line parameters
Call GetParameters
Pop $Parameters
;Check for debug mode
${StrStr} $R0 $Parameters "-dbg"
${if} $R0 == ""
StrCpy $Debug ${FALSE}
${else}
StrCpy $Debug ${TRUE}
${endif}
${if} $Debug == ${FALSE}
;Keep the log window outside the screen to ensure that there will be no flickering
Push "user32::SetWindowPos(i $HWNDPARENT, i 0, i -32000, i -32000, i 0, i 0, i ${SWP_NOSIZE})"
CallInstDLL "$EXEDIR\System.dll" Call
${endif}
FunctionEnd
Function GetLyXSetting