diff options
| author | John Wiegley <johnw@newartisans.com> | 2002-04-08 10:58:53 +0000 |
|---|---|---|
| committer | John Wiegley <johnw@newartisans.com> | 2002-04-08 10:58:53 +0000 |
| commit | 1d12432b65e42f2a74de16637ae75e190d7d29ad (patch) | |
| tree | a8d98649c1740360a52ee83a73c20b2f22f4db98 | |
| parent | 3a56cbdb0873a58b2cdce7397832235f4b8b8c56 (diff) | |
*** no comment ***
| -rw-r--r-- | chess-display.el | 20 | ||||
| -rw-r--r-- | chess-images.el | 37 | ||||
| -rw-r--r-- | chess.el | 6 |
3 files changed, 38 insertions, 25 deletions
diff --git a/chess-display.el b/chess-display.el index 995a6ec..aba88ec 100644 --- a/chess-display.el +++ b/chess-display.el @@ -315,6 +315,7 @@ See `chess-display-type' for the different kinds of displays." (define-key map [?I] 'chess-display-invert) (define-key map [?X] 'chess-display-quit) (define-key map [?M] 'chess-display-manual-move) + (define-key map [?@] 'chess-display-remote) (define-key map [?<] 'chess-display-move-first) (define-key map [?,] 'chess-display-move-backward) @@ -458,6 +459,14 @@ Basically, it means we are playing, not editing or reviewing." (error "Illegal move notation: %s" move)) (chess-display-move nil ply))) +(defun chess-display-remote (display) + (interactive "sDisplay this game on X server: ") + (require 'chess-images) + (let ((chess-images-separate-frame display)) + ;; jww (2002-04-08): also set-position, set-ply, etc. + (chess-display-set-game (chess-display-create 'chess-images t) + (chess-display-game nil)))) + (defun chess-display-set-current (dir) "Change the currently displayed board. Direction may be - or +, to move forward or back, or t or nil to jump @@ -557,7 +566,7 @@ to the end or beginning." ;; Allow for quick entry of algebraic moves via keyboard ;; -(defvar chess-move-string nil) +(defvar chess-move-string "") (defvar chess-legal-moves-pos nil) (defvar chess-legal-moves nil) @@ -594,10 +603,11 @@ to the end or beginning." (defun chess-keyboard-shortcut-delete () (interactive) - (setq chess-move-string - (substring chess-move-string 0 - (1- (length chess-move-string)))) - (chess-keyboard-display-moves)) + (when chess-move-string + (setq chess-move-string + (substring chess-move-string 0 + (1- (length chess-move-string)))) + (chess-keyboard-display-moves))) (defun chess-keyboard-shortcut (&optional display-only) (interactive) diff --git a/chess-images.el b/chess-images.el index bbb4bb1..93ca828 100644 --- a/chess-images.el +++ b/chess-images.el @@ -25,6 +25,12 @@ :group 'chess-display) (defvar chess-images-cache nil) +(defvar chess-images-size nil) +(defvar chess-images-sizes nil) + +(make-variable-buffer-local 'chess-images-cache) +(make-variable-buffer-local 'chess-images-size) +(make-variable-buffer-local 'chess-images-sizes) (defun chess-images-clear-image-cache (sym value) (set sym value) @@ -137,19 +143,18 @@ that specialized squares may be used such as marble tiles, etc." (?p "pawn" 5)) "The names and index values of the different pieces.") -(defvar chess-images-size nil) - (defun chess-images-initialize () (let ((map (current-local-map))) (define-key map [?^] 'chess-images-increase-size) (define-key map [?V] 'chess-images-decrease-size) (define-key map [?D] 'chess-images-set-directory)) - - (setq cursor-type nil - chess-images-cache nil - chess-images-size - (chess-images-best-size (- (display-pixel-height) 20) - (- (display-pixel-width) 20)))) + (let ((display (and (stringp chess-images-separate-frame) + chess-images-separate-frame))) + (setq cursor-type nil + chess-images-cache nil + chess-images-size + (chess-images-best-size (- (display-pixel-height display) 20) + (- (display-pixel-width display) 20))))) (defun chess-images-popup-board () (let* ((size (float (+ (* (or chess-images-border-width 0) 8) @@ -160,11 +165,12 @@ that specialized squares may be used such as marble tiles, etc." (if chess-images-separate-frame ;; make room for the possible title bar and other ;; decorations - (progn - (select-frame - (make-frame (list (cons 'name "*Chessboard*") - (cons 'height (+ max-char-height 2)) - (cons 'width max-char-width)))) + (let ((params (list (cons 'name "*Chessboard*") + (cons 'height (+ max-char-height 2)) + (cons 'width max-char-width)))) + (if (stringp chess-images-separate-frame) + (push (cons 'display chess-images-separate-frame) params)) + (select-frame (make-frame params)) (set-window-dedicated-p (selected-window) t)) (pop-to-buffer (current-buffer)) (set-window-text-height (get-buffer-window (current-buffer)) @@ -244,8 +250,6 @@ Common modes are: (cons "background" chess-images-highlight-color))) (put-text-property pos (1+ pos) 'display highlight))) -(defvar chess-images-sizes nil) - (defun chess-images-alter-size (test) (let ((sizes chess-images-sizes)) (if (eq test '<) @@ -262,8 +266,7 @@ Common modes are: (* chess-images-size 8)))) (max-char-height (ceiling (/ size (frame-char-height)))) (max-char-width (ceiling (/ size (frame-char-width))))) - (set-frame-size (selected-frame) - max-char-width + (set-frame-size (selected-frame) max-char-width (+ max-char-height 2))))) (setq sizes (cdr sizes)))))) @@ -110,9 +110,9 @@ a0 243 (intern (or (read-string "Engine module to play against: ") "chess-none")) chess-default-engine))) - (when engine-module - (require engine-module) - (chess-engine-set-game (chess-engine-create engine-module) game))))) + (if (and engine-module + (require engine-module nil t)) + (chess-engine-set-game (chess-engine-create engine-module) game))))) (cons display engine))) ;;;###autoload |
