On Thu, 11 Mar 2010 14:23:15 +0100 (CET) Michael Van Canneyt <[email protected]> wrote:
> > > On Thu, 11 Mar 2010, [email protected] wrote: > > > On Wed, Mar 10, 2010 at 03:22:31PM +0100, [email protected] wrote: > >> Hi. > >> > >> Main work on TCairoCanvas = class(TPrinterCanvas) is almost done. > >> > >> My question is how to integrate it into LCL? > >> IMHO user should have a choice which TPrinterCanvas implementation use. > >> Now in TCUPSPrinter is hard coded TPostscriptPrinterCanvas: > >> > >> function TCUPSPrinter.GetCanvasRef: TPrinterCanvasRef; > >> begin > >> Result:=TPostscriptPrinterCanvas; > >> end; > >> > >> Petr > >> > > Nobody here, who can halp me to integrate TCairoCanvas into LCL? > > > > Were in LCL directory structure place cairocanvas.pas (depends only on > > libcairo) and gdkcairocanvas.pas (depends extra on libgdk). > > > > How should programer select which implementation of TPrinterCanvas will > > be created in TPrinter.GetCanvas. > > > > Now TCUPSPrinter implementation use hard coded TPostscriptPrinterCanvas > > and needs access to TPostscriptPrinterCanvas(Canvas).OutputFileName. > > My TCairoCanvas implementation has the same needs. > > > > I do not want to waste my time if comunity do not have an interest to > > include CairoCanvas into lcl. > > I think you should create an abstract TFilePrinterCanvas descendent of > TPrinterCanvas (with the needed FileName property) and define a variable > > Type > TFilePrinterCanvas = Class of TFilePrinterCanvas; > > Var > CupsCanvasClass : TFilePrinterCanvas = TPostscriptPrinterCanvas; > > which the programmer can set, if so desired. then the > TCUPSPrinter.GetCanvasRef > implementation checks the CupsCanvasClass variable. If it is set, > it uses the class defined there, and if not, it uses > TPostscriptPrinterCanvas. Good idea. Mattias -- _______________________________________________ Lazarus mailing list [email protected] http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
