pcb 4.1.1
An interactive printed circuit board layout editor.

ps.c File Reference

#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <time.h>
#include "global.h"
#include "data.h"
#include "misc.h"
#include "error.h"
#include "draw.h"
#include "pcb-printf.h"
#include "hid.h"
#include "hid_draw.h"
#include "../hidint.h"
#include "hid/common/hidnogui.h"
#include "hid/common/draw_helpers.h"
#include "../ps/ps.h"
#include "../../print.h"
#include "hid/common/hidinit.h"
Include dependency graph for ps.c:

Go to the source code of this file.

Data Structures

struct  hid_gc_struct
struct  MediaType

Defines

#define CRASH   fprintf(stderr, "HID error: pcb called unimplemented PS function %s.\n", __FUNCTION__); abort()
#define MARGINX   MIL_TO_COORD(500)
#define MARGINY   MIL_TO_COORD(500)

Typedefs

typedef struct hid_gc_struct hid_gc_struct

Functions

static int ps_set_layer (const char *name, int group, int empty)
static void use_gc (hidGC gc)
 REGISTER_ATTRIBUTES (ps_attribute_list)
static HID_Attributeps_get_export_options (int *n)
static int layer_stack_sort (const void *va, const void *vb)
void ps_start_file (FILE *f)
static void ps_end_file (FILE *f)
static FILE * psopen (const char *base, const char *which)
void ps_hid_export_to_file (FILE *the_file, HID_Attr_Val *options)
static void ps_do_export (HID_Attr_Val *options)
static void ps_parse_arguments (int *argc, char ***argv)
static void corner (FILE *fh, Coord x, Coord y, int dx, int dy)
static hidGC ps_make_gc (void)
static void ps_destroy_gc (hidGC gc)
static void ps_use_mask (enum mask_mode mode)
static void ps_set_color (hidGC gc, const char *name)
static void ps_set_line_cap (hidGC gc, EndCapStyle style)
static void ps_set_line_width (hidGC gc, Coord width)
static void ps_set_draw_xor (hidGC gc, int xor_)
static void ps_set_draw_faded (hidGC gc, int faded)
static void ps_draw_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void ps_fill_rect (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void ps_fill_circle (hidGC gc, Coord cx, Coord cy, Coord radius)
static void ps_draw_line (hidGC gc, Coord x1, Coord y1, Coord x2, Coord y2)
static void ps_draw_arc (hidGC gc, Coord cx, Coord cy, Coord width, Coord height, Angle start_angle, Angle delta_angle)
static void ps_fill_polygon (hidGC gc, int n_coords, Coord *x, Coord *y)
static void fill_polyarea (hidGC gc, POLYAREA *pa, const BoxType *clip_box)
static void ps_draw_pcb_polygon (hidGC gc, PolygonType *poly, const BoxType *clip_box)
static int guess (double val, double close_to, double *calib)
void ps_calibrate_1 (double xval, double yval, int use_command)
static void ps_calibrate (double xval, double yval)
static void ps_set_crosshair (int x, int y, int action)
void ps_ps_init (HID *hid)
void ps_ps_graphics_init (HID_DRAW *graphics)
void hid_ps_init ()

Variables

static const char * medias []
static MediaType media_data []
HID_Attribute ps_attribute_list []
 global
HID_Attribute ps_calib_attribute_list []
static const char *const calib_lines []
HID ps_hid
static HID_DRAW ps_graphics

Define Documentation

#define CRASH   fprintf(stderr, "HID error: pcb called unimplemented PS function %s.\n", __FUNCTION__); abort()

Definition at line 32 of file ps.c.

#define MARGINX   MIL_TO_COORD(500)

Definition at line 100 of file ps.c.

#define MARGINY   MIL_TO_COORD(500)

Definition at line 101 of file ps.c.


Typedef Documentation

typedef struct hid_gc_struct hid_gc_struct

Function Documentation

static void corner ( FILE *  fh,
Coord  x,
Coord  y,
int  dx,
int  dy 
) [static]

Definition at line 759 of file ps.c.

References len, MIL_TO_COORD, and pcb_fprintf().

Referenced by ps_set_layer().

Here is the call graph for this function:

static void fill_polyarea ( hidGC  gc,
POLYAREA pa,
const BoxType clip_box 
) [static]

Definition at line 1266 of file ps.c.

References POLYAREA::contours, global, PLINE::head, PLINE::next, VNODE::next, pcb_fprintf(), VNODE::point, and use_gc().

Referenced by ps_draw_pcb_polygon().

Here is the call graph for this function:

static int guess ( double  val,
double  close_to,
double *  calib 
) [static]

Definition at line 1427 of file ps.c.

Referenced by __found_new_guess(), and ps_calibrate_1().

static int layer_stack_sort ( const void *  va,
const void *  vb 
) [static]

Definition at line 420 of file ps.c.

References GetLayerGroupNumberByNumber().

Referenced by ps_hid_export_to_file().

Here is the call graph for this function:

static void ps_calibrate ( double  xval,
double  yval 
) [static]

Definition at line 1514 of file ps.c.

References ps_calibrate_1().

Referenced by ps_ps_init().

Here is the call graph for this function:

void ps_calibrate_1 ( double  xval,
double  yval,
int  use_command 
)

Definition at line 1439 of file ps.c.

References _, hid_st::attribute_dialog, c, calib_lines, HID_Attribute::default_val, global, guess(), gui, Message(), HID_Attr_Val::real_value, and HID_Attr_Val::str_value.

Referenced by lpr_calibrate(), and ps_calibrate().

Here is the call graph for this function:

static void ps_destroy_gc ( hidGC  gc) [static]

Definition at line 1021 of file ps.c.

Referenced by ps_ps_graphics_init().

static void ps_do_export ( HID_Attr_Val options) [static]
static void ps_draw_arc ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  width,
Coord  height,
Angle  start_angle,
Angle  delta_angle 
) [static]

Definition at line 1192 of file ps.c.

References global, linewidth, pcb_fprintf(), start_angle, and use_gc().

Referenced by ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_draw_line ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 1159 of file ps.c.

References hid_gc_struct::cap, global, is_paste, pcb_fprintf(), ps_fill_circle(), ps_fill_rect(), Square_Cap, use_gc(), and hid_gc_struct::width.

Referenced by ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_draw_pcb_polygon ( hidGC  gc,
PolygonType poly,
const BoxType clip_box 
) [static]

Definition at line 1295 of file ps.c.

References polygon_st::Clipped, POLYAREA::f, fill_polyarea(), and TEST_FLAG.

Referenced by ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_draw_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 1149 of file ps.c.

References global, pcb_fprintf(), and use_gc().

Referenced by ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_end_file ( FILE *  f) [static]

Definition at line 530 of file ps.c.

References global.

Referenced by ps_do_export(), and ps_set_layer().

static void ps_fill_circle ( hidGC  gc,
Coord  cx,
Coord  cy,
Coord  radius 
) [static]

Definition at line 1238 of file ps.c.

References hid_gc_struct::erase, global, PCBType::minDrill, PCB, pcb_fprintf(), and use_gc().

Referenced by ps_draw_line(), and ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_fill_polygon ( hidGC  gc,
int  n_coords,
Coord x,
Coord y 
) [static]

Definition at line 1252 of file ps.c.

References global, pcb_fprintf(), and use_gc().

Referenced by ps_ps_graphics_init().

Here is the call graph for this function:

static void ps_fill_rect ( hidGC  gc,
Coord  x1,
Coord  y1,
Coord  x2,
Coord  y2 
) [static]

Definition at line 1310 of file ps.c.

References bloat, f, global, is_paste, lastcap, linewidth, pcb_fprintf(), Round_Cap, and use_gc().

Referenced by ps_draw_line(), and ps_ps_graphics_init().

Here is the call graph for this function:

static HID_Attribute* ps_get_export_options ( int *  n) [static]

Definition at line 408 of file ps.c.

References derive_default_filename(), PCBType::Filename, PCB, and ps_attribute_list.

Referenced by ps_do_export(), and ps_ps_init().

Here is the call graph for this function:

static hidGC ps_make_gc ( void  ) [static]

Definition at line 1012 of file ps.c.

References hid_gc_struct::cap, hid_gc_struct::me_pointer, ps_hid, and Trace_Cap.

Referenced by ps_ps_graphics_init().

static void ps_parse_arguments ( int *  argc,
char ***  argv 
) [static]

Definition at line 752 of file ps.c.

References hid_parse_command_line(), and hid_register_attributes().

Referenced by ps_ps_init().

Here is the call graph for this function:

static void ps_set_color ( hidGC  gc,
const char *  name 
) [static]

Definition at line 1033 of file ps.c.

References hid_gc_struct::b, hid_gc_struct::erase, hid_gc_struct::g, global, and hid_gc_struct::r.

Referenced by ps_ps_graphics_init().

static void ps_set_crosshair ( int  x,
int  y,
int  action 
) [static]

Definition at line 1520 of file ps.c.

Referenced by ps_ps_init().

static void ps_set_draw_faded ( hidGC  gc,
int  faded 
) [static]

Definition at line 1075 of file ps.c.

References hid_gc_struct::faded.

Referenced by ps_ps_graphics_init().

static void ps_set_draw_xor ( hidGC  gc,
int  xor_ 
) [static]

Definition at line 1069 of file ps.c.

Referenced by ps_ps_graphics_init().

static void ps_set_line_cap ( hidGC  gc,
EndCapStyle  style 
) [static]

Definition at line 1057 of file ps.c.

References hid_gc_struct::cap, and style.

Referenced by ps_ps_graphics_init().

static void ps_set_line_width ( hidGC  gc,
Coord  width 
) [static]

Definition at line 1063 of file ps.c.

References hid_gc_struct::width.

Referenced by ps_ps_graphics_init().

void ps_start_file ( FILE *  f)

Definition at line 434 of file ps.c.

References PCBType::Filename, global, MediaType::Height, MediaType::name, PCB, pcb_fprintf(), Progname, and MediaType::Width.

Referenced by ps_hid_export_to_file(), and ps_set_layer().

Here is the call graph for this function:

static void ps_use_mask ( enum mask_mode  mode) [static]

Definition at line 1027 of file ps.c.

Referenced by ps_ps_graphics_init().

static FILE* psopen ( const char *  base,
const char *  which 
) [static]

Definition at line 560 of file ps.c.

References global, and malloc().

Referenced by ps_do_export(), and ps_set_layer().

Here is the call graph for this function:

REGISTER_ATTRIBUTES ( ps_attribute_list  )

Variable Documentation

const char* const calib_lines[] [static]

Definition at line 1350 of file ps.c.

Referenced by ps_calibrate_1().

MediaType media_data[] [static]

Definition at line 103 of file ps.c.

const char* medias[] [static]
Initial value:
 {
  "A0", "A1", "A2", "A3", "A4", "A5",
  "A6", "A7", "A8", "A9", "A10",
  "B0", "B1", "B2", "B3", "B4", "B5",
  "B6", "B7", "B8", "B9", "B10",
  "Letter", "11x17", "Ledger",
  "Legal", "Executive",
  "A-Size", "B-size",
  "C-Size", "D-size", "E-size",
  "US-Business_Card", "Intl-Business_Card",
  0
}

Definition at line 47 of file ps.c.

Definition at line 143 of file ps.c.

Referenced by ps_get_export_options().

Initial value:
 {
  {N_("lprcommand"), N_("Command to print"),
   HID_String, 0, 0, {0, 0, 0}, 0, 0},
}

Definition at line 1345 of file ps.c.

Definition at line 1527 of file ps.c.

Referenced by hid_ps_init().

Definition at line 1526 of file ps.c.

Referenced by lpr_get_export_options(), ps_hid_export_to_file(), ps_make_gc(), and use_gc().