]> git.lyx.org Git - features.git/commitdiff
small stuff
authorAndré Pönitz <poenitz@gmx.net>
Wed, 7 Apr 2004 13:15:34 +0000 (13:15 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Wed, 7 Apr 2004 13:15:34 +0000 (13:15 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8620 a592a061-630c-0410-9148-cb99ea01b6c8

src/cursor.C
src/cursor.h
src/cursor_slice.C
src/cursor_slice.h
src/mathed/math_support.C
src/metricsinfo.C

index 6e91d9d9c27fb770b5080201289244e5f302c290..409c366a4149d403a86fd2ee9f30e232460d22b0 100644 (file)
@@ -314,33 +314,19 @@ bool LCursor::posRight()
 }
 
 
-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();
@@ -348,7 +334,7 @@ CursorSlice const & LCursor::selBegin() const
 }
 
 
-CursorSlice const & LCursor::selEnd() const
+CursorSlice LCursor::selEnd() const
 {
        if (!selection())
                return back();
@@ -920,18 +906,6 @@ int LCursor::targetX() const
 }
 
 
-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)
@@ -1160,25 +1134,6 @@ void LCursor::bruteFind2(int x, int y)
 }
 
 
-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;
index d59e4312bb9e9f3d30f96dc36f5c96194e8c49e0..c254f116599ba71ae66f04ee0677b663fc363d49 100644 (file)
@@ -72,9 +72,9 @@ public:
        ///
        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
@@ -140,10 +140,8 @@ public:
        /// 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
@@ -245,8 +243,6 @@ public:
        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();
@@ -266,9 +262,6 @@ public:
        /// 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();
index 2f8bb87857049218d03575afe23e7443b2ce90aa..f891844e196547906fa8ac0d54d414290325c0ab 100644 (file)
@@ -166,6 +166,12 @@ bool operator>(CursorSlice const & p, CursorSlice const & q)
 }
 
 
+bool operator<=(CursorSlice const & p, CursorSlice const & q)
+{
+       return !(q < p);
+}
+
+
 std::ostream & operator<<(std::ostream & os, CursorSlice const & item)
 {
        return os
index f50820549a31ce59b620c0eb837088bffcbad93b..230a9ad83949309e6aec2a5a1f916c2724edf990 100644 (file)
@@ -153,5 +153,7 @@ bool operator!=(CursorSlice const &, CursorSlice const &);
 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
index 148d33e54e870624a84c5f232618872533293583..29e117df28686bf9deb32ebcbb3ab835a7183f94 100644 (file)
@@ -554,19 +554,19 @@ fontinfo fontinfos[] = {
        {"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},
 
index 1283c687f2e5b8fb2f75bd10b2d411c5acd4964f..9e50cd0683bedbecff2e46d2e87e171806a8c206 100644 (file)
@@ -145,9 +145,11 @@ FontSetChanger::FontSetChanger(MetricsBase & mb, char const * name)
        :       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);
 }