% apsconf.sl -*- mode: slang; mode: fold; -*-
% 
% apsconf.sl is the configurable part of apsmode.
% Here you can modify some global settings as temp directory,
% default printer id, style sheet usage, ...
% some of them are OS specific
% 
% requires apsmode version >=2.2
% 
% 2005-11-21 GM : use path_concat() for Apsmode_tmp_dir
% 2006-06-02 TKO: adapted to apsmode V2.0
% 2006-06-19 TKO: adapted to apsmode V2.2
% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
% name        : Apsmode_menu
% description : defines, whether a popup menu should be created
%               by apsmode.sl
%               be aware that quickprint settings are only available
%               via menu
%               wmenu will not be supported
%               (0 = no menu, 1 = popup menu)
% value       : path
%
% name        : Apsmode_del_ps_file
% description : delete created ps file after printing/viewing 
%               (0 = keep, 1 = delete)
% value       : 0 or 1
%
% name        : Apsmode_tmp_dir
% description : directory for temporary files and ps file
% value       : path
%
% name        : Apsmode_a2ps_cmd
% description : OS specific command to run a2ps
% value       : a2ps programm call (with path)
%
% name        : Apsmode_default_printer
% description : id of the default printer
%               id = 0 is reserved for QuickPrint, don't use it !
%               the configuration file handles UNIX and Windows
%               printers separately
% value       : aps_max_no_printers > Apsmode_default_printer > 0
%
% name        : Apsmode_tmp_file
% description : name of the ps file, which will be created by a2ps
% value       : *.ps
%
% name        : Apsmode_style_sheet
% description : array containing all jed mode names (as index), for which a
%               jed specific style sheet for a2ps should be used
%               style sheets must be available in jed library path
%               can be created by function <create_a2ps_style_sheet(mode)>
% value       : Apsmode_style_sheet[<jed-mode-name>] = 1;
%

%Apsmode_menu = 1;
%Apsmode_del_ps_file = 1;

%#ifdef UNIX
%Apsmode_tmp_dir = path_concat(getenv("TMPDIR"), ""); % ensure trailing "/"
%if (Apsmode_tmp_dir == "")
%  Apsmode_tmp_dir = "/home/wtb3_tko/tmp/";
%Apsmode_a2ps_cmd = "a2ps";
%Apsmode_default_printer = 5;
%#endif
%
%#ifdef MSWINDOWS
%Apsmode_tmp_dir = "C:\\temp\\";
%Apsmode_a2ps_cmd = "D:\\Programs\\a2ps\\bin\\a2ps.exe";
%Apsmode_default_printer = 1;
%#endif
%
%Apsmode_tmp_file = path_concat(Apsmode_tmp_dir, "print_from_jed.ps");
%
%Apsmode_style_sheet["SLang"] = 1;
%Apsmode_style_sheet["awk"] = 1;

  
%%%%%%%%%%%%%%%%%% Define printers %%%%%%%%%%%%%%%%%%%%%%%%%%% %{{{
% 
% This structure contains the printer settings for apsmode.sl
% Most of the settings are directly copied from a2ps options
% See a2ps documentation for further details.
% These settings have been tested with:
% - UNIX      : a2ps v4.12
% - MSWINDOWS : a2ps v4.13b
% 
% The printer settings have been "divided" for UNIX/Windows. so that only
% the relevant printers will show up under the specific OS.
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% JED<XYZ> variables used as placeholder for print options
% 
% name       : JEDFILENAME
% description: use this variable in footer/header definitions to print
%              the path/name of the buffer to be printed
%              do not use "$f" option of a2ps, because this will print
%              the name of the temporary print file instead of the name of 
%              the buffer
% 
% name       : JEDDATETIME
% description: use this variable in footer/header definitions to print
%              the current date, time of the buffer print formatted
%              as YYYY-MMM-DD, HH:MM:SS
%              this is a replacement for the "%e %*" option of a2ps
%              which seems to not work correctly under MSWINDOWS
%              Correction: with apsmode V1.4 options for Windows are 
%              correctly send to a2ps, so "%e %*" should work
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 
% name       : setup
% description: printer id
%              local variable
%              will be used as program internal identifier for 
%              the print setup
% value(s)   : integer, incremented by 1
% 
% name       : setupname
% description: that's the name of the printer setup, which will be used as 
%              identifier
%              should not be too long, because it will be used within 
%              the menus
% value(s)   : text
% example    : "code 2x1x1, A4"
% 
% name       : name
% description: physical printer name as known by the OS
% value(s)   : text
% example    : "114_f004"
% 
% name       : description
% description: Your information about the printer setup
% value(s)   : text
% example    : "This is an example description"
% 
% name       : columns
% description: specify the number of columns of virtual pages per physical page
% value(s)   : integer (1...n)
% example    : "2"
% 
% name       : rows
% description: specify the number of rows of virtual pages per physical page
% value(s)   : integer (1...n)
% example    : "2"
% 
% name       : fontsize
% description: defines fontsize in points
%              if other formats than points needs to be supported 
%              by QuickPrint then function <set_qp_fontsize_callback> has to be 
%              modified accordingly
% value(s)   : 8,...,72 points, anything your printer and a2ps supports
% example    : "8points"
% 
% name       : chars
% description: number of characters to be printed on one line
%              format = min:max
%              min - minimum of characters to be printed
%              max - maximum of characters to be printed
% value(s)   : Integer:Integer
% example    : "80:100"
% 
% name       : borders
% description: switches border printing around each page on/off
% value(s)   : on,off
% example    : "on"
% 
% name       : orientation
% description: defines sheet orientation
% value(s)   : portrait,landscape
% example    : "portrait"
% 
% name       : medium
% description: defines print medium (sheet size)
%              if other formats than a3, a4, letter needs to be supported 
%              by QuickPrint then function <set_qp_medium_callback> has to be 
%              modified accordingly
% value(s)   : a4, a3, letter, ..., anything your printer and a2ps supports
% example    : "a4"
% 
% name       : sides
% description: printing on one/both sides of a sheet
% value(s)   : 1,2
% example    : "2"
% 
% name       : truncate
% description: truncate lines, if they are longer than maximum number of 
%              printing characters
%              !!! ATTENTION !!!
%              try on/off values with your a2ps installation
%              there seems to be a bug in different a2ps version 
%              and/or OS version
%              UNIX     , a2ps v4.12  : truncate=on does not truncate
%              MSWINDOWS, a2ps v4.13b : truncate=off does not truncate
% value(s)   : on,off
% example    : "on"
% 
% name       : linenumbers
% description: add linenumbers every x line to your printout
%              helpful for program code
%              switch off with value 0
% value(s)   : 0...n
% example    : "5"
% 
% name       : copies
% description: number of copies to be printed
% value(s)   : 1...n
% example    : "1"
% 
% name       : major
% description: specify whether the virtual pages should be first filled in 
%              rows (direction = rows) or in columns (direction = columns).
% value(s)   : rows,columns
% example    : "columns"
% 
% name       : margin
% description: Specify the size of the margin (num PostScript points, 
%              or 12 points without arguments) to leave in the inside 
%              (i.e. left for the front side page, and right for the back 
%              side).  This is intended to ease the binding.
% value(s)   : 0...n
% example    : "5"
% 
% name       : header
% description: sets the page header
% value(s)   : text
% example    : "Your Page header"
% 
% name       : title_left
% description: Set virtual page left title to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "%e %*"
% 
% name       : title_center
% description: Set virtual page center title to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "$f", "JEDFILENAME"
% 
% name       : title_right
% description: Set virtual page right title to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "%s./%s#"
% 
% name       : footer_left
% description: Set virtual page left footer to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "%e %*"
% 
% name       : footer_center
% description: Set virtual page center footer to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "$f"
% 
% name       : footer_right
% description: Set virtual page right footer to text
%              see a2ps documentation for more detailed options
% value(s)   : text and/or a2ps options
% example    : "%s./%s#"
% 
% name       : color
% description: switches color printing on/off
%              bw - Style is plain: pure black and white, with standard fonts
%              color - Colors are used to highlight the keywords
% value(s)   : bw,color
% example    : "color"
% 
% name       : pretty
% description: switches pretty printing feature of a2ps on/off
% value(s)   : on,off
% example    : "on"
% 
% name       : print_cmd
% description: string containing the OS specific command to send the created
%              postscript file to the physical printer
%              could also be a ghostview command if direct printing 
%              is somehow not supported
% value(s)   : text
% example    : strcat("lpr -P ", Apsmode_Printers[setup].name, " ", Apsmode_tmp_file)
%              strcat("gsview32.exe ", Apsmode_tmp_file);
% 
% name       : view_cmd
% description: string containing the OS specific command to view the created
%              postscript file (ghostview preferred)
% value(s)   : text
% example    : strcat("gv ", Apsmode_tmp_file)
%              strcat("gsview32.exe ", Apsmode_tmp_file);
% 
% name       : copy_of
% description: internal variable, which is needed for QuickPrint settings
%              has to be 0, don't change it
% value(s)   : 0
% example    : "0"
% 

% evaluate apsmode if this is not already done
require("apsmode");

% reset index for printer setting
private variable setup = 0;

#ifdef UNIX

setup++;
Apsmode_Printers[setup].setupname = "code, A4, 6pt, 2x1, duplex";
Apsmode_Printers[setup].name = "lp";
Apsmode_Printers[setup].description = "Default Printer (code, duplex, 2 on 1)";
Apsmode_Printers[setup].columns = "2";
Apsmode_Printers[setup].rows = "1";
Apsmode_Printers[setup].fontsize = "6points";
Apsmode_Printers[setup].chars = "80:100";
Apsmode_Printers[setup].borders = "on";
Apsmode_Printers[setup].orientation = "landscape";
Apsmode_Printers[setup].medium = "A4";
Apsmode_Printers[setup].sides = "2";
Apsmode_Printers[setup].truncate = "on";
Apsmode_Printers[setup].linenumbers = "5";
Apsmode_Printers[setup].copies = "1";
Apsmode_Printers[setup].major = "columns";
Apsmode_Printers[setup].margin = "5";
Apsmode_Printers[setup].header = "";
Apsmode_Printers[setup].title_left = "";
Apsmode_Printers[setup].title_center = "";
Apsmode_Printers[setup].title_right = "";
%Apsmode_Printers[setup].footer_left = "%e %*";
Apsmode_Printers[setup].footer_left = "JEDDATETIME";
%Apsmode_Printers[setup].footer_center = "$f";
Apsmode_Printers[setup].footer_center = "JEDFILENAME";
Apsmode_Printers[setup].footer_right = "%s./%s#";
Apsmode_Printers[setup].color = "bw";
Apsmode_Printers[setup].pretty = "on";
Apsmode_Printers[setup].print_cmd = strcat("lpr -P ", Apsmode_Printers[setup].name, " ", Apsmode_tmp_file);
Apsmode_Printers[setup].view_cmd = strcat("gv ", Apsmode_tmp_file);
Apsmode_Printers[setup].copy_of = 0;

#endif

%%%%%%%%%%%%%%%%%% MS Windows Printers %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#ifdef MSWINDOWS

setup++;
Apsmode_Printers[setup].setupname = "code, 2x1x2";
Apsmode_Printers[setup].name = "PrinterWINDOWS";
Apsmode_Printers[setup].description = "MS WINDOWS Printer";
Apsmode_Printers[setup].columns = "2";
Apsmode_Printers[setup].rows = "1";
Apsmode_Printers[setup].fontsize = "8points";
Apsmode_Printers[setup].chars = "80:100";
Apsmode_Printers[setup].borders = "on";
Apsmode_Printers[setup].orientation = "landscape";
Apsmode_Printers[setup].medium = "A4";
Apsmode_Printers[setup].sides = "2";
Apsmode_Printers[setup].truncate = "off";
Apsmode_Printers[setup].linenumbers = "5";
Apsmode_Printers[setup].copies = "1";
Apsmode_Printers[setup].major = "columns";
Apsmode_Printers[setup].margin = "5";
Apsmode_Printers[setup].header = "";
Apsmode_Printers[setup].title_left = "";
Apsmode_Printers[setup].title_center = "";
Apsmode_Printers[setup].title_right = "";
%Apsmode_Printers[setup].footer_left = "%e %*";
%Apsmode_Printers[setup].footer_left = "%e";
Apsmode_Printers[setup].footer_left = "JEDDATETIME";
%Apsmode_Printers[setup].footer_center = "$f";
Apsmode_Printers[setup].footer_center = "JEDFILENAME";
Apsmode_Printers[setup].footer_right = "%s./%s#";
Apsmode_Printers[setup].color = "bw";
Apsmode_Printers[setup].pretty = "on";
Apsmode_Printers[setup].print_cmd = strcat("D:\\Programs\\gstools\\gsview\\gsview32.exe ", Apsmode_tmp_file);
Apsmode_Printers[setup].view_cmd = strcat("D:\\Programs\\gstools\\gsview\\gsview32.exe ", Apsmode_tmp_file);
Apsmode_Printers[setup].copy_of = 0;

#endif

