Debian Codegraph @

gui/XEchelle/src/XEchelle.c

raw
1 /*===========================================================================
2 Copyright (C) 1995-2009 European Southern Observatory (ESO)
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License as
6 published by the Free Software Foundation; either version 2 of
7 the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public
15 License along with this program; if not, write to the Free
16 Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
17 MA 02139, USA.
18
19 Correspondence concerning ESO-MIDAS should be addressed as follows:
20 Internet e-mail: [email protected]
21 Postal address: European Southern Observatory
22 Data Management Division
23 Karl-Schwarzschild-Strasse 2
24 D 85748 Garching bei Muenchen
25 GERMANY
26
27 .VERSION
28 090825 last modif
29
30
31 ===========================================================================*/
32
33 /*------------------------------------------------------------
34 * This is the project main program file for Ux generated
35 * code. You may add application dependent source code
36 * at the appropriate places.
37 *
38 * Do not modify the statements preceded by the dollar
39 * sign ($), these statements will be replaced with
40 * the appropriate source code when the main program is
41 * automatically generated.
42 *
43 * $Date: 2009-08-25 15:17:06 $ $Revision: 1.2 $
44 *-----------------------------------------------------------*/
45
46 #ifdef XOPEN_CATALOG
47 #include <locale.h>
48 #endif
49
50 #include <UxLib.h>
51
52
53 /*----------------------------------------------
54 * Insert application global declarations here
55 *---------------------------------------------*/
56 #include <gl_defs.h>
57 #include <spec_defs.h>
58 #include <main_defs.h>
59 #include <main_decl.h>
60
61 #include <stdlib.h>
62 #include <signal.h>
63 #include <StdResources.h>
64
65 #include <midas_def.h>
66 #include <osyparms.h>
67
68 /* variables for file list management */
69 swidget FileListInterface, TextFieldSwidget;
70 Widget FileListWidget;
71 int FillTextField;
72 char DirSpecs[MAXLINE];
73
74 extern void SetResources(), WInit_widgets(), InitAllFields();
75
76 extern int FilterFiles();
77
78 extern swidget create_file_selection();
79 extern swidget create_file_list();
80 extern swidget create_lincat_list();
81
82
83 int main(argc,argv)
84 int argc;
85 char *argv[];
86 {
87 /*-----------------------------------------------------------
88 * Declarations.
89 * The default identifier - mainIface will only be declared
90 * if the interface function is global and of type swidget.
91 * To change the identifier to a different name, modify the
92 * string mainIface in the file "main.dat". If "mainIface"
93 * is declared, it will be used below where the return value
94 * of PJ_INTERFACE_FUNCTION_CALL will be assigned to it.
95 *-----------------------------------------------------------*/
96
97 int narg, fsmode = 0;
98 int cntflag = 1, logflag = 2, dispflag = 1;
99
100 swidget mainIface;
101
102 /*--------------------------------
103 * Interface function declaration
104 *-------------------------------*/
105
106 swidget create_ApplicWindow();
107
108
109
110 /*---------------------
111 * Initialize Program
112 *--------------------*/
113
114 #ifdef XOPEN_CATALOG
115 setlocale(LC_ALL, "");
116 #endif
117
118 UxTopLevel = UxInitialize("XEchelle", &argc, argv);
119
120 /*------------------------------------------------------
121 * Insert initialization code for your application here
122 *-----------------------------------------------------*/
123
124 SetResources(argc, argv);
125 SCSPRO("XEchelle");
126 osscatch(SIGINT,SIG_IGN); /* Ignore INT signals (Ctrl-C) */
127 SCECNT("PUT", &cntflag, &logflag, &dispflag);
128 MonitorPid = atoi(argv[1]);
129
130 for (narg = 1; narg < argc; narg++)
131 if ( (argv[narg][0] == '-') && strcmp(argv[narg], "-fs") == 0 )
132 fsmode = 1; /* MOTIF File Sel. */
133
134 if (fsmode == 0)
135 FileListInterface = create_file_list();
136 else
137 FileListInterface = create_file_selection();
138
139 create_lincat_list();
140
141 /*----------------------------------------------------------------
142 * Create and popup the first window of the interface. The
143 * return value can be used in the popdown or destroy functions.
144 * The swidget return value of PJ_INTERFACE_FUNCTION_CALL will
145 * be assigned to "mainIface" from PJ_INTERFACE_RETVAL_TYPE.
146 *---------------------------------------------------------------*/
147
148 mainIface = create_ApplicWindow();
149
150 UxPopupInterface(mainIface, no_grab);
151
152 /* Initializes content of file list */
153 WInit_widgets(
154 UxGetWidget(UxFindSwidget("tf_session1")),
155 UxGetWidget(UxFindSwidget("tf_session")),
156 UxGetWidget(UxFindSwidget("scrolledList1")),
157 UxGetWidget(UxFindSwidget("scrolledList4"))
158 );
159
160 FilterFiles(".");
161 InitAllFields();
162
163 /*-------------------------
164 * Enter the event loop
165 *------------------------*/
166
167 UxMainLoop();
168
169 return 0;
170 }