Skip to content

Commit 11e5641

Browse files
committed
Merge remote-tracking branch 'origin' into ben-mkiv-main
* origin: Fix add leading padding to reported hex values. Add leading padding to reported hex values. U+00FF formatting for codepoints, mono font for info, various style tweaks to character info box. Remove inline on namespace functions.
2 parents 47e0096 + 5a85bd3 commit 11e5641

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

Source/UnicodeBrowser/UnicodeBrowserWidget.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ TArrayView<FUnicodeBlockRange const> UnicodeBrowser::GetUnicodeBlockRanges()
6565
return BlockRange;
6666
}
6767

68+
int32 UnicodeBrowser::GetRangeIndex(EUnicodeBlockRange BlockRange)
69+
{
70+
return GetUnicodeBlockRanges().IndexOfByPredicate(
71+
[BlockRange](FUnicodeBlockRange const& Range)
72+
{
73+
return Range.Index == BlockRange;
74+
}
75+
);
76+
}
6877

6978
TSharedPtr<SUbCheckBoxList> SUnicodeBrowserWidget::MakeRangeSelector()
7079
{
@@ -108,7 +117,7 @@ FReply SUnicodeBrowserWidget::OnCharacterMouseMove(FGeometry const& Geometry, FP
108117
if (CurrentRow == Row) return FReply::Unhandled();
109118
CurrentRow = Row;
110119
CurrentCharacterView->SetText(FText::FromString(CurrentRow->Character));
111-
CurrentCharacterView->SetToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: 0x%04X. Double-Click to copy: %s."), CurrentRow->Codepoint, *CurrentRow->Character)));
120+
CurrentCharacterView->SetToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: U+%-06.04X. Double-Click to copy: %s."), CurrentRow->Codepoint, *CurrentRow->Character)));
112121
return FReply::Handled();
113122
}
114123

@@ -161,7 +170,7 @@ void SUnicodeBrowserWidget::RebuildGridColumns(FUnicodeBlockRange const Range, T
161170
.Font(this, &SUnicodeBrowserWidget::GetFont)
162171
.Justification(ETextJustify::Center)
163172
.IsEnabled(true)
164-
.ToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: 0x%04X. Double-Click to copy: %s."), Row->Codepoint, *Row->Character)))
173+
.ToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: U+%-06.04X. Double-Click to copy: %s."), Row->Codepoint, *Row->Character)))
165174
.Text(FText::FromString(FString::Printf(TEXT("%s"), *Row->Character)))
166175
];
167176

@@ -306,7 +315,7 @@ void SUnicodeBrowserWidget::Construct(FArguments const& InArgs)
306315
.Font(this, &SUnicodeBrowserWidget::GetFont)
307316
.Justification(ETextJustify::Center)
308317
.IsEnabled(true)
309-
.ToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: %04X. Double-Click to copy: %s."), CurrentRow->Codepoint, *CurrentRow->Character)))
318+
.ToolTipText(FText::FromString(FString::Printf(TEXT("Char Code: U+%-06.04X. Double-Click to copy: %s."), CurrentRow->Codepoint, *CurrentRow->Character)))
310319
.Text(FText::FromString(FString::Printf(TEXT("%s"), *CurrentRow->Character)))
311320
]
312321
]
@@ -474,10 +483,6 @@ FString SUnicodeBrowserWidget::GetUnicodeCharacterName(int32 const CharCode)
474483
{
475484
UChar32 const uChar = static_cast<UChar32>(CharCode);
476485
UErrorCode errorCode = U_ZERO_ERROR;
477-
// uint32 bufferSize = 256;
478-
// char *name= (char *)uprv_malloc(bufferSize*sizeof(char));
479-
// (char *)uprv_malloc(bufferSize*sizeof(char));
480-
// char name[256];
481486
char* name = new char[256];
482487

483488
// Get the Unicode character name using ICU

Source/UnicodeBrowser/UnicodeBrowserWidget.h

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include "Widgets/SCompoundWidget.h"
1212
#include "Widgets/Views/SListView.h"
1313

14-
14+
class SExpandableArea;
1515
class UFont;
1616
class SScrollBox;
1717
class SUbCheckBoxList;
@@ -20,19 +20,11 @@ class SUniformGridPanel;
2020

2121
namespace UnicodeBrowser
2222
{
23-
inline TOptional<EUnicodeBlockRange> GetUnicodeBlockRangeFromChar(int32 const CharCode);
23+
TOptional<EUnicodeBlockRange> GetUnicodeBlockRangeFromChar(int32 const CharCode);
2424

2525
TArrayView<FUnicodeBlockRange const> GetUnicodeBlockRanges();
2626

27-
inline int32 GetRangeIndex(EUnicodeBlockRange BlockRange)
28-
{
29-
return GetUnicodeBlockRanges().IndexOfByPredicate(
30-
[BlockRange](FUnicodeBlockRange const& Range)
31-
{
32-
return Range.Index == BlockRange;
33-
}
34-
);
35-
}
27+
int32 GetRangeIndex(EUnicodeBlockRange BlockRange);
3628

3729
static TArray<EUnicodeBlockRange> SymbolRanges = {
3830
EUnicodeBlockRange::Arrows,
@@ -69,7 +61,7 @@ class SUnicodeBrowserWidget : public SCompoundWidget
6961
void Construct(FArguments const& InArgs);
7062

7163
protected:
72-
TArrayView<FUnicodeBlockRange const> Ranges; // all known unicode ranges
64+
TArrayView<FUnicodeBlockRange const> Ranges; // all known Unicode ranges
7365
TMap<EUnicodeBlockRange, TArray<TSharedPtr<FUnicodeBrowserRow>>> Rows;
7466
TMap<EUnicodeBlockRange, TSharedPtr<SExpandableArea>> RangeWidgets;
7567
TMap<EUnicodeBlockRange, TSharedPtr<SUniformGridPanel>> RangeWidgetsGrid;

0 commit comments

Comments
 (0)