diff --git a/server/assets/config/config.toml b/server/assets/config/config.toml index cfbcbe12..cae1f40b 100644 --- a/server/assets/config/config.toml +++ b/server/assets/config/config.toml @@ -39,7 +39,7 @@ page_size = 8 # 候选窗口跟随光标 candidate_window_follow_cursor = true # 候选窗口排列方式,可选:"vertical", "horizontal" -candidate_window_layout = "vertical" +candidate_window_layout = "horizontal" # # Input @@ -73,11 +73,11 @@ wubi_schema = "wubi86" # [helpcode] # 双拼辅助码 -shuangpin_helpcode = true +shuangpin_helpcode = false # 双拼辅助码方案,可选:"lantian", "ziranma" shuangpin_helpcode_schema = "lantian" # 是否在候选窗口中显示双拼辅助码 -show_sp_helpcode_in_candidate_window = false +show_sp_helpcode_in_candidate_window = true # 全拼辅助码 quanpin_helpcode = true # 全拼辅助码方案,可选:"lantian", "ziranma" diff --git a/server/src/config/ime_config.cpp b/server/src/config/ime_config.cpp index b6ed140b..983b77e4 100644 --- a/server/src/config/ime_config.cpp +++ b/server/src/config/ime_config.cpp @@ -295,11 +295,31 @@ bool GetConfiguredShuangpinHelpcodeEnabled() return g_shuangpin_helpcode_enabled; } +bool SetConfiguredShuangpinHelpcodeEnabled(bool enabled) +{ + if (!WriteConfiguredValue("helpcode", "shuangpin_helpcode", enabled ? "true" : "false")) + { + return false; + } + g_shuangpin_helpcode_enabled = enabled; + return true; +} + bool GetConfiguredQuanpinHelpcodeEnabled() { return g_quanpin_helpcode_enabled; } +bool SetConfiguredQuanpinHelpcodeEnabled(bool enabled) +{ + if (!WriteConfiguredValue("helpcode", "quanpin_helpcode", enabled ? "true" : "false")) + { + return false; + } + g_quanpin_helpcode_enabled = enabled; + return true; +} + bool GetConfiguredShowShuangpinHelpcodeInCandidateWindow() { return g_show_shuangpin_helpcode_in_candidate_window; diff --git a/server/src/config/ime_config.h b/server/src/config/ime_config.h index 7ad77223..3bc8aeb6 100644 --- a/server/src/config/ime_config.h +++ b/server/src/config/ime_config.h @@ -12,7 +12,9 @@ const std::string &GetConfiguredSessionBackend(); SchemeType GetConfiguredInputScheme(); const std::string &GetConfiguredShuangpinPreeditMode(); bool GetConfiguredShuangpinHelpcodeEnabled(); +bool SetConfiguredShuangpinHelpcodeEnabled(bool enabled); bool GetConfiguredQuanpinHelpcodeEnabled(); +bool SetConfiguredQuanpinHelpcodeEnabled(bool enabled); bool GetConfiguredShowShuangpinHelpcodeInCandidateWindow(); bool SetConfiguredShowShuangpinHelpcodeInCandidateWindow(bool enabled); bool GetConfiguredShowQuanpinHelpcodeInCandidateWindow(); diff --git a/server/src/session/engine_input_session.cpp b/server/src/session/engine_input_session.cpp index 9e808519..0708fd3c 100644 --- a/server/src/session/engine_input_session.cpp +++ b/server/src/session/engine_input_session.cpp @@ -108,11 +108,15 @@ EngineInputSession::EngineInputSession(SchemeType scheme_type) : session_(scheme void EngineInputSession::handle_key(UINT vk, UINT modifiers_down, WCHAR wch) { + session_.set_shuangpin_helpcode_enabled(GetConfiguredShuangpinHelpcodeEnabled()); + session_.set_quanpin_helpcode_enabled(GetConfiguredQuanpinHelpcodeEnabled()); session_.handle_key(vk, modifiers_down, wch); } void EngineInputSession::recompute_candidates() { + session_.set_shuangpin_helpcode_enabled(GetConfiguredShuangpinHelpcodeEnabled()); + session_.set_quanpin_helpcode_enabled(GetConfiguredQuanpinHelpcodeEnabled()); if (is_shuangpin() && (!pending_pinyin_sequence_.empty() || !pending_pinyin_sequence_with_cases_.empty())) { apply_pending_shuangpin_sequence(); diff --git a/server/src/webview2/windows_webview2.cpp b/server/src/webview2/windows_webview2.cpp index 55c337e5..147d3c04 100644 --- a/server/src/webview2/windows_webview2.cpp +++ b/server/src/webview2/windows_webview2.cpp @@ -1038,6 +1038,22 @@ HRESULT OnControllerCreatedSettingsWnd( // PostSettingsConfig(); } } + else if (path == "helpcode.shuangpin_helpcode") + { + const bool value = json::value_to(data.at("value")); + if (SetConfiguredShuangpinHelpcodeEnabled(value)) + { + PostSettingsConfig(); + } + } + else if (path == "helpcode.quanpin_helpcode") + { + const bool value = json::value_to(data.at("value")); + if (SetConfiguredQuanpinHelpcodeEnabled(value)) + { + PostSettingsConfig(); + } + } else if (path == "helpcode.show_qp_helpcode_in_candidate_window") { const bool value = json::value_to(data.at("value")); @@ -1131,7 +1147,9 @@ void PostSettingsConfig() {"data", {{"general", {{"floating_toolbar", GetConfiguredFloatingToolbarEnabled()}}}, {"appearance", {{"candidate_window_layout", GetConfiguredCandidateWindowLayout()}}}, {"helpcode", - {{"show_sp_helpcode_in_candidate_window", + {{"shuangpin_helpcode", GetConfiguredShuangpinHelpcodeEnabled()}, + {"quanpin_helpcode", GetConfiguredQuanpinHelpcodeEnabled()}, + {"show_sp_helpcode_in_candidate_window", GetConfiguredShowShuangpinHelpcodeInCandidateWindow()}, {"show_qp_helpcode_in_candidate_window", GetConfiguredShowQuanpinHelpcodeInCandidateWindow()}}}}}};