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

Linux Cross Reference
Tina4/src/Xm/tw_sv_butt.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/tv.h>
  8 #include  <tina/mtw.h>
  9 #include  <tina/tv_screen.h>
 10 #include <tina/Xmfuncs.h>
 11 
 12 static char name[] = "Save";
 13 static void (*func) () = tw_close_call_file;
 14 
 15 static void button_call(Tw_callback * twc, void *call_data)
 16 {
 17     /* last two arguments usually unused */
 18     (*twc->func) (twc->data1, twc->widget, call_data);
 19 }
 20 
 21 static void button_cmnd(void)
 22 {
 23 }
 24 
 25 static void button_prnt(void)
 26 {
 27 }
 28 
 29 /* Create a button labeled "save" which allows the user to "save" their
 30  * button presses (etc). The program MUST be called with the "-s"
 31  * (save) flag (eg my_tina -s).  Then the user's session (button
 32  * presses etc) are recorded) and are saved in a file when the user
 33  * presses the save button.  The file is named <program>.cls, eg
 34  * my_tina.cls. The save button only works ONCE. Next time the program
 35  * can be run with the "-r" (replay) flag (eg my_tina -r). This will
 36  * replay all the user's button presses etc, so the screen should look
 37  * like it did when the "save" button was pressed (except that some
 38  * windows may be covered up). You can use both (eg my_tina -r -s).
 39  * 
 40  * Tool positions (x,y of top left corner) are printed in the .cls file.
 41  * The initial positions of tools can be hard coded using these
 42  * co-ordinates. Eg to put StereoTool next to the top level tool: 1.
 43  * Bring up both tools 2. Position as desired 3. Hit save button 4.
 44  * Read postion of StereoTool in .cls file (say (307, 11, 349, 283, 0)
 45  * (349,283) is the tool's width & height, the 0 is a terminator) 5.
 46  * Edit call to StereoTool: stereo_tool(307,11); . */
 47 void    tw_save_button(void)
 48 {
 49     XmString xmstring;
 50     int     nargs;
 51     Arg     wargs[1];
 52     int     w, h;
 53     Tw_callback *twc;
 54     Widget  panel = tw_get_panel(), button;
 55     char   *fullname = tw_extend_fullname(tw_get_toolname(), name);
 56 
 57     nargs = 0;
 58     xmstring = XmStringCreate(name, XmSTRING_DEFAULT_CHARSET);
 59     XtSetArg(wargs[nargs], XmNlabelString, xmstring);
 60     nargs++;
 61     button = XtCreateManagedWidget("twbutton", xmPushButtonWidgetClass,
 62                                    panel, wargs, nargs);
 63     XmStringFree(xmstring);
 64 
 65     twc = tw_callback_make(fullname, tw_get_tool(), button, button_call, button_cmnd,
 66                            button_prnt, func, NULL, NULL);
 67     XtAddCallback(button, XmNactivateCallback, (void *) tw_callback, (XtPointer) twc);
 68 
 69     w = tw_charwidth(3.0 + strlen(name));
 70     h = tw_charheight(2.0);
 71     tw_set_entry(button, w, h);
 72 }
 73 

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