@@ -40,10 +40,11 @@ btnSaveGroff: TButton; btnLoadGroff: TButton; btnBuild: TButton; btnDownloadGroffWindows: TButton; btnSaveSettings: TButton; + chkLogFile: TCheckBox; chkAutoSaveBuildSettings: TCheckBox; chkPdfMark: TCheckBox; chkRefer: TCheckBox; chkChem: TCheckBox; chkGrn: TCheckBox; @@ -170,10 +171,11 @@ storeBuildSettings := iniStorage.ReadBoolean('AutoSaveBuildSettings', False); chkAutoSaveBuildSettings.Checked := storeBuildSettings; if storeBuildSettings then begin + chkLogFile.Checked := iniStorage.ReadBoolean('BuildLogFile', False); cmbMacro.Text := iniStorage.ReadString('BuildChosenMacro', '[ select ]'); chkChem.Checked := iniStorage.ReadBoolean('BuildUseChem', False); chkEqn.Checked := iniStorage.ReadBoolean('BuildUseEqn', False); chkGrn.Checked := iniStorage.ReadBoolean('BuildUseGrn', False); chkPic.Checked := iniStorage.ReadBoolean('BuildUsePic', False); @@ -210,13 +212,11 @@ if reGroffStudioVersion.Exec(OnlineVersionsFile) then begin // Compare the two versions - ours and the online one: GroffHelpers.VerStrCompare(reGroffStudioVersion.Match[1], FileVerInfo.VersionStrings.Values['FileVersion'], HasVersionUpdate); if HasVersionUpdate > 0 then - MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available' - else - MainStatusBar.Panels[2].Text := IntToStr(HasVersionUpdate); + MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available'; end else MainStatusBar.Panels[2].Text := ''; {$ELSE} // Non-Windows platforms won't need some of that. {$IFDEF DARWIN} // What's the latest available version? @@ -296,23 +296,24 @@ procedure TMainForm.btnBuildClick(Sender: TObject); var buildSuccess: Boolean; buildOpts: String; + logFileName: String; outputFileName: String; begin // Reset status display: MainStatusBar.Panels[1].Text := ''; BuildWindow := TBuildStatusWindow.Create(Application); - BuildWindow.ShowModal; + BuildWindow.Show; // Build the parameters: buildOpts := 'groff'; // - Macro: - buildOpts := buildOpts + ' -' + cmbMacro.SelText; + if cmbMacro.SelText <> '' then buildOpts := buildOpts + ' -' + cmbMacro.SelText; // - Enforce UTF-8: buildOpts := buildOpts + ' -Kutf8'; // - Preprocessors: @@ -333,12 +334,15 @@ // - Input file: buildOpts := buildOpts + ' ' + currentGroffFilePath; buildOpts := buildOpts + ' > ' + outputFileName; + // - Log file: + if chkLogFile.Checked then logFileName := currentGroffFilePath + '.log'; + // Build: - buildSuccess := BuildWindow.BuildDocument(buildOpts); + buildSuccess := BuildWindow.BuildDocument(buildOpts, logFileName); if buildSuccess then MainStatusBar.Panels[1].Text := 'build successful' else MainStatusBar.Panels[1].Text := 'build problem'; @@ -363,11 +367,15 @@ begin currentGroffFilePath := odOpenGroffFile.FileName; currentGroffFileName := ExtractFileName(odOpenGroffFile.FileName); SynEdit1.Lines.LoadFromFile(odOpenGroffFile.FileName); - if hasGroff then btnBuild.Enabled := True; + if hasGroff then + begin + btnBuild.Enabled := True; + chkLogFile.Enabled := True; + end; // Display the current file: MainStatusBar.Panels[0].Text := currentGroffFileName; end; end; @@ -382,11 +390,14 @@ begin currentGroffFilePath := sdSaveGroffFile.FileName; currentGroffFileName := ExtractFileName(currentGroffFilePath); SynEdit1.Lines.SaveToFile(sdSaveGroffFile.FileName); - if hasGroff then btnBuild.Enabled := True; + if hasGroff then begin + btnBuild.Enabled := True; + chkLogFile.Enabled := True; + end; end; // Remove the "Changed" mark: MainStatusBar.Panels[0].Text := currentGroffFileName; unsavedChanges := False; @@ -394,10 +405,11 @@ procedure TMainForm.btnSaveSettingsClick(Sender: TObject); begin // Store the build settings: iniStorage.WriteString('BuildChosenMacro', cmbMacro.Text); + iniStorage.WriteBoolean('BuildLogFile', chkLogFile.Checked); iniStorage.WriteBoolean('BuildUseChem', chkChem.Checked); iniStorage.WriteBoolean('BuildUseEqn', chkEqn.Checked); iniStorage.WriteBoolean('BuildUseGrn', chkGrn.Checked); iniStorage.WriteBoolean('BuildUsePic', chkPic.Checked); iniStorage.WriteBoolean('BuildUseRefer', chkRefer.Checked);