help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] Enlarge frame function


From: Chris McMahan
Subject: [h-e-w] Enlarge frame function
Date: Wed, 7 Aug 2002 12:44:32 -0400

Recently, I sent out a couple of functions to manipulate the frame
sizes based on the current screen resolution.

I was just taking a look at the "enlarge-frame" function that was
included, and realized that it was specific to my particular setup and
initial position of emacs. 

Here's what I think might be a more generic version suitable for mass
consumption...

again, comments are welcome and encouraged... 

 - Chris McMahan


------------------------------

(defun enlarge-frame ()
  "Enlarge the selected frame to fill a sizeable portion of the screen,
based on the current screen resolution"
  (interactive)

  ;; Set the frame size
  ;; set the new width, with a little space on the sides
  (setq lframe-width (- (/ (x-display-pixel-width) (frame-char-width)) 10))
  
  ;; set the new height, allowing for title bars (8)
  (setq lframe-height (- (/ (x-display-pixel-height) (frame-char-height)) 8))

  ;; apply to the selected frame
  (set-frame-size
   (selected-frame)
   lframe-width
   lframe-height)

  ;; center the new frame horizontally and vertically
  ;; set the left position, centering the frame and allowing for frame edges 
(10)
  (setq lframe-left (/ (- (- (x-display-pixel-width) (frame-pixel-width)) 10) 
2))

  ;; set the top position, centering the frame and allowing for title bars (50)
  (setq lframe-top (/ (- (- (x-display-pixel-height) (frame-pixel-height)) 50) 
2))

  (set-frame-position
   (selected-frame)
   lframe-left
   lframe-top)
  )


-- 
    ================================
    Chris McMahan | address@hidden
    ================================




reply via email to

[Prev in Thread] Current Thread [Next in Thread]