[Developer] Restore support for 'reformat xml document' in ACE editor

This commit is contained in:
Marc Durdin 2018-08-27 22:24:32 +10:00
parent 2c6c44f1ca
commit bf6efedf62
6 changed files with 46 additions and 7 deletions

View file

@ -71,10 +71,13 @@ type
IKMDTextEditorActions = interface(IKMDSearchActions)
['{118B5CF5-7FED-4669-9A51-7DC58BF571D4}']
function GetText: string;
procedure SetText(const Value: string);
function GetSelectedRow: Integer;
function GetEditorFormat: TEditorFormat;
property EditorFormat: TEditorFormat read GetEditorFormat;
property SelectedRow: Integer read GetSelectedRow;
property Text: string read GetText write SetText;
end;
implementation

View file

@ -178,9 +178,11 @@ begin
end;
procedure TmodActionsTextEditor.actTextEditor_ReformatXMLExecute(Sender: TObject);
var
a: IKMDTextEditorActions;
begin
{TODO: with Screen.ActiveControl as TKeymanDeveloperMemo do
SetTextBuf(PWideChar(FormatXMLData(Text)));}
a := KMDActions.GetTextEditorController(Screen.ActiveControl);
a.Text := FormatXMLData(a.Text);
end;
procedure TmodActionsTextEditor.actTextEditor_ReformatXMLUpdate(

View file

@ -3142,6 +3142,7 @@ begin
if pagesTouchLayout.ActivePage = pageTouchLayoutCode then
begin
frameTouchLayoutSource.EditorText := frameTouchLayout.SaveToString;
DoFocus(frameTouchLayout);
end;
FLoading := False;
end;

View file

@ -19,6 +19,7 @@ inherited frameOnScreenKeyboardEditor: TframeOnScreenKeyboardEditor
Align = alClient
TabOrder = 0
TabPosition = tpBottom
OnChange = pagesChange
OnChanging = pagesChanging
object pageDesign: TTabSheet
Caption = 'Design'
@ -365,10 +366,6 @@ inherited frameOnScreenKeyboardEditor: TframeOnScreenKeyboardEditor
object pageCode: TTabSheet
Caption = 'Code'
ImageIndex = -1
ExplicitLeft = 0
ExplicitTop = 0
ExplicitWidth = 0
ExplicitHeight = 380
end
end
object dlgVKImportXML: TOpenDialog

View file

@ -140,6 +140,7 @@ type
procedure tmrUpdateCharacterMapTimer(Sender: TObject);
procedure TntFormDestroy(Sender: TObject);
procedure pagesChanging(Sender: TObject; var AllowChange: Boolean);
procedure pagesChange(Sender: TObject);
private
FVKSetup: Boolean;
@ -185,9 +186,11 @@ type
protected
function GetHelpTopic: string; override;
public
procedure Load;
procedure Save;
procedure UpdateControls;
procedure SetFocus; override;
property UnderlyingLayout: HKL read GetUnderlyingLayout write SetUnderlyingLayout;
property KeyFont: TFont read GetKeyFont write SetKeyFont; // I4057
property VKModified: Boolean read FVKModified write SetVKModified;
@ -226,6 +229,9 @@ uses
procedure TframeOnScreenKeyboardEditor.FormCreate(Sender: TObject);
begin
inherited;
pages.ActivePage := pageDesign;
FVKUnicode := True;
kbdOnScreen.SelectedKey := kbdOnScreen.Keys[0];
@ -251,6 +257,13 @@ begin
FreeAndNil(FVK); // I2794
end;
procedure TframeOnScreenKeyboardEditor.SetFocus;
begin
inherited;
if pages.ActivePage = pageCode then
frameSource.SetFocus;
end;
procedure TframeOnScreenKeyboardEditor.SetKeyFont(const Value: TFont); // I4057
begin
if not FVKUnicode
@ -311,6 +324,13 @@ end;
{ - Tab interactions - }
{ ---------------------------------------------------------------------------- }
procedure TframeOnScreenKeyboardEditor.pagesChange(Sender: TObject);
begin
inherited;
if pages.ActivePage = pageCode then
frameSource.SetFocus;
end;
procedure TframeOnScreenKeyboardEditor.pagesChanging(Sender: TObject;
var AllowChange: Boolean);
begin

View file

@ -18,7 +18,7 @@ uses
type
TParColourLineType = (pcltNone, pcltBreakpoint, pcltExecutionPoint, pcltError);
TframeTextEditor = class(TTIKEForm, IKMDSearchActions, IKMDEditActions, IKMDTextEditorActions)
TframeTextEditor = class(TTIKEForm, IKMDEditActions, IKMDSearchActions, IKMDTextEditorActions)
lstImages: TMenuImgList;
dlgFonts: TFontDialog;
dlgPrintSetup: TPrinterSetupDialog;
@ -65,6 +65,7 @@ type
procedure ExecuteCommand(const command: string; const parameters: TJSONValue = nil);
procedure UpdateToken(command: string);
procedure SetCursorPosition(AColumn, ARow: Integer);
protected
function GetHelpTopic: string; override;
@ -78,6 +79,10 @@ type
function CanEditFindNext: Boolean;
{ IKMDEditActions }
function IKMDTextEditorActions_GetText: string;
procedure IKMDTextEditorActions_SetText(const Value: string);
function IKMDTextEditorActions.GetText = IKMDTextEditorActions_GetText;
procedure IKMDTextEditorActions.SetText = IKMDTextEditorActions_SetText;
procedure CutToClipboard;
procedure CopyToClipboard;
procedure PasteFromClipboard;
@ -252,6 +257,16 @@ begin
Result := modWebHttpServer.AppSource.GetSource(FFileName);
end;
function TframeTextEditor.IKMDTextEditorActions_GetText: string;
begin
Result := GetText;
end;
procedure TframeTextEditor.IKMDTextEditorActions_SetText(const Value: string);
begin
SetText(Value);
end;
procedure TframeTextEditor.LoadFromFile(AFileName: WideString);
var
fs: TFileStream;
@ -483,6 +498,7 @@ end;
procedure TframeTextEditor.SetFocus;
begin
inherited;
cef.SetFocus;
end;