diff --git a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs index ed2bb15d..7ccab391 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/DocVersionConfig.cs @@ -7,193 +7,227 @@ using DescriptiveEnum; namespace VEPROMS.CSLA.Library { - [Serializable] - [TypeConverter(typeof(ExpandableObjectConverter))] + [Serializable] + [TypeConverter(typeof(ExpandableObjectConverter))] public class DocVersionConfig : DynamicTypeDescriptor, INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - private void OnPropertyChanged(String info) - { - if (PropertyChanged != null) - PropertyChanged(this, new PropertyChangedEventArgs(info)); - } - internal override bool IsReadOnly + { + public event PropertyChangedEventHandler PropertyChanged; + private void OnPropertyChanged(String info) + { + if (PropertyChanged != null) + PropertyChanged(this, new PropertyChangedEventArgs(info)); + } + internal override bool IsReadOnly + { + get { return _DocVersion == null; } + } + private XMLProperties _Xp; + private XMLProperties Xp + { + get { return _Xp; } + } + //PROPGRID: Hide ParentLookup + [Browsable(false)] + public bool ParentLookup + { + get { return _Xp.ParentLookup; } + set { _Xp.ParentLookup = value; } + } + private bool _AncestorLookup; + //PROPGRID: Hide AncestorLookup + [Browsable(false)] + public bool AncestorLookup + { + get { return _AncestorLookup; } + set { _AncestorLookup = value; } + } + private DocVersion _DocVersion; + public DocVersionConfig(DocVersion docVersion) + { + _DocVersion = docVersion; + string xml = docVersion.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + if (docVersion.MyFolder != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); + } + private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args) + { + if (_AncestorLookup || ParentLookup) + { + for (Folder folder = _DocVersion.MyFolder; folder != null; folder = folder.MyParent) { - get { return _DocVersion == null; } + string retval = folder.FolderConfig.GetValue(args.Group, args.Item); + if (retval != string.Empty) return retval; } - private XMLProperties _Xp; - private XMLProperties Xp - { - get { return _Xp; } - } - public bool ParentLookup - { - get { return _Xp.ParentLookup; } - set { _Xp.ParentLookup = value; } - } - private bool _AncestorLookup; - public bool AncestorLookup - { - get { return _AncestorLookup; } - set { _AncestorLookup = value; } - } - private DocVersion _DocVersion; - public DocVersionConfig(DocVersion docVersion) - { - _DocVersion = docVersion; - string xml = docVersion.Config; - if (xml == string.Empty) xml = ""; - _Xp = new XMLProperties(xml); - if (docVersion.MyFolder != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); } - private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args) - { - if (_AncestorLookup || ParentLookup) - { - for (Folder folder = _DocVersion.MyFolder; 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 = _DocVersionInfo.MyFolder; folder != null; folder = folder.MyParent) - { - string retval = folder.FolderConfig.GetValue(args.Group, args.Item); - if (retval != string.Empty) return retval; - } - } - return string.Empty; - } - private DocVersionInfo _DocVersionInfo; - public DocVersionConfig(DocVersionInfo docVersionInfo) + return string.Empty; + } + private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args) + { + if (_AncestorLookup || ParentLookup) + { + for (FolderInfo folder = _DocVersionInfo.MyFolder; folder != null; folder = folder.MyParent) { - _DocVersionInfo = docVersionInfo; - string xml = docVersionInfo.Config; - if (xml == string.Empty) xml = ""; - _Xp = new XMLProperties(xml); + string retval = folder.FolderConfig.GetValue(args.Group, args.Item); + if (retval != string.Empty) return retval; } - public DocVersionConfig(string xml) - { - _Xp = new XMLProperties(xml); - } - public DocVersionConfig() - { - string xml = ""; - _Xp = new XMLProperties(xml); - } - internal string GetValue(string group, string item) - { - return _Xp[group, item]; - } - //[Category("Identification")] - [Category("General")] - [DisplayName("Name")] - [Description("Name")] - public string Name - { - get { return (_DocVersion != null ? _DocVersion.Name : _DocVersionInfo.Name); } - set { if (_DocVersion != null) _DocVersion.Name = value; } - } - //[Category("Identification")] - [Category("General")] - [DisplayName("Title")] - [Description("Title")] - public string Title - { - get { return (_DocVersion != null ? _DocVersion.Title : _DocVersionInfo.Title); } - set { if (_DocVersion != null) _DocVersion.Title = value; } - } - //[Category("Format")] - [Category("Format Settings")] - [DisplayName("Format")] - [Description("Format")] - [TypeConverter(typeof(FormatList))] - public string FormatSelection - { - get - { - //if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID); - //if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID); - if (_DocVersion != null && _DocVersion.MyFormat != null) return _DocVersion.MyFormat.PlantFormat.FormatData.Name; - if (_DocVersionInfo != null && _DocVersionInfo.MyFormat != null) return _DocVersionInfo.MyFormat.PlantFormat.FormatData.Name; - return null; - } - set - { - if (_DocVersion != null) _DocVersion.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set - } - } - //[Category("Format")] - [Category("Format Settings")] - [DisplayName("Default Format")] - [Description("Format")] - [TypeConverter(typeof(FormatList))] - public string DefaultFormatSelection - { - get - { - //if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID); - //if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID); - if (_DocVersion != null && _DocVersion.MyFolder != null && _DocVersion.MyFolder.ActiveParent != null) return _DocVersion.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; - if (_DocVersionInfo != null && _DocVersionInfo.MyFolder != null && _DocVersionInfo.MyFolder.ActiveParent != null) return _DocVersionInfo.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; - return null; - } - } - public override string ToString() - { - string s = _Xp.ToString(); - if (s == "" || s == "") return string.Empty; - return s; - } + } + return string.Empty; + } + private DocVersionInfo _DocVersionInfo; + public DocVersionConfig(DocVersionInfo docVersionInfo) + { + _DocVersionInfo = docVersionInfo; + string xml = docVersionInfo.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + } + public DocVersionConfig(string xml) + { + _Xp = new XMLProperties(xml); + } + public DocVersionConfig() + { + string xml = ""; + _Xp = new XMLProperties(xml); + } + internal string GetValue(string group, string item) + { + return _Xp[group, item]; + } + [Category("General")] + [DisplayName("Name")] + [Description("Name")] + public string Name + { + get { return (_DocVersion != null ? _DocVersion.Name : _DocVersionInfo.Name); } + set { if (_DocVersion != null) _DocVersion.Name = value; } + } + [Category("General")] + //PROPGRID: Hide Title + [Browsable(false)] + [DisplayName("Title")] + [Description("Title")] + public string Title + { + get { return (_DocVersion != null ? _DocVersion.Title : _DocVersionInfo.Title); } + set { if (_DocVersion != null) _DocVersion.Title = value; } + } + [Category("Format Settings")] + [DisplayName("Format")] + [Description("Format")] + [TypeConverter(typeof(FormatList))] + public string FormatSelection + { + get + { + if (_DocVersion != null && _DocVersion.MyFormat != null) return _DocVersion.MyFormat.PlantFormat.FormatData.Name; + if (_DocVersionInfo != null && _DocVersionInfo.MyFormat != null) return _DocVersionInfo.MyFormat.PlantFormat.FormatData.Name; + return null; + } + set + { + if (_DocVersion != null) _DocVersion.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set + } + } + [Category("Format Settings")] + [DisplayName("Default Format")] + [Description("Default Format")] + [TypeConverter(typeof(FormatList))] + public string DefaultFormatSelection + { + get + { + if (_DocVersion != null && _DocVersion.MyFolder != null && _DocVersion.MyFolder.ActiveParent != null) return _DocVersion.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; + if (_DocVersionInfo != null && _DocVersionInfo.MyFolder != null && _DocVersionInfo.MyFolder.ActiveParent != null) return _DocVersionInfo.MyFolder.ActiveFormat.PlantFormat.FormatData.Name; + return null; + } + } + public override string ToString() + { + string s = _Xp.ToString(); + if (s == "" || s == "") return string.Empty; + return s; + } - // + // - #region RODefaults // From proc.ini - //[Category("RODefaults")] - [Category("Referenced Objects")] - //[DisplayName("Setpoint Prefix")] - [DisplayName("Default RO Prefix")] - [RefreshProperties(RefreshProperties.All)] - [Description("Setpoint Prefix")] - public string RODefaults_setpointprefix - { - get - { - return _Xp["RODefaults", "Setpoint"]; - } - set - { - _Xp["RODefaults", "Setpoint"] = value; - OnPropertyChanged("RODefaults_setpointprefix"); - } - } - //[Category("RODefaults")] - [Category("Referenced Objects")] - //[DisplayName("Graphics Prefix")] - [DisplayName("Default Graphics Prefix")] - [RefreshProperties(RefreshProperties.All)] - [Description("Graphics Prefix")] - public string RODefaults_graphicsprefix - { - get - { - return _Xp["RODefaults", "Graphics"]; - } - set - { - _Xp["RODefaults", "Graphics"] = value; - OnPropertyChanged("RODefaults_graphicsprefix"); - } - } - //[Category("Graphics")] + #region RODefaults // From proc.ini + [Category("Referenced Objects")] + [DisplayName("Default RO Prefix")] + [RefreshProperties(RefreshProperties.All)] + [Description("Setpoint Prefix")] + public string RODefaults_setpointprefix + { + get + { + string s = _Xp["RODefaults", "Setpoint"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("RODefaults", "Setpoint"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "SP1";// default to volian default + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("RODefaults", "Setpoint"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "SP1"; + + if (parval.Equals(value)) + _Xp["RODefaults", "Setpoint"] = string.Empty; // reset to parent value + else + _Xp["RODefaults", "Setpoint"] = value; // save selected value + + OnPropertyChanged("RODefaults_setpointprefix"); + } + } + [Category("Referenced Objects")] + [DisplayName("Default Graphics Prefix")] + [RefreshProperties(RefreshProperties.All)] + [Description("Graphics Prefix")] + public string RODefaults_graphicsprefix + { + get + { + string s = _Xp["RODefaults", "Graphics"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("RODefaults", "Graphics"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "IG1";// default to volian default + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("RODefaults", "Graphics"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "IG1"; + + if (parval.Equals(value)) + _Xp["RODefaults", "Graphics"] = string.Empty; // reset to parent value + else + _Xp["RODefaults", "Graphics"] = value; // save selected value + + OnPropertyChanged("RODefaults_graphicsprefix"); + } + } [Category("Referenced Objects")] - //[DisplayName("Default File Extension")] [DisplayName("Graphic File Extension")] [RefreshProperties(RefreshProperties.All)] [Description("Default File Extension")] @@ -201,319 +235,460 @@ namespace VEPROMS.CSLA.Library { get { - return _Xp["Graphics", "defaultext"]; + string s = _Xp["Graphics", "defaultext"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("Graphics", "defaultext"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return s = "TIF";// default to volian default + + return s; } set { - _Xp["Graphics", "defaultext"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("Graphics", "defaultext"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "TIF"; + + if (parval.Equals(value)) + _Xp["Graphics", "defaultext"] = string.Empty; // reset to parent value + else + _Xp["Graphics", "defaultext"] = value; // save selected value + OnPropertyChanged("Graphics_defaultext"); } } - #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"); - } - } - [Category("Print Settings")] - [DisplayName("Printer")] - [RefreshProperties(RefreshProperties.All)] - [Description("Printer")] - public string Print_Printer - { - get - { - string s = _Xp["PrintSettings", "Printer"]; - return s; - } - set - { - _Xp["PrintSettings", "Printer"] = value.ToString(); - OnPropertyChanged("Print_Printer"); - } - } - //public enum PrintWatermark : int - //{ - // None = 0, Reference, Draft, Master, Sample, - // [Description("Information Only")] - // InformationOnly - //} + #endregion + #region PrintSettingsCategory // From curset.dat + [Category("Print Settings")] + //PROPGRID: Hide Printer + [Browsable(false)] + [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"); + } + } + [Category("Print Settings")] + //PROPGRID: Hide Printer + [Browsable(false)] + [DisplayName("Printer")] + [RefreshProperties(RefreshProperties.All)] + [Description("Printer")] + public string Print_Printer + { + get + { + string s = _Xp["PrintSettings", "Printer"]; + return s; + } + set + { + _Xp["PrintSettings", "Printer"] = value.ToString(); + OnPropertyChanged("Print_Printer"); + } + } [TypeConverter(typeof(EnumDescConverter))] - public enum PrintWatermark : int - { - None = 0, Reference, Draft, Master, Sample, - [Description("Information Only")] - InformationOnly - } - //[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 Duplex Printing")] - [DisplayName("Disable Automatic Duplexing")] - [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 - //public enum PrintChangeBar : int - //{ - // NoDefault = 0, Without, WithDefault, WithUserSpecified - //} - [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 - } + [Category("Print Settings")] + [DisplayName("Watermark")] + [RefreshProperties(RefreshProperties.All)] + [Description("Watermark")] + public PrintWatermark Print_Watermark + { + get + { + string s = _Xp["PrintSettings", "Watermark"]; - //[Category("Print Settings")] - [Category("Format Settings")] - //[DisplayName("Change Bar")] - [DisplayName("Change Bars")] - [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"); - } - } - //public string Print_ChangeBarstr - //{ - // get - // { - // return EnumDescConverter.GetEnumDescription( - // string s = _Xp["PrintSettings", "ChangeBar"]; - // if (s == string.Empty) return PrintChangeBar.SelectBeforePrinting;//PrintChangeBar.NoDefault; - // return (PrintChangeBar)int.Parse(_Xp["PrintSettings", "ChangeBar"]); + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintWatermark.Draft;// default to volian default - // } - //} - // 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"); - } - } + return (PrintWatermark)int.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. - // Change Bar Text from16-bit code: - // Date and Change ID - // Revision Number - // Change ID - // No Change Bar Message - // User Defined Message - //public enum PrintChangeBarText : int - //{ - // DateChgID = 0, RevNum, ChgID, None, UserDef - //} - [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")] - [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")] - [Category("Format Settings")] - //[DisplayName("User Change Bar Message1")] + string parval = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintWatermark.Draft)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Watermark"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); // save selected value + + OnPropertyChanged("Print_Watermark"); + } + } + [Category("Print Settings")] + [DisplayName("Disable Automatic Duplexing")] + [RefreshProperties(RefreshProperties.All)] + [Description("Disable Duplex Printing")] + public bool Print_DisableDuplex + { + get + { + string s = _Xp["PrintSettings", "disableduplex"]; + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "false";// default to volian default + + return bool.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "false"; + + if (parval.Equals(value.ToString())) + _Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "disableduplex"] = value.ToString(); // save selected value + + 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 + } + + [Category("Format Settings")] + [DisplayName("Change Bars")] + [RefreshProperties(RefreshProperties.All)] + [Description("Change Bar Use")] + public PrintChangeBar Print_ChangeBar + { + get + { + string s = _Xp["PrintSettings", "ChangeBar"]; + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBar.SelectBeforePrinting;// default to volian default + + return (PrintChangeBar)int.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBar.SelectBeforePrinting)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBar"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString(); // save selected value + + 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("Format Settings")] + [DisplayName("Change Bar Position")] + [RefreshProperties(RefreshProperties.All)] + [Description("User Specified Change Bar Location")] + public PrintChangeBarLoc Print_ChangeBarLoc + { + get + { + string s = _Xp["PrintSettings", "ChangeBarLoc"]; + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarLoc.WithText;// default to volian default + + return (PrintChangeBarLoc)int.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarLoc.WithText)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); // save selected value + + 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("Format Settings")] + [DisplayName("Change Bar Text Type")] + [Description("Change Bar Text")] + public PrintChangeBarText Print_ChangeBarText + { + get + { + string s = _Xp["PrintSettings", "ChangeBarText"]; + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarText.DateChgID;// default to volian default + + return (PrintChangeBarText)int.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarText.DateChgID)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarText"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); // save selected value + + OnPropertyChanged("Print_ChangeBarText"); + } + } + [Category("Format Settings")] [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")] + [Description("User Change Bar Message1")] + public string Print_UserCBMess1 + { + get + { + string s = _Xp["PrintSettings", "usercbmess1"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return "";// default to volian default + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess1"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess1"] = value; // save selected value + + OnPropertyChanged("Print_UserCBMess1"); + } + } + [Category("Format Settings")] [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"); - } - } - [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"); - } - } - 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"); - } - } - #endregion - /* + [Description("User Change Bar Message2")] + public string Print_UserCBMess2 + { + get + { + string s = _Xp["PrintSettings", "usercbmess2"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return "";// default to volian default + + return s; + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess2"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess2"] = value; // save selected value + + OnPropertyChanged("Print_UserCBMess2"); + } + } + [Category("Print Settings")] + //PROPGRID: Hide User Format + [Browsable(false)] + [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"); + } + } + 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 there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintPagination.Auto;// default to volian default + + return (PrintPagination)int.Parse(s); + } + set + { + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintPagination.Auto)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Pagination"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); // save selected value + + OnPropertyChanged("Print_Pagination"); + } + } + #endregion + #region DELETE_ME + /* #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 @@ -1050,5 +1225,6 @@ OnPropertyChanged("Default_BkColor"); } } */ - } + #endregion + } } \ No newline at end of file diff --git a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs index ef9e74e5..0f003747 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/FolderConfig.cs @@ -10,7 +10,7 @@ namespace VEPROMS.CSLA.Library [Serializable] [TypeConverter(typeof(ExpandableObjectConverter))] //public class FolderConfig : INotifyPropertyChanged - public class FolderConfig : DynamicTypeDescriptor, INotifyPropertyChanged + public class FolderConfig : DynamicTypeDescriptor, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(String info) @@ -27,13 +27,19 @@ namespace VEPROMS.CSLA.Library { get { return _Xp; } } + //PROPGRID: Hide ParentLookup + [Browsable(false)] public bool ParentLookup { get { return _Xp.ParentLookup; } set { _Xp.ParentLookup = value; } } - [NonSerialized] + //PROPGRID: Hide AncestorLookup + //PROPGRID: Needed to comment out [NonSerialized] in order to hide this field from the property grid + //[NonSerialized] + [Browsable(false)] private bool _AncestorLookup; + [Browsable(false)] public bool AncestorLookup { get { return _AncestorLookup; } @@ -47,20 +53,25 @@ namespace VEPROMS.CSLA.Library string xml = _Folder.Config; if (xml == string.Empty) xml = ""; _Xp = new XMLProperties(xml); - if(folder.MyParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); + if (folder.MyParent != null) _Xp.LookInAncestor += new XMLPropertiesEvent(Xp_LookInAncestorFolder); } private string Xp_LookInAncestorFolder(object sender, XMLPropertiesArgs args) { - if (_AncestorLookup || ParentLookup) + if (_AncestorLookup || ParentLookup || args.AncestorLookup) + return GetParentValue(args.Group, args.Item); + return string.Empty; + } + + public string GetParentValue(string group, string item) + { + for (Folder folder = _Folder.MyParent; folder != null; folder = folder.MyParent) { - 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; - } + string retval = folder.FolderConfig.GetValue(group, item); + if (retval != string.Empty) return retval; } return string.Empty; } + private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args) { if (_AncestorLookup || ParentLookup) @@ -93,7 +104,6 @@ namespace VEPROMS.CSLA.Library { return _Xp[group, item]; } - //[Category("Identification")] [Category("General")] [DisplayName("Name")] [Description("Name")] @@ -102,8 +112,9 @@ namespace VEPROMS.CSLA.Library get { return (_Folder != null ? _Folder.Name : _FolderInfo.Name); } set { if (_Folder != null)_Folder.Name = value; } } - //[Category("Identification")] + //PROPGRID: Hide Title [Category("General")] + [Browsable(false)] [DisplayName("Title")] [Description("Title")] public string Title @@ -111,8 +122,9 @@ namespace VEPROMS.CSLA.Library get { return (_Folder != null ? _Folder.Title : _FolderInfo.Title); } set { _Folder.Title = value; } } - //[Category("Identification")] + //PROPGRID: Hide Short Name [Category("General")] + [Browsable(false)] [DisplayName("Short Name")] [Description("Short Name")] public string ShortName @@ -120,39 +132,32 @@ namespace VEPROMS.CSLA.Library 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 + 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 + set { - if (_Folder != null)_Folder.MyFormat = FormatList.ToFormat(value); + if (_Folder != null) _Folder.MyFormat = FormatList.ToFormat(value); } } - //[Category("Format")] [Category("Format Settings")] [DisplayName("Default Format")] - //[DisplayName("Format")] - [Description("Format")] + [Description("Default 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 (_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; } @@ -168,31 +173,53 @@ namespace VEPROMS.CSLA.Library { 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"]; + string s = _Xp["Graphics", "defaultext"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("Graphics", "defaultext"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "TIF";// default to volian default + + return s; } set { - _Xp["Graphics", "defaultext"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("Graphics", "defaultext"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "TIF"; + + if (parval.Equals(value)) + _Xp["Graphics", "defaultext"] = string.Empty; // reset to parent value + else + _Xp["Graphics", "defaultext"] = value; // save selected 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")] + // ** Note that not all possibilities from 16-bit will be added here, until + // ** it is determined how these will be used + // ** If this is used (unhidden), then we need to add logic to blank setting if the value + // ** we are saving is the same as the parent's value. + + //PROPGRID: Hide Editor Color for ROs [Category("Editor Settings")] - //[DisplayName("Referenced Object Highlight")] + [Browsable(false)] [DisplayName("Step Editor Colors - Referenced Objects")] [RefreshProperties(RefreshProperties.All)] [Description("Color used to highlight an RO in procedure text")] @@ -208,9 +235,9 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Color_ro"); } } - //[Category("Color")] + //PROPGRID: Hide Editor Color for Transitions [Category("Editor Settings")] - //[DisplayName("Transition Highlight")] + [Browsable(false)] [DisplayName("Step Editor Colors - Transitions")] [RefreshProperties(RefreshProperties.All)] [Description("Color used to highlight a Transition in procedure text")] @@ -226,9 +253,9 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Color_transition"); } } - //[Category("Color")] + //PROPGRID: Hide Active Text Background Color [Category("Editor Settings")] - //[DisplayName("editbackground")] + [Browsable(false)] [DisplayName("Step Editor Colors - Active Background")] [RefreshProperties(RefreshProperties.All)] [Description("editbackground")] @@ -244,7 +271,9 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Color_editbackground"); } } + //PROPGRID: Hide color setting for Black [Category("Color")] + [Browsable(false)] [DisplayName("black")] [RefreshProperties(RefreshProperties.All)] [Description("black")] @@ -260,7 +289,9 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Color_black"); } } + //PROPGRID: Hide Color Setting for Blue [Category("Color")] + [Browsable(false)] [DisplayName("blue")] [RefreshProperties(RefreshProperties.All)] [Description("blue")] @@ -278,10 +309,8 @@ namespace VEPROMS.CSLA.Library } #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 @@ -289,19 +318,36 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["SystemPrint", "UnderlineWidth"]; - if (s == string.Empty) return 10; - return int.Parse(_Xp["SystemPrint", "UnderlineWidth"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("SystemPrint", "UnderlineWidth"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return 10;// default to volian default + + return int.Parse(s); } set { - _Xp["SystemPrint", "UnderlineWidth"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("SystemPrint", "UnderlineWidth"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "10"; + + if (parval.Equals(value.ToString())) + _Xp["SystemPrint", "UnderlineWidth"] = string.Empty; // reset to parent value + else + _Xp["SystemPrint", "UnderlineWidth"] = value.ToString(); // save selected value + 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 @@ -309,19 +355,36 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["SystemPrint", "VerticalOffset"]; - if (s == string.Empty) return 0; - return int.Parse(_Xp["SystemPrint", "VerticalOffset"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("SystemPrint", "VerticalOffset"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return 0;// default to volian default + + return int.Parse(s); } set { - _Xp["SystemPrint", "VerticalOffset"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("SystemPrint", "VerticalOffset"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "0"; + + if (parval.Equals(value.ToString())) + _Xp["SystemPrint", "VerticalOffset"] = string.Empty; // reset to parent value + else + _Xp["SystemPrint", "VerticalOffset"] = value.ToString(); // save selected value + 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 @@ -329,19 +392,36 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["SystemPrint", "StrokeWidth"]; - if (s == string.Empty) return 0; - return int.Parse(_Xp["SystemPrint", "StrokeWidth"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("SystemPrint", "StrokeWidth"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return 0;// default to volian default + + return int.Parse(s); } set { - _Xp["SystemPrint", "StrokeWidth"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("SystemPrint", "StrokeWidth"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "0"; + + if (parval.Equals(((int)value).ToString())) + _Xp["SystemPrint", "StrokeWidth"] = string.Empty; // reset to parent value + else + _Xp["SystemPrint", "StrokeWidth"] = ((int)value).ToString(); // save selected value + 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 @@ -349,22 +429,43 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["SystemPrint", "StrokeWidthBold"]; - if (s == string.Empty) return 0; - return int.Parse(_Xp["SystemPrint", "StrokeWidthBold"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("SystemPrint", "StrokeWidthBold"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return 0;// default to volian default + + return int.Parse(s); } set { - _Xp["SystemPrint", "StrokeWidthBold"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("SystemPrint", "StrokeWidthBold"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "0"; + + if (parval.Equals(((int)value).ToString())) + _Xp["SystemPrint", "StrokeWidthBold"] = string.Empty; // reset to parent value + else + _Xp["SystemPrint", "StrokeWidthBold"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("SysPrint_StrokeWidthBold"); } } #endregion #region StartupCategory // From veproms.ini - //[Category("Startup")] + //PROPGRID: Hide Startup Message Title + //PROPGRID: The Startup Grouping is not being used right now, thus not visable. [Category("Startup Message")] [DisplayName("Startup MessageBox Title")] [RefreshProperties(RefreshProperties.All)] [Description("Startup MessageBox Title")] + [Browsable(false)] public string Startup_MsgTitle { get @@ -377,11 +478,12 @@ namespace VEPROMS.CSLA.Library OnPropertyChanged("Startup_MsgTitle"); } } - //[Category("Startup")] + //PROPGRID: Hide Startup Message File [Category("Startup Message")] [DisplayName("Startup Message File")] [RefreshProperties(RefreshProperties.All)] [Description("Startup Message File")] + [Browsable(false)] public string Startup_MsgFile { get @@ -397,6 +499,9 @@ namespace VEPROMS.CSLA.Library #endregion #region ProcedureListTabStopsCategory // From veproms.ini [Category("ProcedureListTabStops")] + //PROPGRID: Hide Procedure Number Tab + // ** Note that we will need to add logic it handle the reset to the parent value + [Browsable(false)] [DisplayName("Procedure Number Tab")] [RefreshProperties(RefreshProperties.All)] [Description("Procedure Number Tab")] @@ -415,6 +520,9 @@ namespace VEPROMS.CSLA.Library } } [Category("ProcedureListTabStops")] + //PROPGRID: Hide Procedure Title Tab + // ** Note that we will need to add logic it handle the reset to the parent value + [Browsable(false)] [DisplayName("Procedure Title Tab")] [RefreshProperties(RefreshProperties.All)] [Description("Procedure Title Tab")] @@ -437,14 +545,17 @@ namespace VEPROMS.CSLA.Library [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 + [Description("Format Default")] + 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)] @@ -453,70 +564,117 @@ namespace VEPROMS.CSLA.Library { 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"]); + string s = _Xp["format", "columns"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("format", "columns"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return FormatColumns.Default; // default to volian default + + return (FormatColumns)int.Parse(s); } set { - if (value == 0) _Xp["format", "columns"] = string.Empty; - else _Xp["format", "columns"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("format", "columns"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(FormatColumns.Default)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["format", "columns"] = string.Empty; // reset to parent value + else + _Xp["format", "columns"] = ((int)value).ToString(); // save selected value + 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"]; } + get + { + string s = _Xp["default", "spprefix"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("default", "spprefix"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "SP1";// default to volian default + + return s; + } set { - _Xp["default", "spprefix"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("default", "spprefix"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "SP1"; + + if (parval.Equals(value)) + _Xp["default", "spprefix"] = string.Empty; // reset to parent value + else + _Xp["default", "spprefix"] = value; // save selected 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"]; } + get + { + string s = _Xp["default", "imprefix"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("default", "imprefix"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "IG1";// default to volian default + + return s; + } set { - _Xp["default", "imprefix"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("default", "imprefix"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "IG1"; + + if (parval.Equals(value)) + _Xp["default", "imprefix"] = string.Empty; // reset to parent value + else + _Xp["default", "imprefix"] = value; // save selected value + OnPropertyChanged("RO_IMPrefix"); } } #endregion #region PrintSettingsCategory // From curset.dat + //PROPGRID: Hide Print Number of Copies [Category("Print Settings")] + [Browsable(false)] [DisplayName("Number of Copies")] [RefreshProperties(RefreshProperties.All)] [Description("Number of Copies")] @@ -547,21 +705,40 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "Pagination"]; - if (s == string.Empty || s.Equals("-1")) return PrintPagination.Auto; - return (PrintPagination)int.Parse(_Xp["PrintSettings", "Pagination"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintPagination.Auto;// default to volian default + + return (PrintPagination)int.Parse(s); } set { - if (value == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty; - else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintPagination.Auto)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Pagination"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_Pagination"); } } [TypeConverter(typeof(EnumDescConverter))] public enum PrintWatermark : int { - None = 0, Reference, Draft, Master, Sample, - [Description("Information Only")]InformationOnly + None = 0, Reference, Draft, Master, Sample, + [Description("Information Only")] + InformationOnly } [Category("Print Settings")] @@ -573,19 +750,36 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "Watermark"]; - if (s == string.Empty || s.Equals("-1")) return PrintWatermark.Draft; - return (PrintWatermark)int.Parse(_Xp["PrintSettings", "Watermark"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintWatermark.Draft;// default to volian default + + return (PrintWatermark)int.Parse(s); } set { - if (value == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty; - else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintWatermark.Draft)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Watermark"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); // save selected value + 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 @@ -593,12 +787,31 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "disableduplex"]; - if (s == string.Empty) return false; - return bool.Parse(_Xp["PrintSettings", "disableduplex"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "false";// default to volian default + + return bool.Parse(s); } set { - _Xp["PrintSettings", "disableduplex"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "false"; + + if (parval.Equals(value.ToString())) + _Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "disableduplex"] = value.ToString(); // save selected value + OnPropertyChanged("Print_DisableDuplex"); } } @@ -610,18 +823,15 @@ namespace VEPROMS.CSLA.Library [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 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)] @@ -630,15 +840,32 @@ namespace VEPROMS.CSLA.Library { 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"]); + string s = _Xp["PrintSettings", "ChangeBar"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBar.SelectBeforePrinting;// default to volian default + + return (PrintChangeBar)int.Parse(s); } 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(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBar.SelectBeforePrinting)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBar"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBar"); } } @@ -650,15 +877,17 @@ namespace VEPROMS.CSLA.Library [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 + [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")] @@ -667,13 +896,31 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "ChangeBarLoc"]; - if (s == string.Empty || s.Equals("-1")) return PrintChangeBarLoc.WithText; - return (PrintChangeBarLoc)int.Parse(_Xp["PrintSettings", "ChangeBarLoc"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarLoc.WithText;// default to volian default + + return (PrintChangeBarLoc)int.Parse(s); } set { - if (value == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; - else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarLoc.WithText)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBarLoc"); } } @@ -687,15 +934,18 @@ namespace VEPROMS.CSLA.Library [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 + [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")] @@ -704,18 +954,39 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "ChangeBarText"]; - if (s == string.Empty || s.Equals("-1")) return PrintChangeBarText.DateChgID; - return (PrintChangeBarText)int.Parse(_Xp["PrintSettings", "ChangeBarText"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarText.DateChgID;// default to volian default + + return (PrintChangeBarText)int.Parse(s); } set { - if (value == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty; - else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarText.DateChgID)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarText"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBarText"); } } + //PROPGRID: Hide User Format + // ** If we unhide this, logic to reset to parent setting will need to be added [Category("Print Settings")] + [Browsable(false)] [DisplayName("User Format")] [RefreshProperties(RefreshProperties.All)] [Description("User Format")] @@ -732,9 +1003,7 @@ namespace VEPROMS.CSLA.Library } } - //[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")] @@ -742,18 +1011,37 @@ namespace VEPROMS.CSLA.Library { get { - return _Xp["PrintSettings", "usercbmess1"]; + string s = _Xp["PrintSettings", "usercbmess1"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "";// default to volian default + + return s; } set { - _Xp["PrintSettings", "usercbmess1"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess1"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess1"] = value; // save selected 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")] @@ -761,18 +1049,41 @@ namespace VEPROMS.CSLA.Library { get { - return _Xp["PrintSettings", "usercbmess2"]; + string s = _Xp["PrintSettings", "usercbmess2"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "";// default to volian default + + return s; } set { - _Xp["PrintSettings", "usercbmess2"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess2"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess2"] = value; // save selected value + OnPropertyChanged("Print_UserCBMess2"); } } #endregion //[Category("Defaults")] + //PROPGRID: Hide text background color + [Category("Editor Settings")] - //[DisplayName("Default BackColor")] + [Browsable(false)] [DisplayName("Step Editor Colors - Non Active Background")] [RefreshProperties(RefreshProperties.All)] [Description("Default Background Color")] @@ -780,7 +1091,6 @@ namespace VEPROMS.CSLA.Library { get { - //return _Xp["default", "BkColor"]; string sColor = _Xp["default", "BkColor"]; if (sColor == string.Empty) sColor = "White"; if (sColor[0] == '[') diff --git a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs index 742685f0..55392698 100644 --- a/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs +++ b/PROMS/VEPROMS.CSLA.Library/Config/ProcConfig.cs @@ -32,13 +32,18 @@ namespace VEPROMS.CSLA.Library } #endregion #region Constructors + //PROPGRID: Hide ParentLookup + [Browsable(false)] public bool ParentLookup { get { return _Xp.ParentLookup; } set { _Xp.ParentLookup = value; } } - [NonSerialized] + //PROPGRID: Needed to comment out [NonSerialized] in order to hide AncestorLookup from property grid + //[NonSerialized] private bool _AncestorLookup; + //PROPGRID: Hide AncestorLookup + [Browsable(false)] public bool AncestorLookup { get { return _AncestorLookup; } @@ -64,7 +69,7 @@ namespace VEPROMS.CSLA.Library { retval = proc.ProcedureConfig.GetValue(args.Group, args.Item); if (retval != string.Empty) return retval; - proc = (Procedure) proc.ActiveParent; + proc = (Procedure)proc.ActiveParent; } DocVersion docVersion = (DocVersion)proc.ActiveParent; retval = docVersion.DocVersionConfig.GetValue(args.Group, args.Item); @@ -95,11 +100,11 @@ namespace VEPROMS.CSLA.Library } public ProcedureConfig(ProcedureInfo procedureInfo) { - _ProcedureInfo = procedureInfo; - string xml = procedureInfo.MyContent.Config; - if (xml == string.Empty) xml = ""; - _Xp = new XMLProperties(xml); - } + _ProcedureInfo = procedureInfo; + string xml = procedureInfo.MyContent.Config; + if (xml == string.Empty) xml = ""; + _Xp = new XMLProperties(xml); + } public ProcedureConfig(string xml) { if (xml == string.Empty) xml = ""; @@ -115,7 +120,6 @@ namespace VEPROMS.CSLA.Library } #endregion #region Local Properties - //[Category("Identification")] [Category("General")] [DisplayName("Number")] [Description("Number")] @@ -124,7 +128,6 @@ namespace VEPROMS.CSLA.Library get { return (_Procedure != null ? _Procedure.MyContent.Number : _ProcedureInfo.MyContent.Number); } set { if (_Procedure != null) _Procedure.MyContent.Number = value; } } - //[Category("Identification")] [Category("General")] [DisplayName("Title")] [Description("Title")] @@ -134,21 +137,24 @@ namespace VEPROMS.CSLA.Library set { if (_Procedure != null) _Procedure.MyContent.Text = value; } } [Category("Identification")] + //PROPGRID: Hide Old Sequence + [Browsable(false)] [DisplayName("Old Sequence")] [Description("Old Sequence")] public string OldSequence { - get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent == null? null :_ProcedureInfo.MyContent.MyZContent.OldStepSequence)); } + get { return (_Procedure != null ? _Procedure.MyContent.MyZContent.OldStepSequence : (_ProcedureInfo.MyContent.MyZContent == null ? null : _ProcedureInfo.MyContent.MyZContent.OldStepSequence)); } set { if (_Procedure != null) _Procedure.MyContent.MyZContent.OldStepSequence = value; } } [Category("Identification")] + //PROPGRID: Hide Dirty + [Browsable(false)] [DisplayName("Dirty")] [Description("Dirty")] public bool Dirty { - get { return (_Procedure != null ? _Procedure.IsDirty : false ); } + get { return (_Procedure != null ? _Procedure.IsDirty : false); } } - //[Category("Format")] [Category("Format Settings")] [DisplayName("Format")] [Description("Format")] @@ -157,8 +163,6 @@ namespace VEPROMS.CSLA.Library { get { - //if (_DocVersion != null) return FormatList.ToString(_DocVersion.FormatID); - //if (_DocVersionInfo != null) return FormatList.ToString(_DocVersionInfo.FormatID); if (_Procedure != null && _Procedure.MyContent.MyFormat != null) return _Procedure.MyContent.MyFormat.PlantFormat.FormatData.Name; if (_ProcedureInfo != null && _ProcedureInfo.MyContent.MyFormat != null) return _ProcedureInfo.MyContent.MyFormat.PlantFormat.FormatData.Name; return null; @@ -168,18 +172,14 @@ namespace VEPROMS.CSLA.Library if (_Procedure != null) _Procedure.MyContent.MyFormat = FormatList.ToFormat(value); // Can only be set if _DocVersion is set } } - //[Category("Format")] [Category("Format Settings")] - //[DisplayName("Format")] [DisplayName("Default Format")] - [Description("Format")] + [Description("Default 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 (_Procedure != null && _Procedure.ActiveParent != null && _Procedure.ActiveParent.ActiveFormat != null) return _Procedure.ActiveParent.ActiveFormat.PlantFormat.FormatData.Name; if (_ProcedureInfo != null && _ProcedureInfo.MyParent != null && _ProcedureInfo.MyParent.ActiveFormat != null) return _ProcedureInfo.MyParent.ActiveFormat.PlantFormat.FormatData.Name; return null; @@ -208,9 +208,7 @@ namespace VEPROMS.CSLA.Library [Description("Quad Column")] FourColumns } - //[Category("Format")] [Category("General")] - //[DisplayName("Column Layout")] [DisplayName("Default Column Mode")] [RefreshProperties(RefreshProperties.All)] [Description("Column Layout")] @@ -219,18 +217,37 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["format", "columns"]; - if (s == string.Empty || s.Equals("-1")) return FormatColumns.Default;//(FormatColumns)0; - return (FormatColumns)int.Parse(_Xp["format", "columns"]); - //return Enum.Parse(typeof(FormatColumns),_Xp["format", "columns"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("format", "columns"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return FormatColumns.Default;// default to volian default + + return (FormatColumns)int.Parse(s); } set { - if (value == 0) _Xp["format", "columns"] = string.Empty; - else _Xp["format", "columns"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("format", "columns"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(FormatColumns.Default)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["format", "columns"] = string.Empty; // reset to parent value + else + _Xp["format", "columns"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Format_Columns"); } } [Category("Format")] + //PROPGRID: Hide Plant Format Name (using Format and Default Format) + [Browsable(false)] [DisplayName("Plant Format Name")] [RefreshProperties(RefreshProperties.All)] [Description("Default Plant Format")] @@ -249,6 +266,8 @@ namespace VEPROMS.CSLA.Library #endregion #region PrintSettingsCategory // From curset.dat [Category("Print Settings")] + //PROPGRID: Hide Number of Copies + [Browsable(false)] [DisplayName("Number of Copies")] [RefreshProperties(RefreshProperties.All)] [Description("Number of Copies")] @@ -280,14 +299,32 @@ namespace VEPROMS.CSLA.Library { get { + string s = _Xp["PrintSettings", "Pagination"]; - if (s == string.Empty || s.Equals("-1")) return PrintPagination.Auto; - return (PrintPagination)int.Parse(_Xp["PrintSettings", "Pagination"]); + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintPagination.Auto;// default to volian default + + return (PrintPagination)int.Parse(s); } set { - if (value == PrintPagination.Auto) _Xp["PrintSettings", "Pagination"] = string.Empty; - else _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "Pagination"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintPagination.Auto)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Pagination"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Pagination"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_Pagination"); } } @@ -307,18 +344,35 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "Watermark"]; - if (s == string.Empty || s.Equals("-1")) return PrintWatermark.Draft; - return (PrintWatermark)int.Parse(_Xp["PrintSettings", "Watermark"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintWatermark.Draft;// default to volian default + + return (PrintWatermark)int.Parse(s); } set { - if (value == PrintWatermark.Draft) _Xp["PrintSettings", "Watermark"] = string.Empty; - else _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "Watermark"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintWatermark.Draft)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "Watermark"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "Watermark"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_Watermark"); } } [Category("Print Settings")] - //[DisplayName("Disable Duplex Printing")] [DisplayName("Disable Automatic Duplexing")] [RefreshProperties(RefreshProperties.All)] [Description("Disable Duplex Printing")] @@ -327,12 +381,31 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "disableduplex"]; - if (s == string.Empty) return false; - return bool.Parse(_Xp["PrintSettings", "disableduplex"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "false";// default to volian default + + return bool.Parse(s); } set { - _Xp["PrintSettings", "disableduplex"] = value.ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "disableduplex"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = "false"; + + if (parval.Equals(value.ToString())) + _Xp["PrintSettings", "disableduplex"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "disableduplex"] = value.ToString(); // save selected value + OnPropertyChanged("Print_DisableDuplex"); } } @@ -353,13 +426,6 @@ namespace VEPROMS.CSLA.Library [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)] @@ -369,14 +435,31 @@ namespace VEPROMS.CSLA.Library 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"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBar.SelectBeforePrinting;// default to volian default + + return (PrintChangeBar)int.Parse(s); } 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(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBar"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBar.SelectBeforePrinting)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBar"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBar"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBar"); } } @@ -397,9 +480,7 @@ namespace VEPROMS.CSLA.Library [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")] @@ -408,13 +489,31 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "ChangeBarLoc"]; - if (s == string.Empty || s.Equals("-1")) return PrintChangeBarLoc.WithText; - return (PrintChangeBarLoc)int.Parse(_Xp["PrintSettings", "ChangeBarLoc"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarLoc.WithText;// default to volian default + + return (PrintChangeBarLoc)int.Parse(s); } set { - if (value == PrintChangeBarLoc.WithText) _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; - else _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarLoc"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarLoc.WithText)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarLoc"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarLoc"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBarLoc"); } } @@ -439,9 +538,7 @@ namespace VEPROMS.CSLA.Library [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")] @@ -450,18 +547,38 @@ namespace VEPROMS.CSLA.Library get { string s = _Xp["PrintSettings", "ChangeBarText"]; - if (s == string.Empty || s.Equals("-1")) return PrintChangeBarText.DateChgID; - return (PrintChangeBarText)int.Parse(_Xp["PrintSettings", "ChangeBarText"]); + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + return PrintChangeBarText.DateChgID;// default to volian default + + return (PrintChangeBarText)int.Parse(s); } set { - if (value == PrintChangeBarText.DateChgID) _Xp["PrintSettings", "ChangeBarText"] = string.Empty; - else _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "ChangeBarText"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ((int)(PrintChangeBarText.DateChgID)).ToString(); + + if (parval.Equals(((int)value).ToString())) + _Xp["PrintSettings", "ChangeBarText"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "ChangeBarText"] = ((int)value).ToString(); // save selected value + OnPropertyChanged("Print_ChangeBarText"); } } [Category("Print Settings")] + //PROPGRID: Hide User Format + [Browsable(false)] [DisplayName("User Format")] [RefreshProperties(RefreshProperties.All)] [Description("User Format")] @@ -478,9 +595,7 @@ namespace VEPROMS.CSLA.Library } } - //[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")] @@ -488,18 +603,37 @@ namespace VEPROMS.CSLA.Library { get { - return _Xp["PrintSettings", "usercbmess1"]; + string s = _Xp["PrintSettings", "usercbmess1"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "";// default to volian default + + return s; } set { - _Xp["PrintSettings", "usercbmess1"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess1"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess1"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess1"] = value; // save selected 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")] @@ -507,11 +641,32 @@ namespace VEPROMS.CSLA.Library { get { - return _Xp["PrintSettings", "usercbmess2"]; + string s = _Xp["PrintSettings", "usercbmess2"];// get the saved value + + //If there is no value to get, then get the parent value (a.k.a. default value). + if (s == string.Empty) + s = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + // If there is no parent value, then use the volian default + if (s == string.Empty) + s = "";// default to volian default + + return s; } set { - _Xp["PrintSettings", "usercbmess2"] = value; + // if value being saved is same as the parent value, then clear the value (save blank). This will + // reset the data to use the parent value. + + string parval = _Xp.ParentValue("PrintSettings", "usercbmess2"); // get the parent value + + if (parval.Equals(string.Empty)) // if the parent value is empty, then use the volian default + parval = ""; + + if (parval.Equals(value)) + _Xp["PrintSettings", "usercbmess2"] = string.Empty; // reset to parent value + else + _Xp["PrintSettings", "usercbmess2"] = value; // save selected value + OnPropertyChanged("Print_UserCBMess2"); } }