You've already forked lazarus-ccr
jvcllaz: Fix stack overflow in JvTimeFrameWork demo due to TJvTFDaysPrinter.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7099 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1123,7 +1123,7 @@ object MainForm: TMainForm
|
||||
LineSpacing = 2
|
||||
ShowStartEnd = False
|
||||
left = 304
|
||||
top = 224
|
||||
top = 200
|
||||
end
|
||||
object dbUTF: TSQLite3Connection
|
||||
Connected = False
|
||||
@ -1497,4 +1497,56 @@ object MainForm: TMainForm
|
||||
36348834EDAD6AFF03880DBFF8
|
||||
}
|
||||
end
|
||||
object JvTFDaysPrinter1: TJvTFDaysPrinter
|
||||
ScheduleManager = utfScheduleManager1
|
||||
PageLayout.FooterHeight = 0
|
||||
PageLayout.HeaderHeight = 0
|
||||
PageLayout.MarginLeft = 25
|
||||
PageLayout.MarginTop = 17
|
||||
PageLayout.MarginRight = 25
|
||||
PageLayout.MarginBottom = 63
|
||||
PageLayout.ColsPerPage = 0
|
||||
PageLayout.RowsPerPage = 0
|
||||
PageLayout.AlwaysShowColHdr = False
|
||||
PageLayout.AlwaysShowRowHdr = False
|
||||
OnPrintProgress = JvTFDaysPrinter1PrintProgress
|
||||
OnAssembleProgress = JvTFDaysPrinter1AssembleProgress
|
||||
Title = 'SIMPLDaysPrinter Demo'
|
||||
ApptAttr.Color = clLime
|
||||
ApptAttr.ParentFont = False
|
||||
ApptBuffer = 0
|
||||
ColHdrHeight = 0
|
||||
Color = clBlack
|
||||
Cols = <>
|
||||
ColTitleStyle = ctsSingleClip
|
||||
DateFormat = 'ddddd'
|
||||
FancyRowHdrAttr.Hr2400 = False
|
||||
FancyRowHdrAttr.MajorFont.Height = -19
|
||||
FormattedDesc = False
|
||||
Granularity = 1
|
||||
GridLineColor = clBlack
|
||||
GroupHdrAttr.Font.Color = clWindowText
|
||||
GroupHdrAttr.ParentFont = False
|
||||
GroupHdrAttr.FrameColor = clBlack
|
||||
Grouping = grNone
|
||||
HdrAttr.Font.Color = clWindowText
|
||||
HdrAttr.ParentFont = False
|
||||
HdrAttr.FrameColor = clBlack
|
||||
MinColWidth = 5
|
||||
MinRowHeight = 1
|
||||
PrimeTime.StartTime = 0.333333333333333
|
||||
PrimeTime.EndTime = 0.708333333333333
|
||||
PrimeTime.Color = clYellow
|
||||
RowHdrType = rhGrid
|
||||
RowHdrWidth = 0
|
||||
RowHeight = 0
|
||||
ShowPics = False
|
||||
ShowText = False
|
||||
TimeFormat = 't'
|
||||
OnApptProgress = JvTFDaysPrinter1ApptProgress
|
||||
GridStartTime = 0
|
||||
GridEndTime = 0
|
||||
left = 304
|
||||
top = 259
|
||||
end
|
||||
end
|
||||
|
@ -43,6 +43,7 @@ type
|
||||
|
||||
TMainForm = class(TForm)
|
||||
ImageList: TImageList;
|
||||
JvTFDaysPrinter1: TJvTFDaysPrinter;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Panel2: TPanel;
|
||||
@ -576,9 +577,8 @@ end;
|
||||
|
||||
procedure TMainForm.PrintButtonClick(Sender: TObject);
|
||||
begin
|
||||
(******************** wp: deactivated due to stack overflow ************
|
||||
With JvTFDaysPrinter1 do
|
||||
Begin
|
||||
with JvTFDaysPrinter1 do
|
||||
begin
|
||||
// "Copy" the display properties from the JvTFDays control
|
||||
SetProperties(JvTFDays1);
|
||||
// Set gridline color to black for sharp display on printed page
|
||||
@ -594,8 +594,7 @@ begin
|
||||
// print the document
|
||||
PrintDirect;
|
||||
PrintProgress.Close;
|
||||
End;
|
||||
************************)
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.JvTFDaysPrinter1ApptProgress(Sender: TObject;
|
||||
|
@ -32,7 +32,7 @@ interface
|
||||
|
||||
uses
|
||||
LCLIntf, LCLType,
|
||||
Classes, SysUtils, Controls, //Windows, Messages,
|
||||
Classes, SysUtils, Controls,
|
||||
Graphics, ImgList, ExtCtrls, Printers, Forms,
|
||||
//JvComponentBase,
|
||||
JvComponent, JvTypes, JvTFUtils;
|
||||
@ -4339,6 +4339,7 @@ const
|
||||
var
|
||||
PPI: Integer;
|
||||
begin
|
||||
(**************** DONE
|
||||
PPI := 300; // wp -- just a workaround for next commented lines...
|
||||
{ wp --- to do
|
||||
if Horizontal then
|
||||
@ -4346,6 +4347,11 @@ begin
|
||||
else
|
||||
PPI := Windows.GetDeviceCaps(Printer.Handle, LOGPIXELSY);
|
||||
}
|
||||
******************)
|
||||
if Horizontal then
|
||||
PPI := Printer.XDPI
|
||||
else
|
||||
PPI := Printer.YDPI;
|
||||
if (FromMeasure = pmPixels) and (ToMeasure = pmInches) then
|
||||
Result := round(Value / PPI * 100)
|
||||
else
|
||||
@ -4483,9 +4489,10 @@ function TJvTFPrinter.GetBodyHeight: Integer; // always in pixels
|
||||
var
|
||||
PhysHeight, TopMarginPels, BottomMarginPels, HeaderPels, FooterPels: Integer;
|
||||
begin
|
||||
{ wp --- to do
|
||||
{ wp --- to do **************** DONE ***************
|
||||
PhysHeight := Windows.GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT);
|
||||
}
|
||||
PhysHeight := Printer.PaperSize.Height;
|
||||
TopMarginPels := ConvertMeasure(PageLayout.MarginTop, Measure, pmPixels, False);
|
||||
BottomMarginPels := ConvertMeasure(PageLayout.MarginBottom, Measure, pmPixels, False);
|
||||
HeaderPels := ConvertMeasure(PageLayout.HeaderHeight, Measure, pmPixels, False);
|
||||
@ -4510,9 +4517,10 @@ function TJvTFPrinter.GetBodyWidth: Integer; // always in pixels
|
||||
var
|
||||
PhysWidth, LeftMarginPels, RightMarginPels: Integer;
|
||||
begin
|
||||
{ wp --- to do
|
||||
{ wp --- to do **************** DONE *****************
|
||||
PhysWidth := Windows.GetDeviceCaps(Printer.Handle, PHYSICALWIDTH);
|
||||
}
|
||||
PhysWidth := Printer.PaperSize.Width;
|
||||
LeftMarginPels := ConvertMeasure(PageLayout.MarginLeft, Measure, pmPixels, True);
|
||||
RightMarginPels := ConvertMeasure(PageLayout.MarginRight, Measure, pmPixels, True);
|
||||
|
||||
@ -4589,12 +4597,16 @@ function TJvTFPrinter.GetUnprintable: TJvTFMargins;
|
||||
var
|
||||
LeftMarg, TopMarg, WidthPaper, HeightPaper, WidthPrintable, HeightPrintable: Integer;
|
||||
begin
|
||||
{ wp --- to do
|
||||
{ wp --- to do ----------- DONE ----------------
|
||||
LeftMarg := Windows.GetDeviceCaps(Printer.Handle, PHYSICALOFFSETX);
|
||||
TopMarg := Windows.GetDeviceCaps(Printer.Handle, PHYSICALOFFSETY);
|
||||
WidthPaper := Windows.GetDeviceCaps(Printer.Handle, PHYSICALWIDTH);
|
||||
HeightPaper := Windows.GetDeviceCaps(Printer.Handle, PHYSICALHEIGHT);
|
||||
}
|
||||
LeftMarg := Printer.PaperSize.PaperRect.WorkRect.Left;
|
||||
TopMarg := Printer.PaperSize.PaperRect.WorkRect.Top;
|
||||
WidthPaper := Printer.PaperSize.Width;
|
||||
HeightPaper := Printer.PaperSize.Height;
|
||||
WidthPrintable := Printer.PageWidth;
|
||||
HeightPrintable := Printer.PageHeight;
|
||||
|
||||
@ -4749,13 +4761,18 @@ function TJvTFPrinter.PrinterToScreen(Value: Integer;
|
||||
var
|
||||
ScreenPPI, PrinterPPI: Integer;
|
||||
begin
|
||||
{ wp --- to do
|
||||
{ wp --- to do ************* DONE ************
|
||||
ScreenPPI := Screen.PixelsPerInch;
|
||||
if Horizontal then
|
||||
PrinterPPI := Windows.GetDeviceCaps(Printer.Handle, LOGPIXELSX)
|
||||
else
|
||||
PrinterPPI := Windows.GetDeviceCaps(Printer.Handle, LOGPIXELSY);
|
||||
}
|
||||
ScreenPPI := Screen.PixelsPerInch;
|
||||
if Horizontal then
|
||||
PrinterPPI := Printer.XDPI
|
||||
else
|
||||
PrinterPPI := Printer.YDPI;
|
||||
Result := Trunc(ScreenPPI / PrinterPPI * Value);
|
||||
end;
|
||||
|
||||
@ -4778,7 +4795,11 @@ var
|
||||
ScreenPPI, PrinterPPI: Integer;
|
||||
begin
|
||||
ScreenPPI := Screen.PixelsPerInch;
|
||||
{ wp --- to do
|
||||
if Horizontal then
|
||||
PrinterPPI := Printer.XDPI
|
||||
else
|
||||
PrinterPPI := Printer.YDPI;
|
||||
{ wp --- to do *********** DONE ***********
|
||||
if Horizontal then
|
||||
PrinterPPI := Windows.GetDeviceCaps(Printer.Handle, LOGPIXELSX)
|
||||
else
|
||||
@ -4860,6 +4881,10 @@ begin
|
||||
raise EJvTFPrinterError.CreateRes(@RsECouldNotCreateTJvTFPrinterPageLayou);
|
||||
|
||||
FPrinter := aPrinter;
|
||||
FMargins.Left := 25;
|
||||
FMargins.Right := 25;
|
||||
FMargins.Top := 17;
|
||||
FMargins.Bottom := 63;
|
||||
end;
|
||||
|
||||
procedure TJvTFPrinterPageLayout.Assign(Source: TPersistent);
|
||||
|
Reference in New Issue
Block a user