]> git.lyx.org Git - features.git/commitdiff
LyX Drinkers United: patch 2
authorLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 27 Jun 2001 14:10:35 +0000 (14:10 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Wed, 27 Jun 2001 14:10:35 +0000 (14:10 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2144 a592a061-630c-0410-9148-cb99ea01b6c8

94 files changed:
lib/CREDITS
lib/ChangeLog
lib/ui/default.ui
po/POTFILES.in
src/BufferView2.C
src/BufferView_pimpl.C
src/ChangeLog
src/FontLoader.C
src/LColor.C
src/LColor.h
src/LyXAction.C
src/Makefile.am
src/Painter.C
src/TextCache.C
src/ToolbarDefaults.C
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C
src/commandtags.h
src/converter.C
src/frontends/controllers/ControlBibitem.C
src/frontends/controllers/ControlCharacter.C
src/frontends/qt2/FormParagraph.C
src/frontends/qt2/FormSplashImpl.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/Toolbar_pimpl.C
src/frontends/xforms/bmtable.h
src/frontends/xforms/combox.C
src/func_status.h [new file with mode: 0644]
src/insets/ChangeLog
src/insets/figinset.C
src/insets/inset.C
src/insets/insetert.C
src/insets/insetert.h
src/insets/insetgraphics.C
src/insets/insetinfo.C
src/insets/insetlabel.C
src/insets/insetlabel.h
src/insets/insetquotes.C
src/insets/insetref.C
src/insets/insetref.h
src/insets/insettabular.C
src/insets/insettabular.h
src/insets/insettext.h
src/lyx_cb.C
src/lyxfont.C
src/lyxfont.h
src/lyxfunc.C
src/lyxfunc.h
src/lyxtext.h
src/mathed/ChangeLog
src/mathed/array.C
src/mathed/array.h
src/mathed/formula.C
src/mathed/formulabase.C
src/mathed/formulamacro.C
src/mathed/math_bigopinset.C
src/mathed/math_bigopinset.h
src/mathed/math_cursor.C
src/mathed/math_cursor.h
src/mathed/math_fracinset.C
src/mathed/math_fracinset.h
src/mathed/math_funcinset.C
src/mathed/math_funcinset.h
src/mathed/math_grid.C
src/mathed/math_grid.h
src/mathed/math_hash.C
src/mathed/math_inset.C
src/mathed/math_inset.h
src/mathed/math_macrotable.C
src/mathed/math_matrixinset.C
src/mathed/math_parser.C
src/mathed/math_parser.h
src/mathed/math_scriptinset.C
src/mathed/math_scriptinset.h
src/mathed/math_spaceinset.C
src/mathed/math_spaceinset.h
src/mathed/support.C
src/paragraph.C
src/paragraph_pimpl.C
src/support/ChangeLog
src/support/DebugStream.h
src/support/filetools.C
src/support/lstrings.C
src/support/lstrings.h
src/support/syscall.C
src/tabular.C
src/tabular.h
src/texrow.C
src/text.C
src/text2.C
src/trans_mgr.C

index aaa214e2f414a0abe2344ebe99706d3cec8346aa..64c0e42d28f08a0037c0fa833065b639f8f112c5 100644 (file)
@@ -31,7 +31,8 @@
 @iE-mail: larsbj@lyx.org
    improvements to user interface (menus and 
    keyhandling) including configurable toolbar,
-   and a few other minor things. Also current
+   and a few other (not so) minor things, like 
+   rewriting most of the LyX kernel. Also current
    source maintainer.
 @bChristian Buescher 
    user-definable keys, lyxserver and more
@@ -43,7 +44,7 @@
    Improvements to the czech keymaps
 @bAlbert Chin
 @iE-mail: china@thewrittenword.com
-   Bug fixes.
+   Bug fixes
 @bClaudio Coco
 @iE-mail: lacocio@iol.it
    Italian translation
@@ -72,7 +73,7 @@
 @iE-mail: goebel@noris.net
    Improvements to Koma-Script classes
 @bClaus Hentschel
-@iE-mail claus.hentschel@mbau.fh-hannover.de
+@iE-mail: claus.hentschel@mbau.fh-hannover.de
    Win32 port of LyX 1.1.x
 @bBernard Michael Hurley 
 @iE-mail: bernardh@westherts.ac.uk
 @iE-mail: a.leeming@ic.ac.uk
    GUI-I-fication of insets and more
 @bEdwin Leuven 
-@iE-mail leuven@fee.uva.nl
+@iE-mail: leuven@fee.uva.nl
    Qt2 frontend
    GUI-I-fication of several popups (in particular
      the one you are using now :)
 @bJohn Levon
-@iE-mail moz@compsoc.man.ac.uk
+@iE-mail: moz@compsoc.man.ac.uk
    KDE port
    GUI-I-fication of several popups
 @bJosé Matos
 @iE-mail: a.t.meinen@chello.nl
    Dutch translation coordinator
 @bDaniel Naber
-@iE-mail dnaber@mini.gt.owl.de
+@iE-mail: dnaber@mini.gt.owl.de
    Improvements to find&replace popup
 @bDirk Niggemann
 @iE-mail: dabn100@cam.ac.uk
    Better support for serbian and serbocroatian
 @bKornelia Pietsch
 @iE-mail: pietsch@mathematik.tu-chemnitz.de
+   heavy mathed testing
    provided siamltex document class
 @bAndré Poenitz 
 @iE-mail: poenitz@HTWM.De
    file io with streams
    --export and --import command line options
 @bAlkis Polyzotis
-   Keymap work.
+   Keymap work
 @bBernhard Psaier
    Designer of the LyX-Banner
 @bThomas Pundt
    initial configure script
 @bAllan Rae
 @iE-mail: rae@elec.uq.edu.au
+   GUI-I architect, LyX PR head, LDN, 
    bug reports/fixes, Itemize Bullet Selection,
    xforms-0.81 + gcc-2.6.3 compatibility
 @bGarst R. Reese
    Support for Koma-Script family of classes
 @bMichael Ressler
 @iE-mail: mike.ressler@alum.mit.edu
-   various documentation contributions, AASTeX support
+   documentation maintainer, AASTeX support
 @bHubert Schreier
    spellchecker (ispell frontend)
    beautiful document-manager based on the simple 
-   table of contents (temporary removed)
+   table of contents (removed)
 @bIvan Schreter
 @iE-mail: schreter@kdk.sk
    international support and kbmaps for slovak, czech, 
    small fixes (some work, others didn't)
 @bPeter Sütterlin
 @iE-mail: pit@uni-sw.gwdg.de
-   aapaper support, bug reports
+   aapaper support, german documentation translation,
+   bug reports
 @bKayvan Aghaiepour Sylvan
 @iE-mail: kayvan@sylvan.com      
    noweb2lyx and reLyX integration of noweb files. 
-   Added Import->Noweb and key bindings to menus.
+   added Import->Noweb and key bindings to menus.
 @bReuben Thomas
 @iE-mail: rrt@dcs.gla.ac.uk
-  encts document class
-  lots of useful bug reports
+   encts document class
+   lots of useful bug reports
 @bDekel Tsur
 @iE-mail: dekel@math.tau.ac.il
-   Hebrew support.
-   Many bug fixes.
+   Hebrew support, general file converter,
+   many many bug fixes.
 @bMatthias Ulrichs
 @iE-mail: urlichs@smurf.noris.de
    bug reports and small fixes
    svjour/svjog, egs and llncs document classes
 @bJuergen Vigna
 @iE-mail: jug@sad.it
-   Fax- and Ascii-Export support
+   complete rewrite of the tabular, text inset
+   fax- and Ascii-Export support
    iletter and dinbrief support
 @bJohn P. Weiss
 @iE-mail: weissjp@colorado.edu
    Tutorial chapter 1
 @bEdmar Wienskoski Jr.
 @iE-mail: edmar-w-jr@technologist.com
-   Literate programming support
-   Various bug fixes
+   literate programming support
+   various bug fixes
 @bSerge Winitzki 
 @iE-mail: winitzki@erebus.phys.cwru.edu
-   Updates to the Scientific Word bindings
+   updates to the Scientific Word bindings
 @bStephan Witt
 @iE-mail: stephan.witt@beusen.de
-   Support for page selection for printing
-   Support for number of copies
+   support for page selection for printing
+   support for number of copies
 @bHenner Zeller
 @iE-mail: zeller@think.de
    rotation of wysiwyg figures
index 65b65ea2e7c1b40c7dcd147533c4c8c0027e5e58..8439d6335672e0f5a5f22a0f12313a78c03e8ad5 100644 (file)
@@ -1,3 +1,14 @@
+2001-06-26  The LyX Project  <lyx@violet.home.sad.it>
+
+       * CREDITS: update a bit
+
+       * ui/default.ui: make math align entries non-optional, move
+       math-mutate stuff to Edit>Math.
+
+2001-06-26  The LyX Project  <lyx@rose.home.sad.it>
+
+       * ui/default.ui: add align options to edit_math menu.
+
 2001-06-23  The LyX Project  <jug@sad.it>
 
        * templates/dinbrief.lyx: remove obsolete \cursor tag
index 5ca433c7fa06c6999d5bb824634dbff8beff508f..2f894a007ada2515e22f67856d84deaa53afd614 100644 (file)
@@ -146,6 +146,23 @@ Menuset
     End
 
     Menu "edit_math"
+       Item "Toggle numbering|n" "math-number"
+       Item "Toggle numbering of line|u" "math-nonumber"
+       Item "Toggle limits|l" "math-limits"
+       Separator
+       Item "Inline formula|I" "math-mutate inline"
+       Item "Displayed formula|D" "math-mutate display"
+       Item "Eqnarray environment|q" "math-mutate eqnarray"
+       Item "Align environment|A" "math-mutate align"
+       Separator
+       Item "Align Left|f" "math-halign left"
+       Item "Align Center|C" "math-halign center"
+       Item "Align Right|R" "math-halign right"
+       Separator
+       Item "V.Align Top|T" "math-valign top"
+       Item "V.Align Center|e" "math-valign center"
+       Item "V.Align Bottom|B" "math-valign bottom"
+       Separator
 #      Item "Make eqnarray|e" "break-line e"
 #      Item "Make multline|m" "break-line m"
 #      Item "Make align 1 column|1"  "break-line 1"
@@ -154,9 +171,6 @@ Menuset
 #      Item "Make alignat 2 columns|2"  "break-line B"
 #      Item "Make alignat 3 columns|3"  "break-line C"
 #      Separator
-       Item "Toggle numbering|n" "math-number"
-       Item "Toggle numbering of line|u" "math-nonumber"
-       Item "Toggle limits|l" "math-limits"
     End
 
 #
@@ -165,10 +179,6 @@ Menuset
     Menu "insert"
        Item "Math Formula|h" "math-mode simple"
        Item "Display Formula|D" "math-mode display"
-       Item "Change to Inline Math Formula|q" "math-mutate simple"
-       Item "Change to Displayed Math Formula|q" "math-mutate equation"
-       Item "Change to Eqnarray Environment|q" "math-mutate eqnarray"
-       Item "Change to Align Environment|g" "math-mutate align"
        Separator
        Submenu "Special Character|S" "insert_special"
        Item "Citation Reference...|C" "citation-insert"
index 53c323e68cbdc6e5eaf0f6424b13199f2eae1389..300a18a53dbc3f31c72a0295744ef0fd59ab2ed8 100644 (file)
@@ -198,6 +198,7 @@ src/lyxrc.C
 src/LyXSendto.C
 src/lyxvc.C
 src/LyXView.C
+src/mathed/formulabase.C
 src/mathed/formula.C
 src/mathed/formulamacro.C
 src/MenuBackend.C
index 09232ceb84544ffb426c6351b03f0769c1f07834..0269bf9c36f18e556be6db216cd10ada24c4dfef 100644 (file)
@@ -84,10 +84,11 @@ bool BufferView::insertLyXFile(string const & filen)
        bool res = true;
 
        if (c == '#') {
-               lyxerr.debug() << "Will insert file with header" << endl;
+               lyxerr[Debug::INFO] << "Will insert file with header" << endl;
                res = buffer()->readFile(lex, text->cursor.par());
        } else {
-               lyxerr.debug() << "Will insert file without header" << endl;
+               lyxerr[Debug::INFO] << "Will insert file without header" 
+                                   << endl;
                res = buffer()->readLyXformat2(lex, text->cursor.par());
        }
 
index d0f753a5dad3fb17acce0c9b6d24069e97a4117d..600eef68c3df157132243da0fdc4c03f49a4180d 100644 (file)
@@ -16,6 +16,7 @@
 #include "lyxrow.h"
 #include "LyXView.h"
 #include "commandtags.h"
+#include "lyxfunc.h"
 #include "font.h"
 #include "bufferview_funcs.h"
 #include "TextCache.h"
@@ -1183,8 +1184,12 @@ void BufferView::Pimpl::setState()
                return;
 
        LyXText * text = bv_->getLyXText();
-       if (text->real_current_font.isRightToLeft() &&
-           text->real_current_font.latex() != LyXFont::ON) {
+       if (text->real_current_font.isRightToLeft()
+#ifndef NO_LATEX
+           &&
+           text->real_current_font.latex() != LyXFont::ON
+#endif
+               ) {
                if (owner_->getIntl()->keymap == Intl::PRIMARY)
                        owner_->getIntl()->KeyMapSec();
        } else {
@@ -1393,15 +1398,12 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
                }
        }
 
-       // get absolute path of file and make sure the filename ends
-       // with .lyx
-       filename = MakeAbsPath(filename);
-       if (!IsLyXFilename(filename))
-               filename += ".lyx";
+       // get absolute path of file and add ".lyx" to the filename if
+       // necessary
+       filename = FileSearch(string(), filename, "lyx");
 
        string const disp_fn(MakeDisplayPath(filename));
        
-       // Inserts document
        ostringstream s1;
        s1 << _("Inserting document") << ' '
           << disp_fn << " ...";
@@ -1550,13 +1552,15 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
        case LFUN_FREE:
                owner_->getDialogs()->setUserFreeFont();
                break;
-               
+
+#ifndef NO_LATEX
        case LFUN_TEX:
                Tex(bv_);
                setState();
                owner_->showState();
                break;
-
+#endif
+               
        case LFUN_FILE_INSERT:
        {
                MenuInsertLyXFile(argument);
@@ -1573,8 +1577,8 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                
        case LFUN_LAYOUT:
        {
-               lyxerr.debug() << "LFUN_LAYOUT: (arg) "
-                              << argument << endl;
+               lyxerr[Debug::INFO] << "LFUN_LAYOUT: (arg) "
+                                   << argument << endl;
                
                // Derive layout number from given argument (string)
                // and current buffer's textclass (number). */    
@@ -1680,7 +1684,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                update(lt,
                       BufferView::SELECT
                       | BufferView::FITCUR);
-               lt->changeWordCase(bv_, LyXText::text_uppercase);
+               lt->changeCase(bv_, LyXText::text_uppercase);
                if (lt->inset_owner)
                        updateInset(lt->inset_owner, true);
                update(lt,
@@ -1695,7 +1699,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                LyXText * lt = bv_->getLyXText();
                
                update(lt, BufferView::SELECT|BufferView::FITCUR);
-               lt->changeWordCase(bv_, LyXText::text_lowercase);
+               lt->changeCase(bv_, LyXText::text_lowercase);
                if (lt->inset_owner)
                        updateInset(lt->inset_owner, true);
                update(lt,
@@ -1710,8 +1714,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                LyXText * lt = bv_->getLyXText();
                
                update(lt, BufferView::SELECT|BufferView::FITCUR);
-               lt->changeWordCase(bv_,
-                                  LyXText::text_capitalization);
+               lt->changeCase(bv_, LyXText::text_capitalization);
                if (lt->inset_owner)
                        updateInset(lt->inset_owner, true);
                update(lt,
@@ -2593,7 +2596,7 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                        cur_value = par->params().spacing().getValue();
                }
                
-               istringstream istr(argument.c_str());
+               istringstream istr(argument);
 
                string tmp;
                istr >> tmp;
@@ -2831,10 +2834,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
                
        case LFUN_SETXY:
        {
-#warning Should check sscanf for errors (Lgb)
-               int x;
-               int y;
-               ::sscanf(argument.c_str(), " %d %d", &x, &y);
+               int x = 0;
+               int y = 0;
+               if (::sscanf(argument.c_str(), " %d %d", &x, &y) != 2) {
+                       lyxerr << "SETXY: Could not parse coordinates in '"
+                              << argument << std::endl;
+               }
                bv_->getLyXText()->setCursorFromCoordinates(bv_, x, y);
        }
        break;
@@ -2858,10 +2863,12 @@ bool BufferView::Pimpl::Dispatch(kb_action action, string const & argument)
 
        case LFUN_GETLATEX:
        {
+#ifndef NO_LATEX
                LyXFont & font = bv_->getLyXText()->current_font;
                 if (font.latex() == LyXFont::ON)
                        owner_->getLyXFunc()->setMessage("L");
                 else
+#endif
                        owner_->getLyXFunc()->setMessage("0");
        }
        break;
@@ -3392,8 +3399,9 @@ bool BufferView::Pimpl::insertInset(Inset * inset, string const & lout)
                                   string(),
                                   0);
                update(bv_->text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
-               
+#ifndef NO_LATEX
                bv_->text->current_font.setLatex(LyXFont::OFF);
+#endif
        }
        
        bv_->text->insertInset(bv_, inset);
index fb9d1afea6868d2a756dea320ce13990a0f92cfb..a1d1778f5aa6ae5492e102ebd534a328e00f6105 100644 (file)
@@ -1,3 +1,76 @@
+2001-06-27  Juergen Vigna  <jug@sad.it>
+
+       * text.C (cursorLeftOneWord): changed to return the cursor and added
+       overlay with BufferView * parameter which calls this one.
+       (getWord): added
+       (selectWord): use new getWord function.
+       (changeCase): renamed from changeWordCase as and extended to work
+       also on selections.
+
+       * lyxtext.h: added enum word_location
+
+       * BufferView_pimpl.C (Dispatch): change function changeWordCase to
+       changeCase as this operates now also on selections.
+
+2001-06-26  The LyX Project  <lyx@violet.home.sad.it>
+
+       * lyxfunc.C (getStatus): support LFUN_MATH_MUTATE
+
+       * many files: send debug output to Debug::INFO instead of
+       Debug::ANY. 
+
+       * converter.C (View): 
+       (Convert): 
+       (Move): send debug output to Debug::FILES instead of console.
+
+2001-06-26  The LyX Project  <lyx@rose.home.sad.it>
+
+       * lyxfunc.C (getStatus): use func_status
+
+       * func_status.h: new header, describing the results of
+       LyXFunc::getStatus;
+
+       * lyxfunc.C (getStatus): add support for LFUN_MATH_VALIGN and
+       LFUN_MATH_HALIGN.
+
+2001-06-25  The LyX Project  <jug@sad.it>
+
+       * buffer.C (sgmlOpenTag):
+       (sgmlCloseTag):
+       (SimpleDocBookOnePar):  disable the depth spaces, for the moment.
+
+2001-06-26  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * text2.C: remove some dead code
+
+       * tabular.C (GetCellInset): store the last cell checked (gotten)
+
+       * tabular.h: add the helper for the speedup
+
+       * lyxtext.h: remove some dead code
+
+2001-06-26  The LyX Project  <Asger>
+
+       * paragraph.C: Change export to LaTeX of alignment to
+       \begin{center} and family for better roundtrip work with reLyX.
+
+       * Tune the math drawing a bit.
+
+2001-06-25  The LyX Project  <Asger>
+
+       * LColor.C (LColor): New color for math background. New color
+       for buttons.
+
+2001-06-25  The LyX Project  <jug@sad.it>
+
+       * lyxfunc.C (MenuNew): remove extra check for .lyx file
+
+       * lyxfunc.C (Open): 
+       * bufferlist.C (newFile): do not restrict to files ending with
+       .lyx
+
+       * BufferView_pimpl.C (MenuInsertLyXFile): 
+
 2001-06-24  The LyX Project  <jug@sad.it>
 
        * lyxlex_pimpl.C (compare_tags): use compare_ascii_no_case instead
index 0f7e2d77823fa17d04310a32e426547bb17a98c6..e01669d1244ba1842fa4a787d2520b4bfd1d0958 100644 (file)
@@ -271,7 +271,9 @@ XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,
                f.setEmph(LyXFont::INHERIT);
                f.setUnderbar(LyXFont::INHERIT);
                f.setNoun(LyXFont::INHERIT);
+#ifndef NO_LATEX
                f.setLatex(LyXFont::INHERIT);
+#endif
                f.setColor(LColor::inherit);
                lyxerr << "Font '" << f.stateText(0) 
                       << "' matched by\n" << font << endl;
index f3ed338277789715c683c4cdd72ddc765584d7bd..e0c952f7be07e5c6c023a845093ddcec6f709c28 100644 (file)
@@ -68,18 +68,19 @@ LColor::LColor()
        { depthbar, N_("depth bar"), "depthbar", "IndianRed", "depthbar" },
        { language, N_("language"), "language", "Blue", "language" },
        { command, N_("command inset"), "command", "black", "command" },
-       { commandbg, N_("command inset background"), "commandbg", "grey80", "commandbg" },
+       { commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
        { commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
        { special, N_("special character"), "special", "RoyalBlue", "special" },
        { math, N_("math"), "math", "DarkBlue", "math" },
        { mathbg, N_("math background"), "mathbg", "AntiqueWhite", "mathbg" },
+       { mathmacrobg, N_("Math macro background"), "mathmacrobg", "AntiqueWhite", "mathmacrobg" },
        { mathframe, N_("math frame"), "mathframe", "Magenta", "mathframe" },
        { mathcursor, N_("math cursor"), "mathcursor", "black", "mathcursor" },
        { mathline, N_("math line"), "mathline", "Blue", "mathline" },
        { captionframe, N_("caption frame"), "captionframe", "DarkRed", "captionframe" },
        { collapsable, N_("collapsable inset text"), "collapsable", "DarkRed", "collapsable" },
        { collapsableframe, N_("collapsable inset frame"), "collapsableframe", "IndianRed", "collapsableframe" },
-       { insetbg, N_("inset background"), "insetbg", "grey60", "insetbg" },
+       { insetbg, N_("inset background"), "insetbg", "grey80", "insetbg" },
        { insetframe, N_("inset frame"), "insetframe", "IndianRed", "insetframe" },
        { error, N_("LaTeX error"), "error", "Red", "error" },
        { eolmarker, N_("end-of-line marker"), "eolmarker", "Brown", "eolmarker" },
@@ -92,11 +93,11 @@ LColor::LColor()
             "LightSteelBlue", "tabularonoffline" },
        { bottomarea, N_("bottom area"), "bottomarea", "grey40", "bottomarea" },
        { pagebreak, N_("page break"), "pagebreak", "RoyalBlue", "pagebreak" },
-       { top, N_("top of button"), "top", "grey80", "top" },
-       { bottom, N_("bottom of button"), "bottom", "grey40", "bottom" },
-       { left, N_("left of button"), "left", "grey80", "left" },
-       { right, N_("right of button"), "right", "grey40", "right" },
-       { buttonbg, N_("button background"), "buttonbg", "grey60", "buttonbg" },
+       { top, N_("top of button"), "top", "grey90", "top" },
+       { bottom, N_("bottom of button"), "bottom", "grey60", "bottom" },
+       { left, N_("left of button"), "left", "grey90", "left" },
+       { right, N_("right of button"), "right", "grey60", "right" },
+       { buttonbg, N_("button background"), "buttonbg", "grey80", "buttonbg" },
        { inherit, N_("inherit"), "inherit", "black", "inherit" },
        { ignore, N_("ignore"), "ignore", "black", "ignore" },
        { ignore, 0, 0, 0, 0 }
index 6d832857c4edd2d7ec49049b8793b8d83cd8a00b..b6651839b60dd0817b56239b6b956a815e38d03a 100644 (file)
@@ -106,6 +106,8 @@ public:
                math,
                /// Math inset background color
                mathbg,
+               /// Macro math inset background color
+               mathmacrobg,
                /// Math inset frame color
                mathframe,
                /// Math cursor color
index 7c90498ccfbba8c04f6841b8d4a047fc3f67b997..44dc887bbd3f3f1de1753973c3f6a6b8d2b526ca 100644 (file)
@@ -369,7 +369,9 @@ void LyXAction::init()
                  N_("Tabular Features"), Noop },
                { LFUN_INSET_TABULAR, "tabular-insert",
                  N_("Insert a new Tabular Inset"), Noop },
+#ifndef NO_LATEX
                { LFUN_TEX, "tex-mode", N_("Toggle TeX style"), Noop },
+#endif
                { LFUN_INSET_TEXT, "text-insert",
                  N_("Insert a new Text Inset"), Noop },
                { LFUN_INSET_THEOREM, "theorem-insert", "", Noop },
index 4cc29ddc21d62f577f41d0bc3df6e00c4f457310..cefe8d1433a33867eaa51a75702024fabfb6f088 100644 (file)
@@ -114,6 +114,7 @@ lyx_SOURCES = \
        figureForm.h \
        font.C \
        font.h \
+       func_status.h \
        gettext.C \
        gettext.h \
        importer.C \
index 93a8b73483a02ee034577f23ae96687ea249c8f5..7b4f1160fa6dc85076b30406ada1b5a5aa0362da 100644 (file)
@@ -55,7 +55,7 @@ PainterBase & Painter::point(int x, int y, LColor::color c)
                if (!Lgb_bug_find_hack)
                        lyxerr << "point not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: "
+               lyxerr[Debug::INFO] << "Painter drawable: "
                               << owner.getPixmap() << endl;
        }
        
@@ -74,7 +74,7 @@ PainterBase & Painter::line(int x1, int y1, int x2, int y2,
                if (!Lgb_bug_find_hack)
                        lyxerr << "line not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: "
+               lyxerr[Debug::INFO] << "Painter drawable: "
                               << owner.getPixmap() << endl;
        }
        
@@ -94,7 +94,7 @@ PainterBase & Painter::lines(int const * xp, int const * yp, int np,
                if (!Lgb_bug_find_hack)
                        lyxerr << "lines not called from "
                                "workarea::workhandler\n";
-               lyxerr.debug() << "Painter drawable: "
+               lyxerr[Debug::INFO] << "Painter drawable: "
                               << owner.getPixmap() << endl;
        }
        
@@ -332,7 +332,11 @@ PainterBase & Painter::text(int x, int y, char const * s, size_t ls,
                        }
                }
        }
-       if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON)
+       if (f.underbar() == LyXFont::ON
+#ifndef NO_LATEX
+           && f.latex() != LyXFont::ON
+#endif
+               )
                underline(f, x, y, lyxfont::width(s, ls, f));
        return *this;
 }
@@ -371,7 +375,11 @@ PainterBase & Painter::text(int x, int y, XChar2b const * s, int ls,
                        }
                }
        }
-       if (f.underbar() == LyXFont::ON && f.latex() != LyXFont::ON)
+       if (f.underbar() == LyXFont::ON
+#ifndef NO_LATEX
+           && f.latex() != LyXFont::ON
+#endif
+               )
                underline(f, x, y, lyxfont::width(s, ls, f));
        return *this;
 }
index 28f956499bcf3b40c707aff65b12e3e9a39e628b..f7133d60302feff5171c6861452159353fc453ac 100644 (file)
@@ -99,13 +99,13 @@ void TextCache::show(ostream & os, TextCache::value_type const & vt)
 
 void TextCache::add(Buffer * buf, int workwidth, LyXText * text)
 {
-       lyxerr.debug() << "TextCache::add " << text;
+       lyxerr[Debug::INFO] << "TextCache::add " << text;
        if (bufferlist.isLoaded(buf)) {
                cache[buf] = make_pair(workwidth, text);
-               lyxerr.debug() << " added" << endl;
+               lyxerr[Debug::INFO] << " added" << endl;
        } else {
                delete text;
-               lyxerr.debug() << " deleted" << endl;
+               lyxerr[Debug::INFO] << " deleted" << endl;
        }
 }
 
index b8d0c413a2d2c791a8bbc7b9c6657624f8ac18bd..afca95d8813d8c6b51b4e4477795ef6a5631ed66 100644 (file)
@@ -64,7 +64,9 @@ void ToolbarDefaults::init()
        add(LFUN_DEPTH);
        add(SEPARATOR);
 
+#ifndef NO_LATEX
        add(LFUN_TEX);
+#endif
         add(LFUN_MATH_MODE);
        add(SEPARATOR);
 
index f95fa7893c39742c26e2f9ed4d551d8ca6b2344d..5cb9a3ca8837ac22cbef37fa0845f0bf1482da72 100644 (file)
@@ -363,6 +363,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
        )
 {
        bool the_end_read = false;
+#ifdef NO_LATEX
+       static string inset_ert_contents;
+#endif
 #ifndef NO_PEXTRA_REALLY
        // This is super temporary but is needed to get the compability
        // mode for minipages work correctly together with new tabulars.
@@ -386,6 +389,15 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                par->insertInset(pos, inset, font);
                ++pos;
        } else if (token == "\\layout") {
+#ifdef NO_LATEX
+               // Do the insetert.
+               if (!inset_ert_contents.empty()) {
+                       Inset * inset = new InsetERT(inset_ert_contents);
+                       par->insertInset(pos, inset, font);
+                       ++pos;
+                       inset_ert_contents.erase();
+               }
+#endif
                 lex.EatLine();
                 string const layoutname = lex.GetString();
                 pair<bool, LyXTextClass::LayoutList::size_type> pp
@@ -848,6 +860,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
        } else if (token == "\\size") {
                lex.next();
                font.setLyXSize(lex.GetString());
+#ifndef NO_LATEX
+#ifdef WITH_WARNINGS
+#warning compatability hack needed
+#endif
        } else if (token == "\\latex") {
                lex.next();
                string const tok = lex.GetString();
@@ -861,6 +877,21 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                else
                        lex.printError("Unknown LaTeX font flag "
                                       "`$$Token'");
+#else
+       } else if (token == "\\latex") {
+               lex.next();
+               string const tok = lex.GetString();
+               if (tok == "no_latex") {
+                       ; // nothing
+               } else if (tok == "latex") {
+                       ; // nothing
+               } else if (tok == "default") {
+                       ; // nothing
+               } else {
+                       lex.printError("Unknown LaTeX font flag "
+                                      "`$$Token'");
+               }
+#endif
        } else if (token == "\\lang") {
                lex.next();
                string const tok = lex.GetString();
@@ -1577,8 +1608,10 @@ string const Buffer::asciiParagraph(Paragraph const * par,
        } else {
                lyxerr << "Should this ever happen?" << endl;
        }
-      
+
+#ifndef NO_LATEX
        LyXFont const font1 = LyXFont(LyXFont::ALL_INHERIT, params.language);
+#endif
        for (Paragraph::size_type i = 0; i < par->size(); ++i) {
                if (!i && !noparbreak) {
                        if (linelen > 0)
@@ -1617,6 +1650,7 @@ string const Buffer::asciiParagraph(Paragraph const * par,
                                currlinelen += (ltype_depth-depth)*2;
                        }
                }
+#ifndef NO_LATEX
                LyXFont const font2 = par->getFontSettings(params, i);
                if (font1.latex() != font2.latex()) {
                        if (font2.latex() == LyXFont::OFF)
@@ -1626,6 +1660,7 @@ string const Buffer::asciiParagraph(Paragraph const * par,
                } else {
                        islatex = 0;
                }
+#endif
                
                char c = par->getUChar(params, i);
                if (islatex)
@@ -1691,7 +1726,7 @@ string const Buffer::asciiParagraph(Paragraph const * par,
                        } else if (c != '\0')
                                buffer << c;
                        else if (c == '\0')
-                               lyxerr.debug() << "writeAsciiFile: NULL char in structure." << endl;
+                               lyxerr[Debug::INFO] << "writeAsciiFile: NULL char in structure." << endl;
                        ++currlinelen;
                        break;
                }
@@ -1761,7 +1796,7 @@ void Buffer::makeLaTeXFile(string const & fname,
                texrow.newline();
                texrow.newline();
        }
-       lyxerr.debug() << "lyx header finished" << endl;
+       lyxerr[Debug::INFO] << "lyx header finished" << endl;
        // There are a few differences between nice LaTeX and usual files:
        // usual is \batchmode and has a 
        // special input@path to allow the including of figures
@@ -2177,7 +2212,7 @@ void Buffer::makeLaTeXFile(string const & fname,
                ofs << "\\begin{document}\n";
                texrow.newline();
        } // only_body
-       lyxerr.debug() << "preamble finished, now the body." << endl;
+       lyxerr[Debug::INFO] << "preamble finished, now the body." << endl;
 
        if (!lyxrc.language_auto_begin) {
                ofs << subst(lyxrc.language_command_begin, "$$lang",
@@ -2223,7 +2258,7 @@ void Buffer::makeLaTeXFile(string const & fname,
                lyxerr << "File was not closed properly." << endl;
        }
        
-       lyxerr.debug() << "Finished making latex file." << endl;
+       lyxerr[Debug::INFO] << "Finished making latex file." << endl;
 }
 
 
@@ -2305,7 +2340,8 @@ void Buffer::sgmlOpenTag(ostream & os, Paragraph::depth_type depth,
                         string const & latexname) const
 {
        if (!latexname.empty() && latexname != "!-- --")
-               os << string(depth, ' ') << "<" << latexname << ">\n";
+               os << "<!-- " << depth << " -->" << "<" << latexname << ">";
+       //os << string(depth, ' ') << "<" << latexname << ">\n";
 }
 
 
@@ -2313,7 +2349,8 @@ void Buffer::sgmlCloseTag(ostream & os, Paragraph::depth_type depth,
                          string const & latexname) const
 {
        if (!latexname.empty() && latexname != "!-- --")
-               os << string(depth, ' ') << "</" << latexname << ">\n";
+               os << "<!-- " << depth << " -->" << "</" << latexname << ">\n";
+       //os << string(depth, ' ') << "</" << latexname << ">\n";
 }
 
 
@@ -2727,7 +2764,11 @@ void Buffer::SimpleLinuxDocOnePar(ostream & os,
                        continue;
                }
 
-               if (font.latex() == LyXFont::ON || style.latexparam() == "CDATA") {
+               if (
+#ifndef NO_LATEX
+                       font.latex() == LyXFont::ON ||
+#endif
+                   style.latexparam() == "CDATA") {
                        // "TeX"-Mode on == > SGML-Mode on.
                        if (c != '\0')
                                os << c;
@@ -3093,8 +3134,8 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
        LyXFont font_old = style.labeltype == LABEL_MANUAL ? style.labelfont : style.font;
 
        int char_line_count = depth;
-       if (!style.free_spacing)
-               os << string(depth,' ');
+       //if (!style.free_spacing)
+       //      os << string(depth,' ');
 
        // parsing main loop
        for (Paragraph::size_type i = 0;
@@ -3140,11 +3181,13 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
                                else
                                        os << tmp_out;
                        }
+#ifndef NO_LATEX
                } else if (font.latex() == LyXFont::ON) {
                        // "TeX"-Mode on ==> SGML-Mode on.
                        if (c != '\0')
                                os << c;
                        ++char_line_count;
+#endif
                } else {
                        string sgml_string;
                        if (par->linuxDocConvertChar(c, sgml_string)
@@ -3175,7 +3218,7 @@ void Buffer::SimpleDocBookOnePar(ostream & os, string & extra,
                // <term> not closed...
                os << "</term>";
        }
-       os << '\n';
+       if(style.free_spacing) os << '\n';
 }
 
 
@@ -3327,7 +3370,7 @@ string const Buffer::getIncludeonlyList(char delim)
                        }
                }
        }
-       lyxerr.debug() << "Includeonly(" << lst << ')' << endl;
+       lyxerr[Debug::INFO] << "Includeonly(" << lst << ')' << endl;
        return lst;
 }
 
index 36ba4b357d0e91f3eb467519b67cfc3f16aa39b9..a7ce2a92704ba6afda4051f3d6b9bc0fca1bd75b 100644 (file)
@@ -443,7 +443,7 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
        if (tname.empty()) {
                tname = LibFileSearch("templates", "defaults.lyx");
        }
-       if (!tname.empty() && IsLyXFilename(tname)) {
+       if (!tname.empty()) {
                bool templateok = false;
                LyXLex lex(0, 0);
                lex.setFile(tname);
index 117f28bad506da2c0841d9ecaf79f23d573b0697..f9b9689a5db903930064aa78de3d2b52a8653e8a 100644 (file)
@@ -71,12 +71,14 @@ void Lang(BufferView * bv, string const & l)
 }
 
 
+#ifndef NO_LATEX
 void Tex(BufferView * bv)
 {
        LyXFont font(LyXFont::ALL_IGNORE);
        font.setLatex (LyXFont::TOGGLE);
        ToggleAndShow(bv, font);
 }
+#endif
 
 
 // Change environment depth.
@@ -266,7 +268,9 @@ void ToggleAndShow(BufferView * bv, LyXFont const & font, bool toggleall)
                bv->update(text, BufferView::SELECT|BufferView::FITCUR|BufferView::CHANGE);
 
                if (font.language() != ignore_language ||
+#ifndef NO_LATEX
                    font.latex() != LyXFont::IGNORE ||
+#endif
                    font.number() != LyXFont::IGNORE)
                {
                        LyXCursor & cursor = text->cursor;
index d3fc152ae86b8482f8cd3675be691d2af4d4f5fe..4725e88a3667451cf16e31b3e2fd8663606660a7 100644 (file)
 
 #include <iosfwd>
 
+#if 1
+// For NO_LATEX
+#include "lyxfont.h"
+#endif
+
 /** These are all the lyxfunctions (as enums).
     Please add new functions at the end of the enum, right
     before LFUN_LASTACTION.
@@ -49,7 +54,9 @@ enum kb_action {
        LFUN_HFILL,
        LFUN_DEPTH,
        LFUN_FREE,     // 30
+#ifndef NO_LATEX
        LFUN_TEX,
+#endif
 #if 0
        LFUN_FOOTMELT, // schedule for deletion
        LFUN_MARGINMELT, // schedule for deletion
@@ -293,7 +300,3 @@ enum kb_action {
 
 std::ostream & operator<<(std::ostream &, kb_action);
 #endif
-
-
-
-
index 423274cd1cf963f30c28c6da83dabeeb0e312574..c9248c51502f42eacf43f19294522f488acb0254 100644 (file)
@@ -189,7 +189,7 @@ bool Formats::View(Buffer const * buffer, string const & filename,
 
        command += " " + QuoteName(OnlyFilename((filename)));
 
-       lyxerr << "Executing command: " << command << endl;
+       lyxerr[Debug::FILES] << "Executing command: " << command << endl;
        ShowMessage(buffer, _("Executing command:"), command);
 
        Path p(OnlyPath(filename));
@@ -574,7 +574,7 @@ bool Converters::Convert(Buffer const * buffer,
                Converter const & conv = converterlist[*cit];
                bool dummy = conv.To->dummy() && conv.to != "program";
                if (!dummy)
-                       lyxerr << "Converting from  "
+                       lyxerr[Debug::FILES] << "Converting from  "
                               << conv.from << " to " << conv.to << endl;
                infile = outfile;
                outfile = conv.result_dir.empty()
@@ -587,14 +587,15 @@ bool Converters::Convert(Buffer const * buffer,
                if (conv.latex) {
                        run_latex = true;
                        string command = subst(conv.command, token_from, "");
-                       lyxerr << "Running " << command << endl;
+                       lyxerr[Debug::FILES] << "Running " << command << endl;
                        if (!runLaTeX(buffer, command))
                                return false;
                } else {
                        if (conv.need_aux && !run_latex
                            && !latex_command.empty()) {
-                               lyxerr << "Running " << latex_command 
-                                      << " to update aux file"<<  endl;
+                               lyxerr[Debug::FILES] 
+                                       << "Running " << latex_command 
+                                       << " to update aux file"<<  endl;
                                runLaTeX(buffer, latex_command);
                        }
 
@@ -618,7 +619,7 @@ bool Converters::Convert(Buffer const * buffer,
                                command = add_options(command,
                                                      dvipdfm_options(buffer));
 
-                       lyxerr << "Calling " << command << endl;
+                       lyxerr[Debug::FILES] << "Calling " << command << endl;
                        if (buffer)
                                ShowMessage(buffer, _("Executing command:"), command);
 
@@ -700,7 +701,8 @@ bool Converters::Move(string const & from, string const & to, bool copy)
                        string from2 = path + *it;
                        string to2 = to_base + (*it).substr(base.length());
                        to2 = ChangeExtension(to2, to_extension);
-                       lyxerr << "moving " << from2 << " to " << to2 << endl;
+                       lyxerr[Debug::FILES] << "moving " << from2 
+                                            << " to " << to2 << endl;
                        bool moved = (copy)
                                ? lyx::copy(from2, to2)
                                : lyx::rename(from2, to2);
index 845dbaa2b21959ba3cc5bdd3e4340bca4bc0f39c..0433149d138528ac92797e5bf0c48ace1fd2168d 100644 (file)
@@ -35,6 +35,7 @@ ControlBibitem::ControlBibitem(LyXView & lv, Dialogs & d)
        d_.showBibitem.connect(slot(this, &ControlBibitem::showInset));
 }
 
+
 void ControlBibitem::applyParamsToInset()
 {
        // FIXME:
index 7725a1a4faaa805e7689eb8294adbddea73e9698..5b459abbceb4501036a5c5e1aa31764e16867ee2 100644 (file)
@@ -30,6 +30,7 @@ using Liason::setMinibuffer;
 using SigC::slot;
 using std::vector;
 
+
 ControlCharacter::ControlCharacter(LyXView & lv, Dialogs & d)
        : ControlDialog<ControlConnectBD>(lv, d),
          font_(0), toggleall_(false)
@@ -82,11 +83,13 @@ LyXFont::FONT_FAMILY ControlCharacter::getFamily() const
        return LyXFont::IGNORE_FAMILY;
 }
 
+
 void ControlCharacter::setFamily(LyXFont::FONT_FAMILY val)
 {
        font_->setFamily(val);
 }
 
+
 LyXFont::FONT_SERIES ControlCharacter::getSeries() const
 {
        if (font_.get())
@@ -94,11 +97,13 @@ LyXFont::FONT_SERIES ControlCharacter::getSeries() const
        return LyXFont::IGNORE_SERIES;
 }
 
+
 void ControlCharacter::setSeries(LyXFont::FONT_SERIES val)
 {
        font_->setSeries(val);
 }
 
+
 LyXFont::FONT_SHAPE ControlCharacter::getShape() const
 {
        if (font_.get())
@@ -106,11 +111,13 @@ LyXFont::FONT_SHAPE ControlCharacter::getShape() const
        return LyXFont::IGNORE_SHAPE;
 }
 
+
 void ControlCharacter::setShape(LyXFont::FONT_SHAPE val)
 {
        font_->setShape(val);
 }
 
+
 LyXFont::FONT_SIZE ControlCharacter::getSize() const
 {
        if (font_.get())
@@ -118,11 +125,13 @@ LyXFont::FONT_SIZE ControlCharacter::getSize() const
        return LyXFont::IGNORE_SIZE;
 }
 
+
 void ControlCharacter::setSize(LyXFont::FONT_SIZE val)
 {
        font_->setSize(val);
 }
 
+
 character::FONT_STATE ControlCharacter::getBar() const
 {
        if (font_.get()) {
@@ -134,13 +143,15 @@ character::FONT_STATE ControlCharacter::getBar() const
 
                else if (font_->noun() != LyXFont::IGNORE)
                        return character::NOUN_TOGGLE;
-
+#ifndef NO_LATEX
                else if (font_->latex() != LyXFont::IGNORE)
                        return character::LATEX_TOGGLE;
+#endif
        }
        return character::IGNORE;
 }
 
+
 void ControlCharacter::setBar(character::FONT_STATE val)
 {
        switch (val) {
@@ -148,7 +159,9 @@ void ControlCharacter::setBar(character::FONT_STATE val)
                font_->setEmph(LyXFont::IGNORE);
                font_->setUnderbar(LyXFont::IGNORE);
                font_->setNoun(LyXFont::IGNORE);
+#ifndef NO_LATEX
                font_->setLatex(LyXFont::IGNORE);
+#endif
                break;
 
        case character::EMPH_TOGGLE:
@@ -163,19 +176,24 @@ void ControlCharacter::setBar(character::FONT_STATE val)
                font_->setNoun(LyXFont::TOGGLE);
                break;
 
+#ifndef NO_LATEX
        case character::LATEX_TOGGLE:
                font_->setLatex(LyXFont::TOGGLE);
                break;
-
+#endif
+               
        case character::INHERIT:
                font_->setEmph(LyXFont::INHERIT);
                font_->setUnderbar(LyXFont::INHERIT);
                font_->setNoun(LyXFont::INHERIT);
+#ifndef NO_LATEX
                font_->setLatex(LyXFont::INHERIT);
+#endif
                break;
        }
 }
 
+
 LColor::color ControlCharacter::getColor() const
 {
        LColor::color col = LColor::ignore;
@@ -203,6 +221,7 @@ LColor::color ControlCharacter::getColor() const
        return col;
 }
 
+
 void ControlCharacter::setColor(LColor::color val)
 {
        switch (val) {
@@ -251,6 +270,7 @@ bool ControlCharacter::getToggleAll() const
        return toggleall_;
 }
 
+
 void ControlCharacter::setToggleAll(bool t)
 {
        toggleall_ = t;
index 41d8d1bb647321fa29bd3af6c24d28cfdbfc902b..dc62aedf549af6dbfc79f724730fcfa76bcb9bcf 100644 (file)
@@ -145,7 +145,7 @@ void FormParagraph::apply()
        lyxerr[Debug::GUI] << "Setting above space \"" << LyXGlueLength(spaceabove.length().asString()).asString() << "\"" << endl;
        lyxerr[Debug::GUI] << "Setting below space \"" << LyXGlueLength(spacebelow.length().asString()).asString() << "\"" << endl;
 
-       lv_->view()->text->SetParagraph(lv_->view(),
+       lv_->view()->text->setParagraph(lv_->view(),
                dialog_->getLineAbove(), dialog_->getLineBelow(),
                dialog_->getPagebreakAbove(), dialog_->getPagebreakBelow(),
                spaceabove, spacebelow, dialog_->getAlign(),
index 2380b4fa6fdca7b6bf30f50ae1c03dd6942d16bb..5ebe8ebf67400ba2dc7e280c5fca3e5794e18078 100644 (file)
@@ -43,7 +43,7 @@ FormSplashBase::~FormSplashBase()
 }
 
 
-void FormSplashBase::mousePressEvent( QMouseEvent * e)
+void FormSplashBase::mousePressEvent( QMouseEvent * )
 {
    hide();
 }
index 61f895737d159a71d3d184eb469978c18b4587c2..51bcb28ba6e3bab6e426c7935257869c4767df4c 100644 (file)
@@ -1,3 +1,17 @@
+2001-06-26  The LyX Project  <lyx@violet.home.sad.it>
+
+       * combox.C (remove): send debug output to Debug::GUI.
+
+2001-06-26  The LyX Project  <lyx@rose.home.sad.it>
+
+       * Menubar_pimpl.C (create_submenu): 
+       * Toolbar_pimpl.C (update): update to use func_status
+
+2001-06-25  The LyX Project  <lyx@tulip.home.sad.it>
+
+       * FormPreferences.C (Path::feedback): remove bogus description of
+       lyxpipe.
+
 2001-06-16  Angus Leeming  <a.leeming@ic.ac.uk>
 
        * xformsBC.h: clean-up of included files.
index 4e183e98a2240f150d49bde8dc4ca887714c63a4..3a0a1b5290d2c76a77bf90c9d1734e07507f4e4b 100644 (file)
@@ -2088,7 +2088,6 @@ FormPreferences::Paths::feedback(FL_OBJECT const * const ob) const
                str = lyxrc.getDescription(LyXRC::RC_BACKUPDIR_PATH);
        else if (ob == dialog_->input_serverpipe) {
                str = lyxrc.getDescription(LyXRC::RC_SERVERPIPE);
-               str += " Enter either the input pipe, xxx.in, or the output pipe, xxx.out.";
        }
 
        return str;
index cb2fa4fd3da3955871b6d6033718434bfc92c65b..f15d7c79846af2fe9ee0bbd4904714423ca1644e 100644 (file)
@@ -407,7 +407,8 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
                if (i->kind() == MenuItem::Separator)
                        *last = "%l";
                else if (!i->optional() ||
-                        !(view->getLyXFunc()->getStatus(i->action()) & LyXFunc::Disabled))
+                        !(view->getLyXFunc()->getStatus(i->action()) 
+                          & func_status::Disabled))
                        last = it;
 
        it = extra_labels.begin();
@@ -417,11 +418,12 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
 
                switch (item.kind()) {
                case MenuItem::Command: {
-                       LyXFunc::func_status flag = 
+                       func_status::value_type flag = 
                                view->getLyXFunc()->getStatus(item.action()); 
 
                        // handle optional entries.
-                       if (item.optional() && (flag & LyXFunc::Disabled)) {
+                       if (item.optional() 
+                           && (flag & func_status::Disabled)) {
                                lyxerr[Debug::GUI] 
                                        << "Skipping optional item " 
                                        << item.label() << endl; 
@@ -447,11 +449,12 @@ int Menubar::Pimpl::create_submenu(Window win, LyXView * view,
                        
                        // Modify the entry using the function status
                        string pupmode;
-                       if (flag & (LyXFunc::Disabled | LyXFunc::Unknown))
+                       if (flag & (func_status::Disabled 
+                                   | func_status::Unknown))
                                pupmode += "%i";
-                       if (flag & LyXFunc::ToggleOn)
+                       if (flag & func_status::ToggleOn)
                                pupmode += "%B";
-                       if (flag & LyXFunc::ToggleOff)
+                       if (flag & func_status::ToggleOff)
                                pupmode += "%b";
                        label += pupmode;
 
index 9a051dd33a27942959ef902c6ea322d2190d36ea..b80357e11e65564e6e62a09aedca88109ec4cb1d 100644 (file)
@@ -23,6 +23,7 @@
 #include "debug.h"
 #include "LyXView.h"
 #include "lyxfunc.h"
+#include "func_status.h"
 #include "BufferView.h"
 #include "buffer.h"
 #include "LyXAction.h"
@@ -190,7 +191,7 @@ void Toolbar::Pimpl::update()
        for (; p != end; ++p) {
                if (p->icon) {
                        int status = owner->getLyXFunc()->getStatus(p->action);
-                       if (status & LyXFunc::ToggleOn) {
+                       if (status & func_status::ToggleOn) {
                                // I'd like to use a different color
                                // here, but then the problem is to
                                // know how to use transparency with
@@ -203,7 +204,7 @@ void Toolbar::Pimpl::update()
                                fl_set_object_boxtype(p->icon, FL_UP_BOX);
                        }
 
-                       if (status & LyXFunc::Disabled) {
+                       if (status & func_status::Disabled) {
                                // Is there a way here to specify a
                                // mask in order to show that the
                                // button is disabled? (JMarc)
index 3ae4adb07a6ea2360032db311881c7be3833ab8c..a55c423f0926d59c3e4e34bea6d9c7046485052a 100644 (file)
@@ -1,4 +1,3 @@
-// -*- C++ -*-
 /*
  *  File:        bmtable.h
  *  Purpose:     Declaration of the XForms object bmtable. 
index a8153211930758ee46d3663d6d6ef2407e6fe605..eac8d173523a6a9729bb0d8108a33312449f86ce 100644 (file)
@@ -81,20 +81,20 @@ void Combox::clear()
 
 void Combox::remove()
 {
-       lyxerr.debug() << "Button: " << button << endl;
+       lyxerr[Debug::GUI] << "Button: " << button << endl;
        if (button) {
                fl_delete_object(button);
                fl_free_object(button); 
        }
        
-       lyxerr.debug() << "Label: " << label << endl;
+       lyxerr[Debug::GUI] << "Label: " << label << endl;
        if (label && label != button) {
                fl_delete_object(label);
                fl_free_object(label); 
        }
        
-       lyxerr.debug() << "Form: " << form << endl;
-       lyxerr.debug() << "Browser: " << browser << endl;
+       lyxerr[Debug::GUI] << "Form: " << form << endl;
+       lyxerr[Debug::GUI] << "Browser: " << browser << endl;
        if (form && browser) {
           fl_delete_object(browser);
           fl_free_object(browser);
diff --git a/src/func_status.h b/src/func_status.h
new file mode 100644 (file)
index 0000000..66e8412
--- /dev/null
@@ -0,0 +1,29 @@
+// -*- C++ -*-
+#ifndef FUNC_STATUS_H
+#define FUNC_STATUS_H
+
+/// The status of a function.
+namespace func_status {
+
+enum value_type {
+               /// No problem
+               OK = 0,
+               ///
+               Unknown = 1,
+               /// Command cannot be executed
+               Disabled = 2,
+               ///
+               ToggleOn = 4,
+               ///
+               ToggleOff = 8
+       };
+}
+
+///
+inline
+void operator|=(func_status::value_type & fs, func_status::value_type f)
+{
+       fs = static_cast<func_status::value_type>(fs | f);
+}
+
+#endif
index cdf5931066fb70c03c301a15e6f4bacf74c36d2d..595e40e97ac0dc6d6fa403bf75168ef054d914cf 100644 (file)
@@ -1,3 +1,33 @@
+2001-06-26  The LyX Project  <lyx@violet.home.sad.it>
+
+       * figinset.C:
+       * inset.C:
+       * insetgraphics.C: send debug output to Debug::INFO instead of
+       Debug::ANY.
+
+2001-06-26  The LyX Project  <lyx@rose.home.sad.it>
+
+       * insettabular.h:
+       * insettabular.C (getStatus): update to use func_status
+
+2001-06-26  ben <nicolas.marsgui@libertysurf.fr>
+
+       * insetref.C (DocBook): added support for cross-references without
+       a name.
+
+2001-06-26  The LyX Project  <jug@sad.it>
+
+       * insetref.C:
+       * insetref.h:
+       * insetlabel.C:
+       * insetlabel.h: removed escape method and moved it to
+       support/lstrings.h.
+
+2001-06-26  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insettabular.C (getMaxWidth): do the speedup in a different way,
+       remove dead code
+
 2001-06-24  The LyX Project  <Asger>
 
        * insettabular.C (getMaxWidth): We cache a mapping from
@@ -21,7 +51,7 @@
 
 2001-06-14  Juergen Vigna  <jug@sad.it>
 
-       * insettext.C (draw): removed warinings.
+       * insettext.C (draw): removed warnings.
 
 2001-06-13  Juergen Vigna  <jug@sad.it>
 
index 5b9614c559ea817d18778a5799df2186960a76ee..fa11c2a78dbe4e039ec13adeb7692c3cd72e6ef4 100644 (file)
@@ -233,7 +233,7 @@ int GhostscriptMsg(XEvent * ev, void *)
                                // now fork rendering process
                                forkstat = fork();
                                if (forkstat == -1) {
-                                       lyxerr.debug()
+                                       lyxerr[Debug::INFO]
                                                << "Cannot fork, using slow "
                                                "method for pixmap translation." << endl;
                                        tmpdisp = fl_get_display();
@@ -438,7 +438,7 @@ void DoneFigures()
        bitmaps.clear();
        figures.clear();
        
-       lyxerr.debug() << "Unregistering figures..." << endl;
+       lyxerr[Debug::INFO] << "Unregistering figures..." << endl;
 }
 
 
@@ -676,7 +676,7 @@ void runqueue()
                        // if we are still there, an error occurred.
                        lyxerr << "Error executing ghostscript. "
                               << "Code: " << err << endl;
-                       lyxerr.debug() << "Cmd: " 
+                       lyxerr[Debug::INFO] << "Cmd: " 
                                       << lyxrc.ps_command
                                       << " -sDEVICE=x11 "
                                       << tmpf << ' '
@@ -799,18 +799,18 @@ void makeupdatelist(figdata * p)
 // this func is only "called" in spellchecker.C
 void sigchldchecker(pid_t pid, int * status)
 {
-       lyxerr.debug() << "Got pid = " << pid << endl;
+       lyxerr[Debug::INFO] << "Got pid = " << pid << endl;
        bool pid_handled = false;
        for (bitmaps_type::iterator it = bitmaps.begin();
             it != bitmaps.end(); ++it) {
                if ((*it)->reading && pid == (*it)->gspid) {
-                       lyxerr.debug() << "Found pid in bitmaps" << endl;
+                       lyxerr[Debug::INFO] << "Found pid in bitmaps" << endl;
                        // now read the file and remove it from disk
                        figdata * p = (*it);
                        p->reading = false;
                        if ((*it)->gsdone) *status = 0;
                        if (*status == 0) {
-                               lyxerr.debug() << "GS [" << pid
+                               lyxerr[Debug::INFO] << "GS [" << pid
                                               << "] exit OK." << endl;
                        } else {
                                lyxerr << "GS [" << pid  << "] error "
@@ -836,18 +836,18 @@ void sigchldchecker(pid_t pid, int * status)
                }
        }
        if (!pid_handled) {
-               lyxerr.debug() << "Checking pid in pidwait" << endl;
+               lyxerr[Debug::INFO] << "Checking pid in pidwait" << endl;
                list<int>::iterator it = find(pidwaitlist.begin(),
                                              pidwaitlist.end(), pid);
                if (it != pidwaitlist.end()) {
-                       lyxerr.debug() << "Found pid in pidwait\n"
+                       lyxerr[Debug::INFO] << "Found pid in pidwait\n"
                                       << "Caught child pid of recompute "
                                "routine" << pid << endl;
                        pidwaitlist.erase(it);
                }
        }
        if (pid == -1) {
-               lyxerr.debug() << "waitpid error" << endl;
+               lyxerr[Debug::INFO] << "waitpid error" << endl;
                switch (errno) {
                case ECHILD:
                        lyxerr << "The process or process group specified by "
@@ -871,7 +871,7 @@ void sigchldchecker(pid_t pid, int * status)
        } else if (pid == 0) {
                lyxerr << "waitpid nohang" << endl;;
        } else {
-               lyxerr.debug() << "normal exit from childhandler" << endl;
+               lyxerr[Debug::INFO] << "normal exit from childhandler" << endl;
        }
 }
 
@@ -1078,7 +1078,7 @@ void InsetFig::Read(Buffer const *, LyXLex & lex)
                lex.next();
 
                string const token = lex.GetString();
-               lyxerr.debug() << "Token: " << token << endl;
+               lyxerr[Debug::INFO] << "Token: " << token << endl;
                
                if (token.empty())
                        continue;
@@ -1126,7 +1126,7 @@ void InsetFig::Read(Buffer const *, LyXLex & lex)
                        case PER_PAGE: wtype = PER_PAGE; break;
                        case PER_COL: wtype = PER_COL; break;
                        default:
-                               lyxerr.debug() << "Unknown type!" << endl;
+                               lyxerr[Debug::INFO] << "Unknown type!" << endl;
                                break;
                        }
                        twtype = wtype;
@@ -1142,7 +1142,7 @@ void InsetFig::Read(Buffer const *, LyXLex & lex)
                        case IN: htype = IN; break;
                        case PER_PAGE: htype = PER_PAGE; break;
                        default:
-                               lyxerr.debug() << "Unknown type!" << endl;
+                               lyxerr[Debug::INFO] << "Unknown type!" << endl;
                                break;
                        }
                        thtype = htype;
@@ -1214,7 +1214,7 @@ string const InsetFig::EditMessage() const
 
 void InsetFig::Edit(BufferView * bv, int, int, unsigned int)
 {
-       lyxerr.debug() << "Editing InsetFig." << endl;
+       lyxerr[Debug::INFO] << "Editing InsetFig." << endl;
        Regenerate();
 
        // We should have RO-versions of the form instead.
@@ -1587,14 +1587,14 @@ void InsetFig::GetPSSizes()
        for (;;) {
                char c = 0; ifs.get(c);
                if (ifs.eof()) {
-                       lyxerr.debug() << "End of (E)PS file reached and"
+                       lyxerr[Debug::INFO] << "End of (E)PS file reached and"
                                " no BoundingBox!" << endl;
                        break;
                }
                if (c == '%' && lastchar == '%') {
                        ifs >> p;
                        if (p.empty()) break;
-                       lyxerr.debug() << "Token: `" << p << "'" << endl;
+                       lyxerr[Debug::INFO] << "Token: `" << p << "'" << endl;
                        if (p == "BoundingBox:") {
                                float fpsx, fpsy, fpswid, fpshgh;
                                if (ifs >> fpsx >> fpsy >> fpswid >> fpshgh) {
@@ -1664,7 +1664,7 @@ void InsetFig::CallbackFig(long arg)
                        fl_activate_object(form->Width);
                        break;
                default:
-                       lyxerr.debug() << "Unknown type!" << endl;
+                       lyxerr[Debug::INFO] << "Unknown type!" << endl;
                        break;
                }
                regen = true;
@@ -1695,7 +1695,7 @@ void InsetFig::CallbackFig(long arg)
                        fl_activate_object(form->Height);
                        break;
                default:
-                       lyxerr.debug() << "Unknown type!" << endl;
+                       lyxerr[Debug::INFO] << "Unknown type!" << endl;
                        break;
                }
                regen = true;
index e86a169fed4412d2c562318370572986f282b08a..5fe964448777f7add2b73930487595da7c934f5b 100644 (file)
@@ -85,34 +85,34 @@ LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
 
 void UpdatableInset::InsetButtonPress(BufferView *, int x, int y, int button)
 {
-       lyxerr.debug() << "Inset Button Press x=" << x
+       lyxerr[Debug::INFO] << "Inset Button Press x=" << x
                       << ", y=" << y << ", button=" << button << endl;
 }
 
 
 void UpdatableInset::InsetButtonRelease(BufferView *, int x, int y, int button)
 {
-       lyxerr.debug() << "Inset Button Release x=" << x
+       lyxerr[Debug::INFO] << "Inset Button Release x=" << x
                       << ", y=" << y << ", button=" << button << endl;
 }
 
 
 void UpdatableInset::InsetKeyPress(XKeyEvent *)
 {
-       lyxerr.debug() << "Inset Keypress" << endl;
+       lyxerr[Debug::INFO] << "Inset Keypress" << endl;
 }
 
 
 void UpdatableInset::InsetMotionNotify(BufferView *, int x, int y, int state)
 {
-       lyxerr.debug() << "Inset Motion Notify x=" << x
+       lyxerr[Debug::INFO] << "Inset Motion Notify x=" << x
                       << ", y=" << y << ", state=" << state << endl;
 }
 
 
 void UpdatableInset::InsetUnlock(BufferView *)
 {
-       lyxerr.debug() << "Inset Unlock" << endl;
+       lyxerr[Debug::INFO] << "Inset Unlock" << endl;
 }
 
 
index a1e0e4c46e812ab4cd8d8828422895ef005c78be..8160e7416beac786cd3f0b76d3fac5f67b9a8608 100644 (file)
@@ -25,9 +25,11 @@ using std::ostream;
 
 InsetERT::InsetERT() : InsetCollapsable()
 {
-       setLabel(_("ERT"));
+       setLabel(_("666"));
+#ifndef NO_LATEX
        LyXFont font(LyXFont::ALL_SANE);
        font.setLatex (LyXFont::ON);
+#endif
        labelfont = LyXFont(LyXFont::ALL_SANE);
        labelfont.decSize();
        labelfont.decSize();
@@ -60,6 +62,12 @@ string const InsetERT::EditMessage() const
 }
 
 
+bool InsetERT::InsertInset(BufferView *, Inset *)
+{
+       return false;
+}
+
+
 void InsetERT::SetFont(BufferView *, LyXFont const &, bool, bool selectall)
 {
        // if selectall is activated then the fontchange was an outside general
@@ -74,6 +82,38 @@ void InsetERT::SetFont(BufferView *, LyXFont const &, bool, bool selectall)
 void InsetERT::Edit(BufferView * bv, int x, int y, unsigned int button)
 {
        InsetCollapsable::Edit(bv, x, y, button);
+#ifndef NO_LATEX
        LyXFont font(LyXFont::ALL_SANE);
        font.setLatex (LyXFont::ON);
+#endif
+}
+
+
+int InsetERT::Latex(Buffer const *, std::ostream & os, bool /*fragile*/,
+                   bool /*free_spc*/) const
+{
+       Paragraph::size_type siz = inset.par->size();
+       for (Paragraph::size_type i = 0; i != siz; ++i) {
+               os << inset.par->getChar(i);
+       }
+       return 1;
+}
+
+
+int InsetERT::Ascii(Buffer const *,
+                   std::ostream &, int /*linelen*/) const 
+{
+       return 0;
+}
+
+
+int InsetERT::Linuxdoc(Buffer const *, std::ostream &) const
+{
+       return 0;
+}
+
+
+int InsetERT::DocBook(Buffer const *, std::ostream &) const
+{
+       return 0;
 }
index f57208d4c8906d3f06c58046f01f02630800581c..d653b69316fa76e8a05da6bca33a41a2fc32144b 100644 (file)
@@ -30,18 +30,28 @@ public:
        ///
        InsetERT();
        ///
-       void Write(Buffer const * buf, std::ostream & os) const;
+       virtual void Write(Buffer const * buf, std::ostream & os) const;
        ///
-       Inset * Clone(Buffer const &) const;
+       virtual Inset * Clone(Buffer const &) const;
        ///
-       string const EditMessage() const;
+       virtual string const EditMessage() const;
        ///
-       bool InsertInset(BufferView *, Inset *) { return false; }
+       virtual bool InsertInset(BufferView *, Inset *);
        ///
-       void SetFont(BufferView *, LyXFont const &, bool toggleall = false,
-                 bool selectall = false);
+       virtual void SetFont(BufferView *, LyXFont const &,
+                            bool toggleall = false, bool selectall = false);
        ///
-       void Edit(BufferView *, int, int, unsigned int);
+       virtual void Edit(BufferView *, int, int, unsigned int);
+       ///
+       virtual int Latex(Buffer const *, std::ostream &, bool fragile,
+                         bool free_spc) const;
+       ///
+       virtual int Ascii(Buffer const *,
+                         std::ostream &, int linelen = 0) const;
+       ///
+       virtual int Linuxdoc(Buffer const *, std::ostream &) const;
+       ///
+       virtual int DocBook(Buffer const *, std::ostream &) const;
 };
 
 #endif
index a99ce6cb79d8acb840fcba59953006db13203524..fb7defde2b21323f14963a3174febda4a3d3e303 100644 (file)
@@ -328,7 +328,8 @@ void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
                lex.next();
 
                string const token = lex.GetString();
-               lyxerr.debug() << "Token: '" << token << '\'' << std::endl;
+               lyxerr[Debug::INFO] << "Token: '" << token << '\'' 
+                                   << std::endl;
 
                if (token.empty()) {
                        continue;
@@ -597,14 +598,14 @@ void InsetGraphics::updateInset() const
 }
 
 
-bool InsetGraphics::setParams(InsetGraphicsParams const & params)
+bool InsetGraphics::setParams(InsetGraphicsParams const & p)
 {
        // If nothing is changed, just return and say so.
-       if (this->params == params)
+       if (params == p)
                return false;
 
        // Copy the new parameters.
-       this->params = params;
+       params = p;
 
        // Update the inset with the new parameters.
        updateInset();
@@ -622,7 +623,9 @@ InsetGraphicsParams InsetGraphics::getParams() const
 
 Inset * InsetGraphics::Clone(Buffer const &) const
 {
+#ifdef WITH_WARNINGS
 #warning use the copy constructor instead. (Lgb)
+#endif
        InsetGraphics * newInset = new InsetGraphics;
 
        newInset->cacheHandle = cacheHandle;
index 1aedaa180c1db5d72326075b9639ac30f4a83eee..148b677b23c656a0c248f9cf6661b5f9720cee69 100644 (file)
@@ -39,7 +39,11 @@ InsetInfo::InsetInfo()
        : form(0), labelfont(LyXFont::ALL_SANE)
 {
        labelfont.decSize().decSize()
-               .setColor(LColor::note).setLatex(LyXFont::OFF);
+               .setColor(LColor::note)
+#ifndef NO_LATEX
+               .setLatex(LyXFont::OFF)
+#endif
+               ;
 }
 
 
@@ -47,7 +51,11 @@ InsetInfo::InsetInfo(string const & str)
        : contents(str), form(0), labelfont(LyXFont::ALL_SANE)
 {
        labelfont.decSize().decSize()
-               .setColor(LColor::note).setLatex(LyXFont::OFF);
+               .setColor(LColor::note)
+#ifndef NO_LATEX
+               .setLatex(LyXFont::OFF)
+#endif
+               ;
 }
 
 
index 5be50470dbe5f66f6618e33f05a4850997dd9f58..ff3fa02cb57110eee69a05e03841d007bbbc29b9 100644 (file)
@@ -22,6 +22,7 @@
 #include "buffer.h"
 #include "gettext.h"
 #include "BufferView.h"
+#include "support/lstrings.h"
 
 using std::ostream;
 using std::vector;
@@ -94,23 +95,3 @@ int InsetLabel::DocBook(Buffer const *, ostream & os) const
        os << "<anchor id=\"" << getContents() << "\" ></anchor>";
        return 0;
 }
-
-
-// This function escapes 8-bit characters and other problematic characters
-// It's exactly the same code as in insetref.C.
-string const InsetLabel::escape(string const & lab) const {
-       char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
-                             '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-       string enc;
-       for (string::size_type i= 0; i < lab.length(); ++i) {
-               unsigned char c = lab[i];
-               if (c >= 128 || c == '=' || c == '%') {
-                       enc += '=';
-                       enc += hexdigit[c >> 4];
-                       enc += hexdigit[c & 15];
-               } else {
-                       enc += c;
-               }
-       }
-       return enc;
-}
index b52ce2f8ce07edd330e3169dcace86f986d94a99..888f1dd3bce2252fb69dac9506c93d8688971b04 100644 (file)
@@ -43,9 +43,6 @@ public:
        int Linuxdoc(Buffer const *, std::ostream &) const;
        ///
        int DocBook(Buffer const *, std::ostream &) const;
-private:
-       /// This function escapes 8-bit characters
-       string const escape(string const &) const;
 };
 
 #endif
index 0b50057837b38f3dbab54aa1a68f264fb1581e17..80053ffe7324a956e5eed42cdae80caa38749d96 100644 (file)
@@ -195,8 +195,10 @@ int InsetQuotes::width(BufferView *, LyXFont const & font) const
 LyXFont const InsetQuotes::ConvertFont(LyXFont const & f) const
 {
        LyXFont font(f);
+#ifndef NO_LATEX
        // quotes-insets cannot be latex of any kind
        font.setLatex(LyXFont::OFF);
+#endif
        return font;
 }
 
index d0331fb6cfbee219d270c51c252a524750b3c67c..681aa2183bf1289ca29c712fce99c1509dcf8b3d 100644 (file)
@@ -14,6 +14,7 @@
 #include "frontends/Dialogs.h"
 #include "lyxfunc.h"
 #include "BufferView.h"
+#include "support/lstrings.h"
 
 using std::ostream;
 
@@ -81,30 +82,14 @@ int InsetRef::Linuxdoc(Buffer const *, ostream & os) const
 
 int InsetRef::DocBook(Buffer const *, ostream & os) const
 {
-       os << "<link linkend=\"" << getContents()
-          << "\">" << getOptions() << "</link>";
-       return 0;
-}
-
-
-// This function escapes 8-bit characters and other problematic characters
-// It's exactly the same code as in insetlabel.C.
-string const InsetRef::escape(string const & lab) const
-{
-       char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
-                             '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
-       string enc;
-       for (string::size_type i = 0; i < lab.length(); ++i) {
-               unsigned char c= lab[i];
-               if (c >= 128 || c == '=' || c == '%') {
-                       enc += '=';
-                       enc += hexdigit[c>>4];
-                       enc += hexdigit[c & 15];
-               } else {
-                       enc += c;
-               }
+       if (getOptions().empty()) {
+               os << "<xref linkend=\"" << getContents() << "\"/>";
+       } else {
+               os << "<link linkend=\"" << getContents()
+                  << "\">" << getOptions() << "</link>";
        }
-       return enc;
+
+       return 0;
 }
 
 
index 102371acdb8e36c316e46f49219b822d9b0839d0..19c8c031d79bb10996bbf0db148d0c169cf7be63 100644 (file)
@@ -65,8 +65,6 @@ public:
        ///
        void Validate(LaTeXFeatures & features) const;
 private:
-       /// This function escapes 8-bit characters
-       string const escape(string const &) const;
        ///
        bool isLatex;
 };
index 437971d5ab4396624563d1165f0634ddbaafc4b7..0278bb7e60e59023043d38a4df811a62e3fd181c 100644 (file)
@@ -15,7 +15,7 @@
 
 #include <cstdlib>
 #include <map>
-
+//#include <signal.h>
 #ifdef __GNUG__
 #pragma implementation
 #endif
@@ -24,6 +24,7 @@
 
 #include "buffer.h"
 #include "commandtags.h"
+#include "lyxfunc.h"
 #include "debug.h"
 #include "LaTeXFeatures.h"
 #include "Painter.h"
@@ -46,7 +47,6 @@ using std::endl;
 using std::swap;
 using std::max;
 
-
 namespace {
 
 const int ADD_TO_HEIGHT = 2;
@@ -292,6 +292,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
                                        first_visible_cell = cell;
                                if (hasSelection())
                                        DrawCellSelection(pain, nx, baseline, i, j, cell);
+                               
                                tabular->GetCellInset(cell)->draw(bv, font, baseline, cx,
                                                                                                  cleared);
                                DrawCellLines(pain, nx, baseline, i, cell);
@@ -308,6 +309,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
                if (the_locking_inset &&
                        tabular->GetCellInset(actcell) != the_locking_inset)
                {
+#warning Jürgen, why is this?
                        Inset * inset = tabular->GetCellInset(cell);
                        for (i = 0;
                             inset != the_locking_inset && i < tabular->rows();
@@ -353,7 +355,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
                float dx = nx + tabular->GetBeginningOfTextInCell(cell);
                float cx = dx;
                //cx = dx = nx + tabular->GetBeginningOfTextInCell(cell);
-               tabular->GetCellInset(cell)->draw(bv,font,baseline, dx, false);
+               tabular->GetCellInset(cell)->draw(bv, font, baseline, dx, false);
 #if 0
                if (bv->text->status == LyXText::CHANGED_IN_DRAW)
                        return;
@@ -382,8 +384,8 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
        x -= ADD_TO_TABULAR_WIDTH;
        x += width(bv, font);
        if (bv->text->status == LyXText::CHANGED_IN_DRAW) {
-               int i=0;
-               for(Inset * inset=owner();inset;++i)
+               int i = 0;
+               for(Inset * inset=owner(); inset; ++i)
                        inset = inset->owner();
                if (calculate_dimensions_of_cells(bv, font, false))
                        need_update = INIT;
@@ -582,7 +584,9 @@ bool InsetTabular::UnlockInsetInInset(BufferView * bv, UpdatableInset * inset,
        if (the_locking_inset == inset) {
                the_locking_inset->InsetUnlock(bv);
                the_locking_inset = 0;
+#ifdef WITH_WARNINGS
 #warning fix scrolling when cellinset has requested a scroll (Jug)!!!
+#endif
 #if 0
                if (scroll(false))
                        scroll(bv, 0.0F);
@@ -783,7 +787,7 @@ InsetTabular::LocalDispatch(BufferView * bv,
 
        bool hs = hasSelection();
 
-       result=DISPATCHED;
+       result = DISPATCHED;
        // this one have priority over the locked InsetText!
        switch (action) {
        case LFUN_SHIFT_TAB:
@@ -1141,10 +1145,13 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
                changed = tabular->SetDescentOfRow(actrow, maxDesc + ADD_TO_HEIGHT) || changed;
                return changed;
        }
+#if 0
+       cur_cell = -1;
+#endif
        for (int i = 0; i < tabular->rows(); ++i) {
                maxAsc = 0;
                maxDesc = 0;
-               for (int j= 0; j < tabular->columns(); ++j) {
+               for (int j = 0; j < tabular->columns(); ++j) {
                        if (tabular->IsPartOfMultiColumn(i,j))
                                continue;
                        ++cell;
@@ -1904,34 +1911,36 @@ int InsetTabular::GetMaxWidthOfCell(BufferView * bv, int cell) const
 int InsetTabular::getMaxWidth(BufferView * bv,
                              UpdatableInset const * inset) const
 {
-       typedef std::map<UpdatableInset const *, int> Cache;
-       static Cache cache;
-
-       int cell = -1;
-       Cache::const_iterator ci = cache.find(inset);
-       if (ci != cache.end()) {
-               cell = (*ci).second;
-               if (tabular->GetCellInset(cell) != inset) {
-                               cell = -1;
-               }
+       int cell = tabular->cur_cell;
+       if (tabular->GetCellInset(cell) != inset) {
+                       cell = actcell;
+                       if (tabular->GetCellInset(cell) != inset) {
+                                       lyxerr << "Actcell not equal to actual cell!" << std::endl;
+                                       //raise(SIGSTOP);
+                                       cell = -1;
+                       }
        }
        
        int const n = tabular->GetNumberOfCells();
+
        if (cell == -1) {
                cell = 0;
                for (; cell < n; ++cell) {
                        if (tabular->GetCellInset(cell) == inset)
                                break;
                }
-               cache[inset] = cell;
        }
-
-       if (cell >= n)
-               return -1;
+       
+       if (cell >= n) {
+                       return -1;
+       }
+       
        int w = GetMaxWidthOfCell(bv, cell);
-       if (w > 0)
+       if (w > 0) {
                // because the inset then subtracts it's top_x and owner->x()
                w += (inset->x() - top_x);
+       }
+       
        return w;
 }
 
@@ -1945,8 +1954,8 @@ void InsetTabular::deleteLyXText(BufferView * bv, bool recursive) const
 void InsetTabular::resizeLyXText(BufferView * bv, bool force) const
 {
        if (force) {
-               for(int i=0; i < tabular->rows(); ++i) {
-                       for(int j=0; j < tabular->columns(); ++j) {
+               for(int i = 0; i < tabular->rows(); ++i) {
+                       for(int j = 0; j < tabular->columns(); ++j) {
                                tabular->GetCellInset(i, j)->resizeLyXText(bv, true);
                        }
                }
@@ -1994,10 +2003,10 @@ void InsetTabular::OpenLayoutDialog(BufferView * bv) const
 // 2 ... toggled on
 // 3 ... toggled off
 //
-LyXFunc::func_status InsetTabular::getStatus(string const & what) const
+func_status::value_type InsetTabular::getStatus(string const & what) const
 {
        int action = LyXTabular::LAST_ACTION;
-       LyXFunc::func_status status = LyXFunc::OK;
+       func_status::value_type status = func_status::OK;
        
        int i = 0;
        for (; tabularFeatures[i].action != LyXTabular::LAST_ACTION; ++i) {
@@ -2010,7 +2019,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
                }
        }
        if (action == LyXTabular::LAST_ACTION)
-               return LyXFunc::Unknown;
+               return func_status::Unknown;
 
        string const argument = frontStrip(what.substr(tabularFeatures[i].feature.length()));
 
@@ -2030,7 +2039,7 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
        case LyXTabular::SET_MPWIDTH:
        case LyXTabular::SET_SPECIAL_COLUMN:
        case LyXTabular::SET_SPECIAL_MULTI:
-               status |= LyXFunc::Disabled;
+               status |= func_status::Disabled;
                return status;
 
        case LyXTabular::APPEND_ROW:
@@ -2039,169 +2048,169 @@ LyXFunc::func_status InsetTabular::getStatus(string const & what) const
        case LyXTabular::DELETE_COLUMN:
        case LyXTabular::SET_ALL_LINES:
        case LyXTabular::UNSET_ALL_LINES:
-               status |= LyXFunc::OK;
+               status |= func_status::OK;
                return status;
 
        case LyXTabular::MULTICOLUMN:
                if (tabular->IsMultiColumn(actcell))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_TOGGLE_LINE_TOP:
                flag = false;
        case LyXTabular::TOGGLE_LINE_TOP:
                if (tabular->TopLine(actcell, flag))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_TOGGLE_LINE_BOTTOM:
                flag = false;
        case LyXTabular::TOGGLE_LINE_BOTTOM:
                if (tabular->BottomLine(actcell, flag))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_TOGGLE_LINE_LEFT:
                flag = false;
        case LyXTabular::TOGGLE_LINE_LEFT:
                if (tabular->LeftLine(actcell, flag))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_TOGGLE_LINE_RIGHT:
                flag = false;
        case LyXTabular::TOGGLE_LINE_RIGHT:
                if (tabular->RightLine(actcell, flag))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_ALIGN_LEFT:
                flag = false;
        case LyXTabular::ALIGN_LEFT:
                if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_LEFT)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_ALIGN_RIGHT:
                flag = false;
        case LyXTabular::ALIGN_RIGHT:
                if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_RIGHT)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_ALIGN_CENTER:
                flag = false;
        case LyXTabular::ALIGN_CENTER:
                if (tabular->GetAlignment(actcell, flag) == LYX_ALIGN_CENTER)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_VALIGN_TOP:
                flag = false;
        case LyXTabular::VALIGN_TOP:
                if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_TOP)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_VALIGN_BOTTOM:
                flag = false;
        case LyXTabular::VALIGN_BOTTOM:
                if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_BOTTOM)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::M_VALIGN_CENTER:
                flag = false;
        case LyXTabular::VALIGN_CENTER:
                if (tabular->GetVAlignment(actcell, flag) == LyXTabular::LYX_VALIGN_CENTER)
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LONGTABULAR:
                if (tabular->IsLongTabular())
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::UNSET_LONGTABULAR:
                if (!tabular->IsLongTabular())
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_ROTATE_TABULAR:
                if (tabular->GetRotateTabular())
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::UNSET_ROTATE_TABULAR:
                if (!tabular->GetRotateTabular())
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_ROTATE_CELL:
                if (tabular->GetRotateCell(actcell))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::UNSET_ROTATE_CELL:
                if (!tabular->GetRotateCell(actcell))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_USEBOX:
                if (strToInt(argument) == tabular->GetUsebox(actcell))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LTFIRSTHEAD:
                if (tabular->GetRowOfLTHead(actcell, dummy))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LTHEAD:
                if (tabular->GetRowOfLTHead(actcell, dummy))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LTFOOT:
                if (tabular->GetRowOfLTFoot(actcell, dummy))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LTLASTFOOT:
                if (tabular->GetRowOfLTFoot(actcell, dummy))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        case LyXTabular::SET_LTNEWPAGE:
                if (tabular->GetLTNewPage(actcell))
-                       status |= LyXFunc::ToggleOn;
+                       status |= func_status::ToggleOn;
                else
-                       status |= LyXFunc::ToggleOff;
+                       status |= func_status::ToggleOff;
                break;
        default:
-               status = LyXFunc::Disabled;
+               status = func_status::Disabled;
                break;
        }
        return status;
@@ -2218,12 +2227,6 @@ bool InsetTabular::copySelection(BufferView * bv)
 {
        if (!hasSelection())
                return false;
-       //delete paste_tabular;
-
-       //int sel_col_start;
-       //int sel_col_end;
-       //int sel_row_start;
-       //int sel_row_end;
 
        int sel_col_start = tabular->column_of_cell(sel_cell_start);
        int sel_col_end = tabular->column_of_cell(sel_cell_end);
@@ -2238,16 +2241,12 @@ bool InsetTabular::copySelection(BufferView * bv)
        int sel_row_start = tabular->row_of_cell(sel_cell_start);
        int sel_row_end = tabular->row_of_cell(sel_cell_end);
        if (sel_row_start > sel_row_end) {
-               //int tmp tmp = sel_row_start;
-               //sel_row_start = sel_row_end;
-               //sel_row_end = tmp;
                swap(sel_row_start, sel_row_end);
        }
        int const rows = sel_row_end - sel_row_start + 1;
 
        delete paste_tabular;
        paste_tabular = new LyXTabular(this, *tabular); // rows, columns);
-       //int i;
        for (int i = 0; i < sel_row_start; ++i)
                paste_tabular->DeleteRow(0);
        while(paste_tabular->rows() > rows)
index 2de5b4b9494b69526a852c3cb5f94e0959cb5979..211a191ec3d0179d7879b8b2b90f4ce28245e360 100644 (file)
@@ -56,7 +56,7 @@
 #include "tabular.h"
 #include "LString.h"
 #include "lyxcursor.h"
-#include "lyxfunc.h"
+#include "func_status.h"
 
 class LyXLex;
 class Painter;
@@ -178,7 +178,7 @@ public:
        ///
        bool ShowInsetDialog(BufferView *) const;
        ///
-       LyXFunc::func_status getStatus(string const & argument) const;
+       func_status::value_type getStatus(string const & argument) const;
        ///
        std::vector<string> const getLabelList() const;
        ///
index 7516a4a6b102c447d4748102195e264cd9bf5218..2382a35461d119d2b7e886e3b7b8ff9c191750a6 100644 (file)
@@ -171,11 +171,12 @@ public:
        ///
        void SetFrameColor(BufferView *, LColor::color);
        ///
-       LyXText * getLyXText(BufferView const *, bool const recursive=false) const;
+       LyXText * getLyXText(BufferView const *,
+                            bool const recursive = false) const;
        ///
-       void deleteLyXText(BufferView *, bool recursive=true) const;
+       void deleteLyXText(BufferView *, bool recursive = true) const;
        ///
-       void resizeLyXText(BufferView *, bool force=false) const;
+       void resizeLyXText(BufferView *, bool force = false) const;
        ///
        bool ShowInsetDialog(BufferView *) const;
        ///
@@ -184,9 +185,11 @@ public:
        bool nodraw() const;
        ///
        int scroll(bool recursive=true) const;
+       ///
        void scroll(BufferView *bv, float sx) const {
                UpdatableInset::scroll(bv, sx);
        }
+       ///
        void scroll(BufferView *bv, int offset) const {
                UpdatableInset::scroll(bv, offset);
        }
index 8bb730868f2d1a8c47bb67b376c496f414f150f4..dc73658688abe5de12ebcae5af6b1358c1f46de4 100644 (file)
@@ -277,7 +277,7 @@ int MenuRunChktex(Buffer * buffer)
 
 void QuitLyX()
 {
-       lyxerr.debug() << "Running QuitLyX." << endl;
+       lyxerr[Debug::INFO] << "Running QuitLyX." << endl;
 
        if (lyxrc.use_gui) {
                if (!bufferlist.QwriteAll())
@@ -294,7 +294,7 @@ void QuitLyX()
        bufferlist.closeAll();
 
        // do any other cleanup procedures now
-       lyxerr.debug() << "Deleting tmp dir " << system_tempdir << endl;
+       lyxerr[Debug::INFO] << "Deleting tmp dir " << system_tempdir << endl;
 
        DestroyLyXTmpDir(system_tempdir);
 
@@ -390,9 +390,9 @@ Buffer * NewLyxFile(string const & filename)
                tmpname = split(tmpname, ':');
        }
 #endif
-       lyxerr.debug() << "Arg is " << filename
-                      << "\nName is " << name
-                      << "\nTemplate is " << tmpname << endl;
+       lyxerr[Debug::INFO] << "Arg is " << filename
+                           << "\nName is " << name
+                           << "\nTemplate is " << tmpname << endl;
 
        // find a free buffer 
        Buffer * tmpbuf = bufferlist.newFile(name, tmpname);
index c481050584c1a0131b1fb87af4cf8ae0f6f071e3..7dae2cab0d2fb20fcfc3974fca08401b136c7a89 100644 (file)
@@ -107,7 +107,9 @@ LyXFont::FontBits LyXFont::sane = {
        SIZE_NORMAL,
        LColor::none,
        OFF,
+#ifndef NO_LATEX
        OFF,
+#endif
        OFF,
        OFF,
        OFF };
@@ -120,7 +122,9 @@ LyXFont::FontBits LyXFont::inherit = {
        INHERIT_SIZE,
        LColor::inherit,
        INHERIT,
+#ifndef NO_LATEX
        INHERIT,
+#endif
        INHERIT,
        INHERIT,
        OFF };
@@ -133,7 +137,9 @@ LyXFont::FontBits LyXFont::ignore = {
        IGNORE_SIZE,
        LColor::ignore,
        IGNORE,
+#ifndef NO_LATEX
        IGNORE,
+#endif
        IGNORE,
        IGNORE,
        IGNORE };
@@ -149,7 +155,9 @@ bool LyXFont::FontBits::operator==(LyXFont::FontBits const & fb1) const
                fb1.emph == emph &&
                fb1.underbar == underbar &&
                fb1.noun == noun &&
+#ifndef NO_LATEX
                fb1.latex == latex &&
+#endif
                fb1.number == number;
 }
 
@@ -196,10 +204,12 @@ LyXFont::FONT_MISC_STATE LyXFont::underbar() const
 }
 
 
+#ifndef NO_LATEX
 LyXFont::FONT_MISC_STATE LyXFont::latex() const 
 {
        return bits.latex;
 }
+#endif
 
 
 LColor::color LyXFont::color() const 
@@ -228,7 +238,11 @@ bool LyXFont::isRightToLeft() const
 
 bool LyXFont::isVisibleRightToLeft() const 
 {
-       return (lang->RightToLeft() && latex() != ON && number() != ON);
+       return (lang->RightToLeft() &&
+#ifndef NO_LATEX
+               latex() != ON &&
+#endif
+               number() != ON);
 }
 
 
@@ -281,11 +295,13 @@ LyXFont & LyXFont::setNoun(LyXFont::FONT_MISC_STATE n)
 }
 
 
+#ifndef NO_LATEX
 LyXFont & LyXFont::setLatex(LyXFont::FONT_MISC_STATE l)
 {
        bits.latex = l;
        return *this;
 }
+#endif
 
 
 LyXFont & LyXFont::setColor(LColor::color c)
@@ -437,8 +453,10 @@ void LyXFont::update(LyXFont const & newfont,
        setEmph(setMisc(newfont.emph(), emph()));
        setUnderbar(setMisc(newfont.underbar(), underbar()));
        setNoun(setMisc(newfont.noun(), noun()));
+#ifndef NO_LATEX
        setLatex(setMisc(newfont.latex(), latex()));
-
+#endif
+       
        setNumber(setMisc(newfont.number(), number()));
        if (newfont.language() == language() && toggleall)
                if (language() == document_language)
@@ -472,8 +490,10 @@ void LyXFont::reduce(LyXFont const & tmplt)
                setUnderbar(INHERIT);
        if (noun() == tmplt.noun())
                setNoun(INHERIT);
+#ifndef NO_LATEX
        if (latex() == tmplt.latex())
                setLatex(INHERIT);
+#endif
        if (color() == tmplt.color())
                setColor(LColor::inherit);
 }
@@ -508,9 +528,11 @@ LyXFont & LyXFont::realize(LyXFont const & tmplt)
        if (bits.noun == INHERIT) {
                bits.noun = tmplt.bits.noun;
        }
+#ifndef NO_LATEX
        if (bits.latex == INHERIT) {
                bits.latex = tmplt.bits.latex;
        }
+#endif
        if (bits.color == LColor::inherit) {
                bits.color = tmplt.bits.color;
        }
@@ -524,7 +546,10 @@ bool LyXFont::resolved() const
        return (family() != INHERIT_FAMILY && series() != INHERIT_SERIES &&
                shape() != INHERIT_SHAPE && size() != INHERIT_SIZE &&
                emph() != INHERIT && underbar() != INHERIT && 
-               noun() != INHERIT && latex() != INHERIT && 
+               noun() != INHERIT &&
+#ifndef NO_LATEX
+               latex() != INHERIT &&
+#endif
                color() != LColor::inherit);
 }
 
@@ -551,8 +576,10 @@ string const LyXFont::stateText(BufferParams * params) const
                    << _(GUIMiscNames[underbar()]) << ", ";
        if (noun() != INHERIT)
                ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
+#ifndef NO_LATEX
        if (latex() != INHERIT)
                ost << _("Latex ") << _(GUIMiscNames[latex()]) << ", ";
+#endif
        if (bits == inherit)
                ost << _("Default") << ", ";
        if (!params || (language() != params->language))
@@ -689,6 +716,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
                        lex.next();
                        string const ttok = lex.GetString();
                        setLyXSize(ttok);
+#ifndef NO_LATEX
                } else if (tok == "latex") {
                        lex.next();
                        string const ttok = lowercase(lex.GetString());
@@ -700,6 +728,7 @@ LyXFont & LyXFont::lyxRead(LyXLex & lex)
                        } else {
                                lex.printError("Illegal LaTeX type`$$Token'");
                        }
+#endif
                } else if (tok == "misc") {
                        lex.next();
                        string const ttok = lowercase(lex.GetString());
@@ -773,6 +802,7 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
        if (orgfont.noun() != noun()) {
                os << "\\noun " << LyXMiscNames[noun()] << " \n";
        }
+#ifndef NO_LATEX
        if (orgfont.latex() != latex()) {
                // This is only for backwards compatibility
                switch (latex()) {
@@ -789,6 +819,7 @@ void LyXFont::lyxWriteChanges(LyXFont const & orgfont, ostream & os) const
                break;
                }
        }
+#endif
        if (orgfont.color() != color()) {
                // To make us file compatible with older
                // lyx versions we emit "default" instead
@@ -977,8 +1008,10 @@ int LyXFont::latexWriteEndChanges(ostream & os, LyXFont const & base,
 
 LColor::color LyXFont::realColor() const
 {
+#ifndef NO_LATEX
        if (latex() == ON)
                return LColor::latex;
+#endif
        if (color() == LColor::none)
                return LColor::foreground;
        return color();
@@ -1005,7 +1038,9 @@ LyXFont::FONT_SHAPE LyXFont::realShape() const
 bool LyXFont::equalExceptLatex(LyXFont const & f) const 
 {
        LyXFont f1 = *this;
+#ifndef NO_LATEX
        f1.setLatex(f.latex());
+#endif
        return f1 == f;
 }
 
index 6a716b88c15c2669ad116ebf1caab7067ead81ce..11543c87f3275801bf3bf486a31a74cfb319430c 100644 (file)
@@ -26,6 +26,8 @@ class LyXLex;
 class BufferParams;
 
 
+//#define NO_LATEX 1
+
 ///
 class LyXFont {
 public:
@@ -186,9 +188,10 @@ public:
        ///
        FONT_MISC_STATE noun() const;
 
+#ifndef NO_LATEX
        ///
        FONT_MISC_STATE latex() const;
-
+#endif
        ///
        FONT_MISC_STATE number() const;
 
@@ -218,8 +221,10 @@ public:
        LyXFont & setUnderbar(LyXFont::FONT_MISC_STATE u);
        ///
        LyXFont & setNoun(LyXFont::FONT_MISC_STATE n);
+#ifndef NO_LATEX
        ///
        LyXFont & setLatex(LyXFont::FONT_MISC_STATE l);
+#endif
        ///
        LyXFont & setNumber(LyXFont::FONT_MISC_STATE n);
        ///
@@ -330,8 +335,10 @@ private:
                FONT_MISC_STATE underbar;
                ///
                FONT_MISC_STATE noun;
+#ifndef NO_LATEX
                ///
                FONT_MISC_STATE latex;
+#endif
                ///
                FONT_MISC_STATE number;
        };
index 245c0634786e1b047d920cba9d69b86aa1c7c893..33ae956f304a88cdc90b9c9dc6c62221e794bbb3 100644 (file)
@@ -59,7 +59,9 @@
 #include "insets/insettheorem.h"
 #include "insets/insetcaption.h"
 #include "mathed/formulamacro.h"
-#include "spellchecker.h" // RVDK_PATCH_5
+#include "mathed/math_cursor.h"
+#include "mathed/math_inset.h"
+#include "spellchecker.h" 
 #include "minibuffer.h"
 #include "vspace.h"
 #include "LyXView.h"
@@ -350,17 +352,17 @@ void LyXFunc::processKeySym(KeySym keysym, unsigned int state)
 } 
 
 
-LyXFunc::func_status LyXFunc::getStatus(int ac) const
+func_status::value_type LyXFunc::getStatus(int ac) const
 {
        return getStatus(ac, string());
 }
 
 
-LyXFunc::func_status LyXFunc::getStatus(int ac,
-                                       string const & not_to_use_arg) const
+func_status::value_type LyXFunc::getStatus(int ac,
+                                          string const & not_to_use_arg) const
 {
        kb_action action;
-       func_status flag = LyXFunc::OK;
+       func_status::value_type flag = func_status::OK;
        string argument;
        Buffer * buf = owner->buffer();
        
@@ -374,7 +376,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
        
        if (action == LFUN_UNKNOWN_ACTION) {
                setErrorMessage(N_("Unknown action"));
-               return LyXFunc::Unknown;
+               return func_status::Unknown;
        }
        
        // Check whether we need a buffer
@@ -388,13 +390,13 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
                                                   LyXAction::ReadOnly)) {
                                // no
                                setErrorMessage(N_("Document is read-only"));
-                               flag |= LyXFunc::Disabled;
+                               flag |= func_status::Disabled;
                        }
                } else {
                        // no
                        setErrorMessage(N_("Command not allowed with"
                                           "out any document open"));
-                       flag |= LyXFunc::Disabled;
+                       flag |= func_status::Disabled;
                        return flag;
                }
        }
@@ -447,7 +449,7 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
        case LFUN_TABULAR_FEATURE:
                disable = true;
                if (owner->view()->theLockingInset()) {
-                       func_status ret = LyXFunc::Disabled;
+                       func_status::value_type ret = func_status::Disabled;
                        if (owner->view()->theLockingInset()->LyxCode() == Inset::TABULAR_CODE) {
                                ret = static_cast<InsetTabular *>
                                        (owner->view()->theLockingInset())->
@@ -455,20 +457,20 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
                        } else if (owner->view()->theLockingInset()->GetFirstLockingInsetOfType(Inset::TABULAR_CODE)) {
                                ret = static_cast<InsetTabular *>
                                        (owner->view()->theLockingInset()->
-                                       GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
+                                        GetFirstLockingInsetOfType(Inset::TABULAR_CODE))->
                                        getStatus(argument);
                        }
                        flag |= ret;
                        disable = false;
                } else {
-                   static InsetTabular inset(*owner->buffer(), 1, 1);
-                   func_status ret;
-
-                   disable = true;
-                   ret = inset.getStatus(argument);
-                   if ((ret & LyXFunc::ToggleOn) ||
-                       (ret & LyXFunc::ToggleOff))
-                       flag |= LyXFunc::ToggleOff;
+                       static InsetTabular inset(*owner->buffer(), 1, 1);
+                       func_status::value_type ret;
+
+                       disable = true;
+                       ret = inset.getStatus(argument);
+                       if ((ret & func_status::ToggleOn) ||
+                           (ret & func_status::ToggleOff))
+                               flag |= func_status::ToggleOff;
                }
                break;
 
@@ -489,39 +491,117 @@ LyXFunc::func_status LyXFunc::getStatus(int ac,
        case LFUN_BOOKMARK_GOTO:
                disable =  !owner->view()->
                        isSavedPosition(strToUnsignedInt(argument));
+       case LFUN_MATH_VALIGN: {
+               Inset * tli = owner->view()->theLockingInset();
+               if (tli && (tli->LyxCode() == Inset::MATH_CODE 
+                           || tli->LyxCode() == Inset::MATHMACRO_CODE)) {
+                       char align = mathcursor->valign();
+                       if (align == '\0') {
+                               disable = true;
+                               break;
+                       }
+                       if (argument.empty()) {
+                               flag = func_status::OK;
+                               break;
+                       }
+                       if (!contains("tcb", argument[0])) {
+                               disable = true;
+                               break;
+                       }
+                       if (argument[0] == align) 
+                               flag |= func_status::ToggleOn;
+                       else
+                               flag |= func_status::ToggleOff;
+               } else
+                       disable = true;
+               break;
+       }
+       case LFUN_MATH_HALIGN: {
+               Inset * tli = owner->view()->theLockingInset();
+               if (tli && (tli->LyxCode() == Inset::MATH_CODE 
+                           || tli->LyxCode() == Inset::MATHMACRO_CODE)) {
+                       char align = mathcursor->halign();
+                       if (align == '\0') {
+                               disable = true;
+                               break;
+                       }
+                       if (argument.empty()) {
+                               flag = func_status::OK;
+                               break;
+                       }
+                       if (!contains("lcr", argument[0])) {
+                               disable = true;
+                               break;
+                       }
+                       if (argument[0] == align) 
+                               flag |= func_status::ToggleOn;
+                       else
+                               flag |= func_status::ToggleOff;
+               } else
+                       disable = true;
+               break;
+       }
+       case LFUN_MATH_MUTATE: {
+               Inset * tli = owner->view()->theLockingInset();
+               if (tli && (tli->LyxCode() == Inset::MATH_CODE)) {
+                       MathInsetTypes type = mathcursor->par()->GetType();
+                       func_status::value_type box = func_status::ToggleOff;
+                       if (argument == "inline") {
+                               if (type == LM_OT_SIMPLE)
+                                       box = func_status::ToggleOn;
+                       } else if (argument == "display") {
+                               if (type == LM_OT_EQUATION)
+                                       box = func_status::ToggleOn;
+                       } else if (argument == "eqnarray") {
+                               if (type == LM_OT_EQNARRAY)
+                                       box = func_status::ToggleOn;
+                       } else if (argument == "align") {
+                               if (type == LM_OT_ALIGN)
+                                       box = func_status::ToggleOn;
+                       } else {
+                               box = func_status::OK;
+                               disable = true;
+                       }
+                       flag |= box;
+               } else
+                       disable = true;
+               break;
+       }
        default:
                break;
         }
         if (disable)
-                flag |= LyXFunc::Disabled;
+                flag |= func_status::Disabled;
 
        if (buf) {
-               func_status box = LyXFunc::ToggleOff;
+               func_status::value_type box = func_status::ToggleOff;
                LyXFont const & font =
                        TEXT(false)->real_current_font;
                switch (action) {
                case LFUN_EMPH:
                        if (font.emph() == LyXFont::ON)
-                               box = LyXFunc::ToggleOn;
+                               box = func_status::ToggleOn;
                        break;
                case LFUN_NOUN:
                        if (font.noun() == LyXFont::ON)
-                               box = LyXFunc::ToggleOn;
+                               box = func_status::ToggleOn;
                        break;
                case LFUN_BOLD:
                        if (font.series() == LyXFont::BOLD_SERIES)
-                               box = LyXFunc::ToggleOn;
+                               box = func_status::ToggleOn;
                        break;
+#ifndef NO_LATEX
                case LFUN_TEX:
                        if (font.latex() == LyXFont::ON)
-                               box = LyXFunc::ToggleOn;
+                               box = func_status::ToggleOn;
                        break;
+#endif
                case LFUN_READ_ONLY_TOGGLE:
                        if (buf->isReadonly())
-                               box = LyXFunc::ToggleOn;
+                               box = func_status::ToggleOn;
                        break;
                default:
-                       box = LyXFunc::OK;
+                       box = func_status::OK;
                        break;
                }
                flag |= box;
@@ -583,58 +663,9 @@ string const LyXFunc::Dispatch(int ac,
                owner->view()->hideCursor();
 
        // We cannot use this function here
-       if (getStatus(ac, do_not_use_this_arg) & Disabled)
+       if (getStatus(ac, do_not_use_this_arg) & func_status::Disabled)
                goto exit_with_message;
 
-       commandshortcut.erase();
-       
-       if (lyxrc.display_shortcuts && show_sc) {
-               if (action != LFUN_SELFINSERT) {
-                       // Put name of command and list of shortcuts
-                       // for it in minibuffer
-                       string comname = lyxaction.getActionName(action);
-
-                       int pseudoaction = action;
-                       bool argsadded = false;
-
-                       if (!argument.empty()) {
-                               // If we have the command with argument, 
-                               // this is better
-                               pseudoaction = 
-                                       lyxaction.searchActionArg(action,
-                                                                 argument);
-
-                               if (pseudoaction == -1) {
-                                       pseudoaction = action;
-                               } else {
-                                       comname += " " + argument;
-                                       argsadded = true;
-                               }
-                       }
-
-                       string const shortcuts =
-                               toplevel_keymap->findbinding(pseudoaction);
-
-                       if (!shortcuts.empty()) {
-                               comname += ": " + shortcuts;
-                       } else if (!argsadded) {
-                               comname += " " + argument;
-                       }
-
-                       if (!comname.empty()) {
-                               comname = strip(comname);
-                               commandshortcut = "(" + comname + ')';
-                               owner->message(commandshortcut);
-
-                               // Here we could even add a small pause,
-                               // to annoy the user and make him learn
-                               // the shortcuts.
-                               // No! That will just annoy, not teach
-                               // anything. The user will read the messages
-                               // if they are interested. (Asger)
-                       }
-               }
-        }
 
        if (owner->view()->available() && owner->view()->theLockingInset()) {
                UpdatableInset::RESULT result;
@@ -644,7 +675,7 @@ string const LyXFunc::Dispatch(int ac,
                        if ((action==LFUN_UNKNOWN_ACTION) && argument.empty()){
                                argument = keyseq.getiso();
                        }
-                       // Undo/Redo pre 0.13 is a bit tricky for insets.
+                       // Undo/Redo is a bit tricky for insets.
                        if (action == LFUN_UNDO) {
                                int slx;
                                int sly;
@@ -989,13 +1020,15 @@ string const LyXFunc::Dispatch(int ac,
        case LFUN_FREE:
                owner->getDialogs()->setUserFreeFont();
                break;
-               
+
+#ifndef NO_LATEX
        case LFUN_TEX:
                Tex(owner->view());
                owner->view()->setState();
                owner->showState();
                break;
-
+#endif
+               
        case LFUN_RECONFIGURE:
                Reconfigure(owner->view());
                break;
@@ -1130,9 +1163,9 @@ string const LyXFunc::Dispatch(int ac,
                
        case LFUN_LAYOUTNO:
        {
-               lyxerr.debug() << "LFUN_LAYOUTNO: (arg) " << argument << endl;
+               lyxerr[Debug::INFO] << "LFUN_LAYOUTNO: (arg) " << argument << endl;
                int sel = strToInt(argument);
-               lyxerr.debug() << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
+               lyxerr[Debug::INFO] << "LFUN_LAYOUTNO: (sel) "<< sel << endl;
                
                // Should this give a setMessage instead?
                if (sel == 0) 
@@ -1201,7 +1234,7 @@ string const LyXFunc::Dispatch(int ac,
 
        case LFUN_GETNAME:
                setMessage(owner->buffer()->fileName());
-               lyxerr.debug() << "FNAME["
+               lyxerr[Debug::INFO] << "FNAME["
                               << owner->buffer()->fileName()
                               << "] " << endl;
                break;
@@ -1476,6 +1509,55 @@ string const LyXFunc::Dispatch(int ac,
 
 exit_with_message:
 
+       commandshortcut.erase();
+       
+       if (lyxrc.display_shortcuts && show_sc) {
+               if (action != LFUN_SELFINSERT) {
+                       // Put name of command and list of shortcuts
+                       // for it in minibuffer
+                       string comname = lyxaction.getActionName(action);
+
+                       int pseudoaction = action;
+                       bool argsadded = false;
+
+                       if (!argument.empty()) {
+                               // If we have the command with argument, 
+                               // this is better
+                               pseudoaction = 
+                                       lyxaction.searchActionArg(action,
+                                                                 argument);
+
+                               if (pseudoaction == -1) {
+                                       pseudoaction = action;
+                               } else {
+                                       comname += " " + argument;
+                                       argsadded = true;
+                               }
+                       }
+
+                       string const shortcuts =
+                               toplevel_keymap->findbinding(pseudoaction);
+
+                       if (!shortcuts.empty()) {
+                               comname += ": " + shortcuts;
+                       } else if (!argsadded) {
+                               comname += " " + argument;
+                       }
+
+                       if (!comname.empty()) {
+                               comname = strip(comname);
+                               commandshortcut = "(" + comname + ')';
+
+                               // Here we could even add a small pause,
+                               // to annoy the user and make him learn
+                               // the shortcuts.
+                               // No! That will just annoy, not teach
+                               // anything. The user will read the messages
+                               // if they are interested. (Asger)
+                       }
+               }
+        }
+
        string const res = getMessage();
 
        if (res.empty()) {
@@ -1527,7 +1609,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
        
                if (result.second.empty()) {
                        owner->message(_("Canceled."));
-                       lyxerr.debug() << "New Document Cancelled." << endl;
+                       lyxerr[Debug::INFO] << "New Document Cancelled." << endl;
                        return;
                }
        
@@ -1558,31 +1640,28 @@ void LyXFunc::MenuNew(bool fromTemplate)
                        }
                }
                // Check whether the file already exists
-               if (IsLyXFilename(s)) {
-                       FileInfo fi(s);
-                       if (fi.readable() &&
-                           AskQuestion(_("File already exists:"), 
-                                       MakeDisplayPath(s, 50),
-                                       _("Do you want to open the document?"))) {
+               FileInfo fi(s);
+               if (fi.readable() &&
+                   AskQuestion(_("File already exists:"), 
+                               MakeDisplayPath(s, 50),
+                               _("Do you want to open the document?"))) {
                                // loads document
-                               string const disp_fn(MakeDisplayPath(s));
-                               
-                               ostringstream str;
-                               str << _("Opening  document") << ' '
-                                   << disp_fn << "...";
-                               
-                               owner->message(str.str().c_str());
-                               //XFlush(fl_get_display());
-                               owner->view()->buffer(
-                                       bufferlist.loadLyXFile(s));
-                               ostringstream str2;
-                               str2 << _("Document") << ' '
-                                    << disp_fn << ' ' << _("opened.");
-                               
-                               owner->message(str2.str().c_str());
-
-                               return;
-                       }
+                       string const disp_fn(MakeDisplayPath(s));
+                       
+                       ostringstream str;
+                       str << _("Opening  document") << ' '
+                           << disp_fn << "...";
+                       
+                       owner->message(str.str().c_str());
+                       //XFlush(fl_get_display());
+                       owner->view()->buffer(bufferlist.loadLyXFile(s));
+                       ostringstream str2;
+                       str2 << _("Document") << ' '
+                            << disp_fn << ' ' << _("opened.");
+                       
+                       owner->message(str2.str().c_str());
+                       
+                       return;
                }
        } else {
                s = AddName(lyxrc.document_path,
@@ -1622,7 +1701,7 @@ void LyXFunc::MenuNew(bool fromTemplate)
        }
   
        // find a free buffer
-       lyxerr.debug() << "Find a free buffer." << endl;
+       lyxerr[Debug::INFO] << "Find a free buffer." << endl;
        owner->view()->buffer(bufferlist.newFile(s, templname));
 }
 
@@ -1665,11 +1744,9 @@ void LyXFunc::Open(string const & fname)
        } else
                filename = fname;
 
-       // get absolute path of file and make sure the filename ends
-       // with .lyx
-       filename = MakeAbsPath(filename);
-       if (!IsLyXFilename(filename))
-               filename += ".lyx";
+       // get absolute path of file and add ".lyx" to the filename if
+       // necessary
+       filename = FileSearch(string(), filename, "lyx");
 
        // loads document
        string const disp_fn(MakeDisplayPath(filename));
@@ -1698,8 +1775,8 @@ void LyXFunc::doImport(string const & argument)
 {
        string format;
        string filename = split(argument, format, ' ');
-       lyxerr.debug() << "LyXFunc::doImport: " << format 
-                      << " file: " << filename << endl;
+       lyxerr[Debug::INFO] << "LyXFunc::doImport: " << format 
+                           << " file: " << filename << endl;
 
        if (filename.empty()) { // need user interaction
                string initpath = lyxrc.document_path;
index 68ee86ff53232594a3fb91dcdae58a4bcb82dbda..f1312dadd6c28ced347421141e5c8798e8fa660d 100644 (file)
@@ -10,6 +10,7 @@
 
 #include FORMS_H_LOCATION
 #include "commandtags.h"
+#include "func_status.h"
 #include "kbsequence.h"
 #include "insets/inset.h"
 #include "LString.h"
@@ -25,19 +26,6 @@ class LyXView;
 */
 class LyXFunc : public SigC::Object {
 public:
-       /// The status of a function.
-       enum func_status {
-               /// No problem
-               OK = 0,
-               ///
-               Unknown = 1,
-               /// Command cannot be executed
-               Disabled = 2,
-               ///
-               ToggleOn = 4,
-               ///
-               ToggleOff = 8
-       };
        ///
        explicit
        LyXFunc(LyXView *);
@@ -59,9 +47,10 @@ public:
 
        /// we need one internall which is called from inside LyXAction and
        /// can contain the string argument.
-       func_status getStatus(int ac) const;
+       func_status::value_type getStatus(int ac) const;
        ///
-       func_status getStatus(int ac, string const & not_to_use_arg) const;
+       func_status::value_type getStatus(int ac, 
+                                         string const & not_to_use_arg) const;
        
        /// The last key was meta
        bool wasMetaKey() const;
@@ -185,11 +174,4 @@ void LyXFunc::setHintMessage(bool hm)
        show_sc = hm;
 }
 
-///
-inline
-void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
-{
-       fs = static_cast<LyXFunc::func_status>(fs | f);
-}
-
 #endif
index a7d11dbefa54df97101b13ce7d0a63925900d0ba..5d55c9ddff2513d63566f69e0a94bf517cc9691e 100644 (file)
@@ -46,6 +46,15 @@ public:
                ///
                CHANGED_IN_DRAW
        };
+       ///
+       enum word_location {
+               /// the word around the cursor
+               WHOLE_WORD,
+               /// the word begining from the cursor position
+               PARTIAL_WORD,
+               /// the next word (not yet used)
+               NEXT_WORD
+       };
 
        /// Constructor
        LyXText(BufferView *);
@@ -212,20 +221,6 @@ public:
          */
        mutable LyXCursor cursor;
 
-#if 0
-       /* the selection cursor */
-       /// 
-       mutable bool selection;
-       ///
-       mutable bool mark_set;
-
-       ///
-       mutable LyXCursor sel_cursor;
-       ///
-       mutable LyXCursor sel_start_cursor;
-       ///
-       mutable LyXCursor sel_end_cursor;
-#else
        /** The structrue that keeps track of the selections set. */
        struct Selection {
                bool set() const {
@@ -249,7 +244,7 @@ public:
                
        };
        mutable Selection selection;
-#endif
+
        /// needed for the toggling
        LyXCursor last_sel_cursor;
        ///
@@ -264,6 +259,8 @@ public:
        ///
        string const selectionAsString(Buffer const *) const;
        
+       /// select the word we need depending on word_location
+       void getWord(LyXCursor & from, LyXCursor & to, word_location) const;
        /// just selects the word the cursor is in
        void selectWord(BufferView *);
 
@@ -316,6 +313,8 @@ public:
        ///
        void cursorLeftOneWord(BufferView *) const;
        ///
+       void cursorLeftOneWord(LyXCursor &) const;
+       ///
        void cursorRightOneWord(BufferView *) const;
        ///
        void cursorUpParagraph(BufferView *) const;
@@ -353,7 +352,7 @@ public:
                text_uppercase = 2
        };
        /// Change the case of the word at cursor position.
-       void changeWordCase(BufferView *, TextCase action);
+       void changeCase(BufferView *, TextCase action);
        ///
        void transposeChars(BufferView const &);
        
index a4e88d22d82b37d52c259110462e7335404747e8..5e5591bd9107bd51176f480aabf4bf60532e63eb 100644 (file)
@@ -1,3 +1,18 @@
+2001-06-25  The LyX Project  <Asger>
+
+       * math_scriptinset.C: Fix for entering with cursor up/down.
+
+       * math_fracinset.C: We can enter fractions with cursor up and
+       down.
+
+       * math_cursor.C (Right): Fixes for cursor movement.
+
+       * formula.C (draw): New background color for math.
+       
+       * math_cursor.C: Fixes for toggling labels on/off in math.
+       Fixes for infinity and other symbols that didn't appear in
+       LaTeX.
+
 2001-06-24  The LyX Project  <Asger>
 
        * math_inset.C: Cursor movement is better in square roots, among
index acbecb1230a32d76e02017ea4e62c868df3a90bc..4ceaa578b0dfb75d8e499e625d5261259ac2660d 100644 (file)
@@ -100,7 +100,7 @@ MathInset * MathArray::GetInset(int pos) const
        return p;
 }
 
-char MathArray::GetChar(int pos) const
+byte MathArray::GetChar(int pos) const
 {
        return pos < size() ? bf_[pos + 1] : '\0';
 }
@@ -122,7 +122,7 @@ void MathArray::replace(int pos, MathInset * p)
        memcpy(&bf_[pos + 1], &p, sizeof(p));
 }
 
-void MathArray::insert(int pos, char b, MathTextCodes t)
+void MathArray::insert(int pos, byte b, MathTextCodes t)
 {
        bf_.insert(bf_.begin() + pos, 3, t);
        bf_[pos + 1] = b;
@@ -144,7 +144,7 @@ void MathArray::push_back(MathInset * p)
        insert(size(), p);
 }
 
-void MathArray::push_back(char b, MathTextCodes c)
+void MathArray::push_back(byte b, MathTextCodes c)
 {
        insert(size(), b, c);
 }
@@ -183,7 +183,7 @@ int MathArray::size() const
 
 void MathArray::erase(int pos)
 {
-       if (pos < bf_.size())
+       if (pos < static_cast<int>(bf_.size()))
                erase(pos, pos + item_size(pos));
 }
 
@@ -221,7 +221,16 @@ MathScriptInset * MathArray::prevScriptInset(int pos) const
        prev(pos);
 
        MathInset * inset = GetInset(pos);
-       if (inset && inset->GetType() == LM_OT_SCRIPT) 
+       if (inset && inset->isScriptInset()) 
+               return static_cast<MathScriptInset *>(inset);
+
+       return 0;
+}
+
+MathScriptInset * MathArray::nextScriptInset(int pos) const
+{
+       MathInset * inset = GetInset(pos);
+       if (inset && inset->isScriptInset()) 
                return static_cast<MathScriptInset *>(inset);
 
        return 0;
@@ -261,7 +270,6 @@ void MathArray::Write(ostream & os, bool fragile) const
                return;
 
        int brace = 0;
-       latexkeys const * l;
        
        for (int pos = 0; pos < size(); next(pos)) {
                if (isInset(pos)) {
@@ -270,15 +278,22 @@ void MathArray::Write(ostream & os, bool fragile) const
 
                } else {
 
-                       char fcode = GetCode(pos);
-                       char c     = GetChar(pos);
+                       MathTextCodes fcode = GetCode(pos);
+                       byte c = GetChar(pos);
 
                        if (MathIsSymbol(fcode)) {
-                               l = lm_get_key_by_id(c, fcode == LM_TC_BSYM ? LM_TK_BIGSYM : LM_TK_SYM);
-                               if (l)
-                                               os << '\\' << l->name << ' ';
+                               latexkeys const * l = lm_get_key_by_id(c, LM_TK_SYM);
+
+                               if (l == 0) {
+                                       l = lm_get_key_by_id(c, LM_TK_BIGSYM);
+                               }
+
+                               if (l) {
+                                       os << '\\' << l->name << ' ';
+                               } else {
+                                       lyxerr << "Could not find the LaTeX name for  " << c << " and fcode " << fcode << "!" << std::endl;
+                               }
                        } else {
-                       
                                if (fcode >= LM_TC_RM && fcode <= LM_TC_TEXTRM) 
                                        os << '\\' << math_font_name[fcode - LM_TC_RM] << '{';
 
@@ -295,7 +310,7 @@ void MathArray::Write(ostream & os, bool fragile) const
                                if (c == '}' && fcode == LM_TC_TEX && brace < 0) 
                                        lyxerr <<"Math warning: Unexpected closing brace.\n";
                                else           
-                                       os << char(c);
+                                       os << c;
                        }
 
                        if (fcode >= LM_TC_RM && fcode <= LM_TC_TEXTRM)
index 135bf136e39821aded9a79e85cf210039886aa49..cd0c071efd54962e477c67465d230bea0fb3fca9 100644 (file)
@@ -64,7 +64,7 @@ public:
        ///
        void insert(int pos, MathInset * inset);
        ///
-       void insert(int pos, char, MathTextCodes);
+       void insert(int pos, byte, MathTextCodes);
        ///
        void insert(int pos, MathArray const &);
 
@@ -85,7 +85,7 @@ public:
        ///
        void push_back(MathInset * inset);
        ///
-       void push_back(char, MathTextCodes);
+       void push_back(byte, MathTextCodes);
        ///
        void push_back(MathArray const &);
        ///
@@ -104,7 +104,9 @@ public:
        ///
        MathScriptInset * prevScriptInset(int pos) const;
        ///
-       char GetChar(int pos) const;
+       MathScriptInset * nextScriptInset(int pos) const;
+       ///
+       byte GetChar(int pos) const;
        ///
        MathTextCodes GetCode(int pos) const;
        ///
index 50a847e25105aedf3b08a5c26149120f321c6736..ea5f5f76d5494cbf4baecca3df9f3321578b0810 100644 (file)
@@ -117,16 +117,20 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
 
 
 void InsetFormula::draw(BufferView * bv, LyXFont const &,
-                       int y, float & x, bool) const
+                       int y, float & xx, bool) const
 {
+       int x = int(xx) - 1;
+       y -= 2;
        MathInset::workwidth = bv->workWidth();
        Painter & pain = bv->painter();
 
+       int w = par()->width();
+       int h = par()->height();
+       int a = par()->ascent();
+       pain.fillRectangle(int(x), y - a, w, h, LColor::mathbg);
+
        if (mathcursor) {
                par()->Metrics(LM_ST_TEXT);
-               int w = par()->width()  + 2;
-               int a = par()->ascent() + 1;
-               int h = par()->height() + 1;
 
                if (mathcursor->formula() == this) {
                        if (mathcursor->Selection()) {
@@ -136,12 +140,12 @@ void InsetFormula::draw(BufferView * bv, LyXFont const &,
                                mathcursor->SelGetArea(xp, yp, n);
                                pain.fillPolygon(xp, yp, n, LColor::selection);
                        }
-                       pain.rectangle(int(x - 1), y - a, w, h, LColor::green);
+                       pain.rectangle(int(x), y - a, w, h, LColor::mathframe);
                }
        }
 
        par()->draw(pain, int(x), y);
-       x += par()->width();
+       xx += par()->width();
 
        setCursorVisible(false);
 }
@@ -193,7 +197,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                        //lyxerr << "toggling line number\n";
                        if (display()) {
                                bv->lockedInsetStoreUndo(Undo::INSERT);
-                               int row = par()->nrows() - 1;
+                               int row = mathcursor->row();
                                bool old = par()->numbered(row);
                                bv->owner()->message(old ? _("No number") : _("Number"));
                                par()->numbered(row, !old);
@@ -206,7 +210,7 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
                {
                        bv->lockedInsetStoreUndo(Undo::INSERT);
 
-                       int row = par()->nrows() - 1;
+                       int row = mathcursor->row();
                        string old_label = par()->label(row);
                        string new_label = arg;
 
@@ -313,7 +317,7 @@ void InsetFormula::Validate(LaTeXFeatures & features) const
 
 int InsetFormula::ascent(BufferView *, LyXFont const &) const
 {
-       return par()->ascent();
+       return par()->ascent() + 4;
 }
 
 
index c66eb525109cf797fa34bbd047108a04411739fa..1941b0a61456c01c6852f64169d0710b3991b126 100644 (file)
@@ -282,8 +282,6 @@ void InsetFormulaBase::InsetUnlock(BufferView * bv)
 }
 
 
-
-
 void InsetFormulaBase::GetCursorPos(BufferView *, int & x, int & y) const
 {
        mathcursor->GetPos(x, y);
@@ -352,7 +350,6 @@ void InsetFormulaBase::ToggleInsetSelection(BufferView * bv)
 }
 
 
-
 vector<string> const InsetFormulaBase::getLabelList() const
 {
   return std::vector<string>();
@@ -532,7 +529,6 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                }
                if (!mathcursor->Left())
                        break;
-
                // fall through...
 
        case LFUN_DELETE:
@@ -622,12 +618,17 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
        case LFUN_CODE:  mathcursor->toggleLastCode(LM_TC_TT); break;
        case LFUN_DEFAULT:  mathcursor->setLastCode(LM_TC_VAR); break;
 
+#ifndef NO_LATEX
+#ifdef WITH_WARNINGS
+#warning This needs a fix.
+               // Can we use the ERT inset here? (Lgb)
+#endif
        case LFUN_TEX:
                // varcode = LM_TC_TEX;
                mathcursor->setLastCode(LM_TC_TEX);
                bv->owner()->message(_("TeX mode"));
                break;
-
+#endif
        case LFUN_MATH_LIMITS:
                bv->lockedInsetStoreUndo(Undo::INSERT);
                if (mathcursor->toggleLimits())
@@ -638,7 +639,7 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                if (!arg.empty()) {
                        bv->lockedInsetStoreUndo(Undo::INSERT);
                        latexkeys const * l = in_word_set(arg);
-                       mathcursor->SetSize(MathStyles(l ? l->id : -1));
+                       mathcursor->SetSize(MathStyles(l ? l->id : static_cast<unsigned int>(-1)));
                        UpdateLocal(bv);
                }
                break;
@@ -651,7 +652,6 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                }
                break;
 
-
        case LFUN_INSERT_MATRIX:
                if (mathcursor) {
                        bv->lockedInsetStoreUndo(Undo::INSERT);
@@ -815,18 +815,8 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                result = UNDISPATCHED;
                break;
 
-
-               //------- dummy actions
-#ifdef WITH_WARNINGS
-#warning Is this needed here? Shouldnt the main dispatch handle this? (Lgb)
-#endif
-               //case LFUN_EXEC_COMMAND:
-               //bv->owner()->getMiniBuffer()->PrepareForCommand();
-               //break;
-
        default:
-               if ((action == -1  || action == LFUN_SELFINSERT)
-                   && !arg.empty())  {
+               if ((action == -1 || action == LFUN_SELFINSERT) && !arg.empty()) {
                        unsigned char c = arg[0];
                        bv->lockedInsetStoreUndo(Undo::INSERT);
 
@@ -896,11 +886,20 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                                mathcursor->clearLastCode();
                                mathcursor->insert(c, LM_TC_MIN);
                        } else if (('0' <= c && c <= '9') || strchr(";:!|[]().,?", c)) {
-                               mathcursor->insert(c, LM_TC_CONST);
+                               MathTextCodes code = mathcursor->getLastCode();
+                               if (code != LM_TC_TEXTRM)
+                                       code = LM_TC_CONST;
+                               mathcursor->insert(c, code);
                        } else if (strchr("+/-*<>=", c)) {
-                               mathcursor->insert(c, LM_TC_BOP);
+                               MathTextCodes code = mathcursor->getLastCode();
+                               if (code != LM_TC_TEXTRM)
+                                       code = LM_TC_BOP;
+                               mathcursor->insert(c, code);
                        } else if (strchr(latex_special_chars, c) && c!= '_') {
-                               mathcursor->insert(c, LM_TC_SPECIAL);
+                               MathTextCodes code = mathcursor->getLastCode();
+                               if (code != LM_TC_TEXTRM)
+                                       code = LM_TC_SPECIAL;
+                               mathcursor->insert(c, code);
                        } else if (c == '_' || c == '^') {
                                char s[2];
                                s[0] = c;
@@ -925,9 +924,9 @@ InsetFormulaBase::LocalDispatch(BufferView * bv, kb_action action,
                                        sp->SetSpace(isp);
                                        space_on = true;
                                } else {
-                                       lyxerr << "look here!\n";
-                                       //if (!mathcursor->cursor.pop() && !mathcursor->cursor.OK())
-                                       result = FINISHED;
+                                       if (!mathcursor->pop())
+                                               result = FINISHED;
+                                       mathcursor->plainRight();
                                }
                        } else if (c == '\'' || c == '@') {
                                mathcursor->insert (c, LM_TC_VAR);
@@ -999,8 +998,7 @@ bool math_insert_greek(BufferView * bv, char c)
                new_inset->LocalDispatch(bv, LFUN_SELFINSERT, tmp);
                if (greek_kb_flag_save < 2) {
                        bv->unlockInset(new_inset); // bv->theLockingInset());
-#warning someone broke this in bolzano
-                       //bv->text->cursorRight(bv, true);
+                       bv->text->cursorRight(bv, true);
                }
        } else
                if (bv->theLockingInset()->LyxCode() == Inset::MATH_CODE ||
@@ -1024,7 +1022,9 @@ LyXFont const InsetFormulaBase::ConvertFont(LyXFont const & f) const
 {
        // We have already discussed what was here
        LyXFont font(f);
+#ifndef NO_LATEX
        font.setLatex(LyXFont::OFF);
+#endif
        return font;
 }
 
index 2dd4a2af68c1f98078353d939c1628124aa52946..1317be9d95f00dddac78005babbdf2b7f4cede69 100644 (file)
@@ -143,7 +143,7 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
 
        pain.fillRectangle(int(x), y , w, h, LColor::mathbg);
        pain.rectangle(int(x), y, w, h, LColor::mathframe);
-       
+
        if (mathcursor && mathcursor->formula() == this && mathcursor->Selection()) {
                int xp[10];
                int yp[10];
index c82123e10f7b227101bb5fe3e052dff78b913160..9758426b9428a97154356868e64dcbcd23df7b9d 100644 (file)
@@ -9,8 +9,10 @@
 using std::ostream;
 
 MathBigopInset::MathBigopInset(string const & name, int id)
-       : MathInset(name, LM_OT_BIGOP), lims_(-1), sym_(id)
-{}
+       : MathScriptInset(true, false), lims_(-1), sym_(id)
+{
+       SetName(name);
+}
 
 
 MathInset * MathBigopInset::Clone() const
@@ -22,40 +24,34 @@ MathInset * MathBigopInset::Clone() const
 
 void MathBigopInset::Write(ostream & os, bool fragile) const
 {
-       bool const limp = GetLimits();
-       
+       //bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
        os << '\\' << name();
-
-       bool f = sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
-       
-       if (limp && !f)
+       if (limits() == 1)
                os << "\\limits ";
+       else if (limits() == -1)
+               os << "\\nolimits ";
        else 
-               if (!limp && f)
-                       os << "\\nolimits ";
-               else 
-                       os << ' ';
+               os << ' ';
+       MathScriptInset::Write(os, fragile);
 }
 
 
 void MathBigopInset::WriteNormal(ostream & os) const
 {
-       bool const limp = GetLimits();
-       bool f = sym_ != LM_int && sym_ != LM_oint;
-       
        os << "[bigop " << name();
-       
-       if (limp && !f)
-               os << " limits";
+       if (limits() == 1)
+               os << "\\limits ";
+       else if (limits() == -1)
+               os << "\\nolimits ";
        else 
-               if (!limp && f)
-                       os << " nolimits";
-       
+               os << ' ';
+       MathScriptInset::WriteNormal(os);
        os << "] ";
 }
 
 void MathBigopInset::Metrics(MathStyles st)
 {
+       MathScriptInset::Metrics(st);
        size(st);
        string s;
        short t;
@@ -68,9 +64,22 @@ void MathBigopInset::Metrics(MathStyles st)
                s = name();
                t = LM_TC_TEXTRM;
        }
-       mathed_string_dim(t, size(), s, ascent_, descent_, width_);
+
+       int asc, des, wid;
+       mathed_string_dim(t, size(), s, asc, des, wid);
        if (sym_ == LM_oint)
-               width_ += 2;
+               wid += 2;
+
+       if (hasLimits()) {
+               ascent_  = asc + xcell(0).height() + 2;
+               descent_ = des + xcell(1).height() + 2;
+               width_   = max(width_, wid);
+       } else {
+               ascent_  = max(ascent_, asc);
+               descent_ = max(descent_, des);
+               width_  += wid;
+       }
+
 }
 
 
@@ -78,6 +87,7 @@ void MathBigopInset::draw(Painter & pain, int x, int y)
 {
        xo(x);
        yo(y);
+
        string s;
        short t;
        
@@ -93,22 +103,44 @@ void MathBigopInset::draw(Painter & pain, int x, int y)
                         LColor::mathline);
                ++x;
        }
-       pain.text(x, y, s, mathed_get_font(t, size()));
+
+       int asc, des, wid;
+       mathed_string_dim(t, size(), s, asc, des, wid);
+
+       if (hasLimits()) {
+               int w = width();
+               pain.text(x + (w - wid)/2, y, s, mathed_get_font(t, size()));
+               xcell(0).draw
+                       (pain, x + (w - xcell(0).width())/2, y - asc - xcell(0).descent() - 1);
+               xcell(1).draw
+                       (pain, x + (w - xcell(1).width())/2, y + des + xcell(1).ascent()  + 1);
+       } else {
+               pain.text(x, y, s, mathed_get_font(t, size()));
+               MathScriptInset::draw(pain, x + wid, y);
+       }
 }
 
 
-bool MathBigopInset::GetLimits() const 
-{  
-       // Default case
-       if (lims_ < 0) 
-               return sym_ != LM_int && sym_ != LM_oint && size() == LM_ST_DISPLAY;
-       
-       // Custom 
-       return lims_ > 0;
+int MathBigopInset::limits() const 
+{
+       return lims_;   
 } 
 
 
-void MathBigopInset::SetLimits(bool ls
+void MathBigopInset::limits(int limit
 {  
-       lims_ = ls ? 1 : 0; 
+       lims_ = limit;
+}
+
+bool MathBigopInset::hasLimits() const
+{
+       return limits() == 1 || (limits() == 0 && size() == LM_ST_DISPLAY);
+}
+
+
+bool MathBigopInset::idxDelete(int idx)
+{
+       // ignore the return value, we do not want the inset to be deleted
+       MathScriptInset::idxDelete(idx);
+       return false;
 }
index 20fc5ec7502b33069bf1fc9a230cd0e4fbde2aa3..a518250f041e2c90a33da42ca9f478f7c8d080a0 100644 (file)
@@ -5,7 +5,7 @@
 #include "math_scriptinset.h"
 
 /// big operators
-class MathBigopInset : public MathInset {
+class MathBigopInset : public MathScriptInset {
 public:
        ///
        MathBigopInset(string const &, int);
@@ -20,11 +20,15 @@ public:
        ///
        void Metrics(MathStyles st);
        ///
-       bool GetLimits() const;
+       int limits() const;
        ///
-       void SetLimits(bool);
-private:
+       bool hasLimits() const;
+       ///
+       void limits(int);
        ///
+       bool idxDelete(int idx);
+private:
+       /// 1: \limits, -1: \nolimits, 0: use default
        int lims_;
        ///
        int sym_;
index c0849df500f18abd2aaa85800fe04918d418344b..9086e861e4e12e61fd66c99b6602553ed215d3b3 100644 (file)
@@ -33,6 +33,7 @@
 #include "LColor.h"
 #include "Painter.h"
 #include "math_matrixinset.h"
+#include "math_grid.h"
 #include "math_spaceinset.h"
 #include "math_funcinset.h"
 #include "math_bigopinset.h"
@@ -94,15 +95,16 @@ void MathCursor::push(MathInset * par, bool first)
 }
 
 
-void MathCursor::pop()
+bool MathCursor::pop()
 {
        if (path_.empty())
-               return;
+               return false;
        par_    = path_.back().par_;
        idx_    = path_.back().idx_;
        cursor_ = path_.back().cursor_;
        dump("Popped:");
        path_.pop_back();
+       return true;
 }
 
 
@@ -167,8 +169,7 @@ bool MathCursor::Left(bool sel)
 
        if (selection) {
                result = array().prev(cursor_);
-               if (!result && !path_.empty()) {
-                       pop();
+               if (!result && pop()) {
                        anchor_ = cursor_;
                        result = array().next(anchor_);
                }
@@ -186,8 +187,7 @@ bool MathCursor::Left(bool sel)
                        if (!result) {
                                if (par_->idxLeft(idx_, cursor_)) {
                                        result = true;
-                               } else if (!path_.empty()) {
-                                       pop();
+                               } else if (pop()) {
                                        result = true;
                                }
                        }
@@ -198,6 +198,12 @@ bool MathCursor::Left(bool sel)
 }
 
 
+bool MathCursor::plainRight()
+{
+       return array().next(cursor_);
+}
+
+
 bool MathCursor::Right(bool sel)
 {
        dump("Right 1");
@@ -213,10 +219,9 @@ bool MathCursor::Right(bool sel)
 
        if (selection) {
                result = array().next(cursor_);
-               if (!result && !path_.empty()) {
-                       pop();
+               if (!result && pop()) {
                        anchor_ = cursor_;
-                       result = array().prev(anchor_);
+                       result = array().next(cursor_);
                }
        } else {
                MathInset * p = nextActiveInset();
@@ -228,8 +233,7 @@ bool MathCursor::Right(bool sel)
                        if (!result) {
                                if (par_->idxRight(idx_, cursor_)) {
                                        result = true;
-                               } else if (!path_.empty()) {
-                                       pop();
+                               } else if (pop()) {
                                        result = true;
                                        array().next(cursor_);
                                }
@@ -405,6 +409,13 @@ void MathCursor::Delete()
        if (cursor_ < array().size())
                array().erase(cursor_);
 
+       // delete empty cells parts if necessary
+       if (cursor_ == 0 && array().size() == 0) {
+               bool removeit = par_->idxDelete(idx_);
+               if (pop() && removeit)
+                               Delete();
+       }
+
 #ifdef WITH_WARNINGS
 #warning pullArg disabled
 #endif
@@ -438,10 +449,38 @@ bool MathCursor::Up(bool sel)
        SelHandle(sel);
        SelClear();
 
+       // check whether we could move into an inset on the right or on the left
+       MathInset * p = nextInset();
+       if (p) {
+               int idx, cursor;
+               if (p->idxFirstUp(idx, cursor)) {
+                       push(p, true);
+                       par_ = p;
+                       idx_    = idx;
+                       cursor_ = cursor;
+                       dump("Up 3");
+                       return true;
+               }
+       }
+
+       p = prevInset();
+       if (p) {
+               int idx, cursor;
+               if (p->idxLastUp(idx, cursor)) {
+                       array().prev(cursor_);
+                       push(p, false);
+                       par_ = p;
+                       idx_    = idx;
+                       cursor_ = cursor;
+                       dump("Up 4");
+                       return true;
+               }
+       }
+
+
        int x = xarray().pos2x(cursor_);
        bool result = par_->idxUp(idx_, cursor_);
-       if (!result && !path_.empty()) {
-               pop();
+       if (!result && pop()) {
                result = par_->idxUp(idx_, cursor_);
        }
        cursor_ = xarray().x2pos(x);
@@ -458,10 +497,35 @@ bool MathCursor::Down(bool sel)
        SelHandle(sel);
        SelClear();
 
+       // check whether we could move into an inset on the right or on the left
+       MathInset * p = nextInset();
+       if (p) {
+               int idx, cursor;
+               if (p->idxFirstDown(idx, cursor)) {
+                       push(p, true);
+                       idx_    = idx;
+                       cursor_ = cursor;
+                       dump("Down 3");
+                       return true;
+               }
+       }
+
+       p = prevInset();
+       if (p) {
+               int idx, cursor;
+               if (p->idxLastDown(idx, cursor)) {
+                       array().prev(cursor_);
+                       push(p, false);
+                       idx_    = idx;
+                       cursor_ = cursor;
+                       dump("Down 4");
+                       return true;
+               }
+       }
+
        int x = xarray().pos2x(cursor_);
        bool result = par_->idxDown(idx_, cursor_);
-       if (!result && !path_.empty()) {
-               pop();
+       if (!result && pop()) {
                result = par_->idxDown(idx_, cursor_);
        }
        cursor_ = xarray().x2pos(x);
@@ -476,9 +540,9 @@ bool MathCursor::toggleLimits()
        if (!prevIsInset())
                return false;
        MathInset * p = prevInset();
-       bool old = p->GetLimits();
-       p->SetLimits(!old);
-       return old != p->GetLimits();
+       int old = p->limits();
+       p->limits(old == -1 ? 1 : -1);
+       return old != p->limits();
 }
 
 
@@ -494,26 +558,30 @@ void MathCursor::Interpret(string const & s)
        lyxerr << "Interpret: '" << s << "'\n";
 
        if (s[0] == '^') {
-               MathScriptInset * p = prevScriptInset();
+               MathScriptInset * p = nearbyScriptInset();
                if (!p) {
                        p = new MathScriptInset;
                        insert(p);
+                       array().prev(cursor_);
                }
+               push(p, true);
                if (!p->up())
                        p->up(true);
-               push(p, true);
+               idx_ = 0;
                return;
        }
 
        if (s[0] == '_') {
-               MathScriptInset * p = prevScriptInset();
+               MathScriptInset * p = nearbyScriptInset();
                if (!p) {
                        p = new MathScriptInset;
                        insert(p);
+                       array().prev(cursor_);
                }
+               push(p, true);
                if (!p->down())
                        p->down(true);
-               push(p, true);
+               idx_ = 1;
                return;
        }
 
@@ -526,7 +594,7 @@ void MathCursor::Interpret(string const & s)
        MathInset * p = 0;
        latexkeys const * l = in_word_set(s);
 
-       if (!l) {
+       if (l == 0) {
                if (s == "root") 
                        p = new MathRootInset;
                else if (MathMacroTable::hasTemplate(s))
@@ -540,13 +608,16 @@ void MathCursor::Interpret(string const & s)
                                        break;
                                
                        case LM_TK_SYM: 
-                                       if (l->id < 255)
-                                               insert(static_cast<byte>(l->id), MathIsBOPS(l->id) ?
-                                                       LM_TC_BOPS : LM_TC_SYMB);       
-                                       else 
-                                               p = new MathFuncInset(l->name);
-                                       break;
-                               
+                               if (l->id < 255) {
+                                       insert(static_cast<byte>(l->id), 
+                                              MathIsBOPS(l->id) ?
+                                               LM_TC_BOPS : LM_TC_SYMB);
+                                       
+                               } else {
+                                       p = new MathFuncInset(l->name);
+                               }
+                               break;
+
                        case LM_TK_STACK:
                                p = new MathFracInset(LM_OT_STACKREL);
                                break;
@@ -1018,7 +1089,7 @@ MathInset * MathCursor::prevActiveInset() const
        if (cursor_ <= 0 || !array().isInset(cursor_ - 1))
                return 0;
        MathInset * inset = prevInset();
-       return inset->nargs() ? inset : 0;
+       return inset->isActive() ? inset : 0;
 }
 
 
@@ -1034,14 +1105,17 @@ MathInset * MathCursor::nextActiveInset() const
        if (!array().isInset(cursor_))
                return 0;
        MathInset * inset = nextInset();
-       return inset->nargs() ? inset : 0;
+       return inset->isActive() ? inset : 0;
 }
 
 
-MathScriptInset * MathCursor::prevScriptInset() const
+MathScriptInset * MathCursor::nearbyScriptInset() const
 {
        normalize();
-       return array().prevScriptInset(cursor_);
+       MathScriptInset * p = array().prevScriptInset(cursor_);
+       if (p)
+               return p;
+       return array().nextScriptInset(cursor_);
 }
 
 
@@ -1078,7 +1152,7 @@ bool MathCursor::nextIsInset() const
 
 bool MathCursor::nextIsActive() const
 {
-       return nextIsInset() && nextInset()->nargs();
+       return nextIsInset() && nextInset()->isActive();
 }
 
 
@@ -1090,7 +1164,7 @@ bool MathCursor::prevIsInset() const
 
 bool MathCursor::prevIsActive() const
 {
-       return prevIsInset() && prevInset()->nargs();
+       return prevIsInset() && prevInset()->isActive();
 }
 
 
@@ -1122,3 +1196,19 @@ void MathCursor::idxRight()
 {
        par_->idxRight(idx_, cursor_);
 }
+
+char MathCursor::valign() const
+{
+       int idx;
+       MathGridInset * p =
+               static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
+       return p ? p->valign() : 0;
+}
+
+char MathCursor::halign() const
+{
+       int idx;
+       MathGridInset * p =
+               static_cast<MathGridInset *>(enclosing(LM_OT_MATRIX, idx));
+       return p ? p->halign(idx % p->ncols()) : 0;
+}
index 928431907053bfd1a036115d9eae50822c1ace51..af340065bb03cc5b97e335b5b7e67425e811bbc6 100644 (file)
@@ -56,6 +56,8 @@ public:
        /// Put the cursor in the last position
        void last();
        ///
+       bool plainRight();
+       ///
        void Delete();
        ///
        void DelLine();
@@ -131,7 +133,15 @@ public:
        MathTextCodes prevCode() const;
        ///
        void selArray(MathArray &) const;
-       
+       ///
+       char valign() const;
+       ///
+       char halign() const;
+       ///
+       int col() const;
+       ///
+       int row() const;
+
 //protected:
        ///
        bool macro_mode;
@@ -167,9 +177,14 @@ public:
 
        ///
        MathStyles style() const;
-       ///
+       /// Make sure cursor position is valid
        void normalize() const;
        
+       /// Enter a new MathInset from the front or the back
+       void push(MathInset * par, bool first);
+       /// Leave current MathInset
+       bool pop();
+
 private:
        /// Description of a position 
        struct MathIter {
@@ -181,10 +196,6 @@ private:
        /// MathPath
        std::vector<MathIter> path_;
 
-       ///  
-       void push(MathInset * par, bool first);
-       ///
-       void pop();
        ///  
        int last() const;
        ///
@@ -222,11 +233,7 @@ private:
        ///
        MathInset * prevActiveInset() const;
        ///
-       MathScriptInset * prevScriptInset() const;
-       ///
-       int col() const;
-       ///
-       int row() const;
+       MathScriptInset * nearbyScriptInset() const;
 
        ///
        MathFuncInset * imacro;
index a3b33c1ad44b30cc3233790c7590225dc9229471..09429072fb4444984d1a7bc19081353ee57b3118 100644 (file)
@@ -11,7 +11,7 @@
 #include "support/LOstream.h"
 
 
-MathFracInset::MathFracInset(short ot)
+MathFracInset::MathFracInset(MathInsetTypes ot)
        : MathInset("frac", ot, 2)
 {
        if (objtype == LM_OT_STACKREL) 
@@ -96,3 +96,31 @@ bool MathFracInset::idxDown(int & idx, int &) const
        return true;
 }
 
+bool MathFracInset::idxFirstUp(int & idx, int & pos) const
+{
+       idx = 0;
+       pos = 0;
+       return true;
+}
+
+bool MathFracInset::idxFirstDown(int & idx, int & pos) const
+{
+       idx = 1;
+       pos = 0;
+       return true;
+}
+
+bool MathFracInset::idxLastUp(int & idx, int & pos) const
+{
+       idx = 0;
+       pos = cell(idx).size();
+       return true;
+}
+
+bool MathFracInset::idxLastDown(int & idx, int & pos) const
+{
+       idx = 1;
+       pos = cell(idx).size();
+       return true;
+}
+
index 27d9ed61a5a3305bf938d19aec48e706e4ffb3b4..072d265bca1dfc221a12341fe5e19d1479e0b7d7 100644 (file)
@@ -14,7 +14,7 @@
 class MathFracInset : public MathInset {
 public:
        ///
-       explicit MathFracInset(short ot = LM_OT_FRAC);
+       explicit MathFracInset(MathInsetTypes ot = LM_OT_FRAC);
        ///
        virtual MathInset * Clone() const;
        ///
@@ -33,6 +33,14 @@ public:
        virtual bool idxLeft(int &, int &) const;
        ///
        virtual bool idxRight(int &, int &) const;
+       ///
+       virtual bool idxFirstUp(int & idx, int & pos) const;
+       ///
+       virtual bool idxFirstDown(int & idx, int & pos) const;
+       ///
+       virtual bool idxLastUp(int & idx, int & pos) const;
+       ///
+       virtual bool idxLastDown(int & idx, int & pos) const;
 };
 
 #endif
index c87bbee157daf4cd00095c31c9b75d06b4bb82ae..2f56e9fefb90021c68899788d6d774aa39210da6 100644 (file)
@@ -17,7 +17,7 @@ using std::ostream;
 extern LyXFont WhichFont(short type, int size);
 
 
-MathFuncInset::MathFuncInset(string const & nm, short ot)
+MathFuncInset::MathFuncInset(string const & nm, MathInsetTypes ot)
        : MathInset(nm, ot)
 {
        lims_ = (GetType() == LM_OT_FUNCLIM);
@@ -34,7 +34,9 @@ void MathFuncInset::draw(Painter & pain, int x, int y)
 { 
        if (!name_.empty() && name_[0] > ' ') {
                LyXFont font = WhichFont(LM_TC_TEXTRM, size());
+#ifndef NO_LATEX
                font.setLatex(LyXFont::ON);
+#endif
                x += (lyxfont::width('I', font) + 3) / 4;
                pain.text(x, y, name_, font);
        }
@@ -56,7 +58,9 @@ void MathFuncInset::WriteNormal(std::ostream & os) const
 void MathFuncInset::Metrics(MathStyles st) 
 {
        LyXFont font = WhichFont(LM_TC_TEXTRM, size());
+#ifndef NO_LATEX
        font.setLatex(LyXFont::ON);
+#endif
        size_ = st;
        if (name_.empty()) {
                width_   = lyxfont::width('M', font);
index afb875f0b95cfd9df0fd5ffccfdd55dec8b147ef..7bfea999a54c1b805ae593ed03d525dbd04a13ae 100644 (file)
@@ -15,9 +15,9 @@
 class MathFuncInset : public MathInset {
 public:
        ///
-       explicit MathFuncInset(string const & nm, short ot = LM_OT_FUNC);
+       explicit MathFuncInset(string const & nm, MathInsetTypes ot = LM_OT_FUNC);
        ///
-       MathInset *  Clone() const;
+       MathInset * Clone() const;
        ///
        void draw(Painter &, int, int);
        ///
index 0ec2c9a4bcd9af817db2485206c538ddb4a000a7..467f77ba14b8c70d7c8b4a4b7792796e782a7ff0 100644 (file)
@@ -36,7 +36,7 @@ MathGridInset::ColInfo::ColInfo()
 {}
 
 
-MathGridInset::MathGridInset(int m, int n, string const & nm, short ot)
+MathGridInset::MathGridInset(int m, int n, string const & nm, MathInsetTypes ot)
        : MathInset(nm, ot, m * n), rowinfo_(n), colinfo_(m), v_align_('c')
 {
        if (m <= 0)
@@ -66,12 +66,21 @@ void MathGridInset::halign(char h, int col)
        colinfo_[col].h_align_ = h;
 }
 
+char MathGridInset::halign(int col) const
+{
+       return colinfo_[col].h_align_;
+}
+
 void MathGridInset::valign(char c)
 {
-       lyxerr << "setting valign to " << c << "\n";
        v_align_ = c;
 }
 
+char MathGridInset::valign() const
+{
+       return v_align_;
+}
+
 void MathGridInset::Metrics(MathStyles st)
 {
        // let the cells adjust themselves
@@ -101,7 +110,6 @@ void MathGridInset::Metrics(MathStyles st)
        }
 
        // adjust vertical offset
-       lyxerr << "v_align: " << v_align_ << "\n";
        int h = 0;
        switch (v_align_) {
        case 't':
@@ -139,11 +147,6 @@ void MathGridInset::Metrics(MathStyles st)
        width_   =   colinfo_.back().offset_  + colinfo_.back().width_;
        ascent_  = - rowinfo_.front().offset_ + rowinfo_.front().ascent_;
        descent_ =   rowinfo_.back().offset_  + rowinfo_.back().descent_;
-
-       // some extra space around
-       width_   += 2 * MATH_BORDER;
-       ascent_  += MATH_BORDER;
-       descent_ += MATH_BORDER;
        
 /*     
        // Increase ws_[i] for 'R' columns (except the first one)
@@ -232,7 +235,6 @@ void MathGridInset::Write(std::ostream & os, bool fragile) const
 
 void MathGridInset::addRow(int row)
 {
-       lyxerr << "adding row " << row << endl;
        rowinfo_.insert(rowinfo_.begin() + row + 1, RowInfo());
        cells_.insert(cells_.begin() + (row + 1) * ncols(), ncols(), MathXArray());
 }
index 67f835225ef0a0a101d796899c0a077d56105a47..f6ed4dee11879ae8ccafa0ea753fabc792b451f1 100644 (file)
@@ -52,7 +52,7 @@ class MathGridInset : public MathInset {
 
 public: 
        ///
-       MathGridInset(int m, int n, string const & nm, short ot);
+       MathGridInset(int m, int n, string const & nm, MathInsetTypes ot);
        ///
        MathInset *  Clone() const = 0;
        ///
@@ -66,8 +66,12 @@ public:
        ///
        void halign(char c, int col);
        ///
+       char halign(int col) const;
+       ///
        void valign(char c);
        ///
+       char valign() const;
+       ///
        void resize(short int type, int cols);
        ///
        const RowInfo & rowinfo(int row) const;
index fef84e41f7b32f25eb8f68cc73fae22d58c6b173..4386e96f0f5ee642efacfd8e2eb89b0e8c72bb6d 100644 (file)
@@ -5,6 +5,7 @@
 #include "math_defs.h"
 #include "math_parser.h"
 #include "support/lstrings.h"
+#include <iostream>
 
 namespace {
 
@@ -12,7 +13,7 @@ latexkeys const wordlist[] =
 {
        {"setminus",  LM_TK_SYM, LM_setminus},
        {"ldots",  LM_TK_DOTS, LM_ldots},
-       //{"limits",  LM_TK_LIMIT, 1 },
+       {"limits",  LM_TK_LIMIT, 1 },
        {"stackrel",  LM_TK_STACK, 0},
        {"ll",  LM_TK_SYM, LM_ll},
        {"label",  LM_TK_LABEL, 0},
@@ -82,7 +83,7 @@ latexkeys const wordlist[] =
        {"widehat",  LM_TK_WIDE, LM_widehat},
        {"sin",  LM_TK_FUNC, 0},
        {"asymp",  LM_TK_SYM, LM_asymp},
-       //{"nolimits",  LM_TK_LIMIT, 0 },
+       {"nolimits",  LM_TK_LIMIT, 0 },
        {"perp",  LM_TK_MACRO, LM_perp},
        {"wedge",  LM_TK_SYM, LM_wedge},
        {"ln",  LM_TK_FUNC, 0},
@@ -282,14 +283,13 @@ latexkeys const wordlist[] =
 };
 
 
-
 struct symbolindex {
-       int   id;
+       unsigned int id;
        short token;
 
-       symbolindex(int i, short t) : id(i), token(t)
+       symbolindex(unsigned int i, short t) : id(i), token(t)
        {}
-       
+
        bool operator<(symbolindex const & s) const
        {
                return (id < s.id) || (id == s.id && token < s.token);
@@ -307,7 +307,19 @@ struct init {
        init() {
                int const n = sizeof(wordlist)/sizeof(wordlist[0]);
                for (latexkeys const * it = wordlist; it != wordlist + n; ++it) {
+                       if (LatexkeyByName.find(it->name) != LatexkeyByName.end()) {
+                               std::cerr << "math_hash.C: Bug: Duplicate entry: " 
+                                         << it->name << std::endl;
+                       }
                        LatexkeyByName[it->name] = it - wordlist;
+                       if (it->id != 0 && 
+                           LatexkeyById.find(symbolindex(it->id, it->token)) !=
+                           LatexkeyById.end()) {
+                               std::cerr << "math_hash.C: Bug: Duplicate entry: "
+                                         << it->name << " Id: "
+                                         << it->id << " token: " << it->token
+                                         << std::endl;
+                       }
                        LatexkeyById[symbolindex(it->id, it->token)] = it - wordlist;
                }
        }
@@ -327,7 +339,7 @@ latexkeys const * in_word_set(string const & str)
 }
 
 
-latexkeys const * lm_get_key_by_id(int id, short tc)
+latexkeys const * lm_get_key_by_id(unsigned int id, short tc)
 {
        std::map<symbolindex, int>::const_iterator pos
                = LatexkeyById.find(symbolindex(id, tc));
index b9903f2f4d2a8a51f9f883f262b3c6c54cba27e0..b44d53ad1ab2e45ccba85f467e253720a12a1c69 100644 (file)
@@ -30,7 +30,7 @@
 int MathInset::workwidth;
 
 
-MathInset::MathInset(string const & name, short ot, int nargs)
+MathInset::MathInset(string const & name, MathInsetTypes ot, int nargs)
        : name_(name), objtype(ot), width_(0), ascent_(0), descent_(0),
                size_(LM_ST_TEXT), cells_(nargs), xo_(0), yo_(0)
 {}
@@ -60,13 +60,20 @@ int MathInset::height() const
 }
 
 
-bool MathInset::GetLimits() const
+int MathInset::limits() const
 {
        return false;
 }
 
 
-void MathInset::SetLimits(bool) {}   
+void MathInset::limits(int)
+{
+}
+
+bool MathInset::hasLimits() const
+{
+       return false;
+}
 
 
 string const & MathInset::name() const
@@ -75,13 +82,13 @@ string const & MathInset::name() const
 }
 
 
-short MathInset::GetType() const
+MathInsetTypes MathInset::GetType() const
 {
        return objtype;
 }
 
 
-void  MathInset::SetType(short t)
+void MathInset::SetType(MathInsetTypes t)
 {
        objtype = t;
 }
@@ -246,7 +253,7 @@ bool MathInset::idxLast(int & i, int & pos) const
 }
 
 
-bool MathInset::idxHome(int & i, int & pos) const
+bool MathInset::idxHome(int & /* idx */, int & pos) const
 {
        if (pos == 0)
                return false;
@@ -265,6 +272,35 @@ bool MathInset::idxEnd(int & idx, int & pos) const
 }
 
 
+bool MathInset::idxFirstUp(int &, int &) const
+{
+       return false;
+}
+
+
+bool MathInset::idxFirstDown(int &, int &) const
+{
+       return false;
+}
+
+bool MathInset::idxDelete(int)
+{
+       return false;
+}
+
+
+bool MathInset::idxLastUp(int &, int &) const
+{
+       return false;
+}
+
+
+bool MathInset::idxLastDown(int &, int &) const
+{
+       return false;
+}
+
+
 void MathInset::GetXY(int & x, int & y) const
 {
    x = xo();
index 03f770a1c8e1aad724343184afffbd7772c1832f..2baa756e8e2dee8a4c333e52de09bded5ce9b3f8 100644 (file)
@@ -44,7 +44,7 @@ public:
        */
        ///
        explicit
-       MathInset (string const & nm = string(), short ot = LM_OT_SIMPLE, int na = 0);
+       MathInset (string const & nm = string(), MathInsetTypes ot = LM_OT_SIMPLE, int na = 0);
        /// The virtual base destructor
        virtual ~MathInset() {}
 
@@ -59,7 +59,7 @@ public:
        /// Appends itself with macro arguments substituted
        virtual void substitute(MathArray & array, MathMacro const & macro) const;
        /// Compute the size of the object
-       virtual void Metrics(MathStyles st) = 0; 
+       virtual void Metrics(MathStyles st) = 0;
        /// 
        virtual int ascent() const;
        ///
@@ -69,16 +69,18 @@ public:
        ///
        virtual int height() const;
        ///
-       virtual bool GetLimits() const;
+       virtual bool hasLimits() const;
        ///
-       virtual void SetLimits(bool);
+       virtual int limits() const;
+       ///
+       virtual void limits(int);
        ///
        string const & name() const;
        ///
-       short GetType() const;
+       MathInsetTypes GetType() const;
        //Man:  Avoid to use these functions if it's not strictly necessary 
        ///
-       virtual void SetType(short t);
+       virtual void SetType(MathInsetTypes t);
        ///
        virtual void SetName(string const & n);
        ///
@@ -92,16 +94,30 @@ public:
        virtual bool idxLeft(int & idx, int & pos) const;
        /// The right key
        virtual bool idxRight(int & idx, int & pos) const;
-       /// Where should we go when we enter the inset from the left?
+
+       /// Target pos when we enter the inset from the left by pressing "Right"
        virtual bool idxFirst(int & idx, int & pos) const;
-       /// Where should we go when we enter the inset from the right?
+       /// Target pos when we enter the inset from the left by pressing "Up"
+       virtual bool idxFirstUp(int & idx, int & pos) const;
+       /// Target pos when we enter the inset from the left by pressing "Down"
+       virtual bool idxFirstDown(int & idx, int & pos) const;
+
+       /// Target pos when we enter the inset from the right by pressing "Left"
        virtual bool idxLast(int & idx, int & pos) const;
+       /// Target pos when we enter the inset from the right by pressing "Up"
+       virtual bool idxLastUp(int & idx, int & pos) const;
+       /// Target pos when we enter the inset from the right by pressing "Down"
+       virtual bool idxLastDown(int & idx, int & pos) const;
 
        /// Where should we go if we press home?
        virtual bool idxHome(int & idx, int & pos) const;
        /// Where should we go if we press end?
        virtual bool idxEnd(int & idx, int & pos) const;
 
+       /// Delete a cell and move cursor
+       // a return value true indicates that the whole inset should be deleted
+       virtual bool idxDelete(int idx);
+
        ///
        int nargs() const;
 
@@ -150,6 +166,10 @@ public:
        void GetXY(int & x, int & y) const;
        ///
        bool covers(int x, int y) const;
+       /// Identifies ScriptInsets
+       virtual bool isScriptInset() const { return false; }
+       ///
+       virtual bool isActive() const { return nargs() > 0; }
 
 
        ///
@@ -166,7 +186,7 @@ protected:
        ///
        string name_;
        ///
-       short objtype;
+       MathInsetTypes objtype;
        ///
        int width_;
        ///
index 00c853a4a0a240b700fba967d2f91d7b5c33042a..95d8572404dc2d843fdb4d6a29918341817151c9 100644 (file)
@@ -117,6 +117,12 @@ void MathMacroTable::builtinMacros()
                insertTemplate(t);
        }
 
+       {
+               MathMacroTemplate * t = new MathMacroTemplate("to", 0);
+               t->push_back(LM_rightarrow, LM_TC_SYMB);
+               insertTemplate(t);
+       }
+
        {
                MathMacroTemplate * t = new MathMacroTemplate("perp", 0);
                t->push_back(LM_bot, LM_TC_BOP);
index 0ec2f7faa31eff1e400d78d2b3f67b5b7c7273bd..96a4c0db74aa544adfedd9bac80419ca9ad47325 100644 (file)
@@ -104,47 +104,9 @@ void MathMatrixInset::Metrics(MathStyles st)
                if (l)
                        width_ += 30 + l;
        }
-       
-/*     
-       {
-               cxrow->setBaseline((cxrow == row_.begin()) ?
-                                  cxrow->ascent() :
-                                  cxrow->ascent() + cprow->descent()
-                                  + MATH_ROWSEP + cprow->getBaseline());
-               h += cxrow->ascent() + cxrow->descent() + MATH_ROWSEP;  
-               cprow = cxrow;
-       }
-       
-       int const hl = descent();
-       h -= MATH_ROWSEP;
-       
-       //  Compute vertical align
-       switch (v_align_) {
-       case 't':
-               ascent = row_.begin()->getBaseline();
-               break;
-       case 'b':
-               ascent = h - hl;
-               break;
-       default:
-               ascent = row_.begin().is_last() ? h / 2 : h - hl;
-               break;
-       }
-       descent = h - ascent + 2;
-       
-       // Increase ws_[i] for 'R' columns (except the first one)
-       for (int i = 1; i < nc_; ++i)
-               if (h_align_[i] == 'R')
-                       ws_[i] += 10 * df_width;
-       // Increase ws_[i] for 'C' column
-       if (h_align_[0] == 'C')
-               if (ws_[0] < 7 * workwidth / 8)
-                       ws_[0] = 7 * workwidth / 8;
-       
-*/
-
 }
 
+
 void MathMatrixInset::draw(Painter & pain, int x, int y)
 {
        xo(x);
@@ -154,7 +116,9 @@ void MathMatrixInset::draw(Painter & pain, int x, int y)
 
        if (numberedType()) {
                LyXFont wfont = WhichFont(LM_TC_BF, size());
+#ifndef NO_LATEX
                wfont.setLatex(LyXFont::OFF);
+#endif
                int xx = x + colinfo_.back().offset_ + colinfo_.back().width_ + 20;
                for (int row = 0; row < nrows(); ++row) 
                        pain.text(xx, y + rowinfo_[row].offset_, nicelabel(row), wfont);
index 1ae93cb3694bc77f6a72de40137eb3e547e65bff..e5640e6036dcf53e0856fb0a71cbc728baaa4406 100644 (file)
@@ -403,7 +403,7 @@ void handle_frac(MathArray & dat, MathInsetTypes t)
 MathScriptInset * lastScriptInset(MathArray & array)
 {
        MathInset * p = array.back_inset();
-       if (!p || p->GetType() != LM_OT_SCRIPT) {
+       if (!p || !p->isScriptInset()) {
                p = new MathScriptInset;
                array.push_back(p);
        }
@@ -417,12 +417,12 @@ MathScriptInset * lastScriptInset(MathArray & array)
 static bool   curr_num;
 static string curr_label;
 
-void mathed_parse_lines(MathInset * inset, int col)
+void mathed_parse_lines(MathInset * inset, int col, bool numbered, bool outmost)
 {
        MathGridInset * p = static_cast<MathGridInset *>(inset);
-       while (1) {
+       for (int row = 0; true; ++row) {
                // reset global variables
-               curr_num   = true;
+               curr_num   = numbered;
                curr_label = string();
 
                // reading a row
@@ -431,6 +431,12 @@ void mathed_parse_lines(MathInset * inset, int col)
                        mathed_parse(p->cell(idx), FLAG_AMPERSAND);
                mathed_parse(p->cell(idx), FLAG_NEWLINE | FLAG_END);
 
+               if (outmost) {
+                       MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+                       m->numbered(row, curr_num);
+                       m->label(row, curr_label);
+               }
+
                // Hack!
                // no newline
                if (yylval.i != -1)
@@ -474,17 +480,27 @@ MathInset * mathed_parse()
                        switch (typ) {
 
                                case LM_OT_SIMPLE: {
+                                       curr_num   = latex_mathenv[i].numbered;
+                                       curr_label = string();
                                        mathed_parse(p->cell(0), 0);
+                                       MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+                                       m->numbered(0, curr_num);
+                                       m->label(0, curr_label);
                                        break;
                                }
 
                                case LM_OT_EQUATION: {
+                                       curr_num   = latex_mathenv[i].numbered;
+                                       curr_label = string();
                                        mathed_parse(p->cell(0), FLAG_END);
+                                       MathMatrixInset * m = static_cast<MathMatrixInset *>(p);
+                                       m->numbered(0, curr_num);
+                                       m->label(0, curr_label);
                                        break;
                                }
 
                                case LM_OT_EQNARRAY: {
-                                       mathed_parse_lines(p, 3);
+                                       mathed_parse_lines(p, 3, latex_mathenv[i].numbered, true);
                                        break;
                                }
 
@@ -492,7 +508,7 @@ MathInset * mathed_parse()
                                        LexGetArg('{');
                                        //int c = atoi(yytext.c_str());
                                        lyxerr << "LM_OT_ALIGNAT: not implemented\n";
-                                       mathed_parse_lines(p, 2);
+                                       mathed_parse_lines(p, 2, latex_mathenv[i].numbered, true);
                                        lyxerr << "LM_OT_ALIGNAT: par: " << *p << "\n";
                                        break;
                                }
@@ -503,10 +519,6 @@ MathInset * mathed_parse()
 
                        p->SetName(latex_mathenv[i].basename);
 
-/*
-                       curr_num = latex_mathenv[i].numbered;
-                       p->numbered(p->nrows()-1, curr_num);
-*/
                        break;
                }
                
@@ -649,7 +661,7 @@ void mathed_parse(MathArray & array, unsigned flags)
                {
                        MathScriptInset * p = lastScriptInset(array);
                        if (p) 
-                               p->SetLimits(bool(yylval.l->id));
+                               p->limits(yylval.l->id ? 1 : -1);
                        break;
                }
                
@@ -843,7 +855,7 @@ void mathed_parse(MathArray & array, unsigned flags)
                                mm->valign(valign[0]);
                                mm->halign(halign);
 
-                               mathed_parse_lines(mm, halign.size());
+                               mathed_parse_lines(mm, halign.size(), latex_mathenv[i].numbered, false);
                                do_insert(array, mm);
                                //lyxerr << "read matrix " << *mm << "\n";      
                                break;
index edca7279ab9072724dc889639e9fe24bb29fd55a..3320fa7cfb3afb3167473d72c4a7f4c5aa079c2b 100644 (file)
@@ -108,7 +108,7 @@ struct latexkeys {
        ///
        short token;
        ///
-       int id;
+       unsigned int id;
 };
 
 
@@ -116,7 +116,7 @@ struct latexkeys {
 latexkeys const * in_word_set(string const & str);
 
 ///
-latexkeys const * lm_get_key_by_id(int id, short tc);
+latexkeys const * lm_get_key_by_id(unsigned int id, short tc);
 
 
 MathInset * mathed_parse(std::istream &);
index 046b8ab55fe00a9cdebb223e9c137edb6dade2a0..7be748d1e277cc6027291a4004348cb5587fe376 100644 (file)
@@ -32,8 +32,10 @@ void MathScriptInset::Metrics(MathStyles st)
        MathInset::Metrics(st);
        size_    = st;
        width_   = max(xcell(0).width(), xcell(1).width()) + 2; 
-       ascent_  = xcell(0).height() + 9;
-       descent_ = xcell(1).height();
+       if (up())
+               ascent_  = max(ascent_, xcell(0).height() + 9);
+       if (down())
+               descent_ = max(descent_, xcell(1).height());
 }
 
 
@@ -140,3 +142,52 @@ bool MathScriptInset::idxLast(int & idx, int & pos) const
        pos = cell(idx).size();
        return true;
 }
+
+
+bool MathScriptInset::idxFirstUp(int & idx, int & pos) const
+{
+       if (!up()) 
+               return false;
+       idx = 0;
+       pos = 0;
+       return true;
+}
+
+bool MathScriptInset::idxFirstDown(int & idx, int & pos) const
+{
+       if (!down()) 
+               return false;
+       idx = 1;
+       pos = 0;
+       return true;
+}
+
+bool MathScriptInset::idxLastUp(int & idx, int & pos) const
+{
+       if (!up()) 
+               return false;
+       idx = 0;
+       pos = cell(idx).size();
+       return true;
+}
+
+bool MathScriptInset::idxLastDown(int & idx, int & pos) const
+{
+       if (!down()) 
+               return false;
+       idx = 1;
+       pos = cell(idx).size();
+       return true;
+}
+
+
+bool MathScriptInset::idxDelete(int idx)
+{
+       if (idx == 0) {
+               up(false);
+               return !down();
+       } else {
+               down(false);
+               return !up();
+       }
+}
index 7f155a9fc7f2b69dc01a7991208cb64348722d09..d9713b5cfa9ca1daa13ca3ee70aaec4bb0b77bd8 100644 (file)
@@ -39,8 +39,16 @@ public:
        ///
        bool idxFirst(int & idx, int & pos) const;
        ///
+       bool idxFirstUp(int & idx, int & pos) const;
+       ///
+       bool idxFirstDown(int & idx, int & pos) const;
+       ///
        bool idxLast(int & idx, int & pos) const;
        ///
+       bool idxLastUp(int & idx, int & pos) const;
+       ///
+       bool idxLastDown(int & idx, int & pos) const;
+       ///
        bool up() const;
        ///
        bool down() const;
@@ -48,6 +56,12 @@ public:
        void up(bool);
        ///
        void down(bool);
+       ///
+       bool isActive() const { return false; }
+       /// Identifies ScriptInsets
+       bool isScriptInset() const { return true; }
+       ///
+       bool idxDelete(int idx);
 private:
        ///
        bool up_;
index 6ddc32d9d4f0020d57652c9e3f6defcbfe03e12b..375b4b1ed26b971b7a404589892585fd99c054ef 100644 (file)
@@ -11,7 +11,7 @@
 #include "support/LOstream.h"
 
 
-MathSpaceInset::MathSpaceInset(int sp, short ot)
+MathSpaceInset::MathSpaceInset(int sp, MathInsetTypes ot)
        : MathInset("", ot), space_(sp)
 {}
 
index 4d20d2707d53bb20cb0d759ad9e4b8eeab32ebc1..fdb10df4d381ca35760857c2f6b0c89204af5786 100644 (file)
@@ -13,7 +13,7 @@
 class MathSpaceInset : public MathInset {
 public:
        ///
-       MathSpaceInset(int sp, short ot = LM_OT_SPACE);
+       MathSpaceInset(int sp, MathInsetTypes ot = LM_OT_SPACE);
        ///
        MathInset *  Clone() const;
        ///
index e7a60dbe9476101c6421723d7d9bf92986ed52ae..dfef26cfbaeb011013fef97fe103b55fdcd59291 100644 (file)
@@ -364,9 +364,11 @@ int mathed_string_width(short type, int size, string const & s)
 LyXFont mathed_get_font(short type, int size)
 {
        LyXFont f = WhichFont(type, size);
+#ifndef NO_LATEX
        if (type == LM_TC_TEX) {
                f.setLatex(LyXFont::ON);
        }
+#endif
        return f;
 }
 
index e1572fc8d2031819283ac37eba7af122ebb20245..c1ca96b893e9efe524cf4b67b240d6b719068d1f 100644 (file)
@@ -1436,24 +1436,21 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
        else
                main_body = beginningOfMainBody();
 
+       int column = 0;
+
        if (main_body > 0) {
                os << '[';
+               ++column;
                basefont = getFont(bparams, -2); // Get label font
        } else {
                basefont = getFont(bparams, -1); // Get layout font
        }
 
-       int column = 0;
-
        if (main_body >= 0
            && !pimpl_->size()) {
                if (style.isCommand()) {
                        os << '{';
                        ++column;
-               } else if (params().align() != LYX_ALIGN_LAYOUT) {
-                       os << '{';
-                       ++column;
-                       return_value = true;
                }
        }
 
@@ -1483,12 +1480,6 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                        if (style.isCommand()) {
                                os << '{';
                                ++column;
-                       } else if (params().align() != LYX_ALIGN_LAYOUT && next_) {
-                               // We do not need \par here (Dekel)
-                               // os << "{\\par";
-                               os << "{";
-                               ++column;
-                               return_value = true;
                        }
 
                        if (params().noindent()) {
@@ -1502,32 +1493,26 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                        case LYX_ALIGN_SPECIAL:
                                break;
                        case LYX_ALIGN_LEFT:
-                               if (moving_arg)
-                                       os << "\\protect";
                                if (getParLanguage(bparams)->babel() != "hebrew") {
-                                       os << "\\raggedright ";
-                                       column+= 13;
+                                       os << "\\begin{flushleft}";
+                                       column+= 17;
                                } else {
-                                       os << "\\raggedleft ";
-                                       column+= 12;
+                                       os << "\\begin{flushright}";
+                                       column+= 18;
                                }
                                break;
                        case LYX_ALIGN_RIGHT:
-                               if (moving_arg)
-                                       os << "\\protect";
                                if (getParLanguage(bparams)->babel() != "hebrew") {
-                                       os << "\\raggedleft ";
-                                       column+= 12;
+                                       os << "\\begin{flushright}";
+                                       column+= 18;
                                } else {
-                                       os << "\\raggedright ";
-                                       column+= 13;
+                                       os << "\\begin{flushleft}";
+                                       column+= 17;
                                }
                                break;
                        case LYX_ALIGN_CENTER:
-                               if (moving_arg)
-                                       os << "\\protect";
-                               os << "\\centering ";
-                               column+= 11;
+                               os << "\\begin{center}";
+                               column+= 14;
                                break;
                        }        
                }
@@ -1578,7 +1563,10 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                        // newlines are handled differently here than
                        // the default in SimpleTeXSpecialChars().
                        if (!style.newline_allowed
-                           || font.latex() == LyXFont::ON) {
+#ifndef NO_LATEX
+                           || font.latex() == LyXFont::ON
+#endif
+                               ) {
                                os << '\n';
                        } else {
                                if (open_font) {
@@ -1626,6 +1614,36 @@ bool Paragraph::simpleTeXOnePar(Buffer const * buf,
                return_value = false;
        }
 
+       switch (params().align()) {
+       case LYX_ALIGN_NONE:
+       case LYX_ALIGN_BLOCK:
+       case LYX_ALIGN_LAYOUT:
+       case LYX_ALIGN_SPECIAL:
+               break;
+       case LYX_ALIGN_LEFT:
+               if (getParLanguage(bparams)->babel() != "hebrew") {
+                       os << "\\end{flushleft}";
+                       column+= 15;
+               } else {
+                       os << "\\end{flushright}";
+                       column+= 16;
+               }
+               break;
+       case LYX_ALIGN_RIGHT:
+               if (getParLanguage(bparams)->babel() != "hebrew") {
+                       os << "\\end{flushright}";
+                       column+= 16;
+               } else {
+                       os << "\\end{flushleft}";
+                       column+= 15;
+               }
+               break;
+       case LYX_ALIGN_CENTER:
+               os << "\\end{center}";
+               column+= 12;
+               break;
+       }        
+
        lyxerr[Debug::LATEX] << "SimpleTeXOnePar...done " << this << endl;
        return return_value;
 }
@@ -2065,3 +2083,4 @@ ParagraphParameters const & Paragraph::params() const
 {
        return pimpl_->params;
 }
+
index 8e3a9eee818f6226ce2cb80f30ec153abee27c42..2d9891074c1b89ee35da93dad55227aca6eb515a 100644 (file)
@@ -207,10 +207,12 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
            && i 
            && owner_->getChar(i - 1) != ' '
            && (i < owner_->size() - 1)
+#ifndef NO_LATEX
            // In LaTeX mode, we don't want to
            // break lines since some commands
            // do not like this
            && ! (font.latex() == LyXFont::ON)
+#endif
            // same in FreeSpacing mode
            && !style.free_spacing
            // In typewriter mode, we want to avoid 
@@ -230,13 +232,18 @@ void Paragraph::Pimpl::simpleTeXBlanks(ostream & os, TexRow & texrow,
                texrow.newline();
                texrow.start(owner_, i + 1);
                column = 0;
-       } else if (font.latex() == LyXFont::OFF) {
+       } else
+#ifndef NO_LATEX
+               if (font.latex() == LyXFont::OFF) {
+#endif
                if (style.free_spacing) {
                        os << '~';
                } else {
                        os << ' ';
                }
+#ifndef NO_LATEX
        }
+#endif
 }
 
 
@@ -307,6 +314,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
 
        default:
                // And now for the special cases within each mode
+#ifndef NO_LATEX
                // Are we in LaTeX mode?
                if (font.latex() == LyXFont::ON) {
                        // at present we only have one option
@@ -325,6 +333,7 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                                break;
                        }
                } else {
+#endif
                        // Plain mode (i.e. not LaTeX)
                        switch (c) {
                        case '\\': 
@@ -498,7 +507,9 @@ void Paragraph::Pimpl::simpleTeXSpecialChars(Buffer const * buf,
                                }
                                break;
                        }
+#ifndef NO_LATEX
                }
+#endif
        }
 }
 
index f4763781858459df0dbeac12661268e4d7e6f283..a4701a298a87d55b15f0438c4ece51cee2ca46ad 100644 (file)
@@ -1,3 +1,21 @@
+2001-06-26  The LyX Project  <lyx@violet.home.sad.it>
+
+       * filetools.C (DeleteAllFilesInDir): send debug output to
+       Debug::FILES instewad of Debug::ANY.
+
+       * DebugStream.h: remove gcc 2.8.x hack.
+
+2001-06-26  The LyX Project  <jug@sad.it>
+
+       * lstrings.h:
+       * lstrings.C (escape): move method to escape non ascii characters
+       from insets label and ref to here.
+
+2001-06-25  The LyX Project  <jug@sad.it>
+
+       * filetools.C (IsLyXFilename): 
+       (IsSGMLFilename): do case insensitive name matching
+
 2001-06-24  The LyX Project  <jug@sad.it>
 
        * lstrings.C (compare_ascii_no_case): version of compare_no_case
index fd361cd514918a9f9c05b989515f3dc3dc7953ce..d27eda5e1b8223dbba5190dba886503668556696 100644 (file)
@@ -18,9 +18,6 @@
 
 #include "LOstream.h"
 
-// I don't really like this, but too please doc++...(Lgb)
-using std::ostream;
-
 #ifdef TEST_DEBUGSTREAM
 #include <string>
 struct Debug {
@@ -78,11 +75,8 @@ struct Debug {
     debug[Debug::type(Debug::INFO | Debug::CRIT)] << "...info/crit...\n";
 
 */
-class DebugStream : public ostream
+class DebugStream : public std::ostream
 {
-// This workaround is needed only for gcc 2.8.1 (and possibly egcs
-// 1.0.x), which generates a compiler error when subclassing from
-// std::. (JMarc)
 public:
        /// Constructor, sets the debug level to t.
        explicit DebugStream(Debug::type t = Debug::NONE);
index 9ced099097b83d47669d1f33a8e0ff976637fe54..f082e2ad9cbb594ff226153b4c7c6fadce82280b 100644 (file)
@@ -68,13 +68,13 @@ extern string system_tempdir;
 
 bool IsLyXFilename(string const & filename)
 {
-       return suffixIs(filename, ".lyx");
+       return suffixIs(lowercase(filename), ".lyx");
 }
 
 
 bool IsSGMLFilename(string const & filename)
 {
-       return suffixIs(filename, ".sgml");
+       return suffixIs(lowercase(filename), ".sgml");
 }
 
 
@@ -408,7 +408,8 @@ int DeleteAllFilesInDir (string const & path)
                        continue;
                string const unlinkpath = AddName (path, temp);
 
-               lyxerr.debug() << "Deleting file: " << unlinkpath << endl;
+               lyxerr[Debug::FILES] << "Deleting file: " << unlinkpath 
+                                    << endl;
 
                bool deleted = true;
                if (FileInfo(unlinkpath).isDir())
index 6a6ad420049ea0c185a19b9744c57249fc24d555..f0e6fe2b952cec85e39e06e1a00524394831223c 100644 (file)
@@ -55,13 +55,16 @@ int compare_no_case(string const & s, string const & s2)
        return 1;
 }
 
-static
-int ascii_tolower(int c) {
-       if (c >= 'A' && c <= 'Z')
-               return c - 'A' + 'a';
-       return c;
+
+namespace {
+       int ascii_tolower(int c) {
+               if (c >= 'A' && c <= 'Z')
+                       return c - 'A' + 'a';
+               return c;
+       }
 }
 
+
 int compare_ascii_no_case(string const & s, string const & s2)
 {
        string::const_iterator p = s.begin();
@@ -619,3 +622,24 @@ string const rsplit(string const & a, string & piece, char delim)
        }
        return tmp;
 }
+
+
+// This function escapes 8-bit characters and other problematic
+// characters that cause problems in latex labels.
+string const escape(string const & lab)
+{
+       char hexdigit[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+                             '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
+       string enc;
+       for (string::size_type i = 0; i < lab.length(); ++i) {
+               unsigned char c= lab[i];
+               if (c >= 128 || c == '=' || c == '%') {
+                       enc += '=';
+                       enc += hexdigit[c>>4];
+                       enc += hexdigit[c & 15];
+               } else {
+                       enc += c;
+               }
+       }
+       return enc;
+}
index a3a20b1db886dd8b2f4fd0851474202269fb4104..e79d1f158c57c397cd875121c9e4e5751b003bdd 100644 (file)
@@ -237,4 +237,7 @@ string const split(string const & a, char delim);
 /// Same as split but uses the last delim.
 string const rsplit(string const & a, string & piece, char delim);
 
+/// Escapes non ASCII chars
+string const escape(string const & lab);
+
 #endif
index b43fcc699560e3047a009d159ed45680c612b813..60afc4293545cf498a58119a2240b5497e49452d 100644 (file)
@@ -209,8 +209,11 @@ int Systemcalls::startscript(Starttype how, string const & what,
        retval  = 0;
 
        if (how == SystemDontWait) {
-               (os::shell() == os::UNIX) ? command += " &"
-                                         : command = "start /min/n " + command;
+               if (os::shell() == os::UNIX) {
+                       command += " &";
+               } else {
+                       command = "start /min/n " + command;
+               }
        }
 
         return startscript();
index 6c7ef5c22f886083a9b2e46c65b5d838d6e3fa18..e7e5b034618ca6402cfc79f83ffb7cbf54b713fd 100644 (file)
@@ -93,6 +93,7 @@ LyXTabular::columnstruct::columnstruct()
 LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
 {
        owner_ = inset;
+       cur_cell = -1;
        Init(rows_arg, columns_arg);
 }
 
@@ -100,6 +101,7 @@ LyXTabular::LyXTabular(InsetTabular * inset, int rows_arg, int columns_arg)
 LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
 {
        owner_ = inset;
+       cur_cell = -1;
        Init(lt.rows_, lt.columns_, &lt);
 #if 0
 #ifdef WITH_WARNINGS
@@ -113,6 +115,7 @@ LyXTabular::LyXTabular(InsetTabular * inset, LyXTabular const & lt)
 LyXTabular::LyXTabular(Buffer const * buf, InsetTabular * inset, LyXLex & lex)
 {
        owner_ = inset;
+       cur_cell = -1;
        Read(buf, lex);
 }
 
@@ -129,7 +132,7 @@ LyXTabular & LyXTabular::operator=(LyXTabular const & lt)
        // So then it is ok to throw an exception, or for now
        // call abort()
        lyx::Assert(rows_ == lt.rows_ && columns_ == lt.columns_);
-
+       cur_cell = -1;
        cell_info = lt.cell_info;
        row_info = lt.row_info;
        column_info = lt.column_info;
@@ -2520,6 +2523,7 @@ int LyXTabular::Ascii(Buffer const * buf, ostream & os) const
 
 InsetText * LyXTabular::GetCellInset(int cell) const
 {
+       cur_cell = cell;
        return & cell_info[row_of_cell(cell)][column_of_cell(cell)].inset;
 }
 
index c53fbbf999fd80d3c992f1d64ca53580bd7d6f71..558f3e777cb905553222a48ec2ce5fad0a9766a9 100644 (file)
@@ -371,6 +371,8 @@ public:
        void Validate(LaTeXFeatures &) const;
        ///
        std::vector<string> const getLabelList() const;
+       ///
+       mutable int cur_cell;
 private:
        ///
        struct cellstruct {
index eaca7cdf3a75a6a210d9f87243ed649b936c48c3..61f0a7b0ac520cb5f03bbbd111b3c470db29abd0 100644 (file)
@@ -112,14 +112,14 @@ void TexRow::increasePos(int id, int pos) const
                if (id == (*kit).id()
                    && pos < (*kit).pos()) {
                        (*kit).pos((*kit).pos() + 1);
-                       lyxerr.debug()
+                       lyxerr[Debug::INFO]
                                << "TeXRow::increasePos: ideally this "
                                "should never happen..." << endl;
                }
                // When verified to work this clause should be deleted.
                if (id == (*kit).id()
                    && pos == (*kit).pos()) {
-                       lyxerr.debug()
+                       lyxerr[Debug::INFO]
                                << "TexRow::increasePos: this should happen "
                                "maximum one time for each run of "
                                "increasePos!" << endl;
index 3b9a19e085f17d7a6c251818b8944c97c48e7165..55c8669e27ade97a48b48a3068cdcaff7623ff6b 100644 (file)
@@ -922,12 +922,7 @@ LyXText::nextBreakPoint(BufferView * bview, Row const * row, int width) const
                                                last_separator = i - 1;
                                        x = width;  // this means break
                                } else {
-#if 0
-                                       last_separator = i;
-                                       x += width;
-#else
                                        x += singleWidth(bview, par, i, c);
-#endif
                                }
                        } else  {
                                if (IsLineSeparatorChar(c))
@@ -1494,6 +1489,9 @@ void LyXText::appendParagraph(BufferView * bview, Row * row) const
         not_ready = false;
       
       // Set the dimensions of the row
+#ifdef WITH_WARNINGS
+#warning Something is rotten here! (Jug)
+#endif
       tmprow->fill(fill(bview, tmprow, workWidth(bview)));
       setHeightOfRow(bview, tmprow);
 
@@ -2129,72 +2127,88 @@ void LyXText::cursorTab(BufferView * bview) const
 
 void LyXText::cursorLeftOneWord(BufferView * bview)  const
 {
-       // treat HFills, floats and Insets as words
        LyXCursor tmpcursor = cursor;
-       while (tmpcursor.pos() 
-              && (tmpcursor.par()->isSeparator(tmpcursor.pos() - 1) 
-                  || tmpcursor.par()->isKomma(tmpcursor.pos() - 1))
-              && !(tmpcursor.par()->isHfill(tmpcursor.pos() - 1)
-                   || tmpcursor.par()->isInset(tmpcursor.pos() - 1)))
-               tmpcursor.pos(tmpcursor.pos() - 1);
-
-       if (tmpcursor.pos()
-           && (tmpcursor.par()->isInset(tmpcursor.pos() - 1)
-               || tmpcursor.par()->isHfill(tmpcursor.pos() - 1))) {
-               tmpcursor.pos(tmpcursor.pos() - 1);
-       } else if (!tmpcursor.pos()) {
-               if (tmpcursor.par()->previous()){
-                       tmpcursor.par(tmpcursor.par()->previous());
-                       tmpcursor.pos(tmpcursor.par()->size());
-               }
-       } else {                // Here, tmpcursor != 0 
-               while (tmpcursor.pos() > 0 &&
-                      tmpcursor.par()->isWord(tmpcursor.pos()-1) )
-                       tmpcursor.pos(tmpcursor.pos() - 1);
-       }
+       cursorLeftOneWord(tmpcursor);
        setCursor(bview, tmpcursor.par(), tmpcursor.pos());
 }
 
+void LyXText::cursorLeftOneWord(LyXCursor  & cur)  const
+{
+       // treat HFills, floats and Insets as words
+       cur = cursor;
+       while (cur.pos() 
+              && (cur.par()->isSeparator(cur.pos() - 1) 
+                  || cur.par()->isKomma(cur.pos() - 1))
+              && !(cur.par()->isHfill(cur.pos() - 1)
+                   || cur.par()->isInset(cur.pos() - 1)))
+               cur.pos(cur.pos() - 1);
+
+       if (cur.pos()
+           && (cur.par()->isInset(cur.pos() - 1)
+               || cur.par()->isHfill(cur.pos() - 1))) {
+               cur.pos(cur.pos() - 1);
+       } else if (!cur.pos()) {
+               if (cur.par()->previous()){
+                       cur.par(cur.par()->previous());
+                       cur.pos(cur.par()->size());
+               }
+       } else {                // Here, cur != 0 
+               while (cur.pos() > 0 &&
+                      cur.par()->isWord(cur.pos()-1) )
+                       cur.pos(cur.pos() - 1);
+       }
+}
+
 /* -------> Select current word. This depends on behaviour of CursorLeftOneWord(), so it is
                        patched as well. */
 
-void LyXText::selectWord(BufferView * bview) 
+void LyXText::getWord(LyXCursor & from, LyXCursor & to, word_location loc) const
 {
-       // Move cursor to the beginning, when not already there.
-       if (cursor.pos()
-           && !cursor.par()->isSeparator(cursor.pos() - 1)
-           && !cursor.par()->isKomma(cursor.pos() - 1))
-               cursorLeftOneWord(bview);
+       // first put the cursor where we wana start to select the word
+       from = cursor;
+       switch(loc) {
+       case WHOLE_WORD:
+               // Move cursor to the beginning, when not already there.
+               if (from.pos() && !from.par()->isSeparator(from.pos() - 1)
+                   && !from.par()->isKomma(from.pos() - 1))
+                       cursorLeftOneWord(from);
+               break;
+       case NEXT_WORD:
+               lyxerr << "LyXText::getWord: NEXT_WORD not implemented yet\n";
+               break;
+       case PARTIAL_WORD:
+               break;
+       }
+       to = from;
+       while (to.pos() < to.par()->size()
+              && !to.par()->isSeparator(to.pos())
+              && !to.par()->isKomma(to.pos())
+              && !to.par()->isHfill(to.pos()) )
+       {
+               to.pos(to.pos() + 1);
+       }
+}
 
-       // set the sel cursor
-#if 0
-       sel_cursor = cursor;
-#else
+
+void LyXText::selectWord(BufferView * bview) 
+{
+       LyXCursor from;
+       LyXCursor to;
+       getWord(from, to, WHOLE_WORD);
+       if (cursor != from)
+               setCursor(bview, from.par(), from.pos());
        selection.cursor = cursor;
-#endif
-       
-       while (cursor.pos() < cursor.par()->size()
-              && !cursor.par()->isSeparator(cursor.pos())
-              && !cursor.par()->isKomma(cursor.pos()) )
-               cursor.pos(cursor.pos() + 1);
-       setCursor(bview, cursor.par(), cursor.pos() );
-       
-       // finally set the selection
+       setCursor(bview, to.par(), to.pos() );
        setSelection(bview);
 }
 
-
 /* -------> Select the word currently under the cursor when:
                        1: no selection is currently set,
                        2: the cursor is not at the borders of the word. */
 
 bool LyXText::selectWordWhenUnderCursor(BufferView * bview) 
 {
-#if 0
-       if (!selection &&
-#else
-           if (!selection.set() &&
-#endif
+       if (!selection.set() &&
            cursor.pos() > 0 && cursor.pos() < cursor.par()->size()
            && !cursor.par()->isSeparator(cursor.pos())
            && !cursor.par()->isKomma(cursor.pos())
@@ -2226,8 +2240,11 @@ string const LyXText::selectNextWord(BufferView * bview,
        // Now, skip until we have real text (will jump paragraphs)
        while ((cursor.par()->size() > cursor.pos()
                && (!cursor.par()->isLetter(cursor.pos())
+#ifndef NO_LATEX
                    || cursor.par()->getFont(bview->buffer()->params, cursor.pos())
-                   .latex() == LyXFont::ON))
+                   .latex() == LyXFont::ON
+#endif
+                       ))
               || (cursor.par()->size() == cursor.pos()
                   && cursor.par()->next())){
                if (cursor.pos() == cursor.par()->size()) {
@@ -2244,11 +2261,7 @@ string const LyXText::selectNextWord(BufferView * bview,
        }
 
        // Start the selection from here
-#if 0
-       sel_cursor = cursor;
-#else
        selection.cursor = cursor;
-#endif
        
        std::ostringstream latex;
 
@@ -2265,15 +2278,6 @@ string const LyXText::selectNextWord(BufferView * bview,
 
        // Finally, we copy the word to a string and return it
        string str;
-#if 0
-       if (sel_cursor.pos() < cursor.pos()) {
-               Paragraph::size_type i;
-               for (i = sel_cursor.pos(); i < cursor.pos(); ++i) {
-                       if (cursor.par()->getChar(i) != Paragraph::META_INSET)
-                               str += cursor.par()->getChar(i);
-               }
-       }
-#else
        if (selection.cursor.pos() < cursor.pos()) {
                Paragraph::size_type i;
                for (i = selection.cursor.pos(); i < cursor.pos(); ++i) {
@@ -2281,7 +2285,6 @@ string const LyXText::selectNextWord(BufferView * bview,
                                str += cursor.par()->getChar(i);
                }
        }
-#endif
        return str;
 }
 
@@ -2289,19 +2292,11 @@ string const LyXText::selectNextWord(BufferView * bview,
 // This one is also only for the spellchecker
 void LyXText::selectSelectedWord(BufferView * bview)
 {
-#if 0
-       // move cursor to the beginning
-       setCursor(bview, sel_cursor.par(), sel_cursor.pos());
-       
-       // set the sel cursor
-       sel_cursor = cursor;
-#else
        // move cursor to the beginning
        setCursor(bview, selection.cursor.par(), selection.cursor.pos());
        
        // set the sel cursor
        selection.cursor = cursor;
-#endif
        std::ostringstream latex;
        
        // now find the end of the word
@@ -2329,18 +2324,10 @@ void LyXText::deleteWordForward(BufferView * bview)
        else {
                LyXCursor tmpcursor = cursor;
                tmpcursor.row(0); // ??
-#if 0
-               selection = true; // to avoid deletion
-#else
                selection.set(true); // to avoid deletion
-#endif
                cursorRightOneWord(bview);
                setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
-               sel_cursor = cursor;
-#else
                selection.cursor = cursor;
-#endif
                cursor = tmpcursor;
                setSelection(bview); 
                
@@ -2358,18 +2345,10 @@ void LyXText::deleteWordBackward(BufferView * bview)
        else {
               LyXCursor tmpcursor = cursor;
               tmpcursor.row(0); // ??
-#if 0
-              selection = true; // to avoid deletion
-#else
               selection.set(true); // to avoid deletion
-#endif
               cursorLeftOneWord(bview);
               setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
-              sel_cursor = cursor;
-#else
               selection.cursor = cursor;
-#endif
               cursor = tmpcursor;
               setSelection(bview);
               cutSelection(bview);
@@ -2388,26 +2367,14 @@ void LyXText::deleteLineForward(BufferView * bview)
                // We can't store the row over a regular setCursor
                // so we set it to 0 and reset it afterwards.
                tmpcursor.row(0); // ??
-#if 0
-               selection = true; // to avoid deletion
-#else
                selection.set(true); // to avoid deletion
-#endif
                cursorEnd(bview);
                setCursor(bview, tmpcursor, tmpcursor.par(), tmpcursor.pos());
-#if 0
-               sel_cursor = cursor;
-#else
                selection.cursor = cursor;
-#endif
                cursor = tmpcursor;
                setSelection(bview);
                // What is this test for ??? (JMarc)
-#if 0
-               if (!selection) {
-#else
-                       if (!selection.set()) {
-#endif
+               if (!selection.set()) {
                        deleteWordForward(bview);
                } else {
                        cutSelection(bview);
@@ -2423,20 +2390,25 @@ void LyXText::deleteLineForward(BufferView * bview)
 // Paragraph, but it will have to change for 1.1 anyway. At least
 // it does not access outside of the allocated array as the older
 // version did. (JMarc) 
-void LyXText::changeWordCase(BufferView * bview, LyXText::TextCase action) 
+void LyXText::changeCase(BufferView * bview, LyXText::TextCase action)
 {
-       Paragraph * tmppar = cursor.par();
+       LyXCursor from;
+       LyXCursor to;
 
-       setUndo(bview->buffer(),Undo::FINISH,
-               tmppar->previous(), tmppar->next()); 
+       if (selection.set()) {
+               from = selection.cursor;
+               to = cursor;
+       } else {
+               getWord(from, to, PARTIAL_WORD);
+               setCursor(bview, to.par(), to.pos()+1);
+       }
 
-       Paragraph::size_type tmppos = cursor.pos();
+       setUndo(bview->buffer(), Undo::FINISH,
+               from.par()->previous(), to.par()->next()); 
 
-       while (tmppos < tmppar->size()) {
-               unsigned char c = tmppar->getChar(tmppos);
-               if (IsKommaChar(c) || IsLineSeparatorChar(c))
-                       break;
-               if (c != Paragraph::META_INSET) {
+       while(from != to) {
+               unsigned char c = from.par()->getChar(from.pos());
+               if (!IsInsetChar(c) && !IsHfillChar(c)) {
                        switch (action) {
                        case text_lowercase:
                                c = tolower(c);
@@ -2450,13 +2422,19 @@ void LyXText::changeWordCase(BufferView * bview, LyXText::TextCase action)
                                break;
                        }
                }
-               
-               //tmppar->text[tmppos] = c;
-               tmppar->setChar(tmppos, c);
-               ++tmppos;
+               from.par()->setChar(from.pos(), c);
+               checkParagraph(bview, from.par(), from.pos());
+               from.pos(from.pos() + 1);
+               if (from.pos() >= from.par()->size()) {
+                       from.par(from.par()->next());
+                       from.pos(0);
+               }
+       }
+       if (to.row() != from.row()) {
+               refresh_y = from.y() - from.row()->baseline();
+               refresh_row = from.row();
+               status = LyXText::NEED_MORE_REFRESH;
        }
-       checkParagraph(bview, tmppar, tmppos);
-       cursorRightOneWord(bview);
 }
 
 
@@ -3520,7 +3498,7 @@ int LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
        float last_tmpx = tmpx;
        
        if (main_body > 0 &&
-           (main_body-1 > last || 
+           (main_body - 1 > last || 
             !row->par()->isLineSeparator(main_body - 1)))
                main_body = 0;
        
@@ -3551,7 +3529,7 @@ int LyXText::getColumnNearX(BufferView * bview, Row * row, int & x,
                ++vc;
        }
        
-       if (1 || (tmpx + last_tmpx) / 2 > x) {
+       if ((tmpx + last_tmpx) / 2 > x) {
                tmpx = last_tmpx;
                left_side = true;
        }
index c0ae0663ed2ce7586c7229ee377f05e3c4de653c..4a451e408931f714205905fc2a2d6c0c4f22bd64 100644 (file)
@@ -80,17 +80,10 @@ void LyXText::init()
        status = LyXText::UNCHANGED;
 
        // set cursor at the very top position
-#if 0
-       selection = true;           /* these setting is necessary 
-                                      because of the delete-empty-
-                                      paragraph mechanism in
-                                      SetCursor */
-#else
        selection.set(true);        /* these setting is necessary 
                                       because of the delete-empty-
                                       paragraph mechanism in
                                       SetCursor */
-#endif
        if (bv_owner) {
                Paragraph * par = ownerParagraph();
                current_font = getFont(bv_owner->buffer(), par, 0);
@@ -102,15 +95,9 @@ void LyXText::init()
        } else
                current_font = LyXFont(LyXFont::ALL_SANE);
 
-#if 0
-       sel_cursor = cursor;
-       selection = false;
-       mark_set = false;
-#else
        selection.cursor = cursor;
        selection.set(false);
        selection.mark(false);
-#endif
        
        // no rebreak necessary
        need_break_row = 0;
@@ -151,11 +138,7 @@ void LyXText::init(BufferView * bview)
                par = par->next();
        }
        setCursorIntern(bview, firstrow->par(), 0);
-#if 0
-       sel_cursor = cursor;
-#else
        selection.cursor = cursor;
-#endif
 #if 0
        printf("TP = %x\n",inset_owner->owner());
        // Dump all rowinformation:
@@ -545,32 +528,6 @@ Paragraph * LyXText::setLayout(BufferView * bview,
 // set layout over selection and make a total rebreak of those paragraphs
 void LyXText::setLayout(BufferView * bview, LyXTextClass::size_type layout)
 {
-#if 0
-       LyXCursor tmpcursor = cursor;  /* store the current cursor  */
-
-       // if there is no selection just set the layout
-       // of the current paragraph  */
-       if (!selection) {
-               sel_start_cursor = cursor;  // dummy selection
-               sel_end_cursor = cursor;
-       }
-       Paragraph *
-               endpar = SetLayout(bview, cursor, sel_start_cursor,
-                                  sel_end_cursor, layout);
-       RedoParagraphs(bview, sel_start_cursor, endpar);
-   
-       // we have to reset the selection, because the
-       // geometry could have changed
-       SetCursor(bview, sel_start_cursor.par(),
-                 sel_start_cursor.pos(), false);
-       sel_cursor = cursor;
-       SetCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos(),
-                 false);
-       UpdateCounters(bview, cursor.row());
-       ClearSelection(bview);
-       SetSelection(bview);
-       SetCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
-#else
        LyXCursor tmpcursor = cursor;  /* store the current cursor  */
 
        // if there is no selection just set the layout
@@ -594,94 +551,9 @@ void LyXText::setLayout(BufferView * bview, LyXTextClass::size_type layout)
        clearSelection(bview);
        setSelection(bview);
        setCursor(bview, tmpcursor.par(), tmpcursor.pos(), true);
-#endif
 }
 
 
-#if 0
-// increment depth over selection and
-// make a total rebreak of those paragraphs
-void  LyXText::IncDepth(BufferView * bview)
-{
-       // If there is no selection, just use the current paragraph
-       if (!selection) {
-               sel_start_cursor = cursor; // dummy selection
-               sel_end_cursor = cursor;
-       }
-
-       // We end at the next paragraph with depth 0
-       Paragraph * endpar = sel_end_cursor.par()->next();
-
-       Paragraph * undoendpar = endpar;
-
-       if (endpar && endpar->getDepth()) {
-               while (endpar && endpar->getDepth()) {
-                       endpar = endpar->next();
-                       undoendpar = endpar;
-               }
-       }
-       else if (endpar) {
-               endpar = endpar->next(); // because of parindents etc.
-       }
-       
-       SetUndo(bview->buffer(), Undo::EDIT,
-               sel_start_cursor.par()->previous(),
-               undoendpar);
-
-       LyXCursor tmpcursor = cursor; // store the current cursor
-
-       // ok we have a selection. This is always between sel_start_cursor
-       // and sel_end cursor
-       cursor = sel_start_cursor;
-   
-       bool anything_changed = false;
-   
-       while (true) {
-               // NOTE: you can't change the depth of a bibliography entry
-               if (
-                   textclasslist.Style(bview->buffer()->params.textclass,
-                                     cursor.par()->GetLayout()
-                                    ).labeltype != LABEL_BIBLIO) {
-                       Paragraph * prev = cursor.par()->previous();
-
-                       if (prev 
-                           && (prev->GetDepth() - cursor.par()->GetDepth() > 0
-                               || (prev->GetDepth() == cursor.par()->GetDepth()
-                                   && textclasslist.Style(bview->buffer()->params.textclass,
-                                                     prev->GetLayout()).isEnvironment()))) {
-                               cursor.par()->params.depth(cursor.par()->params.depth() + 1);
-                               anything_changed = true;
-                               }
-               }
-               if (cursor.par() == sel_end_cursor.par())
-                       break;
-               cursor.par(cursor.par()->next());
-       }
-   
-       // if nothing changed set all depth to 0
-       if (!anything_changed) {
-               cursor = sel_start_cursor;
-               while (cursor.par() != sel_end_cursor.par()) {
-                       cursor.par()->params.depth(0);
-                       cursor.par(cursor.par()->next());
-               }
-               cursor.par()->params.depth(0);
-       }
-   
-       redoParagraphs(bview, sel_start_cursor, endpar);
-   
-       // we have to reset the selection, because the
-       // geometry could have changed
-       setCursor(bview, sel_start_cursor.par(),
-                 sel_start_cursor.pos());
-       sel_cursor = cursor;
-       setCursor(bview, sel_end_cursor.par(), sel_end_cursor.pos());
-       updateCounters(bview, cursor.row());
-       clearSelection(bview);
-       setSelection(bview);
-       setCursor(bview, tmpcursor.par(), tmpcursor.pos());
-}
-#else
 // increment depth over selection and
 // make a total rebreak of those paragraphs
 void  LyXText::incDepth(BufferView * bview)
@@ -763,7 +635,6 @@ void  LyXText::incDepth(BufferView * bview)
        setSelection(bview);
        setCursor(bview, tmpcursor.par(), tmpcursor.pos());
 }
-#endif
 
 
 // decrement depth over selection and
index 63715a0146e6770e2a6986b5b80b3442b6e82616..923d84cf956fa3736d56c7cada15c014d95c334f 100644 (file)
@@ -288,9 +288,11 @@ void TransManager::insertVerbatim(string const & str, LyXText * text)
        string::size_type const l = str.length();
        
        for (string::size_type i = 0; i < l; ++i) {
-               if (str[i] == '\"' 
+               if (str[i] == '\"'
+#ifndef NO_LATEX
                    && text->getFont(current_view->buffer(),text->cursor.par(),
                                     text->cursor.pos()).latex() == LyXFont::OFF
+#endif
                    && text->getFont(current_view->buffer(),text->cursor.par(),
                                     text->cursor.pos()).language()->lang() != "hebrew")
                        current_view->insertCorrectQuote();