]> git.lyx.org Git - lyx.git/blobdiff - src/trans_mgr.C
remove more forms.h cruft
[lyx.git] / src / trans_mgr.C
index e6fea7a4f340696d49aa0759b0edee915fc3e159..cbef7d5b94fe0de71c9cb3dc39aa5810752ac463 100644 (file)
@@ -15,6 +15,7 @@
 #include "buffer.h"
 #include "lyxrc.h"
 #include "support/lstrings.h"
+#include "language.h"
 
 using std::endl;
 using std::pair;
@@ -84,9 +85,12 @@ string const TransDeadkeyState::normalkey(char c, string const & trans)
                l = l->next;
        }
        if (l == 0) {
+#if 0
                // Not an exception. Check if it allowed
                if (countChar(deadkey_info_.allowed, c) > 0) {
+#endif
                        res = DoAccent(c, deadkey_info_.accent);
+#if 0
                } else {
                        // Not allowed
                        if (deadkey_!= 0)
@@ -94,6 +98,7 @@ string const TransDeadkeyState::normalkey(char c, string const & trans)
                        res+= TOKEN_SEP;
                        res+= trans;
                }
+#endif
        }
        currentState = init_state_;
        return res;
@@ -156,13 +161,15 @@ TransCombinedState::TransCombinedState()
 string const TransCombinedState::normalkey(char c, string const & trans)
 {
        string res;
-       
+
+#if 0
        // Check if the key is allowed on the combination
        if (countChar(comb_info_->data, c) > 0) {
-               string temp;
-               temp = DoAccent(c, deadkey2_info_.accent);
+#endif
+               string const temp = DoAccent(c, deadkey2_info_.accent);
                res = DoAccent(temp, deadkey_info_.accent);
                currentState = init_state_;
+#if 0
        } else {
                // Not allowed. Output deadkey1 and check deadkey2 + c
                if (deadkey_ != 0)
@@ -173,6 +180,7 @@ string const TransCombinedState::normalkey(char c, string const & trans)
                // Call deadkey state and leave it to setup the FSM
                res += deadkey_state_->normalkey(c, trans);
        }
+#endif
        return res;
 }
 
@@ -205,14 +213,15 @@ TransFSM::TransFSM():
 
 // TransManager
 
+// Initialize static member.
+Trans TransManager::default_;
+
+
 TransManager::TransManager()
        : active_(0), t1_(new Trans), t2_(new Trans)
 {}
 
 
-Trans * TransManager::default_ = new Trans;
-
-
 TransManager::~TransManager() 
 { 
        delete t1_;
@@ -263,7 +272,7 @@ void TransManager::EnableSecondary()
 
 void TransManager::DisableKeymap()
 {
-       active_ = default_;
+       active_ = &default_;
        lyxerr[Debug::KBMAP] << "Disabling keymap" << endl;
 }
 
@@ -284,17 +293,19 @@ void  TransManager::TranslateAndInsert(char c, LyXText * text)
 
 void TransManager::insertVerbatim(string const & str, LyXText * text)
 {      
-       int l = str.length();
+       string::size_type const l = str.length();
        
-       for (int i = 0; i < l; ++i){
-               if (str[i] == '\"' 
-                   && text->GetFont(current_view->buffer(),text->cursor.par(),
+       for (string::size_type i = 0; i < l; ++i) {
+               if (str[i] == '\"'
+#ifndef NO_LATEX
+                   && text->getFont(current_view->buffer(),text->cursor.par(),
                                     text->cursor.pos()).latex() == LyXFont::OFF
-                   && text->GetFont(current_view->buffer(),text->cursor.par(),
+#endif
+                   && text->getFont(current_view->buffer(),text->cursor.par(),
                                     text->cursor.pos()).language()->lang() != "hebrew")
                        current_view->insertCorrectQuote();
                else
-                       text->InsertChar(current_view, str[i]);
+                       text->insertChar(current_view, str[i]);
        }
 }
 
@@ -312,8 +323,8 @@ void TransManager::insert(string const & str, LyXText * text)
            !enc.first) {
                // Could not find an encoding
                InsetLatexAccent ins(str);
-               if (ins.CanDisplay()) {
-                       text->InsertInset(current_view, new InsetLatexAccent(ins));
+               if (ins.canDisplay()) {
+                       text->insertInset(current_view, new InsetLatexAccent(ins));
                } else {
                        insertVerbatim(str, text);
                }
@@ -326,21 +337,24 @@ void TransManager::insert(string const & str, LyXText * text)
 
 void TransManager::deadkey(char c, tex_accent accent, LyXText * t)
 {
-       if (c == 0 && active_ != default_) {
+       if (c == 0 && active_ != &default_) {
                // A deadkey was pressed that cannot be printed
                // or a accent command was typed in the minibuffer
                KmodInfo i;
                if (active_->isAccentDefined(accent, i) == true) {
-                       string res = trans_fsm_.currentState->deadkey(c, i);
+                       string const res = trans_fsm_
+                               .currentState->deadkey(c, i);
                        insert(res, t);
                        return;
                }
        }
        
-       if (active_ == default_ || c == 0) {
+       if (active_ == &default_ || c == 0) {
                KmodInfo i;
                i.accent = accent;
+#if 0
                i.allowed = lyx_accent_table[accent].native;
+#endif
                i.data.erase();
                i.exception_list = 0;