From a5087f708225019550ce1711d06dcedbaff57bf6 Mon Sep 17 00:00:00 2001 From: David Lewis Date: Tue, 31 Aug 2010 12:47:13 +0100 Subject: [PATCH] Preparation for the ability to set horizontal spacing. Two types of horizontal positioning -- an offset from the default position (which doesn't affect the flow) and a padding (which does). Also some package exports. --- buffer.lisp | 4 +++- drawing.lisp | 5 +++++ gui.lisp | 11 +++++++++++ packages.lisp | 4 +++- 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/buffer.lisp b/buffer.lisp index 409afe6..cb1eeac 100644 --- a/buffer.lisp +++ b/buffer.lisp @@ -62,10 +62,12 @@ (defclass element (gsharp-object) ((bar :initform nil :initarg :bar :accessor bar) (xoffset :initform 0 :initarg :xoffset :accessor xoffset) + (right-pad :initform 0 :initarg :right-pad :accessor right-pad) + (left-pad :initform 0 :initarg :left-pad :accessor left-pad) (annotations :initform nil :initarg :annotations :accessor annotations))) (defmethod slots-to-be-saved append ((e element)) - '(xoffset annotations)) + '(xoffset annotations left-pad right-pad)) (defmethod duration ((element element)) 0) (defmethod rbeams ((element element)) 0) diff --git a/drawing.lisp b/drawing.lisp index 394fc8b..37383aa 100644 --- a/drawing.lisp +++ b/drawing.lisp @@ -148,6 +148,11 @@ right of the center of its timeline")) (score-pane:staff-step 0))) (score-pane:staff-step 2))) +(defmethod left-bulge :around ((element element) pane) + (+ (gsharp-buffer::left-pad element) (call-next-method))) +(defmethod right-bulge :around ((element element) pane) + (+ (gsharp-buffer::right-pad element) (call-next-method))) + (defmethod right-bulge ((element element) pane) (score-pane:staff-step 1)) diff --git a/gui.lisp b/gui.lisp index 6a9c8bc..77a0333 100644 --- a/gui.lisp +++ b/gui.lisp @@ -96,6 +96,17 @@ "") pane)))) +(defun x-offset-label (frame pane) + (declare (ignore frame)) + (when (handler-case (cur-cluster) + (gsharp-condition () nil)) + (princ (gsharp-buffer::xoffset (cur-element)) pane))) +(defun x-pad-label (frame pane) + (declare (ignore frame)) + (when (handler-case (cur-cluster) + (gsharp-condition () nil)) + (princ (gsharp-buffer::left-pad (cur-element)) pane))) + (define-application-frame gsharp (esa-frame-mixin standard-application-frame) ((views :initarg :views :initform '() :accessor views) diff --git a/packages.lisp b/packages.lisp index 2cbb089..2219051 100644 --- a/packages.lisp +++ b/packages.lisp @@ -103,7 +103,9 @@ #:tie-right #:tie-left #:needs-saving #:tuning #:master-pitch-note #:master-pitch-freq - #:note-cents #:12-edo #:regular-temperament)) + #:note-cents #:12-edo #:regular-temperament + #:x-offset #:left-pad #:right-pad + #:rastral-size #:zoom-level)) (defpackage :gsharp-numbering (:use :gsharp-utilities :gsharp-buffer :clim-lisp) -- 2.11.4.GIT