diff --git a/applications/lazstats/LazStats.chm b/applications/lazstats/LazStats.chm index 24db858fa..39d96db37 100644 Binary files a/applications/lazstats/LazStats.chm and b/applications/lazstats/LazStats.chm differ diff --git a/applications/lazstats/docs/HelpNDoc/LazStats.hnd b/applications/lazstats/docs/HelpNDoc/LazStats.hnd index 905d290e2..7b7c2f9fa 100644 Binary files a/applications/lazstats/docs/HelpNDoc/LazStats.hnd and b/applications/lazstats/docs/HelpNDoc/LazStats.hnd differ diff --git a/applications/lazstats/source/LazStats.inc b/applications/lazstats/source/LazStats.inc new file mode 100644 index 000000000..10bb364a5 --- /dev/null +++ b/applications/lazstats/source/LazStats.inc @@ -0,0 +1,4 @@ +{$IFDEF MSWINDOWS} + {$DEFINE USE_EXTERNAL_HELP_VIEWER} +{$ENDIF} + diff --git a/applications/lazstats/source/LazStats.lpi b/applications/lazstats/source/LazStats.lpi index e707c7f6e..0ce9526b1 100644 --- a/applications/lazstats/source/LazStats.lpi +++ b/applications/lazstats/source/LazStats.lpi @@ -43,7 +43,7 @@ - + @@ -1382,6 +1382,10 @@ + + + + diff --git a/applications/lazstats/source/forms/mainunit.pas b/applications/lazstats/source/forms/mainunit.pas index 7a9987caf..74e408145 100644 --- a/applications/lazstats/source/forms/mainunit.pas +++ b/applications/lazstats/source/forms/mainunit.pas @@ -7,9 +7,7 @@ unit MainUnit; {$mode objfpc}{$H+} -{$IFDEF MSWINDOWS} - {$DEFINE USE_EXTERNAL_HELP_VIEWER} -{$ENDIF} +{$include ../LazStats.inc} interface @@ -1306,7 +1304,9 @@ begin {$IFDEF USE_EXTERNAL_HELP_VIEWER} Application.OnHelp := @HelpHandler; {$ELSE} - lhelpfn := Application.Location + 'LHelp.exe'; + lhelpfn := Options.LHelpPath; + if lhelpfn = '' then + lhelpfn := Application.Location + 'lhelp' + GetExeExt; if FileExists(lhelpfn) then begin Maindatamodule.LHelpConnector.LHelpPath := lhelpfn; diff --git a/applications/lazstats/source/forms/options/optionsunit.lfm b/applications/lazstats/source/forms/options/optionsunit.lfm index 8a0330003..4c307349c 100644 --- a/applications/lazstats/source/forms/options/optionsunit.lfm +++ b/applications/lazstats/source/forms/options/optionsunit.lfm @@ -1,12 +1,12 @@ object OptionsFrm: TOptionsFrm Left = 510 - Height = 320 + Height = 364 Top = 266 - Width = 352 + Width = 349 AutoSize = True Caption = 'Options' - ClientHeight = 320 - ClientWidth = 352 + ClientHeight = 364 + ClientWidth = 349 OnActivate = FormActivate OnShow = FormShow Position = poMainFormCenter @@ -32,7 +32,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 72 Top = 8 - Width = 336 + Width = 333 Anchors = [akTop, akLeft, akRight] AutoFill = True AutoSize = True @@ -50,7 +50,7 @@ object OptionsFrm: TOptionsFrm ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 1 ClientHeight = 52 - ClientWidth = 332 + ClientWidth = 329 ItemIndex = 0 Items.Strings = ( 'English (default) period separator' @@ -67,7 +67,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 51 Top = 92 - Width = 336 + Width = 333 Anchors = [akTop, akLeft, akRight] AutoFill = True AutoSize = True @@ -85,7 +85,7 @@ object OptionsFrm: TOptionsFrm ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 4 ClientHeight = 31 - ClientWidth = 332 + ClientWidth = 329 Columns = 4 ItemIndex = 3 Items.Strings = ( @@ -105,7 +105,7 @@ object OptionsFrm: TOptionsFrm Left = 8 Height = 51 Top = 155 - Width = 336 + Width = 333 Anchors = [akTop, akLeft, akRight] AutoFill = True AutoSize = True @@ -123,7 +123,7 @@ object OptionsFrm: TOptionsFrm ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 3 ClientHeight = 31 - ClientWidth = 332 + ClientWidth = 329 Columns = 3 ItemIndex = 2 Items.Strings = ( @@ -133,28 +133,12 @@ object OptionsFrm: TOptionsFrm ) TabOrder = 2 end - object FilePathEdit: TEdit - AnchorSideLeft.Control = Owner - AnchorSideTop.Control = Label1 - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - Left = 8 - Height = 23 - Top = 235 - Width = 336 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Top = 2 - BorderSpacing.Right = 8 - TabOrder = 3 - end object CancelBtn: TButton AnchorSideTop.Control = HelpBtn AnchorSideRight.Control = SaveBtn - Left = 169 + Left = 166 Height = 25 - Top = 281 + Top = 329 Width = 62 Anchors = [akTop, akRight] AutoSize = True @@ -164,16 +148,15 @@ object OptionsFrm: TOptionsFrm Caption = 'Cancel' ModalResult = 2 OnClick = CancelBtnClick - TabOrder = 4 + TabOrder = 3 end object SaveBtn: TButton - AnchorSideLeft.Control = Owner AnchorSideTop.Control = HelpBtn AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom - Left = 239 + Left = 236 Height = 25 - Top = 281 + Top = 329 Width = 105 Anchors = [akTop, akRight] AutoSize = True @@ -182,32 +165,16 @@ object OptionsFrm: TOptionsFrm Caption = 'Save and Close' ModalResult = 1 OnClick = SaveBtnClick - TabOrder = 5 - end - object BrowseBtn: TButton - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = HelpBtn - AnchorSideRight.Control = CancelBtn - Left = 88 - Height = 25 - Top = 281 - Width = 73 - Anchors = [akTop, akRight] - AutoSize = True - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - Caption = 'Browse...' - OnClick = BrowseBtnClick - TabOrder = 6 + TabOrder = 4 end object HelpBtn: TButton Tag = 135 AnchorSideTop.Control = Bevel1 AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = BrowseBtn - Left = 29 + AnchorSideRight.Control = CancelBtn + Left = 107 Height = 25 - Top = 281 + Top = 329 Width = 51 Anchors = [akTop, akRight] AutoSize = True @@ -217,24 +184,73 @@ object OptionsFrm: TOptionsFrm BorderSpacing.Bottom = 8 Caption = 'Help' OnClick = HelpBtnClick - TabOrder = 7 + TabOrder = 5 end object Bevel1: TBevel AnchorSideLeft.Control = Owner - AnchorSideTop.Control = FilePathEdit + AnchorSideTop.Control = LHelpPathEdit AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Owner AnchorSideRight.Side = asrBottom Left = 0 Height = 3 - Top = 270 - Width = 352 + Top = 318 + Width = 349 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 12 Shape = bsBottomLine end - object SelDir: TSelectDirectoryDialog - left = 184 - top = 184 + object Label2: TLabel + AnchorSideLeft.Control = LHelpPathEdit + AnchorSideTop.Control = FilePathEdit + AnchorSideTop.Side = asrBottom + Left = 8 + Height = 15 + Top = 266 + Width = 149 + BorderSpacing.Top = 8 + Caption = 'Path to help viewer (LHelp):' + ParentColor = False + end + object LHelpPathEdit: TFileNameEdit + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Label2 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 8 + Height = 23 + Top = 283 + Width = 333 + FilterIndex = 0 + HideDirectories = False + ButtonWidth = 23 + NumGlyphs = 1 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 2 + BorderSpacing.Right = 8 + MaxLength = 0 + TabOrder = 6 + end + object FilePathEdit: TDirectoryEdit + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = Label1 + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 8 + Height = 23 + Top = 235 + Width = 333 + ShowHidden = False + ButtonWidth = 23 + NumGlyphs = 1 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Top = 2 + BorderSpacing.Right = 8 + MaxLength = 0 + TabOrder = 7 end end diff --git a/applications/lazstats/source/forms/options/optionsunit.pas b/applications/lazstats/source/forms/options/optionsunit.pas index 44ac3bda3..a4be77925 100644 --- a/applications/lazstats/source/forms/options/optionsunit.pas +++ b/applications/lazstats/source/forms/options/optionsunit.pas @@ -1,12 +1,13 @@ unit OptionsUnit; {$mode objfpc}{$H+} +{$include ../../LazStats.inc} interface uses Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs, - StdCtrls, ExtCtrls, Clipbrd, + StdCtrls, ExtCtrls, Clipbrd, EditBtn, Globals, ContextHelpUnit; type @@ -15,17 +16,16 @@ type TOptionsFrm = class(TForm) Bevel1: TBevel; - BrowseBtn: TButton; CancelBtn: TButton; + FilePathEdit: TDirectoryEdit; + LHelpPathEdit: TFileNameEdit; HelpBtn: TButton; + Label2: TLabel; SaveBtn: TButton; - FilePathEdit: TEdit; Label1: TLabel; FractionTypeGrp: TRadioGroup; MissValsGrp: TRadioGroup; JustificationGrp: TRadioGroup; - SelDir: TSelectDirectoryDialog; - procedure BrowseBtnClick(Sender: TObject); procedure CancelBtnClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormShow(Sender: TObject); @@ -97,6 +97,10 @@ begin else Options.Defaultpath := pathname; + // LHelp path + Readln(F, pathName); + Options.LHelpPath := pathname; + Close(F); end; @@ -119,9 +123,8 @@ begin WriteLn(F, ord(Options.DefaultMiss)); WriteLn(F, ord(Options.DefaultJust)); WriteLn(F, Options.DefaultPath); + WriteLn(F, Options.LHelpPath); CloseFile(F); - - DefaultFormatSettings.DecimalSeparator := FractionTypeChars[Options.FractionType]; end; @@ -136,6 +139,10 @@ begin AOptions.DefaultPath := OpenStatPath else AOptions.DefaultPath := FilePathEdit.Text; + if LHElpPathEdit.FileName = Application.Location + 'lhelp' + GetExeExt then + AOptions.LHelpPath := '' + else + AOptions.LHelpPath := LHelpPathEdit.FileName; end; procedure TOptionsFrm.OptionsToControls(const AOptions: TOptions); @@ -147,6 +154,10 @@ begin FilePathEdit.Text := OpenStatPath else FilePathEdit.Text := AOptions.DefaultPath; + if AOptions.LHelpPath = '' then + LHelpPathEdit.FileName := Application.Location + 'lhelp' + GetExeExt + else + LHelpPathEdit.FileName := AOptions.LHelpPath; end; procedure TOptionsFrm.FormActivate(Sender: TObject); @@ -156,9 +167,13 @@ begin if FAutoSized then exit; - w := MaxValue([HelpBtn.Width, BrowseBtn.Width, SaveBtn.Width, CancelBtn.Width]); + {$IFDEF USE_EXTERNAL_HELP_VIEWER} + Label2.Visible := false; + LHelpPathEdit.Visible := false; + {$ENDIF} + + w := MaxValue([HelpBtn.Width, SaveBtn.Width, CancelBtn.Width]); HelpBtn.Constraints.MinWidth := w; - BrowseBtn.Constraints.MinWidth := w; SaveBtn.Constraints.MinWidth := w; CancelBtn.Constraints.MinWidth := w; @@ -188,16 +203,6 @@ begin SaveOptions; end; -procedure TOptionsFrm.BrowseBtnClick(Sender: TObject); -begin - with SelDir do - begin - InitialDir := FilePathEdit.Text; - if Execute then - FilePathEdit.text := FileName; - end; -end; - procedure TOptionsFrm.CancelBtnClick(Sender: TObject); begin Options := FSavedOptions; diff --git a/applications/lazstats/source/forms/help/helpunit.lfm b/applications/lazstats/source/not used by LazStats/helpunit.lfm similarity index 100% rename from applications/lazstats/source/forms/help/helpunit.lfm rename to applications/lazstats/source/not used by LazStats/helpunit.lfm diff --git a/applications/lazstats/source/forms/help/helpunit.pas b/applications/lazstats/source/not used by LazStats/helpunit.pas similarity index 100% rename from applications/lazstats/source/forms/help/helpunit.pas rename to applications/lazstats/source/not used by LazStats/helpunit.pas diff --git a/applications/lazstats/source/units/globals.pas b/applications/lazstats/source/units/globals.pas index 56254ad28..a6a73c325 100644 --- a/applications/lazstats/source/units/globals.pas +++ b/applications/lazstats/source/units/globals.pas @@ -51,6 +51,7 @@ type FractionType: TFractionType; DefaultMiss: TMissingValueCode; DefaultJust: TJustification; + LHelpPath: String; end; var @@ -70,7 +71,8 @@ var DefaultPath: ''; FractionType: ftPoint; DefaultMiss: mvcNines; - DefaultJust: jLeft + DefaultJust: jLeft; + LHelpPath: ''; );