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