StrToBmap.c File Reference

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <X11/Xmu/Converters.h>
#include <X11/Xmu/Drawing.h>

Include dependency graph for StrToBmap.c:

Go to the source code of this file.

Defines

#define done(address, type)   { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }

Functions

void XmuCvtStringToBitmap (XrmValuePtr args, Cardinal *num_args, XrmValuePtr fromVal, XrmValuePtr toVal)


Define Documentation

#define done ( address,
type   )     { (*toVal).size = sizeof(type); (*toVal).addr = (XPointer) address; }

Definition at line 82 of file StrToBmap.c.

Referenced by Ado_string(), BuildEvent(), clf(), cpass2(), critical_events(), do_string(), doinclude(), dsort(), expr_out(), f__nowreading(), f__nowwriting(), f_clos(), Fatal(), GetCode_(), Lfinish(), main(), NextInt(), p1getq(), pow_zi(), rawread(), rawwrite(), rd_F(), stfcall(), t_runc(), wavread(), wr_one_init(), XmuCvtStringToBitmap(), XmuCvtStringToGravity(), XmuCvtStringToShapeStyle(), XmuCvtStringToWidget(), XmuWnInitializeNodes(), and yyparse().


Function Documentation

void XmuCvtStringToBitmap ( XrmValuePtr  args,
Cardinal *  num_args,
XrmValuePtr  fromVal,
XrmValuePtr  toVal 
)

Definition at line 88 of file StrToBmap.c.

References addr, data, done, dpy, height, name, NULL, width, XmuLocateBitmapFile(), and XmuReadBitmapDataFromFile().

00090 {
00091     static Pixmap pixmap;               /* static for cvt magic */
00092     char *name = (char *)fromVal->addr;
00093     Screen *screen;
00094     Display *dpy;
00095     XrmDatabase db;
00096     String fn;
00097     unsigned int width, height;
00098     int xhot, yhot;
00099     unsigned char *data;
00100 
00101     if (*num_args != 1)
00102      XtErrorMsg("wrongParameters","cvtStringToBitmap","XtToolkitError",
00103              "String to pixmap conversion needs screen argument",
00104               (String *)NULL, (Cardinal *)NULL);
00105 
00106     if (strcmp(name, "None") == 0) {
00107         pixmap = None;
00108         done(&pixmap, Pixmap);
00109         return;
00110     }
00111 
00112     if (strcmp(name, "ParentRelative") == 0) {
00113         pixmap = ParentRelative;
00114         done(&pixmap, Pixmap);
00115         return;
00116     }
00117 
00118     screen = *((Screen **) args[0].addr);
00119     pixmap = XmuLocateBitmapFile (screen, name,
00120                                   NULL, 0, NULL, NULL, NULL, NULL);
00121     if (pixmap == None) {
00122         dpy = DisplayOfScreen(screen);
00123         db = XrmGetDatabase(dpy);
00124         XrmSetDatabase(dpy, XtScreenDatabase(screen));
00125         fn = XtResolvePathname(dpy, "bitmaps", name, "", NULL, NULL, 0, NULL);
00126         if (!fn)
00127             fn = XtResolvePathname(dpy, "", name, ".xbm", NULL, NULL, 0, NULL);
00128         XrmSetDatabase(dpy, db);
00129         if (fn &&
00130             XmuReadBitmapDataFromFile (fn, &width, &height, &data,
00131                                        &xhot, &yhot) == BitmapSuccess) {
00132             pixmap = XCreatePixmapFromBitmapData (dpy,
00133                                                   RootWindowOfScreen(screen),
00134                                                   (char *) data, width, height,
00135                                                   1, 0, 1);
00136             XFree ((char *)data);
00137         }
00138     }
00139 
00140     if (pixmap != None) {
00141         done (&pixmap, Pixmap);
00142     } else {
00143         XtStringConversionWarning (name, "Pixmap");
00144         return;
00145     }
00146 }

Here is the call graph for this function:


Generated on Sun Mar 4 16:04:23 2007 for Scilab [trunk] by  doxygen 1.5.1