Skip to content

LT-22333: Click on Preview pane and go to field#818

Open
jtmaxwell3 wants to merge 11 commits intomainfrom
LT-22333
Open

LT-22333: Click on Preview pane and go to field#818
jtmaxwell3 wants to merge 11 commits intomainfrom
LT-22333

Conversation

@jtmaxwell3
Copy link
Copy Markdown
Collaborator

@jtmaxwell3 jtmaxwell3 commented Apr 7, 2026

This fixes https://jira.sil.org/browse/LT-22333.

This code attempts to map Preview data elements to corresponding slices. There are three parts:

  1. settings.ConfigSource records the GUID of the source ICmObject of each preview config. This gets written out to the GeckoElements along with the field description.
  2. JumpToFieldAt extracts the nearest object and field from the selected GeckoElement and calls JumpToField with the object, field, and field value. It calls JumpToRecord first if the object and field belongs to a lex entry that is different from the current lex entry.
  3. JumpToField tries to find the corresponding slice. It first looks for a slice that matches the object and field. Failing that, it looks for a slice that matches the object and/or the value.

This change is Reviewable

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

NUnit Tests

    1 files  ±0      1 suites  ±0   6m 23s ⏱️ +7s
4 103 tests +5  4 032 ✅ +5  71 💤 ±0  0 ❌ ±0 
4 112 runs  +5  4 041 ✅ +5  71 💤 ±0  0 ❌ ±0 

Results for commit 6440b66. ± Comparison against base commit 7ef7052.

♻️ This comment has been updated with latest results.

@jasonleenaylor
Copy link
Copy Markdown
Contributor

Src/xWorks/ConfiguredLcmGenerator.cs line 3519 at r1 (raw file):

			public ILcmContentGenerator ContentGenerator = new LcmXhtmlGenerator();
			public ILcmStylesGenerator StylesGenerator = new CssGenerator();
			public Dictionary<ConfigurableDictionaryNode, Guid> ConfigSource = new Dictionary<ConfigurableDictionaryNode, Guid>();

I think this needs to be a ConcurrentDictionary for thread safety.

Copy link
Copy Markdown
Contributor

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-sil reviewed 7 files and all commit messages, and made 4 comments.
Reviewable status: 7 of 10 files reviewed, 4 unresolved discussions (waiting on jasonleenaylor and jtmaxwell3).


Src/Utilities/AlloVarGen/AlloGenService/AlloGenServiceTests/TestData/Quechua MYL CausDeriv.fwdata.lock line 1 at r1 (raw file):

{"__type":"FileLockContent:#Palaso.IO.FileLock","PID":6816,"ProcessName":"testhost.net48","Timestamp":639111542518543262}

This probably shouldn't be checked in.


Src/xWorks/XhtmlDocView.cs line 692 at r1 (raw file):

				{
#pragma warning disable 618 // suppress obsolete warning
					mediator.SendMessage("JumpToRecord", fieldLexEntry.Hvo);

This can be done through the Pub/Sub system instead of calling SendMessage(). Since SendMessage() executes immediately, you can have new code use Pub/Sub and old code still using the SendMessage() calls.


Src/xWorks/XhtmlDocView.cs line 703 at r1 (raw file):

					Publisher.Publish(new PublisherParameterObject(EventConstants.JumpToField, arguments));
				}
				Application.Idle += JumpToField;

Probably should talk to Jason about the best way to handle this. In general, I think we are trying to reduce our use of Idle.


Src/xWorks/xWorks.csproj line 98 at r1 (raw file):

    <EmbeddedResource Include="Resources\Texts 32.ico" />
    <EmbeddedResource Include="Resources\Words 32.ico" />
  </ItemGroup>

Are the changes in this file intentional?

@jtmaxwell3
Copy link
Copy Markdown
Collaborator Author

  1. I replaced Dictionary with ConcurrentDictionary.
  2. I deleted the lock file
  3. There are a lot of calls to mediator.SendMessage("JumpToRecord", ... ). I think that they should all be fixed together, but I don't think that it should be part of this change.
  4. I will ask Jason about alternatives to Application.Idle.
  5. The changes to xWorks.csproj were needed to get the resx resource to recompile automatically.

@jasonleenaylor
Copy link
Copy Markdown
Contributor

Src/xWorks/XhtmlDocView.cs line 703 at r1 (raw file):

Previously, mark-sil (Mark Kidder) wrote…

Probably should talk to Jason about the best way to handle this. In general, I think we are trying to reduce our use of Idle.

We do want to avoid OnIdle, if the JumpToRecord goes through the Pub/Sub is the delay still necessary? Does it not work until the record has rendered?

@jtmaxwell3
Copy link
Copy Markdown
Collaborator Author

@jasonleenaylor: mediator.SendMessage("JumpToRecord", fieldLexEntry.Hvo) invokes JumpToRecord right away, so using Pub/Sub wouldn't solve the problem.

Copy link
Copy Markdown
Contributor

@mark-sil mark-sil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mark-sil reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: 9 of 10 files reviewed, 4 unresolved discussions (waiting on jasonleenaylor and jtmaxwell3).


Src/xWorks/XhtmlDocView.cs line 692 at r1 (raw file):

Previously, mark-sil (Mark Kidder) wrote…

This can be done through the Pub/Sub system instead of calling SendMessage(). Since SendMessage() executes immediately, you can have new code use Pub/Sub and old code still using the SendMessage() calls.

Sounds good, I agree with your comment #3 in the 'Top Level Discussions' section.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants