tvplanit: Fix size of in-place editor for TVpWeekView and TVpDayView.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8446 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-09-04 23:06:49 +00:00
parent 50608d54c3
commit 5751dde6a7
3 changed files with 16 additions and 15 deletions

View File

@ -2348,8 +2348,8 @@ begin
dvInPlaceEditor.SetBounds(
dvActiveIconRec.Right + TextMargin,
dvActiveEventRec.Top + TextMargin,
dvActiveEventRec.Right - dvActiveIconRec.Right - TextMargin,
dvActiveEventRec.Bottom - dvActiveEventRec.Top - TextMargin
WidthOf(dvActiveEventRec) - dvActiveIconRec.Right - TextMargin*2,
HeightOf(dvActiveEventRec) - TextMargin
);
dvInPlaceEditor.Show;
dvInPlaceEditor.Text := FActiveEvent.Description;

View File

@ -145,6 +145,7 @@ type
FDefaultPopup: TPopupMenu;
FDragDropTransparent: Boolean;
FDrawingStyle: TVpDrawingStyle;
FGutterWidth: Integer;
FEventFont: TVpFont; // was: TFont
FExternalPopup: TPopupMenu;
FHeadAttr: TVpWvHeadAttributes;
@ -320,6 +321,7 @@ type
property ActiveEvent: TVpEvent read FActiveEvent write SetActiveEvent;
property Date: TDateTime read FActiveDate write SetActiveDate;
property GutterWidth: Integer read FGutterWidth;
property VisibleLines: Integer read FVisibleLines;
property PrevWeekBtn: TSpeedButton read FPrevWeekBtn;
@ -607,8 +609,8 @@ begin
wvStartDate := trunc(GetStartOfWeek(Now, FWeekStartsOn));
FTimeFormat := tf12Hour;
FDateLabelFormat := 'ddddd';
// FColumnWidth := 200;
FAllowInplaceEdit := true;
FGutterWidth := 6;
{ set up fonts and colors }
FDayHeadAttributes.Font.Size := 10;
@ -1739,16 +1741,16 @@ begin
if ActiveEvent.AllDayEvent then
wvInPlaceEditor.SetBounds(
wvActiveEventRec.Left + TextMargin,
wvActiveEventRec.Top,
wvActiveEventRec.Right - TextMargin * 3,
wvActiveEventRec.Bottom - TextMargin * 2
wvActiveEventRec.Top + TextMargin,
WidthOf(wvActiveEventRec) - TextMargin * 2 - 1,
HeightOf(wvActiveEventRec) - TextMargin * 2
)
else
wvInPlaceEditor.SetBounds(
wvActiveEventRec.Left + TextMargin,
wvActiveEventRec.Top,
wvActiveEventRec.Right - TextMargin * 2,
wvActiveEventRec.Bottom - TextMargin * 2
wvActiveEventRec.Left + FGutterWidth + TextMargin,
wvActiveEventRec.Top + TextMargin,
WidthOf(wvActiveEventRec) - TextMargin - FGutterWidth - 1,
HeightOf(wvActiveEventRec) - 2*TextMargin
);
wvInplaceEditor.Show;
wvInPlaceEditor.Text := ActiveEvent.Description;
@ -1985,6 +1987,7 @@ begin
begin
FTextMargin := round(FTextMargin * AXProportion);
FHeaderMargin := round(FHeaderMargin * AXProportion);
FGutterWidth := round(FGutterWidth * AXProportion);
end;
end;
{$IFEND}

View File

@ -512,8 +512,6 @@ end;
procedure TVpWeekViewPainter.DrawEvent(AEvent: TVpEvent; TextRect: TRect;
ADayIndex: Integer);
const
GUTTER_WIDTH = 6;
var
dayStr: String;
todayStartTime: TDateTime;
@ -558,9 +556,9 @@ begin
TPSFillRect(RenderCanvas, Angle, RenderIn, TextRect);
R := TextRect;
{$IF VP_LCL_SCALING > 0}
R.Right := R.Left + FWeekView.Scale96ToFont(GUTTER_WIDTH);
R.Right := R.Left + FWeekView.Scale96ToFont(FWeekView.GutterWidth);
{$ELSE}
R.Right := R.Left + ScaleX(GUTTER_WIDTH, DesignTimeDPI);
R.Right := R.Left + ScaleX(FWeekView.GutterWidth, DesignTimeDPI);
{$IFEND}
TextRect.Left := R.Right;
RenderCanvas.Brush.Color := eventCat.Color;
@ -786,7 +784,7 @@ begin
else
StartDate := GetStartOfWeek(RenderDate, WeekStartsOn);
wvRowHeight := GetCanvasTextHeight(RenderCanvas, EventFont, VpProductName);
wvRowHeight := GetCanvasTextHeight(RenderCanvas, EventFont, VpProductName) + TextMargin * 2;
Self.FDayHeadHeight := GetCanvasTextHeight(RenderCanvas, DayHeadAttributes.Font) + TextMargin * 2;