-
Notifications
You must be signed in to change notification settings - Fork 4
feat(alphabet): emoji extension — settings-gated emoji group for every alphabet (RFC 0020) #99
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -117,6 +117,15 @@ void CDasherInterfaceBase::Realize(unsigned long ulTime) { | |
| // THIS realize read the other bundle (greptile P1 #2 on #88 — pinned by | ||
| // retired_default_heal_uses_own_context_data_dir). | ||
| m_AlphIO->ScanNameIndex(m_dataDir); | ||
| // RFC 0020: load the emoji extension definition (groups-only, merged | ||
| // into every alphabet when BP_EMOJI_GROUP is on). The engine resolves | ||
| // data against {dataDir, dataDir/Data} — try both, tolerate absence. | ||
| { | ||
| const std::string sep = (m_dataDir.empty() || m_dataDir.back() == '/') ? "" : "/"; | ||
| for (const std::string& sub : {std::string("emoji/extension.xml"), std::string("Data/emoji/extension.xml")}) { | ||
| if (m_AlphIO->LoadEmojiExtension(m_dataDir + sep + sub)) break; | ||
| } | ||
| } | ||
| const auto loadById = [this](const std::string& alphId) { LoadAlphabetById(alphId); }; | ||
| { | ||
| std::string alphId = m_pSettingsStore->GetStringParameter(SP_ALPHABET_ID); | ||
|
|
@@ -219,6 +228,13 @@ CDasherInterfaceBase::~CDasherInterfaceBase() { | |
|
|
||
| // Clean up cached lock label (created by Redraw when locked) | ||
| delete m_pLockLabel; | ||
|
|
||
| // RFC 0020: derived infos own their ControlActions — free them once the | ||
| // model (which referenced them) is gone. | ||
| for (const CAlphInfo* info : m_vExtendedAlphInfos) | ||
| delete info; | ||
| m_vExtendedAlphInfos.clear(); | ||
| m_pExtendedAlphInfo = nullptr; | ||
| } | ||
|
|
||
| void CDasherInterfaceBase::HandleParameterChange(Parameter parameter) { | ||
|
|
@@ -241,6 +257,11 @@ void CDasherInterfaceBase::HandleParameterChange(Parameter parameter) { | |
| ChangeAlphabet(); | ||
| ScheduleRedraw(); | ||
| break; | ||
| case BP_EMOJI_GROUP: // RFC 0020 — the merged emoji group changes the | ||
| case SP_EMOJI_SKIN_TONE: // alphabet's symbol set; rebuild like a switch | ||
| ChangeAlphabet(); | ||
| ScheduleRedraw(); | ||
| break; | ||
| case SP_COLOUR_ID: | ||
| ChangeColors(); | ||
| ScheduleRedraw(); | ||
|
|
@@ -646,7 +667,24 @@ double CDasherInterfaceBase::GetCurFPS() { | |
| } | ||
|
|
||
| const CAlphInfo* CDasherInterfaceBase::GetActiveAlphabet() { | ||
| return m_AlphIO->GetInfo(m_pSettingsStore->GetStringParameter(SP_ALPHABET_ID)); | ||
| const std::string alphId = m_pSettingsStore->GetStringParameter(SP_ALPHABET_ID); | ||
| if (!m_pSettingsStore->GetBoolParameter(BP_EMOJI_GROUP) || !m_AlphIO->HasEmojiExtension()) | ||
| return m_AlphIO->GetInfo(alphId); | ||
|
|
||
| // RFC 0020: merge the emoji extension into a derived copy. Cached per | ||
| // (alphabet, tone): GetActiveAlphabet is called per frame by CAPI | ||
| // consumers, and each merge re-parses the alphabet file. | ||
| const std::string tone = m_pSettingsStore->GetStringParameter(SP_EMOJI_SKIN_TONE); | ||
| const std::string key = alphId + '\x1f' + tone; | ||
| if (m_pExtendedAlphInfo && m_strExtendedKey == key) return m_pExtendedAlphInfo; | ||
|
|
||
| const CAlphInfo* base = m_AlphIO->GetInfo(alphId); | ||
| const CAlphInfo* derived = m_AlphIO->MakeExtendedInfo(alphId, tone); | ||
|
Comment on lines
+681
to
+682
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When emoji support is enabled, this builds the extended alphabet only for the C API symbol-inspection functions. Knowledge Base Used: |
||
| m_pExtendedAlphInfo = derived; | ||
| m_strExtendedKey = key; | ||
| if (derived != base) // MakeExtendedInfo falls back to the shared base | ||
| m_vExtendedAlphInfos.push_back(derived); // info when nothing merged | ||
|
Comment on lines
+678
to
+686
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The cache remembers only the latest alphabet-and-tone key. After switching to another value and back, it reparses and retains another complete derived alphabet instead of reusing the earlier entry. Repeated runtime setting changes followed by alphabet queries therefore make session memory grow continuously until the interface is destroyed. Knowledge Base Used: |
||
| return derived; | ||
| } | ||
|
|
||
| // int CDasherInterfaceBase::GetAutoOffset() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When control mode is enabled, probability generation reserves one twentieth of the normalized range for the control node. This calculation expands the remaining alphabet probability mass back across the entire range, so the last alphabet child ends at 65536.
AddExtrasthen gives the control node bounds of[65536, 65536], leaving it with no selectable area. The base group must retain the range reserved for the control branch.Knowledge Base Used: