/* GNUPLOT - qt.trm 
 * $Id: qt.trm,v 1.2.2.2 2012/01/19 07:03:27 sfeam Exp $
 */

/*[
 * Copyright 2009 Jérôme Lodewyck
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the complete modified source code.  Modifications are to
 * be distributed as patches to the released version.  Permission to
 * distribute binaries produced by compiling modified sources is granted,
 * provided you
 *   1. distribute the corresponding source modifications from the
 *    released version in the form of a patch file along with the binaries,
 *   2. add special version identification to distinguish your version
 *    in addition to the base release version number,
 *   3. provide your name and address as the primary contact for the
 *    support of your modified version, and
 *   4. retain our contact information in regard to use of the base
 *    software.
 * Permission to distribute the released version of the source code along
 * with corresponding source modifications in the form of a patch file is
 * granted with same provisions 2 through 4 for binary distributions.
 *
 * This software is provided "as is" without express or implied warranty
 * to the extent permitted by applicable law.
]*/

#ifdef TERM_REGISTER
register_term (qt)
#endif

#ifndef TERM_PROTO_ONLY

#ifdef TERM_BODY
#include "qtterminal/qt_term.h"
#endif /* TERM_BODY */

#ifdef TERM_TABLE
TERM_TABLE_START (qt_driver)
    "qt", "Qt terminal",
    /* the following values are overriden by qt_graphics */
    1 /* xmax */ , 1 /* ymax */ , 1 /* vchar */ , 1 /* hchar */ ,
    1 /* vtic */ , 1 /* htic */ ,
    qt_options, qt_init, qt_reset, qt_text_wrapper, null_scale, qt_graphics,
    qt_move, qt_vector, qt_linetype, qt_put_text,
    qt_text_angle, qt_justify_text,
    qt_point, do_arrow, qt_set_font,
    qt_pointsize,
    TERM_CAN_MULTIPLOT|TERM_NO_OUTPUTFILE|TERM_ALPHA_CHANNEL|TERM_CAN_DASH,
    0 /* suspend */, 0 /* resume */, qt_fillbox, qt_linewidth
#ifdef USE_MOUSE
    , qt_waitforinput, qt_put_tmptext, qt_set_ruler, qt_set_cursor, qt_set_clipboard
#endif
    , qt_make_palette, 0 /* qt_previous_palette */, qt_set_color, qt_filled_polygon
    , qt_image
    , qt_enhanced_open, qt_enhanced_flush, qt_enhanced_writec
    , qt_layer
    , NULL /* qt_path */
TERM_TABLE_END (qt_driver)

#undef LAST_TERM
#define LAST_TERM qt_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */

#ifdef TERM_HELP
START_HELP(qt)
"1 qt",
"?set terminal qt",
"?terminal qt",
"?set term qt",
"?term qt",
"?qt",
" The `qt` terminal device generates output in a separate window with the Qt library."
"",
" Syntax:",
"         set term qt {<n>}",
"                     {size <width>,<height>}",
"                     {{no}enhanced}",
"                     {font <font>}",
"                     {title \"title\"}",
"                     {{no}persist}",
"                     {{no}raise}",
"                     {{no}ctrl}",
"                     {close}",
"                     {widget <id>}",
"",
" Multiple plot windows are supported: `set terminal qt <n>` directs the",
" output to plot window number n.",
"",
" The default window title is based on the window number. This title can also",
" be specified with the keyword \"title\".",
"",
" Plot windows remain open even when the `gnuplot` driver is changed to a",
" different device. A plot window can be closed by pressing the letter 'q'",
" while that window has input focus, by choosing `close` from a window",
" manager menu, or with `set term qt <n> close`.",
"",
" The size of the plot area is given in pixels, it defaults to 640x480.",
" In addition to that, the actual size of the window also includes the space",
" reserved for the toolbar and the status bar.",
" When you resize a window, the plot is immediately scaled to fit in the",
" new size of the window. The `qt` terminal scales the whole plot, including",
" fonts and linewidths, and keeps its global aspect ratio constant.",
" If you type `replot`, click the `replot` icon in the terminal toolbar or",
" type a new `plot` command, the new plot will completely fit in the window",
" and the font size and the linewidths will be reset to their defaults.",
"",
" The active plot window (the one selected by `set term qt <n>`) is",
" interactive. Its behaviour is shared with other terminal types. See `mouse`",
" for details. It also has some extra icons, which are supposed to be",
" self-explanatory.",
"",
" This terminal supports an enhanced text mode, which allows font and other",
" formatting commands (subscripts, superscripts, etc.) to be embedded in labels",
" and other text strings. The enhanced text mode syntax is shared with other",
" gnuplot terminal types. See `enhanced` for more details.",
"",
" <font> is in the format \"FontFace,FontSize\", i.e. the face and the size",
" comma-separated in a single string. FontFace is a usual font face name, such",
" as \'Arial\'. If you do not provide FontFace, the qt terminal will use",
" \'Sans\'. FontSize is the font size, in points. If you do not provide it,",
" the qt terminal will use a size of 9 points.",
"    For example :",
"       set term qt font \"Arial,12\"",
"       set term qt font \"Arial\" # to change the font face only",
"       set term qt font \",12\" # to change the font size only",
"       set term qt font \"\" # to reset the font name and size",
"",
" The Qt rendering speed is affected strongly by the rendering mode used.",
" In Qt version 4.7 or newer this can be controlled by the environmental",
" variable QT_GRAPHICSSYSTEM. The options are \"native\", \"raster\", or",
" \"opengl\" in order of increasing rendering speed.  For earlier versions",
" of Qt the terminal defaults to \"raster\".",
"",
" To obtain the best output possible, the rendering involves three",
" mechanisms : antialiasing, oversampling and hinting.",
" Oversampling combined with antialiasing provides subpixel accuracy,",
" so that gnuplot can draw a line from non-integer coordinates. This avoids",
" wobbling effects on diagonal lines ('plot x' for example).",
" Hinting avoids the blur on horizontal and vertical lines caused by",
" oversampling. The terminal will snap these lines to integer coordinates so",
" that a one-pixel-wide line will actually be drawn on one and only one pixel.",
"",
" By default, the window is raised to the top of your desktop when a plot is",
" drawn. This can be controlled with the keyword \"raise\".",
" The keyword \"persist\" will prevent gnuplot from exiting before you",
" explicitely close all the plot windows.",
" Finally, by default the key <space> raises the gnuplot console window, and",
" 'q' closes the plot window. The keyword \"ctrl\" allows you to replace those",
" bindings by <ctrl>+<space> and <ctrl>+'q', respectively.",
"",
" The gnuplot outboard driver, gnuplot_qt, is searched in a default place",
" chosen when the program is compiled.  You can override that by defining",
" the environment variable GNUPLOT_DRIVER_DIR to point to a different",
" location."
END_HELP(qt)
#endif /* TERM_HELP */
