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