Move xforms' Maths Panel to the new scheme.

Rename ControlMaths2 as ControlMaths.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7180 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2003-06-17 12:53:35 +00:00
parent 256064c765
commit 8f877fd574
29 changed files with 210 additions and 447 deletions

View File

@ -1,3 +1,11 @@
2003-06-17 Angus Leeming <leeming@lyx.org>
* ControlMath.[Ch]:
* ControlMath2.[Ch]: rename ControlMath2 as ControlMath.
Move into ControlMath.[Ch]. Remove ControlMath2.[Ch].
* Makefile.am: remove ControlMath2.[Ch].
2003-06-17 Angus Leeming <leeming@lyx.org>
* ControlMath.[Ch] (showDialog):

View File

@ -3,8 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author John Levon
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -12,115 +11,72 @@
#include <config.h>
#include "ControlMath.h"
#include "ViewBase.h"
#include "BCView.h"
#include "Kernel.h"
#include "debug.h"
#include "funcrequest.h"
#include "frontends/LyXView.h"
#include "support/lstrings.h"
#include "support/filetools.h"
ControlMath::ControlMath(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d), active_(0)
ControlMath::ControlMath(Dialog & dialog)
: Dialog::Controller(dialog)
{}
void ControlMath::apply()
{
view().apply();
}
void ControlMath::dispatchFunc(kb_action action, string const & arg) const
{
lv_.dispatch(FuncRequest(action, arg));
kernel().dispatch(FuncRequest(action, arg));
}
void ControlMath::insertSymbol(string const & sym, bool bs) const
void ControlMath::dispatchInsert(string const & name) const
{
if (bs)
lv_.dispatch(FuncRequest(LFUN_INSERT_MATH, '\\' + sym));
else
lv_.dispatch(FuncRequest(LFUN_INSERT_MATH, sym));
dispatchFunc(LFUN_INSERT_MATH, '\\' + name);
}
void ControlMath::dispatchSubscript() const
{
dispatchFunc(LFUN_SUBSCRIPT);
}
void ControlMath::dispatchSuperscript() const
{
dispatchFunc(LFUN_SUPERSCRIPT);
}
void ControlMath::dispatchCubeRoot() const
{
dispatchFunc(LFUN_INSERT_MATH, "\\root");
dispatchFunc(LFUN_SELFINSERT, "3");
dispatchFunc(LFUN_RIGHT);
}
void ControlMath::dispatchMatrix(string const & str) const
{
dispatchFunc(LFUN_INSERT_MATRIX, str);
}
void ControlMath::dispatchDelim(string const & str) const
{
dispatchFunc(LFUN_MATH_DELIM, str);
}
void ControlMath::dispatchToggleDisplay() const
{
dispatchFunc(LFUN_MATH_DISPLAY);
}
void ControlMath::showDialog(string const & name) const
{
lv_.dispatch(FuncRequest(LFUN_DIALOG_SHOW, name));
}
void ControlMath::addDaughter(void * key, ViewBase * v,
BCView * bcview, ButtonPolicy * bcpolicy)
{
if (daughters_.find(key) != daughters_.end())
return;
daughters_[key] = DaughterPtr(new GUIMathSub(lv_, d_, *this,
v, bcview, bcpolicy));
}
void ControlMath::showDaughter(void * key)
{
Store::iterator it = daughters_.find(key);
GUIMathSub * const new_active =
(it == daughters_.end()) ? 0 : it->second.get();
if (active_ != new_active) {
if (active_ )
active_->controller().hide();
active_ = new_active;
}
if (active_)
active_->controller().show();
}
ControlMathSub::ControlMathSub(LyXView & lv, Dialogs & d, ControlMath const & p)
: ControlDialogBD(lv, d),
parent_(p)
{}
void ControlMathSub::apply()
{
view().apply();
}
void ControlMathSub::dispatchFunc(kb_action action, string const & arg) const
{
parent_.dispatchFunc(action, arg);
}
void ControlMathSub::insertSymbol(string const & sym, bool bs) const
{
parent_.insertSymbol(sym, bs);
}
GUIMathSub::GUIMathSub(LyXView & lv, Dialogs & d,
ControlMath const & p,
ViewBase * v,
BCView * bcview,
ButtonPolicy * bcpolicy)
: controller_(lv, d, p), view_(v)
{
controller_.setView(*view_);
view_->setController(controller_);
controller_.bc().view(bcview);
controller_.bc().bp(bcpolicy);
dispatchFunc(LFUN_DIALOG_SHOW, name);
}
@ -210,7 +166,7 @@ char const * latex_misc[] = {
"angle", "top", "bot", "Vert", "neg",
"flat", "natural", "sharp", "surd", "triangle",
"diamondsuit", "heartsuit", "clubsuit", "spadesuit",
"textrm Å", "textrm Ø", "mathcircumflex", "_",
"textrm Å", "textrm Ø", "mathcircumflex", "_",
"mathrm T",
"mathbb N", "mathbb Z", "mathbb Q",
"mathbb R", "mathbb C", "mathbb H",
@ -318,8 +274,8 @@ string const find_xpm(string const & name)
#warning Use a static table for this (Lgb)
// And get O(log n) lookup (Lgb)
if (xpm_name == "textrm_Å") xpm_name = "textrm_A";
else if (xpm_name == "textrm_Ø") xpm_name = "textrm_0";
if (xpm_name == "textrm_Å") xpm_name = "textrm_A";
else if (xpm_name == "textrm_Ø") xpm_name = "textrm_0";
else if (xpm_name == "Bumpeq") xpm_name = "bumpeq2";
else if (xpm_name == "Cap") xpm_name = "cap2";
else if (xpm_name == "Cup") xpm_name = "cup2";

View File

@ -4,103 +4,48 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Alejandro Aguilar Sierra
* \author John Levon
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*
* ControlMath2 is a controller class for the Math Panel dialog.
*/
#ifndef CONTROL_MATH_H
#define CONTROL_MATH_H
#include "lfuns.h"
#include "ControlDialog_impl.h"
#include "ButtonController.h"
#include "LString.h"
#include <boost/shared_ptr.hpp>
#include <map>
#ifndef CONTROLMATH_H
#define CONTROLMATH_H
class GUIMathSub;
class BCView;
#include "Dialog.h"
#include "lfuns.h" // for kb_action
class ControlMath : public ControlDialogBD {
class ControlMath : public Dialog::Controller {
public:
///
ControlMath(LyXView &, Dialogs &);
ControlMath(Dialog &);
virtual bool initialiseParams(string const &) { return true; }
virtual void clearParams() {}
virtual void dispatchParams() {}
virtual bool isBufferDependent() const { return true; }
/// dispatch an LFUN
void dispatchFunc(kb_action act, string const & arg = string()) const;
/// dispatch a symbol insert
void insertSymbol(string const & sym, bool bs = true) const;
///
void addDaughter(void * key, ViewBase * v,
BCView * bc, ButtonPolicy * bcpolicy);
///
void showDaughter(void *);
void dispatchFunc(kb_action action, string const & arg = string()) const;
/// Insert a math symbol into the doc.
void dispatchInsert(string const & name) const;
/// Insert a subscript.
void dispatchSubscript() const;
/// Insert a superscript.
void dispatchSuperscript() const;
/// Insert a cube root
void dispatchCubeRoot() const;
/// Insert a matrix
void dispatchMatrix(string const & str) const;
/// Insert a delimiter
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;
private:
///
virtual void apply();
///
typedef boost::shared_ptr<GUIMathSub> DaughterPtr;
///
typedef std::map<void *, DaughterPtr> Store;
/** The store of all daughter dialogs.
* The map uses the button on the main panel to identify them.
*/
Store daughters_;
/// A pointer to the currently active daughter dialog.
GUIMathSub * active_;
};
class ControlMathSub : public ControlDialogBD {
public:
///
ControlMathSub(LyXView &, Dialogs &, ControlMath const & p);
/// dispatch an LFUN
void dispatchFunc(kb_action act, string const & arg = string()) const;
/// dispatch a symbol insert
void insertSymbol(string const & sym, bool bs = true) const;
private:
///
virtual void apply();
///
ControlMath const & parent_;
};
class GUIMathSub {
public:
///
GUIMathSub(LyXView & lv, Dialogs & d,
ControlMath const & p,
ViewBase * v,
BCView * bcview,
ButtonPolicy * bcpolicy);
///
ControlMathSub & controller() { return controller_; }
private:
///
ControlMathSub controller_;
///
boost::scoped_ptr<ButtonController> bc_;
///
boost::scoped_ptr<ViewBase> view_;
};
@ -139,4 +84,4 @@ extern int const nr_latex_ams_ops;
*/
string const find_xpm(string const & name);
#endif /* CONTROL_MATH_H */
#endif // NOT CONTROLMATH

View File

@ -1,76 +0,0 @@
/**
* \file ControlMath2.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 "ControlMath2.h"
#include "Kernel.h"
#include "funcrequest.h"
ControlMath2::ControlMath2(Dialog & dialog)
: Dialog::Controller(dialog)
{}
void ControlMath2::dispatchFunc(kb_action action, string const & arg) const
{
kernel().dispatch(FuncRequest(action, arg));
}
void ControlMath2::dispatchInsert(string const & name) const
{
dispatchFunc(LFUN_INSERT_MATH, '\\' + name);
}
void ControlMath2::dispatchSubscript() const
{
dispatchFunc(LFUN_SUBSCRIPT);
}
void ControlMath2::dispatchSuperscript() const
{
dispatchFunc(LFUN_SUPERSCRIPT);
}
void ControlMath2::dispatchCubeRoot() const
{
dispatchFunc(LFUN_INSERT_MATH, "\\root");
dispatchFunc(LFUN_SELFINSERT, "3");
dispatchFunc(LFUN_RIGHT);
}
void ControlMath2::dispatchMatrix(string const & str) const
{
dispatchFunc(LFUN_INSERT_MATRIX, str);
}
void ControlMath2::dispatchDelim(string const & str) const
{
dispatchFunc(LFUN_MATH_DELIM, str);
}
void ControlMath2::dispatchToggleDisplay() const
{
dispatchFunc(LFUN_MATH_DISPLAY);
}
void ControlMath2::showDialog(string const & name) const
{
dispatchFunc(LFUN_DIALOG_SHOW, name);
}

View File

@ -1,87 +0,0 @@
// -*- C++ -*-
/**
* \file ControlMath2.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
*
* ControlMath2 is a controller class for the Math Panel dialog.
*/
#ifndef CONTROLMATH2_H
#define CONTROLMATH2_H
#include "Dialog.h"
#include "lfuns.h" // for kb_action
class ControlMath2 : public Dialog::Controller {
public:
ControlMath2(Dialog &);
virtual bool initialiseParams(string const &) { return true; }
virtual void clearParams() {}
virtual void dispatchParams() {}
virtual bool isBufferDependent() const { return true; }
/// dispatch an LFUN
void dispatchFunc(kb_action action, string const & arg = string()) const;
/// Insert a math symbol into the doc.
void dispatchInsert(string const & name) const;
/// Insert a subscript.
void dispatchSubscript() const;
/// Insert a superscript.
void dispatchSuperscript() const;
/// Insert a cube root
void dispatchCubeRoot() const;
/// Insert a matrix
void dispatchMatrix(string const & str) const;
/// Insert a delimiter
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;
};
extern char const * function_names[];
extern int const nr_function_names;
extern char const * latex_arrow[];
extern int const nr_latex_arrow;
extern char const * latex_bop[];
extern int const nr_latex_bop;
extern char const * latex_brel[];
extern int const nr_latex_brel;
extern char const * latex_dots[];
extern int const nr_latex_dots;
extern char const * latex_greek[];
extern int const nr_latex_greek;
extern char const * latex_deco[];
extern int const nr_latex_deco;
extern char const * latex_misc[];
extern int const nr_latex_misc;
extern char const * latex_varsz[];
extern int const nr_latex_varsz;
extern char const * latex_ams_misc[];
extern int const nr_latex_ams_misc;
extern char const * latex_ams_arrows[];
extern int const nr_latex_ams_arrows;
extern char const * latex_ams_rel[];
extern int const nr_latex_ams_rel;
extern char const * latex_ams_nrel[];
extern int const nr_latex_ams_nrel;
extern char const * latex_ams_ops[];
extern int const nr_latex_ams_ops;
/**
* Return the mangled XPM filename of the given
* math symbol.
*/
string const find_xpm(string const & name);
#endif // NOT CONTROLMATH2

View File

@ -68,8 +68,6 @@ libcontrollers_la_SOURCES= \
ControlLog.h \
ControlMath.C \
ControlMath.h \
ControlMath2.C \
ControlMath2.h \
ControlMinipage.C \
ControlMinipage.h \
ControlParagraph.C \

View File

@ -1,3 +1,11 @@
2003-06-17 Angus Leeming <leeming@lyx.org>
* Dialogs.C:
* QDelimiterDialog.C:
* QMath.[Ch]:
* QMathDialog.C:
* QMathMatrixDialog.C: s/ControlMath2/ControlMath/.
2003-06-17 Angus Leeming <leeming@lyx.org>
* Dialogs.C (build): create "mathdelimiter" and "mathmatrix" dialogs.

View File

@ -26,7 +26,7 @@
#include "ControlGraphics.h"
#include "ControlInclude.h"
#include "ControlLog.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlRef.h"
@ -196,15 +196,15 @@ Dialog * Dialogs::build(string const & name)
dialog->setView(new QLog(*dialog));
dialog->bc().bp(new OkCancelPolicy);
} else if (name == "math") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new QMath(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "mathdelimiter") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new QMathDelimiter(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "mathmatrix") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new QMathMatrix(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "minipage") {

View File

@ -15,7 +15,7 @@
#include "qt_helpers.h"
#include "debug.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "QMath.h"
#include "QDelimiterDialog.h"

View File

@ -12,14 +12,14 @@
#include "gettext.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "QMathDialog.h"
#include "QMathMatrixDialog.h"
#include "QDelimiterDialog.h"
#include "QMath.h"
typedef QController<ControlMath2, QView<QMathDialog> > math_base;
typedef QController<ControlMath, QView<QMathDialog> > math_base;
QMath::QMath(Dialog & parent)
@ -33,7 +33,7 @@ void QMath::build_dialog()
}
typedef QController<ControlMath2, QView<QMathMatrixDialog> > matrix_base;
typedef QController<ControlMath, QView<QMathMatrixDialog> > matrix_base;
QMathMatrix::QMathMatrix(Dialog & parent)
@ -47,7 +47,7 @@ void QMathMatrix::build_dialog()
}
typedef QController<ControlMath2, QView<QDelimiterDialog> > delimiter_base;
typedef QController<ControlMath, QView<QDelimiterDialog> > delimiter_base;
QMathDelimiter::QMathDelimiter(Dialog & parent)

View File

@ -15,12 +15,12 @@
#include "QDialogView.h"
class ControlMath2;
class ControlMath;
class QMathDialog;
class QMathMatrixDialog;
class QDelimiterDialog;
class QMath : public QController<ControlMath2, QView<QMathDialog> > {
class QMath : public QController<ControlMath, QView<QMathDialog> > {
public:
friend class QMathDialog;
@ -34,7 +34,7 @@ private:
};
class QMathMatrix : public QController<ControlMath2, QView<QMathMatrixDialog> > {
class QMathMatrix : public QController<ControlMath, QView<QMathMatrixDialog> > {
public:
friend class QMathMatrixDialog;
@ -48,7 +48,7 @@ private:
};
class QMathDelimiter : public QController<ControlMath2, QView<QDelimiterDialog> > {
class QMathDelimiter : public QController<ControlMath, QView<QDelimiterDialog> > {
public:
friend class QDelimiterDialog;

View File

@ -15,7 +15,7 @@
#include "qt_helpers.h"
#include "debug.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "QMathDialog.h"
#include "QMath.h"

View File

@ -14,7 +14,7 @@
#include "support/lstrings.h"
#include "Lsstream.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "QMath.h"
#include "QMathMatrixDialog.h"

View File

@ -1,3 +1,18 @@
2003-06-17 Angus Leeming <leeming@lyx.org>
* Dialogs.C:
* Dialogs2.C
* FormMathsPanel.[Ch]:
* forms/form_maths_panel.fd: convert FormMathsPanel to the
new Dialog-based scheme.
* Dialogs.C:
* FormMathsBitmap.[Ch]:
* FormMathsDelim.[Ch]:
* FormMathsMatrix.[Ch]:
* FormMathsSpace.[Ch]:
* FormMathsStyle.[Ch]: s/ControlMath2/ControlMath/.
2003-06-17 Angus Leeming <leeming@lyx.org>
* FormMathsBitmap.[Ch]:

View File

@ -29,7 +29,7 @@
#include "ControlGraphics.h"
#include "ControlInclude.h"
#include "ControlLog.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "ControlMinipage.h"
#include "ControlParagraph.h"
#include "ControlRef.h"
@ -54,6 +54,7 @@
#include "FormGraphics.h"
#include "FormInclude.h"
#include "FormLog.h"
#include "FormMathsPanel.h"
#include "FormMathsBitmap.h"
#include "FormMathsDelim.h"
#include "FormMathsMatrix.h"
@ -109,7 +110,7 @@ FormMathsBitmap * createFormBitmap(Dialog & parent, string const & title,
char const * const dialognames[] = { "about", "bibitem", "bibtex", "changes",
"character", "citation", "error", "errorlist" , "ert", "external", "file",
"float", "graphics", "include", "index", "label", "log",
"float", "graphics", "include", "index", "label", "log", "math",
"mathaccents", "matharrows", "mathoperators", "mathrelations", "mathgreek",
"mathmisc", "mathdots", "mathbigoperators", "mathamsmisc",
"mathamsarrows", "mathamsrelations", "mathamsnegatedrelations", "mathamsoperators",
@ -223,6 +224,11 @@ Dialog * Dialogs::build(string const & name)
dialog->setView(new FormLog(*dialog));
dialog->bc().bp(new OkCancelPolicy);
} else if (name == "math") {
dialog->setController(new ControlMath(*dialog));
dialog->setView(new FormMathsPanel(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "mathaccents") {
FormMathsBitmap * bitmap =
createFormBitmap(*dialog, _("Maths Decorations & Accents"),
@ -232,7 +238,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(10, 4, 3, deco2_width, deco2_height, deco2_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -246,7 +252,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(4, 2, 2, darrow_width, darrow_height, darrow_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -257,7 +263,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(31, 4, 8, bop_width, bop_height, bop_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -268,7 +274,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(35, 4, 9, brel_width, brel_height, brel_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -281,7 +287,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(28, 7, 4, greek_width, greek_height, greek_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -298,7 +304,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(4, 2, 2, misc3_width, misc3_height, misc3_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -309,7 +315,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(4, 4, 1, dots_width, dots_height, dots_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -320,7 +326,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(14, 3, 5, varsz_width, varsz_height, varsz_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -333,7 +339,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(26, 3, 9, ams7_width, ams7_height, ams7_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -346,7 +352,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(6, 3, 2, ams3_width, ams3_height, ams3_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -357,7 +363,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(66, 6, 11, ams_rel_width, ams_rel_height, ams_rel_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -368,7 +374,7 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(51, 6, 9, ams_nrel_width, ams_nrel_height, ams_nrel_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
@ -379,24 +385,24 @@ Dialog * Dialogs::build(string const & name)
bitmap->addBitmap(
BitmapStore(23, 3, 8, ams_ops_width, ams_ops_height, ams_ops_bits, true));
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(bitmap);
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "mathdelimiter") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new FormMathsDelim(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "mathmatrix") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new FormMathsMatrix(*dialog));
dialog->bc().bp(new OkApplyCancelReadOnlyPolicy);
} else if (name == "mathspace") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new FormMathsSpace(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "mathstyle") {
dialog->setController(new ControlMath2(*dialog));
dialog->setController(new ControlMath(*dialog));
dialog->setView(new FormMathsStyle(*dialog));
dialog->bc().bp(new IgnorantPolicy);
} else if (name == "minipage") {

View File

@ -13,6 +13,7 @@
#include <config.h>
#include "Dialogs.h"
#include "Dialog.h"
#include "controllers/GUI.h"
#include "ButtonController.h"
@ -27,10 +28,6 @@
#include "FormForks.h"
#include "forms/form_forks.h"
#include "ControlMath.h"
#include "FormMathsPanel.h"
#include "forms/form_maths_panel.h"
#include "ControlPreamble.h"
#include "FormPreamble.h"
#include "forms/form_preamble.h"
@ -65,9 +62,6 @@ DocumentDialog;
typedef GUI<ControlForks, FormForks, OkApplyCancelPolicy, xformsBC>
ForksDialog;
typedef GUI<ControlMath, FormMathsPanel, OkCancelReadOnlyPolicy, xformsBC>
MathPanelDialog;
typedef GUI<ControlPreamble, FormPreamble, NoRepeatedApplyReadOnlyPolicy, xformsBC>
PreambleDialog;
@ -94,7 +88,6 @@ struct Dialogs::Impl {
DocumentDialog document;
ForksDialog forks;
MathPanelDialog mathpanel;
PreambleDialog preamble;
PreferencesDialog preferences;
PrintDialog print;
@ -108,7 +101,6 @@ struct Dialogs::Impl {
Dialogs::Impl::Impl(LyXView & lv, Dialogs & d)
: document(lv, d),
forks(lv, d),
mathpanel(lv, d),
preamble(lv, d),
preferences(lv, d),
print(lv, d),
@ -145,7 +137,8 @@ void Dialogs::showForks()
void Dialogs::showMathPanel()
{
pimpl_->mathpanel.controller().show();
static DialogPtr mathdialog(build("math"));
mathdialog->show(string());
}

View File

@ -14,7 +14,7 @@
#include "FormMathsBitmap.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "xformsBC.h"
#include "bmtable.h"
@ -40,7 +40,7 @@ FD_maths_bitmap::~FD_maths_bitmap()
}
typedef FormController<ControlMath2, FormView<FD_maths_bitmap> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_bitmap> > base_class;
FormMathsBitmap::FormMathsBitmap(Dialog & parent, string const & t, vector<string> const & l)

View File

@ -50,10 +50,10 @@ struct FD_maths_bitmap
* This class provides an XForms implementation of a maths bitmap form.
*/
class ControlMath2;
class ControlMath;
class FormMathsBitmap
: public FormController<ControlMath2, FormView<FD_maths_bitmap> > {
: public FormController<ControlMath, FormView<FD_maths_bitmap> > {
public:
///
FormMathsBitmap(Dialog &, string const &, std::vector<string> const &);

View File

@ -16,7 +16,7 @@
#include "FormMathsDelim.h"
#include "forms/form_maths_delim.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "xformsBC.h"
#include "ButtonController.h"
@ -49,7 +49,7 @@ static char const * delim_values[] = {
using std::endl;
typedef FormController<ControlMath2, FormView<FD_maths_delim> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_delim> > base_class;
FormMathsDelim::FormMathsDelim(Dialog & parent)
: base_class(parent, _("Math Delimiters"), false)

View File

@ -18,14 +18,14 @@
#include "FormDialogView.h"
class ControlMath2;
class ControlMath;
struct FD_maths_delim;
/**
* This class provides an XForms implementation of the maths delim.
*/
class FormMathsDelim
: public FormController<ControlMath2, FormView<FD_maths_delim> > {
: public FormController<ControlMath, FormView<FD_maths_delim> > {
public:
///
FormMathsDelim(Dialog &);

View File

@ -16,7 +16,7 @@
#include "FormMathsMatrix.h"
#include "forms/form_maths_matrix.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "xformsBC.h"
#include "ButtonController.h"
@ -54,7 +54,7 @@ extern "C" {
}
typedef FormController<ControlMath2, FormView<FD_maths_matrix> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_matrix> > base_class;
FormMathsMatrix::FormMathsMatrix(Dialog & parent)
: base_class(parent, _("Math Matrix"), false)

View File

@ -18,14 +18,14 @@
#include "FormDialogView.h"
class ControlMath2;
class ControlMath;
struct FD_maths_matrix;
/**
* This class provides an XForms implementation of the maths matrix.
*/
class FormMathsMatrix
: public FormController<ControlMath2, FormView<FD_maths_matrix> > {
: public FormController<ControlMath, FormView<FD_maths_matrix> > {
public:
///
FormMathsMatrix(Dialog &);

View File

@ -33,10 +33,10 @@
#include "super.xpm"
typedef FormCB<ControlMath, FormDB<FD_maths_panel> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_panel> > base_class;
FormMathsPanel::FormMathsPanel()
: base_class(_("Math Panel"))
FormMathsPanel::FormMathsPanel(Dialog & parent)
: base_class(parent, _("Math Panel"))
{}
@ -109,28 +109,23 @@ ButtonPolicy::SMInput FormMathsPanel::input(FL_OBJECT * ob, long)
controller().showDialog("mathstyle");
} else if (ob == dialog_->button_super) {
controller().dispatchFunc(LFUN_SUPERSCRIPT);
controller().dispatchSuperscript();
} else if (ob == dialog_->button_sub) {
controller().dispatchFunc(LFUN_SUBSCRIPT);
// } else if (ob == dialog_->???) {
// controller().dispatchFunc(LFUN_SUBSCRIPT);
// controller().dispatchFunc(LFUN_LEFT);
// controller().dispatchFunc(LFUN_SUPERSCRIPT);
controller().dispatchSubscript();
} else if (ob == dialog_->button_equation) {
controller().dispatchFunc(LFUN_MATH_DISPLAY);
controller().dispatchToggleDisplay();
} else if (ob == dialog_->button_frac) {
controller().insertSymbol("frac");
controller().dispatchInsert("frac");
} else if (ob == dialog_->button_sqrt) {
controller().insertSymbol("sqrt");
controller().dispatchInsert("sqrt");
} else if (ob == dialog_->browser_funcs) {
int const i = fl_get_browser(dialog_->browser_funcs) - 1;
controller().insertSymbol(function_names[i]);
controller().dispatchInsert(function_names[i]);
}
return ButtonPolicy::SMI_VALID;

View File

@ -15,7 +15,8 @@
#define FORM_MATHSPANEL_H
#include "FormBase.h"
#include "FormDialogView.h"
class ControlMath;
struct FD_maths_panel;
@ -23,10 +24,11 @@ struct FD_maths_panel;
/**
* This class provides an XForms implementation of the maths panel.
*/
class FormMathsPanel : public FormCB<ControlMath, FormDB<FD_maths_panel> > {
class FormMathsPanel
: public FormController<ControlMath, FormView<FD_maths_panel> > {
public:
///
FormMathsPanel();
FormMathsPanel(Dialog &);
private:
/// Not needed.

View File

@ -16,14 +16,14 @@
#include "FormMathsSpace.h"
#include "forms/form_maths_space.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "xformsBC.h"
#include "lyx_forms.h"
extern char * latex_mathspace[];
typedef FormController<ControlMath2, FormView<FD_maths_space> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_space> > base_class;
FormMathsSpace::FormMathsSpace(Dialog & parent)
: base_class(parent, _("Math Spacing"), false),

View File

@ -18,14 +18,14 @@
#include "FormDialogView.h"
class ControlMath2;
class ControlMath;
struct FD_maths_space;
/**
* This class provides an XForms implementation of the maths space.
*/
class FormMathsSpace
: public FormController<ControlMath2, FormView<FD_maths_space> > {
: public FormController<ControlMath, FormView<FD_maths_space> > {
public:
///
FormMathsSpace(Dialog &);

View File

@ -17,7 +17,7 @@
#include "FormMathsStyle.h"
#include "forms/form_maths_style.h"
#include "ControlMath2.h"
#include "ControlMath.h"
#include "xformsBC.h"
#include "bmtable.h"
@ -37,7 +37,7 @@ kb_action latex_mathfontcmds[] = {
};
typedef FormController<ControlMath2, FormView<FD_maths_style> > base_class;
typedef FormController<ControlMath, FormView<FD_maths_style> > base_class;
FormMathsStyle::FormMathsStyle(Dialog & parent)
: base_class(parent, _("Math Styles & Fonts"), false),

View File

@ -18,14 +18,14 @@
#include "FormDialogView.h"
class ControlMath2;
class ControlMath;
struct FD_maths_style;
/**
* This class provides an XForms implementation of the maths style.
*/
class FormMathsStyle
: public FormController<ControlMath2, FormView<FD_maths_style> > {
: public FormController<ControlMath, FormView<FD_maths_style> > {
public:
///
FormMathsStyle(Dialog &);

View File

@ -46,7 +46,7 @@ shortcut: ^M
resize: FL_RESIZE_NONE
gravity: FL_SouthEast FL_SouthEast
name: button_close
callback: C_FormBaseCancelCB
callback: C_FormDialogView_CancelCB
argument: 0
--------------------
@ -64,7 +64,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_SouthEast
name: browser_funcs
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
h_pref: FL_OFF
@ -83,7 +83,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_greek
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -101,7 +101,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_arrow
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -119,7 +119,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_boperator
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -137,7 +137,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_brelats
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -155,7 +155,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_misc
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -173,7 +173,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_equation
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -191,7 +191,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_sqrt
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -209,7 +209,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_frac
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -227,7 +227,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_delim
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -245,7 +245,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_matrix
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -263,7 +263,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_deco
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -281,7 +281,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_space
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -299,7 +299,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_dots
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -317,7 +317,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_varsize
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -335,7 +335,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_sub
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -353,7 +353,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_super
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -371,7 +371,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_style
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -389,7 +389,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ams_arrows
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -407,7 +407,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ams_brel
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -425,7 +425,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ams_nrel
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -443,7 +443,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ams_ops
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
--------------------
@ -461,7 +461,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: button_ams_misc
callback: C_FormBaseInputCB
callback: C_FormDialogView_InputCB
argument: 0
==============================