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( dvInPlaceEditor.SetBounds(
dvActiveIconRec.Right + TextMargin, dvActiveIconRec.Right + TextMargin,
dvActiveEventRec.Top + TextMargin, dvActiveEventRec.Top + TextMargin,
dvActiveEventRec.Right - dvActiveIconRec.Right - TextMargin, WidthOf(dvActiveEventRec) - dvActiveIconRec.Right - TextMargin*2,
dvActiveEventRec.Bottom - dvActiveEventRec.Top - TextMargin HeightOf(dvActiveEventRec) - TextMargin
); );
dvInPlaceEditor.Show; dvInPlaceEditor.Show;
dvInPlaceEditor.Text := FActiveEvent.Description; dvInPlaceEditor.Text := FActiveEvent.Description;

View File

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

View File

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