2002-01-09 14:40:34 +00:00
|
|
|
/**
|
|
|
|
* \file FormMathsStyle.C
|
|
|
|
* See the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Alejandro Aguilar Sierra
|
2002-09-05 14:10:50 +00:00
|
|
|
* \author Pablo De Napoli
|
|
|
|
* \author John Levon
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
2002-01-09 14:40:34 +00:00
|
|
|
* Adapted from FormMathsSpace martin.vermeer@hut.fi
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2002-04-23 08:16:27 +00:00
|
|
|
#ifdef __GNUG__
|
2002-01-09 14:40:34 +00:00
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "FormMathsStyle.h"
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "forms/form_maths_style.h"
|
2002-01-29 12:31:24 +00:00
|
|
|
#include "bmtable.h"
|
|
|
|
|
2002-06-13 13:43:51 +00:00
|
|
|
#include "debug.h"
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
|
|
|
|
2002-01-29 12:31:24 +00:00
|
|
|
#include "style.xbm"
|
|
|
|
#include "font.xbm"
|
|
|
|
|
|
|
|
char const * latex_mathstyle[] = {
|
|
|
|
"displaystyle", "textstyle", "scriptstyle", "scriptscriptstyle"
|
|
|
|
};
|
|
|
|
|
|
|
|
kb_action latex_mathfontcmds[] = {
|
|
|
|
LFUN_BOLD, LFUN_SANS, LFUN_ROMAN, LFUN_ITAL, LFUN_CODE,
|
|
|
|
LFUN_NOUN, LFUN_FRAK, LFUN_EMPH, LFUN_FREE, LFUN_DEFAULT
|
|
|
|
};
|
|
|
|
|
2002-01-09 14:40:34 +00:00
|
|
|
|
|
|
|
|
2002-08-15 16:02:22 +00:00
|
|
|
FormMathsStyle::FormMathsStyle(LyXView & lv, Dialogs & d,
|
2002-01-09 14:40:34 +00:00
|
|
|
FormMathsPanel const & p)
|
|
|
|
: FormMathsSub(lv, d, p, _("Maths Styles & Fonts"), false),
|
|
|
|
style_(-1)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
FL_FORM * FormMathsStyle::form() const
|
|
|
|
{
|
|
|
|
if (dialog_.get())
|
2002-03-21 21:21:28 +00:00
|
|
|
return dialog_->form;
|
2002-01-09 14:40:34 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormMathsStyle::build()
|
|
|
|
{
|
2002-06-13 13:43:51 +00:00
|
|
|
dialog_.reset(build_maths_style(this));
|
2002-01-09 14:40:34 +00:00
|
|
|
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_data(dialog_->bmtable_style1, 1, 1,
|
2002-03-21 16:59:12 +00:00
|
|
|
style1_width, style1_height, style1_bits);
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_maxitems(dialog_->bmtable_style1, 1);
|
|
|
|
bc().addReadOnly(dialog_->bmtable_style1);
|
2002-01-09 14:40:34 +00:00
|
|
|
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_data(dialog_->bmtable_style2, 1, 3,
|
2002-03-21 16:59:12 +00:00
|
|
|
style2_width, style2_height, style2_bits);
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_maxitems(dialog_->bmtable_style2, 3);
|
|
|
|
bc().addReadOnly(dialog_->bmtable_style2);
|
2002-01-09 14:40:34 +00:00
|
|
|
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_data(dialog_->bmtable_font1, 1, 5,
|
2002-03-21 16:59:12 +00:00
|
|
|
font1_width, font1_height, font1_bits);
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_maxitems(dialog_->bmtable_font1, 5);
|
|
|
|
bc().addReadOnly(dialog_->bmtable_font1);
|
|
|
|
|
|
|
|
fl_set_bmtable_data(dialog_->bmtable_font2, 1, 3,
|
2002-03-21 16:59:12 +00:00
|
|
|
font2_width, font2_height, font2_bits);
|
2002-01-29 12:31:24 +00:00
|
|
|
fl_set_bmtable_maxitems(dialog_->bmtable_font2, 3);
|
|
|
|
bc().addReadOnly(dialog_->bmtable_font2);
|
|
|
|
|
2002-03-12 14:11:15 +00:00
|
|
|
bc().setCancel(dialog_->button_close);
|
2002-03-21 16:59:12 +00:00
|
|
|
}
|
2002-01-09 14:40:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
void FormMathsStyle::apply()
|
|
|
|
{
|
2002-03-21 21:21:28 +00:00
|
|
|
if ((style_ >= 0) && (style_ < 4))
|
2002-01-09 14:40:34 +00:00
|
|
|
parent_.insertSymbol(latex_mathstyle[style_]);
|
2002-03-21 21:21:28 +00:00
|
|
|
else if ((style_ >= 4) && (style_ < 14))
|
2002-01-10 16:47:03 +00:00
|
|
|
parent_.dispatchFunc(latex_mathfontcmds[style_ - 4]);
|
2002-01-09 14:40:34 +00:00
|
|
|
}
|
|
|
|
|
2002-03-21 16:59:12 +00:00
|
|
|
|
2002-01-29 12:31:24 +00:00
|
|
|
bool FormMathsStyle::input(FL_OBJECT * ob, long data)
|
2002-01-09 14:40:34 +00:00
|
|
|
{
|
2002-01-29 12:31:24 +00:00
|
|
|
style_ = fl_get_bmtable(ob);
|
|
|
|
if (style_ < 0) return false;
|
2002-03-21 21:21:28 +00:00
|
|
|
//if (ob == dialog_->bmtable_style1) style_ += 0;
|
2002-01-29 12:31:24 +00:00
|
|
|
if (ob == dialog_->bmtable_style2) style_ += 1;
|
|
|
|
if (ob == dialog_->bmtable_font1) style_ += 4;
|
|
|
|
if (ob == dialog_->bmtable_font2) style_ += 9;
|
|
|
|
if (data >= 12) style_ = short(data);
|
|
|
|
apply();
|
2002-01-09 14:40:34 +00:00
|
|
|
return true;
|
|
|
|
}
|