revert previous commit (wrong file commited) and commit right file

git-svn-id: trunk@12764 -
This commit is contained in:
paul 2007-11-07 09:14:58 +00:00
parent 157e720653
commit 5814f58500
2 changed files with 24 additions and 27 deletions

View File

@ -1,4 +1,4 @@
{
{
*****************************************************************************
* *
* See the file COPYING.modifiedLGPL, included in this distribution, *
@ -135,18 +135,27 @@ function CreateGlyph(B: TBitmap; Width, Height: Integer;
Adjustment: TGlyphAdjustment; TransparentColor: TColor = clFuchsia): TBitmap;
begin
Result := TBitmap.Create;
Result.Width := Width;
Result.Height := Height;
Result.Canvas.Brush.Color := TransparentColor;
Result.Canvas.FillRect(Bounds(0, 0, Width, Height));
case Adjustment of
if (Adjustment = gaNone) then
begin
Result.Assign(B);
end
else
begin
Result.Width := Width;
Result.Height := Height;
Result.Canvas.Brush.Color := TransparentColor;
Result.Canvas.FillRect(Bounds(0, 0, Width, Height));
case Adjustment of
gaStretch: Result.Canvas.StretchDraw(Bounds(0, 0, Width, Height), B);
gaCrop, gaNone: Result.Canvas.Draw(0, 0, B);
gaCrop: Result.Canvas.Draw(0, 0, B);
gaCenter: Result.Canvas.Draw((Width - B.Width) div 2, (Height - B.Height) div 2, B);
end;
Result.TransparentColor := TransparentColor;
Result.Transparent := True;
Result.TransparentMode := tmAuto;
end;
Result.TransparentColor := TransparentColor;
Result.Transparent:= True;
Result.TransparentMode := tmAuto;
end;
function CreateGlyphSplit(Src: TBitmap; Width, Height: Integer; SrcSplitIndex: Integer): TBitmap;
@ -154,13 +163,8 @@ begin
Result := TBitmap.Create;
Result.Width := Width;
Result.Height := Height;
Result.Canvas.Brush.Color:= Src.TransparentColor;
Result.Canvas.FillRect(Bounds(0, 0, Width, Height));
Result.Canvas.CopyRect( Rect(0, 0, Width, Height),
Src.Canvas, Bounds(SrcSplitIndex * Width, 0, Width, Height) );
Result.TransparentColor := Src.TransparentColor;
Result.Transparent := True;
Result.TransparentMode := tmAuto;
end;
{ TImageListEditorDlg }
@ -480,8 +484,6 @@ var
v_PartCount: Integer;
c_Part: Integer;
v_CompositeBmp: TBitmap;
glyphTransparentColor:TColor;
glyphTransparentColorName:String;
begin
SaveDialog.InitialDir := ExtractFileDir(FileName);
Bmp := nil;
@ -489,6 +491,7 @@ begin
Picture := TPicture.Create;
try
Picture.LoadFromFile(FileName);
Bmp := TBitmap.Create;
Bmp.Assign(Picture.Bitmap);
finally
@ -499,12 +502,6 @@ begin
begin
if not Bmp.Empty then
begin
glyphTransparentColor:= Bmp.Canvas.Pixels[0,Bmp.Height-1];
glyphTransparentColorName:= ColorToString(glyphTransparentColor);
If ColorBoxTransparent.Items.IndexOf(glyphTransparentColorName)<0 then
ColorBoxTransparent.Items.Add(glyphTransparentColorName);
ColorBoxTransparent.Selected := glyphTransparentColor;
Bmp.TransparentColor:= glyphTransparentColor;
if (Bmp.Height = ImageList.Height)
and (Bmp.Width > ImageList.Width)
and (Bmp.Width mod ImageList.Width = 0)
@ -526,14 +523,14 @@ begin
if Assigned(v_CompositeBmp) then
Bmp := CreateGlyphSplit(v_CompositeBmp, ImageList.Width, ImageList.Height, c_Part);
Glyph := CreateGlyph(Bmp, ImageList.Width, ImageList.Height, gaNone, Bmp.TransparentColor);
Glyph := CreateGlyph(Bmp, ImageList.Width, ImageList.Height, gaNone);
I := ImageList.Add(Glyph, nil);
Glyph.Free;
New(P);
P^.Bitmap := Bmp;
P^.Adjustment := gaNone;
P^.TransparentColor := glyphTransparentColor;
P^.TransparentColor := clFuchsia;
Node := TreeView.Items.AddObject(nil, IntToStr(I), P);
Node.ImageIndex := I;

View File

@ -165,7 +165,7 @@ begin
msg.Msg := CN_NOTIFY;
if (widgets=nil) or (Widgets^.ItemCache=nil) or (Widgets^.ItemCache.Count=0) then
begin
debugln(' Gtk2_ItemSelectionChanged ItemChache=nil ',tComponent(widgetInfo^.lclObject).name);
debugln(' Gtk2_ItemSelectionChanged ItemCache=nil ',tComponent(widgetInfo^.lclObject).name);
exit;
end;
for i := 0 to Widgets^.ItemCache.Count -1 do
@ -1093,7 +1093,7 @@ var
Widgets: PTVWidgets;
begin
GetCommonTreeViewWidgets(PGtkWidget(AWinControl.Handle), Widgets);
// on widget destroy we have no ItemDeleted notification and we must destroy ItemChache ourself
// on widget destroy we have no ItemDeleted notification and we must destroy ItemCache ourself
// if things will change please remove this destroy
Widgets^.ItemCache.Free;
Widgets^.ItemCache := nil;