/[RomCheater]/trunk/RomCheater/RomCheaterConfigDialog.cs
ViewVC logotype

Diff of /trunk/RomCheater/RomCheaterConfigDialog.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/RomCheater/RomCheaterConfigDialog.cs	2012/05/09 22:31:56	94
+++ trunk/RomCheater/RomCheaterConfigDialog.cs	2012/06/03 19:51:54	266
@@ -49,7 +49,7 @@
             {
                 if (item == RomCheater.Properties.Settings.Default.LastConfigPlugin)
                 {
-                    logger.Debug.WriteLine("    loading LastConfigPlugin: {0}", RomCheater.Properties.Settings.Default.LastConfigPlugin);
+                    logger.VerboseDebug.WriteLine("    loading LastConfigPlugin: {0}", RomCheater.Properties.Settings.Default.LastConfigPlugin);
                     comboConfigPlugins.SelectedIndex = comboConfigPlugins.Items.IndexOf(item);
                     break;
                 }
@@ -58,7 +58,7 @@
             {
                 if (item == RomCheater.Properties.Settings.Default.LastInputPlugin)
                 {
-                    logger.Debug.WriteLine("    loading LastInputPlugin: {0}", RomCheater.Properties.Settings.Default.LastInputPlugin);
+                    logger.VerboseDebug.WriteLine("    loading LastInputPlugin: {0}", RomCheater.Properties.Settings.Default.LastInputPlugin);
                     comboInputPlugins.SelectedIndex = comboInputPlugins.Items.IndexOf(item);
                     break;
                 }
@@ -67,7 +67,7 @@
             {
                 if (item == RomCheater.Properties.Settings.Default.LastWindowPlugin)
                 {
-                    logger.Debug.WriteLine("    loading LastWindowPlugin: {0}", RomCheater.Properties.Settings.Default.LastWindowPlugin);
+                    logger.VerboseDebug.WriteLine("    loading LastWindowPlugin: {0}", RomCheater.Properties.Settings.Default.LastWindowPlugin);
                     comboWindowPlugins.SelectedIndex = comboWindowPlugins.Items.IndexOf(item);
                     break;
                 }
@@ -77,9 +77,15 @@
 
         private void load_loggerflags()
         {
-            logger.Debug.WriteLine("Loading logger flags...");
-            loggerflags logflags = (loggerflags)Logging.Properties.Settings.Default.LoggingFlags;
-            foreach (loggerflags flags in Enum.GetValues(typeof(loggerflags)))
+            logger.VerboseDebug.WriteLine("Loading logger flags...");
+            loggerflags logflags = Logging.Properties.Settings.Default.LoggingFlags;
+
+            if (logflags != logger.GetLoggingFlags())
+            {
+                logflags = logger.GetLoggingFlags(); // we apparently have forced the logging flags (possible for testing)
+            }
+
+            foreach (loggerflags flags in loggerflags.GetValues())
             {
                 if (flags == loggerflags.ALL ||
                     flags == loggerflags.NONE ||
@@ -87,23 +93,29 @@
                     continue;
 
                 string name = flags.ToString();
-                int value = (int)flags;
+                ushort value = (ushort)flags;
 
                 CheckBox chkloggerflags = new CheckBox();
+                chkloggerflags.Font = this.Font;
                 chkloggerflags.Name = name;
                 chkloggerflags.Text = name;
                 chkloggerflags.Tag = value;
+                Graphics g = chkloggerflags.CreateGraphics();
+
+                Size size = g.MeasureString(chkloggerflags.Text, chkloggerflags.Font).ToSize();
+                chkloggerflags.Width = size.Width + 25;
+
                 grpLoggingFlags_flow.Controls.Add(chkloggerflags);
-                logger.Debug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
+                logger.VerboseDebug.WriteLine("\tAdding logger flag: {0} value: 0x{1:x4}", name, value);
 
-                if (logflags.HasFlag((loggerflags)value))
+                if (logflags.HasFlag(value))
                 {
                     chkloggerflags.Checked = true;
-                    logger.Debug.WriteLine("\tTurning on logger flag: {0} value: 0x{1:x4}", name, value);
+                    logger.VerboseDebug.WriteLine("\tTurning on logger flag: {0} value: 0x{1:x4}", name, value);
                 }
             }
-            grpLoggingFlags.AutoSize = true;
-            grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+            //grpLoggingFlags.AutoSize = true;
+            //grpLoggingFlags.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
             logger.Debug.WriteLine("Loaded logger flags.");
         }
         private void btnSave_Click(object sender, EventArgs e)
@@ -126,27 +138,27 @@
         }
         private void SaveSelectedPlugins()
         {
-            logger.Debug.WriteLine("    Setting LastConfigPlugin to {0}", comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString());
+            logger.VerboseDebug.WriteLine("    Setting LastConfigPlugin to {0}", comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastConfigPlugin = comboConfigPlugins.Items[comboConfigPlugins.SelectedIndex].ToString();
 
-            logger.Debug.WriteLine("    Setting LastInputPlugin to {0}", comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString());
+            logger.VerboseDebug.WriteLine("    Setting LastInputPlugin to {0}", comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastInputPlugin = comboInputPlugins.Items[comboInputPlugins.SelectedIndex].ToString();
 
-            logger.Debug.WriteLine("    Setting LastWindowPlugin to {0}", comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString());
+            logger.VerboseDebug.WriteLine("    Setting LastWindowPlugin to {0}", comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString());
             RomCheater.Properties.Settings.Default.LastWindowPlugin = comboWindowPlugins.Items[comboWindowPlugins.SelectedIndex].ToString();
         }
         private void SaveLoggingFlags()
         {
             logger.Debug.WriteLine("Saving Logger flags...");
-            loggerflags logflags = loggerflags.NONE;
+            ushort logflags = loggerflags.NONE;
             foreach (CheckBox cb in grpLoggingFlags_flow.Controls)
             {
                 if (!cb.Checked) continue;
-                int value = Convert.ToInt32(cb.Tag);                
-                logflags = logflags | (loggerflags)value;
-                logger.Debug.WriteLine("\tAdding flag: {0} value: 0x{1:x4} LoggingFlags=0x{2:x4}", cb.Text, value, (int)logflags);                
+                ushort value = Convert.ToUInt16(cb.Tag);
+                logflags = (ushort)(logflags | value);
+                logger.VerboseDebug.WriteLine("\tAdding flag: {0} value: 0x{1:x4} LoggingFlags=0x{2:x4}", cb.Text, value, (int)logflags);                
             }
-            Logging.Properties.Settings.Default.LoggingFlags = (int)logflags;
+            Logging.Properties.Settings.Default.LoggingFlags = (ushort)logflags;
             logger.Debug.WriteLine("Saved Logger flags.");
         }
     }

 

  ViewVC Help
Powered by ViewVC 1.1.22