Skip to content

Commit

Permalink
Rewriting of the tables splitting:
Browse files Browse the repository at this point in the history
 -merging of splitted-multi-page-table into table
 -added a splitted-table
 -removal of multi-page-row
 -v-split is for v-mode boxes only
 -fit-lines replaces v-split for text-content


git-svn-id: http://www.fractalconcept.com:8000/public/open-source/cl-typesetting@53 9d29c65d-f3d6-0310-ab0c-b43ff62e96ec
  • Loading branch information
marc committed Jun 19, 2004
1 parent 5e940d9 commit b9a5510
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 191 deletions.
10 changes: 6 additions & 4 deletions boxes.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@
(defmethod adjust-box-dy (box dy baseline)
nil)

(defgeneric v-split (content dx dy &optional v-align)
;;; Split the content object vertically into two parts
(defgeneric v-split ((box v-mode-mixin) dx dy)
;;; Split a v-mode box vertically into two parts
;; Args: dx - area width, dy - area height
;; Values: boxes-fit, boxes-left, dy-left
;; Values: box-fitted, box-left, dy-left
(:method (content dx dy &optional v-align)
(declare (ignore dx v-align))
(values nil nil dy)))
(if (> (dy box) dy)
(values nil box dy)
(values box nil (- dy (dy box))))))

(defgeneric boxes-left (content))

Expand Down
28 changes: 14 additions & 14 deletions layout.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
(post-decoration style))))

;;This would need a complete rewrite...
(defmethod v-split ((content text-content) dx dy &optional (v-align :top))
(defmethod fit-lines ((content text-content) dx dy &optional (v-align :top)(advance t))
(let* ((boxes (boxes content))
(boxes-left boxes)
(text-lines ())
Expand Down Expand Up @@ -73,7 +73,9 @@
(setq text-lines nil))
((member v-align '(:center :top))
(setq text-lines (cons (make-vfill-glue) text-lines))))
(return-from v-split (values (nreverse text-lines) boxes-left dy-left)))
(when advance
(setf (boxes-left content) boxes-left))
(return-from fit-lines (values (nreverse text-lines) dy-left)))
(abort-line ()
(setf boxes-left boxes)
(return-lines))
Expand Down Expand Up @@ -121,15 +123,15 @@
((vmode-p box)
(next-line line-boxes)
(decf dy (dy box))
(when (minusp dy)
;; Embedded vmode element does not fit - verify for multi-page
(incf dy (dy box))
(push box boxes-left)
(multiple-value-bind (boxes boxes-left dy-left) (v-split box dx dy)
(declare (ignore boxes-left))
(setf text-lines (revappend boxes text-lines))
(return-lines dy-left)))
(push box text-lines))
(if (minusp dy)
;; try to split object
(multiple-value-bind (box-fitted box-left dy-left) (v-split box dx (+ dy (dy box)))
(when box-left
(push box-left boxes-left))
(when box-fitted
(push box-fitted text-lines))
(return-lines dy-left))
(push box text-lines)))
((and trimming (trimmable-p box)) nil)
((eq box :eol)
(when (eq *h-align* :left-not-last)
Expand Down Expand Up @@ -258,12 +260,10 @@
(defun make-filled-vbox (content dx dy &optional (v-align :top) (advance t))
;;; Args: advance If true, assign new boxes-left.
(with-text-content (content)
(multiple-value-bind (boxes boxes-left) (v-split content dx dy v-align)
(multiple-value-bind (boxes) (fit-lines content dx dy v-align advance)
(when boxes
(let* ((vbox (make-instance 'vbox :dx dx :dy dy :boxes boxes :fixed-size t)))
(do-layout vbox)
(when advance
(setf (boxes-left content) boxes-left))
vbox)))))

#+nil
Expand Down
Loading

0 comments on commit b9a5510

Please sign in to comment.