pop-up-printer-setup-dialog

Function

Package: common-graphics

Arguments: &key stream min-margins margins orientation disable-margins-p disable-orientation-p disable-paper-p disable-printer-p disable-sample-page-p

Pops up a dialog for setting default printer orientation, paper size, and margins. This is a different dialog than the one that pops up when a printer stream is opened, and is invoked in the development environment with the File | Page Setup command.

If the user cancels from the dialog, then nil is returned.

Otherwise eleven values are returned:

· t to indicate that the user selected OK

· the left margin selected on the dialog

· the top margin

· the right margin

· the bottom margin

· the orientation selected, either :portrait or :landscape

· a keyword denoting the paper size selected; for a list of possible paper-size keywords, see the paper-size property

· A keyword denoting the bin from which the paper is drawn. See the paper-source printer property for the possible keywords.

· A string naming the port through which printing is done to the selected printer.

· A string naming the selected printer itself. This name could be passed later as the value of the :printer-name initarg to open-stream, along with the :no-dialog-p initarg, to programmatically specify this particular printer for the print job (though this printer will be the default anyway unless it is changed again in the meantime).

· A string naming the printer driver that is used for the selected printer. This is usually "winspool".

The margins are fixnums specifying thousands of an inch. When this function returns, the following symbols are set to these margins:

*default-printer-left-margin*

*default-printer-top-margin*

*default-printer-right-margin*

*default-printer-bottom-margin*

Note that drawing on a printer stream does not automatically offset the drawing by some requested margin; instead, it is offset by a physical margin of the particular printer, which is usually around a quarter of an inch. To make it easier to draw at some arbitrary margin, when a printer stream is opened it is given margins that are equivalent to the above global margin variables minus the physical margin of the printer, so that drawing something at the printer's margins will make it appear where the global margin variables indicate. See printer-physical-offset for more information.

The orientation and paper-size selected on this dialog will determine the initial values of these properties on the print job dialog the next time that it appears when a printer stream is opened. Similarly, if the print job dialog is bypassed by passing the :no-dialog-p initarg to open-stream when creating a printer stream for a print job at some later time, then the values that the user selected on this dialog will be used for the print job unless they are programmatically overridden with other initargs to open-stream. (Note that remembering the orientation and paper-size values in this way is a new feature in release 6.0. In earlier releases, the values were not remembered.)

Note that the value of some printer properties may now be nil. If a printer stream is opened using the print job dialog, then the resulting printer object will have nil as the value of any properties for which the printer driver does not support multiple options. For example, if the particular printer driver allows the user to select either :high, :medium, or :low print quality on the print job dialog, then the value of the print-quality property of the printer object will be one of those three symbols, but if the printer driver does not offer a choice of print quality, then the value of the print-quality property will be nil.

Here is more description of the arguments:

stream may be either nil, a window, or the screen to indicate the owner of the dialog. If a window, the dialog will be modal with respect to the top-level window of the window, and otherwise it will not be modal.

Both min-margins and margins may be either nil or a box. The box refers to the left, top, right, and bottom margins of the printed page, measured in thousandths of an inch, where each margin is measured as a distance from that edge of the paper.

min-margins specifies the minimum margins that the user will be allowed to enter in the dialog. If a smaller margin is entered by the user, it will be replaced with the corresponding minimum value. If min-margins is nil, then some hardwired minimum will be used (which appears to approximate the physical margin limits of the printer).

margins specifies the margins that will be initially displayed on the dialog. If nil, the initially displayed margins will be the values of *default-printer-left-margin*, *default-printer-top-margin*, *default-printer-right-margin*, and *default-printer-bottom-margin*.

orientation may be nil, :portrait, or :landscape, and specifies the initially-selected orientation on the dialog. If nil, the current orientation of the printer is used.

If disable-margins-p is true, then the controls for specifying the margins will be disabled (grayed out) on the dialog.

If disable-orientation-p is true, then the radio-buttons for specifying the orientation will be disabled (grayed out) on the dialog.

If disable-paper-p is true, then the controls for specifying the paper source and size will be disabled (grayed out) on the dialog.

If disable-printer-p is true, then the button for specifying the default printer will be disabled (grayed out) on the dialog.

If disable-sample-page-p is true, then the image of a printed page that appears on the dialog will be blank.

Common Graphics and IDE documentation is described in About Common Graphics and IDE documentation in cgide.htm.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.