]> git.lyx.org Git - lyx.git/blobdiff - src/Text2.cpp
Improve fullscreen capabilities ( http://bugzilla.lyx.org/show_bug.cgi?id=4146 ).
[lyx.git] / src / Text2.cpp
index 8abecd92082db52d7b2e19bcb8c2c6389f931d5f..699d0e9d9d6d016300b1855aecfa477941856a28 100644 (file)
 #include "Changes.h"
 #include "Cursor.h"
 #include "CutAndPaste.h"
-#include "debug.h"
 #include "DispatchResult.h"
 #include "ErrorList.h"
 #include "FuncRequest.h"
-#include "gettext.h"
 #include "Language.h"
 #include "Layout.h"
 #include "Lexer.h"
@@ -44,9 +42,6 @@
 #include "Paragraph.h"
 #include "paragraph_funcs.h"
 #include "ParagraphParameters.h"
-#include "ParIterator.h"
-#include "Server.h"
-#include "ServerSocket.h"
 #include "TextClass.h"
 #include "TextMetrics.h"
 #include "VSpace.h"
 
 #include "mathed/InsetMathHull.h"
 
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/textutils.h"
 
-#include <boost/current_function.hpp>
 #include <boost/next_prior.hpp>
 
 #include <sstream>
 
-using std::endl;
-using std::ostringstream;
-using std::string;
-using std::max;
-using std::min;
-using std::istringstream;
+using namespace std;
 
 namespace lyx {
 
@@ -168,10 +159,9 @@ void Text::setCharFont(Buffer const & buffer, pit_type pit,
 void Text::setInsetFont(BufferView const & bv, pit_type pit,
                pos_type pos, Font const & font, bool toggleall)
 {
-       BOOST_ASSERT(pars_[pit].isInset(pos) &&
-                    pars_[pit].getInset(pos)->noFontChange());
-
        Inset * const inset = pars_[pit].getInset(pos);
+       BOOST_ASSERT(inset && inset->noFontChange());
+
        CursorSlice::idx_type endidx = inset->nargs();
        for (CursorSlice cs(*inset); cs.idx() != endidx; ++cs.idx()) {
                Text * text = cs.text();
@@ -362,13 +352,14 @@ void Text::setFont(BufferView const & bv, CursorSlice const & begin,
                if (dit.pos() != dit.lastpos()) {
                        pit_type const pit = dit.pit();
                        pos_type const pos = dit.pos();
-                       if (pars_[pit].isInset(pos) &&
-                           pars_[pit].getInset(pos)->noFontChange())
+                       Inset * inset = pars_[pit].getInset(pos);
+                       if (inset && inset->noFontChange()) {
                                // We need to propagate the font change to all
                                // text cells of the inset (bug 1973).
                                // FIXME: This should change, see documentation
                                // of noFontChange in Inset.h
                                setInsetFont(bv, pit, pos, font, toggleall);
+                       }
                        TextMetrics const & tm = bv.textMetrics(this);
                        Font f = tm.getDisplayFont(pit, pos);
                        f.update(font, language, toggleall);
@@ -820,7 +811,7 @@ bool Text::deleteEmptyParagraphMechanism(Cursor & cur,
                bool const soa = oldpar.params().startOfAppendix();
                plist.erase(boost::next(plist.begin(), old.pit()));
                // do not lose start of appendix marker (bug 4212)
-               if (soa && old.pit() < plist.size())
+               if (soa && old.pit() < pit_type(plist.size()))
                        plist[old.pit()].params().startOfAppendix(true);
 
                // see #warning (FIXME?) above