From ee1fc9130aba1d9a5248aa65f1329bfe51532c49 Mon Sep 17 00:00:00 2001 From: Juergen Spitzmueller Date: Thu, 23 Aug 2012 17:42:53 +0200 Subject: [PATCH] Add support for some basic non-unicoded IPA macros We now support everything on the IPA chart via the toolbar --- development/FORMAT | 29 + .../ipa/ipamacro-insert_deco_bottomtiebar.png | Bin 0 -> 529 bytes .../ipa/ipamacro-insert_deco_toptiebar.png | Bin 0 -> 527 bytes .../ipa/ipamacro-insert_tone-falling.png | Bin 0 -> 379 bytes ...amacro-insert_tone-high-rising-falling.png | Bin 0 -> 353 bytes .../ipa/ipamacro-insert_tone-high-rising.png | Bin 0 -> 320 bytes .../ipa/ipamacro-insert_tone-low-rising.png | Bin 0 -> 319 bytes .../ipa/ipamacro-insert_tone-rising.png | Bin 0 -> 361 bytes .../ipa/ipamacro-insert_deco_bottomtiebar.svg | 77 +++ .../ipa/ipamacro-insert_deco_toptiebar.svg | 77 +++ .../svg/ipa/ipamacro-insert_tone-falling.svg | 71 ++ ...amacro-insert_tone-high-rising-falling.svg | 85 +++ .../ipa/ipamacro-insert_tone-high-rising.svg | 71 ++ .../ipa/ipamacro-insert_tone-low-rising.svg | 71 ++ .../svg/ipa/ipamacro-insert_tone-rising.svg | 71 ++ lib/layouts/stdinsets.inc | 10 + lib/lyx2lyx/lyx_2_1.py | 78 ++- lib/ui/stdtoolbars.inc | 12 +- src/FuncCode.h | 2 + src/LyXAction.cpp | 11 +- src/Makefile.am | 2 + src/Text.cpp | 7 + src/Text3.cpp | 47 ++ src/factory.cpp | 13 + src/insets/Inset.cpp | 3 + src/insets/InsetCode.h | 4 + src/insets/InsetIPA.cpp | 10 +- src/insets/InsetIPAMacro.cpp | 614 ++++++++++++++++++ src/insets/InsetIPAMacro.h | 181 ++++++ src/version.h | 4 +- 30 files changed, 1535 insertions(+), 15 deletions(-) create mode 100644 lib/images/ipa/ipamacro-insert_deco_bottomtiebar.png create mode 100644 lib/images/ipa/ipamacro-insert_deco_toptiebar.png create mode 100644 lib/images/ipa/ipamacro-insert_tone-falling.png create mode 100644 lib/images/ipa/ipamacro-insert_tone-high-rising-falling.png create mode 100644 lib/images/ipa/ipamacro-insert_tone-high-rising.png create mode 100644 lib/images/ipa/ipamacro-insert_tone-low-rising.png create mode 100644 lib/images/ipa/ipamacro-insert_tone-rising.png create mode 100644 lib/images/svg/ipa/ipamacro-insert_deco_bottomtiebar.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_deco_toptiebar.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_tone-falling.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_tone-high-rising-falling.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_tone-high-rising.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_tone-low-rising.svg create mode 100644 lib/images/svg/ipa/ipamacro-insert_tone-rising.svg create mode 100644 src/insets/InsetIPAMacro.cpp create mode 100644 src/insets/InsetIPAMacro.h diff --git a/development/FORMAT b/development/FORMAT index 5161594db6..a78a36adb0 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,35 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2012-08-23 Jürgen Spitzmüller + * Format incremented to 438 + Support for some IPA macros that are not unicoded. + (1) tone symbols from tipa's "tone" subpackage: + -- \tone{51} => \IPAChar \tone{51} + -- \tone{15} => \IPAChar \tone{15} + -- \tone{45} => \IPAChar \tone{45} + -- \tone{12} => \IPAChar \tone{12} + -- \tone{454} => \IPAChar \tone{454} + (2) TIPA tie bars: + -- \toptiebar{} => + \begin_inset IPADeco toptiebar + status open + + \begin_layout Plain Layout + + \end_layout + + \end_inset + -- \bottomtiebar{} => + \begin_inset IPADeco bottomtiebar + status open + + \begin_layout Plain Layout + + \end_layout + + \end_inset + 2012-08-19 Jürgen Spitzmüller * Format incremented to 437 Support for the TeX Gyre LaTeX fonts. diff --git a/lib/images/ipa/ipamacro-insert_deco_bottomtiebar.png b/lib/images/ipa/ipamacro-insert_deco_bottomtiebar.png new file mode 100644 index 0000000000000000000000000000000000000000..be494fff0c6b006c092e4ee011629e67b764fa8a GIT binary patch literal 529 zcmV+s0`C2ZP)?|VM^5Unkw=f?pfa_Sr6Ff>Oz4@!Rmje6-RwD43 Tivr?$00000NkvXXu0mjf*huTe literal 0 HcmV?d00001 diff --git a/lib/images/ipa/ipamacro-insert_deco_toptiebar.png b/lib/images/ipa/ipamacro-insert_deco_toptiebar.png new file mode 100644 index 0000000000000000000000000000000000000000..362bfc74b3a3aab0578ec83657efab01aa3807ff GIT binary patch literal 527 zcmV+q0`UEbP)#cL@hHH+vc@`MMNKt;t=*>CkD}r?|6^bn87nlWagK@z#`%ZE@Bitc!w8w zgHQN|)mVeA*o$E-;0bPGLU9)G0O!%nOzjSuxPWo|EKHrj&{6>Y0X&4Wu@nLR$9ixT z*RZ}ccVmfNF8!H71GjMwhcQ`*Ji=&Zs;ku6f_tUWx9}O0#h)*+MLfhDKHzR4a~}sH z;$vVXHeoI^e|J(^L|n%->_TFo3jrFa1!^ia=CeaJBH}3?D*h|m z8^LUOIE7QH1u<1((>T_Oeh~XHfYYkU7{MNFz{!#~rrK%SFjitGP+!)q@dq7GZrSW8 R0Y?A;002ovPDHLkV1igz+Qa|= literal 0 HcmV?d00001 diff --git a/lib/images/ipa/ipamacro-insert_tone-falling.png b/lib/images/ipa/ipamacro-insert_tone-falling.png new file mode 100644 index 0000000000000000000000000000000000000000..f5fd6c9092ee0316a1b8412dd403e913c7d74a82 GIT binary patch literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bC!3HFwb&h8MDVAa<&kznEsNqQI0P;BtJR*x3 z7#Nd4m@!`cLNHKJvcxr_Bsf2(yEr+qAXP8FD1G)j8!4coAD%9b zAsQ2VFKzUi<0#Sk@Okvn8#g322yFCGjJOfOvR={mz@exR7k!264;QsYMBHHG_SVjK z@KEheP>%2tU~#k&+bx|M`Olu+t}XFi<;=!l&ycI)XVfYUCawC_rW$kDNbZAm=f#8i zEYY%G3>xJ_w_0TVo8vc0T!vrojoG2*uN>=dtXcKa&Ell(xsRgKxoH*>YpT~4Ow#^y z&?|K9)|m@$r^vUS|Ijf%)bu`wdgU=rwT+k4+MM?!?q0P_>Y+;cjsr5+Zl9^CDfwUj z!23>uD0gqcuTtq-`|Ir_tY;jI|9kGw>K8XuDi5u!la{`3<5QlH+dlbAf%TpJ%&kjO VzNOxpmj?_322WQ%mvv4FO#q`2mRJA) literal 0 HcmV?d00001 diff --git a/lib/images/ipa/ipamacro-insert_tone-high-rising-falling.png b/lib/images/ipa/ipamacro-insert_tone-high-rising-falling.png new file mode 100644 index 0000000000000000000000000000000000000000..1ac3ab30ec70052fd21bc9636ac799167cb56297 GIT binary patch literal 353 zcmeAS@N?(olHy`uVBq!ia0vp^d_XM1!3HGvvhwHvDVAa<&kznEsNqQI0P;BtJR*x3 z7#Nd4m@!`cLNHKJvcxr_Bsf2(yEr+qAXP8FD1G)j8!4cod!8&#}(&gLHcO*1JL@96wgSo?A z)zwzBZkGP}=c=nV^V#h8w&`hpep7->l$ES*I6c@k#mK8xuDBx9>*pj3x05mUuFC*eup2>rwpF1elF{r5}E)Q3yY-y literal 0 HcmV?d00001 diff --git a/lib/images/ipa/ipamacro-insert_tone-high-rising.png b/lib/images/ipa/ipamacro-insert_tone-high-rising.png new file mode 100644 index 0000000000000000000000000000000000000000..faa5fbc81d3bd7a48f9a9a1244565b3182526d7d GIT binary patch literal 320 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bC!3HFwb&h8MDVAa<&kznEsNqQI0P;BtJR*x3 z7#Nd4m@!`cLNHKJvcxr_Bsf2(yEr+qAXP8FD1G)j8!4coy`C

J*PjmKCW70?ZY*o1bgtF#|9^zzuUb!P;!Y3f$Fyif7I>A8)) zx3}fz&svprOR(R<gTe~DWM4fD#v{Q literal 0 HcmV?d00001 diff --git a/lib/images/ipa/ipamacro-insert_tone-low-rising.png b/lib/images/ipa/ipamacro-insert_tone-low-rising.png new file mode 100644 index 0000000000000000000000000000000000000000..fd51e8dd9936ba145e59b9630849e475fc4a7033 GIT binary patch literal 319 zcmeAS@N?(olHy`uVBq!ia0vp^+(0bC!3HFwb&h8MDVAa<&kznEsNqQI0P;BtJR*x3 z7#Nd4m@!`cLNHKJvcxr_Bsf2(yEr+qAXP8FD1G)j8!4coJ)SO( zAsQ3kUeecZWfWn5@cg^cQI(VGJB0HUw3(XLE8ILYJ)nkp zc413(`i<)N@b9aiTh<@)41MV}DRj-ljW4G>e)E8B_T~rY|2*FRsCQ<;B<7sIU6a=& zw`}*DlOh=&ao}ypoRo_{#HSUs{a$zS`HRPV?eX0A3nnSQdC0jt^y{sz$vg%}xVNo- z_4E0upPVrVRiAB$59QZ=o;k^6ha3O$(9(-+3s(yEr+qAXP8FD1G)j8!4coXPz#O zAsQ2VFRk}-aTH;H@P37(4_o)aB(qH8Tp^Z&2^%9^c>YyNiu*|ObYFZRETJ=t$FA|H zf)YoUqb1w>S8;c(uQw)I7|YwI@d?jdX`+uoV{X0LD~yGq&du8nIF(gLP$3vq(i7hK^du~<}u=ei5v-TEBRuKn$)8fQ7&Mzyi zm%mcrawbu>-$FO(O`^=+Gd0;q1Pwc7YaUb_`I>cd_P&1yE7R_6eR%M2pWDHF8Nt&L zM{?8RL^e9@&azNS+t{f7#k*pW*ZaqI#_`@igexz(Es;|_vmWSU22WQ%mvv4FO#sfL Bibwze literal 0 HcmV?d00001 diff --git a/lib/images/svg/ipa/ipamacro-insert_deco_bottomtiebar.svg b/lib/images/svg/ipa/ipamacro-insert_deco_bottomtiebar.svg new file mode 100644 index 0000000000..ca1e0455c8 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_deco_bottomtiebar.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/lib/images/svg/ipa/ipamacro-insert_deco_toptiebar.svg b/lib/images/svg/ipa/ipamacro-insert_deco_toptiebar.svg new file mode 100644 index 0000000000..48921bf5a6 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_deco_toptiebar.svg @@ -0,0 +1,77 @@ + + + + + + + + image/svg+xml + + + + + + + + + + diff --git a/lib/images/svg/ipa/ipamacro-insert_tone-falling.svg b/lib/images/svg/ipa/ipamacro-insert_tone-falling.svg new file mode 100644 index 0000000000..c33e92c349 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_tone-falling.svg @@ -0,0 +1,71 @@ + + + + + + + + image/svg+xml + + + + + + + + ˥˩ + diff --git a/lib/images/svg/ipa/ipamacro-insert_tone-high-rising-falling.svg b/lib/images/svg/ipa/ipamacro-insert_tone-high-rising-falling.svg new file mode 100644 index 0000000000..d22d565748 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_tone-high-rising-falling.svg @@ -0,0 +1,85 @@ + + + + + + + + image/svg+xml + + + + + + + + | + ^ + diff --git a/lib/images/svg/ipa/ipamacro-insert_tone-high-rising.svg b/lib/images/svg/ipa/ipamacro-insert_tone-high-rising.svg new file mode 100644 index 0000000000..db09789b56 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_tone-high-rising.svg @@ -0,0 +1,71 @@ + + + + + + + + image/svg+xml + + + + + + + + ˧˥ + diff --git a/lib/images/svg/ipa/ipamacro-insert_tone-low-rising.svg b/lib/images/svg/ipa/ipamacro-insert_tone-low-rising.svg new file mode 100644 index 0000000000..057f4e3481 --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_tone-low-rising.svg @@ -0,0 +1,71 @@ + + + + + + + + image/svg+xml + + + + + + + + ˩˧ + diff --git a/lib/images/svg/ipa/ipamacro-insert_tone-rising.svg b/lib/images/svg/ipa/ipamacro-insert_tone-rising.svg new file mode 100644 index 0000000000..361e83b68a --- /dev/null +++ b/lib/images/svg/ipa/ipamacro-insert_tone-rising.svg @@ -0,0 +1,71 @@ + + + + + + + + image/svg+xml + + + + + + + + ˩˥ + diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc index 11d86a0c5b..68a3f5533a 100644 --- a/lib/layouts/stdinsets.inc +++ b/lib/layouts/stdinsets.inc @@ -170,6 +170,16 @@ InsetLayout Phantom ForcePlain true End +InsetLayout IPADeco + Decoration minimalistic + Font + Color foreground + EndFont + MultiPar false + CustomPars false + ForcePlain true +End + InsetLayout TOC:Listings # We need the [[List of Listings]] context, since "Listings" is also # the name of the inset and translated differently. diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index ac2452af23..ce0ff226f4 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -913,6 +913,76 @@ def revert_texgyre(document): preamble = "\\usepackage{%s}" % val add_to_preamble(document, [preamble]) document.header[i] = "\\font_typewriter default" + + +def revert_ipadeco(document): + " Revert IPA decorations to ERT " + i = 0 + while True: + i = find_token(document.body, "\\begin_inset IPADeco", i) + if i == -1: + return + end = find_end_of_inset(document.body, i) + if end == -1: + document.warning("Can't find end of inset at line " + str(i)) + i += 1 + continue + line = document.body[i] + rx = re.compile(r'\\begin_inset IPADeco (.*)$') + m = rx.match(line) + decotype = m.group(1) + if decotype != "toptiebar" and decotype != "bottomtiebar": + document.warning("Invalid IPADeco type: " + decotype) + i = end + continue + blay = find_token(document.body, "\\begin_layout Plain Layout", i, end) + if blay == -1: + document.warning("Can't find layout for inset at line " + str(i)) + i = end + continue + bend = find_end_of_layout(document.body, blay) + if bend == -1: + document.warning("Malformed LyX document: Could not find end of IPADeco inset's layout.") + i = end + continue + substi = ["\\begin_inset ERT", "status collapsed", "", + "\\begin_layout Plain Layout", "", "", "\\backslash", + decotype + "{", "\\end_layout", "", "\\end_inset"] + substj = ["\\size default", "", "\\begin_inset ERT", "status collapsed", "", + "\\begin_layout Plain Layout", "", "}", "\\end_layout", "", "\\end_inset"] + # do the later one first so as not to mess up the numbering + document.body[bend:end + 1] = substj + document.body[i:blay + 1] = substi + i = end + len(substi) + len(substj) - (end - bend) - (blay - i) - 2 + add_to_preamble(document, "\\usepackage{tipa}") + + +def revert_ipachar(document): + ' Revert \\IPAChar to ERT ' + i = 0 + found = False + while i < len(document.body): + m = re.match(r'(.*)\\IPAChar \\(\w+\{\w+\})(.*)', document.body[i]) + if m: + found = True + before = m.group(1) + ipachar = m.group(2) + after = m.group(3) + subst = [before, + '\\begin_inset ERT', + 'status collapsed', '', + '\\begin_layout Standard', + '', '', '\\backslash', + ipachar, + '\\end_layout', '', + '\\end_inset', '', + after] + document.body[i: i+1] = subst + i = i + len(subst) + else: + i = i + 1 + if found: + add_to_preamble(document, "\\usepackage{tone}") ## @@ -944,12 +1014,14 @@ convert = [ [434, []], [435, []], [436, []], - [437, []] + [437, []], + [438, []] ] revert = [ - [434, [revert_texgyre]], - [434, [revert_mathdesign]], + [437, [revert_ipadeco, revert_ipachar]], + [436, [revert_texgyre]], + [435, [revert_mathdesign]], [434, [revert_txtt]], [433, [revert_libertine]], [432, [revert_armenian]], diff --git a/lib/ui/stdtoolbars.inc b/lib/ui/stdtoolbars.inc index 8706c60c82..1670d8b259 100644 --- a/lib/ui/stdtoolbars.inc +++ b/lib/ui/stdtoolbars.inc @@ -1021,6 +1021,8 @@ ToolbarSet Item "Voiced alveolo-palatal fricative" "unicode-insert 0x0291" Item "Voiced alveolar lateral flap" "unicode-insert 0x027a" Item "Simultaneous voiceless postalveolar and velar fricative" "unicode-insert 0x0267" + Item "Top tie bar" "ipamacro-insert deco toptiebar" + Item "Bottom tie bar" "ipamacro-insert deco bottomtiebar" End Toolbar "ipa_suprasegmentals" "IPA Suprasegmentals" @@ -1084,15 +1086,15 @@ ToolbarSet Item "Downstep" "unicode-insert 0xa71c" Item "Upstep" "unicode-insert 0xa71b" Item "Rising (accent)" "unicode-insert 0x030c" -# Item "Rising (tone letter)" "" // Not covered by Unicode (def. as a sequence 0x02e9 0x02e5) + Item "Rising (tone letter)" "ipamacro-insert tone-rising" Item "Falling (accent)" "unicode-insert 0x0302" -# Item "Falling (tone letter)" "" // Not covered by Unicode (def. as a sequence 0x02e5 0x02e9) + Item "Falling (tone letter)" "ipamacro-insert tone-falling" Item "High rising (accent)" "unicode-insert 0x1dc4" -# Item "High rising (tone letter)" "" // Not covered by Unicode (def. as a sequence 0x02e7 0x02e5) + Item "High rising (tone letter)" "ipamacro-insert tone-high-rising" Item "Low rising (accent)" "unicode-insert 0x1dc5" -# Item "Low rising (tone letter)" "" // Not covered by Unicode (def. as a sequence 0x02e9 0x02e7) + Item "Low rising (tone letter)" "ipamacro-insert tone-low-rising" Item "Rising-falling (accent)" "unicode-insert 0x1dc8" -# Item "Rising-falling (tone letter)" "" // Not covered by Unicode (def. as a sequence 0x02e8 0x02e5 0x02e8) + Item "Rising-falling (tone letter)" "ipamacro-insert tone-high-rising-falling" Item "Global rise" "unicode-insert 0x2197" Item "Global fall" "unicode-insert 0x2198" End diff --git a/src/FuncCode.h b/src/FuncCode.h index a398055f1e..4924ad2c5d 100644 --- a/src/FuncCode.h +++ b/src/FuncCode.h @@ -454,6 +454,8 @@ enum FuncCode LFUN_IPA_INSERT, // spitz, 20120305 LFUN_BUFFER_FORALL, // scottkostyshak, 20120720 LFUN_IN_IPA, // spitz, 20120520 + LFUN_IPAMACRO_INSERT, // spitz, 20120822 + // 355 LFUN_LASTACTION // end of the table }; diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index bf3db52ad0..67f097195d 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -561,7 +561,16 @@ void LyXAction::init() * \endvar */ { LFUN_IN_IPA, "in-ipa", Noop, Edit }, - +/*! + * \var lyx::FuncCode lyx::LFUN_IPAMACRO_INSERT + * \li Action: Inserts special IPA characters into the document. + * \li Syntax: ipamacro-insert + * \li Params: : tone-falling, tone-rising, tone-high-rising, tone-low-rising, + * tone-high-rising-falling. + * \li Origin: JSpitzm, 22 Aug 2012 + * \endvar + */ + { LFUN_IPAMACRO_INSERT, "ipamacro-insert", Noop, Edit }, /*! * \var lyx::FuncCode lyx::LFUN_NOMENCL_INSERT * \li Action: Inserts Nomenclature entry. diff --git a/src/Makefile.am b/src/Makefile.am index 4a45f076c9..43edb94622 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -562,6 +562,7 @@ SOURCEFILESINSETS = \ insets/InsetIndex.cpp \ insets/InsetInfo.cpp \ insets/InsetIPA.cpp \ + insets/InsetIPAMacro.cpp \ insets/InsetLabel.cpp \ insets/InsetLayout.cpp \ insets/InsetLine.cpp \ @@ -619,6 +620,7 @@ HEADERFILESINSETS = \ insets/InsetIndex.h \ insets/InsetInfo.h \ insets/InsetIPA.h \ + insets/InsetIPAMacro.h \ insets/InsetPreview.h \ insets/InsetLabel.h \ insets/InsetLayout.h \ diff --git a/src/Text.cpp b/src/Text.cpp index baa9c3f1f8..a2f6992203 100644 --- a/src/Text.cpp +++ b/src/Text.cpp @@ -55,6 +55,7 @@ #include "insets/InsetNewline.h" #include "insets/InsetNewpage.h" #include "insets/InsetArgument.h" +#include "insets/InsetIPAMacro.h" #include "insets/InsetSpace.h" #include "insets/InsetSpecialChar.h" #include "insets/InsetTabular.h" @@ -479,6 +480,12 @@ void Text::readParToken(Paragraph & par, Lexer & lex, inset->read(lex); inset->setBuffer(*buf); par.insertInset(par.size(), inset.release(), font, change); + } else if (token == "\\IPAChar") { + auto_ptr inset; + inset.reset(new InsetIPAChar); + inset->read(lex); + inset->setBuffer(*buf); + par.insertInset(par.size(), inset.release(), font, change); } else if (token == "\\backslash") { par.appendChar('\\', font, change); } else if (token == "\\LyXTable") { diff --git a/src/Text3.cpp b/src/Text3.cpp index 0f429b2dbf..beebcc5b90 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -58,6 +58,7 @@ #include "insets/InsetFloatList.h" #include "insets/InsetGraphics.h" #include "insets/InsetGraphicsParams.h" +#include "insets/InsetIPAMacro.h" #include "insets/InsetNewline.h" #include "insets/InsetQuotes.h" #include "insets/InsetSpecialChar.h" @@ -227,6 +228,15 @@ static void specialChar(Cursor & cur, InsetSpecialChar::Kind kind) } +static void ipaChar(Cursor & cur, InsetIPAChar::Kind kind) +{ + cur.recordUndo(); + cap::replaceSelection(cur); + cur.insert(new InsetIPAChar(kind)); + cur.posForward(); +} + + static bool doInsertInset(Cursor & cur, Text * text, FuncRequest const & cmd, bool edit, bool pastesel) { @@ -1174,6 +1184,35 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) break; } + case LFUN_IPAMACRO_INSERT: { + string const arg = cmd.getArg(0); + if (arg == "deco") { + // Open the inset, and move the current selection + // inside it. + doInsertInset(cur, this, cmd, true, true); + cur.posForward(); + // Some insets are numbered, others are shown in the outline pane so + // let's update the labels and the toc backend. + cur.forceBufferUpdate(); + break; + } + if (arg == "tone-falling") + ipaChar(cur, InsetIPAChar::TONE_FALLING); + else if (arg == "tone-rising") + ipaChar(cur, InsetIPAChar::TONE_RISING); + else if (arg == "tone-high-rising") + ipaChar(cur, InsetIPAChar::TONE_HIGH_RISING); + else if (arg == "tone-low-rising") + ipaChar(cur, InsetIPAChar::TONE_LOW_RISING); + else if (arg == "tone-high-rising-falling") + ipaChar(cur, InsetIPAChar::TONE_HIGH_RISING_FALLING); + else if (arg.empty()) + lyxerr << "LyX function 'ipamacro-insert' needs an argument." << endl; + else + lyxerr << "Wrong argument for LyX function 'ipamacro-insert'." << endl; + break; + } + case LFUN_WORD_UPCASE: changeCase(cur, text_uppercase); break; @@ -2497,6 +2536,14 @@ bool Text::getStatus(Cursor & cur, FuncRequest const & cmd, } code = HYPERLINK_CODE; break; + case LFUN_IPAMACRO_INSERT: { + string const arg = cmd.getArg(0); + if (arg == "deco") + code = IPADECO_CODE; + else + code = IPACHAR_CODE; + break; + } case LFUN_QUOTE_INSERT: // always allow this, since we will inset a raw quote // if an inset is not allowed. diff --git a/src/factory.cpp b/src/factory.cpp index f17b91dd49..858e53f138 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -39,6 +39,7 @@ #include "insets/InsetIndex.h" #include "insets/InsetInfo.h" #include "insets/InsetIPA.h" +#include "insets/InsetIPAMacro.h" #include "insets/InsetLabel.h" #include "insets/InsetLine.h" #include "insets/InsetMarginal.h" @@ -131,6 +132,16 @@ Inset * createInsetHelper(Buffer * buf, FuncRequest const & cmd) return new InsetPhantom(buf, arg); } + case LFUN_IPAMACRO_INSERT: { + string const arg1 = cmd.getArg(0); + string const arg2 = cmd.getArg(1); + if (arg1 != "deco") { + LYXERR0("LFUN_IPAMACRO_INSERT: wrong argument"); + return 0; + } + return new InsetIPADeco(buf, arg2); + } + case LFUN_ERT_INSERT: return new InsetERT(buf); @@ -621,6 +632,8 @@ Inset * readInset(Lexer & lex, Buffer * buf) inset.reset(new InsetInfo(buf)); } else if (tmptok == "IPA") { inset.reset(new InsetIPA(buf)); + } else if (tmptok == "IPADeco") { + inset.reset(new InsetIPADeco(buf, tmptok)); } else if (tmptok == "Preview") { inset.reset(new InsetPreview(buf)); } else { diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 00a6bb938a..58a14a2e54 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -94,6 +94,9 @@ static void build_translator() insetnames[FLOAT_CODE] = InsetName("float", _("Float")); insetnames[WRAP_CODE] = InsetName("wrap"); insetnames[SPECIALCHAR_CODE] = InsetName("specialchar"); + insetnames[IPA_CODE] = InsetName("ipa"); + insetnames[IPACHAR_CODE] = InsetName("ipachar"); + insetnames[IPADECO_CODE] = InsetName("ipadeco"); insetnames[TABULAR_CODE] = InsetName("tabular", _("Table")); insetnames[EXTERNAL_CODE] = InsetName("external"); insetnames[CAPTION_CODE] = InsetName("caption"); diff --git a/src/insets/InsetCode.h b/src/insets/InsetCode.h index ee3a87c160..ea7f981231 100644 --- a/src/insets/InsetCode.h +++ b/src/insets/InsetCode.h @@ -233,6 +233,10 @@ enum InsetCode { /// IPA_CODE, /// + IPACHAR_CODE, + /// + IPADECO_CODE, + /// INSET_CODE_SIZE }; diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp index 986c02c601..a43cef12da 100644 --- a/src/insets/InsetIPA.cpp +++ b/src/insets/InsetIPA.cpp @@ -207,10 +207,10 @@ bool InsetIPA::notifyCursorLeaves(Cursor const & old, Cursor & cur) void InsetIPA::validate(LaTeXFeatures & features) const { - if (buffer_->params().useNonTeXFonts) - return; - features.require("tipa"); - features.require("tipx"); + if (!buffer_->params().useNonTeXFonts) { + features.require("tipa"); + features.require("tipx"); + } InsetText::validate(features); } @@ -239,6 +239,8 @@ bool InsetIPA::insetAllowed(InsetCode code) const switch (code) { // code that is allowed case ERT_CODE: + case IPACHAR_CODE: + case IPADECO_CODE: case SCRIPT_CODE: return true; default: diff --git a/src/insets/InsetIPAMacro.cpp b/src/insets/InsetIPAMacro.cpp new file mode 100644 index 0000000000..6e0591f7dd --- /dev/null +++ b/src/insets/InsetIPAMacro.cpp @@ -0,0 +1,614 @@ +/** + * \file InsetIPAMacro.cpp + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Jürgen Spitzmüller + * + * Full author contact details are available in file CREDITS. + */ + +#include + +#include "InsetIPAMacro.h" + +#include "Buffer.h" +#include "BufferParams.h" +#include "Dimension.h" +#include "Encoding.h" +#include "Font.h" +#include "FuncRequest.h" +#include "FuncStatus.h" +#include "LaTeXFeatures.h" +#include "Lexer.h" +#include "MetricsInfo.h" +#include "output_xhtml.h" + +#include "frontends/FontMetrics.h" +#include "frontends/Painter.h" + +#include "support/debug.h" +#include "support/docstream.h" +#include "support/gettext.h" +#include "support/Translator.h" + +using namespace std; + +namespace lyx { + +namespace { + +typedef Translator IPADecoTranslator; +typedef Translator IPADecoTranslatorLoc; + +IPADecoTranslator const init_ipadecotranslator() +{ + IPADecoTranslator translator("toptiebar", InsetIPADecoParams::Toptiebar); + translator.addPair("bottomtiebar", InsetIPADecoParams::Bottomtiebar); + return translator; +} + + +IPADecoTranslatorLoc const init_ipadecotranslator_loc() +{ + IPADecoTranslatorLoc translator(_("Top tie bar"), InsetIPADecoParams::Toptiebar); + translator.addPair(_("Bottom tie bar"), InsetIPADecoParams::Bottomtiebar); + return translator; +} + + +IPADecoTranslator const & ipadecotranslator() +{ + static IPADecoTranslator decotranslator = init_ipadecotranslator(); + return decotranslator; +} + + +IPADecoTranslatorLoc const & ipadecotranslator_loc() +{ + static IPADecoTranslatorLoc translator = init_ipadecotranslator_loc(); + return translator; +} + + +typedef Translator IPACharTranslator; + +IPACharTranslator const init_ipachartranslator() +{ + IPACharTranslator translator("\\tone{51}", InsetIPAChar::TONE_FALLING); + translator.addPair("\\tone{15}", InsetIPAChar::TONE_RISING); + translator.addPair("\\tone{45}", InsetIPAChar::TONE_HIGH_RISING); + translator.addPair("\\tone{12}", InsetIPAChar::TONE_LOW_RISING); + translator.addPair("\\tone{454}", InsetIPAChar::TONE_HIGH_RISING_FALLING); + return translator; +} + + +IPACharTranslator const & ipachartranslator() +{ + static IPACharTranslator chartranslator = init_ipachartranslator(); + return chartranslator; +} + +} // anon + + +InsetIPADecoParams::InsetIPADecoParams() + : type(Bottomtiebar) +{} + + +void InsetIPADecoParams::write(ostream & os) const +{ + string const label = ipadecotranslator().find(type); + os << "IPADeco " << label << "\n"; +} + + +void InsetIPADecoParams::read(Lexer & lex) +{ + string label; + lex >> label; + if (lex) + type = ipadecotranslator().find(label); +} + + +///////////////////////////////////////////////////////////////////// +// +// InsetIPADeco +// +///////////////////////////////////////////////////////////////////// + +InsetIPADeco::InsetIPADeco(Buffer * buf, string const & label) + : InsetCollapsable(buf) +{ + setDrawFrame(true); + setFrameColor(Color_insetframe); + params_.type = ipadecotranslator().find(label); +} + + +InsetIPADeco::~InsetIPADeco() +{} + + +docstring InsetIPADeco::layoutName() const +{ + return from_ascii("IPADeco:" + ipadecotranslator().find(params_.type)); +} + + +void InsetIPADeco::metrics(MetricsInfo & mi, Dimension & dim) const +{ + InsetText::metrics(mi, dim); + + if (params_.type == InsetIPADecoParams::Toptiebar) { + // consider width of the inset label + FontInfo font(getLayout().labelfont()); + font.realize(sane_font); + font.decSize(); + font.decSize(); + int w = 0; + int a = 0; + int d = 0; + docstring const label(1, char_type(0x2040)); + theFontMetrics(font).rectText(label, w, a, d); + dim.asc += a * 0.5; + } + if (params_.type == InsetIPADecoParams::Bottomtiebar) { + // consider width of the inset label + FontInfo font(getLayout().labelfont()); + font.realize(sane_font); + font.decSize(); + font.decSize(); + int w = 0; + int a = 0; + int d = 0; + docstring const label(1, char_type(0x203f)); + theFontMetrics(font).rectText(label, w, a, d); + dim.des += d * 1.5; + } + + // cache the inset dimension + setDimCache(mi, dim); +} + + +void InsetIPADeco::draw(PainterInfo & pi, int x, int y) const +{ + // draw the text + InsetCollapsable::draw(pi, x, y); + + // draw the inset marker + drawMarkers(pi, x, y); + + Dimension const dim = Inset::dimension(*pi.base.bv); + + if (params_.type == InsetIPADecoParams::Toptiebar) { + FontInfo font(getLayout().labelfont()); + font.realize(sane_font); + font.decSize(); + font.decSize(); + int w = 0; + int a = 0; + int d = 0; + int asc = dim.ascent(); + docstring const label(1, char_type(0x2040)); + theFontMetrics(font).rectText(label, w, a, d); + int const ww = max(dim.wid, w); + pi.pain.rectText(x + (ww - w) / 2, y - (asc / 2.5), + label, font, Color_none, Color_none); + } + + if (params_.type == InsetIPADecoParams::Bottomtiebar) { + FontInfo font(getLayout().labelfont()); + font.realize(sane_font); + font.decSize(); + font.decSize(); + int w = 0; + int a = 0; + int d = 0; + int desc = dim.descent(); + docstring const label(1, char_type(0x203f)); + theFontMetrics(font).rectText(label, w, a, d); + int const ww = max(dim.wid, w); + pi.pain.rectText(x + (ww - w) / 2, y + (desc / 1.5), + label, font, Color_none, Color_none); + } +} + + +void InsetIPADeco::write(ostream & os) const +{ + params_.write(os); + InsetCollapsable::write(os); +} + + +void InsetIPADeco::read(Lexer & lex) +{ + params_.read(lex); + InsetCollapsable::read(lex); +} + + +void InsetIPADeco::doDispatch(Cursor & cur, FuncRequest & cmd) +{ + switch (cmd.action()) { + case LFUN_QUOTE_INSERT: { + FuncRequest fr(LFUN_SELF_INSERT, "\""); + InsetText::doDispatch(cur, fr); + break; + } + default: + InsetText::doDispatch(cur, cmd); + break; + } +} + + +bool InsetIPADeco::getStatus(Cursor & cur, FuncRequest const & cmd, + FuncStatus & flag) const +{ + switch (cmd.action()) { + case LFUN_SCRIPT_INSERT: { + if (cmd.argument() == "subscript") { + flag.setEnabled(false); + return true; + } + break; + } + case LFUN_IN_IPA: + flag.setEnabled(true); + return true; + break; + default: + break; + } + return InsetText::getStatus(cur, cmd, flag); +} + + +void InsetIPADeco::latex(otexstream & os, OutputParams const & runparams) const +{ + if (params_.type == InsetIPADecoParams::Toptiebar) + os << "\\texttoptiebar{"; + else if (params_.type == InsetIPADecoParams::Bottomtiebar) + os << "\\textbottomtiebar{"; + InsetCollapsable::latex(os, runparams); + os << "}"; +} + + +int InsetIPADeco::plaintext(odocstream & os, + OutputParams const & runparams) const +{ + // FIXME: Any plaintext option here? + return InsetCollapsable::plaintext(os, runparams); +} + + +int InsetIPADeco::docbook(odocstream & os, OutputParams const & runparams) const +{ + // FIXME: Any docbook option here? + return InsetCollapsable::docbook(os, runparams); +} + + +docstring InsetIPADeco::xhtml(XHTMLStream & xs, OutputParams const & runparams) const +{ + // FIXME: Any xhtml option here? + return InsetCollapsable::xhtml(xs, runparams); +} + + +docstring InsetIPADeco::toolTip(BufferView const &, int, int) const +{ + return ipadecotranslator_loc().find(params_.type); +} + + +string InsetIPADeco::params2string(InsetIPADecoParams const & params) +{ + ostringstream data; + data << "IPADeco" << ' '; + params.write(data); + return data.str(); +} + + +void InsetIPADeco::string2params(string const & in, InsetIPADecoParams & params) +{ + params = InsetIPADecoParams(); + + if (in.empty()) + return; + + istringstream data(in); + Lexer lex; + lex.setStream(data); + lex.setContext("InsetIPADeco::string2params"); + lex >> "IPADeco" >> "toptiebar"; + + params.read(lex); +} + + +void InsetIPADeco::validate(LaTeXFeatures & features) const +{ + if (!buffer_->params().useNonTeXFonts) + features.require("tipa"); + InsetText::validate(features); +} + + +bool InsetIPADeco::insetAllowed(InsetCode code) const +{ + switch (code) { + // code that is allowed + case ERT_CODE: + case IPACHAR_CODE: + case SCRIPT_CODE: + return true; + default: + return false; + } +} + +///////////////////////////////////////////////////////////////////////// +// +// InsetIPAChar +// +///////////////////////////////////////////////////////////////////////// + + +InsetIPAChar::InsetIPAChar(Kind k) + : Inset(0), kind_(k) +{} + + +InsetIPAChar::Kind InsetIPAChar::kind() const +{ + return kind_; +} + + +void InsetIPAChar::metrics(MetricsInfo & mi, Dimension & dim) const +{ + frontend::FontMetrics const & fm = + theFontMetrics(mi.base.font); + dim.asc = fm.maxAscent(); + dim.des = fm.maxDescent(); + + string s; + switch (kind_) { + case TONE_FALLING: + case TONE_RISING: + case TONE_HIGH_RISING: + case TONE_LOW_RISING: + case TONE_HIGH_RISING_FALLING: + s = "_"; + break; + } + docstring ds(s.begin(), s.end()); + dim.wid = fm.width(ds); + setDimCache(mi, dim); +} + + +void InsetIPAChar::draw(PainterInfo & pi, int x, int y) const +{ + FontInfo font = pi.base.font; + frontend::FontMetrics const & fm = + theFontMetrics(font); + + switch (kind_) { + case TONE_FALLING: + { + int w = fm.width(char_type('-')); + int h = fm.ascent(char_type('M')); + int x2 = x + w; + int y2 = y - h; + + pi.pain.line(x2, y2, x2, y, Color_foreground); + pi.pain.line(x2, y, x, y2, Color_foreground); + break; + } + case TONE_RISING: + { + int w = fm.width(char_type('-')); + int h = fm.ascent(char_type('M')); + int x2 = x + w; + int y2 = y - h; + + pi.pain.line(x2, y, x2, y2, Color_foreground); + pi.pain.line(x2, y2, x, y, Color_foreground); + break; + } + case TONE_HIGH_RISING: + { + int w = fm.width(char_type('-')); + int h = fm.ascent(char_type('M')); + int x2 = x + w; + int y2 = y - h; + int y3 = y - (h * 0.75); + + pi.pain.line(x2, y, x2, y2, Color_foreground); + pi.pain.line(x2, y2, x, y3, Color_foreground); + break; + } + case TONE_LOW_RISING: + { + int w = fm.width(char_type('-')); + int h = fm.ascent(char_type('M')); + int x2 = x + w; + int y2 = y - h; + int y3 = y - (h * 0.25); + + pi.pain.line(x2, y, x2, y2, Color_foreground); + pi.pain.line(x2, y3, x, y, Color_foreground); + break; + } + case TONE_HIGH_RISING_FALLING: + { + int w = fm.width(char_type('-')); + int h = fm.ascent(char_type('M')); + int x2 = x + w; + int y2 = y - h; + int x3 = x + (w * 0.5); + int y3 = y - (h * 0.75); + + pi.pain.line(x2, y, x2, y2, Color_foreground); + pi.pain.line(x2, y3, x3, y2, Color_foreground); + pi.pain.line(x3, y2, x, y3, Color_foreground); + break; + } + } +} + + +void InsetIPAChar::write(ostream & os) const +{ + string const command = ipachartranslator().find(kind_); + if (command.empty()) { + LYXERR0("InsetIPAChar::write: Unknown type"); + return; + } + os << "\\IPAChar " << command << "\n"; +} + + +void InsetIPAChar::read(Lexer & lex) +{ + lex.next(); + string const command = lex.getString(); + kind_ = ipachartranslator().find(command); +} + + +void InsetIPAChar::latex(otexstream & os, + OutputParams const &) const +{ + string const command = ipachartranslator().find(kind_); + os << command; +} + + +int InsetIPAChar::plaintext(odocstream & os, OutputParams const &) const +{ + switch (kind_) { + case TONE_FALLING: + os.put(0x02e5); + os.put(0x02e9); + return 2; + case TONE_RISING: + os.put(0x02e9); + os.put(0x02e5); + return 2; + case TONE_HIGH_RISING: + os.put(0x02e7); + os.put(0x02e5); + return 2; + case TONE_LOW_RISING: + os.put(0x02e9); + os.put(0x02e7); + return 2; + case TONE_HIGH_RISING_FALLING: + os.put(0x02e8); + os.put(0x02e5); + os.put(0x02e8); + return 3; + } + return 0; +} + + +int InsetIPAChar::docbook(odocstream & /*os*/, OutputParams const &) const +{ + switch (kind_) { + // FIXME + case TONE_FALLING: + case TONE_RISING: + case TONE_HIGH_RISING: + case TONE_LOW_RISING: + case TONE_HIGH_RISING_FALLING: + break; + } + return 0; +} + + +docstring InsetIPAChar::xhtml(XHTMLStream & xs, OutputParams const &) const +{ + switch (kind_) { + case TONE_FALLING: + xs << XHTMLStream::ESCAPE_NONE << "˥" + << XHTMLStream::ESCAPE_NONE << "˩"; + break; + case TONE_RISING: + xs << XHTMLStream::ESCAPE_NONE << "˩" + << XHTMLStream::ESCAPE_NONE << "˥"; + break; + case TONE_HIGH_RISING: + xs << XHTMLStream::ESCAPE_NONE << "˧" + << XHTMLStream::ESCAPE_NONE << "˥"; + break; + case TONE_LOW_RISING: + xs << XHTMLStream::ESCAPE_NONE << "˩" + << XHTMLStream::ESCAPE_NONE << "˧"; + break; + case TONE_HIGH_RISING_FALLING: + xs << XHTMLStream::ESCAPE_NONE << "˨" + << XHTMLStream::ESCAPE_NONE << "˥" + << XHTMLStream::ESCAPE_NONE << "˨"; + break; + } + return docstring(); +} + + +void InsetIPAChar::toString(odocstream & os) const +{ + plaintext(os, OutputParams(0)); +} + + +void InsetIPAChar::forToc(docstring & os, size_t) const +{ + odocstringstream ods; + plaintext(ods, OutputParams(0)); + os += ods.str(); +} + + +void InsetIPAChar::validate(LaTeXFeatures & features) const +{ + switch (kind_) { + case TONE_FALLING: + case TONE_RISING: + case TONE_HIGH_RISING: + case TONE_LOW_RISING: + case TONE_HIGH_RISING_FALLING: + if (!buffer_->params().useNonTeXFonts) + features.require("tone"); + break; + default: + break; + } +} + + +bool InsetIPAChar::isLetter() const +{ + return true; +} + + +bool InsetIPAChar::isLineSeparator() const +{ + return false; +} + + +} // namespace lyx diff --git a/src/insets/InsetIPAMacro.h b/src/insets/InsetIPAMacro.h new file mode 100644 index 0000000000..d89d17a674 --- /dev/null +++ b/src/insets/InsetIPAMacro.h @@ -0,0 +1,181 @@ +// -*- C++ -*- +/** + * \file InsetIPAMacro.h + * This file is part of LyX, the document processor. + * Licence details can be found in the file COPYING. + * + * \author Jürgen Spitzmüller + * + * Full author contact details are available in file CREDITS. + */ + +#ifndef INSET_IPAMACRO_H +#define INSET_IPAMACRO_H + + +#include "Inset.h" +#include "InsetCollapsable.h" + + +namespace lyx { + +class LaTeXFeatures; + +class InsetIPADecoParams +{ +public: + enum Type { + Toptiebar, + Bottomtiebar + }; + /// + InsetIPADecoParams(); + /// + void write(std::ostream & os) const; + /// + void read(Lexer & lex); + /// + Type type; +}; + +///////////////////////////////////////////////////////////////////////// +// +// InsetIPADeco +// +///////////////////////////////////////////////////////////////////////// + +/// Used to insert IPA decorations +class InsetIPADeco : public InsetCollapsable +{ +public: + /// + InsetIPADeco(Buffer *, std::string const &); + /// + ~InsetIPADeco(); + /// + static std::string params2string(InsetIPADecoParams const &); + /// + static void string2params(std::string const &, InsetIPADecoParams &); + /// + InsetIPADecoParams const & params() const { return params_; } +private: + /// + InsetCode lyxCode() const { return IPADECO_CODE; } + /// + docstring layoutName() const; + /// + void metrics(MetricsInfo &, Dimension &) const; + /// + void draw(PainterInfo & pi, int x, int y) const; + /// + void write(std::ostream &) const; + /// + void read(Lexer & lex); + /// + bool neverIndent() const { return true; } + /// + void latex(otexstream &, OutputParams const &) const; + /// + int plaintext(odocstream &, OutputParams const &) const; + /// + int docbook(odocstream &, OutputParams const &) const; + /// + docstring xhtml(XHTMLStream &, OutputParams const &) const; + /// + bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const; + /// + void doDispatch(Cursor & cur, FuncRequest & cmd); + /// + void validate(LaTeXFeatures & features) const; + /// + bool allowSpellCheck() const { return false; } + /// + bool insetAllowed(InsetCode code) const; + /// + docstring toolTip(BufferView const & bv, int x, int y) const; + /// + Inset * clone() const { return new InsetIPADeco(*this); } + /// used by the constructors + void init(); + /// + friend class InsetIPADecoParams; + + /// + InsetIPADecoParams params_; +}; + + +///////////////////////////////////////////////////////////////////////// +// +// InsetIPAChar +// +///////////////////////////////////////////////////////////////////////// + +/// Used to insert special IPA chars that are not available in unicode +class InsetIPAChar : public Inset { +public: + + /// The different kinds of special chars we support + enum Kind { + /// falling tone mark + TONE_FALLING, + /// rising tone mark + TONE_RISING, + /// high-rising tone mark + TONE_HIGH_RISING, + /// low-rising tone mark + TONE_LOW_RISING, + /// high rising-falling tone mark + TONE_HIGH_RISING_FALLING + }; + + /// + InsetIPAChar() : Inset(0) {} + /// + explicit InsetIPAChar(Kind k); + /// + Kind kind() const; + /// + void metrics(MetricsInfo &, Dimension &) const; + /// + void draw(PainterInfo & pi, int x, int y) const; + /// + void write(std::ostream &) const; + /// Will not be used when lyxf3 + void read(Lexer & lex); + /// + void latex(otexstream &, OutputParams const &) const; + /// + int plaintext(odocstream &, OutputParams const &) const; + /// + int docbook(odocstream &, OutputParams const &) const; + /// + docstring xhtml(XHTMLStream &, OutputParams const &) const; + /// + void toString(odocstream &) const; + /// + void forToc(docstring &, size_t) const; + /// + InsetCode lyxCode() const { return IPACHAR_CODE; } + /// We don't need \begin_inset and \end_inset + bool directWrite() const { return true; } + /// + void validate(LaTeXFeatures &) const; + + /// should this inset be handled like a normal character? + bool isChar() const { return true; } + /// is this equivalent to a letter? + bool isLetter() const; + /// should we break lines after this inset? + bool isLineSeparator() const; +private: + Inset * clone() const { return new InsetIPAChar(*this); }; + + /// And which kind is this? + Kind kind_; +}; + + +} // namespace lyx + +#endif diff --git a/src/version.h b/src/version.h index da997c7411..8c899ad821 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 437 // spitz: support for the TeXGyre fonts -#define LYX_FORMAT_TEX2LYX 437 // spitz: support for the TeXGyre fonts +#define LYX_FORMAT_LYX 438 // spitz: support IPA macros +#define LYX_FORMAT_TEX2LYX 438 // spitz: support for IPA macros #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER