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

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

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

  1 /**@(#)
  2 **/
  3 /**
  4 Tina windows top level tool
  5 **/
  6 
  7 #include <stdio.h>
  8 #include <math.h>
  9 #include <tina/sys.h>
 10 #include <tina/math.h>
 11 #include <tina/tw.h>
 12 #include <tina/tv.h>
 13 #include <tina/tvfuncs.h>
 14 #include <tina/tv_screen.h>
 15 #include <xview/xview.h>
 16 #include <xview/frame.h>
 17 #include <xview/panel.h>
 18 #include <xview/textsw.h>
 19 #include <xview/font.h>
 20 #include <xview/canvas.h>
 21 #include <xview/cms.h>
 22 #include <xview/xv_xrect.h>
 23 #include <xview/openmenu.h>
 24 #include <tina/Xvfuncs.h>
 25 #include <tina/X11funcs.h>
 26 
 27 
 28 
 29 static Frame tool, dialog;
 30 static char *toolname;
 31 
 32 void    tw_show_dialog(Frame dialog)
 33 {
 34     xv_set(dialog,
 35            FRAME_CMD_PUSHPIN_IN, TRUE,
 36            XV_SHOW, TRUE,
 37            NULL);
 38 }
 39 
 40 static void dialog_cmnd(Tw_callback * twc, char *args)
 41 {
 42     int     x, y, w, h, closed;
 43 
 44     (void) sscanf(args, "%*s %d %d %d %d %d", &x, &y, &w, &h, &closed);
 45     tw_set_geom((Frame) twc->window, x, y, w, h);
 46     xv_set(twc->window,
 47            FRAME_CMD_PUSHPIN_IN, !closed,
 48            XV_SHOW, !closed,
 49            NULL);
 50 }
 51 
 52 static void dialog_prnt(FILE * fp, Tw_callback * twc)
 53 {
 54     int     x, y, w, h, closed;
 55 
 56     tw_get_geom((Frame) twc->window, &x, &y, &w, &h);
 57     closed = !(int) xv_get(twc->window, XV_SHOW);
 58     (void) fprintf(fp, "%s %d %d %d %d %d\n",
 59                    twc->name, x, y, w, h, closed);
 60 }
 61 
 62 Frame   tw_dialog(char *name)
 63 {
 64     Panel   panel;
 65     Tw_callback *twc;
 66     char   *dialogname;
 67 
 68     dialog = (Frame) xv_create(tw_get_tool(), FRAME_CMD,
 69                                FRAME_LABEL, name,
 70                                FRAME_CMD_PUSHPIN_IN, TRUE,
 71                                XV_SHOW, FALSE,
 72                                NULL);
 73 
 74     panel = (Panel) xv_get(dialog, FRAME_CMD_PANEL);
 75     xv_set(panel,
 76            PANEL_ITEM_X_GAP, 3,
 77            WIN_ROW_GAP, 7,
 78            NULL);
 79 
 80     tw_set_panel(panel);
 81     tw_firstrow();
 82 
 83     tool = tw_get_tool();
 84     toolname = tw_get_toolname();
 85     tw_set_toolname(dialogname = tw_extend_fullname(toolname, name));
 86     tw_set_tool((Frame) dialog);
 87 
 88     twc = tw_callback_make(dialogname, dialog,
 89                            (void (*) ()) NULL, dialog_cmnd, dialog_prnt, (void (*) ()) NULL, NULL,
 90                            NULL);
 91     tw_register_callfrom(twc);
 92 
 93     return (dialog);
 94 }
 95 
 96 void    tw_end_dialog(void)
 97 {
 98     window_fit(tw_get_panel());
 99     window_fit(dialog);
100 
101     tw_set_tool((Frame) tool);
102     tw_set_toolname(toolname);
103 
104     tw_set_pos(dialog, 100, 100);
105     tw_show_dialog(dialog);
106 }
107 

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