[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Groff-commit] groff ChangeLog NEWS doc/pic.ms src/preproc/pic...
From: |
Werner LEMBERG |
Subject: |
[Groff-commit] groff ChangeLog NEWS doc/pic.ms src/preproc/pic... |
Date: |
Mon, 19 Nov 2007 09:28:45 +0000 |
CVSROOT: /cvsroot/groff
Module name: groff
Changes by: Werner LEMBERG <wl> 07/11/19 09:28:45
Modified files:
. : ChangeLog NEWS
doc : pic.ms
src/preproc/pic: lex.cpp object.cpp object.h pic.man pic.y
Log message:
* src/groff/preproc/pic/lex.cpp (table): Add box attributes
`xslanted' and `yslanted'.
* src/groff/preproc/pic/object.cpp (object_spec::object_spec):
Initialize `xslanted' and `yslanted'.
(graphic_object): Add methods `set_xlanted' and `set_yslanted'.
(closed_object): Ditto.
Add members `xslanted' and `yslanted'.
(box_object::print): Use them.
(object_spec::make_object): Handle slant values.
* src/groff/preproc/pic/object.h (IS_XSLANTED, IS_YSLANTED): New
constants.
(object_spec): Add members `xslanted' and `yslanted'.
* src/groff/preproc/pic/pic.y (XSLANTED, YSLANTED): New left-valued
tokens.
Add rules for them.
* src/groff/preproc/pic/pic.man, NEWS, doc/pic.ms: Document above
changes.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/groff/ChangeLog?cvsroot=groff&r1=1.1110&r2=1.1111
http://cvs.savannah.gnu.org/viewcvs/groff/NEWS?cvsroot=groff&r1=1.243&r2=1.244
http://cvs.savannah.gnu.org/viewcvs/groff/doc/pic.ms?cvsroot=groff&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/lex.cpp?cvsroot=groff&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/object.cpp?cvsroot=groff&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/object.h?cvsroot=groff&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/pic.man?cvsroot=groff&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/groff/src/preproc/pic/pic.y?cvsroot=groff&r1=1.22&r2=1.23
Patches:
Index: ChangeLog
===================================================================
RCS file: /cvsroot/groff/groff/ChangeLog,v
retrieving revision 1.1110
retrieving revision 1.1111
diff -u -b -r1.1110 -r1.1111
--- ChangeLog 16 Nov 2007 08:23:38 -0000 1.1110
+++ ChangeLog 19 Nov 2007 09:28:44 -0000 1.1111
@@ -1,7 +1,29 @@
+2007-11-17 Heinz-Jürgen Oertel <address@hidden>
+
+ * src/groff/preproc/pic/lex.cpp (table): Add box attributes
+ `xslanted' and `yslanted'.
+
+ * src/groff/preproc/pic/object.cpp (object_spec::object_spec):
+ Initialize `xslanted' and `yslanted'.
+ (graphic_object): Add methods `set_xlanted' and `set_yslanted'.
+ (closed_object): Ditto.
+ Add members `xslanted' and `yslanted'.
+ (box_object::print): Use them.
+ (object_spec::make_object): Handle slant values.
+ * src/groff/preproc/pic/object.h (IS_XSLANTED, IS_YSLANTED): New
+ constants.
+ (object_spec): Add members `xslanted' and `yslanted'.
+ * src/groff/preproc/pic/pic.y (XSLANTED, YSLANTED): New left-valued
+ tokens.
+ Add rules for them.
+
+ * src/groff/preproc/pic/pic.man, NEWS, doc/pic.ms: Document above
+ changes.
+
2007-11-16 Werner LEMBERG <address@hidden>
* tmac/hyphenex.pl: Generate copyright notice (this has been
- approved By Barbara Beeton).
+ approved by Barbara Beeton).
* tmac/hyphenex.us: Updated.
2007-11-10 Michail Vidiassov <address@hidden>
Index: NEWS
===================================================================
RCS file: /cvsroot/groff/groff/NEWS,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -b -r1.243 -r1.244
--- NEWS 30 Oct 2007 09:31:37 -0000 1.243
+++ NEWS 19 Nov 2007 09:28:44 -0000 1.244
@@ -79,6 +79,10 @@
o Pic now supports up to 32 macro arguments (and up to 16 on EBCDIC
platforms).
+o Heinz-Jürgen Örtel contributed code for two new keywords, `xslanted' and
+ `yslanted', which can change the shape of boxes into arbitrary
+ parallelograms.
+
Eqn
---
Index: doc/pic.ms
===================================================================
RCS file: /cvsroot/groff/groff/doc/pic.ms,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- doc/pic.ms 21 Mar 2007 13:30:59 -0000 1.35
+++ doc/pic.ms 19 Nov 2007 09:28:44 -0000 1.36
@@ -31,7 +31,7 @@
.\" Eric S. Raymond <address@hidden> in August 1995. It has been put
.\" under the GPL in March 2006.
.\"
-.\" $Id: pic.ms,v 1.35 2007/03/21 13:30:59 wl Exp $
+.\" $Id: pic.ms,v 1.36 2007/11/19 09:28:44 wl Exp $
.
.
.\" Set a proper TeX and LaTeX
@@ -635,6 +635,24 @@
truncated to that value.
.
.NH 2
+Slanted Boxes
+.PP
+GNU \fBgpic\fP supports slanted boxes:
+.KS
+.PS
+box wid 1.2 xslanted 0.1 "xslanted 0.1";
+move;
+box wid 1.2 yslanted -0.1 "yslanted -0.1";
+move;
+box wid 1.2 xslanted -0.2 yslanted 0.1 "xslanted -0.2" "yslanted 0.1";
+.PE
+.CE "4: Various slanted boxes.
+.PP
+The \fBxslanted\fP and \fByslanted\fP attributes specify the x and
+y\~offset, respectively, of the box's upper right corner from its default
+position.
+.
+.NH 2
Arrowheads
.PP
Lines and arcs can be decorated as well. Any line or arc (and any
@@ -644,7 +662,7 @@
.PS
line <- ->
.PE
-.CE "4: Double-headed line made with \fBline <- ->\fP"
+.CE "5: Double-headed line made with \fBline <- ->\fP"
.PP
In fact, the \fBarrow\fP command is just shorthand for \fBline ->\fP. And
there is a double-head modifier <->, so the figure above could have been made
@@ -710,7 +728,7 @@
.PS
circle fill; move; circle fill 0.4; move; circle fill 0.9;
.PE
-.CE "5: \fBcircle fill; move; circle fill 0.4; move; circle fill 0.9;\fR"
+.CE "6: \fBcircle fill; move; circle fill 0.4; move; circle fill 0.9;\fR"
.PP
GNU \fBgpic\fP makes some additional guarantees. A fill value greater
than 1 can also be used: this means fill with the shade of gray that
@@ -735,7 +753,7 @@
.PS
box color "yellow"; arrow color "cyan"; circle shaded "green" outline "black";
.PE
-.CE "6: \fBbox color ""yellow""; arrow color ""cyan""; \
+.CE "7: \fBbox color ""yellow""; arrow color ""cyan""; \
circle shaded ""green"" outline ""black"";\fR"
.PP
Alternative spellings are \fBcolour\fP, \fBcolored\fP, \fBcoloured\fP,
@@ -2673,6 +2691,8 @@
invis[ible] \fR# make primitive invisible\fP
solid \fR# make closed figure solid\fP
fill[ed] [<expr>] \fR# set fill density for figure\fP
+ xscaled <expr> \fR# slant box into x direction\fP
+ yscaled <expr> \fR# slant box into y direction\fP
colo[u]r[ed] TEXT \fR# set fill and outline color for figure\fP
outline[d] TEXT \fR# set outline color for figure\fP
shaded TEXT \fR# set fill color for figure\fP
Index: src/preproc/pic/lex.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/lex.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/preproc/pic/lex.cpp 11 Dec 2006 16:12:15 -0000 1.5
+++ src/preproc/pic/lex.cpp 19 Nov 2007 09:28:45 -0000 1.6
@@ -1,6 +1,6 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2002, 2003, 2004, 2006
- Free Software Foundation, Inc.
+/* Copyright (C) 1989, 1990, 1991, 1992, 2000, 2002, 2003, 2004, 2006,
+ 2007 Free Software Foundation, Inc.
Written by James Clark (address@hidden)
This file is part of groff.
@@ -557,6 +557,8 @@
{ "wid", WIDTH },
{ "width", WIDTH },
{ "with", WITH },
+ { "xslanted", XSLANTED },
+ { "yslanted", YSLANTED },
};
const keyword *start = table;
Index: src/preproc/pic/object.cpp
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/object.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- src/preproc/pic/object.cpp 10 Apr 2007 08:13:42 -0000 1.8
+++ src/preproc/pic/object.cpp 19 Nov 2007 09:28:45 -0000 1.9
@@ -413,6 +413,8 @@
segment_is_absolute = 0;
text = 0;
shaded = 0;
+ xslanted = 0;
+ yslanted = 0;
outlined = 0;
with = 0;
dir = RIGHT_DIRECTION;
@@ -565,6 +567,8 @@
void set_outline_color(char *);
char *get_outline_color();
virtual void set_fill(double);
+ virtual void set_xslanted(double);
+ virtual void set_yslanted(double);
virtual void set_fill_color(char *);
};
@@ -594,6 +598,14 @@
{
}
+void graphic_object::set_xslanted(double)
+{
+}
+
+void graphic_object::set_yslanted(double)
+{
+}
+
void graphic_object::set_fill_color(char *c)
{
color_fill = strsave(c);
@@ -701,14 +713,18 @@
closed_object(const position &);
object_type type() = 0;
void set_fill(double);
+ void set_xslanted(double);
+ void set_yslanted(double);
void set_fill_color(char *fill);
protected:
double fill; // < 0 if not filled
+ double xslanted; // !=0 if x is slanted
+ double yslanted; // !=0 if y is slanted
char *color_fill; // = 0 if not colored
};
closed_object::closed_object(const position &pos)
-: rectangle_object(pos), fill(-1.0), color_fill(0)
+: rectangle_object(pos), fill(-1.0), xslanted(0), yslanted(0), color_fill(0)
{
}
@@ -718,6 +734,19 @@
fill = f;
}
+/* accept positive and negative values */
+void closed_object::set_xslanted(double s)
+{
+ //assert(s >= 0.0);
+ xslanted = s;
+}
+/* accept positive and negative values */
+void closed_object::set_yslanted(double s)
+{
+ //assert(s >= 0.0);
+ yslanted = s;
+}
+
void closed_object::set_fill_color(char *f)
{
color_fill = strsave(f);
@@ -775,10 +804,12 @@
if (xrad == 0.0) {
distance dim2 = dim/2.0;
position vec[4];
- vec[0] = cent + position(dim2.x, -dim2.y);
- vec[1] = cent + position(dim2.x, dim2.y);
- vec[2] = cent + position(-dim2.x, dim2.y);
- vec[3] = cent + position(-dim2.x, -dim2.y);
+ /* error("x slanted %1", xslanted); */
+ /* error("y slanted %1", yslanted); */
+ vec[0] = cent + position(dim2.x, -(dim2.y - yslanted)); /* lr */
+ vec[1] = cent + position(dim2.x + xslanted, dim2.y + yslanted); /* ur */
+ vec[2] = cent + position(-(dim2.x - xslanted), dim2.y); /* ul */
+ vec[3] = cent + position(-(dim2.x), -dim2.y); /* ll */
out->polygon(vec, 4, lt, fill);
}
else {
@@ -1896,6 +1927,10 @@
obj->set_thickness(th);
if (flags & IS_OUTLINED)
obj->set_outline_color(outlined);
+ if (flags & IS_XSLANTED)
+ obj->set_xslanted(xslanted);
+ if (flags & IS_YSLANTED)
+ obj->set_yslanted(yslanted);
if (flags & (IS_DEFAULT_FILLED | IS_FILLED)) {
if (flags & IS_SHADED)
obj->set_fill_color(shaded);
Index: src/preproc/pic/object.h
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/object.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- src/preproc/pic/object.h 26 May 2005 21:02:01 -0000 1.5
+++ src/preproc/pic/object.h 19 Nov 2007 09:28:45 -0000 1.6
@@ -1,5 +1,5 @@
// -*- C++ -*-
-/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004
+/* Copyright (C) 1989, 1990, 1991, 1992, 2002, 2004, 2007
Free Software Foundation, Inc.
Written by James Clark (address@hidden)
@@ -156,6 +156,8 @@
const unsigned long IS_ALIGNED = 010000000;
const unsigned long IS_SHADED = 020000000;
const unsigned long IS_OUTLINED = 040000000;
+const unsigned long IS_XSLANTED = 0100000000;
+const unsigned long IS_YSLANTED = 0200000000;
struct segment {
int is_absolute;
@@ -189,6 +191,8 @@
double end_chop;
double thickness;
double fill;
+ double xslanted;
+ double yslanted;
char *shaded;
char *outlined;
direction dir;
Index: src/preproc/pic/pic.man
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/pic.man,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- src/preproc/pic/pic.man 19 Jul 2004 20:04:22 -0000 1.19
+++ src/preproc/pic/pic.man 19 Nov 2007 09:28:45 -0000 1.20
@@ -1,5 +1,6 @@
.ig
-Copyright (C) 1989-2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+Copyright (C) 1989-2000, 2001, 2002, 2003, 2004, 2007
+ Free Software Foundation, Inc.
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
@@ -735,6 +736,17 @@
A box with rounded corners can be dotted or dashed.
.
.LP
+Boxes can have slanted sides.
+This effectively changes the shape of a box from a rectangle to an
+arbitrary parallelogram.
+The
+.B xslanted
+and
+.B yslanted
+attributes specify the x and y\~offset of the box's upper right corner
+from its default position.
+.
+.LP
The
.B .PS
line can have a second argument specifying a maximum height for
@@ -818,7 +830,7 @@
line.
.
.LP
-Boxes (including boxes with rounded corners),
+Boxes (including boxes with rounded corners or slanted sides),
circles and ellipses can be filled by giving them an attribute of
.BR fill [ ed ].
This takes an optional argument of an expression with a value between
Index: src/preproc/pic/pic.y
===================================================================
RCS file: /cvsroot/groff/groff/src/preproc/pic/pic.y,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -b -r1.22 -r1.23
--- src/preproc/pic/pic.y 20 Sep 2007 07:39:30 -0000 1.22
+++ src/preproc/pic/pic.y 19 Nov 2007 09:28:45 -0000 1.23
@@ -197,6 +197,8 @@
%token COLORED
%token OUTLINED
%token SHADED
+%token XSLANTED
+%token YSLANTED
%token ALIGNED
%token SPRINTF
%token COMMAND
@@ -221,6 +223,7 @@
precedence than left and right, so that eg `line chop left'
parses properly. */
%left CHOP SOLID DASHED DOTTED UP DOWN FILL COLORED OUTLINED
+%left XSLANTED YSLANTED
%left LABEL
%left VARIABLE NUMBER '(' SIN COS ATAN2 LOG EXP SQRT K_MAX K_MIN INT RAND
SRAND LAST
@@ -935,6 +938,18 @@
$$->flags |= IS_FILLED;
$$->fill = $3;
}
+ | object_spec XSLANTED expr
+ {
+ $$ = $1;
+ $$->flags |= IS_XSLANTED;
+ $$->xslanted = $3;
+ }
+ | object_spec YSLANTED expr
+ {
+ $$ = $1;
+ $$->flags |= IS_YSLANTED;
+ $$->yslanted = $3;
+ }
| object_spec SHADED text
{
$$ = $1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Groff-commit] groff ChangeLog NEWS doc/pic.ms src/preproc/pic...,
Werner LEMBERG <=