diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs b/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs index 4b06295e..bc5ed09d 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.Designer.cs @@ -106,6 +106,7 @@ namespace Volian.Controls.Library // this.btnTranCancel.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnTranCancel.AutoSize = true; + this.btnTranCancel.CallBasePaintBackground = true; this.btnTranCancel.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnTranCancel.Dock = System.Windows.Forms.DockStyle.Right; this.btnTranCancel.Location = new System.Drawing.Point(407, 0); @@ -122,6 +123,7 @@ namespace Volian.Controls.Library // this.btnTranSave.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; this.btnTranSave.AutoSize = true; + this.btnTranSave.CallBasePaintBackground = 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); @@ -477,6 +479,7 @@ namespace Volian.Controls.Library // btnTranRangeClear // this.btnTranRangeClear.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnTranRangeClear.CallBasePaintBackground = true; this.btnTranRangeClear.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground; this.btnTranRangeClear.Dock = System.Windows.Forms.DockStyle.Left; this.btnTranRangeClear.Location = new System.Drawing.Point(57, 0); @@ -491,6 +494,7 @@ namespace Volian.Controls.Library // btnUp1 // this.btnUp1.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton; + this.btnUp1.CallBasePaintBackground = true; 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; diff --git a/PROMS/Volian.Controls.Library/DisplayTransition.cs b/PROMS/Volian.Controls.Library/DisplayTransition.cs index 917a2948..2dfd244f 100644 --- a/PROMS/Volian.Controls.Library/DisplayTransition.cs +++ b/PROMS/Volian.Controls.Library/DisplayTransition.cs @@ -36,6 +36,7 @@ namespace Volian.Controls.Library if (_CurTrans == value) return; _TranFmtIndx = value.TranType; _CurItemFrom = MyRTB.MyItemInfo; + btnTranSave.Enabled = btnTranCancel.Enabled = false; } _CurTrans = value; _SavCurItemFrom = _CurItemFrom; @@ -111,6 +112,7 @@ namespace Volian.Controls.Library _InitializingTrans = true; if (_RangeNode1 != null || _RangeNode2 != null) ClearRangeTransition(); InitControls(); + btnTranCancel.Enabled = false; _InitializingTrans = false; } private void InitControls() @@ -395,30 +397,45 @@ namespace Volian.Controls.Library } private void tvTranFillIn(ItemInfo startitm) { + bool nostep = false; tvTran.Nodes.Clear(); groupPanelTranstionSteps.Style.BackColor = _OrigGroupPanelSteps; if (startitm == null) return; // if the transition to point is a section or procedure, just return - if (startitm.MyContent.Type < 20000) return; + if (startitm.MyContent.Type < 20000) nostep = true; groupPanelTranstionSteps.Style.BackColor = Color.Cornsilk; // For the tree view, use parent, unless already at HLS. If at HLS, use this level. ItemInfo selitm = startitm; - if (_CurTrans == null) + if (!nostep) { - if (!startitm.IsHigh) + if (_CurTrans == null) { - startitm = startitm.MyParent; - selitm = startitm; + if (!startitm.IsHigh) + { + startitm = startitm.MyParent; + selitm = startitm; + } } } + else + selitm = null; + E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; + // no step + VETreeNode nost = null; + if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone) + { + VETreeNode tvn = new VETreeNode("No step"); + tvTran.Nodes.Add(tvn); + nost = tvn; + } startitm = startitm.FirstSibling; while (startitm != null) { VETreeNode tvn = new VETreeNode(startitm); tvn.Tag = startitm; int active = this.tvTran.Nodes.Add(tvn); - if (startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active]; + if (nost == null && startitm.ItemID == selitm.ItemID) tvTran.SelectedNode = tvTran.Nodes[active]; startitm = (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null); } tvTran.BeforeExpand += new TreeViewCancelEventHandler(tvTran_BeforeExpand); @@ -494,7 +511,7 @@ namespace Volian.Controls.Library // 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.SectDefault) == E_TransUI.SectDefault) || ((etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) || ((etm & E_TransUI.SectMenuStep) == E_TransUI.SectMenuStep))) { @@ -502,8 +519,10 @@ namespace Volian.Controls.Library groupPanelTransitionSect.Style.BackColor = Color.Cornsilk; } else + { cbTranSects.Enabled = false; - + } + // check for range - if no range, then range button/label & step tree selections should be // 'cleared/invisble'. btnTranRangeClear.Visible = _DoingRange; @@ -647,12 +666,32 @@ namespace Volian.Controls.Library groupPanelTranFmt.Style.BackColor = (_CurTrans == null && _TranFmtIndx == 0) ? Color.Yellow : Color.Orange; E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; _DoingRange = (etm & E_TransUI.StepLast) == E_TransUI.StepLast; + // get section selected and if it's a step section, fill in the treeview of steps + if (cbTranSects.Items.Count > 0) + { + ItemInfo secitm = (ItemInfo) cbTranSects.SelectedItem; + if (secitm == null || !secitm.IsStepSection) + { + tvTran.Nodes.Clear(); + tvTran.Enabled = false; + } + else + { + _InitializingTrans = true; // just initializing now, don't set any ranges, etc. + tvTranFillIn(secitm.Steps[0]); + tvTran.Enabled = true; + _InitializingTrans = false; + } + } SetControlsEnabling(); } private void btnUp1_Click(object sender, EventArgs e) { + // if StepAllowNone, then use the second node in the tree view. + int indx = 0; + if (tvTran.Nodes[0].Tag == null) indx = 1; // if at HLS, don't do anything. - ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[0]).VEObject; + ItemInfo curitm = (ItemInfo)((VETreeNode)tvTran.Nodes[indx]).VEObject; if (curitm.IsHigh) return; tvTranFillIn(curitm); } @@ -661,6 +700,7 @@ namespace Volian.Controls.Library VETreeNode tn = ((VETreeNode)e.Node); // true fixes empty expand, but allows for transitions 'way down' in RNO tree. HVJ & PAL wanted to // allow this (12/2/09) + tn.ChildrenLoaded = false; tn.LoadChildren(true); } private void cbTranSects_SelectedIndexChanged(object sender, EventArgs e) @@ -673,6 +713,10 @@ namespace Volian.Controls.Library { tvTran.Nodes.Clear(); tvTran.Enabled = false; + // Set Save & Cancel enabling, depending on whether section can be an endpoint. + E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[_TranFmtIndx].TransUI; + bool noStepNeeded = (etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone; + SaveCancelEnabling(noStepNeeded, secitm); } else { @@ -707,18 +751,24 @@ namespace Volian.Controls.Library private void tvTran_AfterSelect(object sender, TreeViewEventArgs e) { if (_InitializingTrans) return; + E_TransUI etm = (E_TransUI)_CurItemFrom.ActiveFormat.PlantFormat.FormatData.TransData.TransTypeList[listBoxTranFmt.SelectedIndex].TransUI; + if ((etm & E_TransUI.StepAllowNone) == E_TransUI.StepAllowNone && tvTran.SelectedNode.Tag==null) + { + btnTranSave.Enabled = true; + return; + } // check if node is a true end-point, i.e. not a 'part' node. If part node, don't // allow selection. bool allowSave = false; VETreeNode vt = tvTran.SelectedNode as VETreeNode; + ItemInfo selii = vt.VEObject as ItemInfo; if (vt != null) { - ItemInfo ii = vt.VEObject as ItemInfo; - if (ii != null) allowSave = true; + if (selii != null) allowSave = true; } if (!_DoingRange) - { - btnTranSave.Enabled = allowSave; + { + SaveCancelEnabling(allowSave, selii); return; } if (!allowSave) @@ -736,6 +786,7 @@ namespace Volian.Controls.Library _RangeNode2 = null; lblxTranRangeTip.Text = "Select Last Step \r\nfor Range"; lblxTranRangeTip.BackColor = Color.LightPink; + btnTranSave.Enabled = false; } else { @@ -745,11 +796,29 @@ namespace Volian.Controls.Library tvTranRangeHilites(true, _RangeNode1, _RangeNode2); lblxTranRangeTip.Text = "Select First Transition\r\nfor Range"; lblxTranRangeTip.BackColor = Color.Yellow; + btnTranSave.Enabled = true; } } } + + private void SaveCancelEnabling(bool allowSave, ItemInfo selii) + { + btnTranSave.Enabled = allowSave; + if (CurTrans != null) + { + if (CurTrans.ToID == selii.ItemID) btnTranCancel.Enabled = btnTranSave.Enabled = false; + else + { + btnTranCancel.Enabled = true; + btnTranSave.Enabled = allowSave; + } + } + else btnTranSave.Enabled = allowSave; + } private void btnTranCancel_Click(object sender, EventArgs e) { + btnTranSave.Enabled = false; + btnTranCancel.Enabled = false; _CurItemFrom = _SavCurItemFrom; _TranFmtIndx = _SavTranFmtIndx; TransitionFillIn(); @@ -829,20 +898,22 @@ namespace Volian.Controls.Library else if ((etm & E_TransUI.StepFirst) == E_TransUI.StepFirst) { VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - if (vtn != null) + if (vtn != null && vtn.Tag != null) { toItem = (ItemInfo)vtn.VEObject; // is this cast valid? linktxt = string.Format("#Link:Transition:{0} {1}", listBoxTranFmt.SelectedIndex, toItem.ItemID); } } + // toItem may have been set in the 'Range' selection code above. if (toItem == null && (etm & E_TransUI.SectMenuAny) == E_TransUI.SectMenuAny) { - if (tvTran.Enabled == false || toItem.IsAccPages) + if (tvTran.Enabled == false || (toItem!=null && toItem.IsAccPages)) toItem = (ItemInfo)cbTranSects.SelectedItem; else { VETreeNode vtn = (VETreeNode)tvTran.SelectedNode; - toItem = (ItemInfo)vtn.VEObject; + if (vtn.Tag == null) toItem = (ItemInfo)cbTranSects.SelectedItem; + else toItem = (ItemInfo)vtn.VEObject; } if (toItem==null) { diff --git a/PROMS/Volian.Controls.Library/RTBAPI.cs b/PROMS/Volian.Controls.Library/RTBAPI.cs index aa493cb2..9c0ff76e 100644 --- a/PROMS/Volian.Controls.Library/RTBAPI.cs +++ b/PROMS/Volian.Controls.Library/RTBAPI.cs @@ -844,7 +844,7 @@ namespace Volian.Controls.Library public static void SetLineSpacing(RichTextBox richTextBox, ParaSpacing type) { ParaFormatTwo pft = GetParaFormat(richTextBox); - pft.bLineSpacingRule = type; // For now: RTBAPI.ParaSpacing.PFS_EXACT; + pft.bLineSpacingRule = type; pft.dwMask = 0; pft.dwMask |= ParaFormatMasks.PFM_LINESPACING; pft.dwMask |= ParaFormatMasks.PFM_SPACEAFTER; @@ -871,10 +871,8 @@ namespace Volian.Controls.Library ((cft.dwEffects & CharFormatEffects.CFE_UNDERLINE) == CharFormatEffects.CFE_UNDERLINE)) fs |= E_FontStyle.FS_UNDERLINE; if (((cft.dwMask & CharFormatMasks.CFM_ITALIC) == CharFormatMasks.CFM_ITALIC) && ((cft.dwEffects & CharFormatEffects.CFE_ITALIC) == CharFormatEffects.CFE_ITALIC)) fs |= E_FontStyle.FS_ITALIC; - if (((cft.dwMask & CharFormatMasks.CFM_SUPERSCRIPT) == CharFormatMasks.CFM_SUPERSCRIPT) && - ((cft.dwEffects & CharFormatEffects.CFE_SUPERSCRIPT) == CharFormatEffects.CFE_SUPERSCRIPT)) fs |= E_FontStyle.FS_SUPERSCRIPT; - if (((cft.dwMask & CharFormatMasks.CFM_SUBSCRIPT) == CharFormatMasks.CFM_SUBSCRIPT) && - ((cft.dwEffects & CharFormatEffects.CFE_SUBSCRIPT) == CharFormatEffects.CFE_SUBSCRIPT)) fs |= E_FontStyle.FS_SUBSCRIPT; + if (richTextBox.SelectionCharOffset == -2) fs |= E_FontStyle.FS_SUBSCRIPT; + if (richTextBox.SelectionCharOffset == 2) fs |= E_FontStyle.FS_SUPERSCRIPT; return fs; } public static void SetFontStyle(RichTextBox richTextBox, E_FontStyle fs) @@ -897,57 +895,35 @@ namespace Volian.Controls.Library } if ((fs & E_FontStyle.FS_SUBSCRIPT) == E_FontStyle.FS_SUBSCRIPT) { - cft.dwEffects |= CharFormatEffects.CFE_SUBSCRIPT; - cft.dwMask |= CharFormatMasks.CFM_SUBSCRIPT; + richTextBox.SelectionCharOffset = -2; } if ((fs & E_FontStyle.FS_SUPERSCRIPT) == E_FontStyle.FS_SUPERSCRIPT) { - cft.dwEffects |= RTBAPI.CharFormatEffects.CFE_SUPERSCRIPT; - cft.dwMask |= RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT; + richTextBox.SelectionCharOffset = 2; } SetCharFormat(richTextBox, RTBSelection.SCF_SELECTION, cft); } public static bool IsSuperScript(RichTextBox richTextBox) { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_SUPERSCRIPT) == CharFormatMasks.CFM_SUPERSCRIPT) && - ((cft.dwEffects & CharFormatEffects.CFE_SUPERSCRIPT) == CharFormatEffects.CFE_SUPERSCRIPT)); + return (richTextBox.SelectionCharOffset>0); } public static bool IsSubScript(RichTextBox richTextBox) { - CharFormatTwo cft = GetCharFormat(richTextBox, RTBSelection.SCF_SELECTION); - return (((cft.dwMask & CharFormatMasks.CFM_SUBSCRIPT) == CharFormatMasks.CFM_SUBSCRIPT) && - ((cft.dwEffects & CharFormatEffects.CFE_SUBSCRIPT) == CharFormatEffects.CFE_SUBSCRIPT)); + return (richTextBox.SelectionCharOffset < 0); } public static void ToggleSubscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) { - CharFormatTwo cft = GetCharFormat(richTextBox, selection); // RTBSelection.SCF_SELECTION); if (bSet) - { - cft.dwEffects = CharFormatEffects.CFE_SUBSCRIPT; - cft.dwMask = CharFormatMasks.CFM_SUBSCRIPT; - } + richTextBox.SelectionCharOffset = -2; else - { - cft.dwEffects = CharFormatEffects.CFE_NONE; - cft.dwMask = CharFormatMasks.CFM_SUBSCRIPT; - } - SetCharFormat(richTextBox, selection, cft); + richTextBox.SelectionCharOffset = 0; } public static void ToggleSuperscript(bool bSet, RichTextBox richTextBox, RTBSelection selection) { - CharFormatTwo cft = RTBAPI.GetCharFormat(richTextBox, selection); // RTBAPI.RTBSelection.SCF_SELECTION); if (bSet) - { - cft.dwEffects = RTBAPI.CharFormatEffects.CFE_SUPERSCRIPT; - cft.dwMask = RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT; - } + richTextBox.SelectionCharOffset = 2; else - { - cft.dwEffects = RTBAPI.CharFormatEffects.CFE_NONE; - cft.dwMask = RTBAPI.CharFormatMasks.CFM_SUPERSCRIPT; - } - SetCharFormat(richTextBox, selection, cft); + richTextBox.SelectionCharOffset = 0; } public static bool IsBold(RichTextBox richTextBox) { diff --git a/PROMS/Volian.Controls.Library/StepRTB.cs b/PROMS/Volian.Controls.Library/StepRTB.cs index 2c9bb944..0bec1701 100644 --- a/PROMS/Volian.Controls.Library/StepRTB.cs +++ b/PROMS/Volian.Controls.Library/StepRTB.cs @@ -720,7 +720,9 @@ namespace Volian.Controls.Library _SelectedRtfSB.Append(@"{\f1\fnil\fcharset0 VESymbFix;}}{\colortbl ;\red255\green0\blue0;}"); _SelectedRtfSB.Append("\r\n"); // use styles to construct rtf commands to insert into next line (where \b, etc is) - _SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; + //_SelectedRtfSB.Append(@"\viewkind4\uc1\pard\sl-240\slmult0" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; + _SelectedRtfSB.Append(@"\viewkind4\uc1\sb240\slmult0\pard" + sbbeg.ToString() + @"\fs" + Convert.ToInt32(this.Font.SizeInPoints * 2).ToString() + @" "); // \f0\fs" + this.Font.SizeInPoints * 2 + @" " + myDisplayTextElement.Text + @"}"; + } private bool FontIsFixed() @@ -2344,77 +2346,6 @@ namespace Volian.Controls.Library @"\u9508", // HEX@"\u2524",// Right Tee - 16-bit char: '\xB4' @"\u9532", // HEX@"\u253c" // + Plus - 16-bit char: '\xC5' }; - public static string Repeat(string str, int count) - { - StringBuilder lStr = new StringBuilder(); - for (int i = 0; i < count; i++) - lStr.Append(str); - return lStr.ToString(); - } - public void OutlineTable(bool withBorder) - { - if (_MyStepItem != null) // Set the width based upon the contents - { - int newwidth = (int)_MyStepItem.TableWidth(Font, Text, true); - if (_MyStepItem.ItemWidth != newwidth) - { - _MyStepItem.ItemWidth = newwidth; - } - } - // Determine the number of characters per line - int w = MaxCharacterWidth(); - //Console.WriteLine("'Row','last','Start','w2','w','w3','offset1','offset2'"); - string horzLine = Repeat(withBorder ? @"\u9472?" : " ", w); - // Determine the number of lines - int l = Lines.Length; - int lastoffset = 0; - for (int row = 0; row < Lines.Length; row++) - { - //string strb4 = Lines[row]; - //int spaces = w - line.Length; - int offset1 = GetFirstCharIndexFromLine(row); - if (lastoffset != offset1) - { - //Console.WriteLine("OFFSET MISMATCH {0},{1}", lastoffset, offset1); - offset1 = lastoffset; - } - Select(offset1, 0); - string cleanLine = RemoveLinkComments(Lines[row]); - int w2 = Lines[row].Length; - int w3 = cleanLine.Length; - int offset2 = SelectionStart + w2 + (w - w3) + 1; - lastoffset = offset2 + 2; - int selStart = SelectionStart; - SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}"; - Select(SelectionStart + w2, 0); - if (w3 < w) - { - SelectedText = "".PadRight(w - w3); - Select(offset2, 0); - } - SelectedRtf = RtfPrefix + (withBorder ? @"\u9474?" : " ") + "}"; - //string strafter = Lines[row]; - //Console.WriteLine("'{0}'\r\n'{1}'\r\n'{2}'", strb4, strafter,cleanLine); - //Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7}", row, selStart, SelectionStart, w2, w, w3, offset1, offset2); - } - // Add the top line - //if (_MyStepItem != null) - //{ - // Console.WriteLine("Char[0]={0:X}", (int)(Text[0])); - // _MyStepItem.ItemWidth = (int)_MyStepItem.TableWidth(Font, Text.Replace('\u2502','-'), false); - //} - //Console.WriteLine("After Edges\n{0}\n{1}", Rtf, Text); - Select(0, 0); - SelectedRtf = RtfPrefix + (withBorder ? @"\u9484?" : " ") + horzLine + (withBorder ? @"\u9488?\par " : @" \par ") + "}"; - // Add the bottom line - Select(TextLength, 0); - ContentsResized += new ContentsResizedEventHandler(StepRTB_ContentsResized); - SelectedRtf = RtfPrefix + (withBorder ? @"\par\u9492?" : @"\par ") + horzLine + (withBorder ? @"\u9496?" : @" ") + "}"; - ContentsResized -= new ContentsResizedEventHandler(StepRTB_ContentsResized); - //Console.WriteLine("After Top and Bottom\n{0}\n{1}", Rtf, Text); - ReplaceLinesInTable(withBorder); - - } private int MaxCharacterWidth() { // loop through lines and get the width in characters diff --git a/PROMS/Volian.Controls.Library/StepTabPanel.cs b/PROMS/Volian.Controls.Library/StepTabPanel.cs index 884fd483..ee77b754 100644 --- a/PROMS/Volian.Controls.Library/StepTabPanel.cs +++ b/PROMS/Volian.Controls.Library/StepTabPanel.cs @@ -165,6 +165,7 @@ namespace Volian.Controls.Library _ShowingItem = true; //if (ItemSelected != null) _MyStepPanel.ItemShow(); + _MyStepPanel.MyStepTabPanel.MyStepTabRibbon.SetUpdRoValBtn(_MyStepPanel.MyStepTabPanel.MyStepTabRibbon.NewerRoFst()); _ShowingItem = false; } /// diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.cs index d15284e3..c174872e 100644 --- a/PROMS/Volian.Controls.Library/StepTabRibbon.cs +++ b/PROMS/Volian.Controls.Library/StepTabRibbon.cs @@ -215,6 +215,7 @@ namespace Volian.Controls.Library void btnInsStep_Click(object sender, EventArgs e) { DevComponents.DotNetBar.ButtonItem b = (DevComponents.DotNetBar.ButtonItem)sender; + if (b.Tag == null) return; char [] sep = {' '}; string[] insdata = b.Tag.ToString().Split(sep); if (insdata.Length != 2) return; @@ -502,6 +503,23 @@ namespace Volian.Controls.Library if (sdl != null && sdl.Count > 0) { Char kt = 'A'; // start with letter A for KeyTips + // if doing the insert substep button, check for substeps already there and if so must match type. + if (btn.Name == "btnInsSubstep") + { + if (MyItemInfo.Steps != null) + { + ItemInfo ichld = MyItemInfo.Steps[0]; + btn.Click += new System.EventHandler(btnInsStep_Click); + Volian.Base.Library.vlnStackTrace.ShowStackLocal("btn", 2, 10); + btn.Tag = string.Format("{0} {1}", fromtype, ichld.MyContent.Type - 20000); + return; + } + else + { + btn.Tag = null; + btn.Click -= new System.EventHandler(btnInsStep_Click); + } + } foreach (StepDataRetval sdr in sdl) { bool addit = true; @@ -517,6 +535,7 @@ namespace Volian.Controls.Library if (btn.Name == "btnInsHLS" && sd.Type == "RNOType") addit = false; if (btn.Name == "btnInsCaut" && sd.Type.Length>=4 && sd.Type.Substring(0, 4) == "Note") addit = false; if (btn.Name == "btnInsNote" && sd.Type.Length>=7 && sd.Type.Substring(0, 7) == "Caution") addit = false; + if (btn.Name == "btnInsSubstep" && MyItemInfo.Steps != null) addit = false; if (addit) { DevComponents.DotNetBar.ButtonItem bi = new DevComponents.DotNetBar.ButtonItem("btn" + sd.Type, sd.Type); @@ -578,6 +597,7 @@ namespace Volian.Controls.Library } } } + rbnStepParts.Refresh(); } #endregion #region Insert Tab @@ -838,6 +858,7 @@ namespace Volian.Controls.Library ROFst newrofst = ROFstInfo.UpdateRoFst(roFstInfo.MyRODb, dv.DocVersionAssociations[0], dv, roFstInfo); StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("DisplayROUpdateROFST"); MyStepItem.MyStepPanel.OnTabDisplay(sender, args); + btnUpdROVal.Enabled = false; } Cursor = Cursors.Default; } @@ -846,17 +867,25 @@ namespace Volian.Controls.Library { btnUpdROVal.Enabled = false; if (MyDVI.DocVersionAssociations.Count < 1) return; - ROFstInfo roFstInfo = MyDVI.DocVersionAssociations[0].MyROFst; - RODbInfo rdi = RODbInfo.Get(roFstInfo.RODbID); - - string rofstPath = rdi.FolderPath + @"\ro.fst"; - if (!File.Exists(rofstPath)) return; - FileInfo fiRofst = new FileInfo(rofstPath); - if (roFstInfo.DTS == fiRofst.LastWriteTime) return; - if (roFstInfo.DTS > fiRofst.LastWriteTime) return; + if (!NewerRoFst()) return; btnUpdROVal.Enabled = true; } - + public bool NewerRoFst() + { + if (_MyDVI == null) return false; + ROFstInfo roFstInfo = _MyDVI.DocVersionAssociations[0].MyROFst; + RODbInfo rdi = RODbInfo.Get(roFstInfo.RODbID); + string rofstPath = rdi.FolderPath + @"\ro.fst"; + if (!File.Exists(rofstPath)) return false; + FileInfo fiRofst = new FileInfo(rofstPath); + if (roFstInfo.DTS == fiRofst.LastWriteTime) return false; + if (roFstInfo.DTS > fiRofst.LastWriteTime) return false; + return true; + } + public void SetUpdRoValBtn(bool en) + { + btnUpdROVal.Enabled = en; + } private void btnBookmarks_Click(object sender, EventArgs e) { StepPanelTabDisplayEventArgs args = new StepPanelTabDisplayEventArgs("Bookmarks"); diff --git a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs index 72a2b2ba..6ee420c4 100644 Binary files a/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs and b/PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs differ