* Use Lazarus resources instead of Windows resources

* Added script to build resource file

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@169 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
blikblum
2007-05-26 02:05:17 +00:00
parent 9d6a33dbe9
commit c81ad25465
10 changed files with 1750 additions and 1731 deletions

View File

@ -1,6 +1,5 @@
program Advanced; program Advanced;
{$R Res\ExtraRes.res}
uses uses
{$IFDEF UNIX}{$IFDEF UseCThreads} {$IFDEF UNIX}{$IFDEF UseCThreads}
@ -22,7 +21,6 @@ uses
//HeaderCustomDrawDemo in 'HeaderCustomDrawDemo.pas' {HeaderOwnerDrawForm}, //HeaderCustomDrawDemo in 'HeaderCustomDrawDemo.pas' {HeaderOwnerDrawForm},
States in 'States.pas' {StateForm}, Printer4Lazarus; States in 'States.pas' {StateForm}, Printer4Lazarus;
{.$R *.RES}
begin begin
Application.Initialize; Application.Initialize;

View File

@ -7,6 +7,8 @@ object HeaderOwnerDrawForm: THeaderOwnerDrawForm
VertScrollBar.Page = 439 VertScrollBar.Page = 439
ActiveControl = HeaderCustomDrawTree ActiveControl = HeaderCustomDrawTree
Caption = 'HeaderOwnerDrawForm' Caption = 'HeaderOwnerDrawForm'
ClientHeight = 440
ClientWidth = 776
Font.Height = -11 Font.Height = -11
Font.Name = 'MS Sans Serif' Font.Name = 'MS Sans Serif'
OnCreate = FormCreate OnCreate = FormCreate

View File

@ -241,8 +241,7 @@ begin
FBackBitmap2.PixelFormat := pf32Bit; FBackBitmap2.PixelFormat := pf32Bit;
CreateCheckerBackground; CreateCheckerBackground;
FHeaderBitmap := TBitmap.Create; FHeaderBitmap := TBitmap.Create;
//FHeaderBitmap.Handle := LoadImage(HInstance, 'Transcriptions', IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR); FHeaderBitmap.LoadFromLazarusResource('Transcriptions');
FHeaderBitmap.LoadFromResourceName(HINSTANCE,'Transcriptions');
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
@ -261,7 +260,7 @@ end;
procedure THeaderOwnerDrawForm.AnimationTimerTimer(Sender: TObject); procedure THeaderOwnerDrawForm.AnimationTimerTimer(Sender: TObject);
begin begin
//FLeftPos := (FLeftPos + FHeaderBitmap.Width div 2000) mod FHeaderBitmap.Width; FLeftPos := (FLeftPos + FHeaderBitmap.Width div 2000) mod FHeaderBitmap.Width;
with HeaderCustomDrawTree.Header do with HeaderCustomDrawTree.Header do
Invalidate(Columns[2]); Invalidate(Columns[2]);
end; end;
@ -308,5 +307,6 @@ end;
initialization initialization
{$i HeaderCustomDrawDemo.lrs} {$i HeaderCustomDrawDemo.lrs}
{$i bitmap.lrs}
end. end.

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMainForm','FORMDATA',[ LazarusResources.Add('TMainForm','FORMDATA',[
'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#220#0#6'Height'#3'B'#2#3'Top'#3#206 'TPF0'#9'TMainForm'#8'MainForm'#4'Left'#3#220#0#6'Height'#3'B'#2#3'Top'#3#206
+#0#5'Width'#3'P'#3#18'HorzScrollBar.Page'#3'O'#3#18'VertScrollBar.Page'#3'A' +#0#5'Width'#3'P'#3#18'HorzScrollBar.Page'#3'O'#3#18'VertScrollBar.Page'#3'A'

View File

@ -9,8 +9,6 @@ unit Main;
interface interface
{.$include Compilers.inc}
{$ifdef COMPILER_7_UP} {$ifdef COMPILER_7_UP}
// For some things to work we need code, which is classified as being unsafe for .NET. // For some things to work we need code, which is classified as being unsafe for .NET.
{$warn UNSAFE_TYPE off} {$warn UNSAFE_TYPE off}
@ -92,19 +90,23 @@ end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
procedure LoadUnicodeStrings(Name: string; var Strings: array of WideString); procedure LoadUnicodeStrings(Name: string; var Strings: array of WideString);
// Loads the Unicode strings from the resource. // Loads the Unicode strings from the resource.
var var
Stream: TResourceStream; Res: TLResource;
Head, Tail: PWideChar; Head, Tail: PWideChar;
I: Integer; I: Integer;
begin begin
Stream := TResourceStream.Create(0, Name, 'Unicode'); //Stream := TResourceStream.Create(0, Name, 'Unicode');
try Res := LazarusResources.Find(Name);
Head := Stream.Memory; if (Res <> nil) and (Res.Value <> '') then
begin
//Head := Stream.Memory;
Head := PWideChar(Res.Value);
// Skip byte order mark. // Skip byte order mark.
Inc(Head); Inc(Head);
Tail := Head; Tail := Head;
@ -117,8 +119,6 @@ begin
// Skip carriage return and linefeed. // Skip carriage return and linefeed.
Inc(Tail, 2); Inc(Tail, 2);
end; end;
finally
Stream.Free;
end; end;
end; end;
@ -212,6 +212,7 @@ end;
initialization initialization
{$i Main.lrs} {$i Main.lrs}
{$i unicode.lrs}
end. end.

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TNodeForm','FORMDATA',[ LazarusResources.Add('TNodeForm','FORMDATA',[
'TPF0'#9'TNodeForm'#8'NodeForm'#4'Left'#3'='#2#6'Height'#3#30#2#3'Top'#3'L'#1 'TPF0'#9'TNodeForm'#8'NodeForm'#4'Left'#3'='#2#6'Height'#3#30#2#3'Top'#3'L'#1
+#5'Width'#3#5#3#18'HorzScrollBar.Page'#3#4#3#18'VertScrollBar.Page'#3#29#2#13 +#5'Width'#3#5#3#18'HorzScrollBar.Page'#3#4#3#18'VertScrollBar.Page'#3#29#2#13

View File

@ -67,7 +67,7 @@ end;
procedure TNodeForm.FormCreate(Sender: TObject); procedure TNodeForm.FormCreate(Sender: TObject);
begin begin
LoadUnicodeStrings('LoremIpsum', DemoText); LoadUnicodeStrings('Lorem ipsum', DemoText);
end; end;
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
lazres unicode.lrs Greek.uni Arabic.uni Hebrew.uni "Lorem ipsum.uni"
lazres bitmap.lrs Transcriptions.bmp