1 /* NIGHTFALL Light Curve Synthesis Program                                 */
2 /* Copyright (C) 1999 Rainer Wichmann                                      */
3 /*                                                                         */
4 /*  This program is free software; you can redistribute it                 */
5 /*  and/or modify                                                          */
6 /*  it under the terms of the GNU General Public License as                */
7 /*  published by                                                           */
8 /*  the Free Software Foundation; either version 2 of the License, or      */
9 /*  (at your option) any later version.                                    */
10 /*                                                                         */
11 /*  This program is distributed in the hope that it will be useful,        */
12 /*  but WITHOUT ANY WARRANTY; without even the implied warranty of         */
13 /*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          */
14 /*  GNU General Public License for more details.                           */
15 /*                                                                         */
16 /*  You should have received a copy of the GNU General Public License      */
17 /*  along with this program; if not, write to the Free Software            */
18 /*  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.              */
19 
20 
21 /* ANSI C forbids an empty source file, so put this outside                */
22 
23 #include <math.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include "Light.h"
28 
29 #ifdef _WITH_GTK
30 #ifdef GDK_DISABLE_DEPRECATED
31 GdkPixmap* gdk_pixmap_create_from_xpm_d  (GdkDrawable    *drawable,
32 					  GdkBitmap     **mask,
33 					  const GdkColor *transparent_color,
34 					  gchar         **data);
35 #endif
36 static int         hidestate[NUM_MAG+1];   /* which button is hidden ? */
37 static GtkWidget   *buttmag[NUM_MAG+1][2]; /* filter buttons           */
38 
39 static GtkWidget   *buttphase;             /* Single phase             */
40 
41 static GtkWidget   *xpm_button (GSList *group, GtkWidget *parent,
42 			     char **xpm_data,
43 			     gchar *label_text);
44 
45 static void        showhidepage3 ();
46 
47 /* XPM data  */
48 static char * xpm_data_yes[] = {
49   "14 10 3 1",
50   "       c None",
51   ".      c #000000000000",
52   "X      c #FFFFFFFFFFFF",
53   "              ",
54   "   .......    ",
55   "   ..XXX..    ",
56   "   .X.X.X.    ",
57   "   .XX.XX.    ",
58   "   .X.X.X.    ",
59   "   ..XXX..    ",
60   "   .......    ",
61   "              ",
62   "              "};
63 
64 /* XPM data  */
65 static char * xpm_data_no[] = {
66   "14 10 3 1",
67   "       c None",
68   ".      c #000000000000",
69   "X      c #FFFFFFFFFFFF",
70   "              ",
71   "   .......    ",
72   "   .XXXXX.    ",
73   "   .XXXXX.    ",
74   "   .XXXXX.    ",
75   "   .XXXXX.    ",
76   "   .XXXXX.    ",
77   "   .......    ",
78   "              ",
79   "              "};
80 
81 
82 /******************************************************************
83  @package   nightfall
84  @author    Rainer Wichmann (rwichman@lsw.uni-heidelberg.de)
85  @version   1.0
86  @short     Update plot flag on third notebook page (the plot data)
87  @param     (void)
88  @return    (void)
89  @heading   Graphical User Interface
90 *******************************************************************/
updateplotflagpage3()91 void updateplotflagpage3 ()
92 {
93 
94   int j;  /* loop variable */
95 
96   if (Flags.PlotBand < 0)       Flags.PlotBand = Vmag;
97   if (Flags.PlotBand > NUM_MAG) Flags.PlotBand = NUM_MAG;
98 
99   if (Flags.edu)
100     {
101       Flags.PlotBand = (Flags.PlotBand < NUM_MAG) ? Vmag : NUM_MAG;
102       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttphase),          TRUE);
103     }
104 
105   /* set all to FALSE      */
106   for (j = 0; j <= NUM_MAG; ++j) {
107 
108     if (buttmag[j][OFF] == NULL || buttmag[j][ON] == NULL)
109       continue;
110 
111     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON]),
112 				FALSE);
113     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][OFF]),
114 				FALSE);
115   }
116 
117   /* set all to ALL        */
118   if (hidestate[Flags.PlotBand] == OFF)
119     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[Flags.PlotBand][ON]),
120 				TRUE);
121   else
122     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[Flags.PlotBand][OFF]),
123 				TRUE);
124 
125 
126   return;
127 
128 }
129 
130 /******************************************************************
131  @package   nightfall
132  @author    Rainer Wichmann (rwichman@lsw.uni-heidelberg.de)
133  @version   1.0
134  @short     Show/Hide buttons on third notebook page (the plot data)
135  @param     (void)
136  @return    (void)
137  @heading   Graphical User Interface
138 *******************************************************************/
showhidepage3()139 void showhidepage3 ()
140 {
141   int j;  /* loop variable */
142 
143   if (Flags.Passbands[NUM_MAG] > 0 || Flags.Passbands[NUM_MAG+1] > 0) {
144     gtk_widget_hide (buttmag[NUM_MAG][OFF]);
145     hidestate[NUM_MAG] = OFF;
146   }  else {
147     if (GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON])->active) {
148       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON]),
149 				     FALSE);
150       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][OFF]),
151 				     TRUE);
152     }
153     gtk_widget_hide (buttmag[NUM_MAG][ON]);
154     hidestate[NUM_MAG] = ON;
155   }
156 
157   for (j = 0; j < NUM_MAG; ++j) {
158 
159     if (buttmag[j][OFF] == NULL || buttmag[j][ON] == NULL)
160       continue;
161 
162     if (Flags.Passbands[j] > 0) {
163       gtk_widget_hide (buttmag[j][OFF]);
164       hidestate[j] = OFF;
165     } else {
166       if (GTK_TOGGLE_BUTTON (buttmag[j][ON])->active) {
167 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][ON]),
168 				    FALSE);
169 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][OFF]),
170 				    TRUE);
171       }
172       gtk_widget_hide (buttmag[j][ON]);
173       hidestate[j] = ON;
174     }
175   }
176 
177   return;
178 
179 }
180 
181 /******************************************************************
182  @package   nightfall
183  @author    Rainer Wichmann (rwichman@lsw.uni-heidelberg.de)
184  @version   1.0
185  @short     Update buttons on third notebook page (the plot data)
186  @param     (void)
187  @return    (void)
188  @heading   Graphical User Interface
189 *******************************************************************/
updatepage3()190 void updatepage3 ()
191 {
192   int j;  /* loop variable */
193 
194   if (Flags.Passbands[NUM_MAG] > 0 || Flags.Passbands[NUM_MAG+1] > 0) {
195 
196     if (hidestate[NUM_MAG] == ON) {
197       if (GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][OFF])->active) {
198 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][OFF]),
199 				    FALSE);
200 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON]),
201 				    TRUE);
202       }
203       gtk_widget_show (buttmag[NUM_MAG][ON]);
204       gtk_widget_hide (buttmag[NUM_MAG][OFF]);
205       hidestate[NUM_MAG] = OFF;
206     }
207 
208   }  else {
209 
210     if (hidestate[NUM_MAG] == OFF) {
211       if (GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON])->active) {
212 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON]),
213 				    FALSE);
214 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][OFF]),
215 				    TRUE);
216       }
217       gtk_widget_show (buttmag[NUM_MAG][OFF]);
218       gtk_widget_hide (buttmag[NUM_MAG][ON]);
219       hidestate[NUM_MAG] = ON;
220     }
221   }
222 
223   for (j = 0; j < NUM_MAG; ++j) {
224 
225     if (buttmag[j][OFF] == NULL || buttmag[j][ON] == NULL)
226       continue;
227 
228     if (Flags.Passbands[j] > 0) {
229       if (hidestate[j] == ON) {
230 	if (GTK_TOGGLE_BUTTON (buttmag[j][OFF])->active) {
231 	  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][OFF]),
232 				      FALSE);
233 	  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][ON]),
234 				      TRUE);
235 	}
236 	gtk_widget_show (buttmag[j][ON]);
237 	gtk_widget_hide (buttmag[j][OFF]);
238 	hidestate[j] = OFF;
239       }
240     } else {
241       if (hidestate[j] == OFF) {
242 	if (GTK_TOGGLE_BUTTON (buttmag[j][ON])->active) {
243 	  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][ON]),
244 				      FALSE);
245 	  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON (buttmag[j][OFF]),
246 				      TRUE);
247 	}
248 	gtk_widget_show (buttmag[j][OFF]);
249 	gtk_widget_hide (buttmag[j][ON]);
250 	hidestate[j] = ON;
251       }
252     }
253 
254   }
255 
256   return;
257 
258 }
259 
260 /******************************************************************
261  @package   nightfall
262  @author    Rainer Wichmann (rwichman@lsw.uni-heidelberg.de)
263  @version   1.1
264  @short     Make third notebook page
265  @param     (void)
266  @return    (void)
267  @heading   Graphical User Interface
268 *******************************************************************/
makepage3()269 void makepage3 ()
270 {
271   GtkWidget   *box11;
272   GtkWidget   *inbox;
273   GtkWidget   *label;
274   GtkWidget   *button;
275   GtkWidget   *table;
276   GSList      *group;
277 
278   int          j;
279 
280 #ifdef USING_GTK2
281   GtkWidget   *pixy;
282   GtkWidget   *boxpix;
283 #endif
284 
285   for (j = 0; j < (NUM_MAG+1); ++j)
286     {
287       buttmag[j][ON]  = NULL;
288       buttmag[j][OFF] = NULL;
289     }
290 
291   label = gtk_label_new (_("Plot Options"));
292   box11 = gtk_hbox_new (TRUE, 0);
293   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), box11, label);
294   gtk_widget_show (label);
295   gtk_widget_show (box11);
296 
297 
298 
299   inbox = gtk_vbox_new (FALSE, 0);
300   gtk_container_set_border_width (GTK_CONTAINER (inbox), 0);
301   gtk_box_pack_start (GTK_BOX (box11), inbox, TRUE, TRUE, 0);
302   gtk_widget_show (inbox);
303 
304   table = gtk_table_new (7, 4, TRUE);
305 
306     label = gtk_label_new (_("PlotCurve Options"));
307     gtk_table_attach (GTK_TABLE(table), label, 0, 2, 0, 1,
308           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
309     gtk_widget_show (label);
310 
311   /* --------------- Plot options   --------------------------------- */
312 
313       buttphase = gtk_radio_button_new_with_label (NULL, _("Single Phase"));
314       gtk_signal_connect (GTK_OBJECT (buttphase), "toggled",
315                       GTK_SIGNAL_FUNC (radio_graph), (gpointer) "1");
316       if (Flags.plot < 2)
317         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttphase), TRUE);
318       gtk_table_attach (GTK_TABLE(table), buttphase, 0, 1, 1, 2,
319           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
320       gtk_widget_show (buttphase);
321 
322       group  = gtk_radio_button_group (GTK_RADIO_BUTTON (buttphase));
323 
324       if (Flags.edu == ON)
325 	goto skipped_to_zoom_p;
326 
327       button = gtk_radio_button_new_with_label (group, _("Double Phase"));
328       gtk_signal_connect (GTK_OBJECT (button), "toggled",
329                       GTK_SIGNAL_FUNC (radio_graph), (gpointer) "2");
330       if (Flags.plot == 2)
331         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
332       gtk_table_attach (GTK_TABLE(table), button, 1, 2, 1, 2,
333           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
334       gtk_widget_show (button);
335 
336       group  = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
337 
338       button = gtk_radio_button_new_with_label (group, _("Zoom Eclipse (S)"));
339       gtk_signal_connect (GTK_OBJECT (button), "toggled",
340                       GTK_SIGNAL_FUNC (radio_graph), (gpointer) "S");
341       if (Flags.plot == 4)
342         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
343       gtk_table_attach (GTK_TABLE(table), button, 1, 2, 2, 3,
344           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
345       gtk_widget_show (button);
346 
347       group  = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
348 
349  skipped_to_zoom_p:
350 
351       button = gtk_radio_button_new_with_label (group, _("Zoom Eclipse (P)"));
352       gtk_signal_connect (GTK_OBJECT (button), "toggled",
353                       GTK_SIGNAL_FUNC (radio_graph), (gpointer) "P");
354       if (Flags.plot == 3)
355         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
356       if (Flags.edu == ON)
357 	gtk_table_attach (GTK_TABLE(table), button, 2, 3, 1, 2,
358 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
359       else
360 	gtk_table_attach (GTK_TABLE(table), button, 0, 1, 2, 3,
361 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
362 
363       gtk_widget_show (button);
364 
365   /* --------------- Passband  -------------------------------------- */
366 
367 
368       gtk_widget_realize(top_window); /* needed for style             */
369 
370       buttmag[NUM_MAG][ON] =
371 	  xpm_button (NULL, top_window, xpm_data_yes, _("Radial Velocity"));
372 
373       if (Flags.PlotBand == mag1 || Flags.PlotBand == mag2)
374         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[NUM_MAG][ON]),
375 				     TRUE);
376       gtk_signal_connect (GTK_OBJECT (buttmag[NUM_MAG][ON]), "toggled",
377                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "1");
378       gtk_tooltips_set_tip (tooltips, buttmag[NUM_MAG][ON],
379                      "Plot Radial Velocities",NULL);
380       if (Flags.edu == ON)
381 	gtk_table_attach (GTK_TABLE(table), buttmag[NUM_MAG][ON], 0, 2, 4, 5,
382 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
383       else
384 	gtk_table_attach (GTK_TABLE(table), buttmag[NUM_MAG][ON], 2, 4, 0, 1,
385 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
386       gtk_widget_show (buttmag[NUM_MAG][ON]);
387 
388       group = gtk_radio_button_group(GTK_RADIO_BUTTON (buttmag[NUM_MAG][ON]));
389 
390       buttmag[NUM_MAG][OFF] =
391 	  xpm_button (group, top_window, xpm_data_no, _("Radial Velocity"));
392       gtk_signal_connect (GTK_OBJECT (buttmag[NUM_MAG][OFF]), "toggled",
393                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "1");
394       gtk_tooltips_set_tip (tooltips, buttmag[NUM_MAG][OFF],
395                      "Plot Radial Velocities",NULL);
396       if (Flags.edu == ON)
397 	gtk_table_attach (GTK_TABLE(table), buttmag[NUM_MAG][OFF], 0, 2, 4, 5,
398 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
399       else
400 	gtk_table_attach (GTK_TABLE(table), buttmag[NUM_MAG][OFF], 2, 4, 0, 1,
401 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
402       gtk_widget_show (buttmag[NUM_MAG][OFF]);
403 
404       group = gtk_radio_button_group(GTK_RADIO_BUTTON (buttmag[NUM_MAG][OFF]));
405 
406       buttmag[Vmag][ON] =
407 	  xpm_button (group, top_window, xpm_data_yes, Filters[Vmag]);
408       if (Flags.PlotBand == Vmag)
409         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Vmag][ON]),
410 				     TRUE);
411       gtk_signal_connect (GTK_OBJECT (buttmag[Vmag][ON]), "toggled",
412                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "V");
413       if (Flags.edu == ON)
414 	gtk_table_attach (GTK_TABLE(table), buttmag[Vmag][ON], 2, 3, 4, 5,
415 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
416       else
417 	gtk_table_attach (GTK_TABLE(table), buttmag[Vmag][ON], 2, 3, 2, 3,
418 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
419       gtk_widget_show (buttmag[Vmag][ON]);
420 
421       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Vmag][ON]));
422 
423       buttmag[Vmag][OFF] =
424 	  xpm_button (group, top_window, xpm_data_no, Filters[Vmag]);
425       gtk_signal_connect (GTK_OBJECT (buttmag[Vmag][OFF]), "toggled",
426                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "V");
427       if (Flags.edu == ON)
428 	gtk_table_attach (GTK_TABLE(table), buttmag[Vmag][OFF], 2, 3, 4, 5,
429 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
430       else
431 	gtk_table_attach (GTK_TABLE(table), buttmag[Vmag][OFF], 2, 3, 2, 3,
432 			  GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
433       gtk_widget_show (buttmag[Vmag][OFF]);
434 
435       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Vmag][OFF]));
436 
437 
438       if (Flags.edu == ON)
439 	goto skipped_passbands;
440 
441       buttmag[Umag][ON] =
442 	  xpm_button (group, top_window, xpm_data_yes, Filters[Umag]);
443       if (Flags.PlotBand == Umag)
444         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Umag][ON]),
445 				     TRUE);
446       gtk_signal_connect (GTK_OBJECT (buttmag[Umag][ON]), "toggled",
447                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "U");
448       gtk_table_attach (GTK_TABLE(table), buttmag[Umag][ON], 2, 3, 1, 2,
449           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
450       gtk_widget_show (buttmag[Umag][ON]);
451 
452       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Umag][ON]));
453 
454       buttmag[Umag][OFF] =
455 	  xpm_button (group, top_window, xpm_data_no, Filters[Umag]);
456       gtk_signal_connect (GTK_OBJECT (buttmag[Umag][OFF]), "toggled",
457                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "U");
458       gtk_table_attach (GTK_TABLE(table), buttmag[Umag][OFF], 2, 3, 1, 2,
459           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
460       gtk_widget_show (buttmag[Umag][OFF]);
461 
462       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Umag][OFF]));
463 
464       buttmag[Bmag][ON] =
465 	  xpm_button (group, top_window, xpm_data_yes, Filters[Bmag]);
466       if (Flags.PlotBand == Bmag)
467         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Bmag][ON]),
468 				     TRUE);
469       gtk_signal_connect (GTK_OBJECT (buttmag[Bmag][ON]), "toggled",
470                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "B");
471       gtk_table_attach (GTK_TABLE(table), buttmag[Bmag][ON], 3, 4, 1, 2,
472           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
473       gtk_widget_show (buttmag[Bmag][ON]);
474 
475       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Bmag][ON]));
476 
477       buttmag[Bmag][OFF] =
478 	  xpm_button (group, top_window, xpm_data_no, Filters[Bmag]);
479       gtk_signal_connect (GTK_OBJECT (buttmag[Bmag][OFF]), "toggled",
480                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "B");
481       gtk_table_attach (GTK_TABLE(table), buttmag[Bmag][OFF], 3, 4, 1, 2,
482           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
483       gtk_widget_show (buttmag[Bmag][OFF]);
484 
485       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Bmag][OFF]));
486 
487 
488 
489       buttmag[Rmag][ON] =
490 	  xpm_button (group, top_window, xpm_data_yes, Filters[Rmag]);
491       if (Flags.PlotBand == Rmag)
492         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Rmag][ON]),
493 				     TRUE);
494       gtk_signal_connect (GTK_OBJECT (buttmag[Rmag][ON]), "toggled",
495                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "R");
496       gtk_table_attach (GTK_TABLE(table), buttmag[Rmag][ON], 3, 4, 2, 3,
497           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
498       gtk_widget_show (buttmag[Rmag][ON]);
499 
500       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Rmag][ON]));
501 
502       buttmag[Rmag][OFF] =
503 	  xpm_button (group, top_window, xpm_data_no, Filters[Rmag]);
504       gtk_signal_connect (GTK_OBJECT (buttmag[Rmag][OFF]), "toggled",
505                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "R");
506       gtk_table_attach (GTK_TABLE(table), buttmag[Rmag][OFF], 3, 4, 2, 3,
507           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
508       gtk_widget_show (buttmag[Rmag][OFF]);
509 
510       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Rmag][OFF]));
511 
512 
513       buttmag[Imag][ON] =
514 	  xpm_button (group, top_window, xpm_data_yes, Filters[Imag]);
515       if (Flags.PlotBand == Imag)
516         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Imag][ON]),
517 				     TRUE);
518       gtk_signal_connect (GTK_OBJECT (buttmag[Imag][ON]), "toggled",
519                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "I");
520       gtk_table_attach (GTK_TABLE(table), buttmag[Imag][ON], 2, 3, 3, 4,
521           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
522       gtk_widget_show (buttmag[Imag][ON]);
523 
524       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Imag][ON]));
525 
526       buttmag[Imag][OFF] =
527 	  xpm_button (group, top_window, xpm_data_no, Filters[Imag]);
528       gtk_signal_connect (GTK_OBJECT (buttmag[Imag][OFF]), "toggled",
529                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "I");
530       gtk_table_attach (GTK_TABLE(table), buttmag[Imag][OFF], 2, 3, 3, 4,
531           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
532       gtk_widget_show (buttmag[Imag][OFF]);
533 
534       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Imag][OFF]));
535 
536 
537       buttmag[Jmag][ON] =
538 	  xpm_button (group, top_window, xpm_data_yes, Filters[Jmag]);
539       if (Flags.PlotBand == Jmag)
540         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Jmag][ON]),
541 				     TRUE);
542       gtk_signal_connect (GTK_OBJECT (buttmag[Jmag][ON]), "toggled",
543                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "J");
544       gtk_table_attach (GTK_TABLE(table), buttmag[Jmag][ON], 3, 4, 3, 4,
545           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
546       gtk_widget_show (buttmag[Jmag][ON]);
547 
548       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Jmag][ON]));
549 
550       buttmag[Jmag][OFF] =
551 	  xpm_button (group, top_window, xpm_data_no, Filters[Jmag]);
552       gtk_signal_connect (GTK_OBJECT (buttmag[Jmag][OFF]), "toggled",
553                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "J");
554       gtk_table_attach (GTK_TABLE(table), buttmag[Jmag][OFF], 3, 4, 3, 4,
555           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
556       gtk_widget_show (buttmag[Jmag][OFF]);
557 
558       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Jmag][OFF]));
559 
560 
561       buttmag[Hmag][ON] =
562 	  xpm_button (group, top_window, xpm_data_yes, Filters[Hmag]);
563       if (Flags.PlotBand == Hmag)
564         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Hmag][ON]),
565 				     TRUE);
566       gtk_signal_connect (GTK_OBJECT (buttmag[Hmag][ON]), "toggled",
567                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "H");
568       gtk_table_attach (GTK_TABLE(table), buttmag[Hmag][ON], 2, 3, 4, 5,
569           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
570       gtk_widget_show (buttmag[Hmag][ON]);
571 
572       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Hmag][ON]));
573 
574       buttmag[Hmag][OFF] =
575 	  xpm_button (group, top_window, xpm_data_no, Filters[Hmag]);
576       gtk_signal_connect (GTK_OBJECT (buttmag[Hmag][OFF]), "toggled",
577                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "H");
578       gtk_table_attach (GTK_TABLE(table), buttmag[Hmag][OFF], 2, 3, 4, 5,
579           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
580       gtk_widget_show (buttmag[Hmag][OFF]);
581 
582       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Hmag][OFF]));
583 
584 
585 
586       buttmag[Kmag][ON] =
587 	  xpm_button (group, top_window, xpm_data_yes, Filters[Kmag]);
588       if (Flags.PlotBand == Kmag)
589         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[Kmag][ON]),
590 				     TRUE);
591       gtk_signal_connect (GTK_OBJECT (buttmag[Kmag][ON]), "toggled",
592                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "K");
593       gtk_table_attach (GTK_TABLE(table), buttmag[Kmag][ON], 3, 4, 4, 5,
594           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
595       gtk_widget_show (buttmag[Kmag][ON]);
596 
597       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Kmag][ON]));
598 
599       buttmag[Kmag][OFF] =
600 	  xpm_button (group, top_window, xpm_data_no, Filters[Kmag]);
601       gtk_signal_connect (GTK_OBJECT (buttmag[Kmag][OFF]), "toggled",
602                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "K");
603       gtk_table_attach (GTK_TABLE(table), buttmag[Kmag][OFF], 3, 4, 4, 5,
604           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
605       gtk_widget_show (buttmag[Kmag][OFF]);
606 
607       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[Kmag][OFF]));
608 
609 
610       buttmag[umag][ON] =
611 	  xpm_button (group, top_window, xpm_data_yes, Filters[umag]);
612       if (Flags.PlotBand == umag)
613         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[umag][ON]),
614 				     TRUE);
615       gtk_signal_connect (GTK_OBJECT (buttmag[umag][ON]), "toggled",
616                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "u");
617       gtk_table_attach (GTK_TABLE(table), buttmag[umag][ON], 2, 3, 5, 6,
618           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
619       gtk_widget_show (buttmag[umag][ON]);
620 
621       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[umag][ON]));
622 
623       buttmag[umag][OFF] =
624 	  xpm_button (group, top_window, xpm_data_no, Filters[umag]);
625       gtk_signal_connect (GTK_OBJECT (buttmag[umag][OFF]), "toggled",
626                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "u");
627       gtk_table_attach (GTK_TABLE(table), buttmag[umag][OFF], 2, 3, 5, 6,
628           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
629       gtk_widget_show (buttmag[umag][OFF]);
630 
631       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[umag][OFF]));
632 
633 
634       buttmag[vmag][ON] =
635 	  xpm_button (group, top_window, xpm_data_yes, Filters[vmag]);
636       if (Flags.PlotBand == vmag)
637         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[vmag][ON]),
638 				     TRUE);
639       gtk_signal_connect (GTK_OBJECT (buttmag[vmag][ON]), "toggled",
640                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "v");
641       gtk_table_attach (GTK_TABLE(table), buttmag[vmag][ON], 3, 4, 5, 6,
642           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
643       gtk_widget_show (buttmag[vmag][ON]);
644 
645       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[vmag][ON]));
646 
647       buttmag[vmag][OFF] =
648 	  xpm_button (group, top_window, xpm_data_no, Filters[vmag]);
649       gtk_signal_connect (GTK_OBJECT (buttmag[vmag][OFF]), "toggled",
650                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "v");
651       gtk_table_attach (GTK_TABLE(table), buttmag[vmag][OFF], 3, 4, 5, 6,
652           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
653       gtk_widget_show (buttmag[vmag][OFF]);
654 
655       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[vmag][OFF]));
656 
657 
658       buttmag[bmag][ON] =
659 	  xpm_button (group, top_window, xpm_data_yes, Filters[bmag]);
660       if (Flags.PlotBand == bmag)
661         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[bmag][ON]),
662 				     TRUE);
663       gtk_signal_connect (GTK_OBJECT (buttmag[bmag][ON]), "toggled",
664                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "b");
665       gtk_table_attach (GTK_TABLE(table), buttmag[bmag][ON], 2, 3, 6, 7,
666           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
667       gtk_widget_show (buttmag[bmag][ON]);
668 
669       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[bmag][ON]));
670 
671       buttmag[bmag][OFF] =
672 	  xpm_button (group, top_window, xpm_data_no, Filters[bmag]);
673       gtk_signal_connect (GTK_OBJECT (buttmag[bmag][OFF]), "toggled",
674                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "b");
675       gtk_table_attach (GTK_TABLE(table), buttmag[bmag][OFF], 2, 3, 6, 7,
676           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
677       gtk_widget_show (buttmag[bmag][OFF]);
678 
679       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[bmag][OFF]));
680 
681 
682       buttmag[ymag][ON] =
683 	  xpm_button (group, top_window, xpm_data_yes, Filters[ymag]);
684       if (Flags.PlotBand == ymag)
685         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (buttmag[ymag][ON]),
686 				     TRUE);
687       gtk_signal_connect (GTK_OBJECT (buttmag[ymag][ON]), "toggled",
688                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "y");
689       gtk_table_attach (GTK_TABLE(table), buttmag[ymag][ON], 3, 4, 6, 7,
690           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
691       gtk_widget_show (buttmag[ymag][ON]);
692 
693       group = gtk_radio_button_group (GTK_RADIO_BUTTON (buttmag[ymag][ON]));
694 
695       buttmag[ymag][OFF] =
696 	  xpm_button (group, top_window, xpm_data_no, Filters[ymag]);
697       gtk_signal_connect (GTK_OBJECT (buttmag[ymag][OFF]), "toggled",
698                       GTK_SIGNAL_FUNC (radio_band), (gpointer) "y");
699       gtk_table_attach (GTK_TABLE(table), buttmag[ymag][OFF], 3, 4, 6, 7,
700           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
701       gtk_widget_show (buttmag[ymag][OFF]);
702 
703  skipped_passbands:
704 
705       showhidepage3 ();   /* set initial show/hide state              */
706 
707       gtk_widget_unrealize(top_window);
708 
709       /* --------------- View Geometry Options -------------------------- */
710 
711       if (Flags.edu == ON)
712 	goto skipped_geo_opts;
713 
714       label = gtk_label_new (_("ViewGeometry Options"));
715 
716       gtk_table_attach (GTK_TABLE(table), label, 0, 2, 3, 4,
717 			GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
718       gtk_widget_show (label);
719 
720       button = gtk_radio_button_new_with_label (NULL, _("Stars"));
721       gtk_signal_connect (GTK_OBJECT (button), "toggled",
722                       GTK_SIGNAL_FUNC (radio_visual), (gpointer) "v");
723 #ifndef _WITH_GNUPLOT
724       if (Flags.visualize == ON) {
725         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
726 #else
727       if (Flags.visualize == ON || Flags.visualize == 2
728                                 || Flags.visualize == 4) {
729         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
730 #endif
731         /* TG_visualstore = Flags.visualize; */
732         Flags.visualize = OFF;
733       }
734       gtk_table_attach (GTK_TABLE(table), button, 0, 1, 4, 5,
735           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
736       gtk_widget_show (button);
737 
738       group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
739       button = gtk_radio_button_new_with_label (group,
740 						_("Potential Contours"));
741       gtk_signal_connect (GTK_OBJECT (button), "toggled",
742                       GTK_SIGNAL_FUNC (radio_visual), (gpointer) "c");
743       if (Flags.visualize == 3 || Flags.visualize == OFF) {
744         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
745         Flags.visualize = OFF;
746       }
747       gtk_table_attach (GTK_TABLE(table), button, 0, 1, 5, 6,
748           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
749       gtk_widget_show (button);
750 
751 
752 #ifndef _WITH_GNUPLOT
753 
754       group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
755       button = gtk_radio_button_new_with_label (group, _("View Potential"));
756       gtk_signal_connect (GTK_OBJECT (button), "toggled",
757                       GTK_SIGNAL_FUNC (radio_visual), (gpointer) "i");
758       if (Flags.visualize == 2) {
759         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
760         Flags.visualize = OFF;
761       }
762       gtk_table_attach (GTK_TABLE(table), button, 1, 2, 4, 5,
763           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
764       gtk_widget_show (button);
765 
766       group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
767       button = gtk_radio_button_new_with_label (group, _("All Three"));
768       gtk_signal_connect (GTK_OBJECT (button), "toggled",
769                       GTK_SIGNAL_FUNC (radio_visual), (gpointer) "a");
770       if (Flags.visualize == 4 ) {
771         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
772         Flags.visualize = OFF;
773       }
774       gtk_table_attach (GTK_TABLE(table), button, 1, 2, 5, 6,
775           GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
776       gtk_widget_show (button);
777 
778 #endif
779 
780   /* --------------- Hardcopy  -------------------------------------- */
781 
782 #ifndef USING_GTK2
783       button = gtk_check_button_new_with_label (_("postscript"));
784 #else
785       button = gtk_check_button_new ();
786       boxpix = gtk_hbox_new (FALSE, 0);
787       gtk_container_set_border_width (GTK_CONTAINER (boxpix), 0);
788 
789       pixy = gtk_image_new_from_stock (GTK_STOCK_PRINT,
790 				       GTK_ICON_SIZE_SMALL_TOOLBAR);
791 
792       label = gtk_label_new (_("postscript"));
793       gtk_box_pack_start (GTK_BOX (boxpix),
794                                pixy, TRUE, TRUE, 0);
795       gtk_box_pack_start (GTK_BOX (boxpix), label, TRUE, TRUE, 0);
796       gtk_container_add (GTK_CONTAINER (button), boxpix);
797       gtk_widget_show (label);
798       gtk_widget_show (pixy);
799       gtk_widget_show (boxpix);
800 #endif
801 
802       if (Flags.eps == ON )
803         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
804       gtk_signal_connect (GTK_OBJECT (button), "toggled",
805 			  GTK_SIGNAL_FUNC (toggle_psfile), NULL );
806       gtk_tooltips_set_tip (tooltips, button,
807 			    _("Send graphic output to PS file"),NULL);
808       gtk_table_attach (GTK_TABLE(table), button, 0, 1, 6, 7,
809 			GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
810       gtk_widget_show (button);
811 
812 #ifdef _WITH_OPENGL
813 
814   /* --------------- Use OpenGL  ------------------------------------ */
815 
816       button = gtk_check_button_new_with_label (_("OpenGL"));
817       if (Flags.use_opengl == ON )
818         gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
819       gtk_signal_connect (GTK_OBJECT (button), "toggled",
820 			  GTK_SIGNAL_FUNC (toggle_opengl), NULL );
821       gtk_tooltips_set_tip (tooltips, button,
822 			    _("Use OpenGL for animation"),NULL);
823       gtk_table_attach (GTK_TABLE(table), button, 1, 2, 6, 7,
824 			GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 2, 2);
825       gtk_widget_show (button);
826 
827 #endif
828 
829       skipped_geo_opts:
830 
831   gtk_widget_show (table);
832   gtk_box_pack_start (GTK_BOX (inbox), table, FALSE, FALSE, 0);
833 
834   return;
835 }
836 
837 /******************************************************************
838  @package   nightfall
839  @author    Rainer Wichmann (rwichman@lsw.uni-heidelberg.de)
840  @version   1.0
841  @short     Convenience function, creates radio button with image+label
842  @tip       Original: Ian Main <imain@gtk.org>, Tony Gale <gale@gtk.org>
843  @param     (GSList)    *group          The button group
844  @param     (GtkWidget) *parent         The parent window
845  @param     (gchar)     *xpm_data       The xpm data
846  @param     (gchar)     *label_text     The label
847  @return    (GtkWidget) *button
848  @heading   Graphical User Interface
849 *******************************************************************/
850 GtkWidget *xpm_button (GSList *group, GtkWidget *parent,
851 			     char **xpm_data,
852 			     gchar *label_text)
853 {
854   GtkWidget *button;           /* the button to return            */
855   GtkWidget *hbox;             /* the hbox for label + image      */
856   GtkWidget *label;            /* the label                       */
857   GtkWidget *pixmapwid;        /* the pixmap widget               */
858   GdkPixmap *pixmap;           /* the pixmap                      */
859   GdkBitmap *mask;             /* the mask for pixmap             */
860   GtkStyle  *style;            /* parent window style             */
861 
862   /* create a hbox for xpm and label                              */
863   hbox = gtk_hbox_new (FALSE, 0);
864   gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
865 
866   /* the label                                                    */
867   label = gtk_label_new (label_text);
868 
869   /* the xpm                                                      */
870   style = gtk_widget_get_style(parent);
871 
872   /* - load the xpm data                                          */
873   pixmap = gdk_pixmap_create_from_xpm_d (parent->window, &mask,
874 				       &style->bg[GTK_STATE_NORMAL],
875 				       xpm_data);
876   pixmapwid = gtk_pixmap_new (pixmap, mask);
877 
878   /* pack the pixmap and label into the hbox                      */
879   gtk_box_pack_start (GTK_BOX (hbox),
880 		      pixmapwid, FALSE, FALSE, 2);
881   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 3);
882 
883   gtk_widget_show(pixmapwid);
884   gtk_widget_show(label);
885 
886   /* create and return the button                                 */
887   gtk_widget_show(hbox);
888 
889   button = gtk_radio_button_new (group);
890   gtk_container_add (GTK_CONTAINER (button), hbox);
891 
892   return (button);
893 }
894 
895 #endif
896