]> git.lyx.org Git - lyx.git/blobdiff - src/trans_mgr.C
fix "make dist" target
[lyx.git] / src / trans_mgr.C
index 883421062b867d0788cc02defed3a4f9c2137867..ba0568ef15c27eaaa4085b3d496437c0b7eaf989 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;
@@ -159,8 +160,7 @@ string const TransCombinedState::normalkey(char c, string const & trans)
        
        // Check if the key is allowed on the combination
        if (countChar(comb_info_->data, c) > 0) {
-               string temp;
-               temp = DoAccent(c, deadkey2_info_.accent);
+               string const temp = DoAccent(c, deadkey2_info_.accent);
                res = DoAccent(temp, deadkey_info_.accent);
                currentState = init_state_;
        } else {
@@ -205,14 +205,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 +264,7 @@ void TransManager::EnableSecondary()
 
 void TransManager::DisableKeymap()
 {
-       active_ = default_;
+       active_ = &default_;
        lyxerr[Debug::KBMAP] << "Disabling keymap" << endl;
 }
 
@@ -284,9 +285,9 @@ void  TransManager::TranslateAndInsert(char c, LyXText * text)
 
 void TransManager::insertVerbatim(string const & str, LyXText * text)
 {      
-       int const l = str.length();
+       string::size_type const l = str.length();
        
-       for (int i = 0; i < l; ++i){
+       for (string::size_type i = 0; i < l; ++i) {
                if (str[i] == '\"' 
                    && text->GetFont(current_view->buffer(),text->cursor.par(),
                                     text->cursor.pos()).latex() == LyXFont::OFF
@@ -326,18 +327,19 @@ 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;
                i.allowed = lyx_accent_table[accent].native;