You've already forked lina-components
mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-08-24 21:49:04 +02:00
Version 1.0 DEV 1.15
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
76
Source/Config.inc
Normal file
76
Source/Config.inc
Normal file
@@ -0,0 +1,76 @@
|
||||
//////////////////////////////////////
|
||||
/// Lina Configuration File ///
|
||||
/// **************************** ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$DEFINE LINA}
|
||||
{ Globale Einstellungen }
|
||||
{$DEFINE ADD_SPLASHENTRY}
|
||||
{$DEFINE ADD_ABOUTENTRY}
|
||||
{$DEFINE ADD_COMPONENTREG}
|
||||
{$DEFINE ADD_SINGLECATEGORY}
|
||||
{$DEFINE WARN_INCOMPATIBLEPLATFORM}
|
||||
{$DEFINE WARN_INCOMPATIBLECOMPILER}
|
||||
{$DEFINE WARN_INCOMPATIBLEVERSION}
|
||||
{ Globale Einschr�nkungen }
|
||||
{$IFDEF CONDITIONALEXPRESSIONS}
|
||||
{$IF (NOT Defined(DCC)) AND Defined(WARN_INCOMPATIBLECOMPILER)}
|
||||
{ Nur der Delphi-Compiler wird (offiziell) unterst�tzt. }
|
||||
{$MESSAGE ERROR 'Lina Components requires Delphi'}
|
||||
{$IFEND}
|
||||
{$IF (NOT Defined(MSWINDOWS)) AND Defined(WARN_INCOMPATIBLECOMPILER)}
|
||||
{ Nur Windows wird (offiziell) als Ziel-Platform unterst�tzt. }
|
||||
{$MESSAGE ERROR 'Lina Components requires Microsoft Windows'}
|
||||
{$IFEND}
|
||||
{$IF (CompilerVersion < 15.0) AND Defined(WARN_INCOMPATIBLEVERSION)}
|
||||
{ Fr�here Delphi-Versionen als Delphi 7 werden nicht (offiziell)
|
||||
unterst�tzt. }
|
||||
{$MESSAGE ERROR 'Lina Components requires Delphi 7 or higher'}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 17.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2005 gab es noch nicht die
|
||||
M�glichkeit, Records mit methoden zu versehen. Die Implementierung von
|
||||
Prozeduren und/oder Funktionen war Klassen vorenthalten. }
|
||||
{$DEFINE NO_RECORDMETHODS}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 18.5}
|
||||
{ Unter fr�heren Delphi-Versionen als 2007 gab es (offiziell) noch keine
|
||||
Unterst�tzung f�r Windows-Vista-spezifische funktionen wie die TaskDialog-
|
||||
Komponente oder einige Funktionen.
|
||||
Damit dies nicht zu Problemen f�hrt, geht der Compiler darauf mithilfe
|
||||
dieser Direktive ein. }
|
||||
{$DEFINE NO_VISTA}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 20.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2009 war die Nutzung generischer
|
||||
Datentypen (Generics) nicht m�glich. Da es ohne diese nahezu unm�glich
|
||||
scheint, typisierte Objekte, wie zum Beispiel typisierte TObjectList's
|
||||
zu deklarieren, fallen diese Deklarationen unter fr�heren Delphi-Versionen
|
||||
weg. Dies kann eventuell zu kompatibilit�tsproblemen zwischen
|
||||
unterschiedlichen Nutzern dieser Komponenten f�hren, l�sst sich aber nicht
|
||||
vermeiden. }
|
||||
{$DEFINE NO_GENERIC}
|
||||
{ Unter fr�heren Delphi-Versionen als 2009 entsprach der String-Typenalias
|
||||
dem AnsiString-Typen. Da es gegebenfalls bei manchen externen (zB. OS-
|
||||
Spezifischen) Klassen zu Kompatibilit�tsproblemen kommmen k�nnte, wird
|
||||
hier eine �berpr�fung der Unicode-Unterst�tzung durchgef�hrt.
|
||||
Zu beachten ist jedoch, dass Delphi 2009 und h�her AnsiStrings implizit
|
||||
in UnicodeStrings umwandelt und umgekehrt (sofern m�glich). }
|
||||
{$DEFINE NO_UNICODE}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 21.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2010 gab es ein Problem mit dem
|
||||
"crHandPoint" cursor, sodass dieser nicht korrekt unter Windows Vista oder
|
||||
h�her dargestellt wurde, sondern stattdessen im alten Windows-Look.
|
||||
Bei �lteren Delphi-Versionen als 2010 steht deswegen eine Pseudo-
|
||||
Komponente zur Behebung dieses Problems zur Verf�gung. }
|
||||
{$DEFINE NO_HANDPOINT}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 23.0}
|
||||
{ Unter fr�heren Delphi-Versionen als XE2 stand lediglich eine Ziel-Platform
|
||||
f�r kompilierte Anwendungen zur Verf�gung. Deshalb brauchte noch nicht auf
|
||||
Kompatibilit�t zu mehrfacher Platform-Unterst�tzung geachtet werden. }
|
||||
{$DEFINE NO_MULTIPLATFORM}
|
||||
{$IFEND}
|
||||
{$ENDIF}
|
@@ -3,21 +3,17 @@ unit uAdvCtrls;
|
||||
//////////////////////////////////////
|
||||
/// Lina Advanced Controls Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uAdvCtrls" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, StdCtrls, Windows, Messages, Graphics, Controls, Printers,
|
||||
Contnrs, Forms,
|
||||
SysUtils, Classes, StdCtrls, ExtCtrls, Windows, Messages, Graphics, Controls,
|
||||
Printers, Contnrs, Forms, Math,
|
||||
{ Andere Package-Units }
|
||||
uBase, uSysTools, uFileTools;
|
||||
|
||||
@@ -25,12 +21,19 @@ type
|
||||
{ Hilfsklassen }
|
||||
TMemoCaptionMode = (mcmAnyState,mcmUnfocusedOnly);
|
||||
TShortcutLabelState = (slsDefault,slsHovered,slsPressed);
|
||||
TSizePanelAllow = set of (spaResize,spaMove);
|
||||
TPanelBorderStyle = bsNone..bsSizeable;
|
||||
TValueEditAllow = set of (veaNumbers,veaLetters,veaSpaces,veaSeparators,veaOperators,veaOther);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TPaintMemoPaintEvent = procedure(Sender: TObject) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TCommandButton = class(TButton)
|
||||
protected
|
||||
procedure CreateWnd; override;
|
||||
@@ -67,6 +70,9 @@ type
|
||||
property ReplaceCaption: Boolean read FReplaceCaption write SetReplaceCaption default False;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TScrollListBox = class(TListBox)
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
@@ -100,6 +106,9 @@ type
|
||||
property WordWrap: Boolean read FWordWrap write SetWordWrap default False;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TPaintMemo = class(TMemo)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -120,6 +129,7 @@ type
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure Clear; override;
|
||||
property CaptionVisible: Boolean read FCaptionVisible default False;
|
||||
published
|
||||
{ Ereignisse}
|
||||
@@ -162,6 +172,9 @@ type
|
||||
property Visited: TColor read FVisited write SetVisited default clPurple;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TShortcutLabel = class(TLabel)
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
@@ -197,28 +210,72 @@ type
|
||||
property StoreVisited: Boolean read FStoreVisited write FStoreVisited default True;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TSizePanel = class(TPanel)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FAbout: TComponentAbout;
|
||||
FAllow: TSizePanelAllow;
|
||||
FBorderStyle: TPanelBorderStyle;
|
||||
{ Methoden }
|
||||
procedure SetBorderStyle(Value: TPanelBorderStyle);
|
||||
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
|
||||
procedure CreateParams(var Params: TCreateParams); override;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property About: TComponentAbout read FAbout;
|
||||
property Allow: TSizePanelAllow read FAllow write FAllow default [spaResize,spaMove];
|
||||
property BorderStyle: TPanelBorderStyle read FBorderStyle write SetBorderStyle default bsNone;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TValueEdit = class(TEdit)
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
procedure Change; override;
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FAbout: TComponentAbout;
|
||||
FMinValue: Extended;
|
||||
FMaxValue: Extended;
|
||||
FAllow: TValueEditAllow;
|
||||
FMaxSeparators: Byte;
|
||||
FSeparatorChar: Char;
|
||||
{ Methoden }
|
||||
procedure SetMinValue(Value: Extended);
|
||||
procedure SetMaxValue(Value: Extended);
|
||||
procedure SetAllow(Value: TValueEditAllow);
|
||||
procedure SetMaxSeparators(Value: Byte);
|
||||
procedure SetSeparatorChar(Value: Char);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property MinValue: Extended read FMinValue write SetMinValue;
|
||||
property MaxValue: Extended read FMaxValue write SetMaxValue;
|
||||
property Allow: TValueEditAllow read FAllow write SetAllow default [veaNumbers,veaSeparators];
|
||||
property MaxSeparators: Byte read FMaxSeparators write SetMaxSeparators default 1;
|
||||
property SeparatorChar: Char read FSeparatorChar write SetSeparatorChar default '.';
|
||||
end;
|
||||
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
function BmpToIco(Bitmap: TBitmap): TIcon;
|
||||
function TargetVisited(Target: String): Boolean;
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
CommandButtonComponent_Version = '1.0';
|
||||
CommandButtonComponent_Copyright = 'Copyright � 2015';
|
||||
CommandButtonComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
ScrollListBoxComponent_Version = '1.0';
|
||||
ScrollListBoxComponent_Copyright = 'Copyright � 2015';
|
||||
ScrollListBoxComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
PaintMemoComponent_Version = '1.0';
|
||||
PaintMemoComponent_Copyright = 'Copyright � 2015';
|
||||
PaintMemoComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
ShortcutLabelComponent_Version = '1.0';
|
||||
ShortcutLabelComponent_Copyright = 'Copyright � 2015';
|
||||
ShortcutLabelComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{ Messages }
|
||||
BS_COMMANDLINK = $0000000E;
|
||||
BM_SETIMAGE = $00F7;
|
||||
@@ -232,10 +289,12 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TCommandButton,TScrollListBox,TPaintMemo,TShortcutLabel]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TCommandButton,TScrollListBox,TPaintMemo,TShortcutLabel,TSizePanel,TValueEdit]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function BmpToIco(Bitmap: TBitmap): TIcon;
|
||||
begin
|
||||
@@ -268,7 +327,7 @@ end;
|
||||
constructor TCommandButton.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TCommandButton,CommandButtonComponent_Version,CommandButtonComponent_Copyright,CommandButtonComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TCommandButton);
|
||||
FCommandLink := False;
|
||||
FShield := False;
|
||||
FIcon := TIcon.Create;
|
||||
@@ -379,7 +438,7 @@ end;
|
||||
constructor TScrollListBox.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TScrollListBox,ScrollListBoxComponent_Version,ScrollListBoxComponent_Copyright,ScrollListBoxComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TScrollListBox);
|
||||
FHorizontalScrollBar := False;
|
||||
FWordWrap := False;
|
||||
end;
|
||||
@@ -510,7 +569,7 @@ end;
|
||||
constructor TPaintMemo.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TPaintMemo,PaintMemoComponent_Version,PaintMemoComponent_Copyright,PaintMemoComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TPaintMemo);
|
||||
FShowCaption := True;
|
||||
FCaptionFont := TFont.Create;
|
||||
FCaptionFont.Assign(Font);
|
||||
@@ -529,6 +588,17 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TPaintMemo.Clear;
|
||||
{ Hier wurde ein Bug behoben, bei dem das OnChange-Ereignis beim aufrufen der
|
||||
"Clear"-Methode nicht aufgerufen wurde. }
|
||||
begin
|
||||
inherited;
|
||||
if Assigned(OnChange) then
|
||||
begin
|
||||
OnChange(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPaintMemo.SetShowCaption(Value: Boolean);
|
||||
begin
|
||||
FShowCaption := Value;
|
||||
@@ -651,7 +721,7 @@ end;
|
||||
constructor TShortcutLabel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TShortcutLabel,ShortcutLabelComponent_Version,ShortcutLabelComponent_Copyright,ShortcutLabelComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TShortcutLabel);
|
||||
FState := slsDefault;
|
||||
FFont := TShortcutLabelFont.Create(Self);
|
||||
FHighlightVisited := True;
|
||||
@@ -741,6 +811,164 @@ begin
|
||||
Font.Update;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TSizePanel
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TSizePanel.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TSizePanel);
|
||||
FAllow := [spaResize,spaMove];
|
||||
FBorderStyle := bsNone;
|
||||
end;
|
||||
|
||||
destructor TSizePanel.Destroy;
|
||||
begin
|
||||
FAbout.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TSizePanel.SetBorderStyle(Value: TPanelBorderStyle);
|
||||
begin
|
||||
if Value <> FBorderStyle then
|
||||
begin
|
||||
if Value <> bsSizeable then
|
||||
begin
|
||||
(Self as TPanel).BorderStyle := Value;
|
||||
end;
|
||||
FBorderStyle := Value;
|
||||
RecreateWnd;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSizePanel.WMNCHitTest(var Message: TWMNCHitTest);
|
||||
var
|
||||
ScreenPos: TPoint;
|
||||
MoveArea: TRect;
|
||||
begin
|
||||
inherited;
|
||||
if not (csDesigning in ComponentState) then
|
||||
begin
|
||||
ScreenPos := ScreenToClient(Point(Message.XPos,Message.YPos));
|
||||
MoveArea := Rect(BevelWidth,BevelWidth,Width - BevelWidth,Height - BevelWidth);
|
||||
if (spaResize in Allow) and (BorderStyle <> bsSizeable) then
|
||||
begin
|
||||
if ScreenPos.X < BevelWidth then
|
||||
begin
|
||||
if ScreenPos.Y < BevelWidth then
|
||||
begin
|
||||
Message.Result := HTTOPLEFT;
|
||||
end else
|
||||
begin
|
||||
if ScreenPos.Y >= Height - BevelWidth then
|
||||
begin
|
||||
Message.Result := HTBOTTOMLEFT;
|
||||
end else
|
||||
begin
|
||||
Message.Result := HTLEFT;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if ScreenPos.X >= Width - BevelWidth then
|
||||
begin
|
||||
if ScreenPos.Y < BevelWidth then
|
||||
begin
|
||||
Message.Result := HTTOPRIGHT;
|
||||
end else
|
||||
begin
|
||||
if ScreenPos.Y >= Height - BevelWidth then
|
||||
begin
|
||||
Message.Result := HTBOTTOMRIGHT;
|
||||
end else
|
||||
begin
|
||||
Message.Result := HTRIGHT;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if ScreenPos.Y < BevelWidth then
|
||||
begin
|
||||
Message.Result := HTTOP;
|
||||
end else
|
||||
begin
|
||||
if ScreenPos.Y >= Height - BevelWidth then
|
||||
begin
|
||||
Message.Result := HTBOTTOM;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
if (Message.Result = HTCLIENT) and (PtInRect(MoveArea,ScreenPos) = True) and (spaMove in Allow) then
|
||||
begin
|
||||
Message.Result := HTCAPTION;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TSizePanel.CreateParams(var Params: TCreateParams);
|
||||
begin
|
||||
inherited;
|
||||
if NewStyleControls and Ctl3D and (BorderStyle = bsSizeable) then
|
||||
begin
|
||||
Params.Style := Params.Style or WS_SIZEBOX and not WS_BORDER;
|
||||
Params.ExStyle := Params.ExStyle and not WS_EX_CLIENTEDGE;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TValueEdit
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TValueEdit.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TValueEdit);
|
||||
FAllow := [veaNumbers,veaSeparators];
|
||||
end;
|
||||
|
||||
destructor TValueEdit.Destroy;
|
||||
begin
|
||||
FAbout.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TValueEdit.SetMinValue(Value: Extended);
|
||||
begin
|
||||
if True then
|
||||
|
||||
end;
|
||||
|
||||
procedure TValueEdit.SetMaxValue(Value: Extended);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TValueEdit.SetAllow(Value: TValueEditAllow);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TValueEdit.SetMaxSeparators(Value: Byte);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TValueEdit.SetSeparatorChar(Value: Char);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TValueEdit.Change;
|
||||
begin
|
||||
if False then
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
|
||||
finalization
|
||||
|
@@ -3,9 +3,11 @@ unit uBase;
|
||||
//////////////////////////////////////
|
||||
/// Lina Base Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
{ Dies ist die Basis-Unit f�r die Lina-Komponenten bzw. Methoden und Klassen.
|
||||
@@ -16,6 +18,17 @@ uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Dialogs, uSysTools;
|
||||
|
||||
const
|
||||
UnitName = 'uBase';
|
||||
LinaVersion = 1.00;
|
||||
About_Title = 'About...';
|
||||
{ Komponenten-Informationen }
|
||||
ComponentsPage = 'Lina';
|
||||
ComponentsVersion = '1.0';
|
||||
ComponentsCopyright = 'Copyright � 2016';
|
||||
ComponentsAuthor = 'Dennis G�hlert a.o.';
|
||||
ComponentsHomepage = '';
|
||||
|
||||
type
|
||||
TComponentAbout = class
|
||||
private
|
||||
@@ -30,6 +43,7 @@ type
|
||||
{ Protected-Deklarationen }
|
||||
property Component: TComponentClass read FComponent write FComponent;
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
property Name: TComponentName read FName;
|
||||
property Version: ShortString read FVersion;
|
||||
property Copyright: ShortString read FCopyright;
|
||||
@@ -37,21 +51,19 @@ type
|
||||
property Homepage: ShortString read FHomepage;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(Component: TComponentClass; Ver: ShortString = '1.0';
|
||||
Copy: ShortString = ''; Auth: ShortString = ''; Home: ShortString = '');
|
||||
constructor Create(Component: TComponentClass; Ver:
|
||||
ShortString = ComponentsVersion; Copy: ShortString = ComponentsCopyright;
|
||||
Auth: ShortString = ComponentsAuthor;
|
||||
Home: ShortString = ComponentsHomepage);
|
||||
{ �ber-Dialog }
|
||||
procedure AboutDlg;
|
||||
end;
|
||||
|
||||
const
|
||||
ComponentsPage = 'Lina';
|
||||
About_Title = 'About...';
|
||||
|
||||
implementation
|
||||
|
||||
constructor TComponentAbout.Create(Component: TComponentClass;
|
||||
Ver: ShortString = '1.0'; Copy: ShortString = ''; Auth: ShortString = '';
|
||||
Home: ShortString = '');
|
||||
Ver: ShortString = ComponentsVersion; Copy: ShortString = ComponentsCopyright;
|
||||
Auth: ShortString = ComponentsAuthor; Home: ShortString = ComponentsHomepage);
|
||||
begin
|
||||
FComponent := Component;
|
||||
FName := ExtractClassName(Component.ClassName);
|
||||
|
@@ -1,5 +1,13 @@
|
||||
unit uCalc;
|
||||
|
||||
//////////////////////////////////////
|
||||
/// Lina Calculator Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
@@ -73,6 +81,9 @@ type
|
||||
function IndexOf(Name: String): Integer;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TCalculator = class(TComponent)
|
||||
private
|
||||
{ Ereignisse}
|
||||
@@ -128,13 +139,11 @@ type
|
||||
property Options: TCalculatorOptions read FOptions write FOptions;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
CalculatorComponent_Version = '1.0';
|
||||
CalculatorComponent_Copyright = 'Copyright � 2015';
|
||||
CalculatorComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{ Sonderzeichen f�r Ausdr�cke }
|
||||
CalcSeperators = ['.',','];
|
||||
CalcBrackets = ['(',')'];
|
||||
@@ -143,10 +152,12 @@ const
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TCalculator]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TCalculator]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TCalculatorConstant
|
||||
@@ -218,7 +229,7 @@ end;
|
||||
constructor TCalculator.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TCalculator,CalculatorComponent_Version,CalculatorComponent_Copyright,CalculatorComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TCalculator);
|
||||
FExpression := '';
|
||||
FValue := 0;
|
||||
FConstants := TCalculatorConstants.Create(TCalculatorConstant,Self);
|
||||
|
@@ -1,374 +0,0 @@
|
||||
unit uCrypt;
|
||||
|
||||
//////////////////////////////////////
|
||||
/// Lina Cryption Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uCrypt" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes,
|
||||
{ Andere Package-Units }
|
||||
uSysTools;
|
||||
|
||||
type
|
||||
{ Fehlermeldungen }
|
||||
EInvalidKey = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
TCryptMode = (cmEncrypt,cmDecrypt);
|
||||
|
||||
type
|
||||
{ Ereignisse }
|
||||
TCryptWorkEvent = procedure(Sender: TObject; const Mode: TCryptMode) of object;
|
||||
TCryptKeyChangeEvent = procedure(Sender: TObject) of object;
|
||||
TCryptKeyChangeQueryEvent = procedure(Sender: TObject; var CanChange: Boolean) of object;
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
TCrypt = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FKeyString: String;
|
||||
FKeyChar: Char;
|
||||
FKeyInteger: Integer;
|
||||
FLines: TStrings;
|
||||
FWorkEvent: TCryptWorkEvent;
|
||||
FKeyChangeEvent: TCryptKeyChangeEvent;
|
||||
FKeyChangeQueryEvent: TCryptKeyChangeQueryEvent;
|
||||
{ Methoden }
|
||||
procedure SetKeyString(Value: String);
|
||||
procedure SetKeyChar(Value: Char);
|
||||
procedure SetKeyInteger(Value: Integer);
|
||||
{ Eigenschaften }
|
||||
property KeyString: String read FKeyString write SetKeyString;
|
||||
property KeyChar: Char read FKeyChar write SetKeyChar;
|
||||
property KeyInteger: Integer read FKeyInteger write SetKeyInteger;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property Lines: TStrings read FLines write FLines;
|
||||
procedure Decrypt; virtual;
|
||||
procedure Encrypt; virtual;
|
||||
{ Ereignisse }
|
||||
property OnWork: TCryptWorkEvent read FWorkEvent write FWorkEvent;
|
||||
property OnKeyChange: TCryptKeyChangeEvent read FKeyChangeEvent write FKeyChangeEvent;
|
||||
property OnKeyChangeQuery: TCryptKeyChangeQueryEvent read FKeyChangeQueryEvent write FKeyChangeQueryEvent;
|
||||
end;
|
||||
|
||||
{ Spezifische Kryptologie-Verfahren }
|
||||
|
||||
TXorCrypt = class(TCrypt)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
procedure SetKeyInteger(Value: Integer);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
procedure Decrypt;
|
||||
procedure Encrypt;
|
||||
{ Eigenschaften }
|
||||
property KeyInteger;
|
||||
end;
|
||||
|
||||
TVigenereCrypt = class(TCrypt)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
procedure SetKeyString(Value: String);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
procedure Decrypt;
|
||||
procedure Encrypt;
|
||||
{ Eigenschaften }
|
||||
property KeyChar;
|
||||
end;
|
||||
|
||||
TCaesarCrypt = class(TCrypt)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
procedure SetKeyChar(Value: Char);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
procedure Decrypt;
|
||||
procedure Encrypt;
|
||||
{ Eigenschaften }
|
||||
property KeyString;
|
||||
end;
|
||||
|
||||
//TDynaCrypt = class(TCrypt)
|
||||
//public
|
||||
{ Public-Deklarationen }
|
||||
//procedure Decrypt;
|
||||
//procedure Encrypt;
|
||||
{ Eigenschaften }
|
||||
//property KeyChar;
|
||||
//end;
|
||||
|
||||
implementation
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TCrypt
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TCrypt.Create;
|
||||
begin
|
||||
FLines := TStringList.Create;
|
||||
end;
|
||||
|
||||
destructor TCrypt.Destroy;
|
||||
begin
|
||||
FLines.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCrypt.SetKeyString(Value: String);
|
||||
var
|
||||
CanChange: Boolean;
|
||||
begin
|
||||
CanChange := True;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChangeQuery(Self,CanChange);
|
||||
end;
|
||||
if CanChange = True then
|
||||
begin
|
||||
FKeyString := Value;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChange(Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCrypt.SetKeyChar(Value: Char);
|
||||
var
|
||||
CanChange: Boolean;
|
||||
begin
|
||||
CanChange := True;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChangeQuery(Self,CanChange);
|
||||
end;
|
||||
if CanChange = True then
|
||||
begin
|
||||
FKeyChar := Value;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChange(Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCrypt.SetKeyInteger(Value: Integer);
|
||||
var
|
||||
CanChange: Boolean;
|
||||
begin
|
||||
CanChange := True;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChangeQuery(Self,CanChange);
|
||||
end;
|
||||
if CanChange = True then
|
||||
begin
|
||||
FKeyInteger := Value;
|
||||
if Assigned(OnKeyChange) then
|
||||
begin
|
||||
OnKeyChange(Self);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCrypt.Decrypt;
|
||||
begin
|
||||
//...
|
||||
if Assigned(OnWork) = True then
|
||||
begin
|
||||
OnWork(Self,cmDecrypt);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCrypt.Encrypt;
|
||||
begin
|
||||
//...
|
||||
if Assigned(OnWork) = True then
|
||||
begin
|
||||
OnWork(Self,cmEncrypt);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TXorCrypt
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
procedure TXorCrypt.SetKeyInteger(Value: Integer);
|
||||
begin
|
||||
if not (KeyInteger in [0..31]) then
|
||||
begin
|
||||
raise EInvalidKey.Create('Invalid key value');
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TXorCrypt.Decrypt;
|
||||
begin
|
||||
{ Bei Xor entspricht der Entschl�sselungs-Algorithmus dem der
|
||||
Verschl�sselung. Deshalb gen�gt hier ein Verweis auf "TXorCrypt.Encrypt". }
|
||||
Encrypt;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TXorCrypt.Encrypt;
|
||||
var
|
||||
Encrypted: TStrings;
|
||||
LineIndex: Integer;
|
||||
CharIndex: Integer;
|
||||
Line: String;
|
||||
begin
|
||||
Encrypted := TStringList.Create;
|
||||
try
|
||||
Encrypted.Assign(Lines);
|
||||
for LineIndex := 0 to Encrypted.Count do
|
||||
begin
|
||||
Line := Encrypted.Strings[LineIndex];
|
||||
for CharIndex := 1 to Length(Line) do
|
||||
begin
|
||||
if Line[CharIndex] > #31 then
|
||||
begin
|
||||
Line[CharIndex] := Chr(Ord(Line[CharIndex]) xor KeyInteger);
|
||||
end;
|
||||
end;
|
||||
Encrypted.Strings[LineIndex] := Line;
|
||||
end;
|
||||
Lines.Assign(Encrypted);
|
||||
finally
|
||||
Encrypted.Free;
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TVigenereCrypt
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
procedure TVigenereCrypt.SetKeyString(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Value := UpperCase(Value);
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if not (Value[Index] in ['A'..'Z']) then
|
||||
begin
|
||||
raise EInvalidKey.Create('Invalid key value');
|
||||
end;
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TVigenereCrypt.Decrypt;
|
||||
var
|
||||
Encrypted: TStrings;
|
||||
LineIndex: Integer;
|
||||
CharIndex: Integer;
|
||||
Line: String;
|
||||
KeyIndex: Integer;
|
||||
CurKeyLetter: Integer;
|
||||
CurLetter: Integer;
|
||||
begin
|
||||
Encrypted := TStringList.Create;
|
||||
try
|
||||
Encrypted.Assign(Lines);
|
||||
for LineIndex := 0 to Encrypted.Count do
|
||||
begin
|
||||
Line := Encrypted.Strings[LineIndex];
|
||||
for CharIndex := 1 to Length(Line) do
|
||||
begin
|
||||
if Line[CharIndex] in ['A'..'Z'] then
|
||||
begin
|
||||
CurKeyLetter := Ord(KeyString[1 + (KeyIndex mod Length(KeyString))]) - Ord('A');
|
||||
CurLetter := Ord(Line[CharIndex]) - Ord('A');
|
||||
Line[CharIndex] := Chr(Ord('A') + ((26 + CurLetter - CurKeyLetter) mod 26));
|
||||
Inc(KeyIndex);
|
||||
end
|
||||
end;
|
||||
Encrypted.Strings[LineIndex] := Line;
|
||||
end;
|
||||
Lines.Assign(Encrypted);
|
||||
finally
|
||||
Encrypted.Free;
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TVigenereCrypt.Encrypt;
|
||||
var
|
||||
Encrypted: TStrings;
|
||||
LineIndex: Integer;
|
||||
CharIndex: Integer;
|
||||
Line: String;
|
||||
KeyIndex: Integer;
|
||||
CurKeyLetter: Integer;
|
||||
CurLetter: Integer;
|
||||
begin
|
||||
Encrypted := TStringList.Create;
|
||||
try
|
||||
Encrypted.Assign(Lines);
|
||||
for LineIndex := 0 to Encrypted.Count do
|
||||
begin
|
||||
Line := Encrypted.Strings[LineIndex];
|
||||
for CharIndex := 1 to Length(Line) do
|
||||
begin
|
||||
if Line[CharIndex] in ['A'..'Z'] then
|
||||
begin
|
||||
CurKeyLetter := Ord(KeyString[1 + (KeyIndex mod Length(KeyString))]) - Ord('A');
|
||||
CurLetter := Ord(Line[CharIndex]) - Ord('A');
|
||||
Line[CharIndex] := Chr(Ord('A') + ((CurLetter + CurKeyLetter) mod 26));
|
||||
Inc(KeyIndex);
|
||||
end
|
||||
end;
|
||||
Encrypted.Strings[LineIndex] := Line;
|
||||
end;
|
||||
Lines.Assign(Encrypted);
|
||||
finally
|
||||
Encrypted.Free;
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TCaesarCrypt
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
procedure TCaesarCrypt.SetKeyChar(Value: Char);
|
||||
begin
|
||||
Value := CharUpperCase(Value);
|
||||
if not (Value in ['A'..'Z']) then
|
||||
begin
|
||||
raise EInvalidKey.Create('Invalid key value');
|
||||
end;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCaesarCrypt.Decrypt;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TCaesarCrypt.Encrypt;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
end.
|
@@ -3,14 +3,10 @@ unit uFileCtrls;
|
||||
//////////////////////////////////////
|
||||
/// Lina File Controls Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uFileCtrls" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -18,7 +14,7 @@ uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Windows, Registry,
|
||||
{ Andere Package-Units }
|
||||
uBase;
|
||||
uBase, uSysTools;
|
||||
|
||||
type
|
||||
{ Fehlermeldungen }
|
||||
@@ -57,6 +53,9 @@ type
|
||||
|
||||
TContextMenuItems = class(TCollection);
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TContextMenu = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -98,25 +97,25 @@ type
|
||||
property OnCreateEntry: TContextMenuCreateEntryEvent read FCreateEntryEvent write FCreateEntryEvent;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtStrToRegKey(ExtStr: String): String;
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
ContextMenuComponent_Version = '1.0';
|
||||
ContextMenuComponent_Copyright = 'Copyright � 2015';
|
||||
ContextMenuComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{ Sonstige }
|
||||
ContextRegPathShell = '\shell';
|
||||
ContextRegPathCommand = '\command';
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TContextMenu]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TContextMenu]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtStrToRegKey(ExtStr: String): String;
|
||||
begin
|
||||
@@ -181,7 +180,7 @@ end;
|
||||
constructor TContextMenu.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TContextMenu,ContextMenuComponent_Version,ContextMenuComponent_Copyright,ContextMenuComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TContextMenu);
|
||||
FItems := TContextMenuItems.Create(TContextMenuItem);
|
||||
FExt := '*';
|
||||
FAutoLoad := False;
|
||||
@@ -208,7 +207,7 @@ begin
|
||||
begin
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if not (Value[Index] in ['0'..'9','A'..'Z','a'..'z']) then
|
||||
if not (Value[Index] in Numbers + Letters) then
|
||||
begin
|
||||
raise EInvalidExt.Create('Invalid file extension value');
|
||||
end;
|
||||
@@ -246,7 +245,7 @@ begin
|
||||
begin
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if not (Value[Index] in ['0'..'9','A'..'Z','a'..'z']) then
|
||||
if not (Value[Index] in Numbers + Letters) then
|
||||
begin
|
||||
raise EInvalidAlias.Create('Invalid extension alias value');
|
||||
end;
|
||||
|
@@ -3,14 +3,10 @@ unit uFileTools;
|
||||
//////////////////////////////////////
|
||||
/// Lina File Tools Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uFileTools" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -166,14 +162,15 @@ const
|
||||
B_TO_TB = -4;
|
||||
{ Dateierweiterungen f�r ListFiles() }
|
||||
FXT_ANY = '*.*';
|
||||
FXT_EXE = '*.exe';
|
||||
FXT_TXT = '*.txt';
|
||||
{ Vielleicht sp�ter mal implementieren...
|
||||
FXT_IMG = ('*.jpg','*.jpeg','*.png','*.tif','*.tiff','*.bmp','*.gif');
|
||||
FXT_PAS = ('*.pas','*.dpr','*.dpk','*.dfm');
|
||||
FXT_MSO = ('*.doc','*.xls','*.ppt');
|
||||
FXT_MSI = ('*.msi');
|
||||
FXT_IMG = ('*.img','*.iso'); }
|
||||
FXT_EXEC: array [0..2] of String = ('*.exe','*.com','*.scr');
|
||||
FXT_TEXT: array [0..1] of String = ('*.txt','*.rtf');
|
||||
FXT_IMAGE: array [0..6] of String = ('*.jpg','*.jpeg','*.png','*.tif','*.tiff','*.bmp','*.gif');
|
||||
FXT_SOURCE: array [0..3] of String = ('*.pas','*.dpr','*.dpk','*.dfm');
|
||||
FXT_OFFICE: array [0..2] of String = ('*.doc','*.xls','*.ppt');
|
||||
FXT_OFFICEX: array [0..2] of String = ('*.docx','*.xlsx','*.pptx');
|
||||
FXT_INSTALL: array [0..1] of String = ('*.msi','*.msu');
|
||||
FXT_DISK: array [0..2] of String = ('*.img','*.iso','*.bin');
|
||||
FXT_ARCHIVE: array [0..4] of String = ('*.zip','*.rar','*.7z','*.tar','*.gz');
|
||||
|
||||
var
|
||||
InvalidFileNames: TInvalidFileNames;
|
||||
|
@@ -3,14 +3,10 @@ unit uFrmCtrls;
|
||||
//////////////////////////////////////
|
||||
/// Lina Form Controls Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uFrmCtrls" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -223,6 +219,9 @@ type
|
||||
property Interval: Cardinal read GetInterval write SetInterval default 1000;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TSplashScreen = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -292,7 +291,6 @@ type
|
||||
end;
|
||||
|
||||
{ T...Manager }
|
||||
|
||||
TComponentManager = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -312,6 +310,9 @@ type
|
||||
property About: TComponentAbout read FAbout;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TProgressBarManager = class(TComponentManager)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -337,6 +338,9 @@ type
|
||||
property Mode: TProgressBarManagerMode read FMode write SetMode default pmmNone;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TListBoxManager = class(TComponentManager)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -418,6 +422,9 @@ type
|
||||
|
||||
TParamReferences = class(TCollection);
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TParamDefiner = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -452,32 +459,18 @@ type
|
||||
procedure SetTaskBarVisibe(const Value: Boolean);
|
||||
procedure ListParams(var OutList: TStrings);
|
||||
|
||||
procedure Register;
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
SplashScreenComponent_Version = '1.0';
|
||||
SplashScreenComponent_Copyright = 'Copyright � 2015';
|
||||
SplashScreenComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
ProgressBarManagerComponent_Version = '1.0';
|
||||
ProgressBarManagerComponent_Copyright = 'Copyright � 2015';
|
||||
ProgressBarManagerComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
ListBoxManagerComponent_Version = '1.0';
|
||||
ListBoxManagerComponent_Copyright = 'Copyright � 2015';
|
||||
ListBoxManagerComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
ParamDefinerComponent_Version = '1.0';
|
||||
ParamDefinerComponent_Copyright = 'Copyright � 2015';
|
||||
ParamDefinerComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TSplashScreen,TProgressBarManager,TListBoxManager,TParamDefiner]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TSplashScreen,TProgressBarManager,TListBoxManager,TParamDefiner]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure ShowMessageVal(const Msg: Integer);
|
||||
begin
|
||||
@@ -1043,7 +1036,7 @@ begin
|
||||
FAnimationSpeed := 10;
|
||||
FVisible := False;
|
||||
|
||||
FAbout := TComponentAbout.Create(TSplashScreen,SplashScreenComponent_Version,SplashScreenComponent_Copyright,SplashScreenComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TSplashScreen);
|
||||
FSplashForm := TSplashForm.Create;
|
||||
FSplashForm.FormObject.OnShow := FormObjectShow;
|
||||
FSplashForm.FormObject.OnHide := FormObjectHide;
|
||||
@@ -1396,7 +1389,7 @@ end;
|
||||
constructor TProgressBarManager.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TProgressBarManager,ProgressBarManagerComponent_Version,ProgressBarManagerComponent_Copyright,ProgressBarManagerComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TProgressBarManager);
|
||||
FMode := pmmNone;
|
||||
|
||||
Update;
|
||||
@@ -1470,7 +1463,7 @@ end;
|
||||
constructor TListBoxManager.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TListBoxManager,ListBoxManagerComponent_Version,ListBoxManagerComponent_Copyright,ListBoxManagerComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TListBoxManager);
|
||||
FMode := lmmNone;
|
||||
FFilterOptions := [sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible];
|
||||
FilteredList := TFilteredStringList.Create;
|
||||
@@ -1805,7 +1798,7 @@ end;
|
||||
constructor TParamDefiner.Create;
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TParamDefiner,ParamDefinerComponent_Version,ParamDefinerComponent_Copyright,ParamDefinerComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TParamDefiner);
|
||||
FReferences := TParamReferences.Create(TParamReference);
|
||||
end;
|
||||
|
||||
|
@@ -3,13 +3,15 @@ unit uInit;
|
||||
//////////////////////////////////////
|
||||
/// Lina Initialization Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
{ Dies ist die Initialisierungs-Unit f�r das Lina Components Package.
|
||||
Diese Unit darf NIEMALS direkt in eine Laufzeit-Library eingebunden
|
||||
Diese Unit darf NIEMALS direkt in eine Laufzeit-Bibliothek eingebunden
|
||||
werden! }
|
||||
|
||||
uses
|
||||
@@ -39,7 +41,7 @@ begin
|
||||
SplashBitmap := TBitmap.Create;
|
||||
try
|
||||
SplashBitmap.LoadFromResourceName(HInstance,'LINA');
|
||||
(ToolsAPI.SplashScreenServices as IOTASplashScreenServices).AddPluginBitmap(
|
||||
(SplashScreenServices as IOTASplashScreenServices).AddPluginBitmap(
|
||||
Package_Name,SplashBitmap.Handle,False,Package_License,Package_SKU);
|
||||
finally
|
||||
SplashBitmap.Free;
|
||||
@@ -51,7 +53,7 @@ begin
|
||||
AboutBitmap := TBitmap.Create;
|
||||
try
|
||||
AboutBitmap.LoadFromResourceName(HInstance,'LINA');
|
||||
PluginIndex := (ToolsAPI.BorlandIDEServices as IOTAAboutBoxServices120).AddPluginInfo(
|
||||
PluginIndex := (BorlandIDEServices as IOTAAboutBoxServices120).AddPluginInfo(
|
||||
Package_Name,Package_Description,AboutBitmap.Handle,False,Package_License,Package_SKU);
|
||||
except
|
||||
AboutBitmap.Free;
|
||||
@@ -68,59 +70,6 @@ begin
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$IF Defined(CompilerVersion) = True}
|
||||
{$IF CompilerVersion < 15.0}
|
||||
{ Fr�here Delphi-Versionen als Delphi 7 werden nicht (offiziell)
|
||||
unterst�tzt. }
|
||||
{$MESSAGE ERROR 'Lina Components requires Delphi 7 or higher'}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 17.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2005 gab es noch nicht dieM�glichkeit,
|
||||
Records mit methoden zu versehen. Die Implementierung von Prozeduren und/
|
||||
oder Funktionen war Klassen vorenthalten. }
|
||||
{$DEFINE NO_RECORDMETHODS}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 18.5}
|
||||
{ Unter fr�heren Delphi-Versionen als 2007 gab es (offiziell) noch keine
|
||||
Unterst�tzung f�r Windows-Vista-spezifische funktionen wie die TaskDialog-
|
||||
Komponente oder einige Funktionen.
|
||||
Damit dies nicht zu Problemen f�hrt, geht der Compiler darauf mithilfe
|
||||
dieser Direktive ein. }
|
||||
{$DEFINE NO_VISTA}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 21.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2010 gab es ein Problem mit dem
|
||||
"crHandPoint" cursor, sodass dieser nicht korrekt unter Windows Vista oder
|
||||
h�her dargestellt wurde, sondern stattdessen im alten Windows-Look.
|
||||
Bei �lteren Delphi-Versionen als 2010 steht deswegen eine Pseudo-
|
||||
Komponente zur Behebung dieses Problems zur Verf�gung. }
|
||||
{$DEFINE NO_HANDPOINT}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 20.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2009 war die Nutzung generischer
|
||||
Datentypen (Generics) nicht m�glich. Da es ohne diese nahezu unm�glich
|
||||
scheint, typisierte Objekte, wie zum Beispiel typisierte TObjectList's
|
||||
zu deklarieren, fallen diese Deklarationen unter fr�heren Delphi-Versionen
|
||||
weg. Dies kann eventuell zu kompatibilit�tsproblemen zwischen
|
||||
unterschiedlichen Nutzern dieser Komponenten f�hren, l�sst sich aber nicht
|
||||
vermeiden. }
|
||||
{$DEFINE NO_GENERIC}
|
||||
{$IFEND}
|
||||
{$IF CompilerVersion < 20.0}
|
||||
{ Unter fr�heren Delphi-Versionen als 2009 entsprach der String-Typenalias
|
||||
dem AnsiString-Typen. Da es gegebenfalls bei manchen externen (zB. OS-
|
||||
Spezifischen) Klassen zu Kompatibilit�tsproblemen kommmen k�nnte, wird
|
||||
hier eine �berpr�fung der Unicode-Unterst�tzung durchgef�hrt.
|
||||
Zu beachten ist jedoch, dass Delphi 2009 und h�her AnsiStrings implizit
|
||||
in UnicodeStrings umwandelt und umgekehrt (sofern m�glich). }
|
||||
{$DEFINE NO_UNICODE}
|
||||
{$IFEND}
|
||||
{$IFEND}
|
||||
{ Globale Einstellungen }
|
||||
{$DEFINE ADD_SPLASHENTRY}
|
||||
{$DEFINE ADD_ABOUTENTRY}
|
||||
{$DEFINE WARN_INCOMPATIBLEOS}
|
||||
|
||||
{ Package-Registrierung }
|
||||
{$IFDEF ADD_SPLASHENTRY}
|
||||
RegisterPackageOnSplash;
|
||||
@@ -129,6 +78,7 @@ initialization
|
||||
RegisterPackageOnAbout;
|
||||
{$ENDIF}
|
||||
|
||||
|
||||
finalization
|
||||
{ Package-Deregistrierung }
|
||||
{$IFDEF ADD_ABOUTENTRY}
|
||||
|
@@ -3,22 +3,18 @@ unit uLocalMgr;
|
||||
//////////////////////////////////////
|
||||
/// Lina Localize Manager Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uLocalMgr" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Controls, Forms, TypInfo,
|
||||
SysUtils, Classes, Controls, Forms, TypInfo, IniFiles,
|
||||
{ Andere Package-Units }
|
||||
uBase, uSysTools;
|
||||
uBase, uSysTools, uFileTools;
|
||||
|
||||
type
|
||||
{ Fehlermeldungen }
|
||||
@@ -52,6 +48,7 @@ type
|
||||
FIndent: String;
|
||||
FAddress: String;
|
||||
FCharacter: String;
|
||||
FSpecial: String;
|
||||
{ Methoden }
|
||||
procedure SetComment(Value: String);
|
||||
procedure SetSeparator(Value: String);
|
||||
@@ -59,6 +56,7 @@ type
|
||||
procedure SetIndent(Value: String);
|
||||
procedure SetAddress(Value: String);
|
||||
procedure SetCharacter(Value: String);
|
||||
procedure SetSpecial(Value: String);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
@@ -72,6 +70,30 @@ type
|
||||
property Indent: String read FIndent write SetIndent;
|
||||
property Address: String read FAddress write SetAddress;
|
||||
property Character: String read FCharacter write SetCharacter;
|
||||
property Special: String read FSpecial write SetSpecial;
|
||||
end;
|
||||
|
||||
TLocalizationData = class;
|
||||
|
||||
TLocalization = class;
|
||||
|
||||
TLocalizationImporter = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FLocalization: TLocalization;
|
||||
FClearBeforeImport: Boolean;
|
||||
{ Methoden }
|
||||
procedure PrepareImport;
|
||||
{ Eigenschaften }
|
||||
property Localization: TLocalization read FLocalization;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(ALocalization: TLocalization);
|
||||
destructor Destroy; override;
|
||||
procedure ImportFromData(Data: TLocalizationData);
|
||||
procedure ImportFromINI(INI: TIniFile);
|
||||
{ Eigenschaften }
|
||||
property ClearBeforeImport: Boolean read FClearBeforeImport write FClearBeforeImport default True;
|
||||
end;
|
||||
|
||||
TLocalization = class(TCollectionItem)
|
||||
@@ -82,10 +104,12 @@ type
|
||||
FTag: TLanguageTag;
|
||||
FFormat: TLocalizationFormat;
|
||||
FEncoding: TCharEncoding;
|
||||
FConverter: TLocalizationImporter;
|
||||
{ Methoden }
|
||||
function GetDisplayName: String; override;
|
||||
function GetLines: TStrings;
|
||||
procedure SetLines(Value: TStrings);
|
||||
procedure SetName(Value: ShortString);
|
||||
procedure SetTag(Value: TLanguageTag);
|
||||
function GetFormat: TLocalizationFormat;
|
||||
procedure SetFormat(Value: TLocalizationFormat);
|
||||
@@ -107,11 +131,12 @@ type
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
{ Eigenschaften }
|
||||
property Name: ShortString read FName write FName;
|
||||
property Name: ShortString read FName write SetName;
|
||||
property Tag: TLanguageTag read FTag write SetTag;
|
||||
property Lines: TStrings read GetLines write SetLines;
|
||||
property Format: TLocalizationFormat read GetFormat write SetFormat;
|
||||
property Encoding: TCharEncoding read FEncoding write SetEncoding default {$IFDEF NO_UNICODE} ceUTF8 {$ELSE} ceUnicode {$ENDIF};
|
||||
property Converter: TLocalizationImporter read FConverter write FConverter;
|
||||
end;
|
||||
|
||||
TLocalizationManager = class;
|
||||
@@ -125,6 +150,27 @@ type
|
||||
constructor Create(ItemClass: TCollectionItemClass; AManager: TLocalizationManager);
|
||||
destructor Destroy; override;
|
||||
function IndexOfTag(const Tag: TLanguageTag): Integer;
|
||||
procedure LoadFromFile(const FileName: String);
|
||||
procedure SaveToFile(const FileName: String);
|
||||
procedure LoadFromDirectory(const Dir: String; FileExts: array of String; RecMode: Boolean = True);
|
||||
end;
|
||||
|
||||
TLocalizationExporter = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FData: TLocalizationData;
|
||||
FClearBeforeExport: Boolean;
|
||||
{ Eigenschaften }
|
||||
property Data: TLocalizationData read FData;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create(AData: TLocalizationData);
|
||||
destructor Destroy; override;
|
||||
procedure ExportToINI(var INI: TIniFile);
|
||||
published
|
||||
{ Published-Deklarationen }
|
||||
{ Eigenschaften }
|
||||
property ClearBeforeExport: Boolean read FClearBeforeExport write FClearBeforeExport default True;
|
||||
end;
|
||||
|
||||
TLocalizationData = class
|
||||
@@ -134,6 +180,7 @@ type
|
||||
Indents: array of TStringReferenceDataArray;
|
||||
Values: TStringArray;
|
||||
FManager: TLocalizationManager;
|
||||
FExporter: TLocalizationExporter;
|
||||
protected
|
||||
{ Protected-Deklarationen }
|
||||
procedure AddSection(Section: String);
|
||||
@@ -156,6 +203,7 @@ type
|
||||
procedure WriteInteger(const Section,Indent: String; Value: Integer);
|
||||
procedure WriteFloat(const Section,Indent: String; Value: Extended);
|
||||
procedure Address(const Section,Indent,Target: String);
|
||||
property Exporter: TLocalizationExporter read FExporter write FExporter;
|
||||
end;
|
||||
|
||||
TLocalizationReferences = class(TCollection)
|
||||
@@ -178,6 +226,7 @@ type
|
||||
FReference: PString;
|
||||
FField: String;
|
||||
{ Methoden }
|
||||
function GetDisplayName: String; override;
|
||||
procedure SetIndent(Value: String);
|
||||
procedure Apply;
|
||||
public
|
||||
@@ -217,6 +266,9 @@ type
|
||||
property ApplyMode: TLocalizationApplyMode read FApplyMode write SetApplyMode default laCustom;
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TLocalizationManager = class(TComponent)
|
||||
private
|
||||
{ Ereignisse}
|
||||
@@ -257,20 +309,18 @@ type
|
||||
property Applier: TLocalizationApplier read FApplier write FApplier;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
LocalizationManagerComponent_Version = '1.0';
|
||||
LocalizationManagerComponent_Copyright = 'Copyright � 2015';
|
||||
LocalizationManagerComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TLocalizationManager]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TLocalizationManager]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalizationFormat
|
||||
@@ -285,6 +335,7 @@ begin
|
||||
FHeader := '*';
|
||||
FAddress := '@';
|
||||
FCharacter := '$#';
|
||||
FSpecial := '!';
|
||||
end;
|
||||
|
||||
destructor TLocalizationFormat.Destroy;
|
||||
@@ -297,7 +348,7 @@ procedure TLocalizationFormat.SetComment(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if (ArrayPos(Value,[FSeparator,FHeader,FIndent,FAddress,FCharacter]) <> -1) or (Length(Value) = 0) then
|
||||
if (ArrayPos(Value,[FSeparator,FHeader,FIndent,FAddress,FCharacter,FSpecial]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Comment"');
|
||||
end;
|
||||
@@ -315,7 +366,7 @@ procedure TLocalizationFormat.SetSeparator(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if (ArrayPos(Value,[FComment,FHeader,FIndent,FAddress,FCharacter]) <> -1) or (Length(Value) = 0) then
|
||||
if (ArrayPos(Value,[FComment,FHeader,FIndent,FAddress,FCharacter,FSpecial]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Separator"');
|
||||
end;
|
||||
@@ -333,7 +384,7 @@ procedure TLocalizationFormat.SetHeader(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FIndent,FAddress,FCharacter]) <> -1 then
|
||||
if ArrayPos(Value,[FComment,FSeparator,FIndent,FAddress,FCharacter,FSpecial]) <> -1 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Header"');
|
||||
end;
|
||||
@@ -351,7 +402,7 @@ procedure TLocalizationFormat.SetIndent(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FHeader,FAddress,FCharacter]) <> -1 then
|
||||
if ArrayPos(Value,[FComment,FSeparator,FHeader,FAddress,FCharacter,FSpecial]) <> -1 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Indent"');
|
||||
end;
|
||||
@@ -369,7 +420,7 @@ procedure TLocalizationFormat.SetAddress(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if (ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent,FCharacter]) <> -1) or (Length(Value) = 0) then
|
||||
if (ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent,FCharacter,FSpecial]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Address"');
|
||||
end;
|
||||
@@ -387,7 +438,7 @@ procedure TLocalizationFormat.SetCharacter(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if (ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent,FAddress]) <> -1) or (Length(Value) = 0) then
|
||||
if (ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent,FAddress,FSpecial]) <> -1) or (Length(Value) = 0) then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Character"');
|
||||
end;
|
||||
@@ -401,6 +452,109 @@ begin
|
||||
FCharacter := Value;
|
||||
end;
|
||||
|
||||
procedure TLocalizationFormat.SetSpecial(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
if ArrayPos(Value,[FComment,FSeparator,FHeader,FIndent,FAddress,FCharacter]) <> -1 then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Special"');
|
||||
end;
|
||||
for Index := 1 to Length(Value) do
|
||||
begin
|
||||
if Value[Index] in Spaces then
|
||||
begin
|
||||
raise EInvalidFormat.Create('Invalid localization format for property: "Special"');
|
||||
end;
|
||||
end;
|
||||
FSpecial := Value;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalizationImporter
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TLocalizationImporter.Create(ALocalization: TLocalization);
|
||||
begin
|
||||
inherited Create;
|
||||
FLocalization := ALocalization;
|
||||
FClearBeforeImport := True;
|
||||
end;
|
||||
|
||||
destructor TLocalizationImporter.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TLocalizationImporter.PrepareImport;
|
||||
begin
|
||||
if ClearBeforeImport = True then
|
||||
begin
|
||||
Localization.Lines.Clear;
|
||||
end;
|
||||
Localization.Lines.Add(Localization.Format.Comment + ' ' + '+++ AUTO-GENERATED LOCALIZATION CONTENT +++');
|
||||
end;
|
||||
|
||||
procedure TLocalizationImporter.ImportFromData(Data: TLocalizationData);
|
||||
var
|
||||
Section: Integer;
|
||||
Indent: Integer;
|
||||
begin
|
||||
if Data = nil then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
PrepareImport;
|
||||
for Section := 0 to Length(Data.Sections) - 1 do
|
||||
begin
|
||||
if Data.Sections[Section].Value <> '' then
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Header + ' ' + Data.Sections[Section].Value);
|
||||
end;
|
||||
for Indent := 0 to Length(Data.Sections[Section].Reference^) - 1 do
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Indent + ' ' + Data.Sections[Section].Reference^[Indent].Value + ' ' + Localization.Format.Separator + ' ' + Data.Sections[Section].Reference^[Indent].Reference^);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizationImporter.ImportFromINI(INI: TIniFile);
|
||||
var
|
||||
Sections: TStrings;
|
||||
Section: Integer;
|
||||
Indents: TStrings;
|
||||
Indent: Integer;
|
||||
begin
|
||||
if INI = nil then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
PrepareImport;
|
||||
Sections := TStringList.Create;
|
||||
try
|
||||
INI.ReadSections(Sections);
|
||||
for Section := 0 to Sections.Count - 1 do
|
||||
begin
|
||||
if Sections.Strings[Section] <> '' then
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Header + ' ' + Sections[Section]);
|
||||
end;
|
||||
Indents := TStringList.Create;
|
||||
try
|
||||
for Indent := 0 to Indents.Count - 1 do
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Indent + ' ' + Indents.Strings[Indent] + ' ' + Localization.Format.Separator + ' ' + INI.ReadString(Sections.Strings[Section],Indents.Strings[Indent],''));
|
||||
end;
|
||||
finally
|
||||
Indents.Free;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Sections.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalization
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -412,12 +566,14 @@ begin
|
||||
FFormat := TLocalizationFormat.Create;
|
||||
FTag := 'L' + IntToStrMinLength(ID,2);
|
||||
Encoding := {$IFDEF NO_UNICODE} ceUTF8 {$ELSE} ceUnicode {$ENDIF};
|
||||
FConverter := TLocalizationImporter.Create(Self);
|
||||
end;
|
||||
|
||||
constructor TLocalization.Create(Collection: TCollection; const AFileName: TFileName);
|
||||
begin
|
||||
Create(Collection);
|
||||
Lines.LoadFromFile(AFileName);
|
||||
FConverter.Free;
|
||||
end;
|
||||
|
||||
destructor TLocalization.Destroy;
|
||||
@@ -449,6 +605,7 @@ end;
|
||||
|
||||
procedure TLocalization.SetTag(Value: TLanguageTag);
|
||||
begin
|
||||
Value := Trim(Value);
|
||||
if ((Collection as TLocalizations).IndexOfTag(Value) > -1) and
|
||||
((Collection as TLocalizations).IndexOfTag(Value) <> Index)then
|
||||
begin
|
||||
@@ -459,6 +616,16 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalization.SetName(Value: ShortString);
|
||||
begin
|
||||
Value := Trim(Value);
|
||||
if Value[1] in ['a'..'z'] then
|
||||
begin
|
||||
Value[1] := UpCase(Value[1]);
|
||||
end;
|
||||
FName := Value;
|
||||
end;
|
||||
|
||||
function TLocalization.GetFormat: TLocalizationFormat;
|
||||
begin
|
||||
Result := FFormat;
|
||||
@@ -516,13 +683,24 @@ function TLocalization.Apply: Boolean;
|
||||
|
||||
Die Syntax entspricht den in der TLocalizationFormat-Klasse festgelegten
|
||||
Bausteinen und Einstellungen, die zur Laufzeit f�r jede Sprache Individuell
|
||||
festgelegt werden kann. }
|
||||
festgelegt werden kann.
|
||||
|
||||
Spezielle Direktiven:
|
||||
- "LOC <Name>": Namen der aktuellen Sprache �ndern
|
||||
- "TAG <Tag>": Sprachk�rzel der aktuellen Sprache �ndern
|
||||
- "INC <Sprache>": Andere Sprache einbinden
|
||||
- "END": Kompilierung beenden
|
||||
- "APP <Anwendung>": Fortfahren, falls der Titel der Anwendung �bereinstimmt
|
||||
- "NOT <Anwendung>": Beenden, falls der Titel der Anwendung �bereinstimmt }
|
||||
const
|
||||
Specials: array [0..5] of String = ('loc','tag','inc','end','app','not');
|
||||
var
|
||||
Position: (posPrefix,posIndent,posSeparator,posValue);
|
||||
Line: Integer;
|
||||
Complete: Boolean;
|
||||
Finished: Boolean;
|
||||
Header: Boolean;
|
||||
Special: Boolean;
|
||||
Address: Boolean;
|
||||
Character: Boolean;
|
||||
Current: PChar;
|
||||
@@ -549,6 +727,7 @@ begin
|
||||
//Zeilenanfang
|
||||
Position := posPrefix;
|
||||
Header := False;
|
||||
Special := False;
|
||||
Address := False;
|
||||
Complete := False;
|
||||
Finished := False;
|
||||
@@ -562,14 +741,15 @@ begin
|
||||
if ((Address = False) or (Current^ <> #0)) and (not (Current^ in Spaces)) or ((((Address = False) and (Position = posValue)) or (Header = True)) and (Length(Block) <> 0)) then
|
||||
begin
|
||||
//Zeichen zu Block hinzuf�gen
|
||||
if Character = False then
|
||||
if Current^ <> #0 then
|
||||
begin
|
||||
Block := Block + Current^;
|
||||
if address = true then
|
||||
address := true;
|
||||
end else
|
||||
begin
|
||||
Ordinal := Ordinal + Current^;
|
||||
if Character = False then
|
||||
begin
|
||||
Block := Block + Current^;
|
||||
end else
|
||||
begin
|
||||
Ordinal := Ordinal + Current^;
|
||||
end;
|
||||
end;
|
||||
if (Current^ = #0{@Lines.Strings[Line][Length(Lines.Strings[Line])]}) or ((Character = True) and (Current^ in Spaces)) then
|
||||
begin
|
||||
@@ -645,7 +825,7 @@ begin
|
||||
(Address = True) then
|
||||
begin
|
||||
//Block fertig
|
||||
if ((Position = posSeparator) and (Block = Format.Separator)) or ((Block = Format.Comment) and ((Position = posPrefix) or (Finished = True))) or ((Header = True) and (Position = posIndent) and (Length(Block) <> 0)) or ((Position = PosValue) and ((Address = False) or (Length(Block) <> 0))) then
|
||||
if ((Position = posSeparator) and (Block = Format.Separator)) or ((Block = Format.Comment) and ((Position = posPrefix) or (Finished = True))) or ((Header = True) and (Position = posIndent) and (Length(Block) <> 0)) or (((Position = PosValue) or ((Current^ = #0) and (Special = True))) and ((Address = False) or ((Length(Block) <> 0) or (Special = True)))) then
|
||||
begin
|
||||
if Position = posSeparator then
|
||||
begin
|
||||
@@ -660,25 +840,106 @@ begin
|
||||
//Ende von Value
|
||||
if (Finished = False) and (Block <> Format.Comment) then
|
||||
begin
|
||||
if Address = False then
|
||||
//Ende von Special
|
||||
if Special = True then
|
||||
begin
|
||||
//Wert
|
||||
(Collection as TLocalizations).FManager.Data.WriteString(Section,Indent,TrimRight(Block));
|
||||
end else
|
||||
begin
|
||||
//Adressierung
|
||||
Complete := (Current^ = #0{@Lines.Strings[Line][Length(Lines.Strings[Line])]});
|
||||
if (Collection as TLocalizations).FManager.Data.IndentExists(Section,Block) = True then
|
||||
if Length(Indent) = 0 then
|
||||
begin
|
||||
(Collection as TLocalizations).FManager.Data.Address(Section,Indent,Block);
|
||||
Finished := True;
|
||||
Block := '';
|
||||
Inc(Current);
|
||||
Continue;
|
||||
Indent := LowerCase(Block);
|
||||
Block := '';
|
||||
end;
|
||||
if Indent = Specials[0] then
|
||||
begin
|
||||
//LOC abc
|
||||
Name := Block;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUndeclared(Block,Line,Current,Length(Block));
|
||||
Exit;
|
||||
if Indent = Specials[1] then
|
||||
begin
|
||||
//TAG abc
|
||||
Tag := Block;
|
||||
end else
|
||||
begin
|
||||
if Indent = Specials[2] then
|
||||
begin
|
||||
//INC abc
|
||||
((Collection as TLocalizations).Items[(Collection as TLocalizations).IndexOfTag(Trim(Block))] as TLocalization).Apply;
|
||||
end else
|
||||
begin
|
||||
if Indent = Specials[3] then
|
||||
begin
|
||||
//END
|
||||
if Length(Trim(Block)) <> 0 then
|
||||
begin
|
||||
RaiseParseErrorUnexpected('End of line','expression',Line,Current,Length(Block));
|
||||
end;
|
||||
Exit;
|
||||
end else
|
||||
begin
|
||||
if Indent = Specials[4] then
|
||||
begin
|
||||
//APP abc
|
||||
Block := Trim(Block);
|
||||
if (Length(Block) <> 0) and (Position = posValue) then
|
||||
begin
|
||||
if Application.Title <> Block then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUnexpected('Argument','end of line',Line,Current);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
if Indent = Specials[5] then
|
||||
begin
|
||||
//NOT abc
|
||||
if (Length(Block) <> 0) and (Position = posValue) then
|
||||
begin
|
||||
if Application.Title = Block then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUnexpected('Argument','end of line',Line,Current);
|
||||
Exit;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUnexpected('End of line','expression',Line,Current);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
//Ende von Indent
|
||||
if Address = False then
|
||||
begin
|
||||
//Wert
|
||||
(Collection as TLocalizations).FManager.Data.WriteString(Section,Indent,TrimRight(Block));
|
||||
end else
|
||||
begin
|
||||
//Adressierung
|
||||
Complete := (Current^ = #0{@Lines.Strings[Line][Length(Lines.Strings[Line])]});
|
||||
if (Collection as TLocalizations).FManager.Data.IndentExists(Section,Block) = True then
|
||||
begin
|
||||
(Collection as TLocalizations).FManager.Data.Address(Section,Indent,Block);
|
||||
Finished := True;
|
||||
Block := '';
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUndeclared(Block,Line,Current,Length(Block));
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@@ -693,11 +954,12 @@ begin
|
||||
begin
|
||||
case Position of
|
||||
posPrefix: begin
|
||||
if (Block <> Format.Header) and (Block <> Format.Indent) then
|
||||
if (Block <> Format.Header) and (Block <> Format.Indent) and (Block <> Format.Special) then
|
||||
begin
|
||||
if (Length(Format.Header) = 0) or (Length(Format.Indent) = 0) then
|
||||
if (Length(Format.Header) = 0) or (Length(Format.Indent) = 0) or (Length(Format.Special) = 0) then
|
||||
begin
|
||||
Header := (Length(Format.Header) = 0);
|
||||
Special := (Length(Format.Special) = 0);
|
||||
Position := posIndent;
|
||||
Continue;
|
||||
end else
|
||||
@@ -707,14 +969,30 @@ begin
|
||||
end;
|
||||
end;
|
||||
Header := (Block = Format.Header);
|
||||
Special := (Block = Format.Special);
|
||||
Inc(Position);
|
||||
end;
|
||||
posIndent: begin
|
||||
Indent := LowerCase(TrimRight(Block));
|
||||
if Header = False then
|
||||
begin
|
||||
Inc(Position);
|
||||
if Special = True then
|
||||
begin
|
||||
if ArrayPos(Indent,Specials) <> -1 then
|
||||
begin
|
||||
Inc(Position);
|
||||
end else
|
||||
begin
|
||||
RaiseParseErrorUnexpected('Command','"' + Block + '"',Line,Current,Length(Block));
|
||||
Exit;
|
||||
end;
|
||||
{ if Indent = Specials[3] then
|
||||
begin
|
||||
Finished := True;
|
||||
end; }
|
||||
end;
|
||||
end;
|
||||
Indent := TrimRight(Block);
|
||||
end;
|
||||
posSeparator: begin
|
||||
Address := (Block = Format.Address);
|
||||
@@ -775,6 +1053,125 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizations.LoadFromFile(const FileName: String);
|
||||
var
|
||||
Languages: TStrings;
|
||||
Index: Integer;
|
||||
begin
|
||||
Languages := TStringList.Create;
|
||||
try
|
||||
Languages.LoadFromFile(FileName);
|
||||
for Index := 0 to Languages.Count - 1 do
|
||||
begin
|
||||
(Add as TLocalization).Name := Languages.Strings[Index];
|
||||
end;
|
||||
finally
|
||||
Languages.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizations.SaveToFile(const FileName: String);
|
||||
var
|
||||
Languages: TStrings;
|
||||
Index: Integer;
|
||||
begin
|
||||
Languages := TStringList.Create;
|
||||
try
|
||||
for Index := 0 to Count - 1 do
|
||||
begin
|
||||
Languages.Add((Items[Index] as TLocalization).Name);
|
||||
end;
|
||||
Languages.SaveToFile(FileName);
|
||||
finally
|
||||
Languages.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizations.LoadFromDirectory(const Dir: String; FileExts: array of String; RecMode: Boolean = True);
|
||||
var
|
||||
Languages: TStrings;
|
||||
Language_Index: Integer;
|
||||
begin
|
||||
Languages := TStringList.Create;
|
||||
try
|
||||
ListFiles(Dir,Languages,FileExts,[fnDirectory,fnExtension],RecMode);
|
||||
for Language_Index := 0 to Languages.Count - 1 do
|
||||
begin
|
||||
with (Add as TLocalization) do
|
||||
begin
|
||||
Name := ExtractFileName(ChangeFileExt(Languages.Strings[Language_Index],''));
|
||||
Lines.LoadFromFile(Languages.Strings[Language_Index]);
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Languages.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalizationExporter
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TLocalizationExporter.Create(AData: TLocalizationData);
|
||||
begin
|
||||
inherited Create;
|
||||
FData := AData;
|
||||
FClearBeforeExport := True;
|
||||
end;
|
||||
|
||||
destructor TLocalizationExporter.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TLocalizationExporter.ExportToINI(var INI: TIniFile);
|
||||
var
|
||||
Section: Integer;
|
||||
Sections: TStrings;
|
||||
Indent: Integer;
|
||||
begin
|
||||
if INI = nil then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
if ClearBeforeExport = True then
|
||||
begin
|
||||
Sections := TStringList.Create;
|
||||
INI.ReadSections(Sections);
|
||||
for Section := 0 to Sections.Count - 1 do
|
||||
begin
|
||||
INI.EraseSection(Sections.Strings[Section]);
|
||||
end;
|
||||
end;
|
||||
|
||||
{
|
||||
Localization.Lines.Add(Localization.Format.Comment + ' ' + '+++ AUTO-GENERATED LOCALIZATION CONTENT +++');
|
||||
|
||||
Sections := TStringList.Create;
|
||||
try
|
||||
INI.ReadSections(Sections);
|
||||
for Section := 0 to Sections.Count - 1 do
|
||||
begin
|
||||
if Sections.Strings[Section] <> '' then
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Header + ' ' + Sections[Section]);
|
||||
end;
|
||||
Indents := TStringList.Create;
|
||||
try
|
||||
for Indent := 0 to Indents.Count - 1 do
|
||||
begin
|
||||
Localization.Lines.Add(Localization.Format.Indent + ' ' + Indents.Strings[Indent] + ' ' + Localization.Format.Separator + ' ' + INI.ReadString(Sections.Strings[Section],Indents.Strings[Indent],''));
|
||||
end;
|
||||
finally
|
||||
Indents.Free;
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
Sections.Free;
|
||||
end; }
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TLocalizationData
|
||||
---------------------------------------------------------------------------- }
|
||||
@@ -783,11 +1180,13 @@ constructor TLocalizationData.Create(AManager: TLocalizationManager);
|
||||
begin
|
||||
inherited Create;
|
||||
FManager := AManager;
|
||||
FExporter := TLocalizationExporter.Create(Self);
|
||||
end;
|
||||
|
||||
destructor TLocalizationData.Destroy;
|
||||
begin
|
||||
FManager := nil;
|
||||
FExporter.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
@@ -975,6 +1374,20 @@ begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TLocalizationReference.GetDisplayName: String;
|
||||
begin
|
||||
inherited;
|
||||
Result := Indent;
|
||||
if Length(Section) <> 0 then
|
||||
begin
|
||||
Result := Section + '.' + Result;
|
||||
end;
|
||||
if Component <> nil then
|
||||
begin
|
||||
Result := Result + ' (' + Component.Name + '.' + Field + ')';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TLocalizationReference.SetIndent(Value: String);
|
||||
var
|
||||
Index: Integer;
|
||||
@@ -1127,7 +1540,7 @@ end;
|
||||
constructor TLocalizationManager.Create(AOwnder: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TLocalizationManager,LocalizationManagerComponent_Version,LocalizationManagerComponent_Copyright,LocalizationManagerComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TLocalizationManager);
|
||||
FLocalizations := TLocalizations.Create(TLocalization,Self);
|
||||
FData := TLocalizationData.Create(Self);
|
||||
FReferences := TLocalizationReferences.Create(TLocalizationReference,Self);
|
||||
|
@@ -3,14 +3,10 @@ unit uScriptMgr;
|
||||
//////////////////////////////////////
|
||||
/// Lina Script Manager Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uScriptMgr" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -78,6 +74,9 @@ type
|
||||
procedure Delete(Plugin: TPSPlugin);
|
||||
end;
|
||||
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TScriptManager = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -171,13 +170,11 @@ type
|
||||
procedure AddPlugin(PluginList: TPSPlugins; Plugin: TPSPlugin);
|
||||
procedure DeletePlugin(PluginList: TPSPlugins; Plugin: TPSPlugin);
|
||||
|
||||
procedure Register;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
ScriptManagerComponent_Version = '1.0';
|
||||
ScriptManagerComponent_Copyright = 'Copyright � 2015';
|
||||
ScriptManagerComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{ Fehlermeldungen }
|
||||
Error_MissingReturnTarget = 'Missing log-return target';
|
||||
Error_MissingComponentName = 'Missing component name';
|
||||
@@ -194,10 +191,12 @@ var
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TScriptManager]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TScriptManager]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
procedure AddPlugin(PluginList: TPSPlugins; Plugin: TPSPlugin);
|
||||
begin
|
||||
@@ -286,9 +285,9 @@ end;
|
||||
constructor TScriptManager.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TScriptManager,ScriptManagerComponent_Version,ScriptManagerComponent_Copyright,ScriptManagerComponent_Author);
|
||||
//ReturnMode := srNone; Durch DEFAULT festgelegt!
|
||||
//ReturnStyle := srSimple; Durch DEFAULT festgelegt!
|
||||
FAbout := TComponentAbout.Create(TScriptManager);
|
||||
ReturnMode := srNone;
|
||||
ReturnStyle := srSimple;
|
||||
SecureMode := True;
|
||||
//ReturnSL := TStringList.Create; Nicht erstellen, Property ist nur ein Pointer auf ext. TStrings
|
||||
FLibraries := [slClasses,slControls,slStdCtrls,slForms,slDateUtils,slCustom];
|
||||
|
1229
Source/uSysCtrls.pas
1229
Source/uSysCtrls.pas
File diff suppressed because it is too large
Load Diff
@@ -3,14 +3,10 @@ unit uSysTools;
|
||||
//////////////////////////////////////
|
||||
/// Lina System Tools Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uSysTools" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -25,6 +21,7 @@ uses
|
||||
type
|
||||
{ Fehlermeldungen }
|
||||
EWinUserInformation = class(Exception);
|
||||
EStringCharAccess = class(Exception);
|
||||
|
||||
type
|
||||
{ Hilfsklassen }
|
||||
@@ -44,11 +41,13 @@ type
|
||||
{ Typisierte Arrays }
|
||||
TPointerArray = array of Pointer;
|
||||
TPCharArray = array of PChar;
|
||||
TCharArray = array of Char;
|
||||
|
||||
TVariantArray = array of Variant;
|
||||
|
||||
TStringArray = array of String;
|
||||
TShortStringArray = array of ShortString;
|
||||
TAnsiStringArray = array of AnsiString;
|
||||
|
||||
TByteArray = array of Byte;
|
||||
TWordArray = array of Word;
|
||||
@@ -143,10 +142,13 @@ type
|
||||
end;
|
||||
TFloatRefDataArrayReferenceDataArray = array of TFloatRefDataArrayReferenceData;
|
||||
|
||||
TByteSet = set of Byte;
|
||||
TCharSet = set of Char;
|
||||
|
||||
TVector = TFloatArray;
|
||||
TMatrix = array of TVector;
|
||||
|
||||
TCycle = {$IFDEF NO_RECORDMETHODS} record {$ELSE} class {$ENDIF}
|
||||
TCycle = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FRadius: Extended;
|
||||
@@ -157,11 +159,38 @@ type
|
||||
procedure SetCircumference(Value: Extended);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property Radius: Extended read FRadius write FRadius;
|
||||
property Diameter: Extended read GetDiameter write SetDiameter;
|
||||
property Circumference: Extended read GetCircumference write SetCircumference;
|
||||
end;
|
||||
|
||||
TRange = class
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
FOffset: Integer;
|
||||
FTarget: Integer;
|
||||
FStep: Integer;
|
||||
{ Methoden }
|
||||
procedure SetOffset(Value: Integer);
|
||||
procedure SetTarget(Value: Integer);
|
||||
function GetLength: Integer;
|
||||
procedure SetLength(Value: Integer);
|
||||
function GetCount: Integer;
|
||||
function GetElements: TIntegerArray;
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
property Offset: Integer read FOffset write SetOffset default 0;
|
||||
property Target: Integer read FTarget write SetTarget default 0;
|
||||
property Length: Integer read GetLength write SetLength default 0;
|
||||
property Count: Integer read GetCount default 0;
|
||||
property Elements: TIntegerArray read GetElements;
|
||||
property Step: Integer read FStep write FStep default 1;
|
||||
end;
|
||||
|
||||
TFilteredStringList = class(TStringList)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -299,7 +328,7 @@ type
|
||||
procedure SetMethodSubProp(Instance: TObject; const PropName: String; Value: TMethod);
|
||||
function SubPropIsType(Instance: TObject; const PropName: String; TypeKind: TTypeKind): Boolean;
|
||||
function SubPropType(Instance: TObject; const PropName: String): TTypeKind; overload;
|
||||
{ Uhrzeit }
|
||||
{ Datum/Uhrzeit }
|
||||
function SystemTime: TSystemTime;
|
||||
function Year: Word;
|
||||
function Month: Word;
|
||||
@@ -309,7 +338,17 @@ type
|
||||
function Minute: Word;
|
||||
function Second: Word;
|
||||
function Milliseconds: Word;
|
||||
{ Set-Operationen }
|
||||
function Count(Elements: TByteSet): Byte; overload;
|
||||
function Count(Elements: TCharSet): Byte; overload;
|
||||
function SetToArray(Elements: TByteSet): TByteArray; overload;
|
||||
function SetToArray(Elements: TCharSet): TCharArray; overload;
|
||||
function ArrayToSet(Elements: array of Byte): TByteSet; overload;
|
||||
function ArrayToSet(Elements: array of Char): TCharSet; overload;
|
||||
{ Sonstige }
|
||||
function StringToRange(const S: String; var Range: TRange): Boolean;
|
||||
function ExprInStr(const S: String; Position: Integer): String;
|
||||
function Factional(X: Byte): Cardinal;
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = True): String;
|
||||
function CountLines(S: String): Integer;
|
||||
function Wrappable(S: String; Font: TFont; MaxWidth: Integer): Boolean; overload;
|
||||
@@ -334,9 +373,13 @@ type
|
||||
function CharPosition(Current: PAnsiChar; Text: AnsiString): Integer; {$IFNDEF NO_UNICODE} overload;
|
||||
function CharPosition(Current: PWideChar; Text: UnicodeString): Integer; overload;
|
||||
{$ENDIF}
|
||||
function ConsistsOf(const S: String; Chars: array of Char): Boolean; overload;
|
||||
function ConsistsOf(const S: String; Chars: TCharSet): Boolean; overload;
|
||||
procedure PrintText(Strings: TStrings; Font: TFont);
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char);
|
||||
procedure EnableDebugPrivilege;
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char); overload;
|
||||
procedure ExtractChars(var Text: String; Chars: TCharSet); overload;
|
||||
procedure SetPrivilege(const Name: PChar; Value: Boolean); overload;
|
||||
procedure SetPrivilege(const Name: String; Value: Boolean); overload;
|
||||
|
||||
const
|
||||
Spaces = [#9,#10,#13,#32,#160];
|
||||
@@ -345,7 +388,42 @@ const
|
||||
LowerCaseLetters = ['a'..'z'];
|
||||
Letters = UpperCaseLetters + LowerCaseLetters;
|
||||
Operators = ['+','-','*','/'];
|
||||
{ WinAPI-Privilegien }
|
||||
SE_ASSIGNPRIMARYTOKEN_NAME = 'SeAssignPrimaryTokenPrivilege';
|
||||
SE_AUDIT_NAME = 'SeAuditPrivilege';
|
||||
SE_BACKUP_NAME = 'SeBackupPrivilege';
|
||||
SE_CHANGE_NOTIFY_NAME = 'SeChangeNotifyPrivilege';
|
||||
SE_CREATE_GLOBAL_NAME = 'SeCreateGlobalPrivilege';
|
||||
SE_CREATE_PAGEFILE_NAME = 'SeCreatePagefilePrivilege';
|
||||
SE_CREATE_PERMANENT_NAME = 'SeCreatePermanentPrivilege';
|
||||
SE_CREATE_SYMBOLIC_LINK_NAME = 'SeCreateSymbolicLinkPrivilege';
|
||||
SE_CREATE_TOKEN_NAME = 'SeCreateTokenPrivilege';
|
||||
SE_DEBUG_NAME = 'SeDebugPrivilege';
|
||||
SE_ENABLE_DELEGATION_NAME = 'SeEnableDelegationPrivilege';
|
||||
SE_IMPERSONATE_NAME = 'SeImpersonatePrivilege';
|
||||
SE_INC_BASE_PRIORITY_NAME = 'SeIncreaseBasePriorityPrivilege';
|
||||
SE_INCREASE_QUOTA_NAME = 'SeIncreaseQuotaPrivilege';
|
||||
SE_INC_WORKING_SET_NAME = 'SeIncreaseWorkingSetPrivilege';
|
||||
SE_LOAD_DRIVER_NAME = 'SeLoadDriverPrivilege';
|
||||
SE_LOCK_MEMORY_NAME = 'SeLockMemoryPrivilege';
|
||||
SE_MACHINE_ACCOUNT_NAME = 'SeMachineAccountPrivilege';
|
||||
SE_MANAGE_VOLUME_NAME = 'SeManageVolumePrivilege';
|
||||
SE_PROF_SINGLE_PROCESS_NAME = 'SeProfileSingleProcessPrivilege';
|
||||
SE_RELABEL_NAME = 'SeRelabelPrivilege';
|
||||
SE_REMOTE_SHUTDOWN_NAME = 'SeRemoteShutdownPrivilege';
|
||||
SE_RESTORE_NAME = 'SeRestorePrivilege';
|
||||
SE_SECURITY_NAME = 'SeSecurityPrivilege';
|
||||
SE_SHUTDOWN_NAME = 'SeShutdownPrivilege';
|
||||
SE_SYNC_AGENT_NAME = 'SeSyncAgentPrivilege';
|
||||
SE_SYSTEM_ENVIRONMENT_NAME = 'SeSystemEnvironmentPrivilege';
|
||||
SE_SYSTEM_PROFILE_NAME = 'SeSystemProfilePrivilege';
|
||||
SE_SYSTEMTIME_NAME = 'SeSystemtimePrivilege';
|
||||
SE_TAKE_OWNERSHIP_NAME = 'SeTakeOwnershipPrivilege';
|
||||
SE_TCB_NAME = 'SeTcbPrivilege';
|
||||
SE_TIME_ZONE_NAME = 'SeTimeZonePrivilege';
|
||||
SE_TRUSTED_CREDMAN_ACCESS_NAME = 'SeTrustedCredManAccessPrivilege';
|
||||
SE_UNDOCK_NAME = 'SeUndockPrivilege';
|
||||
SE_UNSOLICITED_INPUT_NAME = 'SeUnsolicitedInputPrivilege';
|
||||
|
||||
implementation
|
||||
|
||||
@@ -1199,6 +1277,192 @@ begin
|
||||
Result := SystemTime.wMilliseconds;
|
||||
end;
|
||||
|
||||
function Count(Elements: TByteSet): Byte;
|
||||
var
|
||||
Current: Byte;
|
||||
begin
|
||||
Result := 0;
|
||||
for Current in Elements do
|
||||
begin
|
||||
Inc(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function Count(Elements: TCharSet): Byte;
|
||||
var
|
||||
Current: Char;
|
||||
begin
|
||||
Result := 0;
|
||||
for Current in Elements do
|
||||
begin
|
||||
Inc(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
function SetToArray(Elements: TByteSet): TByteArray;
|
||||
var
|
||||
Current: Byte;
|
||||
Index: Integer;
|
||||
begin
|
||||
SetLength(Result,Count(Elements));
|
||||
Index := 0;
|
||||
for Current in Elements do
|
||||
begin
|
||||
Result[Index] := Current;
|
||||
Inc(Index);
|
||||
end;
|
||||
end;
|
||||
|
||||
function SetToArray(Elements: TCharSet): TCharArray;
|
||||
var
|
||||
Current: Char;
|
||||
Index: Integer;
|
||||
begin
|
||||
SetLength(Result,Count(Elements));
|
||||
Index := 0;
|
||||
for Current in Elements do
|
||||
begin
|
||||
Result[Index] := Current;
|
||||
Inc(Index);
|
||||
end;
|
||||
end;
|
||||
|
||||
function ArrayToSet(Elements: array of Byte): TByteSet;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Result := [];
|
||||
for Index := 0 to Length(Elements) - 1 do
|
||||
begin
|
||||
Result := Result + [Elements[Index]];
|
||||
end;
|
||||
end;
|
||||
|
||||
function ArrayToSet(Elements: array of Char): TCharSet;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Result := [];
|
||||
for Index := 0 to Length(Elements) - 1 do
|
||||
begin
|
||||
Result := Result + [Elements[Index]];
|
||||
end;
|
||||
end;
|
||||
|
||||
function StringToRange(const S: String; var Range: TRange): Boolean;
|
||||
var
|
||||
Current: PChar;
|
||||
Block: String;
|
||||
Temp: TRange;
|
||||
Position: (posOffset,posDots,posTarget,posFinish);
|
||||
begin
|
||||
{if Range = nil then
|
||||
begin
|
||||
Range := TRange.Create;
|
||||
end;
|
||||
Result := False;
|
||||
if Length(S) = 0 then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
Current := PChar(S);
|
||||
Position := posOffset;
|
||||
Temp := TRange.Create;
|
||||
try
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if (Position^ = posFinish) and (not (Current^ in Spaces)) then
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
end;
|
||||
case Current^ of
|
||||
Spaces: if Position in [posOffset,posTarget] then
|
||||
begin
|
||||
Inc(Position);
|
||||
end;
|
||||
'0'..'9': Block := Block + Current^;
|
||||
'+','-': if Length(Block) = 0 then
|
||||
begin
|
||||
Block := Block + Current^;
|
||||
end else
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
end;
|
||||
'.': if (Current + 1)^ = '.' then
|
||||
begin
|
||||
|
||||
Block := '';
|
||||
Inc(Current);
|
||||
end else
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
Inc(Current);
|
||||
end;
|
||||
finally
|
||||
Temp.Free;
|
||||
end;
|
||||
if Result = True then
|
||||
begin
|
||||
Range.Offset := Temp.Offset;
|
||||
Range.Target := Temp.Target;
|
||||
Range.Step := Temp.Step;
|
||||
end; }
|
||||
end;
|
||||
|
||||
function ExprInStr(const S: String; Position: Integer): String;
|
||||
var
|
||||
Current: PChar;
|
||||
begin
|
||||
if (Position < 1) or (Position > Length(S)) then
|
||||
begin
|
||||
raise EStringCharAccess.Create('Access to String char at position ' + IntToStr(Position) + ' not possible');
|
||||
end;
|
||||
Current := @S[Position];
|
||||
Result := '';
|
||||
while (Current^ in Letters) and (Current >= @S[1]) do
|
||||
begin
|
||||
Result := Current^ + Result;
|
||||
Dec(Current);
|
||||
end;
|
||||
Current := @S[Position + 1];
|
||||
while Current^ in Letters do
|
||||
begin
|
||||
Result := Result + Current^;
|
||||
Inc(Current);
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF PUREPASCAL}
|
||||
function Factional(X: Byte): Cardinal;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
Result := 1;
|
||||
for Index := 2 to X do
|
||||
begin
|
||||
Result := Result * Index;
|
||||
end;
|
||||
end;
|
||||
{$ELSE}
|
||||
function Factional(X: Byte): Cardinal; assembler;
|
||||
asm
|
||||
MOV ECX,EAX
|
||||
MOV EAX,1
|
||||
JMP @Check
|
||||
@Multiply:
|
||||
IMUL EAX,ECX
|
||||
DEC ECX
|
||||
@Check:
|
||||
CMP ECX,1
|
||||
JNE @Multiply
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ExtractClassName(FullClassName: String; CaseSensitive: Boolean = True): String;
|
||||
begin
|
||||
if ((FullClassName[1] = 'T') or ((CaseSensitive = False) and (FullClassName[1] = 't'))) and ((FullClassName[2] in UppercaseLetters) or (CaseSensitive = False)) then
|
||||
@@ -1310,11 +1574,6 @@ function SecToTime(const Sec: Cardinal): TTime;
|
||||
var
|
||||
Hrs, Mins: Word;
|
||||
begin
|
||||
if Sec <= 0 then
|
||||
begin
|
||||
Result := StrToTime('00:00:00');
|
||||
Exit;
|
||||
end;
|
||||
Hrs := Sec div 3600;
|
||||
Mins := Sec div 60 - Hrs * 60;
|
||||
Result := StrToTime(IntToStr(Hrs) + ':' + IntToStr(Mins) + ':' + IntToStr(Sec - (Hrs * 3600 + Mins * 60)));
|
||||
@@ -2123,6 +2382,40 @@ begin
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ConsistsOf(const S: String; Chars: TCharSet): Boolean; overload;
|
||||
var
|
||||
Current: PChar;
|
||||
begin
|
||||
Current := PChar(S);
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if not (Current^ in Chars) then
|
||||
begin
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
Inc(Current);
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
function ConsistsOf(const S: String; Chars: array of Char): Boolean; overload;
|
||||
var
|
||||
Current: PChar;
|
||||
begin
|
||||
Current := PChar(S);
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if ArrayPos(Current^,Chars) = -1 then
|
||||
begin
|
||||
Result := False;
|
||||
Exit;
|
||||
end;
|
||||
Inc(Current);
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure PrintText(Strings: TStrings; Font: TFont);
|
||||
var
|
||||
Index: Integer;
|
||||
@@ -2144,12 +2437,12 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char);
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char); overload;
|
||||
var
|
||||
Current: PChar;
|
||||
OutPut: String;
|
||||
begin
|
||||
Current := @Text[1];
|
||||
Current := PChar(Text);
|
||||
SetLength(OutPut,0);
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
@@ -2162,21 +2455,50 @@ begin
|
||||
Text := OutPut;
|
||||
end;
|
||||
|
||||
procedure EnableDebugPrivilege;
|
||||
procedure ExtractChars(var Text: String; Chars: TCharSet); overload;
|
||||
var
|
||||
Current: PChar;
|
||||
OutPut: String;
|
||||
begin
|
||||
Current := PChar(Text);
|
||||
SetLength(OutPut,0);
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if Current^ in Chars then
|
||||
begin
|
||||
OutPut := OutPut + Current^;
|
||||
end;
|
||||
Inc(Current);
|
||||
end;
|
||||
Text := OutPut;
|
||||
end;
|
||||
|
||||
procedure SetPrivilege(const Name: PChar; Value: Boolean); overload;
|
||||
var
|
||||
Token: THandle;
|
||||
TokenPrivs: TTokenPrivileges;
|
||||
Privileges: TTokenPrivileges;
|
||||
begin
|
||||
if OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES,Token) then
|
||||
begin
|
||||
TokenPrivs.PrivilegeCount := 1;
|
||||
LookupPrivilegeValue(nil, SE_DEBUG_NAME, TokenPrivs.Privileges[0].Luid);
|
||||
TokenPrivs.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
|
||||
AdjustTokenPrivileges(Token,False,TokenPrivs,SizeOf(TokenPrivs),nil,DWord(nil^));
|
||||
Privileges.PrivilegeCount := 1;
|
||||
LookupPrivilegeValue(nil,Name,Privileges.Privileges[0].Luid);
|
||||
if Value = True then
|
||||
begin
|
||||
Privileges.Privileges[0].Attributes := SE_PRIVILEGE_ENABLED;
|
||||
end else
|
||||
begin
|
||||
Privileges.Privileges[0].Attributes := 0;
|
||||
end;
|
||||
AdjustTokenPrivileges(Token,False,Privileges,SizeOf(Privileges),nil,DWord(nil^));
|
||||
CloseHandle(Token);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure SetPrivilege(const Name: String; Value: Boolean); overload;
|
||||
begin
|
||||
SetPrivilege(PChar(Name),Value);
|
||||
end;
|
||||
|
||||
function WinUserName: String;
|
||||
var
|
||||
Buffer: array [0..255] of Char;
|
||||
@@ -2266,6 +2588,18 @@ end;
|
||||
TCycle
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TCycle.Create;
|
||||
begin
|
||||
inherited;
|
||||
FRadius := 0;
|
||||
end;
|
||||
|
||||
destructor TCycle.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TCycle.GetDiameter: Extended;
|
||||
begin
|
||||
Result := Radius * 2;
|
||||
@@ -2286,6 +2620,69 @@ begin
|
||||
FRadius := Value / 2 / Pi;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TRange
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TRange.Create;
|
||||
begin
|
||||
inherited;
|
||||
FOffset := 0;
|
||||
FTarget := 0;
|
||||
FStep := 1;
|
||||
end;
|
||||
|
||||
destructor TRange.Destroy;
|
||||
begin
|
||||
//...
|
||||
inherited;
|
||||
end;
|
||||
|
||||
procedure TRange.SetOffset(Value: Integer);
|
||||
begin
|
||||
if Value <= Target then
|
||||
begin
|
||||
FOffset := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TRange.SetTarget(Value: Integer);
|
||||
begin
|
||||
if Value >= Offset then
|
||||
begin
|
||||
FTarget := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRange.GetLength: Integer;
|
||||
begin
|
||||
Result := Target - Offset;
|
||||
end;
|
||||
|
||||
procedure TRange.SetLength(Value: Integer);
|
||||
begin
|
||||
if Value >= 0 then
|
||||
begin
|
||||
Length := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRange.GetCount: Integer;
|
||||
begin
|
||||
Result := Length div Step;
|
||||
end;
|
||||
|
||||
function TRange.GetElements: TIntegerArray;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
System.SetLength(Result,Count);
|
||||
for Index := 0 to System.Length(Result) - 1 do
|
||||
begin
|
||||
Result[Index] := Offset + Step * Index;
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TFilteredStringList
|
||||
---------------------------------------------------------------------------- }
|
||||
|
@@ -3,14 +3,10 @@ unit uVirtObj;
|
||||
//////////////////////////////////////
|
||||
/// Lina Virtual Object Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uVirtObj" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -52,6 +48,9 @@ type
|
||||
TVirtualClasses = array of TVirtualClass;
|
||||
|
||||
{ VirtualProgram }
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TVirtualProgram = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -68,21 +67,18 @@ type
|
||||
property About: TComponentAbout read FAbout;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
const
|
||||
{ Meta-Daten }
|
||||
VirtualProgramComponent_Name = 'ScriptManager';
|
||||
VirtualProgramComponent_Version = 1.0;
|
||||
VirtualProgramComponent_Copyright = 'Copyright � 2014';
|
||||
VirtualProgramComponent_Author = 'Dennis G�hlert a.o.';
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TVirtualProgram]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TVirtualProgram]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
constructor TVirtualProgram.Create(AOwner: TComponent);
|
||||
begin
|
||||
|
@@ -3,14 +3,10 @@ unit uWebCtrls;
|
||||
//////////////////////////////////////
|
||||
/// Lina Web Controls Unit ///
|
||||
/// **************************** ///
|
||||
/// (c) 2014 Dennis G�hlert a.o. ///
|
||||
/// (c) 2015 Dennis G�hlert a.o. ///
|
||||
//////////////////////////////////////
|
||||
|
||||
{$IFNDEF MSWINDOWS}
|
||||
{$IFDEF WARN_INCOMPATIBLEOS}
|
||||
{$MESSAGE ERROR 'The "uWebCtrls" unit is only available under MS-Windows OS'}
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
{$I 'Config.inc'}
|
||||
|
||||
interface
|
||||
|
||||
@@ -35,6 +31,9 @@ type
|
||||
|
||||
type
|
||||
{ Hauptklassen }
|
||||
{$IFNDEF NO_MULTIPLATFORM}
|
||||
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
|
||||
{$ENDIF}
|
||||
TDownload = class(TComponent)
|
||||
private
|
||||
{ Private-Deklarationen }
|
||||
@@ -85,7 +84,9 @@ type
|
||||
function StrIsURL(const S: String): Boolean;
|
||||
function GetTagParamValue(const S,Tag,Param: String): String;
|
||||
|
||||
procedure Register;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
{$ENDIF}
|
||||
|
||||
const
|
||||
{ Web-Protokolle }
|
||||
@@ -97,17 +98,15 @@ const
|
||||
WebProtocols: array [0..4] of String = (WP_HTTP,WP_HTTPS,WP_FTP,WP_CALL,WP_MAIL);
|
||||
WebProtocolsSimple: array [0..1] of String = (WP_MAIL,WP_CALL);
|
||||
WebProtocolsSpecial: array [0..2] of String = (WP_HTTP,WP_HTTPS,WP_FTP);
|
||||
{ Meta-Daten }
|
||||
DownloadComponent_Version = '1.0';
|
||||
DownloadComponent_Copyright = 'Copyright � 2015';
|
||||
DownloadComponent_Author = 'Dennis G�hlert a.o.';
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TDownload]);
|
||||
end;
|
||||
{$IFDEF ADD_COMPONENTREG}
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents(ComponentsPage,[TDownload]);
|
||||
end;
|
||||
{$ENDIF}
|
||||
|
||||
function ValidProtocol(const Protocol: String;
|
||||
const Protocols: array of String): Boolean;
|
||||
@@ -323,10 +322,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{ ----------------------------------------------------------------------------
|
||||
TDownload
|
||||
---------------------------------------------------------------------------- }
|
||||
|
||||
constructor TDownload.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FAbout := TComponentAbout.Create(TDownload,DownloadComponent_Version,DownloadComponent_Copyright,DownloadComponent_Author);
|
||||
FAbout := TComponentAbout.Create(TDownload);
|
||||
idHTTPObject := TidHTTP.Create(Self);
|
||||
idHTTPObject.HandleRedirects := True;
|
||||
idHTTPObject.OnWork := idHTTPObjectWork;
|
||||
|
Reference in New Issue
Block a user