]> git.lyx.org Git - features.git/commitdiff
Fix various warnings issued by clang++.
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 21 Apr 2014 14:50:56 +0000 (16:50 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 21 Apr 2014 22:04:04 +0000 (00:04 +0200)
* remove unused class TexStream.

* remove unused virtual method Inset::cellXOffset

* remove second argument of FileDialog constructor, which was actually
  not used

* remove some dead local code

* remove some unused private members of classes

* in InsetMathNest::updateBuffer, fix the logic of a test

15 files changed:
src/Buffer.cpp
src/BufferParams.cpp
src/Cursor.cpp
src/Makefile.am
src/TexStream.cpp [deleted file]
src/TexStream.h [deleted file]
src/frontends/qt4/FileDialog.cpp
src/frontends/qt4/FileDialog.h
src/frontends/qt4/GuiPrefs.cpp
src/frontends/qt4/GuiSymbols.cpp
src/frontends/qt4/GuiView.cpp
src/insets/Inset.h
src/mathed/InsetMathNest.cpp
src/output_xhtml.cpp
src/tex2lyx/Preamble.cpp

index 51430e44a1facba642d40160862680a411e4f92e..cbd46266e938c09351e11982e02dfd00165fb41e 100644 (file)
@@ -58,7 +58,6 @@
 #include "SpellChecker.h"
 #include "sgml.h"
 #include "TexRow.h"
-#include "TexStream.h"
 #include "Text.h"
 #include "TextClass.h"
 #include "TocBackend.h"
@@ -1501,7 +1500,6 @@ bool Buffer::makeLaTeXFile(FileName const & fname,
        if (!openFileWrite(ofs, fname))
                return false;
 
-       //TexStream ts(ofs.rdbuf(), &texrow());
        ErrorList & errorList = d->errorLists["Export"];
        errorList.clear();
        bool failed_export = false;
index 454ccbe99c32c079ea2b78cc975f14c898ff70d1..49c55aaa511d6f52249d29b709a176d042a7c31a 100644 (file)
@@ -87,11 +87,6 @@ static char const * const string_orientation[] = {
 };
 
 
-static char const * const string_footnotekinds[] = {
-       "footnote", "margin", "fig", "tab", "alg", "wide-fig", "wide-tab", ""
-};
-
-
 static char const * const tex_graphics[] = {
        "default", "dvialw", "dvilaser", "dvipdf", "dvipdfm", "dvipdfmx",
        "dvips", "dvipsone", "dvitops", "dviwin", "dviwindo", "dvi2ps", "emtex",
index 964b593f231138fe62b0e3eacaa791ad9c843475..c74031555ffad047bf28bd61e1554a44f820e515 100644 (file)
@@ -65,22 +65,6 @@ namespace lyx {
 
 namespace {
 
-bool positionable(DocIterator const & cursor, DocIterator const & anchor)
-{
-       // avoid deeper nested insets when selecting
-       if (cursor.depth() > anchor.depth())
-               return false;
-
-       // anchor might be deeper, should have same path then
-       for (size_t i = 0; i < cursor.depth(); ++i)
-               if (&cursor[i].inset() != &anchor[i].inset())
-                       return false;
-
-       // position should be ok.
-       return true;
-}
-
-
 // Find position closest to (x, y) in cell given by iter.
 // Used only in mathed
 DocIterator bruteFind2(Cursor const & c, int x, int y)
index 2a986437f1bc1dcbd2ca4aca2361bda231528982..d3ea7bc0e4477a8c19669a5a5c8f2d7792f28bdb 100644 (file)
@@ -178,7 +178,6 @@ SOURCEFILESCORE = \
        Text.cpp \
        Text2.cpp \
        Text3.cpp \
-       TexStream.cpp \
        TextClass.cpp \
        TextMetrics.cpp \
        TocBackend.cpp \
@@ -282,7 +281,6 @@ HEADERFILESCORE = \
        Spacing.h \
        SpellChecker.h \
        TexRow.h \
-       TexStream.h \
        Text.h \
        TextClass.h \
        TextMetrics.h \
diff --git a/src/TexStream.cpp b/src/TexStream.cpp
deleted file mode 100644 (file)
index dc1c43c..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * \file TexStream.cpp
- * This file is part of LyX, the document processor.
- * Licence details can be found in the file COPYING.
- *
- * Full author contact details are available in file CREDITS.
- *
- * Inspired by Dietmar Kuehl's prefix iostreams found on
- * http://www.inf.uni-konstanz.de/~kuehl/
- */
-
-#include <config.h>
-
-#include "TexStream.h"
-#include "TexRow.h"
-
-#include <iostream>
-#include <streambuf>
-
-namespace lyx {
-
-////////////////////////////////////////////////////////////////
-//
-// TexStreamBuffer
-//
-////////////////////////////////////////////////////////////////
-
-
-class TexStreamBuffer : public TexStreamBase
-{
-public:
-       TexStreamBuffer(TexStreamBase * sbuf, TexRow * texrow);
-       int line() const { return line_; }
-       int column() const { return column_; }
-
-protected:
-       int_type overflow(int_type);
-       int sync();
-
-private:
-       TexStreamBase * sbuf_; 
-       TexRow * texrow_;
-       int column_;
-       int line_;
-};
-
-
-TexStreamBuffer::TexStreamBuffer(TexStreamBase *sb, TexRow * texrow)
-  : sbuf_(sb), texrow_(texrow), line_(0)
-{
-       setp(0, 0);
-       setg(0, 0, 0);
-}
-
-TexStreamBuffer::int_type TexStreamBuffer::overflow(TexStreamBuffer::int_type c)
-{
-       if (c == '\n') {
-               ++line_;
-               column_ = 0;
-       } else {
-               ++column_;
-       }
-       return c;
-}
-
-
-int TexStreamBuffer::sync()
-{
-       sbuf_->pubsync();
-       return 0;
-}
-
-  
-////////////////////////////////////////////////////////////////
-//
-// TexStream
-//
-////////////////////////////////////////////////////////////////
-
-TexStream::TexStream(TexStreamBase * sbuf, TexRow * texrow)
-               : std::basic_ostream<char_type>(sbuf_ = new TexStreamBuffer(sbuf, texrow))
-{}
-
-
-TexStream::~TexStream()
-{
-       delete sbuf_;
-}
-
-
-int TexStream::line() const
-{
-       return sbuf_->line();
-}
-
-
-////////////////////////////////////////////////////////////////
-//
-// Test
-//
-////////////////////////////////////////////////////////////////
-
-#if 0
-
-int main(int argc, char *argv[])
-{
-       TexStream out(cout.rdbuf());
-       char c;
-       while (cin) {
-               if (cin.get(c))
-                       out.put(c);
-       }
-       cout << "line count: " << out.line() << endl;
-
-       return 0;
-}
-
-#endif
-
-}
-
diff --git a/src/TexStream.h b/src/TexStream.h
deleted file mode 100644 (file)
index 7c4bdd9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef TEXSTREAM_H
-#define TEXSTREAM_H
-
-#include "support/docstring.h"
-
-#include "TexRow.h"
-
-#include <iostream>
-#include <streambuf>
-
-namespace lyx {
-
-class TexStreamBuffer;
-class TexRow;
-
-typedef std::basic_streambuf<char_type> TexStreamBase;
-
-class TexStream : public std::basic_ostream<char_type>
-{
-public:
-       TexStream(TexStreamBase * sbuf, TexRow * texrow);
-       ~TexStream();
-       int line() const;
-
-private:
-       TexStreamBuffer * sbuf_;
-};
-
-} // namespace lyx
-
-#endif
index 988a8d006b49220da38dff09493aeff415ef7146..8f63d2e18a89584f8c6d45227804cf95c4081dcf 100644 (file)
@@ -55,8 +55,8 @@ public:
 };
 
 
-FileDialog::FileDialog(QString const & t, FuncCode s)
-       : private_(new FileDialog::Private), title_(t), success_(s)
+FileDialog::FileDialog(QString const & t)
+       : private_(new FileDialog::Private), title_(t)
 {}
 
 
index d60d9a4b0012b3a5ce2eadd502666f9238ae0ae5..99a98369dccc6f0085e1ee073956192d2323eb2d 100644 (file)
@@ -13,8 +13,6 @@
 #ifndef FILEDIALOG_H
 #define FILEDIALOG_H
 
-#include "FuncCode.h"
-
 #include <QString>
 
 #include <utility>
@@ -42,16 +40,12 @@ public:
 
        /**
         * Constructs a file dialog with title \param title.
-        * If \param a is \const LFUN_SELECT_FILE_SYNC then a value
-        * will be returned immediately upon performing a open(),
-        * otherwise a callback Dispatch() will be invoked with the filename as
-        * argument, of action \param a.
         *
         * Up to two optional extra buttons are allowed for specifying
         * additional directories in the navigation (an empty
         * directory is interpreted as FileName::getcwd())
         */
-       FileDialog(QString const & title, FuncCode a = LFUN_SELECT_FILE_SYNC);
+       FileDialog(QString const & title);
 
        ~FileDialog();
 
@@ -83,8 +77,6 @@ private:
        /// the dialog title
        QString title_;
 
-       /// success action to perform if not synchronous
-       FuncCode success_;
 };
 
 } // namespace lyx
index d93124931e24071c6de0462b1d68ddc8efc94d8f..6dfd337dcdd005f086eb6add84923f46861ae7a6 100644 (file)
@@ -112,7 +112,7 @@ QString browseFile(QString const & filename,
        else if(!fallback_dir.isEmpty())
                lastPath = fallback_dir;
 
-       FileDialog dlg(title, LFUN_SELECT_FILE_SYNC);
+       FileDialog dlg(title);
        dlg.setButton2(label1, dir1);
        dlg.setButton2(label2, dir2);
 
@@ -183,7 +183,7 @@ QString browseDir(QString const & pathname,
        if (!pathname.isEmpty())
                lastPath = onlyPath(pathname);
 
-       FileDialog dlg(title, LFUN_SELECT_FILE_SYNC);
+       FileDialog dlg(title);
        dlg.setButton1(label1, dir1);
        dlg.setButton2(label2, dir2);
 
index c9305042ee6d03a8fce69280f0c86d1ecb4d62d4..1e7e7891bf2f73ac49ece06350475d533669cb5f 100644 (file)
@@ -199,7 +199,7 @@ class GuiSymbols::Model : public QAbstractItemModel
 {
 public:
        Model(GuiSymbols * parent)
-               : QAbstractItemModel(parent), parent_(parent)
+               : QAbstractItemModel(parent)
        {}
 
        QModelIndex index(int row, int column, QModelIndex const &) const
@@ -257,8 +257,7 @@ public:
 
 private:
        friend class GuiSymbols;
-       GuiSymbols * parent_;
-       
+
        QList<char_type> symbols_;
 };
 
index 22681f104b36a1a95ad316df5270a6ffbc642239..a7cbbe49fed44c0026419e1a63c88d1aa6974ee4 100644 (file)
@@ -1952,7 +1952,7 @@ void GuiView::openDocument(string const & fname)
        string filename;
 
        if (fname.empty()) {
-               FileDialog dlg(qt_("Select document to open"), LFUN_FILE_OPEN);
+               FileDialog dlg(qt_("Select document to open"));
                dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                                toqstr(addPath(package().system_support().absFileName(), "examples")));
@@ -2091,7 +2091,7 @@ void GuiView::importDocument(string const & argument)
                docstring const text = bformat(_("Select %1$s file to import"),
                        formats.prettyName(format));
 
-               FileDialog dlg(toqstr(text), LFUN_BUFFER_IMPORT);
+               FileDialog dlg(toqstr(text));
                dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                        toqstr(addPath(package().system_support().absFileName(), "examples")));
@@ -2225,7 +2225,7 @@ void GuiView::insertLyXFile(docstring const & fname)
                        initpath = trypath;
 
                // FIXME UNICODE
-               FileDialog dlg(qt_("Select LyX document to insert"), LFUN_FILE_INSERT);
+               FileDialog dlg(qt_("Select LyX document to insert"));
                dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Examples|#E#e"),
                        toqstr(addPath(package().system_support().absFileName(),
@@ -2267,8 +2267,7 @@ bool GuiView::renameBuffer(Buffer & b, docstring const & newname, RenameKind kin
 
                // No argument? Ask user through dialog.
                // FIXME UNICODE
-               FileDialog dlg(qt_("Choose a filename to save document as"),
-                                  LFUN_BUFFER_WRITE_AS);
+               FileDialog dlg(qt_("Choose a filename to save document as"));
                dlg.setButton1(qt_("Documents|#o#O"), toqstr(lyxrc.document_path));
                dlg.setButton2(qt_("Templates|#T#t"), toqstr(lyxrc.template_path));
 
@@ -3473,7 +3472,6 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
 
                case LFUN_FILE_INSERT_PLAINTEXT:
                case LFUN_FILE_INSERT_PLAINTEXT_PARA: {
-                       bool const as_paragraph = (cmd.action() == LFUN_FILE_INSERT_PLAINTEXT_PARA);
                        string const fname = to_utf8(cmd.argument());
                        if (!fname.empty() && !FileName::isAbsolute(fname)) {
                                dr.setMessage(_("Absolute filename expected."));
@@ -3482,8 +3480,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        
                        FileName filename(fname);
                        if (fname.empty()) {
-                               FileDialog dlg(qt_("Select file to insert"), (as_paragraph ?
-                                       LFUN_FILE_INSERT_PLAINTEXT_PARA : LFUN_FILE_INSERT_PLAINTEXT));
+                               FileDialog dlg(qt_("Select file to insert"));
 
                                FileDialog::Result result = dlg.open(toqstr(bv->buffer().filePath()),
                                        QStringList(qt_("All Files (*)")));
index 6d9bdcac4c29d3a93e5f241f7756fd4827f3c6b3..63834eb6a0da8f195473e93e0e2600152876c97d 100644 (file)
@@ -261,10 +261,6 @@ public:
        virtual row_type row(idx_type) const { return 0; }
        /// cell index corresponding to row and column;
        virtual idx_type index(row_type row, col_type col) const;
-       /// any additional x-offset when drawing a cell?
-       virtual int cellXOffset(idx_type) const { return 0; }
-       /// any additional y-offset when drawing a cell?
-       virtual int cellYOffset(idx_type) const { return 0; }
        /// number of embedded cells
        virtual size_t nargs() const { return 0; }
        /// number of rows in gridlike structures
index 83e49c43b824b77263e36f436f7126f32ebcf017..2b6b9a3a3d91d650131783a6f1fc373a8c361242 100644 (file)
@@ -1771,7 +1771,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
                        // but suppress direct insertion of two spaces in a row
                        // the still allows typing  '<space>a<space>' and deleting the 'a', but
                        // it is better than nothing...
-                       if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' ') {
+                       if (cur.pos() == 0 || cur.prevAtom()->getChar() != ' ') {
                                cur.insert(c);
                                // FIXME: we have to enable full redraw here because of the
                                // visual box corners that define the inset. If we know for
index 281ffc29716115350ec18ed20ee132a4d713097f..d76a35379a160901a4bcd17ab4847dec186dd38b 100644 (file)
@@ -742,35 +742,15 @@ XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
        // curtag is now the one we actually want.
        os_ << curtag->writeEndTag();
        tag_stack_.pop_back();
-       
+
        return *this;
 }
 
 // End code for XHTMLStream
 
 namespace {
-       
-// convenience functions
-
-inline void openTag(XHTMLStream & xs, Layout const & lay)
-{
-       xs << html::StartTag(lay.htmltag(), lay.htmlattr());
-}
-
-
-void openTag(XHTMLStream & xs, Layout const & lay, 
-             ParagraphParameters const & params)
-{
-       // FIXME Are there other things we should handle here?
-       string const align = alignmentToCSS(params.align());
-       if (align.empty()) {
-               openTag(xs, lay);
-               return;
-       }
-       string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
-       xs << html::StartTag(lay.htmltag(), attrs);
-}
 
+// convenience functions
 
 inline void openParTag(XHTMLStream & xs, Layout const & lay,
                        std::string parlabel)
index 0676cad19b35eb3336f3946182a8819217097565..bb74519f57d958250e2e9fbc8b06ab94f84549b1 100644 (file)
@@ -133,9 +133,6 @@ const char * const known_sans_fonts[] = { "avant", "berasans", "biolinum-type1",
 "cmbr", "cmss", "helvet", "iwona", "iwonac", "iwonal", "iwonalc", "kurier",
 "kurierc", "kurierl", "kurierlc", "lmss", "tgadventor", "tgheros", 0};
 
-const char * const known_kurier_fonts[] = { "kurier", "kurierl",
-"kurier-condensed", "kurier-light-condensed", 0};
-
 const char * const known_typewriter_fonts[] = { "beramono", "cmtl", "cmtt",
 "courier", "lmtt", "luximono", "fourier", "lmodern", "mathpazo", "mathptmx",
 "newcent", "tgcursor", "txtt", 0};