]> git.lyx.org Git - lyx.git/blobdiff - src/intl.C
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / intl.C
index fc6266c558be06f567f88efe099d6bd9620fa659..b96fc747a0d392e78b226b75fdbe589f2172a982 100644 (file)
@@ -1,12 +1,12 @@
 /* This file is part of
-* ======================================================
-* 
-*           LyX, The Document Processor
-*       
-*          Copyright (C) 1995 Matthias Ettrich
-*           Copyright (C) 1995-1998 The LyX Team.
-*
-*======================================================*/
+ * ======================================================
+ 
+ *           LyX, The Document Processor
+ *      
+ *           Copyright 1995 Matthias Ettrich
+ *           Copyright 1995-1999 The LyX Team.
+ *
+ * ======================================================*/
 
 /*
  *     International support for LyX
 #include "tex-strings.h"
 #include "combox.h"
 #include "lyx_gui_misc.h" // CancelCloseBoxCB
-#include "error.h"
+#include "debug.h"
 #include "lyxrc.h"
 #include "trans_mgr.h"
+#include "support/lstrings.h"
 
-
-//     $Id: intl.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $      
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: intl.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
-#endif /* lint */
-
-// lyx rc 
 extern LyXRC* lyxrc;
 
+// a wrapper around the callback static member.
+extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code);
+
 
 Intl::Intl()
        : prim_lang(lyxrc->primary_kbmap), 
@@ -45,7 +41,7 @@ Intl::Intl()
          trans(new TransManager)
 {
        keymapon = lyxrc->use_kbmap;
-       chsetcode = NULL;
+       chsetcode = 0;
        primarykeymap = false;
        curkeymap = 0;
        otherkeymap = 0;
@@ -57,18 +53,18 @@ Intl::~Intl()
 }
 
 
-int Intl::SetPrimary(LString const & lang)
+int Intl::SetPrimary(string const & lang)
 {
-       if (lyxerr.debugging(Error::KBMAP))
-               lyxerr.print("Primary: `" + lang + "'");
+       if (lyxerr.debugging(Debug::KBMAP))
+               lyxerr << "Primary: `" << lang << "'" << endl;
        return trans->SetPrimary(lang);
 }
 
 
-int Intl::SetSecondary(LString const & lang)
+int Intl::SetSecondary(string const & lang)
 {
-       if (lyxerr.debugging(Error::KBMAP))
-               lyxerr.print("Secondary: `" + lang + "'");
+       if (lyxerr.debugging(Debug::KBMAP))
+               lyxerr << "Secondary: `" << lang << "'" << endl;
        return trans->SetSecondary(lang);
 }
 
@@ -134,7 +130,7 @@ void Intl::ToggleKeyMap()
 void Intl::KeyMapPrim()
 {
        int i;
-       LString p;
+       string p;
 
        fl_set_button(fd_form_keymap->KeyOffBtn, 0);
        fl_set_button(fd_form_keymap->KeyOnBtn, 1);
@@ -143,8 +139,8 @@ void Intl::KeyMapPrim()
        /* read text from choice */
        i = Language->get();
        
-       if (lyxerr.debugging(Error::KBMAP))
-               lyxerr.print(LString("Table: ") + tex_babel[i-1]);
+       if (lyxerr.debugging(Debug::KBMAP))
+               lyxerr << "Table: " << tex_babel[i-1] << endl;
 
        if (i == otherkeymap)
                p = fl_get_input(fd_form_keymap->OtherKeymap);
@@ -170,7 +166,7 @@ void Intl::KeyMapPrim()
 void Intl::KeyMapSec()
 {
        int i;
-       LString p;
+       string p;
 
        fl_set_button(fd_form_keymap->KeyOffBtn, 0);
        fl_set_button(fd_form_keymap->KeyOnBtn, 0);
@@ -179,8 +175,8 @@ void Intl::KeyMapSec()
        /* read text from choice */
        i = Language2->get();
        
-       if (lyxerr.debugging(Error::KBMAP))
-               lyxerr.print(LString("Table: ") + tex_babel[i-1]);
+       if (lyxerr.debugging(Debug::KBMAP))
+               lyxerr << "Table: " << tex_babel[i-1] << endl;
 
        if (i == otherkeymap)
                p = fl_get_input(fd_form_keymap->OtherKeymap2);
@@ -229,14 +225,18 @@ void Intl::DispatchCallback(FL_OBJECT *ob,long code)
        
        Intl *itl=(Intl *)ob->u_vdata;
 
-       if (itl!=NULL) itl->Keymap(code);
+       if (itl!=0) itl->Keymap(code);
 }
 
+extern "C" void C_Intl_DispatchCallback(FL_OBJECT *ob,long code)
+{
+       Intl::DispatchCallback(ob,code);
+}
 
 void Intl::InitKeyMapper(bool on)
        /* initialize key mapper */
 {
-       lyxerr.debug("Initializing key mappings...", Error::KBMAP);
+       lyxerr[Debug::KBMAP] << "Initializing key mappings..." << endl;
 
        if (prim_lang.empty() && sec_lang.empty())
                keymapon = false; 
@@ -260,16 +260,22 @@ void Intl::InitKeyMapper(bool on)
                fd_form_keymap->KeyOnBtn2->u_vdata=(void *)this;
 
        // add the callbacks.
-       fl_set_object_callback(fd_form_keymap->AcceptChset,DispatchCallback,27);
-       fl_set_object_callback(fd_form_keymap->Charset,DispatchCallback,26);
-       fl_set_object_callback(fd_form_keymap->Accept,DispatchCallback,0);
-
-       fl_set_object_callback(fd_form_keymap->KeyOnBtn,DispatchCallback,23);
-       fl_set_object_callback(fd_form_keymap->KeyOffBtn,DispatchCallback,3);
-       fl_set_object_callback(fd_form_keymap->KeyOnBtn2,DispatchCallback,43);
+       fl_set_object_callback(fd_form_keymap->AcceptChset,
+                              C_Intl_DispatchCallback,27);
+       fl_set_object_callback(fd_form_keymap->Charset,
+                              C_Intl_DispatchCallback,26);
+       fl_set_object_callback(fd_form_keymap->Accept,
+                              C_Intl_DispatchCallback,0);
+
+       fl_set_object_callback(fd_form_keymap->KeyOnBtn,
+                              C_Intl_DispatchCallback,23);
+       fl_set_object_callback(fd_form_keymap->KeyOffBtn,
+                              C_Intl_DispatchCallback,3);
+       fl_set_object_callback(fd_form_keymap->KeyOnBtn2,
+                              C_Intl_DispatchCallback,43);
        
        // Make sure pressing the close box does not kill LyX. (RvdK)
-       fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, NULL);
+       fl_set_form_atclose(fd_form_keymap->KeyMap, CancelCloseBoxCB, 0);
 
        fl_hide_object(fd_form_keymap->KeymapErr);
        fl_hide_object(fd_form_keymap->ChsetErr);
@@ -321,8 +327,8 @@ void Intl::Keymap(long code)
 {
        char const *p;
 
-       if (lyxerr.debugging(Error::KBMAP))
-               lyxerr.print(LString("KeyMap callback: ") + code);
+       if (lyxerr.debugging(Debug::KBMAP))
+               lyxerr << "KeyMap callback: " << code << endl;
 
        switch (code) {
        case 0: