mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
the errorlist change
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6958 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e17caef19e
commit
3e2abfdd78
@ -467,48 +467,9 @@ bool BufferView::removeAutoInsets()
|
||||
}
|
||||
|
||||
|
||||
void BufferView::insertErrors(TeXErrors & terr)
|
||||
void BufferView::showErrorList()
|
||||
{
|
||||
// Save the cursor position
|
||||
LyXCursor cursor = text->cursor;
|
||||
|
||||
TeXErrors::Errors::const_iterator cit = terr.begin();
|
||||
TeXErrors::Errors::const_iterator end = terr.end();
|
||||
for (; cit != end; ++cit) {
|
||||
string const desctext(cit->error_desc);
|
||||
string const errortext(cit->error_text);
|
||||
string const msgtxt = desctext + '\n' + errortext;
|
||||
int const errorrow = cit->error_in_line;
|
||||
|
||||
// Insert error string for row number
|
||||
int tmpid = -1;
|
||||
int tmppos = -1;
|
||||
|
||||
if (buffer()->texrow.getIdFromRow(errorrow, tmpid, tmppos)) {
|
||||
buffer()->texrow.increasePos(tmpid, tmppos);
|
||||
}
|
||||
|
||||
Paragraph * texrowpar = 0;
|
||||
|
||||
if (tmpid == -1) {
|
||||
texrowpar = &*text->ownerParagraphs().begin();
|
||||
tmppos = 0;
|
||||
} else {
|
||||
texrowpar = &*buffer()->getParFromID(tmpid);
|
||||
}
|
||||
|
||||
if (texrowpar == 0)
|
||||
continue;
|
||||
|
||||
freezeUndo();
|
||||
InsetError * new_inset = new InsetError(msgtxt);
|
||||
text->setCursorIntern(texrowpar, tmppos);
|
||||
text->insertInset(new_inset);
|
||||
text->fullRebreak();
|
||||
unFreezeUndo();
|
||||
}
|
||||
// Restore the cursor position
|
||||
text->setCursorIntern(cursor.par(), cursor.pos());
|
||||
owner()->getDialogs().show("errorlist");
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,8 +153,8 @@ public:
|
||||
|
||||
/// removes all autodeletable insets
|
||||
bool removeAutoInsets();
|
||||
/// insert all errors found when running latex
|
||||
void insertErrors(TeXErrors & terr);
|
||||
/// show the error list to the user
|
||||
void showErrorList();
|
||||
/// set the cursor based on the given TeX source row
|
||||
void setCursorFromRow(int row);
|
||||
|
||||
|
@ -1,3 +1,9 @@
|
||||
2003-05-12 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* BufferView.[Ch] (insertErrors): removed
|
||||
* BufferView.[Ch] (showErrorList): added
|
||||
* buffer.C (runChkTeX):
|
||||
* converter.C (scanLog): call showErrorList instead of inserterrors
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -1977,7 +1977,7 @@ int Buffer::runChktex()
|
||||
_("Could not run chktex successfully."));
|
||||
} else if (res > 0) {
|
||||
// Insert all errors as errors boxes
|
||||
users->insertErrors(terr);
|
||||
users->showErrorList();
|
||||
}
|
||||
|
||||
// if we removed error insets before we ran chktex or if we inserted
|
||||
|
@ -459,58 +459,19 @@ bool Converters::formatIsUsed(string const & format)
|
||||
}
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
void alertErrors(string const & prog, int nr_errors)
|
||||
{
|
||||
string s;
|
||||
if (nr_errors == 1)
|
||||
s = bformat(_("One error detected when running %1$s.\n"), prog);
|
||||
else
|
||||
s = bformat(_("%1$s errors detected when running %2$s.\n"),
|
||||
prog, tostr(nr_errors));
|
||||
Alert::error(_("Errors found"), s);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool Converters::scanLog(Buffer const * buffer, string const & command,
|
||||
string const & filename)
|
||||
string const & filename)
|
||||
{
|
||||
if (!buffer)
|
||||
return false;
|
||||
|
||||
BufferView * bv = buffer->getUser();
|
||||
if (bv) {
|
||||
bv->owner()->busy(true);
|
||||
// all error insets should have been removed by now
|
||||
}
|
||||
|
||||
LaTeX latex("", filename, "");
|
||||
TeXErrors terr;
|
||||
int result = latex.scanLogFile(terr);
|
||||
if (bv) {
|
||||
if ((result & LaTeX::ERRORS)) {
|
||||
// Insert all errors as errors boxes
|
||||
bv->insertErrors(terr);
|
||||
#warning repaint() or update() or nothing ?
|
||||
bv->repaint();
|
||||
bv->fitCursor();
|
||||
}
|
||||
bv->owner()->busy(false);
|
||||
}
|
||||
if (bv && (result & LaTeX::ERRORS))
|
||||
bv->showErrorList();
|
||||
|
||||
if ((result & LaTeX::ERRORS)) {
|
||||
string head;
|
||||
split(command, head, ' ');
|
||||
alertErrors(head, latex.getNumErrors());
|
||||
return false;
|
||||
} else if (result & LaTeX::NO_OUTPUT) {
|
||||
Alert::warning(_("Output is empty"),
|
||||
_("An empty output file was generated."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -535,14 +496,9 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
int result = latex.run(terr,
|
||||
bv ? &bv->owner()->getLyXFunc() : 0);
|
||||
|
||||
if (bv) {
|
||||
if ((result & LaTeX::ERRORS)) {
|
||||
// Insert all errors as errors boxes
|
||||
bv->insertErrors(terr);
|
||||
#warning repaint() or update() or nothing ?
|
||||
bv->repaint();
|
||||
bv->fitCursor();
|
||||
}
|
||||
if (bv && (result & LaTeX::ERRORS)) {
|
||||
//show errors
|
||||
bv->showErrorList();
|
||||
}
|
||||
|
||||
// check return value from latex.run().
|
||||
@ -550,9 +506,7 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
|
||||
string str = bformat(_("LaTeX did not run successfully. Additionally, LyX "
|
||||
"could not locate the LaTeX log %1$s."), name);
|
||||
Alert::error(_("LaTeX failed"), str);
|
||||
} else if ((result & LaTeX::ERRORS)) {
|
||||
alertErrors("LaTeX", latex.getNumErrors());
|
||||
} else if (result & LaTeX::NO_OUTPUT) {
|
||||
} else if (result & LaTeX::NO_OUTPUT) {
|
||||
Alert::warning(_("Output is empty"),
|
||||
_("An empty output file was generated."));
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-05-12 Alfredo Braunstein: <abraunst@libero.it>
|
||||
|
||||
* ControlErrorList.[Ch]: added
|
||||
* Makefile.am: the above adittion
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
136
src/frontends/controllers/ControlErrorList.C
Normal file
136
src/frontends/controllers/ControlErrorList.C
Normal file
@ -0,0 +1,136 @@
|
||||
/**
|
||||
* \file ControlErrorList.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 "ControlErrorList.h"
|
||||
#include "support/lstrings.h" // tostr
|
||||
#include "LaTeX.h"
|
||||
#include "buffer.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxtext.h"
|
||||
|
||||
|
||||
|
||||
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)
|
||||
{}
|
||||
|
||||
|
||||
void ControlErrorList::clearParams()
|
||||
{
|
||||
logfilename_.clear();
|
||||
clearErrors();
|
||||
}
|
||||
|
||||
|
||||
std::vector<ControlErrorList::ErrorItem> const &
|
||||
ControlErrorList::ErrorList() const
|
||||
{
|
||||
return ErrorList_;
|
||||
}
|
||||
|
||||
|
||||
int ControlErrorList::currentItem() const
|
||||
{
|
||||
return current_;
|
||||
}
|
||||
|
||||
|
||||
bool ControlErrorList::initialiseParams(string const &)
|
||||
{
|
||||
logfilename_ = kernel().buffer()->getLogName().second;
|
||||
clearErrors();
|
||||
fillErrors();
|
||||
current_ = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ControlErrorList::clearErrors()
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
void ControlErrorList::goTo(int item)
|
||||
{
|
||||
BufferView * const bv = kernel().bufferview();
|
||||
Buffer * const buf = kernel().buffer();
|
||||
|
||||
current_ = item;
|
||||
|
||||
ControlErrorList::ErrorItem const & err = ErrorList_[item];
|
||||
|
||||
|
||||
if (err.par_id == -1)
|
||||
return;
|
||||
|
||||
ParagraphList::iterator pit = buf->getParFromID(err.par_id);
|
||||
|
||||
if (pit == bv->text->ownerParagraphs().end()) {
|
||||
cout << "par id not found" << endl;
|
||||
return;
|
||||
}
|
||||
|
||||
int range = err.pos_end - err.pos_start;
|
||||
|
||||
if (err.pos_end > pit->size() || range <= 0)
|
||||
range = pit->size() - err.pos_start;
|
||||
|
||||
//now make the selection
|
||||
bv->insetUnlock();
|
||||
bv->toggleSelection();
|
||||
bv->text->clearSelection();
|
||||
bv->text->setCursor(pit, err.pos_start);
|
||||
bv->text->setSelectionRange(range);
|
||||
bv->toggleSelection(false);
|
||||
bv->fitCursor();
|
||||
bv->update(bv->text, BufferView::SELECT);
|
||||
}
|
68
src/frontends/controllers/ControlErrorList.h
Normal file
68
src/frontends/controllers/ControlErrorList.h
Normal file
@ -0,0 +1,68 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file ControlErrorList.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
|
||||
*/
|
||||
|
||||
#ifndef CONTROLERRORLIST_H
|
||||
#define CONTROLERRORLIST_H
|
||||
|
||||
|
||||
#include "Dialog.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
||||
/** A controller for the ErrorList dialog.
|
||||
*/
|
||||
|
||||
|
||||
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);
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
///
|
||||
virtual bool initialiseParams(const string & params);
|
||||
///
|
||||
virtual void ControlErrorList::clearParams();
|
||||
///
|
||||
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();
|
||||
///
|
||||
std::vector<ErrorItem> const & ErrorList() const;
|
||||
private:
|
||||
///
|
||||
std::vector<ErrorItem> ErrorList_;
|
||||
///
|
||||
string logfilename_;
|
||||
///
|
||||
int current_;
|
||||
};
|
||||
|
||||
#endif // CONTROLERRORLIST_H
|
@ -50,6 +50,8 @@ libcontrollers_la_SOURCES= \
|
||||
ControlDocument.h \
|
||||
ControlError.C \
|
||||
ControlError.h \
|
||||
ControlErrorList.C \
|
||||
ControlErrorList.h \
|
||||
ControlERT.C \
|
||||
ControlERT.h \
|
||||
ControlExternal.C \
|
||||
|
@ -1,3 +1,10 @@
|
||||
2003-05-12 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* QErrorList.[Ch]:
|
||||
* QErrorListDialog.[Ch]: added
|
||||
* Makefile.dialogs:
|
||||
* Makefile.am: the above additions
|
||||
* Dialogs.C: ditto
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@lyx.org>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
@ -42,6 +43,7 @@
|
||||
#include "QCharacter.h"
|
||||
#include "QCitation.h"
|
||||
#include "QError.h"
|
||||
#include "QErrorList.h"
|
||||
#include "QERT.h"
|
||||
#include "QExternal.h"
|
||||
#include "QFloat.h"
|
||||
@ -77,9 +79,9 @@
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
|
||||
"character", "citation", "error", "ert", "external", "file", "float",
|
||||
"graphics", "include", "index", "label", "log", "minipage", "paragraph",
|
||||
"ref", "tabular", "tabularcreate",
|
||||
"character", "citation", "error", "errorlist", "ert", "external", "file",
|
||||
"float", "graphics", "include", "index", "label", "log", "minipage",
|
||||
"paragraph", "ref", "tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
@ -146,6 +148,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlError(*dialog));
|
||||
dialog->setView(new QError(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "errorlist") {
|
||||
dialog->setController(new ControlErrorList(*dialog));
|
||||
dialog->setView(new QErrorList(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new QERT(*dialog));
|
||||
|
@ -35,6 +35,7 @@ libqt2_la_SOURCES = \
|
||||
QCitation.C QCitation.h \
|
||||
QDocument.C QDocument.h \
|
||||
QError.C QError.h \
|
||||
QErrorList.C QErrorList.h \
|
||||
QERT.C QERT.h \
|
||||
QExternal.C QExternal.h \
|
||||
QFloat.C QFloat.h \
|
||||
|
@ -23,6 +23,7 @@ UIFILES = \
|
||||
QDelimiterDialogBase.ui \
|
||||
QDocumentDialogBase.ui \
|
||||
QErrorDialogBase.ui \
|
||||
QErrorListDialogBase.ui \
|
||||
QERTDialogBase.ui \
|
||||
QExternalDialogBase.ui \
|
||||
QFloatDialogBase.ui \
|
||||
@ -87,6 +88,7 @@ MOCFILES = \
|
||||
QDelimiterDialog.C QDelimiterDialog.h \
|
||||
QDocumentDialog.C QDocumentDialog.h \
|
||||
QErrorDialog.C QErrorDialog.h \
|
||||
QErrorListDialog.C QErrorListDialog.h \
|
||||
QERTDialog.C QERTDialog.h \
|
||||
QExternalDialog.C QExternalDialog.h \
|
||||
QFloatDialog.C QFloatDialog.h \
|
||||
|
68
src/frontends/qt2/QErrorList.C
Normal file
68
src/frontends/qt2/QErrorList.C
Normal file
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* \file QErrorList.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 "LyXView.h"
|
||||
#include "qt_helpers.h"
|
||||
#include "support/lstrings.h"
|
||||
#include "debug.h"
|
||||
|
||||
#include "ControlErrorList.h"
|
||||
#include "QErrorList.h"
|
||||
#include "QErrorListDialog.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
#include <qlistbox.h>
|
||||
#include <qtextbrowser.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
typedef QController<ControlErrorList, QView<QErrorListDialog> > base_class;
|
||||
|
||||
QErrorList::QErrorList(Dialog & parent)
|
||||
: base_class(parent, qt_("LyX: LaTeX error list"))
|
||||
{}
|
||||
|
||||
|
||||
void QErrorList::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QErrorListDialog(this));
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
}
|
||||
|
||||
|
||||
void QErrorList::select(int item)
|
||||
{
|
||||
controller().goTo(item);
|
||||
dialog_->descriptionTB->setText(controller().ErrorList()[item].description);
|
||||
}
|
||||
|
||||
|
||||
void QErrorList::update_contents()
|
||||
{
|
||||
string const caption = string(_("LyX: LaTex error List")) + '(' +
|
||||
controller().docName() + ')';
|
||||
|
||||
dialog_->setCaption(qt_(caption));
|
||||
dialog_->errorsLB->clear();
|
||||
dialog_->descriptionTB->clear();
|
||||
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
it = controller().ErrorList().begin();
|
||||
std::vector<ControlErrorList::ErrorItem>::const_iterator
|
||||
end = controller().ErrorList().end();
|
||||
for(; it != end; ++it) {
|
||||
QListBoxItem * error = new QListBoxText(dialog_->errorsLB,
|
||||
toqstr(it->error));
|
||||
}
|
||||
|
||||
dialog_->errorsLB->setSelected(controller().currentItem(), true);
|
||||
}
|
||||
|
41
src/frontends/qt2/QErrorList.h
Normal file
41
src/frontends/qt2/QErrorList.h
Normal file
@ -0,0 +1,41 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QErrorList.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
|
||||
*/
|
||||
|
||||
#ifndef QERRORLIST_H
|
||||
#define QERRORLIST_H
|
||||
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlErrorList;
|
||||
class QErrorListDialog;
|
||||
|
||||
class QErrorList :
|
||||
public QController<ControlErrorList, QView<QErrorListDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QErrorListDialog;
|
||||
|
||||
QErrorList(Dialog &);
|
||||
private:
|
||||
/// select an entry
|
||||
void select(int item);
|
||||
/// required apply
|
||||
virtual void apply() {}
|
||||
/// build dialog
|
||||
virtual void build_dialog();
|
||||
/// update contents
|
||||
virtual void update_contents();
|
||||
/// run latex
|
||||
void runLaTeX();
|
||||
};
|
||||
|
||||
#endif // QERRORLIST_H
|
47
src/frontends/qt2/QErrorListDialog.C
Normal file
47
src/frontends/qt2/QErrorListDialog.C
Normal file
@ -0,0 +1,47 @@
|
||||
/**
|
||||
* \file QErrorListDialog.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 "QErrorList.h"
|
||||
#include "QErrorListDialog.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <qlistbox.h>
|
||||
#include <qtextedit.h>
|
||||
#include <qtextbrowser.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
|
||||
QErrorListDialog::QErrorListDialog(QErrorList * form)
|
||||
: QErrorListDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
QErrorListDialog::~QErrorListDialog()
|
||||
{}
|
||||
|
||||
|
||||
void QErrorListDialog::select_adaptor(int item)
|
||||
{
|
||||
form_->select(item);
|
||||
}
|
||||
|
||||
|
||||
void QErrorListDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
33
src/frontends/qt2/QErrorListDialog.h
Normal file
33
src/frontends/qt2/QErrorListDialog.h
Normal file
@ -0,0 +1,33 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QErrorListDialog.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
|
||||
*/
|
||||
|
||||
#ifndef QERRORLISTDIALOG_H
|
||||
#define QERRORLISTDIALOG_H
|
||||
|
||||
|
||||
#include "ui/QErrorListDialogBase.h"
|
||||
|
||||
class QErrorList;
|
||||
|
||||
class QErrorListDialog : public QErrorListDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QErrorListDialog(QErrorList * form);
|
||||
~QErrorListDialog();
|
||||
public slots:
|
||||
void select_adaptor(int);
|
||||
protected:
|
||||
void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QErrorList * form_;
|
||||
};
|
||||
|
||||
#endif // QTOCERRORLIST_H
|
103
src/frontends/qt2/ui/QErrorListDialogBase.ui
Normal file
103
src/frontends/qt2/ui/QErrorListDialogBase.ui
Normal file
@ -0,0 +1,103 @@
|
||||
<!DOCTYPE UI><UI>
|
||||
<class>QErrorListDialogBase</class>
|
||||
<include location="global">config.h</include>
|
||||
<include location="local">qt_helpers.h</include>
|
||||
<widget>
|
||||
<class>QDialog</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>QErrorListDialogBase</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>349</width>
|
||||
<height>367</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>caption</name>
|
||||
<string>Form1</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizeGripEnabled</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<grid>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget row="0" column="0" rowspan="1" colspan="2" >
|
||||
<class>QListBox</class>
|
||||
<item>
|
||||
<property>
|
||||
<name>text</name>
|
||||
<string>New Item</string>
|
||||
</property>
|
||||
</item>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>errorsLB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget row="2" column="1" >
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>closePB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="2" column="0" >
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer1</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>orientation</name>
|
||||
<enum>Horizontal</enum>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizeType</name>
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property>
|
||||
<name>sizeHint</name>
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget row="1" column="0" rowspan="1" colspan="2" >
|
||||
<class>QTextBrowser</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>descriptionTB</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>errorsLB</sender>
|
||||
<signal>highlighted(int)</signal>
|
||||
<receiver>QErrorListDialogBase</receiver>
|
||||
<slot>select_adaptor(int)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>close_adaptor()</slot>
|
||||
<slot>select_adaptor(int)</slot>
|
||||
</slots>
|
||||
</UI>
|
@ -1,3 +1,10 @@
|
||||
2003-05-12 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* FormErrorList.[Ch]:
|
||||
* forms/form_errorlist.fd: added
|
||||
* forms/Makefile.am:
|
||||
* Makefile.am: the above additions
|
||||
* Dialogs.C: ditto
|
||||
|
||||
2003-05-13 André Pönitz <poenitz@gmx.net>
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlCommand.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
#include "ControlFloat.h"
|
||||
@ -45,6 +46,7 @@
|
||||
#include "FormCharacter.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormError.h"
|
||||
#include "FormErrorList.h"
|
||||
#include "FormERT.h"
|
||||
#include "FormExternal.h"
|
||||
#include "FormFloat.h"
|
||||
@ -74,10 +76,7 @@
|
||||
|
||||
namespace {
|
||||
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
|
||||
"character", "citation", "error", "ert", "external", "file", "float",
|
||||
"graphics", "include", "index", "label", "log", "minipage", "paragraph",
|
||||
"ref", "tabular", "tabularcreate",
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes", "character", "citation", "error", "errorlist" , "ert", "external", "file", "float", "graphics", "include", "index", "label", "log", "minipage", "paragraph", "ref", "tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
@ -144,6 +143,10 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlError(*dialog));
|
||||
dialog->setView(new FormError(*dialog));
|
||||
dialog->bc().bp(new OkCancelPolicy);
|
||||
} else if (name == "errorlist") {
|
||||
dialog->setController(new ControlErrorList(*dialog));
|
||||
dialog->setView(new FormErrorList(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "ert") {
|
||||
dialog->setController(new ControlERT(*dialog));
|
||||
dialog->setView(new FormERT(*dialog));
|
||||
|
107
src/frontends/xforms/FormErrorList.C
Normal file
107
src/frontends/xforms/FormErrorList.C
Normal file
@ -0,0 +1,107 @@
|
||||
/**
|
||||
* \file FormErrorList.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 "FormErrorList.h"
|
||||
#include "xformsBC.h"
|
||||
#include "xforms_helpers.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "forms/form_errorlist.h"
|
||||
#include "support/lstrings.h" // frontStrip, strip
|
||||
#include "debug.h"
|
||||
#include "gettext.h"
|
||||
#include FORMS_H_LOCATION
|
||||
|
||||
#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"))
|
||||
{}
|
||||
|
||||
|
||||
void FormErrorList::build()
|
||||
{
|
||||
dialog_.reset(build_errorlist(this));
|
||||
|
||||
// Manage the cancel/close button
|
||||
bcview().setCancel(dialog_->button_close);
|
||||
bcview().addReadOnly(dialog_->browser_errors);
|
||||
}
|
||||
|
||||
|
||||
void FormErrorList::update()
|
||||
{
|
||||
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());
|
||||
}
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
updateContents();
|
||||
|
||||
return ButtonPolicy::SMI_VALID;
|
||||
}
|
||||
|
||||
|
||||
void FormErrorList::updateContents()
|
||||
{
|
||||
std::vector<ControlErrorList::ErrorItem> const &
|
||||
Errors = controller().ErrorList();
|
||||
|
||||
if (Errors.empty()) {
|
||||
fl_clear_browser(dialog_->browser_errors);
|
||||
fl_add_browser_line(dialog_->browser_errors,
|
||||
_("*** No Lists ***"));
|
||||
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();
|
||||
|
||||
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);
|
||||
}
|
41
src/frontends/xforms/FormErrorList.h
Normal file
41
src/frontends/xforms/FormErrorList.h
Normal file
@ -0,0 +1,41 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FormErrorList.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
|
||||
*/
|
||||
|
||||
#ifndef FORMERRORLIST_H
|
||||
#define FORMERRORLIST_H
|
||||
|
||||
|
||||
#include "FormDialogView.h"
|
||||
|
||||
class ControlErrorList;
|
||||
struct FD_errorlist;
|
||||
|
||||
/** This class provides an XForms implementation of the FormErrorList Dialog.
|
||||
*/
|
||||
class FormErrorList : public FormController<ControlErrorList, FormView<FD_errorlist> > {
|
||||
public:
|
||||
///
|
||||
FormErrorList(Dialog &);
|
||||
private:
|
||||
/// not needed
|
||||
virtual void apply() {}
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// Update dialog before showing it
|
||||
virtual void update();
|
||||
/// Filter the inputs on callback from xforms
|
||||
virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
|
||||
|
||||
///
|
||||
void updateContents();
|
||||
};
|
||||
|
||||
#endif // FORMERRORLIST_H
|
@ -79,6 +79,8 @@ libxforms_la_SOURCES = \
|
||||
FormDocument.h \
|
||||
FormError.C \
|
||||
FormError.h \
|
||||
FormErrorList.C \
|
||||
FormErrorList.h \
|
||||
FormERT.C \
|
||||
FormERT.h \
|
||||
FormExternal.C \
|
||||
|
@ -18,6 +18,7 @@ SRCS = form_aboutlyx.fd \
|
||||
form_citation.fd \
|
||||
form_document.fd \
|
||||
form_error.fd \
|
||||
form_errorlist.fd \
|
||||
form_ert.fd \
|
||||
form_external.fd \
|
||||
form_filedialog.fd \
|
||||
|
89
src/frontends/xforms/forms/form_errorlist.fd
Normal file
89
src/frontends/xforms/forms/form_errorlist.fd
Normal file
@ -0,0 +1,89 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
SnapGrid: 5
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_errorlist
|
||||
Width: 380
|
||||
Height: 295
|
||||
Number of Objects: 4
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: FLAT_BOX
|
||||
box: 0 0 380 295
|
||||
boxtype: FL_FLAT_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name:
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BROWSER
|
||||
type: HOLD_BROWSER
|
||||
box: 10 10 360 110
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_YELLOW
|
||||
alignment: FL_ALIGN_BOTTOM
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NorthWest FL_SouthEast
|
||||
name: browser_errors
|
||||
callback: C_FormDialogView_InputCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: NORMAL_BUTTON
|
||||
box: 280 260 90 25
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_NORMAL_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Close|^[^M
|
||||
shortcut:
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_SouthEast FL_SouthEast
|
||||
name: button_close
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
--------------------
|
||||
class: FL_INPUT
|
||||
type: MULTILINE_INPUT
|
||||
box: 10 125 360 130
|
||||
boxtype: FL_DOWN_BOX
|
||||
colors: FL_COL1 FL_MCOL
|
||||
alignment: FL_ALIGN_LEFT
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label:
|
||||
shortcut:
|
||||
resize: FL_RESIZE_ALL
|
||||
gravity: FL_NoGravity FL_NoGravity
|
||||
name: input_description
|
||||
callback:
|
||||
argument:
|
||||
|
||||
==============================
|
||||
create_the_forms
|
Loading…
Reference in New Issue
Block a user