LazStats: Add path to LHelp to Options.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7609 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
3a8e6c0071
commit
893acb17cb
Binary file not shown.
Binary file not shown.
4
applications/lazstats/source/LazStats.inc
Normal file
4
applications/lazstats/source/LazStats.inc
Normal file
@ -0,0 +1,4 @@
|
||||
{$IFDEF MSWINDOWS}
|
||||
{$DEFINE USE_EXTERNAL_HELP_VIEWER}
|
||||
{$ENDIF}
|
||||
|
@ -43,7 +43,7 @@
|
||||
<PackageName Value="LCL"/>
|
||||
</Item5>
|
||||
</RequiredPackages>
|
||||
<Units Count="170">
|
||||
<Units Count="171">
|
||||
<Unit0>
|
||||
<Filename Value="LazStats.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
@ -1382,6 +1382,10 @@
|
||||
<IsPartOfProject Value="True"/>
|
||||
<UnitName Value="Utils"/>
|
||||
</Unit169>
|
||||
<Unit170>
|
||||
<Filename Value="LazStats.inc"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit170>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
|
@ -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 = '<default>' then
|
||||
lhelpfn := Application.Location + 'lhelp' + GetExeExt;
|
||||
if FileExists(lhelpfn) then
|
||||
begin
|
||||
Maindatamodule.LHelpConnector.LHelpPath := lhelpfn;
|
||||
|
@ -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
|
||||
|
@ -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 := '<default>'
|
||||
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 = '<default>' 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;
|
||||
|
@ -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: '<default>';
|
||||
);
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user