}
-CursorSlice & LCursor::anchor()
+CursorSlice LCursor::anchor() const
{
- if (anchor_.size() < size()) {
- lyxerr << "anchor_.size() < cursor_.size() "
- "should not happen when accessing the anchor" << endl;
- BOOST_ASSERT(false);
- }
- BOOST_ASSERT(!anchor_.empty());
- // this size is cursor_.size()
- return anchor_[size() - 1];
-}
-
-
-CursorSlice const & LCursor::anchor() const
-{
- if (anchor_.size() < size()) {
- lyxerr << "anchor_.size() < cursor_.size() "
- "should not happen when accessing the anchor" << endl;
- BOOST_ASSERT(false);
+ BOOST_ASSERT(anchor_.size() >= size());
+ CursorSlice normal = anchor_[size() - 1];
+ if (size() < anchor_.size() && back() <= normal) {
+ // anchor is behind cursor -> move anchor behind the inset
+ ++normal.pos();
}
- // this size is cursor_.size()
- BOOST_ASSERT(!anchor_.empty());
- return anchor_[size() - 1];
+ return normal;
}
-CursorSlice const & LCursor::selBegin() const
+CursorSlice LCursor::selBegin() const
{
if (!selection())
return back();
}
-CursorSlice const & LCursor::selEnd() const
+CursorSlice LCursor::selEnd() const
{
if (!selection())
return back();
}
-void LCursor::adjust(pos_type from, int diff)
-{
- if (pos() > from)
- pos() += diff;
- if (anchor().pos() > from)
- anchor().pos() += diff;
- // just to be on the safe side
- // theoretically unecessary
- normalize();
-}
-
-
bool LCursor::inMacroMode() const
{
if (!pos() != 0)
}
-CursorSlice LCursor::normalAnchor()
-{
- if (anchor_.size() < depth()) {
- resetAnchor();
- lyxerr << "unusual Anchor size" << endl;
- }
- //lyx::BOOST_ASSERT(Anchor_.size() >= cursor.depth());
- // use Anchor on the same level as Cursor
- CursorSlice normal = anchor_[size() - 1];
-#if 0
- if (depth() < anchor_.size() && !(normal < xx())) {
- // anchor is behind cursor -> move anchor behind the inset
- ++normal.pos_;
- }
-#endif
- return normal;
-}
-
-
void LCursor::handleFont(string const & font)
{
lyxerr << "LCursor::handleFont: " << font << endl;
///
void clearSelection();
/// access start of selection
- CursorSlice const & selBegin() const;
+ CursorSlice selBegin() const;
/// access end of selection
- CursorSlice const & selEnd() const;
+ CursorSlice selEnd() const;
/// access start of selection
DocIterator selectionBegin() const;
/// access start of selection
/// clear target x position of cursor
void clearTargetX();
- /// access to selection anchor
- CursorSlice & anchor();
- /// access to selection anchor
- CursorSlice const & anchor() const;
+ /// access to normalized selection anchor
+ CursorSlice anchor() const;
/// cache the absolute coordinate from the top inset
void updatePos();
/// sets anchor to cursor position
void setScreenPos(int x, int y);
/// in pixels from left of screen
int targetX() const;
- /// adjust anchor position after deletions/insertions
- void adjust(pos_type from, int diff);
/// current offset in the top cell
/// interpret name a name of a macro
void macroModeClose();
/// mark current cursor trace for redraw
void touch();
- /// returns the normalized anchor of the selection
- CursorSlice normalAnchor();
-
/// hack for reveal codes
void markInsert();
void markErase();
}
+bool operator<=(CursorSlice const & p, CursorSlice const & q)
+{
+ return !(q < p);
+}
+
+
std::ostream & operator<<(std::ostream & os, CursorSlice const & item)
{
return os
bool operator<(CursorSlice const &, CursorSlice const &);
/// test for order
bool operator>(CursorSlice const &, CursorSlice const &);
+/// test for order
+bool operator<=(CursorSlice const &, CursorSlice const &);
#endif
{"mathit", inh_family, inh_series,
LyXFont::ITALIC_SHAPE, LColor::math},
{"cmex", LyXFont::CMEX_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"cmm", LyXFont::CMM_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"cmr", LyXFont::CMR_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"cmsy", LyXFont::CMSY_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"eufrak", LyXFont::EUFRAK_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"msa", LyXFont::MSA_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"msb", LyXFont::MSB_FAMILY, inh_series,
- inh_shape, LColor::none},
+ inh_shape, LColor::math},
{"wasy", LyXFont::WASY_FAMILY, inh_series,
inh_shape, LColor::none},
: Changer<MetricsBase>(mb)
{
save_ = mb;
+ LyXFont::FONT_SIZE oldsize = save_.font.size();
mb.fontname = name;
mb.font = LyXFont();
augmentFont(mb.font, name);
+ mb.font.setSize(oldsize);
}