]> git.lyx.org Git - lyx.git/blobdiff - src/bmtable.C
removed a warning from screen and added CFLAGS in lyx.spec.in.
[lyx.git] / src / bmtable.C
index 163bc0b25ec1eeb5548f3024b7b4b759ae43586c..ffc064d2b3f7c6c18de8ac9782c42cad52f6977f 100644 (file)
@@ -6,7 +6,7 @@
  *  Description: A bitmap table uses a single bitmap to simulate a 2d array 
  *               of bitmap buttons. It can be used to build bitmap menus.
  *               
- *  Copyright (C) 1995,1996 Alejandro Aguilar Sierra 
+ *  Copyright 1995,1996 Alejandro Aguilar Sierra 
  *
  *  You are free to use and modify this code under the terms of
  *  the GNU General Public Licence version 2 or later. 
 
 #include <config.h>
 
-//     $Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $   
-
-#if !defined(lint) && !defined(WITH_WARNINGS)
-static char vcid[] = "$Id: bmtable.C,v 1.1 1999/09/27 18:44:37 larsbj Exp $";
-#endif /* lint */
-
-#include <stdlib.h>
+#include <cstdlib>
 #include "bmtable.h"
 #include XPM_H_LOCATION
 
@@ -30,7 +24,7 @@ typedef struct   {
    int dx, dy;   /* Size of each item */ 
    int bx, by;   /* Bitmap's position */
    int bw, bh;   /* Bitmap dimensions */
-   char* bdata;  /* Bitmap data */
+   unsigned char * bdata;  /* Bitmap data */
    int maxi;     /* Number of items */
    int i;        /* Current position */
    int mousebut; /* mouse button pushed */  
@@ -38,8 +32,8 @@ typedef struct   {
 } BMTABLE_SPEC;
                  
 
-static int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, 
-                             FL_Coord my, int key, void *xev);
+extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, 
+                                 FL_Coord my, int key, void *xev);
 
 
 FL_OBJECT *fl_create_bmtable(int type, FL_Coord x, FL_Coord y, 
@@ -95,7 +89,8 @@ static void draw_bitmaptable(FL_OBJECT *ob)
        if (sp->bdata)  {
                if (!sp->pix) {
                        sp->pix =  XCreatePixmapFromBitmapData(fl_display, fl_winget(), 
-                                       sp->bdata, sp->bw, sp->bh,
+                                       reinterpret_cast<char*>(sp->bdata),
+                                                              sp->bw, sp->bh,
                                        fl_get_flcolor(ob->lcol), fl_get_flcolor(ob->col1),
                                        DefaultDepth(fl_display, DefaultScreen(fl_display)));
                        XFlush(fl_display);
@@ -171,8 +166,8 @@ static void draw_bitmaptable(FL_OBJECT *ob)
 }
 
 
-static int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, 
-                             FL_Coord my, int key, void */*xev*/)
+extern "C" int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx, 
+                                 FL_Coord my, int key, void */*xev*/)
 {
        int i, j;
        BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
@@ -230,7 +225,7 @@ static int handle_bitmaptable(FL_OBJECT *ob, int event, FL_Coord mx,
  * The user could change these later. See below.
  */ 
 void fl_set_bmtable_data(FL_OBJECT *ob, int nx, int ny, int bw, int bh, 
-                       char *bdata)
+                       unsigned char * bdata)
 {
    BMTABLE_SPEC *sp = (BMTABLE_SPEC *)ob->spec;
    if (sp) {
@@ -291,11 +286,12 @@ void fl_set_bmtable_pixmap_data(FL_OBJECT *ob, int nx, int ny,
 
 void fl_set_bmtable_file(FL_OBJECT *ob, int nx, int ny, char const *filename)
 {      
-   int bw, bh, xh, yh;
-   char *bdata;
+   int xh, yh;
+   unsigned int bw, bh;
+   unsigned char *bdata;
    
-   if(XReadBitmapFileData(filename, (unsigned int *) &bw, (unsigned int *) &bh,
-        (unsigned char **) &bdata, &xh, &yh)==BitmapSuccess)
+   if(XReadBitmapFileData(filename, &bw, &bh,
+                         &bdata, &xh, &yh)==BitmapSuccess)
      fl_set_bmtable_data(ob, nx, ny, bw, bh, bdata);
    XFlush(fl_display);
 }