Mercurial > hg > xemacs-beta
changeset 506:39ccc7dd8077
[xemacs-hg @ 2001-05-05 08:39:59 by ben]
Add Page Setup for Windows, take out Pretty Print.
Implement Page Setup. Handle errors properly.
Change top/bottom margin defaults to 0.5 inches.
author | ben |
---|---|
date | Sat, 05 May 2001 08:40:06 +0000 |
parents | 6495d35ba9df |
children | 167135c7a7ae |
files | lisp/ChangeLog lisp/auto-autoloads.el lisp/dialog.el lisp/gtk-init.el lisp/menubar-items.el lisp/printer.el src/ChangeLog src/console-msw.h src/device-msw.c src/frame-msw.c |
diffstat | 10 files changed, 135 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sat May 05 08:26:04 2001 +0000 +++ b/lisp/ChangeLog Sat May 05 08:40:06 2001 +0000 @@ -1,3 +1,22 @@ +2001-05-05 Ben Wing <ben@xemacs.org> + + * dialog.el (make-dialog-box): fix doc string. + * menubar-items.el (default-menubar): Add Page Setup for Windows, + take out Pretty Print. + * printer.el: + * printer.el (printer-current-device): New. + * printer.el (Printer-get-device): New. + * printer.el (Printer-clear-device): New. + * printer.el (generic-page-setup): New. + * printer.el (generic-print-buffer): + * printer.el (generic-print-region): + Implement Page Setup. Handle errors properly. + + unrelated: + + * gtk-init.el: Fix the warning properly. + + 2001-05-04 Ben Wing <ben@xemacs.org> * printer.el (generic-print-buffer):
--- a/lisp/auto-autoloads.el Sat May 05 08:26:04 2001 +0000 +++ b/lisp/auto-autoloads.el Sat May 05 08:40:06 2001 +0000 @@ -131,19 +131,22 @@ ;;;### (autoloads (build-report) "build-report" "lisp/build-report.el") (autoload 'build-report "build-report" "\ -Composes a fresh mail message with the contents of the built XEmacs -Installation file and excerpts from XEmacs make output. -`compose-mail' is used to create the mail message. Point is left at -the beginning of the mail text. You may add some personal notes if -you like and send the report. -See also - `compose-mail', `mail-user-agent', - `build-report-destination', - `build-report-keep-regexp', - `build-report-delete-regexp', - `build-report-make-output-dir', - `build-report-make-output-files', and - `build-report-installation-file'." t nil) +Report build information including Installation and make output. + +Prompts for status (usually \"Success\" or \"Failure\"). Then uses +`compose-mail' to create a mail message. The Subject header contains +status and version information. Point is left at the beginning of the +mail text. Add some notes if you like, and send the report. + +Looks for Installation and the make output file (`beta.err' by +default, customizable via `build-report-make-output-files') in the +build directory of the running XEmacs by default (customizable via +`build-report-make-output-dir'). The output from make is filtered +through `build-report-keep-regexp' and `build-report-delete-regexp' +before including in the message. + +See also `mail-user-agent', `build-report-destination', and +`build-report-installation-file'." t nil) ;;;***
--- a/lisp/dialog.el Sat May 05 08:26:04 2001 +0000 +++ b/lisp/dialog.el Sat May 05 08:40:06 2001 +0000 @@ -280,9 +280,9 @@ Exactly one of these keywords must be given. The function brings up the Print dialog, where the user can -select a different printer and/or change printer options. Connection +select a different printer and/or change printer options. Connection name can change as a result of selecting a different printer device. If -a printer is specified, then changes are stored into the settings object +a device is specified, then changes are stored into the settings object currently selected into that printer. If a settings object is supplied, then changes are recorded into it, and, it it is selected into a printer, then changes are propagated to that printer @@ -307,12 +307,11 @@ For type `page-setup': This invokes the Windows standard Page Setup dialog. -This dialog is usually invoked in response to the Page Setup command, and -used to choose such parameters as page orientation, print margins etc. -Note that this dialog contains the \"Printer\" button, which invokes -the Printer Setup dialog (see `msprinter-print-setup-dialog') so that the -user can update the printer options or even select a different printer -as well. +This dialog is usually invoked in response to the Page Setup command, +and used to choose such parameters as page orientation, print margins +etc. Note that this dialog contains the \"Printer\" button, which +invokes the Printer Setup dialog so that the user can update the +printer options or even select a different printer as well. The keywords allowed are @@ -328,7 +327,7 @@ The function brings up the Page Setup dialog, where the user can select a different printer and/or change printer options. Connection name can change as a result of selecting a different printer -device. If a printer is specified, then changes are stored into the +device. If a device is specified, then changes are stored into the settings object currently selected into that printer. If a settings object is supplied, then changes are recorded into it, and, it it is selected into a printer, then changes are propagated to that printer @@ -341,6 +340,9 @@ Return value is nil if the user has canceled the dialog. Otherwise, it is a new plist, containing the new list of properties. +NOTE: The margin properties (returned by this function) are *NOT* stored +into the print-settings or device object. + The DEVICE is destroyed and an error is signaled in case of initialization problem with the new printer.
--- a/lisp/gtk-init.el Sat May 05 08:26:04 2001 +0000 +++ b/lisp/gtk-init.el Sat May 05 08:40:06 2001 +0000 @@ -25,8 +25,10 @@ (globally-declare-boundp '(gtk-initial-argv-list - gtk-initial-geometry - gtk-keysym-on-keyboard-p)) + gtk-initial-geometry)) + +(globally-declare-fboundp + '(gtk-keysym-on-keyboard-p)) (defvar gtk-win-initted nil) (defvar gtk-pre-win-initted nil)
--- a/lisp/menubar-items.el Sat May 05 08:26:04 2001 +0000 +++ b/lisp/menubar-items.el Sat May 05 08:40:06 2001 +0000 @@ -141,15 +141,18 @@ ["Save %_As..." write-file] ["Save So%_me Buffers" save-some-buffers] "-----" + ,@(if (eq system-type 'windows-nt) + '(["Page Set%_up..." generic-page-setup])) ["%_Print" generic-print-buffer :active (or (valid-specifier-tag-p 'msprinter) (and (not (eq system-type 'windows-nt)) - (fboundp 'lpr-buffer))) + (fboundp 'lpr-region))) :suffix (if put-buffer-names-in-file-menu (concat (buffer-name) "...") "...")] - ["Prett%_y-Print" ps-print-buffer-with-faces - :active (fboundp 'ps-print-buffer-with-faces) - :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] + ,@(unless (eq system-type 'windows-nt) + '(["Prett%_y-Print" ps-print-buffer-with-faces + :active (fboundp 'ps-print-buffer-with-faces) + :suffix (if put-buffer-names-in-file-menu (buffer-name) "")])) "-----" ["%_Revert Buffer" revert-buffer :active (or buffer-file-name revert-buffer-function)
--- a/lisp/printer.el Sat May 05 08:26:04 2001 +0000 +++ b/lisp/printer.el Sat May 05 08:40:06 2001 +0000 @@ -53,8 +53,7 @@ ;; hidden from the user and there is a consistent set of options to ;; control how to print, which works across all implementations. ;; -;; The code here is just a start and needs a huge amount of work. Probably -;; the interfaces below will change and the functions renamed. +;; The code here currently only really supports Windows. (defgroup printing nil "Generic printing support." @@ -70,6 +69,15 @@ (defstruct Print-context pageno window start-time printer-name) +(defvar printer-current-device nil) + +(defun Printer-get-device () + (or printer-current-device (setq printer-current-device + (make-device 'msprinter printer-name)))) + +(defun Printer-clear-device () + (setq printer-current-device nil)) + (defcustom printer-page-header '((face bold date) nil (face bold buffer-name)) "*Controls printed page header. @@ -211,6 +219,23 @@ (t (error 'invalid-argument "Unrecognized print-context property" prop))))) +(defun generic-page-setup () + "Display the Page Setup dialog box. +Changes made are recorded internally." + (interactive) + (let* ((d (Printer-get-device)) + (props + (condition-case err + (make-dialog-box 'page-setup :device d + :properties default-msprinter-frame-plist) + (error + (Printer-clear-device) + (signal (car err) (cdr err)))))) + (while props + (setq default-msprinter-frame-plist + (plist-put default-msprinter-frame-plist (car props) (cadr props))) + (setq props (cddr props))))) + (defun generic-print-buffer (&optional buffer display-print-dialog) "Print buffer BUFFER using a printing method appropriate to the O.S. being run. Under Unix, `lpr' is normally used to spool out a no-frills version of the @@ -231,8 +256,12 @@ (if (or (not (valid-specifier-tag-p 'msprinter)) (not display-print-dialog)) (generic-print-region (point-min buffer) (point-max buffer) buffer) - (let* ((d (make-device 'msprinter printer-name)) - (props (make-dialog-box 'print :device d))) + (let* ((d (Printer-get-device)) + (props (condition-case err + (make-dialog-box 'print :device d) + (error + (Printer-clear-device) + (signal (car err) (cdr err)))))) (and props (generic-print-region (point-min buffer) (point-max buffer) buffer d props))))) @@ -270,8 +299,7 @@ (setq buffer (decode-buffer buffer)) (unwind-protect (progn - (setq d (or print-device - (make-device 'msprinter printer-name))) + (setq d (or print-device (Printer-get-device))) (setq f (make-frame (list* 'name (concat (substitute ?_ ?. (buffer-name buffer)) @@ -389,7 +417,6 @@ (setq pageno (1+ pageno)))) (setq copies (1- copies))))) (and f (delete-frame f)) - (and d (delete-device d)) (and header-buffer (kill-buffer header-buffer)) (and footer-buffer (kill-buffer footer-buffer)) )))
--- a/src/ChangeLog Sat May 05 08:26:04 2001 +0000 +++ b/src/ChangeLog Sat May 05 08:40:06 2001 +0000 @@ -1,3 +1,13 @@ +2001-05-05 Ben Wing <ben@xemacs.org> + + * console-msw.h: + * device-msw.c: + * device-msw.c (mswindows_get_default_margin): + * frame-msw.c (mswindows_size_frame_internal): + * frame-msw.c (msprinter_init_frame_1): + * frame-msw.c (vars_of_frame_mswindows): + Change top/bottom margin defaults to 0.5 inches. + 2001-04-23 Ben Wing <ben@xemacs.org> ------------ notable bug fix: Windows event code --------------
--- a/src/console-msw.h Sat May 05 08:26:04 2001 +0000 +++ b/src/console-msw.h Sat May 05 08:40:06 2001 +0000 @@ -378,6 +378,7 @@ Lisp_Object keys); Lisp_Object mswindows_handle_print_setup_dialog_box (struct frame *f, Lisp_Object keys); +int mswindows_get_default_margin (Lisp_Object prop); void mswindows_register_popup_frame (Lisp_Object frame); void mswindows_unregister_popup_frame (Lisp_Object frame);
--- a/src/device-msw.c Sat May 05 08:26:04 2001 +0000 +++ b/src/device-msw.c Sat May 05 08:40:06 2001 +0000 @@ -792,10 +792,22 @@ return print_dialog_worker (!UNBOUNDP (device) ? device : settings, 1); } +int +mswindows_get_default_margin (Lisp_Object prop) +{ + if (EQ (prop, Qleft_margin)) return 1440; + if (EQ (prop, Qright_margin)) return 1440; + if (EQ (prop, Qtop_margin)) return 720; + if (EQ (prop, Qbottom_margin)) return 720; + abort (); + return 0; +} + static int plist_get_margin (Lisp_Object plist, Lisp_Object prop) { - Lisp_Object val = Fplist_get (plist, prop, make_int (1440)); + Lisp_Object val = + Fplist_get (plist, prop, make_int (mswindows_get_default_margin (prop))); if (!INTP (val)) invalid_argument ("Margin value must be an integer", val);
--- a/src/frame-msw.c Sat May 05 08:26:04 2001 +0000 +++ b/src/frame-msw.c Sat May 05 08:40:06 2001 +0000 @@ -642,13 +642,15 @@ } } -void mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest) +void +mswindows_size_frame_internal (struct frame* f, XEMACS_RECT_WH* dest) { RECT rect, ws_rect; int pixel_width, pixel_height; int size_p = (dest->width >=0 || dest->height >=0); int move_p = (dest->top >=0 || dest->left >=0); - char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, &pixel_height); + char_to_real_pixel_size (f, dest->width, dest->height, &pixel_width, + &pixel_height); if (dest->width < 0) pixel_width = FRAME_PIXWIDTH (f); @@ -806,15 +808,18 @@ f->frame_data = xnew_and_zero (struct msprinter_frame); - /* Default margin size is 1" = 1440 twips */ - FRAME_MSPRINTER_TOP_MARGIN(f) = 1440; - FRAME_MSPRINTER_BOTTOM_MARGIN(f) = 1440; - FRAME_MSPRINTER_LEFT_MARGIN(f) = 1440; - FRAME_MSPRINTER_RIGHT_MARGIN(f) = 1440; + FRAME_MSPRINTER_TOP_MARGIN (f) = + mswindows_get_default_margin (Qtop_margin); + FRAME_MSPRINTER_BOTTOM_MARGIN (f) = + mswindows_get_default_margin (Qbottom_margin); + FRAME_MSPRINTER_LEFT_MARGIN (f) = + mswindows_get_default_margin (Qleft_margin); + FRAME_MSPRINTER_RIGHT_MARGIN (f) = + mswindows_get_default_margin (Qright_margin); /* Negative for "uinspecified" */ - FRAME_MSPRINTER_CHARWIDTH(f) = -1; - FRAME_MSPRINTER_CHARHEIGHT(f) = -1; + FRAME_MSPRINTER_CHARWIDTH (f) = -1; + FRAME_MSPRINTER_CHARHEIGHT (f) = -1; } static void @@ -1182,8 +1187,10 @@ top-margin typographical unit of measurement, right-margin equal to 1/1440 of an inch, or 1/20 of a bottom-margin point, and roughly equal to 7/400 of a - millimeter. If not specified, each margin - defaults to one inch (25.4 mm). + millimeter. If not specified, the left + and right margins default to 1 inch + (25.4 mm) and the top and bottom margins + to 0.5 inch (12.7 mm). MARGINS NOTE. right-margin and bottom-margin are overridden by the height and width properties. If you want to specify size @@ -1194,8 +1201,8 @@ want to specify right/bottom margins, set height/width in this plist to nil, as in this example: - (setq default-frame-plist '(height 55 'width 80) - default-msprinter-frame-plist '(height nil 'width nil)) + (setq default-frame-plist '(height 55 width 80) + default-msprinter-frame-plist '(height nil width nil)) See also `default-frame-plist', which specifies properties which apply to all frames, not just mswindows frames.