1
0
mirror of https://bitbucket.org/Dennis07/lina-components.git synced 2025-08-24 21:49:04 +02:00

Version 1.0 DEV 1.15b

Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
Dennis07
2016-07-01 23:00:40 +02:00
parent 43339d5a24
commit 2160a34266
30 changed files with 1727 additions and 49 deletions

Binary file not shown.

View File

@@ -23,6 +23,9 @@ TCURSORFIX32 BITMAP "Bitmap\Large\TCursorFix.bmp"
TDELPHIMANAGER BITMAP "Bitmap\TDelphiManager.bmp"
TDELPHIMANAGER16 BITMAP "Bitmap\Small\TDelphiManager.bmp"
TDELPHIMANAGER32 BITMAP "Bitmap\Large\TDelphiManager.bmp"
TDIAGRAM BITMAP "Bitmap\TDiagram.bmp"
TDIAGRAM16 BITMAP "Bitmap\Small\TDiagram.bmp"
TDIAGRAM32 BITMAP "Bitmap\Large\TDiagram.bmp"
TDOWNLOAD BITMAP "Bitmap\TDownload.bmp"
TDOWNLOAD16 BITMAP "Bitmap\Small\TDownload.bmp"
TDOWNLOAD32 BITMAP "Bitmap\Large\TDownload.bmp"

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.

View File

@@ -3,7 +3,7 @@ unit uAdvCtrls;
//////////////////////////////////////
/// Lina Advanced Controls Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}
@@ -29,6 +29,8 @@ type
type
{ Ereignisse }
TPaintMemoPaintEvent = procedure(Sender: TObject) of object;
TShortcutLabelOpenTargetEvent = procedure(Sender: TObject) of object;
TShortcutLabelOpenTargetQueryEvent = procedure(Sender: TObject; var CanOpen: Boolean) of object;
type
{ Hauptklassen }
@@ -184,11 +186,15 @@ type
private
{ Private-Deklarationen }
FAbout: TComponentAbout;
FAutoOpenTarget: Boolean;
FTarget: String;
FState: TShortcutLabelState;
FFont: TShortcutLabelFont;
FHighlightVisited: Boolean;
FStoreVisited: Boolean;
{ Ereignisse }
FOpenTargetEvent: TShortcutLabelOpenTargetEvent;
FOpenTargetQueryEvent: TShortcutLabelOpenTargetQueryEvent;
{ Methoden }
procedure SetFont(Value: TShortcutLabelFont);
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
@@ -202,9 +208,13 @@ type
procedure Click; override;
property State: TShortcutLabelState read FState default slsDefault;
published
{ Ereignisse }
property OnOpenTarget: TShortcutLabelOpenTargetEvent read FOpenTargetEvent write FOpenTargetEvent;
property OnOpenTargetQuery: TShortcutLabelOpenTargetQueryEvent read FOpenTargetQueryEvent write FOpenTargetQueryEvent;
{ Published-Deklarationen }
property Cursor default crHandPoint;
property About: TComponentAbout read FAbout;
property AutoOpenTarget: Boolean read FAutoOpenTarget write FAutoOpenTarget default True;
property Target: String read FTarget write FTarget;
property Font: TShortcutLabelFont read FFont write SetFont;
property HighlightVisited: Boolean read FHighlightVisited write FHighlightVisited default True;
@@ -752,6 +762,7 @@ constructor TShortcutLabel.Create(AOwner: TComponent);
begin
inherited;
FAbout := TComponentAbout.Create(TShortcutLabel);
FAutoOpenTarget := True;
FState := slsDefault;
FFont := TShortcutLabelFont.Create(Self);
FHighlightVisited := True;
@@ -771,17 +782,30 @@ end;
procedure TShortcutLabel.Click;
var
Index: Integer;
CanOpen: Boolean;
begin
inherited;
if Length(Target) <> 0 then
if (AutoOpenTarget = True) and (Length(Target) <> 0) then
begin
ExecuteFile(Target);
if StoreVisited = True then
CanOpen := True;
if Assigned(OnOpenTargetQuery) = True then
begin
VisitedTargets.Add(Target);
for Index := 0 to ShortcutLabels.Count - 1 do
OnOpenTargetQuery(Self,CanOpen);
end;
if CanOpen = True then
begin
ExecuteFile(Target);
if StoreVisited = True then
begin
(ShortcutLabels.Items[Index] as TShortcutLabel).Font.Update;
VisitedTargets.Add(Target);
for Index := 0 to ShortcutLabels.Count - 1 do
begin
(ShortcutLabels.Items[Index] as TShortcutLabel).Font.Update;
end;
end;
if Assigned(OnOpenTarget) = True then
begin
OnOpenTarget(Self);
end;
end;
end;

View File

@@ -3,7 +3,7 @@ unit uBase;
//////////////////////////////////////
/// Lina Base Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uCalc;
//////////////////////////////////////
/// Lina Calculator Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uFileCtrls;
//////////////////////////////////////
/// Lina File Controls Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uFileTools;
//////////////////////////////////////
/// Lina File Tools Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}
@@ -27,10 +27,12 @@ type
EMissingExts = class(Exception);
EInvalidStyle = class(Exception);
ENoGetFileOwner = class(Exception);
EDllFileNoExist = class(Exception);
EDllMethodNoExist = class(Exception);
type
{ Hilfsklassen }
TFileExecuteMode = (feOpen,feEdit,feExplore,feFind,fePrint);
TFileExecuteMode = (feOpen,feEdit,feExplore,feFind,fePrint,feProperties,feRunAs,feRunAsUser);
TFileNameStyles = set of (fnDirectory,fnExtension);
TFileAttributes = set of (faReadOnly,faHidden,faSystem,faArchive,faTemporary);
TInvalidFileName = String[4];
@@ -38,6 +40,34 @@ type
type
{ Hauptklassen }
TDllFile = record
FileName: String;
Handle: THandle;
end;
TDllManager = class
private
{ Private-Deklarationen }
FFileName: String;
FFiles: array of TDllFile;
function GetFiles(Index: Integer): TDllFile;
function GetFileCount: Integer;
public
{ Public-Deklarationen }
constructor Create;
destructor Destroy; override;
property Files[Index: Integer]: TDllFile read GetFiles;
property FileCount: Integer read GetFileCount;
procedure Load(const FileName: String);
procedure Close(DLL: TDllFile); overload;
procedure Close(FileName: String); overload;
procedure Close(Handle: THandle); overload;
function GetMethod(Name: String): Pointer;
function GetProcedure(Name: String): TProcedure;
function MethodExists(Name: String): Boolean;
function LibraryExists(FileName: String): Boolean;
end;
TWinFileInfo = class
private
{ Private-Deklarationen }
@@ -341,6 +371,9 @@ begin
feExplore: Result := 'explore';
feFind: Result := 'find';
fePrint: Result := 'print';
feProperties: Result := 'properties';
feRunAs: Result := 'runas';
feRunAsUser: Result := 'runasuser';
else Result := nil;
end;
end;
@@ -644,6 +677,160 @@ begin
end;
end;
{ ----------------------------------------------------------------------------
TDllManager
---------------------------------------------------------------------------- }
constructor TDllManager.Create;
begin
inherited;
SetLength(FFiles,0);
end;
destructor TDllManager.Destroy;
var
Index: Integer;
begin
for Index := 0 to FileCount - 1 do
begin
Close(Files[Index]);
end;
inherited;
end;
function TDllManager.GetFiles(Index: Integer): TDllFile;
begin
Result := FFiles[Index];
end;
function TDllManager.GetFileCount: Integer;
begin
Result := Length(FFiles);
end;
procedure TDllManager.Load(const FileName: String);
var
Handle: THandle;
DLL: TDllFile;
begin
SetLength(FFiles,Length(FFiles) + 1);
Handle := LoadLibrary(PChar(FileName));
if Handle = 0 then
begin
raise EDllFileNoExist.Create('Library "' + FileName + '" not found');
end else
begin
Dll.FileName := FileName;
Dll.Handle := Handle;
FFiles[High(FFiles)] := DLL;
end;
end;
procedure TDllManager.Close(DLL: TDllFile);
var
Index: Integer;
begin
for Index := 0 to FileCount - 1 do
begin
if (Files[Index].FileName = DLL.FileName) and (Files[Index].Handle = DLL.Handle) then
begin
Break;
end;
end;
while Index < FileCount - 1 do
begin
FFiles[Index] := Files[Index + 1];
Inc(Index);
end;
if Index = FileCount then
begin
raise EDllFileNoExist.Create('Library [' + IntToStr(DLL.Handle) + '] "' + DLL.FileName + '" not loaded');
end else
begin
SetLength(FFiles,Length(FFiles) - 1);
end;
end;
procedure TDllManager.Close(FileName: String);
var
Index: Integer;
begin
for Index := 0 to FileCount - 1 do
begin
if Files[Index].FileName = FileName then
begin
Break;
end;
end;
while Index < FileCount - 1 do
begin
FFiles[Index] := Files[Index + 1];
Inc(Index);
end;
if Index = FileCount then
begin
raise EDllFileNoExist.Create('Library "' + FileName + '" not loaded');
end else
begin
SetLength(FFiles,Length(FFiles) - 1);
end;
end;
procedure TDllManager.Close(Handle: THandle);
var
Index: Integer;
begin
for Index := 0 to FileCount - 1 do
begin
if Files[Index].Handle = Handle then
begin
Break;
end;
end;
while Index < FileCount - 1 do
begin
FFiles[Index] := Files[Index + 1];
Inc(Index);
end;
if Index = FileCount then
begin
raise EDllFileNoExist.Create('Library [' + IntToStr(Handle) + '] not loaded');
end else
begin
SetLength(FFiles,Length(FFiles) - 1);
end;
end;
function TDllManager.GetMethod(Name: String): Pointer;
begin
end;
function TDllManager.GetProcedure(Name: String): TProcedure;
begin
Result := TProcedure(GetMethod(Name));
end;
function TDllManager.MethodExists(Name: String): Boolean;
begin
// Load
end;
function TDllManager.LibraryExists(FileName: String): Boolean;
var
Handle: THandle;
begin
Handle := LoadLibrary(PChar(FileName));
if Handle = 0 then
begin
Result := False;
end else
begin
Result := True;
FreeLibrary(Handle);
end;
end;
{ ----------------------------------------------------------------------------
TWinFileInfo
---------------------------------------------------------------------------- }

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ unit uInit;
//////////////////////////////////////
/// Lina Initialization Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uLocalMgr;
//////////////////////////////////////
/// Lina Localize Manager Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}
@@ -147,7 +147,7 @@ type
FManager: TLocalizationManager;
public
{ Public-Deklarationen }
constructor Create(ItemClass: TCollectionItemClass; AManager: TLocalizationManager);
constructor Create(AManager: TLocalizationManager);
destructor Destroy; override;
function IndexOfTag(const Tag: TLanguageTag): Integer;
procedure LoadFromFile(const FileName: String);
@@ -212,7 +212,7 @@ type
FManager: TLocalizationManager;
public
{ Public-Deklarationen }
constructor Create(ItemClass: TCollectionItemClass; AManager: TLocalizationManager);
constructor Create(AManager: TLocalizationManager);
destructor Destroy; override;
procedure Apply;
end;
@@ -1026,9 +1026,9 @@ end;
TLocalizations
---------------------------------------------------------------------------- }
constructor TLocalizations.Create(ItemClass: TCollectionItemClass; AManager: TLocalizationManager);
constructor TLocalizations.Create(AManager: TLocalizationManager);
begin
inherited Create(ItemClass);
inherited Create(TLocalization);
FManager := AManager;
end;
@@ -1333,9 +1333,9 @@ end;
TLocalizationReferences
---------------------------------------------------------------------------- }
constructor TLocalizationReferences.Create(ItemClass: TCollectionItemClass; AManager: TLocalizationManager);
constructor TLocalizationReferences.Create(AManager: TLocalizationManager);
begin
inherited Create(ItemClass);
inherited Create(TLocalizationReference);
FManager := AManager;
end;
@@ -1541,9 +1541,9 @@ constructor TLocalizationManager.Create(AOwnder: TComponent);
begin
inherited;
FAbout := TComponentAbout.Create(TLocalizationManager);
FLocalizations := TLocalizations.Create(TLocalization,Self);
FLocalizations := TLocalizations.Create(Self);
FData := TLocalizationData.Create(Self);
FReferences := TLocalizationReferences.Create(TLocalizationReference,Self);
FReferences := TLocalizationReferences.Create(Self);
FApplier := TLocalizationApplier.Create(Self);
FCurrent := -1;
FIgnoreCase := True;

View File

@@ -3,7 +3,7 @@ unit uScriptMgr;
//////////////////////////////////////
/// Lina Script Manager Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uSysCtrls;
//////////////////////////////////////
/// Lina System Controls Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,10 +3,11 @@ unit uSysTools;
//////////////////////////////////////
/// Lina System Tools Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}
{$POINTERMATH ON}
interface
@@ -30,6 +31,9 @@ type
TStringFilterMode = type TLinePosition;
TStringFilterOptions = set of (sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible);
TCharEncoding = (ceANSI,ceASCII,ceBigEndianUnicode,ceUnicode,ceUTF7,ceUTF8);
{$IF !Declared(TVerticalAlignment}
TVerticalAlignment = (taAlignTop, taAlignBottom, taVerticalCenter);
{$ENDIF}
type
{$IFNDEF NO_GENERIC}
@@ -48,20 +52,34 @@ type
TStringArray = array of String;
TShortStringArray = array of ShortString;
TAnsiStringArray = array of AnsiString;
{$IFDEF NO_UNICODE}
TAnsiStringArray = TStringArray;
{$ELSE}
TAnsiStringArray = array of AnsiString;
TUnicodeStringArray = TStringArray;
{$ENDIF}
TByteArray = array of Byte;
TUInt8Array = TByteArray;
TWordArray = array of Word;
TUInt16Array = TWordArray;
TCardinalArray = array of Cardinal;
TUInt32Array = TCardinalArray;
TUInt64Array = array of UInt64;
TIntegerArray = array of Integer;
TShortIntArray = array of ShortInt;
TInt8Array = TShortIntArray;
TSmallIntArray = array of SmallInt;
TLongIntArray = TIntegerArray;
TInt16Array = TSmallIntArray;
TIntegerArray = array of Integer;
TInt32Array = TIntegerArray;
TLongIntArray = TIntegerArray;
TInt64Array = array of Int64;
TBooleanArray = array of Boolean;
TByteBoolArray = array of ByteBool;
TWordBoolArray = array of WordBool;
TLongBoolArray = array of LongBool;
TFloatArray = array of Extended;
TSingleArray = array of Single;
@@ -232,6 +250,7 @@ type
{ Array-Position }
function ArrayPos(const AValue; const AArray: array of const): Integer; overload;
function ArrayPos(const AValue: Variant; const AArray: array of Variant): Integer; overload;
function ArrayPos(const AValue: Pointer; const AArray: array of Pointer): Integer; overload;
function ArrayPos(const AValue: Char; const AArray: array of Char): Integer; overload;
function ArrayPos(const AValue: ShortString; const AArray: array of ShortString): Integer; overload;
function ArrayPos(const AValue: String; const AArray: array of String): Integer; overload;
@@ -242,6 +261,7 @@ type
function ArrayPos(const AValue: Byte; const AArray: array of Byte): Integer; overload;
function ArrayPos(const AValue: Word; const AArray: array of Word): Integer; overload;
function ArrayPos(const AValue: Cardinal; const AArray: array of Cardinal): Integer; overload;
function ArrayPos(const AValue: UInt64; const AArray: array of UInt64): Integer; overload;
function ArrayPos(const AValue: Single; const AArray: array of Single): Integer; overload;
function ArrayPos(const AValue: Double; const AArray: array of Double): Integer; overload;
function ArrayPos(const AValue: Real; const AArray: array of Real): Integer; overload;
@@ -256,12 +276,29 @@ type
function ArrayPosRef(const AValue: Extended; const AArray: array of TFloatRefDataArrayReferenceData): Integer; overload;
function ArrayPosType(AValue: TClass; AArray: array of TClass): Integer; overload;
function ArrayPosType(AValue: TClass; AArray: array of TObject): Integer; overload;
{ Array-Element L�schen }
procedure ArrayDelete(var AArray: TVariantArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TCharArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TShortStringArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TStringArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TShortIntArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TSmallIntArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TIntegerArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TInt64Array; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TByteArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TWordArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TCardinalArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TUInt64Array; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TSingleArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TDoubleArray; Index: Integer; Count: Integer); overload;
procedure ArrayDelete(var AArray: TExtendedArray; Index: Integer; Count: Integer); overload;
{ TComponent Laden/Speichern }
procedure ComponentSaveToFile(const FileName: String; Component: TComponent);
procedure ComponentLoadFromFile(const FileName: String; Component: TComponent);
procedure ComponentSaveToStream(var Stream: TStream; Component: TComponent);
procedure ComponentLoadFromStream(Stream: TStream; Component: TComponent);
{ Char-Case-Umwandelungen }
function LowCase(Ch: Char): Char;
function CharLowerCase(Character: Char): Char;
function CharUpperCase(Character: Char): Char;
{ Null-/Plus-Minus-Unendlich- Ann�herung }
@@ -280,6 +317,11 @@ type
function FloatMod(X,Y: Single): Single; overload;
function FloatMod(X,Y: Double): Double; overload;
function FloatMod(X,Y: Extended): Extended; overload;
{ Ganzzahliges Exponenzieren }
function IntPow(Base: ShortInt; Exponent: Byte): Int64; overload;
function IntPow(Base: SmallInt; Exponent: Byte): Int64; overload;
function IntPow(Base: Integer; Exponent: Byte): Int64; overload;
function IntPow(Base: Int64; Exponent: Byte): Int64; overload;
{ GGT ("GCD") / KGV ("LCM") }
function GCD(A,B: Byte): Byte; overload;
function GCD(A,B: Word): Word; overload;
@@ -367,8 +409,9 @@ type
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;
function Wrappable(S: String; Canvas: TCanvas; MaxWidth: Integer): Boolean; overload;
function CountLine(S: String; Line: Integer): Integer;
function Wrappable(S: String; Canvas: TCanvas; MaxWidth: Integer): Boolean;
function WrappedTextHeight(S: String; Canvas: TCanvas; MaxWidth: Integer): Integer;
function CharEncoding(EncodingClass: TEncoding): TCharEncoding;
function EncodingClass(CharEncoding: TCharEncoding): TEncoding;
function SecToTime(const Sec: Cardinal): TTime;
@@ -519,6 +562,11 @@ begin
Stream.ReadComponentRes(Component);
end;
function LowCase(Ch: Char): Char;
begin
Result := CharLowerCase(Ch);
end;
function CharLowerCase(Character: Char): Char;
{ Basierend auf der Technik von SysUtils.LowerCase, nur simpler/schneller }
begin
@@ -659,7 +707,7 @@ begin
end;
end;
function PQFormula(P,Q: Single): TSingleArray;
function PQFormula(P,Q: Single): TSingleArray; overload;
var
Root: Single;
begin
@@ -681,7 +729,7 @@ begin
end;
end;
function PQFormula(P,Q: Double): TDoubleArray;
function PQFormula(P,Q: Double): TDoubleArray; overload;
var
Root: Double;
begin
@@ -703,7 +751,7 @@ begin
end;
end;
function PQFormula(P,Q: Extended): TExtendedArray;
function PQFormula(P,Q: Extended): TExtendedArray; overload;
var
Root: Extended;
begin
@@ -725,21 +773,61 @@ begin
end;
end;
function FloatMod(X,Y: Single): Single;
function FloatMod(X,Y: Single): Single; overload;
begin
Result := X - Y * Trunc(X / Y);
end;
function FloatMod(X,Y: Double): Double;
function FloatMod(X,Y: Double): Double; overload;
begin
Result := X - Y * Trunc(X / Y);
end;
function FloatMod(X,Y: Extended): Extended;
function FloatMod(X,Y: Extended): Extended; overload;
begin
Result := X - Y * Trunc(X / Y);
end;
function IntPow(Base: ShortInt; Exponent: Byte): Int64; overload;
begin
Result := 1;
while Exponent > 0 do
begin
Result := Result * Base;
Dec(Exponent);
end;
end;
function IntPow(Base: SmallInt; Exponent: Byte): Int64; overload;
begin
Result := 1;
while Exponent > 0 do
begin
Result := Result * Base;
Dec(Exponent);
end;
end;
function IntPow(Base: Integer; Exponent: Byte): Int64; overload;
begin
Result := 1;
while Exponent > 0 do
begin
Result := Result * Base;
Dec(Exponent);
end;
end;
function IntPow(Base: Int64; Exponent: Byte): Int64; overload;
begin
Result := 1;
while Exponent > 0 do
begin
Result := Result * Base;
Dec(Exponent);
end;
end;
function GCD(A,B: Byte): Byte; overload;
begin
if B <> 0 then
@@ -1838,7 +1926,7 @@ end;
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
if (Length(FullClassName) <> 0) and ((FullClassName[1] = 'T') or ((CaseSensitive = False) and (FullClassName[1] = 't'))) and ((FullClassName[2] in UppercaseLetters) or (CaseSensitive = False)) then
begin
Result := Copy(FullClassName,2,Length(FullClassName) - 1);
end else
@@ -1872,22 +1960,78 @@ begin
end;
end;
function CountLine(S: String; Line: Integer): Integer;
var
Current: PChar;
begin
if Line < 0 then
begin
Result := -1;
Exit;
end;
Result := 0;
Current := PChar(S);
while Current^ <> #0 do
begin
if Current^ = #13 then
begin
if (Current + 1)^ = #10 then
begin
if Line = 0 then
begin
Exit;
end;
Dec(Line);
Inc(Current);
Continue;
end;
end;
if Line = 0 then
begin
Inc(Result);
end;
Inc(Current);
end;
if Line <> 0 then
begin
Result := -1;
end;
end;
function Wrappable(S: String; Canvas: TCanvas; MaxWidth: Integer): Boolean; overload;
begin
Result := (Canvas.TextWidth(S) <= MaxWidth);
end;
function Wrappable(S: String; Font: TFont; MaxWidth: Integer): Boolean; overload;
function WrappedTextHeight(S: String; Canvas: TCanvas; MaxWidth: Integer): Integer;
var
Canvas: TCanvas;
Current: PChar;
Line: String;
begin
Canvas := TCanvas.Create;
try
Canvas.Font.Assign(Font);
Result := Wrappable(S,Canvas,MaxWidth);
finally
Canvas.Free;
Result := 0;
if (Length(S) = 0) or (MaxWidth = 0) then
begin
Exit;
end;
Line := '';
Current := PChar(S);
while Current^ <> #0 do
begin
if ((Current^ = #13) and ((Current + 1)^ = #10)) or (Canvas.TextWidth(Line + Current^) > MaxWidth) then
begin
Inc(Result,Canvas.TextHeight(Line));
Line := Current^;
if (Current + 1)^ = #10 then
begin
Inc(Current);
end;
end else
begin
Line := Line + Current^;
end;
Inc(Current);
end;
Inc(Result,Canvas.TextHeight(Line));
end;
function CharEncoding(EncodingClass: TEncoding): TCharEncoding;
@@ -2114,6 +2258,21 @@ begin
end;
end;
function ArrayPos(const AValue: Pointer; const AArray: array of Pointer): Integer;
var
Index: Integer;
begin
Result := Low(AArray) - 1;
for Index := Low(AArray) to High(AArray) do
begin
if AArray[Index] = AValue then
begin
Result := Index;
Exit;
end;
end;
end;
function ArrayPos(const AValue: Char; const AArray: array of Char): Integer; overload;
var
Index: Integer;
@@ -2264,6 +2423,21 @@ begin
end;
end;
function ArrayPos(const AValue: UInt64; const AArray: array of UInt64): Integer; overload;
var
Index: Integer;
begin
Result := Low(AArray) - 1;
for Index := Low(AArray) to High(AArray) do
begin
if AArray[Index] = AValue then
begin
Result := Index;
Exit;
end;
end;
end;
function ArrayPos(const AValue: Single; const AArray: array of Single): Integer; overload;
var
Index: Integer;
@@ -2474,6 +2648,141 @@ begin
end;
end;
procedure ArrayDelete(var AArray: TVariantArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TCharArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TShortStringArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TStringArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TShortIntArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TSmallIntArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TIntegerArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TInt64Array; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TByteArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TWordArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TCardinalArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TUInt64Array; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TSingleArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TDoubleArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
procedure ArrayDelete(var AArray: TExtendedArray; Index: Integer; Count: Integer);
begin
if Count <> 0 then
begin
Move(AArray[Index + Count],AArray[Index],SizeOf(AArray[0]) * (Length(AArray) - Index - Count));
SetLength(AArray,Length(AArray) - Count);
end;
end;
function ExtractUserName(const Owner: String): String;
var
Index: Integer;

View File

@@ -3,7 +3,7 @@ unit uVirtObj;
//////////////////////////////////////
/// Lina Virtual Object Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}

View File

@@ -3,7 +3,7 @@ unit uWebCtrls;
//////////////////////////////////////
/// Lina Web Controls Unit ///
/// **************************** ///
/// (c) 2015 Dennis G�hlert a.o. ///
/// (c) 2016 Dennis G�hlert a.o. ///
//////////////////////////////////////
{$I 'Config.inc'}