mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-03 01:09:50 +01:00
git-svn-id: trunk@22489 -
This commit is contained in:
parent
ab654bf730
commit
1af2c15937
@ -1484,6 +1484,8 @@ end;
|
||||
constructor TCustomSynEdit.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
SetAncestor(True); // temp until tframe does this
|
||||
SetInline(True);
|
||||
|
||||
fBeautifier := SynDefaultBeautifier;
|
||||
|
||||
@ -1674,7 +1676,8 @@ end;
|
||||
|
||||
procedure TCustomSynEdit.GetChildren(Proc: TGetChildProc; Root: TComponent);
|
||||
begin
|
||||
Proc(FGutter.Parts);
|
||||
if root = self then
|
||||
Proc(FGutter.Parts);
|
||||
end;
|
||||
|
||||
procedure TCustomSynEdit.CreateParams(var Params: TCreateParams);
|
||||
@ -1783,7 +1786,6 @@ begin
|
||||
fPlugins:=nil;
|
||||
FCaret.Lines := nil;
|
||||
FInternalCaret.Lines := nil;
|
||||
FreeAndNil(fScrollTimer);
|
||||
FreeAndNil(fTSearch);
|
||||
FreeAndNil(fMarkupManager);
|
||||
FreeAndNil(fMarkList);
|
||||
|
||||
@ -184,6 +184,7 @@ type
|
||||
destructor Destroy; override;
|
||||
property Index: Integer read GetIndex write SetIndex;
|
||||
property DisplayName: String read GetDisplayName;
|
||||
function GetParentComponent: TComponent; override; // for child order in stream reading
|
||||
end;
|
||||
|
||||
TSynObjectListItemClass = class of TSynObjectListItem;
|
||||
@ -781,6 +782,8 @@ end;
|
||||
constructor TSynObjectList.Create(AOwner: TComponent);
|
||||
begin
|
||||
Inherited Create(AOwner);
|
||||
SetAncestor(True);
|
||||
SetInline(True);
|
||||
FList := TList.Create;
|
||||
FOwner := AOwner;
|
||||
end;
|
||||
@ -795,7 +798,7 @@ end;
|
||||
procedure TSynObjectList.Assign(Source: TPersistent);
|
||||
begin
|
||||
FList.Assign(TSynObjectList(Source).FList);
|
||||
DoChange(self);;
|
||||
DoChange(self);
|
||||
end;
|
||||
|
||||
function TSynObjectList.GetChildOwner: TComponent;
|
||||
@ -807,8 +810,9 @@ procedure TSynObjectList.GetChildren(Proc: TGetChildProc; Root: TComponent);
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
for i:= 0 to Count -1 do
|
||||
Proc(BaseItems[i]);
|
||||
if Root = self then
|
||||
for i:= 0 to Count -1 do
|
||||
Proc(BaseItems[i]);
|
||||
end;
|
||||
|
||||
procedure TSynObjectList.SetChildOrder(Child: TComponent; Order: Integer);
|
||||
@ -895,6 +899,7 @@ end;
|
||||
constructor TSynObjectListItem.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
SetAncestor(True);
|
||||
FOwner := AOwner as TSynObjectList;
|
||||
FOwner.RegisterItem(self);
|
||||
end;
|
||||
@ -905,6 +910,11 @@ begin
|
||||
FOwner.Delete(FOwner.IndexOf(self));
|
||||
end;
|
||||
|
||||
function TSynObjectListItem.GetParentComponent: TComponent;
|
||||
begin
|
||||
Result := FOwner;
|
||||
end;
|
||||
|
||||
{ TSynClipboardStream }
|
||||
|
||||
function TSynClipboardStream.GetMemory: Pointer;
|
||||
|
||||
@ -121,11 +121,17 @@ begin
|
||||
AutoSize := True;
|
||||
|
||||
if not(csLoading in AOwner.ComponentState) then begin
|
||||
TSynGutterMarks.Create(Parts);
|
||||
TSynGutterLineNumber.Create(Parts);
|
||||
TSynGutterChanges.Create(Parts);
|
||||
TSynGutterSeparator.Create(Parts);
|
||||
TSynGutterCodeFolding.Create(Parts);
|
||||
// Todo: currently there is only one Gutter so names can be fixed
|
||||
with TSynGutterMarks.Create(Parts) do
|
||||
Name := 'SynGutterMarks1';
|
||||
with TSynGutterLineNumber.Create(Parts) do
|
||||
Name := 'SynGutterLineNumber1';
|
||||
with TSynGutterChanges.Create(Parts) do
|
||||
Name := 'SynGutterChanges1';
|
||||
with TSynGutterSeparator.Create(Parts) do
|
||||
Name := 'SynGutterSeparator1';
|
||||
with TSynGutterCodeFolding.Create(Parts) do
|
||||
Name := 'SynGutterCodeFolding1';
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -143,9 +143,12 @@ uses SynEdit;
|
||||
{ TSynGutterBase }
|
||||
|
||||
constructor TSynGutterBase.Create(AOwner: TSynEditBase; AFoldedLinesView: TSynEditFoldedView; ATextDrawer: TheTextDrawer);
|
||||
var
|
||||
plist: TSynGutterPartList;
|
||||
begin
|
||||
inherited Create;
|
||||
TSynGutterPartList.Create(AOwner, self);
|
||||
plist := TSynGutterPartList.Create(AOwner, self);
|
||||
plist.Name := 'SynGutterPartList1'; // Todo: currently there is just one gutter, so only one name needed
|
||||
|
||||
FTextDrawer := ATextDrawer;
|
||||
FFoldView := AFoldedLinesView;
|
||||
@ -283,6 +286,7 @@ end;
|
||||
constructor TSynGutterPartBase.Create(AOwner: TComponent);
|
||||
begin
|
||||
Inherited Create(AOwner);
|
||||
|
||||
FGutter := GutterParts.Gutter;
|
||||
FSynEdit := GutterParts.SynEdit;
|
||||
|
||||
@ -362,6 +366,7 @@ end;
|
||||
constructor TSynGutterPartList.Create(AOwner: TComponent);
|
||||
begin
|
||||
Inherited Create(AOwner);
|
||||
include(FComponentStyle, csTransient);
|
||||
if assigned(TSynEdit(SynEdit).Gutter) then
|
||||
FGutter := TSynEdit(SynEdit).Gutter;
|
||||
Gutter.RegisterNewGutterPartList(self);
|
||||
|
||||
@ -63,6 +63,7 @@ type
|
||||
MoveUpButton: TToolButton;
|
||||
MoveDownButton: TToolButton;
|
||||
procedure AddButtonClick(Sender: TObject);
|
||||
function CreateUniqueComponentName(const AClassName: string; OwnerComponent: TComponent): string;
|
||||
procedure SynObjectPartsListBoxClick(Sender: TObject);
|
||||
procedure DeleteButtonClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
@ -112,13 +113,15 @@ end;
|
||||
procedure TSynObjectPartListPropertyEditorForm.AddButtonClick(Sender: TObject);
|
||||
var
|
||||
i: Integer;
|
||||
NewPart: TSynObjectListItem;
|
||||
begin
|
||||
if (SynObjectPartList = nil) or (FClassesList = nil) then Exit;
|
||||
|
||||
i := ClassComboBox.ItemIndex;
|
||||
if (i < 0) or (i >= FClassesList.Count) then
|
||||
exit;
|
||||
TSynObjectListItemClass(Pointer(FClassesList.Objects[i])).Create(SynObjectPartList);
|
||||
NewPart := TSynObjectListItemClass(Pointer(FClassesList.Objects[i])).Create(SynObjectPartList);
|
||||
NewPart.Name := CreateUniqueComponentName(NewPart.ClassName, SynObjectPartList);
|
||||
|
||||
FillSynObjectPartsListBox;
|
||||
if SynObjectPartsListBox.Items.Count > 0 then
|
||||
@ -129,6 +132,30 @@ begin
|
||||
Modified;
|
||||
end;
|
||||
|
||||
function TSynObjectPartListPropertyEditorForm.CreateUniqueComponentName(const AClassName: string;
|
||||
OwnerComponent: TComponent): string;
|
||||
var
|
||||
i, j: integer;
|
||||
begin
|
||||
Result:=AClassName;
|
||||
if (OwnerComponent=nil) or (Result='') then exit;
|
||||
i:=1;
|
||||
while true do begin
|
||||
j:=OwnerComponent.ComponentCount-1;
|
||||
Result:=AClassName;
|
||||
if (length(Result)>1) and (Result[1]='T') then
|
||||
Result:=RightStr(Result,length(Result)-1);
|
||||
if Result[length(Result)] in ['0'..'9'] then
|
||||
Result:=Result+'_';
|
||||
Result:=Result+IntToStr(i);
|
||||
while (j>=0)
|
||||
and (CompareText(Result,OwnerComponent.Components[j].Name)<>0) do
|
||||
dec(j);
|
||||
if j<0 then exit;
|
||||
inc(i);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSynObjectPartListPropertyEditorForm.SynObjectPartsListBoxClick(Sender: TObject);
|
||||
begin
|
||||
UpdateButtons;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user