* 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;
{$R Res\ExtraRes.res}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
@ -22,7 +21,6 @@ uses
//HeaderCustomDrawDemo in 'HeaderCustomDrawDemo.pas' {HeaderOwnerDrawForm},
States in 'States.pas' {StateForm}, Printer4Lazarus;
{.$R *.RES}
begin
Application.Initialize;

View File

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

View File

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

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TMainForm','FORMDATA',[
'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'

View File

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

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TNodeForm','FORMDATA',[
'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

View File

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

View File

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