]> git.lyx.org Git - features.git/commitdiff
some more inlining
authorAndré Pönitz <poenitz@gmx.net>
Sat, 16 Jul 2005 18:25:58 +0000 (18:25 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Sat, 16 Jul 2005 18:25:58 +0000 (18:25 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10259 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt2/qfont_loader.C
src/frontends/qt2/qfont_loader.h
src/insets/insettabular.C
src/lyxfont.C
src/lyxfont.h
src/paragraph.h

index 026a9a599e83e8a03fb719150b96843effea891a..f15ee0de40213a2883a9c8f133b77391bde95f4a 100644 (file)
@@ -310,12 +310,11 @@ FontInfo::FontInfo(LyXFont const & f)
                            << font.pointSizeFloat() << endl;
 
        // Is this an exact match?
-       if (font.exactMatch()) {
+       if (font.exactMatch())
                lyxerr[Debug::FONT] << "This font is an exact match" << endl;
-       } else {
+       else
                lyxerr[Debug::FONT] << "This font is NOT an exact match"
                                    << endl;
-       }
 
        lyxerr[Debug::FONT] << "XFLD: " << font.rawName() << endl;
 
@@ -328,7 +327,6 @@ int FontInfo::width(Uchar val) const
 // Starting with version 3.1.0, Qt/X11 does its own caching of
 // character width, so it is not necessary to provide ours.
 #if defined (USE_LYX_FONTCACHE)
-#error xxx 
        FontInfo::WidthCache::const_iterator cit = widthcache.find(val);
        if (cit != widthcache.end())
                return cit->second;
index c0b401547eee1e6849185fb268a97ca50d3f640c..7447e0189f2e9bcd010f7a42782cd229fc20424f 100644 (file)
@@ -34,40 +34,40 @@ class FontInfo {
 public:
        FontInfo(LyXFont const & f);
 
-       /// return pixel width for the given unicode char
+       /// Return pixel width for the given unicode char
        int width(Uchar val) const;
 
-       /// the font instance
+       /// The font instance
        QFont font;
-       /// metrics on the font
+       /// Metrics on the font
        QFontMetrics metrics;
 
 #if defined(USE_LYX_FONTCACHE)
        typedef std::map<Uchar, int> WidthCache;
-       /// cache of char widths
+       /// Cache of char widths
        WidthCache widthcache;
 #endif
 };
 
 
+/// Hold info about a particular font
 class FontLoader {
 public:
-       /// hold info about a particular font
        ///
        FontLoader();
 
-       /// update fonts after zoom, dpi, font names, or norm change
+       /// Update fonts after zoom, dpi, font names, or norm change
        void update();
 
-       /// do we have anything matching?
+       /// Do we have anything matching?
        bool available(LyXFont const & f);
 
-       /// get the QFont for this LyXFont
+       /// Get the QFont for this LyXFont
        QFont const & get(LyXFont const & f) {
                return fontinfo(f).font;
        }
 
-       /// get the QFont metrics for this LyXFont
+       /// Get the QFont metrics for this LyXFont
        QFontMetrics const & metrics(LyXFont const & f) {
                return fontinfo(f).metrics;
        }
@@ -78,7 +78,7 @@ public:
        /// Called the first time when available() can't load a symbol font
        static void addToFontPath();
 
-       /// get font info (font + metrics) for the given LyX font. Does not fail.
+       /// Get font info (font + metrics) for the given LyX font. 
        FontInfo & fontinfo(LyXFont const & f) {
                FontInfo * & fi =
                        fontinfo_[f.family()][f.series()][f.realShape()][f.size()];
index e86c1d305b418318656dd445333429402839b70a..1bdec8e659e9b72251b6c63b047b22aea722c47d 100644 (file)
@@ -743,18 +743,19 @@ void InsetTabular::doDispatch(LCursor & cur, FuncRequest & cmd)
                        row_type rs, re;
                        col_type cs, ce;
                        getSelection(cur, rs, re, cs, ce);
-                       for (row_type i = rs; i <= re; ++i)
+                       for (row_type i = rs; i <= re; ++i) {
                                for (col_type j = cs; j <= ce; ++j) {
                                        // cursor follows cell:
                                        cur.idx() = tabular.getCellNumber(i, j);
                                        // select this cell only:
                                        cur.pos() = 0;
-                                       cur.resetAnchor();
+                                       cur.resetAnchor();
                                        cur.pos() = cur.top().lastpos();
-                                       cur.setCursor(cur);
-                                       cur.setSelection();
+                                       cur.setCursor(cur);
+                                       cur.setSelection();
                                        cell(cur.idx())->dispatch(cur, cmd);
                                }
+                       }
                        // Restore original selection
                        cur.idx() = tabular.getCellNumber(rs, cs);
                        cur.pos() = 0;
index 6fefc131c90a3bfcc7854db223b1dee84928e91a..d7559ca0842c92ddcfae15c05d5d1a790f16c0c7 100644 (file)
@@ -204,12 +204,6 @@ LColor_color LyXFont::color() const
 }
 
 
-Language const * LyXFont::language() const
-{
-       return lang;
-}
-
-
 bool LyXFont::isRightToLeft() const
 {
        return lang->RightToLeft();
@@ -917,23 +911,6 @@ LColor_color LyXFont::realColor() const
 }
 
 
-// Convert logical attributes to concrete shape attribute
-LyXFont::FONT_SHAPE LyXFont::realShape() const
-{
-       register FONT_SHAPE s = shape();
-
-       if (emph() == ON) {
-               if (s == UP_SHAPE)
-                       s = ITALIC_SHAPE;
-               else
-                       s = UP_SHAPE;
-       }
-       if (noun() == ON)
-               s = SMALLCAPS_SHAPE;
-       return s;
-}
-
-
 ostream & operator<<(ostream & os, LyXFont::FONT_MISC_STATE fms)
 {
        return os << int(fms);
index 58943b749b092c385caa35fb53d4cd849bc41ce8..8d0d3a26102418fb33c3c2dce3712750ad58d8bf 100644 (file)
@@ -221,7 +221,7 @@ public:
        ///
        LColor_color color() const;
        ///
-       Language const * language() const;
+       Language const * language() const { return lang; }
        ///
        bool isRightToLeft() const;
        ///
@@ -319,7 +319,15 @@ public:
        std::ostream & operator<<(std::ostream & os, LyXFont const & font);
 
        /// Converts logical attributes to concrete shape attribute
-       LyXFont::FONT_SHAPE realShape() const;
+       // Try hard to inline this as it shows up with 4.6 % in the profiler.
+       LyXFont::FONT_SHAPE realShape() const {
+               if (bits.noun == ON)
+                       return SMALLCAPS_SHAPE;
+               if (bits.emph == ON)
+                       return (bits.shape == UP_SHAPE) ? ITALIC_SHAPE : UP_SHAPE;
+               return bits.shape;
+       }
+
 
        /** Compaq cxx 6.5 requires that the definition be public so that
            it can compile operator==()
index b16ac0d5b0c85b34501722bc61a1182aafcd2f90..36739946f9523494586abacace1c46eddb933cb2 100644 (file)
@@ -302,18 +302,16 @@ public:
                    LyXFont const & font);
        ///
        void insertChar(lyx::pos_type pos, value_type c,
-                       Change change = Change(Change::INSERTED));
+                       Change change = Change::INSERTED);
        ///
        void insertChar(lyx::pos_type pos, value_type c,
-               LyXFont const &, Change change = Change(Change::INSERTED));
-       ///
-       bool checkInsertChar(LyXFont &);
+               LyXFont const &, Change change = Change::INSERTED);
        ///
        void insertInset(lyx::pos_type pos, InsetBase * inset,
-                        Change change = Change(Change::INSERTED));
+                        Change change = Change::INSERTED);
        ///
        void insertInset(lyx::pos_type pos, InsetBase * inset,
-               LyXFont const &, Change change = Change(Change::INSERTED));
+               LyXFont const &, Change change = Change::INSERTED);
        ///
        bool insetAllowed(InsetBase_code code);
        ///
@@ -327,7 +325,9 @@ public:
        ///
        bool isHfill(lyx::pos_type pos) const;
        /// hinted by profiler
-       bool isInset(lyx::pos_type pos) const { return getChar(pos) == static_cast<value_type>(META_INSET); }
+       bool isInset(lyx::pos_type pos) const {
+               return getChar(pos) == static_cast<value_type>(META_INSET);
+       }
        ///
        bool isNewline(lyx::pos_type pos) const;
        ///
@@ -367,7 +367,9 @@ public:
        unsigned int height() const { return dim_.height(); }
        /// total width of paragraph, may differ from workwidth
        unsigned int width() const { return dim_.width(); }
+       /// ascend of paragraph above baseline
        unsigned int ascent() const { return dim_.ascent(); }
+       /// descend of paragraph below baseline
        unsigned int descent() const { return dim_.descent(); }
        /// LyXText updates the rows using this access point
        RowList & rows() { return rows_; }