Changeset 27524

Show
Ignore:
Timestamp:
11/16/08 01:18:52 (2 months ago)
Author:
younes
Message:

part 7

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • lyx-devel/trunk/src/mathed/InsetMath.h

    r27425 r27524  
    3232        hullFlAlign, 
    3333        hullMultline, 
    34         hullGather 
     34        hullGather, 
     35        hullRegexp 
    3536}; 
    3637 
  • lyx-devel/trunk/src/mathed/InsetMathGrid.cpp

    r27425 r27524  
    982982void InsetMathGrid::write(WriteStream & os) const 
    983983{ 
     984        write(os, 0, 0, nrows(), ncols()); 
     985} 
     986 
     987void InsetMathGrid::write(WriteStream & os, 
     988                          row_type beg_row, col_type beg_col, 
     989                          row_type end_row, col_type end_col) const 
     990{ 
    984991        MathEnsurer ensurer(os, false); 
    985992        docstring eol; 
    986         for (row_type row = 0; row < nrows(); ++row) { 
     993        for (row_type row = beg_row; row < end_row; ++row) { 
    987994                os << verboseHLine(rowinfo_[row].lines_); 
    988995                // don't write & and empty cells at end of line 
    989996                col_type lastcol = 0; 
    990997                bool emptyline = true; 
    991                 for (col_type col = 0; col < ncols(); ++col) 
     998                for (col_type col = beg_col; col < end_col; ++col) 
    992999                        if (!cell(index(row, col)).empty()) { 
    9931000                                lastcol = col + 1; 
    9941001                                emptyline = false; 
    9951002                        } 
    996                 for (col_type col = 0; col < lastcol; ++col) { 
     1003                for (col_type col = beg_col; col < end_col; ++col) { 
    9971004                        os << cell(index(row, col)); 
    9981005                        if (os.pendingBrace()) 
     
    10041011                // append newline only if line wasn't completely empty 
    10051012                // and this was not the last line in the grid 
    1006                 if (!emptyline && row + 1 < nrows()
     1013                if (!emptyline && row + 1 < end_row
    10071014                        os << "\n"; 
    10081015        } 
     1016        // @TODO use end_row instead of nrows() ? 
    10091017        docstring const s = verboseHLine(rowinfo_[nrows()].lines_); 
    10101018        if (!s.empty()) { 
  • lyx-devel/trunk/src/mathed/InsetMathGrid.h

    r27425 r27524  
    211211        void write(WriteStream & os) const; 
    212212        /// 
     213        void write(WriteStream & os, 
     214                   row_type beg_row, col_type beg_col, 
     215                   row_type end_row, col_type end_col) const; 
     216        /// 
    213217        void normalize(NormalStream &) const; 
    214218        /// 
  • lyx-devel/trunk/src/mathed/InsetMathHull.cpp

    r27437 r27524  
    119119        if (s == "gather")    return hullGather; 
    120120        if (s == "flalign")   return hullFlAlign; 
    121         lyxerr << "unknown hull type '" << to_utf8(s) << "'" << endl; 
     121        if (s == "regexp")    return hullRegexp; 
     122        lyxerr << "unknown hull type '" << to_utf8(s) << "'" << endl; 
    122123        return HullType(-1); 
    123124} 
     
    138139                case hullGather:     return from_ascii("gather"); 
    139140                case hullFlAlign:    return from_ascii("flalign"); 
    140                 default: 
     141                case hullRegexp:     return from_ascii("regexp"); 
     142                default: 
    141143                        lyxerr << "unknown hull type '" << type << "'" << endl; 
    142144                        return from_ascii("none"); 
     
    557559Inset::DisplayType InsetMathHull::display() const 
    558560{ 
    559         return (type_ != hullSimple && type_ != hullNone) ? AlignCenter : Inline; 
    560 
    561  
     561        return (type_ != hullSimple && type_ != hullNone 
     562                && type_ != hullRegexp) ? AlignCenter : Inline; 
     563
    562564 
    563565bool InsetMathHull::numberedType() const 
     
    569571        if (type_ == hullXXAlignAt) 
    570572                return false; 
     573        if (type_ == hullRegexp) 
     574                return false; 
    571575        for (row_type row = 0; row < nrows(); ++row) 
    572576                if (!nonum_[row]) 
     
    630634                os << "\\begin{" << hullName(type_) << '}' 
    631635                  << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n"; 
     636                break; 
     637 
     638        case hullRegexp: 
     639                os << "\\regexp{"; 
    632640                break; 
    633641 
     
    671679        case hullXXAlignAt: 
    672680                os << "\\end{" << hullName(type_) << "}\n"; 
     681                break; 
     682 
     683        case hullRegexp: 
     684                os << "}"; 
    673685                break; 
    674686 
  • lyx-devel/trunk/src/mathed/InsetMathHull.h

    r27425 r27524  
    112112        void write(std::ostream & os) const; 
    113113        /// 
     114        void header_write(WriteStream &) const; 
     115        /// 
     116        void footer_write(WriteStream &) const; 
     117        /// 
    114118        void read(Lexer & lex); 
    115119        /// 
     
    157161        /// 
    158162        void validate1(LaTeXFeatures & features); 
    159         /// 
    160         void header_write(WriteStream &) const; 
    161         /// 
    162         void footer_write(WriteStream &) const; 
    163163        /// 
    164164        docstring nicelabel(row_type row) const; 
  • lyx-devel/trunk/src/mathed/InsetMathNest.cpp

    r27425 r27524  
    962962                } 
    963963#endif 
     964                break; 
     965        } 
     966 
     967        case LFUN_REGEXP_MODE: { 
     968                InsetMathHull * i = dynamic_cast<InsetMathHull *>(cur.inset().asInsetMath()); 
     969                if (i && i->getType() == hullRegexp) { 
     970                        cur.message(_("Already in regexp mode")); 
     971                        break; 
     972                } 
     973                cur.macroModeClose(); 
     974                docstring const save_selection = grabAndEraseSelection(cur); 
     975                selClearOrDel(cur); 
     976                cur.plainInsert(MathAtom(new InsetMathHull(hullRegexp))); 
     977                cur.posBackward(); 
     978                cur.pushBackward(*cur.nextInset()); 
     979                cur.niceInsert(save_selection); 
     980                cur.message(_("Regexp editor mode")); 
    964981                break; 
    965982        } 
  • lyx-devel/trunk/src/mathed/MathFactory.cpp

    r27425 r27524  
    4242#include "InsetMathUnderset.h" 
    4343#include "InsetMathUnknown.h" 
     44#include "InsetMathHull.h" 
    4445#include "InsetMathXArrow.h" 
    4546#include "InsetMathXYMatrix.h" 
     
    463464                return MathAtom(new InsetMathSpecialChar(s)); 
    464465 
     466        if (s == "regexp") 
     467                return MathAtom(new InsetMathHull(hullRegexp)); 
     468 
    465469        return MathAtom(new MathMacro(s)); 
    466470}