You've already forked lazarus-ccr
Make compatible to actual svn, Mac OSX Compatibility
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@253 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1570,8 +1570,8 @@ var
|
|||||||
R: TRect;
|
R: TRect;
|
||||||
S: WideString;
|
S: WideString;
|
||||||
DrawFormat: Cardinal;
|
DrawFormat: Cardinal;
|
||||||
xxBidiMode: TBidiMode;
|
xBidiMode: Classes.TBidiMode;
|
||||||
// xAlignment: TAlignment;
|
xAlignment: TAlignment;
|
||||||
PaintInfo: TVTPaintInfo;
|
PaintInfo: TVTPaintInfo;
|
||||||
Dummy: TColumnIndex;
|
Dummy: TColumnIndex;
|
||||||
|
|
||||||
@ -1584,28 +1584,28 @@ begin
|
|||||||
DrawFormat := DT_TOP or DT_NOPREFIX or DT_CALCRECT or DT_WORDBREAK;
|
DrawFormat := DT_TOP or DT_NOPREFIX or DT_CALCRECT or DT_WORDBREAK;
|
||||||
if Column <= NoColumn then
|
if Column <= NoColumn then
|
||||||
begin
|
begin
|
||||||
//b BidiMode := Self.BidiMode;
|
xBidiMode := Self.BidiMode;
|
||||||
// xAlignment := Self.Alignment;
|
xAlignment := Self.Alignment;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
//b BidiMode := Header.Columns[Column].BidiMode;
|
BidiMode := Header.Columns[Column].BidiMode;
|
||||||
// xAlignment := Header.Columns[Column].Alignment;
|
xAlignment := Header.Columns[Column].Alignment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//b if BidiMode <> bdLeftToRight then
|
// if xBidiMode <> bdLeftToRight then
|
||||||
//b ChangeBidiModeAlignment(Alignment);
|
// ChangeBidiModeAlignment(Alignment);
|
||||||
|
|
||||||
// Allow for autospanning.
|
// Allow for autospanning.
|
||||||
PaintInfo.Node := Node;
|
PaintInfo.Node := Node;
|
||||||
//b PaintInfo.BidiMode := BidiMode;
|
PaintInfo.BidiMode := xBidiMode;
|
||||||
PaintInfo.Column := Column;
|
PaintInfo.Column := Column;
|
||||||
PaintInfo.CellRect := R;
|
PaintInfo.CellRect := R;
|
||||||
AdjustPaintCellRect(PaintInfo, Dummy);
|
AdjustPaintCellRect(PaintInfo, Dummy);
|
||||||
|
|
||||||
//b if BidiMode <> bdLeftToRight then
|
if xBidiMode <> bdLeftToRight then
|
||||||
//b DrawFormat := DrawFormat or DT_RIGHT or DT_RTLREADING
|
DrawFormat := DrawFormat or DT_RIGHT or DT_RTLREADING
|
||||||
//b else
|
else
|
||||||
DrawFormat := DrawFormat or DT_LEFT;
|
DrawFormat := DrawFormat or DT_LEFT;
|
||||||
DrawTextW(xCanvas, PWideChar(S), PaintInfo.CellRect, DrawFormat, False); //theo
|
DrawTextW(xCanvas, PWideChar(S), PaintInfo.CellRect, DrawFormat, False); //theo
|
||||||
Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top;
|
Result := PaintInfo.CellRect.Bottom - PaintInfo.CellRect.Top;
|
||||||
|
@ -193,9 +193,6 @@ var // Clipboard format IDs used in OLE drag'n drop and clipboard transfers.
|
|||||||
{$MinEnumSize 1, make enumerations as small as possible}
|
{$MinEnumSize 1, make enumerations as small as possible}
|
||||||
|
|
||||||
type
|
type
|
||||||
// later: remove, only now a dummy
|
|
||||||
TBidiMode = Byte;
|
|
||||||
|
|
||||||
// The exception used by the trees.
|
// The exception used by the trees.
|
||||||
EVirtualTreeError = class(Exception);
|
EVirtualTreeError = class(Exception);
|
||||||
|
|
||||||
@ -615,7 +612,7 @@ type
|
|||||||
DefaultHint: WideString; // used only if there is no node specific hint string available
|
DefaultHint: WideString; // used only if there is no node specific hint string available
|
||||||
// or a header hint is about to appear
|
// or a header hint is about to appear
|
||||||
HintText: WideString; // set when size of the hint window is calculated
|
HintText: WideString; // set when size of the hint window is calculated
|
||||||
//b BidiMode: TBidiMode;
|
BidiMode: TBidiMode;
|
||||||
Alignment: TAlignment;
|
Alignment: TAlignment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -741,7 +738,7 @@ type
|
|||||||
FMaxWidth: Integer;
|
FMaxWidth: Integer;
|
||||||
FStyle: TVirtualTreeColumnStyle;
|
FStyle: TVirtualTreeColumnStyle;
|
||||||
FImageIndex: TImageIndex;
|
FImageIndex: TImageIndex;
|
||||||
//b FBiDiMode: TBiDiMode;
|
FBiDiMode: TBiDiMode;
|
||||||
FLayout: TVTHeaderColumnLayout;
|
FLayout: TVTHeaderColumnLayout;
|
||||||
FMargin,
|
FMargin,
|
||||||
FSpacing: Integer;
|
FSpacing: Integer;
|
||||||
@ -755,7 +752,7 @@ type
|
|||||||
function IsBiDiModeStored: Boolean;
|
function IsBiDiModeStored: Boolean;
|
||||||
function IsColorStored: Boolean;
|
function IsColorStored: Boolean;
|
||||||
procedure SetAlignment(const Value: TAlignment);
|
procedure SetAlignment(const Value: TAlignment);
|
||||||
//b procedure SetBiDiMode(Value: TBiDiMode);
|
procedure SetBiDiMode(Value: TBiDiMode);
|
||||||
procedure SetColor(const Value: TColor);
|
procedure SetColor(const Value: TColor);
|
||||||
procedure SetImageIndex(Value: TImageIndex);
|
procedure SetImageIndex(Value: TImageIndex);
|
||||||
procedure SetLayout(Value: TVTHeaderColumnLayout);
|
procedure SetLayout(Value: TVTHeaderColumnLayout);
|
||||||
@ -798,7 +795,7 @@ type
|
|||||||
property Owner: TVirtualTreeColumns read GetOwner;
|
property Owner: TVirtualTreeColumns read GetOwner;
|
||||||
published
|
published
|
||||||
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
|
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
|
||||||
//b property BiDiMode: TBiDiMode read FBiDiMode write SetBiDiMode stored IsBiDiModeStored default bdLeftToRight;
|
property BiDiMode: TBiDiMode read FBiDiMode write SetBiDiMode stored IsBiDiModeStored default bdLeftToRight;
|
||||||
property Color: TColor read FColor write SetColor stored IsColorStored default clWindow;
|
property Color: TColor read FColor write SetColor stored IsColorStored default clWindow;
|
||||||
property Hint: WideString read FHint write FHint stored False;
|
property Hint: WideString read FHint write FHint stored False;
|
||||||
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex default -1;
|
||||||
@ -1320,7 +1317,7 @@ type
|
|||||||
ContentRect: TRect; // the area of the cell used for the node's content
|
ContentRect: TRect; // the area of the cell used for the node's content
|
||||||
NodeWidth: Integer; // the actual node width
|
NodeWidth: Integer; // the actual node width
|
||||||
Alignment: TAlignment; // how to align within the node rectangle
|
Alignment: TAlignment; // how to align within the node rectangle
|
||||||
//b BidiMode: TBidiMode; // directionality to be used for painting
|
BidiMode: TBidiMode; // directionality to be used for painting
|
||||||
BrushOrigin: TPoint; // the alignment for the brush used to draw dotted lines
|
BrushOrigin: TPoint; // the alignment for the brush used to draw dotted lines
|
||||||
ImageInfo: array[TVTImageInfoIndex] of TVTImageInfo; // info about each possible node image
|
ImageInfo: array[TVTImageInfoIndex] of TVTImageInfo; // info about each possible node image
|
||||||
end;
|
end;
|
||||||
@ -3166,7 +3163,11 @@ procedure DrawTextW(Canvas: TCanvas; lpString: PWideChar; var lpRect: TRect; uFo
|
|||||||
var Style:TTextStyle;
|
var Style:TTextStyle;
|
||||||
begin
|
begin
|
||||||
{$ifndef WINCE}
|
{$ifndef WINCE}
|
||||||
|
<<<<<<< .mine
|
||||||
|
{$ifdef UNIX}
|
||||||
|
=======
|
||||||
{$ifdef LCLgtk}
|
{$ifdef LCLgtk}
|
||||||
|
>>>>>>> .r252
|
||||||
Style.Layout:=tlCenter;
|
Style.Layout:=tlCenter;
|
||||||
Canvas.TextRect(lpRect,lpRect.Left,lpRect.Top,lpString,Style); // theo 24.2.2007 Gibt sonst Striche auf GTK1
|
Canvas.TextRect(lpRect,lpRect.Left,lpRect.Top,lpString,Style); // theo 24.2.2007 Gibt sonst Striche auf GTK1
|
||||||
{$else}
|
{$else}
|
||||||
@ -3795,7 +3796,7 @@ begin
|
|||||||
Stream.Position:=0;
|
Stream.Position:=0;
|
||||||
AnotherImage.LoadFromStream(Stream);
|
AnotherImage.LoadFromStream(Stream);
|
||||||
Stream.Size:=0;
|
Stream.Size:=0;
|
||||||
IL.AddDirect(AnotherImage, nil);
|
IL.Add(AnotherImage, nil);
|
||||||
end;
|
end;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@ -3846,8 +3847,7 @@ var
|
|||||||
FlatImages.Draw(BM.Canvas, OffsetX, OffsetY, I)
|
FlatImages.Draw(BM.Canvas, OffsetX, OffsetY, I)
|
||||||
else
|
else
|
||||||
DarkCheckImages.Draw(BM.Canvas, OffsetX, OffsetY, I);
|
DarkCheckImages.Draw(BM.Canvas, OffsetX, OffsetY, I);
|
||||||
//IL.AddMasked(BM, MaskColor);
|
IL.AddMasked(BM, MaskColor);
|
||||||
IL.AddCopy(BM,nil);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3885,8 +3885,7 @@ var
|
|||||||
ButtonState := ButtonState or DFCS_FLAT;
|
ButtonState := ButtonState or DFCS_FLAT;
|
||||||
//todo: remap to LCLIntf
|
//todo: remap to LCLIntf
|
||||||
// DrawFrameControl(BM.Canvas.Handle, Rect(1, 2, BM.Width - 2, BM.Height - 1), DFC_BUTTON, ButtonType or ButtonState);
|
// DrawFrameControl(BM.Canvas.Handle, Rect(1, 2, BM.Width - 2, BM.Height - 1), DFC_BUTTON, ButtonType or ButtonState);
|
||||||
IL.AddCopy(BM,nil);
|
IL.AddMasked(BM, MaskColor);
|
||||||
//IL.AddMasked(BM, MaskColor);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//--------------- end local functions ---------------------------------------
|
//--------------- end local functions ---------------------------------------
|
||||||
@ -3896,7 +3895,7 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{$IFDEF LINUX} //theo 24.2.2007
|
{$IFDEF UNIX} //theo 24.2.2007
|
||||||
Width:=16;
|
Width:=16;
|
||||||
Height:=16; {$message warn'nur um die exception zu verhindern. Werte nicht getestet'}
|
Height:=16; {$message warn'nur um die exception zu verhindern. Werte nicht getestet'}
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -3919,8 +3918,7 @@ begin
|
|||||||
BM.Canvas.Brush.Color := MaskColor;
|
BM.Canvas.Brush.Color := MaskColor;
|
||||||
BM.Canvas.Brush.Style := bsSolid;
|
BM.Canvas.Brush.Style := bsSolid;
|
||||||
BM.Canvas.FillRect(Rect(0, 0, BM.Width, BM.Height));
|
BM.Canvas.FillRect(Rect(0, 0, BM.Width, BM.Height));
|
||||||
//IL.AddMasked(BM, MaskColor);
|
IL.AddMasked(BM, MaskColor);
|
||||||
IL.AddCopy(BM,nil);
|
|
||||||
|
|
||||||
// Add the 20 system checkbox and radiobutton images.
|
// Add the 20 system checkbox and radiobutton images.
|
||||||
for I := 0 to 19 do
|
for I := 0 to 19 do
|
||||||
@ -4972,12 +4970,12 @@ begin
|
|||||||
// Determine text position and don't forget the border.
|
// Determine text position and don't forget the border.
|
||||||
InflateRect(R, -Tree.FTextMargin - 1, -1);
|
InflateRect(R, -Tree.FTextMargin - 1, -1);
|
||||||
DrawFormat := DT_TOP or DT_NOPREFIX;
|
DrawFormat := DT_TOP or DT_NOPREFIX;
|
||||||
//b if BidiMode <> bdLeftToRight then
|
if BidiMode <> bdLeftToRight then
|
||||||
//b begin
|
begin
|
||||||
//b DrawFormat := DrawFormat or DT_RIGHT or DT_RTLREADING;
|
DrawFormat := DrawFormat or DT_RIGHT or DT_RTLREADING;
|
||||||
//b Inc(R.Right);
|
Inc(R.Right);
|
||||||
//b end
|
end
|
||||||
//b else
|
else
|
||||||
DrawFormat := DrawFormat or DT_LEFT;
|
DrawFormat := DrawFormat or DT_LEFT;
|
||||||
SetBkMode(Handle, LCLType.TRANSPARENT);
|
SetBkMode(Handle, LCLType.TRANSPARENT);
|
||||||
R.Top := Y;
|
R.Top := Y;
|
||||||
@ -5207,7 +5205,7 @@ begin
|
|||||||
// The text alignment is based on the bidi mode passed in the hint data, hence we can
|
// The text alignment is based on the bidi mode passed in the hint data, hence we can
|
||||||
// simply set the window's mode to left-to-right (it might have been modified by the caller, if the
|
// simply set the window's mode to left-to-right (it might have been modified by the caller, if the
|
||||||
// tree window is right-to-left aligned).
|
// tree window is right-to-left aligned).
|
||||||
//b BidiMode := bdLeftToRight;
|
BidiMode := bdLeftToRight;
|
||||||
|
|
||||||
FHintData := PVTHintData(AData)^;
|
FHintData := PVTHintData(AData)^;
|
||||||
|
|
||||||
@ -5221,17 +5219,17 @@ begin
|
|||||||
begin
|
begin
|
||||||
if Column <= NoColumn then
|
if Column <= NoColumn then
|
||||||
begin
|
begin
|
||||||
//b BidiMode := Tree.BidiMode;
|
BidiMode := Tree.BidiMode;
|
||||||
Alignment := Tree.Alignment;
|
Alignment := Tree.Alignment;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
//b BidiMode := Tree.Header.Columns[Column].BidiMode;
|
BidiMode := Tree.Header.Columns[Column].BidiMode;
|
||||||
Alignment := Tree.Header.Columns[Column].Alignment;
|
Alignment := Tree.Header.Columns[Column].Alignment;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//b if BidiMode <> bdLeftToRight then
|
// if BidiMode <> bdLeftToRight then
|
||||||
//b ChangeBidiModeAlignment(Alignment);
|
// ChangeBidiModeAlignment(Alignment);
|
||||||
|
|
||||||
if (Node = nil) or (Tree.FHintMode <> hmToolTip) then
|
if (Node = nil) or (Tree.FHintMode <> hmToolTip) then
|
||||||
begin
|
begin
|
||||||
@ -5899,7 +5897,7 @@ begin
|
|||||||
FText := '';
|
FText := '';
|
||||||
FOptions := DefaultColumnOptions;
|
FOptions := DefaultColumnOptions;
|
||||||
FAlignment := taLeftJustify;
|
FAlignment := taLeftJustify;
|
||||||
//b FBidiMode := bdLeftToRight;
|
FBidiMode := bdLeftToRight;
|
||||||
FColor := clWindow;
|
FColor := clWindow;
|
||||||
FLayout := blGlyphLeft;
|
FLayout := blGlyphLeft;
|
||||||
|
|
||||||
@ -6011,8 +6009,7 @@ end;
|
|||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
{bprocedure TVirtualTreeColumn.SetBiDiMode(Value: TBiDiMode);
|
procedure TVirtualTreeColumn.SetBiDiMode(Value: TBiDiMode);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if Value <> FBiDiMode then
|
if Value <> FBiDiMode then
|
||||||
begin
|
begin
|
||||||
@ -6022,7 +6019,7 @@ begin
|
|||||||
// Setting the alignment affects also the tree, hence invalidate it too.
|
// Setting the alignment affects also the tree, hence invalidate it too.
|
||||||
Owner.Header.TreeView.Invalidate;
|
Owner.Header.TreeView.Invalidate;
|
||||||
end;
|
end;
|
||||||
end;}
|
end;
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -6340,12 +6337,12 @@ begin
|
|||||||
taLeftJustify:
|
taLeftJustify:
|
||||||
begin
|
begin
|
||||||
MinLeft := FMargin;
|
MinLeft := FMargin;
|
||||||
//b if UseSortGlyph and (FBidiMode <> bdLeftToRight) then
|
if UseSortGlyph and (FBidiMode <> bdLeftToRight) then
|
||||||
//b begin
|
begin
|
||||||
//b // In RTL context is the sort glyph placed on the left hand side.
|
// In RTL context is the sort glyph placed on the left hand side.
|
||||||
//b SortGlyphPos.X := MinLeft;
|
SortGlyphPos.X := MinLeft;
|
||||||
//b Inc(MinLeft, SortGlyphSize.X + FSpacing);
|
Inc(MinLeft, SortGlyphSize.X + FSpacing);
|
||||||
//b end;
|
end;
|
||||||
if Layout in [blGlyphTop, blGlyphBottom] then
|
if Layout in [blGlyphTop, blGlyphBottom] then
|
||||||
begin
|
begin
|
||||||
// Header glyph is above or below text, so both must be considered when calculating
|
// Header glyph is above or below text, so both must be considered when calculating
|
||||||
@ -6378,8 +6375,8 @@ begin
|
|||||||
Inc(MinLeft, HeaderGlyphSize.X + FSpacing);
|
Inc(MinLeft, HeaderGlyphSize.X + FSpacing);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//b if UseSortGlyph and (FBidiMode = bdLeftToRight) then
|
if UseSortGlyph and (FBidiMode = bdLeftToRight) then
|
||||||
//b SortGlyphPos.X := MinLeft;
|
SortGlyphPos.X := MinLeft;
|
||||||
end;
|
end;
|
||||||
taCenter:
|
taCenter:
|
||||||
begin
|
begin
|
||||||
@ -6415,27 +6412,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
// Place the sort glyph directly to the left or right of the larger item.
|
// Place the sort glyph directly to the left or right of the larger item.
|
||||||
if UseSortGlyph then
|
if UseSortGlyph then
|
||||||
//b if FBidiMode = bdLeftToRight then
|
if FBidiMode = bdLeftToRight then
|
||||||
//b begin
|
begin
|
||||||
//b // Sort glyph on the right hand side.
|
// Sort glyph on the right hand side.
|
||||||
//b SortGlyphPos.X := MaxRight + FSpacing;
|
SortGlyphPos.X := MaxRight + FSpacing;
|
||||||
//b end
|
end
|
||||||
//b else
|
else
|
||||||
//b begin
|
begin
|
||||||
// Sort glyph on the left hand side.
|
// Sort glyph on the left hand side.
|
||||||
SortGlyphPos.X := MinLeft - FSpacing - SortGlyphSize.X;
|
SortGlyphPos.X := MinLeft - FSpacing - SortGlyphSize.X;
|
||||||
//b end;
|
end;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
// taRightJustify
|
// taRightJustify
|
||||||
MaxRight := ClientSize.X - FMargin;
|
MaxRight := ClientSize.X - FMargin;
|
||||||
//b if UseSortGlyph and (FBidiMode = bdLeftToRight) then
|
if UseSortGlyph and (FBidiMode = bdLeftToRight) then
|
||||||
//b begin
|
begin
|
||||||
//b // In LTR context is the sort glyph placed on the right hand side.
|
// In LTR context is the sort glyph placed on the right hand side.
|
||||||
//b Dec(MaxRight, SortGlyphSize.X);
|
Dec(MaxRight, SortGlyphSize.X);
|
||||||
//b SortGlyphPos.X := MaxRight;
|
SortGlyphPos.X := MaxRight;
|
||||||
//b Dec(MaxRight, FSpacing);
|
Dec(MaxRight, FSpacing);
|
||||||
//b end;
|
end;
|
||||||
if Layout in [blGlyphTop, blGlyphBottom] then
|
if Layout in [blGlyphTop, blGlyphBottom] then
|
||||||
begin
|
begin
|
||||||
TextPos.X := MaxRight - TextSize.cx;
|
TextPos.X := MaxRight - TextSize.cx;
|
||||||
@ -6466,8 +6463,8 @@ begin
|
|||||||
MaxRight := HeaderGlyphPos.X - FSpacing;
|
MaxRight := HeaderGlyphPos.X - FSpacing;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
//b if UseSortGlyph and (FBidiMode <> bdLeftToRight) then
|
if UseSortGlyph and (FBidiMode <> bdLeftToRight) then
|
||||||
//b SortGlyphPos.X := MaxRight - SortGlyphSize.X;
|
SortGlyphPos.X := MaxRight - SortGlyphSize.X;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6480,20 +6477,20 @@ begin
|
|||||||
MaxRight := ClientSize.X - FMargin;
|
MaxRight := ClientSize.X - FMargin;
|
||||||
if UseSortGlyph then
|
if UseSortGlyph then
|
||||||
begin
|
begin
|
||||||
//b if FBidiMode = bdLeftToRight then
|
if FBidiMode = bdLeftToRight then
|
||||||
//b begin
|
begin
|
||||||
//b // Sort glyph on the right hand side.
|
// Sort glyph on the right hand side.
|
||||||
//b if SortGlyphPos.X + SortGlyphSize.X > MaxRight then
|
if SortGlyphPos.X + SortGlyphSize.X > MaxRight then
|
||||||
//b SortGlyphPos.X := MaxRight - SortGlyphSize.X;
|
SortGlyphPos.X := MaxRight - SortGlyphSize.X;
|
||||||
//b MaxRight := SortGlyphPos.X - FSpacing;
|
MaxRight := SortGlyphPos.X - FSpacing;
|
||||||
//b end;
|
end;
|
||||||
|
|
||||||
// Consider also the left side of the sort glyph regardless of the bidi mode.
|
// Consider also the left side of the sort glyph regardless of the bidi mode.
|
||||||
if SortGlyphPos.X < MinLeft then
|
if SortGlyphPos.X < MinLeft then
|
||||||
SortGlyphPos.X := MinLeft;
|
SortGlyphPos.X := MinLeft;
|
||||||
// Left border needs only adjustment if the sort glyph marks the left border.
|
// Left border needs only adjustment if the sort glyph marks the left border.
|
||||||
//b if FBidiMode <> bdLeftToRight then
|
if FBidiMode <> bdLeftToRight then
|
||||||
//b MinLeft := SortGlyphPos.X + SortGlyphSize.X + FSpacing;
|
MinLeft := SortGlyphPos.X + SortGlyphSize.X + FSpacing;
|
||||||
|
|
||||||
// Finally transform sort glyph to its actual position.
|
// Finally transform sort glyph to its actual position.
|
||||||
with SortGlyphPos do
|
with SortGlyphPos do
|
||||||
@ -6658,7 +6655,7 @@ begin
|
|||||||
OldOptions := FOptions;
|
OldOptions := FOptions;
|
||||||
FOptions := [];
|
FOptions := [];
|
||||||
|
|
||||||
//b BiDiMode := TVirtualTreeColumn(Source).BiDiMode;
|
BiDiMode := TVirtualTreeColumn(Source).BiDiMode;
|
||||||
ImageIndex := TVirtualTreeColumn(Source).ImageIndex;
|
ImageIndex := TVirtualTreeColumn(Source).ImageIndex;
|
||||||
Layout := TVirtualTreeColumn(Source).Layout;
|
Layout := TVirtualTreeColumn(Source).Layout;
|
||||||
Margin := TVirtualTreeColumn(Source).Margin;
|
Margin := TVirtualTreeColumn(Source).Margin;
|
||||||
@ -6689,7 +6686,7 @@ end;
|
|||||||
function TVirtualTreeColumn.Equals(OtherColumn: TVirtualTreeColumn): Boolean;
|
function TVirtualTreeColumn.Equals(OtherColumn: TVirtualTreeColumn): Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := {b(BiDiMode = OtherColumn.BiDiMode) and}
|
Result := (BiDiMode = OtherColumn.BiDiMode) and
|
||||||
(ImageIndex = OtherColumn.ImageIndex) and
|
(ImageIndex = OtherColumn.ImageIndex) and
|
||||||
(Layout = OtherColumn.Layout) and
|
(Layout = OtherColumn.Layout) and
|
||||||
(Margin = OtherColumn.Margin) and
|
(Margin = OtherColumn.Margin) and
|
||||||
@ -6780,7 +6777,7 @@ begin
|
|||||||
ReadBuffer(Dummy, SizeOf(Dummy));
|
ReadBuffer(Dummy, SizeOf(Dummy));
|
||||||
Spacing := Dummy;
|
Spacing := Dummy;
|
||||||
ReadBuffer(Dummy, SizeOf(Dummy));
|
ReadBuffer(Dummy, SizeOf(Dummy));
|
||||||
//b BiDiMode := TBiDiMode(Dummy);
|
BiDiMode := TBiDiMode(Dummy);
|
||||||
|
|
||||||
ReadBuffer(Dummy, SizeOf(Dummy));
|
ReadBuffer(Dummy, SizeOf(Dummy));
|
||||||
Options := ConvertOptions(Dummy);
|
Options := ConvertOptions(Dummy);
|
||||||
@ -6813,9 +6810,9 @@ begin
|
|||||||
if coParentBiDiMode in FOptions then
|
if coParentBiDiMode in FOptions then
|
||||||
begin
|
begin
|
||||||
Columns := GetOwner as TVirtualTreeColumns;
|
Columns := GetOwner as TVirtualTreeColumns;
|
||||||
if Assigned(Columns) {band (FBidiMode <> Columns.FHeader.Treeview.BiDiMode)} then
|
if Assigned(Columns) and (FBidiMode <> Columns.FHeader.Treeview.BiDiMode) then
|
||||||
begin
|
begin
|
||||||
//b FBiDiMode := Columns.FHeader.Treeview.BiDiMode;
|
FBiDiMode := Columns.FHeader.Treeview.BiDiMode;
|
||||||
Changed(False);
|
Changed(False);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -6875,8 +6872,8 @@ begin
|
|||||||
WriteBuffer(Dummy, SizeOf(Dummy));
|
WriteBuffer(Dummy, SizeOf(Dummy));
|
||||||
WriteBuffer(FMargin, SizeOf(FMargin));
|
WriteBuffer(FMargin, SizeOf(FMargin));
|
||||||
WriteBuffer(FSpacing, SizeOf(FSpacing));
|
WriteBuffer(FSpacing, SizeOf(FSpacing));
|
||||||
//b Dummy := Ord(FBiDiMode);
|
Dummy := Ord(FBiDiMode);
|
||||||
//b WriteBuffer(Dummy, SizeOf(Dummy));
|
WriteBuffer(Dummy, SizeOf(Dummy));
|
||||||
//todo Dummy := Word(FOptions);
|
//todo Dummy := Word(FOptions);
|
||||||
// WriteBuffer(Dummy, SizeOf(Dummy));
|
// WriteBuffer(Dummy, SizeOf(Dummy));
|
||||||
|
|
||||||
@ -6896,7 +6893,7 @@ end;
|
|||||||
function TVirtualTreeColumn.UseRightToLeftReading: Boolean;
|
function TVirtualTreeColumn.UseRightToLeftReading: Boolean;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//b Result := FBiDiMode <> bdLeftToRight;
|
Result := FBiDiMode <> bdLeftToRight;
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7987,8 +7984,8 @@ begin
|
|||||||
|
|
||||||
// Consider right-to-left directionality.
|
// Consider right-to-left directionality.
|
||||||
with FHeader.Treeview do
|
with FHeader.Treeview do
|
||||||
//b if (BidiMode <> bdLeftToRight) and (Integer(FRangeY) > ClientHeight) then
|
if (BidiMode <> bdLeftToRight) and (Integer(FRangeY) > ClientHeight) then
|
||||||
//b Inc(HOffset, GetSystemMetrics(SM_CXVSCROLL));
|
Inc(HOffset, GetSystemMetrics(SM_CXVSCROLL));
|
||||||
|
|
||||||
// Erase background of the header.
|
// Erase background of the header.
|
||||||
// See if the application wants to do that on its own.
|
// See if the application wants to do that on its own.
|
||||||
@ -24085,7 +24082,7 @@ begin
|
|||||||
ImageInfo[iiCheck].Index := GetCheckImage(Node);
|
ImageInfo[iiCheck].Index := GetCheckImage(Node);
|
||||||
if ImageInfo[iiCheck].Index > -1 then
|
if ImageInfo[iiCheck].Index > -1 then
|
||||||
begin
|
begin
|
||||||
AdjustImageBorder(FCheckImages, 0, VAlign, ContentRect, ImageInfo[iiCheck]);
|
AdjustImageBorder(FCheckImages, BidiMode, VAlign, ContentRect, ImageInfo[iiCheck]);
|
||||||
ImageInfo[iiCheck].Ghosted := False;
|
ImageInfo[iiCheck].Ghosted := False;
|
||||||
end;
|
end;
|
||||||
end
|
end
|
||||||
@ -24095,7 +24092,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
ImageInfo[iiState].Index := GetImageIndex(Node, ikState, Column, ImageInfo[iiState].Ghosted);
|
ImageInfo[iiState].Index := GetImageIndex(Node, ikState, Column, ImageInfo[iiState].Ghosted);
|
||||||
if ImageInfo[iiState].Index > -1 then
|
if ImageInfo[iiState].Index > -1 then
|
||||||
AdjustImageBorder(FStateImages, 0, VAlign, ContentRect, ImageInfo[iiState]);
|
AdjustImageBorder(FStateImages, BidiMode, VAlign, ContentRect, ImageInfo[iiState]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ImageInfo[iiState].Index := -1;
|
ImageInfo[iiState].Index := -1;
|
||||||
@ -24104,7 +24101,7 @@ begin
|
|||||||
ImageInfo[iiNormal].Index := GetImageIndex(Node, ImageKind[vsSelected in Node^.States], Column,
|
ImageInfo[iiNormal].Index := GetImageIndex(Node, ImageKind[vsSelected in Node^.States], Column,
|
||||||
ImageInfo[iiNormal].Ghosted);
|
ImageInfo[iiNormal].Ghosted);
|
||||||
if ImageInfo[iiNormal].Index > -1 then
|
if ImageInfo[iiNormal].Index > -1 then
|
||||||
AdjustImageBorder(FImages, 0, VAlign, ContentRect, ImageInfo[iiNormal]);
|
AdjustImageBorder(FImages, BidiMode, VAlign, ContentRect, ImageInfo[iiNormal]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ImageInfo[iiNormal].Index := -1;
|
ImageInfo[iiNormal].Index := -1;
|
||||||
@ -24169,7 +24166,7 @@ begin
|
|||||||
if (toShowButtons in FOptions.FPaintOptions) and (vsHasChildren in Node^.States) and
|
if (toShowButtons in FOptions.FPaintOptions) and (vsHasChildren in Node^.States) and
|
||||||
not ((vsAllChildrenHidden in Node^.States) and
|
not ((vsAllChildrenHidden in Node^.States) and
|
||||||
(toAutoHideButtons in TreeOptions.FAutoOptions)) then
|
(toAutoHideButtons in TreeOptions.FAutoOptions)) then
|
||||||
PaintNodeButton(Canvas, Node, CellRect, ButtonX, ButtonY, 0);
|
PaintNodeButton(Canvas, Node, CellRect, ButtonX, ButtonY, BidiMode);
|
||||||
|
|
||||||
if ImageInfo[iiCheck].Index > -1 then
|
if ImageInfo[iiCheck].Index > -1 then
|
||||||
PaintCheckImage(PaintInfo);
|
PaintCheckImage(PaintInfo);
|
||||||
|
@ -1,450 +0,0 @@
|
|||||||
unit vt_lazbridge;
|
|
||||||
|
|
||||||
{ *************************************************************************** }
|
|
||||||
{ Copyright (c) 2007 Theo Lustenberger }
|
|
||||||
{ }
|
|
||||||
{ This software is provided "as-is". This software comes without warranty }
|
|
||||||
{ or garantee, explicit or implied. Use this software at your own risk. }
|
|
||||||
{ The author will not be liable for any damage to equipment, data, or }
|
|
||||||
{ information that may result while using this software. }
|
|
||||||
{ }
|
|
||||||
{ By using this software, you agree to the conditions stated above. }
|
|
||||||
{ *************************************************************************** }
|
|
||||||
|
|
||||||
{$MODE objfpc}{$H+}
|
|
||||||
|
|
||||||
{$DEFINE VER_VTV} //Version for VTV.
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses Classes, SysUtils, Graphics, GraphType, InterfaceBase, LCLType,
|
|
||||||
IntfGraphics, FPimage, LCLIntf, ExtDlgs, FileUtil, ExtCtrls,
|
|
||||||
vt_opbitmap {$IFNDEF VER_VTV} , opbitmapformats {$ENDIF};
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TMyIntfImage }
|
|
||||||
|
|
||||||
TMyIntfImage = class(TLazIntfImage)
|
|
||||||
public
|
|
||||||
procedure CreateBitmapLateMask(var Bitmap, MaskBitmap: HBitmap;
|
|
||||||
AlwaysCreateMask: boolean; const RawImage: TRawImage);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TOPOpenDialog }
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
TOPOpenDialog = class(TOpenPictureDialog)
|
|
||||||
private
|
|
||||||
FPreviewFilename: string;
|
|
||||||
protected
|
|
||||||
procedure UpdatePreview; override;
|
|
||||||
function Execute: boolean; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TLazOPPicture }
|
|
||||||
|
|
||||||
TLazOPPicture=class(TOPPicture)
|
|
||||||
private
|
|
||||||
fImage:TImage;
|
|
||||||
fUpdateImageSize:Boolean;
|
|
||||||
public
|
|
||||||
constructor Create(Image:TImage);
|
|
||||||
procedure DrawImage;
|
|
||||||
property UpdateImageSize:Boolean read fUpdateImageSize write fUpdateImageSize;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure AssignBitmapToOpBitmap(Bitmap: TBitmap; OpBitmap: TOpBitmap);
|
|
||||||
procedure AssignOpBitmapToBitmap(SourceBitmap: TOpBitmap; Bitmap: TBitmap; PreserveFormat: boolean = true);
|
|
||||||
procedure AssignOpBitmapToCanvas(OpBitmap: TOpBitmap; aCanvas: Graphics.TCanvas; X, Y: integer);
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
procedure AssignBitmapToOpBitmap(Bitmap: TBitmap; OpBitmap: TOpBitmap);
|
|
||||||
var int: TLazIntfImage;
|
|
||||||
i: integer;
|
|
||||||
x, y: integer;
|
|
||||||
begin
|
|
||||||
int := Bitmap.CreateIntfImage;
|
|
||||||
OpBitmap.Width := int.Width;
|
|
||||||
OpBitmap.Height := int.Height;
|
|
||||||
OpBitmap.Pixelformat := PixelFormatFromBPP(Int.DataDescription.BitsPerPixel);
|
|
||||||
for y := 0 to OpBitmap.Height - 1 do
|
|
||||||
for x := 0 to OpBitmap.Width - 1 do
|
|
||||||
OpBitmap.Pixels[X, Y] := Int.TColors[X, Y];
|
|
||||||
if Bitmap.Transparent then
|
|
||||||
OpBitmap.TransparentColor := Bitmap.TransparentColor else OPBitmap.Transparent:=false;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure AssignOpBitmapToBitmap(SourceBitmap: TOpBitmap; Bitmap: TBitmap; PreserveFormat: boolean = true);
|
|
||||||
var int: TMyIntfImage;
|
|
||||||
var bmph, mbmph: HBitmap;
|
|
||||||
x, y: integer;
|
|
||||||
pmask: PByte;
|
|
||||||
rawi: TRawImage;
|
|
||||||
OPBitmap: TOpBitmap;
|
|
||||||
begin
|
|
||||||
if PreserveFormat then
|
|
||||||
begin
|
|
||||||
OpBitmap := TOPBitmap.create;
|
|
||||||
OpBitmap.Assign(SourceBitmap);
|
|
||||||
end else OpBitmap := SourceBitmap;
|
|
||||||
|
|
||||||
Int := TMyIntfImage.Create(0, 0);
|
|
||||||
Int.AutoCreateMask := false;
|
|
||||||
Int.GetDescriptionFromDevice(0);
|
|
||||||
Int.Width := OpBitmap.Width;
|
|
||||||
Int.Height := OpBitmap.Height;
|
|
||||||
OpBitmap.Pixelformat := PixelFormatFromBPP(Int.DataDescription.BitsPerPixel);
|
|
||||||
for y := 0 to OpBitmap.Height - 1 do
|
|
||||||
for x := 0 to OpBitmap.Width - 1 do
|
|
||||||
Int.TColors[X, Y] := OpBitmap.Pixels[X, Y];
|
|
||||||
|
|
||||||
if OPBitmap.Transparent then
|
|
||||||
begin
|
|
||||||
int.GetRawImage(Rawi);
|
|
||||||
rawi.MaskSize := OpBitmap.GetTransparentMask(0, pmask,
|
|
||||||
Rawi.Description.AlphaBitOrder = riboReversedBits,
|
|
||||||
TOPRawImageLineEnd(Rawi.Description.AlphaLineEnd));
|
|
||||||
rawi.Mask := pmask;
|
|
||||||
(* writeln(RawImageDescriptionAsString(@Rawi));
|
|
||||||
writeln('bwid: ',OpBitmap.Width, ' bhei: ',OpBitmap.Height,' rmsiz:',Rawi.MaskSize); *)
|
|
||||||
Int.CreateBitmapLateMask(bmph, mbmph, false, rawi);
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
Int.CreateBitmap(bmph, mbmph, false);
|
|
||||||
end;
|
|
||||||
Bitmap.Free;
|
|
||||||
Bitmap := TBitmap.Create;
|
|
||||||
Bitmap.Handle := bmph;
|
|
||||||
Bitmap.MaskHandle := mbmph;
|
|
||||||
Int.free;
|
|
||||||
if PreserveFormat then OPBitmap.free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure AssignOpBitmapToCanvas(OpBitmap: TOpBitmap; aCanvas: Graphics.TCanvas; X, Y: integer);
|
|
||||||
var Bmp: TBitmap;
|
|
||||||
begin
|
|
||||||
Bmp := TBitmap.create;
|
|
||||||
AssignOpBitmapToBitmap(OpBitmap, Bmp);
|
|
||||||
aCanvas.Draw(X, Y, bmp);
|
|
||||||
Bmp.free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
|
|
||||||
{ TOPOpenDialog }
|
|
||||||
|
|
||||||
procedure TOPOpenDialog.UpdatePreview;
|
|
||||||
var
|
|
||||||
CurFilename: string;
|
|
||||||
FileIsValid: boolean;
|
|
||||||
OP: TOPPicture;
|
|
||||||
LBPP: Integer;
|
|
||||||
begin
|
|
||||||
CurFilename := FileName;
|
|
||||||
if CurFilename = FPreviewFilename then exit;
|
|
||||||
|
|
||||||
FPreviewFilename := CurFilename;
|
|
||||||
FileIsValid := FileExists(FPreviewFilename)
|
|
||||||
and (not DirPathExists(FPreviewFilename))
|
|
||||||
and FileIsReadable(FPreviewFilename);
|
|
||||||
if FileIsValid then
|
|
||||||
try
|
|
||||||
OP := TOPPicture.create;
|
|
||||||
try
|
|
||||||
OP.LoadFromFile(FPreviewFilename);
|
|
||||||
LBPP := OP.Bitmap.BPP;
|
|
||||||
OP.Bitmap.Transparent := false;
|
|
||||||
AssignOpBitmapToBitmap(Op.Bitmap, ImageCtrl.Picture.Bitmap, false);
|
|
||||||
PictureGroupBox.Caption := Format('(%dx%d BPP:%d)',
|
|
||||||
[ImageCtrl.Picture.Width, ImageCtrl.Picture.Height, LBPP]);
|
|
||||||
finally
|
|
||||||
OP.free;
|
|
||||||
end;
|
|
||||||
except
|
|
||||||
FileIsValid := False;
|
|
||||||
end;
|
|
||||||
if not FileIsValid then
|
|
||||||
ClearPreview;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TOPOpenDialog.Execute: boolean;
|
|
||||||
begin
|
|
||||||
Filter := OPGLoadFilters;
|
|
||||||
result := inherited Execute;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
|
||||||
{ TMyIntfImage }
|
|
||||||
|
|
||||||
procedure TMyIntfImage.CreateBitmapLateMask(var Bitmap, MaskBitmap: HBitmap;
|
|
||||||
AlwaysCreateMask: boolean; const RawImage: TRawImage);
|
|
||||||
var
|
|
||||||
ARawImage: TRawImage;
|
|
||||||
begin
|
|
||||||
GetRawImage(ARawImage);
|
|
||||||
ARawImage.Mask := RawImage.Mask;
|
|
||||||
ARawImage.MaskSize := RawImage.MaskSize;
|
|
||||||
if not CreateBitmapFromRawImage(ARawImage, Bitmap, MaskBitmap, AlwaysCreateMask)
|
|
||||||
then
|
|
||||||
raise FPImageException.Create('Failed to create bitmaps');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
|
|
||||||
{ TLazOPPicture }
|
|
||||||
|
|
||||||
constructor TLazOPPicture.Create(Image: TImage);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
fImage:=Image;
|
|
||||||
fUpdateImageSize:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TLazOPPicture.DrawImage;
|
|
||||||
begin
|
|
||||||
if fImage<>nil then
|
|
||||||
begin
|
|
||||||
if fUpdateImageSize then fImage.SetBounds(0,0,Bitmap.Width,Bitmap.Height);
|
|
||||||
AssignOpBitmapToBitmap(Bitmap, fImage.Picture.Bitmap);
|
|
||||||
fImage.invalidate;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
end.
|
|
||||||
unit lazbridge;
|
|
||||||
|
|
||||||
{ *************************************************************************** }
|
|
||||||
{ Copyright (c) 2007 Theo Lustenberger }
|
|
||||||
{ }
|
|
||||||
{ This software is provided "as-is". This software comes without warranty }
|
|
||||||
{ or garantee, explicit or implied. Use this software at your own risk. }
|
|
||||||
{ The author will not be liable for any damage to equipment, data, or }
|
|
||||||
{ information that may result while using this software. }
|
|
||||||
{ }
|
|
||||||
{ By using this software, you agree to the conditions stated above. }
|
|
||||||
{ *************************************************************************** }
|
|
||||||
|
|
||||||
{$MODE objfpc}{$H+}
|
|
||||||
|
|
||||||
{$DEFINE VER_VTV} //Version for VTV.
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses Classes, SysUtils, Graphics, GraphType, InterfaceBase, LCLType,
|
|
||||||
IntfGraphics, FPimage, LCLIntf, ExtDlgs, FileUtil, ExtCtrls,
|
|
||||||
opbitmap {$IFNDEF VER_VTV} , opbitmapformats {$ENDIF};
|
|
||||||
|
|
||||||
|
|
||||||
type
|
|
||||||
|
|
||||||
{ TMyIntfImage }
|
|
||||||
|
|
||||||
TMyIntfImage = class(TLazIntfImage)
|
|
||||||
public
|
|
||||||
procedure CreateBitmapLateMask(var Bitmap, MaskBitmap: HBitmap;
|
|
||||||
AlwaysCreateMask: boolean; const RawImage: TRawImage);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TOPOpenDialog }
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
TOPOpenDialog = class(TOpenPictureDialog)
|
|
||||||
private
|
|
||||||
FPreviewFilename: string;
|
|
||||||
protected
|
|
||||||
procedure UpdatePreview; override;
|
|
||||||
function Execute: boolean; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{ TLazOPPicture }
|
|
||||||
|
|
||||||
TLazOPPicture=class(TOPPicture)
|
|
||||||
private
|
|
||||||
fImage:TImage;
|
|
||||||
fUpdateImageSize:Boolean;
|
|
||||||
public
|
|
||||||
constructor Create(Image:TImage);
|
|
||||||
procedure DrawImage;
|
|
||||||
property UpdateImageSize:Boolean read fUpdateImageSize write fUpdateImageSize;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
procedure AssignBitmapToOpBitmap(Bitmap: TBitmap; OpBitmap: TOpBitmap);
|
|
||||||
procedure AssignOpBitmapToBitmap(SourceBitmap: TOpBitmap; Bitmap: TBitmap; PreserveFormat: boolean = true);
|
|
||||||
procedure AssignOpBitmapToCanvas(OpBitmap: TOpBitmap; aCanvas: Graphics.TCanvas; X, Y: integer);
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
procedure AssignBitmapToOpBitmap(Bitmap: TBitmap; OpBitmap: TOpBitmap);
|
|
||||||
var int: TLazIntfImage;
|
|
||||||
i: integer;
|
|
||||||
x, y: integer;
|
|
||||||
begin
|
|
||||||
int := Bitmap.CreateIntfImage;
|
|
||||||
OpBitmap.Width := int.Width;
|
|
||||||
OpBitmap.Height := int.Height;
|
|
||||||
OpBitmap.Pixelformat := PixelFormatFromBPP(Int.DataDescription.BitsPerPixel);
|
|
||||||
for y := 0 to OpBitmap.Height - 1 do
|
|
||||||
for x := 0 to OpBitmap.Width - 1 do
|
|
||||||
OpBitmap.Pixels[X, Y] := Int.TColors[X, Y];
|
|
||||||
if Bitmap.Transparent then
|
|
||||||
OpBitmap.TransparentColor := Bitmap.TransparentColor;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure AssignOpBitmapToBitmap(SourceBitmap: TOpBitmap; Bitmap: TBitmap; PreserveFormat: boolean = true);
|
|
||||||
var int: TMyIntfImage;
|
|
||||||
var bmph, mbmph: HBitmap;
|
|
||||||
x, y: integer;
|
|
||||||
pmask: PByte;
|
|
||||||
rawi: TRawImage;
|
|
||||||
OPBitmap: TOpBitmap;
|
|
||||||
begin
|
|
||||||
if PreserveFormat then
|
|
||||||
begin
|
|
||||||
OpBitmap := TOPBitmap.create;
|
|
||||||
OpBitmap.Assign(SourceBitmap);
|
|
||||||
end else OpBitmap := SourceBitmap;
|
|
||||||
|
|
||||||
Int := TMyIntfImage.Create(0, 0);
|
|
||||||
Int.AutoCreateMask := false;
|
|
||||||
Int.GetDescriptionFromDevice(0);
|
|
||||||
Int.Width := OpBitmap.Width;
|
|
||||||
Int.Height := OpBitmap.Height;
|
|
||||||
OpBitmap.Pixelformat := PixelFormatFromBPP(Int.DataDescription.BitsPerPixel);
|
|
||||||
for y := 0 to OpBitmap.Height - 1 do
|
|
||||||
for x := 0 to OpBitmap.Width - 1 do
|
|
||||||
Int.TColors[X, Y] := OpBitmap.Pixels[X, Y];
|
|
||||||
|
|
||||||
if OPBitmap.Transparent then
|
|
||||||
begin
|
|
||||||
int.GetRawImage(Rawi);
|
|
||||||
rawi.MaskSize := OpBitmap.GetTransparentMask(0, pmask,
|
|
||||||
Rawi.Description.AlphaBitOrder = riboReversedBits,
|
|
||||||
Rawi.Description.AlphaLineEnd = rileWordBoundary);
|
|
||||||
rawi.Mask := pmask;
|
|
||||||
{ writeln(RawImageDescriptionAsString(@Rawi));
|
|
||||||
writeln('bwid: ',OpBitmap.Width, ' bhei: ',OpBitmap.Height,' rmsiz:',Rawi.MaskSize); }
|
|
||||||
Int.CreateBitmapLateMask(bmph, mbmph, false, rawi);
|
|
||||||
end else
|
|
||||||
begin
|
|
||||||
Int.CreateBitmap(bmph, mbmph, false);
|
|
||||||
end;
|
|
||||||
Bitmap.Free;
|
|
||||||
Bitmap := TBitmap.Create;
|
|
||||||
Bitmap.Handle := bmph;
|
|
||||||
Bitmap.MaskHandle := mbmph;
|
|
||||||
Int.free;
|
|
||||||
if PreserveFormat then OPBitmap.free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure AssignOpBitmapToCanvas(OpBitmap: TOpBitmap; aCanvas: Graphics.TCanvas; X, Y: integer);
|
|
||||||
var Bmp: TBitmap;
|
|
||||||
begin
|
|
||||||
Bmp := TBitmap.create;
|
|
||||||
AssignOpBitmapToBitmap(OpBitmap, Bmp);
|
|
||||||
aCanvas.Draw(X, Y, bmp);
|
|
||||||
Bmp.free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
|
|
||||||
{ TOPOpenDialog }
|
|
||||||
|
|
||||||
procedure TOPOpenDialog.UpdatePreview;
|
|
||||||
var
|
|
||||||
CurFilename: string;
|
|
||||||
FileIsValid: boolean;
|
|
||||||
OP: TOPPicture;
|
|
||||||
LBPP: Integer;
|
|
||||||
begin
|
|
||||||
CurFilename := FileName;
|
|
||||||
if CurFilename = FPreviewFilename then exit;
|
|
||||||
|
|
||||||
FPreviewFilename := CurFilename;
|
|
||||||
FileIsValid := FileExists(FPreviewFilename)
|
|
||||||
and (not DirPathExists(FPreviewFilename))
|
|
||||||
and FileIsReadable(FPreviewFilename);
|
|
||||||
if FileIsValid then
|
|
||||||
try
|
|
||||||
OP := TOPPicture.create;
|
|
||||||
try
|
|
||||||
OP.LoadFromFile(FPreviewFilename);
|
|
||||||
LBPP := OP.Bitmap.BPP;
|
|
||||||
OP.Bitmap.Transparent := false;
|
|
||||||
AssignOpBitmapToBitmap(Op.Bitmap, ImageCtrl.Picture.Bitmap, false);
|
|
||||||
PictureGroupBox.Caption := Format('(%dx%d BPP:%d)',
|
|
||||||
[ImageCtrl.Picture.Width, ImageCtrl.Picture.Height, LBPP]);
|
|
||||||
finally
|
|
||||||
OP.free;
|
|
||||||
end;
|
|
||||||
except
|
|
||||||
FileIsValid := False;
|
|
||||||
end;
|
|
||||||
if not FileIsValid then
|
|
||||||
ClearPreview;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TOPOpenDialog.Execute: boolean;
|
|
||||||
begin
|
|
||||||
Filter := OPGLoadFilters;
|
|
||||||
result := inherited Execute;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
|
|
||||||
{ TMyIntfImage }
|
|
||||||
|
|
||||||
procedure TMyIntfImage.CreateBitmapLateMask(var Bitmap, MaskBitmap: HBitmap;
|
|
||||||
AlwaysCreateMask: boolean; const RawImage: TRawImage);
|
|
||||||
var
|
|
||||||
ARawImage: TRawImage;
|
|
||||||
begin
|
|
||||||
GetRawImage(ARawImage);
|
|
||||||
ARawImage.Mask := RawImage.Mask;
|
|
||||||
ARawImage.MaskSize := RawImage.MaskSize;
|
|
||||||
if not CreateBitmapFromRawImage(ARawImage, Bitmap, MaskBitmap, AlwaysCreateMask)
|
|
||||||
then
|
|
||||||
raise FPImageException.Create('Failed to create bitmaps');
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
{$IFNDEF VER_VTV}
|
|
||||||
|
|
||||||
{ TLazOPPicture }
|
|
||||||
|
|
||||||
constructor TLazOPPicture.Create(Image: TImage);
|
|
||||||
begin
|
|
||||||
inherited Create;
|
|
||||||
fImage:=Image;
|
|
||||||
fUpdateImageSize:=true;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TLazOPPicture.DrawImage;
|
|
||||||
begin
|
|
||||||
if fImage<>nil then
|
|
||||||
begin
|
|
||||||
if fUpdateImageSize then fImage.SetBounds(0,0,Bitmap.Width,Bitmap.Height);
|
|
||||||
AssignOpBitmapToBitmap(Bitmap, fImage.Picture.Bitmap);
|
|
||||||
fImage.invalidate;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{$ENDIF}
|
|
||||||
|
|
||||||
end.
|
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user