CSLA Config cleanup

This commit is contained in:
2026-08-28 11:15:35 -04:00
parent d0587706a2
commit f88f8a1c75
27 changed files with 566 additions and 2412 deletions
+22 -250
View File
@@ -1,29 +1,18 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Drawing;
using DescriptiveEnum;
namespace VEPROMS.CSLA.Library
{
[Serializable]
[TypeConverter(typeof(ExpandableObjectConverter))]
//public class FolderConfig : INotifyPropertyChanged
public class FolderConfig : ConfigDynamicTypeDescriptor, INotifyPropertyChanged
{
#region DynamicTypeDescriptor
internal override bool IsReadOnly
{
get { return _Folder == null; }
}
#endregion
#region XML
private XMLProperties _Xp;
private XMLProperties Xp
{
get { return _Xp; }
}
#region DynamicTypeDescriptor
internal override bool IsReadOnly => _Folder == null;
#endregion
#region XML
private readonly XMLProperties _Xp;
#endregion
#region Constructors
//PROPGRID: Hide ParentLookup
@@ -33,19 +22,8 @@ namespace VEPROMS.CSLA.Library
get { return _Xp.ParentLookup; }
set { _Xp.ParentLookup = value; }
}
//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; }
// set { _AncestorLookup = value; }
//}
private Folder _Folder;
private FolderInfo _FolderInfo;
private readonly Folder _Folder;
private readonly FolderInfo _FolderInfo;
public FolderConfig(Folder folder)
{
_Folder = folder;
@@ -75,18 +53,6 @@ namespace VEPROMS.CSLA.Library
return false;
}
}
//private string Xp_LookInAncestorFolderInfo(object sender, XMLPropertiesArgs args)
//{
// if (args.AncestorLookup || ParentLookup)
// {
// for (FolderInfo folder = _FolderInfo.MyParent; folder != null; folder = folder.MyParent)
// {
// string retval = folder.FolderConfig.GetValue(args.Group, args.Item);
// if (retval != string.Empty) return retval;
// }
// }
// return string.Empty;
//}
public FolderConfig(FolderInfo folderInfo)
{
_FolderInfo = folderInfo;
@@ -100,21 +66,12 @@ namespace VEPROMS.CSLA.Library
if (xml == string.Empty) xml = "<Config/>";
_Xp = new XMLProperties(xml);
}
public FolderConfig()
{
_Xp = new XMLProperties("<Config/>");
}
public string GetValue(string group, string item)
{
return _Xp[group, item];
}
public void SetValue(string group, string item, string newvalue)
{
_Xp[group, item] = newvalue;
}
#endregion
#region Local Properties
[Category("General")]
public FolderConfig() => _Xp = new XMLProperties("<Config/>");
public string GetValue(string group, string item) => _Xp[group, item];
public void SetValue(string group, string item, string newvalue) => _Xp[group, item] = newvalue;
#endregion
#region Local Properties
[Category("General")]
[DisplayName("Name")]
[Description("Name")]
public string Name
@@ -189,7 +146,6 @@ namespace VEPROMS.CSLA.Library
if (_Folder != null)
{
_Folder.MyFormat = FormatList.ToFormat(value);
//_Folder.ActiveFormat = null;
}
}
}
@@ -206,24 +162,17 @@ namespace VEPROMS.CSLA.Library
return null;
}
}
public Folder MyFolder
{ get { return _Folder; } }
public FolderInfo MyFolderInfo
{ get { return _FolderInfo; } }
#endregion
#region ToString
public override string ToString()
public Folder MyFolder => _Folder;
public FolderInfo MyFolderInfo => _FolderInfo;
#endregion
#region ToString
public override string ToString()
{
string s = _Xp.ToString();
if (s == "<Config/>" || s == "<Config></Config>") return string.Empty;
return s;
}
#endregion
#region GraphicsCategory // From veproms.ini
public bool CanWrite(string str)
{
return true;
}
return s == "<Config/>" || s == "<Config></Config>" ? string.Empty : s;
}
#endregion
#region GraphicsCategory // From veproms.ini
[Category("Referenced Objects")]
[DisplayName("Graphic File Extension")]
[RefreshProperties(RefreshProperties.All)]
@@ -304,103 +253,6 @@ namespace VEPROMS.CSLA.Library
}
}
#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
//// ** 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")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Referenced Objects")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight an RO in procedure text")]
//public string Color_ro
//{
// get
// {
// return _Xp["Color", "ro"];
// }
// set
// {
// _Xp["Color", "ro"] = value;
// OnPropertyChanged("Color_ro");
// }
//}
////PROPGRID: Hide Editor Color for Transitions
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Transitions")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("Color used to highlight a Transition in procedure text")]
//public string Color_transition
//{
// get
// {
// return _Xp["Color", "transition"];
// }
// set
// {
// _Xp["Color", "transition"] = value;
// OnPropertyChanged("Color_transition");
// }
//}
////PROPGRID: Hide Active Text Background Color
//[Category("Editor Settings")]
//[Browsable(false)]
//[DisplayName("Step Editor Colors - Active Background")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("editbackground")]
//public string Color_editbackground
//{
// get
// {
// return _Xp["Color", "editbackground"];
// }
// set
// {
// _Xp["Color", "editbackground"] = value;
// OnPropertyChanged("Color_editbackground");
// }
//}
////PROPGRID: Hide color setting for Black
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("black")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("black")]
//public string Color_black
//{
// get
// {
// return _Xp["Color", "black"];
// }
// set
// {
// _Xp["Color", "black"] = value;
// OnPropertyChanged("Color_black");
// }
//}
////PROPGRID: Hide Color Setting for Blue
//[Category("Color")]
//[Browsable(false)]
//[DisplayName("blue")]
//[RefreshProperties(RefreshProperties.All)]
//[Description("blue")]
//public string Color_blue
//{
// get
// {
// return _Xp["Color", "blue"];
// }
// set
// {
// _Xp["Color", "blue"] = value;
// OnPropertyChanged("Color_blue");
// }
//}
//#endregion // From veproms.ini
#region SystemPrintCategory // From veproms.ini
[Category("Print Settings")]
[DisplayName("Override Underline Thickness (dots)")]
@@ -635,20 +487,6 @@ namespace VEPROMS.CSLA.Library
}
#endregion
#region FormatCategory
//[TypeConverter(typeof(EnumDescConverter))]
//public enum FormatColumns : int
//{
// [Description("Format Default")]
// Default = 0,
// [Description("Single Column")]
// OneColumn,
// [Description("Dual Column")]
// TwoColumn,
// [Description("Triple Column")]
// ThreeColumn,
// [Description("Quad Column")]
// FourColumns
//}
[Category("Editor Settings")]
[DisplayName("Step Editor Columns")]
[RefreshProperties(RefreshProperties.All)]
@@ -726,10 +564,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_NumCopies");
}
}
//public enum PrintPagination : int
//{
// Free = 0, Fixed, Auto
//}
[Category("Print Settings")]
[DisplayName("Pagination")]
[RefreshProperties(RefreshProperties.All)]
@@ -767,13 +601,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Pagination");
}
}
//[TypeConverter(typeof(EnumDescConverter))]
//public enum PrintWatermark : int
//{
// None = 0, Reference, Draft, Master, Sample,
// [Description("Information Only")]
// InformationOnly
//}
[Category("Print Settings")]
[DisplayName("Watermark")]
@@ -812,23 +639,6 @@ namespace VEPROMS.CSLA.Library
OnPropertyChanged("Print_Watermark");
}
}
// 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 Bar")]
[RefreshProperties(RefreshProperties.All)]
@@ -866,24 +676,6 @@ namespace VEPROMS.CSLA.Library
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)]
@@ -922,26 +714,6 @@ namespace VEPROMS.CSLA.Library
}
}
// 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")]
[RefreshProperties(RefreshProperties.All)]