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

Linux Cross Reference
Tina5/tina-tools/tinatool/wdgts/xm/wdgtsXm_tw_init.c

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

  1 /**********
  2  * 
  3  * Copyright (c) 2003, Division of Imaging Science and Biomedical Engineering,
  4  * University of Manchester, UK.  All rights reserved.
  5  * 
  6  * Redistribution and use in source and binary forms, with or without modification, 
  7  * are permitted provided that the following conditions are met:
  8  * 
  9  *   . Redistributions of source code must retain the above copyright notice, 
 10  *     this list of conditions and the following disclaimer.
 11  *    
 12  *   . Redistributions in binary form must reproduce the above copyright notice,
 13  *     this list of conditions and the following disclaimer in the documentation 
 14  *     and/or other materials provided with the distribution.
 15  * 
 16  *   . Neither the name of the University of Manchester nor the names of its
 17  *     contributors may be used to endorse or promote products derived from this 
 18  *     software without specific prior written permission.
 19  * 
 20  * 
 21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
 22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
 23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
 24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
 25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
 26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
 27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
 29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 31  * POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  **********
 34  * 
 35  * Program :    TINA
 36  * File    :  $Source: /home/tina/cvs/tina-tools/tinatool/wdgts/xm/wdgtsXm_tw_init.c,v $
 37  * Date    :  $Date: 2007/02/15 01:55:50 $
 38  * Version :  $Revision: 1.4 $
 39  * CVS Id  :  $Id: wdgtsXm_tw_init.c,v 1.4 2007/02/15 01:55:50 paul Exp $
 40  *
 41  * Author  :  Legacy TINA
 42  *
 43  * Notes :
 44  *
 45  *********
 46 */
 47 
 48 #include "wdgtsXm_tw_init.h"
 49 
 50 #if HAVE_CONFIG_H
 51 #   include <config.h>
 52 #endif
 53 
 54 #include <stdio.h>
 55 #include <signal.h>
 56 #include <tinatool/draw/drawPro.h>
 57 #include <tina/sys/sysDef.h>
 58 #include <tinatool/wdgts/xm/wdgtsXm_tw_tool.h>
 59 
 60 #define PROGRAM_CLASS "tinatool"
 61 
 62 static Bool save = false;
 63 
 64 Bool    tw_save(void)
 65 {
 66     return (save);
 67 }
 68 
 69 static Bool recover = false;
 70 
 71 Bool    tw_recover(void)
 72 {
 73     return (recover);
 74 }
 75 
 76 void tw_set_save(Bool newsave)
 77 {
 78     save =  newsave;
 79 }
 80 
 81 static char *progname;
 82 
 83 char   *tw_get_progname(void)
 84 {
 85     return (progname);
 86 }
 87 
 88 static Display *display = (Display *) NULL;
 89 
 90 Display *tw_get_display(void)
 91 {
 92     return (display);
 93 }
 94 
 95 void   *tw_set_display(Display * newdisplay)
 96 {
 97     display = newdisplay;
 98 }
 99 
100 static XtAppContext context = 0;
101 
102 XtAppContext tw_get_context(void)
103 {
104     return (context);
105 }
106 
107 void    tw_flush(void)
108 {
109     XFlush(display);
110 }
111 
112 void
113 tw_read_args(int *argc, char **argv)
114 {
115     int     i;
116 
117     progname = argv[0];
118 
119     for (i = 1; i < *argc; i++)
120     {
121         if (argv[i][0] != '-')
122             continue;
123         switch (argv[i][1])
124         {
125         case 's':
126             save = true;
127             break;
128         case 'r':
129             recover = true;
130             break;
131         case 'f':
132             recover = true;
133             progname =  argv[i+1];
134             break;
135         case 'e':
136             toggle_bigtolittle();
137             break;
138         }
139     }
140 }
141 
142 int     tw_init(int *argc, char **argv)
143 {
144     Widget  first_tool = XtInitialize("Tinatool",
145                                       PROGRAM_CLASS, NULL, 0,
146                                       argc, argv);
147 
148     extern void alarm_handler();
149     extern void interrupt_handler();
150 
151     context = XtWidgetToApplicationContext(first_tool);
152     display = XtDisplay(first_tool);
153     tw_first_tool_set(first_tool);
154     tw_read_args(argc, argv);
155 
156     /* handle interrupts */
157     (void) signal(SIGALRM, alarm_handler);
158     (void) signal(SIGINT, interrupt_handler);
159 
160     /**** OLD VERSION
161       XtToolkitInitialize();
162       context = XtCreateApplicationContext();
163       display = XtOpenDisplay(context, NULL, NULL,
164       PROGRAM_CLASS, NULL, 0,
165       argc, argv);
166       ****/
167 }
168 

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