spktoolbar: Google-translate the Polish comments of the original author in spkt_types to English. Some reformatting.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4096 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-04-26 21:44:22 +00:00
parent f5c1eb21cb
commit 54673b5c69

View File

@@ -28,11 +28,15 @@ type TSpkCollection = class(TPersistent)
FRootComponent : TComponent;
// *** Metody reakcji na zmiany w liœcie ***
// *** Methods responding to changes in list ***
procedure Notify(Item : TComponent; Operation : TOperation); virtual;
procedure Update; virtual;
// *** Wewnêtrzne metody dodawania i wstawiania elementów ***
// *** Gettery i settery ***
// *** Internal methods for adding and inserting elements ***
// *** Getters and setters ***
function GetItems(index: integer): TComponent; virtual;
public
// *** Konstruktor, destruktor ***
@@ -40,6 +44,7 @@ type TSpkCollection = class(TPersistent)
destructor Destroy; override;
// *** Obs³uga listy ***
// *** List operations ***
procedure AddItem(AItem: TComponent);
procedure InsertItem(index: integer; AItem: TComponent);
procedure Clear;
@@ -52,6 +57,7 @@ type TSpkCollection = class(TPersistent)
procedure Move(IndexFrom, IndexTo: integer);
// *** Reader, writer i obs³uga designtime i DFM ***
// *** Reader, writer and operation designtime and DFM
procedure WriteNames(Writer: TWriter); virtual;
procedure ReadNames(Reader: TReader); virtual;
procedure ProcessNames(Owner: TComponent); virtual;
@@ -68,6 +74,7 @@ type TSpkComponent = class(TComponent)
FCollection: TSpkCollection;
public
// *** Obs³uga parenta ***
// *** Parent operations ***
function HasParent : boolean; override;
function GetParentComponent : TComponent; override;
procedure SetParentComponent(Value : TComponent); override;
@@ -85,6 +92,9 @@ begin
// Ta metoda mo¿e byæ wywo³ywana bez przetworzenia nazw (w szczególnoœci, metoda
// przetwarzaj¹ca nazwy korzysta z AddItem)
// This method can be recalling untreated names (in particular, the method
// uses the name przetwarzaj¹ca AddItem) --- ???
Notify(AItem, opInsert);
FList.Add(AItem);
@@ -97,7 +107,6 @@ end;
procedure TSpkCollection.Clear;
begin
FList.Clear;
Update;
end;
@@ -110,23 +119,19 @@ constructor TSpkCollection.Create(RootComponent : TComponent);
begin
inherited Create;
FRootComponent := RootComponent;
FNames := TStringList.create;
FList := TFPObjectList.create(False);
FListState := lsReady;
end;
procedure TSpkCollection.Delete(index: integer);
begin
if (index < 0) or (index >= FList.count) then
raise InternalException.Create('TSpkCollection.Delete: Nieprawid³owy indeks!');
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
//raise InternalException.Create('TSpkCollection.Delete: Nieprawid³owy indeks!');
Notify(TComponent(FList[index]), opRemove);
FList.Delete(index);
Update;
end;
@@ -146,7 +151,8 @@ end;
function TSpkCollection.GetItems(index: integer): TComponent;
begin
if (index < 0) or (index >= FList.Count) then
raise InternalException.create('TSpkCollection.GetItems: Nieprawid³owy indeks!');
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
//raise InternalException.create('TSpkCollection.GetItems: Nieprawid³owy indeks!');
result := TComponent(FList[index]);
end;
@@ -159,25 +165,25 @@ end;
procedure TSpkCollection.InsertItem(index: integer; AItem: TComponent);
begin
if (index < 0) or (index > FList.Count) then
raise InternalException.Create('TSpkCollection.Insert: Nieprawid³owy indeks!');
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
//raise InternalException.Create('TSpkCollection.Insert: Nieprawid³owy indeks!');
Notify(AItem, opInsert);
FList.Insert(index, AItem);
if AItem is TSpkComponent then
TSpkComponent(AItem).FCollection := self;
Update;
end;
procedure TSpkCollection.Move(IndexFrom, IndexTo: integer);
begin
if (indexFrom < 0) or (indexFrom >= FList.Count) or
(indexTo<0) or (indexTo>=FList.Count) then
raise InternalException.Create('TSpkCollection.Move: Nieprawid³owy indeks!');
(indexTo < 0) or (indexTo >= FList.Count)
then
raise InternalException.Create('TSpkCollection.Delete: Illegal index!');
//raise InternalException.Create('TSpkCollection.Move: Nieprawid³owy indeks!');
FList.Move(IndexFrom, IndexTo);
Update;
end;
@@ -187,64 +193,49 @@ begin
end;
procedure TSpkCollection.ProcessNames(Owner: TComponent);
var s : string;
var
s: string;
begin
FList.Clear;
if Owner <> nil then
for s in FNames do
AddItem(Owner.FindComponent(s));
FNames.Clear;
FListState := lsReady;
end;
procedure TSpkCollection.ReadNames(Reader: TReader);
begin
Reader.ReadListBegin;
FNames.Clear;
while not(Reader.EndOfList) do
FNames.Add(Reader.ReadString);
Reader.ReadListEnd;
FListState := lsNeedsProcessing;
end;
procedure TSpkCollection.Remove(Item: TComponent);
var i : integer;
var
i: integer;
begin
i := FList.IndexOf(Item);
if i >= 0 then
begin
Notify(Item, opRemove);
FList.Delete(i);
Update;
end;
end;
procedure TSpkCollection.RemoveReference(Item: TComponent);
var i : integer;
var
i: integer;
begin
i := FList.IndexOf(Item);
if i >= 0 then
begin
Notify(Item, opRemove);
FList.Extract(Item);
Update;
end;
end;