]> git.lyx.org Git - lyx.git/blobdiff - src/intl.C
get builddir!=srcdir compiling working; allow successful make even without noweb...
[lyx.git] / src / intl.C
index 19a4fefd5eaab91be92981ff79d811b1bf787853..0f33480ee6a6db0af4ee3610db7a0c6b5181e405 100644 (file)
@@ -30,6 +30,7 @@
 #include "support/lstrings.h"
 #include "language.h"
 
+using std::endl;
 
 // a wrapper around the callback static member.
 extern "C" void C_Intl_DispatchCallback(FL_OBJECT * ob, long code);
@@ -47,6 +48,11 @@ Intl::Intl()
        otherkeymap = 0;
 }
 
+Intl::~Intl()
+{
+       delete trans;
+}
+
 
 int Intl::SetPrimary(string const & lang)
 {
@@ -131,10 +137,6 @@ void Intl::KeyMapPrim()
        /* read text from choice */
        int i = Language->get();
 
-#if 0
-       if (lyxerr.debugging(Debug::KBMAP))
-               lyxerr << "Table: " << tex_babel[i-1] << endl;
-#endif
        string p;
        if (i == otherkeymap)
                p = fl_get_input(fd_form_keymap->OtherKeymap);
@@ -166,10 +168,6 @@ void Intl::KeyMapSec()
        /* read text from choice */
        int i = Language2->get();
 
-#if 0
-       if (lyxerr.debugging(Debug::KBMAP))
-               lyxerr << "Table: " << tex_babel[i-1] << endl;
-#endif
        string p;
        if (i == otherkeymap)
                p = fl_get_input(fd_form_keymap->OtherKeymap2);
@@ -190,23 +188,16 @@ void Intl::KeyMapSec()
        }
 }
 
-
-void Intl::LCombo(int, void * v)
+void Intl::LCombo(int, void * v, Combox * combox)
 {
        Intl * itl = static_cast<Intl*>(v);
-       itl->Keymap(23);
+       if (combox == itl->Language)
+           itl->Keymap(23);
+       else if (combox == itl->Language2)
+           itl->Keymap(43);
        return;
 }
 
-
-void Intl::LCombo2(int, void * v)
-{
-       Intl * itl = static_cast<Intl*>(v);
-       itl->Keymap(43);
-       return;
-}
-
-
 void Intl::DispatchCallback(FL_OBJECT * ob, long code)
 {
        if (ob && (code == 0)) {
@@ -241,7 +232,7 @@ void Intl::InitKeyMapper(bool on)
        Language = new Combox(FL_COMBOX_DROPLIST);
        Language2 = new Combox(FL_COMBOX_DROPLIST);
        Language->setcallback(LCombo, this);
-       Language2->setcallback(LCombo2, this);
+       Language2->setcallback(LCombo, this);
 
        fd_form_keymap = create_form_KeyMap();
 
@@ -282,39 +273,31 @@ void Intl::InitKeyMapper(bool on)
        Language2->add(120, 110, 160, 30, 300); // Secondary
        fl_end_form();
 
-#if 0
        int n = 0;
-       while (true)
-               if (!strlen(tex_babel[n]))
-                       break;
-               else {
-                       Language->addto(tex_babel[n]);
-                       Language2->addto(tex_babel[n]);
-                       ++n;
-               }
-#else
-       int n = 1;
        // Default is not in the language map
+#ifdef DO_USE_DEFAULT_LANGUAGE
        Language->addto("default");
        Language2->addto("default");
+       ++n;
+#endif
        for (Languages::const_iterator cit = languages.begin();
             cit != languages.end(); ++cit) {
-               Language->addto((*cit).second.lang.c_str());
-               Language2->addto((*cit).second.lang.c_str());
+               Language->addto((*cit).second.lang());
+               Language2->addto((*cit).second.lang());
                ++n;
        }
-#endif
+
        Language->addto(_("other..."));
        Language2->addto(_("other..."));
        otherkeymap = n + 1;
-       if (!Language->select_text(prim_lang.c_str())) {
+       if (!Language->select_text(prim_lang)) {
                Language->select(n+1);
                fl_set_input(fd_form_keymap->OtherKeymap, prim_lang.c_str());
        }
        else 
                trans->SetPrimary(prim_lang);
 
-       if (!Language2->select_text(sec_lang.c_str())) {
+       if (!Language2->select_text(sec_lang)) {
                Language2->select(n + 1);
                fl_set_input(fd_form_keymap->OtherKeymap2, sec_lang.c_str());
        }
@@ -325,7 +308,7 @@ void Intl::InitKeyMapper(bool on)
        if (keymapon)
                Keymap(23); // turn primary on
 
-       trans->setCharset(lyxrc.font_norm.c_str());
+       trans->setCharset(lyxrc.font_norm);
 }