Created
August 25, 2015 16:03
-
-
Save piotrklibert/007bc0b47e3b50578431 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar steps (list 50 120 200 300 500)) | |
(defvar current-step-choice 120) | |
(defun get-next-step (step lst) | |
(if (= (car lst) step) | |
(if (not (cdr lst)) | |
(car steps) | |
(cadr lst)) | |
(get-next-step step (cdr lst)))) | |
(defun get-prev-step (step lst) | |
(if (= step (car lst)) | |
step | |
(labels ((find-prev (step lst) | |
(if (= (cadr lst) step) | |
(car lst) | |
(get-prev-step step (cdr lst))) )) | |
(find-prev step lst)))) | |
(defcommand increase-step-size () () | |
(setf current-step-choice (get-next-step current-step-choice steps)) | |
(message (format nil "~a" current-step-choice))) | |
(defcommand decrease-step-size () () | |
(setf current-step-choice (get-prev-step current-step-choice steps)) | |
(message (format nil "~a" current-step-choice))) | |
(defun widen/narrow-frame (&key x y) | |
(let ((x (or x 0)) | |
(y (or y 0))) | |
(run-commands (format nil "resize ~a ~a" x y)))) | |
(defcommand widen-frame () () (widen/narrow-frame :x current-step-choice)) | |
(defcommand narrow-frame () () (widen/narrow-frame :x (- current-step-choice))) | |
(defcommand grow-frame () () (widen/narrow-frame :y current-step-choice)) | |
(defcommand shrink-frame () () (widen/narrow-frame :y (- current-step-choice))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment