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

Linux Cross Reference
Tina4/src/Xv/tw_svalue.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 
 24 
 25 static void svalue_call(Tw_callback * twc)
 26 {
 27     void    (*set) () = (void (*) ()) twc->data2;
 28     char   *string = (char *) xv_get(twc->window, PANEL_VALUE);
 29 
 30     (*set) (string);
 31 }
 32 
 33 static void svalue_cmnd(Tw_callback * twc, char *args)
 34 {
 35     void    (*set) () = (void (*) ()) twc->data2;
 36     char    string[64];
 37 
 38     (void) sscanf(args, "%*s %s", string);
 39     (*set) (string);
 40     xv_set(twc->window, PANEL_VALUE, string, NULL);
 41 }
 42 
 43 static void svalue_prnt(FILE * fp, Tw_callback * twc)
 44 {
 45     char   *(*get) () = (char (*) ()) twc->data1;
 46 
 47     (void) fprintf(fp, "%s %s\n", twc->name, (*get) ());
 48 }
 49 
 50 Tw_callback *tw_svalue(char *name, char *(*get) ( /* ??? */ ), void (*set) ( /* ??? */ ), int nchars)
 51 {
 52     Panel_item text;
 53     Panel   panel = tw_get_panel();
 54     Bool    newrow = tw_get_newrow();
 55     int     row;
 56     Tw_callback *twc;
 57     char   *fullname = tw_extend_fullname(tw_get_toolname(), name);
 58 
 59     text = xv_create(panel, PANEL_TEXT,
 60                      PANEL_LABEL_STRING, name,
 61                      PANEL_VALUE_DISPLAY_LENGTH, nchars,
 62                      PANEL_VALUE, (*get) (),
 63                      PANEL_NOTIFY_LEVEL, PANEL_ALL,
 64                      NULL);
 65 
 66     twc = tw_callback_make(fullname, text,
 67                            svalue_call, svalue_cmnd, svalue_prnt, (void (*) ()) NULL, (void *) get,
 68                            (void *) set);
 69 
 70     xv_set(text,
 71            PANEL_NOTIFY_PROC, tw_text_callback,
 72            PANEL_CLIENT_DATA, twc,
 73            NULL);
 74 
 75     if (newrow)
 76     {
 77         row = tw_get_row();
 78         xv_set(text,
 79                XV_X, xv_col(panel, 0),
 80                XV_Y, xv_row(panel, row),
 81                NULL);
 82         tw_set_newrow(false);
 83     }
 84     return (twc);
 85 }
 86 
 87 void    tw_svalue_reset(Tw_callback * twc)
 88 {
 89     char   *(*get) ();
 90     char   *string;
 91 
 92     if (twc == NULL)
 93         return;
 94 
 95     get = (char *(*)()) twc->data1;
 96     string = get();
 97     xv_set(twc->window, PANEL_VALUE, string, NULL);
 98 }
 99 

~ [ 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.