[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: CVS update: f_print.c



  User: ahvezda 
  Date: 06/08/30 07:06:17

  Modified:    .        f_print.c i_vars.c s_toplevel.c
  Log:
  Applied patch by Peter Brett to add a new print dialog to gschem. Patch#1530417
  
  
  
  
  Revision  Changes    Path
  1.25      +59 -13    eda/geda/gaf/libgeda/src/f_print.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: f_print.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/f_print.c,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -b -r1.24 -r1.25
  --- f_print.c	15 Jul 2006 17:00:51 -0000	1.24
  +++ f_print.c	30 Aug 2006 11:06:17 -0000	1.25
  @@ -352,16 +352,73 @@
     return;
   }
   
  -/*! \brief Print the current TOPLEVEL object to a postscript document.
  +/*! \brief Print the current TOPLEVEL object to a file as a postscript
  + *  document.  
  + *
    *  \par Function Description
    *
    *  \param [in] w_current  The TOPLEVEL object to print.
    *  \param [in] filename   The file name of the output postscript document.
    *  \return 0 on success, -1 on failure.
    */
  -int f_print(TOPLEVEL *w_current, const char *filename)
  +int f_print_file (TOPLEVEL *w_current, const char *filename)
   {
     FILE *fp;
  +  int result;
  +
  +  /* dots are breaking my filename selection hack hack !!!! */
  +  fp = fopen(filename, "wb"); /* Use "wb" for safety on e.g. Win32 */
  +
  +  /* check to see if it worked */ 
  +  if (fp == NULL) {
  +    s_log_message("Could not open [%s] for printing\n", filename);
  +    return -1;
  +  }
  +
  +  result = f_print_stream(w_current, fp);
  +  fclose (fp);
  +  return result;
  +}
  +
  +/*! \brief Opens a pipe to the specified command and prints the
  + *  current TOPLEVEL object to the pipe as a postscript document.
  + *
  + *  \par Function Description
  + *
  + *  \param [in] w_current  The TOPLEVEL object to print.
  + *  \param [in] command    The command to print to.
  + *  \return 0 on success, -1 on failure.
  + */
  +int f_print_command (TOPLEVEL *w_current, const char *command)
  +{
  +  FILE *fp;
  +  int result;
  +
  +  fp = popen (command, "w");
  +
  +  /* check to see if it worked */ 
  +  if (fp == NULL) 
  +    {
  +      s_log_message("Could not execute command [%s] for printing\n", command);
  +      return -1;
  +    }
  +
  +  result = f_print_stream (w_current, fp);
  +  pclose (fp);
  +  return result;
  +}
  +
  +/*! \brief Print the current TOPLEVEL object to a stream as a
  + *  postscript document.  
  + *  \par Function Description
  + *
  + *  \param [in] w_current  The TOPLEVEL object to print.
  + *  \param [in] fp         A pointer to an open IO stream
  + *  \return 0 on success, -1 on failure.
  + */
  +
  +int f_print_stream(TOPLEVEL *w_current, FILE *fp)
  +{
     int origin_x, origin_y, bottom, right;
     int margin_x, margin_y;
     int dx,dy;
  @@ -379,16 +436,6 @@
   			 w_current->page_current->object_head, 
   			 0, unicode_table);
   
  -
  -  /* dots are breaking my filename selection hack hack !!!! */
  -  fp = fopen(filename, "w");
  -
  -  /* check to see if it worked */ 
  -  if (fp == NULL) {
  -    s_log_message("Could not open [%s] for printing\n", filename);
  -    return(-1);
  -  }
  -
     /*	printf("%d %d\n", w_current->paper_width, w_current->paper_height);*/
   
     world_get_complex_bounds(w_current, 
  @@ -539,7 +586,6 @@
   
     f_print_footer(fp);
   
  -  fclose(fp);
     return(0);
   }
   
  
  
  
  1.3       +5 -0      eda/geda/gaf/libgeda/src/i_vars.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: i_vars.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/i_vars.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- i_vars.c	15 Jul 2006 17:00:51 -0000	1.2
  +++ i_vars.c	30 Aug 2006 11:06:17 -0000	1.3
  @@ -57,6 +57,7 @@
   #define DEFAULT_BUS_RIPPER_SYMNAME "busripper-1.sym"
   #define DEFAULT_POSTSCRIPT_PROLOG  "prolog.ps"
   #define DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES ""
  +#define DEFAULT_PRINT_COMMAND "lpr"
   
   int   default_init_right = WIDTH_C;
   int   default_init_bottom = HEIGHT_C;
  @@ -68,6 +69,7 @@
   char *default_bus_ripper_symname = NULL;
   char *default_postscript_prolog = NULL;
   char *default_always_promote_attributes = NULL;
  +char *default_print_command = NULL;
   
   /*! \brief Initialize variables in TOPLEVEL object
    *  \par Function Description
  @@ -91,6 +93,7 @@
     INIT_STR(w_current, bus_ripper_symname, DEFAULT_BUS_RIPPER_SYMNAME);
     INIT_STR(w_current, postscript_prolog,  DEFAULT_POSTSCRIPT_PROLOG);
     INIT_STR(w_current, always_promote_attributes, DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
  +  INIT_STR(w_current, print_command, DEFAULT_PRINT_COMMAND);
   
   }
   
  @@ -111,6 +114,7 @@
     w_current->bitmap_directory   = g_strdup (DEFAULT_BITMAP_DIRECTORY);
     w_current->bus_ripper_symname = g_strdup (DEFAULT_BUS_RIPPER_SYMNAME);
     w_current->always_promote_attributes = g_strdup (DEFAULT_ALWAYS_PROMOTE_ATTRIBUTES);
  +  w_current->print_command = g_strdup (DEFAULT_PRINT_COMMAND);
   }
   
   /*! \brief Free default names
  @@ -128,4 +132,5 @@
     g_free(default_bus_ripper_symname);
     g_free(default_postscript_prolog);
     g_free(default_always_promote_attributes);
  +  g_free(default_print_command);
   }
  
  
  
  1.6       +1 -4      eda/geda/gaf/libgeda/src/s_toplevel.c
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: s_toplevel.c
  ===================================================================
  RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/libgeda/src/s_toplevel.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -b -r1.5 -r1.6
  --- s_toplevel.c	6 Aug 2006 19:23:20 -0000	1.5
  +++ s_toplevel.c	30 Aug 2006 11:06:17 -0000	1.6
  @@ -213,10 +213,6 @@
   
   /*   toplevel->fileselect */
   
  -  toplevel->pwindow = NULL;
  -  toplevel->plib_list = NULL;
  -  toplevel->pfilename_entry = NULL; 
  -
     toplevel->iwindow = NULL;
     toplevel->ifilename_entry = NULL; 
   
  @@ -472,6 +468,7 @@
     g_free (toplevel->scheme_directory);
     g_free (toplevel->bitmap_directory);
     g_free (toplevel->bus_ripper_symname);
  +  g_free (toplevel->print_command);
     
     /* free all fonts */
     /* if you close a window, then you free the font set... */
  
  
  


_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs