Skip to content

Commit

Permalink
Merge branch 'release/9.1' into cross-thread
Browse files Browse the repository at this point in the history
  • Loading branch information
JakeOliver28 authored Dec 12, 2024
2 parents 1edd940 + eb4a00b commit caa9ad7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Bin/_setLatestBuildConfig.bat
Bin/_setroot.bat
Lib/debug/DebugProcs.lib
Lib/debug/Generic.lib
Lib/debug/System.ValueTuple.dll
Lib/debug/unit++.*
Lib/release/DebugProcs.lib
Lib/release/Generic.lib
Expand Down
32 changes: 32 additions & 0 deletions Src/Common/Controls/DetailControls/MSAReferenceComboBoxSlice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class MSAReferenceComboBoxSlice : FieldSlice, IVwNotifyChange

//private bool m_processSelectionEvent = true;
private bool m_handlingMessage = false;
private bool m_forceRefresh = false;

/// ------------------------------------------------------------------------------------
/// <summary>
Expand Down Expand Up @@ -98,6 +99,8 @@ public override Mediator Mediator
m_MSAPopupTreeManager = new MSAPopupTreeManager(m_tree, m_cache, list,
m_tree.WritingSystemCode, true, m_mediator, m_propertyTable,
m_propertyTable.GetValue<Form>("window"));
m_MSAPopupTreeManager.BeforeChange += m_MSAPopupTreeManager_BeforeChange;
m_MSAPopupTreeManager.AfterChange += m_MSAPopupTreeManager_AfterChange;
m_MSAPopupTreeManager.AfterSelect += m_MSAPopupTreeManager_AfterSelect;
m_MSAPopupTreeManager.Sense = m_obj as ILexSense;
m_MSAPopupTreeManager.PersistenceProvider = m_persistProvider;
Expand Down Expand Up @@ -222,6 +225,33 @@ protected override void UpdateDisplayFromDatabase()
// What do we need to do here, if anything?
}

public void m_MSAPopupTreeManager_BeforeChange(object sender, TreeViewEventArgs e)
{
if (!ContainingDataTree.DoNotRefresh)
{
// Postpone refreshing the screen until m_MSAPopupTreeManager_AfterChange (LT-21980).
ContainingDataTree.DoNotRefresh = true;
m_forceRefresh = true;
}
}

public void m_MSAPopupTreeManager_AfterChange(object sender, TreeViewEventArgs e)
{
if (m_forceRefresh)
{
m_forceRefresh = false;
// We can't call RefreshDataTree directly,
// since that will cause Windows to crash accessing a disposed object.
// So, we queue it on the UI thread instead.
this.BeginInvoke(new Action(RefreshDataTree));
}
}

public void RefreshDataTree()
{
ContainingDataTree.DoNotRefresh = false;
}

private void m_MSAPopupTreeManager_AfterSelect(object sender, TreeViewEventArgs e)
{
// unless we get a mouse click or simulated mouse click (e.g. by ENTER or TAB),
Expand Down Expand Up @@ -286,7 +316,9 @@ private void m_MSAPopupTreeManager_AfterSelect(object sender, TreeViewEventArgs
// We still can't refresh the data at this point without causing a crash due to
// a pending Windows message. See LT-9713 and LT-9714.
if (ContainingDataTree.DoNotRefresh != fOldDoNotRefresh)
{
Mediator.BroadcastMessage("DelayedRefreshList", fOldDoNotRefresh);
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions Src/LexText/LexTextControls/MSAPopupTreeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class MSAPopupTreeManager : PopupTreeManager

#region Events

public event TreeViewEventHandler BeforeChange;
public event TreeViewEventHandler AfterChange;

#endregion Events

/// <summary>
Expand Down Expand Up @@ -419,11 +422,19 @@ private bool EditExistingMsa()
m_sense.MorphoSyntaxAnalysisRA.Hvo, true, m_sEditGramFunc);
if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
{
if (BeforeChange != null)
{
BeforeChange(this, null);
}
Cache.DomainDataByFlid.BeginUndoTask(String.Format(LexTextControls.ksUndoSetX, FieldName),
String.Format(LexTextControls.ksRedoSetX, FieldName));
m_sense.SandboxMSA = dlg.SandboxMSA;
Cache.DomainDataByFlid.EndUndoTask();
LoadPopupTree(m_sense.MorphoSyntaxAnalysisRA.Hvo);
if (AfterChange != null)
{
AfterChange(this, null);
}
return true;
}
}
Expand Down
15 changes: 15 additions & 0 deletions Src/xWorks/LcmWordGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ public static void SavePublishedDocx(int[] entryHvos, DictionaryPublicationDecor
new Columns() { EqualWidth = true, ColumnCount = 2 },
new SectionType() { Val = SectionMarkValues.Continuous }
);
// Set the section to BiDi so the columns are displayed right to left.
if (IsBidi)
{
sectProps.Append(new BiDi());
}
fragment.DocBody.Append(sectProps);

if (progress != null)
Expand Down Expand Up @@ -329,6 +334,11 @@ internal static DocFragment GenerateLetterHeaderDocFragment(string str, string s
new Columns() { EqualWidth = true, ColumnCount = 2 },
new SectionType() { Val = SectionMarkValues.Continuous }
);
// Set the section to BiDi so the columns are displayed right to left.
if (IsBidi)
{
sectProps2.Append(new BiDi());
}
docFrag.DocBody.AppendChild(new WP.Paragraph(new WP.ParagraphProperties(sectProps2)));
}

Expand All @@ -349,6 +359,11 @@ internal static DocFragment GenerateLetterHeaderDocFragment(string str, string s
new Columns() { EqualWidth = true, ColumnCount = 1 },
new SectionType() { Val = SectionMarkValues.Continuous }
);
// Set the section to BiDi so the columns are displayed right to left.
if (IsBidi)
{
sectProps1.Append(new BiDi());
}
docFrag.DocBody.AppendChild(new WP.Paragraph(new WP.ParagraphProperties(sectProps1)));
}
return docFrag;
Expand Down

0 comments on commit caa9ad7

Please sign in to comment.