groffstudio

Check-in [a21e9e8fc9]
Login

Check-in [a21e9e8fc9]

Overview
Comment:[Feature] The update check was made optional (default: false).
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: a21e9e8fc9d4476457bf5bab75c66f8359a6f0def88c4d07c4d69d57be44b456
User & Date: Cthulhux on 2022-03-12 11:17:53
Other Links: manifest | tags
Context
2022-03-13
19:29
[Changed] On platforms which probably use a package manager (currently, Linux and BSDs), the "update check" checkbox is disabled and the related libraries are not referenced. [Improved] When exiting groffstudio, the Save function from the "save" button is reused. check-in: f7adaf4d43 user: Cthulhux tags: trunk
2022-03-12
11:17
[Feature] The update check was made optional (default: false). check-in: a21e9e8fc9 user: Cthulhux tags: trunk
2022-03-10
17:08
Rearranged the build options panel so it won't look as misaligned as it actually was. check-in: d18bcebca9 user: Cthulhux tags: trunk
Changes

Modified CHANGES.txt from [c850d28f3b] to [34c632ec7b].

1


2

3

4
5
6
7
8
9
10

1
2
3
4
5
6
7
8
9
10
11
12
13
-
+
+

+

+







Version [next]
Version 0.11.0
2022-03-12

[Feature] The update check was made optional (default: false).
[Changed] Rearranged the build options panel so it won't look as misaligned as it actually was.
[Changed] The required SSL libraries are shipped with the Windows package now.

-------------------------------

Version 0.10.1
2022-03-10

[Bugfix] When editing an unsaved document, the status panel will (correctly) display "[unsaved file]" now.

Modified src/groffstudio.lpi from [e05021d78f] to [c42a030e94].

18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
18
19
20
21
22
23
24

25

26
27
28
29
30
31
32







-
+
-







      <Resources Count="1">
        <Resource_0 FileName="..\LICENSE" Type="RCDATA" ResourceName="LICENSE"/>
      </Resources>
    </General>
    <VersionInfo>
      <UseVersionInfo Value="True"/>
      <AutoIncrementBuild Value="True"/>
      <MinorVersionNr Value="10"/>
      <MinorVersionNr Value="11"/>
      <RevisionNr Value="1"/>
      <Attributes pvaPreRelease="True"/>
      <StringTable ProductName="groffstudio"/>
    </VersionInfo>
    <BuildModes>
      <Item Name="Default" Default="True"/>
    </BuildModes>
    <PublishOptions>

Modified src/unit1.lfm from [0bdef3f198] to [9197565161].

776
777
778
779
780
781
782
783

784
785
786








787
788
789
790
791
792
793
776
777
778
779
780
781
782

783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801







-
+



+
+
+
+
+
+
+
+







        Caption = 'save settings'
        OnClick = btnSaveSettingsClick
        TabOrder = 1
      end
      object Label14: TLabel
        Left = 0
        Height = 15
        Top = 48
        Top = 80
        Width = 129
        Caption = 'Yes, that''s all for now. :-)'
        ParentColor = False
      end
      object chkUpdateCheckOnStart: TCheckBox
        Left = 0
        Height = 19
        Top = 40
        Width = 171
        Caption = 'Check for updates on startup'
        TabOrder = 2
      end
    end
    object tsGroff: TTabSheet
      Caption = 'groff version'
      ClientHeight = 631
      ClientWidth = 953
      object GroupBox2: TGroupBox

Modified src/unit1.pas from [24552d1e1a] to [ac7a628a1a].

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;
    chkUpdateCheckOnStart: TCheckBox;
    chkLogFile: TCheckBox;
    chkAutoSaveBuildSettings: TCheckBox;
    chkPdfMark: TCheckBox;
    chkRefer: TCheckBox;
    chkChem: TCheckBox;
    chkGrn: TCheckBox;
    chkTbl: TCheckBox;
110
111
112
113
114
115
116

117
118
119
120
121
122
123
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125







+







    var currentGroffFileName: String;
    var hasGroff: Boolean;
    var unsavedChanges: Boolean;
{$IFDEF WINDOWS}
    var latestGroffWindowsUrl: String;
{$ENDIF}
    var storeBuildSettings: Boolean;
    var updateCheck: Boolean;
  public

  end;

var
  MainForm: TMainForm;
  BuildWindow: TBuildStatusWindow;
167
168
169
170
171
172
173



174
175
176
177
178
179
180
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185







+
+
+







  end;

  // Restore the settings
  iniStorage.Restore;
  storeBuildSettings := iniStorage.ReadBoolean('AutoSaveBuildSettings', False);
  chkAutoSaveBuildSettings.Checked := storeBuildSettings;

  updateCheck := iniStorage.ReadBoolean('UpdateCheckOnStart', False);
  chkUpdateCheckOnStart.Checked := updateCheck;

  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);
192
193
194
195
196
197
198


199
200
201
202
203
204
205
206
207
208
209













210

211
212
213
214
215
216
217
218
219













220
221
222
223
224
225
226
227
228

229
230
231
232








233
234
235
236
237
238
239











240
241

242
243
244
245
246
247
248
197
198
199
200
201
202
203
204
205











206
207
208
209
210
211
212
213
214
215
216
217
218
219
220









221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238




239



240
241
242
243
244
245
246
247
248







249
250
251
252
253
254
255
256
257
258
259
260

261
262
263
264
265
266
267
268







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

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





-
-
-
-
+
-
-
-

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

-
+







  try
    FileVerInfo.ReadFileInfo;
    edtGroffStudioInstalledVersion.Text := FileVerInfo.VersionStrings.Values['FileVersion'];
    lblAboutProductName.Caption := FileVerInfo.VersionStrings.Values['ProductName'] + ' ' + FileVerInfo.VersionStrings.Values['FileVersion'];
    MainStatusBar.Panels[2].Text := '';

    {$IFDEF WINDOWS}
    if updateCheck then
    begin
    OnlineVersionsFile := TFPCustomHTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt');
    reGroffVersion := TRegExpr.Create('groff-win ([\d\.]+) (.*)$');
    reGroffVersion.ModifierM := True;
    if reGroffVersion.Exec(OnlineVersionsFile) then
    begin
      edtOnlineGroffVersionWindows.Text := reGroffVersion.Match[1];
      latestGroffWindowsUrl := reGroffVersion.Match[2];
    end else begin
      edtOnlineGroffVersionWindows.Text := 'error';
      btnDownloadGroffWindows.Enabled := False;
    end;
      OnlineVersionsFile := TFPCustomHTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt');

      // 1. groff update check
      reGroffVersion := TRegExpr.Create('groff-win ([\d\.]+) (.*)$');
      reGroffVersion.ModifierM := True;
      if reGroffVersion.Exec(OnlineVersionsFile) then
      begin
        edtOnlineGroffVersionWindows.Text := reGroffVersion.Match[1];
        latestGroffWindowsUrl := reGroffVersion.Match[2];
      end else begin
        edtOnlineGroffVersionWindows.Text := 'error';
        btnDownloadGroffWindows.Enabled := False;
      end;

      // 2. groffstudio update check
    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';
    end;
      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';
      end;
    end else begin
        edtOnlineGroffVersionWindows.Text := 'n/a';
        btnDownloadGroffWindows.Enabled := False;
    end;
    {$ELSE}
    // Non-Windows platforms won't need some of that.
    {$IFDEF DARWIN}
    // What's the latest available version?
    try
      HTTPClient := TFPHTTPClient.Create(Nil);
      HTTPClient.OnGetSocketHandler := @GetSocketHandler;
      OnlineVersionsFile := HTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt');

      if updateCheck then
      reGroffStudioVersion := TRegExpr.Create('studio-macos ([\d\.]+) (.*)$');
      reGroffStudioVersion.ModifierM := True;
      if reGroffStudioVersion.Exec(OnlineVersionsFile) then
      begin
        HTTPClient := TFPHTTPClient.Create(Nil);
        HTTPClient.OnGetSocketHandler := @GetSocketHandler;
        OnlineVersionsFile := HTTPClient.SimpleGet('https://groff.tuxproject.de/updates/versions.txt');

        reGroffStudioVersion := TRegExpr.Create('studio-macos ([\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'
        else
          MainStatusBar.Panels[2].Text := IntToStr(HasVersionUpdate);
      end;
          // 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);
        end;
      end else begin
        edtOnlineGroffVersionWindows.Text := 'n/a';
        btnDownloadGroffWindows.Enabled := False;
      end;
    finally
      HTTPClient.Free;
      if updateCheck then HTTPClient.Free;
    end;
    {$ENDIF}
    edtOnlineGroffVersionWindows.Text := 'n/a';
    btnDownloadGroffWindows.Enabled := False;
  {$ENDIF}
  finally
    FileVerInfo.Free;
416
417
418
419
420
421
422

423
424
425
426
427
428
429
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450







+







  iniStorage.WriteBoolean('BuildUseTbl', chkTbl.Checked);
  iniStorage.WriteBoolean('BuildUsePdfMark', chkPdfMark.Checked);
  iniStorage.WriteBoolean('BuildToPostscript', rdPs.Checked);
  iniStorage.WriteBoolean('BuildToPDF', rdPDF.Checked);

  // Store the IDE settings:
  iniStorage.WriteBoolean('AutoSaveBuildSettings', chkAutoSaveBuildSettings.Checked);
  iniStorage.WriteBoolean('AutoUpdateCheck', chkUpdateCheckOnStart.Checked);

  iniStorage.Save;
end;

procedure TMainForm.FormClose(Sender: TObject; var CloseAction: TCloseAction);
var
  Reply, BoxStyle: Integer;