mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 16:31:13 +00:00
first cut of detachable icon menus. Buggy.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5231 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f398f95a2d
commit
1bb56d90c1
@ -1,3 +1,8 @@
|
||||
2002-09-08 John Levon <levon@movementarian.org>
|
||||
|
||||
* QMathDialog.h:
|
||||
* QMathDialog.C: detachable icon menus
|
||||
|
||||
2002-09-08 John Levon <levon@movementarian.org>
|
||||
|
||||
* QMathDialog.C:
|
||||
|
@ -61,6 +61,16 @@ private:
|
||||
QWidget * w_;
|
||||
};
|
||||
|
||||
namespace {
|
||||
char const ** panels[] = {
|
||||
latex_bop, latex_varsz, latex_brel, latex_greek, latex_arrow,
|
||||
latex_dots, latex_deco, latex_misc, latex_ams_ops,
|
||||
latex_ams_rel, latex_ams_nrel, latex_ams_arrows,
|
||||
latex_ams_misc
|
||||
};
|
||||
int const nr_panels = sizeof(panels)/sizeof(panels[0]);
|
||||
}
|
||||
|
||||
|
||||
QMathDialog::QMathDialog(QMath * form)
|
||||
: QMathDialogBase(0, 0, false, 0),
|
||||
@ -72,37 +82,32 @@ QMathDialog::QMathDialog(QMath * form)
|
||||
functionsLB->insertItem(function_names[i]);
|
||||
}
|
||||
|
||||
addPanel("operators", latex_bop);
|
||||
addPanel("bigoperators", latex_varsz);
|
||||
addPanel("relations", latex_brel);
|
||||
addPanel("greek", latex_greek);
|
||||
addPanel("arrows", latex_arrow);
|
||||
addPanel("dots", latex_dots);
|
||||
addPanel("deco", latex_deco);
|
||||
addPanel("misc", latex_misc);
|
||||
addPanel("amsoperators", latex_ams_ops);
|
||||
addPanel("amsrelations", latex_ams_rel);
|
||||
addPanel("amsnegrelations", latex_ams_nrel);
|
||||
addPanel("amsarrows", latex_ams_arrows);
|
||||
addPanel("amsmisc", latex_ams_misc);
|
||||
for (int i = 0; i < nr_panels; ++i) {
|
||||
addPanel(panels[i]);
|
||||
}
|
||||
symbolsWS->raiseWidget(0);
|
||||
symbolsWS->resize(symbolsWS->sizeHint());
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::addPanel(string const & name, char const ** entries)
|
||||
IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
|
||||
{
|
||||
static int id = 0;
|
||||
|
||||
QScrollViewSingle * view = new QScrollViewSingle(symbolsWS);
|
||||
IconPalette * p = new IconPalette(view->viewport());
|
||||
|
||||
IconPalette * p = new IconPalette(parent);
|
||||
for (int i = 0; *entries[i]; ++i) {
|
||||
string xpm_name = LibFileSearch("images/math/", entries[i], "xpm");
|
||||
p->add(QPixmap(xpm_name.c_str()), entries[i], string("\\") + entries[i]);
|
||||
}
|
||||
connect(p, SIGNAL(button_clicked(string)), this, SLOT(symbol_clicked(string)));
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
void QMathDialog::addPanel(char const ** entries)
|
||||
{
|
||||
static int id = 0;
|
||||
|
||||
QScrollViewSingle * view = new QScrollViewSingle(symbolsWS);
|
||||
IconPalette * p = makePanel(view->viewport(), entries);
|
||||
view->setChild(p);
|
||||
symbolsWS->addWidget(view, id++);
|
||||
}
|
||||
@ -133,10 +138,12 @@ void QMathDialog::delimiterClicked()
|
||||
|
||||
void QMathDialog::expandClicked()
|
||||
{
|
||||
int const id = symbolsWS->id(symbolsWS->visibleWidget());
|
||||
IconPalette * p = makePanel(0, panels[id]);
|
||||
p->show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void QMathDialog::functionSelected(const QString & str)
|
||||
{
|
||||
form_->insert_symbol(str.latin1());
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ui/QMathDialogBase.h"
|
||||
|
||||
class QMath;
|
||||
class IconPalette;
|
||||
|
||||
class QMathDialog : public QMathDialogBase
|
||||
{
|
||||
@ -41,8 +42,11 @@ protected:
|
||||
//needed ? virtual void closeEvent(QCloseEvent * e);
|
||||
|
||||
private:
|
||||
/// make a symbol panel
|
||||
IconPalette * makePanel(QWidget * parent, char const ** entries);
|
||||
|
||||
/// add a symbol panel
|
||||
void addPanel(string const & name, char const ** entries);
|
||||
void addPanel(char const ** entries);
|
||||
|
||||
/// owning form
|
||||
QMath * form_;
|
||||
|
Loading…
Reference in New Issue
Block a user