Changeset 27524
- Timestamp:
- 11/16/08 01:18:52 (2 months ago)
- Files:
-
- lyx-devel/trunk/src/mathed/InsetMath.h (modified) (1 diff)
- lyx-devel/trunk/src/mathed/InsetMathGrid.cpp (modified) (2 diffs)
- lyx-devel/trunk/src/mathed/InsetMathGrid.h (modified) (1 diff)
- lyx-devel/trunk/src/mathed/InsetMathHull.cpp (modified) (6 diffs)
- lyx-devel/trunk/src/mathed/InsetMathHull.h (modified) (2 diffs)
- lyx-devel/trunk/src/mathed/InsetMathNest.cpp (modified) (1 diff)
- lyx-devel/trunk/src/mathed/MathFactory.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
lyx-devel/trunk/src/mathed/InsetMath.h
r27425 r27524 32 32 hullFlAlign, 33 33 hullMultline, 34 hullGather 34 hullGather, 35 hullRegexp 35 36 }; 36 37 lyx-devel/trunk/src/mathed/InsetMathGrid.cpp
r27425 r27524 982 982 void InsetMathGrid::write(WriteStream & os) const 983 983 { 984 write(os, 0, 0, nrows(), ncols()); 985 } 986 987 void InsetMathGrid::write(WriteStream & os, 988 row_type beg_row, col_type beg_col, 989 row_type end_row, col_type end_col) const 990 { 984 991 MathEnsurer ensurer(os, false); 985 992 docstring eol; 986 for (row_type row = 0; row < nrows(); ++row) {993 for (row_type row = beg_row; row < end_row; ++row) { 987 994 os << verboseHLine(rowinfo_[row].lines_); 988 995 // don't write & and empty cells at end of line 989 996 col_type lastcol = 0; 990 997 bool emptyline = true; 991 for (col_type col = 0; col < ncols(); ++col)998 for (col_type col = beg_col; col < end_col; ++col) 992 999 if (!cell(index(row, col)).empty()) { 993 1000 lastcol = col + 1; 994 1001 emptyline = false; 995 1002 } 996 for (col_type col = 0; col < lastcol; ++col) {1003 for (col_type col = beg_col; col < end_col; ++col) { 997 1004 os << cell(index(row, col)); 998 1005 if (os.pendingBrace()) … … 1004 1011 // append newline only if line wasn't completely empty 1005 1012 // and this was not the last line in the grid 1006 if (!emptyline && row + 1 < nrows())1013 if (!emptyline && row + 1 < end_row) 1007 1014 os << "\n"; 1008 1015 } 1016 // @TODO use end_row instead of nrows() ? 1009 1017 docstring const s = verboseHLine(rowinfo_[nrows()].lines_); 1010 1018 if (!s.empty()) { lyx-devel/trunk/src/mathed/InsetMathGrid.h
r27425 r27524 211 211 void write(WriteStream & os) const; 212 212 /// 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 /// 213 217 void normalize(NormalStream &) const; 214 218 /// lyx-devel/trunk/src/mathed/InsetMathHull.cpp
r27437 r27524 119 119 if (s == "gather") return hullGather; 120 120 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; 122 123 return HullType(-1); 123 124 } … … 138 139 case hullGather: return from_ascii("gather"); 139 140 case hullFlAlign: return from_ascii("flalign"); 140 default: 141 case hullRegexp: return from_ascii("regexp"); 142 default: 141 143 lyxerr << "unknown hull type '" << type << "'" << endl; 142 144 return from_ascii("none"); … … 557 559 Inset::DisplayType InsetMathHull::display() const 558 560 { 559 return (type_ != hullSimple && type_ != hullNone ) ? AlignCenter : Inline;560 } 561 561 return (type_ != hullSimple && type_ != hullNone 562 && type_ != hullRegexp) ? AlignCenter : Inline; 563 } 562 564 563 565 bool InsetMathHull::numberedType() const … … 569 571 if (type_ == hullXXAlignAt) 570 572 return false; 573 if (type_ == hullRegexp) 574 return false; 571 575 for (row_type row = 0; row < nrows(); ++row) 572 576 if (!nonum_[row]) … … 630 634 os << "\\begin{" << hullName(type_) << '}' 631 635 << '{' << static_cast<unsigned int>((ncols() + 1)/2) << "}\n"; 636 break; 637 638 case hullRegexp: 639 os << "\\regexp{"; 632 640 break; 633 641 … … 671 679 case hullXXAlignAt: 672 680 os << "\\end{" << hullName(type_) << "}\n"; 681 break; 682 683 case hullRegexp: 684 os << "}"; 673 685 break; 674 686 lyx-devel/trunk/src/mathed/InsetMathHull.h
r27425 r27524 112 112 void write(std::ostream & os) const; 113 113 /// 114 void header_write(WriteStream &) const; 115 /// 116 void footer_write(WriteStream &) const; 117 /// 114 118 void read(Lexer & lex); 115 119 /// … … 157 161 /// 158 162 void validate1(LaTeXFeatures & features); 159 ///160 void header_write(WriteStream &) const;161 ///162 void footer_write(WriteStream &) const;163 163 /// 164 164 docstring nicelabel(row_type row) const; lyx-devel/trunk/src/mathed/InsetMathNest.cpp
r27425 r27524 962 962 } 963 963 #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")); 964 981 break; 965 982 } lyx-devel/trunk/src/mathed/MathFactory.cpp
r27425 r27524 42 42 #include "InsetMathUnderset.h" 43 43 #include "InsetMathUnknown.h" 44 #include "InsetMathHull.h" 44 45 #include "InsetMathXArrow.h" 45 46 #include "InsetMathXYMatrix.h" … … 463 464 return MathAtom(new InsetMathSpecialChar(s)); 464 465 466 if (s == "regexp") 467 return MathAtom(new InsetMathHull(hullRegexp)); 468 465 469 return MathAtom(new MathMacro(s)); 466 470 }
