]> git.lyx.org Git - lyx.git/blob - src/lengthcommon.C
The Gtk patch.
[lyx.git] / src / lengthcommon.C
1 /**
2  * \file lengthcommon.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  * \author Matthias Ettrich
8  * \author John Levon
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "lengthcommon.h"
16
17 #include "gettext.h"
18
19
20 int const num_units = LyXLength::UNIT_NONE;
21
22 // I am not sure if "mu" should be possible to select (Lgb)
23
24 // unit_name is for compatibility. Can be deleted when all works well.
25 // means, when we have full language support for the lengths
26 // in all gui's                         (Herbert 2002-11-01)
27 char const * unit_name[num_units] = {
28         "sp", "pt", "bp", "dd", "mm", "pc",
29         "cc", "cm", "in", "ex", "em", "mu",
30         "text%",  "col%", "page%", "line%",
31         "theight%", "pheight%" };
32
33 // the latex units
34 char const * unit_name_ltx[num_units] = {
35         "sp", "pt", "bp", "dd", "mm", "pc",
36         "cc", "cm", "in", "ex", "em", "mu",
37         // in 1.4 the following names should be used. then no
38         // translation into the latex ones are needed
39 //      "textheight",  "columnwidth", "pagewidth", "linewidth",
40 //      "textheight", "pageheight" };
41         "text%",  "col%", "page%", "line%",
42         "theight%", "pheight%" };
43
44 // the LyX gui units
45 char const * unit_name_gui[num_units] = {
46         N_("sp"), N_("pt"), N_("bp"), N_("dd"), N_("mm"), N_("pc"),
47         N_("cc"), N_("cm"), N_("in"), N_("ex"), N_("em"), N_("mu"),
48         N_("text%"), N_("col%"), N_("page%"), N_("line%"),
49         N_("theight%"), N_("pheight%") };
50
51         // this one maybe better ???? but there can be problems with
52         // xforms (Herbert)
53 //      N_("textwidth%"), N_("columnwidth%"), N_("pagewidth%"), N_("linewidth%"),
54 //      N_("textheight%"), N_("pageheight%") };
55
56         // or altenative this ones
57 //      N_("twidth%"), N_("cwidth%"), N_("pwidth%"), N_("lwidth%"),
58 //      N_("theight%"), N_("pheight%") };
59
60 LyXLength::UNIT unitFromString(string const & data)
61 {
62         int i = 0;
63         while (i < num_units && data != unit_name[i])
64                 ++i;
65         return static_cast<LyXLength::UNIT>(i);
66 }