home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Science / Science.zip / fblnk224.zip / report.c < prev    next >
C/C++ Source or Header  |  1999-01-28  |  2KB  |  77 lines

  1. /*  report.c  */
  2. /*  part of the fitsblink program  */
  3. /*  routines for the output of astrometry data  */
  4. /*  Jure Skvarc                                 */
  5. #include <stdio.h> 
  6. #include <forms.h>
  7.  
  8.  
  9. #include "formblink.h"
  10. #include "functs.h"
  11.  
  12. extern STATE state;
  13. extern BLINK_FRAME *frame;
  14.  
  15. void reportC(FL_OBJECT *obj, long val)
  16.  
  17. {
  18. }
  19.  
  20.  
  21. void savereportC(FL_OBJECT *obj, long val)
  22.  
  23. {
  24.   const char *fn;
  25.   static char *curdir = "";
  26.   static char *pattern = "*.rep";
  27.   static char *name = "";
  28.   FILE *fp;
  29.   int i, n;
  30.  
  31.   fl_use_fselector(4);
  32.   fl_invalidate_fselector_cache();
  33.   fn = fl_show_fselector("Choose output file", curdir, pattern, name);
  34.   if (fn == NULL) return;
  35.   /*  Save the current directory  */
  36.   curdir = (char *) fl_get_directory();
  37.   /*  Save the current pattern */
  38.   pattern = (char *) fl_get_pattern();
  39.   name = (char *) fl_get_filename();
  40.   if (!(fp = fopen(fn, "w"))) {
  41.     fl_show_alert("Can not open file", name, "for writing!", 0);
  42.     return;
  43.   }
  44.   n = fl_get_browser_maxline(state.report->reportW);
  45.   for (i = 1; i <= n; i++) {
  46.     fprintf(fp, "%s\n", fl_get_browser_line(state.report->reportW, i));
  47.   }
  48.   fclose(fp);
  49. }
  50.  
  51.  
  52. void
  53. show_report(void)
  54.  
  55. {
  56.   /*  The window in not created yet, do it now  */
  57.   if (state.report == NULL) {
  58.     state.report = create_form_Report();
  59.     fl_set_form_minsize(state.report->Report, 
  60.           state.report->Report->w, state.report->Report->h);
  61.     fl_set_browser_fontsize(state.report->reportW, 16);
  62.     fl_set_browser_fontstyle(state.report->reportW, FL_FIXED_STYLE);
  63.   }
  64.   if (!fl_form_is_visible(state.report->Report)) {
  65.     fl_show_form(state.report->Report,  FL_FIX_SIZE, FL_FULLBORDER | FL_PLACE_FREE_CENTER, "Astrometry report");
  66.   }
  67. }
  68.  
  69.  
  70. void
  71. hide_report(void)
  72.  
  73. {
  74.   fl_hide_form(state.report->Report);
  75. }
  76.  
  77.