* 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
#include "SpellChecker.h"
#include "sgml.h"
#include "TexRow.h"
-#include "TexStream.h"
#include "Text.h"
#include "TextClass.h"
#include "TocBackend.h"
if (!openFileWrite(ofs, fname))
return false;
- //TexStream ts(ofs.rdbuf(), &texrow());
ErrorList & errorList = d->errorLists["Export"];
errorList.clear();
bool failed_export = false;
};
-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",
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)
Text.cpp \
Text2.cpp \
Text3.cpp \
- TexStream.cpp \
TextClass.cpp \
TextMetrics.cpp \
TocBackend.cpp \
Spacing.h \
SpellChecker.h \
TexRow.h \
- TexStream.h \
Text.h \
TextClass.h \
TextMetrics.h \
+++ /dev/null
-/**
- * \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
-
-}
-
+++ /dev/null
-#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
};
-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)
{}
#ifndef FILEDIALOG_H
#define FILEDIALOG_H
-#include "FuncCode.h"
-
#include <QString>
#include <utility>
/**
* 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();
/// the dialog title
QString title_;
- /// success action to perform if not synchronous
- FuncCode success_;
};
} // namespace lyx
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);
if (!pathname.isEmpty())
lastPath = onlyPath(pathname);
- FileDialog dlg(title, LFUN_SELECT_FILE_SYNC);
+ FileDialog dlg(title);
dlg.setButton1(label1, dir1);
dlg.setButton2(label2, dir2);
{
public:
Model(GuiSymbols * parent)
- : QAbstractItemModel(parent), parent_(parent)
+ : QAbstractItemModel(parent)
{}
QModelIndex index(int row, int column, QModelIndex const &) const
private:
friend class GuiSymbols;
- GuiSymbols * parent_;
-
+
QList<char_type> symbols_;
};
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")));
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")));
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(),
// 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));
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."));
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 (*)")));
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
// 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
// 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)
"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};