[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/gnugo 82c5b64 351/357: [gnugo imgen] New fit func to ig
From: |
Stefan Monnier |
Subject: |
[elpa] externals/gnugo 82c5b64 351/357: [gnugo imgen] New fit func to ignore bottom grid line |
Date: |
Sun, 29 Nov 2020 14:51:55 -0500 (EST) |
branch: externals/gnugo
commit 82c5b649f704972ddf67f009da37be30e7247765
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[gnugo imgen] New fit func to ignore bottom grid line
* packages/gnugo/gnugo-imgen.el (gnugo-imgen--fit): New func.
(gnugo-imgen-fit-window-height): Use ‘gnugo-imge--fit’.
(gnugo-imgen-fit-window-height/no-grid-bottom): New func.
---
gnugo-imgen.el | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/gnugo-imgen.el b/gnugo-imgen.el
index 0c7f720..5709d33 100644
--- a/gnugo-imgen.el
+++ b/gnugo-imgen.el
@@ -78,16 +78,27 @@ a square position on the board. A value less than 8 is
taken as 8.")
(interactive)
(clrhash gnugo-imgen-cache))
+(defun gnugo-imgen--fit (board-size ignored-grid-lines)
+ (cl-destructuring-bind (L top R bot)
+ (window-inside-absolute-pixel-edges)
+ (ignore L R)
+ (/ (float (- bot top (* (frame-char-height)
+ ignored-grid-lines)))
+ board-size)))
+
(defun gnugo-imgen-fit-window-height (board-size)
"Return the dimension (in pixels) of a square for BOARD-SIZE.
This uses the TOP and BOTTOM components as returned by
`window-inside-absolute-pixel-edges' and subtracts twice
the `frame-char-height' (to leave space for the grid)."
- (cl-destructuring-bind (L top R bot)
- (window-inside-absolute-pixel-edges)
- (ignore L R)
- (/ (float (- bot top (* 2 (frame-char-height))))
- board-size)))
+ (gnugo-imgen--fit board-size 2))
+
+(defun gnugo-imgen-fit-window-height/no-grid-bottom (board-size)
+ "Return the dimension (in pixels) of a square for BOARD-SIZE.
+This uses the TOP and BOTTOM components as returned by
+`window-inside-absolute-pixel-edges' and subtracts the
+`frame-char-height' (to leave top-line space for the grid)."
+ (gnugo-imgen--fit board-size 1))
(defconst gnugo-imgen-palette '((32 . :background)
(?. . :grid-lines)
- [elpa] externals/gnugo f1c7c8d 319/357: [gnugo int] Fix verse meter; nfc., (continued)
- [elpa] externals/gnugo f1c7c8d 319/357: [gnugo int] Fix verse meter; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo da8901f 314/357: [gnugo] Release: 3.0.1, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a667440 298/357: [gnugo int] Fix up gnugo-frolic.el ‘require’ forms., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo abd1fa0 315/357: [gnugo int] Use ‘replace-regexp-in-string’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 2e6bbe5 300/357: [gnugo int] Whitespace, comment munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo c0f6ed5 328/357: [gnugo int] Comment munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo cf36ccd 331/357: [gnugo int] Whitespace munging; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo a70a854 336/357: [gnugo] Add abstraction: gnugo-aqr, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 1eb43f1 342/357: [gnugo int] Add abstraction: gnugo--zonk-ovs, Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo abb12ef 345/357: [gnugo] Include seki groups in game-over data., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 82c5b64 351/357: [gnugo imgen] New fit func to ignore bottom grid line,
Stefan Monnier <=
- [elpa] externals/gnugo 152c53c 354/357: [gnugo] Move two funcs internal., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 5566285 026/357: [gnugo] Give names and docstrings to ‘lambda’ commands., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 62a7c8d 052/357: [gnugo slog] Specify second arg to ‘unintern’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo eae8444 113/357: [gnugo int] Specify STREAM to ‘pp’ directly., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 00ae088 120/357: [gnugo int] Use ‘gnugo--tree-ends’ more., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo fa99b79 134/357: [gnugo int] Make ‘gnugo-board-buffer-p’ precise., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 8f99c83 151/357: [gnugo frolic int] Don't bother to awake w/ ‘col’., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 283534a 157/357: [gnugo sgf int] Consolidate loops., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 671d7aa 147/357: [gnugo frolic] Sync column headers w/ buffer text; handle offsets., Stefan Monnier, 2020/11/29
- [elpa] externals/gnugo 45fe672 169/357: [gnugo int] Move :SZ access into ‘gnugo--as-pos-func’., Stefan Monnier, 2020/11/29