diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs index 2def909c..a7897a3a 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs @@ -28,101 +28,42 @@ namespace Volian.Controls.Library /// private void InitializeComponent() { - this.groupPanelTranstionSteps = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.btnUp1 = new DevComponents.DotNetBar.ButtonX(); this.groupPanelBtns = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.cbCurProcSet = new System.Windows.Forms.CheckBox(); - this.panelTranSelStepBtns = new System.Windows.Forms.Panel(); - this.btnNewTrans = new DevComponents.DotNetBar.ButtonX(); - this.btnTranInsert = new DevComponents.DotNetBar.ButtonX(); - this.groupPanelProcSets = new DevComponents.DotNetBar.Controls.GroupPanel(); + this.btnTranCancel = new DevComponents.DotNetBar.ButtonX(); + this.btnTranSave = new DevComponents.DotNetBar.ButtonX(); this.groupPanelTranFmt = new DevComponents.DotNetBar.Controls.GroupPanel(); this.listBoxTranFmt = new System.Windows.Forms.ListBox(); + this.groupPanelTransitionSets = new DevComponents.DotNetBar.Controls.GroupPanel(); this.groupPanelTransitionProcs = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.listBoxTranProcs = new System.Windows.Forms.ListBox(); + this.cbTranProcs = new System.Windows.Forms.ComboBox(); this.groupPanelTransitionSect = new DevComponents.DotNetBar.Controls.GroupPanel(); - this.listBoxTranSects = new System.Windows.Forms.ListBox(); + this.cbTranSects = new System.Windows.Forms.ComboBox(); + this.groupPanelTranstionSteps = new DevComponents.DotNetBar.Controls.GroupPanel(); + this.pnlTranStepBtns = new System.Windows.Forms.Panel(); + this.lblxTranRangeTip = new DevComponents.DotNetBar.LabelX(); + this.btnTranRangeClear = new DevComponents.DotNetBar.ButtonX(); + this.btnUp1 = new DevComponents.DotNetBar.ButtonX(); this.tvTran = new Volian.Controls.Library.vlnTreeView3(); - this.tvProcSets = new Volian.Controls.Library.vlnTreeView3(); - this.groupPanelTranstionSteps.SuspendLayout(); + this.vlnTreeComboSets = new Volian.Controls.Library.vlnTreeCombo(); this.groupPanelBtns.SuspendLayout(); - this.panelTranSelStepBtns.SuspendLayout(); - this.groupPanelProcSets.SuspendLayout(); this.groupPanelTranFmt.SuspendLayout(); + this.groupPanelTransitionSets.SuspendLayout(); this.groupPanelTransitionProcs.SuspendLayout(); this.groupPanelTransitionSect.SuspendLayout(); + this.groupPanelTranstionSteps.SuspendLayout(); + this.pnlTranStepBtns.SuspendLayout(); this.SuspendLayout(); // - // groupPanelTranstionSteps - // - this.groupPanelTranstionSteps.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelTranstionSteps.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTranstionSteps.Controls.Add(this.btnUp1); - this.groupPanelTranstionSteps.Controls.Add(this.tvTran); - this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 493); - this.groupPanelTranstionSteps.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps"; - this.groupPanelTranstionSteps.Size = new System.Drawing.Size(387, 336); - // - // - // - this.groupPanelTranstionSteps.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelTranstionSteps.Style.BackColorGradientAngle = 90; - this.groupPanelTranstionSteps.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelTranstionSteps.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderBottomWidth = 1; - this.groupPanelTranstionSteps.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelTranstionSteps.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderLeftWidth = 1; - this.groupPanelTranstionSteps.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderRightWidth = 1; - this.groupPanelTranstionSteps.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelTranstionSteps.Style.BorderTopWidth = 1; - this.groupPanelTranstionSteps.Style.CornerDiameter = 4; - this.groupPanelTranstionSteps.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelTranstionSteps.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelTranstionSteps.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelTranstionSteps.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - this.groupPanelTranstionSteps.TabIndex = 24; - this.groupPanelTranstionSteps.Text = "Select Step"; - // - // btnUp1 - // - this.btnUp1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnUp1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnUp1.Dock = System.Windows.Forms.DockStyle.Left; - this.btnUp1.Image = global::Volian.Controls.Library.Properties.Resources.GoToParentFolderHS; - this.btnUp1.Location = new System.Drawing.Point(0, 0); - this.btnUp1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnUp1.Name = "btnUp1"; - this.btnUp1.Size = new System.Drawing.Size(51, 43); - this.btnUp1.TabIndex = 24; - this.btnUp1.Click += new System.EventHandler(this.btnUp1_Click); - // - // tvTran - // - this.tvTran.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tvTran.Location = new System.Drawing.Point(0, 43); - this.tvTran.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.tvTran.Name = "tvTran"; - this.tvTran.Size = new System.Drawing.Size(381, 270); - this.tvTran.TabIndex = 20; - this.tvTran.NodeSelectionChange += new Volian.Controls.Library.vlnTreeViewEvent(this.tvTran_NodeSelectionChange); - this.tvTran.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tvTran_MouseClick); - this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect); - // // groupPanelBtns // this.groupPanelBtns.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelBtns.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelBtns.Controls.Add(this.cbCurProcSet); - this.groupPanelBtns.Controls.Add(this.panelTranSelStepBtns); + this.groupPanelBtns.Controls.Add(this.btnTranCancel); + this.groupPanelBtns.Controls.Add(this.btnTranSave); this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; this.groupPanelBtns.Location = new System.Drawing.Point(0, 0); - this.groupPanelBtns.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.groupPanelBtns.Name = "groupPanelBtns"; - this.groupPanelBtns.Size = new System.Drawing.Size(387, 81); + this.groupPanelBtns.Size = new System.Drawing.Size(376, 42); // // // @@ -145,93 +86,32 @@ namespace Volian.Controls.Library this.groupPanelBtns.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; this.groupPanelBtns.TabIndex = 25; // - // cbCurProcSet + // btnTranCancel // - this.cbCurProcSet.AutoSize = true; - this.cbCurProcSet.Checked = true; - this.cbCurProcSet.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbCurProcSet.Dock = System.Windows.Forms.DockStyle.Top; - this.cbCurProcSet.Location = new System.Drawing.Point(0, 0); - this.cbCurProcSet.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.cbCurProcSet.Name = "cbCurProcSet"; - this.cbCurProcSet.Size = new System.Drawing.Size(381, 21); - this.cbCurProcSet.TabIndex = 24; - this.cbCurProcSet.Text = "Current Procedure Set"; - this.cbCurProcSet.UseVisualStyleBackColor = true; - this.cbCurProcSet.CheckedChanged += new System.EventHandler(this.cbCurProcSet_CheckedChanged); + this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTranCancel.AutoSize = true; + this.btnTranCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnTranCancel.Dock = System.Windows.Forms.DockStyle.Right; + this.btnTranCancel.Location = new System.Drawing.Point(282, 0); + this.btnTranCancel.Margin = new System.Windows.Forms.Padding(2); + this.btnTranCancel.Name = "btnTranCancel"; + this.btnTranCancel.Size = new System.Drawing.Size(88, 36); + this.btnTranCancel.TabIndex = 25; + this.btnTranCancel.Text = "Cancel"; + this.btnTranCancel.Click += new System.EventHandler(this.btnTranCancel_Click); // - // panelTranSelStepBtns + // btnTranSave // - this.panelTranSelStepBtns.Controls.Add(this.btnNewTrans); - this.panelTranSelStepBtns.Controls.Add(this.btnTranInsert); - this.panelTranSelStepBtns.Dock = System.Windows.Forms.DockStyle.Bottom; - this.panelTranSelStepBtns.Location = new System.Drawing.Point(0, 29); - this.panelTranSelStepBtns.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.panelTranSelStepBtns.Name = "panelTranSelStepBtns"; - this.panelTranSelStepBtns.Size = new System.Drawing.Size(381, 46); - this.panelTranSelStepBtns.TabIndex = 23; - // - // btnNewTrans - // - this.btnNewTrans.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnNewTrans.AutoSize = true; - this.btnNewTrans.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnNewTrans.Dock = System.Windows.Forms.DockStyle.Left; - this.btnNewTrans.Location = new System.Drawing.Point(88, 0); - this.btnNewTrans.Name = "btnNewTrans"; - this.btnNewTrans.Size = new System.Drawing.Size(88, 36); - this.btnNewTrans.TabIndex = 23; - this.btnNewTrans.Text = "New Transition"; - this.btnNewTrans.Click += new System.EventHandler(this.btnNewTrans_Click); - // - // btnTranInsert - // - this.btnTranInsert.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; - this.btnTranInsert.AutoSize = true; - this.btnTranInsert.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; - this.btnTranInsert.Dock = System.Windows.Forms.DockStyle.Left; - this.btnTranInsert.Location = new System.Drawing.Point(0, 0); - this.btnTranInsert.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.btnTranInsert.Name = "btnTranInsert"; - this.btnTranInsert.Size = new System.Drawing.Size(103, 36); - this.btnTranInsert.TabIndex = 22; - this.btnTranInsert.Text = "Select Transition"; - this.btnTranInsert.Click += new System.EventHandler(this.btnTranInsert_Click); - // - // groupPanelProcSets - // - this.groupPanelProcSets.AntiAlias = false; - this.groupPanelProcSets.AutoSize = true; - this.groupPanelProcSets.BackColor = System.Drawing.Color.Cyan; - //this.groupPanelBtns.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelProcSets.CanvasColor = System.Drawing.SystemColors.Control; - this.groupPanelProcSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelProcSets.Controls.Add(this.tvProcSets); - this.groupPanelProcSets.Location = new System.Drawing.Point(25, 49); - this.groupPanelProcSets.Name = "groupPanelProcSets"; - this.groupPanelProcSets.Size = new System.Drawing.Size(284, 100); - // - // - // - this.groupPanelProcSets.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; - this.groupPanelProcSets.Style.BackColorGradientAngle = 90; - this.groupPanelProcSets.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; - this.groupPanelProcSets.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelProcSets.Style.BorderBottomWidth = 1; - this.groupPanelProcSets.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.groupPanelProcSets.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelProcSets.Style.BorderLeftWidth = 1; - this.groupPanelProcSets.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelProcSets.Style.BorderRightWidth = 1; - this.groupPanelProcSets.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; - this.groupPanelProcSets.Style.BorderTopWidth = 1; - this.groupPanelProcSets.Style.CornerDiameter = 4; - this.groupPanelProcSets.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; - this.groupPanelProcSets.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; - this.groupPanelProcSets.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.groupPanelProcSets.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - this.groupPanelProcSets.TabIndex = 25; - this.groupPanelProcSets.Text = "Select Procedure"; + this.btnTranSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTranSave.AutoSize = true; + this.btnTranSave.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnTranSave.Dock = System.Windows.Forms.DockStyle.Left; + this.btnTranSave.Location = new System.Drawing.Point(0, 0); + this.btnTranSave.Name = "btnTranSave"; + this.btnTranSave.Size = new System.Drawing.Size(103, 36); + this.btnTranSave.TabIndex = 24; + this.btnTranSave.Text = "Save Transition"; + this.btnTranSave.Click += new System.EventHandler(this.btnTranSave_Click); // // groupPanelTranFmt // @@ -239,10 +119,9 @@ namespace Volian.Controls.Library this.groupPanelTranFmt.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; this.groupPanelTranFmt.Controls.Add(this.listBoxTranFmt); this.groupPanelTranFmt.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 81); - this.groupPanelTranFmt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupPanelTranFmt.Location = new System.Drawing.Point(0, 42); this.groupPanelTranFmt.Name = "groupPanelTranFmt"; - this.groupPanelTranFmt.Size = new System.Drawing.Size(387, 138); + this.groupPanelTranFmt.Size = new System.Drawing.Size(376, 112); // // // @@ -271,24 +150,53 @@ namespace Volian.Controls.Library this.listBoxTranFmt.Dock = System.Windows.Forms.DockStyle.Top; this.listBoxTranFmt.FormattingEnabled = true; this.listBoxTranFmt.HorizontalScrollbar = true; - this.listBoxTranFmt.ItemHeight = 16; this.listBoxTranFmt.Location = new System.Drawing.Point(0, 0); - this.listBoxTranFmt.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.listBoxTranFmt.Name = "listBoxTranFmt"; - this.listBoxTranFmt.Size = new System.Drawing.Size(381, 100); + this.listBoxTranFmt.Size = new System.Drawing.Size(370, 82); this.listBoxTranFmt.TabIndex = 13; this.listBoxTranFmt.SelectedIndexChanged += new System.EventHandler(this.listBoxTranFmt_Click); // + // groupPanelTransitionSets + // + this.groupPanelTransitionSets.CanvasColor = System.Drawing.SystemColors.Control; + this.groupPanelTransitionSets.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.groupPanelTransitionSets.Controls.Add(this.vlnTreeComboSets); + this.groupPanelTransitionSets.Dock = System.Windows.Forms.DockStyle.Top; + this.groupPanelTransitionSets.Location = new System.Drawing.Point(0, 154); + this.groupPanelTransitionSets.Name = "groupPanelTransitionSets"; + this.groupPanelTransitionSets.Size = new System.Drawing.Size(376, 48); + // + // + // + this.groupPanelTransitionSets.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.groupPanelTransitionSets.Style.BackColorGradientAngle = 90; + this.groupPanelTransitionSets.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.groupPanelTransitionSets.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTransitionSets.Style.BorderBottomWidth = 1; + this.groupPanelTransitionSets.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.groupPanelTransitionSets.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTransitionSets.Style.BorderLeftWidth = 1; + this.groupPanelTransitionSets.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTransitionSets.Style.BorderRightWidth = 1; + this.groupPanelTransitionSets.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTransitionSets.Style.BorderTopWidth = 1; + this.groupPanelTransitionSets.Style.CornerDiameter = 4; + this.groupPanelTransitionSets.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.groupPanelTransitionSets.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; + this.groupPanelTransitionSets.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.groupPanelTransitionSets.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; + this.groupPanelTransitionSets.TabIndex = 31; + this.groupPanelTransitionSets.Text = "Select Procedure Set"; + // // groupPanelTransitionProcs // this.groupPanelTransitionProcs.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelTransitionProcs.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTransitionProcs.Controls.Add(this.listBoxTranProcs); + this.groupPanelTransitionProcs.Controls.Add(this.cbTranProcs); this.groupPanelTransitionProcs.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 219); - this.groupPanelTransitionProcs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupPanelTransitionProcs.Location = new System.Drawing.Point(0, 202); this.groupPanelTransitionProcs.Name = "groupPanelTransitionProcs"; - this.groupPanelTransitionProcs.Size = new System.Drawing.Size(387, 130); + this.groupPanelTransitionProcs.Size = new System.Drawing.Size(376, 46); // // // @@ -309,32 +217,28 @@ namespace Volian.Controls.Library this.groupPanelTransitionProcs.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; this.groupPanelTransitionProcs.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; this.groupPanelTransitionProcs.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - this.groupPanelTransitionProcs.TabIndex = 29; + this.groupPanelTransitionProcs.TabIndex = 32; this.groupPanelTransitionProcs.Text = "Select Procedure"; // - // listBoxTranProcs + // cbTranProcs // - this.listBoxTranProcs.Dock = System.Windows.Forms.DockStyle.Top; - this.listBoxTranProcs.FormattingEnabled = true; - this.listBoxTranProcs.HorizontalScrollbar = true; - this.listBoxTranProcs.ItemHeight = 16; - this.listBoxTranProcs.Location = new System.Drawing.Point(0, 0); - this.listBoxTranProcs.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.listBoxTranProcs.Name = "listBoxTranProcs"; - this.listBoxTranProcs.Size = new System.Drawing.Size(381, 100); - this.listBoxTranProcs.TabIndex = 12; - this.listBoxTranProcs.SelectedIndexChanged += new System.EventHandler(this.listBoxTranProcs_SelectedIndexChanged); + this.cbTranProcs.Dock = System.Windows.Forms.DockStyle.Fill; + this.cbTranProcs.FormattingEnabled = true; + this.cbTranProcs.Location = new System.Drawing.Point(0, 0); + this.cbTranProcs.Name = "cbTranProcs"; + this.cbTranProcs.Size = new System.Drawing.Size(370, 21); + this.cbTranProcs.TabIndex = 14; + this.cbTranProcs.SelectedIndexChanged += new System.EventHandler(this.cbTranProcs_SelectedIndexChanged); // // groupPanelTransitionSect // this.groupPanelTransitionSect.CanvasColor = System.Drawing.SystemColors.Control; this.groupPanelTransitionSect.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; - this.groupPanelTransitionSect.Controls.Add(this.listBoxTranSects); + this.groupPanelTransitionSect.Controls.Add(this.cbTranSects); this.groupPanelTransitionSect.Dock = System.Windows.Forms.DockStyle.Top; - this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 349); - this.groupPanelTransitionSect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.groupPanelTransitionSect.Location = new System.Drawing.Point(0, 248); this.groupPanelTransitionSect.Name = "groupPanelTransitionSect"; - this.groupPanelTransitionSect.Size = new System.Drawing.Size(387, 144); + this.groupPanelTransitionSect.Size = new System.Drawing.Size(376, 49); // // // @@ -355,84 +259,161 @@ namespace Volian.Controls.Library this.groupPanelTransitionSect.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; this.groupPanelTransitionSect.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; this.groupPanelTransitionSect.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; - this.groupPanelTransitionSect.TabIndex = 30; + this.groupPanelTransitionSect.TabIndex = 33; this.groupPanelTransitionSect.Text = "Select Section"; // - // listBoxTranSects + // cbTranSects // - this.listBoxTranSects.Dock = System.Windows.Forms.DockStyle.Fill; - this.listBoxTranSects.FormattingEnabled = true; - this.listBoxTranSects.HorizontalScrollbar = true; - this.listBoxTranSects.ItemHeight = 16; - this.listBoxTranSects.Location = new System.Drawing.Point(0, 0); - this.listBoxTranSects.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); - this.listBoxTranSects.Name = "listBoxTranSects"; - this.listBoxTranSects.Size = new System.Drawing.Size(381, 116); - this.listBoxTranSects.TabIndex = 19; - this.listBoxTranSects.SelectedIndexChanged += new System.EventHandler(this.listBoxTranSects_SelectedIndexChanged); + this.cbTranSects.Dock = System.Windows.Forms.DockStyle.Fill; + this.cbTranSects.FormattingEnabled = true; + this.cbTranSects.Location = new System.Drawing.Point(0, 0); + this.cbTranSects.Name = "cbTranSects"; + this.cbTranSects.Size = new System.Drawing.Size(370, 21); + this.cbTranSects.TabIndex = 20; + this.cbTranSects.SelectedIndexChanged += new System.EventHandler(this.cbTranSects_SelectedIndexChanged); + this.cbTranSects.Click += new System.EventHandler(this.cbTranSects_SelectedIndexChanged); + // + // groupPanelTranstionSteps + // + this.groupPanelTranstionSteps.CanvasColor = System.Drawing.SystemColors.Control; + this.groupPanelTranstionSteps.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.Office2007; + this.groupPanelTranstionSteps.Controls.Add(this.tvTran); + this.groupPanelTranstionSteps.Controls.Add(this.pnlTranStepBtns); + this.groupPanelTranstionSteps.Dock = System.Windows.Forms.DockStyle.Fill; + this.groupPanelTranstionSteps.Location = new System.Drawing.Point(0, 297); + this.groupPanelTranstionSteps.Name = "groupPanelTranstionSteps"; + this.groupPanelTranstionSteps.Size = new System.Drawing.Size(376, 379); + // + // + // + this.groupPanelTranstionSteps.Style.BackColor2SchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground2; + this.groupPanelTranstionSteps.Style.BackColorGradientAngle = 90; + this.groupPanelTranstionSteps.Style.BackColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBackground; + this.groupPanelTranstionSteps.Style.BorderBottom = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTranstionSteps.Style.BorderBottomWidth = 1; + this.groupPanelTranstionSteps.Style.BorderColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.groupPanelTranstionSteps.Style.BorderLeft = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTranstionSteps.Style.BorderLeftWidth = 1; + this.groupPanelTranstionSteps.Style.BorderRight = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTranstionSteps.Style.BorderRightWidth = 1; + this.groupPanelTranstionSteps.Style.BorderTop = DevComponents.DotNetBar.eStyleBorderType.Solid; + this.groupPanelTranstionSteps.Style.BorderTopWidth = 1; + this.groupPanelTranstionSteps.Style.CornerDiameter = 4; + this.groupPanelTranstionSteps.Style.CornerType = DevComponents.DotNetBar.eCornerType.Rounded; + this.groupPanelTranstionSteps.Style.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center; + this.groupPanelTranstionSteps.Style.TextColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.groupPanelTranstionSteps.Style.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Near; + this.groupPanelTranstionSteps.TabIndex = 34; + this.groupPanelTranstionSteps.Text = "Select Step"; + // + // pnlTranStepBtns + // + this.pnlTranStepBtns.Controls.Add(this.lblxTranRangeTip); + this.pnlTranStepBtns.Controls.Add(this.btnTranRangeClear); + this.pnlTranStepBtns.Controls.Add(this.btnUp1); + this.pnlTranStepBtns.Dock = System.Windows.Forms.DockStyle.Top; + this.pnlTranStepBtns.Location = new System.Drawing.Point(0, 0); + this.pnlTranStepBtns.Name = "pnlTranStepBtns"; + this.pnlTranStepBtns.Size = new System.Drawing.Size(370, 46); + this.pnlTranStepBtns.TabIndex = 30; + // + // lblxTranRangeTip + // + this.lblxTranRangeTip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblxTranRangeTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblxTranRangeTip.Location = new System.Drawing.Point(235, 0); + this.lblxTranRangeTip.Name = "lblxTranRangeTip"; + this.lblxTranRangeTip.Size = new System.Drawing.Size(135, 46); + this.lblxTranRangeTip.TabIndex = 33; + this.lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; + // + // btnTranRangeClear + // + this.btnTranRangeClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTranRangeClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnTranRangeClear.Dock = System.Windows.Forms.DockStyle.Left; + this.btnTranRangeClear.Location = new System.Drawing.Point(43, 0); + this.btnTranRangeClear.Name = "btnTranRangeClear"; + this.btnTranRangeClear.Size = new System.Drawing.Size(58, 46); + this.btnTranRangeClear.TabIndex = 31; + this.btnTranRangeClear.Text = "Clear Range Selection"; + this.btnTranRangeClear.Click += new System.EventHandler(this.btnTranRangeClear_Click); + // + // btnUp1 + // + this.btnUp1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnUp1.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; + this.btnUp1.Dock = System.Windows.Forms.DockStyle.Left; + this.btnUp1.Image = global::Volian.Controls.Library.Properties.Resources.GoToParentFolderHS; + this.btnUp1.Location = new System.Drawing.Point(0, 0); + this.btnUp1.Name = "btnUp1"; + this.btnUp1.Size = new System.Drawing.Size(43, 46); + this.btnUp1.TabIndex = 30; + this.btnUp1.Click += new System.EventHandler(this.btnUp1_Click); // // tvTran // - this.tvTran.Dock = System.Windows.Forms.DockStyle.Bottom; - this.tvTran.Location = new System.Drawing.Point(0, 32); + this.tvTran.Dock = System.Windows.Forms.DockStyle.Fill; + this.tvTran.HideSelection = false; + this.tvTran.Location = new System.Drawing.Point(0, 46); this.tvTran.Name = "tvTran"; - this.tvTran.Size = new System.Drawing.Size(284, 220); - this.tvTran.TabIndex = 20; - this.tvTran.NodeSelectionChange += new Volian.Controls.Library.vlnTreeViewEvent(this.tvTran_NodeSelectionChange); - this.tvTran.MouseClick += new System.Windows.Forms.MouseEventHandler(this.tvTran_MouseClick); + this.tvTran.Size = new System.Drawing.Size(370, 312); + this.tvTran.TabIndex = 31; this.tvTran.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.tvTran_AfterSelect); // - // tvProcSets + // vlnTreeComboSets // - this.tvProcSets.Dock = System.Windows.Forms.DockStyle.Fill; - this.tvProcSets.Location = new System.Drawing.Point(0, 0); - this.tvProcSets.Name = "tvProcSets"; - this.tvProcSets.Size = new System.Drawing.Size(278, 79); - this.tvProcSets.TabIndex = 15; + this.vlnTreeComboSets.Dock = System.Windows.Forms.DockStyle.Fill; + this.vlnTreeComboSets.Location = new System.Drawing.Point(0, 0); + this.vlnTreeComboSets.Name = "vlnTreeComboSets"; + this.vlnTreeComboSets.Size = new System.Drawing.Size(370, 21); + this.vlnTreeComboSets.TabIndex = 33; + this.vlnTreeComboSets.Value = null; + this.vlnTreeComboSets.FinishEditing += new AT.STO.UI.Win.DropDownValueChangedEventHandler(this.DropDown_FinishEditing); // // DisplayTransition // - this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F); + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.groupPanelTranstionSteps); this.Controls.Add(this.groupPanelTransitionSect); this.Controls.Add(this.groupPanelTransitionProcs); + this.Controls.Add(this.groupPanelTransitionSets); this.Controls.Add(this.groupPanelTranFmt); this.Controls.Add(this.groupPanelBtns); - this.Controls.Add(this.groupPanelProcSets); + this.Margin = new System.Windows.Forms.Padding(2); this.Name = "DisplayTransition"; - this.Size = new System.Drawing.Size(387, 832); - this.groupPanelTranstionSteps.ResumeLayout(false); + this.Size = new System.Drawing.Size(376, 676); this.groupPanelBtns.ResumeLayout(false); this.groupPanelBtns.PerformLayout(); - this.panelTranSelStepBtns.ResumeLayout(false); - this.panelTranSelStepBtns.PerformLayout(); - this.groupPanelProcSets.ResumeLayout(false); this.groupPanelTranFmt.ResumeLayout(false); + this.groupPanelTransitionSets.ResumeLayout(false); this.groupPanelTransitionProcs.ResumeLayout(false); this.groupPanelTransitionSect.ResumeLayout(false); + this.groupPanelTranstionSteps.ResumeLayout(false); + this.pnlTranStepBtns.ResumeLayout(false); this.ResumeLayout(false); - this.PerformLayout(); } #endregion - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTranstionSteps; private DevComponents.DotNetBar.Controls.GroupPanel groupPanelBtns; - private System.Windows.Forms.Panel panelTranSelStepBtns; - private DevComponents.DotNetBar.ButtonX btnTranInsert; private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTranFmt; private System.Windows.Forms.ListBox listBoxTranFmt; + private DevComponents.DotNetBar.ButtonX btnTranCancel; + private DevComponents.DotNetBar.ButtonX btnTranSave; + private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionSets; + private vlnTreeCombo vlnTreeComboSets; private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionProcs; - private System.Windows.Forms.ListBox listBoxTranProcs; + private System.Windows.Forms.ComboBox cbTranProcs; private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTransitionSect; - private System.Windows.Forms.ListBox listBoxTranSects; - private vlnTreeView3 tvTran; - private System.Windows.Forms.CheckBox cbCurProcSet; + private System.Windows.Forms.ComboBox cbTranSects; + private DevComponents.DotNetBar.Controls.GroupPanel groupPanelTranstionSteps; + private System.Windows.Forms.Panel pnlTranStepBtns; + private DevComponents.DotNetBar.ButtonX btnTranRangeClear; private DevComponents.DotNetBar.ButtonX btnUp1; - private DevComponents.DotNetBar.ButtonX btnNewTrans; - private DevComponents.DotNetBar.Controls.GroupPanel groupPanelProcSets; - private vlnTreeView3 tvProcSets; + private DevComponents.DotNetBar.LabelX lblxTranRangeTip; + private vlnTreeView3 tvTran; } } diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index 05727023..54dfcbb5 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -7,6 +7,7 @@ using System.Data; using System.Text; using System.Windows.Forms; using System.Text.RegularExpressions; +using AT.STO.UI.Win; using VEPROMS.CSLA.Library; namespace Volian.Controls.Library @@ -14,15 +15,10 @@ namespace Volian.Controls.Library public partial class DisplayTransition : UserControl { #region Properties - private bool _CurProcSet = true; - public bool CurProcSet - { - get { return _CurProcSet; } - set { _CurProcSet = value; } - } - private int _TranFmtIndx = -1; - private ItemInfo _CurItemFrom; - private TransitionInfo _CurTrans; + + private int _TranFmtIndx = -1; // stores selected transition format + private ItemInfo _CurItemFrom; // stores what item transition is 'from' + private TransitionInfo _CurTrans; // if modify, this is transition to modify public TransitionInfo CurTrans { get { return _CurTrans; } @@ -33,26 +29,42 @@ namespace Volian.Controls.Library { if (MyRTB == null) return; _CurItemFrom = MyRTB.MyItem; - ClearControls(); - DetermineCurProcSet(); - return; + _TranFmtIndx = 0; } - _TranFmtIndx = _CurTrans.TranType; - _CurItemFrom = ItemInfo.Get(_CurTrans.FromID); + else + { + _TranFmtIndx = _CurTrans.TranType; + _CurItemFrom = ItemInfo.Get(_CurTrans.FromID); + } + _SavCurItemFrom = _CurItemFrom; + _SavTranFmtIndx = _TranFmtIndx; TransitionFillIn(); } } + // use the following if user selects 'cancel' button + private ItemInfo _SavCurItemFrom; + private int _SavTranFmtIndx; + + private bool _DoingRange = false; // flags if in 'range' transition mode private VETreeNode _RangeNode1; - private ItemInfo _tranitem1; - private ItemInfo _tranitem2; - private DisplayRTB _MyRTB; + private VETreeNode _RangeNode2; + // Use _RangeColor to show highlighting for steps selected in range. This is set from + // calling methods from application settings. If not default to aquamarine. + private Color _RangeColor = Color.Aquamarine; + public Color RangeColor + { + get { return _RangeColor; } + set { _RangeColor = value; } + } + private DisplayRTB _MyRTB; // Current RichTextBox, i.e. insert transition to it. public DisplayRTB MyRTB { get { return _MyRTB; } set { _MyRTB = value; } } - private ItemInfo _CurrentProcedure; + private ItemInfo _CurrentProcedure; // current procedure flags private int _CurrentProcIndex; + private bool _AlwaysDisableSets; // true if there is only 1 item in tree/combo for sets #endregion #region Constructors public DisplayTransition() @@ -61,66 +73,172 @@ namespace Volian.Controls.Library } #endregion #region LoadControlData - // TransitionFillIn uses other methods to fill in all controls on the - // insert/modify transition tab. + // TransitionFillIn uses other methods to fill in all controls on the transition tab. private bool _InitializingTrans; private void TransitionFillIn() { - //if (_CurItem == null) return; - btnTranInsert.Text = "Select Transition"; _InitializingTrans = true; - - if (_RangeNode1!= null) _RangeNode1.BackColor = tvTran.BackColor; - // first see if transition is within same set, this determines what - // controls & settings are used. - DetermineCurProcSet(); - if (!CurProcSet) - return; - else - CurrentProcSetFillIn(); - + if (_RangeNode1 != null || _RangeNode2 != null) ClearRangeTransition(); + InitControls(); _InitializingTrans = false; } - - private void CurrentProcSetFillIn() + private void InitControls() { ListBoxTranFmtFillIn(); - // if new, use _CurItemFrom to find the section level & procedure level, + // if new, use _CurItemFrom to setup the initial selections in the controls, // if modify, use the first transition to, _CurTrans - //ItemInfo tmpitm = _ToModify!=null?_tranitem1:_CurItem; - ItemInfo tmpitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID; - ItemInfo selstpitm = tmpitm; - while (tmpitm.MyContent.Type >= 20000) + // This item will be either a procedure, section or step, never a docversion + ItemInfo selitm = _CurTrans==null?_CurItemFrom:_CurTrans.MyItemToID; + + ItemInfo tmpitm = selitm; + ItemInfo secitm = null; + + // Find the procedure level first. + while (tmpitm.MyContent.Type != 0) { + if (tmpitm.MyContent.Type >=10000 && tmpitm.MyContent.Type<20000) secitm = tmpitm; tmpitm = tmpitm.MyParent; } - ItemInfo secitm = tmpitm; - listBoxTranSectsFillIn(secitm, secitm.ItemID); - ItemInfo prcitm = secitm.MyParent; - _CurrentProcedure = prcitm; - listBoxTranProcsFillIn(prcitm); - tvTranFillIn(selstpitm); - SetControlsEnabling(); - } - private void DetermineCurProcSet() - { - // If a current transition exists then check if current from item is in same set - // as transition to item. If no current transition (new), initialize to current - // set. Different controls are used for same set (list view) versus different - // set (tree view). - if (_CurTrans != null) + _CurrentProcedure = tmpitm; + vlnTreeComboSetsFillIn(_CurrentProcedure); + cbTranProcsFillIn(_CurrentProcedure); + if (_CurrentProcedure.Sections != null) { - DocVersionInfo dv = _CurItemFrom.MyProcedure.ActiveParent as DocVersionInfo; - if (dv == null) return; // what to do if null? - DocVersionInfo dvto = _CurTrans.MyItemToID.MyProcedure.ActiveParent as DocVersionInfo; - if (dv.VersionID != dvto.VersionID) CurProcSet = false; - else CurProcSet = true; - cbCurProcSet.Checked = CurProcSet; + cbTranSectsFillIn(secitm, secitm == null ? -1 : secitm.ItemID); + + // Fill step items, passing in the active step to the selected item, or the first + // step if the selection was not at the step level. + ItemInfo stpitm = null; + if (selitm.MyContent.Type >= 20000) + stpitm = selitm; + else if (secitm != null && secitm.Steps != null && secitm.Steps.Count > 0) + stpitm = selitm.Steps[0]; + tvTranFillIn(stpitm); } else - CurProcSet = cbCurProcSet.Checked; - + { + cbTranSects.Items.Clear(); + tvTran.Nodes.Clear(); + } + + SetControlsEnabling(); + } + private void vlnTreeComboSetsFillIn(ItemInfo prcitm) + { + // from this procedure, walk up the tree storing the FolderInfos. This is done + // so that the tree can be expanded highlighting (selecting) the current set. + List filist = new List(); + DocVersionInfo mydocversion = prcitm.ActiveParent as DocVersionInfo; + FolderInfo tmpfi = mydocversion.ActiveParent as FolderInfo; + while (tmpfi != null) + { + if (tmpfi.FolderID != 1) filist.Add(tmpfi); // don't add top folder + tmpfi = tmpfi.ActiveParent as FolderInfo; + } + + // Now start at the top folder. Continue to get children using the filist to determine + // the expanded part of the tree. Note that if there is only 1 item at a level, + // the level is not added to the tree, except if there are no sub-folders, i.e. + // right before the docversion. Also note that docversions are not displayed + // (at least for now - as of 2/14/08), this may change and if so uncomment (& fix/test) + // the next section of code where docversions are processed. + FolderInfo fi = FolderInfo.Get(1); + DropDownNode topnode = null; + int cntnd = 0; + while (fi.ChildFolderCount > 0) + { + // if there is more than 1 child, add this level of children to the + // to the tree. The second part of the 'if' covers the last level of + // folder. + if ((fi.ChildFolders.Count > 1) || + (fi.ChildFolders.Count==1 && fi.ChildFolders[0].FolderDocVersionCount>0)) + { + int indx = -1; + int pathid = filist[filist.Count - 1].FolderID; + foreach (FolderInfo fic in fi.ChildFolders) + { + DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString()); + int tmp = topnode==null?vlnTreeComboSets.DropDownControl.Nodes.Add(newnode):topnode.Nodes.Add(newnode); + cntnd++; + newnode.Tag = fic; + if (fic.FolderID == pathid) + indx = tmp; // flag the path to expand. + else if (fic.ChildFolders.Count > 0) // allow for '+' for tree expansion + { + DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY"); + newnode.Nodes.Add(tnt); + } + } + topnode = topnode==null?(DropDownNode)vlnTreeComboSets.DropDownControl.Nodes[indx]:(DropDownNode)topnode.Nodes[indx]; + } + fi = (filist.Count > 0) ? FolderInfo.Get(filist[filist.Count - 1].FolderID) : null; + if (filist.Count > 0) filist.RemoveAt(filist.Count - 1); + } + // if nothing was added to the tree, just put in the node above the docversions... + if (vlnTreeComboSets.DropDownControl.Nodes.Count == 0) + { + cntnd++; + fi = mydocversion.MyFolder; + topnode = new DropDownNode(fi.FolderID, fi.ToString()); + vlnTreeComboSets.DropDownControl.Nodes.Add(topnode); + topnode.Tag = fi; + } + // if there is only one node in entire tree, disable selection... + if (cntnd == 1) _AlwaysDisableSets = true; + else _AlwaysDisableSets = false; + + // the following selects the set & displays its value in the combo box portion + // of the tree combo control. + vlnTreeComboSets.Value = topnode; + vlnTreeComboSets.DropDownControl.SelectedNode = topnode; + vlnTreeComboSets.DropDownControl.BeforeExpand += new TreeViewCancelEventHandler(vlnTreeComboSets_BeforeExpand); + + #region CheckIfNeeded Commented Out + //vlnTreeComboSets.DropDownControl. = vlnTreeComboSets.Width; + // The DropDownNode should be at a DocVersion now. The expanded DocVersion + // is the one that matches mydocversion + //tmpfi = mydocversion.ActiveParent as FolderInfo; + //DocVersionInfoList dvlist = tmpfi.FolderDocVersions; + //DropDownNode tnDV = null; + // Once at a docversions, only allow working + // draft sets. Use DocVersion that we're in, to expand it showing the active procedure. + // first count how many versions can be displayed, i.e. only workingdraft? + // if more than one, put out a tree node for them. + //int cntdocv = 0; + //foreach (DocVersionInfo dv in dvlist) + //{ + // if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) cntdocv++; + + //} + //if (cntdocv>1) + //{ + // foreach (DocVersionInfo dv in dvlist) + // { + // if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) + // { + // DropDownNode tn = new DropDownNode(dv.VersionID, dv.ToString()); + // tn.Tag = dv; + // if (topnode != null) + // topnode.Nodes.Add(tn); + // else + // vlnTreeComboSets.DropDownControl.Nodes.Add(tn); + // if (dv.VersionID == mydocversion.VersionID) + // { + // tnDV = tn; + // vlnTreeComboSets.Value = tnDV; + // vlnTreeComboSets.DropDownControl.SelectedNode = tnDV; + + // } + // //else if (dv.HasChildren) // allow for '+' for tree expansion + // //{ + // // DropDownNode tnt = new DropDownNode(0,"VLN_DUMMY"); + // // tn.Nodes.Add(tnt); + // //} + // } + // } + //} + #endregion } private void ListBoxTranFmtFillIn() { @@ -133,6 +251,7 @@ namespace Volian.Controls.Library private void tvTranFillIn(ItemInfo startitm) { tvTran.Nodes.Clear(); + if (startitm == null) return; // if the transition to point is a section or procedure, just return if (startitm.MyContent.Type < 20000) return; @@ -151,120 +270,221 @@ namespace Volian.Controls.Library { VETreeNode tvn = new VETreeNode(startitm); tvn.Tag = startitm; - int active = this.tvTran.Nodes.Add(tvn); //new VETreeNode(curitm)); + int active = this.tvTran.Nodes.Add(tvn); if (startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active]; startitm = (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null); } tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand); } - private void listBoxTranSectsFillIn(ItemInfo secitm, int sectstart) + private void cbTranSectsFillIn(ItemInfo secitm, int secstart) { - listBoxTranSects.Items.Clear(); - // if the transition point 'to' is a procedure, don't list sections yet. - if (secitm.MyContent.Type < 10000) return; + cbTranSects.Items.Clear(); + // if the transition points 'to' procedure, don't list the sections yet. + if (secitm == null || secitm.MyContent.Type < 10000) return; // if sectstart is not -1, then use this as the section to select, otherwise // use the id for the item passed in. - int startitm = sectstart; - if (sectstart < 0) sectstart = secitm.ItemID; + int startitm = secstart; + if (secstart < 0) secstart = secitm.ItemID; ItemInfo selitm = secitm; // this is the selected 'section' secitm = secitm.FirstSibling; while (secitm != null) { - int active = listBoxTranSects.Items.Add(secitm); - if (secitm.ItemID == sectstart) listBoxTranSects.SelectedIndex = active; + // if the selected transition format requires a step be selected (show only step sections), only add step sections + E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; + if (((!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) && secitm.IsStepSection) || + ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) + { + int active = cbTranSects.Items.Add(secitm); + if (secitm.ItemID == secstart) cbTranSects.SelectedIndex = active; + } secitm = (secitm.NextItemCount > 0 ? secitm.NextItems[0] : null); } } - private void listBoxTranProcsFillIn(ItemInfo prcitm) + private void cbTranProcsFillIn(ItemInfo prcitm) { - listBoxTranProcs.Items.Clear(); + cbTranProcs.Items.Clear(); ItemInfo selitm = prcitm; // this is the selected 'section' prcitm = prcitm.FirstSibling; while (prcitm != null) { - int active = listBoxTranProcs.Items.Add(prcitm); + int active = cbTranProcs.Items.Add(prcitm); if (_CurrentProcedure.ContentID == prcitm.MyContent.ContentID) _CurrentProcIndex = active; - if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) listBoxTranProcs.SelectedIndex = active; + if (prcitm.MyContent.ContentID == selitm.MyContent.ContentID) cbTranProcs.SelectedIndex = active; prcitm = (prcitm.NextItemCount > 0 ? prcitm.NextItems[0] : null); } } private void SetControlsEnabling() { - if (CurProcSet) - { - groupPanelTranFmt.Visible = true; - groupPanelTransitionProcs.Visible = true; - groupPanelTransitionSect.Visible = true; - groupPanelTranstionSteps.Visible = true; - groupPanelProcSets.Visible = false; - tvProcSets.Visible = false; + // Based on selection & enum representing the transition format, determine the enabling of associated controls + if (_CurItemFrom == null) return; + int indx = listBoxTranFmt.SelectedIndex; + if (listBoxTranFmt.SelectedIndex < 0 || listBoxTranFmt.SelectedIndex > listBoxTranFmt.Items.Count) indx = 0; + E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].TransUI; - // Determine, based on selection, i.e. select proc/section and disable associated list boxes if - // enum representing the transition restricts the selection. - if (_CurItemFrom == null) return; - int indx = listBoxTranFmt.SelectedIndex; - if (listBoxTranFmt.SelectedIndex < 0 || listBoxTranFmt.SelectedIndex > listBoxTranFmt.Items.Count) indx = 0; - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[indx].TransUI; - // do the procedure list box. (in 16-bit system it was types 0, 3, 5 - if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu) - listBoxTranProcs.Enabled = true; - else - { - listBoxTranProcs.SelectedIndex = _CurrentProcIndex > 0 ? _CurrentProcIndex : 0; - listBoxTranProcs.Enabled = false; - } - - // in 16-bit system it was types 0, 3, 4, 5 - if (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) || - ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) || - ((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep)) - { - // find default step section and make it the selected item - then disable from further selection. - //listBoxTranSects.SelectedIndex = 1; // TEMP until default step section found. - listBoxTranSects.Enabled = true; - } - else - listBoxTranSects.Enabled = false; + // do the set tree/combo & procedure combo. in 16-bit system it was types 0, 3, 5 + vlnTreeComboSets.Enabled = false; + if ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu) + { + if (!_AlwaysDisableSets)vlnTreeComboSets.Enabled = true; + cbTranProcs.Enabled = true; } else { - groupPanelTranFmt.Visible = false; - groupPanelTransitionProcs.Visible = false; - groupPanelTransitionSect.Visible = false; - groupPanelTranstionSteps.Visible = false; - groupPanelProcSets.Visible = true; - tvProcSets.Visible = true; - tvProcSets.Dock = DockStyle.Top; - return; + cbTranProcs.SelectedIndex = _CurrentProcIndex > 0 ? _CurrentProcIndex : 0; + cbTranProcs.Enabled = false; } - } - private void ClearControls() - { - listBoxTranFmt.Items.Clear(); - listBoxTranProcs.Items.Clear(); - listBoxTranSects.Items.Clear(); - tvTran.Nodes.Clear(); - _TranFmtIndx = 0; + + // Do section combo, in 16-bit system it was types 0, 3, 4, 5 + if (cbTranSects.Items.Count>0 && + (((etm & E_TransUI.SectDefault) == E_TransUI.SectDefault) || + ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) || + ((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep))) + { + cbTranSects.Enabled = true; + } + else + cbTranSects.Enabled = false; + + // check for range - if no range, then range button/label & step tree selections should be + // 'cleared/invisble'. + _DoingRange = false; + if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) _DoingRange = true; + btnTranRangeClear.Visible = _DoingRange; + lblxTranRangeTip.Visible = _DoingRange; + lblxTranRangeTip.BackColor = _RangeColor; + // if any previous nodes selected for range - clear them here + if (!_DoingRange && _RangeNode1 != null) ClearRangeTransition(); + + // Always allow for step selection if there are items. + if (tvTran.Nodes.Count>0)tvTran.Enabled = true; } #endregion #region Events + private void vlnTreeComboSets_BeforeExpand(object sender, TreeViewCancelEventArgs e) + { + DropDownNode par = ((DropDownNode)e.Node); + // get first child's text, if it has one & if the text is VLN_DUMMY, load children + DropDownNode tn = null; + if (par.Nodes.Count > 0) tn = (DropDownNode)par.Nodes[0]; + if (tn.Text == "VLN_DUMMY") // expand this + { + par.Nodes.Clear(); + Object obj = par.Tag; + if (!(obj is FolderInfo)) return; // should always be folderinfo on expand + FolderInfo fi = (FolderInfo)obj; + if (fi.ChildFolderCount > 0) + { + foreach (FolderInfo fic in fi.ChildFolders) + { + DropDownNode newnode = new DropDownNode(fic.FolderID, fic.ToString()); + par.Nodes.Add(newnode); + newnode.Tag = fic; + if (fic.HasChildren) // allow for '+' for tree expansion + { + DropDownNode tnt = new DropDownNode(0, "VLN_DUMMY"); + newnode.Nodes.Add(tnt); + } + } + } + else if (fi.FolderDocVersionCount > 0) + { + foreach (DocVersionInfo dv in fi.FolderDocVersions) + { + if ((VersionTypeEnum)dv.VersionType == VersionTypeEnum.WorkingDraft) + { + DropDownNode newnode = new DropDownNode(dv.VersionID, dv.ToString()); + newnode.Tag = dv; + par.Nodes.Add(newnode); + } + } + } + } + vlnTreeComboSets.Value = par; + vlnTreeComboSets.DropDownControl.SelectedNode = par; + } + private void DropDown_FinishEditing(object sender, DropDownValueChangedEventArgs e) + { + DropDownNode selnd = (DropDownNode)vlnTreeComboSets.DropDownControl.SelectedNode; + Object obj = selnd.Tag; + // only allow selections from proc, sect & step controls if the user has + // selected a folder with only 1 working draft docversion or has + // selected the docversion itself.... + bool defines_set = false; + FolderInfo fi = null; + if (obj is FolderInfo) + { + fi = (FolderInfo)obj; + if (fi.ChildFolderCount == 0) + { + // note that the folder may contain more than one docversion, check for + // only 1 working draft. + int cntwd = 0; + foreach (DocVersionInfo dvt in fi.FolderDocVersions) + { + if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) cntwd++; + } + if (cntwd == 1) defines_set = true; + } + } + else if (obj is DocVersionInfo) + defines_set = true; + if (!defines_set) + { + MessageBox.Show("Based on your selection, cannot get list of procedures, narrow the procedure set selection."); + // disable ALL other controls + cbTranProcs.Enabled = false; + cbTranSects.Enabled = false; + tvTran.Enabled = false; + return; + } + + // get to DocVersion node, if at folder... If there are no procedures, notify + // the user and return (a transition must at least go to a procedure). + // Otherwise, enable/disable controls based on format type of transition. + DocVersionInfo dv = null; + if (fi != null) + { + foreach (DocVersionInfo dvt in fi.FolderDocVersions) + { + if ((VersionTypeEnum)dvt.VersionType == VersionTypeEnum.WorkingDraft) + { + dv = dvt; + break; + } + } + } + else + dv = (DocVersionInfo)obj; + if (dv.Procedures.Count < 1) + { + MessageBox.Show("There are no procedures in this set. Cannot insert a transition within it."); + cbTranProcs.Enabled = false; + cbTranSects.Enabled = false; + tvTran.Enabled = false; + return; + } + cbTranProcsFillIn(dv.Procedures[0]); + cbTranProcs.SelectedIndex = 0; + SetControlsEnabling(); + } private void listBoxTranFmt_Click(object sender, EventArgs e) { if (_InitializingTrans) return; if (listBoxTranFmt.SelectedIndex == _TranFmtIndx) return; - // if resetting format selection, null out the selected transitions. - _tranitem1 = null; - _tranitem2 = null; - if (_RangeNode1 != null) + + if (_RangeNode1 != null) ClearRangeTransition(); + // if this selection needs a step, the section list may need to updated with step only sections, + // list the step sections of the current procedure..... + E_TransUI etmprev = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; + E_TransUI etmnew = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; + if (((etmnew & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone) != ((etmprev & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) { - _RangeNode1.BackColor = tvTran.BackColor; - _RangeNode1 = null; + int sectstartid = FindSectionStart(_CurrentProcedure); + IList chldrn = _CurrentProcedure.GetChildren(); + if (chldrn != null && chldrn.Count > 0) cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid); } _TranFmtIndx = listBoxTranFmt.SelectedIndex; - SetControlsEnabling(); - - tvTran.Enabled = true; } private void btnUp1_Click(object sender, EventArgs e) { @@ -278,12 +498,12 @@ namespace Volian.Controls.Library VETreeNode tn = ((VETreeNode)e.Node); tn.LoadChildren(false); } - private void listBoxTranSects_SelectedIndexChanged(object sender, EventArgs e) + private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e) { if (_InitializingTrans) return; // a different section was selected, if step section, update step list, otherwise, empty // it & disable. - ItemInfo secitm = (ItemInfo)listBoxTranSects.SelectedItem; + ItemInfo secitm = (ItemInfo)cbTranSects.SelectedItem; if (!secitm.IsStepSection) { tvTran.Nodes.Clear(); @@ -291,28 +511,73 @@ namespace Volian.Controls.Library } else { + _InitializingTrans = true; // just initializing now, don't set any ranges, etc. tvTranFillIn(secitm.Steps[0]); tvTran.Enabled = true; + _InitializingTrans = false; } } - private void listBoxTranProcs_SelectedIndexChanged(object sender, EventArgs e) + private int FindSectionStart(ItemInfo prcitm) { - if (_InitializingTrans) return; - ItemInfo prcitm = (ItemInfo)listBoxTranProcs.SelectedItem; - ProcedureConfig pc = (ProcedureConfig)prcitm.MyConfig; int sectstartid = -1; - if (pc != null) sectstartid = System.Convert.ToInt32(pc.SectionStart); - IList chldrn = prcitm.GetChildren(); - listBoxTranSectsFillIn((ItemInfo)chldrn[0], sectstartid); + string ss = pc == null ? null : pc.SectionStart; + if (ss != null) sectstartid = System.Convert.ToInt32(ss); + return sectstartid; } - private void btnTranInsert_Click(object sender, EventArgs e) + private void cbTranProcs_SelectedIndexChanged(object sender, EventArgs e) + { + if (_InitializingTrans) return; + ItemInfo prcitm = (ItemInfo)cbTranProcs.SelectedItem; + if (prcitm == null || prcitm.Sections == null || prcitm.Sections.Count < 1) + { + cbTranSects.Items.Clear(); + tvTran.Nodes.Clear(); + return; + } + int sectstartid = FindSectionStart(prcitm); + IList chldrn = prcitm.GetChildren(); + cbTranSectsFillIn((ItemInfo)chldrn[0], sectstartid); + } + private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) + { + if (_InitializingTrans) return; + if (_DoingRange) + { + if (_RangeNode1 == null || (_RangeNode1 != null && _RangeNode2 != null)) + { + if (_RangeNode1 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); + tvTran.SelectedNode.BackColor = _RangeColor; + _RangeNode1 = (VETreeNode)tvTran.SelectedNode; + _RangeNode2 = null; + lblxTranRangeTip.Text = "Select Last Step \r\nfor Range"; + } + else + { + if (_RangeNode2 != null) tvTranRangeHilites(false, _RangeNode1, _RangeNode2); + _RangeNode2 = (VETreeNode)tvTran.SelectedNode; + tvTran.SelectedNode.BackColor = _RangeColor; + tvTranRangeHilites(true, _RangeNode1, _RangeNode2); + lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; + } + } + } + private void btnTranCancel_Click(object sender, EventArgs e) + { + _CurItemFrom = _SavCurItemFrom; + _TranFmtIndx = _SavTranFmtIndx; + TransitionFillIn(); + } + private void btnTranRangeClear_Click(object sender, EventArgs e) + { + ClearRangeTransition(); + } + private void btnTranSave_Click(object sender, EventArgs e) { string trantxt = "{Resolved Transition Text}"; string linktxt = null; - //int type = (int)(_CurItem.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].Type); E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - // do the procedure list box. (in 16-bit system it was types 0, 3, 5 + // if must have a step, test for this first. if (!((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone)) // _tranitem1 is set from step tree node. { if (tvTran.SelectedNode==null) @@ -320,25 +585,26 @@ namespace Volian.Controls.Library MessageBox.Show("Must 'Select Step' for transition 'to'"); return; } - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem1 = (ItemInfo) vtn.VEObject; // is this cast valid? - linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID); } - else if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) //range + ItemInfo _tranitem1 = null; + ItemInfo _tranitem2 = null; + if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) //range { - if (_tranitem1==null) + if (_RangeNode1==null) { MessageBox.Show("Must 'Select Step' for transition 'to'"); return; } + _tranitem1 = (ItemInfo)_RangeNode1.VEObject; // Get the second item in the range, based on current tree view selection. - if (tvTran.SelectedNode == null) + if (_RangeNode2 == null && tvTran.SelectedNode == null) { MessageBox.Show("Must 'Select Step' for range transition 'to'"); return; } - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem2 = (ItemInfo)vtn.VEObject; // is this cast valid? + if (_RangeNode2 == null) _RangeNode2 = (VETreeNode)tvTran.SelectedNode; + _tranitem2 = (ItemInfo)_RangeNode2.VEObject; + // Check that the two items are of the below the section type. if (_tranitem1.MyContent.Type < 20000 || _tranitem2.MyContent.Type < 20000) { @@ -346,142 +612,138 @@ namespace Volian.Controls.Library return; } linktxt = string.Format("#Link:Transition: {0} xx {1} {2}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID, _tranitem2.ItemID); - } - else if ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) + else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst) + { + VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; + if (vtn != null) + { + _tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid? + linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID); + } + } + if (_tranitem1 == null && (etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) { if (tvTran.Enabled == false || _tranitem1.IsAccPages) - _tranitem1 = (ItemInfo)listBoxTranSects.SelectedItem; + _tranitem1 = (ItemInfo)cbTranSects.SelectedItem; else { VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid? + _tranitem1 = (ItemInfo)vtn.VEObject; } if (_tranitem1==null) { MessageBox.Show("Must 'Select Section' or 'Select Step' for transition 'to'"); return; } - // check that item is a valid type based on transition type selected from format, i.e. section versus step, etc. - //if (type < 4 && _tranitem1.MyContent.Type < 20000) - //{ - // MessageBox.Show("Must select a step type item for this transition format type"); - // return; - //} + linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID); + } + if (_tranitem1 == null && (((etm & E_TransUI.ProcCur) == E_TransUI.ProcCur) || ((etm & E_TransUI.ProcMenu) == E_TransUI.ProcMenu))) + { + _tranitem1 = (ItemInfo)cbTranProcs.SelectedItem; + if (_tranitem1 == null) + { + MessageBox.Show("Must select an item for transition 'to'"); + return; + } linktxt = string.Format("#Link:Transition: {0} xx {1}", listBoxTranFmt.SelectedIndex, _tranitem1.ItemID); } _MyRTB.InsertTran(trantxt, linktxt); } #endregion - - private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) + #region VariousSupportMethods + private void ClearRangeTransition() { - if (_InitializingTrans) return; - if (_RangeNode1 == null) + if (_RangeNode1 == null && _RangeNode2 == null) return; + tvTranRangeHilites(false, _RangeNode1, _RangeNode2); + lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; + _RangeNode1 = _RangeNode2 = null; + } + private void tvTranRangeHilites(bool on, VETreeNode node1, VETreeNode node2) + { + if (node1==null && node2==null) return; + if (node1 != null && node2 == null) { - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid? - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; + node1.BackColor = on ? _RangeColor : tvTran.BackColor; + return; + } - // if this is a range, we'll denote the first 'to' item with color on the - // tree view. - if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) + // If node2 is below node1 in the tree switch them... get to high level step & + // then just walk down tree. + ItemInfo itm1 = (ItemInfo)node1.VEObject; + ItemInfo itm2 = (ItemInfo)node2.VEObject; + while (!itm1.IsHigh) itm1 = itm1.MyParent; + while (!itm2.IsHigh) itm2 = itm2.MyParent; + ItemInfoList itmlst = (ItemInfoList)itm1.MyParent.GetChildren(); + int i1 = -1; + int i2 = -1; + int cnt = 1; + foreach (ItemInfo chld in itmlst) + { + if (chld.ItemID == itm1.ItemID) i1 = cnt; + if (chld.ItemID == itm2.ItemID) i2 = cnt; + cnt++; + if (i1 != -1 && i2 != -1) break; + } + if (i1 > i2) + { + VETreeNode t = node2; + node2 = node1; + node1 = t; + } + // Turn Hilighting on/off (depending on bool argument) between the two nodes + // they may be at different tree levels. + + // find common parent level first and save the 'top parent' node for each selection. + VETreeNode tmp1 = node1; + VETreeNode tmp2 = node2; + // loop, walking up node2's tree checking against node1. If not found, go to node1 + // parent, etc. + bool foundcommon = false; + while (!foundcommon && tmp1 != null) + { + while (!foundcommon & tmp2 != null) { - tvTran.SelectedNode.BackColor = Color.Aquamarine; - _RangeNode1 = vtn; - return; + if (tmp1.Parent == tmp2.Parent) foundcommon = true; + else tmp2 = (VETreeNode)tmp2.Parent; } - else + if (!foundcommon) { - return; + tmp2 = node2; + tmp1 = (VETreeNode)tmp1.Parent; } } - else + + // work down from node1. + VETreeNode cur = node1; + while (cur != null) { - _tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem; - if (tvTran.Enabled == false || _tranitem2.IsAccPages) - _tranitem2 = (ItemInfo)listBoxTranSects.SelectedItem; - else - _tranitem2 = (ItemInfo)tvTran.SelectedNode.Tag; + cur.BackColor = on ? _RangeColor : tvTran.BackColor; + cur = (VETreeNode)(cur.NextNode == null ? cur.Parent : cur.NextNode); + // if these nodes were at the same level, then stop after the current node = range2 + if (cur == tmp1) cur = null; // stop at top + if (cur == tmp2) tmp1 = cur = null; } - TreeNode tn = tvTran.SelectedNode; - tn.BackColor = Color.Aquamarine; - } - - private void tvTran_NodeSelectionChange(object sender, vlnTreeEventArgs args) - { - if (_InitializingTrans) return; - if (_RangeNode1 == null) + // set background for highest level between two nodes. + cur = tmp1==null?null:(VETreeNode)tmp1.NextNode; + while (cur != null) { - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid? - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - // if this is a range, we'll denote the first 'to' item with color on the - // tree view. - if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) - { - tvTran.SelectedNode.BackColor = Color.Aquamarine; - _RangeNode1 = vtn; - return; - } + cur.BackColor = on ? _RangeColor : tvTran.BackColor; + cur = (VETreeNode)cur.NextNode; + if (cur == tmp2) cur = null; - else - { - return; - } } - } - - private void tvTran_MouseClick(object sender, MouseEventArgs e) - { - if (_InitializingTrans) return; - if (_RangeNode1 == null) + // finish subtree of second node in range. + cur = tmp2==node2?null:node2; + while (cur != null) { - VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - _tranitem1 = (ItemInfo)vtn.VEObject; // is this cast valid? - E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; - // if this is a range, we'll denote the first 'to' item with color on the - // tree view. - if ((etm & E_TransUI.StepLast) == E_TransUI.StepLast) - { - tvTran.SelectedNode.BackColor = Color.Aquamarine; - _RangeNode1 = vtn; - return; - } - - else - { - return; - } + cur.BackColor = on ? _RangeColor : tvTran.BackColor; + cur = (VETreeNode)(cur.PrevNode == null ? cur.Parent : cur.PrevNode); + if (cur == tmp2) cur = null; // stop at top } + // hilite last selection.. + tmp2.BackColor = on ? _RangeColor : tvTran.BackColor; } - - private void btnNewTrans_Click(object sender, EventArgs e) - { - _CurItemFrom = _MyRTB.MyItem; - _CurTrans = null; - _TranFmtIndx = 0; - TransitionFillIn(); - } - private void LoadProcSetTree() - { - VETreeNode tn = VETreeNode.GetFolder(1); - tvProcSets.Nodes.Add(tn); - tn.LoadChildren(true); - tvProcSets.BeforeExpand += new TreeViewCancelEventHandler(tvProcSet_BeforeExpand); - } - private void tvProcSet_BeforeExpand(object sender, TreeViewCancelEventArgs e) - { - VETreeNode tn = ((VETreeNode)e.Node); - tn.LoadChildren(true); - } - private void cbCurProcSet_CheckedChanged(object sender, EventArgs e) - { - CurProcSet = cbCurProcSet.Checked; - if (!CurProcSet && tvProcSets.Nodes.Count == 0) LoadProcSetTree(); - SetControlsEnabling(); - } - - + #endregion } } diff --git a/PROMS/Volian.Controls.Library/DropDownNode.cs b/PROMS/Volian.Controls.Library/DropDownNode.cs new file mode 100644 index 00000000..93aa4345 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DropDownNode.cs @@ -0,0 +1,66 @@ +using System; +using System.Windows.Forms; + +using AT.STO.UI.Win; + +namespace Volian.Controls.Library +{ + internal class DropDownNode : TreeNode, ILookupItem + { + #region Private Variable Declarations + private long _id = 0; + #endregion + #region Constructor / Destructor + /// + /// Default constructor. + /// + public DropDownNode() : base() + { + } + + /// + /// /// + /// Some constructors initializing the node with Id. + /// + /// + /// + /// + public DropDownNode(long Id, string Text) : base(Text) + { + _id = Id; + } + + public DropDownNode(long Id, string Text, DropDownNode[] Children) : base(Text, Children) + { + _id = Id; + } + + public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex) : base(Text, ImageIndex, SelectedImageIndex) + { + _id = Id; + } + + public DropDownNode(long Id, string Text, int ImageIndex, int SelectedImageIndex, DropDownNode[] Children) : base(Text, ImageIndex, SelectedImageIndex, Children) + { + _id = Id; + } + #endregion + #region Public Methods + public override string ToString() + { + return this.GetType().Name + " (Id=" + Id.ToString() + ", Name=" + Text + ")"; + } + #endregion + #region ILookupItem Implementation + public long Id + { + get { return _id; } + } + + public new string Text + { + get { return base.Text; } + } + #endregion + } +} diff --git a/PROMS/Volian.Controls.Library/DropDownTree.cs b/PROMS/Volian.Controls.Library/DropDownTree.cs new file mode 100644 index 00000000..30a66218 --- /dev/null +++ b/PROMS/Volian.Controls.Library/DropDownTree.cs @@ -0,0 +1,86 @@ +using System; +using System.Windows.Forms; + +using AT.STO.UI.Win; + +namespace Volian.Controls.Library +{ + internal class DropDownTree : TreeView, IDropDownAware + { + #region DropDownTree + public DropDownTree() + { + this.Dock = DockStyle.Top; + } + #endregion + #region TreeView Events + /// + /// Allow keeping track of the editing process. + /// + /// + protected override void OnAfterSelect(TreeViewEventArgs e) + { + base.OnAfterSelect(e); + + if (ValueChanged != null) + { + ValueChanged(this, new DropDownValueChangedEventArgs(e.Node)); + } + } + /// + /// A double click on a node counts as finish editing. + /// + /// + protected override void OnDoubleClick(EventArgs e) + { + base.OnDoubleClick(e); + + TreeNode node = HitTest(PointToClient(Cursor.Position)).Node; + + if ((FinishEditing != null) && (node != null)) + { + FinishEditing(this, new DropDownValueChangedEventArgs(node)); + } + } + + /// + /// ENNTER counts as finish editing, ESC as cancel (null is returned). + /// + /// + protected override void OnKeyUp(KeyEventArgs e) + { + base.OnKeyUp(e); + + if (FinishEditing != null) + { + switch (e.KeyCode) + { + case Keys.Enter: + FinishEditing(this, new DropDownValueChangedEventArgs(Value)); + break; + case Keys.Escape: + FinishEditing(this, new DropDownValueChangedEventArgs(null)); + break; + } + } + } + #endregion + #region IDropDownAware Implementation + public event DropDownValueChangedEventHandler FinishEditing; + public event DropDownValueChangedEventHandler ValueChanged; + + public object Value + { + get { return base.SelectedNode; } + set + { + if (value is DropDownNode) + { + base.SelectedNode = value as DropDownNode; + } + } + } + + #endregion + } +}