Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordi Mas i Hernandez <jordi@mono-cvs.ximian.com>2006-11-25 13:36:07 +0300
committerJordi Mas i Hernandez <jordi@mono-cvs.ximian.com>2006-11-25 13:36:07 +0300
commita80595c16567f946881a01479c188d91d66b2c45 (patch)
tree6d3457d2c0e64a4959fdb6ea028be52586ae4ca9 /mcs/class/System.Drawing/System.Drawing.Printing
parentee72b74af8e958c2fe457fdfb94764a4dff8311b (diff)
2006-11-25 Jordi Mas i Hernandez <jordimash@gmail.com>
* PrintingServicesUnix.cs: Implements GetPrintDialogInfo svn path=/trunk/mcs/; revision=68454
Diffstat (limited to 'mcs/class/System.Drawing/System.Drawing.Printing')
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog4
-rw-r--r--mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs65
2 files changed, 67 insertions, 2 deletions
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog b/mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog
index 5127f07c862..474f2978153 100644
--- a/mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/ChangeLog
@@ -1,3 +1,7 @@
+2006-11-25 Jordi Mas i Hernandez <jordimash@gmail.com>
+
+ * PrintingServicesUnix.cs: Implements GetPrintDialogInfo
+
2006-11-24 Carlos Alberto Cortez <calberto.cortez@gmail.com>
Initial support for PageSettings (color, copies, collate,
diff --git a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs
index 729728d9aaa..67079518faa 100644
--- a/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs
+++ b/mcs/class/System.Drawing/System.Drawing.Printing/PrintingServicesUnix.cs
@@ -447,10 +447,55 @@ namespace System.Drawing.Printing
return PaperKind.Custom;
}
- // TODO
internal override void GetPrintDialogInfo (string printer, ref string port, ref string type, ref string status, ref string comment)
{
- status = "Ready";
+ int printers, state = -1;
+ CUPS_DESTS cups_dests;
+ CUPS_OPTIONS options;
+ string str;
+ IntPtr dests = IntPtr.Zero, ptr_printers, ptr_printer, ptr_options;
+
+ if (cups_installed == false)
+ return;
+
+ printers = cupsGetDests (ref dests);
+
+ ptr_printers = dests;
+ for (int i = 0; i < printers; i++) {
+ cups_dests = (CUPS_DESTS) Marshal.PtrToStructure (ptr_printers, typeof (CUPS_DESTS));
+ str = Marshal.PtrToStringAnsi (cups_dests.name);
+ ptr_printers = new IntPtr (ptr_printers.ToInt64 () + 20 /*size of CUPS_DEST*/);
+ if (str != printer)
+ continue;
+
+ ptr_options = cups_dests.options;
+ for (int o = 0; o < cups_dests.num_options; o ++) {
+ options = (CUPS_OPTIONS) Marshal.PtrToStructure (ptr_options, typeof (CUPS_OPTIONS));
+ str = Marshal.PtrToStringAnsi (options.name);
+ if (str == "printer-state") {
+ state = Int32.Parse (Marshal.PtrToStringAnsi (options.val));
+ } else {
+ if (str == "printer-info")
+ comment = Marshal.PtrToStringAnsi (options.val);
+ }
+ ptr_options = new IntPtr (ptr_options.ToInt64 () + 8 /*size of CUPS_DEST*/);
+ }
+
+ }
+
+ Marshal.FreeHGlobal (dests);
+
+ if (state == 4) {
+ status = "Printing";
+ }
+ else {
+ if (state == 5) {
+ status = "Stopped";
+ }
+ else {
+ status = "Ready";
+ }
+ }
}
//
@@ -588,6 +633,22 @@ namespace System.Drawing.Printing
/* There is more data after this that we are not using*/
}
+
+
+ public struct CUPS_OPTIONS
+ {
+ public IntPtr name;
+ public IntPtr val;
+ }
+
+ public struct CUPS_DESTS
+ {
+ public IntPtr name;
+ public IntPtr instance;
+ public int is_default;
+ public int num_options;
+ public IntPtr options;
+ }
}
}