home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / printing / ddrvprev / ddrvcnst.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-12-09  |  13.1 KB  |  365 lines

  1. unit Ddrvcnst;
  2.  
  3.  
  4. interface
  5.  
  6. uses
  7.     wintypes, winprocs, sysutils;
  8.  
  9. { ---------------------------------
  10.      DLL Declarations
  11. -----------------------------------}
  12.  Function rvInit(   hParent :Integer;    {Handle of the calling (parent) window}
  13.                     Title :PChar;        {the title of the report}
  14.                     JustShow,            {if non-zero, ddrv will preview the
  15.                                          print-out, otherwise it will print
  16.                                          directly to the printer.
  17.                                          Use constants:
  18.                                              rv_justprint, rv_showfirst, or
  19.                                              rv_createtemp}
  20.                     UnitOfMeas,          {Determines if your parameters are
  21.                                          passed in cm or inches. Use constants:
  22.                                              rv_cm or rv_inch}
  23.                     Options :Integer)    {bitwise options
  24.                                          Use constants:
  25.                                              rv_portrait or rv_landscape,
  26.                                              rv_zoomXXX, rv_magnify,
  27.                                              rv_printselect}
  28.                     : Integer;           {doesn't return anything ... yet}
  29.  
  30.  
  31.  Procedure rvViewerPos (
  32.                     x, y,                {Initial screen Left and Top Positions
  33.                                          passed in pixels}
  34.                     w, h,                {Initial screen Width and Height
  35.                                          passed in pixels}
  36.                     ShowCtl :Integer);   {set to either rv_ctlbox (show the
  37.                                          viewer's control box) or rv_noctlbox
  38.                                          (don't show the viewer's control box)}
  39.  
  40.  
  41.  Procedure rvButtonCaption (
  42.                     Which   :Integer;    {Which button are we talking about
  43.                                          Use constants:
  44.                                              rv_btn_exit, rv_btn_prev, etc.}
  45.                     Caption :PChar);     {The new caption}
  46.  
  47.  
  48.  Procedure rvButtons (
  49.                     w, h        :Integer;{The width and height of the button
  50.                                          graphic in pixels}
  51.                     GraphicFile :PChar); {The filename containing the alternate
  52.                                          button graphics. (SEE ALT_TOOL.BMP
  53.                                          to see the layout of the graphic file)
  54.                                          The bitmap must contain graphics side-
  55.                                          by-side for seven buttons:
  56.                                            #1 - picture for Exit button
  57.                                            #2 - Prev button in enabled state
  58.                                            #3 - Prev button in disabled state
  59.                                            #4 - Next button in enabled state
  60.                                            #5 - Next button in disabled state
  61.                                            #6 - Print button
  62.                                            #7 - Choose printer button.}
  63.  
  64.  
  65.  Procedure rvNewPage;                   {Call this to start a new page}
  66.  
  67.  Procedure rvEndDoc;                    {This function ends the document and
  68.                                         starts the viewer screen (or prints
  69.                                         if rvInit passed rv_justprint)}
  70.  
  71.  Function rvGetHandle    : Integer;     { Returns the window handle of the
  72.                                           last preview screen created }
  73.  
  74.  
  75.  Function rvViewerActive (
  76.                     hWnd :THandle)      { The handle of the viewer
  77.                                           to check }
  78.                     :Integer;           { Returns non-zero if the viewer
  79.                                           screen still exists }
  80.  
  81.  Function rvGetCloseHandle    :THandle; { Returns the handle to be passed
  82.                                           in rvKillViewer. This is actually
  83.                                           the handle to the exit button
  84.                                           on the viewer screen. }
  85.  
  86.  Procedure rvFloatViewer (
  87.                     hWnd :THandle;      { The handle of the window to float }
  88.                     YesOrNo :Integer);  { non-zero to float, zero to "un-float" }
  89.  
  90.  Procedure rvKillViewer (
  91.                     hWndClose :THandle);{ The handle obtained with
  92.                                           rvGetCloseHandle. This is NOT the
  93.                                           window handle of the viewer }
  94.  
  95.  
  96.  Procedure rvText ( x, y    :Single;    {The x,y coordinate to locate the text}
  97.                     align   :Integer;   {How to align the text about the given
  98.                                         coordinate: use rv_left, rv_right,
  99.                                         rv_center, rv_decimal}
  100.                     TheText :PChar);    {The text to print-out}
  101.  
  102.  Procedure rvAngleText ( x, y :Single;  {The x,y coordinate to locate the text}
  103.                        angle  :Integer; {The angle in degrees to print the
  104.                                         text at. 0 would be normal, 90 would
  105.                                         be vertical up, ... it's
  106.                                         counter-clockwise}
  107.                        TheText :PChar); {The text to print-out}
  108.  
  109.  Procedure rvParagraph
  110.                   ( x1, y1, x2, y2      { The coordinates of the bounding }
  111.                     :Single;            { rectangle for the paragraph }
  112.                     TheText :PChar);    { The paragraph text, null-terminated }
  113.  
  114.  Procedure rvLine ( x1, y1,             {The coordinates at which to start
  115.                                         the line (in inches or cm)}
  116.                     x2, y2,             {The end coordinates of the line}
  117.                     p :Single);         {The thickness of the lines in points}
  118.  
  119.  
  120.  Procedure rvRect ( x1, y1,             {Coordinates of the upper-left corner
  121.                                         of the rectangle (in inches or cm)}
  122.                     x2, y2,             {Lower-left corner of rectangle}
  123.                     p :Single;          {The thickness of the border in points}
  124.                     s :Integer);        {Fill style - either
  125.                                           rv_clearback or rv_greyback}
  126.  
  127.  Procedure rvGraphic (
  128.                     FileName :PChar;    {Full path and filename of the graphic}
  129.                     x1, y1, x2, y2      {DDRV will stretch the graphic to fit
  130.                                         in the rectangle defined by these points
  131.                                         given in inches or cm}
  132.                     :Single);
  133.  
  134.  
  135.  Procedure rvFontName (
  136.                     FontName :PChar);   {Sets the current print font to be
  137.                                         FontName}
  138.  
  139.  Procedure rvFontSize (
  140.                     FontSize :Integer); {Sets the size of the font in points}
  141.  
  142.  
  143.  Procedure rvFontStyle (
  144.                     FontStyle :Integer);{Sets the current font style based
  145.                                         on the bit-wise parameter:
  146.                                           e.g.
  147.                                               rvFontStyle( rv_fontbold Or
  148.                                                            rv_fontitalic)
  149.                                         }
  150.  Procedure rvGetEditBoxLine
  151.                   ( hWnd :THandle;      { The handle to the edit box in question }
  152.                     Which :Pointer;     { The line to get or 0 to return the number
  153.                                           of lines. After the function is called
  154.                                           it either holds the number of lines in
  155.                                           the edit box or the number of characters
  156.                                           in the line. Remember is a pointer
  157.                                           to a LONG INT }
  158.                     TheBuffer :PChar);  { An allocated buffer to hold the line }
  159.  
  160.  Function rvWhatIsTempFile
  161.                   ( FileName :PChar )   { A pre-allocated buffer to hold the
  162.                                           name of the temp file being created }
  163.                     :Integer;
  164.  
  165. { ---------------------------------
  166.      THE CONSTANTS
  167. -----------------------------------}
  168.   CONST
  169.  
  170. { -- Font control -- }
  171. { ------------------
  172.   NOTE: These are bitwise and used by rvFontStyle
  173. }
  174.        rv_fontnormal    = 0;
  175.        rv_fontbold      = 1;
  176.        rv_fontitalic    = 2;
  177.        rv_fontunderline = 4;
  178.        rv_fontstrikeout = 8;
  179.  
  180.  
  181. { -- Text Alignment -- }
  182. { --------------------
  183.   NOTE: Used by rvText
  184. }
  185.        rv_left          = 0;
  186.        rv_center        = 1;
  187.        rv_right         = 2;
  188.        rv_decimal       = 3;
  189.  
  190.  
  191. { -- Options -- }
  192. { -------------------------
  193.   NOTE: Bitwise used by rvInit in the Options Parameter
  194. }
  195.        rv_portrait      = 0;
  196.        rv_landscape     = 1;
  197.        rv_magnify       = 2;
  198.        rv_printselect   = 4;
  199.        rv_zoom100       = 0;
  200.        rv_zoom75        = 8;
  201.        rv_zoom50        = 16;
  202.        rv_zoomFit       = 32;
  203.        rv_hidedefprinter= 64;
  204.        rv_savetempfile  = 128;
  205.  
  206. { -- Rectangle Style -- }
  207. { ---------------------
  208.   NOTE: Used by rvRect
  209. }
  210.        rv_clearback     = 0;
  211.        rv_greyback      = 2;
  212.  
  213.  
  214. { -- Units of Measure -- }
  215. { ----------------------
  216.   NOTE: Used by rvInit
  217. }
  218.        rv_inch          = 0;
  219.        rv_cm            = 1;
  220.  
  221.  
  222. { -- Print control -- }
  223. { -------------------
  224.   NOTE: Used by rvInit
  225. }
  226.        rv_justprint     = 0;
  227.        rv_viewfirst     = 1;
  228.        rv_createtemp    = 2;
  229.  
  230.  
  231. { -- Window State -- }
  232. { ---------------------
  233.   NOTE: Used by rvViewPos in the X parameter
  234. }
  235.        rv_maximize      = -1;
  236.        rv_minimize      = -2;
  237.  
  238.  
  239. { -- Control box -- }
  240. { ---------------------
  241.   NOTE: Used by rvViewPos
  242. }
  243.        rv_noctlbox      = 0;
  244.        rv_ctlbox        = 1;
  245.  
  246.  
  247. { -- Button indicators -- }
  248. { ---------------------
  249.   NOTE: Used by rvButtonCaption in the Which parameter
  250. }
  251.        rv_btn_exit            = 0;
  252.        rv_btn_prev            = 1;
  253.        rv_btn_next            = 2;
  254.        rv_btn_print           = 3;
  255.        rv_btn_chooseprinter   = 4;
  256.        rv_cbo_zoom            = 5;
  257.  
  258.  
  259. implementation
  260.  
  261.  
  262. { -- Function declarations with descriptions --}
  263.  
  264.  Function rvInit(   hParent :Integer;
  265.                     Title :PChar;
  266.                     JustShow,
  267.                     UnitOfMeas,
  268.                     Options :Integer) :Integer;
  269.                     external 'ddrv';
  270.  
  271.  Procedure rvViewerPos (
  272.                     x, y,
  273.                     w, h,
  274.                     ShowCtl :Integer);
  275.                     external 'ddrv';
  276.  
  277.  Procedure rvButtonCaption (
  278.                     Which   :Integer;
  279.                     Caption :PChar);
  280.                     external 'ddrv';
  281.  
  282.  Procedure rvButtons (
  283.                     w, h        :Integer;
  284.                     GraphicFile :PChar);
  285.                     external 'ddrv';
  286.  
  287.  Procedure rvNewPage; external 'ddrv';
  288.  
  289.  Procedure rvEndDoc; external 'ddrv';
  290.  
  291.  Function rvGetHandle : Integer; external 'ddrv';
  292.  
  293.  Function rvViewerActive (
  294.                     hWnd :THandle) :Integer;
  295.                     external 'ddrv';
  296.  
  297.  Function rvGetCloseHandle  :THandle; external 'ddrv';
  298.  
  299.  Procedure rvFloatViewer (
  300.                     hWnd :THandle;
  301.                     YesOrNo :Integer);
  302.                     external 'ddrv';
  303.  
  304.  Procedure rvKillViewer (
  305.                     hWndClose :THandle); external 'ddrv';
  306.  
  307.  
  308.  
  309.  Procedure rvText ( x, y    :Single;
  310.                     align   :Integer;
  311.                     TheText :PChar);
  312.                     external 'ddrv';
  313.  
  314.  Procedure rvAngleText
  315.                   ( x, y :Single;
  316.                     angle  :Integer;
  317.                     TheText :PChar);
  318.                     external 'ddrv';
  319.  
  320.  Procedure rvParagraph
  321.                   ( x1, y1, x2, y2 :Single;
  322.                     TheText :PChar);
  323.                     external 'ddrv';
  324.  
  325.  Procedure rvLine ( x1, y1,
  326.                     x2, y2,
  327.                     p :Single);
  328.                     external 'ddrv';
  329.  
  330.  Procedure rvRect ( x1, y1,
  331.                     x2, y2,
  332.                     p :Single;
  333.                     s :Integer);
  334.                     external 'ddrv';
  335.  
  336.  Procedure rvGraphic (
  337.                     FileName :PChar;
  338.                     x1, y1, x2, y2
  339.                     :Single);
  340.                     external 'ddrv';
  341.  
  342.  Procedure rvFontName (
  343.                     FontName :PChar);
  344.                     external 'ddrv';
  345.  
  346.  Procedure rvFontSize (
  347.                     FontSize :Integer);
  348.                     external 'ddrv';
  349.  
  350.  Procedure rvFontStyle (
  351.                     FontStyle :Integer);
  352.                     external 'ddrv';
  353.  
  354.  Procedure rvGetEditBoxLine
  355.                   ( hWnd :THandle;
  356.                     Which :Pointer;
  357.                     TheBuffer :PChar);
  358.                     external 'ddrv';
  359.  
  360.  Function rvWhatIsTempFile
  361.                   ( FileName :PChar) :Integer;
  362.                     external 'ddrv';
  363.  
  364.  end.
  365.