spktoolbar: Google-translate most of the Polish comments.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6195 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-02-12 00:15:47 +00:00
parent a149d9d180
commit 38fc173d25
15 changed files with 278 additions and 350 deletions

View File

@ -609,4 +609,5 @@ begin
ACanvas.Brush.Style := TmpBrushStyle; ACanvas.Brush.Style := TmpBrushStyle;
end; end;
end. end.

View File

@ -7,7 +7,7 @@ unit SpkMath;
interface interface
{TODO: Zastanowiæ siê, czy wszystkie niejawne casty ma sens} {TODO: Consider if all implicit casts make sense }
uses uses
Types, Math, SysUtils; Types, Math, SysUtils;

View File

@ -4,11 +4,11 @@ unit spkt_Appearance;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Appearance.pas * * File: spkt_Appearance.pas *
* Opis: Klasy bazowe dla klas wygl¹du elementów toolbara * * Description: Base classes for the appearance classes of the toolbar elements*
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)
@ -56,9 +56,9 @@ type
procedure TabHeaderFontChange(Sender: TObject); procedure TabHeaderFontChange(Sender: TObject);
public public
// *** Konstruktor, destruktor, assign *** // *** Constructor, destructor, Assign ***
// <remarks>Appearance musi mieæ assign, bo wystêpuje jako w³asnoœæ // Remarks: Appearance must have Assign because it exists as a
// opublikowana.</remarks> // published property.
constructor Create(ADispatch: TSpkBaseAppearanceDispatch); constructor Create(ADispatch: TSpkBaseAppearanceDispatch);
destructor Destroy; override; destructor Destroy; override;
procedure Assign(Source: TPersistent); override; procedure Assign(Source: TPersistent); override;
@ -329,7 +329,7 @@ begin
if FDispatch <> nil then if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end else end else
raise AssignException.Create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!'); raise AssignException.Create('TSpkToolbarAppearance.Assign: Cannot assign the object '+Source.ClassName+' to TSpkToolbarAppearance!');
end; end;
procedure TSpkTabAppearance.LoadFromXML(Node: TSpkXMLNode); procedure TSpkTabAppearance.LoadFromXML(Node: TSpkXMLNode);
@ -544,7 +544,7 @@ begin
if FDispatch <> nil then if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end else end else
raise AssignException.create('TSpkPaneAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkPaneAppearance!'); raise AssignException.Create('TSpkPaneAppearance.Assign: Cannot assign the class '+Source.ClassName+' to TSpkPaneAppearance!');
end; end;
procedure TSpkPaneAppearance.CaptionFontChange(Sender: TObject); procedure TSpkPaneAppearance.CaptionFontChange(Sender: TObject);
@ -831,7 +831,7 @@ begin
if FDispatch <> nil then if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end else end else
raise AssignException.create('TSpkElementAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkElementAppearance!'); raise AssignException.Create('TSpkElementAppearance.Assign: Cannot assign the objecct '+Source.ClassName+' to TSpkElementAppearance!');
end; end;
procedure TSpkElementAppearance.CaptionFontChange(Sender: TObject); procedure TSpkElementAppearance.CaptionFontChange(Sender: TObject);
@ -1522,7 +1522,7 @@ begin
if FDispatch <> nil then if FDispatch <> nil then
FDispatch.NotifyAppearanceChanged; FDispatch.NotifyAppearanceChanged;
end else end else
raise AssignException.create('TSpkToolbarAppearance.Assign: Nie mogê przypisaæ obiektu '+Source.ClassName+' do TSpkToolbarAppearance!'); raise AssignException.Create('TSpkToolbarAppearance.Assign: Cannot assign the object '+Source.ClassName+' to TSpkToolbarAppearance!');
end; end;
procedure TSpkToolbarAppearance.LoadFromXML(Node: TSpkXMLNode); procedure TSpkToolbarAppearance.LoadFromXML(Node: TSpkXMLNode);

View File

@ -2,11 +2,11 @@ unit spkt_BaseItem;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_BaseItem.pas * * File: spkt_BaseItem.pas *
* Opis: Modu³ zawieraj¹cy bazow¹ klasê dla elementu tafli. * * Description: The module containing the base class for the glass element. *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)

View File

@ -4,12 +4,12 @@ unit spkt_Dispatch;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Dispatch.pas * * File: spkt_Dispatch.pas *
* Opis: Bazowe klasy dyspozytorów poœrednicz¹cych pomiêdzy elementami * * Description: Basic classes of intermediary dispatchers between elements *
* toolbara. * * of the toolbar. *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)

View File

@ -4,11 +4,11 @@ unit spkt_Exceptions;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Exceptions.pas * * File: spkt_Exceptions.pas *
* Opis: Klasy wyj¹tków toolbara * * Description: Exception classes of the toolbar *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)

View File

@ -5,11 +5,11 @@ unit spkt_Items;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Items.pas * * File: spkt_Items.pas *
* Opis: Modu³ zawiera klasê kolekcji elementów tafli. * * Description: The module contains the class of panel elements collection. *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)
@ -32,7 +32,7 @@ type
FImagesWidth: Integer; FImagesWidth: Integer;
FLargeImagesWidth: Integer; FLargeImagesWidth: Integer;
// *** Gettery i settery *** // *** Getters and setters ***
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
function GetItems(AIndex: integer): TSpkBaseItem; reintroduce; function GetItems(AIndex: integer): TSpkBaseItem; reintroduce;
procedure SetAppearance(const Value: TSpkToolbarAppearance); procedure SetAppearance(const Value: TSpkToolbarAppearance);
@ -49,7 +49,7 @@ type
function AddCheckbox: TSpkCheckbox; function AddCheckbox: TSpkCheckbox;
function AddRadioButton: TSpkRadioButton; function AddRadioButton: TSpkRadioButton;
// *** Reakcja na zmiany listy *** // *** Reaction to changes in the list ***
procedure Notify(Item: TComponent; Operation: TOperation); override; procedure Notify(Item: TComponent; Operation: TOperation); override;
procedure Update; override; procedure Update; override;
@ -108,8 +108,8 @@ begin
case Operation of case Operation of
opInsert: opInsert:
begin begin
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas // Setting the dispatcher to nil will cause that during the ownership
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify* // assignment, the Notify method will not be called
TSpkBaseItem(Item).ToolbarDispatch := nil; TSpkBaseItem(Item).ToolbarDispatch := nil;
TSpkBaseItem(Item).Appearance := FAppearance; TSpkBaseItem(Item).Appearance := FAppearance;
TSpkBaseItem(Item).Images := FImages; TSpkBaseItem(Item).Images := FImages;

View File

@ -5,11 +5,11 @@ unit spkt_Pane;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Pane.pas * * File: spkt_Pane.pas *
* Opis: Komponent tafli toolbara * * Description: The component of the toolbar panel *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)
@ -59,15 +59,15 @@ type
FVisible: boolean; FVisible: boolean;
FItems: TSpkItems; FItems: TSpkItems;
// *** Generowanie layoutu elementów *** // *** Generating a layout of elements ***
function GenerateLayout: TSpkPaneItemsLayout; function GenerateLayout: TSpkPaneItemsLayout;
// *** Obs³uga designtime i DFM *** // *** Designtime and LFM support ***
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure DefineProperties(Filer : TFiler); override; procedure DefineProperties(Filer : TFiler); override;
procedure Loaded; override; procedure Loaded; override;
// *** Gettery i settery *** // *** Getters and setters ***
procedure SetCaption(const Value: string); procedure SetCaption(const Value: string);
procedure SetVisible(const Value: boolean); procedure SetVisible(const Value: boolean);
procedure SetAppearance(const Value: TSpkToolbarAppearance); procedure SetAppearance(const Value: TSpkToolbarAppearance);
@ -81,22 +81,22 @@ type
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
public public
// *** Konstruktor, destruktor *** // *** Constructor, destructor ***
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
// *** Obs³uga gryzonia *** // *** Mouse support ***
procedure MouseLeave; procedure MouseLeave;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MouseMove(Shift: TShiftState; X, Y: Integer); procedure MouseMove(Shift: TShiftState; X, Y: Integer);
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
// *** Geometria i rysowanie *** // *** Geometry and drawing ***
function GetWidth: integer; function GetWidth: integer;
procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect); procedure Draw(ABuffer: TBitmap; ClipRect: T2DIntRect);
function FindItemAt(x, y: integer): integer; function FindItemAt(x, y: integer): integer;
// *** Obs³uga elementów *** // *** Support for elements ***
procedure FreeingItem(AItem: TSpkBaseItem); procedure FreeingItem(AItem: TSpkBaseItem);
property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch; property ToolbarDispatch: TSpkBaseToolbarDispatch read FToolbarDispatch write SetToolbarDispatch;
@ -127,7 +127,7 @@ type
FImagesWidth: Integer; FImagesWidth: Integer;
FLargeImagesWidth: Integer; FLargeImagesWidth: Integer;
// *** Gettery i settery *** // *** Getters and setters ***
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
function GetItems(AIndex: integer): TSpkPane; reintroduce; function GetItems(AIndex: integer): TSpkPane; reintroduce;
procedure SetAppearance(const Value: TSpkToolbarAppearance); procedure SetAppearance(const Value: TSpkToolbarAppearance);
@ -139,11 +139,11 @@ type
procedure SetLargeImagesWidth(const Value: Integer); procedure SetLargeImagesWidth(const Value: Integer);
public public
// *** Dodawanie i wstawianie elementów *** // *** Adding and inserting elements ***
function Add: TSpkPane; function Add: TSpkPane;
function Insert(AIndex: integer): TSpkPane; function Insert(AIndex: integer): TSpkPane;
// *** Reakcja na zmiany listy *** // *** Reaction to changes in the list ***
procedure Notify(Item: TComponent; Operation: TOperation); override; procedure Notify(Item: TComponent; Operation: TOperation); override;
procedure Update; override; procedure Update; override;
@ -251,12 +251,12 @@ var
R: T2DIntRect; R: T2DIntRect;
delta: Integer; delta: Integer;
begin begin
// W niektórych warunkach nie jesteœmy w stanie rysowaæ: // Under some conditions, we are not able to draw::
// * Brak dyspozytora // * No dispatcher
if FToolbarDispatch = nil then if FToolbarDispatch = nil then
exit; exit;
// * Brak appearance // * No appearance
if FAppearance = nil then if FAppearance = nil then
exit; exit;
@ -281,7 +281,7 @@ begin
BorderDarkColor := TColorTools.Brighten(FAppearance.Pane.BorderDarkColor, delta); BorderDarkColor := TColorTools.Brighten(FAppearance.Pane.BorderDarkColor, delta);
end; end;
// T³o // The background
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
R := T2DIntRect.Create( R := T2DIntRect.Create(
{$ELSE} {$ELSE}
@ -302,7 +302,7 @@ begin
ClipRect ClipRect
); );
// T³o etykiety tafli // Label background
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
R := T2DIntRect.Create( R := T2DIntRect.Create(
{$ELSE} {$ELSE}
@ -399,7 +399,8 @@ begin
FRect.Bottom-1 FRect.Bottom-1
); );
if FAppearance.Pane.Style = psRectangleEtched then if FAppearance.Pane.Style = psRectangleEtched then
c := BorderDarkColor else c := BorderDarkColor
else
c := BorderLightColor; c := BorderLightColor;
TGUITools.DrawAARoundFrame( TGUITools.DrawAARoundFrame(
ABuffer, ABuffer,
@ -423,7 +424,8 @@ begin
c c
); );
if FAppearance.Pane.Style = psDividerRaised then if FAppearance.Pane.Style = psDividerRaised then
c := BorderDarkColor else c := BorderDarkColor
else
c := BorderLightColor; c := BorderLightColor;
TGUITools.DrawVLine( TGUITools.DrawVLine(
ABuffer, ABuffer,
@ -444,7 +446,7 @@ begin
); );
end; end;
// Elementy // Elements
for i := 0 to FItems.Count - 1 do for i := 0 to FItems.Count - 1 do
if FItems[i].Visible then if FItems[i].Visible then
FItems[i].Draw(ABuffer, ClipRect); FItems[i].Draw(ABuffer, ClipRect);
@ -504,9 +506,9 @@ begin
if FItems.Count = 0 then if FItems.Count = 0 then
exit; exit;
// Notatka: algorytm jest skonstruowany w ten sposób, ¿e trójka: CurrentColumn, // Note: the algorithm is structured in such a way that three of them,
// CurrentRow oraz CurrentItem wskazuje na element, którego jeszcze nie // CurrentColumn, CurrentRow and CurrentItem, point to an element that
// ma (zaraz za ostatnio dodanym elementem). // is not yet present (just after the recently added element).
SetLength(Layout, 1); SetLength(Layout, 1);
CurrentColumn := 0; CurrentColumn := 0;
@ -524,14 +526,14 @@ begin
ItemTableBehaviour := FItems[i].GetTableBehaviour; ItemTableBehaviour := FItems[i].GetTableBehaviour;
ItemSize := FItems[i].GetSize; ItemSize := FItems[i].GetSize;
// Rozpoczêcie nowej kolumny? // Starting a new column?
if (i=0) or if (i=0) or
(ItemSize = isLarge) or (ItemSize = isLarge) or
(ItemTableBehaviour = tbBeginsColumn) or (ItemTableBehaviour = tbBeginsColumn) or
((ItemTableBehaviour = tbBeginsRow) and (CurrentRow = 2)) or ((ItemTableBehaviour = tbBeginsRow) and (CurrentRow = 2)) or
(ForceNewColumn) then (ForceNewColumn) then
begin begin
// Jeœli ju¿ jesteœmy na pocz¹tku nowej kolumny, nie ma nic do roboty. // If we are already at the beginning of the new column, there is nothing to do.
if (CurrentRow <> 0) or (CurrentItem <> 0) then if (CurrentRow <> 0) or (CurrentItem <> 0) then
begin begin
SetLength(Layout, Length(Layout)+1); SetLength(Layout, Length(Layout)+1);
@ -544,10 +546,10 @@ begin
CurrentItem := 0; CurrentItem := 0;
end; end;
end else end else
// Rozpoczêcie nowego wiersza? // Starting a new row?
if (ItemTableBehaviour = tbBeginsRow) then if (ItemTableBehaviour = tbBeginsRow) then
begin begin
// Jeœli ju¿ jesteœmy na pocz¹tku nowego wiersza, nie ma nic do roboty. // If we are already at the beginning of a new poem, there is nothing to do.
if CurrentItem <> 0 then if CurrentItem <> 0 then
begin begin
SetLength(Layout[CurrentColumn], Length(Layout[CurrentColumn])+1); SetLength(Layout[CurrentColumn], Length(Layout[CurrentColumn])+1);
@ -558,8 +560,7 @@ begin
ForceNewColumn := (ItemSize = isLarge); ForceNewColumn := (ItemSize = isLarge);
// Jeœli element jest widoczny, dodajemy go w aktualnej kolumnie i aktualnym // If the item is visible, we add it in the current column and the current row.
// wierszu.
if FItems[i].Visible then if FItems[i].Visible then
begin begin
SetLength(Layout[CurrentColumn][CurrentRow], Length(Layout[CurrentColumn][CurrentRow])+1); SetLength(Layout[CurrentColumn][CurrentRow], Length(Layout[CurrentColumn][CurrentRow])+1);
@ -569,11 +570,10 @@ begin
end; end;
end; end;
// W tym miejscu mamy gotowy layout. Teraz trzeba obliczyæ pozycje i rozmiary // We have a ready layout here. Now you have to calculate the positions
// Rectów. // and sizes of the Rects.
// Najpierw wype³niamy je pustymi danymi, które zape³ni¹ miejsce elementów // First, fill them with empty data that will fill the place of invisible elements.
// niewidocznych.
{$IFDEF EnhancedRecordSupport} {$IFDEF EnhancedRecordSupport}
for i := 0 to FItems.Count - 1 do for i := 0 to FItems.Count - 1 do
Result.Rects[i] := T2DIntRect.Create(-1, -1, -1, -1); Result.Rects[i] := T2DIntRect.Create(-1, -1, -1, -1);
@ -584,7 +584,7 @@ begin
MaxRowX := 0; MaxRowX := 0;
// Teraz iterujemy po layoucie, ustalaj¹c recty. // Now, we iterate through the layout, fixing the recit.
for c := 0 to High(Layout) do for c := 0 to High(Layout) do
begin begin
if c>0 then if c>0 then
@ -630,8 +630,8 @@ begin
end end
else else
begin begin
// Jeœli element nie jest pierwszy, musi zostaæ // If the element is not the first one, it must be offset by
// odsuniêty marginesem od poprzedniego // the margin from the previous one
if i>0 then if i>0 then
tmpRect.Left := LastX + PaneGroupSpacer tmpRect.Left := LastX + PaneGroupSpacer
else else
@ -639,7 +639,7 @@ begin
tmpRect.Right := tmpRect.Left + ItemWidth - 1; tmpRect.Right := tmpRect.Left + ItemWidth - 1;
end; end;
{$REGION 'Obliczanie tmpRect.top i bottom'} {$REGION 'Calculation of tmpRect.top and bottom'}
case rows of case rows of
1 : begin 1 : begin
tmpRect.Top := PaneOneRowTopPadding; tmpRect.Top := PaneOneRowTopPadding;
@ -681,8 +681,8 @@ begin
end; end;
end; end;
end; end;
// W tym miejscu MaxRowX wskazuje na pierwszy piksel za najbardziej wysuniêtym // At this point, MaxRowX points to the first pixel behind the most
// w prawo elementem - ergo jest równy szerokoœci ca³ego layoutu. // right-hand element - ergo is equal to the width of the entire layout.
Result.Width := MaxRowX; Result.Width := MaxRowX;
end; end;
@ -703,7 +703,7 @@ var
ElementsW: integer; ElementsW: integer;
Layout: TSpkPaneItemsLayout; Layout: TSpkPaneItemsLayout;
begin begin
// Przygotowywanie... // Preparing...
Result := -1; Result := -1;
if FToolbarDispatch = nil then if FToolbarDispatch = nil then
exit; exit;
@ -715,16 +715,16 @@ begin
exit; exit;
tmpBitmap.Canvas.Font.Assign(FAppearance.Pane.CaptionFont); tmpBitmap.Canvas.Font.Assign(FAppearance.Pane.CaptionFont);
// *** Minimalna szerokoϾ tafli (tekstu) *** // *** The minimum width of the sheet (text) ***
TextW := tmpBitmap.Canvas.TextWidth(FCaption); TextW := tmpBitmap.Canvas.TextWidth(FCaption);
PaneCaptionWidth := 2*PaneBorderSize + 2*PaneCaptionHMargin + TextW; PaneCaptionWidth := 2*PaneBorderSize + 2*PaneCaptionHMargin + TextW;
// *** Szerokoœæ elementów tafli *** // *** The width of the elements of the sheet ***
Layout := GenerateLayout; Layout := GenerateLayout;
ElementsW := Layout.Width; ElementsW := Layout.Width;
PaneElementsWidth := PaneBorderSize + PaneLeftPadding + ElementsW + PaneRightPadding + PaneBorderSize; PaneElementsWidth := PaneBorderSize + PaneLeftPadding + ElementsW + PaneRightPadding + PaneBorderSize;
// *** Ustawianie szerokoœci tafli *** // *** Setting the width of the pane ***
Result := Max(PaneCaptionWidth, PaneElementsWidth); Result := Max(PaneCaptionWidth, PaneElementsWidth);
end; end;
@ -767,7 +767,7 @@ begin
begin begin
FMouseActiveElement.ElementType := pePaneArea; FMouseActiveElement.ElementType := pePaneArea;
FMouseActiveElement.ElementIndex := -1; FMouseActiveElement.ElementIndex := -1;
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
end; end;
end; end;
@ -783,15 +783,15 @@ begin
end else end else
if FMouseHoverElement.ElementType = pePaneArea then if FMouseHoverElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
end; end;
FMouseHoverElement.ElementType := peNone; FMouseHoverElement.ElementType := peNone;
FMouseHoverElement.ElementIndex := -1; FMouseHoverElement.ElementIndex := -1;
// Niezale¿nie od tego, który element by³ aktywny / pod mysz¹, trzeba // Regardless of which item was active / under the mouse, you need to
// wygasiæ HotTrack. // expire HotTrack.
if FPaneState <> psIdle then if FPaneState <> psIdle then
begin begin
FPaneState := psIdle; FPaneState := psIdle;
@ -805,9 +805,9 @@ var
i: integer; i: integer;
NewMouseHoverElement: TSpkMousePaneElement; NewMouseHoverElement: TSpkMousePaneElement;
begin begin
// MouseMove jest wywo³ywany tylko, gdy tafla jest aktywna, b¹dŸ gdy // MouseMove is only called when the tile is active, or when the mouse moves
// mysz rusza siê wewn¹trz jej obszaru. Wobec tego zawsze nale¿y // inside its area. Therefore, it is always necessary to ignite HotTrack
// w tej sytuacji zapaliæ HotTrack. // in this situation.
if FPaneState = psIdle then if FPaneState = psIdle then
begin begin
@ -816,7 +816,7 @@ begin
FToolbarDispatch.NotifyVisualsChanged; FToolbarDispatch.NotifyVisualsChanged;
end; end;
// Szukamy obiektu pod mysz¹ // We're looking for an object under the mouse
i := FindItemAt(X, Y); i := FindItemAt(X, Y);
if i <> -1 then if i <> -1 then
begin begin
@ -841,12 +841,12 @@ begin
end else end else
if FMouseActiveElement.ElementType = pePaneArea then if FMouseActiveElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end else end else
if FMouseActiveElement.ElementType = peNone then if FMouseActiveElement.ElementType = peNone then
begin begin
// Jeœli element pod mysz¹ siê zmienia, informujemy poprzedni element o // If the item under the mouse changes, we inform the previous element
// tym, ¿e mysz opuszcza jego obszar // that the mouse leaves its area
if (NewMouseHoverElement.ElementType <> FMouseHoverElement.ELementType) or if (NewMouseHoverElement.ElementType <> FMouseHoverElement.ELementType) or
(NewMouseHoverElement.ElementIndex <> FMouseHoverElement.ElementIndex) then (NewMouseHoverElement.ElementIndex <> FMouseHoverElement.ElementIndex) then
begin begin
@ -857,7 +857,7 @@ begin
end else end else
if FMouseHoverElement.ElementType = pePaneArea then if FMouseHoverElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end; end;
end; end;
@ -868,7 +868,7 @@ begin
end else end else
if NewMouseHoverElement.ElementType = pePaneArea then if NewMouseHoverElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end; end;
end; end;
@ -889,7 +889,7 @@ begin
end else end else
if FMouseActiveElement.ElementType = pePaneArea then if FMouseActiveElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event
end; end;
if ClearActive and if ClearActive and
@ -903,7 +903,7 @@ begin
end else end else
if FMouseActiveElement.ElementType = pePaneArea then if FMouseActiveElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event
end; end;
if FMouseHoverElement.ElementType = peItem then if FMouseHoverElement.ElementType = peItem then
@ -913,7 +913,7 @@ begin
end else end else
if FMouseHoverElement.ElementType = pePaneArea then if FMouseHoverElement.ElementType = pePaneArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event
end else end else
if FMouseHoverElement.ElementType = peNone then if FMouseHoverElement.ElementType = peNone then
begin begin
@ -1010,7 +1010,7 @@ var
i: Integer; i: Integer;
begin begin
if (AIndex < 0) or (AIndex > self.Count) then if (AIndex < 0) or (AIndex > self.Count) then
raise InternalException.Create('TSpkPanes.Insert: Nieprawid³owy indeks!'); raise InternalException.Create('TSpkPanes.Insert: Invalid index!');
if FRootComponent<>nil then if FRootComponent<>nil then
begin begin
@ -1043,8 +1043,8 @@ begin
case Operation of case Operation of
opInsert: opInsert:
begin begin
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas // Setting the dispatcher to nil will cause that during the
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify* // ownership assignment, the Notify method will not be called
TSpkPane(Item).ToolbarDispatch := nil; TSpkPane(Item).ToolbarDispatch := nil;
TSpkPane(Item).Appearance := FAppearance; TSpkPane(Item).Appearance := FAppearance;
TSpkPane(Item).Images := FImages; TSpkPane(Item).Images := FImages;

View File

@ -5,11 +5,11 @@ unit spkt_Tab;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Tab.pas * * File: spkt_Tab.pas *
* Opis: Komponent zak³adki toolbara * * Description: Toolbar component tab *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)
@ -17,9 +17,9 @@ interface
uses uses
Graphics, Controls, Classes, SysUtils, Graphics, Controls, Classes, SysUtils,
SpkMath, SpkMath,
spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions, spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions,
spkt_Pane, spkt_Types; spkt_Pane, spkt_Types;
type type
TSpkTab = class; TSpkTab = class;
@ -35,10 +35,10 @@ type
private private
FTab: TSpkTab; FTab: TSpkTab;
public public
// *** Konstruktor *** // *** Constructor ***
constructor Create(ATab: TSpkTab); constructor Create(ATab: TSpkTab);
// *** Implementacja metod odziedziczonych po TSpkBaseTabDispatch *** // *** Implementation of methods inherited from TSpkBaseTabDispatch ***
procedure NotifyAppearanceChanged; override; procedure NotifyAppearanceChanged; override;
end; end;
@ -65,18 +65,18 @@ type
FImagesWidth: Integer; FImagesWidth: Integer;
FLargeImagesWidth: Integer; FLargeImagesWidth: Integer;
// *** Makro ustawia odpowiednie appearance taflom *** // *** Sets the appropriate appearance tiles ***
procedure SetPaneAppearance; inline; procedure SetPaneAppearance; inline;
// *** Wyszukiwanie tafli *** // *** Sheet search ***
function FindPaneAt(x, y: integer): integer; function FindPaneAt(x, y: integer): integer;
// *** Obs³uga designtime i DFM *** // *** Designtime and LFM support ***
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override; procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
procedure DefineProperties(Filer: TFiler); override; procedure DefineProperties(Filer: TFiler); override;
procedure Loaded; override; procedure Loaded; override;
// *** Gettery i settery *** // *** Getters and setters ***
procedure SetCaption(const Value: string); procedure SetCaption(const Value: string);
procedure SetCustomAppearance(const Value: TSpkToolbarAppearance); procedure SetCustomAppearance(const Value: TSpkToolbarAppearance);
procedure SetOverrideAppearance(const Value: boolean); procedure SetOverrideAppearance(const Value: boolean);
@ -92,24 +92,24 @@ type
procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch); procedure SetToolbarDispatch(const Value: TSpkBaseToolbarDispatch);
public public
// *** Konstruktor, destruktor *** // *** Constructor, destructor ***
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
// *** Geometria, obs³uga tafli, rysowanie *** // *** Geometry, sheet service, drawing ***
function AtLeastOnePaneVisible: boolean; function AtLeastOnePaneVisible: boolean;
procedure Draw(ABuffer: TBitmap; AClipRect: T2DIntRect); procedure Draw(ABuffer: TBitmap; AClipRect: T2DIntRect);
// *** Obs³uga gryzonia *** // *** Mouse support ***
procedure MouseLeave; procedure MouseLeave;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MouseMove(Shift: TShiftState; X, Y: Integer); procedure MouseMove(Shift: TShiftState; X, Y: Integer);
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
// *** Obs³uga zdarzeñ dyspozytora *** // *** Dispatcher event handling ***
procedure NotifyAppearanceChanged; procedure NotifyAppearanceChanged;
// *** Obs³uga elementów *** // *** Support for elements ***
procedure FreeingPane(APane: TSpkPane); procedure FreeingPane(APane: TSpkPane);
procedure ExecOnClick; procedure ExecOnClick;
@ -356,7 +356,7 @@ begin
end else end else
if FMouseActiveElement.ElementType = etTabArea then if FMouseActiveElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end else end else
if FMouseActiveElement.ElementType = etNone then if FMouseActiveElement.ElementType = etNone then
begin begin
@ -378,7 +378,7 @@ begin
begin begin
FMouseActiveElement.ElementType := etTabArea; FMouseActiveElement.ElementType := etTabArea;
FMouseActiveElement.ElementIndex := -1; FMouseActiveElement.ElementIndex := -1;
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
end; end;
end; end;
@ -394,7 +394,7 @@ begin
end else end else
if FMouseHoverElement.ElementType = etTabArea then if FMouseHoverElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
end; end;
@ -407,7 +407,7 @@ var
i: integer; i: integer;
NewMouseHoverElement: TSpkMouseTabElement; NewMouseHoverElement: TSpkMouseTabElement;
begin begin
// Szukamy obiektu pod mysz¹ // We're looking for an object under the mouse
i := FindPaneAt(X, Y); i := FindPaneAt(X, Y);
if i <> -1 then if i <> -1 then
begin begin
@ -434,12 +434,12 @@ begin
end else end else
if FMouseActiveElement.ElementType = etTabArea then if FMouseActiveElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end else end else
if FMouseActiveElement.ElementType = etNone then if FMouseActiveElement.ElementType = etNone then
begin begin
// Jeœli element pod mysz¹ siê zmienia, informujemy poprzedni element o // If the item under the mouse changes, we inform the previous element
// tym, ¿e mysz opuszcza jego obszar // that the mouse leaves its area
if (NewMouseHoverElement.ElementType <> FMouseHoverElement.ElementType) or if (NewMouseHoverElement.ElementType <> FMouseHoverElement.ElementType) or
(NewMouseHoverElement.ElementIndex <> FMouseHoverElement.ElementIndex) then (NewMouseHoverElement.ElementIndex <> FMouseHoverElement.ElementIndex) then
begin begin
@ -450,7 +450,7 @@ begin
end else end else
if FMouseHoverElement.ElementType = etTabArea then if FMouseHoverElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end; end;
end; end;
@ -461,7 +461,7 @@ begin
end else end else
if NewMouseHoverElement.ElementType = etTabArea then if NewMouseHoverElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia // Placeholder, if there is a need to handle this event
end; end;
end; end;
@ -482,7 +482,7 @@ begin
end else end else
if FMouseActiveElement.ElementType = etTabArea then if FMouseActiveElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
if ClearActive and if ClearActive and
@ -496,7 +496,7 @@ begin
end else end else
if FMouseActiveElement.ElementType = etTabArea then if FMouseActiveElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
if FMouseHoverElement.ElementType = etPane then if FMouseHoverElement.ElementType = etPane then
@ -506,7 +506,7 @@ begin
end else end else
if FMouseHoverElement.ElementType = etTabArea then if FMouseHoverElement.ElementType = etTabArea then
begin begin
// Placeholder, jeœli zajdzie potrzeba obs³ugi tego zdarzenia. // Placeholder, if there is a need to handle this event.
end; end;
end; end;
@ -593,7 +593,8 @@ begin
FPanes.Appearance := FCustomAppearance FPanes.Appearance := FCustomAppearance
else else
FPanes.Appearance := FAppearance; FPanes.Appearance := FAppearance;
// Metoda pe³ni rolê makra - dlatego nie powiadamia dyspozytora o zmianie. // The method plays the role of a macro - therefore it does not
// notify the dispatcher about the change.
end; end;
procedure TSpkTab.SetVisible(const Value: boolean); procedure TSpkTab.SetVisible(const Value: boolean);
@ -624,7 +625,7 @@ var
i: Integer; i: Integer;
begin begin
if (AIndex < 0) or (AIndex >= self.Count) then if (AIndex < 0) or (AIndex >= self.Count) then
raise InternalException.Create('TSpkTabs.Insert: Nieprawid³owy indeks!'); raise InternalException.Create('TSpkTabs.Insert: Invalid index!');
if FRootComponent<>nil then if FRootComponent<>nil then
begin begin
@ -658,8 +659,8 @@ begin
case Operation of case Operation of
opInsert: opInsert:
begin begin
// Ustawienie dyspozytora na nil spowoduje, ¿e podczas // Setting the dispatcher to nil will cause that during the
// przypisywania w³asnoœci nie bêd¹ wo³ane metody Notify* // ownership assignment, the Notify method will not be called
TSpkTab(Item).ToolbarDispatch := nil; TSpkTab(Item).ToolbarDispatch := nil;
TSpkTab(Item).Appearance := self.FAppearance; TSpkTab(Item).Appearance := self.FAppearance;
TSpkTab(Item).Images := self.FImages; TSpkTab(Item).Images := self.FImages;

View File

@ -72,14 +72,14 @@ begin
not (RightEdgeOpen or BottomEdgeOpen) not (RightEdgeOpen or BottomEdgeOpen)
); );
// Wewnêtrzna krawêdŸ // Inner edge
// *** Góra *** // *** Top ***
x1 := Rect.Left + radius * TopClosed * LeftClosed + LeftClosed; x1 := Rect.Left + radius * TopClosed * LeftClosed + LeftClosed;
x2 := Rect.Right - radius * TopClosed * RightClosed - RightClosed; x2 := Rect.Right - radius * TopClosed * RightClosed - RightClosed;
y1 := Rect.Top + TopClosed; y1 := Rect.Top + TopClosed;
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect); TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Dó³ *** // *** Bottom ***
x1 := Rect.Left + radius * BottomClosed * LeftClosed + LeftClosed; x1 := Rect.Left + radius * BottomClosed * LeftClosed + LeftClosed;
x2 := Rect.Right - radius * BottomClosed * RightClosed - RightClosed; x2 := Rect.Right - radius * BottomClosed * RightClosed - RightClosed;
y1 := Rect.Bottom - BottomClosed; y1 := Rect.Bottom - BottomClosed;
@ -88,13 +88,13 @@ begin
else else
TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect); TGuiTools.DrawHLine(Bitmap, x1, x2, y1, InnerLightColor, ClipRect);
// *** Lewo *** // *** Left ***
y1 := Rect.Top + Radius * LeftClosed * TopClosed + TopClosed; y1 := Rect.Top + Radius * LeftClosed * TopClosed + TopClosed;
y2 := Rect.Bottom - Radius * LeftClosed * BottomClosed - BottomClosed; y2 := Rect.Bottom - Radius * LeftClosed * BottomClosed - BottomClosed;
x1 := Rect.Left + LeftClosed; x1 := Rect.Left + LeftClosed;
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect); TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// *** Prawo *** // *** Right ***
y1 := Rect.Top + Radius * RightClosed * TopClosed + TopClosed; y1 := Rect.Top + Radius * RightClosed * TopClosed + TopClosed;
y2 := Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed; y2 := Rect.Bottom - Radius * RightClosed * BottomClosed - BottomClosed;
x1 := Rect.Right - RightClosed; x1 := Rect.Right - RightClosed;
@ -103,7 +103,7 @@ begin
else else
TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect); TGuiTools.DrawVLine(Bitmap, x1, y1, y2, InnerLightColor, ClipRect);
// Zaokr¹glone naro¿niki // Rounded corners
if not(LeftEdgeOpen or TopEdgeOpen) then if not(LeftEdgeOpen or TopEdgeOpen) then
TGuiTools.DrawAARoundCorner( TGuiTools.DrawAARoundCorner(
Bitmap, Bitmap,
@ -157,8 +157,8 @@ begin
ClipRect ClipRect
); );
// Zewnêtrzna krawêdŸ // Outer edge
// Zaokr¹glone naro¿niki // Rounded corners
if not TopEdgeOpen then if not TopEdgeOpen then
begin begin
x1 := Rect.Left + Radius * LeftClosed; x1 := Rect.Left + Radius * LeftClosed;

View File

@ -4,11 +4,11 @@ unit spkt_Types;
(******************************************************************************* (*******************************************************************************
* * * *
* Plik: spkt_Types.pas * * File: spkt_Types.pas *
* Opis: Definicje typów u¿ywanych podczas pracy toolbara * * Description: Definitions of types used during work of the toolbar *
* Copyright: (c) 2009 by Spook. * * Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) * * License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation * ' See "license.txt" in this installation *
* * * *
*******************************************************************************) *******************************************************************************)
@ -111,7 +111,7 @@ begin
// przetwarzaj¹ca nazwy korzysta z AddItem) // przetwarzaj¹ca nazwy korzysta z AddItem)
// This method can be recalling untreated names (in particular, the method // This method can be recalling untreated names (in particular, the method
// uses the name przetwarzaj¹ca AddItem) --- ??? // that processes the name uses the AddItem)
Notify(AItem, opInsert); Notify(AItem, opInsert);
FList.Add(AItem); FList.Add(AItem);

View File

@ -6,9 +6,10 @@ unit SpkXMLParser;
interface interface
{TODO Uporz�dkowa� widoczno�� i wirtualno�� metod i w�asno�ci} {TODO Organize the visibility and virtuality of methods and properties}
// Notatki: Stosuj� konsekwentnie case-insensitivity // Notatki: Stosuj� konsekwentnie case-insensitivity
// Notes: I apply case-insensitivity consistently
uses uses
SysUtils, Classes, ContNrs, Graphics, Math; SysUtils, Classes, ContNrs, Graphics, Math;
@ -16,31 +17,32 @@ uses
//todo: use LineEnding? //todo: use LineEnding?
const CRLF=#13#10; const CRLF=#13#10;
type // Rodzaj ga��zi XML type // The type of XML nodes
TXMLNodeType = (xntNormal, xntControl, xntComment); TXMLNodeType = (xntNormal, xntControl, xntComment);
type // Forward dla klasy ga��zi XML type // Forward declaration for XML nodes
TSpkXMLNode = class; TSpkXMLNode = class;
TBinaryTreeNode = class; TBinaryTreeNode = class;
// Ga��� drzewa binarnych przeszukiwa� // I'm going to binary tree searches
TBinaryTreeNode = class(TObject) TBinaryTreeNode = class(TObject)
private private
// Lewe poddrzewo // The left subtree
FLeft, FLeft,
// Prawe poddrzewo // The right subtree
FRight, FRight,
// Rodzic // Parent
FParent : TBinaryTreeNode; FParent : TBinaryTreeNode;
// Dane zawarte w w��le // Data contained in the node
FData : array of TSpkXMLNode; FData : array of TSpkXMLNode;
// Wysoko�� poddrzewa // The height of the subtree
FSubtreeSize : integer; FSubtreeSize : integer;
protected
// *** Metody dotycz�ce drzewa ***
// Setter dla lewego poddrzewa protected
// *** Methods for the tree ***
// Setter for the left subtree
procedure SetLeft(ANode : TBinaryTreeNode); procedure SetLeft(ANode : TBinaryTreeNode);
// Setter dla prawego poddrzewa // Setter dla prawego poddrzewa
procedure SetRight(ANode : TBinaryTreeNode); procedure SetRight(ANode : TBinaryTreeNode);
@ -411,26 +413,23 @@ if Parent<>nil then
Parent.RefreshSubtreeSize; Parent.RefreshSubtreeSize;
end; end;
// According to the assumptions, this method can only be called the current parent.
procedure TBinaryTreeNode.DetachFromParent; procedure TBinaryTreeNode.DetachFromParent;
begin begin
// Zgodnie z za�o�eniami, metod� t� mo�e zawo�a� tylko obecny parent. FParent := nil;
FParent:=nil;
end; end;
// According to the assumptions, this method is called by the new parent
// of the element. The element must take care to inform the previous parent
// about the fact that he is removable.
procedure TBinaryTreeNode.AttachToParent(AParent : TBinaryTreeNode); procedure TBinaryTreeNode.AttachToParent(AParent : TBinaryTreeNode);
begin begin
// Zgodnie z za�o�eniami, t� metod� wywo�uje nowy parent elementu. Element if AParent<>FParent then
// musi zadba� o to, by poinformowa� poprzedniego parenta o tym, �e jest on begin
// odpinany. if FParent<>nil then
if AParent<>FParent then
begin
if FParent<>nil then
FParent.DetachChild(self); FParent.DetachChild(self);
FParent := AParent;
FParent:=AParent; end;
end;
end; end;
procedure TBinaryTreeNode.DetachChild(AChild : TBinaryTreeNode); procedure TBinaryTreeNode.DetachChild(AChild : TBinaryTreeNode);
@ -446,15 +445,14 @@ RefreshSubtreeSize;
end; end;
procedure TBinaryTreeNode.Add(AData : TSpkXMLNode); procedure TBinaryTreeNode.Add(AData : TSpkXMLNode);
begin begin
{$B-} {$B-}
if (length(FData)=0) or ((length(FData)>0) and (uppercase(FData[0].Name)=uppercase(AData.Name))) then if (Length(FData)=0) or ((Length(FData)>0) and (Uppercase(FData[0].Name)=Uppercase(AData.Name))) then
begin begin
setlength(FData,length(FData)+1); SetLength(FData, Length(FData)+1);
FData[high(FData)]:=AData; FData[High(FData)] := AData;
end else end else
raise exception.create('Pojedyncza ga��� przechowuje dane o jednakowych nazwach!'); raise Exception.Create('A single node stores data with identical names!');
end; end;
procedure TBinaryTreeNode.Remove(AData : TSpkXMLNode); procedure TBinaryTreeNode.Remove(AData : TSpkXMLNode);
@ -519,7 +517,7 @@ if (uppercase(FValue)='TRUE') or (uppercase(FValue)='T') or
(uppercase(FValue)='YES') or (uppercase(FValue)='Y') then result:=true else (uppercase(FValue)='YES') or (uppercase(FValue)='Y') then result:=true else
if (uppercase(FValue)='FALSE') or (uppercase(FValue)='F') or if (uppercase(FValue)='FALSE') or (uppercase(FValue)='F') or
(uppercase(FValue)='NO') or (uppercase(FValue)='N') then result:=false else (uppercase(FValue)='NO') or (uppercase(FValue)='N') then result:=false else
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
function TSpkXMLParameter.GetValueAsColor: TColor; function TSpkXMLParameter.GetValueAsColor: TColor;
@ -528,7 +526,7 @@ begin
try try
result:=StrToInt(FValue); result:=StrToInt(FValue);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -537,7 +535,7 @@ begin
try try
result:=StrToFloat(FValue); result:=StrToFloat(FValue);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -546,7 +544,7 @@ begin
try try
result:=StrToInt(FValue); result:=StrToInt(FValue);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -581,7 +579,7 @@ procedure TSpkXMLParameters.Insert(AIndex : integer; AParameter : TSpkXMLParamet
begin begin
if (AIndex<0) or (AIndex>FList.count-1) then if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks.'); raise exception.create('Invalid index.');
FList.Insert(AIndex, AParameter); FList.Insert(AIndex, AParameter);
end; end;
@ -601,7 +599,7 @@ end;
procedure TSpkXMLParameters.Delete(index: integer); procedure TSpkXMLParameters.Delete(index: integer);
begin begin
if (index<0) or (index>FList.count-1) then if (index<0) or (index>FList.count-1) then
raise exception.create('Nieprawid�owy indeks parametru.'); raise exception.create('Invalid parameter index.');
FList.delete(index); FList.delete(index);
end; end;
@ -626,7 +624,7 @@ end;
function TSpkXMLParameters.GetParamByIndex(index: integer): TSpkXMLParameter; function TSpkXMLParameters.GetParamByIndex(index: integer): TSpkXMLParameter;
begin begin
if (index<0) or (index>Flist.count-1) then if (index<0) or (index>Flist.count-1) then
raise exception.create('Nieprawid�owy indeks elementu.'); raise exception.create('Invalid item index.');
result:=TSpkXMLParameter(FList[index]); result:=TSpkXMLParameter(FList[index]);
end; end;
@ -727,7 +725,7 @@ procedure TSpkBaseXMLNode.TreeDelete(ANode : TSpkXMLNode);
// Kilka przypadk�w. // Kilka przypadk�w.
// 0. Mo�e elementu nie ma w drzewku? // 0. Mo�e elementu nie ma w drzewku?
if DelNode=nil then if DelNode=nil then
raise exception.create('Takiego elementu nie ma w drzewie AVL!') else raise exception.create('There is no such element in the AVL tree!') else
// 1. Je�li ga��� ta przechowuje wi�cej ni� tylko ten element, to usuwamy go // 1. Je�li ga��� ta przechowuje wi�cej ni� tylko ten element, to usuwamy go
// z listy i ko�czymy dzia�anie. // z listy i ko�czymy dzia�anie.
if DelNode.Count>1 then if DelNode.Count>1 then
@ -1004,7 +1002,7 @@ function TSpkBaseXMLNode.GetNodeByIndex(index : integer) : TSpkXMLNode;
begin begin
if (index<0) or (index>FList.count-1) then if (index<0) or (index>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!'); raise exception.create('Invalid index!');
result:=TSpkXMLNode(FList[index]); result:=TSpkXMLNode(FList[index]);
end; end;
@ -1066,21 +1064,20 @@ inherited destroy;
end; end;
procedure TSpkBaseXMLNode.Add(ANode : TSpkXMLNode); procedure TSpkBaseXMLNode.Add(ANode : TSpkXMLNode);
begin begin
if ANode = self then if ANode = self then
raise exception.create('Nie mog� doda� siebie do w�asnej listy!'); raise Exception.Create('Cannot add Self to list!');
if ANode.NodeType=xntNormal then if ANode.NodeType = xntNormal then
TreeAdd(ANode); TreeAdd(ANode);
FList.add(ANode); FList.add(ANode);
ANode.Parent:=self; ANode.Parent := self;
end; end;
procedure TSpkBaseXMLNode.Insert(AIndex : integer; ANode : TSpkXMLNode); procedure TSpkBaseXMLNode.Insert(AIndex : integer; ANode : TSpkXMLNode);
begin begin
if (AIndex<0) or (AIndex>FList.count-1) then if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!'); raise exception.create('Invalid index!');
FList.Insert(AIndex, ANode); FList.Insert(AIndex, ANode);
TreeAdd(ANode); TreeAdd(ANode);
@ -1091,7 +1088,7 @@ procedure TSpkBaseXMLNode.Delete(AIndex : integer);
begin begin
if (AIndex<0) or (AIndex>FList.count-1) then if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!'); raise exception.create('Invalid index');
TreeDelete(TSpkXMLNode(FList[AIndex])); TreeDelete(TSpkXMLNode(FList[AIndex]));
@ -1156,7 +1153,7 @@ begin
try try
result:=StrToInt(FText); result:=StrToInt(FText);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -1172,7 +1169,7 @@ begin
try try
result:=StrToFloat(FText); result:=StrToFloat(FText);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -1188,7 +1185,7 @@ begin
try try
result:=StrToInt(FText); result:=StrToInt(FText);
except except
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
end; end;
@ -1205,7 +1202,7 @@ if (uppercase(FText)='TRUE') or (uppercase(FText)='T') or
(uppercase(FText)='YES') or (uppercase(FText)='Y') then result:=true else (uppercase(FText)='YES') or (uppercase(FText)='Y') then result:=true else
if (uppercase(FText)='FALSE') or (uppercase(FText)='F') or if (uppercase(FText)='FALSE') or (uppercase(FText)='F') or
(uppercase(FText)='NO') or (uppercase(FText)='N') then result:=false else (uppercase(FText)='NO') or (uppercase(FText)='N') then result:=false else
raise exception.create('Nie mog� przekonwertowa� warto�ci.'); raise exception.create('Cannot convert values.');
end; end;
procedure TSpkXMLNode.SetTextAsBoolean(value : boolean); procedure TSpkXMLNode.SetTextAsBoolean(value : boolean);
@ -1342,7 +1339,7 @@ var // Stos przetwarzanych ga
// Nie mo�e wyst�pi� tu koniec pliku // Nie mo�e wyst�pi� tu koniec pliku
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku.') else raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file.') else
// Je�li napotkali�my nawias k�towy, mo�e to by� sekcja CDATA // Je�li napotkali�my nawias k�towy, mo�e to by� sekcja CDATA
if (input^='<') and (StrLComp(input,'<![CDATA[',9)=0) then if (input^='<') and (StrLComp(input,'<![CDATA[',9)=0) then
@ -1355,7 +1352,7 @@ var // Stos przetwarzanych ga
repeat repeat
{$B-} {$B-}
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku.'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file.');
if (input^=']') and (StrLComp(input,']]>',3)=0) then Finish:=true else if (input^=']') and (StrLComp(input,']]>',3)=0) then Finish:=true else
begin begin
result:=result+input^; result:=result+input^;
@ -1378,7 +1375,7 @@ var // Stos przetwarzanych ga
while input^<>';' do while input^<>';' do
begin begin
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku - nie doko�czona encja.'); raise Exception.Create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file - entity not finished.');
Entity:=Entity+input^; Entity:=Entity+input^;
increment(input); increment(input);
end; end;
@ -1398,17 +1395,17 @@ var // Stos przetwarzanych ga
// Kod ASCII zapisany heksadecymalnie // Kod ASCII zapisany heksadecymalnie
i:=HexToInt(copy(Entity,2,length(Entity)-1)); i:=HexToInt(copy(Entity,2,length(Entity)-1));
if not(i in [0..255]) then if not(i in [0..255]) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa warto�� heksadecymalna encji (dopuszczalne: 0..255)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid hexadecimal value of the entity (allowed: 0..255)');
result:=result+chr(i); result:=result+chr(i);
end else end else
if Entity[1]='#' then if Entity[1]='#' then
begin begin
i:=StrToInt(copy(Entity,2,length(Entity)-1)); i:=StrToInt(copy(Entity,2,length(Entity)-1));
if not(i in [0..255]) then if not(i in [0..255]) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa warto�� dziesi�tna encji (dopuszczalne: 0..255)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid entity decimal value (acceptable: 0..255)');
result:=result+chr(i); result:=result+chr(i);
end else end else
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa (nie obs�ugiwana) encja!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid (not supported) entity!');
end else end else
if (DoTrim) and (input^ in [#32,#9,#10,#13]) then if (DoTrim) and (input^ in [#32,#9,#10,#13]) then
begin begin
@ -1459,10 +1456,10 @@ try
// Wej�cie mo�e si� tu ko�czy� tylko wtedy, gdy jeste�my // Wej�cie mo�e si� tu ko�czy� tylko wtedy, gdy jeste�my
// maksymalnie na zewn�trz // maksymalnie na zewn�trz
if (input^=#0) and (NodeStack.count>0) then if (input^=#0) and (NodeStack.count>0) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku.'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file.');
if (input^<>#0) and (input^<>'<') then if (input^<>#0) and (input^<>'<') then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owy znak podczas przetwarzania pliku.'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid character when processing the file.');
if input^<>#0 then if input^<>#0 then
if StrLComp(input,'<?',2)=0 then if StrLComp(input,'<?',2)=0 then
@ -1473,7 +1470,7 @@ try
CurrentOperation:=poClosingInterior else CurrentOperation:=poClosingInterior else
if StrLComp(input,'<',1)=0 then if StrLComp(input,'<',1)=0 then
CurrentOperation:=poTagInterior else CurrentOperation:=poTagInterior else
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owy znak podczas przetwarzania pliku.'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid character when processing the file.');
end; end;
poTagInterior, poTagInterior,
@ -1497,12 +1494,12 @@ try
// Plik nie mo�e si� tu ko�czy� // Plik nie mo�e si� tu ko�czy�
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file');
// Oczekujemy nazwy taga, kt�ra jest postaci // Oczekujemy nazwy taga, kt�ra jest postaci
// [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))* // [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))*
if not (input^ in ['a'..'z','A'..'Z']) then if not (input^ in ['a'..'z','A'..'Z']) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa nazwa taga!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid tag name!');
TokenStart:=input; TokenStart:=input;
repeat repeat
@ -1511,7 +1508,7 @@ try
begin begin
increment(input); increment(input);
if not(input^ in ['a'..'z','A'..'Z','0'..'9','_']) then if not(input^ in ['a'..'z','A'..'Z','0'..'9','_']) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa nazwa taga!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid tag name!');
increment(input); increment(input);
end; end;
until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']); until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']);
@ -1522,7 +1519,7 @@ try
// Plik nie mo�e si� tu ko�czy�. // Plik nie mo�e si� tu ko�czy�.
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Teraz b�dziemy wczytywa� parametry (o ile takowe s�). // Teraz b�dziemy wczytywa� parametry (o ile takowe s�).
repeat repeat
@ -1534,7 +1531,7 @@ try
// Plik nie mo�e si� tu ko�czy�. // Plik nie mo�e si� tu ko�czy�.
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Je�eli po bia�ych znakach jest litera, // Je�eli po bia�ych znakach jest litera,
// zaczynamy wczytywa� parametr // zaczynamy wczytywa� parametr
@ -1555,11 +1552,11 @@ try
// Plik nie mo�e si� tu ko�czy� // Plik nie mo�e si� tu ko�czy�
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Oczekujemy znaku '=' // Oczekujemy znaku '='
if input^<>'=' then if input^<>'=' then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Oczekiwany znak r�wno�ci (prawdopodobnie nieprawid�owa nazwa parametru)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Expected equality sign (probably invalid parameter name)');
increment(input); increment(input);
@ -1568,7 +1565,7 @@ try
// Plik nie mo�e si� tu ko�czy� // Plik nie mo�e si� tu ko�czy�
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Oczekujemy ' lub " // Oczekujemy ' lub "
if input^='''' then if input^='''' then
@ -1587,7 +1584,7 @@ try
// Pomijamy ko�cz�cy znak cudzys�owu // Pomijamy ko�cz�cy znak cudzys�owu
increment(input); increment(input);
end else end else
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owy znak, oczekiwano '' lub "'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+ '): Invalid character, expected " or "');
// Dodajemy parametr o nazwie s i zawarto�ci s1 // Dodajemy parametr o nazwie s i zawarto�ci s1
Node.Parameters[s,true].Value:=s1; Node.Parameters[s,true].Value:=s1;
@ -1603,12 +1600,12 @@ try
// Plik nie mo�e si� tu ko�czy�. // Plik nie mo�e si� tu ko�czy�.
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
if CurrentOperation=poControlInterior then if CurrentOperation=poControlInterior then
begin begin
if StrLComp(input,'?>',2)<>0 then if StrLComp(input,'?>',2)<>0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owe domkni�cie taga kontrolnego (powinno by�: ?>)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Incorrect closing of the control tag (should be:?>)');
// Pomijamy znaki zamkni�cia taga kontrolnego // Pomijamy znaki zamkni�cia taga kontrolnego
increment(input,2); increment(input,2);
@ -1641,7 +1638,7 @@ try
CurrentOperation:=poTagText; CurrentOperation:=poTagText;
end else end else
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owe domkni�cie taga XML (powinno by�: > lub />)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Incorrect closing of the XML tag (should be:> or />)');
end; end;
except except
@ -1673,7 +1670,7 @@ try
repeat repeat
increment(input); increment(input);
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
until input^='-'; until input^='-';
until StrLComp(input,'-->',3)=0; until StrLComp(input,'-->',3)=0;
@ -1703,12 +1700,12 @@ try
// Plik nie mo�e si� tu ko�czy� // Plik nie mo�e si� tu ko�czy�
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Wczytujemy nazw� zamykanego taga postaci // Wczytujemy nazw� zamykanego taga postaci
// [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))* // [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))*
if not(input^ in ['a'..'z','A'..'Z']) then if not(input^ in ['a'..'z','A'..'Z']) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa nazwa taga!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid tag name!');
TokenStart:=input; TokenStart:=input;
repeat repeat
@ -1717,7 +1714,7 @@ try
begin begin
increment(input); increment(input);
if not(input^ in ['a'..'z','A'..'Z','0'..'9','_']) then if not(input^ in ['a'..'z','A'..'Z','0'..'9','_']) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieprawid�owa nazwa taga!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Invalid tag name!');
increment(input); increment(input);
end; end;
until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']); until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']);
@ -1730,11 +1727,11 @@ try
// Plik nie mo�e si� tu ko�czy� // Plik nie mo�e si� tu ko�czy�
if input^=#0 then if input^=#0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of the file!');
// Oczekujemy znaku '>' // Oczekujemy znaku '>'
if input^<>'>' then if input^<>'>' then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Oczekiwany znak zamkni�cia taga (>)'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Expected tag closing (>)');
// Pomijamy znak zamkni�cia taga // Pomijamy znak zamkni�cia taga
increment(input); increment(input);
@ -1742,10 +1739,10 @@ try
// Sprawdzamy, czy uppercase nazwa taga na stosie i // Sprawdzamy, czy uppercase nazwa taga na stosie i
// wczytana pasuj� do siebie // wczytana pasuj� do siebie
if NodeStack.Count=0 then if NodeStack.Count=0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Brakuje taga otwieraj�cego do zamykaj�cego!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): The opening tag is not closed!');
if uppercase(s)<>uppercase(TSpkXMLNode(NodeStack.Peek).Name) then if uppercase(s)<>uppercase(TSpkXMLNode(NodeStack.Peek).Name) then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Tag zamykaj�cy ('+s+') nie pasuje do taga otwieraj�cego ('+TSpkXMLNode(NodeStack.Peek).Name+') !'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): The closing tag (' + s + ') does not match the opening tag ('+TSpkXMLNode(NodeStack.Peek).Name+') !');
// Wszystko OK, zdejmujemy tag ze stosu i dodajemy go do taga pod nim // Wszystko OK, zdejmujemy tag ze stosu i dodajemy go do taga pod nim
Node:=TSpkXMLNode(NodeStack.Pop); Node:=TSpkXMLNode(NodeStack.Pop);
@ -1763,7 +1760,7 @@ try
s:=ParseText(input,'<',true); s:=ParseText(input,'<',true);
if NodeStack.Count=0 then if NodeStack.Count=0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Tekst mo�e wyst�powa� tylko wewn�trz tag�w!'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): The text can only be inside tags!');
TSpkXMLNode(NodeStack.Peek).Text:=s; TSpkXMLNode(NodeStack.Peek).Text:=s;
@ -1775,7 +1772,7 @@ try
// domkni�te) // domkni�te)
if NodeStack.Count>0 then if NodeStack.Count>0 then
raise exception.create('B��d w sk�adni XML (linia '+IntToStr(ParseLine)+', znak '+IntToStr(ParseChar)+') : Nieoczekiwany koniec pliku (istniej� nie domkni�te tagi, pierwszy z nich: '+TSpkXMLNode(NodeStack.Peek).Name+')'); raise exception.create('Error in XML syntax (line '+IntToStr(ParseLine)+', character '+IntToStr(ParseChar)+'): Unexpected end of file (there are unclosed tags, the first of them is '+TSpkXMLNode(NodeStack.Peek).Name+')');
// Wszystko w porz�dku, XML zosta� wczytany. // Wszystko w porz�dku, XML zosta� wczytany.
finally finally
@ -1978,78 +1975,60 @@ function TSpkXMLParser.Generate(UseFormatting : boolean) : string;
end; end;
begin begin
result:=InternalGenerate(nil,0,UseFormatting); result:=InternalGenerate(nil,0,UseFormatting);
end; end;
procedure TSpkXMLParser.LoadFromFile(AFile : string); procedure TSpkXMLParser.LoadFromFile(AFile : string);
var
var sl : TStringList; sl : TStringList;
begin begin
sl:=nil; sl:=TStringList.create;
try try
sl:=TStringList.create; sl.LoadFromFile(AFile);
sl.LoadFromFile(AFile); if length(sl.text)>0 then
self.Parse(PChar(sl.text));
if length(sl.text)>0 then finally
self.Parse(PChar(sl.text)); sl.free;
end;
finally
if sl<>nil then sl.free;
end;
end; end;
procedure TSpkXMLParser.SaveToFile(AFile : string; UseFormatting : boolean); procedure TSpkXMLParser.SaveToFile(AFile : string; UseFormatting : boolean);
var
var sl : TStringList; sl: TStringList;
begin begin
sl:=nil; sl:=TStringList.create;
try try
sl:=TStringList.create; sl.text:=self.Generate(UseFormatting);
sl.savetofile(AFile);
sl.text:=self.Generate(UseFormatting); finally
sl.free;
sl.savetofile(AFile); end;
finally
if sl<>nil then sl.free;
end;
end; end;
procedure TSpkXMLParser.LoadFromStream(AStream : TStream); procedure TSpkXMLParser.LoadFromStream(AStream : TStream);
var
var sl : TStringList; sl: TStringList;
begin begin
sl:=nil; sl:=TStringList.create;
try try
sl:=TStringList.create; sl.LoadFromStream(AStream);
sl.LoadFromStream(AStream); self.Parse(PChar(sl.text));
finally
self.Parse(PChar(sl.text)); sl.free;
end;
finally
if sl<>nil then sl.free;
end;
end; end;
procedure TSpkXMLParser.SaveToStream(AStream : TStream; UseFormatting : boolean); procedure TSpkXMLParser.SaveToStream(AStream : TStream; UseFormatting : boolean);
var
var sl : TStringList; sl: TStringList;
begin begin
sl:=nil; sl:=TStringList.create;
try try
sl:=TStringList.create; sl.text:=self.Generate(UseFormatting);
sl.savetostream(AStream);
sl.text:=self.Generate(UseFormatting); finally
sl.free;
sl.savetostream(AStream); end;
finally
if sl<>nil then sl.free;
end;
end; end;
end. end.

View File

@ -125,8 +125,6 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
CustomAppearance.Element.ActiveCaptionColor = 8405614 CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded CustomAppearance.Element.Style = esRounded
Caption = 'Sample toolbar' Caption = 'Sample toolbar'
OverrideAppearance = False
Visible = True
Panes = ( Panes = (
'SpkPane1' 'SpkPane1'
'SpkPane2' 'SpkPane2'
@ -134,29 +132,21 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
) )
object SpkPane1: TSpkPane object SpkPane1: TSpkPane
Caption = 'Sample large buttons' Caption = 'Sample large buttons'
Visible = True
Items = ( Items = (
'SpkLargeButton1' 'SpkLargeButton1'
'SpkLargeButton3' 'SpkLargeButton3'
'SpkLargeButton2' 'SpkLargeButton2'
) )
object SpkLargeButton1: TSpkLargeButton object SpkLargeButton1: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Default' Caption = 'Default'
LargeImageIndex = 0 LargeImageIndex = 0
ButtonKind = bkButton
end end
object SpkLargeButton3: TSpkLargeButton object SpkLargeButton3: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Button and dropdown' Caption = 'Button and dropdown'
LargeImageIndex = 0 LargeImageIndex = 0
ButtonKind = bkButtonDropdown ButtonKind = bkButtonDropdown
end end
object SpkLargeButton2: TSpkLargeButton object SpkLargeButton2: TSpkLargeButton
Visible = True
Enabled = True
Caption = 'Dropdown' Caption = 'Dropdown'
LargeImageIndex = 0 LargeImageIndex = 0
ButtonKind = bkDropdown ButtonKind = bkDropdown
@ -164,49 +154,34 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
end end
object SpkPane2: TSpkPane object SpkPane2: TSpkPane
Caption = 'Sample small buttons' Caption = 'Sample small buttons'
Visible = True
Items = ( Items = (
'SpkSmallButton1' 'SpkSmallButton1'
'SpkSmallButton2' 'SpkSmallButton2'
'SpkSmallButton3' 'SpkSmallButton3'
) )
object SpkSmallButton1: TSpkSmallButton object SpkSmallButton1: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Default' Caption = 'Default'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True HideFrameWhenIdle = True
ImageIndex = 0 ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow TableBehaviour = tbBeginsRow
ButtonKind = bkButton
end end
object SpkSmallButton2: TSpkSmallButton object SpkSmallButton2: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button and dropdown' Caption = 'Button and dropdown'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True HideFrameWhenIdle = True
ImageIndex = 0 ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow TableBehaviour = tbBeginsRow
ButtonKind = bkButtonDropdown ButtonKind = bkButtonDropdown
end end
object SpkSmallButton3: TSpkSmallButton object SpkSmallButton3: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Dropdown' Caption = 'Dropdown'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = True HideFrameWhenIdle = True
ImageIndex = 0 ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow TableBehaviour = tbBeginsRow
ButtonKind = bkDropdown ButtonKind = bkDropdown
end end
end end
object SpkPane3: TSpkPane object SpkPane3: TSpkPane
Caption = 'Tool buttons' Caption = 'Tool buttons'
Visible = True
Items = ( Items = (
'SpkSmallButton4' 'SpkSmallButton4'
'SpkSmallButton5' 'SpkSmallButton5'
@ -215,59 +190,31 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
'SpkSmallButton8' 'SpkSmallButton8'
) )
object SpkSmallButton4: TSpkSmallButton object SpkSmallButton4: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button' Caption = 'Button'
GroupBehaviour = gbBeginsGroup GroupBehaviour = gbBeginsGroup
HideFrameWhenIdle = False
ImageIndex = 0 ImageIndex = 0
ShowCaption = False ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end end
object SpkSmallButton5: TSpkSmallButton object SpkSmallButton5: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button' Caption = 'Button'
GroupBehaviour = gbContinuesGroup GroupBehaviour = gbContinuesGroup
HideFrameWhenIdle = False
ImageIndex = 0 ImageIndex = 0
ShowCaption = False ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end end
object SpkSmallButton6: TSpkSmallButton object SpkSmallButton6: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Button' Caption = 'Button'
GroupBehaviour = gbEndsGroup GroupBehaviour = gbEndsGroup
HideFrameWhenIdle = False
ImageIndex = 0 ImageIndex = 0
ShowCaption = False ShowCaption = False
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end end
object SpkSmallButton7: TSpkSmallButton object SpkSmallButton7: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Btn1' Caption = 'Btn1'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = False
ImageIndex = 0 ImageIndex = 0
ShowCaption = True
TableBehaviour = tbBeginsRow TableBehaviour = tbBeginsRow
ButtonKind = bkButton
end end
object SpkSmallButton8: TSpkSmallButton object SpkSmallButton8: TSpkSmallButton
Visible = True
Enabled = True
Caption = 'Btn2' Caption = 'Btn2'
GroupBehaviour = gbSingleItem
HideFrameWhenIdle = False
ImageIndex = 0 ImageIndex = 0
ShowCaption = True
TableBehaviour = tbContinuesRow
ButtonKind = bkButton
end end
end end
end end
@ -316,8 +263,6 @@ object frmAppearanceEditWindow: TfrmAppearanceEditWindow
CustomAppearance.Element.ActiveCaptionColor = 8405614 CustomAppearance.Element.ActiveCaptionColor = 8405614
CustomAppearance.Element.Style = esRounded CustomAppearance.Element.Style = esRounded
Caption = 'Another tab' Caption = 'Another tab'
OverrideAppearance = False
Visible = True
Panes = ( ) Panes = ( )
end end
end end

View File

@ -326,7 +326,8 @@ uses
var var
CurrPageIndex: Integer = 0; CurrPageIndex: Integer = 0;
{ TForm3 }
{ TfrmAppearanceEditWindow }
{$IF lcl_fullversion >= 1080000} {$IF lcl_fullversion >= 1080000}
procedure TfrmAppearanceEditWindow.DoAutoAdjustLayout( procedure TfrmAppearanceEditWindow.DoAutoAdjustLayout(

View File

@ -136,6 +136,7 @@ resourcestring
RSNoObjectSelected = 'No object selected!'; RSNoObjectSelected = 'No object selected!';
RSNoObjectSelectedToMove = 'No object selected to move!'; RSNoObjectSelectedToMove = 'No object selected to move!';
{ TfrmEditWindow } { TfrmEditWindow }
procedure TfrmEditWindow.aAddPaneExecute(Sender: TObject); procedure TfrmEditWindow.aAddPaneExecute(Sender: TObject);