mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-11 22:40:40 +01:00
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
git-svn-id: trunk@5183 -
This commit is contained in:
parent
683d3564ff
commit
63221956e2
@ -155,6 +155,8 @@ const
|
|||||||
'riloTopToBottom',
|
'riloTopToBottom',
|
||||||
'riloBottomToTop'
|
'riloBottomToTop'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
DefaultByteOrder = {$IFDEF Endian_Little}riboLSBFirst{$ELSE}riboMSBFirst{$ENDIF};
|
||||||
|
|
||||||
|
|
||||||
function RawImageDescriptionAsString(Desc: PRawImageDescription): string;
|
function RawImageDescriptionAsString(Desc: PRawImageDescription): string;
|
||||||
@ -209,6 +211,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.24 2004/02/09 19:52:52 mattias
|
||||||
|
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
|
||||||
|
|
||||||
Revision 1.23 2003/12/06 19:20:46 mattias
|
Revision 1.23 2003/12/06 19:20:46 mattias
|
||||||
codecompletion: forward proc body position now block sensitive
|
codecompletion: forward proc body position now block sensitive
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ begin
|
|||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
fCompStyle := csMemo;
|
fCompStyle := csMemo;
|
||||||
FWordWrap := True;
|
FWordWrap := True;
|
||||||
FFont := TFont.Create;
|
//FFont := TFont.Create;
|
||||||
FLines := TMemoStrings.Create(Self);
|
FLines := TMemoStrings.Create(Self);
|
||||||
FVertScrollbar := TMemoScrollBar.Create(Self, sbVertical);
|
FVertScrollbar := TMemoScrollBar.Create(Self, sbVertical);
|
||||||
FHorzScrollbar := TMemoScrollBar.Create(Self, sbHorizontal);
|
FHorzScrollbar := TMemoScrollBar.Create(Self, sbHorizontal);
|
||||||
@ -47,7 +47,7 @@ end;
|
|||||||
destructor TCustomMemo.Destroy;
|
destructor TCustomMemo.Destroy;
|
||||||
begin
|
begin
|
||||||
FreeThenNil(FLines);
|
FreeThenNil(FLines);
|
||||||
FreeThenNil(FFont);
|
//FreeThenNil(FFont);
|
||||||
FreeThenNil(FVertScrollbar);
|
FreeThenNil(FVertScrollbar);
|
||||||
FreeThenNil(FHorzScrollbar);
|
FreeThenNil(FHorzScrollbar);
|
||||||
inherited destroy;
|
inherited destroy;
|
||||||
@ -168,6 +168,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.19 2004/02/09 19:52:52 mattias
|
||||||
|
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
|
||||||
|
|
||||||
Revision 1.18 2004/01/27 17:36:01 mattias
|
Revision 1.18 2004/01/27 17:36:01 mattias
|
||||||
fixed switching menus in menueditor
|
fixed switching menus in menueditor
|
||||||
|
|
||||||
|
|||||||
@ -1295,8 +1295,7 @@ procedure TWinControl.FontChanged(Sender: TObject);
|
|||||||
begin
|
begin
|
||||||
if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
|
if HandleAllocated and ([csLoading,csDestroying]*ComponentState=[]) then
|
||||||
begin
|
begin
|
||||||
// ToDo: replace with correct intf call
|
CNSendMessage(LM_SETFONT, Self, Pointer(Font.Handle));
|
||||||
CNSendMessage(LM_SETCOLOR, Self, nil);
|
|
||||||
Exclude(FFlags,wcfFontChanged);
|
Exclude(FFlags,wcfFontChanged);
|
||||||
//NotifyControls(CM_ ...);
|
//NotifyControls(CM_ ...);
|
||||||
end else
|
end else
|
||||||
@ -3292,6 +3291,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.199 2004/02/09 19:52:52 mattias
|
||||||
|
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
|
||||||
|
|
||||||
Revision 1.198 2004/02/04 23:30:18 mattias
|
Revision 1.198 2004/02/04 23:30:18 mattias
|
||||||
completed TControl actions
|
completed TControl actions
|
||||||
|
|
||||||
|
|||||||
@ -683,6 +683,12 @@ activate_time : the time at which the activation event occurred.
|
|||||||
If Handle <> 0 Then
|
If Handle <> 0 Then
|
||||||
SetFocus(Handle);
|
SetFocus(Handle);
|
||||||
End;
|
End;
|
||||||
|
LM_SETFONT:
|
||||||
|
begin
|
||||||
|
if Sender is TControl then begin
|
||||||
|
Windows.SendMessage(Handle, WM_SETFONT, windows.wParam(integer(data)), 1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
LM_SETSIZE:
|
LM_SETSIZE:
|
||||||
Begin
|
Begin
|
||||||
If (Sender Is TWinControl) Then // Handle is already tested --> see above
|
If (Sender Is TWinControl) Then // Handle is already tested --> see above
|
||||||
@ -3008,6 +3014,9 @@ End;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.166 2004/02/09 19:52:52 mattias
|
||||||
|
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
|
||||||
|
|
||||||
Revision 1.165 2004/02/06 23:58:44 marc
|
Revision 1.165 2004/02/06 23:58:44 marc
|
||||||
+ patch from Jesus Reyes, it enables TCustomEdit SelStart/Length
|
+ patch from Jesus Reyes, it enables TCustomEdit SelStart/Length
|
||||||
|
|
||||||
|
|||||||
@ -147,7 +147,9 @@ type
|
|||||||
TheLineEnd: TRawImageLineEnd); virtual;
|
TheLineEnd: TRawImageLineEnd); virtual;
|
||||||
procedure SetDataDescription(const NewDescription: TRawImageDescription); virtual;
|
procedure SetDataDescription(const NewDescription: TRawImageDescription); virtual;
|
||||||
procedure ChooseGetSetColorFunctions; virtual;
|
procedure ChooseGetSetColorFunctions; virtual;
|
||||||
procedure ChooseRawBitsProc(BitsPerPixel: cardinal; BitOrder: TRawImageBitOrder;
|
procedure ChooseRawBitsProc(BitsPerPixel: cardinal;
|
||||||
|
ByteOrder: TRawImageByteOrder;
|
||||||
|
BitOrder: TRawImageBitOrder;
|
||||||
var ProcReadRawImageBits: TOnReadRawImageBits;
|
var ProcReadRawImageBits: TOnReadRawImageBits;
|
||||||
var ProcWriteRawImageBits: TOnWriteRawImageBits);
|
var ProcWriteRawImageBits: TOnWriteRawImageBits);
|
||||||
// get color functions
|
// get color functions
|
||||||
@ -638,6 +640,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ReadRawImageBits_ReversedBytes_16(TheData: PByte;
|
||||||
|
const Position: TRawImagePosition;
|
||||||
|
Prec, Shift: cardinal;
|
||||||
|
var Bits: word);
|
||||||
|
var
|
||||||
|
P: PByte;
|
||||||
|
PrecMask: Cardinal;
|
||||||
|
TwoBytes: Word;
|
||||||
|
begin
|
||||||
|
PrecMask:=(Cardinal(1) shl Prec)-1;
|
||||||
|
P:=@(TheData[Position.Byte]);
|
||||||
|
|
||||||
|
TwoBytes:=PWord(P)^;
|
||||||
|
TwoBytes:=(TwoBytes shr 8) or ((TwoBytes and $ff) shl 8); // switch byte order
|
||||||
|
Bits:=Word(cardinal(TwoBytes shr Shift) and PrecMask);
|
||||||
|
|
||||||
|
if Prec<16 then begin
|
||||||
|
// add missing bits
|
||||||
|
Bits:=(Bits shl (16-Prec));
|
||||||
|
Bits:=Bits or MissingBits[Prec,Bits shr 13];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure ReadRawImageBits_32(TheData: PByte;
|
procedure ReadRawImageBits_32(TheData: PByte;
|
||||||
const Position: TRawImagePosition;
|
const Position: TRawImagePosition;
|
||||||
Prec, Shift: cardinal;
|
Prec, Shift: cardinal;
|
||||||
@ -660,6 +685,33 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure ReadRawImageBits_ReversedBytes_32(TheData: PByte;
|
||||||
|
const Position: TRawImagePosition;
|
||||||
|
Prec, Shift: cardinal;
|
||||||
|
var Bits: word);
|
||||||
|
var
|
||||||
|
P: PByte;
|
||||||
|
PrecMask: Cardinal;
|
||||||
|
FourBytes: Cardinal;
|
||||||
|
begin
|
||||||
|
PrecMask:=(Cardinal(1) shl Prec)-1;
|
||||||
|
P:=@(TheData[Position.Byte]);
|
||||||
|
|
||||||
|
FourBytes:=PDWord(P)^;
|
||||||
|
|
||||||
|
// switch byte order
|
||||||
|
FourBytes:=(FourBytes shr 24) or ((FourBytes shr 8) and $FF00)
|
||||||
|
or ((FourBytes and $ff00) shl 8) or ((FourBytes and $ff) shl 24);
|
||||||
|
|
||||||
|
Bits:=Word(cardinal(FourBytes shr Shift) and PrecMask);
|
||||||
|
|
||||||
|
if Prec<16 then begin
|
||||||
|
// add missing bits
|
||||||
|
Bits:=(Bits shl (16-Prec));
|
||||||
|
Bits:=Bits or MissingBits[Prec,Bits shr 13];
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure WriteRawImageBits_1_2_4_BIO(TheData: PByte;
|
procedure WriteRawImageBits_1_2_4_BIO(TheData: PByte;
|
||||||
const Position: TRawImagePosition;
|
const Position: TRawImagePosition;
|
||||||
Prec, Shift: cardinal; Bits: word);
|
Prec, Shift: cardinal; Bits: word);
|
||||||
@ -740,6 +792,27 @@ begin
|
|||||||
PWord(P)^:=TwoBytes;
|
PWord(P)^:=TwoBytes;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure WriteRawImageBits_ReversedBytes_16(TheData: PByte;
|
||||||
|
const Position: TRawImagePosition;
|
||||||
|
Prec, Shift: cardinal; Bits: word);
|
||||||
|
var
|
||||||
|
P: PByte;
|
||||||
|
PrecMask: Cardinal;
|
||||||
|
TwoBytes: Word;
|
||||||
|
begin
|
||||||
|
P:=@(TheData[Position.Byte]);
|
||||||
|
PrecMask:=(Cardinal(1) shl Prec)-1;
|
||||||
|
Bits:=Bits shr (16-Prec);
|
||||||
|
|
||||||
|
TwoBytes:=PWord(P)^;
|
||||||
|
TwoBytes:=(TwoBytes shr 8) or ((TwoBytes and $ff) shl 8); // switch byte order
|
||||||
|
PrecMask:=not (PrecMask shl Shift);
|
||||||
|
TwoBytes:=TwoBytes and PrecMask; // clear old
|
||||||
|
TwoBytes:=TwoBytes or (Bits shl Shift); // set new
|
||||||
|
TwoBytes:=(TwoBytes shr 8) or ((TwoBytes and $ff) shl 8); // switch byte order
|
||||||
|
PWord(P)^:=TwoBytes;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure WriteRawImageBits_32(TheData: PByte;
|
procedure WriteRawImageBits_32(TheData: PByte;
|
||||||
const Position: TRawImagePosition;
|
const Position: TRawImagePosition;
|
||||||
Prec, Shift: cardinal; Bits: word);
|
Prec, Shift: cardinal; Bits: word);
|
||||||
@ -759,6 +832,34 @@ begin
|
|||||||
PDWord(P)^:=FourBytes;
|
PDWord(P)^:=FourBytes;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure WriteRawImageBits_ReversedBytes_32(TheData: PByte;
|
||||||
|
const Position: TRawImagePosition;
|
||||||
|
Prec, Shift: cardinal; Bits: word);
|
||||||
|
var
|
||||||
|
P: PByte;
|
||||||
|
PrecMask: Cardinal;
|
||||||
|
FourBytes: Cardinal;
|
||||||
|
begin
|
||||||
|
P:=@(TheData[Position.Byte]);
|
||||||
|
PrecMask:=(Cardinal(1) shl Prec)-1;
|
||||||
|
Bits:=Bits shr (16-Prec);
|
||||||
|
|
||||||
|
FourBytes:=PDWord(P)^;
|
||||||
|
|
||||||
|
// switch byte order
|
||||||
|
FourBytes:=(FourBytes shr 24) or ((FourBytes shr 8) and $FF00)
|
||||||
|
or ((FourBytes and $ff00) shl 8) or ((FourBytes and $ff) shl 24);
|
||||||
|
|
||||||
|
PrecMask:=not (PrecMask shl Shift);
|
||||||
|
FourBytes:=FourBytes and PrecMask; // clear old
|
||||||
|
FourBytes:=FourBytes or cardinal(Bits shl Shift); // set new
|
||||||
|
|
||||||
|
// switch byte order
|
||||||
|
FourBytes:=(FourBytes shr 24) or ((FourBytes shr 8) and $FF00)
|
||||||
|
or ((FourBytes and $ff00) shl 8) or ((FourBytes and $ff) shl 24);
|
||||||
|
PDWord(P)^:=FourBytes;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure ReadRawImageBits_NULL(TheData: PByte;
|
procedure ReadRawImageBits_NULL(TheData: PByte;
|
||||||
const Position: TRawImagePosition;
|
const Position: TRawImagePosition;
|
||||||
Prec, Shift: cardinal;
|
Prec, Shift: cardinal;
|
||||||
@ -801,7 +902,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TLazIntfImage.ChooseRawBitsProc(BitsPerPixel: cardinal;
|
procedure TLazIntfImage.ChooseRawBitsProc(BitsPerPixel: cardinal;
|
||||||
BitOrder: TRawImageBitOrder;
|
ByteOrder: TRawImageByteOrder; BitOrder: TRawImageBitOrder;
|
||||||
var ProcReadRawImageBits: TOnReadRawImageBits;
|
var ProcReadRawImageBits: TOnReadRawImageBits;
|
||||||
var ProcWriteRawImageBits: TOnWriteRawImageBits);
|
var ProcWriteRawImageBits: TOnWriteRawImageBits);
|
||||||
begin
|
begin
|
||||||
@ -827,14 +928,24 @@ begin
|
|||||||
|
|
||||||
16:
|
16:
|
||||||
begin
|
begin
|
||||||
ProcReadRawImageBits := @ReadRawImageBits_16;
|
if DefaultByteOrder=ByteOrder then begin
|
||||||
ProcWriteRawImageBits := @WriteRawImageBits_16;
|
ProcReadRawImageBits := @ReadRawImageBits_16;
|
||||||
|
ProcWriteRawImageBits := @WriteRawImageBits_16;
|
||||||
|
end else begin
|
||||||
|
ProcReadRawImageBits := @ReadRawImageBits_ReversedBytes_16;
|
||||||
|
ProcWriteRawImageBits := @WriteRawImageBits_ReversedBytes_16;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
32:
|
32:
|
||||||
begin
|
begin
|
||||||
ProcReadRawImageBits := @ReadRawImageBits_32;
|
if DefaultByteOrder=ByteOrder then begin
|
||||||
ProcWriteRawImageBits := @WriteRawImageBits_32;
|
ProcReadRawImageBits := @ReadRawImageBits_32;
|
||||||
|
ProcWriteRawImageBits := @WriteRawImageBits_32;
|
||||||
|
end else begin
|
||||||
|
ProcReadRawImageBits := @ReadRawImageBits_ReversedBytes_32;
|
||||||
|
ProcWriteRawImageBits := @WriteRawImageBits_ReversedBytes_32;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -850,6 +961,7 @@ procedure TLazIntfImage.ChooseGetSetColorFunctions;
|
|||||||
begin
|
begin
|
||||||
//writeln('ChooseRGBAFunctions ',RawImageDescriptionAsString(@FDataDescription));
|
//writeln('ChooseRGBAFunctions ',RawImageDescriptionAsString(@FDataDescription));
|
||||||
ChooseRawBitsProc(FDataDescription.BitsPerPixel,
|
ChooseRawBitsProc(FDataDescription.BitsPerPixel,
|
||||||
|
FDataDescription.ByteOrder,
|
||||||
FDataDescription.BitOrder,
|
FDataDescription.BitOrder,
|
||||||
FReadRawImageBits, FWriteRawImageBits);
|
FReadRawImageBits, FWriteRawImageBits);
|
||||||
|
|
||||||
@ -877,13 +989,14 @@ procedure TLazIntfImage.ChooseGetSetColorFunctions;
|
|||||||
OnSetInternalColor:=@SetColor_NoPalette_RGBA_NoAlpha;
|
OnSetInternalColor:=@SetColor_NoPalette_RGBA_NoAlpha;
|
||||||
end;
|
end;
|
||||||
ChooseRawBitsProc(FDataDescription.AlphaBitsPerPixel,
|
ChooseRawBitsProc(FDataDescription.AlphaBitsPerPixel,
|
||||||
|
FDataDescription.AlphaByteOrder,
|
||||||
FDataDescription.AlphaBitOrder,
|
FDataDescription.AlphaBitOrder,
|
||||||
FAlphaReadRawImageBits, FAlphaWriteRawImageBits);
|
FAlphaReadRawImageBits, FAlphaWriteRawImageBits);
|
||||||
end else begin
|
end else begin
|
||||||
OnGetInternalColor:=@GetColor_NoPalette_RGBA_Alpha_NoSep;
|
OnGetInternalColor:=@GetColor_NoPalette_RGBA_Alpha_NoSep;
|
||||||
OnSetInternalColor:=@SetColor_NoPalette_RGBA_Alpha_NoSep;
|
OnSetInternalColor:=@SetColor_NoPalette_RGBA_Alpha_NoSep;
|
||||||
ChooseRawBitsProc(FDataDescription.BitsPerPixel,
|
ChooseRawBitsProc(FDataDescription.BitsPerPixel,
|
||||||
FDataDescription.AlphaBitOrder,
|
FDataDescription.AlphaByteOrder, FDataDescription.AlphaBitOrder,
|
||||||
FAlphaReadRawImageBits, FAlphaWriteRawImageBits);
|
FAlphaReadRawImageBits, FAlphaWriteRawImageBits);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
|
|||||||
@ -539,7 +539,7 @@ type
|
|||||||
|
|
||||||
TCustomMemo = class(TCustomEdit)
|
TCustomMemo = class(TCustomEdit)
|
||||||
private
|
private
|
||||||
FFont : TFont;
|
//FFont : TFont;
|
||||||
FHorzScrollBar: TMemoScrollBar;
|
FHorzScrollBar: TMemoScrollBar;
|
||||||
FLines: TStrings;
|
FLines: TStrings;
|
||||||
FScrollBars: TScrollStyle;
|
FScrollBars: TScrollStyle;
|
||||||
@ -564,7 +564,7 @@ type
|
|||||||
property Lines: TStrings read FLines write SetLines;
|
property Lines: TStrings read FLines write SetLines;
|
||||||
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars;
|
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars;
|
||||||
property WordWrap: Boolean read FWordWrap write SetWordWrap default true;
|
property WordWrap: Boolean read FWordWrap write SetWordWrap default true;
|
||||||
property Font : TFont read FFont write FFont;
|
//property Font : TFont read FFont write FFont;
|
||||||
property HorzScrollBar: TMemoScrollBar
|
property HorzScrollBar: TMemoScrollBar
|
||||||
read FHorzScrollBar write SetHorzScrollBar stored StoreScrollBars;
|
read FHorzScrollBar write SetHorzScrollBar stored StoreScrollBars;
|
||||||
property VertScrollBar: TMemoScrollBar
|
property VertScrollBar: TMemoScrollBar
|
||||||
@ -1496,6 +1496,9 @@ end.
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.130 2004/02/09 19:52:52 mattias
|
||||||
|
implemented ByteOrder for TLazIntfImage and added call of to LM_SETFONT
|
||||||
|
|
||||||
Revision 1.129 2004/02/06 16:58:58 mattias
|
Revision 1.129 2004/02/06 16:58:58 mattias
|
||||||
updated polish translation
|
updated polish translation
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user