mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
math stuff
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20826 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
cd64f187e6
commit
f1c1cba9c3
@ -22,8 +22,6 @@
|
|||||||
#include <boost/bind.hpp>
|
#include <boost/bind.hpp>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include "frontends/controllers/ControlMath.h"
|
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
|
|
||||||
using support::compare_ascii_no_case;
|
using support::compare_ascii_no_case;
|
||||||
|
@ -9,13 +9,11 @@ noinst_LTLIBRARIES = liblyxcontrollers.la
|
|||||||
SOURCEFILES = \
|
SOURCEFILES = \
|
||||||
Dialog.cpp \
|
Dialog.cpp \
|
||||||
ButtonPolicy.cpp \
|
ButtonPolicy.cpp \
|
||||||
ControlMath.cpp \
|
|
||||||
frontend_helpers.cpp
|
frontend_helpers.cpp
|
||||||
|
|
||||||
HEADERFILES = \
|
HEADERFILES = \
|
||||||
Dialog.h \
|
Dialog.h \
|
||||||
ButtonPolicy.h \
|
ButtonPolicy.h \
|
||||||
ControlMath.h \
|
|
||||||
frontend_helpers.h
|
frontend_helpers.h
|
||||||
|
|
||||||
if MONOLITHIC_CONTROLLERS
|
if MONOLITHIC_CONTROLLERS
|
||||||
|
@ -13,17 +13,6 @@
|
|||||||
#include "Dialogs.h"
|
#include "Dialogs.h"
|
||||||
#include "GuiDialog.h"
|
#include "GuiDialog.h"
|
||||||
|
|
||||||
#include "ButtonController.h"
|
|
||||||
#include "DialogView.h"
|
|
||||||
#include "DockView.h"
|
|
||||||
#include "GuiDelimiter.h"
|
|
||||||
#include "GuiIndex.h"
|
|
||||||
#include "GuiMathMatrix.h"
|
|
||||||
#include "GuiView.h"
|
|
||||||
|
|
||||||
// Uncomment this if you prefer dock widget
|
|
||||||
//#define USE_DOCK_WIDGET
|
|
||||||
|
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
|
|
||||||
#include <boost/assert.hpp>
|
#include <boost/assert.hpp>
|
||||||
@ -90,7 +79,7 @@ Dialog * createGuiIndex(LyXView & lv);
|
|||||||
Dialog * createGuiLabel(LyXView & lv);
|
Dialog * createGuiLabel(LyXView & lv);
|
||||||
Dialog * createGuiListings(LyXView & lv);
|
Dialog * createGuiListings(LyXView & lv);
|
||||||
Dialog * createGuiLog(LyXView & lv);
|
Dialog * createGuiLog(LyXView & lv);
|
||||||
Dialog * createGuiMath(LyXView & lv);
|
Dialog * createGuiMathMatrix(LyXView & lv);
|
||||||
Dialog * createGuiNomenclature(LyXView & lv);
|
Dialog * createGuiNomenclature(LyXView & lv);
|
||||||
Dialog * createGuiNote(LyXView & lv);
|
Dialog * createGuiNote(LyXView & lv);
|
||||||
Dialog * createGuiParagraph(LyXView & lv);
|
Dialog * createGuiParagraph(LyXView & lv);
|
||||||
@ -170,9 +159,9 @@ Dialog * Dialogs::build(string const & name)
|
|||||||
if (name == "view-source")
|
if (name == "view-source")
|
||||||
return createGuiViewSource(lyxview_);
|
return createGuiViewSource(lyxview_);
|
||||||
if (name == "mathdelimiter")
|
if (name == "mathdelimiter")
|
||||||
return new GuiDelimiterDialog(lyxview_);
|
return createGuiDelimiter(lyxview_);
|
||||||
if (name == "mathmatrix")
|
if (name == "mathmatrix")
|
||||||
return new GuiMathMatrixDialog(lyxview_);
|
return createGuiMathMatrix(lyxview_);
|
||||||
if (name == "note")
|
if (name == "note")
|
||||||
return createGuiNote(lyxview_);
|
return createGuiNote(lyxview_);
|
||||||
if (name == "paragraph")
|
if (name == "paragraph")
|
||||||
|
@ -69,12 +69,12 @@ namespace lyx {
|
|||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
|
||||||
GuiDelimiterDialog::GuiDelimiterDialog(LyXView & lv)
|
GuiDelimiter::GuiDelimiter(LyXView & lv)
|
||||||
: GuiDialog(lv, "mathdelimiter")
|
: GuiMath(lv, "mathdelimiter")
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setViewTitle(_("Math Delimiter"));
|
setViewTitle(_("Math Delimiter"));
|
||||||
setController(new ControlMath(*this));
|
setController(this, false);
|
||||||
|
|
||||||
connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
|
connect(closePB, SIGNAL(clicked()), this, SLOT(accept()));
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ GuiDelimiterDialog::GuiDelimiterDialog(LyXView & lv)
|
|||||||
int const end = nr_latex_delimiters - 1;
|
int const end = nr_latex_delimiters - 1;
|
||||||
for (int i = 0; i < end; ++i) {
|
for (int i = 0; i < end; ++i) {
|
||||||
string const delim = latex_delimiters[i];
|
string const delim = latex_delimiters[i];
|
||||||
MathSymbol const & ms = controller().mathSymbol(delim);
|
MathSymbol const & ms = mathSymbol(delim);
|
||||||
QString symbol(ms.fontcode?
|
QString symbol(ms.fontcode?
|
||||||
QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
|
QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode)));
|
||||||
QListWidgetItem * lwi = new QListWidgetItem(symbol);
|
QListWidgetItem * lwi = new QListWidgetItem(symbol);
|
||||||
@ -103,7 +103,7 @@ GuiDelimiterDialog::GuiDelimiterDialog(LyXView & lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i != leftLW->count(); ++i) {
|
for (int i = 0; i != leftLW->count(); ++i) {
|
||||||
MathSymbol const & ms = controller().mathSymbol(
|
MathSymbol const & ms = mathSymbol(
|
||||||
fromqstr(leftLW->item(i)->toolTip()));
|
fromqstr(leftLW->item(i)->toolTip()));
|
||||||
rightLW->addItem(list_items[doMatch(ms.unicode)]->clone());
|
rightLW->addItem(list_items[doMatch(ms.unicode)]->clone());
|
||||||
}
|
}
|
||||||
@ -122,15 +122,9 @@ GuiDelimiterDialog::GuiDelimiterDialog(LyXView & lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ControlMath & GuiDelimiterDialog::controller()
|
char_type GuiDelimiter::doMatch(char_type const symbol)
|
||||||
{
|
{
|
||||||
return static_cast<ControlMath &>(GuiDialog::controller());
|
string const & str = texName(symbol);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
char_type GuiDelimiterDialog::doMatch(char_type const symbol)
|
|
||||||
{
|
|
||||||
string const & str = controller().texName(symbol);
|
|
||||||
string match;
|
string match;
|
||||||
if (str == "(") match = ")";
|
if (str == "(") match = ")";
|
||||||
else if (str == ")") match = "(";
|
else if (str == ")") match = "(";
|
||||||
@ -149,11 +143,11 @@ char_type GuiDelimiterDialog::doMatch(char_type const symbol)
|
|||||||
else if (str == "/") match = "backslash";
|
else if (str == "/") match = "backslash";
|
||||||
else return symbol;
|
else return symbol;
|
||||||
|
|
||||||
return controller().mathSymbol(match).unicode;
|
return mathSymbol(match).unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::updateTeXCode(int size)
|
void GuiDelimiter::updateTeXCode(int size)
|
||||||
{
|
{
|
||||||
bool const bigsize = size != 0;
|
bool const bigsize = size != 0;
|
||||||
|
|
||||||
@ -191,39 +185,39 @@ void GuiDelimiterDialog::updateTeXCode(int size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_insertPB_clicked()
|
void GuiDelimiter::on_insertPB_clicked()
|
||||||
{
|
{
|
||||||
if (sizeCO->currentIndex() == 0)
|
if (sizeCO->currentIndex() == 0)
|
||||||
controller().dispatchDelim(fromqstr(tex_code_));
|
dispatchDelim(fromqstr(tex_code_));
|
||||||
else {
|
else {
|
||||||
QString command = '"' + tex_code_ + '"';
|
QString command = '"' + tex_code_ + '"';
|
||||||
command.replace(' ', "\" \"");
|
command.replace(' ', "\" \"");
|
||||||
controller().dispatchBigDelim(fromqstr(command));
|
dispatchBigDelim(fromqstr(command));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_sizeCO_activated(int index)
|
void GuiDelimiter::on_sizeCO_activated(int index)
|
||||||
{
|
{
|
||||||
updateTeXCode(index);
|
updateTeXCode(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_leftLW_itemActivated(QListWidgetItem *)
|
void GuiDelimiter::on_leftLW_itemActivated(QListWidgetItem *)
|
||||||
{
|
{
|
||||||
on_insertPB_clicked();
|
on_insertPB_clicked();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_rightLW_itemActivated(QListWidgetItem *)
|
void GuiDelimiter::on_rightLW_itemActivated(QListWidgetItem *)
|
||||||
{
|
{
|
||||||
on_insertPB_clicked();
|
on_insertPB_clicked();
|
||||||
accept();
|
accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_leftLW_currentRowChanged(int item)
|
void GuiDelimiter::on_leftLW_currentRowChanged(int item)
|
||||||
{
|
{
|
||||||
if (matchCB->isChecked())
|
if (matchCB->isChecked())
|
||||||
rightLW->setCurrentRow(item);
|
rightLW->setCurrentRow(item);
|
||||||
@ -232,7 +226,7 @@ void GuiDelimiterDialog::on_leftLW_currentRowChanged(int item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_rightLW_currentRowChanged(int item)
|
void GuiDelimiter::on_rightLW_currentRowChanged(int item)
|
||||||
{
|
{
|
||||||
if (matchCB->isChecked())
|
if (matchCB->isChecked())
|
||||||
leftLW->setCurrentRow(item);
|
leftLW->setCurrentRow(item);
|
||||||
@ -241,7 +235,7 @@ void GuiDelimiterDialog::on_rightLW_currentRowChanged(int item)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiDelimiterDialog::on_matchCB_stateChanged(int state)
|
void GuiDelimiter::on_matchCB_stateChanged(int state)
|
||||||
{
|
{
|
||||||
if (state == Qt::Checked)
|
if (state == Qt::Checked)
|
||||||
on_leftLW_currentRowChanged(leftLW->currentRow());
|
on_leftLW_currentRowChanged(leftLW->currentRow());
|
||||||
@ -250,6 +244,9 @@ void GuiDelimiterDialog::on_matchCB_stateChanged(int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dialog * createGuiDelimiter(LyXView & lv) { return new GuiDelimiter(lv); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file GuiDelimiterDialog.h
|
* \file GuiDelimiter.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -12,8 +12,7 @@
|
|||||||
#ifndef GUIDELIMITERDIALOG_H
|
#ifndef GUIDELIMITERDIALOG_H
|
||||||
#define GUIDELIMITERDIALOG_H
|
#define GUIDELIMITERDIALOG_H
|
||||||
|
|
||||||
#include "GuiDialog.h"
|
#include "GuiMath.h"
|
||||||
#include "ControlMath.h"
|
|
||||||
#include "ui_DelimiterUi.h"
|
#include "ui_DelimiterUi.h"
|
||||||
|
|
||||||
class QListWidgetItem;
|
class QListWidgetItem;
|
||||||
@ -21,12 +20,12 @@ class QListWidgetItem;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiDelimiterDialog : public GuiDialog, public Ui::DelimiterUi
|
class GuiDelimiter : public GuiMath, public Ui::DelimiterUi
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiDelimiterDialog(LyXView & lv);
|
GuiDelimiter(LyXView & lv);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void on_leftLW_itemActivated(QListWidgetItem *);
|
void on_leftLW_itemActivated(QListWidgetItem *);
|
||||||
@ -42,8 +41,6 @@ private:
|
|||||||
char_type doMatch(char_type const symbol);
|
char_type doMatch(char_type const symbol);
|
||||||
///
|
///
|
||||||
void updateTeXCode(int size);
|
void updateTeXCode(int size);
|
||||||
/// parent controller
|
|
||||||
ControlMath & controller();
|
|
||||||
|
|
||||||
/// TeX code that will be inserted.
|
/// TeX code that will be inserted.
|
||||||
QString tex_code_;
|
QString tex_code_;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* \file ControlMath.cpp
|
* \file GuiMath.cpp
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#include "ControlMath.h"
|
#include "GuiMath.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
|
|
||||||
@ -20,8 +20,8 @@ using std::map;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
ControlMath::ControlMath(Dialog & dialog)
|
GuiMath::GuiMath(LyXView & lv, std::string const & name)
|
||||||
: Controller(dialog)
|
: GuiDialog(lv, name), Controller(this)
|
||||||
{
|
{
|
||||||
// FIXME: Ideally, those unicode codepoints would be defined
|
// FIXME: Ideally, those unicode codepoints would be defined
|
||||||
// in "lib/symbols". Unfortunately, some of those are already
|
// in "lib/symbols". Unfortunately, some of those are already
|
||||||
@ -62,31 +62,31 @@ ControlMath::ControlMath(Dialog & dialog)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchFunc(kb_action action, string const & arg) const
|
void GuiMath::dispatchFunc(kb_action action, string const & arg) const
|
||||||
{
|
{
|
||||||
dispatch(FuncRequest(action, arg));
|
dispatch(FuncRequest(action, arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchInsert(string const & name) const
|
void GuiMath::dispatchInsert(string const & name) const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_INSERT, '\\' + name);
|
dispatchFunc(LFUN_MATH_INSERT, '\\' + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchSubscript() const
|
void GuiMath::dispatchSubscript() const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_INSERT, "_");
|
dispatchFunc(LFUN_MATH_INSERT, "_");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchSuperscript() const
|
void GuiMath::dispatchSuperscript() const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_INSERT, "^");
|
dispatchFunc(LFUN_MATH_INSERT, "^");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchCubeRoot() const
|
void GuiMath::dispatchCubeRoot() const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_INSERT, "\\root");
|
dispatchFunc(LFUN_MATH_INSERT, "\\root");
|
||||||
dispatchFunc(LFUN_SELF_INSERT, "3");
|
dispatchFunc(LFUN_SELF_INSERT, "3");
|
||||||
@ -94,37 +94,37 @@ void ControlMath::dispatchCubeRoot() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchMatrix(string const & str) const
|
void GuiMath::dispatchMatrix(string const & str) const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_MATRIX, str);
|
dispatchFunc(LFUN_MATH_MATRIX, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchDelim(string const & str) const
|
void GuiMath::dispatchDelim(string const & str) const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_DELIM, str);
|
dispatchFunc(LFUN_MATH_DELIM, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchBigDelim(string const & str) const
|
void GuiMath::dispatchBigDelim(string const & str) const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_BIGDELIM, str);
|
dispatchFunc(LFUN_MATH_BIGDELIM, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::dispatchToggleDisplay() const
|
void GuiMath::dispatchToggleDisplay() const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_MATH_DISPLAY);
|
dispatchFunc(LFUN_MATH_DISPLAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ControlMath::showDialog(string const & name) const
|
void GuiMath::showDialog(string const & name) const
|
||||||
{
|
{
|
||||||
dispatchFunc(LFUN_DIALOG_SHOW, name);
|
dispatchFunc(LFUN_DIALOG_SHOW, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MathSymbol const & ControlMath::mathSymbol(string tex_name) const
|
MathSymbol const & GuiMath::mathSymbol(string tex_name) const
|
||||||
{
|
{
|
||||||
map<string, MathSymbol>::const_iterator it =
|
map<string, MathSymbol>::const_iterator it =
|
||||||
math_symbols_.find(tex_name);
|
math_symbols_.find(tex_name);
|
||||||
@ -137,7 +137,7 @@ MathSymbol const & ControlMath::mathSymbol(string tex_name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string const & ControlMath::texName(char_type math_symbol) const
|
std::string const & GuiMath::texName(char_type math_symbol) const
|
||||||
{
|
{
|
||||||
map<char_type, string>::const_iterator it =
|
map<char_type, string>::const_iterator it =
|
||||||
tex_names_.find(math_symbol);
|
tex_names_.find(math_symbol);
|
@ -1,6 +1,6 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file ControlMath.h
|
* \file GuiMath.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -9,10 +9,10 @@
|
|||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONTROLMATH_H
|
#ifndef GUIMATH_H
|
||||||
#define CONTROLMATH_H
|
#define GUIMATH_H
|
||||||
|
|
||||||
#include "Dialog.h"
|
#include "GuiDialog.h"
|
||||||
#include "lfuns.h" // for kb_action
|
#include "lfuns.h" // for kb_action
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
|
|
||||||
@ -33,18 +33,22 @@ struct MathSymbol {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class ControlMath : public Controller {
|
class GuiMath : public GuiDialog, public Controller
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
ControlMath(Dialog &);
|
GuiMath(LyXView & lv, std::string const & name);
|
||||||
|
|
||||||
/// Nothing to initialise in this case.
|
/// Nothing to initialise in this case.
|
||||||
virtual bool initialiseParams(std::string const &) { return true; }
|
bool initialiseParams(std::string const &) { return true; }
|
||||||
virtual void clearParams() {}
|
void clearParams() {}
|
||||||
virtual void dispatchParams() {}
|
void dispatchParams() {}
|
||||||
virtual bool isBufferDependent() const { return true; }
|
bool isBufferDependent() const { return true; }
|
||||||
|
|
||||||
|
Controller & controller() { return *this; }
|
||||||
|
|
||||||
/// dispatch an LFUN
|
/// dispatch an LFUN
|
||||||
void dispatchFunc(kb_action action, std::string const & arg = std::string()) const;
|
void dispatchFunc(kb_action action,
|
||||||
|
std::string const & arg = std::string()) const;
|
||||||
/// Insert a math symbol into the doc.
|
/// Insert a math symbol into the doc.
|
||||||
void dispatchInsert(std::string const & name) const;
|
void dispatchInsert(std::string const & name) const;
|
||||||
/// Insert a subscript.
|
/// Insert a subscript.
|
||||||
@ -84,4 +88,4 @@ private:
|
|||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
#endif // NOT CONTROLMATH
|
#endif // GUIMATH_H
|
@ -12,7 +12,6 @@
|
|||||||
|
|
||||||
#include "GuiMathMatrix.h"
|
#include "GuiMathMatrix.h"
|
||||||
|
|
||||||
#include "ControlMath.h"
|
|
||||||
#include "EmptyTable.h"
|
#include "EmptyTable.h"
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
@ -29,12 +28,12 @@ using std::string;
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
GuiMathMatrixDialog::GuiMathMatrixDialog(LyXView & lv)
|
GuiMathMatrix::GuiMathMatrix(LyXView & lv)
|
||||||
: GuiDialog(lv, "mathmatrix")
|
: GuiMath(lv, "mathmatrix")
|
||||||
{
|
{
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
setViewTitle(_("Math Matrix"));
|
setViewTitle(_("Math Matrix"));
|
||||||
setController(new ControlMath(*this));
|
setController(this, false);
|
||||||
|
|
||||||
table->setMinimumSize(100, 100);
|
table->setMinimumSize(100, 100);
|
||||||
rowsSB->setValue(5);
|
rowsSB->setValue(5);
|
||||||
@ -65,13 +64,7 @@ GuiMathMatrixDialog::GuiMathMatrixDialog(LyXView & lv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ControlMath & GuiMathMatrixDialog::controller()
|
void GuiMathMatrix::columnsChanged(int)
|
||||||
{
|
|
||||||
return static_cast<ControlMath &>(GuiDialog::controller());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void GuiMathMatrixDialog::columnsChanged(int)
|
|
||||||
{
|
{
|
||||||
char h_align_str[80] = "c";
|
char h_align_str[80] = "c";
|
||||||
int const nx = int(columnsSB->value());
|
int const nx = int(columnsSB->value());
|
||||||
@ -83,18 +76,18 @@ void GuiMathMatrixDialog::columnsChanged(int)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiMathMatrixDialog::rowsChanged(int)
|
void GuiMathMatrix::rowsChanged(int)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiMathMatrixDialog::change_adaptor()
|
void GuiMathMatrix::change_adaptor()
|
||||||
{
|
{
|
||||||
// FIXME: We need a filter for the halign input
|
// FIXME: We need a filter for the halign input
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiMathMatrixDialog::slotOK()
|
void GuiMathMatrix::slotOK()
|
||||||
{
|
{
|
||||||
char v_align_c[] = "tcb";
|
char v_align_c[] = "tcb";
|
||||||
char const c = v_align_c[valignCO->currentIndex()];
|
char const c = v_align_c[valignCO->currentIndex()];
|
||||||
@ -104,18 +97,22 @@ void GuiMathMatrixDialog::slotOK()
|
|||||||
|
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
os << nx << ' ' << ny << ' ' << c << ' ' << sh;
|
||||||
controller().dispatchMatrix(os.str().c_str());
|
dispatchMatrix(os.str().c_str());
|
||||||
|
|
||||||
// close the dialog
|
// close the dialog
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GuiMathMatrixDialog::slotClose()
|
void GuiMathMatrix::slotClose()
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Dialog * createGuiMathMatrix(LyXView & lv) { return new GuiMathMatrix(lv); }
|
||||||
|
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// -*- C++ -*-
|
// -*- C++ -*-
|
||||||
/**
|
/**
|
||||||
* \file GuiMathMatrixDialog.h
|
* \file GuiMathMatrix.h
|
||||||
* This file is part of LyX, the document processor.
|
* This file is part of LyX, the document processor.
|
||||||
* Licence details can be found in the file COPYING.
|
* Licence details can be found in the file COPYING.
|
||||||
*
|
*
|
||||||
@ -11,11 +11,10 @@
|
|||||||
* Full author contact details are available in file CREDITS.
|
* Full author contact details are available in file CREDITS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GUIMATHMATRIXDIALOG_H
|
#ifndef GUIMATHMATRIX_H
|
||||||
#define GUIMATHMATRIXDIALOG_H
|
#define GUIMATHMATRIX_H
|
||||||
|
|
||||||
#include "GuiDialog.h"
|
#include "GuiMath.h"
|
||||||
#include "ControlMath.h"
|
|
||||||
#include "ui_MathMatrixUi.h"
|
#include "ui_MathMatrixUi.h"
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
@ -23,12 +22,12 @@
|
|||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiMathMatrixDialog : public GuiDialog, public Ui::MathMatrixUi
|
class GuiMathMatrix : public GuiMath, public Ui::MathMatrixUi
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiMathMatrixDialog(LyXView & lv);
|
GuiMathMatrix(LyXView & lv);
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void slotOK();
|
void slotOK();
|
||||||
@ -36,9 +35,6 @@ public Q_SLOTS:
|
|||||||
void columnsChanged(int);
|
void columnsChanged(int);
|
||||||
void rowsChanged(int);
|
void rowsChanged(int);
|
||||||
void change_adaptor();
|
void change_adaptor();
|
||||||
|
|
||||||
/// parent controller
|
|
||||||
ControlMath & controller();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace frontend
|
} // namespace frontend
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
#ifndef GUIPARAGRAPH_H
|
#ifndef GUIPARAGRAPH_H
|
||||||
#define GUIPARAGRAPH_H
|
#define GUIPARAGRAPH_H
|
||||||
|
|
||||||
|
// Uncomment this if you prefer dock widget
|
||||||
|
//#define USE_DOCK_WIDGET
|
||||||
|
|
||||||
#include "Layout.h"
|
#include "Layout.h"
|
||||||
#include "ui_ParagraphUi.h"
|
#include "ui_ParagraphUi.h"
|
||||||
#include "Dialog.h"
|
#include "Dialog.h"
|
||||||
|
@ -37,8 +37,6 @@
|
|||||||
#include "support/lstrings.h"
|
#include "support/lstrings.h"
|
||||||
#include "support/lyxalgo.h" // sorted
|
#include "support/lyxalgo.h" // sorted
|
||||||
|
|
||||||
#include "controllers/ControlMath.h"
|
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
@ -88,6 +88,7 @@ SOURCEFILES = \
|
|||||||
GuiKeySymbol.cpp \
|
GuiKeySymbol.cpp \
|
||||||
GuiListings.cpp \
|
GuiListings.cpp \
|
||||||
GuiLog.cpp \
|
GuiLog.cpp \
|
||||||
|
GuiMath.cpp \
|
||||||
GuiMathMatrix.cpp \
|
GuiMathMatrix.cpp \
|
||||||
GuiMenubar.cpp \
|
GuiMenubar.cpp \
|
||||||
GuiNomencl.cpp \
|
GuiNomencl.cpp \
|
||||||
@ -175,6 +176,7 @@ MOCHEADER = \
|
|||||||
GuiKeySymbol.h \
|
GuiKeySymbol.h \
|
||||||
GuiListings.h \
|
GuiListings.h \
|
||||||
GuiLog.h \
|
GuiLog.h \
|
||||||
|
GuiMath.h \
|
||||||
GuiMathMatrix.h \
|
GuiMathMatrix.h \
|
||||||
GuiMenubar.h \
|
GuiMenubar.h \
|
||||||
GuiNomencl.h \
|
GuiNomencl.h \
|
||||||
|
Loading…
Reference in New Issue
Block a user