Skip to content

Instantly share code, notes, and snippets.

@piotrklibert
Created August 25, 2015 16:03
Show Gist options
  • Save piotrklibert/007bc0b47e3b50578431 to your computer and use it in GitHub Desktop.
Save piotrklibert/007bc0b47e3b50578431 to your computer and use it in GitHub Desktop.
(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