summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeng Wu <alexepico@gmail.com>2021-01-28 11:59:17 +0800
committerPeng Wu <alexepico@gmail.com>2021-01-28 11:59:17 +0800
commit330ba5b289eec7670aa82244ed9064d8bc6d537b (patch)
tree662a6e2ccc7599915dcf89007b8a297bb81f0d96
parent39c7da6eb672d89ea240e336bdea1546eaf85f46 (diff)
downloadibus-libpinyin-330ba5b289eec7670aa82244ed9064d8bc6d537b.tar.gz
Support Compatibility display style
-rw-r--r--src/PYConfig.h3
-rw-r--r--src/PYPBopomofoEditor.cc9
-rw-r--r--src/PYPConfig.cc3
-rw-r--r--src/PYPDoublePinyinEditor.cc6
-rw-r--r--src/PYPFullPinyinEditor.cc6
-rw-r--r--src/PYPPinyinEditor.cc3
6 files changed, 20 insertions, 10 deletions
diff --git a/src/PYConfig.h b/src/PYConfig.h
index 7fe9a25..a6031b3 100644
--- a/src/PYConfig.h
+++ b/src/PYConfig.h
@@ -35,7 +35,8 @@ namespace PY {
typedef enum {
DISPLAY_STYLE_TRADITIONAL,
- DISPLAY_STYLE_COMPACT
+ DISPLAY_STYLE_COMPACT,
+ DISPLAY_STYLE_COMPATIBILITY
} DisplayStyle;
enum CloudInputSource{
diff --git a/src/PYPBopomofoEditor.cc b/src/PYPBopomofoEditor.cc
index f98fe8c..3d13c77 100644
--- a/src/PYPBopomofoEditor.cc
+++ b/src/PYPBopomofoEditor.cc
@@ -345,7 +345,8 @@ BopomofoEditor::commit (const gchar *str)
void
BopomofoEditor::updatePreeditText ()
{
- if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
+ if (DISPLAY_STYLE_COMPACT == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
return;
guint num = 0;
@@ -405,7 +406,8 @@ void
BopomofoEditor::updateAuxiliaryText (void)
{
if (G_UNLIKELY (m_text.empty ())) {
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
hideAuxiliaryText ();
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
hidePreeditText ();
@@ -424,7 +426,8 @@ BopomofoEditor::updateAuxiliaryText (void)
m_buffer << p;
StaticText text (m_buffer);
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
Editor::updateAuxiliaryText (text, TRUE);
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
Editor::updatePreeditText (text, 0, TRUE);
diff --git a/src/PYPConfig.cc b/src/PYPConfig.cc
index 6cf5b33..836e676 100644
--- a/src/PYPConfig.cc
+++ b/src/PYPConfig.cc
@@ -193,7 +193,8 @@ static const struct{
DisplayStyle display_style;
} display_style_options [] = {
{0, DISPLAY_STYLE_TRADITIONAL},
- {1, DISPLAY_STYLE_COMPACT}
+ {1, DISPLAY_STYLE_COMPACT},
+ {2, DISPLAY_STYLE_COMPATIBILITY}
};
static const struct{
diff --git a/src/PYPDoublePinyinEditor.cc b/src/PYPDoublePinyinEditor.cc
index c39bff5..ee10b35 100644
--- a/src/PYPDoublePinyinEditor.cc
+++ b/src/PYPDoublePinyinEditor.cc
@@ -124,7 +124,8 @@ void
DoublePinyinEditor::updateAuxiliaryText (void)
{
if (G_UNLIKELY (m_text.empty ())) {
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
hideAuxiliaryText ();
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
hidePreeditText ();
@@ -143,7 +144,8 @@ DoublePinyinEditor::updateAuxiliaryText (void)
m_buffer << p;
StaticText text (m_buffer);
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
Editor::updateAuxiliaryText (text, TRUE);
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
Editor::updatePreeditText (text, 0, TRUE);
diff --git a/src/PYPFullPinyinEditor.cc b/src/PYPFullPinyinEditor.cc
index 3d2fd3b..7c0eab8 100644
--- a/src/PYPFullPinyinEditor.cc
+++ b/src/PYPFullPinyinEditor.cc
@@ -91,7 +91,8 @@ void
FullPinyinEditor::updateAuxiliaryText (void)
{
if (G_UNLIKELY (m_text.empty ())) {
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
hideAuxiliaryText ();
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
hidePreeditText ();
@@ -110,7 +111,8 @@ FullPinyinEditor::updateAuxiliaryText (void)
m_buffer << p;
StaticText text (m_buffer);
- if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle ())
+ if (DISPLAY_STYLE_TRADITIONAL == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
Editor::updateAuxiliaryText (text, TRUE);
if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
Editor::updatePreeditText (text, 0, TRUE);
diff --git a/src/PYPPinyinEditor.cc b/src/PYPPinyinEditor.cc
index ab4d76c..275c02a 100644
--- a/src/PYPPinyinEditor.cc
+++ b/src/PYPPinyinEditor.cc
@@ -227,7 +227,8 @@ PinyinEditor::commit (const gchar *str)
void
PinyinEditor::updatePreeditText ()
{
- if (DISPLAY_STYLE_COMPACT == m_config.displayStyle ())
+ if (DISPLAY_STYLE_COMPACT == m_config.displayStyle () ||
+ DISPLAY_STYLE_COMPATIBILITY == m_config.displayStyle ())
return;
guint num = 0;