diff --git a/windows/src/desktop/kmshell/kmshell.dpr b/windows/src/desktop/kmshell/kmshell.dpr index 99f52b328c..a568bca23c 100644 --- a/windows/src/desktop/kmshell/kmshell.dpr +++ b/windows/src/desktop/kmshell/kmshell.dpr @@ -97,7 +97,6 @@ uses MSXMLDomCreate in '..\..\global\delphi\general\MSXMLDomCreate.pas', utilexecute in '..\..\global\delphi\general\utilexecute.pas', KeymanVersion in '..\..\global\delphi\general\KeymanVersion.pas', - UfrmScriptError in '..\..\global\delphi\general\UfrmScriptError.pas' {frmScriptError}, BaseKeyboards in '..\..\global\delphi\general\BaseKeyboards.pas', LoadIndirectStringUnit in '..\..\engine\keyman\langswitch\LoadIndirectStringUnit.pas', Glossary in '..\..\global\delphi\general\Glossary.pas', diff --git a/windows/src/desktop/kmshell/kmshell.dproj b/windows/src/desktop/kmshell/kmshell.dproj index 73a91035f5..320db2e449 100644 --- a/windows/src/desktop/kmshell/kmshell.dproj +++ b/windows/src/desktop/kmshell/kmshell.dproj @@ -229,9 +229,6 @@ - -
frmScriptError
-
@@ -432,18 +429,18 @@ true - - - .\ - true - - kmshell.exe true + + + .\ + true + + 1 diff --git a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.dfm b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.dfm index 20daa99b3f..9d23c9b3a5 100644 --- a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.dfm +++ b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.dfm @@ -1,4 +1,4 @@ -object frmSettingsAddTSFApp: TfrmSettingsAddTSFApp +inherited frmSettingsAddTSFApp: TfrmSettingsAddTSFApp Left = 0 Top = 0 ActiveControl = editFilename @@ -7,14 +7,10 @@ object frmSettingsAddTSFApp: TfrmSettingsAddTSFApp Caption = 'Text Services Framework Application Overrides' ClientHeight = 139 ClientWidth = 442 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False Position = poOwnerFormCenter + ExplicitWidth = 448 + ExplicitHeight = 168 PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel diff --git a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.pas b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.pas index 4f70310ad4..5c9e273109 100644 --- a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.pas +++ b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsAddTSFApp.pas @@ -13,10 +13,12 @@ uses Vcl.Grids, Vcl.StdCtrls, Winapi.Messages, - Winapi.Windows; + Winapi.Windows, + + UfrmKeymanBase; type - TfrmSettingsAddTSFApp = class(TForm) + TfrmSettingsAddTSFApp = class(TfrmKeymanBase) cmdOK: TButton; cmdCancel: TButton; Label1: TLabel; diff --git a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.dfm b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.dfm index f580b13549..f75baca662 100644 --- a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.dfm +++ b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.dfm @@ -1,23 +1,19 @@ -object frmSettingsManager: TfrmSettingsManager +inherited frmSettingsManager: TfrmSettingsManager Left = 0 Top = 0 BorderIcons = [biSystemMenu] Caption = 'Keyman Settings Manager' ClientHeight = 447 ClientWidth = 704 - Color = clBtnFace Constraints.MinHeight = 360 Constraints.MinWidth = 720 - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False Position = poOwnerFormCenter OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnResize = FormResize + ExplicitWidth = 720 + ExplicitHeight = 486 DesignSize = ( 704 447) diff --git a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.pas b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.pas index 5e1ef95282..a4a48a79a3 100644 --- a/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.pas +++ b/windows/src/desktop/kmshell/settings/Keyman.Configuration.UI.UfrmSettingsManager.pas @@ -15,10 +15,12 @@ uses Winapi.Messages, Winapi.Windows, - Keyman.System.Settings, Vcl.Imaging.pngimage, Vcl.ExtCtrls; + Keyman.System.Settings, Vcl.Imaging.pngimage, Vcl.ExtCtrls, + + UfrmKeymanBase; type - TfrmSettingsManager = class(TForm) + TfrmSettingsManager = class(TfrmKeymanBase) gridDebugOption: TStringGrid; memoDescription: TMemo; cmdApply: TButton; @@ -84,6 +86,7 @@ procedure TfrmSettingsManager.FormCreate(Sender: TObject); var r: TRegistry; begin + inherited; r := TRegistry.Create; try r.RootKey := HKEY_LOCAL_MACHINE; @@ -102,12 +105,14 @@ end; procedure TfrmSettingsManager.FormResize(Sender: TObject); begin + inherited; gridDebugOption.ColWidths[1] := gridDebugOption.ClientWidth - gridDebugOption.ColWidths[0] - 1; end; procedure TfrmSettingsManager.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin + inherited; CanClose := True; if settings.Modified then begin diff --git a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm index 49e3364463..8d8e23df5f 100644 --- a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm +++ b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.dfm @@ -1,4 +1,4 @@ -object frmDiagnosticTests: TfrmDiagnosticTests +inherited frmDiagnosticTests: TfrmDiagnosticTests Left = 0 Top = 0 BorderIcons = [biSystemMenu] @@ -6,13 +6,9 @@ object frmDiagnosticTests: TfrmDiagnosticTests Caption = 'Diagnostic Tests' ClientHeight = 166 ClientWidth = 362 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False + ExplicitWidth = 368 + ExplicitHeight = 195 PixelsPerInch = 96 TextHeight = 13 object cmdSendTestException: TButton diff --git a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas index 13b080d607..3055ab2fb3 100644 --- a/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas +++ b/windows/src/desktop/kmshell/util/Keyman.Configuration.UI.UfrmDiagnosticTests.pas @@ -4,10 +4,11 @@ interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, - Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls; + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, + UfrmKeymanBase; type - TfrmDiagnosticTests = class(TForm) + TfrmDiagnosticTests = class(TfrmKeymanBase) cmdSendTestException: TButton; cmdSendTestCOMAPIException: TButton; cmdClose: TButton; diff --git a/windows/src/engine/keyman/keyman.dpr b/windows/src/engine/keyman/keyman.dpr index a4245285fa..ee7703e391 100644 --- a/windows/src/engine/keyman/keyman.dpr +++ b/windows/src/engine/keyman/keyman.dpr @@ -70,7 +70,6 @@ uses UfrmOSKFontHelper in 'viskbd\UfrmOSKFontHelper.pas' {frmOSKFontHelper}, HintConsts in '..\..\global\delphi\hints\HintConsts.pas', KeymanHints in 'KeymanHints.pas', - UfrmKeymanBase in '..\..\global\delphi\ui\UfrmKeymanBase.pas' {frmKeymanBase: TTntForm}, Hints in '..\..\global\delphi\hints\Hints.pas', utilcheckfonts in '..\..\global\delphi\general\utilcheckfonts.pas', findfonts in '..\..\global\delphi\general\findfonts.pas', diff --git a/windows/src/engine/keyman/keyman.dproj b/windows/src/engine/keyman/keyman.dproj index 5e5c35d928..63bd58e761 100644 --- a/windows/src/engine/keyman/keyman.dproj +++ b/windows/src/engine/keyman/keyman.dproj @@ -171,10 +171,6 @@ - -
frmKeymanBase
- TTntForm -
@@ -297,9 +293,9 @@ False - + - keyman.exe + .\ true @@ -309,9 +305,9 @@ true - + - .\ + keyman.exe true diff --git a/windows/src/engine/keyman/viskbd/UfrmOSKFontHelper.pas b/windows/src/engine/keyman/viskbd/UfrmOSKFontHelper.pas index 19083e909e..02da0309ce 100644 --- a/windows/src/engine/keyman/viskbd/UfrmOSKFontHelper.pas +++ b/windows/src/engine/keyman/viskbd/UfrmOSKFontHelper.pas @@ -54,7 +54,6 @@ uses ClearTypeDrawCharacter, keymanapi_TLB, - UfrmKeymanBase, UfrmOSKPlugInBase, UserMessages, utilcheckfonts; diff --git a/windows/src/ext/sentry/Sentry.Client.pas b/windows/src/ext/sentry/Sentry.Client.pas index fc823bfaa7..d1aaf7d67b 100644 --- a/windows/src/ext/sentry/Sentry.Client.pas +++ b/windows/src/ext/sentry/Sentry.Client.pas @@ -83,6 +83,8 @@ type function MessageEvent(Level: TSentryLevel; const Message: string; IncludeStack: Boolean = False): string; function ExceptionEvent(const ExceptionClassName, Message: string; AExceptAddr: Pointer = nil): string; + procedure Breadcrumb(const BreadcrumbType, Message: string; const Category: string = ''; const Level: string = 'info'); + property OnBeforeEvent: TSentryClientBeforeEvent read FOnBeforeEvent write FOnBeforeEvent; property OnAfterEvent: TSentryClientAfterEvent read FOnAfterEvent write FOnAfterEvent; @@ -356,6 +358,18 @@ begin end; end; +procedure TSentryClient.Breadcrumb(const BreadcrumbType, Message: string; const Category: string = ''; const Level: string = 'info'); +var + crumb: sentry_value_t; +begin + crumb := sentry_value_new_breadcrumb(PAnsiChar(UTF8Encode(BreadcrumbType)), PAnsiChar(UTF8Encode(Message))); + if Category <> '' then + sentry_value_set_by_key(crumb, 'category', sentry_value_new_string(PAnsiChar(UTF8Encode(Category)))); + if Level <> '' then + sentry_value_set_by_key(crumb, 'level', sentry_value_new_string(PAnsiChar(UTF8Encode(Level)))); + sentry_add_breadcrumb(crumb); +end; + function TSentryClient.ConvertRawStackToSentryStack(wrapWithThread: Boolean): sentry_value_t; var frames, s_frame, stacktrace, thread, threads: sentry_value_t; diff --git a/windows/src/global/delphi/general/Keyman.System.KeymanSentryClient.pas b/windows/src/global/delphi/general/Keyman.System.KeymanSentryClient.pas index 4af511157c..ef9c767f30 100644 --- a/windows/src/global/delphi/general/Keyman.System.KeymanSentryClient.pas +++ b/windows/src/global/delphi/general/Keyman.System.KeymanSentryClient.pas @@ -35,6 +35,8 @@ type class procedure ReportHandledException(E: Exception; const Message: string = ''; IncludeStack: Boolean = True); + class procedure Breadcrumb(const BreadcrumbType, Message: string; const Category: string = ''; const Level: string = 'info'); + class procedure Start(SentryClientClass: TSentryClientClass; AProject: TKeymanSentryClientProject; const ALogger: string; AFlags: TKeymanSentryClientFlags = [kscfCaptureExceptions, kscfShowUI, kscfTerminate]); class procedure Stop; class property Client: TSentryClient read FClient; @@ -115,6 +117,13 @@ begin Result := ''; end; +class procedure TKeymanSentryClient.Breadcrumb(const BreadcrumbType, Message, + Category, Level: string); +begin + if Enabled then + Client.Breadcrumb(BreadcrumbType, Message, Category, Level); +end; + procedure TKeymanSentryClient.ClientAfterEvent(Sender: TObject; EventType: TSentryClientEventType; const EventID, EventClassName, Message: string; var EventAction: TSentryClientEventAction); diff --git a/windows/src/global/delphi/general/UfrmScriptError.dfm b/windows/src/global/delphi/general/UfrmScriptError.dfm deleted file mode 100644 index 706452ebad..0000000000 --- a/windows/src/global/delphi/general/UfrmScriptError.dfm +++ /dev/null @@ -1,83 +0,0 @@ -object frmScriptError: TfrmScriptError - Left = 0 - Top = 0 - BorderIcons = [biSystemMenu] - BorderStyle = bsDialog - Caption = 'Script Error' - ClientHeight = 201 - ClientWidth = 487 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'Tahoma' - Font.Style = [] - OldCreateOrder = False - Position = poScreenCenter - PixelsPerInch = 96 - TextHeight = 13 - object lblBlurb1: TLabel - Left = 16 - Top = 16 - Width = 455 - Height = 13 - Caption = - 'We are very sorry but an error has been encountered in this wind' + - 'ow. The error received was:' - end - object lblError: TLabel - Left = 36 - Top = 44 - Width = 397 - Height = 45 - AutoSize = False - end - object lblBlurb2: TLabel - Left = 16 - Top = 108 - Width = 321 - Height = 13 - Caption = - 'Do you want to try continuing? In many cases this will be just ' + - 'fine.' - end - object cmdContinue: TButton - Left = 16 - Top = 161 - Width = 95 - Height = 25 - Caption = '&Try and continue' - Default = True - ModalResult = 6 - TabOrder = 0 - end - object cmdExit: TButton - Left = 376 - Top = 161 - Width = 95 - Height = 25 - Caption = 'E&xit Application' - ModalResult = 3 - TabOrder = 1 - end - object cmdCancel: TButton - Left = 117 - Top = 161 - Width = 95 - Height = 25 - Cancel = True - Caption = '&Cancel' - ModalResult = 2 - TabOrder = 2 - end - object chkTellKeymanSupport: TCheckBox - Left = 16 - Top = 138 - Width = 225 - Height = 17 - Caption = 'Tell Keyman Support about this error' - Checked = True - State = cbChecked - TabOrder = 3 - end -end diff --git a/windows/src/global/delphi/general/UfrmScriptError.pas b/windows/src/global/delphi/general/UfrmScriptError.pas deleted file mode 100644 index 96327ba5f1..0000000000 --- a/windows/src/global/delphi/general/UfrmScriptError.pas +++ /dev/null @@ -1,61 +0,0 @@ -(* - Name: UfrmScriptError - Copyright: Copyright (C) 2003-2017 SIL International. - Documentation: - Description: - Create Date: 6 Feb 2012 - - Modified Date: 4 Nov 2012 - Authors: mcdurdin - Related Files: - Dependencies: - - Bugs: - Todo: - Notes: - History: 06 Feb 2012 - mcdurdin - I2992 - Handle script errors more cleanly - 04 Nov 2012 - mcdurdin - I3544 - V9.0 - Merge of I2992 - Handle script errors more cleanly -*) -unit UfrmScriptError; // I3544 - -interface - -uses - Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls; - -type - TfrmScriptError = class(TForm) - lblBlurb1: TLabel; - lblError: TLabel; - lblBlurb2: TLabel; - cmdContinue: TButton; - cmdExit: TButton; - cmdCancel: TButton; - chkTellKeymanSupport: TCheckBox; - private - { Private declarations } - public - { Public declarations } - end; - -/// Return values. mrYes = continue, mrCancel = cancel, mrAbort = exit app -function ShowScriptErrorDialog(Owner: TComponent; Message: WideString; var TellKeymanSupport: Boolean): TModalResult; - -implementation - -{$R *.dfm} - -function ShowScriptErrorDialog(Owner: TComponent; Message: WideString; var TellKeymanSupport: Boolean): TModalResult; -begin - with TfrmScriptError.Create(Owner) do - try - lblError.Caption := Message; - Result := ShowModal; - TellKeymanSupport := chkTellKeymanSupport.Checked; - finally - Free; - end; -end; - -end. diff --git a/windows/src/global/delphi/ui/UfrmKeymanBase.pas b/windows/src/global/delphi/ui/UfrmKeymanBase.pas index 0bb0134a57..2c6159b023 100644 --- a/windows/src/global/delphi/ui/UfrmKeymanBase.pas +++ b/windows/src/global/delphi/ui/UfrmKeymanBase.pas @@ -64,18 +64,21 @@ uses System.Win.Registry, ErrorControlledRegistry, + Keyman.System.KeymanSentryClient, RegistryKeys; {$R *.DFM} procedure TfrmKeymanBase.TntFormCreate(Sender: TObject); begin + TKeymanSentryClient.Breadcrumb('user', 'Created form '+ClassName, 'form-create'); RegisterWindow; // I2720 end; procedure TfrmKeymanBase.TntFormDestroy(Sender: TObject); begin DeregisterWindow; // I2720 + TKeymanSentryClient.Breadcrumb('user', 'Destroyed form '+ClassName, 'form-destroy'); end; function TfrmKeymanBase.TntFormHelp(Command: Word; Data: NativeInt; var CallHelp: Boolean): Boolean; diff --git a/windows/src/global/delphi/ui/UfrmWebContainer.pas b/windows/src/global/delphi/ui/UfrmWebContainer.pas index 265bdb85c3..ea00447b62 100644 --- a/windows/src/global/delphi/ui/UfrmWebContainer.pas +++ b/windows/src/global/delphi/ui/UfrmWebContainer.pas @@ -110,9 +110,9 @@ uses custinterfaces, ErrorControlledRegistry, Keyman.Configuration.System.UmodWebHttpServer, + Keyman.System.KeymanSentryClient, kmint, UILanguages, - UfrmScriptError, Upload_Settings, utilexecute, utilsystem, @@ -220,6 +220,7 @@ end; procedure TfrmWebContainer.cefCommand(Sender: TObject; const command: string; params: TStringList); begin + TKeymanSentryClient.Breadcrumb('user', 'Clicked '+command+' in '+ClassName, 'click'); FireCommand(command, params); end;