-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10114 from keymanapp/feat/developer/multi-process…
…-file-loading feat(developer): Multi-process model for projects 🦕
- Loading branch information
Showing
28 changed files
with
2,524 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
developer/src/test/manual/multiprocess/Keyman.MultiProcess.UI.UfrmMultiProcess.dfm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
object frmMultiProcess: TfrmMultiProcess | ||
Left = 0 | ||
Top = 0 | ||
Caption = 'frmMultiProcess' | ||
ClientHeight = 333 | ||
ClientWidth = 608 | ||
Color = clBtnFace | ||
Font.Charset = DEFAULT_CHARSET | ||
Font.Color = clWindowText | ||
Font.Height = -11 | ||
Font.Name = 'Tahoma' | ||
Font.Style = [] | ||
OldCreateOrder = False | ||
OnCreate = FormCreate | ||
PixelsPerInch = 96 | ||
TextHeight = 13 | ||
object Label1: TLabel | ||
Left = 240 | ||
Top = 11 | ||
Width = 31 | ||
Height = 13 | ||
Caption = 'Label1' | ||
end | ||
object Edit1: TEdit | ||
Left = 296 | ||
Top = 8 | ||
Width = 121 | ||
Height = 21 | ||
TabOrder = 0 | ||
Text = 'Edit1' | ||
OnChange = Edit1Change | ||
end | ||
object Button1: TButton | ||
Left = 512 | ||
Top = 8 | ||
Width = 75 | ||
Height = 25 | ||
Caption = 'New Process' | ||
TabOrder = 1 | ||
OnClick = Button1Click | ||
end | ||
object lbProcess: TListBox | ||
Left = 8 | ||
Top = 8 | ||
Width = 209 | ||
Height = 289 | ||
ItemHeight = 13 | ||
TabOrder = 2 | ||
OnDblClick = lbProcessDblClick | ||
end | ||
object cmdFocus: TButton | ||
Left = 8 | ||
Top = 300 | ||
Width = 75 | ||
Height = 25 | ||
Caption = 'Focus process' | ||
TabOrder = 3 | ||
OnClick = cmdFocusClick | ||
end | ||
object tmrEnumerate: TTimer | ||
Interval = 100 | ||
OnTimer = tmrEnumerateTimer | ||
Left = 400 | ||
Top = 112 | ||
end | ||
end |
103 changes: 103 additions & 0 deletions
103
developer/src/test/manual/multiprocess/Keyman.MultiProcess.UI.UfrmMultiProcess.pas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
unit Keyman.MultiProcess.UI.UfrmMultiProcess; | ||
|
||
interface | ||
|
||
uses | ||
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, | ||
Keyman.Developer.System.MultiProcess, | ||
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; | ||
|
||
type | ||
TfrmMultiProcess = class(TForm) | ||
Edit1: TEdit; | ||
Label1: TLabel; | ||
tmrEnumerate: TTimer; | ||
Button1: TButton; | ||
lbProcess: TListBox; | ||
cmdFocus: TButton; | ||
procedure FormCreate(Sender: TObject); | ||
procedure tmrEnumerateTimer(Sender: TObject); | ||
procedure Edit1Change(Sender: TObject); | ||
procedure lbProcessDblClick(Sender: TObject); | ||
procedure cmdFocusClick(Sender: TObject); | ||
procedure Button1Click(Sender: TObject); | ||
private | ||
function SelectedProcess: TMultiProcessInstance; | ||
{ Private declarations } | ||
public | ||
{ Public declarations } | ||
end; | ||
|
||
var | ||
frmMultiProcess: TfrmMultiProcess; | ||
|
||
implementation | ||
|
||
uses | ||
utilexecute; | ||
|
||
{$R *.dfm} | ||
|
||
procedure TfrmMultiProcess.Button1Click(Sender: TObject); | ||
begin | ||
TUtilExecute.Execute('"'+ParamStr(0)+'"', ExtractFileDir(ParamStr(0)), SW_SHOWNORMAL); | ||
end; | ||
|
||
procedure TfrmMultiProcess.cmdFocusClick(Sender: TObject); | ||
var | ||
p: TMultiProcessInstance; | ||
begin | ||
p := SelectedProcess; | ||
if Assigned(p) then | ||
p.BringToFront; | ||
end; | ||
|
||
function TfrmMultiProcess.SelectedProcess: TMultiProcessInstance; | ||
begin | ||
if lbProcess.ItemIndex < 0 then | ||
Result := nil | ||
else | ||
Result := TMultiProcessInstance(lbProcess.Items.Objects[lbProcess.ItemIndex]); | ||
end; | ||
|
||
procedure TfrmMultiProcess.Edit1Change(Sender: TObject); | ||
begin | ||
MultiProcessCoordinator.SetProcessIdentifier(Edit1.Text); | ||
end; | ||
|
||
procedure TfrmMultiProcess.FormCreate(Sender: TObject); | ||
begin | ||
Caption := 'MultiProcess Test Form - '+IntToStr(Handle)+'/'+IntToStr(GetCurrentThreadId); | ||
end; | ||
|
||
procedure TfrmMultiProcess.lbProcessDblClick(Sender: TObject); | ||
begin | ||
cmdFocusClick(cmdFocus); | ||
end; | ||
|
||
procedure TfrmMultiProcess.tmrEnumerateTimer(Sender: TObject); | ||
var | ||
p: TMultiProcessInstance; | ||
LastTID: Cardinal; | ||
begin | ||
p := SelectedProcess; | ||
if Assigned(p) then | ||
begin | ||
LastTID := p.ThreadId; | ||
end | ||
else | ||
LastTID := 0; | ||
|
||
lbProcess.Clear; | ||
MultiProcessCoordinator.Enumerate; | ||
for p in MultiProcessCoordinator.Processes do | ||
begin | ||
lbProcess.Items.AddObject( | ||
p.Handle.ToString + '/' + p.ThreadId.ToString + ': '+p.Identifier, | ||
p); | ||
if p.ThreadId = LastTID then | ||
lbProcess.ItemIndex := lbProcess.Items.Count - 1; | ||
end; | ||
end; | ||
|
||
end. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
program multiprocess; | ||
|
||
uses | ||
Vcl.Forms, | ||
Keyman.MultiProcess.UI.UfrmMultiProcess in 'Keyman.MultiProcess.UI.UfrmMultiProcess.pas' {frmMultiProcess}, | ||
Keyman.Developer.System.MultiProcess in '..\..\..\tike\main\Keyman.Developer.System.MultiProcess.pas', | ||
utilexecute in '..\..\..\..\..\common\windows\delphi\general\utilexecute.pas', | ||
Unicode in '..\..\..\..\..\common\windows\delphi\general\Unicode.pas'; | ||
|
||
{$R *.res} | ||
|
||
begin | ||
CreateMultiProcessCoordinator(TfrmMultiProcess.ClassName, 'Software\Keyman\Test\MultiProcess'); | ||
Application.Initialize; | ||
Application.MainFormOnTaskbar := True; | ||
Application.CreateForm(TfrmMultiProcess, frmMultiProcess); | ||
Application.Run; | ||
end. |
Oops, something went wrong.