mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
The error boxes are no more! See also Bug: 192, Bug: 807, Bug: 899 and Bug: 973
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7201 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
ffb610695f
commit
74aaf64a53
@ -1,3 +1,8 @@
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* ControlError.[Ch]: removed
|
||||
* Makefile.am: adjust
|
||||
|
||||
2003-06-20 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* tex_helpers.[Ch] (getTexFileList): changed to
|
||||
|
@ -1,30 +0,0 @@
|
||||
/**
|
||||
* \file ControlError.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "ControlError.h"
|
||||
|
||||
|
||||
ControlError::ControlError(Dialog & parent)
|
||||
: Dialog::Controller(parent)
|
||||
{}
|
||||
|
||||
|
||||
bool ControlError::initialiseParams(string const & data)
|
||||
{
|
||||
params_ = data;
|
||||
}
|
||||
|
||||
|
||||
void ControlError::clearParams()
|
||||
{
|
||||
params_.erase();
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file ControlError.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef CONTROLERROR_H
|
||||
#define CONTROLERROR_H
|
||||
|
||||
|
||||
#include "Dialog.h"
|
||||
|
||||
|
||||
class ControlError : public Dialog::Controller {
|
||||
public:
|
||||
///
|
||||
ControlError(Dialog &);
|
||||
///
|
||||
virtual bool initialiseParams(string const & data);
|
||||
///
|
||||
virtual void clearParams();
|
||||
///
|
||||
virtual void dispatchParams() {}
|
||||
///
|
||||
virtual bool isBufferDependent() const { return true; }
|
||||
///
|
||||
string & params() { return params_; }
|
||||
///
|
||||
string const & params() const { return params_; }
|
||||
///
|
||||
private:
|
||||
string params_;
|
||||
};
|
||||
|
||||
#endif // CONTROLERROR_H
|
@ -48,8 +48,6 @@ libcontrollers_la_SOURCES= \
|
||||
ControlDialog_impl.h \
|
||||
ControlDocument.C \
|
||||
ControlDocument.h \
|
||||
ControlError.C \
|
||||
ControlError.h \
|
||||
ControlErrorList.C \
|
||||
ControlErrorList.h \
|
||||
ControlERT.C \
|
||||
|
@ -1,3 +1,11 @@
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* QError.[Ch]:
|
||||
* QErrorDialog.[Ch]:
|
||||
* ui/QErrorDialogBase.ui: removed
|
||||
* Makefile.am:
|
||||
* Makefile.dialogs:
|
||||
* Dialogs.C: adjust
|
||||
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "ControlChanges.h"
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
@ -44,7 +43,6 @@
|
||||
#include "QChanges.h"
|
||||
#include "QCharacter.h"
|
||||
#include "QCitation.h"
|
||||
#include "QError.h"
|
||||
#include "QErrorList.h"
|
||||
#include "QERT.h"
|
||||
#include "QExternal.h"
|
||||
@ -149,10 +147,6 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new QCitation(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "error") {
|
||||
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));
|
||||
|
@ -34,7 +34,6 @@ libqt2_la_SOURCES = \
|
||||
QCharacter.C QCharacter.h \
|
||||
QCitation.C QCitation.h \
|
||||
QDocument.C QDocument.h \
|
||||
QError.C QError.h \
|
||||
QErrorList.C QErrorList.h \
|
||||
QERT.C QERT.h \
|
||||
QExternal.C QExternal.h \
|
||||
|
@ -22,7 +22,6 @@ UIFILES = \
|
||||
QCitationFindDialogBase.ui \
|
||||
QDelimiterDialogBase.ui \
|
||||
QDocumentDialogBase.ui \
|
||||
QErrorDialogBase.ui \
|
||||
QErrorListDialogBase.ui \
|
||||
QERTDialogBase.ui \
|
||||
QExternalDialogBase.ui \
|
||||
@ -87,7 +86,6 @@ MOCFILES = \
|
||||
QContentPane.C QContentPane.h \
|
||||
QDelimiterDialog.C QDelimiterDialog.h \
|
||||
QDocumentDialog.C QDocumentDialog.h \
|
||||
QErrorDialog.C QErrorDialog.h \
|
||||
QErrorListDialog.C QErrorListDialog.h \
|
||||
QERTDialog.C QERTDialog.h \
|
||||
QExternalDialog.C QExternalDialog.h \
|
||||
|
@ -1,44 +0,0 @@
|
||||
/**
|
||||
* \file QError.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlError.h"
|
||||
#include "qt_helpers.h"
|
||||
|
||||
#include <qtextview.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include "QErrorDialog.h"
|
||||
#include "QError.h"
|
||||
#include "Qt2BC.h"
|
||||
|
||||
typedef QController<ControlError, QView<QErrorDialog> > base_class;
|
||||
|
||||
|
||||
QError::QError(Dialog & parent)
|
||||
: base_class(parent, _("LyX: LaTeX Error"))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QError::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QErrorDialog(this));
|
||||
|
||||
bcview().setCancel(dialog_->closePB);
|
||||
}
|
||||
|
||||
|
||||
void QError::update_contents()
|
||||
{
|
||||
dialog_->errorTV->setText(toqstr(controller().params()));
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QError.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef QERROR_H
|
||||
#define QERROR_H
|
||||
|
||||
|
||||
#include "QDialogView.h"
|
||||
|
||||
class ControlError;
|
||||
class QErrorDialog;
|
||||
|
||||
|
||||
class QError
|
||||
: public QController<ControlError, QView<QErrorDialog> >
|
||||
{
|
||||
public:
|
||||
friend class QErrorDialog;
|
||||
|
||||
QError(Dialog &);
|
||||
private:
|
||||
/// Apply changes
|
||||
virtual void apply() {}
|
||||
/// update
|
||||
virtual void update_contents();
|
||||
/// build the dialog
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
#endif // QERROR_H
|
@ -1,35 +0,0 @@
|
||||
/**
|
||||
* \file QErrorDialog.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "QError.h"
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qpushbutton.h>
|
||||
|
||||
#include "QErrorDialog.h"
|
||||
|
||||
|
||||
QErrorDialog::QErrorDialog(QError * form)
|
||||
: QErrorDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
connect(closePB, SIGNAL(clicked()),
|
||||
form, SLOT(slotClose()));
|
||||
}
|
||||
|
||||
|
||||
void QErrorDialog::closeEvent(QCloseEvent * e)
|
||||
{
|
||||
form_->slotWMHide();
|
||||
e->accept();
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file QErrorDialog.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author John Levon
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef QERRORDIALOG_H
|
||||
#define QERRORDIALOG_H
|
||||
|
||||
|
||||
#include "ui/QErrorDialogBase.h"
|
||||
|
||||
class QError;
|
||||
|
||||
class QErrorDialog : public QErrorDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QErrorDialog(QError * form);
|
||||
protected:
|
||||
virtual void closeEvent(QCloseEvent * e);
|
||||
private:
|
||||
QError * form_;
|
||||
};
|
||||
|
||||
#endif // QERRORDIALOG_H
|
@ -1,106 +0,0 @@
|
||||
<!DOCTYPE UI><UI>
|
||||
<class>QErrorDialogBase</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>QErrorDialogBase</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>geometry</name>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>356</width>
|
||||
<height>236</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>caption</name>
|
||||
<string>LaTeX Error</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>sizeGripEnabled</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<vbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget>
|
||||
<class>QTextView</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>errorTV</cstring>
|
||||
</property>
|
||||
<property>
|
||||
<name>toolTip</name>
|
||||
<string>LaTeX error messages</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget>
|
||||
<class>QLayoutWidget</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>Layout3</cstring>
|
||||
</property>
|
||||
<hbox>
|
||||
<property stdset="1">
|
||||
<name>margin</name>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>spacing</name>
|
||||
<number>6</number>
|
||||
</property>
|
||||
<spacer>
|
||||
<property>
|
||||
<name>name</name>
|
||||
<cstring>Spacer3</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>
|
||||
<class>QPushButton</class>
|
||||
<property stdset="1">
|
||||
<name>name</name>
|
||||
<cstring>closePB</cstring>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>text</name>
|
||||
<string>&Close</string>
|
||||
</property>
|
||||
<property stdset="1">
|
||||
<name>default</name>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<connections>
|
||||
<slot access="public">change_adaptor()</slot>
|
||||
</connections>
|
||||
</UI>
|
@ -1,3 +1,11 @@
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* FormError.[Ch]:
|
||||
* forms/form_error.fd: removed
|
||||
* forms/Makefile.am:
|
||||
* Makefile.am: adjust
|
||||
* Dialogs.C: adjust
|
||||
|
||||
2003-06-20 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* FormBibtex.C (input, update): changes due to changed controller
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "ControlCharacter.h"
|
||||
#include "ControlCitation.h"
|
||||
#include "ControlCommand.h"
|
||||
#include "ControlError.h"
|
||||
#include "ControlErrorList.h"
|
||||
#include "ControlERT.h"
|
||||
#include "ControlExternal.h"
|
||||
@ -47,7 +46,6 @@
|
||||
#include "FormChanges.h"
|
||||
#include "FormCharacter.h"
|
||||
#include "FormCitation.h"
|
||||
#include "FormError.h"
|
||||
#include "FormErrorList.h"
|
||||
#include "FormERT.h"
|
||||
#include "FormExternal.h"
|
||||
@ -179,10 +177,6 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlCitation(*dialog));
|
||||
dialog->setView(new FormCitation(*dialog));
|
||||
dialog->bc().bp(new NoRepeatedApplyReadOnlyPolicy);
|
||||
} else if (name == "error") {
|
||||
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));
|
||||
|
@ -1,42 +0,0 @@
|
||||
/**
|
||||
* \file FormError.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "xformsBC.h"
|
||||
#include "ControlError.h"
|
||||
#include "FormError.h"
|
||||
#include "forms/form_error.h"
|
||||
#include "xforms_helpers.h" // formatted
|
||||
#include "lyx_forms.h"
|
||||
|
||||
typedef FormController<ControlError, FormView<FD_error> > base_class;
|
||||
|
||||
FormError::FormError(Dialog & parent)
|
||||
: base_class(parent, _("LaTeX Error"))
|
||||
{}
|
||||
|
||||
|
||||
void FormError::build()
|
||||
{
|
||||
dialog_.reset(build_error(this));
|
||||
|
||||
// Manage the cancel/close button
|
||||
bcview().setCancel(dialog_->button_close);
|
||||
}
|
||||
|
||||
|
||||
void FormError::update()
|
||||
{
|
||||
string const txt = formatted(controller().params(),
|
||||
dialog_->frame_message->w - 10);
|
||||
fl_set_object_label(dialog_->frame_message, txt.c_str());
|
||||
}
|
@ -1,37 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file FormError.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Angus Leeming
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef FORMERROR_H
|
||||
#define FORMERROR_H
|
||||
|
||||
|
||||
#include "FormDialogView.h"
|
||||
|
||||
|
||||
class ControlError;
|
||||
struct FD_error;
|
||||
|
||||
/** This class provides an XForms implementation of the Error Dialog.
|
||||
*/
|
||||
class FormError : public FormController<ControlError, FormView<FD_error> > {
|
||||
public:
|
||||
/// Constructor
|
||||
FormError(Dialog &);
|
||||
private:
|
||||
/// not needed.
|
||||
virtual void apply() {}
|
||||
/// Build the dialog
|
||||
virtual void build();
|
||||
/// Update dialog before showing it
|
||||
virtual void update();
|
||||
};
|
||||
|
||||
#endif // FORMERROR_H
|
@ -79,8 +79,6 @@ libxforms_la_SOURCES = \
|
||||
FormCitation.h \
|
||||
FormDocument.C \
|
||||
FormDocument.h \
|
||||
FormError.C \
|
||||
FormError.h \
|
||||
FormErrorList.C \
|
||||
FormErrorList.h \
|
||||
FormERT.C \
|
||||
|
@ -17,7 +17,6 @@ SRCS = form_aboutlyx.fd \
|
||||
form_character.fd \
|
||||
form_citation.fd \
|
||||
form_document.fd \
|
||||
form_error.fd \
|
||||
form_errorlist.fd \
|
||||
form_ert.fd \
|
||||
form_external.fd \
|
||||
|
@ -1,70 +0,0 @@
|
||||
Magic: 13000
|
||||
|
||||
Internal Form Definition File
|
||||
(do not change)
|
||||
|
||||
Number of forms: 1
|
||||
Unit of measure: FL_COORD_PIXEL
|
||||
|
||||
=============== FORM ===============
|
||||
Name: form_error
|
||||
Width: 400
|
||||
Height: 240
|
||||
Number of Objects: 3
|
||||
|
||||
--------------------
|
||||
class: FL_BOX
|
||||
type: UP_BOX
|
||||
box: 0 0 400 240
|
||||
boxtype: FL_UP_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_BOX
|
||||
type: FRAME_BOX
|
||||
box: 10 10 380 180
|
||||
boxtype: FL_FRAME_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_NorthWest FL_SouthEast
|
||||
name: frame_message
|
||||
callback:
|
||||
argument:
|
||||
|
||||
--------------------
|
||||
class: FL_BUTTON
|
||||
type: RETURN_BUTTON
|
||||
box: 135 200 130 30
|
||||
boxtype: FL_UP_BOX
|
||||
colors: FL_COL1 FL_COL1
|
||||
alignment: FL_ALIGN_CENTER
|
||||
style: FL_NORMAL_STYLE
|
||||
size: FL_DEFAULT_SIZE
|
||||
lcol: FL_BLACK
|
||||
label: Close|^[
|
||||
shortcut: ^M
|
||||
resize: FL_RESIZE_NONE
|
||||
gravity: FL_South FL_South
|
||||
name: button_close
|
||||
callback: C_FormDialogView_CancelCB
|
||||
argument: 0
|
||||
|
||||
==============================
|
||||
create_the_forms
|
@ -1,3 +1,7 @@
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* inseterror.[Ch]: removed
|
||||
|
||||
2003-06-21 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
* insetinclude.C (docbook): use parseError instead of sgmlError
|
||||
|
@ -39,8 +39,6 @@ libinsets_la_SOURCES = \
|
||||
insetcommandparams.h \
|
||||
insetenv.C \
|
||||
insetenv.h \
|
||||
inseterror.C \
|
||||
inseterror.h \
|
||||
insetert.C \
|
||||
insetert.h \
|
||||
insetexternal.C \
|
||||
|
@ -1,96 +0,0 @@
|
||||
/**
|
||||
* \file inseterror.C
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "inseterror.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "funcrequest.h"
|
||||
#include "gettext.h"
|
||||
#include "lyxfont.h"
|
||||
#include "metricsinfo.h"
|
||||
|
||||
#include "frontends/Dialogs.h"
|
||||
#include "frontends/font_metrics.h"
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Painter.h"
|
||||
|
||||
#include "support/LAssert.h"
|
||||
|
||||
using std::ostream;
|
||||
|
||||
|
||||
InsetError::InsetError(string const & str)
|
||||
: contents(str)
|
||||
{}
|
||||
|
||||
|
||||
// InsetError::InsetError(string const & str, bool)
|
||||
// : contents(str)
|
||||
// {}
|
||||
|
||||
|
||||
InsetError::~InsetError()
|
||||
{
|
||||
Dialogs::hide("error", this);
|
||||
}
|
||||
|
||||
|
||||
dispatch_result InsetError::localDispatch(FuncRequest const & cmd)
|
||||
{
|
||||
// UNUSED: dispatch_result result = UNDISPATCHED;
|
||||
|
||||
switch (cmd.action) {
|
||||
case LFUN_MOUSE_RELEASE:
|
||||
case LFUN_INSET_EDIT:
|
||||
cmd.view()->owner()->getDialogs().show("error", getContents(), this);
|
||||
return DISPATCHED;
|
||||
|
||||
default:
|
||||
return Inset::localDispatch(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void InsetError::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
LyXFont efont;
|
||||
efont.setSize(mi.base.font.size()).decSize();
|
||||
dim_.asc = font_metrics::maxAscent(efont) + 1;
|
||||
dim_.des = font_metrics::maxDescent(efont) + 1;
|
||||
dim_.wid = 6 + font_metrics::width(_("Error"), efont);
|
||||
dim = dim_;
|
||||
}
|
||||
|
||||
|
||||
void InsetError::draw(PainterInfo & pi, int x, int y) const
|
||||
{
|
||||
lyx::Assert(pi.base.bv);
|
||||
cache(pi.base.bv);
|
||||
|
||||
LyXFont efont;
|
||||
efont.setSize(pi.base.font.size()).decSize();
|
||||
efont.setColor(LColor::error);
|
||||
|
||||
// Draw as "Error" in a framed box
|
||||
x += 1;
|
||||
pi.pain.fillRectangle(x, y - dim_.asc + 1,
|
||||
dim_.wid - 2, dim_.asc + dim_.des - 2, LColor::insetbg);
|
||||
pi.pain.rectangle(x, y - dim_.asc + 1,
|
||||
dim_.wid - 2, dim_.asc + dim_.des - 2, LColor::error);
|
||||
pi.pain.text(x + 2, y, _("Error"), efont);
|
||||
}
|
||||
|
||||
|
||||
string const InsetError::editMessage() const
|
||||
{
|
||||
return _("Opened error");
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
// -*- C++ -*-
|
||||
/**
|
||||
* \file inseterror.h
|
||||
* This file is part of LyX, the document processor.
|
||||
* Licence details can be found in the file COPYING.
|
||||
*
|
||||
* \author Lars Gullik Bjønnes
|
||||
*
|
||||
* Full author contact details are available in file CREDITS
|
||||
*/
|
||||
|
||||
#ifndef INSET_ERROR_H
|
||||
#define INSET_ERROR_H
|
||||
|
||||
#include "inset.h"
|
||||
#include "LString.h"
|
||||
#include "dimension.h"
|
||||
|
||||
/** Used for error messages from LaTeX runs.
|
||||
|
||||
The edit-operation opens a
|
||||
dialog with the text of the error-message. The inset is displayed as
|
||||
"Error" in a box, and automatically deleted. */
|
||||
class InsetError : public Inset {
|
||||
public:
|
||||
///
|
||||
explicit
|
||||
InsetError(string const &);
|
||||
///
|
||||
~InsetError();
|
||||
///
|
||||
virtual dispatch_result localDispatch(FuncRequest const & cmd);
|
||||
///
|
||||
void metrics(MetricsInfo &, Dimension &) const;
|
||||
///
|
||||
void draw(PainterInfo & pi, int x, int y) const;
|
||||
///
|
||||
void write(Buffer const *, std::ostream &) const {}
|
||||
///
|
||||
void read(Buffer const *, LyXLex &) {}
|
||||
///
|
||||
int latex(Buffer const *, std::ostream &,
|
||||
LatexRunParams const &) const { return 0; }
|
||||
///
|
||||
int ascii(Buffer const *, std::ostream &, int) const { return 0; }
|
||||
///
|
||||
int linuxdoc(Buffer const *, std::ostream &) const { return 0; }
|
||||
///
|
||||
int docbook(Buffer const *, std::ostream &, bool) const { return 0; }
|
||||
///
|
||||
bool autoDelete() const { return true; }
|
||||
/// what appears in the minibuffer when opening
|
||||
string const editMessage() const;
|
||||
///
|
||||
EDITABLE editable() const { return IS_EDITABLE; }
|
||||
///
|
||||
InsetBase * clone() const {
|
||||
return new InsetError(contents);
|
||||
}
|
||||
///
|
||||
Inset::Code lyxCode() const { return Inset::ERROR_CODE; }
|
||||
/// We don't want "begin" and "end inset" in lyx-file
|
||||
bool directWrite() const { return true; };
|
||||
///
|
||||
string const & getContents() const { return contents; }
|
||||
private:
|
||||
///
|
||||
string contents;
|
||||
///
|
||||
mutable Dimension dim_;
|
||||
};
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user