Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LT-20853: Fix FocusBox word bundle elements' order #31

Merged
merged 2 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Src/LexText/Interlinear/InterlinDocForAnalysis.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public virtual void TriggerAnalysisSelected(AnalysisOccurrence target, bool fSav
MoveFocusBoxIntoPlace();
// Now it is the right size and place we can show it.
TryShowFocusBox();
// All this CAN hapen because we're editing in another window...for example,
// All this CAN happen because we're editing in another window...for example,
// if we edit something that deletes the current wordform in a concordance view.
// In that case we don't want to steal the focus.
if (ParentForm == Form.ActiveForm)
Expand Down Expand Up @@ -1828,16 +1828,19 @@ internal override void UpdateForNewLineChoices(InterlinLineChoices newChoices)
}
}

private bool previousRightToLeft;
private bool hasRightToLeftChanged => previousRightToLeft != Vc.RightToLeft;
/// <summary>
/// returns the focus box for the interlinDoc if it exists or can be created.
/// </summary>
internal FocusBoxController FocusBox
{
get
{
if (ExistingFocusBox == null && ForEditing)
if ((ExistingFocusBox == null && ForEditing) || hasRightToLeftChanged)
{
CreateFocusBox();
previousRightToLeft = Vc.RightToLeft;
}
return ExistingFocusBox;
}
Expand All @@ -1849,6 +1852,11 @@ internal FocusBoxController FocusBox

internal override void CreateFocusBox()
{
if (ExistingFocusBox != null)
{
ExistingFocusBox.Dispose();
}

ExistingFocusBox = CreateFocusBoxInternal();
}

Expand Down
4 changes: 2 additions & 2 deletions Src/LexText/Interlinear/SandboxBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3873,10 +3873,10 @@ public override void MakeRoot()

m_dxdLayoutWidth = kForceLayout; // Don't try to draw until we get OnSize and do layout.
// For some reason, we don't always initialize our control size to be the same as our rootbox.
this.Margin = new Padding(3, 0, 3, 1);
Margin = new Padding(3, 0, 3, 1);
SyncControlSizeToRootBoxSize();
if (RightToLeftWritingSystem)
this.Anchor = AnchorStyles.Right | AnchorStyles.Top;
Anchor = AnchorStyles.Right | AnchorStyles.Top;

//TODO:
//ptmw->RegisterRootBox(qrootb);
Expand Down
Loading