replace most &dquot;...&dquot; by <...>
[lyx.git] / src / intl.C
blobce237ed1a2eb1f1e25607233b662f335353e3ccc
1 /**
2  * \file intl.h
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author Lars Gullik Bjønnes
8  * \author Angus Leeming
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
14 #include <config.h>
16 #include "intl.h"
17 #include "debug.h"
18 #include "lyxrc.h"
21 using std::endl;
24 Intl::Intl()
25         : keymap(Intl::PRIMARY), keymapon(lyxrc.use_kbmap),
26         prim_lang(lyxrc.primary_kbmap), sec_lang(lyxrc.secondary_kbmap)
31 void Intl::KeyMapOn(bool on)
33         keymapon = on;
35         if (on) {
36                 if (keymap == PRIMARY)
37                         KeyMapPrim();
38                 else
39                         KeyMapSec();
40         } else
41                 trans.DisableKeymap();
45 void Intl::ToggleKeyMap()
47         if (keymapon && (keymap == PRIMARY)) {
48                 KeyMapSec();
49         } else if (keymapon) {
50                 KeyMapOn(false);
51         } else
52                 KeyMapPrim();
56 void Intl::KeyMapPrim()
58         if (!trans.SetPrimary(prim_lang))
59                 trans.EnablePrimary();
61         keymapon = true;
62         keymap = PRIMARY;
66 void Intl::KeyMapSec()
68         if (!trans.SetSecondary(sec_lang))
69                 trans.EnableSecondary();
71         keymapon = true;
72         keymap = SECONDARY;
76 void Intl::InitKeyMapper(bool on)
78         lyxerr[Debug::INIT] << "Initializing key mappings..." << endl;
80         if (prim_lang.empty() && sec_lang.empty())
81                 keymapon = false;
82         else
83                 keymapon = on;
85         KeyMapOn(keymapon);
87         if (keymapon)
88                 KeyMapPrim();
90         trans.SetPrimary(prim_lang);
91         trans.SetSecondary(sec_lang);
92         trans.setCharset(lyxrc.font_norm);