Commit e2d0d0cb authored by Hiroshi Sumita's avatar Hiroshi Sumita
Browse files

Make m_observer private.

BUG=None
TEST=Run a test.

Review URL: http://codereview.appspot.com/5312042
parent 6b98a38b
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -310,7 +310,7 @@ BopomofoContext::updateAuxiliaryText (void)
    if (G_UNLIKELY (m_text.empty () ||
        m_phrase_editor.candidates ().size () == 0)) {
        m_auxiliary_text = "";
        m_observer->auxiliaryTextChanged (this);
        PhoneticContext::updateAuxiliaryText ();
        return;
    }

@@ -349,7 +349,7 @@ BopomofoContext::updateAuxiliaryText (void)
    }

    m_auxiliary_text = m_buffer;
    m_observer->auxiliaryTextChanged (this);
    PhoneticContext::updateAuxiliaryText ();
}

void
@@ -384,7 +384,7 @@ BopomofoContext::commit ()
    m_phrase_editor.commit ();
    reset ();
    update ();
    m_observer->commitText (this, m_buffer);
    PhoneticContext::commitText (m_buffer);
}

void
@@ -393,7 +393,7 @@ BopomofoContext::updatePreeditText (void)
    /* preedit text = selected phrases + highlight candidate + rest text */
    if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) {
        m_preedit_text.clear ();
        m_observer->preeditTextChanged (this);
        PhoneticContext::updatePreeditText ();
        return;
    }

@@ -474,7 +474,7 @@ BopomofoContext::updatePreeditText (void)
        m_preedit_text.rest_text = m_buffer.substr (edit_end_byte);
    }

    m_observer->preeditTextChanged (this);
    PhoneticContext::updatePreeditText ();
}

static gint
+18 −0
Original line number Diff line number Diff line
@@ -170,6 +170,12 @@ PhoneticContext::updateSpecialPhrases (void)
    return size != m_special_phrases.size () || size != 0;
}

void
PhoneticContext::commitText (const std::string & commit_text)
{
    m_observer->commitText (this, commit_text);
}

void
PhoneticContext::updateLookupTable (void)
{
@@ -203,6 +209,18 @@ PhoneticContext::updateLookupTable (void)
    m_observer->lookupTableChanged (this);
}

void
PhoneticContext::updateAuxiliaryText (void)
{
    m_observer->auxiliaryTextChanged (this);
}

void
PhoneticContext::updatePreeditText (void)
{
    m_observer->preeditTextChanged (this);
}

void
PhoneticContext::reset (void)
{
+8 −3
Original line number Diff line number Diff line
@@ -69,7 +69,11 @@ public:

protected:

    virtual void commitText (const std::string & commit_text);
    virtual void updateLookupTable (void);
    virtual void updateAuxiliaryText (void);
    virtual void updatePreeditText (void);

    virtual gboolean updateSpecialPhrases (void);
    gboolean selectCandidate (guint i);
    gboolean selectCandidateInPage (guint i);
@@ -107,6 +111,7 @@ protected:
        return (const gchar *)m_text + m_cursor;
    }


    /* pure virtual functions */
    virtual gboolean insert (gint ch) = 0;
    virtual gboolean removeCharBefore (void) = 0;
@@ -119,8 +124,6 @@ protected:
    virtual gboolean moveCursorRightByWord (void) = 0;
    virtual gboolean moveCursorToBegin (void) = 0;
    virtual gboolean moveCursorToEnd (void) = 0;
    virtual void updateAuxiliaryText (void) = 0;
    virtual void updatePreeditText (void) = 0;

    /* variables */
    Config                     &m_config;
@@ -134,9 +137,11 @@ protected:
    std::string                 m_selected_special_phrase;
    String                      m_text;
    Preedit                     m_preedit_text;
    PhoneticContext::Observer  *m_observer;
    std::vector<Candidate>      m_candidates;
    std::string                 m_auxiliary_text;

private:
    PhoneticContext::Observer  *m_observer;
};

}; // namespace PyZy
+5 −5
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ PinyinContext::commit ()
    m_phrase_editor.commit ();
    reset ();
    update ();
    m_observer->commitText (this, m_buffer);
    PhoneticContext::commitText (m_buffer);
}

void
@@ -71,7 +71,7 @@ PinyinContext::updatePreeditText ()
    /* preedit text = selected phrases + highlight candidate + rest text */
    if (G_UNLIKELY (m_phrase_editor.empty () && m_text.empty ())) {
        m_preedit_text.clear ();
        m_observer->preeditTextChanged (this);
        PhoneticContext::updatePreeditText ();
        return;
    }

@@ -148,7 +148,7 @@ PinyinContext::updatePreeditText ()
        m_preedit_text.rest_text = m_buffer.substr (edit_end_byte);
    }

    m_observer->preeditTextChanged (this);
    PhoneticContext::updatePreeditText ();
}

void
@@ -158,7 +158,7 @@ PinyinContext::updateAuxiliaryText (void)
    if (G_UNLIKELY (m_text.empty () ||
        m_candidates.size () == 0)) {
        m_auxiliary_text = "";
        m_observer->auxiliaryTextChanged (this);
        PhoneticContext::updateAuxiliaryText ();
        return;
    }

@@ -201,7 +201,7 @@ PinyinContext::updateAuxiliaryText (void)
    }
  
    m_auxiliary_text = m_buffer;
    m_observer->auxiliaryTextChanged (this);
    PhoneticContext::updateAuxiliaryText ();
}

};  // namespace PyZy