Skip to content

Commit

Permalink
Merge branch 'release/9.1' into LT-21425
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonleenaylor authored May 14, 2024
2 parents e4c7555 + 8fb2af8 commit 9ea09a2
Show file tree
Hide file tree
Showing 10 changed files with 177 additions and 111 deletions.
2 changes: 1 addition & 1 deletion Build/Localize.targets
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<Target Name="downloadTranslatedFiles" Condition="'$(disableDownloads)'!='true'" DependsOnTargets="InstallOvercrowdin">
<ForceDelete Files="$(L10nsDirectory)"/>
<MakeDir Directories="$(DownloadsDir)"/>
<Exec WorkingDirectory="$(fwrt)" Command="overcrowdin download -v -r2 -f $(CrowdinZip)" ContinueOnError="$(OnFailedCrowdinDownload)"/>
<Exec WorkingDirectory="$(fwrt)" Command="overcrowdin download -v -f $(CrowdinZip)" ContinueOnError="$(OnFailedCrowdinDownload)"/>
<Unzip ZipFilename="$(CrowdinZip)" ToDir="$(L10nsDirectory)"/>
<NormalizeLocales L10nsDirectory="$(L10nsDirectory)"/>
<ItemGroup>
Expand Down
Binary file modified DistFiles/xample64.dll
Binary file not shown.
11 changes: 3 additions & 8 deletions Src/Common/SimpleRootSite/SimpleRootSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion Src/LexText/Interlinear/ITextDll.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@
<SubType>Code</SubType>
</Compile>
<Compile Include="BIRDInterlinearImporter.cs" />
<Compile Include="ChooseAnalysisHander.cs">
<Compile Include="ChooseAnalysisHandler.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="ChooseTextWritingSystemDlg.cs">
Expand Down
80 changes: 21 additions & 59 deletions Src/LexText/Interlinear/InterlinMaster.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,8 @@ private void SetupInterlinearTabControlForStText(IInterlinearTabControl site)
{
InitializeInterlinearTabControl(site);
//if (site is ISetupLineChoices && m_tabCtrl.SelectedIndex != ktpsCChart)
if (site is ISetupLineChoices)
if (site is ISetupLineChoices interlinearView)
{
var interlinearView = site as ISetupLineChoices;
interlinearView.SetupLineChoices($"InterlinConfig_v3_{(interlinearView.ForEditing ? "Edit" : "Doc")}_{InterlinearTab}",
$"InterlinConfig_v2_{(interlinearView.ForEditing ? "Edit" : "Doc")}_{InterlinearTab}",
GetLineMode());
Expand Down Expand Up @@ -290,9 +289,7 @@ internal void SaveBookMark()
return; // nothing to save...for now, don't overwrite existing one.

if (RootStText == null)
{
return;
}

AnalysisOccurrence curAnalysis = null;
var fSaved = false;
Expand Down Expand Up @@ -509,17 +506,11 @@ public bool OnDisplayLexiconLookup(object commandObject,
CheckDisposed();

display.Visible = true;
if (m_tabCtrl.SelectedIndex != ktpsRawText)
display.Enabled = false;
else
{
//LT-6904 : exposed this case where the m_rtPane was null
// (another case of toolbar processing being done at an unepxected time)
if (m_rtPane == null)
display.Enabled = false;
else
display.Enabled = m_rtPane.LexiconLookupEnabled();
}

//LT-6904 : exposed the case where the m_rtPane was null
// (another case of toolbar processing being done at an unexpected time)
display.Enabled = m_tabCtrl.SelectedIndex == ktpsRawText ?
m_rtPane?.LexiconLookupEnabled() ?? false : false;
return true;
}

Expand Down Expand Up @@ -600,16 +591,9 @@ protected void ShowTabView()
m_infoPane.Dock = DockStyle.Fill;

m_infoPane.Enabled = m_infoPane.CurrentRootHvo != 0;
if (m_infoPane.Enabled)
{
m_infoPane.BackColor = System.Drawing.SystemColors.Control;
if (ParentForm == Form.ActiveForm)
m_infoPane.Focus();
}
else
{
m_infoPane.BackColor = System.Drawing.Color.White;
}
m_infoPane.BackColor = m_infoPane.Enabled ? SystemColors.Control : Color.White;
if (m_infoPane.Enabled && ParentForm == Form.ActiveForm)
m_infoPane.Focus();
break;
default:
break;
Expand Down Expand Up @@ -637,7 +621,7 @@ private void CreateCChart()
private void SetupChartPane()
{
(m_constChartPane as IxCoreColleague).Init(m_mediator, m_propertyTable, m_configurationParameters);
m_constChartPane.BackColor = System.Drawing.SystemColors.Window;
m_constChartPane.BackColor = SystemColors.Window;
m_constChartPane.Name = "m_constChartPane";
m_constChartPane.Dock = DockStyle.Fill;
}
Expand Down Expand Up @@ -725,12 +709,11 @@ public override void Init(Mediator mediator, PropertyTable propertyTable, XmlNod
// Do this BEFORE calling InitBase, which calls ShowRecord, whose correct behavior
// depends on the suppressAutoCreate flag.
bool fHideTitlePane = XmlUtils.GetBooleanAttributeValue(configurationParameters, "hideTitleContents");

// When used as the third pane of a concordance, we don't want the
// title/contents stuff.
if (fHideTitlePane)
{
// When used as the third pane of a concordance, we don't want the
// title/contents stuff.
m_tcPane.Visible = false;
}
m_fSuppressAutoCreate = XmlUtils.GetBooleanAttributeValue(configurationParameters,
"suppressAutoCreate");

Expand Down Expand Up @@ -773,15 +756,10 @@ private void SetInitialTabPage()
{
// If the Record Clerk has remembered we're IsPersistedForAnInterlinearTabPage,
// and we haven't already switched to that tab page, do so now.
if (this.Visible && m_tabCtrl.SelectedIndex != (int)InterlinearTab)
{
m_tabCtrl.SelectedIndex = Visible && m_tabCtrl.SelectedIndex != (int)InterlinearTab ?
// Switch to the persisted tab page index.
m_tabCtrl.SelectedIndex = (int)InterlinearTab;
}
else
{
m_tabCtrl.SelectedIndex = ktpsRawText;
}
(int)InterlinearTab :
ktpsRawText;
}

/// <summary>
Expand All @@ -798,7 +776,7 @@ public override bool PrepareToGoAway()

private bool SaveWorkInProgress()
{
if (m_idcAnalyze != null && m_idcAnalyze.Visible && !m_idcAnalyze.PrepareToGoAway())
if (m_idcAnalyze != null && m_idcAnalyze.Visible && !m_idcAnalyze.PrepareToGoAway())
return false;
if (m_idcGloss != null && m_idcGloss.Visible && !m_idcGloss.PrepareToGoAway())
return false;
Expand Down Expand Up @@ -912,9 +890,7 @@ protected override void ShowRecord()
return;
//This is our very first time trying to show a text, if possible we would like to show the stored text.
if (m_bookmarks == null)
{
m_bookmarks = new Dictionary<Tuple<string, Guid>, InterAreaBookmark>();
}

// It's important not to do this if there is a filter, as there's a good chance the new
// record doesn't pass the filter and we get into an infinite loop. Also, if the user
Expand Down Expand Up @@ -962,27 +938,21 @@ protected override void ShowRecord()
{
var stText = Cache.ServiceLocator.GetInstance<IStTextRepository>().GetObject(hvoRoot);
if (stText.ParagraphsOS.Count == 0)
{
NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () =>
((InterlinearTextsRecordClerk)Clerk).CreateFirstParagraph(stText, Cache.DefaultVernWs));
}
if (stText.ParagraphsOS.Count == 1 && ((IStTxtPara)stText.ParagraphsOS[0]).Contents.Length == 0)
{
// If we have restarted FLEx since this text was created, the WS has been lost and replaced with the userWs.
// If this is the case, default to the Default Vernacular WS (LT-15688 & LT-20837)
var userWs = Cache.ServiceLocator.WritingSystemManager.UserWs;
if(stText.MainWritingSystem == userWs)
{
NonUndoableUnitOfWorkHelper.Do(Cache.ActionHandlerAccessor, () =>
((IStTxtPara)stText.ParagraphsOS[0]).Contents = TsStringUtils.MakeString(string.Empty, Cache.DefaultVernWs));
}

// since we have no text, we should not sit on any of the analyses tabs,
// the info tab is still useful though.
if (InterlinearTab != TabPageSelection.Info && InterlinearTab != TabPageSelection.RawText)
{
InterlinearTab = TabPageSelection.RawText;
}
// Don't steal the focus from another window. See FWR-1795.
if (ParentForm == Form.ActiveForm)
m_rtPane.Focus();
Expand Down Expand Up @@ -1054,13 +1024,9 @@ private void CreateOrRestoreBookmark(IStText stText)
{
InterAreaBookmark mark;
if (m_bookmarks.TryGetValue(new Tuple<string, Guid>(CurrentTool, stText.Guid), out mark))
{
mark.Restore(IndexOfTextRecord);
}
else
{
m_bookmarks.Add(new Tuple<string, Guid>(CurrentTool, stText.Guid), new InterAreaBookmark(this, Cache, m_propertyTable));
}
}
}

Expand Down Expand Up @@ -1312,7 +1278,6 @@ protected override void UpdateContextHistory()
Guid guid = Guid.Empty;
if (Clerk.CurrentObject != null)
guid = Clerk.CurrentObject.Guid;
LcmCache cache = Cache;
// Not sure what will happen with guid == Guid.Empty on the link...
FwLinkArgs link = new FwLinkArgs(toolName, guid, InterlinearTab.ToString());
link.PropertyTableEntries.Add(new Property("InterlinearTab",
Expand Down Expand Up @@ -1358,9 +1323,8 @@ public bool OnDisplayITexts_AddWordsToLexicon(object commandObject,
ref UIItemDisplayProperties display)
{
CheckDisposed();
var fCanDisplayAddWordsToLexiconPanelBarButton = InterlinearTab == TabPageSelection.Gloss;
display.Visible = fCanDisplayAddWordsToLexiconPanelBarButton;
display.Enabled = fCanDisplayAddWordsToLexiconPanelBarButton;
// Can display add words to lexicon panel bar button
display.Visible = display.Enabled = InterlinearTab == TabPageSelection.Gloss;
return true;
}

Expand All @@ -1381,9 +1345,8 @@ public bool OnDisplayShowHiddenFields_interlinearEdit(object commandObject,
ref UIItemDisplayProperties display)
{
CheckDisposed();
var fCanDisplayAddWordsToLexiconPanelBarButton = InterlinearTab == TabPageSelection.Info;
display.Visible = fCanDisplayAddWordsToLexiconPanelBarButton;
display.Enabled = fCanDisplayAddWordsToLexiconPanelBarButton;
// Can display add words to lexicon panel bar button
display.Visible = display.Enabled = InterlinearTab == TabPageSelection.Info;
return true;
}

Expand Down Expand Up @@ -1435,7 +1398,6 @@ private void m_tabCtrl_Deselecting(object sender, TabControlCancelEventArgs e)
// params.
if (m_configurationParameters != null /* && !Cache.DatabaseAccessor.IsTransactionOpen() */)
Clerk.SaveOnChangeRecord();
bool fParsedTextDuringSave = false;
// Pane-individual updates; None did anything, I removed them; GJM
// Is this where we need to hook in reparsing of segments/paras, etc. if RawTextPane is deselected?
// No. See DomainImpl.AnalysisAdjuster.
Expand Down
7 changes: 3 additions & 4 deletions Src/LexText/Interlinear/InterlinVc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ public class InterlinVc : FwBaseVc, IDisposable
private InterlinLineChoices m_lineChoices;
protected IVwStylesheet m_stylesheet;
private IParaDataLoader m_loader;
private readonly HashSet<int> m_vernWss; // all vernacular writing systems
private readonly int m_selfFlid;

private int m_leftPadding;
Expand Down Expand Up @@ -184,8 +183,7 @@ public InterlinVc(LcmCache cache) : base(cache.DefaultAnalWs)
m_tssEmptyPara = TsStringUtils.MakeString(ITextStrings.ksEmptyPara, m_wsAnalysis);
m_tssSpace = TsStringUtils.MakeString(" ", m_wsAnalysis);
m_msaVc = new MoMorphSynAnalysisUi.MsaVc(m_cache);
m_vernWss = WritingSystemServices.GetAllWritingSystems(m_cache, "all vernacular",
null, 0, 0);

// This usually gets overridden, but ensures default behavior if not.
m_lineChoices = InterlinLineChoices.DefaultChoices(m_cache.LangProject,
WritingSystemServices.kwsVernInParagraph, WritingSystemServices.kwsAnal);
Expand Down Expand Up @@ -227,7 +225,8 @@ protected virtual void GetSegmentLevelTags(LcmCache cache)
/// </summary>
internal bool CanBeAnalyzed(AnalysisOccurrence occurrence)
{
return !(occurrence.Analysis is IPunctuationForm) && m_vernWss.Contains(occurrence.BaselineWs);
return !(occurrence.Analysis is IPunctuationForm) &&
WritingSystemServices.GetAllWritingSystems(m_cache, "all vernacular", null, 0, 0).Contains(occurrence.BaselineWs);
}

internal IVwStylesheet StyleSheet
Expand Down
26 changes: 25 additions & 1 deletion Src/LexText/Interlinear/RawTextPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public class RawTextPane : RootSite, IInterlinearTabControl, IHandleBookmark
/// </summary>
RecordClerk m_clerk;

private string m_currentTool = "";

public string CurrentTool
{
get { return m_currentTool; }
}

public RawTextPane() : base(null)
{
BackColor = Color.FromKnownColor(KnownColor.Window);
Expand Down Expand Up @@ -158,6 +165,8 @@ public IStText RootObject
}
}



internal int LastFoundAnnotationHvo
{
get
Expand Down Expand Up @@ -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<string, Guid>(CurrentTool, RootObject.Guid)];
MakeTextSelectionAndScrollToView(bookmark.BeginCharOffset, bookmark.EndCharOffset, 0, bookmark.IndexOfParagraph);

VisibleChanged -= RawTextPane_VisibleChanged;
}
}

#endregion
Expand Down Expand Up @@ -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;
}
}

Expand Down
Loading

0 comments on commit 9ea09a2

Please sign in to comment.