spiegel-keyman/developer/src/tike/main/Keyman.Developer.System.Main.pas
Marc Durdin fa57d5c674 chore(developer): final work on build.sh for developer
Now builds from a clean repo:

  developer/src/build.sh configure build test publish

* Splits kmbrowserhost into kmdbrowserhost for Developer; this means
  that Developer Browser Host now inherits the Developer settings rather
  than the Keyman for Windows settings, and simplifies distribution and
  management. The only difference between the two is in the startup code
  so this seems like a good split.

* Cleanup of various build scripts and dependencies.
2024-05-20 06:34:53 +07:00

88 lines
1.9 KiB
ObjectPascal

unit Keyman.Developer.System.Main;
interface
uses
System.SysUtils,
System.Win.ComObj,
Vcl.Forms,
Winapi.ActiveX,
Winapi.UxTheme,
uCEFApplication,
uCEFTypes,
KeymanDeveloperOptions,
Keyman.Developer.System.TikeCommandLine,
Keyman.System.CEFManager,
Keyman.System.KeymanSentryClient,
Sentry.Client,
Sentry.Client.Vcl,
UfrmMain,
UmodWebHttpServer;
procedure RunKeymanDeveloper;
implementation
const
LOGGER_DEVELOPER_IDE_TIKE = TKeymanSentryClient.LOGGER_DEVELOPER_IDE + '.tike';
procedure RunWithExceptionsHandled; forward;
procedure RunKeymanDeveloper;
begin
CoInitFlags := COINIT_APARTMENTTHREADED;
Application.MainFormOnTaskBar := True;
Application.Initialize;
Application.Title := 'Keyman Developer';
TKeymanSentryClient.Start(TSentryClientVcl, kscpDeveloper, LOGGER_DEVELOPER_IDE_TIKE, LoadKeymanDeveloperSentryFlags);
try
try
RunWithExceptionsHandled;
except
on E:Exception do
SentryHandleException(E);
end;
finally
TKeymanSentryClient.Stop;
end;
end;
procedure RunWithExceptionsHandled;
begin
FInitializeCEF := TCEFManager.Create(True);
try
if GlobalCEFApp.ProcessType = ptBrowser then
begin
// We want to process the command line only if we are not a CEF
// sub-process, because otherwise we lose the benefit of
if TikeCommandLine.Process = pclExit then
begin
Exit;
end;
end;
if FInitializeCEF.Start then
begin
InitThemeLibrary;
SetThemeAppProperties(STAP_ALLOW_NONCLIENT or STAP_ALLOW_CONTROLS or STAP_ALLOW_WEBCONTENT);
Application.CreateForm(TmodWebHttpServer, modWebHttpServer);
try
Application.CreateForm(TfrmKeymanDeveloper, frmKeymanDeveloper);
try
Application.Run;
finally
FreeAndNil(frmKeymanDeveloper);
end;
finally
FreeAndNil(modWebHttpServer);
end;
end;
finally
FInitializeCEF.Free;
end;
end;
end.