diff --git a/PROMS/Volian.Controls.Library/AnnotationDetails.cs b/PROMS/Volian.Controls.Library/AnnotationDetails.cs index a867ae5a..e9f11f14 100644 --- a/PROMS/Volian.Controls.Library/AnnotationDetails.cs +++ b/PROMS/Volian.Controls.Library/AnnotationDetails.cs @@ -119,7 +119,6 @@ namespace Volian.Controls.Library UpdateAnnotationGrid(); //_AnnotationSearch.UpdateAnnotationSearchResults(); // update the search results } - } private void btnSaveAnnotation_Click(object sender, EventArgs e) @@ -244,6 +243,7 @@ namespace Volian.Controls.Library } FindCurrentAnnotation(); // position to the grid row of the current annotation _LoadingGrid = false; + if (_Annotations == null || _Annotations.Count == 0) btnRemoveAnnotation.Enabled = false; } /// diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 6ea164f5..4d6bc030 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -183,8 +183,8 @@ namespace Volian.Controls.Library if (_SavCurROLink != null) SavROLink = _SavCurROLink; ; lbROId.Text = chld.appid; - btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Equals(SavROLink))); - btnCancelRO.Enabled = ((_SavCurROLink != null) && !(chld.roid.Equals(SavROLink))); + btnSaveRO.Enabled = ((_SavCurROLink == null) || !(chld.roid.Substring(0, 12).ToLower().Equals(SavROLink.ROID.Substring(0, 12).ToLower()))); + btnCancelRO.Enabled = ((_SavCurROLink != null) && chld.roid.Substring(0, 12).ToLower() != SavROLink.ROID.Substring(0, 12).ToLower()); switch (chld.type) { case 1: // standard (regular) text RO type diff --git a/PROMS/Volian.Controls.Library/DisplayTags.cs b/PROMS/Volian.Controls.Library/DisplayTags.cs index b0fb0b12..61d90f77 100644 --- a/PROMS/Volian.Controls.Library/DisplayTags.cs +++ b/PROMS/Volian.Controls.Library/DisplayTags.cs @@ -42,7 +42,19 @@ namespace Volian.Controls.Library } _MyRTB = value; _CurItemInfo = MyRTB.MyItemInfo; - cbChgAll.Checked = !_CurItemInfo.IsHigh; + // only change all at level if all substeps are of same type + bool allSameType = true; + ItemInfo itmp = _CurItemInfo.FirstSibling; + while (itmp != null) + { + if (_CurItemInfo.MyContent.Type != itmp.MyContent.Type) + { + allSameType = false; + break; + } + itmp = itmp.NextItem; + } + cbChgAll.Checked = allSameType; TagsFillIn(); } } @@ -244,6 +256,7 @@ namespace Volian.Controls.Library if (_Initalizing) return; StepItem topStepItem = _MyRTB.MyStepItem; FormatData fmtdata = _CurItemInfo.ActiveFormat.PlantFormat.FormatData; + string msgBox = null; if (cbChgAll.Checked) { ItemInfo startitm = _CurItemInfo.FirstSibling; @@ -255,14 +268,18 @@ namespace Volian.Controls.Library cnt.Save(); startitm = (startitm.NextItemCount > 0 ? startitm.NextItems[0] : null); } + msgBox = string.Format("All Step Types at this level were changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]); } else { Content cnt = Content.Get(_CurItemInfo.MyContent.ContentID); cnt.Type = 20000 + fmtdata.StepDataList[_MyStepTypeInd[listBoxStepTypes.SelectedIndex]].Index; cnt.Save(); + msgBox = string.Format("This Step Type was changed to {0}", listBoxStepTypes.Items[listBoxStepTypes.SelectedIndex]); } topStepItem.SetAllTabs(); + MessageBox.Show(msgBox); + } private void groupPanelCheckoff_VisibleChanged(object sender, EventArgs e) { diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index a266ebfb..30511f7f 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -321,8 +321,7 @@ namespace Volian.Controls.Library { string fnum = m.Groups[1].Value; string supnum = m.Groups[2].Value; - //string newstr = string.Format(@"{0}x10\super {1}\nosupersub ", fnum, supnum); - string newstr = string.Format(@"{0}x10\up3 {1}\up0 ", fnum, supnum); + string newstr = string.Format(@"{0}x10\up2 {1}\up0 ", fnum, supnum); retstr = retstr.Replace(m.Value, newstr); } return retstr; @@ -354,7 +353,6 @@ namespace Volian.Controls.Library RtfToDisplayTextElements(OriginalText); List origList = GetLinkList(DisplayTextElementList); // now get new text into displaytext elements for comparison for links: - //RtfToDisplayTextElements(rtb.Rtf); RtfToDisplayTextElements(modtext); // Compare ro/transition lists and delete or add any to the item for any ros/transitions that have been // added/deleted or modified. @@ -599,33 +597,32 @@ namespace Volian.Controls.Library } private void RtfToDisplayTextElements(string text) { - // get original text into displaytext elements for comparison for links: - if (DisplayTextElementList == null) - DisplayTextElementList = new List(); - else - DisplayTextElementList.Clear(); + // get original text into displaytext elements for comparison for links: + if (DisplayTextElementList == null) + DisplayTextElementList = new List(); + else + DisplayTextElementList.Clear(); - if (text == null || text == "") return; + if (text == null || text == "") return; - //string noExtraRtfStr = RtfToDbText(text); - string noExtraRtfStr = text; - - int startIndex = 0; - int index = -1; - while ((index = FindTokenChar(noExtraRtfStr, startIndex)) > -1) - { - // Do any 'plain' text that preceeds the token. - if (index > startIndex) DoTextElement(noExtraRtfStr, startIndex, index); + string noExtraRtfStr = text; + int startIndex = 0; + int index = -1; + noExtraRtfStr = noExtraRtfStr.Replace(@"><", @">\v0 \v <"); + while ((index = FindTokenChar(noExtraRtfStr, startIndex)) > -1) + { + // Do any 'plain' text that preceeds the token. + if (index > startIndex) DoTextElement(noExtraRtfStr, startIndex, index); - if (noExtraRtfStr[index + 1] == 'v') - index = DoLink(noExtraRtfStr, index); - else - index = DoSymbol(noExtraRtfStr, startIndex, index); - startIndex = index; // +1; - if (startIndex >= noExtraRtfStr.Length) break; - } - // Add any remaining text. - if (startIndex < noExtraRtfStr.Length) DoTextElement(noExtraRtfStr, startIndex, index); + if (noExtraRtfStr[index + 1] == 'v') + index = DoLink(noExtraRtfStr, index); + else + index = DoSymbol(noExtraRtfStr, startIndex, index); + startIndex = index; // +1; + if (startIndex >= noExtraRtfStr.Length) break; + } + // Add any remaining text. + if (startIndex < noExtraRtfStr.Length) DoTextElement(noExtraRtfStr, startIndex, index); } private string RtfToDbText(string text) { @@ -654,112 +651,6 @@ namespace Volian.Controls.Library return noExtraRtfStr; } - //private string RemoveRtfStyles(string rtf) - //{ - // string retval = rtf; - // // remove rtf commands for any styles that were added. Note that if - // // the entire item has a style, and also contains 'pieces' of text with - // // the same style, the underlying rtf box removes the embedded rtf commands, - // // for example, if the entire step is bolded, and 'THEN' has bold on/off - // // surrounding it, the rtf box removes the bold around the 'THEN' - // // These remove the command with a following space or the command alone, - // // either case may exist, because if there are rtf commands following the - // // style command, there will be no space character following the style command. - // if (((TextFont.Style & E_Style.Bold) > 0) || ((TextFont.Style & E_Style.MmBold) > 0)) - // { - // retval = RemoveToken(retval, @"\\b0"); - // retval = RemoveToken(retval, @"\\b"); - // } - // if ((TextFont.Style & E_Style.Underline) > 0) - // { - // retval = RemoveToken(retval, @"\\ulnone"); - // retval = RemoveToken(retval, @"\\ul"); - // } - // if ((TextFont.Style & E_Style.Italics) > 0) - // { - // retval = RemoveToken(retval, @"\\i0"); - // retval = RemoveToken(retval, @"\\i"); - // } - // return retval; - //} - //private string RemoveToken(string str, string token) - //{ - // // if this token is preceeded by another token and followed by a space - // // leave the preceeding token the ending space - // string retval = Regex.Replace(str, @"(\\[^ \\?\r\n\t]*)" + token + " ", "$1 "); - // if (retval != str) - // Console.WriteLine("leave the preceeding token the ending space"); - // // otherwise replace the token optionally followed by a space - // retval = Regex.Replace(retval, token + " ?", ""); - // return retval; - //} - //private static string StaticRemoveToken(string str, string token) - //{ - // // if this token is preceeded by another token and followed by a space - // // leave the preceeding token the ending space - // string retval = Regex.Replace(str, @"(\\[^ \\?\r\n\t]*)" + token + " ", "$1 "); - // if (retval != str) - // Console.WriteLine("leave the preceeding token the ending space"); - // // otherwise replace the token optionally followed by a space - // retval = Regex.Replace(retval, token + " ?", ""); - // return retval; - //} - //public static string ReplaceRTFClause(Match m) - //{ - // switch (m.Value[1]) - // { - // case 'u': - // if (Regex.IsMatch(m.Value, @"\\u[0-9]+")) - // return m.Value; // Special Charcaters - // if (Regex.IsMatch(m.Value, @"\\ulnone")) - // return m.Value; - // if (Regex.IsMatch(m.Value, @"\\ul.*")) - // return m.Value; // Underline - // break; - // case '\'': // Special Character - // return m.Value; - // case 'b': // Bold - // return m.Value; - // case 's': // sub or super.... - // if (m.Value == @"\sub") return m.Value; - // if (m.Value == @"\super") return m.Value; - // break; - // case 'n': // nosubsuper... - // if (m.Value == @"\nosupersub") return m.Value; - // break; - // case 'i': // Italics - // return m.Value; - // case '{': // look for escape for curly braces: - // return m.Value; - // case '}': - // return m.Value; - // case 'v': // save link hidden info - // if (m.Value == @"\v") return m.Value; // comment part of link - // // end comment may end in space or may end in '\' if another rtf command, - // // or may end at end of string. First check for space, keep it in string - // // if it is there. - // if (Regex.IsMatch(m.Value, @"\\v0 ")) - // return m.Value; - // if (Regex.IsMatch(m.Value, @"\\v0")) - // return m.Value; - // break; - // case 'l': - // if (m.Value == @"\line") return m.Value; - // break; - // case 'p': - // if (m.Value == @"\par") return "\r\n"; - // //if (m.Value == @"\protect") - // // return m.Value; - // //if (m.Value == @"\protect0") - // // return m.Value; - // if (m.Value.Length>=6 && m.Value.Substring(0,6) == "\\par\r\n") return m.Value.Replace("\r\n", " "); - // break; - // case 'f': // handle fonts separately because they may or may not have a space after them - // if (m.Value[2]>='0' && m.Value[2]<='9')return m.Value; - // break; - // } - // return "";//Strip All - //} public static string StaticReplaceRTFClause(Match m) { try @@ -785,13 +676,6 @@ namespace Volian.Controls.Library return token; case 'b': // Bold return token; - //case 's': // sub or super.... - // if (Regex.IsMatch(token, @"^\\sub ?$")) return token; - // if (Regex.IsMatch(token, @"^\\super ?$")) return token; - // break; - //case 'n': // nosubsuper... - // if (Regex.IsMatch(token, @"^\\nosupersub ?$")) return token; - // break; case 'i': // Italics return token; case '{': // look for escape for curly braces: @@ -990,7 +874,7 @@ namespace Volian.Controls.Library // followed by a non-underline or single quote, and if so, return it. if (((txt[indx + 1] == 'u' && txt[indx + 2] != 'l')) || (txt[indx + 1] == '\'')) return indx; // see if link - if (txt[indx + 1] == 'v') return indx; + if (txt[indx + 1] == 'v') return indx; //TODO - should have int endLinkIndxV = text.IndexOf(@"\v0 ", linkIndx); if (endLinkIndxV == -1) endLinkIndxV = text.IndexOf(@"\v0", linkIndx); // at end of string - int endLinkIndxE = text.IndexOf(@"[END>", linkIndx); + int endLinkIndxE = text.IndexOf(@"[END>", linkIndx); int endLinkIndx = (endLinkIndxV < endLinkIndxE) ? endLinkIndxV : endLinkIndxE; vte.Link = text.Substring(linkIndx + 6, endLinkIndx - linkIndx - 6); // 6 for #Link: @@ -1228,7 +1111,7 @@ namespace Volian.Controls.Library // Now get the entire text & link. Account for various ending possibilities: // ends with '\v0\'; ends with '\v0 '; ends with '\v0' (end of string); // ends with '[END>' if two in a row - will have ", endLinkIndx + 3); // get past end of link + int endToken = (endLinkIndx == endLinkIndxE) ? endLinkIndx + 3 : text.IndexOf(@"[END>", endLinkIndx + 3); // get past end of link int endComment = text.IndexOf(@"\v0", endToken); int rettoken = 0; @@ -1248,6 +1131,7 @@ namespace Volian.Controls.Library DisplayTextElementList.Add(vte); return rettoken; } + private int DoSymbol(string text, int startIndex, int index) { displayTextElement vte = new displayTextElement();