]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbols.C
Hopefully fix the problem with stateText() in lyxfont.C
[lyx.git] / src / mathed / math_symbols.C
index 3766bc2e53b859c30dcb446cb658e08ad671e4ca..0fe7451ce7abab29e6970bf0894bb125c1c031ab 100644 (file)
@@ -9,7 +9,7 @@
  *
  *  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.
@@ -23,7 +23,6 @@
 #endif
 
 #include <algorithm>
-using std::max;
 
 #include "lyx_main.h"
 #include "buffer.h"
@@ -33,14 +32,17 @@ using std::max;
 #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 Update(signed char);
-//extern int UnlockInset(UpdatableInset *);
+using std::max;
+using std::endl;
+using std::ostream;
+
 extern short greek_kb_flag;
 
 extern BufferView * current_view;
@@ -157,10 +159,10 @@ BitmapMenu::BitmapMenu(int n,  FL_OBJECT * bt, BitmapMenu * prevx): nb(n)
 
 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;
 }
 
 
@@ -211,12 +213,12 @@ BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char cons
 
 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;
    }
@@ -228,7 +230,7 @@ int BitmapMenu::GetIndex(FL_OBJECT* ob)
 {
    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]);
@@ -271,7 +273,7 @@ extern "C" int C_peek_event(FL_FORM *form, void *ptr) {
 
 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;
 
@@ -303,7 +305,7 @@ extern "C" void math_cb(FL_OBJECT* ob, long data)
    }
   
    if (s)  {
-      if (current_view->available() && lyxrc->display_shortcuts) {
+      if (current_view->available() && lyxrc.display_shortcuts) {
          current_view->owner()->getMiniBuffer()->Set("Inserting symbol ", s);
       }
       current_view->owner()->getLyXFunc()->Dispatch(LFUN_INSERT_MATH, s);
@@ -371,11 +373,11 @@ void math_insert_symbol(char const * s)
         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->the_locking_inset->LyxCode() == Inset::MATH_CODE)
-               static_cast<InsetFormula*>(current_view->the_locking_inset)->InsertSymbol(s);
+               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;
@@ -454,7 +456,7 @@ char const ** pixmapFromBitmapData(char const * s, int wx, int hx)
         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;