mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-23 13:31:49 +00:00
get rid of InsetError users
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6986 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
56359ec0a8
commit
2a882902eb
@ -19,6 +19,7 @@
|
||||
#include "bufferlist.h"
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include "errorlist.h"
|
||||
#include "iterators.h"
|
||||
#include "language.h"
|
||||
#include "lyxcursor.h"
|
||||
@ -466,9 +467,38 @@ bool BufferView::removeAutoInsets()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showErrorList()
|
||||
void BufferView::resetErrorList()
|
||||
{
|
||||
owner()->getDialogs().show("errorlist");
|
||||
pimpl_->errorlist_.clear();
|
||||
}
|
||||
|
||||
|
||||
void BufferView::setErrorList(ErrorList const & el)
|
||||
{
|
||||
pimpl_->errorlist_ = el;
|
||||
}
|
||||
|
||||
|
||||
void BufferView::addError(ErrorItem const & ei)
|
||||
{
|
||||
pimpl_->errorlist_.push_back(ei);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void BufferView::showErrorList(string const & action) const
|
||||
{
|
||||
if (getErrorList().size()) {
|
||||
string const title = bformat(_("LyX: %1$s errors (%2$s)"), action, buffer()->fileName());
|
||||
owner()->getDialogs().show("errorlist", title);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ErrorList const &
|
||||
BufferView::getErrorList() const
|
||||
{
|
||||
return pimpl_->errorlist_;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,8 @@ class Painter;
|
||||
class UpdatableInset;
|
||||
class WordLangTuple;
|
||||
class Encoding;
|
||||
class ErrorList;
|
||||
class ErrorItem;
|
||||
|
||||
/**
|
||||
* A buffer view encapsulates a view onto a particular
|
||||
@ -153,8 +155,16 @@ public:
|
||||
|
||||
/// removes all autodeletable insets
|
||||
bool removeAutoInsets();
|
||||
/// get the stored error list
|
||||
ErrorList const & getErrorList() const;
|
||||
/// clears the stored error list
|
||||
void resetErrorList();
|
||||
/// stored this error list
|
||||
void setErrorList(ErrorList const &);
|
||||
/// adds a single error to the list
|
||||
void addError(ErrorItem const &);
|
||||
/// show the error list to the user
|
||||
void showErrorList();
|
||||
void showErrorList(string const &) const;
|
||||
/// set the cursor based on the given TeX source row
|
||||
void setCursorFromRow(int row);
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
#ifndef BUFFERVIEW_PIMPL_H
|
||||
#define BUFFERVIEW_PIMPL_H
|
||||
|
||||
#include "errorlist.h"
|
||||
#include "BufferView.h"
|
||||
#include "frontends/Timeout.h"
|
||||
#include "frontends/key_state.h"
|
||||
@ -103,6 +104,9 @@ struct BufferView::Pimpl : public boost::signals::trackable {
|
||||
/// a function should be executed
|
||||
bool dispatch(FuncRequest const & ev);
|
||||
private:
|
||||
/// An error list (replaces the error insets)
|
||||
ErrorList errorlist_;
|
||||
|
||||
/// track changes for the document
|
||||
void trackChanges();
|
||||
|
||||
|
@ -1,3 +1,13 @@
|
||||
|
||||
2003-05-08 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* errorlist.[Ch]: added
|
||||
* buffer.C:
|
||||
* BufferView.[Ch]:
|
||||
* BufferView_pimpl.C:
|
||||
* CutAndPaste.[Ch]: get rid of InsetError users, use ErrorList
|
||||
instead
|
||||
|
||||
2003-05-08 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* Makefile.am: ensure that lyx is relinked upon changes to the
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "CutAndPaste.h"
|
||||
#include "BufferView.h"
|
||||
#include "buffer.h"
|
||||
#include "errorlist.h"
|
||||
#include "paragraph.h"
|
||||
#include "ParagraphParameters.h"
|
||||
#include "lyxtext.h"
|
||||
@ -197,15 +198,17 @@ bool CutAndPaste::copySelection(ParagraphList::iterator startpit,
|
||||
pair<PitPosPair, ParagraphList::iterator>
|
||||
CutAndPaste::pasteSelection(ParagraphList & pars,
|
||||
ParagraphList::iterator pit, int pos,
|
||||
textclass_type tc)
|
||||
textclass_type tc,
|
||||
ErrorList & errorlist)
|
||||
{
|
||||
return pasteSelection(pars, pit, pos, tc, 0);
|
||||
return pasteSelection(pars, pit, pos, tc, 0, errorlist);
|
||||
}
|
||||
|
||||
pair<PitPosPair, ParagraphList::iterator>
|
||||
CutAndPaste::pasteSelection(ParagraphList & pars,
|
||||
ParagraphList::iterator pit, int pos,
|
||||
textclass_type tc, size_t cut_index)
|
||||
textclass_type tc, size_t cut_index,
|
||||
ErrorList & errorlist)
|
||||
{
|
||||
if (!checkPastePossible())
|
||||
return make_pair(PitPosPair(pit, pos), pit);
|
||||
@ -220,7 +223,8 @@ CutAndPaste::pasteSelection(ParagraphList & pars,
|
||||
// new environment and set also another font if that is required.
|
||||
|
||||
// Make sure there is no class difference.
|
||||
SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone);
|
||||
SwitchLayoutsBetweenClasses(textclass, tc, simple_cut_clone,
|
||||
errorlist);
|
||||
|
||||
ParagraphList::iterator tmpbuf = simple_cut_clone.begin();
|
||||
int depth_delta = pit->params().depth() - tmpbuf->params().depth();
|
||||
@ -329,7 +333,8 @@ int CutAndPaste::nrOfParagraphs()
|
||||
|
||||
int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
|
||||
textclass_type c2,
|
||||
ParagraphList & pars)
|
||||
ParagraphList & pars,
|
||||
ErrorList & errorlist)
|
||||
{
|
||||
lyx::Assert(!pars.empty());
|
||||
|
||||
@ -359,7 +364,9 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
|
||||
"because of class conversion from\n%3$s to %4$s"),
|
||||
name, par->layout()->name(), tclass1.name(), tclass2.name());
|
||||
// To warn the user that something had to be done.
|
||||
par->insertInset(0, new InsetError(s));
|
||||
errorlist.push_back(ErrorItem("Changed Layout", s,
|
||||
par->id(), 0,
|
||||
par->size()));
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -18,6 +18,7 @@
|
||||
class Paragraph;
|
||||
class BufferParams;
|
||||
class LyXTextClass;
|
||||
class ErrorList;
|
||||
|
||||
///
|
||||
namespace CutAndPaste {
|
||||
@ -40,14 +41,14 @@ bool copySelection(ParagraphList::iterator startpit,
|
||||
std::pair<PitPosPair, ParagraphList::iterator>
|
||||
pasteSelection(ParagraphList & pars,
|
||||
ParagraphList::iterator pit, int pos,
|
||||
lyx::textclass_type tc);
|
||||
lyx::textclass_type tc, ErrorList &);
|
||||
|
||||
///
|
||||
std::pair<PitPosPair, ParagraphList::iterator>
|
||||
pasteSelection(ParagraphList & pars,
|
||||
ParagraphList::iterator pit, int pos,
|
||||
lyx::textclass_type tc,
|
||||
size_t cuts_index);
|
||||
size_t cuts_indexm, ErrorList &);
|
||||
|
||||
///
|
||||
int nrOfParagraphs();
|
||||
@ -58,7 +59,8 @@ int nrOfParagraphs();
|
||||
*/
|
||||
int SwitchLayoutsBetweenClasses(lyx::textclass_type c1,
|
||||
lyx::textclass_type c2,
|
||||
ParagraphList & par);
|
||||
ParagraphList & par,
|
||||
ErrorList &);
|
||||
///
|
||||
bool checkPastePossible();
|
||||
|
||||
|
@ -127,6 +127,8 @@ lyx_SOURCES = \
|
||||
dimension.h \
|
||||
encoding.C \
|
||||
encoding.h \
|
||||
errorlist.C \
|
||||
errorlist.h \
|
||||
exporter.C \
|
||||
exporter.h \
|
||||
gettext.C \
|
||||
|
33
src/buffer.C
33
src/buffer.C
@ -28,6 +28,7 @@
|
||||
#include "gettext.h"
|
||||
#include "language.h"
|
||||
#include "exporter.h"
|
||||
#include "errorlist.h"
|
||||
#include "Lsstream.h"
|
||||
#include "format.h"
|
||||
#include "BufferView.h"
|
||||
@ -1167,6 +1168,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
string item_name;
|
||||
vector<string> environment_stack(5);
|
||||
|
||||
users->resetErrorList();
|
||||
|
||||
ParagraphList::iterator pit = paragraphs.begin();
|
||||
ParagraphList::iterator pend = paragraphs.end();
|
||||
for (; pit != pend; ++pit) {
|
||||
@ -1205,7 +1208,7 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
|
||||
case LATEX_COMMAND:
|
||||
if (depth != 0)
|
||||
sgmlError(&*pit, 0,
|
||||
sgmlError(pit, 0,
|
||||
_("Error: Wrong depth for LatexType Command.\n"));
|
||||
|
||||
if (!environment_stack[depth].empty()) {
|
||||
@ -1296,6 +1299,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
|
||||
|
||||
// we want this to be true outside previews (for insetexternal)
|
||||
niceFile = true;
|
||||
|
||||
users->showErrorList(_("LinuxDoc"));
|
||||
}
|
||||
|
||||
|
||||
@ -1549,23 +1554,10 @@ void Buffer::simpleLinuxDocOnePar(ostream & os,
|
||||
|
||||
|
||||
// Print an error message.
|
||||
void Buffer::sgmlError(ParagraphList::iterator /*par*/, int /*pos*/,
|
||||
string const & /*message*/) const
|
||||
void Buffer::sgmlError(ParagraphList::iterator pit, int pos,
|
||||
string const & message) const
|
||||
{
|
||||
#ifdef WITH_WARNINGS
|
||||
#warning This is wrong we cannot insert an inset like this!!!
|
||||
// I guess this was Jose' so I explain you more or less why this
|
||||
// is wrong. This way you insert something in the paragraph and
|
||||
// don't tell it to LyXText (row rebreaking and undo handling!!!)
|
||||
// I deactivate this code, have a look at BufferView::insertErrors
|
||||
// how you should do this correctly! (Jug 20020315)
|
||||
#endif
|
||||
#if 0
|
||||
// insert an error marker in text
|
||||
InsetError * new_inset = new InsetError(message);
|
||||
par->insertInset(pos, new_inset, LyXFont(LyXFont::ALL_INHERIT,
|
||||
params.language));
|
||||
#endif
|
||||
users->addError(ErrorItem(message, string(), pit->id(), pos, pos));
|
||||
}
|
||||
|
||||
|
||||
@ -1633,6 +1625,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
string item_name;
|
||||
string command_name;
|
||||
|
||||
users->resetErrorList();
|
||||
|
||||
ParagraphList::iterator par = paragraphs.begin();
|
||||
ParagraphList::iterator pend = paragraphs.end();
|
||||
|
||||
@ -1849,6 +1843,7 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
|
||||
|
||||
// we want this to be true outside previews (for insetexternal)
|
||||
niceFile = true;
|
||||
users->showErrorList(_("DocBook"));
|
||||
}
|
||||
|
||||
|
||||
@ -1974,7 +1969,9 @@ int Buffer::runChktex()
|
||||
_("Could not run chktex successfully."));
|
||||
} else if (res > 0) {
|
||||
// Insert all errors as errors boxes
|
||||
users->showErrorList();
|
||||
ErrorList el (*this, terr);
|
||||
users->setErrorList(el);
|
||||
users->showErrorList(_("ChkTeX"));
|
||||
}
|
||||
|
||||
// if we removed error insets before we ran chktex or if we inserted
|
||||
|
47
src/errorlist.C
Normal file
47
src/errorlist.C
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* \file errorlist.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Alfredo Braunstein
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "errorlist.h"
|
||||
#include "buffer.h"
|
||||
#include "LaTeX.h"
|
||||
|
||||
|
||||
ErrorItem::ErrorItem(string const & error, string const & description,
|
||||
int par_id, int pos_start, int pos_end)
|
||||
: error(error), description(description), par_id(par_id),
|
||||
pos_start(pos_start), pos_end(pos_end)
|
||||
{}
|
||||
|
||||
|
||||
ErrorItem::ErrorItem()
|
||||
: par_id(-1), pos_start(0), pos_end(0)
|
||||
{}
|
||||
|
||||
|
||||
ErrorList::ErrorList(Buffer const & buf,
|
||||
TeXErrors const & terr)
|
||||
{
|
||||
TeXErrors::Errors::const_iterator cit = terr.begin();
|
||||
TeXErrors::Errors::const_iterator end = terr.end();
|
||||
|
||||
for (; cit != end; ++cit) {
|
||||
int par_id = -1;
|
||||
int posstart = -1;
|
||||
int const errorrow = cit->error_in_line;
|
||||
buf.texrow.getIdFromRow(errorrow, par_id, posstart);
|
||||
int posend = -1;
|
||||
buf.texrow.getIdFromRow(errorrow + 1, par_id, posend);
|
||||
push_back(ErrorItem(cit->error_desc,
|
||||
cit->error_text,
|
||||
par_id, posstart, posend));
|
||||
}
|
||||
}
|
53
src/errorlist.h
Normal file
53
src/errorlist.h
Normal file
@ -0,0 +1,53 @@
|
||||
// -*- C++ -*-
|
||||
|
||||
#ifndef ERRORLIST_H
|
||||
#define ERRORLIST_H
|
||||
|
||||
/**
|
||||
* \file errorlist.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Alfredo Braunstein
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include "support/lstrings.h"
|
||||
|
||||
class Buffer;
|
||||
class TeXErrors;
|
||||
|
||||
/// A class to hold an error item
|
||||
struct ErrorItem {
|
||||
string error;
|
||||
string description;
|
||||
int par_id;
|
||||
int pos_start;
|
||||
int pos_end;
|
||||
ErrorItem(string const &, string const &,
|
||||
int, int, int);
|
||||
ErrorItem();
|
||||
};
|
||||
|
||||
class ErrorList : private std::vector<ErrorItem>
|
||||
{
|
||||
public:
|
||||
ErrorList() : std::vector<ErrorItem> () {};
|
||||
ErrorList(Buffer const & buf, TeXErrors const &);
|
||||
|
||||
using std::vector<ErrorItem>::push_back;
|
||||
using std::vector<ErrorItem>::end;
|
||||
using std::vector<ErrorItem>::begin;
|
||||
using std::vector<ErrorItem>::operator[];
|
||||
using std::vector<ErrorItem>::size;
|
||||
using std::vector<ErrorItem>::clear;
|
||||
using std::vector<ErrorItem>::empty;
|
||||
using std::vector<ErrorItem>::const_iterator;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
@ -1,5 +1,8 @@
|
||||
2003-05-20 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
ControlErrorList.[Ch]: small bugs fixed, use ErrorList
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
* ControlForks.[Ch]: use vector<pid_t> instead of strings
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "lyxfind.h"
|
||||
|
||||
#include "buffer.h"
|
||||
#include "errorlist.h"
|
||||
#include "language.h"
|
||||
#include "lyx_main.h"
|
||||
#include "lyxtextclass.h"
|
||||
@ -117,24 +118,14 @@ void ControlDocument::classApply()
|
||||
buffer()->params = *bp_;
|
||||
|
||||
lv_.message(_("Converting document to new document class..."));
|
||||
int ret = CutAndPaste::SwitchLayoutsBetweenClasses(
|
||||
old_class, new_class,
|
||||
lv_.buffer()->paragraphs);
|
||||
|
||||
if (!ret)
|
||||
return;
|
||||
ErrorList el;
|
||||
CutAndPaste::SwitchLayoutsBetweenClasses(old_class, new_class,
|
||||
lv_.buffer()->paragraphs,
|
||||
el);
|
||||
|
||||
string s;
|
||||
if (ret == 1) {
|
||||
s = bformat(_("One paragraph could not be converted\n"
|
||||
"into the document class %1$s."),
|
||||
textclasslist[new_class].name());
|
||||
} else {
|
||||
s = bformat(_("%1$s paragraphs could not be converted\n"
|
||||
"into the document class %2$s."),
|
||||
textclasslist[new_class].name());
|
||||
}
|
||||
Alert::warning(_("Class conversion errors"), s);
|
||||
bufferview()->setErrorList(el);
|
||||
bufferview()->showErrorList(_("Class switch"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
#include "ControlErrorList.h"
|
||||
#include "support/lstrings.h" // tostr
|
||||
#include "LaTeX.h"
|
||||
#include "errorlist.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxtext.h"
|
||||
@ -22,84 +22,33 @@
|
||||
using std::endl;
|
||||
|
||||
|
||||
ControlErrorList::ErrorItem::ErrorItem(string const & error,
|
||||
string const & description,
|
||||
int par_id, int pos_start, int pos_end)
|
||||
: error(error), description(description), par_id(par_id),
|
||||
pos_start(pos_start), pos_end(pos_end)
|
||||
{}
|
||||
|
||||
|
||||
ControlErrorList::ControlErrorList(Dialog & d)
|
||||
: Dialog::Controller(d), current_(0)
|
||||
: Dialog::Controller(d)
|
||||
{}
|
||||
|
||||
|
||||
void ControlErrorList::clearParams()
|
||||
{}
|
||||
|
||||
|
||||
ErrorList const &
|
||||
ControlErrorList::errorList() const
|
||||
{
|
||||
logfilename_.erase();
|
||||
clearErrors();
|
||||
return errorlist_;
|
||||
}
|
||||
|
||||
|
||||
std::vector<ControlErrorList::ErrorItem> const &
|
||||
ControlErrorList::ErrorList() const
|
||||
bool ControlErrorList::initialiseParams(string const & name)
|
||||
{
|
||||
return ErrorList_;
|
||||
}
|
||||
|
||||
|
||||
int ControlErrorList::currentItem() const
|
||||
{
|
||||
return current_;
|
||||
}
|
||||
|
||||
|
||||
bool ControlErrorList::initialiseParams(string const &)
|
||||
{
|
||||
logfilename_ = kernel().buffer()->getLogName().second;
|
||||
clearErrors();
|
||||
fillErrors();
|
||||
current_ = 0;
|
||||
errorlist_ = kernel().bufferview()->getErrorList();
|
||||
name_ = name;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ControlErrorList::clearErrors()
|
||||
string const & ControlErrorList::name()
|
||||
{
|
||||
ErrorList_.clear();
|
||||
current_ = 0;
|
||||
}
|
||||
|
||||
|
||||
void ControlErrorList::fillErrors()
|
||||
{
|
||||
LaTeX latex("", logfilename_, "");
|
||||
TeXErrors terr;
|
||||
latex.scanLogFile(terr);
|
||||
|
||||
Buffer * const buf = kernel().buffer();
|
||||
|
||||
TeXErrors::Errors::const_iterator cit = terr.begin();
|
||||
TeXErrors::Errors::const_iterator end = terr.end();
|
||||
|
||||
for (; cit != end; ++cit) {
|
||||
int par_id = -1;
|
||||
int posstart = -1;
|
||||
int const errorrow = cit->error_in_line;
|
||||
buf->texrow.getIdFromRow(errorrow, par_id, posstart);
|
||||
int posend = -1;
|
||||
buf->texrow.getIdFromRow(errorrow + 1, par_id, posend);
|
||||
ErrorList_.push_back(ErrorItem(cit->error_desc,
|
||||
cit->error_text,
|
||||
par_id, posstart, posend));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
string const & ControlErrorList::docName()
|
||||
{
|
||||
return kernel().buffer()->fileName();
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
@ -108,9 +57,7 @@ void ControlErrorList::goTo(int item)
|
||||
BufferView * const bv = kernel().bufferview();
|
||||
Buffer * const buf = kernel().buffer();
|
||||
|
||||
current_ = item;
|
||||
|
||||
ControlErrorList::ErrorItem const & err = ErrorList_[item];
|
||||
ErrorItem const & err = errorlist_[item];
|
||||
|
||||
|
||||
if (err.par_id == -1)
|
||||
|
@ -12,7 +12,7 @@
|
||||
#ifndef CONTROLERRORLIST_H
|
||||
#define CONTROLERRORLIST_H
|
||||
|
||||
|
||||
#include "errorlist.h"
|
||||
#include "Dialog.h"
|
||||
#include <vector>
|
||||
|
||||
@ -24,15 +24,6 @@
|
||||
|
||||
class ControlErrorList : public Dialog::Controller {
|
||||
public:
|
||||
/// A class to hold an error item
|
||||
struct ErrorItem {
|
||||
std::string error;
|
||||
std::string description;
|
||||
int par_id;
|
||||
int pos_start;
|
||||
int pos_end;
|
||||
ErrorItem(string const &, string const &, int, int, int);
|
||||
};
|
||||
///
|
||||
ControlErrorList(Dialog & parent);
|
||||
///
|
||||
@ -44,25 +35,17 @@ public:
|
||||
///
|
||||
virtual void ControlErrorList::dispatchParams() {}
|
||||
|
||||
/// get the current item
|
||||
int currentItem() const;
|
||||
/// goto this error in the parent bv
|
||||
void goTo(int item);
|
||||
/// return the parent document name
|
||||
string const & docName();
|
||||
/// rescan the log file and rebuild the error list
|
||||
void fillErrors();
|
||||
/// clear everything
|
||||
void clearErrors();
|
||||
string const & name();
|
||||
///
|
||||
std::vector<ErrorItem> const & ErrorList() const;
|
||||
ErrorList const & errorList() const;
|
||||
private:
|
||||
///
|
||||
std::vector<ErrorItem> ErrorList_;
|
||||
ErrorList errorlist_;
|
||||
///
|
||||
string logfilename_;
|
||||
///
|
||||
int current_;
|
||||
string name_;
|
||||
};
|
||||
|
||||
#endif // CONTROLERRORLIST_H
|
||||
|
@ -1,3 +1,12 @@
|
||||
2003-05-20 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* QErrorList.[Ch]: small bugs fixed.
|
||||
|
||||
2003-05-17 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* QErrorList.C (update_contents): replace TextBrowser::clear() by
|
||||
TextBrowser::setText(QString())
|
||||
|
||||
2003-05-14 Juergen Spitzmueller <juergen.sp@t-online.de>
|
||||
|
||||
* QErrorList.C (select): added a missing toqstr()
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "LyXView.h"
|
||||
#include "errorlist.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "debug.h"
|
||||
@ -27,7 +28,7 @@
|
||||
typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class;
|
||||
|
||||
QErrorList::QErrorList(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: LaTeX error list"))
|
||||
: base_class(parent, "")
|
||||
{}
|
||||
|
||||
|
||||
@ -41,28 +42,22 @@ void QErrorList::build_dialog()
|
||||
void QErrorList::select(int item)
|
||||
{
|
||||
controller().goTo(item);
|
||||
dialog_->descriptionTB->setText(toqstr(controller().ErrorList()[item].description));
|
||||
dialog_->descriptionTB->setText(toqstr(controller().errorList()[item].description));
|
||||
}
|
||||
|
||||
|
||||
void QErrorList::update_contents()
|
||||
{
|
||||
string const caption = string(_("LyX: LaTex error List")) + '(' +
|
||||
controller().docName() + ')';
|
||||
|
||||
dialog_->setCaption(qt_(caption));
|
||||
dialog_->setCaption(toqstr(controller().name()));
|
||||
dialog_->errorsLB->clear();
|
||||
dialog_->descriptionTB->clear();
|
||||
dialog_->descriptionTB->setText(QString());
|
||||
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
it = controller().ErrorList().begin();
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
end = controller().ErrorList().end();
|
||||
ErrorList::const_iterator it = controller().errorList().begin();
|
||||
ErrorList::const_iterator end = controller().errorList().end();
|
||||
for(; it != end; ++it) {
|
||||
QListBoxItem * error = new QListBoxText(dialog_->errorsLB,
|
||||
toqstr(it->error));
|
||||
new QListBoxText(dialog_->errorsLB, toqstr(it->error));
|
||||
}
|
||||
|
||||
dialog_->errorsLB->setSelected(controller().currentItem(), true);
|
||||
dialog_->errorsLB->setSelected(0, true);
|
||||
}
|
||||
|
||||
|
@ -34,8 +34,6 @@ private:
|
||||
virtual void build_dialog();
|
||||
/// update contents
|
||||
virtual void update_contents();
|
||||
/// run latex
|
||||
void runLaTeX();
|
||||
};
|
||||
|
||||
#endif // QERRORLIST_H
|
||||
|
@ -27,6 +27,8 @@ QErrorListDialog::QErrorListDialog(QErrorList * form)
|
||||
{
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
connect(errorsLB, SIGNAL(returnPressed(QListBoxItem *)),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-05-20 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* FormErrorList.[Ch]: small bugs fixed
|
||||
|
||||
2003-05-13 Rob Lahaye <lahaye@snu.ac.kr>
|
||||
|
||||
* FormPreferences.C: Change conversions-tooltip.
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "errorlist.h"
|
||||
#include "FormErrorList.h"
|
||||
#include "xformsBC.h"
|
||||
#include "xforms_helpers.h"
|
||||
@ -21,87 +22,76 @@
|
||||
#include "gettext.h"
|
||||
#include "lyx_forms.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
using std::vector;
|
||||
using std::endl;
|
||||
|
||||
|
||||
typedef FormController<ControlErrorList, FormView<FD_errorlist> > base_class;
|
||||
|
||||
FormErrorList::FormErrorList(Dialog & parent)
|
||||
: base_class(parent, _("LaTeX error list"))
|
||||
: base_class(parent, "")
|
||||
{}
|
||||
|
||||
|
||||
void FormErrorList::build()
|
||||
{
|
||||
dialog_.reset(build_errorlist(this));
|
||||
|
||||
// Manage the cancel/close button
|
||||
bcview().setCancel(dialog_->button_close);
|
||||
bcview().addReadOnly(dialog_->browser_errors);
|
||||
setEnabled(dialog_->input_description, false);
|
||||
}
|
||||
|
||||
|
||||
void FormErrorList::update()
|
||||
{
|
||||
fl_set_form_title(dialog_->form, controller().name().c_str());
|
||||
updateContents();
|
||||
}
|
||||
|
||||
|
||||
ButtonPolicy::SMInput FormErrorList::input(FL_OBJECT * ob, long)
|
||||
{
|
||||
std::vector<ControlErrorList::ErrorItem> const &
|
||||
Errors = controller().ErrorList();
|
||||
|
||||
if (ob == dialog_->browser_errors) {
|
||||
//xforms return values 1..n
|
||||
int const choice = int(fl_get_browser(dialog_->browser_errors)) - 1;
|
||||
if (0 <= choice && choice < int(Errors.size())) {
|
||||
controller().goTo(choice);
|
||||
fl_set_input(dialog_->input_description,
|
||||
Errors[choice].description.c_str());
|
||||
}
|
||||
goTo(choice);
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
updateContents();
|
||||
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
|
||||
void FormErrorList::goTo(int where)
|
||||
{
|
||||
ErrorList const & errors = controller().errorList();
|
||||
|
||||
if (0 <= where && where < int(errors.size())) {
|
||||
controller().goTo(where);
|
||||
fl_set_input(dialog_->input_description,
|
||||
errors[where].description.c_str());
|
||||
setEnabled(dialog_->input_description, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FormErrorList::updateContents()
|
||||
{
|
||||
std::vector<ControlErrorList::ErrorItem> const &
|
||||
Errors = controller().ErrorList();
|
||||
fl_clear_browser(dialog_->browser_errors);
|
||||
|
||||
if (Errors.empty()) {
|
||||
fl_clear_browser(dialog_->browser_errors);
|
||||
ErrorList const & errors = controller().errorList();
|
||||
if (errors.empty()) {
|
||||
fl_add_browser_line(dialog_->browser_errors,
|
||||
_("*** No Lists ***").c_str());
|
||||
setEnabled(dialog_->browser_errors, false);
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int const topline =
|
||||
fl_get_browser_topline(dialog_->browser_errors);
|
||||
unsigned int const line = fl_get_browser(dialog_->browser_errors);
|
||||
|
||||
fl_clear_browser(dialog_->browser_errors);
|
||||
setEnabled(dialog_->browser_errors, true);
|
||||
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
cit = Errors.begin();
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
end = Errors.end();
|
||||
ErrorList::const_iterator cit = errors.begin();
|
||||
ErrorList::const_iterator end = errors.end();
|
||||
|
||||
for (; cit != end; ++cit) {
|
||||
fl_add_browser_line(dialog_->browser_errors,
|
||||
cit->error.c_str());
|
||||
}
|
||||
|
||||
fl_set_browser_topline(dialog_->browser_errors, topline);
|
||||
fl_select_browser_line(dialog_->browser_errors, line);
|
||||
fl_select_browser_line(dialog_->browser_errors, 1);
|
||||
goTo(1);
|
||||
}
|
||||
|
@ -1532,7 +1532,7 @@ int InsetText::docbook(Buffer const * buf, ostream & os, bool mixcont) const
|
||||
break;
|
||||
|
||||
case LATEX_COMMAND:
|
||||
buf->sgmlError(&*pit, 0, _("Error: LatexType Command not allowed here.\n"));
|
||||
buf->sgmlError(pit, 0, _("Error: LatexType Command not allowed here.\n"));
|
||||
return -1;
|
||||
break;
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "undo_funcs.h"
|
||||
#include "buffer.h"
|
||||
#include "bufferparams.h"
|
||||
#include "errorlist.h"
|
||||
#include "gettext.h"
|
||||
#include "BufferView.h"
|
||||
#include "CutAndPaste.h"
|
||||
@ -1406,10 +1407,15 @@ void LyXText::pasteSelection()
|
||||
ParagraphList::iterator endpit;
|
||||
PitPosPair ppp;
|
||||
|
||||
ErrorList el;
|
||||
|
||||
boost::tie(ppp, endpit) =
|
||||
CutAndPaste::pasteSelection(ownerParagraphs(),
|
||||
cursor.par(), cursor.pos(),
|
||||
bv()->buffer()->params.textclass);
|
||||
bv()->buffer()->params.textclass,
|
||||
el);
|
||||
bv()->setErrorList(el);
|
||||
bv()->showErrorList(_("Paste"));
|
||||
|
||||
redoParagraphs(cursor, endpit);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user