From 8f877fd574dfcf6b12d1630214b7fe93db1a19b5 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Tue, 17 Jun 2003 12:53:35 +0000 Subject: [PATCH] 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 --- src/frontends/controllers/ChangeLog | 8 ++ src/frontends/controllers/ControlMath.C | 96 ++++----------- src/frontends/controllers/ControlMath.h | 113 +++++------------- src/frontends/controllers/ControlMath2.C | 76 ------------ src/frontends/controllers/ControlMath2.h | 87 -------------- src/frontends/controllers/Makefile.am | 2 - src/frontends/qt2/ChangeLog | 8 ++ src/frontends/qt2/Dialogs.C | 8 +- src/frontends/qt2/QDelimiterDialog.C | 2 +- src/frontends/qt2/QMath.C | 8 +- src/frontends/qt2/QMath.h | 8 +- src/frontends/qt2/QMathDialog.C | 2 +- src/frontends/qt2/QMathMatrixDialog.C | 2 +- src/frontends/xforms/ChangeLog | 15 +++ src/frontends/xforms/Dialogs.C | 44 ++++--- src/frontends/xforms/Dialogs2.C | 13 +- src/frontends/xforms/FormMathsBitmap.C | 4 +- src/frontends/xforms/FormMathsBitmap.h | 4 +- src/frontends/xforms/FormMathsDelim.C | 4 +- src/frontends/xforms/FormMathsDelim.h | 4 +- src/frontends/xforms/FormMathsMatrix.C | 4 +- src/frontends/xforms/FormMathsMatrix.h | 4 +- src/frontends/xforms/FormMathsPanel.C | 23 ++-- src/frontends/xforms/FormMathsPanel.h | 8 +- src/frontends/xforms/FormMathsSpace.C | 4 +- src/frontends/xforms/FormMathsSpace.h | 4 +- src/frontends/xforms/FormMathsStyle.C | 4 +- src/frontends/xforms/FormMathsStyle.h | 4 +- .../xforms/forms/form_maths_panel.fd | 48 ++++---- 29 files changed, 187 insertions(+), 424 deletions(-) delete mode 100644 src/frontends/controllers/ControlMath2.C delete mode 100644 src/frontends/controllers/ControlMath2.h diff --git a/src/frontends/controllers/ChangeLog b/src/frontends/controllers/ChangeLog index b9f141371e..c482cf7167 100644 --- a/src/frontends/controllers/ChangeLog +++ b/src/frontends/controllers/ChangeLog @@ -1,3 +1,11 @@ +2003-06-17 Angus Leeming + + * 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 * ControlMath.[Ch] (showDialog): diff --git a/src/frontends/controllers/ControlMath.C b/src/frontends/controllers/ControlMath.C index 4686a63bea..11bfdefbf2 100644 --- a/src/frontends/controllers/ControlMath.C +++ b/src/frontends/controllers/ControlMath.C @@ -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 #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::showDialog(string const & name) const +void ControlMath::dispatchSubscript() const { - lv_.dispatch(FuncRequest(LFUN_DIALOG_SHOW, name)); + dispatchFunc(LFUN_SUBSCRIPT); } -void ControlMath::addDaughter(void * key, ViewBase * v, - BCView * bcview, ButtonPolicy * bcpolicy) +void ControlMath::dispatchSuperscript() const { - if (daughters_.find(key) != daughters_.end()) - return; - - daughters_[key] = DaughterPtr(new GUIMathSub(lv_, d_, *this, - v, bcview, bcpolicy)); + dispatchFunc(LFUN_SUPERSCRIPT); } -void ControlMath::showDaughter(void * key) +void ControlMath::dispatchCubeRoot() const { - 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(); + dispatchFunc(LFUN_INSERT_MATH, "\\root"); + dispatchFunc(LFUN_SELFINSERT, "3"); + dispatchFunc(LFUN_RIGHT); } - -ControlMathSub::ControlMathSub(LyXView & lv, Dialogs & d, ControlMath const & p) - : ControlDialogBD(lv, d), - parent_(p) -{} - - -void ControlMathSub::apply() +void ControlMath::dispatchMatrix(string const & str) const { - view().apply(); + dispatchFunc(LFUN_INSERT_MATRIX, str); } -void ControlMathSub::dispatchFunc(kb_action action, string const & arg) const +void ControlMath::dispatchDelim(string const & str) const { - parent_.dispatchFunc(action, arg); + dispatchFunc(LFUN_MATH_DELIM, str); } -void ControlMathSub::insertSymbol(string const & sym, bool bs) const +void ControlMath::dispatchToggleDisplay() const { - parent_.insertSymbol(sym, bs); + dispatchFunc(LFUN_MATH_DISPLAY); } -GUIMathSub::GUIMathSub(LyXView & lv, Dialogs & d, - ControlMath const & p, - ViewBase * v, - BCView * bcview, - ButtonPolicy * bcpolicy) - : controller_(lv, d, p), view_(v) +void ControlMath::showDialog(string const & name) const { - 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"; diff --git a/src/frontends/controllers/ControlMath.h b/src/frontends/controllers/ControlMath.h index 13edf9d25a..79621ea684 100644 --- a/src/frontends/controllers/ControlMath.h +++ b/src/frontends/controllers/ControlMath.h @@ -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" +#ifndef CONTROLMATH_H +#define CONTROLMATH_H -#include "LString.h" -#include -#include +#include "Dialog.h" +#include "lfuns.h" // for kb_action -class GUIMathSub; -class BCView; - -class ControlMath : public ControlDialogBD { +class ControlMath : public Dialog::Controller { public: - /// - ControlMath(LyXView &, Dialogs &); + ControlMath(Dialog &); - /// 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; + virtual bool initialiseParams(string const &) { return true; } + virtual void clearParams() {} + virtual void dispatchParams() {} + virtual bool isBufferDependent() const { return true; } - /// - void addDaughter(void * key, ViewBase * v, - BCView * bc, ButtonPolicy * bcpolicy); - /// - void showDaughter(void *); + /// 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; - -private: - /// - virtual void apply(); - - /// - typedef boost::shared_ptr DaughterPtr; - /// - typedef std::map 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 bc_; - /// - boost::scoped_ptr 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 diff --git a/src/frontends/controllers/ControlMath2.C b/src/frontends/controllers/ControlMath2.C deleted file mode 100644 index 8c1be821ba..0000000000 --- a/src/frontends/controllers/ControlMath2.C +++ /dev/null @@ -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 - -#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); -} diff --git a/src/frontends/controllers/ControlMath2.h b/src/frontends/controllers/ControlMath2.h deleted file mode 100644 index 776f256395..0000000000 --- a/src/frontends/controllers/ControlMath2.h +++ /dev/null @@ -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 diff --git a/src/frontends/controllers/Makefile.am b/src/frontends/controllers/Makefile.am index 3c4ffed931..b827c7d611 100644 --- a/src/frontends/controllers/Makefile.am +++ b/src/frontends/controllers/Makefile.am @@ -68,8 +68,6 @@ libcontrollers_la_SOURCES= \ ControlLog.h \ ControlMath.C \ ControlMath.h \ - ControlMath2.C \ - ControlMath2.h \ ControlMinipage.C \ ControlMinipage.h \ ControlParagraph.C \ diff --git a/src/frontends/qt2/ChangeLog b/src/frontends/qt2/ChangeLog index a27a0947f7..02cf579eee 100644 --- a/src/frontends/qt2/ChangeLog +++ b/src/frontends/qt2/ChangeLog @@ -1,3 +1,11 @@ +2003-06-17 Angus Leeming + + * Dialogs.C: + * QDelimiterDialog.C: + * QMath.[Ch]: + * QMathDialog.C: + * QMathMatrixDialog.C: s/ControlMath2/ControlMath/. + 2003-06-17 Angus Leeming * Dialogs.C (build): create "mathdelimiter" and "mathmatrix" dialogs. diff --git a/src/frontends/qt2/Dialogs.C b/src/frontends/qt2/Dialogs.C index 4c75aff7f4..41703b023a 100644 --- a/src/frontends/qt2/Dialogs.C +++ b/src/frontends/qt2/Dialogs.C @@ -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") { diff --git a/src/frontends/qt2/QDelimiterDialog.C b/src/frontends/qt2/QDelimiterDialog.C index c2a50029fd..3a02bd7c67 100644 --- a/src/frontends/qt2/QDelimiterDialog.C +++ b/src/frontends/qt2/QDelimiterDialog.C @@ -15,7 +15,7 @@ #include "qt_helpers.h" #include "debug.h" -#include "ControlMath2.h" +#include "ControlMath.h" #include "QMath.h" #include "QDelimiterDialog.h" diff --git a/src/frontends/qt2/QMath.C b/src/frontends/qt2/QMath.C index 28d55c980b..5f9412a789 100644 --- a/src/frontends/qt2/QMath.C +++ b/src/frontends/qt2/QMath.C @@ -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 > math_base; +typedef QController > math_base; QMath::QMath(Dialog & parent) @@ -33,7 +33,7 @@ void QMath::build_dialog() } -typedef QController > matrix_base; +typedef QController > matrix_base; QMathMatrix::QMathMatrix(Dialog & parent) @@ -47,7 +47,7 @@ void QMathMatrix::build_dialog() } -typedef QController > delimiter_base; +typedef QController > delimiter_base; QMathDelimiter::QMathDelimiter(Dialog & parent) diff --git a/src/frontends/qt2/QMath.h b/src/frontends/qt2/QMath.h index f6a467cddf..d3dfeee93b 100644 --- a/src/frontends/qt2/QMath.h +++ b/src/frontends/qt2/QMath.h @@ -15,12 +15,12 @@ #include "QDialogView.h" -class ControlMath2; +class ControlMath; class QMathDialog; class QMathMatrixDialog; class QDelimiterDialog; -class QMath : public QController > { +class QMath : public QController > { public: friend class QMathDialog; @@ -34,7 +34,7 @@ private: }; -class QMathMatrix : public QController > { +class QMathMatrix : public QController > { public: friend class QMathMatrixDialog; @@ -48,7 +48,7 @@ private: }; -class QMathDelimiter : public QController > { +class QMathDelimiter : public QController > { public: friend class QDelimiterDialog; diff --git a/src/frontends/qt2/QMathDialog.C b/src/frontends/qt2/QMathDialog.C index fd25ec4b3b..0943427005 100644 --- a/src/frontends/qt2/QMathDialog.C +++ b/src/frontends/qt2/QMathDialog.C @@ -15,7 +15,7 @@ #include "qt_helpers.h" #include "debug.h" -#include "ControlMath2.h" +#include "ControlMath.h" #include "QMathDialog.h" #include "QMath.h" diff --git a/src/frontends/qt2/QMathMatrixDialog.C b/src/frontends/qt2/QMathMatrixDialog.C index 8a2c54658d..f1a496a315 100644 --- a/src/frontends/qt2/QMathMatrixDialog.C +++ b/src/frontends/qt2/QMathMatrixDialog.C @@ -14,7 +14,7 @@ #include "support/lstrings.h" #include "Lsstream.h" -#include "ControlMath2.h" +#include "ControlMath.h" #include "QMath.h" #include "QMathMatrixDialog.h" diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 078b5314a2..ad7cfbca20 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,18 @@ +2003-06-17 Angus Leeming + + * 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 * FormMathsBitmap.[Ch]: diff --git a/src/frontends/xforms/Dialogs.C b/src/frontends/xforms/Dialogs.C index 51fc6b017f..d21216d041 100644 --- a/src/frontends/xforms/Dialogs.C +++ b/src/frontends/xforms/Dialogs.C @@ -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") { diff --git a/src/frontends/xforms/Dialogs2.C b/src/frontends/xforms/Dialogs2.C index 0c95fde981..1c9a733b7f 100644 --- a/src/frontends/xforms/Dialogs2.C +++ b/src/frontends/xforms/Dialogs2.C @@ -13,6 +13,7 @@ #include #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 ForksDialog; -typedef GUI -MathPanelDialog; - typedef GUI 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()); } diff --git a/src/frontends/xforms/FormMathsBitmap.C b/src/frontends/xforms/FormMathsBitmap.C index 63ba2f127e..0b9f8b8fd2 100644 --- a/src/frontends/xforms/FormMathsBitmap.C +++ b/src/frontends/xforms/FormMathsBitmap.C @@ -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 > base_class; +typedef FormController > base_class; FormMathsBitmap::FormMathsBitmap(Dialog & parent, string const & t, vector const & l) diff --git a/src/frontends/xforms/FormMathsBitmap.h b/src/frontends/xforms/FormMathsBitmap.h index 88b2255a9b..5e90ed0b5f 100644 --- a/src/frontends/xforms/FormMathsBitmap.h +++ b/src/frontends/xforms/FormMathsBitmap.h @@ -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 > { + : public FormController > { public: /// FormMathsBitmap(Dialog &, string const &, std::vector const &); diff --git a/src/frontends/xforms/FormMathsDelim.C b/src/frontends/xforms/FormMathsDelim.C index 509d97aded..62c774b163 100644 --- a/src/frontends/xforms/FormMathsDelim.C +++ b/src/frontends/xforms/FormMathsDelim.C @@ -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 > base_class; +typedef FormController > base_class; FormMathsDelim::FormMathsDelim(Dialog & parent) : base_class(parent, _("Math Delimiters"), false) diff --git a/src/frontends/xforms/FormMathsDelim.h b/src/frontends/xforms/FormMathsDelim.h index 5c53d716f6..9d77068f7a 100644 --- a/src/frontends/xforms/FormMathsDelim.h +++ b/src/frontends/xforms/FormMathsDelim.h @@ -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 > { + : public FormController > { public: /// FormMathsDelim(Dialog &); diff --git a/src/frontends/xforms/FormMathsMatrix.C b/src/frontends/xforms/FormMathsMatrix.C index 8cd7535ddb..b807ca1983 100644 --- a/src/frontends/xforms/FormMathsMatrix.C +++ b/src/frontends/xforms/FormMathsMatrix.C @@ -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 > base_class; +typedef FormController > base_class; FormMathsMatrix::FormMathsMatrix(Dialog & parent) : base_class(parent, _("Math Matrix"), false) diff --git a/src/frontends/xforms/FormMathsMatrix.h b/src/frontends/xforms/FormMathsMatrix.h index 8e1a609461..58077bdb71 100644 --- a/src/frontends/xforms/FormMathsMatrix.h +++ b/src/frontends/xforms/FormMathsMatrix.h @@ -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 > { + : public FormController > { public: /// FormMathsMatrix(Dialog &); diff --git a/src/frontends/xforms/FormMathsPanel.C b/src/frontends/xforms/FormMathsPanel.C index f3be1d1a54..801a05e211 100644 --- a/src/frontends/xforms/FormMathsPanel.C +++ b/src/frontends/xforms/FormMathsPanel.C @@ -33,10 +33,10 @@ #include "super.xpm" -typedef FormCB > base_class; +typedef FormController > 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; diff --git a/src/frontends/xforms/FormMathsPanel.h b/src/frontends/xforms/FormMathsPanel.h index 670dc72640..e07724817f 100644 --- a/src/frontends/xforms/FormMathsPanel.h +++ b/src/frontends/xforms/FormMathsPanel.h @@ -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 > { +class FormMathsPanel + : public FormController > { public: /// - FormMathsPanel(); + FormMathsPanel(Dialog &); private: /// Not needed. diff --git a/src/frontends/xforms/FormMathsSpace.C b/src/frontends/xforms/FormMathsSpace.C index 165adbba22..dfe1e75cf1 100644 --- a/src/frontends/xforms/FormMathsSpace.C +++ b/src/frontends/xforms/FormMathsSpace.C @@ -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 > base_class; +typedef FormController > base_class; FormMathsSpace::FormMathsSpace(Dialog & parent) : base_class(parent, _("Math Spacing"), false), diff --git a/src/frontends/xforms/FormMathsSpace.h b/src/frontends/xforms/FormMathsSpace.h index 5b370fb3d7..d4db83f0a6 100644 --- a/src/frontends/xforms/FormMathsSpace.h +++ b/src/frontends/xforms/FormMathsSpace.h @@ -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 > { + : public FormController > { public: /// FormMathsSpace(Dialog &); diff --git a/src/frontends/xforms/FormMathsStyle.C b/src/frontends/xforms/FormMathsStyle.C index 979b614ff5..5cd1925ffa 100644 --- a/src/frontends/xforms/FormMathsStyle.C +++ b/src/frontends/xforms/FormMathsStyle.C @@ -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 > base_class; +typedef FormController > base_class; FormMathsStyle::FormMathsStyle(Dialog & parent) : base_class(parent, _("Math Styles & Fonts"), false), diff --git a/src/frontends/xforms/FormMathsStyle.h b/src/frontends/xforms/FormMathsStyle.h index 7d6bc94faa..afdb97bb31 100644 --- a/src/frontends/xforms/FormMathsStyle.h +++ b/src/frontends/xforms/FormMathsStyle.h @@ -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 > { + : public FormController > { public: /// FormMathsStyle(Dialog &); diff --git a/src/frontends/xforms/forms/form_maths_panel.fd b/src/frontends/xforms/forms/form_maths_panel.fd index b14138b81e..1e11889eba 100644 --- a/src/frontends/xforms/forms/form_maths_panel.fd +++ b/src/frontends/xforms/forms/form_maths_panel.fd @@ -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 ============================== -- 2.39.2