~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/Xv/tw_hlp_btn.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)
  2 **/
  3 #include <stdio.h>
  4 #include <math.h>
  5 #include <tina/sys.h>
  6 #include <tina/math.h>
  7 #include <tina/tw.h>
  8 #include <tina/tv.h>
  9 #include <tina/tvfuncs.h>
 10 #include <tina/tv_screen.h>
 11 #include <xview/xview.h>
 12 #include <xview/frame.h>
 13 #include <xview/panel.h>
 14 #include <xview/textsw.h>
 15 #include <xview/font.h>
 16 #include <xview/canvas.h>
 17 #include <xview/cms.h>
 18 #include <xview/xv_xrect.h>
 19 #include <xview/openmenu.h>
 20 #include <tina/Xvfuncs.h>
 21 #include <tina/X11funcs.h>
 22 
 23 static void help_proc(char *help_file)
 24 {
 25     static Frame help_tool = 0;
 26     static Textsw help_win = 0;
 27 
 28     if (help_tool)
 29     {
 30         tw_show_tool(help_tool);
 31     }
 32     else
 33     {
 34         help_tool = tw_tool("Tina Help", 10, 10);
 35         help_win = tw_textsubwin(20, 100);
 36         tw_end_tool();
 37     }
 38     print_help(help_win, help_file);
 39 }
 40 
 41 static void button_call(Tw_callback * twc)
 42 {
 43     (*twc->func) (twc->data1);
 44 }
 45 
 46 /* ARGSUSED quieten lint */
 47 static void button_cmnd(Tw_callback * twc)
 48 {
 49 }
 50 
 51 /* ARGSUSED quieten lint */
 52 static void button_prnt(FILE * fp, Tw_callback * twc)
 53 {
 54 }
 55 
 56 /* Create a button labeled "help" which summons help from a file
 57  * <help_file_name>, searching directories in this order: current
 58  * directory, directory specified by environment variable TINA_HELPDIR,
 59  * home directory. (Re-reads file on each button press to simplify
 60  * adding help (instant gratification!) Output to Help tool's text
 61  * subwindow. */
 62 void tw_help_button(char *help_file)
 63 {
 64     int row;
 65     Tw_callback *twc;
 66     Panel_item button;
 67     Panel panel = tw_get_panel();
 68     Bool newrow = tw_get_newrow();
 69     static char name[] = "Help";
 70     char *fullname = tw_extend_fullname(tw_get_toolname(), name);
 71 
 72     button = (Panel_item) xv_create(panel, PANEL_BUTTON,
 73                                     PANEL_LABEL_STRING, name, NULL);
 74 
 75     twc = tw_callback_make(fullname, button, button_call, button_cmnd,
 76      button_prnt, (void *) help_proc, (void *) string_copy(help_file),
 77                            NULL);
 78     xv_set(button, PANEL_NOTIFY_PROC, tw_button_callback,
 79            PANEL_CLIENT_DATA, twc, NULL);
 80 
 81     if (newrow)
 82     {
 83         row = tw_get_row();
 84         xv_set(button, XV_X, xv_col(panel,
 85                                   0), XV_Y, xv_row(panel, row), NULL);
 86         tw_set_newrow(false);
 87     }
 88     format_set_print_sw(textsw_print_sw);
 89 
 90 }
 91 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.