diff options
author | Peng Wu <alexepico@gmail.com> | 2016-08-31 10:49:26 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2016-08-31 10:49:26 +0800 |
commit | 2d4204379e1ba6758a0b31f69019b089734689ab (patch) | |
tree | 5e8a31c5fe33f22ae8864bc8be7c9eda03c996f3 | |
parent | 97f89f6f939d86da27565897d82e8fafff7298cb (diff) | |
download | ibus-libzhuyin-2d4204379e1ba6758a0b31f69019b089734689ab.tar.gz ibus-libzhuyin-2d4204379e1ba6758a0b31f69019b089734689ab.tar.xz ibus-libzhuyin-2d4204379e1ba6758a0b31f69019b089734689ab.zip |
update class ZhuyinProperties
-rw-r--r-- | src/ZYZhuyinProperties.cc | 86 | ||||
-rw-r--r-- | src/ZYZhuyinProperties.h | 12 |
2 files changed, 26 insertions, 72 deletions
diff --git a/src/ZYZhuyinProperties.cc b/src/ZYZhuyinProperties.cc index 4b0c469..2ff4f73 100644 --- a/src/ZYZhuyinProperties.cc +++ b/src/ZYZhuyinProperties.cc @@ -31,8 +31,7 @@ namespace ZY { ZhuyinProperties::ZhuyinProperties (Config & config) : m_config (config), m_mode_chinese (m_config.initChinese ()), - m_mode_full_english (m_config.initFullEnglish ()), - m_mode_full_punct (m_config.initFullPunct ()), + m_mode_full_width (m_config.initFullWidth ()), m_mode_trad (m_config.initTradChinese ()), m_prop_chinese ("InputMode", PROP_TYPE_NORMAL, @@ -45,28 +44,17 @@ ZhuyinProperties::ZhuyinProperties (Config & config) StaticText (m_mode_chinese ? _("Switch to English Mode") : _("Switch to Chinese Mode"))), - m_prop_full_english ("mode.full", + m_prop_full_width ("mode.full", PROP_TYPE_NORMAL, - StaticText (m_mode_full_english ? - _("Full Width Letter") : - _("Half Width Letter")), - m_mode_full_english ? + StaticText (m_mode_full_width ? + _("Full Width") : + _("Half Width")), + m_mode_full_width ? PKGDATADIR"/icons/full.svg" : PKGDATADIR"/icons/half.svg", - StaticText (m_mode_full_english ? - _("Switch to Half Width Letter Mode"): - _("Switch to Full Width Letter Mode"))), - m_prop_full_punct ("mode.full_punct", - PROP_TYPE_NORMAL, - StaticText (m_mode_full_punct ? - _("Full Width Punct") : - _("Half Width Punct")), - m_mode_full_punct ? - PKGDATADIR"/icons/full-punct.svg" : - PKGDATADIR"/icons/half-punct.svg", - StaticText (m_mode_full_punct ? - _("Switch to Half Width Punctuation Mode"): - _("Switch to Full Width Punctuation Mode"))), + StaticText (m_mode_full_width ? + _("Switch to Half Width Mode"): + _("Switch to Full Width Mode"))), m_prop_trad ( "mode.trad", PROP_TYPE_NORMAL, StaticText (m_mode_trad ? @@ -90,8 +78,7 @@ ZhuyinProperties::ZhuyinProperties (Config & config) m_prop_chinese.setSymbol(N_("英")); m_props.append (m_prop_chinese); - m_props.append (m_prop_full_english); - m_props.append (m_prop_full_punct); + m_props.append (m_prop_full_width); m_props.append (m_prop_trad); m_props.append (m_prop_setup); @@ -117,46 +104,25 @@ ZhuyinProperties::toggleModeChinese (void) _("Switch to English Mode") : _("Switch to Chinese Mode")); updateProperty (m_prop_chinese); - -#if 0 - m_prop_full_punct.setSensitive (m_mode_chinese); - updateProperty (m_prop_full_punct); -#endif } void -ZhuyinProperties::toggleModeFullEnglish (void) +ZhuyinProperties::toggleModeFullWidth (void) { - m_mode_full_english = !m_mode_full_english; - m_prop_full_english.setLabel (m_mode_full_english ? - _("Full Width Letter") : - _("Half Width Letter")); - m_prop_full_english.setIcon (m_mode_full_english ? + m_mode_full_width = !m_mode_full_width; + m_prop_full_english.setLabel (m_mode_full_width ? + _("Full Width") : + _("Half Width")); + m_prop_full_english.setIcon (m_mode_full_width ? PKGDATADIR"/icons/full.svg" : PKGDATADIR"/icons/half.svg"); - m_prop_full_english.setTooltip (m_mode_full_english ? - _("Switch to Half Width Letter Mode"): - _("Switch to Full Width Letter Mode")); + m_prop_full_english.setTooltip (m_mode_full_width ? + _("Switch to Half Width Mode"): + _("Switch to Full Width Mode")); updateProperty (m_prop_full_english); } void -ZhuyinProperties::toggleModeFullPunct (void) -{ - m_mode_full_punct = !m_mode_full_punct; - m_prop_full_punct.setLabel (m_mode_full_punct ? - _("Full Width Punct") : - _("Half Width Punct")); - m_prop_full_punct.setIcon (m_mode_full_punct ? - PKGDATADIR"/icons/full-punct.svg" : - PKGDATADIR"/icons/half-punct.svg"); - m_prop_full_punct.setTooltip(m_mode_full_punct ? - _("Switch to Half Width Punctuation Mode"): - _("Switch to Full Width Punctuation Mode")); - updateProperty (m_prop_full_punct); -} - -void ZhuyinProperties::toggleModeTrad (void) { m_mode_trad = ! m_mode_trad; @@ -178,11 +144,8 @@ ZhuyinProperties::reset (void) if (modeChinese () != m_config.initChinese ()) { toggleModeChinese (); } - if (modeFullEnglish () != m_config.initFullEnglish ()) { - toggleModeFullEnglish (); - } - if (modeFullPunct () != m_config.initFullPunct ()) { - toggleModeFullPunct (); + if (modeFullWidth () != m_config.initFullWidth ()) { + toggleModeFullWidth (); } if (modeTrad () != m_config.initTradChinese ()) { toggleModeTrad (); @@ -193,7 +156,6 @@ gboolean ZhuyinProperties::propertyActivate (const gchar *prop_name, guint prop_state) { const static std::string mode_chinese ("InputMode"); const static std::string mode_full ("mode.full"); - const static std::string mode_full_punct ("mode.full_punct"); const static std::string mode_trad ("mode.trad"); if (mode_chinese == prop_name) { @@ -201,11 +163,7 @@ ZhuyinProperties::propertyActivate (const gchar *prop_name, guint prop_state) { return TRUE; } else if (mode_full == prop_name) { - toggleModeFullEnglish (); - return TRUE; - } - else if (mode_full_punct == prop_name) { - toggleModeFullPunct (); + toggleModeFullWidth (); return TRUE; } else if (mode_trad == prop_name) { diff --git a/src/ZYZhuyinProperties.h b/src/ZYZhuyinProperties.h index a6d184a..32a6b4b 100644 --- a/src/ZYZhuyinProperties.h +++ b/src/ZYZhuyinProperties.h @@ -33,15 +33,13 @@ public: ZhuyinProperties (Config & config); void toggleModeChinese (void); - void toggleModeFullEnglish (void); - void toggleModeFullPunct (void); + void toggleModeFullWidth (void); void toggleModeTrad (void); void reset (void); gboolean modeChinese (void) const { return m_mode_chinese; } - gboolean modeFullEnglish (void) const { return m_mode_full_english; } - gboolean modeFullPunct (void) const { return m_mode_full_punct; } + gboolean modeFullWidth (void) const { return m_mode_full_width; } gboolean modeTrad (void) const { return m_mode_trad; } PropList & properties (void) { return m_props; } @@ -64,14 +62,12 @@ private: private: Config & m_config; gboolean m_mode_chinese; - gboolean m_mode_full_english; - gboolean m_mode_full_punct; + gboolean m_mode_full_width; gboolean m_mode_trad; /* properties */ Property m_prop_chinese; - Property m_prop_full_english; - Property m_prop_full_punct; + Property m_prop_full_width; Property m_prop_trad; Property m_prop_setup; PropList m_props; |