mirror of
https://bitbucket.org/Dennis07/lina-components.git
synced 2025-02-12 10:25:59 +02:00
Version 1.0 DEV 1.13
Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
parent
7a08ff2791
commit
9fa2450281
@ -5,4 +5,3 @@ LanguageSelect @ LANGUAGE
|
||||
* Buttons
|
||||
Close = Schliessen
|
||||
Hello = Hallo!
|
||||
fff @
|
||||
|
Binary file not shown.
Binary file not shown.
@ -68,16 +68,16 @@ object Form1: TForm1
|
||||
item
|
||||
Section = 'Buttons'
|
||||
Indent = 'Close'
|
||||
Control = btClose
|
||||
Component = btClose
|
||||
end
|
||||
item
|
||||
Section = 'Buttons'
|
||||
Indent = 'Hello'
|
||||
Control = btHello
|
||||
Component = btHello
|
||||
end
|
||||
item
|
||||
Indent = 'LanguageSelect'
|
||||
Control = gbLaguage
|
||||
Component = gbLaguage
|
||||
end>
|
||||
Left = 288
|
||||
Top = 8
|
||||
|
@ -66,16 +66,18 @@ begin
|
||||
for Index := 0 to LanguageFiles.Count - 1 do
|
||||
begin
|
||||
(LocalizationManager.Localizations.Add as TLocalization).Lines.LoadFromFile(ExtractFilePath(Application.ExeName) + ChangeFileExt(LanguageFiles.Strings[Index],'.loc'));
|
||||
//(LocalizationManager.Localizations.Items[Index] as TLocalization).Format.Indent := '+';
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.lbLanguageClick(Sender: TObject);
|
||||
//var Indents: TStrings;
|
||||
var Indents: TStrings;
|
||||
begin
|
||||
LocalizationManager.Current := lbLanguage.ItemIndex;
|
||||
// indents := TStringList.Create;
|
||||
// LocalizationManager.Data.ReadValues('',indents);
|
||||
// showmessage(indents.Text);
|
||||
// Showmessage(booltostr(LocalizationManager.Data.IndentExists('','HelloWorld'),true));
|
||||
// indents := TStringList.Create;
|
||||
// LocalizationManager.Data.ReadValues('buttons',indents);
|
||||
// showmessage(indents.Text);
|
||||
// indents.Free;
|
||||
end;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
These statistics cover the official repository of Lina Components.
|
||||
|
||||
Total lines of code (LoC): 7900+
|
||||
Total lines of code (LoC): 8100+
|
||||
Total visual components (VC): 15
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -16,7 +16,8 @@ interface
|
||||
|
||||
uses
|
||||
{ Standard-Units }
|
||||
SysUtils, Classes, Controls, Forms, StdCtrls, ExtCtrls,
|
||||
SysUtils, Classes, Controls, Forms, StdCtrls, ExtCtrls, ComCtrls, Dialogs,
|
||||
Menus, Buttons,
|
||||
{ Andere Package-Units }
|
||||
uBase, uSysTools;
|
||||
|
||||
@ -169,10 +170,10 @@ type
|
||||
FSection: String;
|
||||
FIndent: String;
|
||||
FReference: PString;
|
||||
FControl: TControl;
|
||||
FComponent: TComponent;
|
||||
{ Methoden }
|
||||
procedure SetIndent(Value: String);
|
||||
procedure SetControl(Value: TControl);
|
||||
procedure SetComponent(Value: TComponent);
|
||||
public
|
||||
{ Public-Deklarationen }
|
||||
destructor Destroy; override;
|
||||
@ -183,7 +184,7 @@ type
|
||||
{ Published-Deklarationen }
|
||||
property Section: String read FSection write FSection;
|
||||
property Indent: String read FIndent write SetIndent;
|
||||
property Control: TControl read FControl write SetControl;
|
||||
property Component: TComponent read FComponent write SetComponent;
|
||||
end;
|
||||
|
||||
TLocalizationManager = class(TComponent)
|
||||
@ -479,7 +480,6 @@ begin
|
||||
//Leere Zeile
|
||||
if Length(Lines.Strings[Line]) = 0 then
|
||||
begin
|
||||
Inc(Current);
|
||||
Continue;
|
||||
end;
|
||||
//Zeilenanfang
|
||||
@ -495,10 +495,6 @@ begin
|
||||
begin
|
||||
if (not (Current^ in Spaces)) or ((((Address = False) and (Position = posValue)) or (Header = True)) and (Length(Block) <> 0)) then
|
||||
begin
|
||||
if Header = True then
|
||||
begin
|
||||
Header := True;
|
||||
end;
|
||||
//Zeichen zu Block hinzufügen
|
||||
Block := Block + Current^;
|
||||
if Current = @Lines.Strings[Line][Length(Lines.Strings[Line])] then
|
||||
@ -535,7 +531,7 @@ begin
|
||||
((Block = Format.Comment) and ((Format.AllowComment = lpAnyPosition) or ((Format.AllowComment = lpBeginning) and (Current = @Lines.Strings[Line][1]))) or (Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) or (InComment^ = #0)) or
|
||||
//Zeilenende
|
||||
((Current = @Lines.Strings[Line][Length(Lines.Strings[Line])]) and (not (Current^ in Spaces))) or
|
||||
//Addressenende
|
||||
//Adressenende
|
||||
(Address = True) then
|
||||
begin
|
||||
//Block fertig
|
||||
@ -604,8 +600,11 @@ begin
|
||||
Inc(Position);
|
||||
end;
|
||||
posIndent: begin
|
||||
if Header = False then
|
||||
begin
|
||||
Inc(Position);
|
||||
end;
|
||||
Indent := TrimRight(Block);
|
||||
Inc(Position);
|
||||
end;
|
||||
posSeparator: begin
|
||||
Address := (Block = Format.Address);
|
||||
@ -695,8 +694,6 @@ procedure TLocalizationData.AddIndent(const Section: String; Indent: String);
|
||||
Stattdessen die Methode WriteString() bzw. Address() verwenden, welche unter
|
||||
anderem auf diese Methode zurückgreift. Ansonsten kann es zu
|
||||
Zugriffsverletzungen oder nicht addressierten Werten kommen. }
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
SetLength(Sections[IndexOfSection(Section)].Reference^,Length(Sections[IndexOfSection(Section)].Reference^) + 1);
|
||||
SetLength(Values,Length(Values) + 1);
|
||||
@ -855,7 +852,7 @@ end;
|
||||
|
||||
destructor TLocalizationReference.Destroy;
|
||||
begin
|
||||
Control := nil;
|
||||
Component := nil;
|
||||
Reference := nil;
|
||||
inherited;
|
||||
end;
|
||||
@ -878,15 +875,18 @@ begin
|
||||
FIndent := Value;
|
||||
end;
|
||||
|
||||
procedure TLocalizationReference.SetControl(Value: TControl);
|
||||
procedure TLocalizationReference.SetComponent(Value: TComponent);
|
||||
begin
|
||||
if (Value is TForm) or (Value is TButton) or (Value is TEdit) or
|
||||
(Value is TCheckBox) or (Value is TComboBox) or (Value is TMemo) or
|
||||
(Value is TListBox) or (Value is TLabel) or (Value is TStaticText) or
|
||||
(Value is TGroupBox) or (Value is TRadioButton) or (Value is TPanel) or
|
||||
(Value is TRadioGroup) or (Value = nil) then
|
||||
(Value is TRadioGroup) or (Value is TStatusBar) or (Value is TTabSheet) or
|
||||
(Value is TOpenDialog) or (Value is TRichEdit) or (Value is TMenuItem) or
|
||||
(Value is TBitBtn) or (Value is TSpeedButton) or (Value is TLabeledEdit) or
|
||||
(Value is TBoundLabel) or (Value = nil) then
|
||||
begin
|
||||
FControl := Value;
|
||||
FComponent := Value;
|
||||
end else
|
||||
begin
|
||||
raise EUnsupportedComponent.Create('"' + Value.ClassName + '" is an unsupported class');
|
||||
@ -894,79 +894,125 @@ begin
|
||||
end;
|
||||
|
||||
procedure TLocalizationReference.Apply;
|
||||
{ Alle (relevanten) Controls aus der Unit "StdCtrls", sowie TPanel, TRadioGroup
|
||||
und TForm werden unterstützt. }
|
||||
{ Alle (relevanten) Controls aus der Unit "StdCtrls", "Buttons", sowie alle
|
||||
herkömmlichen Dialoge (nicht Vista-Dialoge), TPanel, TRadioGroup, TStatusBar,
|
||||
TTabSheet, TMenuItem, und TForm werden unterstützt. }
|
||||
begin
|
||||
if Reference <> nil then
|
||||
begin
|
||||
Reference^ := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,Reference^);
|
||||
end;
|
||||
if Assigned(Control) = True then
|
||||
if Assigned(Component) = True then
|
||||
begin
|
||||
//TForm
|
||||
if Control is TForm then
|
||||
if Component is TForm then
|
||||
begin
|
||||
(Control as TForm).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TForm).Caption);
|
||||
(Component as TForm).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TForm).Caption);
|
||||
end;
|
||||
//TButton
|
||||
if Control is TButton then
|
||||
if Component is TButton then
|
||||
begin
|
||||
(Control as TButton).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TButton).Caption);
|
||||
(Component as TButton).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TButton).Caption);
|
||||
end;
|
||||
//TEdit
|
||||
if Control is TEdit then
|
||||
if Component is TEdit then
|
||||
begin
|
||||
(Control as TEdit).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TEdit).Text);
|
||||
(Component as TEdit).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TEdit).Text);
|
||||
end;
|
||||
//TLabeledEdit
|
||||
if Component is TLabeledEdit then
|
||||
begin
|
||||
(Component as TLabeledEdit).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TLabeledEdit).Text);
|
||||
end;
|
||||
//TBoundLabel
|
||||
if Component is TBoundLabel then
|
||||
begin
|
||||
(Component as TBoundLabel).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TBoundLabel).Caption);
|
||||
end;
|
||||
//TCheckBox
|
||||
if Control is TCheckBox then
|
||||
if Component is TCheckBox then
|
||||
begin
|
||||
(Control as TCheckBox).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TCheckBox).Caption);
|
||||
(Component as TCheckBox).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TCheckBox).Caption);
|
||||
end;
|
||||
//TComboBox
|
||||
if Control is TComboBox then
|
||||
if Component is TComboBox then
|
||||
begin
|
||||
(Control as TComboBox).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TComboBox).Text);
|
||||
(Component as TComboBox).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TComboBox).Text);
|
||||
end;
|
||||
//TMemo
|
||||
if Control is TMemo then
|
||||
if Component is TMemo then
|
||||
begin
|
||||
(Control as TMemo).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TMemo).Text);
|
||||
(Component as TMemo).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TMemo).Text);
|
||||
end;
|
||||
//TListBox
|
||||
if Control is TListBox then
|
||||
if Component is TListBox then
|
||||
begin
|
||||
(Control as TListBox).Items.Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TListBox).Items.Text);
|
||||
(Component as TListBox).Items.Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TListBox).Items.Text);
|
||||
end;
|
||||
//TLabel
|
||||
if Control is TLabel then
|
||||
if Component is TLabel then
|
||||
begin
|
||||
(Control as TLabel).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TLabel).Caption);
|
||||
(Component as TLabel).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TLabel).Caption);
|
||||
end;
|
||||
//TStaticText
|
||||
if Control is TStaticText then
|
||||
if Component is TStaticText then
|
||||
begin
|
||||
(Control as TStaticText).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TStaticText).Caption);
|
||||
(Component as TStaticText).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TStaticText).Caption);
|
||||
end;
|
||||
//TGroupBox
|
||||
if Control is TGroupBox then
|
||||
if Component is TGroupBox then
|
||||
begin
|
||||
(Control as TGroupBox).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TGroupBox).Caption);
|
||||
(Component as TGroupBox).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TGroupBox).Caption);
|
||||
end;
|
||||
//TRadioButton
|
||||
if Control is TRadioButton then
|
||||
if Component is TRadioButton then
|
||||
begin
|
||||
(Control as TRadioButton).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TRadioButton).Caption);
|
||||
(Component as TRadioButton).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TRadioButton).Caption);
|
||||
end;
|
||||
//TPanel
|
||||
if Control is TPanel then
|
||||
if Component is TPanel then
|
||||
begin
|
||||
(Control as TPanel).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TPanel).Caption);
|
||||
(Component as TPanel).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TPanel).Caption);
|
||||
end;
|
||||
//TRadioGroup
|
||||
if Control is TRadioGroup then
|
||||
if Component is TRadioGroup then
|
||||
begin
|
||||
(Control as TRadioGroup).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Control as TRadioGroup).Caption);
|
||||
(Component as TRadioGroup).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TRadioGroup).Caption);
|
||||
end;
|
||||
//TStatusBar
|
||||
if Component is TStatusBar then
|
||||
begin
|
||||
(Component as TStatusBar).SimpleText := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TStatusBar).SimpleText);
|
||||
end;
|
||||
//TTabSheet
|
||||
if Component is TTabSheet then
|
||||
begin
|
||||
(Component as TTabSheet).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TTabSheet).Caption);
|
||||
end;
|
||||
//TOpenDialog
|
||||
if Component is TOpenDialog then
|
||||
begin
|
||||
(Component as TOpenDialog).Title := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TOpenDialog).Title);
|
||||
end;
|
||||
//TRichEdit
|
||||
if Component is TRichEdit then
|
||||
begin
|
||||
(Component as TRichEdit).Text := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TRichEdit).Text);
|
||||
end;
|
||||
//TMenuItem
|
||||
if Component is TMenuItem then
|
||||
begin
|
||||
(Component as TMenuItem).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TMenuItem).Caption);
|
||||
end;
|
||||
//TBitBtn
|
||||
if Component is TBitBtn then
|
||||
begin
|
||||
(Component as TBitBtn).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TBitBtn).Caption);
|
||||
end;
|
||||
//TSpeedButton
|
||||
if Component is TSpeedButton then
|
||||
begin
|
||||
(Component as TSpeedButton).Caption := (Collection as TLocalizationReferences).FManager.Data.ReadString(Section,Indent,(Component as TSpeedButton).Caption);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -1030,6 +1076,7 @@ begin
|
||||
OnChange(Self,FCurrent,Value);
|
||||
end;
|
||||
FCurrent := Value;
|
||||
FReferences.Apply;
|
||||
end;
|
||||
|
||||
procedure TLocalizationManager.SetIgnoreCase(Value: Boolean);
|
||||
|
@ -253,7 +253,10 @@ type
|
||||
function FontHeightToSize(Height: Integer; PpI: Integer): Integer;
|
||||
function ComponentByTag(Owner: TComponent; const Tag: Integer): TComponent;
|
||||
function IntToStrMinLength(Value: Integer; MinLength: SmallInt): String;
|
||||
function MultiPos(const SubStr, Str: ShortString; Offset: Integer = 1): TIntegerArray; overload;
|
||||
function MultiPos(const SubStr, Str: String; Offset: Integer = 1): TIntegerArray; overload;
|
||||
procedure PrintText(Strings: TStrings; Font: TFont);
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char);
|
||||
procedure EnableDebugPrivilege;
|
||||
|
||||
const
|
||||
@ -1053,6 +1056,37 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function MultiPos(const SubStr, Str: ShortString; Offset: Integer = 1): TIntegerArray;
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
function MultiPos(const SubStr, Str: String; Offset: Integer = 1): TIntegerArray;
|
||||
var
|
||||
Temp: PChar;
|
||||
Position: Integer;
|
||||
Further: TIntegerArray;
|
||||
begin
|
||||
SetLength(Result,0);
|
||||
if (Offset < 1) or (Offset - 1 > (Length(Str) - Length(SubStr))) then
|
||||
begin
|
||||
Exit;
|
||||
end;
|
||||
Temp := @Str[OffSet];
|
||||
Position := Pos(SubStr,String(Temp));
|
||||
if Position <> 0 then
|
||||
begin
|
||||
SetLength(Result,1);
|
||||
Result[0] := Position;
|
||||
Further := MultiPos(SubStr,Str,Offset + Position + Length(SubStr) - 1);
|
||||
if Length(Further) <> 0 then
|
||||
begin
|
||||
SetLength(Result,1 + Length(Further));
|
||||
Move(Further[0],Result[1],SizeOf(Further) * Length(Further));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure PrintText(Strings: TStrings; Font: TFont);
|
||||
var
|
||||
Index: Integer;
|
||||
@ -1074,6 +1108,24 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ExtractChars(var Text: String; Chars: array of Char);
|
||||
var
|
||||
Current: PChar;
|
||||
OutPut: String;
|
||||
begin
|
||||
Current := @Text[1];
|
||||
SetLength(OutPut,0);
|
||||
while Current^ <> #0 do
|
||||
begin
|
||||
if ArrayPos(Current^,Chars) <> -1 then
|
||||
begin
|
||||
OutPut := OutPut + Current^;
|
||||
end;
|
||||
Inc(Current);
|
||||
end;
|
||||
Text := OutPut;
|
||||
end;
|
||||
|
||||
procedure EnableDebugPrivilege;
|
||||
var
|
||||
Token: THandle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user