SynEdit: Cleaned up, some old properties from SynSelection

git-svn-id: trunk@20940 -
This commit is contained in:
martin 2009-07-24 23:00:47 +00:00
parent 02cec874b0
commit 48efa0db01
2 changed files with 14 additions and 16 deletions

View File

@ -1544,7 +1544,6 @@ begin
TSynEditStringList(FLines).RedoList := fRedoList; TSynEditStringList(FLines).RedoList := fRedoList;
FBlockSelection := TSynEditSelection.Create(FTheLinesView); FBlockSelection := TSynEditSelection.Create(FTheLinesView);
FBlockSelection.MaxLeftChar := @FMaxLeftChar;
FBlockSelection.Caret := FCaret; FBlockSelection.Caret := FCaret;
FBlockSelection.UndoList := fUndoList; FBlockSelection.UndoList := fUndoList;
FBlockSelection.InvalidateLinesMethod := {$IFDEF FPC}@{$ENDIF}InvalidateLines; FBlockSelection.InvalidateLinesMethod := {$IFDEF FPC}@{$ENDIF}InvalidateLines;
@ -1807,7 +1806,7 @@ begin
FreeAndNil(fFontDummy); FreeAndNil(fFontDummy);
FreeAndNil(FWordBreaker); FreeAndNil(FWordBreaker);
FreeAndNil(FFoldedLinesView); FreeAndNil(FFoldedLinesView);
FreeAndNil(fBlockSelection); FreeAndNil(FBlockSelection);
FreeAndNil(FStrings); FreeAndNil(FStrings);
FreeAndNil(FTabbedLinesView); FreeAndNil(FTabbedLinesView);
FreeAndNil(FTrimmedLinesView); FreeAndNil(FTrimmedLinesView);
@ -6376,7 +6375,6 @@ begin
if (Value <> fTabWidth) then begin if (Value <> fTabWidth) then begin
fTabWidth := Value; fTabWidth := Value;
FTabbedLinesView.TabWidth := Value; FTabbedLinesView.TabWidth := Value;
FBlockSelection.TabWidth := Value;
Invalidate; // to redraw text containing tab chars Invalidate; // to redraw text containing tab chars
end; end;
end; end;

View File

@ -52,7 +52,6 @@ type
FLines: TSynEditStrings; FLines: TSynEditStrings;
FOnChangeList: TMethodList; FOnChangeList: TMethodList;
FLockCount: Integer; FLockCount: Integer;
FMaxLeftChar: PInteger;
procedure DoLock; virtual; procedure DoLock; virtual;
Procedure DoUnlock; virtual; Procedure DoUnlock; virtual;
public public
@ -64,7 +63,6 @@ type
procedure Lock; procedure Lock;
Procedure Unlock; Procedure Unlock;
property Lines: TSynEditStrings read FLines write FLines; property Lines: TSynEditStrings read FLines write FLines;
property MaxLeftChar: PInteger write FMaxLeftChar;
end; end;
TSynEditCaret = class; TSynEditCaret = class;
@ -76,7 +74,6 @@ type
fUndoList: TSynEditUndoList; fUndoList: TSynEditUndoList;
FInvalidateLinesMethod: TInvalidateLines; FInvalidateLinesMethod: TInvalidateLines;
FEnabled: Boolean; FEnabled: Boolean;
FTabWidth: Integer;
FActiveSelectionMode: TSynSelectionMode; FActiveSelectionMode: TSynSelectionMode;
FSelectionMode: TSynSelectionMode; FSelectionMode: TSynSelectionMode;
FStartLinePos: Integer; // 1 based FStartLinePos: Integer; // 1 based
@ -128,8 +125,6 @@ type
property InvalidateLinesMethod : TInvalidateLines write FInvalidateLinesMethod; property InvalidateLinesMethod : TInvalidateLines write FInvalidateLinesMethod;
property Caret: TSynEditCaret read FCaret write SetCaret; property Caret: TSynEditCaret read FCaret write SetCaret;
property UndoList: TSynEditUndoList read fUndoList write fUndoList; property UndoList: TSynEditUndoList read fUndoList write fUndoList;
// TODO: Move dependend functions to Lines
property TabWidth: integer read FTabWidth write FTabWidth;
end; end;
{ TSynEditCaret } { TSynEditCaret }
@ -145,6 +140,8 @@ type
FOldLinePos: Integer; // 1 based FOldLinePos: Integer; // 1 based
FOldCharPos: Integer; // 1 based FOldCharPos: Integer; // 1 based
FAdjustToNextChar: Boolean; FAdjustToNextChar: Boolean;
FMaxLeftChar: PInteger;
procedure AdjustToChar; procedure AdjustToChar;
procedure InternalSetLineCharPos(NewLine, NewCharPos: Integer; procedure InternalSetLineCharPos(NewLine, NewCharPos: Integer;
KeepLastCharPos: Boolean = False); KeepLastCharPos: Boolean = False);
@ -181,6 +178,7 @@ type
property AdjustToNextChar: Boolean read FAdjustToNextChar write FAdjustToNextChar; property AdjustToNextChar: Boolean read FAdjustToNextChar write FAdjustToNextChar;
property AllowPastEOL: Boolean read FAllowPastEOL write SetAllowPastEOL; property AllowPastEOL: Boolean read FAllowPastEOL write SetAllowPastEOL;
property KeepCaretX: Boolean read FKeepCaretX write SetKeepCaretX; property KeepCaretX: Boolean read FKeepCaretX write SetKeepCaretX;
property MaxLeftChar: PInteger write FMaxLeftChar;
end; end;
implementation implementation
@ -901,15 +899,16 @@ end;
procedure TSynEditSelection.SetStartLineBytePos(Value : TPoint); procedure TSynEditSelection.SetStartLineBytePos(Value : TPoint);
// logical position (byte) // logical position (byte)
var var
nInval1, nInval2, nMaxX: integer; nInval1, nInval2: integer;
SelChanged: boolean; SelChanged: boolean;
Line: string; Line: string;
begin begin
Value.y := MinMax(Value.y, 1, fLines.Count); Value.y := MinMax(Value.y, 1, fLines.Count);
Line := Lines[Value.y - 1]; Line := Lines[Value.y - 1];
nMaxX := Max(Lines.LogicalToPhysicalCol(Line, Value.y - 1, length(Line)+1), if FCaret.AllowPastEOL then
FMaxLeftChar^); Value.x := Max(Value.x, 1)
Value.x := MinMax(Value.x, 1, nMaxX); else
Value.x := MinMax(Value.x, 1, Lines.LogicalToPhysicalCol(Line, Value.y - 1, length(Line)+1));
if (ActiveSelectionMode = smNormal) then if (ActiveSelectionMode = smNormal) then
if (Value.y >= 1) and (Value.y <= FLines.Count) then if (Value.y >= 1) and (Value.y <= FLines.Count) then
Value.x := AdjustBytePosToCharacterStart(Value.y,Value.x) Value.x := AdjustBytePosToCharacterStart(Value.y,Value.x)
@ -946,7 +945,7 @@ end;
procedure TSynEditSelection.SetEndLineBytePos(Value : TPoint); procedure TSynEditSelection.SetEndLineBytePos(Value : TPoint);
var var
nLine, nMaxX: integer; nLine: integer;
Line: String; Line: String;
{$IFDEF SYN_MBCSSUPPORT} {$IFDEF SYN_MBCSSUPPORT}
s: string; s: string;
@ -955,9 +954,10 @@ begin
if FEnabled then begin if FEnabled then begin
Value.y := MinMax(Value.y, 1, fLines.Count); Value.y := MinMax(Value.y, 1, fLines.Count);
Line := Lines[Value.y - 1]; Line := Lines[Value.y - 1];
nMaxX := Max(Lines.LogicalToPhysicalCol(Line, Value.y - 1, length(Line)+1), if FCaret.AllowPastEOL then
FMaxLeftChar^); Value.x := Max(Value.x, 1)
Value.x := MinMax(Value.x, 1, nMaxX); else
Value.x := MinMax(Value.x, 1, Lines.LogicalToPhysicalCol(Line, Value.y - 1, length(Line)+1));
if (ActiveSelectionMode = smNormal) then if (ActiveSelectionMode = smNormal) then
if (Value.y >= 1) and (Value.y <= fLines.Count) then if (Value.y >= 1) and (Value.y <= fLines.Count) then
Value.x := AdjustBytePosToCharacterStart(Value.y,Value.x) Value.x := AdjustBytePosToCharacterStart(Value.y,Value.x)