mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-05 13:26:21 +00:00
Fix memory leaks in the Qt math panel.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7176 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a9713c5563
commit
a0aa73cf1e
@ -1,3 +1,10 @@
|
||||
2003-06-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* lfuns.h:
|
||||
* LyXAction.C (init): new LFUN_DIALOG_SHOW.
|
||||
|
||||
* lyxfunc.C (dispatch): invoke it.
|
||||
|
||||
2003-06-16 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* iterators.C (operator++, ParPosition): reintroduce some
|
||||
|
@ -313,6 +313,7 @@ void LyXAction::init()
|
||||
{ LFUN_REJECT_CHANGE, "reject-change", Noop },
|
||||
{ LFUN_ACCEPT_ALL_CHANGES, "accept-all-changes", Noop },
|
||||
{ LFUN_REJECT_ALL_CHANGES, "reject-all-changes", Noop },
|
||||
{ LFUN_DIALOG_SHOW, "dialog-show", Noop },
|
||||
{ LFUN_DIALOG_SHOW_NEW_INSET, "dialog-show-new-inset", Noop },
|
||||
{ LFUN_DIALOG_SHOW_NEXT_INSET, "dialog-show-next-inset", Noop },
|
||||
{ LFUN_DIALOG_UPDATE, "dialog-update", Noop },
|
||||
|
@ -95,6 +95,7 @@ void Dialogs::show(string const & name, string const & data)
|
||||
if (!dialog)
|
||||
return;
|
||||
|
||||
// FIXME! Should check that the dialog is NOT an inset dialog.
|
||||
dialog->show(data);
|
||||
}
|
||||
|
||||
@ -105,6 +106,7 @@ void Dialogs::show(string const & name, string const & data, InsetBase * inset)
|
||||
if (!dialog)
|
||||
return;
|
||||
|
||||
// FIXME! Should check that the dialog IS an inset dialog.
|
||||
dialog->show(data);
|
||||
open_insets_[name] = inset;
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
2003-06-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlMath2.[Ch] (showDialog): new member function.
|
||||
|
||||
2003-06-12 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* ControlMath2.[Ch]: new files. A work in progress towards a clean
|
||||
|
@ -63,3 +63,9 @@ void ControlMath2::dispatchToggleDisplay() const
|
||||
kernel().dispatch(FuncRequest(LFUN_MATH_DISPLAY));
|
||||
}
|
||||
|
||||
|
||||
void ControlMath2::showDialog(string const & name) const
|
||||
{
|
||||
kernel().dispatch(FuncRequest(LFUN_DIALOG_SHOW, name));
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ public:
|
||||
void dispatchDelim(string const & str) const;
|
||||
/// switch between display and inline
|
||||
void dispatchToggleDisplay() const;
|
||||
/// a request to launch dialog \param name.
|
||||
void showDialog(string const & name) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
2003-06-17 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* Dialogs.C (build): create "mathdelimiter" and "mathmatrix" dialogs.
|
||||
|
||||
* QMath.[Ch]: add QMathMatrix and QMathDelimiter classes.
|
||||
|
||||
* QDelimiterDialog.[Ch]: store a QMathDelimiter*, not a QMath*.
|
||||
* QMathMatrixDialog.[Ch]: store a QMathMatrix*, not a QMath*.
|
||||
|
||||
* QMathDialog.C (delimiterClicked, matrixClicked): fix memory leaks.
|
||||
|
||||
2003-06-14 John Levon <levon@movementarian.org>
|
||||
|
||||
* ui/QPrintDialogBase.ui: make "OK" default
|
||||
|
@ -82,8 +82,9 @@ namespace {
|
||||
|
||||
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
|
||||
"character", "citation", "error", "errorlist", "ert", "external", "file",
|
||||
"float", "graphics", "include", "index", "label", "log", "math", "minipage",
|
||||
"paragraph", "ref", "tabular", "tabularcreate",
|
||||
"float", "graphics", "include", "index", "label", "log",
|
||||
"math", "mathdelimiter", "mathmatrix",
|
||||
"minipage", "paragraph", "ref", "tabular", "tabularcreate",
|
||||
|
||||
#ifdef HAVE_LIBAIKSAURUS
|
||||
"thesaurus",
|
||||
@ -198,6 +199,14 @@ Dialog * Dialogs::build(string const & name)
|
||||
dialog->setController(new ControlMath2(*dialog));
|
||||
dialog->setView(new QMath(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathdelimiter") {
|
||||
dialog->setController(new ControlMath2(*dialog));
|
||||
dialog->setView(new QMathDelimiter(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "mathmatrix") {
|
||||
dialog->setController(new ControlMath2(*dialog));
|
||||
dialog->setView(new QMathMatrix(*dialog));
|
||||
dialog->bc().bp(new IgnorantPolicy);
|
||||
} else if (name == "minipage") {
|
||||
dialog->setController(new ControlMinipage(*dialog));
|
||||
dialog->setView(new QMinipage(*dialog));
|
||||
|
@ -71,7 +71,7 @@ string fix_name(string const & str)
|
||||
} // namespace anon
|
||||
|
||||
|
||||
QDelimiterDialog::QDelimiterDialog(QMath * form)
|
||||
QDelimiterDialog::QDelimiterDialog(QMathDelimiter * form)
|
||||
: QDelimiterDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
|
@ -16,14 +16,14 @@
|
||||
#include "ui/QDelimiterDialogBase.h"
|
||||
#include "LString.h"
|
||||
|
||||
class QMath;
|
||||
class QMathDelimiter;
|
||||
class IconPalette;
|
||||
class QLabel;
|
||||
|
||||
class QDelimiterDialog : public QDelimiterDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QDelimiterDialog(QMath * form);
|
||||
QDelimiterDialog(QMathDelimiter * form);
|
||||
public slots:
|
||||
void ldelim_clicked(const string & str);
|
||||
void rdelim_clicked(const string & str);
|
||||
@ -40,7 +40,7 @@ private:
|
||||
string right_;
|
||||
|
||||
/// owning form
|
||||
QMath * form_;
|
||||
QMathDelimiter * form_;
|
||||
};
|
||||
|
||||
#endif // QDELIMITERDIALOG_H
|
||||
|
@ -14,14 +14,16 @@
|
||||
#include "gettext.h"
|
||||
#include "ControlMath2.h"
|
||||
#include "QMathDialog.h"
|
||||
#include "QMathMatrixDialog.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
#include "QMath.h"
|
||||
|
||||
|
||||
typedef QController<ControlMath2, QView<QMathDialog> > base_class;
|
||||
typedef QController<ControlMath2, QView<QMathDialog> > math_base;
|
||||
|
||||
|
||||
QMath::QMath(Dialog & parent)
|
||||
: base_class(parent, _("LyX: Math Panel"))
|
||||
: math_base(parent, _("LyX: Math Panel"))
|
||||
{}
|
||||
|
||||
|
||||
@ -29,3 +31,31 @@ void QMath::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QMathDialog(this));
|
||||
}
|
||||
|
||||
|
||||
typedef QController<ControlMath2, QView<QMathMatrixDialog> > matrix_base;
|
||||
|
||||
|
||||
QMathMatrix::QMathMatrix(Dialog & parent)
|
||||
: matrix_base(parent, _("LyX: Insert Matrix"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathMatrix::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QMathMatrixDialog(this));
|
||||
}
|
||||
|
||||
|
||||
typedef QController<ControlMath2, QView<QDelimiterDialog> > delimiter_base;
|
||||
|
||||
|
||||
QMathDelimiter::QMathDelimiter(Dialog & parent)
|
||||
: delimiter_base(parent, _("LyX: Insert Delimiter"))
|
||||
{}
|
||||
|
||||
|
||||
void QMathDelimiter::build_dialog()
|
||||
{
|
||||
dialog_.reset(new QDelimiterDialog(this));
|
||||
}
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
class ControlMath2;
|
||||
class QMathDialog;
|
||||
class QMathMatrixDialog;
|
||||
class QDelimiterDialog;
|
||||
|
||||
class QMath : public QController<ControlMath2, QView<QMathDialog> > {
|
||||
public:
|
||||
@ -31,4 +33,32 @@ private:
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
class QMathMatrix : public QController<ControlMath2, QView<QMathMatrixDialog> > {
|
||||
public:
|
||||
friend class QMathMatrixDialog;
|
||||
|
||||
QMathMatrix(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
|
||||
class QMathDelimiter : public QController<ControlMath2, QView<QDelimiterDialog> > {
|
||||
public:
|
||||
friend class QDelimiterDialog;
|
||||
|
||||
QMathDelimiter(Dialog &);
|
||||
|
||||
private:
|
||||
virtual void apply() {}
|
||||
virtual void update_contents() {}
|
||||
/// Build the dialog.
|
||||
virtual void build_dialog();
|
||||
};
|
||||
|
||||
#endif // QMATH_H
|
||||
|
@ -21,8 +21,6 @@
|
||||
#include "QMath.h"
|
||||
|
||||
#include "iconpalette.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
#include "QMathMatrixDialog.h"
|
||||
|
||||
#include <qapplication.h>
|
||||
#include <qwidgetstack.h>
|
||||
@ -208,9 +206,7 @@ void QMathDialog::fracClicked()
|
||||
|
||||
void QMathDialog::delimiterClicked()
|
||||
{
|
||||
// FIXME: leak
|
||||
QDelimiterDialog * d = new QDelimiterDialog(form_);
|
||||
d->show();
|
||||
form_->controller().showDialog("mathdelimiter");
|
||||
}
|
||||
|
||||
|
||||
@ -235,9 +231,7 @@ void QMathDialog::functionSelected(const QString & str)
|
||||
|
||||
void QMathDialog::matrixClicked()
|
||||
{
|
||||
// FIXME: leak?
|
||||
QMathMatrixDialog * d = new QMathMatrixDialog(form_);
|
||||
d->show();
|
||||
form_->controller().showDialog("mathmatrix");
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ static char h_align_str[80] = "c";
|
||||
static char v_align_c[] = "tcb";
|
||||
|
||||
|
||||
QMathMatrixDialog::QMathMatrixDialog(QMath * form)
|
||||
QMathMatrixDialog::QMathMatrixDialog(QMathMatrix * form)
|
||||
: QMathMatrixDialogBase(0, 0, false, 0),
|
||||
form_(form)
|
||||
{
|
||||
|
@ -17,12 +17,12 @@
|
||||
|
||||
#include "ui/QMathMatrixDialogBase.h"
|
||||
|
||||
class QMath;
|
||||
class QMathMatrix;
|
||||
|
||||
class QMathMatrixDialog : public QMathMatrixDialogBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
QMathMatrixDialog(QMath * form);
|
||||
QMathMatrixDialog(QMathMatrix * form);
|
||||
public slots:
|
||||
void slotOK();
|
||||
void slotClose();
|
||||
@ -31,7 +31,7 @@ protected slots:
|
||||
virtual void rowsChanged(int);
|
||||
virtual void change_adaptor();
|
||||
private:
|
||||
QMath * form_;
|
||||
QMathMatrix * form_;
|
||||
};
|
||||
|
||||
#endif // QMATHMATRIXDIALOG_H
|
||||
|
@ -321,18 +321,19 @@ enum kb_action {
|
||||
LFUN_REJECT_ALL_CHANGES, // Levon 20021016
|
||||
LFUN_INSERT_BIBITEM, // André 14 Feb 2003
|
||||
// 245
|
||||
LFUN_DIALOG_SHOW,
|
||||
LFUN_DIALOG_SHOW_NEW_INSET,
|
||||
LFUN_DIALOG_SHOW_NEXT_INSET,
|
||||
LFUN_DIALOG_UPDATE,
|
||||
LFUN_DIALOG_HIDE,
|
||||
LFUN_DIALOG_DISCONNECT_INSET,
|
||||
// 250
|
||||
LFUN_DIALOG_DISCONNECT_INSET,
|
||||
LFUN_INSET_APPLY,
|
||||
LFUN_INSET_INSERT,
|
||||
LFUN_INSET_MODIFY,
|
||||
LFUN_INSET_DIALOG_UPDATE,
|
||||
LFUN_INSET_SETTINGS,
|
||||
// 255
|
||||
LFUN_INSET_SETTINGS,
|
||||
LFUN_PARAGRAPH_APPLY,
|
||||
LFUN_PARAGRAPH_UPDATE,
|
||||
LFUN_EXTERNAL_EDIT,
|
||||
|
@ -1408,6 +1408,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
|
||||
owner->getDialogs().showMathPanel();
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_SHOW:
|
||||
owner->getDialogs().show(argument);
|
||||
break;
|
||||
|
||||
case LFUN_DIALOG_SHOW_NEW_INSET: {
|
||||
string const & name = argument;
|
||||
string data;
|
||||
|
Loading…
Reference in New Issue
Block a user