From e9c74ebdd0bdf45d97b49360b2b98e2309e7f759 Mon Sep 17 00:00:00 2001 From: Jake Oliver Date: Thu, 9 May 2024 13:39:40 -0400 Subject: [PATCH] LT-20854: Fix baseline tab focus after returning from different area --- Src/Common/SimpleRootSite/SimpleRootSite.cs | 11 +++------ Src/LexText/Interlinear/RawTextPane.cs | 26 ++++++++++++++++++++- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/Src/Common/SimpleRootSite/SimpleRootSite.cs b/Src/Common/SimpleRootSite/SimpleRootSite.cs index 9e0834d7e9..3ce2584327 100644 --- a/Src/Common/SimpleRootSite/SimpleRootSite.cs +++ b/Src/Common/SimpleRootSite/SimpleRootSite.cs @@ -1537,15 +1537,10 @@ public virtual Point ScrollPosition newPos.Y = 0; } - if (Platform.IsMono) - { - if (AllowPainting == true) // FWNX-235 - AutoScrollPosition = newPos; - else - cachedAutoScrollPosition = newPos; - } - else + if (!Platform.IsMono || AllowPainting) // FWNX-235 AutoScrollPosition = newPos; + else + cachedAutoScrollPosition = newPos; } } diff --git a/Src/LexText/Interlinear/RawTextPane.cs b/Src/LexText/Interlinear/RawTextPane.cs index ce6755a5f2..732a9ae642 100644 --- a/Src/LexText/Interlinear/RawTextPane.cs +++ b/Src/LexText/Interlinear/RawTextPane.cs @@ -41,6 +41,13 @@ public class RawTextPane : RootSite, IInterlinearTabControl, IHandleBookmark /// RecordClerk m_clerk; + private string m_currentTool = ""; + + public string CurrentTool + { + get { return m_currentTool; } + } + public RawTextPane() : base(null) { BackColor = Color.FromKnownColor(KnownColor.Window); @@ -158,6 +165,8 @@ public IStText RootObject } } + + internal int LastFoundAnnotationHvo { get @@ -652,7 +661,21 @@ protected void MakeTextSelectionAndScrollToView(int ichMin, int ichLim, int ws, public void SelectBookmark(IStTextBookmark bookmark) { CheckDisposed(); - MakeTextSelectionAndScrollToView(bookmark.BeginCharOffset, bookmark.EndCharOffset, 0, bookmark.IndexOfParagraph); + if (CanFocus) + MakeTextSelectionAndScrollToView(bookmark.BeginCharOffset, bookmark.EndCharOffset, 0, bookmark.IndexOfParagraph); + else + VisibleChanged += RawTextPane_VisibleChanged; + } + + private void RawTextPane_VisibleChanged(object sender, EventArgs e) + { + if (CanFocus) + { + var bookmark = InterlinMaster.m_bookmarks[new Tuple(CurrentTool, RootObject.Guid)]; + MakeTextSelectionAndScrollToView(bookmark.BeginCharOffset, bookmark.EndCharOffset, 0, bookmark.IndexOfParagraph); + + VisibleChanged -= RawTextPane_VisibleChanged; + } } #endregion @@ -891,6 +914,7 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod m_configurationParameters = configurationParameters; m_clerk = ToolConfiguration.FindClerk(m_propertyTable, m_configurationParameters); m_styleSheet = FontHeightAdjuster.StyleSheetFromPropertyTable(m_propertyTable); + m_currentTool = configurationParameters.Attributes["clerk"].Value; } }