mirror of
https://github.com/keymanapp/keyman.git
synced 2026-09-21 23:27:39 +00:00
refactor(developer): keyman core library path
This commit is contained in:
parent
63f8137005
commit
4ed4aeebf6
7 changed files with 43 additions and 66 deletions
|
|
@ -183,14 +183,12 @@ uses
|
|||
CaptionPanel in '..\..\global\delphi\comp\CaptionPanel.pas',
|
||||
Glossary in '..\..\global\delphi\general\Glossary.pas',
|
||||
UframeTouchLayoutBuilder in 'oskbuilder\UframeTouchLayoutBuilder.pas' {frameTouchLayoutBuilder},
|
||||
TouchLayoutUtils in 'oskbuilder\TouchLayoutUtils.pas' {,
|
||||
UfrmSelectTouchLayoutTemplate in 'oskbuilder\UfrmSelectTouchLayoutTemplate.pas' {frmSelectTouchLayoutTemplate},
|
||||
TouchLayoutUtils in 'oskbuilder\TouchLayoutUtils.pas',
|
||||
UfrmSelectTouchLayoutTemplate in 'oskbuilder\UfrmSelectTouchLayoutTemplate.pas' {frmSelectTouchLayoutTemplate},
|
||||
OnScreenKeyboardData in '..\..\global\delphi\visualkeyboard\OnScreenKeyboardData.pas',
|
||||
TouchLayout in 'oskbuilder\TouchLayout.pas',
|
||||
TouchLayoutDefinitions in 'oskbuilder\TouchLayoutDefinitions.pas',
|
||||
CharMapDropTool_TntCustomEdit in 'main\CharMapDropTool_TntCustomEdit.pas',
|
||||
keyman_msctf in '..\..\global\delphi\winapi\keyman_msctf.pas',
|
||||
Winapi.UxTheme,
|
||||
CheckboxGridHelper in '..\..\global\delphi\general\CheckboxGridHelper.pas',
|
||||
UfrmAddKeyboardFeature in 'dialogs\UfrmAddKeyboardFeature.pas' {frmAddKeyboardFeature},
|
||||
|
|
|
|||
|
|
@ -413,7 +413,6 @@
|
|||
<DCCReference Include="oskbuilder\TouchLayout.pas"/>
|
||||
<DCCReference Include="oskbuilder\TouchLayoutDefinitions.pas"/>
|
||||
<DCCReference Include="main\CharMapDropTool_TntCustomEdit.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\winapi\keyman_msctf.pas"/>
|
||||
<DCCReference Include="..\..\global\delphi\general\CheckboxGridHelper.pas"/>
|
||||
<DCCReference Include="dialogs\UfrmAddKeyboardFeature.pas">
|
||||
<Form>frmAddKeyboardFeature</Form>
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ uses
|
|||
Keyman.System.Debug.DebugUIStatus,
|
||||
Keyman.System.KeymanCore,
|
||||
Keyman.System.KeymanCoreDebug,
|
||||
msctf,
|
||||
UframeTextEditor,
|
||||
UfrmDebugStatus,
|
||||
UfrmMDIEditor,
|
||||
|
|
@ -110,14 +109,13 @@ type
|
|||
|
||||
procedure ResetEvents;
|
||||
procedure ExecuteEvent(n: Integer);
|
||||
procedure WMUserDebugEnd(var Message: TMessage); message WM_USER_DebugEnd;
|
||||
procedure ExecuteEventAction(n: Integer);
|
||||
procedure ExecuteEventRule(n: Integer);
|
||||
procedure SetExecutionPointLine(ALine: Integer);
|
||||
procedure SetUIStatus(const Value: TDebugUIStatus);
|
||||
procedure DisableUI;
|
||||
procedure EnableUI;
|
||||
procedure SetForceKeyboard(Value: Boolean);
|
||||
procedure SetForceKeyboard(Value: Boolean); // TODO: refactor this away -- we should use only FUIStatus
|
||||
function GetStatusText: string;
|
||||
procedure SetStatusText(Value: string);
|
||||
procedure UpdateDebugStatusForm; // I4809
|
||||
|
|
@ -255,35 +253,18 @@ const
|
|||
- Form events -
|
||||
------------------------------------------------------------------------------}
|
||||
|
||||
var
|
||||
KeymanCoreLoaded: Boolean = False;
|
||||
|
||||
procedure InitKeymanCore;
|
||||
begin
|
||||
if not KeymanCoreLoaded then
|
||||
begin
|
||||
// TODO: debugpath for this
|
||||
_km_kbp_set_library_path(ExtractFilePath(ParamStr(0)) + '..\..\..\..\..\..\..\common\core\desktop\build\x86\debug\src\' + kmnkbp0);
|
||||
KeymanCoreLoaded := True;
|
||||
end;
|
||||
end;
|
||||
procedure TfrmDebug.FormCreate(Sender: TObject);
|
||||
begin
|
||||
inherited;
|
||||
// InitMSCTF; // I3655
|
||||
|
||||
InitKeymanCore;
|
||||
|
||||
FBreakpoints := TDebugBreakpoints.Create;
|
||||
|
||||
FExecutionPointLine := -1;
|
||||
//InitControlCaptions;
|
||||
FUIStatus := duiInvalid;
|
||||
FEvents := TDebugEventList.Create;
|
||||
FDefaultFont := True;
|
||||
memo.Align := alClient;
|
||||
|
||||
//InitSystemKeyboard;
|
||||
UIStatus := duiReadyForInput;
|
||||
|
||||
frmDebugStatus.SetDebugMemo(memo);
|
||||
|
|
@ -871,38 +852,6 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmDebug.WMUserDebugEnd(var Message: TMessage);
|
||||
begin
|
||||
if UIStatus = duiPaused then
|
||||
begin
|
||||
SetCurrentEvent(1);
|
||||
ResetEvents;
|
||||
frmDebugStatus.Key.ShowKey(nil);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
if FEvents.Count > 0 then
|
||||
begin
|
||||
if FSingleStepMode then
|
||||
begin
|
||||
UIStatus := duiDebugging;
|
||||
SetCurrentEvent(1);
|
||||
ExecuteEvent(0);
|
||||
end
|
||||
else
|
||||
begin
|
||||
FRunning := True;
|
||||
UIStatus := duiDebugging;
|
||||
SetCurrentEvent(0);
|
||||
Run;
|
||||
end;
|
||||
end
|
||||
else
|
||||
if memo.Focused
|
||||
then UIStatus := duiFocusedForInput
|
||||
else UIStatus := duiReadyForInput;
|
||||
end;
|
||||
|
||||
procedure TfrmDebug.HideDebugForm;
|
||||
begin
|
||||
frmKeymanDeveloper.ShowDebug(False); // I4796
|
||||
|
|
@ -916,18 +865,15 @@ begin
|
|||
frmKeymanDeveloper.ShowDebug(True); // I4796
|
||||
|
||||
FDebugVisible := True;
|
||||
// FFileName := ChangeFileExt(DebugFileName, '.kmx');
|
||||
|
||||
//UpdateFont(nil);
|
||||
SetupDebug;
|
||||
|
||||
//Keyman_Initialise(Application.MainFormHandle, True); // I2801 // I3283 - remove // I3503
|
||||
memo.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TfrmDebug.ResetDebug;
|
||||
begin
|
||||
//SelectSystemLayout(False);
|
||||
ForceKeyboard := False;
|
||||
FreeAndNil(debugkeyboard);
|
||||
if (frmDebugStatus <> nil) then
|
||||
|
|
@ -1034,8 +980,6 @@ begin
|
|||
FOnUpdateExecutionPoint(Self, ALine);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TfrmDebug.UpdateFont(FFont: TFont);
|
||||
begin
|
||||
if FFont = nil then
|
||||
|
|
|
|||
|
|
@ -147,7 +147,7 @@ uses
|
|||
Vcl.Grids, KeyboardFonts,
|
||||
TempFileManager,
|
||||
UfrmDebugStatus,
|
||||
UKeymanTargets, msctf, Winapi.UxTheme, Vcl.Themes,
|
||||
UKeymanTargets, Winapi.UxTheme, Vcl.Themes,
|
||||
System.Generics.Collections, LeftTabbedPageControl, Vcl.CheckLst;
|
||||
|
||||
type
|
||||
|
|
|
|||
|
|
@ -18,7 +18,8 @@ type
|
|||
FKeyboard: pkm_kbp_keyboard;
|
||||
FState: pkm_kbp_state;
|
||||
FDeadkeys: TDebugDeadkeyInfoList;
|
||||
|
||||
class var KeymanCoreLoaded: Boolean;
|
||||
class procedure InitKeymanCore; static;
|
||||
public
|
||||
constructor Create(const Filename: string; EnableDebug: Boolean);
|
||||
destructor Destroy; override;
|
||||
|
|
@ -30,7 +31,9 @@ type
|
|||
implementation
|
||||
|
||||
uses
|
||||
System.SysUtils;
|
||||
System.SysUtils,
|
||||
|
||||
KeymanPaths;
|
||||
|
||||
{ TDebugCore }
|
||||
|
||||
|
|
@ -40,6 +43,8 @@ var
|
|||
begin
|
||||
inherited Create;
|
||||
|
||||
InitKeymanCore;
|
||||
|
||||
FKeyboard := nil;
|
||||
FState := nil;
|
||||
FDeadkeys := TDebugDeadkeyInfoList.Create;
|
||||
|
|
@ -72,4 +77,16 @@ begin
|
|||
inherited Destroy;
|
||||
end;
|
||||
|
||||
class procedure TDebugCore.InitKeymanCore;
|
||||
var
|
||||
path: string;
|
||||
begin
|
||||
if not KeymanCoreLoaded then
|
||||
begin
|
||||
path := TKeymanPaths.KeymanCoreLibraryPath(kmnkbp0);
|
||||
_km_kbp_set_library_path(path);
|
||||
KeymanCoreLoaded := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
|||
|
|
@ -111,8 +111,6 @@ procedure TfrmDebugStatus_Events.AddActionEvent(action: TDebugEventActionData);
|
|||
begin
|
||||
lbCallStack.Items.AddObject(StringOfChar(' ', FIndent)+message, data);
|
||||
end;
|
||||
var
|
||||
s: string;
|
||||
begin
|
||||
case action.ActionType of
|
||||
KM_KBP_IT_EMIT_KEYSTROKE: AddItem('emit_keystroke', action);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ type
|
|||
class function KeyboardsInstallPath(const filename: string = ''): string; static;
|
||||
class function KeyboardsInstallDir: string; static;
|
||||
class function KeymanConfigStaticHttpFilesPath(const filename: string = ''): string; static;
|
||||
class function KeymanCoreLibraryPath(const Filename: string): string; static;
|
||||
class function CEFPath: string; static; // Chromium Embedded Framework
|
||||
class function CEFDataPath(const mode: string): string; static;
|
||||
class function CEFSubprocessPath: string; static;
|
||||
|
|
@ -406,4 +407,24 @@ begin
|
|||
Result := (keyman_root <> '') and SameText(keyman_root, ParamStr(0).Substring(0, keyman_root.Length));
|
||||
end;
|
||||
|
||||
class function TKeymanPaths.KeymanCoreLibraryPath(const Filename: string): string;
|
||||
var
|
||||
keyman_root: string;
|
||||
begin
|
||||
// Look up KEYMAN_ROOT development variable -- if found and executable
|
||||
// within that path then use that as source path
|
||||
if TKeymanPaths.RunningFromSource(keyman_root) then
|
||||
begin
|
||||
Exit(keyman_root + 'common\core\desktop\build\x86\debug\src\' + Filename);
|
||||
end;
|
||||
|
||||
Result := GetDebugPath('KeymanCoreLibraryPath', '');
|
||||
if Result = '' then
|
||||
begin
|
||||
Result := ExtractFilePath(ParamStr(0));
|
||||
end;
|
||||
|
||||
Result := IncludeTrailingPathDelimiter(Result) + Filename;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue