using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
	[Serializable]
	[TypeConverter(typeof(ExpandableObjectConverter))]
	//public class FolderConfig : INotifyPropertyChanged
	public class FolderConfig : DynamicTypeDescriptor,  INotifyPropertyChanged
	{
		public event PropertyChangedEventHandler PropertyChanged;
		private void OnPropertyChanged(String info)
		{
			if (PropertyChanged != null)
				PropertyChanged(this, new PropertyChangedEventArgs(info));
		}
		internal override bool IsReadOnly
		{
			get { return _Folder == null; }
		}
		private XMLProperties _Xp;
		private XMLProperties Xp
		{
			get { return _Xp; }
		}
		public bool ParentLookup
		{
			get { return _Xp.ParentLookup; }
			set { _Xp.ParentLookup = value; }
		}
		[NonSerialized]
		private bool _AncestorLookup;
		public bool AncestorLookup
		{
			get { return _AncestorLookup; }
			set { _AncestorLookup = value; }
		}
		private Folder _Folder;
		private FolderInfo _FolderInfo;
		public FolderConfig(Folder folder)
		{
			_Folder = folder;
			string xml = _Folder.Config;
			if (xml == string.Empty) xml = "";
			_Xp = new XMLProperties(xml);
			if(folder.MyParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder);
		}
		private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args)
		{
			if (_AncestorLookup || ParentLookup)
			{
				for (Folder folder = _Folder.MyParent; folder != null; folder = folder.MyParent)
				{
					string retval = folder.FolderConfig.GetValue( args.Group, args.Item);
					if (retval != string.Empty) return retval;
				}
			}
			return string.Empty;
		}
		private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
		{
			if (_AncestorLookup || ParentLookup)
			{
				for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
				{
					string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
					if (retval != string.Empty) return retval;
				}
			}
			return string.Empty;
		}
		public FolderConfig(FolderInfo folderInfo)
		{
			_FolderInfo = folderInfo;
			string xml = _FolderInfo.Config;
			if (xml == string.Empty) xml = "";
			_Xp = new XMLProperties(xml);
		}
		public FolderConfig(string xml)
		{
			if (xml == string.Empty) xml = "";
			_Xp = new XMLProperties(xml);
		}
		public FolderConfig()
		{
			_Xp = new XMLProperties("");
		}
		internal string GetValue(string group, string item)
		{
			return _Xp[group, item];
		}
		//[Category("Identification")]
		[Category("General")]
		[DisplayName("Name")]
		[Description("Name")]
		public string Name
		{
			get { return (_Folder != null ? _Folder.Name : _FolderInfo.Name); }
			set { if (_Folder != null)_Folder.Name = value; }
		}
		//[Category("Identification")]
		[Category("General")]
		[DisplayName("Title")]
		[Description("Title")]
		public string Title
		{
			get { return (_Folder != null ? _Folder.Title : _FolderInfo.Title); }
			set { _Folder.Title = value; }
		}
		//[Category("Identification")]
		[Category("General")]
		[DisplayName("Short Name")]
		[Description("Short Name")]
		public string ShortName
		{
			get { return (_Folder != null ? _Folder.ShortName : _FolderInfo.ShortName); }
			set { if (_Folder != null)_Folder.ShortName = value; }
		}
		//[Category("Format")]
		[Category("Format Settings")]
		[DisplayName("Format")]
		[Description("Format")]
		[TypeConverter(typeof(FormatList))]
		public string FormatSelection
		{
			get 
			{
				//if (_Folder != null) return FormatList.ToString(_Folder.FormatID);
				//if (_FolderInfo != null) return FormatList.ToString(_FolderInfo.FormatID);
				if (_Folder != null && _Folder.MyFormat != null) return _Folder.MyFormat.PlantFormat.FormatData.Name;
				if (_FolderInfo != null && _FolderInfo.MyFormat != null) return _FolderInfo.MyFormat.PlantFormat.FormatData.Name;
				return null;
			}
			set 
			{
				if (_Folder != null)_Folder.MyFormat = FormatList.ToFormat(value);
			}
		}
		//[Category("Format")]
		[Category("Format Settings")]
		[DisplayName("Default Format")]
		//[DisplayName("Format")]
		[Description("Format")]
		[TypeConverter(typeof(FormatList))]
		public string DefaultFormatSelection
		{
			get
			{
				//if (_Folder != null) return FormatList.ToString(_Folder.FormatID);
				//if (_FolderInfo != null) return FormatList.ToString(_FolderInfo.FormatID);
				if (_Folder != null && _Folder.MyParent!= null && _Folder.MyParent.ActiveFormat != null) return _Folder.MyParent.ActiveFormat.PlantFormat.FormatData.Name;
				if (_FolderInfo != null && _FolderInfo.MyParent != null && _FolderInfo.MyParent.ActiveFormat != null) return _FolderInfo.MyParent.ActiveFormat.PlantFormat.FormatData.Name;
				return null;
			}
		}
		public override string ToString()
		{
			string s = _Xp.ToString();
			if (s == "" || s == "") return string.Empty;
			return s;
		}
		#region GraphicsCategory        // From veproms.ini
		public bool CanWrite(string str)
		{
			return true;
		}
		//[Category("Graphics")]
		[Category("Referenced Objects")]
		[DisplayName("Graphic File Extension")]
		//[DisplayName("Default File Extension")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Default File Extension")]
		public string Graphics_defaultext
		{
			get
			{
				return _Xp["Graphics", "defaultext"];
			}
			set
			{
				_Xp["Graphics", "defaultext"] = value;
				OnPropertyChanged("Graphics_defaultext");
			}
		}
		#endregion
		#region ColorCategory       // From veproms.ini
		// Note that not all possibilities from 16-bit will be added here, until
		// it is determined how these will be used
		//[Category("Color")]
		[Category("Editor Settings")]
		//[DisplayName("Referenced Object Highlight")]
		[DisplayName("Step Editor Colors - Referenced Objects")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Color used to highlight an RO in procedure text")]
		public string Color_ro
		{
			get
			{
				return _Xp["Color", "ro"];
			}
			set
			{
				_Xp["Color", "ro"] = value;
				OnPropertyChanged("Color_ro");
			}
		}
		//[Category("Color")]
		[Category("Editor Settings")]
		//[DisplayName("Transition Highlight")]
		[DisplayName("Step Editor Colors - Transitions")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Color used to highlight a Transition in procedure text")]
		public string Color_transition
		{
			get
			{
				return _Xp["Color", "transition"];
			}
			set
			{
				_Xp["Color", "transition"] = value;
				OnPropertyChanged("Color_transition");
			}
		}
		//[Category("Color")]
		[Category("Editor Settings")]
		//[DisplayName("editbackground")]
		[DisplayName("Step Editor Colors - Active Background")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("editbackground")]
		public string Color_editbackground
		{
			get
			{
				return _Xp["Color", "editbackground"];
			}
			set
			{
				_Xp["Color", "editbackground"] = value;
				OnPropertyChanged("Color_editbackground");
			}
		}
		[Category("Color")]
		[DisplayName("black")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("black")]
		public string Color_black
		{
			get
			{
				return _Xp["Color", "black"];
			}
			set
			{
				_Xp["Color", "black"] = value;
				OnPropertyChanged("Color_black");
			}
		}
		[Category("Color")]
		[DisplayName("blue")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("blue")]
		public string Color_blue
		{
			get
			{
				return _Xp["Color", "blue"];
			}
			set
			{
				_Xp["Color", "blue"] = value;
				OnPropertyChanged("Color_blue");
			}
		}
		#endregion       // From veproms.ini
		#region SystemPrintCategory     // From veproms.ini
		//[Category("System Print")]
		[Category("Print Settings")]
		[DisplayName("Override Underline Thickness (dots)")]
		//[DisplayName("Underline Width")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Underline Width")]
		public int SysPrint_UWidth
		{
			get
			{
				string s = _Xp["SystemPrint", "UnderlineWidth"];
				if (s == string.Empty) return 10;
				return int.Parse(_Xp["SystemPrint", "UnderlineWidth"]);
			}
			set
			{
				_Xp["SystemPrint", "UnderlineWidth"] = value.ToString();
				OnPropertyChanged("SysPrint_UWidth");
			}
		}
		//[Category("System Print")]
		[Category("Print Settings")]
		[DisplayName("Adjust Starting Print Position (dots)")]
		//[DisplayName("Vertical Offset")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Vertical Offset")]
		public int SysPrint_VOffset
		{
			get
			{
				string s = _Xp["SystemPrint", "VerticalOffset"];
				if (s == string.Empty) return 0;
				return int.Parse(_Xp["SystemPrint", "VerticalOffset"]);
			}
			set
			{
				_Xp["SystemPrint", "VerticalOffset"] = value.ToString();
				OnPropertyChanged("SysPrint_VOffset");
			}
		}
		//[Category("System Print")]
		[Category("Print Settings")]
		[DisplayName("Override Normal Pen Width (dots)")]
		//[DisplayName("Stroke Width")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Stroke Width")]
		public int SysPrint_StrokeWidth
		{
			get
			{
				string s = _Xp["SystemPrint", "StrokeWidth"];
				if (s == string.Empty) return 0;
				return int.Parse(_Xp["SystemPrint", "StrokeWidth"]);
			}
			set
			{
				_Xp["SystemPrint", "StrokeWidth"] = value.ToString();
				OnPropertyChanged("SysPrint_StrokeWidth");
			}
		}
		//[Category("System Print")]
		[Category("Print Settings")]
		[DisplayName("Override Bold Pen Width (dots)")]
		//[DisplayName("Stroke Width Bold")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Stroke Width Bold")]
		public int SysPrint_StrokeWidthBold
		{
			get
			{
				string s = _Xp["SystemPrint", "StrokeWidthBold"];
				if (s == string.Empty) return 0;
				return int.Parse(_Xp["SystemPrint", "StrokeWidthBold"]);
			}
			set
			{
				_Xp["SystemPrint", "StrokeWidthBold"] = value.ToString();
				OnPropertyChanged("SysPrint_StrokeWidthBold");
			}
		}
		#endregion
		#region StartupCategory     // From veproms.ini
		//[Category("Startup")]
		[Category("Startup Message")]
		[DisplayName("Startup MessageBox Title")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Startup MessageBox Title")]
		public string Startup_MsgTitle
		{
			get
			{
				return _Xp["Startup", "MessageBoxTitle"];
			}
			set
			{
				_Xp["Startup", "MessageBoxTitle"] = value;
				OnPropertyChanged("Startup_MsgTitle");
			}
		}
		//[Category("Startup")]
		[Category("Startup Message")]
		[DisplayName("Startup Message File")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Startup Message File")]
		public string Startup_MsgFile
		{
			get
			{
				return _Xp["Startup", "MessageFile"];
			}
			set
			{
				_Xp["Startup", "MessageFile"] = value;
				OnPropertyChanged("Startup_MsgFile");
			}
		}
		#endregion
		#region ProcedureListTabStopsCategory       // From veproms.ini
		[Category("ProcedureListTabStops")]
		[DisplayName("Procedure Number Tab")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Procedure Number Tab")]
		public int ProcListTab_Number
		{
			get
			{
				string s = _Xp["ProcedureListTabStops", "ProcedureNumberTab"];
				if (s == string.Empty) return 75;
				return int.Parse(_Xp["ProcedureListTabStops", "ProcedureNumberTab"]);
			}
			set
			{
				_Xp["ProcedureListTabStops", "ProcedureNumberTab"] = value.ToString();
				OnPropertyChanged("ProcListTab_Number");
			}
		}
		[Category("ProcedureListTabStops")]
		[DisplayName("Procedure Title Tab")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Procedure Title Tab")]
		public int ProcListTab_Title
		{
			get
			{
				string s = _Xp["ProcedureListTabStops", "ProcedureTitleTab"];
				if (s == string.Empty) return 175;
				return int.Parse(_Xp["ProcedureListTabStops", "ProcedureTitleTab"]);
			}
			set
			{
				_Xp["ProcedureListTabStops", "ProcedureTitleTab"] = value.ToString();
				OnPropertyChanged("ProcListTab_Title");
			}
		}
		#endregion
		#region FormatCategory
		[TypeConverter(typeof(EnumDescConverter))]
		public enum FormatColumns : int
		{
			 Default = 0, 
			 [Description("Single Column")]OneColumn, 
			 [Description("Duel Column")]TwoColumn, 
			 [Description("Triple Column")]ThreeColumn, 
			 [Description("Quad Column")]FourColumns
		}
		//[Category("Format")]
		//[DisplayName("Column Layout")]
		[Category("Editor Settings")]
		[DisplayName("Step Editor Columns")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Column Layout")]
		public FormatColumns Format_Columns
		{
			get
			{
				string s = _Xp["format", "columns"];
				if (s == string.Empty || s.Equals("-1")) return FormatColumns.Default;//return (FormatColumns)0;
				return (FormatColumns)int.Parse(_Xp["format", "columns"]);
				//return Enum.Parse(typeof(FormatColumns),_Xp["format", "columns"]);
			}
			set
			{
				if (value == 0) _Xp["format", "columns"] = string.Empty;
				else _Xp["format", "columns"] = ((int)value).ToString();
				OnPropertyChanged("Format_Columns");
			}
		}
		//[Category("Format")]
		//[DisplayName("Plant Format Name")]
		[Category("Format Settings")]
		[DisplayName("Format")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Default Plant Format")]
		public string Format_Plant
		{
			get
			{
				return _Xp["format", "plant"];
			}
			set
			{
				_Xp["format", "plant"] = value;
				OnPropertyChanged("Format_Plant");
			}
		}
		#endregion
		#region DefaultsCategory        // from proc.ini
		//[Category("Defaults")]
		[Category("Referenced Objects")]
		//[DisplayName("Default Setpoint Prefix")]
		[DisplayName("Default RO Prefix")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Default Setpoint Prefix")]
		public string Default_SPPrefix
		{
			get { return _Xp["default", "spprefix"]; }
			set
			{
				_Xp["default", "spprefix"] = value;
				OnPropertyChanged("Default_SPPrefix");
			}
		}
		//[Category("Defaults")]
		[Category("Referenced Objects")]
		[DisplayName("Default Image Prefix")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Default Image Prefix")]
		public string Default_IMPrefix
		{
			get { return _Xp["default", "imprefix"]; }
			set
			{
				_Xp["default", "imprefix"] = value;
				OnPropertyChanged("RO_IMPrefix");
			}
		}
		#endregion
		#region PrintSettingsCategory       // From curset.dat
		[Category("Print Settings")]
		[DisplayName("Number of Copies")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Number of Copies")]
		public int Print_NumCopies
		{
			get
			{
				string s = _Xp["PrintSettings", "numcopies"];
				if (s == string.Empty) return 1;
				return int.Parse(_Xp["PrintSettings", "numcopies"]);
			}
			set
			{
				_Xp["PrintSettings", "numcopies"] = value.ToString();
				OnPropertyChanged("Print_NumCopies");
			}
		}
		public enum PrintPagination : int
		{
			Free = 0, Fixed, Auto
		}
		[Category("Print Settings")]
		[DisplayName("Pagination")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Pagination")]
		public PrintPagination Print_Pagination
		{
			get
			{
				string s = _Xp["PrintSettings", "Pagination"];
				if (s == string.Empty || s.Equals("-1")) return PrintPagination.Auto;
				return (PrintPagination)int.Parse(_Xp["PrintSettings", "Pagination"]);
			}
			set
			{
				if (value == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty;
				else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString();
				OnPropertyChanged("Print_Pagination");
			}
		}
		[TypeConverter(typeof(EnumDescConverter))]
		public enum PrintWatermark : int
		{
			None = 0, Reference, Draft, Master, Sample, 
			[Description("Information Only")]InformationOnly
		}
		[Category("Print Settings")]
		[DisplayName("Watermark")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Watermark")]
		public PrintWatermark Print_Watermark
		{
			get
			{
				string s = _Xp["PrintSettings", "Watermark"];
				if (s == string.Empty || s.Equals("-1")) return PrintWatermark.Draft;
				return (PrintWatermark)int.Parse(_Xp["PrintSettings", "Watermark"]);
			}
			set
			{
				if (value == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty;
				else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString();
				OnPropertyChanged("Print_Watermark");
			}
		}
		[Category("Print Settings")]
		[DisplayName("Disable Automatic Duplexing")]
		//[DisplayName("Disable Duplex Printing")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Disable Duplex Printing")]
		public bool Print_DisableDuplex
		{
			get
			{
				string s = _Xp["PrintSettings", "disableduplex"];
				if (s == string.Empty) return false;
				return bool.Parse(_Xp["PrintSettings", "disableduplex"]);
			}
			set
			{
				_Xp["PrintSettings", "disableduplex"] = value.ToString();
				OnPropertyChanged("Print_DisableDuplex");
			}
		}
		// Change Bar Use from 16-bit code:
		//  	No Default
		//      Without Change Bars
		//      With Default Change Bars
		//      With User Specified Change Bars
		[TypeConverter(typeof(EnumDescConverter))]
		public enum PrintChangeBar : int
		{
			[Description("Select Before Printing")]SelectBeforePrinting = 0, 
			[Description("Without Change Bars")]Without, 
			[Description("With Default Change Bars")]WithDefault, 
			[Description("Use Custom Change Bars")]WithUserSpecified
		}
		//{
		//        [Description("Select When Printed")]NoDefault = 0,
		//        [Description("None")]Without,
		//        [Description("Default")]WithDefault,
		//        [Description("User Specified")]WithUserSpecified
		//}
		//[Category("Print Settings")]
		[Category("Format Settings")]
		[DisplayName("Change Bar")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Change Bar Use")]
		public PrintChangeBar Print_ChangeBar
		{
			get
			{
				string s = _Xp["PrintSettings", "ChangeBar"];
				if (s == string.Empty || s.Equals("-1")) return PrintChangeBar.SelectBeforePrinting;//PrintChangeBar.NoDefault;
				return (PrintChangeBar)int.Parse(_Xp["PrintSettings", "ChangeBar"]);
			}
			set
			{
	//			if (value == PrintChangeBar.NoDefault) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
				if (value == PrintChangeBar.SelectBeforePrinting) _Xp["PrintSettings", "ChangeBar"] = string.Empty;
				else _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString();
				OnPropertyChanged("Print_ChangeBar");
			}
		}
		// User Specified Change Bar Location from16-bit code:
		//      With Text
		//      Outside Box
		//      AER on LEFT, RNO on Right
		//      To the Left of Text
		[TypeConverter(typeof(EnumDescConverter))]
		public enum PrintChangeBarLoc : int
		{
			[Description("With Text")]WithText = 0, 
			[Description("Outside Box")]OutsideBox, 
			[Description("AER on Left RNO on Right")]AERleftRNOright, 
			[Description("To the Left of the Text")]LeftOfText
		}
		//[Category("Print Settings")]
		[Category("Format Settings")]
		//[DisplayName("Change Bar Location")]
		[DisplayName("Change Bar Position")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("User Specified Change Bar Location")]
		public PrintChangeBarLoc Print_ChangeBarLoc
		{
			get
			{
				string s = _Xp["PrintSettings", "ChangeBarLoc"];
				if (s == string.Empty || s.Equals("-1")) return PrintChangeBarLoc.WithText;
				return (PrintChangeBarLoc)int.Parse(_Xp["PrintSettings", "ChangeBarLoc"]);
			}
			set
			{
				if (value == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty;
				else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString();
				OnPropertyChanged("Print_ChangeBarLoc");
			}
		}
		// Change Bar Text from16-bit code:
		//      Date and Change ID
		//      Revision Number
		//      Change ID
		//      No Change Bar Message
		//      User Defined Message
		[TypeConverter(typeof(EnumDescConverter))]
		public enum PrintChangeBarText : int
		{
			[Description("Date and Change ID")]DateChgID = 0, 
			[Description("Revision Number")]RevNum, 
			[Description("Change ID")]ChgID, 
			[Description("No Change Bar Text")]None, 
			[Description("Custom Change Bar Text")]UserDef
		}
		//[Category("Print Settings")]
		[Category("Format Settings")]
		//[DisplayName("Change Bar Text")]
		[DisplayName("Change bar Text Type")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Change Bar Text")]
		public PrintChangeBarText Print_ChangeBarText
		{
			get
			{
				string s = _Xp["PrintSettings", "ChangeBarText"];
				if (s == string.Empty || s.Equals("-1")) return PrintChangeBarText.DateChgID;
				return (PrintChangeBarText)int.Parse(_Xp["PrintSettings", "ChangeBarText"]);
			}
			set
			{
				if (value == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty;
				else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString();
				OnPropertyChanged("Print_ChangeBarText");
			}
		}
		[Category("Print Settings")]
		[DisplayName("User Format")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("User Format")]
		public string Print_UserFormat
		{
			get
			{
				return _Xp["PrintSettings", "userformat"];
			}
			set
			{
				_Xp["PrintSettings", "userformat"] = value;
				OnPropertyChanged("Print_UserFormat");
			}
		}
		//[Category("Print Settings")]
		[Category("Format Settings")]
		//[DisplayName("User Change Bar Message1")]
		[DisplayName("Custom Change Bar Message Line One")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("User Change Bar Message1")]
		public string Print_UserCBMess1
		{
			get
			{
				return _Xp["PrintSettings", "usercbmess1"];
			}
			set
			{
				_Xp["PrintSettings", "usercbmess1"] = value;
				OnPropertyChanged("Print_UserCBMess1");
			}
		}
		//[Category("Print Settings")]
		[Category("Format Settings")]
		//[DisplayName("User Change Bar Message2")]
		[DisplayName("Custom Change Bar Message Line Two")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("User Change Bar Message2")]
		public string Print_UserCBMess2
		{
			get
			{
				return _Xp["PrintSettings", "usercbmess2"];
			}
			set
			{
				_Xp["PrintSettings", "usercbmess2"] = value;
				OnPropertyChanged("Print_UserCBMess2");
			}
		}
		#endregion
		//[Category("Defaults")]
		[Category("Editor Settings")]
		//[DisplayName("Default BackColor")]
		[DisplayName("Step Editor Colors - Non Active Background")]
		[RefreshProperties(RefreshProperties.All)]
		[Description("Default Background Color")]
		public Color Default_BkColor
		{
			get
			{
				//return _Xp["default", "BkColor"];
				string sColor = _Xp["default", "BkColor"];
				if (sColor == string.Empty) sColor = "White";
				if (sColor[0] == '[')
				{
					string[] parts = sColor.Substring(1, sColor.Length - 2).Split(",".ToCharArray());
					return Color.FromArgb(Int32.Parse(parts[0]), Int32.Parse(parts[1]), Int32.Parse(parts[2]));
				}
				else return Color.FromName(sColor);
			}
			set
			{
				if (value.IsNamedColor) _Xp["default", "BkColor"] = value.Name;
				else
				{
					_Xp["default", "BkColor"] = string.Format("[{0},{1},{2}]", value.R, value.G, value.B);
				}
				OnPropertyChanged("Default_BkColor");
			}
		}
	}
}