diff --git a/Feedback/fb_language.res b/Feedback/fb_language.res index fa43433..c34c50e 100644 --- a/Feedback/fb_language.res +++ b/Feedback/fb_language.res @@ -1,6 +1,7 @@ ; FEEDBACK-PROGRAM LANGUAGES ; (ONE SECTION FOR EACH LANGUAGE) ; TO CHANGE THE DEFAULT LANGUAGE, EDIT FB_CONFIG.RES FILE +; GERMAN LANGUAGE IS HARD-CODED AND DEFAULT! [English] ; APPLICATION 000=Feedback @@ -29,7 +30,7 @@ 122=The program did not work correctly 123=The program could not be launched 124=The program hang-up -125=The program demaged my system +125=The program damaged my system ; TAB #2 200=Problems 210=The program had problems @@ -46,6 +47,8 @@ 410=Wishes and suggestions: 420=Other annotations: ; ------------------------------------------------ +; ITALIAN +; TRANSLATION BY: Francesco Martella [Italiano] ; L'APPLICAZIONE 000=Feedback @@ -89,4 +92,146 @@ ; TAB # 4 400=Suggerimenti 410=Richieste e suggerimenti: -420=Altre annotazioni: \ No newline at end of file +420=Altre annotazioni: +; ------------------------------------------------ +; NORWEGIAN +; TRANSLATION BY: Lennart von Aasenden +[Norsk] +; APPLICATION +000=Tilbakemelding +001=Tilbakemelding-Program +002=Tilbakemelding filer +003=Eksportere Tilbakemelding fil... +; DIALOGS (NEWLINE: &) +004=Gir du tillatelse til å inkludere anonyme data for statistiske formål i din tilbakemelding? Dette hjelper oss å forbedre kvaliteten for fremtiden. Data vidreføres ikke til tredjeparter. +005=Husk og gi oss din rating, fra en til fem stjerner! +006=Takk for at du deltar i vårt feedback program! Dine data lagres som FBK filer som du kan laste opp. Vil du åpne et nettleser vinue og laste opp filene nå? +; MAIN FORM +010=Instillinger +011=Språk: +012=Program: +013=Versjon: +021=Avslutt +022=Fortsett +; TAB #1 +100=Vanlig +111=Utilfredstillende +112=Adekvat +113=Bra +114=Utmerket +115=Perfekt +121=programmet sluttet uventet å virke +122=Programmet fungerte ikke som det skal +123=Klarte ikke å starte programmet +124=Programmet fryser eller henger seg opp +125=Programmet skadet mitt system +; TAB #2 +200=Problem +210=Programmet opplever problemer +220=Problem beskrivelse +; TAB #3 +300=Rating +301=Dårlig +302=Bra +310=Grafisk presentasjon: +320=Praktisk handling: +330=Funksjonalitet: +; TAB #4 +400=Forslag +410=Ønsker og forslag: +420=Andre kommentarer: +; ------------------------------------------------ +; INDONESIAN +; TRANSLATION BY: Kayra Lyra +[Indonesia] +; APLIKASI +000=Umpan Balik +001=Umpan balik-Program +002=Berkas umpan balik +003=Ekspor berkas umpan balik... +; DIALOGS (NEWLINE: &) +004=Apakah kami diizinkan untuk memasukkan beberapa data yang tidak dikenali untuk tujuan statistik dalam umpan balik Anda? dan ini membantu kami untuk membuat program kami lebih baik untuk para pengguna kami di masa depan. dan kami tidak akan mempublikasi data Anda. +005=Silakan pilih rate untuk program dengan 1 sampai 5 bintang! +006=Terima kasih untuk partisipasi Anda pada program umpan balik kami! & Data Anda telah disimpan dalam berkas FBK khusus yang dapat Anda unggah sekarang. & Apakah Anda ingin membuka halaman web browser untuk mengunggah berkas umpan balik? +; FORM UTAMA +010=Pengaturan +011=Bahasa: +012=Program: +013=Versi: +021=Keluar +022=Lanjutkan +; TAB #1 +100=Biasa +111=Kurang Memuaskan +112=Dapat diterima +113=Baik +114=Luar biasa +115=Sempurna +121=Program ini sering tidak berfungsi tiba-tiba +122=Program ini tidak bekerja secara benar +123=Program ini tidak bisa dibuka +124=Program ini rusak +125=Program ini merusak sistem saya +; TAB #2 +200=Permasalahan +210=Program ini memiliki masalah +220=Penjabaran masalah +; TAB #3 +300=Pilihan +301=Buruk +302=Baik +310=Tampilan yag bagu +320=Perawatan yang mudah +330=Nilai fungsionalitas +; TAB #4 +400=Saran +410=Harapan dan saran: +420=Catatan lain: +; ------------------------------------------------ +; POLISH +; TRANSLATION BY: David Ratajczak +[Polski] +; APPLICATION +000=Feedback +001=Program feedback +002=Pliki feedback +003=Export pliku... +; DIALOGS (NEWLINE: &) +004=Czy wolno nam uzywac kilka anonimowych danych dla celów statystycznych? To pomaga nam, aby nasze programy lepsze dla naszych uzytkowników +& Nie bedzie publikacji danych. +005=Prosze glosowac na program z jednej do pieciu gwiazdek! +006=Dziekujemy za udzial w naszym programie zwrotnego! & Twoje dane zostaly zapisane w specjalnych plikach FBK które mozna przesylac juz teraz. & Chcialbys otworzyc strone dla przesylania plików? +; MAIN FORM +010=Ustawienia +011=Jezyk: +012=Program: +013=Wersja: +021=Zakonc +022=Dalej +; TAB #1 +100=Ogólnie +111=Niezadowalajace +112=Zadowalajace +113=Dobre +114=Bardzo dobre +115=Perfekcyjne +121=Program zostal wylaczony nie sprawiedliwie +122=Program nie dzialal sprawiedliwie +123=Program nie mogl by odpalony +124=Program sie zawiesil +125=Program uszkodzil moj system +; TAB #2 +200=Problemy +210=Program mial problemy +220=Opis problemu +; TAB #3 +300=Ocenianie +301=Zle +302=Dobrze +310=Wyglad: +320=Uzywanie: +330=Funkcjonowanie: +; TAB #4 +400=Sugestie +410=Sugestie i zyczenia: +420=Dodatki: diff --git a/Information/Links/Donate.url b/Information/Links/Donate.url new file mode 100644 index 0000000..00ade29 --- /dev/null +++ b/Information/Links/Donate.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,2 +[InternetShortcut] +IDList= +URL=http://www.patreon.com/dennis07 diff --git a/Information/Links/Facebook-Group.url b/Information/Links/Facebook-Group.url new file mode 100644 index 0000000..63f9b8b --- /dev/null +++ b/Information/Links/Facebook-Group.url @@ -0,0 +1,5 @@ +[{000214A0-0000-0000-C000-000000000046}] +Prop3=19,11 +[InternetShortcut] +IDList= +URL=https://www.facebook.com/groups/137012246341854/ diff --git a/Information/Statistics.txt b/Information/Statistics.txt index 7b7bdef..5889453 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): 6500+ +Total lines of code (LoC): 6700+ Total visual components (VC): 15 \ No newline at end of file diff --git a/Package/Delphi_XE5/LINA_D_XE5.identcache b/Package/Delphi_XE5/LINA_D_XE5.identcache index 7a546b0..d304868 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/Lina.jpg b/Resource/Bitmap/Lina.jpg new file mode 100644 index 0000000..56ae65a Binary files /dev/null and b/Resource/Bitmap/Lina.jpg differ diff --git a/Source/Compiled/uAdvCtrls.dcu b/Source/Compiled/uAdvCtrls.dcu index 39d6f4f..0d8b782 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 def8817..0abf0fa 100644 Binary files a/Source/Compiled/uBase.dcu and b/Source/Compiled/uBase.dcu differ diff --git a/Source/Compiled/uCrypt.dcu b/Source/Compiled/uCrypt.dcu index ad3444f..a21dc6a 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 91c1e18..1da206e 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 cdb754a..a7b8bd9 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 46cc87d..d978056 100644 Binary files a/Source/Compiled/uFrmCtrls.dcu and b/Source/Compiled/uFrmCtrls.dcu differ diff --git a/Source/Compiled/uLocalMgr.dcu b/Source/Compiled/uLocalMgr.dcu index 6f14b3c..6d6f545 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 1a4353b..54b3fbe 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 ecdfd1a..87255d0 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 5bf5d7a..65e9b38 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 a484d18..6f393f9 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 5124617..5294918 100644 Binary files a/Source/Compiled/uWebCtrls.dcu and b/Source/Compiled/uWebCtrls.dcu differ diff --git a/Source/uBase.pas b/Source/uBase.pas index 197b992..66ecd91 100644 --- a/Source/uBase.pas +++ b/Source/uBase.pas @@ -32,7 +32,7 @@ unit uBase; vermeiden. } {$DEFINE NO_GENERIC} {$IFEND} - {$IF CompilerVersion < 20.0} + {$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 @@ -41,6 +41,9 @@ unit uBase; in UnicodeStrings umwandelt und umgekehrt (sofern möglich). } {$DEFINE NO_UNICODE} {$IFEND} + {$DEFINE ADDSPLASHENTRY} + {$DEFINE ADDABOUTENTRY} + interface @@ -48,7 +51,7 @@ interface uses { Standard-Units } - SysUtils, Classes, Dialogs; + SysUtils, Classes, Dialogs, Graphics, ToolsAPI; type TComponentAbout = class @@ -75,12 +78,38 @@ type procedure AboutDlg; end; + procedure RegisterPackageOnSplash; + procedure RegisterPackageOnAbout; + const ComponentsPage = 'Lina'; About_Title = 'About...'; + Package_Name = 'Lina Components'; + Package_Description = 'Components and source library for Delphi'; + Package_License = 'Mozilla Public License (MPL) 2.0'; + Package_SKU = '(Dev-Preview)'; implementation +procedure RegisterPackageOnSplash; +var + SplashBitmap: TBitmap; +begin + SplashBitmap := TBitmap.Create; + try + SplashBitmap.LoadFromFile('..\..\Resource\Lina.bmp'); + (ToolsAPI.SplashScreenServices as IOTASplashScreenServices).AddPluginBitmap( + Package_Name,SplashBitmap.Handle,False,Package_License,Package_SKU); + finally + SplashBitmap.Free; + end; +end; + +procedure RegisterPackageOnAbout; +begin + +end; + constructor TComponentAbout.Create(Comp: ShortString = ''; Ver: Single = 1.0; Copy: ShortString = ''; Auth: ShortString = ''; Home: ShortString = ''); begin @@ -112,4 +141,9 @@ begin [mbClose],0) end; +initialization + {$IFDEF ADDSPLASHENTRY} + RegisterPackageOnSplash; + {$ENDIF} + end. diff --git a/Source/uFileTools.pas b/Source/uFileTools.pas index 494d24a..843dec8 100644 --- a/Source/uFileTools.pas +++ b/Source/uFileTools.pas @@ -123,6 +123,10 @@ type function ExtractDriveChar(const FileName: String): Char; function DriveCharToFileDir(DriveChar: Char): ShortString; function DriveCharToFilePath(DriveChar: Char): ShortString; + function DriveByteToDriveChar(DriveByte: Byte): Char; + function DriveCharToDriveByte(DriveChar: Char): Byte; + function DriveExists(DriveByte: Byte): Boolean; + function GetDriveTypeChar(DriveByte: Byte): UINT; function FileTimeToDateTime(FileTime: TFileTime): TDateTime; function ConvertFileSize(const InputSize: Int64; ConvertFactor: ShortInt = -1): Extended; function GetFileSize(FileName: String): Int64; @@ -495,6 +499,26 @@ begin Result := DriveCharToFileDir(DriveChar) + PathDelim; end; +function DriveByteToDriveChar(DriveByte: Byte): Char; +begin + Result := Chr(DriveByte + Ord('A')); +end; + +function DriveCharToDriveByte(DriveChar: Char): Byte; +begin + Result := Ord(DriveChar) - Ord('A'); +end; + +function DriveExists(DriveByte: Byte): Boolean; +begin + Result := (GetLogicalDrives and (1 shl DriveByte) <> 0); +end; + +function GetDriveTypeChar(DriveByte: Byte): UINT; +begin + Result := GetDriveType(PChar(String(DriveCharToFilePath(DriveByteToDriveChar(DriveByte))))); +end; + function FileTimeToDateTime(FileTime: TFileTime): TDateTime; var LocalTime: TFileTime; diff --git a/Source/uFrmCtrls.pas b/Source/uFrmCtrls.pas index da905f3..e85c919 100644 --- a/Source/uFrmCtrls.pas +++ b/Source/uFrmCtrls.pas @@ -435,6 +435,7 @@ type property References: TParamReferences read FReferences write SetReferences; end; + procedure SetTaskBarVisibe(const Value: Boolean); procedure ListParams(var OutList: TStrings); function StringFromParam(Ident,Value: String; Format: TParamFormat): String; function StringFromParamRef(ParamRef: TParamReference; UseDefVal: Boolean = True): String; @@ -471,6 +472,21 @@ begin RegisterComponents(ComponentsPage,[TSplashScreen,TProgressBarManager,TListBoxManager,TParamDefiner]); end; +procedure SetTaskBarVisibe(const Value: Boolean); +begin + if Value = True then + begin + ShowWindow(Application.Handle,SW_HIDE); + SetWindowLong(Application.Handle,GWL_EXSTYLE,GetWindowLong(Application.Handle,GWL_EXSTYLE) and not WS_EX_TOOLWINDOW or WS_EX_APPWINDOW); + ShowWindow(Application.Handle,SW_SHOW); + end else + begin + ShowWindow(Application.Handle,SW_SHOW); + SetWindowLong(Application.Handle,GWL_EXSTYLE,GetWindowLong(Application.Handle,GWL_EXSTYLE) and not WS_EX_TOOLWINDOW or WS_EX_APPWINDOW); + ShowWindow(Application.Handle,SW_HIDE); + end; +end; + procedure ListParams(var OutList: TStrings); var Index: Integer; diff --git a/Source/uLocalMgr.pas b/Source/uLocalMgr.pas index 0b89e8e..71c1bfd 100644 --- a/Source/uLocalMgr.pas +++ b/Source/uLocalMgr.pas @@ -10,7 +10,7 @@ interface uses { Standard-Units } - SysUtils, Classes, + SysUtils, Classes, Windows, { Andere Package-Units } uBase, uSysTools; @@ -18,33 +18,40 @@ type { Fehlermeldungen } EInvalidFormat = class(Exception); ELanguageTagExists = class(Exception); + ELocalizationParse = class(Exception); type { Hilfsklassen } TLanguageTag = String[3]; TComponentDetectMode = (cdTag,cdName); + TCommentAllow = type TLinePosition; type { Hauptklassen } TLocalizationFormat = class(TPersistent) private { Private-Deklarationen } + FAllowComment: TCommentAllow; FComment: ShortString; FSeparator: ShortString; FHeader: ShortString; + FIndent: ShortString; { Methoden } procedure SetComment(Value: ShortString); procedure SetSeparator(Value: ShortString); procedure SetHeader(Value: ShortString); + procedure SetIndent(Value: ShortString); public { Public-Deklarationen } constructor Create; destructor Destroy; override; published { Published-Deklarationen } - property Comment: ShortString read FComment write SetComment; - property Separator: ShortString read FSeparator write SetSeparator; + property AllowComment: TCommentAllow read FAllowComment write FAllowComment default lpAnyPosition; + property Comment: ShortString read FComment write SetComment; //nicht leer + property Separator: ShortString read FSeparator write SetSeparator; //nicht leer property Header: ShortString read FHeader write SetHeader; + property Indent: ShortString read FIndent write SetIndent; end; TLocalization = class(TCollectionItem) @@ -62,13 +69,14 @@ type procedure SetFormat(Value: TLocalizationFormat); protected { Protected-Deklarationen } + procedure RaiseParseError(Msg: String; LineIndex, CharIndex: Integer); public { Public-Deklarationen } constructor Create(Collection: TCollection); overload; override; constructor Create(Collection: TCollection; const AFileName: TFileName); overload; destructor Destroy; override; - function Check: Boolean; overload; - function Check(const Line: Integer): Boolean; overload; + //function Check: Boolean; overload; + //function Check(const Line: Integer): Boolean; overload; procedure Apply; published { Published-Deklarationen } @@ -144,6 +152,7 @@ end; constructor TLocalizationFormat.Create; begin inherited; + FAllowComment := lpAnyPosition; FComment := ';'; FSeparator := '='; FHeader := '*'; @@ -159,7 +168,7 @@ procedure TLocalizationFormat.SetComment(Value: ShortString); var Index: Integer; begin - if ArrayPos(Value,[FSeparator,FHeader]) <> -1 then + if (ArrayPos(Value,[FSeparator,FHeader,FIndent]) <> -1) or (Length(Value) = 0) then begin raise EInvalidFormat.Create('Invalid param format for property: "Comment"'); end; @@ -177,7 +186,7 @@ procedure TLocalizationFormat.SetSeparator(Value: ShortString); var Index: Integer; begin - if (ArrayPos(Value,[FComment,FHeader]) <> -1) or (Length(Value) = 0) then + if (ArrayPos(Value,[FComment,FHeader,FIndent]) <> -1) or (Length(Value) = 0) then begin raise EInvalidFormat.Create('Invalid param format for property: "Separator"'); end; @@ -195,7 +204,7 @@ procedure TLocalizationFormat.SetHeader(Value: ShortString); var Index: Integer; begin - if ArrayPos(Value,[FComment,FSeparator]) <> -1 then + if ArrayPos(Value,[FComment,FSeparator,FIndent]) <> -1 then begin raise EInvalidFormat.Create('Invalid param format for property: "Header"'); end; @@ -209,6 +218,24 @@ begin FHeader := Value; end; +procedure TLocalizationFormat.SetIndent(Value: ShortString); +var + Index: Integer; +begin + if ArrayPos(Value,[FComment,FSeparator,FHeader]) <> -1 then + begin + raise EInvalidFormat.Create('Invalid param format for property: "Header"'); + end; + for Index := 1 to Length(Value) do + begin + if Value[Index] in Spaces then + begin + raise EInvalidFormat.Create('Invalid param format for property: "Header"'); + end; + end; + FIndent := Value; +end; + { ---------------------------------------------------------------------------- TLocalization ---------------------------------------------------------------------------- } @@ -265,46 +292,89 @@ begin FFormat := Value; end; -function TLocalization.Check: Boolean; -var - Index: Integer; +procedure TLocalization.RaiseParseError(Msg: String; LineIndex, CharIndex: Integer); begin - for Index := 0 to Lines.Count do - begin - Check(Index); - end; + raise ELocalizationParse.Create('[' + IntToStr(LineIndex) + '.' + IntToStr(CharIndex) + ']' + ' ' + Msg); end; -function TLocalization.Check(const Line: Integer): Boolean; +{function TLocalization.Apply(const Line: Integer): Boolean; var Index: Integer; LineStr: String; - InComment: Boolean; - InSeparator: Boolean; - InHeader: Boolean; - InIndex: Byte; + InPart: array [3] of Byte; //0 = Header; 1 = Separator; 2 = Indent begin Result := True; LineStr := Lines.Strings[Index]; - for Index := 1 to Length(LineStr) do + { Standardwerte } + { InPart[0] := 0; + InPart[1] := 0; + InPart[2] := 0; + { Parse } + { for Index := 1 to Length(LineStr) do begin + if LineStr[Index] in Spaces then begin Continue; end; end; -end; +end; } procedure TLocalization.Apply; +var + LineIndex: Integer; + CharIndex: Integer; + Line: String; + Identifier: ShortString; + Value: String; + Expr: String; + Header: Boolean; + Position: (posPrefix,posIndent,posSeparator,posValue); begin - if Check = True then + for LineIndex := 0 to Lines.Count - 1 do begin - //... - (Collection as TLocalizations).Manager.FCurrent := Index; - end else - begin - //... + Line := Lines.Strings[LineIndex]; + for CharIndex := 1 to Length(Line) do + begin + if Expr = Format.Comment then + begin + + end; + if Line[CharIndex] in Spaces then + begin + case Position of + //[>PRE<] Indent SEP Value + posPrefix: + + //PRE [>Indent<] SEP Value + // posIndent: if Length(Expr then + + //PRE Indent [>SEP<] Value + // posSeparator: if Expr = Format.Separator then + begin + Position := posValue; + Continue; + end; + //PRE Indent SEP [>Value<] + posValue: Expr := Expr + Line[CharIndex]; + end; + end; + end; + { Auf vollständigkeit prüfen... } + case Position of + posPrefix: RaiseParseError('Prefix expected, but end of line found',LineIndex,CharIndex); + posIndent: if Header = True then + begin + RaiseParseError('Header expected, but end of line found',LineIndex,CharIndex); + end else + begin + RaiseParseError('Indent expected, but end of line found',LineIndex,CharIndex); + end; + posSeparator: RaiseParseError('Definition expected, but end of line found',LineIndex,CharIndex); + end; end; + //-------------------------------- + (Collection as TLocalizations).Manager.FCurrent := Index; end; { ---------------------------------------------------------------------------- diff --git a/Source/uSysTools.pas b/Source/uSysTools.pas index 37c4fea..8d9fc21 100644 --- a/Source/uSysTools.pas +++ b/Source/uSysTools.pas @@ -24,7 +24,8 @@ type type { Hilfsklassen } - TStringFilterMode = (sfmAnyPosition,sfmBeginning); + TLinePosition = (lpAnyPosition,lpBeginning); //Mutter-Hilfsklasse für sämtliche Enums + TStringFilterMode = type TLinePosition; TStringFilterOptions = set of (sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible); type @@ -61,7 +62,7 @@ type property Filtered: Boolean read FFiltered write FFiltered default True; property Filter: String read FFilter write FFilter; property FilteredStrings: TStrings read GetFilteredStrings; - property FilterMode: TStringFilterMode read FFilterMode write FFilterMode default sfmBeginning; + property FilterMode: TStringFilterMode read FFilterMode write FFilterMode default lpBeginning; property FilterOptions: TStringFilterOptions read FFilterOptions write FFilterOptions default [sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible]; end; @@ -100,6 +101,8 @@ type function RoundPos(Number: Extended; Pos: Byte): Extended; function FontSizeToHeight(Size: Integer; PpI: Integer): Integer; function FontHeightToSize(Height: Integer; PpI: Integer): Integer; + function ComponentByTag(Owner: TComponent; const Tag: Integer): TComponent; + function PQFormula(P,Q: Extended): TFloatArray; procedure PrintText(Strings: TStrings; Font: TFont); procedure EnableDebugPrivilege; @@ -365,6 +368,41 @@ begin Result := - Height * 72 div PpI; end; +function ComponentByTag(Owner: TComponent; const Tag: Integer): TComponent; +var + Index: Integer; +begin + for Index := 0 to Owner.ComponentCount - 1 do + begin + if Owner.Components[Index].Tag = Tag then + begin + Result := Owner.Components[Index]; + end; + end; +end; + +function PQFormula(P,Q: Extended): TFloatArray; +var + Root: Extended; +begin + Root := Sqr(P / 2) - Q; + if Root < 0 then + begin + SetLength(Result,0); + end else + begin + if Root = 0 then + begin + SetLength(Result,1); + end else + begin + SetLength(Result,2); + Result[1] := -(P / 2) - Sqrt(Root); + end; + Result[0] := -(P / 2) + Sqrt(Root); + end; +end; + procedure PrintText(Strings: TStrings; Font: TFont); var Index: Integer; @@ -495,7 +533,7 @@ begin inherited; FFilteredStrings := TStringList.Create; FFiltered := True; - FFilterMode := sfmBeginning; + FFilterMode := lpBeginning; FFilterOptions := [sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible]; end; @@ -540,8 +578,8 @@ begin StringValue := Trim(StringValue); end; StringPos := Pos(FilterValue,StringValue); - if (((FilterMode = sfmBeginning) and (StringPos = 1)) or - ((FilterMode = sfmAnyPosition) and (StringPos > 0))) or + if (((FilterMode = lpBeginning) and (StringPos = 1)) or + ((FilterMode = lpAnyPosition) and (StringPos > 0))) or ((Length(FilterValue) = 0) and (sfoDefaultVisible in FilterOptions)) then begin FFilteredStrings.Add(Strings[Index]);