Back to index

tetex-bin  3.0
Defines | Typedefs | Enumerations | Functions
statusline.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define STAT_BUF_LEN   512

Typedefs

typedef enum statusTimerT_ statusTimerT

Enumerations

enum  statusTimerT_ { STATUS_FOREVER = 0, STATUS_SHORT = 5, STATUS_MEDIUM = 10, STATUS_LONG = 30 }

Functions

void statusline_clear (void)
void statusline_print (statusTimerT timeout, const char *fmt,...)
void statusline_append (statusTimerT timeout, const char *pattern, const char *fmt,...)
Widget create_statusline (void)
void handle_statusline_resize (void)
void force_statusline_update (void)
void toggle_statusline (void)

Define Documentation

#define STAT_BUF_LEN   512

Definition at line 26 of file statusline.h.


Typedef Documentation


Enumeration Type Documentation

Enumerator:
STATUS_FOREVER 
STATUS_SHORT 
STATUS_MEDIUM 
STATUS_LONG 

Definition at line 32 of file statusline.h.


Function Documentation

Widget create_statusline ( void  )

Definition at line 126 of file statusline.c.

{
#ifndef MOTIF
    Position vport_h;
    Position clip_x;
    Position clip_w;
    static Position my_h = 0;
#endif

    /*
     * FIXME: is there a better way to set the y position depending on
     * the height of the widget?
     * It doesn't work to change the value of XtNy *after* creating
     * the widget!
     */

    if (!initialized) {
#ifndef MOTIF
       /*
        * determine height of statusline (depending on the font used).
        * This is not changeable at runtime, so it's determined once and
        * for all at program start.
        */
       statusline = XtVaCreateWidget("statusline", labelWidgetClass, globals.widgets.vport_widget,
                                  XtNlabel, (XtArgVal) "test",
                                  NULL);
       XtVaGetValues(statusline, XtNheight, &my_h, NULL);
       global_statusline_h = my_h;
       XtDestroyWidget(statusline);
#endif
       initialized = True;
       /* initialize g_string_savebuf */
       sprintf(g_string_savebuf, "This is xdvik %s", XDVI_TERSE_VERSION_INFO);
    }
#ifndef MOTIF
    /* determine position and width of statusline */
    XtVaGetValues(globals.widgets.clip_widget, XtNx, &clip_x, XtNwidth, &clip_w, NULL);
    XtVaGetValues(globals.widgets.vport_widget, XtNheight, &vport_h, NULL);
    if (vport_h - my_h <= 0) {
       XDVI_FATAL((stderr, "Window height too small for statusline (minimum value: %d).", my_h));
       return NULL;
    }
    statusline = XtVaCreateManagedWidget("statusline",
                                    labelWidgetClass, globals.widgets.vport_widget,
                                    XtNlabel, (XtArgVal) g_string_savebuf,
                                    XtNwidth, clip_w,
                                    XtNx, clip_x - 1,   /* so that left border becomes invisible */
                                    XtNy, vport_h - my_h,
                                    XtNjustify, XtJustifyLeft,
                                    /* same as for the buttons line */
                                    XtNborder, (XtArgVal) resource.fore_Pixel,
                                    NULL);
#else
    statusline = XtVaCreateManagedWidget("statusline",
                                    xmTextFieldWidgetClass, parent,
                                    XmNalignment, XmALIGNMENT_END,
                                    XmNdepth, (XtArgVal) G_depth,
                                    XmNbottomAttachment, XmATTACH_FORM,
                                    XmNleftAttachment, XmATTACH_FORM,
                                    XmNrightAttachment, XmATTACH_FORM,
                                    XmNleftOffset, 1,
                                    XmNrightOffset, 1,
                                    XmNbottomOffset, 1,
                                    XmNtopOffset, 0,
                                    XmNcursorPositionVisible, False,
                                    XmNautoShowCursorPosition, False,
                                    XmNmarginWidth, 4,
                                    XmNmarginHeight, 1,
                                    XmNeditable, False,
                                    XmNtraversalOn, False,
                                    XmNvalue, g_string_savebuf,
                                    NULL);

    /* Block processing of most interactive events on this widget, except
     * for button events that should navigate the page history.
     */
    XtInsertEventHandler(statusline,
                      KeyPressMask | KeyReleaseMask |
                      PointerMotionMask| PointerMotionHintMask |
                      ButtonMotionMask |
#if !MOTIF
                      ButtonPressMask | ButtonReleaseMask |
#endif
                      FocusChangeMask,
                      /* ButtonPressMask | ButtonReleaseMask | */
                      /*                   PointerMotionMask| PointerMotionHintMask | */
                      /*                   ButtonMotionMask | */
                      True, block_event_callback,
                      (XtPointer)0, 0);
#if MOTIF
    XtInsertEventHandler(statusline,
                      /* suboptimal, but needs to be release not press
                       * since we want to query the current cursor position,
                       * and that may not be set yet in the press event(?).
                       */
                      ButtonReleaseMask,
                      True, handle_statusline_event,
                      (XtPointer)g_string_savebuf, XtListTail);

#endif /* MOTIF */

#endif

    return statusline;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 391 of file statusline.c.

{
#ifdef MOTIF
    XmUpdateDisplay(globals.widgets.top_level);
#else
    XEvent event;
    XSync(DISP, False);
    while (XCheckMaskEvent(DISP, ExposureMask, &event))
        XtDispatchEvent(&event);
#endif /* MOTIF */
}

Here is the caller graph for this function:

Definition at line 316 of file statusline.c.

{
#ifndef MOTIF
    if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) {
       return;
    }

    if (!statusline)
       return;

    /* apparently the x,y values of a widget can only be set at creation time, so
     * the following won't work:
     */

#if 0
    /*
    BROKEN  Position vport_h, clip_x, clip_w;
    BROKEN  static Position my_h = 0;
    BROKEN
    BROKEN  XtVaGetValues(globals.widgets.clip_widget,
    BROKEN                XtNx, &clip_x,
    BROKEN                XtNwidth, &clip_w,
    BROKEN                NULL);
    BROKEN  XtVaGetValues(globals.widgets.vport_widget,
    BROKEN                XtNheight, &vport_h,
    BROKEN                NULL);
    BROKEN
    BROKEN  XtUnmanageChild(statusline);
    BROKEN  XtVaSetValues(statusline,
    BROKEN                             XtNlabel, (XtArgVal) "",
    BROKEN                XtNwidth, clip_w,
    BROKEN                XtNx, clip_x - 1,
    BROKEN                XtNy, vport_h - my_h,
    BROKEN                XtNborderWidth, 1,
    BROKEN                XtNjustify, XtJustifyLeft,
    BROKEN                XtNborder, (XtArgVal) resource.fore_Pixel,
    BROKEN                NULL);
    BROKEN  XtManageChild(statusline);
    BROKEN  XFlush(DISP);
    */
#endif

    /* only this will: */
    XtDestroyWidget(statusline);
    create_statusline();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

void statusline_append ( statusTimerT  timeout,
const char *  pattern,
const char *  fmt,
  ... 
)

Definition at line 488 of file statusline.c.

{
    const char *buf = NULL;
    va_list argp;

    if (XtIsRealized(globals.widgets.top_level) && initialized && (resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0) {
       /* get current statusline contents */
#ifdef MOTIF
       XtVaGetValues(statusline, XmNvalue, &buf, NULL);
#else
       XtVaGetValues(statusline, XtNlabel, &buf, NULL);
#endif
    }

    while (buf != NULL && isspace((int)*buf)) /* skip spaces inserted by statusline appending */
       buf++;
    va_start(argp, fmt);

    if (buf != NULL && memcmp(buf, pattern, strlen(pattern)) == 0) {
       buf = NULL;
    }
    internal_print_statusline(timeout, buf, fmt, argp);
    va_end(argp);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 528 of file statusline.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void statusline_print ( statusTimerT  timeout,
const char *  fmt,
  ... 
)

Definition at line 519 of file statusline.c.

{
    va_list argp;
    va_start(argp, fmt);
    internal_print_statusline(timeout, NULL, fmt, argp);
    va_end(argp);
}

Here is the call graph for this function:

Definition at line 240 of file statusline.c.

{
#ifdef MOTIF
    if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0)
       XtUnmanageChild(statusline);
    else
       XtManageChild(statusline);

#if defined(NEW_MENU_CREATION) || defined(MOTIF)
    set_menu(&resource.expert_mode, Act_set_expert_mode, check_resource_expert);
#else
    set_show_statusline_option();
#endif
#else
    static Boolean initialized = False;
    static Boolean statusline_mapped = False;

    Boolean make_statusline_visible = False;
    Boolean make_statusline_invisible = False;
    
    if (!initialized) {
       statusline_mapped = (resource.expert_mode & XPRT_SHOW_STATUSLINE) != 0;
       initialized = True;
    }

    if ((resource.expert_mode & XPRT_SHOW_STATUSLINE) == 0) {
       if (statusline_mapped)
           make_statusline_invisible = True;
    }
    else {
       if (!statusline_mapped)
           make_statusline_visible = True;
    }

    if (make_statusline_invisible) {
       XtDestroyWidget(statusline);
       statusline_mapped = False;
    }
    if (make_statusline_visible) {
       static Dimension window_w, window_h;

       static Arg arg_wh[] = {
           {XtNwidth, (XtArgVal) &window_w},
           {XtNheight, (XtArgVal) &window_h},
       };
#ifdef MOTIF
       XtGetValues(globals.widgets.main_window, arg_wh, XtNumber(arg_wh));
#else
       XtGetValues(globals.widgets.vport_widget, arg_wh, XtNumber(arg_wh));
#endif
       XtVaSetValues(globals.widgets.vport_widget, XtNresizable, (XtArgVal)True, NULL);
       TRACE_GUI((stderr, "statusline: w %d, h %d", window_w, window_h));
       XtVaSetValues(globals.widgets.vport_widget, XtNwidth, (XtArgVal)window_w, XtNheight, (XtArgVal)window_h, NULL);
       TRACE_GUI((stderr, "after statusline"));
       create_statusline();
       statusline_mapped = True;
    }
#endif /* MOTIF */
}

Here is the call graph for this function:

Here is the caller graph for this function: