mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:59:19 +02:00
made synedit ClearText undoable
git-svn-id: trunk@7008 -
This commit is contained in:
parent
8abc0f0530
commit
e866be9633
@ -55,6 +55,8 @@ type
|
|||||||
fDoNotLoad: boolean;
|
fDoNotLoad: boolean;
|
||||||
procedure Loaded; override;
|
procedure Loaded; override;
|
||||||
function FindNode(const APath: String; PathHasValue: boolean): TDomNode;
|
function FindNode(const APath: String; PathHasValue: boolean): TDomNode;
|
||||||
|
function ExtendedToStr(const e: extended): string;
|
||||||
|
function StrToExtended(const s: string; const ADefault: extended): extended;
|
||||||
public
|
public
|
||||||
constructor Create(const AFilename: String); overload;
|
constructor Create(const AFilename: String); overload;
|
||||||
constructor CreateClean(const AFilename: String);
|
constructor CreateClean(const AFilename: String);
|
||||||
@ -64,12 +66,17 @@ type
|
|||||||
function GetValue(const APath, ADefault: String): String;
|
function GetValue(const APath, ADefault: String): String;
|
||||||
function GetValue(const APath: String; ADefault: Integer): Integer;
|
function GetValue(const APath: String; ADefault: Integer): Integer;
|
||||||
function GetValue(const APath: String; ADefault: Boolean): Boolean;
|
function GetValue(const APath: String; ADefault: Boolean): Boolean;
|
||||||
|
function GetExtendedValue(const APath: String;
|
||||||
|
const ADefault: extended): extended;
|
||||||
procedure SetValue(const APath, AValue: String);
|
procedure SetValue(const APath, AValue: String);
|
||||||
procedure SetDeleteValue(const APath, AValue, DefValue: String);
|
procedure SetDeleteValue(const APath, AValue, DefValue: String);
|
||||||
procedure SetValue(const APath: String; AValue: Integer);
|
procedure SetValue(const APath: String; AValue: Integer);
|
||||||
procedure SetDeleteValue(const APath: String; AValue, DefValue: Integer);
|
procedure SetDeleteValue(const APath: String; AValue, DefValue: Integer);
|
||||||
procedure SetValue(const APath: String; AValue: Boolean);
|
procedure SetValue(const APath: String; AValue: Boolean);
|
||||||
procedure SetDeleteValue(const APath: String; AValue, DefValue: Boolean);
|
procedure SetDeleteValue(const APath: String; AValue, DefValue: Boolean);
|
||||||
|
procedure SetExtendedValue(const APath: String; const AValue: extended);
|
||||||
|
procedure SetDeleteExtendedValue(const APath: String;
|
||||||
|
const AValue, DefValue: extended);
|
||||||
procedure DeletePath(const APath: string);
|
procedure DeletePath(const APath: string);
|
||||||
procedure DeleteValue(const APath: string);
|
procedure DeleteValue(const APath: string);
|
||||||
property Modified: Boolean read FModified;
|
property Modified: Boolean read FModified;
|
||||||
@ -203,6 +210,12 @@ begin
|
|||||||
Result := ADefault;
|
Result := ADefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TXMLConfig.GetExtendedValue(const APath: String;
|
||||||
|
const ADefault: extended): extended;
|
||||||
|
begin
|
||||||
|
Result:=StrToExtended(GetValue(APath,ExtendedToStr(ADefault)),ADefault);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TXMLConfig.SetValue(const APath, AValue: String);
|
procedure TXMLConfig.SetValue(const APath, AValue: String);
|
||||||
var
|
var
|
||||||
Node, Child: TDOMNode;
|
Node, Child: TDOMNode;
|
||||||
@ -279,6 +292,21 @@ begin
|
|||||||
SetValue(APath,AValue);
|
SetValue(APath,AValue);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TXMLConfig.SetExtendedValue(const APath: String;
|
||||||
|
const AValue: extended);
|
||||||
|
begin
|
||||||
|
SetValue(APath,ExtendedToStr(AValue));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TXMLConfig.SetDeleteExtendedValue(const APath: String; const AValue,
|
||||||
|
DefValue: extended);
|
||||||
|
begin
|
||||||
|
if AValue=DefValue then
|
||||||
|
DeleteValue(APath)
|
||||||
|
else
|
||||||
|
SetExtendedValue(APath,AValue);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TXMLConfig.DeletePath(const APath: string);
|
procedure TXMLConfig.DeletePath(const APath: string);
|
||||||
var
|
var
|
||||||
Node: TDomNode;
|
Node: TDomNode;
|
||||||
@ -336,6 +364,35 @@ begin
|
|||||||
Result:=nil;
|
Result:=nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TXMLConfig.ExtendedToStr(const e: extended): string;
|
||||||
|
var
|
||||||
|
OldDecimalSeparator: Char;
|
||||||
|
OldThousandSeparator: Char;
|
||||||
|
begin
|
||||||
|
OldDecimalSeparator:=DecimalSeparator;
|
||||||
|
OldThousandSeparator:=ThousandSeparator;
|
||||||
|
DecimalSeparator:='.';
|
||||||
|
ThousandSeparator:=',';
|
||||||
|
Result:=FloatToStr(e);
|
||||||
|
DecimalSeparator:=OldDecimalSeparator;
|
||||||
|
ThousandSeparator:=OldThousandSeparator;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TXMLConfig.StrToExtended(const s: string; const ADefault: extended
|
||||||
|
): extended;
|
||||||
|
var
|
||||||
|
OldDecimalSeparator: Char;
|
||||||
|
OldThousandSeparator: Char;
|
||||||
|
begin
|
||||||
|
OldDecimalSeparator:=DecimalSeparator;
|
||||||
|
OldThousandSeparator:=ThousandSeparator;
|
||||||
|
DecimalSeparator:='.';
|
||||||
|
ThousandSeparator:=',';
|
||||||
|
Result:=StrToFloatDef(s,ADefault);
|
||||||
|
DecimalSeparator:=OldDecimalSeparator;
|
||||||
|
ThousandSeparator:=OldThousandSeparator;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TXMLConfig.SetFilename(const AFilename: String);
|
procedure TXMLConfig.SetFilename(const AFilename: String);
|
||||||
var
|
var
|
||||||
cfg: TDOMElement;
|
cfg: TDOMElement;
|
||||||
@ -372,6 +429,9 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.13 2005/03/23 08:45:37 mattias
|
||||||
|
made synedit ClearText undoable
|
||||||
|
|
||||||
Revision 1.12 2004/11/10 15:25:32 mattias
|
Revision 1.12 2004/11/10 15:25:32 mattias
|
||||||
updated memcheck.pas from heaptrc.pp
|
updated memcheck.pas from heaptrc.pp
|
||||||
|
|
||||||
|
@ -7779,7 +7779,14 @@ end;
|
|||||||
|
|
||||||
procedure TCustomSynEdit.ClearAll;
|
procedure TCustomSynEdit.ClearAll;
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF SYN_LAZARUS}
|
||||||
|
BeginUndoBlock;
|
||||||
|
SelectAll;
|
||||||
|
SelText:='';
|
||||||
|
EndUndoBlock;
|
||||||
|
{$ELSE}
|
||||||
Lines.Clear;
|
Lines.Clear;
|
||||||
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomSynEdit.ClearSelection;
|
procedure TCustomSynEdit.ClearSelection;
|
||||||
|
Loading…
Reference in New Issue
Block a user