X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ftex-accent.C;h=ddfa1a7dfb8b8f87fdc229b5890fc170827eb512;hb=d9e6e32961860821ecc047039ae6c1a9dcc6e35d;hp=d8cd984bb920cc83769db35bf10ac4e36b1c75a9;hpb=4820fdd44f4f708ac1364f6a67b7a85a66be7fd0;p=lyx.git diff --git a/src/tex-accent.C b/src/tex-accent.C index d8cd984bb9..ddfa1a7dfb 100644 --- a/src/tex-accent.C +++ b/src/tex-accent.C @@ -1,24 +1,22 @@ -/* This file is part of - * ====================================================== - * - * LyX, The Document Processor - * - * Copyright 1995 Matthias Ettrich - * Copyright 1995-2000 The LyX Team. +/** + * \file tex-accent.C + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. * - * ====================================================== */ + * \author Lars Gullik Bjønnes + * \author Matthias Ettrich + * + * Full author contact details are available in file CREDITS. + */ #include -#ifdef __GNUG__ -#pragma implementation -#endif - -#include #include "tex-accent.h" -#include "commandtags.h" -#include "LString.h" -#include "support/lstrings.h" +#include "support/convert.h" + +#include + +using std::string; /* the names used by TeX and XWindows for deadkeys/accents are not the same so here follows a table to clearify the differences. Please correct this @@ -51,36 +49,36 @@ // I am not sure how some of the XWindows names coresponds to the TeX ones. tex_accent_struct lyx_accent_table[18] = { - { static_cast(0), "", "", "", static_cast(0)}, - {TEX_ACUTE, "\\'", " AEIOUYaeiouySZszRLCNrlcn", "acute", LFUN_ACUTE}, - {TEX_GRAVE, "\\`", " aeiouAEIOU", "grave", LFUN_GRAVE}, - {TEX_MACRON, "\\=", " EeAIOUaiou", "macron", LFUN_MACRON}, - {TEX_TILDE, "\\~", " ANOanoIiUu", "tilde", LFUN_TILDE}, - {TEX_UNDERBAR, "\\b", " ", "underbar", LFUN_UNDERBAR}, - {TEX_CEDILLA, "\\c", " CcSsTtRLGrlgNKnk", "cedilla", LFUN_CEDILLA}, - {TEX_UNDERDOT, "\\d", " ", "underdot", LFUN_UNDERDOT}, - {TEX_CIRCUMFLEX, "\\^", " AEIOUaeiouHJhjCGScgs", "circumflex", LFUN_CIRCUMFLEX}, - {TEX_CIRCLE, "\\r", " AaUu", "circle", LFUN_CIRCLE}, - {TEX_TIE, "\\t", " ", "tie", LFUN_TIE}, - {TEX_BREVE, "\\u", " AaGgUu", "breve", LFUN_BREVE}, - {TEX_CARON, "\\v", " LSTZlstzCEDNRcednr", "caron", LFUN_CARON}, + { static_cast(0), "", /*"",*/ "", static_cast(0)}, + {TEX_ACUTE, "\\'", /*" AEIOUYaeiouySZszRLCNrlcn",*/ "acute", LFUN_ACUTE}, + {TEX_GRAVE, "\\`", /*" aeiouAEIOU",*/ "grave", LFUN_GRAVE}, + {TEX_MACRON, "\\=", /*" EeAIOUaiou",*/ "macron", LFUN_MACRON}, + {TEX_TILDE, "\\~", /*" ANOanoIiUu",*/ "tilde", LFUN_TILDE}, + {TEX_UNDERBAR, "\\b", /*" ",*/ "underbar", LFUN_UNDERBAR}, + {TEX_CEDILLA, "\\c", /*" CcSsTtRLGrlgNKnk",*/ "cedilla", LFUN_CEDILLA}, + {TEX_UNDERDOT, "\\d", /*" ",*/ "underdot", LFUN_UNDERDOT}, + {TEX_CIRCUMFLEX, "\\^", /*" AEIOUaeiouHJhjCGScgs",*/ "circumflex", LFUN_CIRCUMFLEX}, + {TEX_CIRCLE, "\\r", /*" AaUu",*/ "circle", LFUN_CIRCLE}, + {TEX_TIE, "\\t", /*" ",*/ "tie", LFUN_TIE}, + {TEX_BREVE, "\\u", /*" AaGgUu",*/ "breve", LFUN_BREVE}, + {TEX_CARON, "\\v", /*" LSTZlstzCEDNRcednr",*/ "caron", LFUN_CARON}, // {TEX_SPECIAL_CARON, "\\q", "", "ooo", LFUN_SPECIAL_CARON}, - {TEX_HUNGUML, "\\H", " OUou", "hugarian_umlaut", LFUN_HUNG_UMLAUT}, - {TEX_UMLAUT, "\\\"", " AEIOUaeiouy", "umlaut", LFUN_UMLAUT}, - {TEX_DOT, "\\.", " ZzICGicgEe", "dot", LFUN_DOT}, - {TEX_OGONEK, "\\k", " AaEe", "ogonek", LFUN_OGONEK}, - { static_cast(0), "", "", "", static_cast(0)}}; + {TEX_HUNGUML, "\\H", /*" OUou",*/ "hugarian_umlaut", LFUN_HUNG_UMLAUT}, + {TEX_UMLAUT, "\\\"", /*" AEIOUaeiouy",*/ "umlaut", LFUN_UMLAUT}, + {TEX_DOT, "\\.", /*" ZzICGicgEe",*/ "dot", LFUN_DOT}, + {TEX_OGONEK, "\\k", /*" AaEe",*/ "ogonek", LFUN_OGONEK}, + { static_cast(0), "", /*"",*/ "", static_cast(0)}}; tex_accent_struct get_accent(kb_action action) { int i = 0; - while (i <= TEX_MAX_ACCENT){ + while (i <= TEX_MAX_ACCENT) { if (lyx_accent_table[i].action == action) return lyx_accent_table[i]; ++i; } - struct tex_accent_struct temp = { static_cast(0), 0, 0, + struct tex_accent_struct temp = { static_cast(0), 0, 0, static_cast(0)}; return temp; } @@ -89,7 +87,7 @@ tex_accent_struct get_accent(kb_action action) string const DoAccent(string const & s, tex_accent accent) { string res; - + res += lyx_accent_table[accent].cmd; res += '{'; if (s == "i" || s == "j") { @@ -103,6 +101,5 @@ string const DoAccent(string const & s, tex_accent accent) string const DoAccent(char c, tex_accent accent) { - return DoAccent(tostr(c), accent); + return DoAccent(convert(c), accent); } -