pcb 4.1.1
An interactive printed circuit board layout editor.
|
#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"
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_Attribute * | ps_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 |
typedef struct hid_gc_struct hid_gc_struct |
Definition at line 759 of file ps.c.
References len, MIL_TO_COORD, and pcb_fprintf().
Referenced by ps_set_layer().
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().
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().
void hid_ps_init | ( | ) |
Definition at line 1560 of file ps.c.
References common_draw_helpers_init(), common_nogui_init(), hid_st::description, hid_st::exporter, hid_st::graphics, hid_eps_init(), hid_register_hid(), N_, hid_st::name, hid_st::poly_before, ps_graphics, ps_ps_graphics_init(), ps_ps_init(), and hid_st::struct_size.
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().
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().
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().
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] |
Definition at line 707 of file ps.c.
References HID_Attribute::default_val, global, hid_restore_layer_ons(), hid_save_and_show_layer_ons(), HID_Attr_Val::int_value, MAX_ALL_LAYER, ps_end_file(), ps_get_export_options(), ps_hid_export_to_file(), psopen(), and HID_Attr_Val::str_value.
Referenced by ps_ps_init().
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().
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().
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().
Definition at line 1149 of file ps.c.
References global, pcb_fprintf(), and use_gc().
Referenced by ps_ps_graphics_init().
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().
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().
Definition at line 1252 of file ps.c.
References global, pcb_fprintf(), and use_gc().
Referenced by ps_ps_graphics_init().
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().
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().
void ps_hid_export_to_file | ( | FILE * | the_file, |
HID_Attr_Val * | options | ||
) |
Definition at line 590 of file ps.c.
References LayerType::ArcN, BOTTOM_SIDE, CLEAR_FLAG, HID_Attr_Val::coord_value, PCBType::Data, PCBType::Flags, GetLayerGroupNumberByNumber(), GetLayerGroupNumberBySide(), global, MediaType::Height, hid_expose_callback(), HID_Attr_Val::int_value, DataType::Layer, layer, layer_stack_sort(), LayerStack, LayerType::LineN, MediaType::MarginX, MediaType::MarginY, max_copper_layer, PCBType::MaxHeight, PCBType::MaxWidth, MIN, LayerType::Name, PCB, LayerType::PolygonN, ps_hid, ps_set_layer(), ps_start_file(), HID_Attr_Val::real_value, LayerType::TextN, TOP_SIDE, use_gc(), and MediaType::Width.
Referenced by lpr_do_export(), and ps_do_export().
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().
void ps_ps_graphics_init | ( | HID_DRAW * | graphics | ) |
Definition at line 1539 of file ps.c.
References hid_draw_st::destroy_gc, hid_draw_st::draw_arc, hid_draw_st::draw_line, hid_draw_st::draw_pcb_polygon, hid_draw_st::draw_rect, hid_draw_st::fill_circle, hid_draw_st::fill_polygon, hid_draw_st::fill_rect, hid_draw_st::make_gc, ps_destroy_gc(), ps_draw_arc(), ps_draw_line(), ps_draw_pcb_polygon(), ps_draw_rect(), ps_fill_circle(), ps_fill_polygon(), ps_fill_rect(), ps_make_gc(), ps_set_color(), ps_set_draw_faded(), ps_set_draw_xor(), ps_set_line_cap(), ps_set_line_width(), ps_use_mask(), hid_draw_st::set_color, hid_draw_st::set_draw_faded, hid_draw_st::set_draw_xor, hid_draw_st::set_line_cap, hid_draw_st::set_line_width, and hid_draw_st::use_mask.
Referenced by hid_ps_init().
void ps_ps_init | ( | HID * | hid | ) |
Definition at line 1529 of file ps.c.
References hid_st::calibrate, hid_st::do_export, hid_st::get_export_options, hid_st::parse_arguments, ps_calibrate(), ps_do_export(), ps_get_export_options(), ps_parse_arguments(), ps_set_crosshair(), ps_set_layer(), hid_st::set_crosshair, and hid_st::set_layer.
Referenced by hid_lpr_init(), and hid_ps_init().
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 int ps_set_layer | ( | const char * | name, |
int | group, | ||
int | empty | ||
) | [static] |
Definition at line 783 of file ps.c.
References BOTTOM_SIDE, corner(), PCBType::Data, DrawLayer(), LayerGroupType::Entries, PCBType::Filename, FNS_fixed, GetLayerGroupNumberBySide(), global, lastgroup, DataType::Layer, layer_type_to_file_name_ex(), PCBType::LayerGroups, max_copper_layer, max_group, PCBType::MaxHeight, PCBType::MaxWidth, MIL_TO_COORD, PCBType::Name, LayerType::Name, PCB, pcb_fprintf(), PrintFab_overhang(), ps_end_file(), ps_start_file(), psopen(), SL_ASSY, SL_BOTTOM_SIDE, SL_FAB, SL_MASK, SL_PASTE, SL_PDRILL, SL_SIDE, SL_TYPE, SL_UDRILL, and use_gc().
Referenced by ps_hid_export_to_file(), and ps_ps_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().
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().
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().
REGISTER_ATTRIBUTES | ( | ps_attribute_list | ) |
Definition at line 362 of file ps.c.
References bloat, f, filename, is_copper, is_drill, is_mask, is_paste, linewidth, MAX_ALL_LAYER, outline_layer, pagecount, print_group, print_layer, and region.
static void use_gc | ( | hidGC | gc | ) | [static] |
Definition at line 1081 of file ps.c.
References hid_gc_struct::b, c, hid_gc_struct::cap, hid_gc_struct::erase, hid_gc_struct::faded, hid_gc_struct::g, global, lastcap, lastcolor, hid_gc_struct::me_pointer, pcb_fprintf(), ps_hid, hid_gc_struct::r, Round_Cap, Square_Cap, Trace_Cap, and hid_gc_struct::width.
Referenced by fill_polyarea(), ps_draw_arc(), ps_draw_line(), ps_draw_rect(), ps_fill_circle(), ps_fill_polygon(), ps_fill_rect(), ps_hid_export_to_file(), and ps_set_layer().
const char* const calib_lines[] [static] |
Definition at line 1350 of file ps.c.
Referenced by ps_calibrate_1().
Definition at line 405 of file ps.c.
Referenced by fill_polyarea(), ps_calibrate_1(), ps_do_export(), ps_draw_arc(), ps_draw_line(), ps_draw_rect(), ps_end_file(), ps_fill_circle(), ps_fill_polygon(), ps_fill_rect(), ps_hid_export_to_file(), ps_set_color(), ps_set_layer(), ps_start_file(), psopen(), and use_gc().
MediaType media_data[] [static] |
const char* medias[] [static] |
{ "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 143 of file ps.c.
Referenced by ps_get_export_options().
{ {N_("lprcommand"), N_("Command to print"), HID_String, 0, 0, {0, 0, 0}, 0, 0}, }
HID_DRAW ps_graphics [static] |
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().