*
* Dependencies: Xlib, XForms, Lyx
*
- * Copyright: (c) 1995, 1996, Alejandro Aguilar Sierra
+ * Copyright: 1995, 1996, Alejandro Aguilar Sierra
*
* You are free to use and modify it under the terms of
* the GNU General Public Licence version 2 or later.
#endif
#include <algorithm>
-using std::max;
#include "lyx_main.h"
#include "buffer.h"
#include "LyXView.h"
#include "support/lstrings.h"
#include "debug.h"
+#include "lyxfunc.h"
#include "formula.h"
#include "math_panel.h"
#include "math_parser.h"
-extern void SmallUpdate(signed char);
-extern void BeforeChange();
-extern void Update(signed char);
-extern int UnlockInset(UpdatableInset *);
+using std::max;
+using std::endl;
+using std::ostream;
+
extern short greek_kb_flag;
-extern MiniBuffer * minibuffer;
extern BufferView * current_view;
w = h = 0;
form = 0;
i = 0;
- ww = 2*FL_abs(FL_BOUND_WIDTH);
+ ww = 2 * FL_abs(FL_BOUND_WIDTH);
x = y = ww;
y += 8;
bitmap = new FL_OBJECTP[nb];
BitmapMenu::~BitmapMenu()
{
- if (next) delete next;
- if (form->visible) Hide();
- fl_free_form(form);
- delete[] bitmap;
+ delete next;
+ if (form->visible) Hide();
+ fl_free_form(form);
+ delete[] bitmap;
}
void BitmapMenu::Create()
{
- if (i<nb) {
+ if (i < nb) {
lyxerr << "Error: Bitmaps not created!" << endl;
return;
}
form = fl_bgn_form(FL_UP_BOX, w, h);
- for (i= 0; i<nb; i++) {
+ for (i = 0; i < nb; ++i) {
fl_add_object(form, bitmap[i]);
bitmap[i]->u_vdata = this;
}
{
if (active == this) {
int k = 0;
- for (i= 0; i<nb; i++) {
+ for (i = 0; i < nb; ++i) {
if (bitmap[i] == ob)
return k+fl_get_bmtable(ob);
k += fl_get_bmtable_maxitems(bitmap[i]);
if (BitmapMenu::active == 0)
return 0;
- if(((XEvent *)xev)->type == ButtonPress)
+ if(static_cast<XEvent *>(xev)->type == ButtonPress)
{
BitmapMenu::active->Hide();
return 1;
}
- if(((XEvent *)xev)->type == KeyPress)
+ if(static_cast<XEvent *>(xev)->type == KeyPress)
{
char c[5];
KeySym keysym;
- XLookupString(&((XEvent *)xev)->xkey, &c[0], 5, &keysym, 0);
+ XLookupString(&static_cast<XEvent *>(xev)->xkey, &c[0], 5, &keysym, 0);
if (keysym == XK_Left)
BitmapMenu::active->Prev(); else
if (keysym == XK_Right)
extern "C" void math_cb(FL_OBJECT* ob, long data)
{
- BitmapMenu* menu = (BitmapMenu*)ob->u_vdata;
+ BitmapMenu * menu = static_cast<BitmapMenu*>(ob->u_vdata);
int i = menu->GetIndex(ob);
char const *s = 0;
}
if (s) {
- if (current_view->available() && lyxrc->display_shortcuts) {
- minibuffer->Set("Inserting symbol ", s);
+ if (current_view->available() && lyxrc.display_shortcuts) {
+ current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s);
}
current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s);
}
math_insert_symbol(s);
if (greek_kb_flag<2) {
greek_kb_flag = 0;
- UnlockInset(current_view->buffer()->the_locking_inset);
+ current_view->unlockInset(current_view->the_locking_inset);
}
return True;
} else
return False;
}
-void math_insert_symbol(char const* s)
+
+void math_insert_symbol(char const * s)
{
if (current_view->available()) {
- if (!current_view->buffer()->the_locking_inset) {
+ if (!current_view->the_locking_inset) {
InsetFormula * new_inset = new InsetFormula();
- BeforeChange();
- current_view->buffer()->insertInset(new_inset);
+ current_view->beforeChange();
+ current_view->insertInset(new_inset);
// Update(1);//BUG
- new_inset->Edit(0, 0);
- new_inset->InsertSymbol(s);
+ new_inset->Edit(current_view, 0, 0, 0);
+ new_inset->InsertSymbol(current_view, s);
} else
- if (current_view->buffer()->the_locking_inset->LyxCode() == Inset::MATH_CODE)
- static_cast<InsetFormula*>(current_view->buffer()->the_locking_inset)->InsertSymbol(s);
+ if (current_view->the_locking_inset->LyxCode() == Inset::MATH_CODE)
+ static_cast<InsetFormula*>(current_view->the_locking_inset)->InsertSymbol(current_view, s);
else
lyxerr << "Math error: attempt to write on a wrong "
"class of inset." << endl;
}
}
+
BitmapMenu * sym_menu= 0;
void create_symbol_menues(FD_panel * symb_form)
case 5: latex_str = latex_misc; break;
}
- for (int k = 0; latex_str[k][0]>' '; k++) {
+ for (int k = 0; latex_str[k][0] > ' '; ++k) {
if (strcmp(latex_str[k], s) == 0) {
id = k;
break;