groffstudio

Diff
Login

Diff

Differences From Artifact [ac546c0910]:

To Artifact [ab132a4429]:


392
393
394
395
396
397
398

399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423







424
425
426
427
428
429
430
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418






419
420
421
422
423
424
425
426
427
428
429
430
431
432







+



















-
-
-
-
-
-
+
+
+
+
+
+
+







{$ENDIF}
end;

procedure TMainForm.btnBuildClick(Sender: TObject);
var
  buildSuccess: boolean;
  buildOpts: string;
  preproc: string;
  logFileName: string = '';
  outputFileName: string;
begin
  // Reset status display:
  MainStatusBar.Panels[1].Text := '';

  BuildWindow := TBuildStatusWindow.Create(Application);
  BuildWindow.Show;

  // Build the parameters:
  buildOpts := 'groff';

  // - Macro:
  if LeftStr(cmbMacro.Text, 1) = 'm' then buildOpts := buildOpts + ' -' + cmbMacro.Text;

  // - Enforce UTF-8:
  buildOpts := buildOpts + ' -Kutf8';

  // - Preprocessors:
  if chkBoxPreprocessors.Checked[0] then  buildOpts := buildOpts + ' -chem';
  if chkBoxPreprocessors.Checked[1] then  buildOpts := buildOpts + ' -eqn';
  if chkBoxPreprocessors.Checked[2] then  buildOpts := buildOpts + ' -grn';
  if chkBoxPreprocessors.Checked[3] then  buildOpts := buildOpts + ' -pic';
  if chkBoxPreprocessors.Checked[4] then  buildOpts := buildOpts + ' -refer';
  if chkBoxPreprocessors.Checked[5] then  buildOpts := buildOpts + ' -tbl';
  if chkBoxPreprocessors.Checked[0] then  preproc := preproc + 'chem | ';

  if chkBoxPreprocessors.Checked[1] then  buildOpts := buildOpts + ' -e';   // eqn
  if chkBoxPreprocessors.Checked[2] then  buildOpts := buildOpts + ' -g';   // grn
  if chkBoxPreprocessors.Checked[3] then  buildOpts := buildOpts + ' -p';   // pic
  if chkBoxPreprocessors.Checked[4] then  buildOpts := buildOpts + ' -R';   // refer
  if chkBoxPreprocessors.Checked[5] then  buildOpts := buildOpts + ' -t';   // tbl

  if chkBoxExtras.Checked[0] then  buildOpts := buildOpts + ' -mhdtbl';

  // - PDF-specifics:
{$IFNDEF WINDOWS}
  // On Windows, we use a two-step program:
  // 1) Output to PostScript,
444
445
446
447
448
449
450

451
452
453
454
455
456
457
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460







+







  buildOpts := buildOpts + ' ' + currentGroffFilePath;
  buildOpts := buildOpts + ' > ' + outputFileName;

  // - Log file:
  if chkLogFile.Checked then logFileName := currentGroffFilePath + '.log';

  // Build:
  buildOpts := preproc + buildOpts;
  buildSuccess := BuildWindow.BuildDocument(buildOpts, logFileName);

{$IFDEF WINDOWS}
  if buildSuccess and hasGhostscript and rdPdf.Checked then
{$ELSE}
  // On non-Windows systems, Ghostscript is entirely optional.
  if buildSuccess and hasGhostscript and chkUseGhostscript.Checked and rdPdf.Checked then