]> git.lyx.org Git - features.git/commitdiff
Patch for TOC menu by dekel, kde cleanup patch from John, plus a few things
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 9 Oct 2000 12:30:52 +0000 (12:30 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 9 Oct 2000 12:30:52 +0000 (12:30 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1089 a592a061-630c-0410-9148-cb99ea01b6c8

16 files changed:
ChangeLog
lib/.cvsignore
lib/bind/cua.bind
lib/bind/emacs.bind
lib/bind/menus.bind
src/buffer.C
src/bufferview_funcs.C
src/bufferview_funcs.h
src/frontends/kde/FormPrint.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/Menubar_pimpl.C
src/lyxfont.C
src/lyxfont.h
src/spellchecker.C
src/text.C
src/text2.C

index ad7bd111dabc55855e01c16791566754fe0267c8..77898c7964fd9ed9342e09eff09fed7cbada4548 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,37 @@
+2000-10-06  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
+
+       * lib/bind/cua.bind: fix a bit.
+       * lib/bind/emacs.bind: ditto.
+
+       * lib/bind/menus.bind: remove real menu entries from there.
+
+       * src/spellchecker.C: make sure we only include strings.h when
+       _AIX is defined.        
+
+2000-10-05  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * src/frontends/xforms/Menubar_pimpl.C (get_new_submenu): New
+       function. It enlarges the maximum number of pup when needed.
+       (add_toc2): Open a new menu if maximum number of items per menu has 
+       reached.
+       
+2000-10-05  John Levon  <moz@compsoc.man.ac.uk>
+
+       * src/frontends/kde/FormPrint.C: fix error reporting
+
+       * src/frontends/xforms/FormDocument.C: fix compiler
+       warnings
+
+       * lib/.cvsignore: add Literate.nw
+
+2000-10-05  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * buffer.C
+       * bufferview_funcs.[Ch]
+       * lyxfont.[Ch]
+       * text.C
+       * text2.C: Add support for numbers in RTL text.
+
 2000-10-06  Allan Rae  <rae@lyx.org>
 
        * po/Makefile.in.in (POTFILES.in, POTFILES): Fixed
index c0ca31f9d6df633320c3e10e3f43a19c269ab972..2c07c31d512fa9290b83a6b5fe58cff8d29e17e8 100644 (file)
@@ -4,3 +4,4 @@ textclass.lst
 packages.lst
 lyxrc.defaults
 listerrors
+Literate.nw
index b7f493eaa33ef95a2bb6a09c5ddb900f758f45a1..8b359063b89f39961e6aca7a86c75d0a2bf78bb4 100644 (file)
 #\bind "C-j"
 #\bind "C-y"
 
-## Documents menu
-#
-# 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"
 
 ###
 
index 4359b270c8fb9153877d697281ec71169111b687..6ed4aa260643221083ba6a37ee942ee6b169d542 100644 (file)
 
 # Include menu and math bindings
 
-#\bind_file menus.bind
+\bind_file menus.bind
 \bind_file math.bind
index dec163a9ee781e48f6a61b9057eef4af998c9fc5..dcf5883804bb192fd7c7982b2eb6f9d2418ea648 100644 (file)
@@ -3,91 +3,11 @@
 #
 #                  LyX, the High Level Word Processor
 # 
-#                 Copyright (C) 1995-1997 The LyX Team
+#                 Copyright (C) 1995-2000 The LyX Team
 #
 # ==================================================================
 
-# Key bindings for menus, both invisible and visible.
-
-#
-# Visible Menu access menu
-#
-
-\bind "F10 f"                  "menu-open File"
-\bind "F10 e"                  "menu-open Edit"
-\bind "F10 l"                  "menu-open Layout"
-\bind "F10 i"                  "menu-open Insert"
-\bind "F10 m"                  "menu-open Math"
-\bind "F10 o"                  "menu-open Options"
-\bind "F10 d"                  "menu-open Documents"
-\bind "F10 h"                  "menu-open Help"
-
-
-#
-# File menu
-#
-
-\bind "M-f n"                  "buffer-new"
-\bind "M-f t"                  "buffer-new-template"
-\bind "M-f o"                  "buffer-open"
-\bind "M-f c"                  "buffer-close"
-\bind "M-f s"                  "buffer-write"
-\bind "M-f a"                  "buffer-write-as"
-\bind "M-f r"                  "buffer-reload"
-\bind "M-f d"                  "buffer-view dvi"
-\bind "M-f w"                  "buffer-view ps"
-\bind "M-f v"                  "buffer-update dvi"
-\bind "M-f u"                  "buffer-update ps"
-\bind "M-f p"                  "buffer-print" 
-\bind "M-f f"                  "buffer-fax"
-\bind "M-f i l"                 "buffer-import latex"
-\bind "M-f i a"                 "buffer-import ascii"
-\bind "M-f i p"                 "buffer-import asciiparagraph"
-\bind "M-f i n"                 "buffer-import noweb"
-\bind "M-f e l"                 "buffer-export latex"
-\bind "M-f e p"                 "buffer-export postscript"
-\bind "M-f e d"                 "buffer-export linuxdoc"
-\bind "M-f e t"                 "buffer-export ascii"
-\bind "M-f e h"                        "buffer-export html"
-\bind "M-f e m"                 "buffer-export custom"
-\bind "M-f x"                  "lyx-quit"
-\bind "M-f space"              "menu-open File" 
-#bind "M-f l"                  "file-last"             # Not yet implemented.
-
-#
-# Edit menu
-#
-
-#bind "M-e b"                  "table"                 # Not yet implemented!
-\bind "M-e c"                  "cut"
-\bind "M-e e"                  "error-next"
-\bind "M-e f"                  "find-replace"
-\bind "M-e k"                  "line-delete-forward"
-\bind "M-e m"                  "mark-on"
-\bind "M-e S-M"                        "mark-off"
-\bind "M-e n"                  "note-next"
-\bind "M-e o"                  "copy"
-\bind "M-e p"                  "paste"
-\bind "M-e r"                  "redo"
-\bind "M-e s"                  "spellchecker"
-\bind "M-e h"                  "buffer-chktex"
-\bind "M-e t"                  "toc-view"
-\bind "M-e u"                  "undo"
-\bind "M-e w"                  "latex-view-log"
-\bind "M-e space"              "menu-open Edit" 
-
-#
-# TOC menu
-#
-
-\bind "M-t"                    "menu-open TOC" 
-
-#
-# Refs menu
-#
-
-\bind "M-r"                    "menu-open Refs" 
-
+# Key bindings for so-called "invisible" menus
 
 #
 # Layout menu
 # Insert menu
 #
 
-\bind "M-i g"                  "figure-insert"
-\bind "M-i b"                  "dialog-tabular-insert"
-\bind "M-i c"                  "buffer-child-insert"
-\bind "M-i a l"                        "file-insert-ascii line"         
-\bind "M-i a p"                        "file-insert-ascii paragraph"
-\bind "M-i x"                  "file-insert"
-\bind "M-i f"                  "footnote-insert"
-\bind "M-i m"                  "marginpar-insert"
-
-# PREVIOUS PATCH
-\bind "M-i o g"                        "buffer-float-insert figure" 
-\bind "M-i o t"                        "buffer-float-insert table"
-\bind "M-i o w"                        "buffer-float-insert wide-fig"
-\bind "M-i o d"                        "buffer-float-insert wide-tab"
-\bind "M-i o a"                        "buffer-float-insert algorithm"
-
-\bind "M-i t c"                        "toc-insert"
-\bind "M-i t f"                        "lof-insert"
-\bind "M-i t t"                        "lot-insert"
-\bind "M-i t i"                        "index-print"
-\bind "M-i t b"                        "bibtex-insert"
-\bind "M-i t a"                        "loa-insert"
-
-\bind "M-i minus"              "hyphenation-point-insert"
-\bind "M-i p"                  "dots-insert"
-\bind "M-i e"                  "end-of-sentence-period-insert"
-\bind "M-i q"                  "quote-insert"
-\bind "M-i apostrophe"         "quote-insert"
-\bind "M-i S-quotedbl"         "quote-insert"
-\bind "M-i s h"                        "hfill-insert"
-# NOT IN MENU. (HIDDEN TO LEARNER)
-\bind "M-i s minus"            "hyphenation-point-insert"
-\bind "M-i s b"                        "protected-space-insert"
-\bind "M-i s l"                        "break-line"
-\bind "M-i s i"                        "dots-insert"
-\bind "M-i s e"                        "end-of-sentence-period-insert"
-\bind "M-i s q"                        "quote-insert"
-\bind "M-i s m"                        "menu-separator-insert"
-\bind "M-i n"                  "note-insert"
-\bind "M-i l"                  "label-insert"
-\bind "M-i r"                  "reference-insert"
-\bind "M-i i"                  "citation-insert"
-\bind "M-i d"                  "index-insert"
-\bind "M-i w"                  "index-insert-last"
-\bind "M-i u"                  "url-insert"
-\bind "M-i space"              "menu-open Insert"  
-
-
-
-#
-# Math menu
-#
-
-\bind "M-m space"              "menu-open Math" 
-
-#
-# Options menu
-#
-
-#bind "M-o f"                  "screen-font-options"   # Not yet implemented!
-#bind "M-o s"                  "spellcheck-options"    # Not yet implemented!
-#bind "M-o k"                  "keyboard-options"      # Not yet implemented!
-#bind "M-o l"                  "latex-options"         # Not yet implemented!
-\bind "M-o space"              "menu-open Options"  
-
-
-#
-# Documents menu
-#
-# 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"
-
-
-#
-# Help menu
-#
-
-#bind "M-h i"                  "help-introduction"     # Not yet implemented!
-#bind "M-h t"                  "help-tutorial"         # Not yet implemented!
-#bind "M-h u"                  "help-user-guide"       # Not yet implemented!
-#bind "M-h r"                  "help-reference-guide"  # Not yet implemented!
-#bind "M-h h"                  "help-how-do-i-"        # Not yet implemented!
-#bind "M-h c"                  "help-customization"    # Not yet implemented!
-#bind "M-h s"                  "help-special-tools"    # Not yet implemented!
-#bind "M-h k"                  "help-known-bugs"       # Not yet implemented!
-#bind "M-h a"                  "help-latex-config"     # Not yet implemented!
-#bind "M-h o"                  "help-copyright"        # Not yet implemented!
-#bind "M-h e"                  "help-credits"          # Not yet implemented!
-#bind "M-h v"                  "help-version"          # Not yet implemented!
-\bind "M-h space"              "menu-open Help" 
-
+# These ones are not supported anymore.
+#\bind "M-i minus"             "hyphenation-point-insert"
+#\bind "M-i p"                 "dots-insert"
+#\bind "M-i e"                 "end-of-sentence-period-insert"
+#\bind "M-i q"                 "quote-insert"
+#\bind "M-i apostrophe"                "quote-insert"
+#\bind "M-i S-quotedbl"                "quote-insert"
+#\bind "M-i s h"                       "hfill-insert"
+#\bind "M-i s minus"           "hyphenation-point-insert"
 
 #
 # Font size menu
index 116253f0b8da5d9b6b9c28a66f2f03d30186aa45..9f4ab480e2e26cd195964a1095122304db2fa78e 100644 (file)
@@ -778,6 +778,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()));
index ff4f699d48598910e886a3aca1c7c10b41a86fbe..cf6cc4abcee18b195e454a047949e40d6bc192e3 100644 (file)
@@ -82,6 +82,12 @@ void Margin(BufferView * bv)
 }
 #endif
 
+void Number(BufferView * bv)
+{
+       LyXFont font(LyXFont::ALL_IGNORE);
+       font.setNumber(LyXFont::TOGGLE);
+       ToggleAndShow(bv, font);
+}
 
 void Lang(BufferView * bv, string const & l)
 {
@@ -312,7 +318,8 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font)
                bv->update(BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
 
                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(bv->buffer(), cursor.row());
index 4837f19e46549042a578631187c453c8ec033bcd..2ba44d3013ef8b8774bf65f5418e96db85ec2dff 100644 (file)
@@ -41,6 +41,8 @@ extern void Figure();
 extern void Table();
 ///
 extern void Lang(BufferView *, string const &);
+///
+extern void Number(BufferView *);
 #ifndef NEW_INSETS
 ///
 extern void Melt(BufferView *);
index 8fd3d612f2239f2984b9982750e6e9835b6317a3..bdcf5fc10e8a80d3e14e25d15ee05bc1a69d4459 100644 (file)
@@ -99,11 +99,9 @@ void FormPrint::print()
                dialog_->getWhichPages(), from, to, dialog_->getReverse(), 
                dialog_->getSort(), strToInt(dialog_->getCount())));
 
-       if (retval!=0) {
+       if (!retval) {
                // FIXME: should have a utility class for this
-               string message(_("The error :\n\n"));
-               message += strerror(retval);
-               message += _("\n\noccurred while printing.\n");
+               string message(_("An error occured while printing.\n\n"));
                message += _("Check the parameters are correct.\n");
                KMsgBox msg(0, _("LyX: Print Error"), message.c_str(), KMsgBox::EXCLAMATION, _("&OK"));
                msg.raise();
index 616219009edca8279908bf8453ea7f43eb345755..7d89cf98ecd68aa530a9e54cc4bc4e3e56e506c4 100644 (file)
@@ -949,7 +949,7 @@ void FormDocument::BulletDepth(FL_OBJECT * ob, State cb)
     /* maybe try to support the others later                      */
     BufferParams & param = lv_->buffer()->params;
 
-    int data;
+    int data = 0;
     if( cb == BULLETDEPTH1 )
            data = 0;
     else if ( cb == BULLETDEPTH2 )
@@ -978,7 +978,7 @@ void FormDocument::BulletPanel(FL_OBJECT * /*ob*/, State cb)
     /* Here we have to change the background pixmap to that selected */
     /* by the user. (eg. standard.xpm, psnfss1.xpm etc...)           */
     
-    int data;
+    int data = 0;
     if( cb == BULLETPANEL1 )
            data = 0;
     else if ( cb == BULLETPANEL2 )
index 8f465b990f673e85b84ca173e540f88b42fe4eb0..1955069e781bdb2a7cb143029a5d2b6be5d84f61 100644 (file)
@@ -191,7 +191,17 @@ string limit_string_length(string const & str)
                return str;
 }
 
-size_type const max_number_of_menus = 32;
+
+int get_new_submenu(vector<int> & smn, Window win)
+{
+       static size_type max_number_of_menus = 32;
+       if (smn.size() >= max_number_of_menus)
+               max_number_of_menus = fl_setpup_maxpup(2*smn.size());
+       int menu = fl_newpup(win);
+       smn.push_back(menu);
+       return menu;
+}
+
 size_type const max_number_of_items = 25;
 
 void add_toc2(int menu, string const & extra_label,
@@ -218,7 +228,14 @@ void add_toc2(int menu, string const & extra_label,
                while (pos < to) {
                        ++count;
                        if (count > max_number_of_items) {
-                               fl_addtopup(menu, ". . .%d");
+                               int menu2 = get_new_submenu(smn, win);
+                               add_toc2(menu2, extra_label, smn, win,
+                                        toc_list, pos, to, depth);
+                               string label = _("More");
+                               label += "...%m";
+                               if (depth == 0)
+                                       label += extra_label;
+                               fl_addtopup(menu, label.c_str(), menu2);
                                break;
                        }
                        size_type new_pos = pos+1;
@@ -238,16 +255,12 @@ void add_toc2(int menu, string const & extra_label,
                        if (new_pos == pos + 1) {
                                label += "%x" + tostr(action);
                                fl_addtopup(menu, label.c_str());
-                       } else if (smn.size() < max_number_of_menus) {
-                               int menu2 = fl_newpup(win);
-                               smn.push_back(menu2);
+                       } else {
+                               int menu2 = get_new_submenu(smn, win);
                                add_toc2(menu2, extra_label, smn, win,
                                         toc_list, pos, new_pos, depth+1);
                                label += "%m";
                                fl_addtopup(menu, label.c_str(), menu2);
-                       } else {
-                               label += "%d";
-                               fl_addtopup(menu, label.c_str());
                        }
                        pos = new_pos;
                }
@@ -275,8 +288,7 @@ void Menubar::Pimpl::add_toc(int menu, string const & extra_label,
 
        for (int j = 1; j <= 3; ++j)
                if (!toc_list[j].empty()) {
-                       int menu2 = fl_newpup(win);
-                       smn.push_back(menu2);
+                       int menu2 = get_new_submenu(smn, win);
                        for (size_type i = 0; i < toc_list[j].size(); ++i) {
                                if (i > max_number_of_items) {
                                        fl_addtopup(menu2, ". . .%d");
@@ -352,28 +364,22 @@ void add_references2(int menu, vector<int> & smn, Window win,
                                ? label_list[j-1].substr(0, max_item_length2-1) + "$"
                                : label += label_list[j-1];
 
-                       if (smn.size() < max_number_of_menus) {
-                               int menu2 = fl_newpup(win);
-                               smn.push_back(menu2);
-                               for (size_type k = i;  k < j; ++k) {
-                                       int action = (type == "goto")
-                                               ? lyxaction.getPseudoAction(LFUN_REF_GOTO, 
-                                                                           label_list[k])
-                                               : lyxaction.getPseudoAction(LFUN_REF_INSERT,
-                                                                           type + "|++||++|"
-                                                                           + label_list[k]);
-                                       string label2 = label_list[k];
-                                       if (label2.size() > max_item_length)
-                                               label2 = label2.substr(0, max_item_length-1) + "$";
-                                       label2 += "%x" + tostr(action);
-                                       fl_addtopup(menu2, label2.c_str());
-                               }
-                               label += "%m";
-                               fl_addtopup(menu, label.c_str(), menu2);
-                       } else {
-                               label += "%d";
-                               fl_addtopup(menu, label.c_str());
+                       int menu2 = get_new_submenu(smn, win);
+                       for (size_type k = i;  k < j; ++k) {
+                               int action = (type == "goto")
+                                       ? lyxaction.getPseudoAction(LFUN_REF_GOTO, 
+                                                                   label_list[k])
+                                       : lyxaction.getPseudoAction(LFUN_REF_INSERT,
+                                                                   type + "|++||++|"
+                                                                   + label_list[k]);
+                               string label2 = label_list[k];
+                               if (label2.size() > max_item_length)
+                                       label2 = label2.substr(0, max_item_length-1) + "$";
+                               label2 += "%x" + tostr(action);
+                               fl_addtopup(menu2, label2.c_str());
                        }
+                       label += "%m";
+                       fl_addtopup(menu, label.c_str(), menu2);
                }
        }
 }
@@ -430,16 +436,10 @@ void Menubar::Pimpl::add_references(int menu, string const & extra_label,
                        string label = _(MenuNames[i]);
                        if (i == max_nonempty)
                                label += extra_label;
-                       if (smn.size() < max_number_of_menus) {
-                               int menu2 = fl_newpup(win);
-                               smn.push_back(menu2);
-                               add_references2(menu2, smn, win, label_list,
-                                               MenuTypes[i]);
-                               fl_addtopup(menu, label.c_str(), menu2);
-                       } else {
-                               label += "%d";
-                               fl_addtopup(menu, label.c_str());       
-                       }
+                       int menu2 = get_new_submenu(smn, win);
+                       add_references2(menu2, smn, win, label_list,
+                                       MenuTypes[i]);
+                       fl_addtopup(menu, label.c_str(), menu2);
                }
        }
 }
@@ -457,12 +457,11 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
        Menu md = Menu();
        menubackend_->getMenu(menu_name).expand(md, owner_->buffer());
 
-       int menu = fl_newpup(win);
+       int menu = get_new_submenu(smn, win);
        fl_setpup_softedge(menu, true);
        fl_setpup_bw(menu, -1);
        lyxerr[Debug::GUI] << "Adding menu " << menu 
                           << " in deletion list" << endl;
-       smn.push_back(menu);
 
        // Compute the size of the largest label (because xforms is
        // not able to support shortcuts correctly...)
index 3a70535afe5ee95f17517844f8eb1dd6290d9a13..065a5d8d72752f108753e1d9003c464bad2be183 100644 (file)
@@ -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)
                setLanguage(document_language);
        else if (newfont.language() != ignore_language)
@@ -404,7 +405,10 @@ string const LyXFont::stateText(BufferParams * params) const
        if (bits == inherit)
                ost << _("Default") << ", ";
        if (!params || (language() != params->language_info))
-               ost << _("Language: ") << _(language()->display().c_str());
+               ost << _("Language: ") << _(language()->display().c_str()) << ", ";
+       if (number() != OFF)
+               ost << _("  Number ") << _(GUIMiscNames[number()]);
+
 
        string buf(ost.str().c_str());
        buf = strip(buf, ' ');
@@ -609,6 +613,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()) {
@@ -674,11 +681,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 = '{' + 
@@ -686,10 +691,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);
        
@@ -761,18 +771,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;
@@ -816,6 +821,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;
 }
 
index 910782dcebdd74efaacd88a20c7d15e9e60a8d25..aedd3236f50f182f65a38001b06b1bb2dc076256 100644 (file)
@@ -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);
@@ -357,6 +362,8 @@ private:
        FontBits bits;
        ///
        Language const * lang;
+       ///
+       FONT_MISC_STATE number_;
        
        /// Sane font
        static FontBits sane;
@@ -379,7 +386,8 @@ std::ostream & operator<<(std::ostream &, LyXFont::FONT_MISC_STATE);
 inline
 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_;
 }
 
 ///
@@ -394,6 +402,7 @@ LyXFont::LyXFont()
 {
        bits = sane;
        lang = default_language;
+       number_ = OFF;
 }
 
 
@@ -402,6 +411,7 @@ LyXFont::LyXFont(LyXFont const & x)
 {
        bits = x.bits;
        lang = x.lang;
+       number_ = x.number_;
 }
 
 
@@ -410,6 +420,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT1)
 {
        bits = inherit;
        lang = default_language;
+       number_ = OFF;
 }
 
 
@@ -418,6 +429,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2)
 {
        bits = ignore;
        lang = ignore_language;
+       number_ = IGNORE;
 }
 
 
@@ -426,6 +438,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3)
 {
        bits = sane;
        lang = default_language;
+       number_ = OFF;
 }
 
 
@@ -434,6 +447,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT1, Language const * l)
 {
        bits = inherit;
        lang = l;
+       number_ = OFF;
 }
 
 
@@ -442,6 +456,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT2, Language const * l)
 {
        bits = ignore;
        lang = l;
+       number_ = IGNORE;
 }
 
 
@@ -450,6 +465,7 @@ LyXFont::LyXFont(LyXFont::FONT_INIT3, Language const * l)
 {
        bits = sane;
        lang = l;
+       number_ = OFF;
 }
 
 
@@ -458,6 +474,7 @@ LyXFont & LyXFont::operator=(LyXFont const & x)
 {
        bits = x.bits;
        lang = x.lang;
+       number_ = x.number_;
        return *this;
 }
 
@@ -532,6 +549,13 @@ Language const * LyXFont::language() const
 }
 
 
+inline
+LyXFont::FONT_MISC_STATE LyXFont::number() const 
+{
+       return number_;
+}
+
+
 inline
 bool LyXFont::isRightToLeft() const 
 {
@@ -542,7 +566,7 @@ bool LyXFont::isRightToLeft() const
 inline
 bool LyXFont::isVisibleRightToLeft() const 
 {
-       return (lang->RightToLeft() && latex() != ON);
+       return (lang->RightToLeft() && latex() != ON && number() != ON);
 }
 
 
@@ -624,4 +648,12 @@ LyXFont & LyXFont::setLanguage(Language const * l)
        return *this;
 }
 
+
+inline
+LyXFont & LyXFont::setNumber(LyXFont::FONT_MISC_STATE n)
+{
+       number_ = n;
+       return *this;
+}
+
 #endif
index 81153c61e0a01bbc0b1fef0ff59f4055e07f8c2a..355782c7646db92a26b98a96fe35db3f6095d74e 100644 (file)
 #ifdef HAVE_SYS_SELECT_H
 # ifdef HAVE_STRINGS_H
    // <strings.h> is needed at least on AIX because FD_ZERO uses bzero().
-# include <strings.h> 
+   // BUT we cannot include both string.h and strings.h on Irix 6.5 :(
+#  ifdef _AIX
+#   include <strings.h>
+#  endif
 # endif
 #include <sys/select.h>
 #endif
index 519b7759827a491b7a445d38b2172e619ff5cf50..8c21418d8763fb4baa0f27a79a4e4a93c7f563cc 100644 (file)
@@ -33,6 +33,7 @@
 #include "font.h"
 #include "encoding.h"
 #include "lyxscreen.h"
+#include "bufferview_funcs.h"
 
 using std::max;
 using std::min;
@@ -262,13 +263,22 @@ void LyXText::ComputeBidiTables(Buffer const * buf, Row * row) const
                         !row->par()->IsNewline(lpos + 1))
                        ? lpos + 1 : lpos;
                LyXFont font = row->par()->GetFontSettings(buf->params, pos);
+               if (pos != lpos && 0 < lpos && rtl0 && font.isRightToLeft() &&
+                   font.number() == LyXFont::ON &&
+                   row->par()->GetFontSettings(buf->params, lpos-1).number()
+                   == LyXFont::ON) {
+                       font = row->par()->GetFontSettings(buf->params, lpos);
+                       is_space = false;
+               }
+
+
                bool new_rtl = font.isVisibleRightToLeft();
                bool new_rtl0 = font.isRightToLeft();
                int new_level;
 
                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)
@@ -1888,6 +1898,51 @@ void LyXText::InsertChar(BufferView * bview, char c)
                textclasslist.Style(bview->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(bview->buffer(),
+                                     cursor.par(),
+                                     cursor.pos()).number() == LyXFont::ON &&
+                             GetFont(bview->buffer(),
+                                     cursor.par(),
+                                     cursor.pos()-1).number() == LyXFont::ON)
+                           )
+                               Number(bview); // Set current_font.number to OFF
+               } else if (isdigit(c) &&
+                          real_current_font.isVisibleRightToLeft()) {
+                       Number(bview); // 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(bview->buffer(),
+                                                   cursor.par(),
+                                                   cursor.pos() - 1,
+                                                   current_font);
+                               } else if (strchr(".", c) &&
+                                          cursor.pos() >= 2 &&
+                                          GetFont(bview->buffer(),
+                                                  cursor.par(),
+                                                  cursor.pos()-2).number() == LyXFont::ON) {
+                                       SetCharFont(bview->buffer(),
+                                                   cursor.par(),
+                                                   cursor.pos() - 1,
+                                                   current_font);
+                               }
+                       }
+               }
+       }
+
+
        /* First check, if there will be two blanks together or a blank at 
          the beginning of a paragraph. 
          I decided to handle blanks like normal characters, the main 
index 24ff26b183f8c25159986b91d1543562aa014915..94e06a769b0c19ddcb7526a6d496641d28bb4f8b 100644 (file)
@@ -1279,7 +1279,8 @@ void LyXText::ToggleFree(BufferView * bview,
        // 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(bview) : false;
 
        // Set font