dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dotgnu-pnet-commits] pnetlib/System.Drawing/Toolkit ToolkitManager.cs,


From: Rhys Weatherley <address@hidden>
Subject: [Dotgnu-pnet-commits] pnetlib/System.Drawing/Toolkit ToolkitManager.cs, 1.8, 1.9
Date: Fri, 10 Oct 2003 04:10:27 +0000

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit
In directory subversions:/tmp/cvs-serv2245/System.Drawing/Toolkit

Modified Files:
        ToolkitManager.cs 
Log Message:


Look for the "--toolkit" option and "PNET_WINFORMS_TOOLKIT" environment
variable to override the default drawing toolkit selection.


Index: ToolkitManager.cs
===================================================================
RCS file: 
/cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit/ToolkitManager.cs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** ToolkitManager.cs   12 Sep 2003 11:01:03 -0000      1.8
--- ToolkitManager.cs   10 Oct 2003 04:10:22 -0000      1.9
***************
*** 147,150 ****
--- 147,197 ----
                        }
  
+       // Get the override toolkit name.
+       private static String GetToolkitOverride()
+                       {
+                               String name;
+ 
+                               // Search for "--toolkit" in the command-line 
options.
+                               String[] args = 
Environment.GetCommandLineArgs();
+                               int index;
+                               name = null;
+                               for(index = 1; index < args.Length; ++index)
+                               {
+                                       if(args[index] == "--toolkit")
+                                       {
+                                               if((index + 1) < args.Length)
+                                               {
+                                                       name = args[index + 1];
+                                                       break;
+                                               }
+                                       }
+                                       else 
if(args[index].StartsWith("--toolkit="))
+                                       {
+                                               name = 
args[index].Substring(10);
+                                               break;
+                                       }
+                               }
+ 
+                               // Check the environment next.
+                               if(name == null)
+                               {
+                                       name = 
Environment.GetEnvironmentVariable
+                                               ("PNET_WINFORMS_TOOLKIT");
+                               }
+ 
+                               // Bail out if no toolkit name specified.
+                               if(name == null || name == String.Empty)
+                               {
+                                       return null;
+                               }
+ 
+                               // Prepend "System.Drawing." if necessary.
+                               if(name.IndexOf('.') == -1)
+                               {
+                                       name = "System.Drawing." + name;
+                               }
+                               return name;
+                       }
+ 
        // Create the default toolkit.
        private static IToolkit CreateDefaultToolkit()
***************
*** 152,163 ****
                        #if CONFIG_REFLECTION
                                // Determine the name of the toolkit we wish to 
use.
!                               String name;
!                               if(IsUnix())
!                               {
!                                       name = "System.Drawing.Xsharp";
!                               }
!                               else
                                {
!                                       name = "System.Drawing.Win32";
                                }
  
--- 199,213 ----
                        #if CONFIG_REFLECTION
                                // Determine the name of the toolkit we wish to 
use.
!                               String name = GetToolkitOverride();
!                               if(name == null)
                                {
!                                       if(IsUnix())
!                                       {
!                                               name = "System.Drawing.Xsharp";
!                                       }
!                                       else
!                                       {
!                                               name = "System.Drawing.Win32";
!                                       }
                                }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]