mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:39:15 +02:00
IDE/SynEdit (windows only): Add option to choose IME mode
git-svn-id: trunk@36142 -
This commit is contained in:
parent
d3541e702d
commit
4738029f35
@ -422,15 +422,20 @@ type
|
|||||||
|
|
||||||
TCustomSynEdit = class(TSynEditBase)
|
TCustomSynEdit = class(TSynEditBase)
|
||||||
procedure SelAvailChange(Sender: TObject);
|
procedure SelAvailChange(Sender: TObject);
|
||||||
|
{$IFDEF WinIME}
|
||||||
private
|
private
|
||||||
{$IFDEF WinIME}
|
|
||||||
FImeHandler: LazSynIme;
|
FImeHandler: LazSynIme;
|
||||||
|
procedure SetImeHandler(AValue: LazSynIme);
|
||||||
procedure WMImeRequest(var Msg: TMessage); message WM_IME_REQUEST;
|
procedure WMImeRequest(var Msg: TMessage); message WM_IME_REQUEST;
|
||||||
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY;
|
||||||
procedure WMImeStartComposition(var Msg: TMessage); message WM_IME_STARTCOMPOSITION;
|
procedure WMImeStartComposition(var Msg: TMessage); message WM_IME_STARTCOMPOSITION;
|
||||||
procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION;
|
procedure WMImeComposition(var Msg: TMessage); message WM_IME_COMPOSITION;
|
||||||
procedure WMImeEndComposition(var Msg: TMessage); message WM_IME_ENDCOMPOSITION;
|
procedure WMImeEndComposition(var Msg: TMessage); message WM_IME_ENDCOMPOSITION;
|
||||||
{$ENDIF}
|
protected
|
||||||
|
// SynEdit takes ownership
|
||||||
|
property ImeHandler: LazSynIme read FImeHandler write SetImeHandler;
|
||||||
|
{$ENDIF}
|
||||||
|
private
|
||||||
procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES;
|
procedure WMDropFiles(var Msg: TMessage); message WM_DROPFILES;
|
||||||
procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
|
procedure WMEraseBkgnd(var Msg: TMessage); message WM_ERASEBKGND;
|
||||||
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
|
procedure WMGetDlgCode(var Msg: TWMGetDlgCode); message WM_GETDLGCODE;
|
||||||
@ -741,6 +746,8 @@ type
|
|||||||
procedure SetUpdateState(NewUpdating: Boolean; Sender: TObject); virtual; // Called *before* paintlock, and *after* paintlock
|
procedure SetUpdateState(NewUpdating: Boolean; Sender: TObject); virtual; // Called *before* paintlock, and *after* paintlock
|
||||||
|
|
||||||
property PaintLockOwner: TSynEditBase read GetPaintLockOwner write SetPaintLockOwner;
|
property PaintLockOwner: TSynEditBase read GetPaintLockOwner write SetPaintLockOwner;
|
||||||
|
property TextDrawer: TheTextDrawer read fTextDrawer;
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure CreateHandle; override;
|
procedure CreateHandle; override;
|
||||||
procedure CreateParams(var Params: TCreateParams); override;
|
procedure CreateParams(var Params: TCreateParams); override;
|
||||||
@ -2517,6 +2524,13 @@ begin
|
|||||||
FImeHandler.WMImeRequest(Msg);
|
FImeHandler.WMImeRequest(Msg);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.SetImeHandler(AValue: LazSynIme);
|
||||||
|
begin
|
||||||
|
if FImeHandler = AValue then Exit;
|
||||||
|
FreeAndNil(FImeHandler);
|
||||||
|
FImeHandler := AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage);
|
procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage);
|
||||||
begin
|
begin
|
||||||
FImeHandler.WMImeNotify(Msg);
|
FImeHandler.WMImeNotify(Msg);
|
||||||
|
@ -30,6 +30,12 @@ unit EditorOptions;
|
|||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$IFDEF Windows}
|
||||||
|
{$IFnDEF WithoutWinIME}
|
||||||
|
{$DEFINE WinIME}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -1161,6 +1167,9 @@ type
|
|||||||
FHideSingleTabInWindow: Boolean;
|
FHideSingleTabInWindow: Boolean;
|
||||||
FPasStringKeywordMode: TSynPasStringMode;
|
FPasStringKeywordMode: TSynPasStringMode;
|
||||||
FTopInfoView: boolean;
|
FTopInfoView: boolean;
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
FUseMinimumIme: Boolean;
|
||||||
|
{$ENDIF}
|
||||||
xmlconfig: TRttiXMLConfig;
|
xmlconfig: TRttiXMLConfig;
|
||||||
|
|
||||||
// general options
|
// general options
|
||||||
@ -1408,6 +1417,10 @@ type
|
|||||||
published { use RTTIConf}
|
published { use RTTIConf}
|
||||||
property TabPosition: TTabPosition
|
property TabPosition: TTabPosition
|
||||||
read fTabPosition write fTabPosition default tpTop;
|
read fTabPosition write fTabPosition default tpTop;
|
||||||
|
// General - Misc
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
property UseMinimumIme: Boolean read FUseMinimumIme write FUseMinimumIme default False;
|
||||||
|
{$ENDIF}
|
||||||
// Display
|
// Display
|
||||||
property ShowOverviewGutter: boolean
|
property ShowOverviewGutter: boolean
|
||||||
read FShowOverviewGutter write FShowOverviewGutter default True;
|
read FShowOverviewGutter write FShowOverviewGutter default True;
|
||||||
@ -4650,6 +4663,14 @@ begin
|
|||||||
ASynEdit.TrimSpaceType := FTrimSpaceType;
|
ASynEdit.TrimSpaceType := FTrimSpaceType;
|
||||||
ASynEdit.TabWidth := fTabWidth;
|
ASynEdit.TabWidth := fTabWidth;
|
||||||
ASynEdit.BracketHighlightStyle := FBracketHighlightStyle;
|
ASynEdit.BracketHighlightStyle := FBracketHighlightStyle;
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
if ASynEdit is TIDESynEditor then begin
|
||||||
|
if UseMinimumIme
|
||||||
|
then TIDESynEditor(ASynEdit).CreateMinimumIme
|
||||||
|
else TIDESynEditor(ASynEdit).CreateFullIme;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
// Display options
|
// Display options
|
||||||
ASynEdit.Gutter.Visible := fVisibleGutter;
|
ASynEdit.Gutter.Visible := fVisibleGutter;
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
object EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
||||||
|
Left = 0
|
||||||
Height = 232
|
Height = 232
|
||||||
|
Top = 0
|
||||||
Width = 460
|
Width = 460
|
||||||
ClientHeight = 232
|
ClientHeight = 232
|
||||||
ClientWidth = 460
|
ClientWidth = 460
|
||||||
@ -7,7 +9,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
|||||||
Visible = False
|
Visible = False
|
||||||
DesignLeft = 138
|
DesignLeft = 138
|
||||||
DesignTop = 138
|
DesignTop = 138
|
||||||
object EditorTrimSpaceTypeLabel: TLabel[0]
|
object EditorTrimSpaceTypeLabel: TLabel
|
||||||
AnchorSideLeft.Control = EditorTrimSpaceTypeCheckBox
|
AnchorSideLeft.Control = EditorTrimSpaceTypeCheckBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
||||||
@ -20,7 +22,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
|||||||
Caption = 'EditorTrimSpaceTypeLabel'
|
Caption = 'EditorTrimSpaceTypeLabel'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
object EditorOptionsGroupBox: TCheckGroup[1]
|
object EditorOptionsGroupBox: TCheckGroup
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
AnchorSideRight.Control = Owner
|
AnchorSideRight.Control = Owner
|
||||||
@ -48,7 +50,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
|||||||
OnItemClick = EditorOptionsGroupBoxItemClick
|
OnItemClick = EditorOptionsGroupBoxItemClick
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object EditorTrimSpaceTypeCheckBox: TComboBox[2]
|
object EditorTrimSpaceTypeCheckBox: TComboBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = EditorOptionsGroupBox
|
AnchorSideTop.Control = EditorOptionsGroupBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
@ -61,7 +63,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
|||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
end
|
end
|
||||||
object EditorTabPositionCheckBox: TComboBox[3]
|
object EditorTabPositionCheckBox: TComboBox
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
AnchorSideTop.Control = EditorTrimSpaceTypeCheckBox
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
@ -74,7 +76,7 @@ inherited EditorGeneralMiscOptionsFrame: TEditorGeneralMiscOptionsFrame
|
|||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object EditorTabPositionLabel: TLabel[4]
|
object EditorTabPositionLabel: TLabel
|
||||||
AnchorSideLeft.Control = EditorTrimSpaceTypeCheckBox
|
AnchorSideLeft.Control = EditorTrimSpaceTypeCheckBox
|
||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideTop.Control = EditorTabPositionCheckBox
|
AnchorSideTop.Control = EditorTabPositionCheckBox
|
||||||
|
@ -22,6 +22,12 @@ unit editor_general_misc_options;
|
|||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
{$IFDEF Windows}
|
||||||
|
{$IFnDEF WithoutWinIME}
|
||||||
|
{$DEFINE WinIME}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -79,6 +85,9 @@ begin
|
|||||||
Items.Add(dlgFindTextatCursor);
|
Items.Add(dlgFindTextatCursor);
|
||||||
Items.Add(dlgCopyWordAtCursorOnCopyNone);
|
Items.Add(dlgCopyWordAtCursorOnCopyNone);
|
||||||
Items.Add(dlgCopyPasteKeepFolds);
|
Items.Add(dlgCopyPasteKeepFolds);
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
Items.Add(dlgUseMinimumIme);
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypeLeaveLine);
|
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypeLeaveLine);
|
||||||
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypeEditLine);
|
EditorTrimSpaceTypeCheckBox.Items.Add(dlgTrimSpaceTypeEditLine);
|
||||||
@ -106,6 +115,9 @@ begin
|
|||||||
Checked[2] := FindTextAtCursor;
|
Checked[2] := FindTextAtCursor;
|
||||||
Checked[3] := CopyWordAtCursorOnCopyNone;
|
Checked[3] := CopyWordAtCursorOnCopyNone;
|
||||||
Checked[4] := eoFoldedCopyPaste in SynEditOptions2;
|
Checked[4] := eoFoldedCopyPaste in SynEditOptions2;
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
Checked[5] := UseMinimumIme;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
EditorTrimSpaceTypeCheckBox.ItemIndex := ord(TrimSpaceType);
|
EditorTrimSpaceTypeCheckBox.ItemIndex := ord(TrimSpaceType);
|
||||||
EditorTabPositionCheckBox.ItemIndex := TabPosToIndex[TabPosition];
|
EditorTabPositionCheckBox.ItemIndex := TabPosToIndex[TabPosition];
|
||||||
@ -138,6 +150,9 @@ begin
|
|||||||
SynEditOptions2 := SynEditOptions2 - [eoFoldedCopyPaste];
|
SynEditOptions2 := SynEditOptions2 - [eoFoldedCopyPaste];
|
||||||
TrimSpaceType := TSynEditStringTrimmingType(EditorTrimSpaceTypeCheckBox.ItemIndex);
|
TrimSpaceType := TSynEditStringTrimmingType(EditorTrimSpaceTypeCheckBox.ItemIndex);
|
||||||
TabPosition := TabIndexToPos[EditorTabPositionCheckBox.ItemIndex];
|
TabPosition := TabIndexToPos[EditorTabPositionCheckBox.ItemIndex];
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
UseMinimumIme := EditorOptionsGroupBox.Checked[5];
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -1517,6 +1517,7 @@ resourcestring
|
|||||||
dlgTrimSpaceTypeCaretMove = 'Caret or Edit';
|
dlgTrimSpaceTypeCaretMove = 'Caret or Edit';
|
||||||
dlgTrimSpaceTypePosOnly = 'Position Only';
|
dlgTrimSpaceTypePosOnly = 'Position Only';
|
||||||
dlgCopyPasteKeepFolds = 'Copy/Paste with fold info';
|
dlgCopyPasteKeepFolds = 'Copy/Paste with fold info';
|
||||||
|
dlgUseMinimumIme = 'Ime handled by System';
|
||||||
dlgUndoLimit = 'Undo limit';
|
dlgUndoLimit = 'Undo limit';
|
||||||
dlgTabWidths = 'Tab widths';
|
dlgTabWidths = 'Tab widths';
|
||||||
dlgMarginGutter = 'Margin and gutter';
|
dlgMarginGutter = 'Margin and gutter';
|
||||||
|
@ -34,9 +34,18 @@ unit SourceSynEditor;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
|
{$IFDEF Windows}
|
||||||
|
{$IFnDEF WithoutWinIME}
|
||||||
|
{$DEFINE WinIME}
|
||||||
|
{$ENDIF}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{$I ide.inc}
|
{$I ide.inc}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
LazSynIMM,
|
||||||
|
{$ENDIF}
|
||||||
Classes, SysUtils, Controls, LCLProc, LCLType, Graphics, Menus, math, LazarusIDEStrConsts,
|
Classes, SysUtils, Controls, LCLProc, LCLType, Graphics, Menus, math, LazarusIDEStrConsts,
|
||||||
SynEdit, SynEditMiscClasses, SynGutter, SynGutterBase, SynEditMarks,
|
SynEdit, SynEditMiscClasses, SynGutter, SynGutterBase, SynEditMarks,
|
||||||
SynEditTypes, SynGutterLineNumber, SynGutterCodeFolding, SynGutterMarks, SynGutterChanges,
|
SynEditTypes, SynGutterLineNumber, SynGutterCodeFolding, SynGutterMarks, SynGutterChanges,
|
||||||
@ -154,6 +163,10 @@ type
|
|||||||
//////
|
//////
|
||||||
property TopInfoMarkup: TSynSelectedColor read FTopInfoMarkup write SetTopInfoMarkup;
|
property TopInfoMarkup: TSynSelectedColor read FTopInfoMarkup write SetTopInfoMarkup;
|
||||||
property ShowTopInfo: boolean read FShowTopInfo write SetShowTopInfo;
|
property ShowTopInfo: boolean read FShowTopInfo write SetShowTopInfo;
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
procedure CreateMinimumIme;
|
||||||
|
procedure CreateFullIme;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TIDESynHighlighterPasRangeList = class(TSynHighlighterPasRangeList)
|
TIDESynHighlighterPasRangeList = class(TSynHighlighterPasRangeList)
|
||||||
@ -794,6 +807,29 @@ begin
|
|||||||
Result := TextView.TextIndexToViewPos(aTextIndex - 1);
|
Result := TextView.TextIndexToViewPos(aTextIndex - 1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{$IFDEF WinIME}
|
||||||
|
procedure TIDESynEditor.CreateMinimumIme;
|
||||||
|
var
|
||||||
|
Ime: LazSynIme;
|
||||||
|
begin
|
||||||
|
if ImeHandler is LazSynImeSimple then exit;
|
||||||
|
Ime := LazSynImeSimple.Create(Self);
|
||||||
|
LazSynImeSimple(Ime).TextDrawer := TextDrawer;
|
||||||
|
Ime.InvalidateLinesMethod := @InvalidateLines;
|
||||||
|
ImeHandler := Ime;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TIDESynEditor.CreateFullIme;
|
||||||
|
var
|
||||||
|
Ime: LazSynIme;
|
||||||
|
begin
|
||||||
|
if ImeHandler is LazSynImeFull then exit;
|
||||||
|
Ime := LazSynImeFull.Create(Self);
|
||||||
|
Ime.InvalidateLinesMethod := @InvalidateLines;
|
||||||
|
ImeHandler := Ime;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
{ TIDESynPasSyn }
|
{ TIDESynPasSyn }
|
||||||
|
|
||||||
function TIDESynPasSyn.GetFinalizationLine: Integer;
|
function TIDESynPasSyn.GetFinalizationLine: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user