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