You've already forked lazarus-ccr
jvcllaz: New features in JvThumbnail: ThumbColor, ThumbTitleColor, Margin. Fix TitleHeight.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6273 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -14,7 +14,7 @@ implementation
|
|||||||
{$R ../../resource/jvcustomreg.res}
|
{$R ../../resource/jvcustomreg.res}
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, ImgList, Controls, PropEdits, GraphPropEdits, ComponentEditors,
|
Classes, ImgList, Controls, LResources, PropEdits, GraphPropEdits, ComponentEditors,
|
||||||
JvDsgnConsts,
|
JvDsgnConsts,
|
||||||
JvOutlookBar, JvOutlookBarEditors,
|
JvOutlookBar, JvOutlookBarEditors,
|
||||||
JvTabBar, JvTabBarXPPainter,
|
JvTabBar, JvTabBarXPPainter,
|
||||||
@ -49,6 +49,10 @@ begin
|
|||||||
RegisterPropertyEditor(TypeInfo(TImageIndex), TJvOutlookBarPage,
|
RegisterPropertyEditor(TypeInfo(TImageIndex), TJvOutlookBarPage,
|
||||||
'ImageIndex', TJvOutlookBarPageImageIndexProperty);
|
'ImageIndex', TJvOutlookBarPageImageIndexProperty);
|
||||||
|
|
||||||
|
// Thumbnails
|
||||||
|
RegisterPropertyToSkip(TJvThumbnail, 'ClientWidth', 'Redundant', '');
|
||||||
|
RegisterPropertyToSkip(TJvThumbnail, 'ClientHeight', 'Redundant', '');
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -338,7 +338,6 @@ object JvThumbnailChildForm: TJvThumbnailChildForm
|
|||||||
Top = 5
|
Top = 5
|
||||||
Width = 577
|
Width = 577
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
|
||||||
BorderSpacing.Around = 4
|
BorderSpacing.Around = 4
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 159
|
ClientHeight = 159
|
||||||
@ -443,23 +442,14 @@ object JvThumbnailChildForm: TJvThumbnailChildForm
|
|||||||
Anchors = [akTop, akBottom]
|
Anchors = [akTop, akBottom]
|
||||||
BorderSpacing.Left = 2
|
BorderSpacing.Left = 2
|
||||||
BorderSpacing.Right = 8
|
BorderSpacing.Right = 8
|
||||||
ClientHeight = 136
|
ClientHeight = 159
|
||||||
ClientWidth = 144
|
ClientWidth = 152
|
||||||
Constraints.MinWidth = 152
|
Constraints.MinWidth = 152
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
OnClick = ThumbNailClick
|
OnClick = ThumbNailClick
|
||||||
TitleColor = clBtnFace
|
TitleColor = clBtnFace
|
||||||
TitleFont.Color = clWindowText
|
TitleFont.Color = clWindowText
|
||||||
TitleFont.Height = -11
|
|
||||||
TitleFont.Name = 'MS Sans Serif'
|
|
||||||
AsButton = False
|
|
||||||
MinimizeMemory = True
|
|
||||||
StreamFileType = grBMP
|
|
||||||
ShowTitle = False
|
|
||||||
TitlePlacement = tpUp
|
|
||||||
AutoLoad = True
|
|
||||||
ShadowColor = clSilver
|
ShadowColor = clSilver
|
||||||
ShowShadow = False
|
|
||||||
end
|
end
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
AnchorSideLeft.Control = ThumbNail
|
AnchorSideLeft.Control = ThumbNail
|
||||||
@ -610,6 +600,14 @@ object JvThumbnailChildForm: TJvThumbnailChildForm
|
|||||||
Caption = 'Thumbnails Title'
|
Caption = 'Thumbnails Title'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
|
object SpinEdit1: TSpinEdit
|
||||||
|
Left = 2
|
||||||
|
Height = 23
|
||||||
|
Top = 80
|
||||||
|
Width = 86
|
||||||
|
OnChange = SpinEdit1Change
|
||||||
|
TabOrder = 6
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -32,7 +32,7 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, Forms,
|
Classes, SysUtils, Controls, Forms,
|
||||||
StdCtrls, ExtCtrls, FileCtrl, ComCtrls, ShellCtrls,
|
StdCtrls, ExtCtrls, FileCtrl, ComCtrls, ShellCtrls, Spin,
|
||||||
JvThumbImage, JvThumbNails, JvBaseThumbnail, JvExExtCtrls;
|
JvThumbImage, JvThumbNails, JvBaseThumbnail, JvExExtCtrls;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -42,6 +42,7 @@ type
|
|||||||
TJvThumbnailChildForm = class(TForm)
|
TJvThumbnailChildForm = class(TForm)
|
||||||
Bevel2: TBevel;
|
Bevel2: TBevel;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
|
SpinEdit1: TSpinEdit;
|
||||||
Splitter2: TSplitter;
|
Splitter2: TSplitter;
|
||||||
Panel6: TPanel;
|
Panel6: TPanel;
|
||||||
Splitter4: TSplitter;
|
Splitter4: TSplitter;
|
||||||
@ -86,6 +87,7 @@ type
|
|||||||
procedure BtnInvertClick(Sender: TObject);
|
procedure BtnInvertClick(Sender: TObject);
|
||||||
procedure Button5Click(Sender: TObject);
|
procedure Button5Click(Sender: TObject);
|
||||||
procedure ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
|
procedure ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
|
||||||
|
procedure SpinEdit1Change(Sender: TObject);
|
||||||
procedure ThumbNailClick(Sender: TObject);
|
procedure ThumbNailClick(Sender: TObject);
|
||||||
procedure Panel10Resize(Sender: TObject);
|
procedure Panel10Resize(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
@ -137,6 +139,11 @@ begin
|
|||||||
Node.ImageIndex := 1;
|
Node.ImageIndex := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnailChildForm.SpinEdit1Change(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Thumbnail.Margin := SpinEdit1.Value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnailChildForm.CbAsButtonClick(Sender: TObject);
|
procedure TJvThumbnailChildForm.CbAsButtonClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ThumbNail.Asbutton := CbAsButton.Checked;
|
ThumbNail.Asbutton := CbAsButton.Checked;
|
||||||
@ -189,6 +196,7 @@ begin
|
|||||||
//ThumbImage.Picture.Free;
|
//ThumbImage.Picture.Free;
|
||||||
GbTitlePlacement.ItemIndex := integer(ThumbNail.titlePlacement);
|
GbTitlePlacement.ItemIndex := integer(ThumbNail.titlePlacement);
|
||||||
GbAngle.ItemIndex := integer(ThumbImage.angle);
|
GbAngle.ItemIndex := integer(ThumbImage.angle);
|
||||||
|
SpinEdit1.Value := Thumbnail.Margin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnailChildForm.GbAngleClick(Sender: TObject);
|
procedure TJvThumbnailChildForm.GbAngleClick(Sender: TObject);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
object JvThumbnailMainForm: TJvThumbnailMainForm
|
object JvThumbnailMainForm: TJvThumbnailMainForm
|
||||||
Left = 295
|
Left = 296
|
||||||
Height = 656
|
Height = 656
|
||||||
Top = 100
|
Top = 126
|
||||||
Width = 878
|
Width = 878
|
||||||
Caption = 'JvThumbView Demo'
|
Caption = 'JvThumbView Demo'
|
||||||
ClientHeight = 656
|
ClientHeight = 656
|
||||||
@ -261,6 +261,34 @@ object JvThumbnailMainForm: TJvThumbnailMainForm
|
|||||||
OnClick = BtnEditSelThumbClick
|
OnClick = BtnEditSelThumbClick
|
||||||
TabOrder = 7
|
TabOrder = 7
|
||||||
end
|
end
|
||||||
|
object CbThumbColor: TColorButton
|
||||||
|
AnchorSideLeft.Control = SpinEdit2
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = SpinEdit2
|
||||||
|
Left = 760
|
||||||
|
Height = 25
|
||||||
|
Top = 27
|
||||||
|
Width = 27
|
||||||
|
BorderSpacing.Left = 16
|
||||||
|
BorderWidth = 2
|
||||||
|
ButtonColorSize = 16
|
||||||
|
ButtonColor = clBlack
|
||||||
|
OnColorChanged = CbThumbColorColorChanged
|
||||||
|
end
|
||||||
|
object CbTitleColor: TColorButton
|
||||||
|
AnchorSideLeft.Control = CbThumbColor
|
||||||
|
AnchorSideLeft.Side = asrBottom
|
||||||
|
AnchorSideTop.Control = CbThumbColor
|
||||||
|
Left = 789
|
||||||
|
Height = 25
|
||||||
|
Top = 27
|
||||||
|
Width = 27
|
||||||
|
BorderSpacing.Left = 2
|
||||||
|
BorderWidth = 2
|
||||||
|
ButtonColorSize = 16
|
||||||
|
ButtonColor = clBlack
|
||||||
|
OnColorChanged = CbTitleColorColorChanged
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
|
@ -31,8 +31,9 @@ unit JvThumbnailMainFormU;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Controls, Forms, StdCtrls, ExtCtrls, FileCtrl, ComCtrls, Spin, ShellCtrls,
|
Classes, Controls, Graphics, Forms, StdCtrls, ExtCtrls, FileCtrl, ComCtrls, Spin,
|
||||||
JvThumbNails, JvThumbViews, JvBaseThumbnail, JvThumbnailDatamodule;
|
ShellCtrls, ColorBox, Dialogs, JvThumbNails, JvThumbViews, JvBaseThumbnail,
|
||||||
|
JvThumbnailDatamodule;
|
||||||
{JvSpecialProgress,
|
{JvSpecialProgress,
|
||||||
JvListBox, JvDriveCtrls, JvCombobox, JvExControls, JvComponent,
|
JvListBox, JvDriveCtrls, JvCombobox, JvExControls, JvComponent,
|
||||||
JvExStdCtrls, JvExForms; }
|
JvExStdCtrls, JvExForms; }
|
||||||
@ -42,6 +43,8 @@ type
|
|||||||
{ TJvThumbnailMainForm }
|
{ TJvThumbnailMainForm }
|
||||||
|
|
||||||
TJvThumbnailMainForm = class(TForm)
|
TJvThumbnailMainForm = class(TForm)
|
||||||
|
CbThumbColor: TColorButton;
|
||||||
|
CbTitleColor: TColorButton;
|
||||||
PageControl1: TPageControl;
|
PageControl1: TPageControl;
|
||||||
TabSheet1: TTabSheet;
|
TabSheet1: TTabSheet;
|
||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
@ -68,6 +71,8 @@ type
|
|||||||
Panel5: TPanel;
|
Panel5: TPanel;
|
||||||
ProgressBar: TProgressBar;
|
ProgressBar: TProgressBar;
|
||||||
Bevel1: TBevel;
|
Bevel1: TBevel;
|
||||||
|
procedure CbThumbColorColorChanged(Sender: TObject);
|
||||||
|
procedure CbTitleColorColorChanged(Sender: TObject);
|
||||||
procedure ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
|
procedure ShellTreeViewChange(Sender: TObject; Node: TTreeNode);
|
||||||
procedure ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
|
procedure ShellTreeViewGetImageIndex(Sender: TObject; Node: TTreeNode);
|
||||||
procedure ThumbViewKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure ThumbViewKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
@ -164,6 +169,16 @@ begin
|
|||||||
ThumbView.MinMemory := CbMinMemory.Checked;
|
ThumbView.MinMemory := CbMinMemory.Checked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnailMainForm.CbThumbColorColorChanged(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ThumbView.ThumbColor := CbThumbColor.ButtonColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnailMainForm.CbTitleColorColorChanged(Sender: TObject);
|
||||||
|
begin
|
||||||
|
ThumbView.ThumbTitleColor := CbTitleColor.ButtonColor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnailMainForm.SpinEdit1Change(Sender: TObject);
|
procedure TJvThumbnailMainForm.SpinEdit1Change(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
if spinedit1.Text <> '' then ThumbView.ThumbGap := spinedit1.Value;
|
if spinedit1.Text <> '' then ThumbView.ThumbGap := spinedit1.Value;
|
||||||
@ -207,6 +222,8 @@ end;
|
|||||||
|
|
||||||
procedure TJvThumbnailMainForm.FormShow(Sender: TObject);
|
procedure TJvThumbnailMainForm.FormShow(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
CbThumbColor.ButtonColor := ColorToRGB(ThumbVIew.ThumbColor);
|
||||||
|
CbTitleColor.ButtonColor := ColorToRGB(ThumbVIew.ThumbColor);
|
||||||
CbAutoScrolling.Checked := ThumbView.AutoScrolling;
|
CbAutoScrolling.Checked := ThumbView.AutoScrolling;
|
||||||
CbAutoHandleKeyboard.Checked := ThumbView.AutoHandleKeyb;
|
CbAutoHandleKeyboard.Checked := ThumbView.AutoHandleKeyb;
|
||||||
CbSorted.Checked := ThumbView.Sorted;
|
CbSorted.Checked := ThumbView.Sorted;
|
||||||
|
@ -428,6 +428,7 @@ begin
|
|||||||
inherited KeyPress(Key);
|
inherited KeyPress(Key);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
//=== { TJvBaseThumbImage } ==================================================
|
//=== { TJvBaseThumbImage } ==================================================
|
||||||
|
|
||||||
constructor TJvBaseThumbImage.Create(AOwner: TComponent);
|
constructor TJvBaseThumbImage.Create(AOwner: TComponent);
|
||||||
|
@ -74,7 +74,6 @@ type
|
|||||||
FClass: TGraphicClass;
|
FClass: TGraphicClass;
|
||||||
FOnInvalidImage: TInvalidImageEvent;
|
FOnInvalidImage: TInvalidImageEvent;
|
||||||
procedure Rotate90;
|
procedure Rotate90;
|
||||||
//procedure Rotate180;
|
|
||||||
procedure Rotate270;
|
procedure Rotate270;
|
||||||
procedure SetAngle(AAngle: TAngle);
|
procedure SetAngle(AAngle: TAngle);
|
||||||
function GetModify: Boolean;
|
function GetModify: Boolean;
|
||||||
@ -749,88 +748,11 @@ procedure TJvThumbImage.SetAngle(AAngle: TAngle);
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if not Assigned(Picture.Graphic) then
|
if Assigned(Picture.Graphic) and CanModify and (AAngle <> FAngle) then begin
|
||||||
exit;
|
RotateByDelta(ord(AAngle) - ord(FAngle));
|
||||||
if not CanModify then
|
FAngle := AAngle;
|
||||||
exit;
|
FModified := FAngle <> AT0;
|
||||||
if AAngle = FAngle then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
RotateByDelta(ord(AAngle) - ord(FAngle));
|
|
||||||
(*
|
|
||||||
case FAngle of
|
|
||||||
AT0:
|
|
||||||
case AAngle of
|
|
||||||
AT90:
|
|
||||||
begin
|
|
||||||
Rotate90;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
AT180:
|
|
||||||
Mirror(mtBoth);
|
|
||||||
AT270:
|
|
||||||
begin
|
|
||||||
Rotate270;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
AT90:
|
|
||||||
case AAngle of
|
|
||||||
AT180:
|
|
||||||
begin
|
|
||||||
Rotate90;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
AT270:
|
|
||||||
Mirror(mtBoth);
|
|
||||||
AT0:
|
|
||||||
begin
|
|
||||||
Rotate270;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
AT180:
|
|
||||||
case AAngle of
|
|
||||||
AT270:
|
|
||||||
begin
|
|
||||||
Rotate90;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
AT0:
|
|
||||||
Mirror(mtBoth);
|
|
||||||
AT90:
|
|
||||||
begin
|
|
||||||
Rotate270;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
AT270:
|
|
||||||
case AAngle of
|
|
||||||
AT0:
|
|
||||||
begin
|
|
||||||
Rotate90;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
AT90:
|
|
||||||
Mirror(mtBoth);
|
|
||||||
AT180:
|
|
||||||
begin
|
|
||||||
Rotate270;
|
|
||||||
if Parent is TJvThumbnail then
|
|
||||||
SendMessage(TJvThumbnail(Parent).Handle, TH_IMAGESIZECHANGED, 0, 0);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
*)
|
|
||||||
FAngle := AAngle;
|
|
||||||
FModified := FAngle <> AT0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(*
|
(*
|
||||||
@ -927,10 +849,9 @@ end;
|
|||||||
procedure TJvThumbImage.Rotate270;
|
procedure TJvThumbImage.Rotate270;
|
||||||
var
|
var
|
||||||
Row, Col: Integer;
|
Row, Col: Integer;
|
||||||
MemBmp: TBitmap;
|
MemBmp, RotBmp: TBitmap;
|
||||||
IntfImg: TLazIntfImage;
|
IntfImg, RotIntfImg: TLazIntfImage;
|
||||||
RotIntfImg: TLazIntfImage;
|
RotImgHandle, RotImgMaskHandle: HBitmap;
|
||||||
ImgHandle, ImgMaskHandle: HBitmap;
|
|
||||||
clr: TColor;
|
clr: TColor;
|
||||||
w, h: Integer;
|
w, h: Integer;
|
||||||
begin
|
begin
|
||||||
@ -942,32 +863,44 @@ begin
|
|||||||
IntfImg := TLazIntfImage.Create(0, 0);
|
IntfImg := TLazIntfImage.Create(0, 0);
|
||||||
RotIntfImg := TLazIntfImage.Create(0, 0);
|
RotIntfImg := TLazIntfImage.Create(0, 0);
|
||||||
MemBmp := TBitmap.Create;
|
MemBmp := TBitmap.Create;
|
||||||
|
RotBmp := TBitmap.Create;
|
||||||
try
|
try
|
||||||
MemBmp.PixelFormat := pf32bit;
|
MemBmp.PixelFormat := pf32bit;
|
||||||
MemBmp.SetSize(w, h);
|
MemBmp.SetSize(w, h);
|
||||||
MemBmp.Canvas.Brush.Color := clWhite;
|
MemBmp.Canvas.Brush.Color := clWhite;
|
||||||
MemBmp.Canvas.FillRect(0, 0, w, h);
|
MemBmp.Canvas.FillRect(0, 0, w, h);
|
||||||
MemBmp.Assign(Picture);
|
MemBmp.Assign(Picture);
|
||||||
|
RotBmp.PixelFormat := pf32Bit;
|
||||||
|
RotBmp.SetSize(h, w);
|
||||||
IntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
IntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
||||||
RotIntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
RotIntfImg.LoadFromBitmap(RotBmp.Handle, RotBmp.MaskHandle);
|
||||||
RotIntfImg.SetSize(h, w);
|
(*
|
||||||
|
|
||||||
for Row := 0 to h - 1 do
|
for Row := 0 to h - 1 do
|
||||||
for Col := 0 to w - 1 do begin
|
for Col := 0 to w - 1 do begin
|
||||||
clr := IntfImg.TColors[Col, Row];
|
clr := IntfImg.TColors[Col, Row];
|
||||||
RotIntfImg.TColors[h - 1 - Row , w - 1 - Col] := clr;
|
RotIntfImg.TColors[h - 1 - Row , w - 1 - Col] := clr;
|
||||||
end;
|
end;
|
||||||
RotIntfImg.CreateBitmaps(ImgHandle, ImgMaskHandle);
|
*)
|
||||||
MemBmp.Handle := ImgHandle;
|
for Row := h - 1 downto 0 do
|
||||||
MemBmp.MaskHandle := ImgMaskHandle;
|
for Col := 0 to w - 1 do begin
|
||||||
|
clr := IntfImg.TColors[Col, Row];
|
||||||
|
RotIntfImg.TColors[h - 1 - Row, w - 1 - Col] := clr;
|
||||||
|
end;
|
||||||
|
|
||||||
|
RotIntfImg.CreateBitmaps(RotImgHandle, RotImgMaskHandle);
|
||||||
|
RotBmp.Handle := RotImgHandle;
|
||||||
|
RotBmp.MaskHandle := RotImgMaskHandle;
|
||||||
|
Picture.Graphic.Clear;
|
||||||
if Picture.Graphic is TJpegImage then
|
if Picture.Graphic is TJpegImage then
|
||||||
TJpegImage(Picture.Graphic).Assign(MemBmp)
|
TJpegImage(Picture.Graphic).Assign(RotBmp)
|
||||||
else if Picture.Graphic is Graphics.TBitmap then
|
else if Picture.Graphic is Graphics.TBitmap then
|
||||||
Picture.Bitmap.Assign(MemBmp);
|
Picture.Bitmap.Assign(RotBmp);
|
||||||
Invalidate;
|
Invalidate;
|
||||||
finally
|
finally
|
||||||
MemBmp.Free;
|
MemBmp.Free;
|
||||||
|
RotBmp.Free;
|
||||||
IntfImg.Free;
|
IntfImg.Free;
|
||||||
|
RotIntfImg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1031,10 +964,9 @@ end;
|
|||||||
procedure TJvThumbImage.Rotate90;
|
procedure TJvThumbImage.Rotate90;
|
||||||
var
|
var
|
||||||
Row, Col: Integer;
|
Row, Col: Integer;
|
||||||
MemBmp: TBitmap;
|
MemBmp, RotBmp: TBitmap;
|
||||||
IntfImg: TLazIntfImage;
|
IntfImg, RotIntfImg: TLazIntfImage;
|
||||||
RotIntfImg: TLazIntfImage;
|
RotImgHandle, RotImgMaskHandle: HBitmap;
|
||||||
ImgHandle, ImgMaskHandle: HBitmap;
|
|
||||||
clr: TColor;
|
clr: TColor;
|
||||||
w, h: Integer;
|
w, h: Integer;
|
||||||
begin
|
begin
|
||||||
@ -1046,32 +978,37 @@ begin
|
|||||||
IntfImg := TLazIntfImage.Create(0, 0);
|
IntfImg := TLazIntfImage.Create(0, 0);
|
||||||
RotIntfImg := TLazIntfImage.Create(0, 0);
|
RotIntfImg := TLazIntfImage.Create(0, 0);
|
||||||
MemBmp := TBitmap.Create;
|
MemBmp := TBitmap.Create;
|
||||||
|
RotBmp := TBitmap.Create;
|
||||||
try
|
try
|
||||||
MemBmp.PixelFormat := pf32bit;
|
MemBmp.PixelFormat := pf32bit;
|
||||||
MemBmp.SetSize(w, h);
|
MemBmp.SetSize(w, h);
|
||||||
MemBmp.Canvas.Brush.Color := clWhite;
|
MemBmp.Canvas.Brush.Color := clWhite;
|
||||||
MemBmp.Canvas.FillRect(0, 0, w, h);
|
MemBmp.Canvas.FillRect(0, 0, w, h);
|
||||||
MemBmp.Assign(Picture);
|
MemBmp.Assign(Picture);
|
||||||
|
RotBmp.PixelFormat := pf32Bit;
|
||||||
|
RotBmp.SetSize(h, w);
|
||||||
IntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
IntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
||||||
RotIntfImg.LoadFromBitmap(MemBmp.Handle, MemBmp.MaskHandle);
|
RotIntfImg.LoadFromBitmap(RotBmp.Handle, RotBmp.MaskHandle);
|
||||||
RotIntfImg.SetSize(h, w);
|
|
||||||
|
|
||||||
for Row := 0 to h - 1 do
|
for Row := 0 to h - 1 do
|
||||||
for Col := 0 to w - 1 do begin
|
for Col := 0 to w - 1 do begin
|
||||||
clr := IntfImg.TColors[Col, Row];
|
clr := IntfImg.TColors[Col, Row];
|
||||||
RotIntfImg.TColors[Row, Col] := clr;
|
RotIntfImg.TColors[Row, Col] := clr;
|
||||||
end;
|
end;
|
||||||
RotIntfImg.CreateBitmaps(ImgHandle, ImgMaskHandle);
|
RotIntfImg.CreateBitmaps(RotImgHandle, RotImgMaskHandle);
|
||||||
MemBmp.Handle := ImgHandle;
|
RotBmp.Handle := RotImgHandle;
|
||||||
MemBmp.MaskHandle := ImgMaskHandle;
|
RotBmp.MaskHandle := RotImgMaskHandle;
|
||||||
|
Picture.Graphic.Clear;
|
||||||
if Picture.Graphic is TJpegImage then
|
if Picture.Graphic is TJpegImage then
|
||||||
TJpegImage(Picture.Graphic).Assign(MemBmp)
|
TJpegImage(Picture.Graphic).Assign(RotBmp)
|
||||||
else if Picture.Graphic is Graphics.TBitmap then
|
else if Picture.Graphic is Graphics.TBitmap then
|
||||||
Picture.Bitmap.Assign(MemBmp);
|
Picture.Bitmap.Assign(RotBmp);
|
||||||
Invalidate;
|
Invalidate;
|
||||||
finally
|
finally
|
||||||
MemBmp.Free;
|
MemBmp.Free;
|
||||||
|
RotBmp.Free;
|
||||||
IntfImg.Free;
|
IntfImg.Free;
|
||||||
|
RotIntfImg.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -84,6 +84,7 @@ type
|
|||||||
FFilter: string;
|
FFilter: string;
|
||||||
// FBufferFile: string;
|
// FBufferFile: string;
|
||||||
FThumbColor: TColor;
|
FThumbColor: TColor;
|
||||||
|
FThumbTitleColor: TColor;
|
||||||
FAsButtons: Boolean;
|
FAsButtons: Boolean;
|
||||||
FTitlePlacement: TTitlePos;
|
FTitlePlacement: TTitlePos;
|
||||||
FOnKeyDown: TKeyEvent;
|
FOnKeyDown: TKeyEvent;
|
||||||
@ -112,6 +113,8 @@ type
|
|||||||
procedure GoDown;
|
procedure GoDown;
|
||||||
procedure GoUp;
|
procedure GoUp;
|
||||||
procedure SetAsButton(const NewVal: Boolean);
|
procedure SetAsButton(const NewVal: Boolean);
|
||||||
|
procedure SetThumbColor(const AValue: TColor);
|
||||||
|
procedure SetThumbTitleColor(const AValue: TColor);
|
||||||
procedure SetTitlePos(const NewVal: TTitlePos);
|
procedure SetTitlePos(const NewVal: TTitlePos);
|
||||||
function CreateFilter: string;
|
function CreateFilter: string;
|
||||||
procedure SetFilters;
|
procedure SetFilters;
|
||||||
@ -185,7 +188,8 @@ type
|
|||||||
property TitlePlacement: TTitlePos read FTitlePlacement write SetTitlePos default tpUp;
|
property TitlePlacement: TTitlePos read FTitlePlacement write SetTitlePos default tpUp;
|
||||||
property Filter: string read FFilter write FFilter;
|
property Filter: string read FFilter write FFilter;
|
||||||
// Property BufferFile : String Read FBufferFile write SetBufferFile;
|
// Property BufferFile : String Read FBufferFile write SetBufferFile;
|
||||||
property ThumbColor: TColor read FThumbColor write FThumbColor;
|
property ThumbColor: TColor read FThumbColor write SetThumbColor default clDefault;
|
||||||
|
property ThumbTitleColor: TColor read FThumbTitleColor write SetThumbTitleColor default clDefault;
|
||||||
property ShowShadow: Boolean read FShowShadow write FShowShadow;
|
property ShowShadow: Boolean read FShowShadow write FShowShadow;
|
||||||
property ShadowColor: TColor read FShadowColor write FShadowColor;
|
property ShadowColor: TColor read FShadowColor write FShadowColor;
|
||||||
property AutoScroll;
|
property AutoScroll;
|
||||||
@ -243,7 +247,8 @@ begin
|
|||||||
FFileList.Clear;
|
FFileList.Clear;
|
||||||
FFileListSorted := TStringList.Create;
|
FFileListSorted := TStringList.Create;
|
||||||
FFileListSorted.Clear;
|
FFileListSorted.Clear;
|
||||||
FThumbColor := clNone;
|
FThumbColor := clDefault;
|
||||||
|
FThumbTitlecolor := clDefault;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TJvThumbView.Destroy;
|
destructor TJvThumbView.Destroy;
|
||||||
@ -286,16 +291,18 @@ begin
|
|||||||
Thb.OnDblClick := OnDblClick;
|
Thb.OnDblClick := OnDblClick;
|
||||||
Thb.Photo.OnDblClick := OnDblClick;
|
Thb.Photo.OnDblClick := OnDblClick;
|
||||||
Thb.MinimizeMemory := MinMemory;
|
Thb.MinimizeMemory := MinMemory;
|
||||||
Thb.Color := Self.Color;
|
|
||||||
Thb.Title := ATitle;
|
Thb.Title := ATitle;
|
||||||
if FThumbColor = clNone then
|
if FThumbColor = clDefault then
|
||||||
begin
|
begin
|
||||||
Thb.Color := Self.Color;
|
Thb.Color := Self.Color;
|
||||||
Thb.ParentColor := True;
|
Thb.ParentColor := True;
|
||||||
Thb.TitleColor := Self.Color;
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
Thb.Color := FThumbColor;
|
Thb.Color := FThumbColor;
|
||||||
|
if FThumbTitleColor = clDefault then
|
||||||
|
Thb.TitleColor := Self.Color
|
||||||
|
else
|
||||||
|
Thb.TitleColor := FThumbTitleColor;
|
||||||
FThumbList.AddObject(Thb.Title, Thb);
|
FThumbList.AddObject(Thb.Title, Thb);
|
||||||
Thb.Parent := Self;
|
Thb.Parent := Self;
|
||||||
if Redraw then
|
if Redraw then
|
||||||
@ -783,6 +790,16 @@ begin
|
|||||||
Thb.OnDblClick := OnDblClick;
|
Thb.OnDblClick := OnDblClick;
|
||||||
Thb.Title := aTitle;
|
Thb.Title := aTitle;
|
||||||
Thb.Photo.OnDblClick := OnDblClick;
|
Thb.Photo.OnDblClick := OnDblClick;
|
||||||
|
if FThumbColor = clDefault then
|
||||||
|
begin
|
||||||
|
Thb.Color := Self.Color;
|
||||||
|
Thb.ParentColor := True;
|
||||||
|
end else
|
||||||
|
Thb.Color := FThumbColor;
|
||||||
|
if FThumbTitleColor = clDefault then
|
||||||
|
Thb.TitleColor := Self.Color
|
||||||
|
else
|
||||||
|
Thb.TitleColor := FThumbTitleColor;
|
||||||
// Thb.Buffer := Vbuffer;
|
// Thb.Buffer := Vbuffer;
|
||||||
Thb.Photo.LoadFromStream(AStream, Thb.StreamFileType);
|
Thb.Photo.LoadFromStream(AStream, Thb.StreamFileType);
|
||||||
Result := FThumbList.AddObject(Thb.Title, Thb);
|
Result := FThumbList.AddObject(Thb.Title, Thb);
|
||||||
@ -814,6 +831,18 @@ begin
|
|||||||
Thb.OnDblClick := OnDblClick;
|
Thb.OnDblClick := OnDblClick;
|
||||||
Thb.Photo.OnDblClick := OnDblClick;
|
Thb.Photo.OnDblClick := OnDblClick;
|
||||||
Thb.MinimizeMemory := MinMemory;
|
Thb.MinimizeMemory := MinMemory;
|
||||||
|
if FThumbColor = clDefault then
|
||||||
|
begin
|
||||||
|
Thb.Color := Self.Color;
|
||||||
|
Thb.ParentColor := True;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Thb.Color := FThumbColor;
|
||||||
|
if FThumbTitleColor = clDefault then
|
||||||
|
Thb.TitleColor := Self.Color
|
||||||
|
else
|
||||||
|
Thb.TitleColor := FThumbTitleColor;
|
||||||
|
|
||||||
// Thb.Buffer := VBuffer;
|
// Thb.Buffer := VBuffer;
|
||||||
FThumbList.AddObject(AFile, Thb);
|
FThumbList.AddObject(AFile, Thb);
|
||||||
InsertControl(Thb);
|
InsertControl(Thb);
|
||||||
@ -1103,6 +1132,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbView.SetThumbColor(const AValue: TColor);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if AValue = FThumbColor then exit;
|
||||||
|
FThumbColor := AValue;
|
||||||
|
for i:=0 to FThumbList.Count-1 do
|
||||||
|
FThumbList.Thumbnail[i].Color := FThumbColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbView.SetThumbTitleColor(const AValue: TColor);
|
||||||
|
var
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
if AValue = FThumbTitleColor then exit;
|
||||||
|
FThumbTitleColor := AValue;
|
||||||
|
for i:=0 to FThumbList.Count-1 do
|
||||||
|
FThumbList.Thumbnail[i].TitleColor := FThumbTitleColor;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJvThumbView.SetTitlePos(const NewVal: TTitlePos);
|
procedure TJvThumbView.SetTitlePos(const NewVal: TTitlePos);
|
||||||
var
|
var
|
||||||
I: Longint;
|
I: Longint;
|
||||||
|
@ -79,8 +79,8 @@ type
|
|||||||
FStream: TStream;
|
FStream: TStream;
|
||||||
FImageWidth: Longint;
|
FImageWidth: Longint;
|
||||||
FImageHeight: Longint;
|
FImageHeight: Longint;
|
||||||
FClientHeight: Word;
|
FThumbHeight: Word;
|
||||||
FClientWidth: Word;
|
FThumbWidth: Word;
|
||||||
FShadowObj: TShape;
|
FShadowObj: TShape;
|
||||||
FUpdated: Boolean;
|
FUpdated: Boolean;
|
||||||
FImageReady: Boolean;
|
FImageReady: Boolean;
|
||||||
@ -97,6 +97,7 @@ type
|
|||||||
FShowShadow: Boolean;
|
FShowShadow: Boolean;
|
||||||
FHShadowOffset: Word;
|
FHShadowOffset: Word;
|
||||||
FVShadowOffset: Word;
|
FVShadowOffset: Word;
|
||||||
|
FMargin: Integer;
|
||||||
procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
|
procedure WMPaint(var Msg: TLMPaint); message LM_PAINT;
|
||||||
(************** NOT CONVERTED ***
|
(************** NOT CONVERTED ***
|
||||||
procedure PhotoOnProgress(Sender: TObject; Stage: TProgressStage;
|
procedure PhotoOnProgress(Sender: TObject; Stage: TProgressStage;
|
||||||
@ -108,11 +109,9 @@ type
|
|||||||
function LoadFile(AFile: string): string;
|
function LoadFile(AFile: string): string;
|
||||||
function GetFileName: string;
|
function GetFileName: string;
|
||||||
procedure CalculateImageSize; virtual;
|
procedure CalculateImageSize; virtual;
|
||||||
procedure SetClientWidth(AWidth: Word);
|
|
||||||
procedure SetDummyStr(AStr: string);
|
procedure SetDummyStr(AStr: string);
|
||||||
procedure SetMinimizeMemory(Min: Boolean);
|
procedure SetMinimizeMemory(Min: Boolean);
|
||||||
procedure SetDummyCard(AInt: Longint);
|
procedure SetDummyCard(AInt: Longint);
|
||||||
procedure SetClientHeight(AHeight: Word);
|
|
||||||
procedure SetShowTitle(const AState: Boolean);
|
procedure SetShowTitle(const AState: Boolean);
|
||||||
procedure SetTitlePlacement(const AState: TTitlePos);
|
procedure SetTitlePlacement(const AState: TTitlePos);
|
||||||
procedure SetTitle(const Value: string);
|
procedure SetTitle(const Value: string);
|
||||||
@ -121,8 +120,15 @@ type
|
|||||||
procedure SetTitleFont(const Value: TFont);
|
procedure SetTitleFont(const Value: TFont);
|
||||||
procedure GetFileInfo(AName: string);
|
procedure GetFileInfo(AName: string);
|
||||||
procedure SetShowShadow(AShow: Boolean);
|
procedure SetShowShadow(AShow: Boolean);
|
||||||
|
procedure SetMargin(AValue: Integer);
|
||||||
// procedure SetShadowColor(aColor: TColor);
|
// procedure SetShadowColor(aColor: TColor);
|
||||||
|
|
||||||
|
procedure UpdateThumbHeight;
|
||||||
|
procedure UpdateThumbWidth;
|
||||||
|
procedure UpdateTitlePanelHeight;
|
||||||
|
function IsTitleFontStored: Boolean;
|
||||||
protected
|
protected
|
||||||
|
procedure CreateHandle; override;
|
||||||
procedure THSizeChanged(var Msg: TLMessage); message TH_IMAGESIZECHANGED;
|
procedure THSizeChanged(var Msg: TLMessage); message TH_IMAGESIZECHANGED;
|
||||||
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
|
||||||
X, Y: Integer); override;
|
X, Y: Integer); override;
|
||||||
@ -140,12 +146,10 @@ type
|
|||||||
published
|
published
|
||||||
property FileName: string read GetFileName write SetFileName;
|
property FileName: string read GetFileName write SetFileName;
|
||||||
property Title: string read FTitle write SetTitle;
|
property Title: string read FTitle write SetTitle;
|
||||||
property TitleColor: TColor read FTitleColor write SetTitleColor;
|
property TitleColor: TColor read FTitleColor write SetTitleColor default clDefault;
|
||||||
property TitleFont: TFont read FTitleFont write SetTitleFont;
|
property TitleFont: TFont read FTitleFont write SetTitleFont stored IsTitleFontStored;
|
||||||
property ImageReady: Boolean read FImageReady;
|
property ImageReady: Boolean read FImageReady;
|
||||||
property OnGetTitle: TTitleNotify read FOnGetTitle write FOnGetTitle;
|
property OnGetTitle: TTitleNotify read FOnGetTitle write FOnGetTitle;
|
||||||
property ClientWidth: Word read FClientWidth write SetClientWidth;
|
|
||||||
property ClientHeight: Word read FClientHeight write SetClientHeight;
|
|
||||||
{ Do not store dummies }
|
{ Do not store dummies }
|
||||||
property FileSize: Longint read FDFileSize write SetDummyCard stored False;
|
property FileSize: Longint read FDFileSize write SetDummyCard stored False;
|
||||||
property FileAccessed: string read FDFileAccessed write SetDummyStr stored False;
|
property FileAccessed: string read FDFileAccessed write SetDummyStr stored False;
|
||||||
@ -153,14 +157,15 @@ type
|
|||||||
property FileChanged: string read FDFileChanged write SetDummyStr stored False;
|
property FileChanged: string read FDFileChanged write SetDummyStr stored False;
|
||||||
property ImageWidth: Longint read FImageWidth default 0;
|
property ImageWidth: Longint read FImageWidth default 0;
|
||||||
property ImageHeight: Longint read FImageHeight default 0;
|
property ImageHeight: Longint read FImageHeight default 0;
|
||||||
property AsButton: Boolean read FAsButton write FAsButton;
|
property AsButton: Boolean read FAsButton write FAsButton default false;
|
||||||
property MinimizeMemory: Boolean read FMinimizeMemory write SetMinimizeMemory;
|
property Margin: Integer read FMargin write SetMargin default 8;
|
||||||
property StreamFileType: TGRFKind read FStreamFileKind write FStreamFileKind;
|
property MinimizeMemory: Boolean read FMinimizeMemory write SetMinimizeMemory default true;
|
||||||
property ShowTitle: Boolean read FShowTitle write SetShowTitle;
|
property StreamFileType: TGRFKind read FStreamFileKind write FStreamFileKind default grBMP;
|
||||||
property TitlePlacement: TTitlePos read FTitlePlacement write SetTitlePlacement;
|
property ShowTitle: Boolean read FShowTitle write SetShowTitle default true;
|
||||||
property AutoLoad: Boolean read FAutoLoad write FAutoLoad;
|
property TitlePlacement: TTitlePos read FTitlePlacement write SetTitlePlacement default tpUp;
|
||||||
|
property AutoLoad: Boolean read FAutoLoad write FAutoLoad default true;
|
||||||
property ShadowColor: TColor read FShadowColor write FShadowColor;
|
property ShadowColor: TColor read FShadowColor write FShadowColor;
|
||||||
property ShowShadow: Boolean read FShowShadow write SetShowShadow;
|
property ShowShadow: Boolean read FShowShadow write SetShowShadow default false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -173,16 +178,19 @@ uses
|
|||||||
constructor TJvThumbnail.Create(AOwner: TComponent);
|
constructor TJvThumbnail.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
FPhotoName := TJvFileName.Create;
|
FShowTitle := True;
|
||||||
|
FMargin := 8;
|
||||||
FHShadowOffset := 3;
|
FHShadowOffset := 3;
|
||||||
FVShadowOffset := 3;
|
FVShadowOffset := 3;
|
||||||
FShowShadow := False;
|
FShowShadow := False;
|
||||||
FShadowColor := clSilver;
|
FShadowColor := clSilver;
|
||||||
FShadowObj := TShape.Create(Self);
|
FTitleColor := clDefault; //clBtnFace;
|
||||||
FShadowObj.Visible := FShowShadow;
|
FTitlePlacement := tpUp;
|
||||||
FShadowObj.Brush.Color := FShadowColor;
|
FTitle := '';
|
||||||
FShadowObj.Parent := Self;
|
FUpdated := False;
|
||||||
FShadowObj.Pen.Style := psClear;
|
|
||||||
|
FPhotoName := TJvFileName.Create;
|
||||||
|
|
||||||
Photo := TJvThumbImage.Create(Self);
|
Photo := TJvThumbImage.Create(Self);
|
||||||
Photo.AutoSize := False;
|
Photo.AutoSize := False;
|
||||||
Photo.Align := alNone;
|
Photo.Align := alNone;
|
||||||
@ -191,25 +199,31 @@ begin
|
|||||||
Photo.OnProgress := PhotoOnProgress;
|
Photo.OnProgress := PhotoOnProgress;
|
||||||
**************)
|
**************)
|
||||||
|
|
||||||
|
FShadowObj := TShape.Create(Self);
|
||||||
|
FShadowObj.Visible := FShowShadow;
|
||||||
|
FShadowObj.Brush.Color := FShadowColor;
|
||||||
|
FShadowObj.Parent := Self;
|
||||||
|
FShadowObj.Pen.Style := psClear;
|
||||||
FShadowObj.Width := Photo.Width;
|
FShadowObj.Width := Photo.Width;
|
||||||
FShadowObj.Height := Photo.Height;
|
FShadowObj.Height := Photo.Height;
|
||||||
FShadowObj.Left := Photo.Left + FHShadowOffset;
|
FShadowObj.Left := Photo.Left + FHShadowOffset;
|
||||||
FShadowObj.Top := Photo.Top + FVShadowOffset;
|
FShadowObj.Top := Photo.Top + FVShadowOffset;
|
||||||
|
|
||||||
|
FTitleFont := TFont.Create;
|
||||||
|
FTitleFont.Name := 'default';
|
||||||
|
FTitleFont.Size := 0;
|
||||||
|
FTitleFont.OnChange := @RefreshFont;
|
||||||
|
|
||||||
FTitlePanel := TJvThumbTitle.Create(Self);
|
FTitlePanel := TJvThumbTitle.Create(Self);
|
||||||
FTitlePanel.Align := alTop;
|
FTitlePanel.Align := alTop;
|
||||||
FTitlePanel.Height := 15;
|
FTitlePanel.Height := 15;
|
||||||
FTitlePanel.Alignment := taCenter;
|
FTitlePanel.Alignment := taCenter;
|
||||||
FTitleColor := clBtnFace;
|
|
||||||
FTitlePanel.Color := FTitleColor;
|
FTitlePanel.Color := FTitleColor;
|
||||||
FTitleFont := TFont.Create;
|
|
||||||
FTitleFont.OnChange := @RefreshFont;
|
|
||||||
FTitlePanel.BevelOuter := bvLowered;
|
FTitlePanel.BevelOuter := bvLowered;
|
||||||
FTitlePanel.ParentColor := True;
|
FTitlePanel.ParentColor := True;
|
||||||
FTitlePanel.Color := Self.Color;
|
// FTitlePanel.Color := Self.Color;
|
||||||
if FTitlePlacement = tpNone then
|
FTitlePanel.Visible := (FTitlePlacement <> tpNone) and FShowTitle;
|
||||||
FTitlePanel.Visible := False;
|
|
||||||
FTitle := '';
|
|
||||||
FUpdated := False;
|
|
||||||
InsertControl(Photo);
|
InsertControl(Photo);
|
||||||
InsertControl(FTitlePanel);
|
InsertControl(FTitlePanel);
|
||||||
Align := alNone;
|
Align := alNone;
|
||||||
@ -260,6 +274,31 @@ begin
|
|||||||
inherited BoundsChanged;
|
inherited BoundsChanged;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnail.CreateHandle;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if not (csDesigning in ComponentState) and (FTitleColor = clDefault) then
|
||||||
|
FTitleColor := Color;
|
||||||
|
UpdateTitlePanelHeight;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TJvThumbnail.IsTitleFontStored: Boolean;
|
||||||
|
begin
|
||||||
|
Result := not FTitleFont.IsDefault;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnail.UpdateTitlePanelHeight;
|
||||||
|
var
|
||||||
|
fd: TFontData;
|
||||||
|
begin
|
||||||
|
fd := GetFontData(FTitleFont.Handle);
|
||||||
|
Canvas.Font.Name := fd.Name;
|
||||||
|
Canvas.Font.Style := fd.Style;
|
||||||
|
Canvas.Font.Height := fd.Height;
|
||||||
|
FTitlePanel.Height := Canvas.TextHeight('Tg') + 4;
|
||||||
|
CalculateImageSize;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnail.SetStream(const AStream: TStream);
|
procedure TJvThumbnail.SetStream(const AStream: TStream);
|
||||||
var
|
var
|
||||||
Bmp: Graphics.TBitmap;
|
Bmp: Graphics.TBitmap;
|
||||||
@ -304,17 +343,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnail.SetClientWidth(AWidth: Word);
|
procedure TJvThumbnail.UpdateThumbWidth;
|
||||||
begin
|
begin
|
||||||
FClientWidth := (Width - (BorderWidth * 2)) - 8;
|
FThumbWidth := ClientWidth - 2 * FMargin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnail.SetClientHeight(AHeight: Word);
|
procedure TJvThumbnail.UpdateThumbHeight;
|
||||||
begin
|
begin
|
||||||
if Assigned(FTitlePanel) then
|
if Assigned(FTitlePanel) and FTitlePanel.Visible then
|
||||||
FClientHeight := Height - (FTitlePanel.Height + 8)
|
FThumbHeight := ClientHeight - FTitlePanel.Height - FMargin
|
||||||
else
|
else
|
||||||
FClientHeight := Height - 8;
|
FThumbHeight := ClientHeight - FMargin;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// dummy property functions to allow the object inspector to
|
// dummy property functions to allow the object inspector to
|
||||||
@ -355,6 +394,17 @@ begin
|
|||||||
FShowShadow := AShow;
|
FShowShadow := AShow;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TJvThumbnail.SetMargin(AValue: Integer);
|
||||||
|
begin
|
||||||
|
if AValue <> FMargin then begin
|
||||||
|
FMargin := AValue;
|
||||||
|
CalculateImageSize;
|
||||||
|
// UpdateThumbWidth;
|
||||||
|
// UpdateThumbHeight;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{procedure TJvThumbnail.SetShadowColor(aColor: TColor);
|
{procedure TJvThumbnail.SetShadowColor(aColor: TColor);
|
||||||
begin
|
begin
|
||||||
FShadowObj.Brush.Color := aColor;
|
FShadowObj.Brush.Color := aColor;
|
||||||
@ -466,7 +516,7 @@ begin
|
|||||||
if Owner is TJvThumbView then
|
if Owner is TJvThumbView then
|
||||||
Photo.ScaleDown(TJvThumbView(Owner).MaxWidth, TJvThumbView(Owner).MaxHeight)
|
Photo.ScaleDown(TJvThumbView(Owner).MaxWidth, TJvThumbView(Owner).MaxHeight)
|
||||||
else
|
else
|
||||||
Photo.ScaleDown(Width, Height);
|
Photo.ScaleDown(FThumbWidth, FThumbHeight);
|
||||||
end;
|
end;
|
||||||
Result := FName;
|
Result := FName;
|
||||||
end;
|
end;
|
||||||
@ -499,12 +549,12 @@ var
|
|||||||
begin
|
begin
|
||||||
if (Photo = nil) or (Photo.Picture = nil) then
|
if (Photo = nil) or (Photo.Picture = nil) then
|
||||||
exit;
|
exit;
|
||||||
SetClientHeight(15);
|
UpdateThumbHeight;
|
||||||
SetClientWidth(15);
|
UpdateThumbWidth;
|
||||||
if (Photo.Picture.Width > ClientWidth) or (Photo.Picture.Height > ClientHeight) then
|
if (Photo.Picture.Width > FThumbWidth) or (Photo.Picture.Height > FThumbHeight) then
|
||||||
begin
|
begin
|
||||||
TempX := ((ClientWidth) / Photo.Picture.Width) * 100;
|
TempX := (FThumbWidth / Photo.Picture.Width) * 100;
|
||||||
TempY := ((ClientHeight) / Photo.Picture.Height) * 100;
|
TempY := (FThumbHeight / Photo.Picture.Height) * 100;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
@ -584,6 +634,7 @@ end;
|
|||||||
procedure TJvThumbnail.RefreshFont(Sender: TObject);
|
procedure TJvThumbnail.RefreshFont(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
FTitlePanel.Font.Assign(FTitleFont);
|
FTitlePanel.Font.Assign(FTitleFont);
|
||||||
|
UpdateTitlePanelHeight;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TJvThumbnail.SetTitlePanel(ATitle: string; AFont: TFont;
|
procedure TJvThumbnail.SetTitlePanel(ATitle: string; AFont: TFont;
|
||||||
@ -606,7 +657,7 @@ begin
|
|||||||
tpNone:
|
tpNone:
|
||||||
FTitlePanel.Visible := False;
|
FTitlePanel.Visible := False;
|
||||||
end;
|
end;
|
||||||
if FTitlePlacement = tpNone then
|
if FTitlePlacement <> tpNone then
|
||||||
FTitlePanel.Visible := True;
|
FTitlePanel.Visible := True;
|
||||||
FTitlePlacement := AState;
|
FTitlePlacement := AState;
|
||||||
CalculateImageSize;
|
CalculateImageSize;
|
||||||
@ -641,5 +692,4 @@ begin
|
|||||||
inherited Refresh;
|
inherited Refresh;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user