Back to index

tetex-bin  3.0
Functions
help-window.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void show_help (Widget parent, const char *topic)

Function Documentation

void show_help ( Widget  parent,
const char *  topic 
)

Definition at line 1028 of file help-window.c.

{
    size_t i;
    static Widget help_shell = 0;
    static struct topic_info info;
    static struct topic_item items[NUM_HELP_TOPICS];
    static Boolean first_time = True;
    
    if (help_shell == 0) { /* called 1st time; create widget */

       /* no special callbacks for OK/Cancel buttons */
       info.ok_callback = NULL;
       info.cancel_callback = NULL;
       info.items = items;
/*     info.items_size = NUM_HELP_TOPICS; */
           
       help_shell = create_topic_window(toplevel,
                                    "xdvik: Help",
                                    "help_window",
                                    &info,
                                    initialize_items,
                                    "Close",
                                    /* no Cancel button needed */
                                    NULL);
       info.shell = help_shell;
       
       center_window(help_shell, globals.widgets.top_level);
    }
    
#if MOTIF
    { /* check if resources are set properly */
       Dimension w, h;
       XtVaGetValues(help_shell, XtNwidth, &w, XtNheight, &h, NULL);
       if (h < 200 || w < 400) {
           XDVI_WARNING((stderr, "Initial help window size too small (%dx%d); overriding size.\n"
                       "Please check/update your application defaults file, and set both of\n"
                       "`XDvi*help_text.rows' and `XDvi*help_text.columns' to a realistic value.",
                       h, w));
           XtVaSetValues(help_shell, XtNwidth, 620, XtNheight, 520, NULL);
       }
    }
#endif
    XtPopup(help_shell, XtGrabNone);

    if (topic != NULL) {
       Boolean matched = False;
       for (i = 0; info.items[i].topic != NULL; i++) {
           if (strcmp(info.items[i].topic, topic) == 0) { /* match */
              select_topic(&info, i);
              matched = True;
           }
       }
       if (!matched) {
           XBell(DISP, 0);
           popup_message(help_shell,
                       MSG_WARN,
                       NULL,
                       "Shouldn't happen: Could not find topic `%s' in help list!\n"
                       REPORT_XDVI_BUG_TEMPLATE,
                       topic);
       }
    }
    else if (first_time) {
       first_time = False;
       select_topic(&info, 0);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function: