[ros-diffs] [cwittich] 41130: -make it possible to set a default value for the mode of the named pipe in setting dialog -change the type of the ComboBox to DropDownList in the ConnectDialog to prevent the user from typing random crap in it

cwittich at svn.reactos.org cwittich at svn.reactos.org
Tue May 26 22:03:53 CEST 2009


Author: cwittich
Date: Wed May 27 00:03:52 2009
New Revision: 41130

URL: http://svn.reactos.org/svn/reactos?rev=41130&view=rev
Log:
-make it possible to set a default value for the mode of the named pipe in setting dialog
-change the type of the ComboBox to DropDownList in the ConnectDialog to prevent the user from typing random crap in it

Modified:
    trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.Designer.cs
    trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.cs
    trunk/tools/reactosdbg/RosDBG/Settings.cs

Modified: trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.Designer.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.Designer.cs?rev=41130&r1=41129&r2=41130&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.Designer.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.Designer.cs [iso-8859-1] Wed May 27 00:03:52 2009
@@ -94,6 +94,7 @@
             // 
             // cType
             // 
+            this.cType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.cType.FormattingEnabled = true;
             this.cType.Items.AddRange(new object[] {
             "Client",

Modified: trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.cs?rev=41130&r1=41129&r2=41130&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/PipeTargetSelect.cs [iso-8859-1] Wed May 27 00:03:52 2009
@@ -73,8 +73,17 @@
 
         private void PipeTargetSelect_Load(object sender, EventArgs e)
         {
+            int i = 0;
+
             DefaultRadioBtn.Text += " [" + defaultPipeName + "]";
-            cType.SelectedIndex = 0;
+
+            for (i = 0; i < cType.Items.Count -1; i++)
+            {
+                if (cType.Items[i].ToString().CompareTo(Settings.Mode) == 0)
+                    break;
+            }
+            
+            cType.SelectedIndex = i;
         }
     }
 }

Modified: trunk/tools/reactosdbg/RosDBG/Settings.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Settings.cs?rev=41130&r1=41129&r2=41130&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] Wed May 27 00:03:52 2009
@@ -17,6 +17,7 @@
         public class SettingsPropertyValues : ApplicationSettingsBase
         {
             private SerialConnSettings _serialconnsettings;
+            private PipeConnSettings _pipeconnsettings;
 
             /* Hack to work around a crash (bug in .net?) 
              * using a TypeConverter in a class which is derived from
@@ -37,6 +38,23 @@
                 get { return this["Baudrate"].ToString(); }
                 set { this["Baudrate"] = value; }
             }
+
+            [UserScopedSetting, DefaultSettingValue(@"RosDbg")]
+            [Browsable(false)]
+            public string Pipe
+            {
+                get { return this["Pipe"].ToString(); }
+                set { this["Pipe"] = value; }
+            }
+
+            [UserScopedSetting, DefaultSettingValue(@"Client")]
+            [Browsable(false)]
+            public string Mode
+            {
+                get { return this["Mode"].ToString(); }
+                set { this["Mode"] = value; }
+            }
+
             /* end of hack */
 
             [CategoryAttribute("Directories"), DescriptionAttribute("Directory settings")]
@@ -56,20 +74,19 @@
             }
 
             [CategoryAttribute("Connection"), DescriptionAttribute("Connection settings")]
-            [UserScopedSetting, DefaultSettingValue(@"RosDbg")]
-            public string Pipe
-            {
-                get { return this["Pipe"].ToString(); }
-                set { this["Pipe"] = value; }
-            }
- 
-            [CategoryAttribute("Connection"), DescriptionAttribute("Connection settings")]
             public SerialConnSettings Serial
             {
                 get { return new SerialConnSettings(Port, Baudrate, this); }
                 set { _serialconnsettings = value; }
             }
 
+            [CategoryAttribute("Connection"), DescriptionAttribute("Connection settings")]
+            public PipeConnSettings NamedPipe
+            {
+                get { return new PipeConnSettings(Mode, Pipe, this); }
+                set { _pipeconnsettings = value; }
+            }
+
             public SettingsPropertyValues()
             {
                 Reload();
@@ -94,6 +111,25 @@
                 return new StandardValuesCollection((string[]) SerialPort.GetPortNames());
             }
         }
+
+        public class PipeConverter : StringConverter
+        {
+            public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
+            {
+                return true;
+            }
+
+            public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
+            {
+                return true;
+            }
+
+            public override System.ComponentModel.TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
+            {
+                return new StandardValuesCollection(new string[] {"Client", "Server"} );
+            }
+        }
+
         #endregion
 
         [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
@@ -129,11 +165,45 @@
             }
         }
 
+        [TypeConverterAttribute(typeof(ExpandableObjectConverter))]
+        public class PipeConnSettings
+        {
+            private string _Pipe;
+            private string _Mode;
+            private SettingsPropertyValues _Parent;
+
+            public PipeConnSettings(string Mode, string Pipe, SettingsPropertyValues parent)
+            {
+                _Pipe = Pipe;
+                _Mode = Mode;
+                _Parent = parent;
+            }
+
+            public override string ToString()
+            {
+                return this._Mode + ";" + this._Pipe;
+            }
+
+            public string Pipe
+            {
+                get { return _Pipe; }
+                set { _Pipe = value; _Parent.Pipe = _Pipe; }
+            }
+
+            [TypeConverter(typeof(PipeConverter))]
+            public string Mode
+            {
+                get { return _Mode; }
+                set { _Mode = value; _Parent.Mode = _Mode; }
+            }
+        }
+
         static SettingsPropertyValues mProperties = new SettingsPropertyValues();
 
         public static string SourceDirectory { get { return mProperties.SourceDirectory; } }
         public static string OutputDirectory { get { return mProperties.OutputDirectory; } }
-        public static string Pipe { get { return mProperties.Pipe;  } }
+        public static string Mode { get { return mProperties.Mode;  } }
+        public static string Pipe { get { return mProperties.Pipe; } }
         public static string ComPort { get { return mProperties.Port; } }
         public static string Baudrate { get { return mProperties.Baudrate; } }
 



More information about the Ros-diffs mailing list