From 53c08828929823f8e111e4d0df5aa9a007216694 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Tue, 10 Oct 2000 17:04:50 +0000 Subject: [PATCH] Dekel's RTL numbers patch, fix for crash with free fonts and a few finnish locale improvements git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/lyx-1_1_5@1098 a592a061-630c-0410-9148-cb99ea01b6c8 --- ChangeLog | 21 ++++++++ lib/bind/fi_menus.bind | 89 ++++++++++++++++++++-------------- po/fi.po | 106 ++++++++++++++++++++--------------------- src/buffer.C | 3 ++ src/bufferview_funcs.C | 9 +++- src/bufferview_funcs.h | 2 + src/lyx_gui.C | 2 +- src/lyxfont.C | 33 +++++++++---- src/lyxfont.h | 39 +++++++++++++-- src/spellchecker.C | 5 +- src/text.C | 43 ++++++++++++++++- src/text2.C | 3 +- 12 files changed, 245 insertions(+), 110 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51523496c6..19b152d55e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +2000-10-10 Dekel Tsur + + * src/lyx_gui.C (create_forms): Fix crash with locales. + +2000-10-09 Jean-Marc Lasgouttes + + * lib/bind/fi_menus.bind: update from pauli.virtanen@saunalahti.fi. + +2000-10-06 Jean-Marc Lasgouttes + + * src/spellchecker.C: make sure we only include strings.h when + _AIX is defined. + +2000-10-05 Dekel Tsur + + * buffer.C + * bufferview_funcs.[Ch] + * lyxfont.[Ch] + * text.C + * text2.C: Add support for numbers in RTL text. + 2000-10-04 Jean-Marc Lasgouttes * src/mathed/math_parser.C (LexInitCodes): set lexcode of "@" to diff --git a/lib/bind/fi_menus.bind b/lib/bind/fi_menus.bind index 912e324f40..21699703ec 100644 --- a/lib/bind/fi_menus.bind +++ b/lib/bind/fi_menus.bind @@ -10,6 +10,8 @@ # Adapted to the finnish internationalization December 22 1999 # by pauli.virtanen@saunalahti.fi # +# Last updated: 6 Oct 2000 +# # Key bindings for menus, both invisible and visible. @@ -19,11 +21,13 @@ \bind "F10 t" "menu-open Tiedosto" \bind "F10 m" "menu-open Muokkaa" +\bind "F10 s" "menu-open Sisällys" +\bind "F10 v" "menu-open Viitteet" \bind "F10 u" "menu-open Muotoile" \bind "F10 l" "menu-open Lisää" -\bind "F10 e" "menu-open Matematiikka" +\bind "F10 e" "menu-open Matem." \bind "F10 a" "menu-open Asetukset" -\bind "F10 k" "menu-open Asiakirjat" +\bind "F10 j" "menu-open Asiakirjat" \bind "F10 o" "menu-open Ohje" @@ -55,7 +59,7 @@ \bind "M-t e h" "buffer-export html" \bind "M-t e o" "buffer-export custom" \bind "M-t p" "lyx-quit" -\bind "M-t space" "menu-open File" +\bind "M-t space" "menu-open Tiedosto" # # Edit menu @@ -73,11 +77,18 @@ \bind "M-m o" "spellchecker" \bind "M-m x" "buffer-chktex" -\bind "M-m s" "toc-view" +\bind "M-m y" "toc-view" \bind "M-m n" "latex-view-log" -\bind "M-m space" "menu-open Edit" +\bind "M-m space" "menu-open Muokkaa" + + +# +# Refs menu +# +\bind "M-v p" "reference-back" +\bind "M-v space" "menu-open Viitteet" # # Layout menu @@ -96,7 +107,8 @@ \bind "M-u y" "depth-next" \bind "M-u e" "layout-preamble" \bind "M-u u" "layout-save-default" -\bind "M-u space" "menu-open Layout" +\bind "M-u i" "appendix" +\bind "M-u space" "menu-open Muotoile" # @@ -105,43 +117,43 @@ \bind "M-l k" "figure-insert" \bind "M-l t" "table-insert" -\bind "M-l s" "buffer-child-insert" +\bind "M-l y" "buffer-child-insert" \bind "M-l c r" "file-insert-ascii line" \bind "M-l c k" "file-insert-ascii paragraph" \bind "M-l x" "file-insert" \bind "M-l a" "footnote-insert" \bind "M-l r" "marginpar-insert" -\bind "M-l o k" "buffer-float-insert figure" -\bind "M-l o t" "buffer-float-insert table" -\bind "M-l o l" "buffer-float-insert wide-fig" -\bind "M-l o e" "buffer-float-insert wide-tab" -\bind "M-l o a" "buffer-float-insert algorithm" +\bind "M-l i k" "buffer-float-insert figure" +\bind "M-l i t" "buffer-float-insert table" +\bind "M-l i l" "buffer-float-insert wide-fig" +\bind "M-l i e" "buffer-float-insert wide-tab" +\bind "M-l i a" "buffer-float-insert algorithm" -\bind "M-l t s" "toc-insert" -\bind "M-l t k" "lof-insert" -\bind "M-l t t" "lot-insert" -\bind "M-l t a" "loa-insert" -\bind "M-l t h" "index-print" -\bind "M-l t b" "bibtex-insert" +\bind "M-l l s" "toc-insert" +\bind "M-l l k" "lof-insert" +\bind "M-l l t" "lot-insert" +\bind "M-l l a" "loa-insert" +\bind "M-l l h" "index-print" +\bind "M-l l b" "bibtex-insert" -\bind "M-l s v" "hfill-insert" -\bind "M-l e t" "hyphenation-point-insert" -\bind "M-l e k" "protected-space-insert" -\bind "M-l e r" "break-line" -\bind "M-l e e" "dots-insert" -\bind "M-l e v" "end-of-sentence-period-insert" -\bind "M-l e l" "quote-insert" -\bind "M-l e m" "menu-separator-insert" +\bind "M-l o v" "hfill-insert" +\bind "M-l o t" "hyphenation-point-insert" +\bind "M-l o k" "protected-space-insert" +\bind "M-l o r" "break-line" +\bind "M-l o e" "dots-insert" +\bind "M-l o p" "end-of-sentence-period-insert" +\bind "M-l o l" "quote-insert" +\bind "M-l o m" "menu-separator-insert" -\bind "M-l h" "note-insert" +\bind "M-l p" "note-insert" \bind "M-l n" "label-insert" \bind "M-l v" "reference-insert" -\bind "M-l i" "citation-insert" -\bind "M-l k" "index-insert" -\bind "M-l e" "index-insert-last" +\bind "M-l d" "citation-insert" +\bind "M-l m" "index-insert" +\bind "M-l s" "index-insert-last" \bind "M-l u" "url-insert" -\bind "M-l space" "menu-open Insert" +\bind "M-l space" "menu-open Lisää" @@ -158,7 +170,7 @@ \bind "M-e t" "math-mode" \bind "M-e k" "math-display" #bind "M-e p" "display-math-panel-or-something" # What function to use? -\bind "M-e space" "menu-open Math" +\bind "M-e space" "menu-open Matem." # # Options menu @@ -168,8 +180,8 @@ #bind "M-a o" "spellcheck-options" # Not yet implemented! #bind "M-a n" "keyboard-options" # Not yet implemented! #bind "M-a l" "latex-options" # Not yet implemented! -\bind "M-a u" "reconfigure" -\bind "M-a space" "menu-open Options" +\bind "M-a k" "reconfigure" +\bind "M-a space" "menu-open Asetukset" # @@ -177,8 +189,8 @@ # # These are now defined in cua or emacs bind files so their "standard" # bindings are available. (eg M-d "word-delete-forward" in emacs) ARRae -#\bind "M-d p" "buffer-previous" -#\bind "M-d space" "menu-open Documents" +#\bind "M-k p" "buffer-previous" +\bind "M-j space" "menu-open Asiakirjat" # @@ -197,7 +209,10 @@ #bind "M-o t" "help-copyright" # Not yet implemented! #bind "M-o k" "help-credits" # Not yet implemented! #bind "M-o v" "help-version" # Not yet implemented! -\bind "M-o space" "menu-open Help" +\bind "M-o space" "menu-open Ohje" + + +## Below this the bindings aren't localized. # diff --git a/po/fi.po b/po/fi.po index eb2facc911..99344fa64c 100644 --- a/po/fi.po +++ b/po/fi.po @@ -9,8 +9,8 @@ msgid "" msgstr "" "Project-Id-Version: lyx 1.1.5fix1\n" -"POT-Creation-Date: 2000-10-04 17:06+0300\n" -"PO-Revision-Date: 2000-10-03 13:44+03:00\n" +"POT-Creation-Date: 2000-10-04 21:18+0300\n" +"PO-Revision-Date: 2000-10-06 18:51+03:00\n" "Last-Translator: Pauli Virtanen \n" "Language-Team: Finnish, out-of-team\n" "MIME-Version: 1.0\n" @@ -22,160 +22,160 @@ msgstr "" #. or stop loading the file. #. I can substitute but I don't see how I can #. stop loading... ideas?? ARRae980418 -#: src/buffer.C:399 +#: src/buffer.C:403 msgid "Textclass Loading Error!" msgstr "Virhe tekstiluokan lataamisessa!" -#: src/buffer.C:400 +#: src/buffer.C:404 msgid "Can't load textclass " msgstr "Tekstiluokkaa ei voi ladata " -#: src/buffer.C:402 +#: src/buffer.C:406 msgid "-- substituting default" msgstr "-- korvautuu oletuksella" -#: src/buffer.C:1092 +#: src/buffer.C:1096 #, c-format msgid "Warning: need lyxformat %.2f but found %.2f\n" msgstr "" "Varoitus: tarvittava LyX-tiedostomuoto on %.2f, mutta tunnistettu on %.2f\n" -#: src/buffer.C:1096 +#: src/buffer.C:1100 #, c-format msgid "ERROR: need lyxformat %.2f but found %.2f\n" msgstr "" "Virhe: tarvittava LyX-tiedostomuoto on %.2f, mutta tunnistettu on %.2f\n" -#: src/buffer.C:1107 +#: src/buffer.C:1111 msgid "Warning!" msgstr "Varoitus!" -#: src/buffer.C:1108 +#: src/buffer.C:1112 msgid "Reading of document is not complete" msgstr "Asiakirjaa ei ole vielä luettu kokonaan" -#: src/buffer.C:1109 +#: src/buffer.C:1113 msgid "Maybe the document is truncated" msgstr "Asiakirja saattaa olla typistetty" #. "\\lyxformat" not found -#: src/buffer.C:1115 src/buffer.C:1122 src/buffer.C:1125 +#: src/buffer.C:1119 src/buffer.C:1126 src/buffer.C:1129 msgid "ERROR!" msgstr "VIRHE!" -#: src/buffer.C:1116 +#: src/buffer.C:1120 msgid "Old LyX file format found. Use LyX 0.10.x to read this!" msgstr "Vanha LyX-tiedostomuoto tunnistettu. Lue version 0.10.x avulla!" -#: src/buffer.C:1122 +#: src/buffer.C:1126 msgid "Not a LyX file!" msgstr "Ei ole LyX-tiedosto!" -#: src/buffer.C:1125 +#: src/buffer.C:1129 msgid "Unable to read file!" msgstr "Tiedostoa ei voi lukea!" -#: src/buffer.C:1205 +#: src/buffer.C:1209 msgid "Could not delete auto-save file!" msgstr "Automaattista tallennustiedostoa ei voi poistaa!" -#: src/buffer.C:1231 src/buffer.C:1234 +#: src/buffer.C:1235 src/buffer.C:1238 msgid "Error! Document is read-only: " msgstr "Virhe! Kirjoitussuojattu asiakirja:" -#: src/buffer.C:1244 src/buffer.C:1247 +#: src/buffer.C:1248 src/buffer.C:1251 msgid "Error! Cannot write file: " msgstr "Virhe! Tiedostoon ei voi kirjoittaa:" -#: src/buffer.C:1255 src/buffer.C:1258 +#: src/buffer.C:1259 src/buffer.C:1262 msgid "Error! Cannot open file: " msgstr "Virhe! Tiedostoa ei voi avata:" -#: src/buffer.C:1304 +#: src/buffer.C:1320 msgid "Error: Cannot write file:" msgstr "Virhe: Tiedostoon ei voi kirjoittaa:" -#: src/buffer.C:1635 +#: src/buffer.C:1651 msgid "Error: Cannot open file: " msgstr "Virhe: Tiedostoa ei voi avata:" -#: src/buffer.C:2238 src/buffer.C:2843 src/buffer.C:3499 +#: src/buffer.C:2254 src/buffer.C:2859 src/buffer.C:3515 msgid "LYX_ERROR:" msgstr "LYX_VIRHE:" -#: src/buffer.C:2238 src/buffer.C:2843 +#: src/buffer.C:2254 src/buffer.C:2859 msgid "Cannot write file" msgstr "Tiedostoon ei voi kirjoittaa" -#: src/buffer.C:2314 src/buffer.C:2926 +#: src/buffer.C:2330 src/buffer.C:2942 msgid "Error : Wrong depth for LatexType Command.\n" msgstr "Virhe : Väärä syvyys LatexType-komennoksi.\n" #. path to LaTeX file -#: src/buffer.C:3248 +#: src/buffer.C:3264 msgid "Running LaTeX..." msgstr "LaTeX on käynnissä..." -#: src/buffer.C:3266 +#: src/buffer.C:3282 msgid "LaTeX did not work!" msgstr "LaTeX ei toiminut!" -#: src/buffer.C:3267 src/buffer.C:3334 src/buffer.C:3404 +#: src/buffer.C:3283 src/buffer.C:3350 src/buffer.C:3420 msgid "Missing log file:" msgstr "Puuttuva lokitiedosto:" #. no errors or any other things to think about so: -#: src/buffer.C:3269 src/buffer.C:3278 src/buffer.C:3336 src/buffer.C:3345 -#: src/buffer.C:3406 src/buffer.C:3414 src/combox.C:461 +#: src/buffer.C:3285 src/buffer.C:3294 src/buffer.C:3352 src/buffer.C:3361 +#: src/buffer.C:3422 src/buffer.C:3430 src/combox.C:461 msgid "Done" msgstr "Valmis" #. path to Literate file -#: src/buffer.C:3314 +#: src/buffer.C:3330 msgid "Running Literate..." msgstr "Literate on käynnissä..." -#: src/buffer.C:3333 +#: src/buffer.C:3349 msgid "Literate command did not work!" msgstr "Literate-komento ei toiminut!" #. path to Literate file -#: src/buffer.C:3381 +#: src/buffer.C:3397 msgid "Building Program..." msgstr "Build-ohjelma käynnissä..." -#: src/buffer.C:3403 +#: src/buffer.C:3419 msgid "Build did not work!" msgstr "Build ei toiminut!" #. path to LaTeX file -#: src/buffer.C:3451 +#: src/buffer.C:3467 msgid "Running chktex..." msgstr "chktex on käynnissä..." -#: src/buffer.C:3464 +#: src/buffer.C:3480 msgid "chktex did not work!" msgstr "chktex ei toiminut!" -#: src/buffer.C:3465 +#: src/buffer.C:3481 msgid "Could not run with file:" msgstr "Ohjelma ei voinut käsitellä tiedostoa:" -#: src/buffer.C:3500 +#: src/buffer.C:3516 msgid "Cannot open temporary file:" msgstr "Väliaikaistiedostoa ei voi avata:" -#: src/buffer.C:3578 +#: src/buffer.C:3594 msgid "Error! Can't open temporary file:" msgstr "Virhe! Väliaikaistiedostoa ei voi avata:" -#: src/BufferView2.C:61 src/BufferView2.C:71 src/buffer.C:3585 +#: src/BufferView2.C:61 src/BufferView2.C:71 src/buffer.C:3601 #: src/bufferlist.C:411 src/lyx_cb.C:396 src/lyx_cb.C:758 src/lyx_cb.C:784 #: src/lyx_sendfax_main.C:264 src/menus.C:2130 msgid "Error!" msgstr "Virhe!" -#: src/buffer.C:3586 +#: src/buffer.C:3602 msgid "Error executing *roff command on table" msgstr "Virhe suoritettaessa *roff-komentoa taulukkoon" @@ -3549,11 +3549,11 @@ msgstr "Sulje" #: src/lyx_gui_misc.C:412 src/lyx_gui_misc.C:421 src/lyx_gui_misc.C:425 msgid "Yes|Yy#y" -msgstr "Kyllä|kK#k" +msgstr "Kyllä|Kk#k" #: src/lyx_gui_misc.C:413 src/lyx_gui_misc.C:422 src/lyx_gui_misc.C:426 msgid "No|Nn#n" -msgstr "Ei|eE#e" +msgstr "Ei|Ee#e" #: src/lyx_gui_misc.C:436 msgid "Clear|#e" @@ -4038,7 +4038,7 @@ msgstr "Lis #: src/menus.C:195 src/menus.C:331 src/menus.C:332 src/menus.C:333 msgid "Math" -msgstr "Matematiikka" +msgstr "Matem." #: src/menus.C:201 src/menus.C:210 src/menus.C:373 src/menus.C:374 #: src/menus.C:375 src/menus.C:434 src/menus.C:435 src/menus.C:436 @@ -4079,7 +4079,7 @@ msgstr "MB|#A" #: src/menus.C:363 msgid "MB|#D" -msgstr "MB|#k" +msgstr "MB|#j" #: src/menus.C:377 src/menus.C:438 msgid "MB|#H" @@ -4600,7 +4600,7 @@ msgstr "EM|Xx#x#X" #: src/menus.C:1159 msgid "EM|Tt#t#T" -msgstr "EM|Tt#t#T" +msgstr "EM|yY#y#Y" #. fl_setpup_shortcut(EditMenu, 14, scex(_("EM|Ff#f#F"))); #. fl_setpup_shortcut(EditMenu, 15, scex(_("EM|bB#b#B"))); @@ -4790,15 +4790,15 @@ msgstr "" #: src/menus.C:1719 msgid "IMF|gG#g#G" -msgstr "IMF|Kk#k#K" +msgstr "IMF|kK#k#K" #: src/menus.C:1720 msgid "IMF|Tt#t#T" -msgstr "IMF|Tt#t#T" +msgstr "IMF|tT#t#T" #: src/menus.C:1721 msgid "IMF|Ww#w#W" -msgstr "IMF|Ll#l#L" +msgstr "IMF|lL#l#L" #: src/menus.C:1722 msgid "IMF|iI#i#I" @@ -4806,7 +4806,7 @@ msgstr "IMF|eE#e#E" #: src/menus.C:1723 msgid "IMF|Aa#a#A" -msgstr "IMF|Aa#a#A" +msgstr "IMF|aA#a#A" #: src/menus.C:1726 msgid "" @@ -4840,7 +4840,7 @@ msgstr "IMS|Ee#e#E" #: src/menus.C:1741 msgid "IMS|Ee#e#E" -msgstr "IMS|Vv#v#V" +msgstr "IMS|pP#p#P" #: src/menus.C:1742 msgid "IMS|Qq#q#Q" @@ -4856,11 +4856,7 @@ msgid "" "File...%l|Footnote|Margin Note|Floats%m%l|Lists & TOC%m%l|Special " "Character%m%l|Note...|Label...|Cross-Reference...|Citation " "Reference...|Index entry...|Index entry of last word" -msgstr "" -"Kuva...|Taulukko...%l|Sisällytä tiedosto...|Tuo ASCII-tiedosto%m|Lisää " -"LyX-tiedosto...%l|Alaviite|Reunahuomautus|Irralliset " -"osat%m%l|Luettelot%m%l|Erikoismerkki%m%l|Huomautus...|Nimike...|Viite...|Lähd" -"eviite...|Hakemistoviite...|Hakemistoviite edeltävästä sanasta" +msgstr "Kuva...|Taulukko...%l|Sisällytä tiedosto...|Tuo ASCII-tiedosto%m|Lisää LyX-tiedosto...%l|Alaviite|Reunahuomautus|Irralliset osat%m%l|Luettelot%m%l|Erikoismerkki%m%l|Muistiinpano...|Nimike...|Viite...|Lähdeviite...|Hakemistoviite...|Hakemistoviite edeltävästä sanasta" #: src/menus.C:1767 msgid "IM|gG#g#G" @@ -4904,7 +4900,7 @@ msgstr "IM|oO#o#O" #: src/menus.C:1777 msgid "IM|Nn#n#N" -msgstr "IM|Hh#h#H" +msgstr "IM|pP#p#P" #: src/menus.C:1778 msgid "IM|Ll#l#L" diff --git a/src/buffer.C b/src/buffer.C index 1265157a25..773e064de7 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -697,6 +697,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par, font.setLanguage(params.language_info); lex.printError("Unknown language `$$Token'"); } + } else if (token == "\\numeric") { + lex.next(); + font.setNumber(font.setLyXMisc(lex.GetString())); } else if (token == "\\emph") { lex.next(); font.setEmph(font.setLyXMisc(lex.GetString())); diff --git a/src/bufferview_funcs.C b/src/bufferview_funcs.C index fcfbc1ee50..c3bd4fab97 100644 --- a/src/bufferview_funcs.C +++ b/src/bufferview_funcs.C @@ -78,6 +78,12 @@ void Lang(BufferView * bv, string const & l) WriteAlert(_("Error! unknown language"),l); } +void Number(BufferView * bv) +{ + LyXFont font(LyXFont::ALL_IGNORE); + font.setNumber(LyXFont::TOGGLE); + ToggleAndShow(bv, font); +} void Melt(BufferView * bv) { @@ -295,7 +301,8 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font) bv->update(1); if (font.language() != ignore_language || - font.latex() != LyXFont::IGNORE) { + font.latex() != LyXFont::IGNORE || + font.number() != LyXFont::IGNORE) { LyXText * text = bv->text; LyXCursor & cursor = text->cursor; text->ComputeBidiTables(cursor.row); diff --git a/src/bufferview_funcs.h b/src/bufferview_funcs.h index ada69da5ea..018b7cc8a5 100644 --- a/src/bufferview_funcs.h +++ b/src/bufferview_funcs.h @@ -24,6 +24,8 @@ extern void Table(); /// extern void Lang(BufferView *, string const &); /// +extern void Number(BufferView *); +/// extern void Melt(BufferView *); /// extern void Tex(BufferView *); diff --git a/src/lyx_gui.C b/src/lyx_gui.C index 6841d5c1c1..9029523daa 100644 --- a/src/lyx_gui.C +++ b/src/lyx_gui.C @@ -404,7 +404,7 @@ void LyXGUI::create_forms() combo_language->addto((*cit).second.lang.c_str()); combo_language2->addto((*cit).second.lang.c_str()); } - combo_language2->select_text("No change"); + combo_language2->select_text(_("No change")); // not really necessary, but we can do it anyway. fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12"); diff --git a/src/lyxfont.C b/src/lyxfont.C index 5239fbba8f..e587f47213 100644 --- a/src/lyxfont.C +++ b/src/lyxfont.C @@ -290,6 +290,7 @@ void LyXFont::update(LyXFont const & newfont, setNoun(setMisc(newfont.noun(), noun())); setLatex(setMisc(newfont.latex(), latex())); + setNumber(setMisc(newfont.number(), number())); if (newfont.language() == language() && toggleall) if (language() == document_language) setLanguage(default_language); @@ -413,6 +414,8 @@ string LyXFont::stateText(BufferParams * params) const ost << _("Default") << ", "; if (!params || language() != params->language_info) ost << _("Language: ") << _(language()->display.c_str()); + if (number() != OFF) + ost << _(" Number ") << _(GUIMiscNames[number()]); #ifdef HAVE_SSTREAM string buf(ost.str().c_str()); #else @@ -621,6 +624,9 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const if (orgfont.emph() != emph()) { os << "\\emph " << LyXMiscNames[emph()] << " \n"; } + if (orgfont.number() != number()) { + os << "\\numeric " << LyXMiscNames[number()] << " \n"; + } if (orgfont.underbar() != underbar()) { // This is only for backwards compatibility switch (underbar()) { @@ -686,11 +692,9 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, if (isRightToLeft()) { os << "\\R{"; count += 3; - env = true; //We have opened a new environment } else { os << "\\L{"; count += 3; - env = true; //We have opened a new environment } } else { string tmp = '{' + @@ -698,10 +702,15 @@ int LyXFont::latexWriteStartChanges(ostream & os, LyXFont const & base, "$$lang", language()->lang); os << tmp; count += tmp.length(); - env = true; //We have opened a new environment } } + if (number() == ON && prev.number() != ON && + language()->lang == "hebrew") { + os << "{\\beginL "; + count += 9; + } + LyXFont f = *this; f.reduce(base); @@ -773,18 +782,13 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, int count = 0; bool env = false; - if (language() != base.language() && language() != next.language()) { - os << "}"; - ++count; - env = true; // Size change need not bother about closing env. - } - LyXFont f = *this; // why do you need this? f.reduce(base); // why isn't this just "reduce(base);" (Lgb) // Because this function is const. Everything breaks if this // method changes the font it represents. There is no speed penalty // by using the temporary. (Asger) + if (f.family() != INHERIT_FAMILY) { os << '}'; ++count; @@ -828,6 +832,17 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base, } } + if (number() == ON && next.number() != ON && + language()->lang == "hebrew") { + os << "\\endL}"; + count += 6; + } + + if (language() != base.language() && language() != next.language()) { + os << "}"; + ++count; + } + return count; } diff --git a/src/lyxfont.h b/src/lyxfont.h index 65267f9969..4faf3188ab 100644 --- a/src/lyxfont.h +++ b/src/lyxfont.h @@ -207,6 +207,9 @@ public: /// FONT_MISC_STATE latex() const; + /// + FONT_MISC_STATE number() const; + /// LColor::color color() const; @@ -236,6 +239,8 @@ public: /// LyXFont & setLatex(LyXFont::FONT_MISC_STATE l); /// + LyXFont & setNumber(LyXFont::FONT_MISC_STATE n); + /// LyXFont & setColor(LColor::color c); /// LyXFont & setLanguage(Language const * l); @@ -319,14 +324,16 @@ public: friend bool operator==(LyXFont const & font1, LyXFont const & font2) { return font1.bits == font2.bits && - font1.lang == font2.lang; + font1.lang == font2.lang && + font1.number_ == font2.number_; } /// friend bool operator!=(LyXFont const & font1, LyXFont const & font2) { return font1.bits != font2.bits || - font1.lang != font2.lang; + font1.lang != font2.lang || + font1.number_ != font2.number_; } /// compares two fonts, ignoring the setting of the Latex part. @@ -364,6 +371,8 @@ private: FontBits bits; /// Language const * lang; + /// + FONT_MISC_STATE number_; /// Sane font static FontBits sane; @@ -388,6 +397,7 @@ LyXFont::LyXFont() { bits = sane; lang = default_language; + number_ = OFF; } @@ -396,6 +406,7 @@ LyXFont::LyXFont(LyXFont const & x) { bits = x.bits; lang = x.lang; + number_ = x.number_; } @@ -404,6 +415,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT1) { bits = inherit; lang = default_language; + number_ = OFF; } @@ -412,6 +424,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2) { bits = ignore; lang = ignore_language; + number_ = IGNORE; } @@ -420,12 +433,14 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3) { bits = sane; lang = default_language; + number_ = OFF; } inline LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l) { bits = inherit; lang = l; + number_ = OFF; } @@ -434,6 +449,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l) { bits = ignore; lang = l; + number_ = IGNORE; } @@ -442,6 +458,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l) { bits = sane; lang = l; + number_ = OFF; } @@ -450,6 +467,7 @@ LyXFont & LyXFont::operator=(LyXFont const & x) { bits = x.bits; lang = x.lang; + number_ = x.number_; return *this; } @@ -524,6 +542,13 @@ Language const * LyXFont::language() const } +inline +LyXFont::FONT_MISC_STATE LyXFont::number() const +{ + return number_; +} + + inline bool LyXFont::isRightToLeft() const { @@ -534,7 +559,7 @@ bool LyXFont::isRightToLeft() const inline bool LyXFont::isVisibleRightToLeft() const { - return (lang->RightToLeft && latex() != ON); + return (lang->RightToLeft && latex() != ON && number() != ON); } @@ -616,4 +641,12 @@ LyXFont & LyXFont::setLanguage(Language const * l) return *this; } + +inline +LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n) +{ + number_ = n; + return *this; +} + #endif diff --git a/src/spellchecker.C b/src/spellchecker.C index 2f83d7aa74..14b51e9227 100644 --- a/src/spellchecker.C +++ b/src/spellchecker.C @@ -36,7 +36,10 @@ #ifdef HAVE_SYS_SELECT_H # ifdef HAVE_STRINGS_H // is needed at least on AIX because FD_ZERO uses bzero(). -# include + // BUT we cannot include both string.h and strings.h on Irix 6.5 :( +# ifdef _AIX +# include +# endif # endif #include #endif diff --git a/src/text.C b/src/text.C index 207bae3dd3..01dad21665 100644 --- a/src/text.C +++ b/src/text.C @@ -33,6 +33,7 @@ #include "Painter.h" #include "tracer.h" #include "font.h" +#include "bufferview_funcs.h" using std::max; using std::min; @@ -305,7 +306,6 @@ LyXParagraph::size_type LyXText::RowLastPrintable(Row const * row) const return last; } - void LyXText::ComputeBidiTables(Row * row) const { bidi_same_direction = true; @@ -349,6 +349,13 @@ void LyXText::ComputeBidiTables(Row * row) const (!row->par->table || !row->par->IsNewline(lpos+1)) ) ? lpos + 1 : lpos; LyXFont font = row->par->GetFontSettings(pos); + if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() && + font.number() == LyXFont::ON && + row->par->GetFontSettings(lpos-1).number() == LyXFont::ON) { + font = row->par->GetFontSettings(lpos); + is_space = false; + } + bool new_rtl = font.isVisibleRightToLeft(); bool new_rtl0 = font.isRightToLeft(); int new_level; @@ -357,7 +364,7 @@ void LyXText::ComputeBidiTables(Row * row) const new_level = 0; new_rtl = new_rtl0 = false; } else if (lpos == main_body - 1 && row->pos < main_body - 1 && - row->par->IsLineSeparator(lpos)) { + is_space) { new_level = (rtl_par) ? 1 : 0; new_rtl = new_rtl0 = rtl_par; } else if (new_rtl0) @@ -2656,6 +2663,38 @@ void LyXText::InsertChar(char c) textclasslist.Style(buffer->params.textclass, cursor.row->par->GetLayout()).free_spacing; + if (lyxrc.auto_number) { + if (current_font.number() == LyXFont::ON) { + if (!isdigit(c) && !strchr("+-/*", c) && + !(strchr(".",c) && + cursor.pos >= 1 && cursor.pos < cursor.par->size() && + GetFont(cursor.par, cursor.pos).number() == LyXFont::ON && + GetFont(cursor.par, cursor.pos-1).number() == LyXFont::ON) + ) + Number(owner_); // Set current_font.number to OFF + } else if (isdigit(c) && + real_current_font.isVisibleRightToLeft()) { + Number(owner_); // Set current_font.number to ON + + if (cursor.pos > 0) { + char c = cursor.par->GetChar(cursor.pos - 1); + if (strchr("+-",c) && + (cursor.pos == 1 || + cursor.par->IsSeparator(cursor.pos - 2) || + cursor.par->IsNewline(cursor.pos - 2) ) + ) { + SetCharFont(cursor.par, cursor.pos - 1, + current_font); + } else if (strchr(".", c) && + cursor.pos >= 2 && + GetFont(cursor.par, cursor.pos-2).number() == LyXFont::ON) { + SetCharFont(cursor.par, cursor.pos - 1, + current_font); + } + } + } + } + /* table stuff -- begin*/ if (cursor.par->table) { InsertCharInTable(c); diff --git a/src/text2.C b/src/text2.C index d39e3c3ab5..b310dc6a3b 100644 --- a/src/text2.C +++ b/src/text2.C @@ -1187,7 +1187,8 @@ void LyXText::ToggleFree(LyXFont const & font, bool toggleall) // If there is a change in the language the implicit word selection // is disabled. LyXCursor resetCursor = cursor; - bool implicitSelection = (font.language() == ignore_language) + bool implicitSelection = (font.language() == ignore_language && + font.number() == LyXFont::IGNORE) ? SelectWordWhenUnderCursor() : false; // Set font