!! - mark "not a bug, a feature" replies, usually with a request for
further discussion
+ pp - partially fixed
+
Unmarked items are known unfixed but probably unverified bugs.
----------------------------------------------------------------------
// - When you press the mouse just to the left of the middle point of
// some char, the cursor will be positioned to the right of the char.
-- It is possible to put two or more consecutive spaces in math text mode
+pp - It is possible to put two or more consecutive spaces in math text mode
// - Text in superscript is not smaller than normal text.
// enter the cell its cell and press
// M-m ( M-f 1 <right> <right> <right> (zoom=100, screenDPI=100)
-- When selecting multiple cells in a array using the keyboard, <left>
- etc. should can move whole cell at a time -- no need to navigate
- within cells.
+// - When selecting multiple cells in a array using the keyboard, <left>
+// etc. should can move whole cell at a time -- no need to navigate
+// within cells.
- When selecting, maybe give a visual indication of the "original"
anchor, when it differs from the "actual" one.
math_atom.h \
math_binominset.C \
math_binominset.h \
+ math_braceinset.C \
+ math_braceinset.h \
math_boxinset.C \
math_boxinset.h \
math_charinset.C \
break;
}
- case LFUN_MATH_EXTERN:
- bv->lockedInsetStoreUndo(Undo::EDIT);
- handleExtern(arg);
- // re-compute inset dimension
- metrics(bv);
- updateLocal(bv, true);
- break;
-
case LFUN_MATH_MUTATE:
{
bv->lockedInsetStoreUndo(Undo::EDIT);
break;
}
+ case LFUN_MATH_EXTERN:
+ {
+ bv->lockedInsetStoreUndo(Undo::EDIT);
+ handleExtern(arg);
+ // re-compute inset dimension
+ metrics(bv);
+ updateLocal(bv, true);
+ break;
+ }
+
case LFUN_MATH_DISPLAY:
{
int x;
--- /dev/null
+#include <config.h>
+
+#ifdef __GNUG__
+#pragma implementation
+#endif
+
+#include "math_braceinset.h"
+#include "math_parser.h"
+#include "mathed/support.h"
+#include "support/LOstream.h"
+
+using std::max;
+
+
+MathBraceInset::MathBraceInset()
+ : MathNestInset(1)
+{}
+
+
+MathInset * MathBraceInset::clone() const
+{
+ return new MathBraceInset(*this);
+}
+
+
+void MathBraceInset::write(MathWriteInfo & os) const
+{
+ os << '{' << cell(0) << '}';
+}
+
+
+void MathBraceInset::writeNormal(std::ostream & os) const
+{
+ os << "[block ";
+ cell(0).writeNormal(os);
+ os << "]";
+}
+
+
+void MathBraceInset::metrics(MathMetricsInfo const & mi) const
+{
+ xcell(0).metrics(mi);
+ int a, d;
+ mathed_char_dim(LM_TC_TEX, mi, '{', a, d, wid_);
+ ascent_ = std::max(xcell(0).ascent(), a);
+ descent_ = std::max(xcell(0).descent(), a);
+ width_ = xcell(0).width() + 2 * wid_;
+}
+
+
+void MathBraceInset::draw(Painter & pain, int x, int y) const
+{
+ drawChar(pain, LM_TC_TEX, mi_, x, y, '{');
+ xcell(0).draw(pain, x + wid_, y);
+ drawChar(pain, LM_TC_TEX, mi_, x + width_ - wid_, y, '}');
+}
--- /dev/null
+// -*- C++ -*-
+#ifndef MATH_BRACEINSET_H
+#define MATH_BRACEINSET_H
+
+#include "math_nestinset.h"
+#include "math_metricsinfo.h"
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+/** Extra nesting
+ \author André Pönitz
+*/
+
+class MathBraceInset : public MathNestInset {
+public:
+ ///
+ MathBraceInset();
+ ///
+ MathInset * clone() const;
+ ///
+ void draw(Painter &, int x, int y) const;
+ ///
+ void write(MathWriteInfo & os) const;
+ /// write normalized content
+ void writeNormal(std::ostream &) const;
+ ///
+ void metrics(MathMetricsInfo const & st) const;
+
+private:
+ /// width of brace character
+ mutable int wid_;
+ ///
+ MathMetricsInfo mi_;
+};
+
+#endif
#include "math_cursor.h"
#include "math_factory.h"
#include "math_arrayinset.h"
+#include "math_braceinset.h"
#include "math_charinset.h"
#include "math_deliminset.h"
#include "math_matrixinset.h"
MathCursorPos i1;
MathCursorPos i2;
getSelection(i1, i2);
-
//lyxerr << "selection from: " << i1 << " to " << i2 << "\n";
if (i1.idx_ == i2.idx_) {
pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
}
}
+
+#if 0
+ // draw anchor if different from selection boundary
+ MathCursorPos anc = Anchor_.back();
+ if (anc != i1 && anc != i2) {
+ MathXArray & c = anc.xcell();
+ int x = c.xo() + c.pos2x(anc.pos_);
+ int y1 = c.yo() - c.ascent();
+ int y2 = c.yo() + c.descent();
+ pain.line(x, y1, x, y2, LColor::mathline);
+ }
+#endif
}
return;
}
+/*
if (strchr("{}", c)) {
insert(c, LM_TC_TEX);
return;
}
+*/
+
+ if (c == '{') {
+ niceInsert(MathAtom(new MathBraceInset));
+ return;
+ }
+
+ if (c == '}') {
+ return;
+ }
if (strchr("#$%", c)) {
insert(MathAtom(new MathSpecialCharInset(c)));
using std::max;
+
MathDelimInset::MathDelimInset(string const & l, string const & r)
: MathNestInset(1), left_(l), right_(r)
{}
void MathDelimInset::writeNormal(std::ostream & os) const
{
- os << "[delim " << latexName(left_) << " " << latexName(right_) << "]";
+ os << "[delim " << latexName(left_) << ' ' << latexName(right_) << ' ';
+ cell(0).writeNormal(os);
+ os << "]";
}
* the GNU General Public Licence version 2 or later.
*/
+/*
+
+If someone desperately needs partial "structures" (such as a few cells of
+an array inset or similar) (s)he could uses the following hack as starting
+point to write some macros:
+
+ \newif\ifcomment
+ \commentfalse
+ \ifcomment
+ \def\makeamptab{\catcode`\&=4\relax}
+ \def\makeampletter{\catcode`\&=11\relax}
+ \def\b{\makeampletter\expandafter\makeamptab\bi}
+ \long\def\bi#1\e{}
+ \else
+ \def\b{}\def\e{}
+ \fi
+
+ ...
+
+ \[\begin{array}{ccc}
+ 1 & 2\b & 3^2\\
+ 4 & 5\e & 6\\
+ 7 & 8 & 9
+ \end{array}\]
+
+*/
+
+
#include <config.h>
#include <cctype>
#include "array.h"
#include "math_inset.h"
#include "math_arrayinset.h"
+#include "math_braceinset.h"
#include "math_charinset.h"
#include "math_deliminset.h"
#include "math_factory.h"
void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
{
- stack<MathTextCodes> fontcodes;
- fontcodes.push(LM_TC_MIN);
-
bool panic = false;
int limits = 0;
break;
else if (t.cat() == catLetter)
- add(array, t.character(), fontcodes.top());
+ add(array, t.character(), code);
- else if (t.cat() == catSpace &&
- (fontcodes.top() == LM_TC_TEXTRM || code == LM_TC_TEXTRM))
- add(array, ' ', fontcodes.top());
+ else if (t.cat() == catSpace && code == LM_TC_TEXTRM)
+ add(array, t.character(), code);
else if (t.cat() == catParameter) {
Token const & n = getToken();
}
else if (t.cat() == catBegin) {
- add(array, '{', LM_TC_TEX);
- fontcodes.push(LM_TC_MIN);
+ array.push_back(MathAtom(new MathBraceInset));
+ parse_into(array.back()->cell(0), FLAG_BRACE_LAST, LM_TC_MIN);
}
else if (t.cat() == catEnd) {
if (flags & FLAG_BRACE_LAST)
return;
+ lyxerr << "found '}' unexpectedly, array: '" << array << "'\n";
add(array, '}', LM_TC_TEX);
- fontcodes.pop();
}
else if (t.cat() == catAlign) {
return;
else if (t.cat() == catOther)
- add(array, t.character(), fontcodes.top());
+ add(array, t.character(), code);
//
// codesequences
}
else if (l->token == LM_TK_OLDFONT) {
- fontcodes.pop();
- fontcodes.push(static_cast<MathTextCodes>(l->id));
+ code = static_cast<MathTextCodes>(l->id);
}
else {
void MathSymbolInset::writeNormal(ostream & os) const
{
- os << "[" << sym_->name << "] ";
+ os << "[symbol " << sym_->name << "]";
}