/********************************************************************************************* * Copyright 2004 - Volian Enterprises, Inc. All rights reserved. * Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE * ------------------------------------------------------------------------------ * $Workfile: PSProperties.cs $ $Revision: 16 $ * $Author: Jsj $ $Date: 1/08/08 11:37a $ * * $History: PSProperties.cs $ * * ***************** Version 16 ***************** * User: Jsj Date: 1/08/08 Time: 11:37a * Updated in $/LibSource/VEObject * B2008-001 fixed Enum selection problem when creating new Deviation Set * (for NSP) * * ***************** Version 15 ***************** * User: Jsj Date: 5/15/07 Time: 9:41a * Updated in $/LibSource/VEObject * Allow edit of a Slave Set's title. * * ***************** Version 14 ***************** * User: Jsj Date: 10/20/06 Time: 9:35a * Updated in $/LibSource/VEObject * Combo box setup and pre select item fix * * ***************** Version 13 ***************** * User: Kathy Date: 6/27/05 Time: 11:35a * Updated in $/LibSource/VEObject * Proc.ini & Set.ini readonly rather than enabled property for edit mode * * ***************** Version 12 ***************** * User: Jsj Date: 6/10/05 Time: 9:46a * Updated in $/LibSource/VEObject * disable parent list (backgrounds, deviations, slaves) if a lock is NOT * set. * * ***************** Version 11 ***************** * User: Kathy Date: 5/25/05 Time: 10:32a * Updated in $/LibSource/VEObject * Allow edits for tmpchg * * ***************** Version 10 ***************** * User: Jsj Date: 5/12/05 Time: 11:52a * Updated in $/LibSource/VEObject * fixed unhandled exception problem when changing enhanced doc parent * * ***************** Version 9 ***************** * User: Jsj Date: 5/06/05 Time: 12:08p * Updated in $/LibSource/VEObject * bug fix setting creating new enhanced document set (setting up) * * ***************** Version 8 ***************** * User: Kathy Date: 4/21/05 Time: 10:24a * Updated in $/LibSource/VEObject * remove upgrade2005 define * * ***************** Version 7 ***************** * User: Jsj Date: 4/15/05 Time: 9:47a * Updated in $/LibSource/VEObject * bug fix B2005-021, parent and erg selection wasn't sticking when * changed for backgrounds, deviations, and slaves * * ***************** Version 6 ***************** * User: Jsj Date: 4/08/05 Time: 10:56a * Updated in $/LibSource/VEObject * added tab for SET.INI * * ***************** Version 5 ***************** * User: Kathy Date: 3/22/05 Time: 10:10a * Updated in $/LibSource/VEObject * approve: change bar removal checkbox * * ***************** Version 4 ***************** * User: Kathy Date: 2/10/05 Time: 12:36p * Updated in $/LibSource/VEObject * B2005-012: No apply button for new * * ***************** Version 3 ***************** * User: Kathy Date: 1/10/05 Time: 1:01p * Updated in $/LibSource/VEObject * B2004-062: allow new set PROCS & PROCS2 * * ***************** Version 2 ***************** * User: Jsj Date: 11/12/04 Time: 10:35a * Updated in $/LibSource/VEObject * Logic to support EOP to ERG relationships * * ***************** Version 1 ***************** * User: Kathy Date: 7/27/04 Time: 8:53a * Created in $/LibSource/VEObject *********************************************************************************************/ using System; using System.IO; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Text; using System.Data; using Utils; using VDB_Set; using IniFileIO; namespace VEObject { /// /// NOTE: cmbType (the combo box that contains the document types) must match /// the order of document types given in the ProcTypeOptions for this dialog /// to work correctly /// public class PSProperties : System.Windows.Forms.Form { private System.Windows.Forms.Button btnOK; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnApply; private VEO_Base _ParentObj; private VEO_Base _CurObj; private ArrayList ERGPaths; // map to titles in cmbGuildLink; private ArrayList ParentPaths; // map to titles in cmbPLink; private ArrayList EopErgRelations; // translation table array private ArrayList ERGinfoList; // ERG SET file info private EopToErgRelations RelationshipTbl; // translation file class private bool isnew; private System.Windows.Forms.Button btnCurSet; private System.Windows.Forms.Label lblGdLink; private System.Windows.Forms.ComboBox cmbGuideLink; private System.Windows.Forms.Label lblPLink; private System.Windows.Forms.ComboBox cmbPLink; private System.Windows.Forms.Label lblType; private System.Windows.Forms.ComboBox cmbType; private System.Windows.Forms.PropertyGrid myPropertyGrid; private System.Windows.Forms.TabPage tbGeneral; private System.Windows.Forms.TabPage tbPageAdvanced; private System.Windows.Forms.TextBox tbIniText; private System.Windows.Forms.Label lblIniFile; private System.Windows.Forms.Label lblExtraRev; private System.Windows.Forms.TextBox tbExtraRev; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; private bool changeProcIniFile; private System.Windows.Forms.Label label1; private System.Windows.Forms.ListBox lbEopRelateList; private System.Windows.Forms.ComboBox cbErgRelateList; private System.Windows.Forms.Label label2; private System.Windows.Forms.TabPage tbERG_Relate; private bool canedit; private bool blnDontCallChange; // change EOP/ERG relation? private static bool AlreadySetup; private System.Windows.Forms.CheckBox cbChgBarApp; private System.Windows.Forms.Label lblSetINI; private System.Windows.Forms.TabPage tbpgSetINI; private bool changeSetIniFile; private System.Windows.Forms.TextBox tbSetIniText; private System.Windows.Forms.TabControl tabControl1; private bool blnNeedToWriteEopErgTable; // write the translation table? public PSProperties(Object parent, Object curobj) { // // Required for Windows Form Designer support // _ParentObj = (VEO_Base) parent; _CurObj = (VEO_Base) curobj; VEO_ProcSet tmpPS = (VEO_ProcSet)curobj; if (tmpPS.isNew == true) isnew=true; else isnew=false; changeProcIniFile=false; changeSetIniFile=false; AlreadySetup=false; blnNeedToWriteEopErgTable=false; InitializeComponent(); this.cmbType.Items.Add("Standard"); this.cmbType.Items.Add("Slave"); if (!isnew || (isnew&&_CurObj.usrRunTime.SerialNumber.GetSNOption((uint)Utils.SerialNo.SN_Flags.SN_BACKGROUND_ON)>0)) this.cmbType.Items.Add("Background"); if (!isnew || (isnew&&_CurObj.usrRunTime.SerialNumber.GetSNOption((uint)Utils.SerialNo.SN_Flags.SN_DEVIATION_ON)>0)) this.cmbType.Items.Add("Deviation"); this.myPropertyGrid.SelectedObject=curobj; ERGPaths = new ArrayList(); ParentPaths = new ArrayList(); if(tmpPS.hasExtraRevNumber) { this.lblExtraRev.Visible = true; this.tbExtraRev.Visible = true; } else { this.lblExtraRev.Visible = false; this.tbExtraRev.Visible = false; } // If new, combo box should have 'Standard' & neither link combo boxes // are visible. VEO_ProcSet ps = (VEO_ProcSet)curobj; if (isnew == true) { this.cmbType.Enabled = true; // setting selectedindex will set up the new file names too. this.cmbType.SelectedIndex = (int)VEObject.ProcTypeOptions.Standard; this.cmbGuideLink.Visible = false; this.cmbPLink.Visible = false; this.lblGdLink.Visible = false; this.lblPLink.Visible = false; this.btnCurSet.Visible = false; //this.btnEditIni.Visible = false; NOTE - on note, make advanced tab invisible lblIniFile.Text = ps._curDirectory + "\\" + ps._Location + "\\proc.ini"; } else { this.btnCurSet.Visible = true; //this.btnEditIni.Visible = true; see above comment this.cmbType.Enabled = false; // if this isn't a new object, set up the data for type, i.e. // standard, background & deviation. If it's background or deviation, // then need to set links to. this.cmbType.SelectedIndex = (int) ps._ProcType; this.lblPLink.Visible = ps._ProcType != VEObject.ProcTypeOptions.Standard; this.cmbPLink.Visible = ps._ProcType != VEObject.ProcTypeOptions.Standard; this.cmbPLink.Enabled = (ps._ProcType != VEObject.ProcTypeOptions.Slave && _CurObj.canEdit()); this.lblGdLink.Visible = ps._ProcType.Equals(VEObject.ProcTypeOptions.Deviation); this.cmbGuideLink.Visible = ps._ProcType.Equals(VEObject.ProcTypeOptions.Deviation); if (ps.hasExtraRevNumber) this.tbExtraRev.Text = ps.ExtraRevNumber; if (ps._ProcType != VEObject.ProcTypeOptions.Standard) SetupComboBoxes(ps._ProcType); // setup PROC.INI tab lblIniFile.Text = ps._curDirectory + "\\" + ps._Location + "\\proc.ini"; if (File.Exists(lblIniFile.Text)) { // if proc.ini exists, read it into the text // box. StreamReader sr = new StreamReader(lblIniFile.Text); this.tbIniText.Text = sr.ReadToEnd(); sr.Close(); } // setup SET.INI tab lblSetINI.Text = ps._curDirectory + "\\" + ps._Location + "\\set.ini"; if (File.Exists(lblSetINI.Text)) { // if set.ini exists, read it into the text // box. StreamReader sr = new StreamReader(lblSetINI.Text); this.tbSetIniText.Text = sr.ReadToEnd(); sr.Close(); } // set this after the text is set because it was getting called when the ini file // was read. this.tbIniText.TextChanged += new System.EventHandler(this.tbIniText_TextChanged); this.tbSetIniText.TextChanged += new System.EventHandler(this.tbSetIniText_TextChanged); this.cbChgBarApp.Checked=ps.tmpRmChgBarOnApp; } if((_CurObj.canEdit()==false)&&!isnew) { canedit=false; this.myPropertyGrid.Enabled=false; this.tbIniText.ReadOnly=true; this.tbSetIniText.ReadOnly=true; this.tbExtraRev.Enabled=false; this.cbChgBarApp.Enabled=false; } else { canedit=true; // Bug fix: B2007-012 // Could not edit a Slave set's title when a lock was set. // // if (ps!=null && ((!ps.isTempChange && ps.isApproved) || ps._ProcType == VEObject.ProcTypeOptions.Slave)) if (ps!=null && (!ps.isTempChange && ps.isApproved) ) this.myPropertyGrid.Enabled=false; else this.myPropertyGrid.Enabled=true; if (ps.isApproved||ps.isTempChange) this.cbChgBarApp.Visible=false; this.tbIniText.ReadOnly=false; this.tbSetIniText.ReadOnly=false; this.tbExtraRev.Enabled=true; } btnApply.Enabled = false; // make apply button visible if modify this.btnApply.Visible = !isnew; } private void SetupComboBoxes(VEObject.ProcTypeOptions setType) { if (AlreadySetup) return; AlreadySetup = true; if (setType==VEObject.ProcTypeOptions.Standard) return; // for all of the 'standard' procedure sets in this parent plant directory, // add to Parent combo box. VEO_ProcSet ps = (VEO_ProcSet) _CurObj; string parLink = null; if (!isnew) parLink = ps.parentLink; // this is current, make active in cmbbox int parindx=0; // which combo box item matches the parent set. bool first = true; int cntproc=0; int len = _ParentObj.Children.Count; for (int i = 0; i-1) { DirectoryInfo direct = new DirectoryInfo(parLink); expand_dir = direct.Name; } if (parLink != null && tmppth.ToUpper()==expand_dir.ToUpper()) { parLink=null; parindx = cntproc+1; } ParentPaths.Add(tmppth); cntproc++; } } if (this.cmbPLink.Items.Count<1) { // could not find any doc sets suitable for linking this.cmbPLink.Items.Add("No Linkable Document Sets Found"); this.cmbPLink.Enabled=false; // make read only this.cmbPLink.SelectedIndex = 0; } else this.cmbPLink.SelectedIndex = parindx; if (!isnew) { if (parLink != null) { this.cmbPLink.Items.RemoveAt(0); this.cmbPLink.Items.Insert(0,"NOT FOUND: " + parLink); // this.cmbPLink.Items.Add("NOT FOUND: " + parLink); // this.cmbPLink.SelectedIndex = this.cmbPLink.Items.Count -1; } // jsj allow user to change selected parent if a lock is set //jsj this.cmbPLink.Enabled = false; this.cmbPLink.Enabled = _CurObj.canEdit(); } string gdLink = null; int devindx=0; if (!isnew /*&& setType==VEObject.ProcTypeOptions.Deviation*/) { gdLink = ps.GetGuideLink(); if (gdLink != null) gdLink = Path.GetFullPath(gdLink); // get path selected else return; //no erg path set, no relationship tab } VEO_Plant plnt = (VEO_Plant) ps.parentObj; VEO_DataPath dp = (VEO_DataPath) plnt.parentObj; int numitems = dp.Children.Count; VEO_Plant cplnt; for(int i=0;i-1 || uloc.IndexOf("\\VELP")>-1 || uloc.IndexOf("\\VEREV")>-1) { bool didread=false; if (cplnt.Children.Count==0) { cplnt.Read(false); didread=true; } // loop through the list of procedure set directories, // but only list the working draft. first = true; for (int j=0; j-1)||(gps._Location.IndexOf(".SL")>-1)) this.cmbGuideLink.Items.Add(gps._Title); else this.cmbGuideLink.Items.Add(cplnt._Title); if (gdLink != null && gdLink.ToUpper() == gps._curDirectory.ToUpper() + "\\" + gps._Location.ToUpper()) { gdLink = null; // bug fix B2006-044 // we were pre-selecting the wrong ERG // devindx = j+1; devindx = this.cmbGuideLink.Items.Count - 1; } ERGPaths.Add(gps._curDirectory+ "\\" + gps._Location); } } if(didread) cplnt.Children.Clear(); } } if (this.cmbGuideLink.Items.Count<1) { // no Generic Guidline (ERGs) data found this.cmbGuideLink.Items.Add("Generic Guidelines Not Found"); this.cmbGuideLink.Enabled = false; this.cmbGuideLink.SelectedIndex = 0; } else this.cmbGuideLink.SelectedIndex = devindx; if (!isnew) { if (gdLink != null) { this.cmbGuideLink.Items.Add("NOT FOUND: "+gdLink); } // jsj allow user to change ERG selection // jsj this.cmbGuideLink.Enabled = false; this.cmbGuideLink.Enabled = _CurObj.canEdit(); } // Read in the Translastion table file (TRANSL.TBL) and setup // the relationship dialog boxes. - jsj SetupRelationshipTab(); } private string GetNextSlaveDirExtension(string strMasterPrefix) { int slvNum = 1; string slExt = ".sl" + slvNum.ToString("D"); string SlaveDir = strMasterPrefix + slExt; while (Directory.Exists(SlaveDir)) { slvNum++; string OLDslExt = slExt; slExt = ".sl" + slvNum.ToString("D"); SlaveDir = SlaveDir.Replace(OLDslExt,slExt); } return SlaveDir; } private void SetupNewFileName() { int i=0; bool skipSlaveExt = true; StringBuilder newname = new StringBuilder(); string MstrDir = ""; VEO_ProcSet ps = (VEO_ProcSet) _CurObj; if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Slave) { MstrDir = (string) this.ParentPaths[this.cmbPLink.SelectedIndex]; if (MstrDir.Equals("Null")) { MstrDir = "** SELECT A PARENT SET TO BE THE MASTER **"; } else { MstrDir = MstrDir.ToLower(); int idx = MstrDir.LastIndexOf(".prc"); if (idx > 0) { MstrDir = MstrDir.Substring(0,idx); } idx = MstrDir.LastIndexOf('\\'); if (idx > 0) MstrDir = MstrDir.Substring(idx+1); skipSlaveExt = false; } newname.Append(MstrDir); } bool do_procs=false; while(i==0 || Directory.Exists(newname.ToString())) { newname.Remove(0,newname.Length); // if there is no procs directory & the user is making a standard // procedure set, default to Procs (B20054-062) if ((this.cmbType.Text=="Standard")&&(!Directory.Exists("Procs"))) { newname.Append("PROCS"); do_procs=true; } else if (MstrDir.Equals("")) { newname.Append("PROC"); newname.Append(i.ToString("")); } if (!do_procs) { if (this.cmbType.Text == "Background") newname.Append(".BCK"); else if (this.cmbType.Text == "Deviation") newname.Append(".DVT"); else if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Slave) { if (!skipSlaveExt) newname.Append(GetNextSlaveDirExtension(MstrDir)); // .SLx else newname.Append(MstrDir); } else newname.Append(".PRC"); } i++; } ps.Location = newname.ToString(); lblIniFile.Text = ps._curDirectory + "\\" + ps._Location + "\\proc.ini"; this.myPropertyGrid.SelectedObject=_CurObj; } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(PSProperties)); this.btnOK = new System.Windows.Forms.Button(); this.btnCancel = new System.Windows.Forms.Button(); this.btnApply = new System.Windows.Forms.Button(); this.tabControl1 = new System.Windows.Forms.TabControl(); this.tbGeneral = new System.Windows.Forms.TabPage(); this.cbChgBarApp = new System.Windows.Forms.CheckBox(); this.tbExtraRev = new System.Windows.Forms.TextBox(); this.lblExtraRev = new System.Windows.Forms.Label(); this.btnCurSet = new System.Windows.Forms.Button(); this.lblGdLink = new System.Windows.Forms.Label(); this.cmbGuideLink = new System.Windows.Forms.ComboBox(); this.lblPLink = new System.Windows.Forms.Label(); this.cmbPLink = new System.Windows.Forms.ComboBox(); this.lblType = new System.Windows.Forms.Label(); this.cmbType = new System.Windows.Forms.ComboBox(); this.myPropertyGrid = new System.Windows.Forms.PropertyGrid(); this.tbPageAdvanced = new System.Windows.Forms.TabPage(); this.lblIniFile = new System.Windows.Forms.Label(); this.tbIniText = new System.Windows.Forms.TextBox(); this.tbpgSetINI = new System.Windows.Forms.TabPage(); this.lblSetINI = new System.Windows.Forms.Label(); this.tbSetIniText = new System.Windows.Forms.TextBox(); this.tbERG_Relate = new System.Windows.Forms.TabPage(); this.label2 = new System.Windows.Forms.Label(); this.cbErgRelateList = new System.Windows.Forms.ComboBox(); this.lbEopRelateList = new System.Windows.Forms.ListBox(); this.label1 = new System.Windows.Forms.Label(); this.tabControl1.SuspendLayout(); this.tbGeneral.SuspendLayout(); this.tbPageAdvanced.SuspendLayout(); this.tbpgSetINI.SuspendLayout(); this.tbERG_Relate.SuspendLayout(); this.SuspendLayout(); // // btnOK // this.btnOK.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnOK.Location = new System.Drawing.Point(509, 342); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(77, 27); this.btnOK.TabIndex = 8; this.btnOK.Text = "OK"; this.btnOK.Click += new System.EventHandler(this.btnOK_Click); // // btnCancel // this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnCancel.Location = new System.Drawing.Point(605, 342); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(77, 27); this.btnCancel.TabIndex = 9; this.btnCancel.Text = "Cancel"; this.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); // // btnApply // this.btnApply.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnApply.Location = new System.Drawing.Point(701, 342); this.btnApply.Name = "btnApply"; this.btnApply.Size = new System.Drawing.Size(67, 27); this.btnApply.TabIndex = 10; this.btnApply.Text = "Apply"; this.btnApply.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.btnApply.Click += new System.EventHandler(this.btnApply_Click); // // tabControl1 // this.tabControl1.Controls.Add(this.tbGeneral); this.tabControl1.Controls.Add(this.tbPageAdvanced); this.tabControl1.Controls.Add(this.tbpgSetINI); this.tabControl1.Controls.Add(this.tbERG_Relate); this.tabControl1.Location = new System.Drawing.Point(0, 0); this.tabControl1.Name = "tabControl1"; this.tabControl1.SelectedIndex = 0; this.tabControl1.Size = new System.Drawing.Size(941, 323); this.tabControl1.TabIndex = 17; this.tabControl1.VisibleChanged += new System.EventHandler(this.tabControl1_VisibleChanged); // // tbGeneral // this.tbGeneral.Controls.Add(this.cbChgBarApp); this.tbGeneral.Controls.Add(this.tbExtraRev); this.tbGeneral.Controls.Add(this.lblExtraRev); this.tbGeneral.Controls.Add(this.btnCurSet); this.tbGeneral.Controls.Add(this.lblGdLink); this.tbGeneral.Controls.Add(this.cmbGuideLink); this.tbGeneral.Controls.Add(this.lblPLink); this.tbGeneral.Controls.Add(this.cmbPLink); this.tbGeneral.Controls.Add(this.lblType); this.tbGeneral.Controls.Add(this.cmbType); this.tbGeneral.Controls.Add(this.myPropertyGrid); this.tbGeneral.Location = new System.Drawing.Point(4, 25); this.tbGeneral.Name = "tbGeneral"; this.tbGeneral.Size = new System.Drawing.Size(933, 294); this.tbGeneral.TabIndex = 0; this.tbGeneral.Text = "General"; // // cbChgBarApp // this.cbChgBarApp.Checked = true; this.cbChgBarApp.CheckState = System.Windows.Forms.CheckState.Checked; this.cbChgBarApp.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cbChgBarApp.Location = new System.Drawing.Point(432, 9); this.cbChgBarApp.Name = "cbChgBarApp"; this.cbChgBarApp.Size = new System.Drawing.Size(298, 28); this.cbChgBarApp.TabIndex = 26; this.cbChgBarApp.Text = "Remove Change Bars on Approval"; this.cbChgBarApp.CheckedChanged += new System.EventHandler(this.cbChgBarApp_CheckedChanged); // // tbExtraRev // this.tbExtraRev.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.tbExtraRev.Location = new System.Drawing.Point(182, 249); this.tbExtraRev.MaxLength = 249; this.tbExtraRev.Name = "tbExtraRev"; this.tbExtraRev.Size = new System.Drawing.Size(538, 24); this.tbExtraRev.TabIndex = 25; this.tbExtraRev.Text = ""; this.tbExtraRev.TextChanged += new System.EventHandler(this.tbExtraRev_TextChanged); // // lblExtraRev // this.lblExtraRev.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblExtraRev.Location = new System.Drawing.Point(10, 249); this.lblExtraRev.Name = "lblExtraRev"; this.lblExtraRev.Size = new System.Drawing.Size(153, 28); this.lblExtraRev.TabIndex = 24; this.lblExtraRev.Text = "Extra Rev Number"; this.lblExtraRev.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // btnCurSet // this.btnCurSet.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnCurSet.Location = new System.Drawing.Point(730, 185); this.btnCurSet.Name = "btnCurSet"; this.btnCurSet.Size = new System.Drawing.Size(134, 46); this.btnCurSet.TabIndex = 23; this.btnCurSet.Text = "Change Default Settings"; this.btnCurSet.Click += new System.EventHandler(this.btnCurSet_Click); // // lblGdLink // this.lblGdLink.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblGdLink.Location = new System.Drawing.Point(10, 211); this.lblGdLink.Name = "lblGdLink"; this.lblGdLink.Size = new System.Drawing.Size(124, 28); this.lblGdLink.TabIndex = 22; this.lblGdLink.Text = "Guideline Set:"; this.lblGdLink.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // cmbGuideLink // this.cmbGuideLink.Location = new System.Drawing.Point(134, 211); this.cmbGuideLink.Name = "cmbGuideLink"; this.cmbGuideLink.Size = new System.Drawing.Size(442, 24); this.cmbGuideLink.TabIndex = 21; this.cmbGuideLink.SelectedIndexChanged += new System.EventHandler(this.cmbGuideLink_SelectedIndexChanged); // // lblPLink // this.lblPLink.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblPLink.Location = new System.Drawing.Point(19, 175); this.lblPLink.Name = "lblPLink"; this.lblPLink.Size = new System.Drawing.Size(106, 28); this.lblPLink.TabIndex = 20; this.lblPLink.Text = "Parent Set:"; this.lblPLink.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // cmbPLink // this.cmbPLink.Location = new System.Drawing.Point(134, 174); this.cmbPLink.Name = "cmbPLink"; this.cmbPLink.Size = new System.Drawing.Size(442, 24); this.cmbPLink.TabIndex = 19; this.cmbPLink.SelectedIndexChanged += new System.EventHandler(this.cmbPLink_SelectedIndexChanged); // // lblType // this.lblType.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblType.Location = new System.Drawing.Point(10, 8); this.lblType.Name = "lblType"; this.lblType.Size = new System.Drawing.Size(57, 28); this.lblType.TabIndex = 18; this.lblType.Text = "Type:"; this.lblType.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // cmbType // this.cmbType.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.cmbType.Location = new System.Drawing.Point(86, 8); this.cmbType.Name = "cmbType"; this.cmbType.Size = new System.Drawing.Size(250, 28); this.cmbType.TabIndex = 17; this.cmbType.SelectedIndexChanged += new System.EventHandler(this.cmbType_SelectedIndexChanged); // // myPropertyGrid // this.myPropertyGrid.CommandsVisibleIfAvailable = true; this.myPropertyGrid.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.myPropertyGrid.HelpVisible = false; this.myPropertyGrid.LargeButtons = false; this.myPropertyGrid.LineColor = System.Drawing.SystemColors.ScrollBar; this.myPropertyGrid.Location = new System.Drawing.Point(10, 45); this.myPropertyGrid.Name = "myPropertyGrid"; this.myPropertyGrid.Size = new System.Drawing.Size(883, 108); this.myPropertyGrid.TabIndex = 16; this.myPropertyGrid.Text = "Properties"; this.myPropertyGrid.ToolbarVisible = false; this.myPropertyGrid.ViewBackColor = System.Drawing.SystemColors.Window; this.myPropertyGrid.ViewForeColor = System.Drawing.SystemColors.WindowText; this.myPropertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.myPropertyGrid_PropertyValueChanged); // // tbPageAdvanced // this.tbPageAdvanced.Controls.Add(this.lblIniFile); this.tbPageAdvanced.Controls.Add(this.tbIniText); this.tbPageAdvanced.Location = new System.Drawing.Point(4, 25); this.tbPageAdvanced.Name = "tbPageAdvanced"; this.tbPageAdvanced.Size = new System.Drawing.Size(933, 294); this.tbPageAdvanced.TabIndex = 1; this.tbPageAdvanced.Text = "PROC.INI"; // // lblIniFile // this.lblIniFile.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblIniFile.Location = new System.Drawing.Point(19, 0); this.lblIniFile.Name = "lblIniFile"; this.lblIniFile.Size = new System.Drawing.Size(720, 18); this.lblIniFile.TabIndex = 20; // // tbIniText // this.tbIniText.Location = new System.Drawing.Point(32, 32); this.tbIniText.Multiline = true; this.tbIniText.Name = "tbIniText"; this.tbIniText.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.tbIniText.Size = new System.Drawing.Size(720, 212); this.tbIniText.TabIndex = 19; this.tbIniText.Text = ""; // // tbpgSetINI // this.tbpgSetINI.Controls.Add(this.lblSetINI); this.tbpgSetINI.Controls.Add(this.tbSetIniText); this.tbpgSetINI.Location = new System.Drawing.Point(4, 25); this.tbpgSetINI.Name = "tbpgSetINI"; this.tbpgSetINI.Size = new System.Drawing.Size(933, 294); this.tbpgSetINI.TabIndex = 3; this.tbpgSetINI.Text = "SET.INI"; // // lblSetINI // this.lblSetINI.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.lblSetINI.Location = new System.Drawing.Point(24, 0); this.lblSetINI.Name = "lblSetINI"; this.lblSetINI.Size = new System.Drawing.Size(720, 18); this.lblSetINI.TabIndex = 21; // // tbSetIniText // this.tbSetIniText.Location = new System.Drawing.Point(32, 32); this.tbSetIniText.Multiline = true; this.tbSetIniText.Name = "tbSetIniText"; this.tbSetIniText.ScrollBars = System.Windows.Forms.ScrollBars.Both; this.tbSetIniText.Size = new System.Drawing.Size(720, 212); this.tbSetIniText.TabIndex = 20; this.tbSetIniText.Text = ""; // // tbERG_Relate // this.tbERG_Relate.Controls.Add(this.label2); this.tbERG_Relate.Controls.Add(this.cbErgRelateList); this.tbERG_Relate.Controls.Add(this.lbEopRelateList); this.tbERG_Relate.Controls.Add(this.label1); this.tbERG_Relate.Location = new System.Drawing.Point(4, 25); this.tbERG_Relate.Name = "tbERG_Relate"; this.tbERG_Relate.Size = new System.Drawing.Size(933, 294); this.tbERG_Relate.TabIndex = 2; this.tbERG_Relate.Text = "ERG Relationships"; // // label2 // this.label2.Location = new System.Drawing.Point(0, 144); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(840, 24); this.label2.TabIndex = 3; this.label2.Text = "ERG List"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // cbErgRelateList // this.cbErgRelateList.Location = new System.Drawing.Point(0, 168); this.cbErgRelateList.MaxDropDownItems = 5; this.cbErgRelateList.Name = "cbErgRelateList"; this.cbErgRelateList.Size = new System.Drawing.Size(840, 24); this.cbErgRelateList.TabIndex = 2; this.cbErgRelateList.Text = "comboBox1"; this.cbErgRelateList.SelectedIndexChanged += new System.EventHandler(this.cbErgRelateList_SelectedIndexChanged); // // lbEopRelateList // this.lbEopRelateList.ItemHeight = 16; this.lbEopRelateList.Location = new System.Drawing.Point(0, 24); this.lbEopRelateList.Name = "lbEopRelateList"; this.lbEopRelateList.Size = new System.Drawing.Size(840, 100); this.lbEopRelateList.TabIndex = 1; this.lbEopRelateList.SelectedIndexChanged += new System.EventHandler(this.lbEopRelateList_SelectedIndexChanged); // // label1 // this.label1.Location = new System.Drawing.Point(0, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(840, 24); this.label1.TabIndex = 0; this.label1.Text = "EOP List"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // PSProperties // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(920, 374); this.Controls.Add(this.tabControl1); this.Controls.Add(this.btnApply); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "PSProperties"; this.Text = "Procedure Set Properties"; this.tabControl1.ResumeLayout(false); this.tbGeneral.ResumeLayout(false); this.tbPageAdvanced.ResumeLayout(false); this.tbpgSetINI.ResumeLayout(false); this.tbERG_Relate.ResumeLayout(false); this.ResumeLayout(false); } #endregion private void cmbType_SelectedIndexChanged(object sender, System.EventArgs e) { VEO_ProcSet ps = (VEO_ProcSet) _CurObj; // bug fix B2008-001 // find the value of the selected item // ps._ProcType = (VEObject.ProcTypeOptions)this.cmbType.SelectedIndex; ps._ProcType = (VEObject.ProcTypeOptions)Enum.Parse(typeof(VEObject.ProcTypeOptions),this.cmbType.SelectedItem.ToString()); // check whether other combo boxes should be shown, i.e. standard doesn't // show any, background & deviation show some. // standard first. // if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Standard) if (this.cmbType.SelectedItem.Equals("Standard")) { this.cmbGuideLink.Visible = false; this.cmbPLink.Visible = false; this.lblGdLink.Visible = false; this.lblPLink.Visible = false; // 05/11/05 //jsj remove translation table tab // this.tabControl1.Controls.Remove(tbERG_Relate); // this.tabControl1.SelectedIndex = 0; // return; } else { // Otherwise setup combo boxes for linked docs. this.lblPLink.Visible = true; this.cmbPLink.Visible = true; this.lblGdLink.Visible = this.cmbType.Text.Equals("Deviation"); this.cmbGuideLink.Visible = this.cmbType.Text.Equals("Deviation"); if (this.cmbType.SelectedIndex != (int)VEObject.ProcTypeOptions.Standard && this.cmbPLink.Items.Count<1) SetupComboBoxes((VEObject.ProcTypeOptions)this.cmbType.SelectedIndex); // if (this.cmbGuideLink.Visible) // this.tabControl1.Controls.Add(tbERG_Relate); } // now handle the file name. if (isnew) SetupNewFileName(); } // save was clicked, use the objects save methods. private bool saveclick() { bool success = true; VEO_ProcSet ps = (VEO_ProcSet) _CurObj; // Get the procedure set type (standard, slave, backgrounds, devitaions) // bug fix B2008-001 // find the value of the selected item // ps._ProcType = (VEObject.ProcTypeOptions)this.cmbType.SelectedIndex; ps._ProcType = (VEObject.ProcTypeOptions)Enum.Parse(typeof(VEObject.ProcTypeOptions),this.cmbType.SelectedItem.ToString()); // if (isnew) // { if(_ParentObj==null) { DialogResult=DialogResult.Cancel; return true; } // If deviations, get path to ERGs if (ps._ProcType == VEObject.ProcTypeOptions.Deviation && (this.cmbGuideLink.Items.Count > 0) && (this.cmbGuideLink.Items[0].ToString() != "Generic Guidelines Not Found")) { ps.guideLink = (string) ERGPaths[this.cmbGuideLink.SelectedIndex]; ps.SetGuideLink(ps.guideLink); } // If Slave, Backgrounds, or ERGs - get the parent (associated procedure set) path if (this.cmbPLink.Items.Count > 0 && ps._ProcType != VEObject.ProcTypeOptions.Standard) { string selparent = (string) ParentPaths[this.cmbPLink.SelectedIndex]; bool blnSelectParentChanged; if (ps.parentLink == null) blnSelectParentChanged = true; else blnSelectParentChanged = !ps.parentLink.ToUpper().Equals(selparent.ToUpper()); if (blnSelectParentChanged) ps.parentLink = selparent; if (ps.parentLink.Equals("Null")) { MessageBox.Show("You need to select a parent procedure set.","Need more information..."); success = false; ps.parentLink = null; } else ps.SetParentLink(ps.parentLink, ps._ProcType,blnSelectParentChanged); } if (isnew) { // Now actually create the new procedure set if (success) { VEO_ProcSetN psn = (VEO_ProcSetN) _CurObj; psn.SaveFields(); success=_ParentObj.SaveChild(_CurObj); } } else { // VEO_ProcSet ps = (VEO_ProcSet) _CurObj; if (ps.hasExtraRevNumber) ps.ExtraRevNumber=this.tbExtraRev.Text; success=_CurObj.Write(); } // check for change of ini file text.... and write out. // NOTE: When a new Slave procedure set is created, we copy the PROC.INI // file from the master set (as a default). The following code will // overwrite this with what the used had entered in the Advanced tab. // if (success && changeProcIniFile) if (success) { if (changeSetIniFile) { //write ini file text box data into set.ini (streamwriter creates // file if it doesn't exist) StreamWriter sw = new StreamWriter(lblSetINI.Text,false); sw.Write(this.tbSetIniText.Text); sw.Close(); changeSetIniFile=false; } if (changeProcIniFile) { //write ini file text box data into proc.ini (streamwriter creates // file if it doesn't exist) StreamWriter sw = new StreamWriter(lblIniFile.Text,false); sw.Write(this.tbIniText.Text); sw.Close(); changeProcIniFile=false; } // else if (ps._ProcType == VEObject.ProcTypeOptions.Slave) else if (ps.blnCopiedProcINI) { // VE-PROMS automatically created a PROC.INI for the slave. // Ask the user to check the information on the PROC.INI tab // for both the Master and Slave procedure sets. string strMessage = "VE-PROMS had automatically created a PROC.INI file in this\nSlave Procedure Set. Please verify and change (if needed)\nthe Applicability settings in both the Master and Slave sets.\nThis is done from the PROC.INI tab on the properties dialog."; MessageBox.Show(strMessage,"F.Y.I."); } } ps.blnCopiedProcINI = false; if (blnNeedToWriteEopErgTable) { RelationshipTbl.WriteTranslationTableFile(); blnNeedToWriteEopErgTable = false; } return success; } // save was clicked, use the objects save methods. private void btnOK_Click(object sender, System.EventArgs e) { bool success = true; if(canedit)success = saveclick(); if (success==true) { DialogResult = DialogResult.OK; this.Close(); } } private void btnApply_Click(object sender, System.EventArgs e) { if(!canedit)return; bool success = saveclick(); if(success==true)btnApply.Enabled=false; Refresh(); } private void btnCurSet_Click(object sender, System.EventArgs e) { bool success; //jsj if(!canedit)return; VEO_ProcSet ps = (VEO_ProcSet) this._CurObj; success=ps.ChgDefSettings(); if (success) { this.myPropertyGrid.SelectedObject=this._CurObj; } } private void btnCancel_Click(object sender, System.EventArgs e) { if(!canedit)return; VEO_ProcSet ps = (VEO_ProcSet) _CurObj; ps.Restore(); } private void myPropertyGrid_PropertyValueChanged(object s, System.Windows.Forms.PropertyValueChangedEventArgs e) { btnApply.Enabled = true; // CurrentGridItem = this.myPropertyGrid.SelectedGridItem; } private void cmbPLink_SelectedIndexChanged(object sender, System.EventArgs e) { if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Slave) { // VEO_ProcSet ps = (VEO_ProcSet) sender; // ps.parentLink = (string) ParentPaths[this.cmbPLink.SelectedIndex]; if (this.isnew) SetupNewFileName(); } else if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Deviation) { SetupRelationshipTab(); } btnApply.Enabled = true; } private void cmbGuideLink_SelectedIndexChanged(object sender, System.EventArgs e) { if (this.cmbType.SelectedIndex == (int)VEObject.ProcTypeOptions.Deviation) SetupRelationshipTab(); btnApply.Enabled = true; } private void tbExtraRev_TextChanged(object sender, System.EventArgs e) { btnApply.Enabled = true; } private void tbIniText_TextChanged(object sender, System.EventArgs e) { btnApply.Enabled = true; changeProcIniFile=true; } private void tbSetIniText_TextChanged(object sender, System.EventArgs e) { btnApply.Enabled = true; changeSetIniFile=true; } // set up the list boxes with the current list of EOPs and // list of ERG procedures private void SetupRelationshipTab() { bool isfirst = true; if (this.cmbPLink.SelectedIndex < 0 || this.cmbGuideLink.SelectedIndex < 0) return; // EOP or ERG path not set yet, just return string strPathToParentEOPs = (string) this.ParentPaths[this.cmbPLink.SelectedIndex]; if (strPathToParentEOPs.Equals("Null")) return; // EOP path not yet selected if (ERGPaths.Count == 0) return; // No ERG Paths string strPathToERGs = (string) ERGPaths[this.cmbGuideLink.SelectedIndex]; // Read in existing translation table RelationshipTbl = new EopToErgRelations(); EopErgRelations = new ArrayList(); ERGinfoList = new ArrayList(); lbEopRelateList.Items.Clear(); if (strPathToParentEOPs.Equals("Null")) { lbEopRelateList.Items.Add("Parent Set Not Selected"); } else { // populate the EOP list box // EopErgRelations (Array) contains a list of procedures in // the parent's SET file with the latest ERG relation // information gotten from the translation table (TRANSL.TBL). // Creating the list in this way will account for added and // deleted procedures. vdb_Set vdbSet=new vdb_Set(strPathToParentEOPs + "\\SET.DBF"); // Loop thru the procset DataTable tbl = vdbSet.DB_Data.Tables[0]; foreach (DataRow row in tbl.Rows) { // skip the first one (it's always a "blank" record) if (isfirst) isfirst = false; else { SetRecordObj SetRec = new SetRecordObj(row); lbEopRelateList.Items.Add(SetRec); RelationshipTbl.AddToTranslationList(SetRec,EopErgRelations); } } // replace the read-in relation list with the updated list // this new list will reflect the current list of procedures // in the SET file. RelationshipTbl.aryTransTable.Clear(); RelationshipTbl.aryTransTable = EopErgRelations; } cbErgRelateList.Items.Clear(); if (strPathToERGs.Equals("Null")) { cbErgRelateList.Items.Add("Guideline Set Not Selected"); } else { // populate the ERG dropdown box // and create a list (array) of the ERG information vdb_Set vdbERGset=new vdb_Set(strPathToERGs + "\\SET.DBF"); DataTable tbl = vdbERGset.DB_Data.Tables[0]; isfirst=true; ERGinfoList.Clear(); // Loop thru the ERG set foreach (DataRow row in tbl.Rows) { SetRecordObj SetRec = new SetRecordObj(row); if (isfirst) { isfirst = false; cbErgRelateList.Items.Add("Not Selected"); } else { cbErgRelateList.Items.Add(SetRec); } ERGinfoList.Add(SetRec); } } // position both list boxes lbEopRelateList.SelectedIndex = 0; if (strPathToERGs.Equals("Null")) { cbErgRelateList.SelectedIndex = 0; cbErgRelateList.Enabled = _CurObj.canEdit(); } else { cbErgRelateList.SelectedIndex = RelationshipTbl.FindInERGList(0,ERGinfoList); cbErgRelateList.Enabled = _CurObj.canEdit(); } } private void lbEopRelateList_SelectedIndexChanged(object sender, System.EventArgs e) { blnDontCallChange = true; // we're just positioning, not saving selection if (ERGinfoList.Count > 0) cbErgRelateList.SelectedIndex = RelationshipTbl.FindInERGList(lbEopRelateList.SelectedIndex,ERGinfoList); } private void cbErgRelateList_SelectedIndexChanged(object sender, System.EventArgs e) { if (blnDontCallChange) { blnDontCallChange = false; return; } if (RelationshipTbl.ChangeTranslationListItem(lbEopRelateList.SelectedIndex,ERGinfoList[cbErgRelateList.SelectedIndex])) { btnApply.Enabled = true; blnNeedToWriteEopErgTable = true; // there are changes to be saved } } private void cbChgBarApp_CheckedChanged(object sender, System.EventArgs e) { // store changed value in temp variable. Will be written to file when user // chooses to write changes (ok/apply button). VEO_ProcSet ps = (VEO_ProcSet)_CurObj; ps.tmpRmChgBarOnApp=cbChgBarApp.Checked; btnApply.Enabled = true; } private void tabControl1_VisibleChanged(object sender, System.EventArgs e) { if (this.cmbGuideLink.Visible) this.tabControl1.Controls.Add(tbERG_Relate); else { //jsj remove translation table tab this.tabControl1.Controls.Remove(tbERG_Relate); this.tabControl1.SelectedIndex = 0; } } } }