123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358 |
- #include "sys-defines.h"
- #include "extern.h"
- #ifndef LIBPLOTTER
- const Plotter _pl_x_default_plotter =
- {
-
- _pl_x_initialize, _pl_x_terminate,
-
- _pl_x_begin_page, _pl_x_erase_page, _pl_x_end_page,
-
- _pl_x_push_state, _pl_x_pop_state,
-
- _pl_x_paint_path, _pl_x_paint_paths, _pl_x_path_is_flushable, _pl_x_maybe_prepaint_segments,
-
- _pl_g_paint_marker, _pl_x_paint_point,
-
- _pl_g_paint_text_string_with_escapes, _pl_x_paint_text_string,
- _pl_x_get_text_width,
-
- _pl_x_retrieve_font,
-
- _pl_x_flush_output,
-
- _pl_g_warning,
- _pl_g_error,
- };
- #endif
- void
- _pl_x_initialize (S___(Plotter *_plotter))
- {
- Colormap *x_cmap_ptr;
- Drawable *drawable_p1, *drawable_p2;
- #ifndef LIBPLOTTER
-
- _pl_g_initialize (S___(_plotter));
- #endif
-
- #ifndef LIBPLOTTER
-
- _plotter->data->type = PL_X11_DRAWABLE;
- #endif
-
- _plotter->data->output_model = PL_OUTPUT_VIA_CUSTOM_ROUTINES_TO_NON_STREAM;
-
- _plotter->data->have_wide_lines = 1;
- _plotter->data->have_dash_array = 1;
- _plotter->data->have_solid_fill = 1;
- _plotter->data->have_odd_winding_fill = 1;
- _plotter->data->have_nonzero_winding_fill = 1;
- _plotter->data->have_settable_bg = 1;
- _plotter->data->have_escaped_string_support = 0;
- _plotter->data->have_ps_fonts = 1;
- #ifdef USE_LJ_FONTS_IN_X
- _plotter->data->have_pcl_fonts = 1;
- #else
- _plotter->data->have_pcl_fonts = 0;
- #endif
- _plotter->data->have_stick_fonts = 0;
- _plotter->data->have_extra_stick_fonts = 0;
- _plotter->data->have_other_fonts = 1;
-
- _plotter->data->default_font_type = PL_F_POSTSCRIPT;
- _plotter->data->pcl_before_ps = false;
- _plotter->data->have_horizontal_justification = false;
- _plotter->data->have_vertical_justification = false;
- _plotter->data->issue_font_warning = true;
-
- _plotter->data->have_mixed_paths = false;
- _plotter->data->allowed_arc_scaling = AS_AXES_PRESERVED;
- _plotter->data->allowed_ellarc_scaling = AS_AXES_PRESERVED;
- _plotter->data->allowed_quad_scaling = AS_NONE;
- _plotter->data->allowed_cubic_scaling = AS_NONE;
- _plotter->data->allowed_box_scaling = AS_NONE;
- _plotter->data->allowed_circle_scaling = AS_NONE;
- _plotter->data->allowed_ellipse_scaling = AS_AXES_PRESERVED;
-
- _plotter->data->display_model_type = (int)DISP_MODEL_VIRTUAL;
- _plotter->data->display_coors_type = (int)DISP_DEVICE_COORS_INTEGER_LIBXMI;
- _plotter->data->flipped_y = true;
- _plotter->data->imin = 0;
- _plotter->data->imax = 569;
- _plotter->data->jmin = 569;
- _plotter->data->jmax = 0;
- _plotter->data->xmin = 0.0;
- _plotter->data->xmax = 0.0;
- _plotter->data->ymin = 0.0;
- _plotter->data->ymax = 0.0;
- _plotter->data->page_data = (plPageData *)NULL;
-
- _plotter->x_dpy = (Display *)NULL;
- _plotter->x_visual = (Visual *)NULL;
- _plotter->x_drawable1 = (Drawable)0;
- _plotter->x_drawable2 = (Drawable)0;
- _plotter->x_drawable3 = (Drawable)0;
- _plotter->x_double_buffering = X_DBL_BUF_NONE;
- _plotter->x_max_polyline_len = INT_MAX;
- _plotter->x_fontlist = (plXFontRecord *)NULL;
- _plotter->x_colorlist = (plColorRecord *)NULL;
- _plotter->x_cmap = (Colormap)0;
- _plotter->x_cmap_type = X_CMAP_ORIG;
- _plotter->x_colormap_warning_issued = false;
- _plotter->x_bg_color_warning_issued = false;
- _plotter->x_paint_pixel_count = 0;
-
-
- _plotter->x_dpy = (Display *)_get_plot_param (_plotter->data, "XDRAWABLE_DISPLAY");
-
- _plotter->x_visual = (Visual *)_get_plot_param (_plotter->data, "XDRAWABLE_VISUAL");
-
- drawable_p1 = (Drawable *)_get_plot_param (_plotter->data, "XDRAWABLE_DRAWABLE1");
- drawable_p2 = (Drawable *)_get_plot_param (_plotter->data, "XDRAWABLE_DRAWABLE2");
- _plotter->x_drawable1 = drawable_p1 ? *drawable_p1 : 0;
- _plotter->x_drawable2 = drawable_p2 ? *drawable_p2 : 0;
-
- x_cmap_ptr = (Colormap *)_get_plot_param (_plotter->data, "XDRAWABLE_COLORMAP");
- if (x_cmap_ptr != NULL)
-
- {
- _plotter->x_cmap = *x_cmap_ptr;
- if (_plotter->x_dpy)
-
- {
- int screen;
- Screen *screen_struct;
-
- screen = DefaultScreen (_plotter->x_dpy);
- screen_struct = ScreenOfDisplay (_plotter->x_dpy, screen);
- if (_plotter->x_cmap == DefaultColormapOfScreen (screen_struct))
-
- _plotter->x_visual = DefaultVisualOfScreen (screen_struct);
- }
- }
- else
-
- {
- if (_plotter->x_dpy)
-
- {
- int screen;
- Screen *screen_struct;
-
- screen = DefaultScreen (_plotter->x_dpy);
- screen_struct = ScreenOfDisplay (_plotter->x_dpy, screen);
- _plotter->x_cmap = DefaultColormapOfScreen (screen_struct);
-
-
- _plotter->x_visual = DefaultVisualOfScreen (screen_struct);
- }
- }
-
- _plotter->x_cmap_type = X_CMAP_ORIG;
- }
- void
- _pl_x_terminate (S___(Plotter *_plotter))
- {
- plXFontRecord *fptr = _plotter->x_fontlist, *fptr_next;
-
- while (fptr)
- {
- fptr_next = fptr->next;
- free (fptr->x_font_name);
- if (fptr->x_font_struct)
-
- XFreeFont (_plotter->x_dpy, fptr->x_font_struct);
- fptr = fptr->next;
- }
- #ifndef LIBPLOTTER
-
- _pl_g_terminate (S___(_plotter));
- #endif
- }
- #ifdef LIBPLOTTER
- XDrawablePlotter::XDrawablePlotter (FILE *infile, FILE *outfile, FILE *errfile)
- :Plotter (infile, outfile, errfile)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (FILE *outfile)
- :Plotter (outfile)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (istream& in, ostream& out, ostream& err)
- : Plotter (in, out, err)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (ostream& out)
- : Plotter (out)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter ()
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (FILE *infile, FILE *outfile, FILE *errfile, PlotterParams ¶meters)
- :Plotter (infile, outfile, errfile, parameters)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (FILE *outfile, PlotterParams ¶meters)
- :Plotter (outfile, parameters)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (istream& in, ostream& out, ostream& err, PlotterParams ¶meters)
- : Plotter (in, out, err, parameters)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (ostream& out, PlotterParams ¶meters)
- : Plotter (out, parameters)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::XDrawablePlotter (PlotterParams ¶meters)
- : Plotter (parameters)
- {
- _pl_x_initialize ();
- }
- XDrawablePlotter::~XDrawablePlotter ()
- {
-
- if (_plotter->data->open)
- _API_closepl ();
- _pl_x_terminate ();
- }
- #endif
- #ifndef LIBPLOTTER
- void
- _maybe_get_new_colormap (Plotter *_plotter)
- {
- switch ((int)_plotter->data->type)
- {
- case (int)PL_X11_DRAWABLE:
- default:
- _pl_x_maybe_get_new_colormap (_plotter);
- break;
- case (int)PL_X11:
- _pl_y_maybe_get_new_colormap (_plotter);
- break;
- }
- }
- void
- _maybe_handle_x_events (Plotter *_plotter)
- {
- switch ((int)_plotter->data->type)
- {
- case (int)PL_X11_DRAWABLE:
- default:
- _pl_x_maybe_handle_x_events (_plotter);
- break;
- case (int)PL_X11:
- _pl_y_maybe_handle_x_events (_plotter);
- break;
- }
- }
- #endif
|