Back to index

plt-scheme  4.2.1
Defines | Functions | Variables
PSDC.cxx File Reference
#include "common.h"
#include "wx_frame.h"
#include "wx_dcps.h"
#include "wx_dcmem.h"
#include "wx_utils.h"
#include "wx_dialg.h"
#include "wx_cmdlg.h"
#include "wx_main.h"
#include "wx_lbox.h"
#include "wx_rbox.h"
#include "wx_buttn.h"
#include "wx_choic.h"
#include "wx_check.h"
#include "wx_messg.h"
#include "wx_rgn.h"
#include "../mzscheme/include/scheme.h"
#include <math.h>
#include <stdlib.h>
#include <limits.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define YSCALE(y)   ((paper_h) - ((y) * user_scale_y + device_origin_y))
#define XSCALE(x)   ((x) * user_scale_x + device_origin_x)
#define YOFFSET(y)   ((paper_h) - ((y) + device_origin_y))
#define XOFFSET(x)   ((x) + device_origin_x)
#define YSCALEREL(dy)   ((dy) * user_scale_y)
#define XSCALEREL(dx)   ((dx) * user_scale_x)
#define XSCALEBND(dx)   (XSCALEREL(dx) + device_origin_x)
#define YSCALEBND(dy)   (YSCALEREL(dy) + device_origin_y)
#define ASCALEREL(a)   ((a) * ascale)
#define PIE   pie
#define RESET_FONT   0x1
#define RESET_COLOR   0x2
#define WXUNUSED(x)   x
#define WXXTUNUSED(x)   x
#define DEFAULT_PAPER   "Letter 8 1/2 x 11 in"
#define current_font   font
#define PS_DEFAULT_PAPER   "Letter 8 1/2 x 11 in"
#define PS_PREVIEW_COMMAND   "gv"
#define PS_PRINTER_COMMAND   "lpr"
#define PS_PRINTER_OPTIONS   ""
#define PS_AFM_PATH   NULL

Functions

voidwxPostScriptDrawText (Scheme_Object *f, const char *fontname, const char *text, int dt, Bool combine, int use16, double font_size, int symbol_map, void *used_fonts)
void wxPostScriptGetTextExtent (const char *fontname, const char *text, int dt, int len, Bool combine, int use16, double font_size, double *x, double *y, double *descent, double *topSpace, int symbol_map)
char * wxPostScriptFixupFontName (const char *fontname)
Bool wxPostScriptGlyphExists (const char *fontname, int c, int symbol_map)
voidwxPostScriptRecordFont (const char *fontname, void *used_fonts)
char * wxPostScriptFontsToString (void *used_fonts)
Bool XPrinterDialog (wxWindow *parent)
static void set_pattern (wxPostScriptDC *dc, wxPSStream *pstream, wxBitmap *bm, int rop, wxColour *col)
static void printhex (wxPSStream *pstream, int v)
Bool wxsPrinterDialog (wxWindow *parent)
void wxInitializePrintSetupData (Bool)

Variables

static double pie = 0.0
static char * default_afm_path = NULL
static char * dotted = "[2 5] 2"
static char * short_dashed = "[4 4] 2"
static char * long_dashed = "[4 8] 2"
static char * dotted_dashed = "[6 6 2 6] 4"
static char * ps_brush_hatch []
static const char * wxPostScriptHeaderEllipse
static wxMemoryDCtemp_mdc
static wxMemoryDCtemp_mask_mdc

Define Documentation

#define ASCALEREL (   a)    ((a) * ascale)

Definition at line 92 of file PSDC.cxx.

#define current_font   font

Definition at line 132 of file PSDC.cxx.

#define DEFAULT_PAPER   "Letter 8 1/2 x 11 in"

Definition at line 111 of file PSDC.cxx.

#define PIE   pie

Definition at line 94 of file PSDC.cxx.

#define PS_AFM_PATH   NULL

Definition at line 2254 of file PSDC.cxx.

#define PS_DEFAULT_PAPER   "Letter 8 1/2 x 11 in"

Definition at line 2249 of file PSDC.cxx.

#define PS_PREVIEW_COMMAND   "gv"

Definition at line 2251 of file PSDC.cxx.

#define PS_PRINTER_COMMAND   "lpr"

Definition at line 2252 of file PSDC.cxx.

#define PS_PRINTER_OPTIONS   ""

Definition at line 2253 of file PSDC.cxx.

#define RESET_COLOR   0x2

Definition at line 97 of file PSDC.cxx.

#define RESET_FONT   0x1

Definition at line 96 of file PSDC.cxx.

#define WXUNUSED (   x)    x

Definition at line 102 of file PSDC.cxx.

#define WXXTUNUSED (   x)    x

Definition at line 108 of file PSDC.cxx.

#define XOFFSET (   x)    ((x) + device_origin_x)

Definition at line 86 of file PSDC.cxx.

#define XSCALE (   x)    ((x) * user_scale_x + device_origin_x)

Definition at line 84 of file PSDC.cxx.

#define XSCALEBND (   dx)    (XSCALEREL(dx) + device_origin_x)

Definition at line 89 of file PSDC.cxx.

#define XSCALEREL (   dx)    ((dx) * user_scale_x)

Definition at line 88 of file PSDC.cxx.

#define YOFFSET (   y)    ((paper_h) - ((y) + device_origin_y))

Definition at line 85 of file PSDC.cxx.

#define YSCALE (   y)    ((paper_h) - ((y) * user_scale_y + device_origin_y))

Definition at line 83 of file PSDC.cxx.

#define YSCALEBND (   dy)    (YSCALEREL(dy) + device_origin_y)

Definition at line 90 of file PSDC.cxx.

#define YSCALEREL (   dy)    ((dy) * user_scale_y)

Definition at line 87 of file PSDC.cxx.


Function Documentation

static void printhex ( wxPSStream pstream,
int  v 
) [static]

Definition at line 1773 of file PSDC.cxx.

{
  int h, l;
  char s[3];

  s[2] = 0;
  
  h = (v >> 4) & 0xF;
  l = v & 0xF;
  
  if (h <= 9)
    s[0] = '0' + h;
  else
    s[0] = 'a' + (h - 10);
  if (l <= 9)
    s[1] = '0' + l;
  else
    s[1] = 'a' + (l - 10);

  pstream->Out(s);
}

Here is the call graph for this function:

static void set_pattern ( wxPostScriptDC *  dc,
wxPSStream pstream,
wxBitmap bm,
int  rop,
wxColour col 
) [static]

Definition at line 1024 of file PSDC.cxx.

{
  int width, height;

  width = bm->GetWidth();
  height = bm->GetHeight();

  pstream->Out("8 dict\n");
  pstream->Out("dup\n");
  pstream->Out("begin\n");
  pstream->Out(" /PatternType 1 def\n");
  pstream->Out(" /PaintType 1 def\n");
  pstream->Out(" /TilingType 1 def\n");
  pstream->Out(" /BBox [ 0 0 "); pstream->Out(width); pstream->Out(" "); pstream->Out(height); pstream->Out(" ] def\n");
  pstream->Out(" /XStep "); pstream->Out(width); pstream->Out(" def\n");
  pstream->Out(" /YStep "); pstream->Out(height); pstream->Out(" def\n");

  dc->Blit(0, 0, width, height, bm, 0, 0, -rop - 1, col);

  pstream->Out("end\n");
  pstream->Out(" matrix makepattern setpattern\n");
}

Here is the call graph for this function:

Definition at line 2452 of file PSDC.cxx.

{
  wxPrintSetupData *wxThePrintSetupData;
  
  wxThePrintSetupData = new WXGC_PTRS wxPrintSetupData;
  
  wxThePrintSetupData->SetPrintPreviewCommand(PS_PREVIEW_COMMAND);
  wxThePrintSetupData->SetPrinterOrientation(PS_PORTRAIT);
#ifdef wx_x
  wxThePrintSetupData->SetPrinterMode(PS_PREVIEW);
#else
  wxThePrintSetupData->SetPrinterMode(PS_FILE);
#endif
  wxThePrintSetupData->SetPaperName(PS_DEFAULT_PAPER);
  wxThePrintSetupData->SetPrinterCommand(PS_PRINTER_COMMAND);
  wxThePrintSetupData->SetPrinterOptions(PS_PRINTER_OPTIONS);
  wxThePrintSetupData->SetAFMPath(PS_AFM_PATH);
  
  wxSetThePrintSetupData(wxThePrintSetupData);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void* wxPostScriptDrawText ( Scheme_Object f,
const char *  fontname,
const char *  text,
int  dt,
Bool  combine,
int  use16,
double  font_size,
int  symbol_map,
void used_fonts 
)

Definition at line 1348 of file wxscheme.cxx.

{
  if (ps_draw_text) {
    Scheme_Object *a[7], *v;

    v = scheme_make_utf8_string(fontname);
    a[0] = v;
    a[1] = scheme_make_double(font_size);
    if (use16)
      v = scheme_make_sized_offset_char_string((mzchar *)text, dt, -1, 1);
    else 
      v = scheme_make_sized_offset_utf8_string((char *)text, dt, -1);
    a[2] = v;
    a[3] = f;
    a[4] = (combine ? scheme_true : scheme_false);
    a[5] = (sym_map ? scheme_true : scheme_false);
    a[6] = (used_fonts ? (Scheme_Object *)used_fonts : scheme_false);

    return scheme_apply(ps_draw_text, 7, a);
  } else
    return NULL;
}

Here is the call graph for this function:

char* wxPostScriptFixupFontName ( const char *  fontname)

Definition at line 1421 of file wxscheme.cxx.

{
  if (ps_expand_name) {
    Scheme_Object *a[1], *v;
    v = scheme_make_sized_offset_utf8_string((char *)fontname, 0, -1);
    a[0] = v;
    v = scheme_apply(ps_expand_name, 1, a);
    if ((v != a[0]) && SCHEME_CHAR_STRINGP(v)) {
      v = scheme_char_string_to_byte_string(v);
      fontname = SCHEME_BYTE_STR_VAL(v);
    }
  }
  return (char *)fontname;
}
char* wxPostScriptFontsToString ( void used_fonts)

Definition at line 1462 of file wxscheme.cxx.

{
  if (ps_fonts_string && used_fonts) {
    Scheme_Object *a[1], *s;
    a[0] = (Scheme_Object *)used_fonts;
    s = scheme_apply(ps_fonts_string, 1, a);
    if (SCHEME_CHAR_STRINGP(s)) {
      s = scheme_char_string_to_byte_string(s);
      return SCHEME_BYTE_STR_VAL(s);
    }
  }
  return "";
}
void wxPostScriptGetTextExtent ( const char *  fontname,
const char *  text,
int  dt,
int  len,
Bool  combine,
int  use16,
double  font_size,
double *  x,
double *  y,
double *  descent,
double *  topSpace,
int  symbol_map 
)

Definition at line 1373 of file wxscheme.cxx.

{
  if (ps_get_text_extent) {
    long multiple_count;
    Scheme_Object **multiple_array;
    Scheme_Object *a[5], *v;

    v = scheme_make_utf8_string(fontname);
    a[0] = v;
    a[1] = scheme_make_double(font_size);
    if (use16)
      v = scheme_make_sized_offset_char_string((mzchar *)text, dt, slen, 1);
    else 
      v = scheme_make_sized_offset_utf8_string((char *)text, dt, slen);
    a[2] = v;
    a[3] = (combine ? scheme_true : scheme_false);
    a[4] = (sym_map ? scheme_true : scheme_false);

    v = scheme_apply_multi(ps_get_text_extent, 5, a);
    
    multiple_count = scheme_get_multiple_count();
    multiple_array = scheme_get_multiple_array();
    if (SAME_OBJ(v, SCHEME_MULTIPLE_VALUES)
       && (multiple_count == 4)) {
      if (SCHEME_FLTP(multiple_array[0]))
       *x = SCHEME_FLT_VAL(multiple_array[0]);
      if (SCHEME_FLTP(multiple_array[1]))
       *y = SCHEME_FLT_VAL(multiple_array[1]);
      if (descent)
       if (SCHEME_FLTP(multiple_array[2]))
         *descent = SCHEME_FLT_VAL(multiple_array[2]);
      if (topSpace)
       if (SCHEME_FLTP(multiple_array[3]))
         *topSpace = SCHEME_FLT_VAL(multiple_array[3]);
    } else {
      *x = 0;
      *y = 0;
      if (descent) *descent = 0;
      if (topSpace) *topSpace = 0;
    }
    multiple_array = NULL;
  }
}

Here is the call graph for this function:

Bool wxPostScriptGlyphExists ( const char *  fontname,
int  c,
int  symbol_map 
)

Definition at line 1436 of file wxscheme.cxx.

{
  if (ps_glyph_exists) {
    Scheme_Object *a[3], *v;
    v = scheme_make_sized_offset_utf8_string((char *)fontname, 0, -1);
    a[0] = v;
    a[1] = scheme_make_integer_value(c);
    a[2] = (sym_map ? scheme_true : scheme_false);
    v = scheme_apply(ps_glyph_exists, 3, a);
    return SCHEME_TRUEP(v);
  }
  return TRUE;
}
void* wxPostScriptRecordFont ( const char *  fontname,
void used_fonts 
)

Definition at line 1450 of file wxscheme.cxx.

{
  if (ps_record_font) {
    Scheme_Object *a[2], *v;
    v = scheme_make_sized_offset_utf8_string((char *)fontname, 0, -1);
    a[0] = v;
    a[1] = (used_fonts ? (Scheme_Object *)used_fonts : scheme_false);
    return scheme_apply(ps_record_font, 2, a);
  }
  return scheme_null;
}

Definition at line 2597 of file wxscheme.cxx.

{
  Scheme_Object *a[4], *r;
  
  a[0] = scheme_false;
  a[1] = !parent ? scheme_false : objscheme_bundle_wxWindow(parent);
  a[2] = scheme_false;
  a[3] = scheme_null;

  r = scheme_apply(get_ps_setup_from_user, 4, a);

  if (SCHEME_FALSEP(r)) {
    return 0;
  } else {
    wxPrintSetupData *p, *p2;
    p = objscheme_unbundle_wxPrintSetupData(r, NULL, 0);
    p2 = wxGetThePrintSetupData();
    p2->copy(p);
    return 1;
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Bool XPrinterDialog ( wxWindow parent)

Definition at line 2240 of file PSDC.cxx.

{
  return wxsPrinterDialog(parent);
}

Here is the call graph for this function:


Variable Documentation

char* default_afm_path = NULL [static]

Definition at line 123 of file PSDC.cxx.

char* dotted = "[2 5] 2" [static]

Definition at line 1047 of file PSDC.cxx.

char* dotted_dashed = "[6 6 2 6] 4" [static]

Definition at line 1050 of file PSDC.cxx.

char* long_dashed = "[4 8] 2" [static]

Definition at line 1049 of file PSDC.cxx.

double pie = 0.0 [static]

Definition at line 99 of file PSDC.cxx.

char* ps_brush_hatch[] [static]
Initial value:
 { " 0 0 moveto 8 8",
                              " 0 0 moveto 8 8 lineto closepath stroke 8 0 moveto 0 8",
                              " 8 0 moveto 0 8",
                              " 0 4 moveto 8 4 lineto closepath stroke 4 0 moveto 4 8",
                              " 0 4 moveto 8 4",
                              " 4 0 moveto 4 8",
                              " 0 0 moveto 0.1 0.1" }

Definition at line 1179 of file PSDC.cxx.

char* short_dashed = "[4 4] 2" [static]

Definition at line 1048 of file PSDC.cxx.

Definition at line 1994 of file PSDC.cxx.

wxMemoryDC* temp_mdc [static]

Definition at line 1994 of file PSDC.cxx.

Initial value:
"\
/ellipsedict 8 dict def\n\
ellipsedict /mtrx matrix put\n\
/ellipse\n\
{ ellipsedict begin\n\
  /endangle exch def\n\
  /startangle exch def\n\
  /yrad exch def\n\
  /xrad exch def\n\
  /y exch def\n\
  /x exch def\n\
  /savematrix mtrx currentmatrix def\n\
  x y translate\n\
  xrad yrad scale\n\
  0 0 1 endangle startangle arcn\n\
  savematrix setmatrix\n\
  end\n\
  } def\n\
"

Definition at line 1510 of file PSDC.cxx.