︙ | | |
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
+
|
TMainForm = class(TForm)
btnSaveGroff: TButton;
btnLoadGroff: TButton;
btnBuild: TButton;
btnDownloadGroffWindows: TButton;
btnSaveSettings: TButton;
chkLogFile: TCheckBox;
chkAutoSaveBuildSettings: TCheckBox;
chkPdfMark: TCheckBox;
chkRefer: TCheckBox;
chkChem: TCheckBox;
chkGrn: TCheckBox;
chkTbl: TCheckBox;
chkPic: TCheckBox;
|
︙ | | |
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
+
|
// Restore the settings
iniStorage.Restore;
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);
chkRefer.Checked := iniStorage.ReadBoolean('BuildUseRefer', False);
chkTbl.Checked := iniStorage.ReadBoolean('BuildUseTbl', False);
|
︙ | | |
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
|
-
+
-
-
|
reGroffStudioVersion := TRegExpr.Create('studio-win ([\d\.]+) (.*)$');
reGroffStudioVersion.ModifierM := True;
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'
MainStatusBar.Panels[2].Text := 'update ' + reGroffStudioVersion.Match[1] + ' available';
else
MainStatusBar.Panels[2].Text := IntToStr(HasVersionUpdate);
end else MainStatusBar.Panels[2].Text := '';
{$ELSE}
// Non-Windows platforms won't need some of that.
{$IFDEF DARWIN}
// What's the latest available version?
MainStatusBar.Panels[2].Text := '';
try
|
︙ | | |
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
|
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
+
-
+
-
+
|
{$ENDIF}
end;
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:
if chkChem.Checked then buildOpts := buildOpts + ' -chem';
if chkEqn.Checked then buildOpts := buildOpts + ' -eqn';
|
︙ | | |
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
|
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
|
+
+
+
-
+
|
end
else outputFileName := currentGroffFilePath + '.ps';
// - 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';
FreeAndNil(BuildWindow);
end;
|
︙ | | |
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
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
|
-
+
+
+
+
+
-
+
+
+
+
+
|
begin
if FileExists(odOpenGroffFile.FileName) then
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;
end;
procedure TMainForm.btnSaveGroffClick(Sender: TObject);
begin
if FileExists(currentGroffFilePath) then
// We don't need to open the Save As box every time.
SynEdit1.Lines.SaveToFile(currentGroffFilePath)
else if sdSaveGroffFile.Execute then
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;
end;
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);
iniStorage.WriteBoolean('BuildUseTbl', chkTbl.Checked);
iniStorage.WriteBoolean('BuildUsePdfMark', chkPdfMark.Checked);
|
︙ | | |