]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/math_symbols.C
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / mathed / math_symbols.C
index 4598abe487413e8afaecff464659a9957a9e8273..c3a0bc56d3f79f13c6ffbd736b10ddb72271ef2c 100644 (file)
@@ -23,6 +23,7 @@
 #endif
 
 #include <algorithm>
+using std::max;
 
 #include "lyx_main.h"
 #include "buffer.h"
@@ -31,7 +32,7 @@
 #include "lyxrc.h"
 #include "LyXView.h"
 #include "support/lstrings.h"
-#include "error.h"
+#include "debug.h"
 
 #include "formula.h"
 
@@ -132,7 +133,7 @@ static signed char Latin2Greek[] =  {
 }; 
 
 extern char** mathed_get_pixmap_from_icon(int d);
-static void math_cb(FL_OBJECT*, long);
+extern "C" void math_cb(FL_OBJECT*, long);
 static char** pixmapFromBitmapData(char const *, int, int);
 void math_insert_symbol(char const* s);
 Bool math_insert_greek(char const c);
@@ -179,7 +180,7 @@ void BitmapMenu::Show()  {
 }
 
 FL_OBJECT*
-BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, char* data, Bool vert)
+BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, unsigned char* data, Bool vert)
 {
    if (i>=nb)
      return 0;
@@ -207,7 +208,7 @@ BitmapMenu::AddBitmap(int id, int nx, int ny, int bw, int bh, char* data, Bool v
 void BitmapMenu::Create()
 {
    if (i<nb)  {
-      fprintf(stderr, "Error: Bitmaps not created!");
+          lyxerr << "Error: Bitmaps not created!" << endl;
       return;
    }
    form = fl_bgn_form(FL_UP_BOX, w, h);   
@@ -216,7 +217,7 @@ void BitmapMenu::Create()
       bitmap[i]->u_vdata = this;
    }
    fl_end_form();
-   fl_register_raw_callback(form, KeyPressMask, peek_event);
+   fl_register_raw_callback(form, KeyPressMask, C_peek_event);
 }
 
 int BitmapMenu::GetIndex(FL_OBJECT* ob)
@@ -258,13 +259,19 @@ int peek_event(FL_FORM * /*form*/, void *xev)
    return 0;  
 }
 
-static void math_cb(FL_OBJECT* ob, long data)
+// This is just a wrapper.
+extern "C" int C_peek_event(FL_FORM *form, void *ptr) {
+  return peek_event(form,ptr);
+}
+
+
+extern "C" void math_cb(FL_OBJECT* ob, long data)
 {
    BitmapMenu* menu = (BitmapMenu*)ob->u_vdata;
    int i = menu->GetIndex(ob);   
    char const *s = 0;
 
-//   fprintf(stderr, "data[%d]", data);     
+//   lyxerr << "data[" << data << "]";
    if (i<0) return;
    switch (data)  {
     case MM_GREEK: 
@@ -286,7 +293,7 @@ static void math_cb(FL_OBJECT* ob, long data)
       s = latex_misc[i];  
       break;
     case MM_DOTS: 
-//      fprintf(stderr, "dots[%s %d]", latex_dots[i], i);
+//      lyxerr << "dots[" << latex_dots[i] << " " << i << "]";
       s = latex_dots[i-29];  
       break;
    }
@@ -365,7 +372,8 @@ void math_insert_symbol(char const* s)
        if (current_view->currentBuffer()->the_locking_inset->LyxCode()==Inset::MATH_CODE)
          ((InsetFormula*)current_view->currentBuffer()->the_locking_inset)->InsertSymbol(s);
         else 
-         fprintf(stderr, "Math error: attempt to write on a wrong class of inset.\n");
+               lyxerr << "Math error: attempt to write on a wrong "
+                       "class of inset." << endl;
    }
 }
 
@@ -449,11 +457,10 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx)
        if (id>=0) break;
     }
     if (i<6 && id>=0) {
-       char *bdata = 0;
+       unsigned char *bdata = 0;
        int w = 0, h = 0, dw = 0, dh = 0;
 
-       lyxerr.debug(string("Imando ") + tostr(i) + ", " + tostr(id),
-                    Error::MATHED);
+       lyxerr[Debug::MATHED] << "Imando " << i << ", " << id << endl;
        switch (i) {
         case 0: 
            if (id<=10) {
@@ -517,7 +524,7 @@ char** pixmapFromBitmapData(char const *s, int wx, int hx)
        int ww = w/dw, hh = h/dh, x, y;
    
        XImage *xima = XCreateImage(fl_display, 0, 1, XYBitmap, 0, 
-                                   bdata, w, h, 8, 0);
+                                   reinterpret_cast<char*>(bdata), w, h, 8, 0);
        xima->byte_order = LSBFirst;
        xima->bitmap_bit_order = LSBFirst;
        x = (id % dw)*ww;