mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-18 21:45:24 +00:00
Fix various warnings issued by clang++.
* 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
This commit is contained in:
parent
af11949934
commit
3cf887f08e
@ -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"
|
||||
@ -1555,7 +1554,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;
|
||||
|
@ -88,11 +88,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",
|
||||
|
@ -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 \
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
@ -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
|
@ -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)
|
||||
{}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -198,7 +198,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
|
||||
@ -255,8 +255,7 @@ public:
|
||||
|
||||
private:
|
||||
friend class GuiSymbols;
|
||||
GuiSymbols * parent_;
|
||||
|
||||
|
||||
QList<char_type> symbols_;
|
||||
};
|
||||
|
||||
|
@ -1946,7 +1946,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")));
|
||||
@ -2085,7 +2085,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")));
|
||||
@ -2219,7 +2219,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(),
|
||||
@ -2261,8 +2261,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));
|
||||
|
||||
@ -3467,7 +3466,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."));
|
||||
@ -3476,8 +3474,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 (*)")));
|
||||
|
@ -263,10 +263,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
|
||||
|
@ -328,7 +328,7 @@ int InsetQuotes::docbook(odocstream & os, OutputParams const &) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const & op) const
|
||||
docstring InsetQuotes::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
{
|
||||
xs << XHTMLStream::ESCAPE_NONE << getQuoteEntity();
|
||||
return docstring();
|
||||
|
@ -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
|
||||
|
@ -742,36 +742,16 @@ 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);
|
||||
}
|
||||
|
||||
|
||||
inline void openParTag(XHTMLStream & xs, Layout const & lay,
|
||||
std::string parlabel)
|
||||
{
|
||||
|
@ -191,3 +191,5 @@ What's new
|
||||
- Fix a configuration error on Windows causing that TeX files were not scanned.
|
||||
|
||||
- Add "Keywords" to lyx.desktop file (bug 9414).
|
||||
|
||||
- Fix several compilation warnings (bug 9488).
|
||||
|
Loading…
x
Reference in New Issue
Block a user