[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit UnixPrinter.cs
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit UnixPrinter.cs, 1.1, 1.2 |
Date: |
Fri, 18 Jul 2003 00:10:22 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit
In directory subversions:/tmp/cvs-serv914/System.Drawing/Toolkit
Modified Files:
UnixPrinter.cs
Log Message:
Load the Postscript driver to handle Unix print requests.
Index: UnixPrinter.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit/UnixPrinter.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** UnixPrinter.cs 7 Jun 2003 22:40:58 -0000 1.1
--- UnixPrinter.cs 18 Jul 2003 04:10:20 -0000 1.2
***************
*** 23,26 ****
--- 23,27 ----
{
+ using System.Reflection;
using System.Drawing.Printing;
***************
*** 29,32 ****
--- 30,37 ----
// Internal state.
private String name;
+ #if CONFIG_REFLECTION
+ private static Assembly driver;
+ private static Type driverType;
+ #endif
// Constructor.
***************
*** 120,138 ****
}
// Create an "IToolkitGraphics" object that can be used
// to perform text measurement for this printer.
- [TODO]
public IToolkitGraphics CreateMeasurementGraphics()
{
! // TODO
! return null;
}
// Get a session handler for this printer to print a document.
- [TODO]
public IToolkitPrintSession GetSession(PrintDocument document)
{
! // TODO
! return null;
}
--- 125,173 ----
}
+ // Call the print driver (currently, System.Drawing.Postscript).
+ private static Object CallDriver(String name, Object[] args)
+ {
+ #if CONFIG_REFLECTION
+ lock(typeof(UnixPrinter))
+ {
+ if(driver == null)
+ {
+ driver =
Assembly.Load("System.Drawing.Postscript");
+ }
+ if(driverType == null)
+ {
+ driverType = driver.GetType
+
("System.Drawing.Toolkit.PostscriptDriver");
+ if(driverType == null)
+ {
+ throw new
NotSupportedException();
+ }
+ }
+ return driverType.InvokeMember
+ (name,
+
BindingFlags.InvokeMethod |
+
BindingFlags.Static |
+
BindingFlags.Public,
+ null, null,
args, null, null, null);
+ }
+ #else
+ throw new NotSupportedException();
+ #endif
+ }
+
// Create an "IToolkitGraphics" object that can be used
// to perform text measurement for this printer.
public IToolkitGraphics CreateMeasurementGraphics()
{
! return (IToolkitGraphics)CallDriver
! ("CreateMeasurementGraphics",
! new Object[] {name});
}
// Get a session handler for this printer to print a document.
public IToolkitPrintSession GetSession(PrintDocument document)
{
! return (IToolkitPrintSession)CallDriver
! ("GetSession", new Object[] {name,
document});
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit UnixPrinter.cs, 1.1, 1.2,
Rhys Weatherley <address@hidden> <=