diff --git a/Example/TCryptManager/pExample.dpr b/Example/TCryptManager/pExample.dpr new file mode 100644 index 0000000..7b51a69 --- /dev/null +++ b/Example/TCryptManager/pExample.dpr @@ -0,0 +1,14 @@ +program pExample; + +uses + Vcl.Forms, + uMain in 'uMain.pas' {fmMain}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TfmMain, fmMain); + Application.Run; +end. diff --git a/Example/TCryptManager/pExample.dproj b/Example/TCryptManager/pExample.dproj new file mode 100644 index 0000000..b0f2e4d --- /dev/null +++ b/Example/TCryptManager/pExample.dproj @@ -0,0 +1,170 @@ + + + {B2F1BE7E-2745-4B2F-A4DE-CA83E5CC75C5} + 15.3 + VCL + pExample.dpr + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + $(BDS)\bin\delphi_PROJECTICON.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + $(BDS)\bin\default_app.manifest + true + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + JvBDE;JvGlobus;O408br;JvMM;JvManagedThreads;FireDACSqliteDriver;DBXSqliteDriver;AbbreviaVCL;FireDACPgDriver;VampyreImagingPackage.D2009;fmx;JvDlgs;IndySystem;JvCrypt;TeeDB;frx19;inetdbbde;vclib;DBXInterBaseDriver;GR32_DSGN_RSXE5;DataSnapCommon;MiscrosoftScriptControls;pkCindyDERDXE5;JvNet;JvDotNetCtrls;DbxCommonDriver;vclimg;dbxcds;PieLib;vclshlctrls;MetropolisUILiveTile;JvXPCtrls;pkCindyPackDXE5;vcldb;vcldsnap;pkCindyIEDXE5;fmxFireDAC;pkCindyDBXDXE5;CustomIPTransport;JvCore;SynEdit_RXE5;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;DebenuPDFLibraryLite;DCEF_XE5;CodeSiteExpressPkg;IndyIPCommon;CloudService;FmxTeeUI;FireDACIBDriver;JvAppFrm;JvDB;JvRuntimeDesign;inetdbxpress;webdsnap;frxe19;JclDeveloperTools;JvDocking;adortl;JvWizards;frxDB19;FireDACASADriver;JvHMI;bindcompfmx;JvBands;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;JvPluginSystem;Tee;JclContainers;JvCmp;vclFireDAC;JvSystem;xmlrtl;svnui;ibxpress;SVATimer_DXE5;JvControls;JvTimeFramework;IndyProtocols;DBXMySQLDriver;djsonrt;FireDACCommonDriver;O408_r;bindengine;vclactnband;soaprtl;bindcompdbx;TeeUI;FMXTee;bindcompvcl;JvStdCtrls;JvCustom;Jcl;vclie;JvJans;JvPageComps;JvPrintPreview;pkCindyDBCtrlsPackDXE5;FireDACADSDriver;vcltouch;LINA_D_XE5;VclSmp;FireDAC;VCLRESTComponents;Intraweb;GR32_RSXE5;dsnapcon;inet;fmxobj;JclVcl;JvPascalInterpreter;FireDACMySQLDriver;vclx;svn;fmxdae;RESTComponents;bdertl;FireDACMSAccDriver;dbexpress;IndyIPClient;$(DCC_UsePackage) + + + O408br;FireDACSqliteDriver;DBXSqliteDriver;AbbreviaVCL;FireDACPgDriver;fmx;IndySystem;vclib;DBXInterBaseDriver;DataSnapCommon;DbxCommonDriver;vclimg;dbxcds;vclshlctrls;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;CustomIPTransport;SynEdit_RXE5;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;FireDACIBDriver;inetdbxpress;webdsnap;adortl;FireDACASADriver;bindcompfmx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;vclFireDAC;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;O408_r;bindengine;vclactnband;soaprtl;bindcompdbx;bindcompvcl;vclie;FireDACADSDriver;vcltouch;LINA_D_XE5;VclSmp;FireDAC;VCLRESTComponents;Intraweb;dsnapcon;inet;fmxobj;FireDACMySQLDriver;vclx;fmxdae;RESTComponents;FireDACMSAccDriver;dbexpress;IndyIPClient;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + +
fmMain
+ dfm +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + pExample.dpr + + + + + True + False + + + 12 + + + +
diff --git a/Example/TCryptManager/pExample.dproj.local b/Example/TCryptManager/pExample.dproj.local new file mode 100644 index 0000000..6c1ac22 --- /dev/null +++ b/Example/TCryptManager/pExample.dproj.local @@ -0,0 +1,40 @@ + + + + 1899.12.30 00:00:00.000.629,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.911,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.029,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.228,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\uMain.pas + 1899.12.30 00:00:00.000.505,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.438,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.832,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.376,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.579,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.086,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.036,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.283,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.634,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.044,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.562,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.012,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.689,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.779,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.120,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.963,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.256,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.169,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.228,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.dfm=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\uMain.dfm + 1899.12.30 00:00:00.000.191,C:\Users\Dennis G\Documents\RAD Studio\Projekte\Project1.dproj=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\pExample.dproj + 1899.12.30 00:00:00.000.028,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.726,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.541,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.129,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.165,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.957,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.106,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.356,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.177,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.215,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.333,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + + diff --git a/Example/TCryptManager/pExample.exe b/Example/TCryptManager/pExample.exe new file mode 100644 index 0000000..411752e Binary files /dev/null and b/Example/TCryptManager/pExample.exe differ diff --git a/Example/TCryptManager/pExample.identcache b/Example/TCryptManager/pExample.identcache new file mode 100644 index 0000000..3a5312f Binary files /dev/null and b/Example/TCryptManager/pExample.identcache differ diff --git a/Example/TCryptManager/pExample.res b/Example/TCryptManager/pExample.res new file mode 100644 index 0000000..d6cf632 Binary files /dev/null and b/Example/TCryptManager/pExample.res differ diff --git a/Example/TCryptManager/uMain.dfm b/Example/TCryptManager/uMain.dfm new file mode 100644 index 0000000..8185443 --- /dev/null +++ b/Example/TCryptManager/uMain.dfm @@ -0,0 +1,100 @@ +object fmMain: TfmMain + Left = 0 + Top = 0 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'LinaComponents "TCryptManager" Example' + ClientHeight = 281 + ClientWidth = 761 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object mmDecrypted: TMemo + Left = 8 + Top = 8 + Width = 330 + Height = 265 + Lines.Strings = ( + 'This is a sample test to show the usability of the' + '"TCryptManager" component from Lina Components' + 'for Delphi.') + ScrollBars = ssBoth + TabOrder = 0 + WordWrap = False + end + object mmEncrypted: TMemo + Left = 425 + Top = 8 + Width = 330 + Height = 265 + ScrollBars = ssBoth + TabOrder = 1 + WordWrap = False + end + object btEncrypt: TButton + Left = 344 + Top = 87 + Width = 75 + Height = 25 + Caption = 'Encrypt '#187 + TabOrder = 2 + OnClick = btEncryptClick + end + object rgMode: TRadioGroup + Left = 344 + Top = 8 + Width = 75 + Height = 73 + Caption = 'Mode' + Items.Strings = ( + 'Xor' + 'Caesar' + 'Vigenere') + TabOrder = 3 + OnClick = rgModeClick + end + object btDecrypt: TButton + Left = 344 + Top = 118 + Width = 75 + Height = 25 + Caption = #171' Decrypt' + TabOrder = 4 + OnClick = btDecryptClick + end + object leKey: TLabeledEdit + Left = 344 + Top = 221 + Width = 75 + Height = 21 + CharCase = ecUpperCase + EditLabel.Width = 22 + EditLabel.Height = 13 + EditLabel.Caption = 'Key:' + TabOrder = 5 + OnChange = leKeyChange + OnContextPopup = leKeyContextPopup + OnKeyPress = leKeyKeyPress + end + object brGenerate: TButton + Left = 344 + Top = 248 + Width = 75 + Height = 25 + Caption = 'Generate' + TabOrder = 6 + OnClick = brGenerateClick + end + object CryptManager: TCryptManager + Left = 704 + Top = 8 + end +end diff --git a/Example/TCryptManager/uMain.pas b/Example/TCryptManager/uMain.pas new file mode 100644 index 0000000..4da9c93 --- /dev/null +++ b/Example/TCryptManager/uMain.pas @@ -0,0 +1,105 @@ +unit uMain; + +////////////////////////////////////// +/// Lina Cryption Example /// +/// **************************** /// +/// (c) 2014 Dennis Göhlert a.o. /// +////////////////////////////////////// + +{$IF CompilerVersion <> 26.0} + {$MESSAGE ERROR 'This example was written to compile under Delphi XE5'} +{$ENDIF} + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, uBase, + uSysCtrls, uSysTools; + +type + TfmMain = class(TForm) + mmDecrypted: TMemo; + mmEncrypted: TMemo; + btEncrypt: TButton; + rgMode: TRadioGroup; + btDecrypt: TButton; + leKey: TLabeledEdit; + CryptManager: TCryptManager; + brGenerate: TButton; + procedure rgModeClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + procedure btEncryptClick(Sender: TObject); + procedure btDecryptClick(Sender: TObject); + procedure leKeyChange(Sender: TObject); + procedure leKeyKeyPress(Sender: TObject; var Key: Char); + procedure leKeyContextPopup(Sender: TObject; MousePos: TPoint; + var Handled: Boolean); + procedure brGenerateClick(Sender: TObject); + private + { Private-Deklarationen } + public + { Public-Deklarationen } + end; + +var + fmMain: TfmMain; + +implementation + +{$R *.dfm} + +procedure TfmMain.btEncryptClick(Sender: TObject); +begin + CryptManager.Decrypted.Assign(mmDecrypted.Lines); + mmEncrypted.Lines.Assign(CryptManager.Encrypted); +end; + +procedure TfmMain.brGenerateClick(Sender: TObject); +begin + leKey.Text := CryptManager.GenerateKey; +end; + +procedure TfmMain.btDecryptClick(Sender: TObject); +begin + CryptManager.Encrypted.Assign(mmEncrypted.Lines); + mmDecrypted.Lines.Assign(CryptManager.Decrypted); +end; + +procedure TfmMain.FormCreate(Sender: TObject); +begin + rgMode.ItemIndex := 0; +end; + +procedure TfmMain.leKeyChange(Sender: TObject); +begin + CryptManager.Key := leKey.Text; +end; + +procedure TfmMain.leKeyContextPopup(Sender: TObject; MousePos: TPoint; + var Handled: Boolean); +begin + Handled := True; +end; + +procedure TfmMain.leKeyKeyPress(Sender: TObject; var Key: Char); +begin + if (Key in Numbers + Letters) and (CryptManager.ValidKey(leKey.Text + Key) = False) then + begin + Key := #0; + end; +end; + +procedure TfmMain.rgModeClick(Sender: TObject); +begin + leKey.Clear; + leKey.NumbersOnly := rgMode.ItemIndex = 0; + leKey.MaxLength := Abs(BoolToInt(rgMode.ItemIndex = 1)); + case rgMode.ItemIndex of + 0: CryptManager.Mode := cmXor; + 1: CryptManager.Mode := cmCaesar; + 2: CryptManager.Mode := cmVigenere; + end; +end; + +end. diff --git a/Example/TDelphiManager/pExample.dpr b/Example/TDelphiManager/pExample.dpr new file mode 100644 index 0000000..7b51a69 --- /dev/null +++ b/Example/TDelphiManager/pExample.dpr @@ -0,0 +1,14 @@ +program pExample; + +uses + Vcl.Forms, + uMain in 'uMain.pas' {fmMain}; + +{$R *.res} + +begin + Application.Initialize; + Application.MainFormOnTaskbar := True; + Application.CreateForm(TfmMain, fmMain); + Application.Run; +end. diff --git a/Example/TDelphiManager/pExample.dproj b/Example/TDelphiManager/pExample.dproj new file mode 100644 index 0000000..b0f2e4d --- /dev/null +++ b/Example/TDelphiManager/pExample.dproj @@ -0,0 +1,170 @@ + + + {B2F1BE7E-2745-4B2F-A4DE-CA83E5CC75C5} + 15.3 + VCL + pExample.dpr + True + Debug + Win32 + 1 + Application + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_1 + true + true + + + true + Base + true + + + $(BDS)\bin\delphi_PROJECTICON.ico + System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) + .\$(Platform)\$(Config) + .\$(Platform)\$(Config) + false + false + false + false + false + + + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + $(BDS)\bin\default_app.manifest + true + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + JvBDE;JvGlobus;O408br;JvMM;JvManagedThreads;FireDACSqliteDriver;DBXSqliteDriver;AbbreviaVCL;FireDACPgDriver;VampyreImagingPackage.D2009;fmx;JvDlgs;IndySystem;JvCrypt;TeeDB;frx19;inetdbbde;vclib;DBXInterBaseDriver;GR32_DSGN_RSXE5;DataSnapCommon;MiscrosoftScriptControls;pkCindyDERDXE5;JvNet;JvDotNetCtrls;DbxCommonDriver;vclimg;dbxcds;PieLib;vclshlctrls;MetropolisUILiveTile;JvXPCtrls;pkCindyPackDXE5;vcldb;vcldsnap;pkCindyIEDXE5;fmxFireDAC;pkCindyDBXDXE5;CustomIPTransport;JvCore;SynEdit_RXE5;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;DebenuPDFLibraryLite;DCEF_XE5;CodeSiteExpressPkg;IndyIPCommon;CloudService;FmxTeeUI;FireDACIBDriver;JvAppFrm;JvDB;JvRuntimeDesign;inetdbxpress;webdsnap;frxe19;JclDeveloperTools;JvDocking;adortl;JvWizards;frxDB19;FireDACASADriver;JvHMI;bindcompfmx;JvBands;vcldbx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;JvPluginSystem;Tee;JclContainers;JvCmp;vclFireDAC;JvSystem;xmlrtl;svnui;ibxpress;SVATimer_DXE5;JvControls;JvTimeFramework;IndyProtocols;DBXMySQLDriver;djsonrt;FireDACCommonDriver;O408_r;bindengine;vclactnband;soaprtl;bindcompdbx;TeeUI;FMXTee;bindcompvcl;JvStdCtrls;JvCustom;Jcl;vclie;JvJans;JvPageComps;JvPrintPreview;pkCindyDBCtrlsPackDXE5;FireDACADSDriver;vcltouch;LINA_D_XE5;VclSmp;FireDAC;VCLRESTComponents;Intraweb;GR32_RSXE5;dsnapcon;inet;fmxobj;JclVcl;JvPascalInterpreter;FireDACMySQLDriver;vclx;svn;fmxdae;RESTComponents;bdertl;FireDACMSAccDriver;dbexpress;IndyIPClient;$(DCC_UsePackage) + + + O408br;FireDACSqliteDriver;DBXSqliteDriver;AbbreviaVCL;FireDACPgDriver;fmx;IndySystem;vclib;DBXInterBaseDriver;DataSnapCommon;DbxCommonDriver;vclimg;dbxcds;vclshlctrls;MetropolisUILiveTile;vcldb;vcldsnap;fmxFireDAC;CustomIPTransport;SynEdit_RXE5;vclribbon;dsnap;IndyIPServer;fmxase;vcl;IndyCore;IndyIPCommon;CloudService;FireDACIBDriver;inetdbxpress;webdsnap;adortl;FireDACASADriver;bindcompfmx;FireDACODBCDriver;rtl;dbrtl;DbxClientDriver;FireDACCommon;bindcomp;vclFireDAC;xmlrtl;ibxpress;IndyProtocols;DBXMySQLDriver;FireDACCommonDriver;O408_r;bindengine;vclactnband;soaprtl;bindcompdbx;bindcompvcl;vclie;FireDACADSDriver;vcltouch;LINA_D_XE5;VclSmp;FireDAC;VCLRESTComponents;Intraweb;dsnapcon;inet;fmxobj;FireDACMySQLDriver;vclx;fmxdae;RESTComponents;FireDACMSAccDriver;dbexpress;IndyIPClient;$(DCC_UsePackage) + + + DEBUG;$(DCC_Define) + true + false + true + true + true + + + false + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + + MainSource + + +
fmMain
+ dfm +
+ + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + +
+ + Delphi.Personality.12 + + + + + False + False + 1 + 0 + 0 + 0 + False + False + False + False + False + 1031 + 1252 + + + + + 1.0.0.0 + + + + + + 1.0.0.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + pExample.dpr + + + + + True + False + + + 12 + + + +
diff --git a/Example/TDelphiManager/pExample.dproj.local b/Example/TDelphiManager/pExample.dproj.local new file mode 100644 index 0000000..1c08d57 --- /dev/null +++ b/Example/TDelphiManager/pExample.dproj.local @@ -0,0 +1,40 @@ + + + + 1899.12.30 00:00:00.000.541,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.177,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.356,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.333,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.963,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.120,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.215,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.165,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.129,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.106,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.957,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.779,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.438,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.169,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.911,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.726,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.832,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.029,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.283,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.036,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.579,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.376,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.191,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\pExample.dproj=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Project1.dproj + 1899.12.30 00:00:00.000.228,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\uMain.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.086,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.228,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Example\TContextMenu\uMain.dfm=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.dfm + 1899.12.30 00:00:00.000.634,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.256,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.505,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.028,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.629,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.562,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.044,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.689,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + 1899.12.30 00:00:00.000.012,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\Unit1.pas + + diff --git a/Example/TDelphiManager/pExample.exe b/Example/TDelphiManager/pExample.exe new file mode 100644 index 0000000..36daf12 Binary files /dev/null and b/Example/TDelphiManager/pExample.exe differ diff --git a/Example/TDelphiManager/pExample.identcache b/Example/TDelphiManager/pExample.identcache new file mode 100644 index 0000000..81d0b01 Binary files /dev/null and b/Example/TDelphiManager/pExample.identcache differ diff --git a/Example/TDelphiManager/pExample.res b/Example/TDelphiManager/pExample.res new file mode 100644 index 0000000..d6cf632 Binary files /dev/null and b/Example/TDelphiManager/pExample.res differ diff --git a/Example/TDelphiManager/uMain.dfm b/Example/TDelphiManager/uMain.dfm new file mode 100644 index 0000000..dd440b0 --- /dev/null +++ b/Example/TDelphiManager/uMain.dfm @@ -0,0 +1,80 @@ +object fmMain: TfmMain + Left = 0 + Top = 0 + BorderIcons = [biSystemMenu, biMinimize] + BorderStyle = bsSingle + Caption = 'LinaComponents "TDelphiManager" Example' + ClientHeight = 219 + ClientWidth = 474 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] + OldCreateOrder = False + Position = poScreenCenter + OnCreate = FormCreate + PixelsPerInch = 96 + TextHeight = 13 + object rgVersions: TRadioGroup + Left = 8 + Top = 8 + Width = 371 + Height = 185 + Caption = 'Installed Delphi versions' + TabOrder = 0 + end + object pnButtons: TPanel + Left = 385 + Top = 0 + Width = 89 + Height = 200 + Align = alRight + TabOrder = 1 + ExplicitHeight = 201 + object btLaunch: TButton + Left = 8 + Top = 168 + Width = 75 + Height = 25 + Caption = 'Launch' + Default = True + TabOrder = 2 + OnClick = btLaunchClick + end + object btRefresh: TButton + Left = 8 + Top = 8 + Width = 75 + Height = 25 + Caption = 'Refresh' + TabOrder = 0 + OnClick = btRefreshClick + end + object btInfo: TButton + Left = 8 + Top = 137 + Width = 75 + Height = 25 + Caption = 'Info' + TabOrder = 1 + OnClick = btInfoClick + end + end + object StatusBar: TStatusBar + Left = 0 + Top = 200 + Width = 474 + Height = 19 + Panels = <> + SimplePanel = True + ExplicitLeft = 192 + ExplicitTop = 208 + ExplicitWidth = 0 + end + object DelphiManager: TDelphiManager + Left = 40 + Top = 32 + end +end diff --git a/Example/TDelphiManager/uMain.pas b/Example/TDelphiManager/uMain.pas new file mode 100644 index 0000000..320b231 --- /dev/null +++ b/Example/TDelphiManager/uMain.pas @@ -0,0 +1,93 @@ +unit uMain; + +////////////////////////////////////// +/// Lina Delphi Manager Example /// +/// **************************** /// +/// (c) 2014 Dennis Göhlert a.o. /// +////////////////////////////////////// + +{$IF CompilerVersion <> 26.0} + {$MESSAGE ERROR 'This example was written to compile under Delphi XE5'} +{$ENDIF} + +interface + +uses + Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, + Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, uBase, + uSysCtrls, Vcl.ComCtrls; + +type + TfmMain = class(TForm) + rgVersions: TRadioGroup; + pnButtons: TPanel; + btLaunch: TButton; + btRefresh: TButton; + DelphiManager: TDelphiManager; + btInfo: TButton; + StatusBar: TStatusBar; + procedure FormCreate(Sender: TObject); + procedure btRefreshClick(Sender: TObject); + procedure btLaunchClick(Sender: TObject); + procedure btInfoClick(Sender: TObject); + private + { Private-Deklarationen } + public + { Public-Deklarationen } + end; + +var + fmMain: TfmMain; + +implementation + +{$R *.dfm} + +procedure TfmMain.btInfoClick(Sender: TObject); +begin + MessageDlg(DelphiVersionToFullName(NameToDelphiVersion(rgVersions.Items.Strings[rgVersions.ItemIndex])) + + sLineBreak + 'Code name: ' + DelphiVersionToCodeName(NameToDelphiVersion(rgVersions.Items.Strings[rgVersions.ItemIndex])) + + sLineBreak + 'Product version: ' + IntToStr(DelphiVersionToProductVersion(NameToDelphiVersion(rgVersions.Items.Strings[rgVersions.ItemIndex]))) + + sLineBreak + 'Package version: ' + IntToStr(DelphiVersionToPackageVersion(NameToDelphiVersion(rgVersions.Items.Strings[rgVersions.ItemIndex]))), + mtInformation,[mbOK],0); +end; + +procedure TfmMain.btLaunchClick(Sender: TObject); +begin + DelphiManager.Launch(NameToDelphiVersion(rgVersions.Items.Strings[rgVersions.ItemIndex])); +end; + +procedure TfmMain.btRefreshClick(Sender: TObject); +var + Installed: TDelphiVersions; + Index: TDelphiVersion; +begin + rgVersions.Items.Clear; + Installed := DelphiManager.Installed; + for Index := Low(TDelphiVersion) to High(TDelphiVersion) do + begin + if Index in Installed then + begin + rgVersions.Items.Add(DelphiVersionToName(Index)); + end; + end; + if rgVersions.Items.Count <> 0 then + begin + rgVersions.ItemIndex := 0; + btInfo.Enabled := True; + btLaunch.Enabled := True; + end else + begin + rgVersions.ItemIndex := -1; + btInfo.Enabled := False; + btLaunch.Enabled := False; + end; +end; + +procedure TfmMain.FormCreate(Sender: TObject); +begin + StatusBar.SimpleText := 'Built with ' + DelphiManager.VersionFullName + ' "' + DelphiManager.VersionCodeName + '" and Lina Components v' + FloatToStr(DelphiManager.LinaVersion) + ' for ' + DelphiManager.LocalPlatformFullName; + btRefresh.Click; +end; + +end. diff --git a/Example/TLocalizationManager/pExample.exe b/Example/TLocalizationManager/pExample.exe index 37b9b5d..99afced 100644 Binary files a/Example/TLocalizationManager/pExample.exe and b/Example/TLocalizationManager/pExample.exe differ diff --git a/Example/TLocalizationManager/pExample.identcache b/Example/TLocalizationManager/pExample.identcache index e508cbb..f6cb760 100644 Binary files a/Example/TLocalizationManager/pExample.identcache and b/Example/TLocalizationManager/pExample.identcache differ diff --git a/Example/TLocalizationManager/uMain.dfm b/Example/TLocalizationManager/uMain.dfm index 0bdd3f9..d3fcf70 100644 --- a/Example/TLocalizationManager/uMain.dfm +++ b/Example/TLocalizationManager/uMain.dfm @@ -31,7 +31,6 @@ object Form1: TForm1 Height = 41 Align = alBottom TabOrder = 0 - ExplicitTop = 139 object btClose: TButton Left = 8 Top = 8 @@ -112,7 +111,7 @@ object Form1: TForm1 Indent = 'Coding' Field = 'Caption' end> - Left = 240 - Top = 32 + Left = 280 + Top = 24 end end diff --git a/Example/TLocalizationManager/uMain.pas b/Example/TLocalizationManager/uMain.pas index 7380544..37250da 100644 --- a/Example/TLocalizationManager/uMain.pas +++ b/Example/TLocalizationManager/uMain.pas @@ -52,8 +52,13 @@ begin end; procedure TForm1.btHelloClick(Sender: TObject); +//var g: TLocalizationGenerator; begin - ShowMessage(HelloWorld); +//g := TLocalizationGenerator.Create(LocalizationManager.Data); +// ShowMessage(HelloWorld); +//showmessage(g.Localization.Lines.Text); +//g.Free; +showmessage((localizationmanager.Localizations.Items[LocalizationManager.Current] as TLocalization).Name); end; procedure TForm1.coEncodingChange(Sender: TObject); @@ -75,12 +80,12 @@ end; procedure TForm1.FormCreate(Sender: TObject); var Index: Integer; - LanguageFiles: TStrings; + // LanguageFiles: TStrings; begin LocalizationManager.References.Add; HelloWorld := 'Hello,' + #10 + 'World!'; (LocalizationManager.References.Items[0] as TLocalizationReference).Reference := @HelloWorld; - LanguageFiles := TStringList.Create; + {LanguageFiles := TStringList.Create; ListFiles(ExtractFileDir(Application.ExeName),LanguageFiles,['*.loc']); lbLanguage.Items.Assign(LanguageFiles); for Index := 0 to LanguageFiles.Count - 1 do @@ -92,7 +97,12 @@ begin // if (LocalizationManager.Localizations.Items[Index] as TLocalization).Lines.DefaultEncoding = TEncoding.ANSI then showmessage(''); // TLocalization(LocalizationManager.Localizations.Items[Index]).Encoding := ceANSI; end; - //LocalizationManager.Applier.ApplyMode := laMainForm; + //LocalizationManager.Applier.ApplyMode := laMainForm; } + LocalizationManager.Localizations.LoadFromDirectory(ExtractFileDir(Application.ExeName),['*.loc']); + for Index := 0 to LocalizationManager.Localizations.Count - 1 do + begin + lbLanguage.Items.Add((LocalizationManager.Localizations.Items[Index] as TLocalization).Name); + end; end; procedure TForm1.lbLanguageClick(Sender: TObject); diff --git a/Information/Statistics.txt b/Information/Statistics.txt index 164cbc0..a910116 100644 --- a/Information/Statistics.txt +++ b/Information/Statistics.txt @@ -1,4 +1,4 @@ These statistics cover the official repository of Lina Components. -Total lines of code (LoC): 10300+ -Total visual components (VC): 17 \ No newline at end of file +Total lines of code (LoC): 12000+ +Total visual components (VC): 20 \ No newline at end of file diff --git a/Package/Delphi_XE5/LINA_D_XE5.dpk b/Package/Delphi_XE5/LINA_D_XE5.dpk index 775f407..4664838 100644 --- a/Package/Delphi_XE5/LINA_D_XE5.dpk +++ b/Package/Delphi_XE5/LINA_D_XE5.dpk @@ -41,7 +41,7 @@ package LINA_D_XE5; requires rtl, vcl, - dbrtl, + vclx, PascalScript_Core_D19, IndySystem, IndyProtocols, @@ -60,7 +60,9 @@ contains uAdvCtrls in '..\..\Source\uAdvCtrls.pas', uWebCtrls in '..\..\Source\uWebCtrls.pas', uFileCtrls in '..\..\Source\uFileCtrls.pas', - uInit in '..\..\Source\uInit.pas', + {$IFDEF WIN32} + uInit in '..\..\Source\uInit.pas', + {$ENDIF} uCalc in '..\..\Source\uCalc.pas'; end. diff --git a/Package/Delphi_XE5/LINA_D_XE5.dproj b/Package/Delphi_XE5/LINA_D_XE5.dproj index a89a75b..7d731e8 100644 --- a/Package/Delphi_XE5/LINA_D_XE5.dproj +++ b/Package/Delphi_XE5/LINA_D_XE5.dproj @@ -115,7 +115,7 @@ - + diff --git a/Package/Delphi_XE5/LINA_D_XE5.dproj.local b/Package/Delphi_XE5/LINA_D_XE5.dproj.local index bb605d8..1c3cc35 100644 --- a/Package/Delphi_XE5/LINA_D_XE5.dproj.local +++ b/Package/Delphi_XE5/LINA_D_XE5.dproj.local @@ -1,50 +1,53 @@  - 1899.12.30 00:00:00.000.681,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc= - 1899.12.30 00:00:00.000.809,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc - 1899.12.30 00:00:00.000.204,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFileCtrls.pas - 1899.12.30 00:00:00.000.508,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBase.pas 1899.12.30 00:00:00.000.576,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uSysTools.pas - 1899.12.30 00:00:00.000.325,=dbrtl.dcp - 1899.12.30 00:00:00.000.412,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas - 1899.12.30 00:00:00.000.674,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas - 1899.12.30 00:00:00.000.675,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas 1899.12.30 00:00:00.000.592,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uFileTools.pas - 1899.12.30 00:00:00.000.411,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uAdvCtrls.pas - 1899.12.30 00:00:00.000.621,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas - 1899.12.30 00:00:00.000.318,=vcl.dcp - 1899.12.30 00:00:00.000.414,C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas= - 1899.12.30 00:00:00.000.577,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBattery.pas - 1899.12.30 00:00:00.000.556,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uLocalMgr.pas - 1899.12.30 00:00:00.000.143,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm + 1899.12.30 00:00:00.000.508,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBase.pas 1899.12.30 00:00:00.000.518,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBattery.pas 1899.12.30 00:00:00.000.650,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBattery.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uSysCtrls.pas + 1899.12.30 00:00:00.000.204,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFileCtrls.pas + 1899.12.30 00:00:00.000.411,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uAdvCtrls.pas + 1899.12.30 00:00:00.000.675,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas + 1899.12.30 00:00:00.000.809,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc + 1899.12.30 00:00:00.000.325,=dbrtl.dcp + 1899.12.30 00:00:00.000.681,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc= + 1899.12.30 00:00:00.000.934,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\Config.inc + 1899.12.30 00:00:00.000.414,C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas= + 1899.12.30 00:00:00.000.621,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas + 1899.12.30 00:00:00.000.556,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uLocalMgr.pas + 1899.12.30 00:00:00.000.577,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBattery.pas + 1899.12.30 00:00:00.000.861,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Settings.inc + 1899.12.30 00:00:00.000.318,=vcl.dcp 1899.12.30 00:00:00.000.648,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uScriptMgr.pas - 1899.12.30 00:00:00.000.896,C:\Users\Dennis G\Documents\CodeQuality.htm= + 1899.12.30 00:00:00.000.938,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\Config.inc 1899.12.30 00:00:00.000.537,C:\Users\Dennis G\Documents\CodeQuality.htm=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm + 1899.12.30 00:00:00.000.143,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm + 1899.12.30 00:00:00.000.896,C:\Users\Dennis G\Documents\CodeQuality.htm= + 1899.12.30 00:00:00.000.412,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas 1899.12.30 00:00:00.000.971,=IndySystem.dcp 1899.12.30 00:00:00.000.555,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBase.pas - 1899.12.30 00:00:00.000.196,=rtl.dcp - 1899.12.30 00:00:00.000.525,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCrypt.pas 1899.12.30 00:00:00.000.584,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uVirtObj.pas + 1899.12.30 00:00:00.000.686,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uSysTools.pas + 1899.12.30 00:00:00.000.196,=rtl.dcp 1899.12.30 00:00:00.000.075,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCalc.pas 1899.12.30 00:00:00.000.118,=IndyCore.dcp 1899.12.30 00:00:00.000.535,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFileTools.pas 1899.12.30 00:00:00.000.633,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLocalMgr.pas - 1899.12.30 00:00:00.000.686,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uSysTools.pas + 1899.12.30 00:00:00.000.525,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCrypt.pas 1899.12.30 00:00:00.000.672,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uFrmCtrls.pas - 1899.12.30 00:00:00.000.932,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas - 1899.12.30 00:00:00.000.173,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uInit.pas - 1899.12.30 00:00:00.000.791,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas - 1899.12.30 00:00:00.000.837,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas - 1899.12.30 00:00:00.000.582,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uWebCtrls.pas - 1899.12.30 00:00:00.000.566,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uScriptMgr.pas - 1899.12.30 00:00:00.000.045,=IndyProtocols.dcp 1899.12.30 00:00:00.000.633,C:\Users\Dennis\Documents\RAD Studio\Projekte\Package1.dproj=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\LINA_D_XE5.dproj + 1899.12.30 00:00:00.000.582,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uWebCtrls.pas + 1899.12.30 00:00:00.000.932,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas + 1899.12.30 00:00:00.000.837,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas + 1899.12.30 00:00:00.000.791,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas + 1899.12.30 00:00:00.000.674,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas + 1899.12.30 00:00:00.000.173,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uInit.pas 1899.12.30 00:00:00.000.857,=PascalScript_Core_D19.dcp - 1899.12.30 00:00:00.000.546,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFrmCtrls.pas + 1899.12.30 00:00:00.000.045,=IndyProtocols.dcp 1899.12.30 00:00:00.000.799,=PascalScript_Core_D19.dcp + 1899.12.30 00:00:00.000.566,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uScriptMgr.pas + 1899.12.30 00:00:00.000.546,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFrmCtrls.pas @@ -75,12 +78,12 @@ - + diff --git a/Package/Delphi_XE5/LINA_D_XE5.identcache b/Package/Delphi_XE5/LINA_D_XE5.identcache index b173661..abd1c66 100644 Binary files a/Package/Delphi_XE5/LINA_D_XE5.identcache and b/Package/Delphi_XE5/LINA_D_XE5.identcache differ diff --git a/Resource/Bitmap/Large/TCryptManager.bmp b/Resource/Bitmap/Large/TCryptManager.bmp new file mode 100644 index 0000000..ab3347b Binary files /dev/null and b/Resource/Bitmap/Large/TCryptManager.bmp differ diff --git a/Resource/Bitmap/Large/TDelphiManager.bmp b/Resource/Bitmap/Large/TDelphiManager.bmp new file mode 100644 index 0000000..df9755e Binary files /dev/null and b/Resource/Bitmap/Large/TDelphiManager.bmp differ diff --git a/Resource/Bitmap/Large/TStringContainer.bmp b/Resource/Bitmap/Large/TStringContainer.bmp new file mode 100644 index 0000000..9406ea7 Binary files /dev/null and b/Resource/Bitmap/Large/TStringContainer.bmp differ diff --git a/Resource/Bitmap/Large/TValueEdit.bmp b/Resource/Bitmap/Large/TValueEdit.bmp new file mode 100644 index 0000000..51d1f38 Binary files /dev/null and b/Resource/Bitmap/Large/TValueEdit.bmp differ diff --git a/Resource/Bitmap/Small/TCryptManager.bmp b/Resource/Bitmap/Small/TCryptManager.bmp new file mode 100644 index 0000000..f51de70 Binary files /dev/null and b/Resource/Bitmap/Small/TCryptManager.bmp differ diff --git a/Resource/Bitmap/Small/TDelphiManager.bmp b/Resource/Bitmap/Small/TDelphiManager.bmp new file mode 100644 index 0000000..67bf58a Binary files /dev/null and b/Resource/Bitmap/Small/TDelphiManager.bmp differ diff --git a/Resource/Bitmap/Small/TSizePanel.bmp b/Resource/Bitmap/Small/TSizePanel.bmp new file mode 100644 index 0000000..92bb68a Binary files /dev/null and b/Resource/Bitmap/Small/TSizePanel.bmp differ diff --git a/Resource/Bitmap/Small/TStringContainer.bmp b/Resource/Bitmap/Small/TStringContainer.bmp new file mode 100644 index 0000000..714d8d8 Binary files /dev/null and b/Resource/Bitmap/Small/TStringContainer.bmp differ diff --git a/Resource/Bitmap/TCryptManager.bmp b/Resource/Bitmap/TCryptManager.bmp new file mode 100644 index 0000000..c726bb5 Binary files /dev/null and b/Resource/Bitmap/TCryptManager.bmp differ diff --git a/Resource/Bitmap/TDelphiManager.bmp b/Resource/Bitmap/TDelphiManager.bmp new file mode 100644 index 0000000..17a64db Binary files /dev/null and b/Resource/Bitmap/TDelphiManager.bmp differ diff --git a/Resource/Bitmap/TStringContainer.bmp b/Resource/Bitmap/TStringContainer.bmp new file mode 100644 index 0000000..d2d0b45 Binary files /dev/null and b/Resource/Bitmap/TStringContainer.bmp differ diff --git a/Resource/Bitmap/TValueEdit.bmp b/Resource/Bitmap/TValueEdit.bmp new file mode 100644 index 0000000..b61787e Binary files /dev/null and b/Resource/Bitmap/TValueEdit.bmp differ diff --git a/Resource/Compiled/uAdvCtrls.dcr b/Resource/Compiled/uAdvCtrls.dcr index 1f29e7c..c6c4f69 100644 Binary files a/Resource/Compiled/uAdvCtrls.dcr and b/Resource/Compiled/uAdvCtrls.dcr differ diff --git a/Resource/Compiled/uSysCtrls.dcr b/Resource/Compiled/uSysCtrls.dcr index b3959a4..883c419 100644 Binary files a/Resource/Compiled/uSysCtrls.dcr and b/Resource/Compiled/uSysCtrls.dcr differ diff --git a/Resource/LINA.rc b/Resource/LINA.rc index e3cb67f..9add5ea 100644 --- a/Resource/LINA.rc +++ b/Resource/LINA.rc @@ -14,9 +14,15 @@ TCOMPONENTMANAGER32 BITMAP "Bitmap\Large\TComponentManager.bmp" TCONTEXTMENU BITMAP "Bitmap\TContextMenu.bmp" TCONTEXTMENU16 BITMAP "Bitmap\Small\TContextMenu.bmp" TCONTEXTMENU32 BITMAP "Bitmap\Large\TContextMenu.bmp" +TCRYPTMANAGER BITMAP "Bitmap\TCryptManager.bmp" +TCRYPTMANAGER16 BITMAP "Bitmap\Small\TCryptManager.bmp" +TCRYPTMANAGER32 BITMAP "Bitmap\Large\TCryptManager.bmp" TCURSORFIX BITMAP "Bitmap\TCursorFix.bmp" TCURSORFIX16 BITMAP "Bitmap\Small\TCursorFix.bmp" TCURSORFIX32 BITMAP "Bitmap\Large\TCursorFix.bmp" +TDELPHIMANAGER BITMAP "Bitmap\TDelphiManager.bmp" +TDELPHIMANAGER16 BITMAP "Bitmap\Small\TDelphiManager.bmp" +TDELPHIMANAGER32 BITMAP "Bitmap\Large\TDelphiManager.bmp" TDOWNLOAD BITMAP "Bitmap\TDownload.bmp" TDOWNLOAD16 BITMAP "Bitmap\Small\TDownload.bmp" TDOWNLOAD32 BITMAP "Bitmap\Large\TDownload.bmp" @@ -41,9 +47,18 @@ TSCROLLLISTBOX32 BITMAP "Bitmap\Large\TScrollListBox.bmp" TSHORTCUTLABEL BITMAP "Bitmap\TShortcutLabel.bmp" TSHORTCUTLABEL16 BITMAP "Bitmap\Small\TShortcutLabel.bmp" TSHORTCUTLABEL32 BITMAP "Bitmap\Large\TShortcutLabel.bmp" +TSIZEPANEL BITMAP "Bitmap\TSizePanel.bmp" +TSIZEPANEL16 BITMAP "Bitmap\Small\TSizePanel.bmp" +TSIZEPANEL32 BITMAP "Bitmap\Large\TSizePanel.bmp" TSPLASHSCREEN BITMAP "Bitmap\TSplashScreen.bmp" TSPLASHSCREEN16 BITMAP "Bitmap\Small\TSplashScreen.bmp" TSPLASHSCREEN32 BITMAP "Bitmap\Large\TSplashScreen.bmp" +TSTRINGCONTAINER BITMAP "Bitmap\TStringContainer.bmp" +TSTRINGCONTAINER16 BITMAP "Bitmap\Small\TStringContainer.bmp" +TSTRINGCONTAINER32 BITMAP "Bitmap\Large\TStringContainer.bmp" +TVALUEEDIT BITMAP "Bitmap\TValueEdit.bmp" +TVALUEEDIT16 BITMAP "Bitmap\Small\TValueEdit.bmp" +TVALUEEDIT32 BITMAP "Bitmap\Large\TValueEdit.bmp" TVIRTUALPROGRAM BITMAP "Bitmap\TVirtualProgram.bmp" TVIRTUALPROGRAM16 BITMAP "Bitmap\Small\TVirtualProgram.bmp" TVIRTUALPROGRAM32 BITMAP "Bitmap\Large\TVirtualProgram.bmp" \ No newline at end of file diff --git a/Source/Compiled/uAdvCtrls.dcu b/Source/Compiled/uAdvCtrls.dcu index 6437fbb..558a427 100644 Binary files a/Source/Compiled/uAdvCtrls.dcu and b/Source/Compiled/uAdvCtrls.dcu differ diff --git a/Source/Compiled/uBase.dcu b/Source/Compiled/uBase.dcu index 05377cb..d8431de 100644 Binary files a/Source/Compiled/uBase.dcu and b/Source/Compiled/uBase.dcu differ diff --git a/Source/Compiled/uCalc.dcu b/Source/Compiled/uCalc.dcu index c8dd1e7..d9e829d 100644 Binary files a/Source/Compiled/uCalc.dcu and b/Source/Compiled/uCalc.dcu differ diff --git a/Source/Compiled/uCrypt.dcu b/Source/Compiled/uCrypt.dcu index 0d8fdc0..888d507 100644 Binary files a/Source/Compiled/uCrypt.dcu and b/Source/Compiled/uCrypt.dcu differ diff --git a/Source/Compiled/uFileCtrls.dcu b/Source/Compiled/uFileCtrls.dcu index f27a641..a4d9b6d 100644 Binary files a/Source/Compiled/uFileCtrls.dcu and b/Source/Compiled/uFileCtrls.dcu differ diff --git a/Source/Compiled/uFileTools.dcu b/Source/Compiled/uFileTools.dcu index 6dadd2a..402fd80 100644 Binary files a/Source/Compiled/uFileTools.dcu and b/Source/Compiled/uFileTools.dcu differ diff --git a/Source/Compiled/uFrmCtrls.dcu b/Source/Compiled/uFrmCtrls.dcu index f233401..35a27f9 100644 Binary files a/Source/Compiled/uFrmCtrls.dcu and b/Source/Compiled/uFrmCtrls.dcu differ diff --git a/Source/Compiled/uInit.dcu b/Source/Compiled/uInit.dcu index 497d0c4..9b4689d 100644 Binary files a/Source/Compiled/uInit.dcu and b/Source/Compiled/uInit.dcu differ diff --git a/Source/Compiled/uLocalMgr.dcu b/Source/Compiled/uLocalMgr.dcu index 0cafc8c..982ea6f 100644 Binary files a/Source/Compiled/uLocalMgr.dcu and b/Source/Compiled/uLocalMgr.dcu differ diff --git a/Source/Compiled/uScriptMgr.dcu b/Source/Compiled/uScriptMgr.dcu index 1a4114f..6161b18 100644 Binary files a/Source/Compiled/uScriptMgr.dcu and b/Source/Compiled/uScriptMgr.dcu differ diff --git a/Source/Compiled/uSysCtrls.dcu b/Source/Compiled/uSysCtrls.dcu index 2d1bb9a..9603bbe 100644 Binary files a/Source/Compiled/uSysCtrls.dcu and b/Source/Compiled/uSysCtrls.dcu differ diff --git a/Source/Compiled/uSysTools.dcu b/Source/Compiled/uSysTools.dcu index a5df079..38ba830 100644 Binary files a/Source/Compiled/uSysTools.dcu and b/Source/Compiled/uSysTools.dcu differ diff --git a/Source/Compiled/uVirtObj.dcu b/Source/Compiled/uVirtObj.dcu index 41c5b52..3de2f95 100644 Binary files a/Source/Compiled/uVirtObj.dcu and b/Source/Compiled/uVirtObj.dcu differ diff --git a/Source/Compiled/uWebCtrls.dcu b/Source/Compiled/uWebCtrls.dcu index eb642e5..b1337d5 100644 Binary files a/Source/Compiled/uWebCtrls.dcu and b/Source/Compiled/uWebCtrls.dcu differ diff --git a/Source/Config.inc b/Source/Config.inc new file mode 100644 index 0000000..1591b0f --- /dev/null +++ b/Source/Config.inc @@ -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} diff --git a/Source/uAdvCtrls.pas b/Source/uAdvCtrls.pas index 9a7acd5..b0d9c6d 100644 --- a/Source/uAdvCtrls.pas +++ b/Source/uAdvCtrls.pas @@ -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 diff --git a/Source/uBase.pas b/Source/uBase.pas index 8018954..e223248 100644 --- a/Source/uBase.pas +++ b/Source/uBase.pas @@ -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); diff --git a/Source/uCalc.pas b/Source/uCalc.pas index 72daaa4..02210ac 100644 --- a/Source/uCalc.pas +++ b/Source/uCalc.pas @@ -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); diff --git a/Source/uCrypt.pas b/Source/uCrypt.pas deleted file mode 100644 index 5234ea7..0000000 --- a/Source/uCrypt.pas +++ /dev/null @@ -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. diff --git a/Source/uFileCtrls.pas b/Source/uFileCtrls.pas index 3f66d58..ff14c46 100644 --- a/Source/uFileCtrls.pas +++ b/Source/uFileCtrls.pas @@ -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; diff --git a/Source/uFileTools.pas b/Source/uFileTools.pas index 117d1d8..4468045 100644 --- a/Source/uFileTools.pas +++ b/Source/uFileTools.pas @@ -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; diff --git a/Source/uFrmCtrls.pas b/Source/uFrmCtrls.pas index 8075913..38547dd 100644 --- a/Source/uFrmCtrls.pas +++ b/Source/uFrmCtrls.pas @@ -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; diff --git a/Source/uInit.pas b/Source/uInit.pas index 45f05d1..e89f94f 100644 --- a/Source/uInit.pas +++ b/Source/uInit.pas @@ -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} diff --git a/Source/uLocalMgr.pas b/Source/uLocalMgr.pas index c3eb534..87d105f 100644 --- a/Source/uLocalMgr.pas +++ b/Source/uLocalMgr.pas @@ -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 ": Namen der aktuellen Sprache ändern + - "TAG ": Sprachkürzel der aktuellen Sprache ändern + - "INC ": Andere Sprache einbinden + - "END": Kompilierung beenden + - "APP ": Fortfahren, falls der Titel der Anwendung übereinstimmt + - "NOT ": 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); diff --git a/Source/uScriptMgr.pas b/Source/uScriptMgr.pas index 1ccf404..61f4749 100644 --- a/Source/uScriptMgr.pas +++ b/Source/uScriptMgr.pas @@ -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]; diff --git a/Source/uSysCtrls.pas b/Source/uSysCtrls.pas index a70fde8..a48b2d8 100644 --- a/Source/uSysCtrls.pas +++ b/Source/uSysCtrls.pas @@ -3,35 +3,52 @@ unit uSysCtrls; ////////////////////////////////////// /// Lina System Controls Unit /// /// **************************** /// -/// (c) 2014 Dennis Göhlert a.o. /// +/// (c) 2015 Dennis Göhlert a.o. /// ////////////////////////////////////// - {$IFNDEF MSWINDOWS} - {$IFDEF WARN_INCOMPATIBLEOS} - {$MESSAGE ERROR 'The "uSysCtrls" unit is only available under MS-Windows OS'} - {$ENDIF} - {$ENDIF} + {$I 'Config.inc'} interface uses { Standard-Units } - SysUtils, Classes, Windows, ExtCtrls, TlHelp32, PsAPI, + SysUtils, Classes, Windows, ExtCtrls, Registry, TlHelp32, PsAPI, dialogs, { Andere Package-Units } - uBase, uSysTools; + uBase, uSysTools, uFileTools; type { Fehlermeldungen } EBatteryFlag = class(Exception); + EDelphiVersion = class(Exception); + EInvalidKey = class(Exception); type { Hilfsklassen } TBatteryFlag = (bfHealthy,bfLow,bfCritical,bfCharge,bfHealthyAccu,bfNone,bfUnknown); TBatteryStatus = (bsInternal,bsExternal); TProcessRefreshMode = (prNone,prAccess,prTime); + TDelphiVersion = (dv7,dv2005,dv2006,dv2007,dv2009,dv2010,dvXE,dvXE2,dvXE3,dvXE4,dvXE5,dvXE6,dvXE7,dvXE8,dv10); + TDelphiVersions = set of TDelphiVersion; + TDelphiCompilerOptions = set of (dcmDebug,dcmConsole,dcmTypeInfo,dcmUnicode,dcmExtSyntax,dcmAssembler,dcmCondExpr); + TDelphiTargetPlatform = (dpWin32,dpWin64,dpOSX32,dpAndroid32,dpIOSDev,dpIOSSim,dpIOSDev32,dpIOSDev64); + TDelphiTargetPlatforms = set of TDelphiTargetPlatform; + TDelphiLocalPlatform = dpWin32..dpWin64; + TDelphiEdition = (dePersonal,deProfessional,deEnterprise,deUltimate,deArchitect); + TCryptMode = (cmCustom,cmXor,cmCaesar,cmVigenere); + +type + { Ereignisse } + TStringContainerChangeEvent = procedure(Sender: TObject) of object; + TStringContainerChangingEvent = procedure(Sender: TObject) of object; + TCryptWorkEvent = procedure(Sender: TObject) of object; + TCryptKeyChangeEvent = procedure(Sender: TObject) of object; + TCryptKeyChangeQueryEvent = procedure(Sender: TObject; const NewKey: String; var CanChange: Boolean) of object; type { Hauptklassen } + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} TBattery = class(TComponent) private { Private-Deklarationen } @@ -54,6 +71,9 @@ type property About: TComponentAbout read FAbout; end; + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} TCursorFix = class(TComponent) private { Private-Deklarationen } @@ -67,11 +87,14 @@ type property About: TComponentAbout read FAbout; end; + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} TProcessManager = class(TComponent) private { Private-Deklarationen } - TimerObject: TTimer; FAbout: TComponentAbout; + TimerObject: TTimer; FNames: TStrings; FTimeOut: DWORD; FRefreshMode: TProcessRefreshMode; @@ -97,12 +120,175 @@ type published { Published-Deklarationen } property About: TComponentAbout read FAbout; - property TimeOut: DWORD read FTimeOut write FTimeOut; + property TimeOut: DWORD read FTimeOut write FTimeOut default 0; property RefreshMode: TProcessRefreshMode read FRefreshMode write SetRefreshMode default prNone; property Interval: Cardinal read GetInterval write SetInterval default 1000; end; - procedure Register; + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} + TStringContainer = class(TComponent) + private + { Private-Deklarationen } + FAbout: TComponentAbout; + FItems: TStrings; + { Ereignisse } + FChangeEvent: TStringContainerChangeEvent; + FChangingEvent: TStringContainerChangingEvent; + { Methoden } + function GetItems: TStrings; + procedure SetItems(Value: TStrings); + procedure ItemsChange(Sender: TObject); + procedure ItemsChanging(Sender: TObject); + public + { Public-Deklarationen } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + published + { Published-Deklarationen } + property About: TComponentAbout read FAbout; + property Items: TStrings read GetItems write SetItems; + { Ereignisse } + property OnChange: TStringContainerChangeEvent read FChangeEvent write FChangeEvent; + property OnChanging: TStringContainerChangingEvent read FChangingEvent write FChangingEvent; + end; + + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} + TDelphiManager = class(TComponent) + private + { Private-Deklarationen } + FAbout: TComponentAbout; + { Methoden } + function GetVersion: TDelphiVersion; + function GetVersionName: String; + function GetVersionFullName: String; + function GetVersionCodeName: String; + function GetInstalled: TDelphiVersions; + function GetCompilerVersion: Extended; + function GetRuntimeVersion: Extended; + function GetLinaVersion: Extended; + function GetProductVersion: Integer; + function GetPackageVersion: Integer; + function GetCompilerOptions: TDelphiCompilerOptions; + function GetLocalPlatform: TDelphiLocalPlatform; + function GetLocalPlatformName: String; + function GetLocalPlatformFullName: String; + protected + { Protected-Deklarationen } + function RegistryPath(const Version: TDelphiVersion): String; + function TargetPlatformKey(const TargetPlatform: TDelphiTargetPlatform): String; + public + { Public-Deklarationen } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + { Eigenschaften } + property Version: TDelphiVersion read GetVersion; + property VersionName: String read GetVersionName; + property VersionFullName: String read GetVersionFullName; + property VersionCodeName: String read GetVersionCodeName; + property Installed: TDelphiVersions read GetInstalled; + property CompilerVersion: Extended read GetCompilerVersion; + property RuntimeVersion: Extended read GetRuntimeVersion; + property LinaVersion: Extended read GetLinaVersion; + property ProductVersion: Integer read GetProductVersion; + property PackageVersion: Integer read GetPackageVersion; + property CompilerOptions: TDelphiCompilerOptions read GetCompilerOptions; + property LocalPlatform: TDelphiLocalPlatform read GetLocalPlatform; + property LocalPlatformName: String read GetLocalPlatformName; + property LocalPlatformFullName: String read GetLocalPlatformFullName; + { Methoden } + function RootDir(const Version: TDelphiVersion): String; + function ExeName(const Version: TDelphiVersion): String; + function Edition(const Version: TDelphiVersion): TDelphiEdition; + function Language(const Version: TDelphiVersion): String; + function TargetPlatforms(const Version: TDelphiVersion): TDelphiTargetPlatforms; + function VariablePath(const Version: TDelphiVersion; const Variable: String): String; + procedure BrowsingPaths(const Version: TDelphiVersion; const TargetPlatform: TDelphiTargetPlatform; var Target: TStrings); + procedure SearchPaths(const Version: TDelphiVersion; const TargetPlatform: TDelphiTargetPlatform; var Target: TStrings); + procedure EnvironmentVariables(const Version: TDelphiVersion; Target: TStrings); + procedure Launch(const Version: TDelphiVersion); + published + { Published-Deklarationen } + property About: TComponentAbout read FAbout; + end; + + {$IFNDEF NO_MULTIPLATFORM} + [ComponentPlatformsAttribute(pidWin32 or pidWin64)] + {$ENDIF} + TCryptManager = class(TComponent) + private + { Private-Deklarationen } + FAbout: TComponentAbout; + FMode: TCryptMode; + FKey: String; + FDecrypted: TStrings; + FEncrypted: TStrings; + FAutoCrypt: Boolean; + FWorkEvent: TCryptWorkEvent; + FKeyChangeEvent: TCryptKeyChangeEvent; + FKeyChangeQueryEvent: TCryptKeyChangeQueryEvent; + { Methoden } + procedure SetMode(Value: TCryptMode); + procedure SetKey(Value: String); + function GetDecrypted: TStrings; + procedure SetDecrypted(Value: TStrings); + function GetEncrypted: TStrings; + procedure SetEncrypted(Value: TStrings); + protected + { Protected-Deklarationen } + procedure DecryptedChange(Sender: TObject); + procedure EncryptedChange(Sender: TObject); + procedure XorEncrypt; + procedure XorDecrypt; + procedure CaesarEncrypt; + procedure CaesarDecrypt; + procedure VigenereEncrypt; + procedure VigenereDecrypt; + public + { Public-Deklarationen } + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Decrypt; + procedure Encrypt; + function ValidKey(const S: String): Boolean; + function GenerateKey: String; + published + { Published-Deklarationen } + property About: TComponentAbout read FAbout; + property Mode: TCryptMode read FMode write SetMode default cmCustom; + property Key: String read FKey write SetKey; + property Decrypted: TStrings read GetDecrypted write SetDecrypted; + property Encrypted: TStrings read GetEncrypted write SetEncrypted; + property AutoCrypt: Boolean read FAutoCrypt write FAutoCrypt default True; + { Ereignisse } + property OnWork: TCryptWorkEvent read FWorkEvent write FWorkEvent; + property OnKeyChange: TCryptKeyChangeEvent read FKeyChangeEvent write FKeyChangeEvent; + property OnKeyChangeQuery: TCryptKeyChangeQueryEvent read FKeyChangeQueryEvent write FKeyChangeQueryEvent; + end; + + {$IFDEF ADD_COMPONENTREG} + procedure Register; + {$ENDIF} + + function NameToDelphiVersion(const Name: String): TDelphiVersion; + function FullNameToDelphiVersion(const FullName: String): TDelphiVersion; + function CodeNameToDelphiVersion(const CodeName: String): TDelphiVersion; + function DelphiVersionToName(const DelphiVersion: TDelphiVersion): String; + function DelphiVersionToFullName(const DelphiVersion: TDelphiVersion): String; + function DelphiVersionToCodeName(const DelphiVersion: TDelphiVersion): String; + function DelphiVersionToProductVersion(const DelphiVersion: TDelphiVersion): Integer; + function DelphiVersionToPackageVersion(const DelphiVersion: TDelphiVersion): Integer; + function ProductVersionToDelphiVersion(const ProductVersion: Integer): TDelphiVersion; + function PackageVersionToDelphiVersion(const PackageVersion: Integer): TDelphiVersion; + function ProductVersionToPackageVersion(const ProductVersion: Integer): Integer; + function PackageVersionToProductVersion(const PackageVersion: Integer): Integer; + function TargetPlatformToName(const TargetPlatform: TDelphiTargetPlatform): String; + function TargetPlatformToFullName(const TargetPlatform: TDelphiTargetPlatform): String; + function ValidKey(Mode: TCryptMode; const Key: String): Boolean; + function GenerateKey(Mode: TCryptMode): String; const { PowerStatus-Meldungen } @@ -113,24 +299,172 @@ const PS_HEALTHYACCU = 'HealthyAccu'; PS_NONE = 'None'; PS_UNKNOWN = 'Unknown'; - { Meta-Daten } - BatteryComponent_Version = '1.0'; - BatteryComponent_Copyright = 'Copyright © 2014'; - BatteryComponent_Author = 'Dennis Göhlert a.o.'; - - CursorFixComponent_Version = '1.0'; - CursorFixComponent_Copyright = 'Copyright © 2014'; - CursorFixComponent_Author = 'Dennis Göhlert a.o.'; - - ProcessManagerComponent_Version = '1.0'; - ProcessManagerComponent_Copyright = 'Copyright © 2014'; - ProcessManagerComponent_Author = 'Dennis Göhlert a.o.'; implementation -procedure Register; +{$IFDEF ADD_COMPONENTREG} + procedure Register; + begin + RegisterComponents(ComponentsPage,[TBattery,TCursorFix,TProcessManager,TStringContainer,TDelphiManager,TCryptManager]); + end; +{$ENDIF} + +function NameToDelphiVersion(const Name: String): TDelphiVersion; +const + VersionNames: array [TDelphiVersion] of String = ( + '7','2005','2006','2007','2009','2010', + 'XE','XE2','XE3','XE4','XE5','XE6','XE7','XE8', + '10' + ); begin - RegisterComponents(ComponentsPage,[TBattery,TCursorFix,TProcessManager]); + Result := TDelphiVersion(ArrayPos(Name,VersionNames)); +end; + +function FullNameToDelphiVersion(const FullName: String): TDelphiVersion; +const + VersionFullNames: array [TDelphiVersion] of String = ( + 'Delphi 7','Delphi 2005','Delphi 2006','Delphi 2007','Delphi 2009','Delphi 2010', + 'Delphi XE','Delphi XE2','Delphi XE3','Delphi XE4','Delphi XE5','Delphi XE6','Delphi XE7','Delphi XE8', + 'Delphi 10' + ); +begin + Result := TDelphiVersion(ArrayPos(FullName,VersionFullNames)); +end; + +function CodeNameToDelphiVersion(const CodeName: String): TDelphiVersion; +const + VersionCodeNames: array [TDelphiVersion] of String = ( + 'Aurora','DiamondBack','DeXter','Spacely','Tiburón','Weaver', + 'Fulcrum','Pulsar','Waterdragon','Quintessence','Zephyr','Proteus','Carpathia','Elbrus', + 'Seattle' + ); +begin + Result := TDelphiVersion(ArrayPos(CodeName,VersionCodeNames)); +end; + +function DelphiVersionToName(const DelphiVersion: TDelphiVersion): String; +const + VersionNames: array [TDelphiVersion] of String = ( + '7','2005','2006','2007','2009','2010', + 'XE','XE2','XE3','XE4','XE5','XE6','XE7','XE8', + '10' + ); +begin + Result := VersionNames[DelphiVersion]; +end; + +function DelphiVersionToFullName(const DelphiVersion: TDelphiVersion): String; +const + VersionFullNames: array [TDelphiVersion] of String = ( + 'Delphi 7','Delphi 2005','Delphi 2006','Delphi 2007','Delphi 2009','Delphi 2010', + 'Delphi XE','Delphi XE2','Delphi XE3','Delphi XE4','Delphi XE5','Delphi XE6','Delphi XE7','Delphi XE8', + 'Delphi 10' + ); +begin + Result := VersionFullNames[DelphiVersion]; +end; + +function DelphiVersionToCodeName(const DelphiVersion: TDelphiVersion): String; +const + VersionCodeNames: array [TDelphiVersion] of String = ( + 'Aurora','DiamondBack','DeXter','Spacely','Tiburón','Weaver', + 'Fulcrum','Pulsar','Waterdragon','Quintessence','Zephyr','Proteus','Carpathia','Elbrus', + 'Seattle' + ); +begin + Result := VersionCodeNames[DelphiVersion]; +end; + +function DelphiVersionToProductVersion(const DelphiVersion: TDelphiVersion): Integer; +begin + if DelphiVersion = dv7 then + begin + Result := 7; + end else + begin + Result := Integer(DelphiVersion) + 9; + end; +end; + +function DelphiVersionToPackageVersion(const DelphiVersion: TDelphiVersion): Integer; +begin + Result := DelphiVersionToProductVersion(DelphiVersion) * 10; +end; + +function ProductVersionToDelphiVersion(const ProductVersion: Integer): TDelphiVersion; +begin + Result := TDelphiVersion(ProductVersion - 7); +end; + +function PackageVersionToDelphiVersion(const PackageVersion: Integer): TDelphiVersion; +begin + Result := TDelphiVersion(PackageVersion - 7 div 10) +end; + +function ProductVersionToPackageVersion(const ProductVersion: Integer): Integer; +begin + Result := ProductVersion * 10; +end; + +function PackageVersionToProductVersion(const PackageVersion: Integer): Integer; +begin + Result := PackageVersion div 10; +end; + +function TargetPlatformToName(const TargetPlatform: TDelphiTargetPlatform): String; +const + TargetPlatformNames: array [TDelphiTargetPlatform] of String = ( + 'Win32','Win64', + 'OSX32', + 'Android32', + 'IOSDev','IOSSim','IOSDev32','IOSDev64' + ); +begin + Result := TargetPlatformNames[TargetPlatform]; +end; + +function TargetPlatformToFullName(const TargetPlatform: TDelphiTargetPlatform): String; +const + TargetPlatformNames: array [TDelphiTargetPlatform] of String = ( + 'Windows 32-Bit','Windows 64-Bit', + 'Mac OS/X 32-Bit', + 'Android 32-Bit', + 'iOS','IOS Simulator','IOS 32-Bit','IOS 64-Bit' + ); +begin + Result := TargetPlatformNames[TargetPlatform]; +end; + +function ValidKey(Mode: TCryptMode; const Key: String): Boolean; +begin + if Length(Key) <> 0 then + begin + case Mode of + cmXor: Result := ((StrIsInt(Key) = True) and (StrToInt(Key) in [0..31])); + cmCaesar: Result := ((Length(Key) = 1) and (Key[1] in Letters)); + cmVigenere: Result := ConsistsOf(Key,Letters); + end; + end; +end; + +function GenerateKey(Mode: TCryptMode): String; +var + Current: PChar; +begin + Randomize; + case Mode of + cmXor: Result := IntToStr(Random(32)); + cmCaesar: Result := Chr(Random(Ord('Z') - Ord('A')) + Ord('A')); + cmVigenere: begin + SetLength(Result,1 + Random(15)); + Current := PChar(Result); + while Current^ <> #0 do + begin + Current^ := Chr(Random(Ord('Z') - Ord('A')) + Ord('A')); + Inc(Current); + end; + end; + end; end; { ---------------------------------------------------------------------------- @@ -157,7 +491,7 @@ end; constructor TBattery.Create(AOwner: TComponent); begin inherited; - FAbout := TComponentAbout.Create(TBattery,BatteryComponent_Version,BatteryComponent_Copyright,BatteryComponent_Author); + FAbout := TComponentAbout.Create(TBattery); end; destructor TBattery.Destroy; @@ -236,7 +570,7 @@ constructor TCursorFix.Create(AOwner: TComponent); {$ENDIF} begin inherited; - FAbout := TComponentAbout.Create(TCursorFix,CursorFixComponent_Version,CursorFixComponent_Copyright,CursorFixComponent_Author); + FAbout := TComponentAbout.Create(TCursorFix); {$IFDEF NO_CURSOR} CursorHandle := Screen.Cursors[crHandPoint]; Screen.Cursors[crHandPoint] := LoadCursor(0,IDC_HAND); @@ -270,9 +604,10 @@ end; constructor TProcessManager.Create(AOwner: TComponent); begin inherited; - FAbout := TComponentAbout.Create(TProcessManager,ProcessManagerComponent_Version,ProcessManagerComponent_Copyright,ProcessManagerComponent_Author); + FAbout := TComponentAbout.Create(TProcessManager); FNames := TStringList.Create; TimerObject := TTimer.Create(Self); + FTimeOut := 0; FRefreshMode := prNone; TimerObject.OnTimer := TimerObjectTimer; end; @@ -511,4 +846,842 @@ begin end; end; +{ ---------------------------------------------------------------------------- + TStringContainer + ---------------------------------------------------------------------------- } + +constructor TStringContainer.Create(AOwner: TComponent); +begin + inherited; + FAbout := TComponentAbout.Create(TStringContainer); + FItems := TStringList.Create; + (FItems as TStringList).OnChange := ItemsChange; + (FItems as TStringList).OnChanging := ItemsChanging; +end; + +destructor TStringContainer.Destroy; +begin + FAbout.Free; + FItems.Free; + inherited; +end; + +function TStringContainer.GetItems: TStrings; +begin + Result := FItems; +end; + +procedure TStringContainer.SetItems(Value: TStrings); +begin + (FItems as TStringList).Assign(Value); +end; + +procedure TStringContainer.ItemsChange(Sender: TObject); +begin + if Assigned(OnChange) then + begin + OnChange(Self); + end; +end; + +procedure TStringContainer.ItemsChanging(Sender: TObject); +begin + if Assigned(OnChanging) then + begin + OnChanging(Self); + end; +end; + +{ ---------------------------------------------------------------------------- + TDelphiManager + ---------------------------------------------------------------------------- } + +constructor TDelphiManager.Create(AOwner: TComponent); +begin + inherited; + FAbout := TComponentAbout.Create(TDelphiManager); +end; + +destructor TDelphiManager.Destroy; +begin + FAbout.Free; + inherited; +end; + +function TDelphiManager.GetVersion: TDelphiVersion; +begin + {$IFDEF VER150} + Result := dv7; + {$ELSE} + {$IFDEF VER170} + Result := dv2005; + {$ELSE} + {$IFDEF VER180} + {$IFNDEF VER185} + Result := dv2006; + {$ELSE} + Result := dv2007; + {$ENDIF} + {$ELSE} + {$IFDEF VER200} + Result := dv2009; + {$ELSE} + {$IFDEF VER210} + Result := dv2010; + {$ELSE} + {$IFDEF VER220} + Result := dvXE; + {$ELSE} + {$IFDEF VER230} + Result := dvXE2; + {$ELSE} + {$IFDEF VER240} + Result := dvXE3; + {$ELSE} + {$IFDEF VER250} + Result := dvXE4; + {$ELSE} + {$IFDEF VER260} + Result := dvXE5; + {$ELSE} + {$IFDEF VER270} + Result := dvXE6; + {$ELSE} + {$IFDEF VER280} + Result := dvXE7; + {$ELSE} + {$IFDEF VER290} + Result := dvXE8; + {$ELSE} + {$IFDEF VER300} + Result := dv10; + {$ELSE} + raise EDelphiVersion.Create('Delphi version could not be determined'); + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} + {$ENDIF} +end; + +function TDelphiManager.GetVersionName: String; +begin + Result := DelphiVersionToName(Version); +end; + +function TDelphiManager.GetVersionFullName: String; +begin + Result := DelphiVersionToFullName(Version); +end; + +function TDelphiManager.GetVersionCodeName: String; +begin + Result := DelphiVersionToCodeName(Version); +end; + +function TDelphiManager.GetInstalled: TDelphiVersions; +var + Reg: TRegistry; + Index: TDelphiVersion; +begin + Result := []; + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_LOCAL_MACHINE; + try + for Index := Low(TDelphiVersion) to High(TDelphiVersion) do + begin + if Reg.KeyExists(RegistryPath(Version)) then + begin + if FileExists(ExeName(Index)) = True then + begin + Result := Result + [Index]; + end; + end; + end; + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +function TDelphiManager.GetCompilerVersion: Extended; +begin + Result := System.CompilerVersion; +end; + +function TDelphiManager.GetRuntimeVersion: Extended; +begin + Result := RTLVersion; +end; + +function TDelphiManager.GetLinaVersion: Extended; +begin + Result := uBase.LinaVersion; +end; + +function TDelphiManager.GetProductVersion: Integer; +begin + Result := DelphiVersionToProductVersion(Version); +end; + +function TDelphiManager.GetPackageVersion: Integer; +begin + Result := DelphiVersionToPackageVersion(Version); +end; + +function TDelphiManager.GetCompilerOptions: TDelphiCompilerOptions; +begin + Result := [] + {$IFDEF DEBUG} + [dcmDebug] {$ENDIF} + {$IFOPT M+} + [dcmTypeInfo] {$ENDIF} + {$IFDEF CONSOLE} + [dcmConsole] {$ENDIF} + {$IFDEF UNICODE} + [dcmUnicode] {$ENDIF} + {$IFOPT X+} + [dcmExtSyntax] {$ENDIF} + {$IFDEF ASSEMBLER} + [dcmAssembler] {$ENDIF} + {$IFDEF CONDITIONALEXPRESSIONS} + [dcmCondExpr] {$ENDIF} + ; +end; + +function TDelphiManager.GetLocalPlatform: TDelphiLocalPlatform; +begin + {$IFDEF WIN32} + Result := dpWin32; + {$ENDIF} + {$IFDEF WIN64} + Result := dpWin64; + {$ENDIF} +end; + +function TDelphiManager.GetLocalPlatformName: String; +begin + Result := TargetPlatformToName(LocalPlatform); +end; + +function TDelphiManager.GetLocalPlatformFullName: String; +begin + Result := TargetPlatformToFullName(LocalPlatform); +end; + +function TDelphiManager.RegistryPath(const Version: TDelphiVersion): String; +const + RegistryPaths: array [TDelphiVersion] of String = ( + 'Software\Borland\Delphi\7.0', + 'Software\Borland\BDS\3.0', + 'Software\Borland\BDS\4.0', + 'Software\Borland\BDS\5.0', + 'Software\CodeGear\BDS\6.0', + 'Software\CodeGear\BDS\7.0', + 'Software\Embarcadero\BDS\8.0', + 'Software\Embarcadero\BDS\9.0', + 'Software\Embarcadero\BDS\10.0', + 'Software\Embarcadero\BDS\11.0', + 'Software\Embarcadero\BDS\12.0', + 'Software\Embarcadero\BDS\14.0', + 'Software\Embarcadero\BDS\15.0', + 'Software\Embarcadero\BDS\16.0', + 'Software\Embarcadero\BDS\17.0' + ); +begin + Result := RegistryPaths[Version]; +end; + +function TDelphiManager.TargetPlatformKey(const TargetPlatform: TDelphiTargetPlatform): String; +const + TargetPlatforms: array [TDelphiTargetPlatform] of String = ( + 'Win32', + 'Win64', + 'OSX32', + 'Android32', + 'iOSDevice', + 'iOSSimulator', + 'iOSDevice32', + 'iOSDevice64' + ); +begin + Result := TargetPlatforms[TargetPlatform]; +end; + +function TDelphiManager.RootDir(const Version: TDelphiVersion): String; +const + RegEntry = 'RootDir'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version)); + Result := Reg.ReadString(RegEntry); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +function TDelphiManager.ExeName(const Version: TDelphiVersion): String; +const + RegEntry = 'App'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version)); + Result := Reg.ReadString(RegEntry) + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +function TDelphiManager.Edition(const Version: TDelphiVersion): TDelphiEdition; +const + RegEntry = 'Edition'; + Editions: array [TDelphiEdition] of String = ( + 'Personal', + 'Professional', + 'Enterprise', + 'Ultimate', + 'Architect' + ); +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version)); + Result := TDelphiEdition(ArrayPos(Reg.ReadString(RegEntry),Editions)); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +function TDelphiManager.Language(const Version: TDelphiVersion): String; +const + RegEntry = 'InstallLanguage'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version)); + Result := Reg.ReadString(RegEntry); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +function TDelphiManager.TargetPlatforms(const Version: TDelphiVersion): TDelphiTargetPlatforms; +begin + Result := [dpWin32]; + if Version >= dvXE2 then + begin + Result := Result + [dpWin64,dpOSX32]; + if Version <> dvXE3 then + begin + Result := Result + [dpIOSSim]; + if Version < dvXE8 then + begin + Result := Result + [dpIOSDev]; + end else + begin + Result := Result + [dpIOSDev32,dpIOSDev64]; + end; + if Version >= dvXE5 then + begin + Result := Result + [dpAndroid32]; + end; + end; + end; +end; + +function TDelphiManager.VariablePath(const Version: TDelphiVersion; const Variable: String): String; +const + RegSubKey = 'Environment Variables'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version) + PathDelim + RegSubKey) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version) + PathDelim + RegSubKey); + if Reg.ValueExists(Variable) = True then + begin + Result := Reg.ReadString(Variable); + end else + begin + Result := ''; + end; + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +procedure TDelphiManager.BrowsingPaths(const Version: TDelphiVersion; const TargetPlatform: TDelphiTargetPlatform; var Target: TStrings); +const + RegSubKey = 'Library'; + RegEntry = 'Browsing Path'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version) + PathDelim + RegSubKey + PathDelim + TargetPlatformKey(TargetPlatform)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version) + PathDelim + RegSubKey + PathDelim + TargetPlatformKey(TargetPlatform)); + Target.StrictDelimiter := True; + Target.Delimiter := ';'; + Target.DelimitedText := Reg.ReadString(RegEntry); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +procedure TDelphiManager.SearchPaths(const Version: TDelphiVersion; const TargetPlatform: TDelphiTargetPlatform; var Target: TStrings); +const + RegSubKey = 'Library'; + RegEntry = 'Search Path'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version) + PathDelim + RegSubKey + PathDelim + TargetPlatformKey(TargetPlatform)) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version) + PathDelim + RegSubKey + PathDelim + TargetPlatformKey(TargetPlatform)); + Target.StrictDelimiter := True; + Target.Delimiter := ';'; + Target.DelimitedText := Reg.ReadString(RegEntry); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +procedure TDelphiManager.EnvironmentVariables(const Version: TDelphiVersion; Target: TStrings); +const + RegSubKey = 'Environment Variables'; +var + Reg: TRegistry; +begin + Reg := TRegistry.Create; + try + Reg.RootKey := HKEY_CURRENT_USER; + if (Reg.KeyExists(RegistryPath(Version) + PathDelim + RegSubKey) = False) then + begin + Reg.RootKey := HKEY_LOCAL_MACHINE; + end; + try + Reg.OpenKeyReadOnly(RegistryPath(Version) + PathDelim + RegSubKey); + Reg.GetValueNames(Target); + finally + Reg.CloseKey; + end; + finally + Reg.Free; + end; +end; + +procedure TDelphiManager.Launch(const Version: TDelphiVersion); +begin + ExecuteFile(ExeName(Version)); +end; + +{ ---------------------------------------------------------------------------- + TCryptManager + ---------------------------------------------------------------------------- } + +constructor TCryptManager.Create; +begin + inherited; + FMode := cmCustom; + FAutoCrypt := True; + FAbout := TComponentAbout.Create(TCryptManager); + FDecrypted := TStringList.Create; + (FDecrypted as TStringList).OnChange := DecryptedChange; + FEncrypted := TStringList.Create; + (FEncrypted as TStringList).OnChange := EncryptedChange; +end; + +destructor TCryptManager.Destroy; +begin + FAbout.Free; + FDecrypted.Free; + FEncrypted.Free; + inherited; +end; + +procedure TCryptManager.SetMode(Value: TCryptMode); +begin + FMode := Value; + Key := ''; +end; + +procedure TCryptManager.SetKey(Value: String); +var + CanChange: Boolean; +begin + if Length(Value) <> 0 then + begin + case Mode of + cmXor: if not ((StrIsInt(Value) = True) and (StrToInt(Value) in [0..31])) then + begin + raise EInvalidKey.Create('Invalid Xor crypt key value'); + end; + cmCaesar: begin + Value[1] := CharUpperCase(Value[1]); + if not ((Length(Value) = 1) and (Value[1] in UpperCaseLetters)) then + begin + raise EInvalidKey.Create('Invalid Caesar crypt key value'); + end; + end; + cmVigenere: begin + Value := UpperCase(Value); + if ConsistsOf(Value,UpperCaseLetters) = False then + begin + raise EInvalidKey.Create('Invalid Vigenere crypt key value'); + end; + end; + end; + end; + CanChange := True; + if Assigned(OnKeyChange) then + begin + OnKeyChangeQuery(Self,Value,CanChange); + end; + if CanChange = True then + begin + FKey := Value; + if Assigned(OnKeyChange) then + begin + OnKeyChange(Self); + end; + end; +end; + +function TCryptManager.GetDecrypted: TStrings; +begin + Result := FDecrypted; +end; + +procedure TCryptManager.SetDecrypted(Value: TStrings); +begin + (FDecrypted as TStringList).Assign(Value); + if AutoCrypt = True then + begin + Encrypt; + end; +end; + +function TCryptManager.GetEncrypted: TStrings; +begin + Result := FEncrypted; +end; + +procedure TCryptManager.SetEncrypted(Value: TStrings); +begin + (FEncrypted as TStringList).Assign(Value); + if AutoCrypt = True then + begin + Decrypt; + end; +end; + +procedure TCryptManager.DecryptedChange(Sender: TObject); +begin + if AutoCrypt = True then + begin + Encrypt; + end; +end; + +procedure TCryptManager.EncryptedChange(Sender: TObject); +begin + if AutoCrypt = True then + begin + Decrypt; + end; +end; + +procedure TCryptManager.XorEncrypt; +var + Index: Integer; + Line: String; + Current: PChar; + Delta: Integer; +begin + Delta := StrToInt(Key); + Encrypted.Clear; + for Index := 0 to Decrypted.Count - 1 do + begin + Line := Decrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + Current^ := Chr(Ord(Current^) xor Delta); + Inc(Current); + end; + Encrypted.Add(Line); + end; +end; + +procedure TCryptManager.XorDecrypt; +var + Index: Integer; + Line: String; + Current: PChar; + Delta: Integer; +begin + Delta := StrToInt(Key); + Decrypted.Clear; + for Index := 0 to Encrypted.Count - 1 do + begin + Line := Encrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + if Current^ > #31 then + begin + Current^ := Chr(Ord(Current^) xor Delta); + end; + Inc(Current); + end; + Decrypted.Add(Line); + end; +end; + +procedure TCryptManager.CaesarEncrypt; +var + Index: Integer; + Line: String; + Current: PChar; + Delta: Byte; +begin + Delta := Ord(Key[1]) - Ord('A'); + Encrypted.Clear; + for Index := 0 to Decrypted.Count - 1 do + begin + Line := Decrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + Current^ := Chr(Ord(Current^) + Delta); + Inc(Current); + end; + Encrypted.Add(Line); + end; +end; + +procedure TCryptManager.CaesarDecrypt; +var + Index: Integer; + Line: String; + Current: PChar; + Delta: Byte; +begin + Delta := Ord(Key[1]) - Ord('A'); + Decrypted.Clear; + for Index := 0 to Encrypted.Count - 1 do + begin + Line := Encrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + Current^ := Chr(Ord(Current^) - Delta); + Inc(Current); + end; + Decrypted.Add(Line); + end; +end; + +procedure TCryptManager.VigenereEncrypt; +var + Index: Integer; + Line: String; + Current: PChar; + CurrentKey: PChar; +begin + CurrentKey := PChar(Key); + Encrypted.Clear; + for Index := 0 to Decrypted.Count - 1 do + begin + Line := Decrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + Current^ := Chr(Ord(Current^) + Ord(CurrentKey^) - Ord('A')); + Inc(CurrentKey); + if CurrentKey^ = #0 then + begin + CurrentKey := PChar(Key); + end; + Inc(Current); + end; + Encrypted.Add(Line); + end; +end; + +procedure TCryptManager.VigenereDecrypt; +var + Index: Integer; + Line: String; + Current: PChar; + CurrentKey: PChar; +begin + CurrentKey := PChar(Key); + Decrypted.Clear; + for Index := 0 to Encrypted.Count - 1 do + begin + Line := Encrypted.Strings[Index]; + Current := PChar(Line); + while Current^ <> #0 do + begin + Current^ := Chr(Ord(Current^) - Ord(CurrentKey^) + Ord('A')); + Inc(CurrentKey); + if CurrentKey^ = #0 then + begin + CurrentKey := PChar(Key); + end; + Inc(Current); + end; + Decrypted.Add(Line); + end; +end; + +procedure TCryptManager.Decrypt; +var + OldAutoCrypt: Boolean; +begin + if AutoCrypt = True then + begin + OldAutoCrypt := True; + AutoCrypt := False; + end else + begin + OldAutoCrypt := False; + end; + if Length(Key) <> 0 then + begin + case Mode of + cmXor: XorDecrypt; + cmCaesar: CaesarDecrypt; + cmVigenere: VigenereDecrypt; + end; + end; + if Assigned(OnWork) = True then + begin + OnWork(Self); + end; + if OldAutoCrypt = True then + begin + AutoCrypt := True; + end; +end; + +procedure TCryptManager.Encrypt; +var + OldAutoCrypt: Boolean; +begin + if AutoCrypt = True then + begin + OldAutoCrypt := True; + AutoCrypt := False; + end else + begin + OldAutoCrypt := False; + end; + if Length(Key) <> 0 then + begin + case Mode of + cmXor: XorEncrypt; + cmCaesar: CaesarEncrypt; + cmVigenere: VigenereEncrypt; + end; + end; + if Assigned(OnWork) = True then + begin + OnWork(Self); + end; + if OldAutoCrypt = True then + begin + AutoCrypt := True; + end; +end; + +function TCryptManager.ValidKey(const S: String): Boolean; +begin + Result := uSysCtrls.ValidKey(Mode,S); +end; + +function TCryptManager.GenerateKey: String; +begin + Result := uSysCtrls.GenerateKey(Mode); +end; + end. diff --git a/Source/uSysTools.pas b/Source/uSysTools.pas index b745a8f..8a5c095 100644 --- a/Source/uSysTools.pas +++ b/Source/uSysTools.pas @@ -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 ---------------------------------------------------------------------------- } diff --git a/Source/uVirtObj.pas b/Source/uVirtObj.pas index 8c82e36..4982b1a 100644 --- a/Source/uVirtObj.pas +++ b/Source/uVirtObj.pas @@ -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 diff --git a/Source/uWebCtrls.pas b/Source/uWebCtrls.pas index e9a73b8..1c8128d 100644 --- a/Source/uWebCtrls.pas +++ b/Source/uWebCtrls.pas @@ -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; diff --git a/resource/bitmap/Large/TSizePanel.bmp b/resource/bitmap/Large/TSizePanel.bmp new file mode 100644 index 0000000..fe8005c Binary files /dev/null and b/resource/bitmap/Large/TSizePanel.bmp differ diff --git a/resource/bitmap/Small/TValueEdit.bmp b/resource/bitmap/Small/TValueEdit.bmp new file mode 100644 index 0000000..b0803a8 Binary files /dev/null and b/resource/bitmap/Small/TValueEdit.bmp differ diff --git a/resource/bitmap/TSizePanel.bmp b/resource/bitmap/TSizePanel.bmp new file mode 100644 index 0000000..6b257bd Binary files /dev/null and b/resource/bitmap/TSizePanel.bmp differ