Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
rampaa committed Jan 24, 2024
1 parent b40c5e7 commit e27b9e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion JL.Windows/GUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ private async Task Precache(string input, CancellationToken cancellationToken)
bool pOrthographyInfo = jmdict.Options?.POrthographyInfo?.Value ?? true;
bool rOrthographyInfo = jmdict.Options?.ROrthographyInfo?.Value ?? true;
bool aOrthographyInfo = jmdict.Options?.AOrthographyInfo?.Value ?? true;
double pOrthographyInfoFontSize = jmdict.Options?.POrthographyInfoFontSize?.Value ?? 15;

int resultCount = Math.Min(lookupResults.Count, ConfigManager.MaxNumResultsNotInMiningMode);
StackPanel[] popupItemSource = new StackPanel[resultCount];
Expand All @@ -289,7 +290,7 @@ private async Task Precache(string input, CancellationToken cancellationToken)
FirstPopupWindow.DictsWithResults.Add(lookupResult.Dict);
}

popupItemSource[i] = FirstPopupWindow.PrepareResultStackPanel(lookupResult, i, lookupResults.Count, pitchDict, pitchDictIsActive, pOrthographyInfo, rOrthographyInfo, aOrthographyInfo);
popupItemSource[i] = FirstPopupWindow.PrepareResultStackPanel(lookupResult, i, lookupResults.Count, pitchDict, pitchDictIsActive, pOrthographyInfo, rOrthographyInfo, aOrthographyInfo, pOrthographyInfoFontSize);
}

PopupWindow.StackPanelCache.AddReplace(text, popupItemSource);
Expand Down
7 changes: 4 additions & 3 deletions JL.Windows/GUI/PopupWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ public void DisplayResults(bool generateAllResults, string? text = null)
bool showPOrthographyInfo = jmdict.Options?.POrthographyInfo?.Value ?? true;
bool showROrthographyInfo = jmdict.Options?.ROrthographyInfo?.Value ?? true;
bool showAOrthographyInfo = jmdict.Options?.AOrthographyInfo?.Value ?? true;
double pOrthographyInfoFontSize = jmdict.Options?.POrthographyInfoFontSize?.Value ?? 15;

int resultCount = generateAllResults
? LastLookupResults.Count
Expand All @@ -467,7 +468,7 @@ public void DisplayResults(bool generateAllResults, string? text = null)
DictsWithResults.Add(lookupResult.Dict);
}

popupItemSource[i] = PrepareResultStackPanel(lookupResult, i, resultCount, pitchDict, pitchDictIsActive, showPOrthographyInfo, showROrthographyInfo, showAOrthographyInfo);
popupItemSource[i] = PrepareResultStackPanel(lookupResult, i, resultCount, pitchDict, pitchDictIsActive, showPOrthographyInfo, showROrthographyInfo, showAOrthographyInfo, pOrthographyInfoFontSize);
}

PopupListView.ItemsSource = popupItemSource;
Expand All @@ -482,7 +483,7 @@ public void DisplayResults(bool generateAllResults, string? text = null)
}
}

public StackPanel PrepareResultStackPanel(LookupResult result, int index, int resultsCount, Dict? pitchDict, bool pitchDictIsActive, bool showPOrthographyInfo, bool showROrthographyInfo, bool showAOrthographyInfo)
public StackPanel PrepareResultStackPanel(LookupResult result, int index, int resultsCount, Dict? pitchDict, bool pitchDictIsActive, bool showPOrthographyInfo, bool showROrthographyInfo, bool showAOrthographyInfo, double pOrthographyInfoFontSize)
{
// top
WrapPanel top = new() { Tag = index };
Expand Down Expand Up @@ -528,7 +529,7 @@ public StackPanel PrepareResultStackPanel(LookupResult result, int index, int re
TextBlock textBlockPOrthographyInfo = PopupWindowUtils.CreateTextBlock(nameof(result.PrimarySpellingOrthographyInfoList),
string.Create(CultureInfo.InvariantCulture, $"({string.Join(", ", result.PrimarySpellingOrthographyInfoList)})"),
DictOptionManager.POrthographyInfoColor,
result.Dict.Options?.POrthographyInfoFontSize?.Value ?? 15,
pOrthographyInfoFontSize,
PopupContextMenu,
VerticalAlignment.Center,
new Thickness(5, 0, 0, 0));
Expand Down

0 comments on commit e27b9e8

Please sign in to comment.