1
0
mirror of https://bitbucket.org/Dennis07/lina-components.git synced 2025-02-12 10:25:59 +02:00

Version 1.0 DEV 1.14a

Signed-off-by: Dennis07 <den.goehlert@t-online.de>
This commit is contained in:
Dennis07 2015-06-26 01:12:44 +02:00
parent 924f4ba3d2
commit 5ac07034e0
32 changed files with 572 additions and 48 deletions

View File

@ -5,3 +5,5 @@ LanguageSelect @ LANGUAGE
* Buttons
Close = Schliessen
Hello = Hallo!
* Other
Coding = Kodierung

View File

@ -0,0 +1,9 @@
; No-section content
HelloWorld = Hallo, $# 10 Welt! ; MessageBox variable
Language = Sprache
LanguageSelect @ LANGUAGE
* Buttons
Close = Schliessen
Hello = Hallo!
* Other
Coding = Kodierung

Binary file not shown.

View File

@ -3,7 +3,7 @@ object Form1: TForm1
Top = 0
BorderStyle = bsDialog
Caption = 'LinaComponents "TScriptManager" Example'
ClientHeight = 180
ClientHeight = 211
ClientWidth = 353
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@ -16,13 +16,22 @@ object Form1: TForm1
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object laEncoding: TLabel
Left = 8
Top = 132
Width = 65
Height = 13
AutoSize = False
Caption = 'Encoding:'
end
object pnButtons: TPanel
Left = 0
Top = 139
Top = 170
Width = 353
Height = 41
Align = alBottom
TabOrder = 0
ExplicitTop = 139
object btClose: TButton
Left = 8
Top = 8
@ -59,6 +68,21 @@ object Form1: TForm1
OnClick = lbLanguageClick
end
end
object coEncoding: TComboBox
Left = 79
Top = 129
Width = 90
Height = 21
Style = csDropDownList
ItemIndex = 2
TabOrder = 2
Text = 'Unicode'
OnChange = coEncodingChange
Items.Strings = (
'ANSI'
'UTF8'
'Unicode')
end
object LocalizationManager: TLocalizationManager
Localizations = <>
References = <
@ -81,6 +105,12 @@ object Form1: TForm1
Section = 'Buttons'
Indent = 'Close'
Field = 'Caption'
end
item
Component = laEncoding
Section = 'Other'
Indent = 'Coding'
Field = 'Caption'
end>
Left = 240
Top = 32

View File

@ -15,7 +15,7 @@ interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, uBase, uLocalMgr, Vcl.StdCtrls,
Vcl.ExtCtrls, uFileTools;
Vcl.ExtCtrls, uFileTools, uSysTools;
type
TForm1 = class(TForm)
@ -25,10 +25,13 @@ type
btHello: TButton;
gbLaguage: TGroupBox;
lbLanguage: TListBox;
laEncoding: TLabel;
coEncoding: TComboBox;
procedure FormCreate(Sender: TObject);
procedure lbLanguageClick(Sender: TObject);
procedure btHelloClick(Sender: TObject);
procedure btCloseClick(Sender: TObject);
procedure coEncodingChange(Sender: TObject);
private
{ Private-Deklarationen }
HelloWorld: String;
@ -53,6 +56,22 @@ begin
ShowMessage(HelloWorld);
end;
procedure TForm1.coEncodingChange(Sender: TObject);
var
Index: Integer;
begin
for Index := 0 to lbLanguage.Items.Count - 1 do
begin
case coEncoding.ItemIndex of
0: (LocalizationManager.Localizations.Items[Index] as TLocalization).Encoding := ceANSI;
1: (LocalizationManager.Localizations.Items[Index] as TLocalization).Encoding := ceUTF8;
2: (LocalizationManager.Localizations.Items[Index] as TLocalization).Encoding := ceUnicode;
end;
(LocalizationManager.Localizations.Items[Index] as TLocalization).Lines.LoadFromFile(ExtractFilePath(Application.ExeName) + ChangeFileExt(lbLanguage.Items.Strings[Index],'.loc'));
end;
LocalizationManager.Current := lbLanguage.ItemIndex;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
Index: Integer;
@ -66,8 +85,12 @@ begin
lbLanguage.Items.Assign(LanguageFiles);
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 := '+';
(LocalizationManager.Localizations.Add as TLocalization).Lines.LoadFromFile(ExtractFilePath(Application.ExeName) + ChangeFileExt(LanguageFiles.Strings[Index],'.loc'));
// (LocalizationManager.Localizations.Add as TLocalization).Encoding := ceUnicode;
// (LocalizationManager.Localizations.Items[LocalizationManager.Localizations.Count - 1] as TLocalization).Lines.LoadFromFile(ExtractFilePath(Application.ExeName) + ChangeFileExt(LanguageFiles.Strings[Index],'.loc'));
// // (LocalizationManager.Localizations.Items[Index] as TLocalization).Format.Indent := '+';
// 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;
end;
@ -75,12 +98,14 @@ end;
procedure TForm1.lbLanguageClick(Sender: TObject);
var Indents: TStrings;
begin
// Showmessage((LocalizationManager.Localizations.Items[0] as TLocalization).Lines.Text);
LocalizationManager.Current := lbLanguage.ItemIndex;
// Showmessage(booltostr(LocalizationManager.Data.IndentExists('','HelloWorld'),true));
// // Showmessage(booltostr(LocalizationManager.Data.IndentExists('','HelloWorld'),true));
// indents := TStringList.Create;
// LocalizationManager.Data.ReadValues('buttons',indents);
// showmessage(indents.Text);
// indents.Free;
end;
end.

View File

@ -1,4 +1,4 @@
These statistics cover the official repository of Lina Components.
Total lines of code (LoC): 9500+
Total visual components (VC): 16
Total lines of code (LoC): 9900+
Total visual components (VC): 17

View File

@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<BorlandProject>
<Transactions>
<Transaction>1899.12.30 00:00:00.000.576,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uSysTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.508,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBase.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.650,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uSysCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBattery.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.518,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBattery.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.173,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uInit.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.932,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.592,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uFileTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.412,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.325,=dbrtl.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.809,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc</Transaction>
<Transaction>1899.12.30 00:00:00.000.681,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc=</Transaction>
<Transaction>1899.12.30 00:00:00.000.143,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm</Transaction>
<Transaction>1899.12.30 00:00:00.000.318,=vcl.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.537,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm=C:\Users\Dennis G\Documents\CodeQuality.htm</Transaction>
<Transaction>1899.12.30 00:00:00.000.633,C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\LINA_D_XE5.dproj=C:\Users\Dennis\Documents\RAD Studio\Projekte\Package1.dproj</Transaction>
<Transaction>1899.12.30 00:00:00.000.577,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBattery.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.809,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Resource\Lina.rc</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.508,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBase.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.576,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uSysTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.325,=dbrtl.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.412,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.674,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.675,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.592,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uFileTools.pas</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.621,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.896,C:\Users\Dennis G\Documents\CodeQuality.htm=</Transaction>
<Transaction>1899.12.30 00:00:00.000.648,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uScriptMgr.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.204,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFileCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\uFileCtrls.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.318,=vcl.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.414,C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLinaTest.pas=</Transaction>
<Transaction>1899.12.30 00:00:00.000.577,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBattery.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.556,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uLocalMgr.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.555,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBase.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.075,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCalc.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.143,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Untitled1.htm</Transaction>
<Transaction>1899.12.30 00:00:00.000.518,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uBattery.pas</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.648,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uScriptMgr.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.896,C:\Users\Dennis G\Documents\CodeQuality.htm=</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.971,=IndySystem.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.555,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uBase.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.196,=rtl.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.525,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCrypt.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.584,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uVirtObj.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.686,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uSysTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.075,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCalc.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.118,=IndyCore.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.535,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFileTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.582,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uWebCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.672,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uFrmCtrls.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.633,=C:\Users\Dennis\Documents\RAD Studio\Projekte\LinaComponents\uLocalMgr.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.686,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uSysTools.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.672,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\uFrmCtrls.pas</Transaction>
<Transaction>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</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.791,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.546,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFrmCtrls.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.674,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.837,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.675,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.411,C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uAdvCtrls.pas=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Package\Delphi_XE5\Unit1.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.045,=IndyProtocols.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.525,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uCrypt.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.857,=PascalScript_Core_D19.dcp</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.566,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uScriptMgr.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.045,=IndyProtocols.dcp</Transaction>
<Transaction>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</Transaction>
<Transaction>1899.12.30 00:00:00.000.857,=PascalScript_Core_D19.dcp</Transaction>
<Transaction>1899.12.30 00:00:00.000.546,=C:\Users\Dennis G\Documents\RAD Studio\Projekte\LinaComponents\Source\uFrmCtrls.pas</Transaction>
<Transaction>1899.12.30 00:00:00.000.799,=PascalScript_Core_D19.dcp</Transaction>
</Transactions>
<ProjectSortOrder AutoSort="0" SortType="0">

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

View File

@ -38,6 +38,9 @@ TSCRIPTMANAGER32 BITMAP "Bitmap\Large\TScriptManager.bmp"
TSCROLLLISTBOX BITMAP "Bitmap\TScrollListBox.bmp"
TSCROLLLISTBOX16 BITMAP "Bitmap\Small\TScrollListBox.bmp"
TSCROLLLISTBOX32 BITMAP "Bitmap\Large\TScrollListBox.bmp"
TSHORTCUTLABEL BITMAP "Bitmap\TShortcutLabel.bmp"
TSHORTCUTLABEL16 BITMAP "Bitmap\Small\TShortcutLabel.bmp"
TSHORTCUTLABEL32 BITMAP "Bitmap\Large\TShortcutLabel.bmp"
TSPLASHSCREEN BITMAP "Bitmap\TSplashScreen.bmp"
TSPLASHSCREEN16 BITMAP "Bitmap\Small\TSplashScreen.bmp"
TSPLASHSCREEN32 BITMAP "Bitmap\Large\TSplashScreen.bmp"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -17,12 +17,14 @@ interface
uses
{ Standard-Units }
SysUtils, Classes, StdCtrls, Windows, Messages, Graphics, Controls, Printers,
Contnrs,
{ Andere Package-Units }
uBase;
uBase, uFileTools;
type
{ Hilfsklassen }
TMemoCaptionMode = (mcmAnyState,mcmUnfocusedOnly);
TShortcutLabelState = (slsDefault,slsHovered,slsPressed);
type
{ Ereignisse }
@ -106,9 +108,69 @@ type
property CaptionPosition: TPoint read FCaptionPosition write FCaptionPosition;
end;
TShortcutLabel = class;
TShortcutLabelFont = class(TPersistent)
private
{ Private-Deklarationen }
FLabel: TShortcutLabel;
FDefault: TFont;
FHovered: TFont;
FPressed: TFont;
FVisited: TColor;
{ Methoden }
procedure SetDefault(Value: TFont);
procedure SetHovered(Value: TFont);
procedure SetPressed(Value: TFont);
procedure SetVisited(Value: TColor);
procedure FontChange(Sender: TObject);
public
{ Public-Deklarationen }
constructor Create(ALabel: TShortcutLabel);
destructor Destroy; override;
procedure Update;
published
{ Published-Deklarationen }
property Default: TFont read FDefault write SetDefault;
property Hovered: TFont read FHovered write SetHovered;
property Pressed: TFont read FPressed write SetPressed;
property Visited: TColor read FVisited write SetVisited default clHotlight;
end;
TShortcutLabel = class(TLabel)
protected
{ Protected-Deklarationen }
procedure RegisterToList;
procedure UnregisterFromList;
private
{ Private-Deklarationen }
FAbout: TComponentAbout;
FTarget: String;
FState: TShortcutLabelState;
FFont: TShortcutLabelFont;
{ Methoden }
procedure SetFont(Value: TShortcutLabelFont);
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure WMLButtonDown(var Message: TWMLButtonDown); message WM_LBUTTONDOWN;
procedure WMLButtonUp(var Message: TWMLButtonUp); message WM_LBUTTONUP;
public
{ Public-Deklarationen }
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Click; override;
property State: TShortcutLabelState read FState default slsDefault;
published
{ Published-Deklarationen }
property About: TComponentAbout read FAbout;
property Target: String read FTarget write FTarget;
property Font: TShortcutLabelFont read FFont write SetFont;
end;
procedure Register;
function BmpToIco(Bitmap: TBitmap): TIcon;
function TargetVisited(Target: String): Boolean;
const
{ Meta-Daten }
@ -126,6 +188,12 @@ const
PaintMemoComponent_Version = 1.0;
PaintMemoComponent_Copyright = 'Copyright © 2014';
PaintMemoComponent_Author = 'Dennis Göhlert a.o.';
ShortcutLabelComponent_Name = 'ShortcutLabel';
ShortcutLabelComponent_Version = 1.0;
ShortcutLabelComponent_Copyright = 'Copyright © 2014';
ShortcutLabelComponent_Author = 'Dennis Göhlert a.o.';
{ Messages }
BS_COMMANDLINK = $0000000E;
BM_SETIMAGE = $00F7;
@ -133,11 +201,15 @@ const
BCM_FIRST = $1600;
BCM_SETSHIELD = BCM_FIRST + $000C;
var
VisitedTargets: TStrings;
ShortcutLabels: TObjectList;
implementation
procedure Register;
begin
RegisterComponents(ComponentsPage,[TCommandButton,TScrollListBox,TPaintMemo]);
RegisterComponents(ComponentsPage,[TCommandButton,TScrollListBox,TPaintMemo,TShortcutLabel]);
end;
function BmpToIco(Bitmap: TBitmap): TIcon;
@ -154,6 +226,16 @@ begin
end;
end;
function TargetVisited(Target: String): Boolean;
begin
if VisitedTargets = nil then
begin
VisitedTargets := TStringList.Create;
(VisitedTargets as TStringList).Duplicates := dupIgnore;
end;
Result := (VisitedTargets.IndexOf(Target) <> -1);
end;
{ ----------------------------------------------------------------------------
TAdvancedButton
---------------------------------------------------------------------------- }
@ -267,6 +349,7 @@ end;
procedure TPaintMemo.SetCaptionFont(Value: TFont);
begin
FCaptionFont.Assign(Value);
Repaint;
end;
procedure TPaintMemo.WMPaint(var Message: TWMPaint);
@ -276,7 +359,7 @@ var
begin
inherited;
FCaptionVisible := False;
if FShowCaption = True then
if (FShowCaption = True) and (Message.DC <> 0) and (not (csDestroying in ComponentState)) then
begin
if ((Focused = False) or (CaptionMode = mcmAnyState)) and (Length(Text) < 1) then
begin
@ -301,4 +384,176 @@ begin
end;
end;
{ ----------------------------------------------------------------------------
TShortcutLabelFont
---------------------------------------------------------------------------- }
constructor TShortcutLabelFont.Create(ALabel: TShortcutLabel);
begin
FLabel := ALabel;
FDefault := TFont.Create;
FHovered := TFont.Create;
FPressed := TFont.Create;
Default.OnChange := FontChange;
Default.Color := clHotlight;
Hovered.OnChange := FontChange;
Hovered.Color := clHighlight;
Hovered.Style := [fsUnderline];
Pressed.OnChange := FontChange;
Pressed.Color := clHotlight;
Pressed.Style := [fsUnderline];
Visited := clHotlight;
end;
destructor TShortcutLabelFont.Destroy;
begin
FLabel := nil;
FDefault.Free;
FHovered.Free;
FPressed.Free;
inherited;
end;
procedure TShortcutLabelFont.Update;
begin
case FLabel.State of
slsDefault: (FLabel as TLabel).Font.Assign(Default);
slsHovered: (FLabel as TLabel).Font.Assign(Hovered);
slsPressed: (FLabel as TLabel).Font.Assign(Pressed);
end;
if TargetVisited(FLabel.Target) = True then
begin
(FLabel as TLabel).Font.Color := Visited;
end;
end;
procedure TShortcutLabelFont.SetDefault(Value: TFont);
begin
FDefault.Assign(Value);
Update;
end;
procedure TShortcutLabelFont.SetHovered(Value: TFont);
begin
FHovered.Assign(Value);
Update;
end;
procedure TShortcutLabelFont.SetPressed(Value: TFont);
begin
FPressed.Assign(Value);
Update;
end;
procedure TShortcutLabelFont.SetVisited(Value: TColor);
begin
FVisited := Value;
Update;
end;
procedure TShortcutLabelFont.FontChange(Sender: TObject);
begin
Update;
end;
{ ----------------------------------------------------------------------------
TShortcutLabel
---------------------------------------------------------------------------- }
constructor TShortcutLabel.Create(AOwner: TComponent);
begin
inherited;
FAbout := TComponentAbout.Create(ShortcutLabelComponent_Name,ShortcutLabelComponent_Version,ShortcutLabelComponent_Copyright,ShortcutLabelComponent_Author);
FState := slsDefault;
FFont := TShortcutLabelFont.Create(Self);
Cursor := crHandPoint;
RegisterToList;
end;
destructor TShortcutLabel.Destroy;
begin
FAbout.Free;
FFont.Free;
UnregisterFromList;
inherited;
end;
procedure TShortcutLabel.Click;
var
Index: Integer;
begin
inherited;
if Length(Target) <> 0 then
begin
ExecuteFile(Target);
VisitedTargets.Add(Target);
for Index := 0 to ShortcutLabels.Count - 1 do
begin
(ShortcutLabels.Items[Index] as TShortcutLabel).Font.Update;
end;
end;
end;
procedure TShortcutLabel.SetFont(Value: TShortcutLabelFont);
begin
FFont := Value;
FFont.Update;
end;
procedure TShortcutLabel.RegisterToList;
begin
if ShortcutLabels = nil then
begin
ShortcutLabels := TObjectList.Create(False);
end;
ShortcutLabels.Add(Self);
end;
procedure TShortcutLabel.UnregisterFromList;
begin
if ShortcutLabels.Count = 1 then
begin
ShortcutLabels.Free;
end;
end;
procedure TShortcutLabel.CMMouseEnter(var Message: TMessage);
begin
inherited;
if State <> slsHovered then
begin
FState := slsHovered;
Font.Update;
end;
end;
procedure TShortcutLabel.CMMouseLeave(var Message: TMessage);
begin
inherited;
FState := slsDefault;
Font.Update;
end;
procedure TShortcutLabel.WMLButtonDown(var Message: TWMLButtonDown);
begin
inherited;
FState := slsPressed;
Font.Update;
end;
procedure TShortcutLabel.WMLButtonUp(var Message: TWMLButtonUp);
begin
inherited;
FState := slsHovered;
Font.Update;
end;
initialization
finalization
if VisitedTargets <> nil then
begin
VisitedTargets.Free;
end;
end.

View File

@ -81,6 +81,7 @@ type
FLines: TStrings;
FTag: TLanguageTag;
FFormat: TLocalizationFormat;
FEncoding: TCharEncoding;
{ Methoden }
function GetDisplayName: String; override;
function GetLines: TStrings;
@ -88,6 +89,7 @@ type
procedure SetTag(Value: TLanguageTag);
function GetFormat: TLocalizationFormat;
procedure SetFormat(Value: TLocalizationFormat);
procedure SetEncoding(Value: TCharEncoding);
protected
{ Protected-Deklarationen }
procedure RaiseParseError(Text: String; LineIndex: Integer;
@ -109,6 +111,7 @@ type
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};
end;
TLocalizationManager = class;
@ -409,6 +412,7 @@ begin
FLines := TStringList.Create;
FFormat := TLocalizationFormat.Create;
FTag := 'L' + IntToStrMinLength(ID,2);
Encoding := {$IFDEF NO_UNICODE} ceUTF8 {$ELSE} ceUnicode {$ENDIF};
end;
constructor TLocalization.Create(Collection: TCollection; const AFileName: TFileName);
@ -438,6 +442,10 @@ end;
procedure TLocalization.SetLines(Value: TStrings);
begin
(FLines as TStringList).Assign(Value);
if FLines <> nil then
begin
FLines.DefaultEncoding := EncodingClass(Encoding);
end;
end;
procedure TLocalization.SetTag(Value: TLanguageTag);
@ -462,10 +470,16 @@ begin
FFormat.Assign(FFormat);
end;
procedure TLocalization.SetEncoding(Value: TCharEncoding);
begin
Lines.DefaultEncoding := EncodingClass(Value);
FEncoding := Value;
end;
procedure TLocalization.RaiseParseError(Text: String; LineIndex: Integer;
CharIndex: PChar; ExprLength: Integer = 0);
begin
raise ELocalizationParse.Create('[' + IntToStr(LineIndex + 1) + '.' + IntToStr(Pos(String(CharIndex),Lines.Strings[LineIndex]) - ExprLength) + ']' + ' ' + Text);
raise ELocalizationParse.Create('[' + IntToStr(LineIndex + 1) + '.' + IntToStr(CharPosition(CharIndex,Lines.Strings[LineIndex]) - ExprLength) + ']' + ' ' + Text);
end;
procedure TLocalization.RaiseParseErrorUnexpected(Expected: String; Found: String; LineIndex: Integer;

View File

@ -25,13 +25,13 @@ uses
type
{ Fehlermeldungen }
EWinUserInformation = class(Exception);
EInvalidValueType = class(Exception);
type
{ Hilfsklassen }
TLinePosition = (lpAnyPosition,lpBeginning); //Mutter-Hilfsklasse für sämtliche Enums
TStringFilterMode = type TLinePosition;
TStringFilterOptions = set of (sfoCaseSensitive,sfoForceTrim,sfoDefaultVisible);
TCharEncoding = (ceANSI,ceASCII,ceBigEndianUnicode,ceUnicode,ceUTF7,ceUTF8);
type
{$IFNDEF NO_GENERIC}
@ -143,6 +143,9 @@ type
end;
TFloatRefDataArrayReferenceDataArray = array of TFloatRefDataArrayReferenceData;
TVector = TFloatArray;
TMatrix = array of TVector;
TCycle = {$IFDEF NO_RECORDMETHODS} record {$ELSE} class {$ENDIF}
private
{ Private-Deklarationen }
@ -203,7 +206,7 @@ type
function ArrayPos(const AValue: String; const AArray: array of String): Integer; overload;
function ArrayPos(const AValue: ShortInt; const AArray: array of ShortInt): Integer; overload;
function ArrayPos(const AValue: SmallInt; const AArray: array of SmallInt): Integer; overload;
function ArrayPos(const AValue: LongInt; const AArray: array of LongInt): Integer; overload;
function ArrayPos(const AValue: Integer; const AArray: array of Integer): Integer; overload;
function ArrayPos(const AValue: Int64; const AArray: array of Int64): Integer; overload;
function ArrayPos(const AValue: Byte; const AArray: array of Byte): Integer; overload;
function ArrayPos(const AValue: Word; const AArray: array of Word): Integer; overload;
@ -249,6 +252,22 @@ type
function FloatMod(X,Y: Double): Double; overload;
function FloatMod(X,Y: Real): Real; overload;
function FloatMod(X,Y: Extended): Extended; overload;
{ Summenformel }
function SumOf(Value: Byte; Offset: Byte = 1): Byte; overload;
function SumOf(Value: Word; Offset: Word = 1): Word; overload;
function SumOf(Value: Cardinal; Offset: Cardinal = 1): Cardinal; overload;
{ Addition numerischer Arrays }
function ArrayAdd(A,B: array of ShortInt): TShortIntArray; overload;
function ArrayAdd(A,B: array of SmallInt): TSmallIntArray; overload;
function ArrayAdd(A,B: array of Integer): TIntegerArray; overload;
function ArrayAdd(A,B: array of Int64): TInt64Array; overload;
function ArrayAdd(A,B: array of Byte): TByteArray; overload;
function ArrayAdd(A,B: array of Word): TWordArray; overload;
function ArrayAdd(A,B: array of Cardinal): TCardinalArray; overload;
function ArrayAdd(A,B: array of Single): TSingleArray; overload;
function ArrayAdd(A,B: array of Double): TDoubleArray; overload;
function ArrayAdd(A,B: array of Real): TRealArray; overload;
function ArrayAdd(A,B: array of Extended): TExtendedArray; overload;
{ RTTI-Werzeuge }
function GetSubPropInfo(Instance: TObject; const PropName: String; AKinds: TTypeKinds = []): PPropInfo;
function GetObjectSubProp(Instance: TObject; const PropName: String): TObject;
@ -280,6 +299,8 @@ type
function SubPropIsType(Instance: TObject; const PropName: String; TypeKind: TTypeKind): Boolean;
function SubPropType(Instance: TObject; const PropName: String): TTypeKind; overload;
{ Sonstige }
function CharEncoding(EncodingClass: TEncoding): TCharEncoding;
function EncodingClass(CharEncoding: TCharEncoding): TEncoding;
function SecToTime(const Sec: Cardinal): TTime;
function GetExecTime(Command: Pointer; Amount: Cardinal; Attempts: Cardinal = 1): Cardinal;
function SystemLanguage: String;
@ -648,6 +669,94 @@ begin
Result := X - Y * Trunc(X / Y);
end;
function SumOf(Value: Byte; Offset: Byte = 1): Byte;
begin
if Offset < Value then
begin
Result := (Sqr(Value) + Value) div 2 - SumOf(Offset - 1);
end else
begin
Result := 0;
end;
end;
function SumOf(Value: Word; Offset: Word = 1): Word;
begin
if Offset < Value then
begin
Result := (Sqr(Value) + Value) div 2 - SumOf(Offset - 1);
end else
begin
Result := 0;
end;
end;
function SumOf(Value: Cardinal; Offset: Cardinal = 1): Cardinal;
begin
if Offset < Value then
begin
Result := (Sqr(Value) + Value) div 2 - SumOf(Offset - 1);
end else
begin
Result := 0;
end;
end;
function ArrayAdd(A,B: array of ShortInt): TShortIntArray;
begin
end;
function ArrayAdd(A,B: array of SmallInt): TSmallIntArray;
begin
end;
function ArrayAdd(A,B: array of Integer): TIntegerArray;
begin
end;
function ArrayAdd(A,B: array of Int64): TInt64Array;
begin
end;
function ArrayAdd(A,B: array of Byte): TByteArray;
begin
end;
function ArrayAdd(A,B: array of Word): TWordArray;
begin
end;
function ArrayAdd(A,B: array of Cardinal): TCardinalArray;
begin
end;
function ArrayAdd(A,B: array of Single): TSingleArray;
begin
end;
function ArrayAdd(A,B: array of Double): TDoubleArray;
begin
end;
function ArrayAdd(A,B: array of Real): TRealArray;
begin
end;
function ArrayAdd(A,B: array of Extended): TExtendedArray;
begin
end;
function GetSubPropInfo(Instance: TObject; const PropName: String; AKinds: TTypeKinds = []): PPropInfo;
var
DotPos: Integer;
@ -1028,6 +1137,59 @@ begin
end;
end;
function CharEncoding(EncodingClass: TEncoding): TCharEncoding;
begin
if EncodingClass = TEncoding.ANSI then
begin
Result := ceANSI;
end else
begin
if EncodingClass = TEncoding.ASCII then
begin
Result := ceASCII;
end else
begin
if EncodingClass = TEncoding.BigEndianUnicode then
begin
Result := ceBigEndianUnicode;
end else
begin
if EncodingClass = TEncoding.Unicode then
begin
Result := ceUnicode;
end else
begin
if EncodingClass = TEncoding.UTF7 then
begin
Result := ceUTF7;
end else
begin
if EncodingClass = TEncoding.UTF8 then
begin
Result := ceUTF8;
end else
begin
raise EConvertError.Create('Invalid encoding type');
end;
end;
end;
end;
end;
end;
end;
function EncodingClass(CharEncoding: TCharEncoding): TEncoding;
begin
case CharEncoding of
ceANSI: Result := TEncoding.ANSI;
ceASCII: Result := TEncoding.ASCII;
ceBigEndianUnicode: Result := TEncoding.BigEndianUnicode;
ceUnicode: Result := TEncoding.Unicode;
ceUTF7: Result := TEncoding.UTF7;
ceUTF8: Result := TEncoding.UTF8;
end;
end;
function SecToTime(const Sec: Cardinal): TTime;
var
Hrs, Mins: Word;
@ -1569,7 +1731,13 @@ begin
Position := Pos(AnsiString(Current),Text);
if Position = 0 then
begin
Result := -1;
if Current^ = #0 then
begin
Result := Length(Text) + 1;
end else
begin
Result := 0;
end;
Exit;
end;
Result := 0;
@ -1605,7 +1773,13 @@ begin
Position := Pos(UnicodeString(Current),Text);
if Position = 0 then
begin
Result := -1;
if Current^ = #0 then
begin
Result := Length(Text) + 1;
end else
begin
Result := 0;
end;
Exit;
end;
UnicodeLineBreak := UnicodeString(sLineBreak);
@ -1642,7 +1816,13 @@ begin
Position := Pos(AnsiString(Current),Text);
if Position = 0 then
begin
Result := 0;
if Current^ = #0 then
begin
Result := Length(Text) + 1;
end else
begin
Result := 0;
end;
Exit;
end;
Result := 1;
@ -1681,7 +1861,13 @@ begin
Position := Pos(UnicodeString(Current),Text);
if Position = 0 then
begin
Result := 0;
if Current^ = #0 then
begin
Result := Length(Text) + 1;
end else
begin
Result := 0;
end;
Exit;
end;
UnicodeLineBreak := UnicodeString(sLineBreak);