Back to index

lightning-sunbird  0.9+nobinonly
Functions
printplugin.c File Reference
#include "npapi.h"
#include "printplugin.h"
#include "prprf.h"
#include <stdlib.h>
#include <stdio.h>

Go to the source code of this file.

Functions

NPMIMEType dupMimeType (NPMIMEType type)
static void privatePrintScreenMessage (PluginInstance *This)
static void setCursor (PluginInstance *This)
static void addXtEventHandler (PluginInstance *This)
void printScreenMessage (PluginInstance *This)
void printEPSMessage (PluginInstance *This, FILE *output, NPWindow window)

Function Documentation

static void addXtEventHandler ( PluginInstance This) [static]

Definition at line 127 of file printplugin.c.

{
#ifdef MOZ_X11
     Display *dpy = (Display*) This->display;
     Window xwin = (Window) This->window;
     Widget xt_w = XtWindowToWidget(dpy, xwin);
     if (xt_w)
     {
         long event_mask = ExposureMask | ButtonReleaseMask | ButtonPressMask;
         XSelectInput(dpy, xwin, event_mask);
         XtAddEventHandler(xt_w, event_mask, False, (XtEventHandler)xt_event_handler, This);
     }
#endif /* MOZ_X11 */
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 54 of file printplugin.c.

{
    NPMIMEType mimetype = NPN_MemAlloc(strlen(type)+1);
    if (mimetype)
        strcpy(mimetype, type);
    return mimetype;
}

Here is the call graph for this function:

void printEPSMessage ( PluginInstance This,
FILE output,
NPWindow  window 
)

Definition at line 150 of file printplugin.c.

{
    char *string;
    int x,y,h,w;
    
    if (!output)
      return;

    fprintf(output, "%%!PS-Adobe-3.0 EPSF-3.0\n");
    fprintf(output, "%%%%BoundingBox: 0 0 %d %d\n", window.width, window.height);
    fprintf(output, "%%%%EndComments\n");
    fprintf(output, "gsave\n");

    w = 3 * window.width  / 4;
    h =     window.height / 2;
    x = (window.width - w)/2; /* center */
    y = h/2;

    /* draw a rectangle */
    fprintf(output, "newpath\n");
    fprintf(output, "%d %d moveto 0 %d rlineto %d 0 rlineto 0 %d rlineto\n",
            x, y, h, w, -h);
    fprintf(output, "closepath\n");
    fprintf(output, "stroke\n");

    /* draw a string */
    string = This->pluginsPrintMessage;
    if (string && *string)
    {
        fprintf(output, "/Times-Roman findfont 300 scalefont setfont\n");
        fprintf(output, "%d %d moveto\n", x + window.width/10, window.height / 2);
        fprintf(output, "(%s) show\n",string);
    }

    fprintf(output,"grestore\n");
    fprintf(output,"%%%%EOF\n");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 142 of file printplugin.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void privatePrintScreenMessage ( PluginInstance This) [static]

Definition at line 63 of file printplugin.c.

{
#ifdef MOZ_X11
    GC gc;
    unsigned int h,w;
    int x,y,l;
    const char *string;
    gc = XCreateGC(This->display, This->window, 0, NULL);

    /* draw a rectangle */
    h = This->height/2;
    w = 3 * This->width/4;
    x = (This->width - w)/2; /* center */
    y = h/2;
    XDrawRectangle(This->display, This->window, gc, x, y, w, h);

    /* draw a string */
    string = This->pluginsPrintMessage;
    if (string && *string)
    {
        l = strlen(string);
        x += This->width/10;
        XDrawString(This->display, This->window, gc, x, This->height/2, string, l);
    }
    XFreeGC(This->display, gc);
#endif /* MOZ_X11 */
}

Here is the caller graph for this function:

static void setCursor ( PluginInstance This) [static]

Definition at line 92 of file printplugin.c.

{
#ifdef MOZ_X11
    static Cursor nullPluginCursor = None;
    if (!nullPluginCursor)
    {
        nullPluginCursor = XCreateFontCursor(This->display, XC_hand2);
    }
    if (nullPluginCursor)
    {
        XDefineCursor(This->display, This->window, nullPluginCursor);
    }
#endif /* MOZ_X11 */
}

Here is the caller graph for this function: