Skip to content

Commit

Permalink
feat(developer): Project Settings Form for 17.0+ projects
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdurdin committed Nov 11, 2023
1 parent 3c0b7a9 commit f9272aa
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 11 deletions.
15 changes: 10 additions & 5 deletions developer/src/tike/actions/dmActionsMain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,9 @@ implementation
Keyman.Developer.UI.Project.ProjectFileUI,
Keyman.Developer.UI.Project.ProjectUI,
Keyman.Developer.UI.Project.UfrmNewProject,
Keyman.Developer.UI.Project.UfrmProject,
Keyman.Developer.UI.Project.UfrmProjectSettings,
Keyman.Developer.UI.Project.UfrmProjectSettings20,
GlobalProxySettings,
RegistryKeys,
TextFileFormat,
Expand All @@ -291,8 +294,6 @@ implementation
UfrmOSKEditor,
UfrmPackageEditor,
UmodWebHttpServer,
Keyman.Developer.UI.Project.UfrmProject,
Keyman.Developer.UI.Project.UfrmProjectSettings,
Upload_Settings,
utilexecute,
UfrmMDIChild;
Expand Down Expand Up @@ -630,12 +631,16 @@ procedure TmodActionsMain.CloseProject;
end;

procedure TmodActionsMain.actProjectSettingsExecute(Sender: TObject);
var
frm: TForm;
begin
with TfrmProjectSettings.Create(Screen.ActiveForm) do // I4688
if FGlobalProject.Options.Version = pv10
then frm := TfrmProjectSettings.Create(Screen.ActiveForm) // I4688
else frm := TfrmProjectSettings20.Create(Screen.ActiveForm);
try
ShowModal;
frm.ShowModal;
finally
Free;
frm.Free;
end;
end;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
object frmProjectSettings20: TfrmProjectSettings20
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Project Settings'
ClientHeight = 219
ClientWidth = 418
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object lblOutputPath: TLabel
Left = 16
Top = 19
Width = 59
Height = 13
Caption = '&Output path'
FocusControl = editOutputPath
end
object Label2: TLabel
Left = 81
Top = 73
Width = 64
Height = 13
Caption = 'Placeholders:'
end
object Label3: TLabel
Left = 151
Top = 73
Width = 77
Height = 13
Caption = '$PROJECTPATH'
end
object Label6: TLabel
Left = 248
Top = 73
Width = 122
Height = 13
Caption = 'Path that the project is in'
end
object lblSourcePath: TLabel
Left = 16
Top = 46
Width = 58
Height = 13
Caption = '&Source path'
FocusControl = editSourcePath
end
object editOutputPath: TEdit
Left = 81
Top = 16
Width = 320
Height = 21
TabOrder = 0
end
object cmdOK: TButton
Left = 131
Top = 186
Width = 75
Height = 25
Caption = 'OK'
Default = True
TabOrder = 6
OnClick = cmdOKClick
end
object cmdCancel: TButton
Left = 212
Top = 186
Width = 75
Height = 25
Cancel = True
Caption = 'Cancel'
ModalResult = 2
TabOrder = 7
end
object chkCompilerWarningsAsErrors: TCheckBox
Left = 81
Top = 114
Width = 232
Height = 17
Caption = 'Treat compiler &hints and warnings as errors'
TabOrder = 3
end
object chkWarnDeprecatedCode: TCheckBox
Left = 81
Top = 137
Width = 160
Height = 17
Caption = 'Warn on &deprecated code'
TabOrder = 4
end
object chkCheckFilenameConventions: TCheckBox
Left = 81
Top = 160
Width = 160
Height = 17
Caption = '&Check filename conventions'
TabOrder = 5
end
object editSourcePath: TEdit
Left = 81
Top = 43
Width = 320
Height = 21
TabOrder = 1
end
object chkBuildMetadataFiles: TCheckBox
Left = 81
Top = 92
Width = 232
Height = 17
Caption = 'Build &metadata files for Keyman Cloud'
TabOrder = 2
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
(*
Name: Keyman.Developer.UI.Project.UfrmProjectSettings
Copyright: Copyright (C) SIL International.
Documentation:
Description:
Create Date: 4 May 2015
Modified Date: 24 Aug 2015
Authors: mcdurdin
Related Files:
Dependencies:
Bugs:
Todo:
Notes:
History: 04 May 2015 - mcdurdin - I4688 - V9.0 - Add build path to project settings
24 Aug 2015 - mcdurdin - I4865 - Add treat hints and warnings as errors into project
24 Aug 2015 - mcdurdin - I4866 - Add warn on deprecated features to project and compile
*)
unit Keyman.Developer.UI.Project.UfrmProjectSettings20; // I4688

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TfrmProjectSettings20 = class(TForm)
lblOutputPath: TLabel;
editOutputPath: TEdit;
Label2: TLabel;
cmdOK: TButton;
cmdCancel: TButton;
Label3: TLabel;
Label6: TLabel;
chkCompilerWarningsAsErrors: TCheckBox;
chkWarnDeprecatedCode: TCheckBox;
chkCheckFilenameConventions: TCheckBox;
lblSourcePath: TLabel;
editSourcePath: TEdit;
chkBuildMetadataFiles: TCheckBox;
procedure FormCreate(Sender: TObject);
procedure cmdOKClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

implementation

{$R *.dfm}

uses
Keyman.Developer.System.Project.Project;

procedure TfrmProjectSettings20.cmdOKClick(Sender: TObject);
begin
FGlobalProject.Options.BuildPath := Trim(editOutputPath.Text);
FGlobalProject.Options.SourcePath := Trim(editSourcePath.Text);
FGlobalProject.Options.SkipMetadataFiles := not chkBuildMetadataFiles.Checked;
FGlobalProject.Options.CompilerWarningsAsErrors := chkCompilerWarningsAsErrors.Checked; // I4865
FGlobalProject.Options.WarnDeprecatedCode := chkWarnDeprecatedCode.Checked; // I4866
FGlobalProject.Options.CheckFilenameConventions := chkCheckFilenameConventions.Checked;
FGlobalProject.Save;
ModalResult := mrOk;
end;

procedure TfrmProjectSettings20.FormCreate(Sender: TObject);
begin
editOutputPath.Text := FGlobalProject.Options.BuildPath;
editSourcePath.Text := FGlobalProject.Options.SourcePath;
chkBuildMetadataFiles.Checked := not FGlobalProject.Options.SkipMetadataFiles;
chkCompilerWarningsAsErrors.Checked := FGlobalProject.Options.CompilerWarningsAsErrors; // I4865
chkWarnDeprecatedCode.Checked := FGlobalProject.Options.WarnDeprecatedCode; // I4866
chkCheckFilenameConventions.Checked := FGlobalProject.Options.CheckFilenameConventions;
if editOutputPath.Text = '' then editOutputPath.Text := '$PROJECTPATH';
end;

end.
8 changes: 4 additions & 4 deletions developer/src/tike/tike.dpr
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ uses
Keyman.Developer.System.Project.kpsProjectFile in 'project\Keyman.Developer.System.Project.kpsProjectFile.pas',
Keyman.Developer.System.Project.kmxProjectFile in 'project\Keyman.Developer.System.Project.kmxProjectFile.pas',
Keyman.Developer.System.Project.modelTsProjectFile in 'project\Keyman.Developer.System.Project.modelTsProjectFile.pas',
Keyman.Developer.UI.Project.UfrmProjectSettings in 'project\Keyman.Developer.UI.Project.UfrmProjectSettings.pas' {frmProjectSettings},
Keyman.Developer.UI.Project.UfrmProjectSettings20 in 'project\Keyman.Developer.UI.Project.UfrmProjectSettings20.pas' {frmProjectSettings20},
Keyman.Developer.UI.Project.ProjectFileUI in 'project\Keyman.Developer.UI.Project.ProjectFileUI.pas',
Keyman.Developer.UI.Project.ProjectUI in 'project\Keyman.Developer.UI.Project.ProjectUI.pas',
Keyman.Developer.UI.Project.ProjectUIFileType in 'project\Keyman.Developer.UI.Project.ProjectUIFileType.pas',
Expand Down Expand Up @@ -287,7 +287,8 @@ uses
Keyman.Developer.System.Project.xmlLdmlProjectFileAction in 'project\Keyman.Developer.System.Project.xmlLdmlProjectFileAction.pas',
Keyman.Developer.UI.Project.xmlLdmlProjectFileUI in 'project\Keyman.Developer.UI.Project.xmlLdmlProjectFileUI.pas',
Keyman.Developer.UI.UfrmLdmlKeyboardEditor in 'child\Keyman.Developer.UI.UfrmLdmlKeyboardEditor.pas' {frmLdmlKeyboardEditor},
dmActionsKeyboardEditor in 'actions\dmActionsKeyboardEditor.pas' {modActionsKeyboardEditor: TDataModule};
dmActionsKeyboardEditor in 'actions\dmActionsKeyboardEditor.pas' {modActionsKeyboardEditor: TDataModule},
Keyman.Developer.UI.Project.UfrmProjectSettings in 'project\Keyman.Developer.UI.Project.UfrmProjectSettings.pas' {frmProjectSettings};

{$R *.RES}
{$R ICONS.RES}
Expand Down Expand Up @@ -317,8 +318,7 @@ begin
Application.Title := 'Keyman Developer';
if TikeActive then Exit;
Application.CreateForm(TmodWebHttpServer, modWebHttpServer);
Application.CreateForm(TmodActionsKeyboardEditor, modActionsKeyboardEditor);
try
try
Application.CreateForm(TfrmKeymanDeveloper, frmKeymanDeveloper);
Application.Run;
finally
Expand Down
8 changes: 6 additions & 2 deletions developer/src/tike/tike.dproj
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@
<DCCReference Include="project\Keyman.Developer.System.Project.kpsProjectFile.pas"/>
<DCCReference Include="project\Keyman.Developer.System.Project.kmxProjectFile.pas"/>
<DCCReference Include="project\Keyman.Developer.System.Project.modelTsProjectFile.pas"/>
<DCCReference Include="project\Keyman.Developer.UI.Project.UfrmProjectSettings.pas">
<Form>frmProjectSettings</Form>
<DCCReference Include="project\Keyman.Developer.UI.Project.UfrmProjectSettings20.pas">
<Form>frmProjectSettings20</Form>
</DCCReference>
<DCCReference Include="project\Keyman.Developer.UI.Project.ProjectFileUI.pas"/>
<DCCReference Include="project\Keyman.Developer.UI.Project.ProjectUI.pas"/>
Expand Down Expand Up @@ -572,6 +572,10 @@
<FormType>dfm</FormType>
<DesignClass>TDataModule</DesignClass>
</DCCReference>
<DCCReference Include="project\Keyman.Developer.UI.Project.UfrmProjectSettings.pas">
<Form>frmProjectSettings</Form>
<FormType>dfm</FormType>
</DCCReference>
<None Include="Profiling\AQtimeModule1.aqt"/>
<BuildConfiguration Include="Debug">
<Key>Cfg_2</Key>
Expand Down

0 comments on commit f9272aa

Please sign in to comment.