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;
end;
end.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,11 +4,11 @@ unit spkt_Types;
(*******************************************************************************
* *
* Plik: spkt_Types.pas *
* Opis: Definicje typów u¿ywanych podczas pracy toolbara *
* Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation *
* File: spkt_Types.pas *
* Description: Definitions of types used during work of the toolbar *
* Copyright: (c) 2009 by Spook. *
* License: Modified LGPL (with linking exception, like Lazarus LCL) *
' See "license.txt" in this installation *
* *
*******************************************************************************)
@ -111,7 +111,7 @@ begin
// przetwarzaj¹ca nazwy korzysta z AddItem)
// 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);
FList.Add(AItem);

View File

@ -6,9 +6,10 @@ unit SpkXMLParser;
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
// Notes: I apply case-insensitivity consistently
uses
SysUtils, Classes, ContNrs, Graphics, Math;
@ -16,31 +17,32 @@ uses
//todo: use LineEnding?
const CRLF=#13#10;
type // Rodzaj ga��zi XML
type // The type of XML nodes
TXMLNodeType = (xntNormal, xntControl, xntComment);
type // Forward dla klasy ga��zi XML
type // Forward declaration for XML nodes
TSpkXMLNode = class;
TBinaryTreeNode = class;
// Ga��� drzewa binarnych przeszukiwa�
// I'm going to binary tree searches
TBinaryTreeNode = class(TObject)
private
// Lewe poddrzewo
// The left subtree
FLeft,
// Prawe poddrzewo
// The right subtree
FRight,
// Rodzic
// Parent
FParent : TBinaryTreeNode;
// Dane zawarte w w��le
// Data contained in the node
FData : array of TSpkXMLNode;
// Wysoko�� poddrzewa
// The height of the subtree
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);
// Setter dla prawego poddrzewa
procedure SetRight(ANode : TBinaryTreeNode);
@ -411,26 +413,23 @@ if Parent<>nil then
Parent.RefreshSubtreeSize;
end;
// According to the assumptions, this method can only be called the current parent.
procedure TBinaryTreeNode.DetachFromParent;
begin
// Zgodnie z za�o�eniami, metod� t� mo�e zawo�a� tylko obecny parent.
FParent:=nil;
FParent := nil;
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);
begin
// Zgodnie z za�o�eniami, t� metod� wywo�uje nowy parent elementu. Element
// musi zadba� o to, by poinformowa� poprzedniego parenta o tym, �e jest on
// odpinany.
if AParent<>FParent then
begin
if FParent<>nil then
if AParent<>FParent then
begin
if FParent<>nil then
FParent.DetachChild(self);
FParent:=AParent;
end;
FParent := AParent;
end;
end;
procedure TBinaryTreeNode.DetachChild(AChild : TBinaryTreeNode);
@ -446,15 +445,14 @@ RefreshSubtreeSize;
end;
procedure TBinaryTreeNode.Add(AData : TSpkXMLNode);
begin
{$B-}
if (length(FData)=0) or ((length(FData)>0) and (uppercase(FData[0].Name)=uppercase(AData.Name))) then
begin
setlength(FData,length(FData)+1);
FData[high(FData)]:=AData;
end else
raise exception.create('Pojedyncza ga��� przechowuje dane o jednakowych nazwach!');
{$B-}
if (Length(FData)=0) or ((Length(FData)>0) and (Uppercase(FData[0].Name)=Uppercase(AData.Name))) then
begin
SetLength(FData, Length(FData)+1);
FData[High(FData)] := AData;
end else
raise Exception.Create('A single node stores data with identical names!');
end;
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
if (uppercase(FValue)='FALSE') or (uppercase(FValue)='F') or
(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;
function TSpkXMLParameter.GetValueAsColor: TColor;
@ -528,7 +526,7 @@ begin
try
result:=StrToInt(FValue);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
end;
end;
@ -537,7 +535,7 @@ begin
try
result:=StrToFloat(FValue);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
end;
end;
@ -546,7 +544,7 @@ begin
try
result:=StrToInt(FValue);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
end;
end;
@ -581,7 +579,7 @@ procedure TSpkXMLParameters.Insert(AIndex : integer; AParameter : TSpkXMLParamet
begin
if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks.');
raise exception.create('Invalid index.');
FList.Insert(AIndex, AParameter);
end;
@ -601,7 +599,7 @@ end;
procedure TSpkXMLParameters.Delete(index: integer);
begin
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);
end;
@ -626,7 +624,7 @@ end;
function TSpkXMLParameters.GetParamByIndex(index: integer): TSpkXMLParameter;
begin
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]);
end;
@ -727,7 +725,7 @@ procedure TSpkBaseXMLNode.TreeDelete(ANode : TSpkXMLNode);
// Kilka przypadk�w.
// 0. Mo�e elementu nie ma w drzewku?
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
// z listy i ko�czymy dzia�anie.
if DelNode.Count>1 then
@ -1004,7 +1002,7 @@ function TSpkBaseXMLNode.GetNodeByIndex(index : integer) : TSpkXMLNode;
begin
if (index<0) or (index>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!');
raise exception.create('Invalid index!');
result:=TSpkXMLNode(FList[index]);
end;
@ -1066,21 +1064,20 @@ inherited destroy;
end;
procedure TSpkBaseXMLNode.Add(ANode : TSpkXMLNode);
begin
if ANode = self then
raise exception.create('Nie mog� doda� siebie do w�asnej listy!');
if ANode.NodeType=xntNormal then
TreeAdd(ANode);
FList.add(ANode);
ANode.Parent:=self;
if ANode = self then
raise Exception.Create('Cannot add Self to list!');
if ANode.NodeType = xntNormal then
TreeAdd(ANode);
FList.add(ANode);
ANode.Parent := self;
end;
procedure TSpkBaseXMLNode.Insert(AIndex : integer; ANode : TSpkXMLNode);
begin
if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!');
raise exception.create('Invalid index!');
FList.Insert(AIndex, ANode);
TreeAdd(ANode);
@ -1091,7 +1088,7 @@ procedure TSpkBaseXMLNode.Delete(AIndex : integer);
begin
if (AIndex<0) or (AIndex>FList.count-1) then
raise exception.create('Nieprawid�owy indeks!');
raise exception.create('Invalid index');
TreeDelete(TSpkXMLNode(FList[AIndex]));
@ -1156,7 +1153,7 @@ begin
try
result:=StrToInt(FText);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
end;
end;
@ -1172,7 +1169,7 @@ begin
try
result:=StrToFloat(FText);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
end;
end;
@ -1188,7 +1185,7 @@ begin
try
result:=StrToInt(FText);
except
raise exception.create('Nie mog� przekonwertowa� warto�ci.');
raise exception.create('Cannot convert values.');
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
if (uppercase(FText)='FALSE') or (uppercase(FText)='F') or
(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;
procedure TSpkXMLNode.SetTextAsBoolean(value : boolean);
@ -1342,7 +1339,7 @@ var // Stos przetwarzanych ga
// Nie mo�e wyst�pi� tu koniec pliku
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
if (input^='<') and (StrLComp(input,'<![CDATA[',9)=0) then
@ -1355,7 +1352,7 @@ var // Stos przetwarzanych ga
repeat
{$B-}
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
begin
result:=result+input^;
@ -1378,7 +1375,7 @@ var // Stos przetwarzanych ga
while input^<>';' do
begin
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^;
increment(input);
end;
@ -1398,17 +1395,17 @@ var // Stos przetwarzanych ga
// Kod ASCII zapisany heksadecymalnie
i:=HexToInt(copy(Entity,2,length(Entity)-1));
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);
end else
if Entity[1]='#' then
begin
i:=StrToInt(copy(Entity,2,length(Entity)-1));
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);
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
if (DoTrim) and (input^ in [#32,#9,#10,#13]) then
begin
@ -1459,10 +1456,10 @@ try
// Wej�cie mo�e si� tu ko�czy� tylko wtedy, gdy jeste�my
// maksymalnie na zewn�trz
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
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 StrLComp(input,'<?',2)=0 then
@ -1473,7 +1470,7 @@ try
CurrentOperation:=poClosingInterior else
if StrLComp(input,'<',1)=0 then
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;
poTagInterior,
@ -1497,12 +1494,12 @@ try
// Plik nie mo�e si� tu ko�czy�
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
// [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))*
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;
repeat
@ -1511,7 +1508,7 @@ try
begin
increment(input);
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);
end;
until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']);
@ -1522,7 +1519,7 @@ try
// Plik nie mo�e si� tu ko�czy�.
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�).
repeat
@ -1534,7 +1531,7 @@ try
// Plik nie mo�e si� tu ko�czy�.
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,
// zaczynamy wczytywa� parametr
@ -1555,11 +1552,11 @@ try
// Plik nie mo�e si� tu ko�czy�
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 '='
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);
@ -1568,7 +1565,7 @@ try
// Plik nie mo�e si� tu ko�czy�
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 "
if input^='''' then
@ -1587,7 +1584,7 @@ try
// Pomijamy ko�cz�cy znak cudzys�owu
increment(input);
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
Node.Parameters[s,true].Value:=s1;
@ -1603,12 +1600,12 @@ try
// Plik nie mo�e si� tu ko�czy�.
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
begin
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
increment(input,2);
@ -1641,7 +1638,7 @@ try
CurrentOperation:=poTagText;
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;
except
@ -1673,7 +1670,7 @@ try
repeat
increment(input);
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 StrLComp(input,'-->',3)=0;
@ -1703,12 +1700,12 @@ try
// Plik nie mo�e si� tu ko�czy�
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
// [a-zA-Z]([a-zA-Z0-9_]|([\-:][a-zA-Z0-9_]))*
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;
repeat
@ -1717,7 +1714,7 @@ try
begin
increment(input);
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);
end;
until not(input^ in ['a'..'z','A'..'Z','0'..'9','_']);
@ -1730,11 +1727,11 @@ try
// Plik nie mo�e si� tu ko�czy�
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 '>'
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
increment(input);
@ -1742,10 +1739,10 @@ try
// Sprawdzamy, czy uppercase nazwa taga na stosie i
// wczytana pasuj� do siebie
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
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
Node:=TSpkXMLNode(NodeStack.Pop);
@ -1763,7 +1760,7 @@ try
s:=ParseText(input,'<',true);
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;
@ -1775,7 +1772,7 @@ try
// domkni�te)
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.
finally
@ -1978,78 +1975,60 @@ function TSpkXMLParser.Generate(UseFormatting : boolean) : string;
end;
begin
result:=InternalGenerate(nil,0,UseFormatting);
result:=InternalGenerate(nil,0,UseFormatting);
end;
procedure TSpkXMLParser.LoadFromFile(AFile : string);
var sl : TStringList;
var
sl : TStringList;
begin
sl:=nil;
try
sl:=TStringList.create;
sl.LoadFromFile(AFile);
if length(sl.text)>0 then
self.Parse(PChar(sl.text));
finally
if sl<>nil then sl.free;
end;
sl:=TStringList.create;
try
sl.LoadFromFile(AFile);
if length(sl.text)>0 then
self.Parse(PChar(sl.text));
finally
sl.free;
end;
end;
procedure TSpkXMLParser.SaveToFile(AFile : string; UseFormatting : boolean);
var sl : TStringList;
var
sl: TStringList;
begin
sl:=nil;
try
sl:=TStringList.create;
sl.text:=self.Generate(UseFormatting);
sl.savetofile(AFile);
finally
if sl<>nil then sl.free;
end;
sl:=TStringList.create;
try
sl.text:=self.Generate(UseFormatting);
sl.savetofile(AFile);
finally
sl.free;
end;
end;
procedure TSpkXMLParser.LoadFromStream(AStream : TStream);
var sl : TStringList;
var
sl: TStringList;
begin
sl:=nil;
try
sl:=TStringList.create;
sl.LoadFromStream(AStream);
self.Parse(PChar(sl.text));
finally
if sl<>nil then sl.free;
end;
sl:=TStringList.create;
try
sl.LoadFromStream(AStream);
self.Parse(PChar(sl.text));
finally
sl.free;
end;
end;
procedure TSpkXMLParser.SaveToStream(AStream : TStream; UseFormatting : boolean);
var sl : TStringList;
var
sl: TStringList;
begin
sl:=nil;
try
sl:=TStringList.create;
sl.text:=self.Generate(UseFormatting);
sl.savetostream(AStream);
finally
if sl<>nil then sl.free;
end;
sl:=TStringList.create;
try
sl.text:=self.Generate(UseFormatting);
sl.savetostream(AStream);
finally
sl.free;
end;
end;
end.

View File

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

View File

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

View File

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