You've already forked lazarus-ccr
tvplanit: Fix contactgrid inplace editor appearing in name field.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4813 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -410,8 +410,8 @@ begin
|
|||||||
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
ControlStyle := [csCaptureMouse, csOpaque, csDoubleClicks];
|
||||||
cgGridState := gsNormal;
|
cgGridState := gsNormal;
|
||||||
{ Create internal classes and stuff }
|
{ Create internal classes and stuff }
|
||||||
cgClickTimer := TTimer.Create (self);
|
cgClickTimer := TTimer.Create(self);
|
||||||
FContactHeadAttr := TVpContactHeadAttr.Create (Self);
|
FContactHeadAttr := TVpContactHeadAttr.Create(Self);
|
||||||
|
|
||||||
{ Set styles and initialize internal variables }
|
{ Set styles and initialize internal variables }
|
||||||
{$IFDEF VERSION4}
|
{$IFDEF VERSION4}
|
||||||
@ -2359,7 +2359,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if cgInPlaceEditor <> nil then
|
if (cgInPlaceEditor <> nil) and cgInplaceEditor.Visible then
|
||||||
cgInPlaceEditor.SelectAll;
|
cgInPlaceEditor.SelectAll;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -29,7 +29,7 @@ type
|
|||||||
protected
|
protected
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
procedure DrawBorders;
|
procedure DrawBorders;
|
||||||
procedure DrawContactPart(ABitmap: TBitmap; AText, ALabel: String;
|
procedure DrawContactLine(ABitmap: TBitmap; AText, ALabel: String;
|
||||||
var AWholeRect, ATextRect: TRect);
|
var AWholeRect, ATextRect: TRect);
|
||||||
procedure DrawContacts;
|
procedure DrawContacts;
|
||||||
procedure DrawVerticalBars;
|
procedure DrawVerticalBars;
|
||||||
@ -122,14 +122,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpContactGridPainter.DrawContactPart(ABitmap: TBitmap; AText, ALabel: String;
|
procedure TVpContactGridPainter.DrawContactLine(ABitmap: TBitmap;
|
||||||
var AWholeRect, ATextRect: TRect);
|
AText, ALabel: String; var AWholeRect, ATextRect: TRect);
|
||||||
var
|
var
|
||||||
txtheight: Integer;
|
txtheight: Integer;
|
||||||
txtColWidth: Integer;
|
txtColWidth: Integer;
|
||||||
begin
|
begin
|
||||||
if AText = '' then
|
if AText = '' then begin
|
||||||
|
ATextRect := Rect(0, 0, 0, 0);
|
||||||
exit;
|
exit;
|
||||||
|
end;
|
||||||
|
|
||||||
txtHeight := ABitmap.Canvas.TextHeight(VpProductName);
|
txtHeight := ABitmap.Canvas.TextHeight(VpProductName);
|
||||||
|
|
||||||
@ -267,6 +269,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Col := 1;
|
Col := 1;
|
||||||
|
|
||||||
{ clear the bitmap }
|
{ clear the bitmap }
|
||||||
TmpBmp.Canvas.FillRect(Rect(0, 0, TmpBmp.Width, TmpBmp.Height));
|
TmpBmp.Canvas.FillRect(Rect(0, 0, TmpBmp.Width, TmpBmp.Height));
|
||||||
|
|
||||||
@ -358,19 +361,9 @@ begin
|
|||||||
if Str > '' then begin
|
if Str > '' then begin
|
||||||
{ paint the header cell's background }
|
{ paint the header cell's background }
|
||||||
if (Angle = ra0) or (Angle = ra180) then
|
if (Angle = ra0) or (Angle = ra180) then
|
||||||
Str := GetDisplayString(
|
Str := GetDisplayString(TmpBmp.Canvas, Str, 2, WidthOf(HeadRect) - TextMargin)
|
||||||
TmpBmp.Canvas,
|
|
||||||
Str,
|
|
||||||
2,
|
|
||||||
WidthOf(HeadRect) - TextMargin
|
|
||||||
)
|
|
||||||
else
|
else
|
||||||
Str := GetDisplayString(
|
Str := GetDisplayString(TmpBmp.Canvas, Str, 2, HeightOf(HeadRect) - TextMargin);
|
||||||
TmpBmp.Canvas,
|
|
||||||
Str,
|
|
||||||
2,
|
|
||||||
HeightOf(HeadRect) - TextMargin
|
|
||||||
);
|
|
||||||
TmpBmp.Canvas.Brush.Color := RealContactHeadAttrColor;
|
TmpBmp.Canvas.Brush.Color := RealContactHeadAttrColor;
|
||||||
TmpBmp.Canvas.FillRect(HeadRect);
|
TmpBmp.Canvas.FillRect(HeadRect);
|
||||||
{ paint the header cell's border }
|
{ paint the header cell's border }
|
||||||
@ -386,26 +379,26 @@ begin
|
|||||||
case Angle of
|
case Angle of
|
||||||
ra90:
|
ra90:
|
||||||
begin
|
begin
|
||||||
TextXOffset := HeadRect.Right - HeadRect.Left - TextMargin div 2;
|
TextXOffset := WidthOf(HeadRect) - TextMargin div 2;
|
||||||
TextYOffset := TextMargin div 3;
|
TextYOffset := TextMargin div 3;
|
||||||
end;
|
end;
|
||||||
ra180:
|
ra180:
|
||||||
begin
|
begin
|
||||||
TextXOffset := HeadRect.Right - HeadRect.Left - TextMargin;
|
TextXOffset := WidthOf(HeadRect) - TextMargin;
|
||||||
TextYOffset := HeadRect.Bottom - HeadRect.Top - TextMargin div 3;
|
TextYOffset := HeightOf(HeadRect) - TextMargin div 3;
|
||||||
end;
|
end;
|
||||||
ra270:
|
ra270:
|
||||||
begin
|
begin
|
||||||
TextXOffset := TextMargin div 2;
|
TextXOffset := TextMargin div 2;
|
||||||
TextYOffset := HeadRect.Bottom - HeadRect.Top - TextMargin div 3;
|
TextYOffset := HeightOf(HeadRect) - TextMargin div 3;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
TPSTextOutAtPoint(
|
TPSTextOutAtPoint(
|
||||||
TmpBmp.Canvas,
|
TmpBmp.Canvas,
|
||||||
Angle,
|
Angle,
|
||||||
TmpBmpRect,
|
TmpBmpRect,
|
||||||
HeadRect.Left + (TextMargin div 2) + TextXOffset,
|
HeadRect.Left + TextMargin div 2 + TextXOffset,
|
||||||
HeadRect.Top + (TextMargin div 3) + TextYOffset,
|
HeadRect.Top + TextMargin div 3 + TextYOffset,
|
||||||
Str
|
Str
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -416,10 +409,10 @@ begin
|
|||||||
TmpBmp.Canvas.Pen.Style := psSolid;
|
TmpBmp.Canvas.Pen.Style := psSolid;
|
||||||
|
|
||||||
{ do Company }
|
{ do Company }
|
||||||
DrawContactPart(TmpBmp, TmpCon.Company, '', WholeRect, CompanyRect);
|
DrawContactLine(TmpBmp, TmpCon.Company, '', WholeRect, CompanyRect);
|
||||||
|
|
||||||
{ do address... }
|
{ do address... }
|
||||||
DrawContactPart(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect);
|
DrawContactLine(TmpBmp, TmpCon.Address, '', WholeRect, AddrRect);
|
||||||
|
|
||||||
{ do City, State, Zip }
|
{ do City, State, Zip }
|
||||||
Str := TmpCon.City;
|
Str := TmpCon.City;
|
||||||
@ -431,30 +424,30 @@ begin
|
|||||||
Str := Str + ' ' + TmpCon.Zip
|
Str := Str + ' ' + TmpCon.Zip
|
||||||
else
|
else
|
||||||
Str := TmpCon.Zip;
|
Str := TmpCon.Zip;
|
||||||
DrawContactPart(TmpBmp, Str, '', WholeRect, CSZRect);
|
DrawContactLine(TmpBmp, Str, '', WholeRect, CSZRect);
|
||||||
|
|
||||||
{ do Phone1 }
|
{ do Phone1 }
|
||||||
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType1)) + ': ';
|
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType1)) + ': ';
|
||||||
DrawContactPart(TmpBmp, TmpCon.Phone1, Str, WholeRect, Phone1Rect);
|
DrawContactLine(TmpBmp, TmpCon.Phone1, Str, WholeRect, Phone1Rect);
|
||||||
|
|
||||||
{ do Phone2 }
|
{ do Phone2 }
|
||||||
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType2)) + ': ';
|
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType2)) + ': ';
|
||||||
DrawContactPart(TmpBmp, TmpCon.Phone2, Str, WholeRect, Phone2Rect);
|
DrawContactLine(TmpBmp, TmpCon.Phone2, Str, WholeRect, Phone2Rect);
|
||||||
|
|
||||||
{ do Phone3 }
|
{ do Phone3 }
|
||||||
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType3)) + ': ';
|
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType3)) + ': ';
|
||||||
DrawContactPart(TmpBmp, TmpCon.Phone3, Str, WholeRect, Phone3Rect);
|
DrawContactLine(TmpBmp, TmpCon.Phone3, Str, WholeRect, Phone3Rect);
|
||||||
|
|
||||||
{ do Phone4 }
|
{ do Phone4 }
|
||||||
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType4)) + ': ';
|
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType4)) + ': ';
|
||||||
DrawContactPart(TmpBmp, TmpCon.Phone4, Str, WholeRect, Phone4Rect);
|
DrawContactLine(TmpBmp, TmpCon.Phone4, Str, WholeRect, Phone4Rect);
|
||||||
|
|
||||||
{ do Phone5 }
|
{ do Phone5 }
|
||||||
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType5)) + ': ';
|
Str := PhoneLabel(TVpPhoneType(TmpCon.PhoneType5)) + ': ';
|
||||||
DrawContactPart(TmpBmp, TmpCon.Phone5, Str, WholeRect, Phone5Rect);
|
DrawContactLine(TmpBmp, TmpCon.Phone5, Str, WholeRect, Phone5Rect);
|
||||||
|
|
||||||
{ do EMail }
|
{ do EMail }
|
||||||
DrawContactPart(TmpBmp, TmpCon.EMail, RSEmail + ': ', WholeRect, EMailRect);
|
DrawContactLine(TmpBmp, TmpCon.EMail, RSEmail + ': ', WholeRect, EMailRect);
|
||||||
|
|
||||||
{ if this record's too big to fit in the remaining area of this }
|
{ if this record's too big to fit in the remaining area of this }
|
||||||
{ column, then slide over to the top of the next column }
|
{ column, then slide over to the top of the next column }
|
||||||
|
Reference in New Issue
Block a user