You've already forked lazarus-ccr
tvplanit: Add centimeters as new measurement unit.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4937 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -54,7 +54,7 @@ const
|
||||
|
||||
type
|
||||
TVpRotationAngle = (ra0, ra90, ra180, ra270);
|
||||
TVpItemMeasurement = (imAbsolutePixel, imPercent, imInches);
|
||||
TVpItemMeasurement = (imAbsolutePixel, imPercent, imInches, imCentimeters);
|
||||
TVpItemType = (itDayView, itWeekView, itMonthView, itCalendar,
|
||||
itShape, itCaption, itTasks, itContacts);
|
||||
|
||||
|
@ -82,6 +82,8 @@ const
|
||||
{ of the Contact Grid's horizontal bars. }
|
||||
CompareTimeEPS = 1.0 / (24*60*60*10); { Epsilon for time comparison, 0.1 sec }
|
||||
|
||||
cmPerInch = 2.54; { 1 inch is 2.54 cm }
|
||||
|
||||
ResourceTableName = 'Resources';
|
||||
TasksTableName = 'Tasks';
|
||||
EventsTableName = 'Events';
|
||||
|
@ -184,6 +184,7 @@ object frmEditElement: TfrmEditElement
|
||||
'Pixels'
|
||||
'Percent'
|
||||
'Inches'
|
||||
'cm'
|
||||
)
|
||||
OnClick = rgMeasurementClick
|
||||
TabOrder = 1
|
||||
|
@ -46,8 +46,7 @@ type
|
||||
TDayList = array[1..12] of Word;
|
||||
|
||||
|
||||
TVpDayType = (dtSunday, dtMonday, dtTuesday, dtWednesday, dtThursday,
|
||||
dtFriday, dtSaturday);
|
||||
TVpDayType = (dtSunday, dtMonday, dtTuesday, dtWednesday, dtThursday, dtFriday, dtSaturday);
|
||||
|
||||
TVpDateFormat = (dfShort, dfLong);
|
||||
|
||||
@ -85,6 +84,8 @@ function HeightOf(const R : TRect) : Integer;
|
||||
{- return the height of the TRect}
|
||||
function WidthOf(const R : TRect) : Integer;
|
||||
{- return the width of the TRect}
|
||||
function RightOf(AControl: TControl): Integer;
|
||||
{- returns the right edge of a control }
|
||||
function GetDisplayString(Canvas : TCanvas; const S : string;
|
||||
MinChars, MaxWidth : Integer) : string;
|
||||
{-given a string, a minimum number of chars to display, and a max width, }
|
||||
@ -126,7 +127,6 @@ function GetLineDuration(Granularity: TVpGranularity): Double;
|
||||
|
||||
function GetLabelWidth(ALabel: TLabel): Integer;
|
||||
function GetRealFontHeight(AFont: TFont): Integer;
|
||||
function RightOf(AControl: TControl): Integer;
|
||||
|
||||
function DecodeLineEndings(const AText: String): String;
|
||||
function EncodeLineEndings(const AText: String): String;
|
||||
|
@ -447,7 +447,7 @@ uses
|
||||
{$IFDEF LCL}
|
||||
DateUtils,
|
||||
{$ENDIF}
|
||||
VpBaseDS, VpPrtFmtCBox, VpPrtPrv, VpDayView, VpWeekView, VpMonthView,
|
||||
VpConst, VpBaseDS, VpPrtFmtCBox, VpPrtPrv, VpDayView, VpWeekView, VpMonthView,
|
||||
VpCalendar, VpTaskList, VpContactGrid;
|
||||
|
||||
function XMLizeString(const s: string): string;
|
||||
@ -1548,10 +1548,18 @@ var
|
||||
imInches:
|
||||
begin
|
||||
StartX := Round(Element.Left * PixelsPerInchX);
|
||||
StartY := Round(Element.Top * PixelsPerInchX);
|
||||
StartY := Round(Element.Top * PixelsPerInchY);
|
||||
StopX := Round((Element.Left + Element.Width) * PixelsPerInchX);
|
||||
StopY := Round((Element.Top + Element.Height) * PixelsPerInchX);
|
||||
end;
|
||||
|
||||
imCentimeters:
|
||||
begin
|
||||
StartX := Round(Element.Left * PixelsPerInchX / cmPerInch);
|
||||
StartY := Round(Element.Top * PixelsPerInchY / cmPerInch);
|
||||
StopX := Round((Element.Left + Element.Width) * PixelsPerInchX / cmPerInch);
|
||||
StopY := Round((Element.Top + Element.Height) * PixelsPerInchY / cmPerInch);
|
||||
end;
|
||||
end;
|
||||
|
||||
inc(StartX, ARect.Left);
|
||||
@ -1768,10 +1776,19 @@ var
|
||||
imInches:
|
||||
begin
|
||||
ARect.Left := Round(LeftMargin * PixelsPerInchX);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchX);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchY);
|
||||
ARect.Right := ARect.Right - Round(RightMargin * PixelsPerInchX);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchX);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchY);
|
||||
end;
|
||||
|
||||
imCentimeters:
|
||||
begin
|
||||
ARect.Left := Round(LeftMargin * PixelsPerInchX / cmPerInch);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchY / cmPerInch);
|
||||
ARect.Right := ARect.Right - Round(RightMargin * PixelsPerInchX / cmPerInch);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchY / cmPerInch);
|
||||
end;
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -1937,9 +1954,17 @@ var
|
||||
imInches:
|
||||
begin
|
||||
ARect.Left := Round(LeftMargin * PixelsPerInchX);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchX);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchY);
|
||||
ARect.Right := ARect.Right - Round(RightMargin * PixelsPerInchX);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchX);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchY);
|
||||
end;
|
||||
|
||||
imCentimeters:
|
||||
begin
|
||||
ARect.Left := Round(LeftMargin * PixelsPerInchX / cmPerInch);
|
||||
ARect.Top := Round(TopMargin * PixelsPerInchY / cmPerInch);
|
||||
ARect.Right := ARect.Right - Round(RightMargin * PixelsPerInchX / cmPerInch);
|
||||
ARect.Bottom := ARect.Bottom - Round(BottomMargin * PixelsPerInchY / cmPerInch);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -2178,6 +2203,7 @@ begin
|
||||
imAbsolutePixel : Writeln(fpOut, ' Measurement="AbsolutePixel"');
|
||||
imPercent : Writeln(fpOut, ' Measurement="Percent"');
|
||||
imInches : Writeln(fpOut, ' Measurement="Inches"');
|
||||
imCentimeters : WriteLn(fpOut, ' Measurement="Centimeters"');
|
||||
end;
|
||||
Writeln(fpOut, ' Left="' + FloatToStr(elem.Left) + '"');
|
||||
Writeln(fpOut, ' Top="' + FloatToStr(elem.Top) + '"');
|
||||
@ -2585,6 +2611,9 @@ begin
|
||||
else
|
||||
if attr.Value = 'Inches' then
|
||||
NewElement.Measurement := imInches
|
||||
else
|
||||
if attr.Value = 'Centimeters' then
|
||||
NewElement.Measurement := imCentimeters
|
||||
else
|
||||
raise EVpPrintFormatError.Create(RSBadMeasurement + attr.Value);
|
||||
end
|
||||
|
Reference in New Issue
Block a user