mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
math icon name fixups
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5676 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
8b817af6f6
commit
4a70c91eee
@ -1,3 +1,8 @@
|
||||
2002-11-20 John Levon <levon@movementarian.org>
|
||||
|
||||
* ControlMath.h:
|
||||
* ControlMath.C: add find_xpm mangler
|
||||
|
||||
2002-11-17 John Levon <levon@movementarian.org>
|
||||
|
||||
* helper_funcs.C and users: specify save/open in file dialog
|
||||
|
@ -13,6 +13,10 @@
|
||||
|
||||
#include "ControlMath.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/filetools.h"
|
||||
#include "debug.h"
|
||||
|
||||
char const * function_names[] = {
|
||||
"arccos", "arcsin", "arctan", "arg", "bmod",
|
||||
"cos", "cosh", "cot", "coth", "csc", "deg",
|
||||
@ -197,3 +201,53 @@ char const * latex_ams_ops[] = {
|
||||
};
|
||||
|
||||
int const nr_latex_ams_ops = sizeof(latex_ams_ops) / sizeof(char const *);
|
||||
|
||||
|
||||
string const find_xpm(string const & name)
|
||||
{
|
||||
string xpm_name = subst(name, ' ', '_');
|
||||
if (xpm_name == "(") xpm_name = "lparen";
|
||||
else if (xpm_name == ")") xpm_name = "rparen";
|
||||
else if (xpm_name == "[") xpm_name = "lbracket";
|
||||
else if (xpm_name == "]") xpm_name = "rbracket";
|
||||
else if (xpm_name == "{") xpm_name = "lbrace";
|
||||
else if (xpm_name == "}") xpm_name = "rbrace";
|
||||
else if (xpm_name == "|") xpm_name = "bars";
|
||||
else if (xpm_name == "Bumpeq") xpm_name = "bumpeq2";
|
||||
else if (xpm_name == "Cap") xpm_name = "cap2";
|
||||
else if (xpm_name == "Cup") xpm_name = "cup2";
|
||||
else if (xpm_name == "Delta") xpm_name = "delta2";
|
||||
else if (xpm_name == "Downarrow") xpm_name = "downarrow2";
|
||||
else if (xpm_name == "Gamma") xpm_name = "gamma2";
|
||||
else if (xpm_name == "Lambda") xpm_name = "lambda2";
|
||||
else if (xpm_name == "Leftarrow") xpm_name = "leftarrow2";
|
||||
else if (xpm_name == "Leftrightarrow") xpm_name = "leftrightarrow2";
|
||||
else if (xpm_name == "Longleftarrow") xpm_name = "longleftarrow2";
|
||||
else if (xpm_name == "Longleftrightarrow") xpm_name = "longleftrightarrow2";
|
||||
else if (xpm_name == "Longrightarrow") xpm_name = "longrightarrow2";
|
||||
else if (xpm_name == "nLeftarrow") xpm_name = "nleftarrow2";
|
||||
else if (xpm_name == "nLeftrightarrow") xpm_name = "nleftrightarrow2";
|
||||
else if (xpm_name == "nRightarrow") xpm_name = "nrightarrow2";
|
||||
else if (xpm_name == "nvDash") xpm_name = "nvdash2";
|
||||
else if (xpm_name == "nVDash") xpm_name = "nvdash3";
|
||||
else if (xpm_name == "Omega") xpm_name = "omega2";
|
||||
else if (xpm_name == "Phi") xpm_name = "phi2";
|
||||
else if (xpm_name == "Pi") xpm_name = "pi2";
|
||||
else if (xpm_name == "Psi") xpm_name = "psi2";
|
||||
else if (xpm_name == "Rightarrow") xpm_name = "rightarrow2";
|
||||
else if (xpm_name == "Sigma") xpm_name = "sigma2";
|
||||
else if (xpm_name == "Subset") xpm_name = "subset2";
|
||||
else if (xpm_name == "Supset") xpm_name = "supset2";
|
||||
else if (xpm_name == "Theta") xpm_name = "theta2";
|
||||
else if (xpm_name == "Uparrow") xpm_name = "uparrow2";
|
||||
else if (xpm_name == "Updownarrow") xpm_name = "updownarrow2";
|
||||
else if (xpm_name == "Upsilon") xpm_name = "upsilon2";
|
||||
else if (xpm_name == "vDash") xpm_name = "vdash2";
|
||||
else if (xpm_name == "Vdash") xpm_name = "vdash3";
|
||||
else if (xpm_name == "Xi") xpm_name = "xi2";
|
||||
|
||||
lyxerr[Debug::GUI] << "Looking for math XPM called \""
|
||||
<< xpm_name << "\"" << std::endl;
|
||||
|
||||
return LibFileSearch("images/math/", xpm_name, "xpm");
|
||||
}
|
||||
|
@ -13,6 +13,8 @@
|
||||
#ifndef CONTROL_MATH_H
|
||||
#define CONTROL_MATH_H
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
extern char const * function_names[];
|
||||
extern int const nr_function_names;
|
||||
extern char const * latex_arrow[];
|
||||
@ -42,4 +44,10 @@ 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 /* CONTROL_MATH_H */
|
||||
|
@ -1,3 +1,9 @@
|
||||
2002-11-20 John Levon <levon@movementarian.org>
|
||||
|
||||
* Toolbar_pimpl.C:
|
||||
* QDelimiterDialog.C:
|
||||
* QMathDialog.C: use find_xpm to mangle name
|
||||
|
||||
2002-11-20 John Levon <levon@movementarian.org>
|
||||
|
||||
* QDelimiterDialog.h:
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "debug.h"
|
||||
|
||||
#include "QMath.h"
|
||||
#include "ControlMath.h"
|
||||
#include "QDelimiterDialog.h"
|
||||
|
||||
#include "iconpalette.h"
|
||||
@ -80,19 +81,18 @@ QDelimiterDialog::QDelimiterDialog(QMath * form)
|
||||
setCaption(_("LyX: Delimiters"));
|
||||
|
||||
for (int i = 0; *delim[i]; ++i) {
|
||||
string xpm_name = LibFileSearch("images/math/", delim[i], "xpm");
|
||||
leftIP->add(QPixmap(xpm_name.c_str()), delim[i], delim[i]);
|
||||
string xpm(find_xpm(delim[i]));
|
||||
leftIP->add(QPixmap(xpm.c_str()), delim[i], delim[i]);
|
||||
rightIP->add(QPixmap(xpm.c_str()), delim[i], delim[i]);
|
||||
}
|
||||
leftIP->add(QPixmap(LibFileSearch("images/math/", "empty", "xpm").c_str()), "empty", "empty");
|
||||
|
||||
string empty_xpm(find_xpm("empty"));
|
||||
|
||||
leftIP->add(QPixmap(empty_xpm.c_str()), "empty", "empty");
|
||||
rightIP->add(QPixmap(empty_xpm.c_str()), "empty", "empty");
|
||||
connect(leftIP, SIGNAL(button_clicked(string const &)), this, SLOT(ldelim_clicked(string const &)));
|
||||
ldelim_clicked("(");
|
||||
|
||||
for (int i = 0; *delim[i]; ++i) {
|
||||
string xpm_name = LibFileSearch("images/math/", delim[i], "xpm");
|
||||
rightIP->add(QPixmap(xpm_name.c_str()), delim[i], delim[i]);
|
||||
}
|
||||
rightIP->add(QPixmap(LibFileSearch("images/math/", "empty", "xpm").c_str()), "empty", "empty");
|
||||
connect(rightIP, SIGNAL(button_clicked(string const &)), this, SLOT(rdelim_clicked(string const &)));
|
||||
ldelim_clicked("(");
|
||||
rdelim_clicked(")");
|
||||
}
|
||||
|
||||
@ -105,9 +105,8 @@ void QDelimiterDialog::insertClicked()
|
||||
|
||||
void QDelimiterDialog::set_label(QLabel * label, string const & str)
|
||||
{
|
||||
string xpm_name = LibFileSearch("images/math/", str, "xpm");
|
||||
label->setUpdatesEnabled(false);
|
||||
label->setPixmap(QPixmap(xpm_name.c_str()));
|
||||
label->setPixmap(QPixmap(find_xpm(str).c_str()));
|
||||
label->setUpdatesEnabled(true);
|
||||
label->update();
|
||||
}
|
||||
|
@ -180,8 +180,7 @@ IconPalette * QMathDialog::makePanel(QWidget * parent, char const ** entries)
|
||||
{
|
||||
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]);
|
||||
p->add(QPixmap(find_xpm(entries[i]).c_str()), entries[i], string("\\") + entries[i]);
|
||||
}
|
||||
connect(p, SIGNAL(button_clicked(string const &)), this, SLOT(symbol_clicked(string const &)));
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
|
||||
#include "QtView.h"
|
||||
|
||||
#include "ControlMath.h"
|
||||
#include "Toolbar_pimpl.h"
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
@ -47,19 +48,20 @@ QPixmap getIconPixmap(int action)
|
||||
{
|
||||
FuncRequest f = lyxaction.retrieveActionArg(action);
|
||||
|
||||
string xpm_name;
|
||||
|
||||
string fullname;
|
||||
|
||||
if (f.action == LFUN_INSERT_MATH && !f.argument.empty()) {
|
||||
xpm_name = "math/" + subst(f.argument.substr(1), ' ', '_');
|
||||
fullname = find_xpm(f.argument.substr(1));
|
||||
} else {
|
||||
string const name = lyxaction.getActionName(f.action);
|
||||
string xpm_name(name);
|
||||
|
||||
if (!f.argument.empty())
|
||||
xpm_name = subst(name + ' ' + f.argument, ' ','_');
|
||||
else
|
||||
xpm_name = name;
|
||||
|
||||
fullname = LibFileSearch("images", xpm_name, "xpm");
|
||||
}
|
||||
|
||||
string fullname = LibFileSearch("images", xpm_name, "xpm");
|
||||
|
||||
if (!fullname.empty()) {
|
||||
lyxerr[Debug::GUI] << "Full icon name is `"
|
||||
@ -67,7 +69,7 @@ QPixmap getIconPixmap(int action)
|
||||
return QPixmap(fullname.c_str());
|
||||
}
|
||||
|
||||
lyxerr << "Unable to find icon `" << xpm_name << "'" << endl;
|
||||
lyxerr << "Unable to find icon `" << fullname << "'" << endl;
|
||||
fullname = LibFileSearch("images", "unknown", "xpm");
|
||||
if (!fullname.empty()) {
|
||||
lyxerr[Debug::GUI] << "Using default `unknown' icon"
|
||||
|
Loading…
Reference in New Issue
Block a user