[comp.windows.interviews] manual.sty

cameron@cs.flinders.oz.au (Cameron Humphries) (05/29/91)

Could some kind person send me the doc style file "manual.sty"? It doesn't
appear to be part of the 3.0beta distribution but is needed for the Reference
Manual.

Thanks
-Cameron

Cameron Humphries
Discipline of Computer Science                 email: cameron@cs.flinders.oz.au
School of Information Science and Technology   phone: +61 +8 201 2874
The Flinders University of South Australia     fax  : +61 +8 201 2904

grunwald@foobar.colorado.edu (Dirk Grunwald) (05/29/91)

Here's a MonoGlyph that surrounds another Glyph with an oval border.
You specify the color and brush for the border, as well as the radius
in the x,y directions. The oval has quarter circles at each corner of
the contained glyph.

I'd be interested in hearing about other such gee-gaws that people
come up with. 

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of shell archive."
# Contents:  example.cc OvalBorder.cc OvalBorder.h
# Wrapped by grunwald@foobar.Colorado.EDU on Tue May 28 21:48:59 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'example.cc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'example.cc'\"
else
echo shar: Extracting \"'example.cc'\" \(1205 characters\)
sed "s/^X//" >'example.cc' <<'END_OF_FILE'
X#include "OvalBorder.h"
X#include "InterViews/character.h"
X#include "InterViews/font.h"
X#include "InterViews/color.h"
X#include "InterViews/brush.h"
X#include "InterViews/window.h"
X#include "InterViews/world.h"
X#include "InterViews/aggregate.h"
X#include "InterViews/box.h"
X#include "InterViews/margin.h"
X#include "InterViews/discretion.h"
X#include "InterViews/glue.h"
X#include "InterViews/shadow.h"
X
X#include "stream.h"
X#include "string.h"
X
X#include "OvalBorder.h"
X
XWorld	*world;
X
Xmain(int argc, char **argv)
X{
X    world = new World("Foo", argc, argv);
X    
X    Color *color = world -> foreground();
X    Color *back = world -> background();
X    Font *font = world -> font();
X
X    char *s = "Hello, World";
X    if ( argc > 1 ) {
X	s = argv[1];
X    }
X    int len = strlen(s);
X
X    LRBox *bx = new LRBox();
X
X    while ( s && *s && *s != '\n' ) {
X	Character *ch  = new Character(*s, font, color);
X	bx -> append(ch);
X	if ( *s == ' ') {
X	    bx -> append(new HGlue());
X	}
X	s++;
X    }
X
X    Glyph *xx = new Margin(new OvalBorder(bx, color, new Brush(3)),
X					  50, 50);
X
X    TopLevelWindow *window = new TopLevelWindow(xx);
X
X    window -> world(world);
X    window -> map();
X
X    world->Run();
X
X    delete world;
X
X}
X
END_OF_FILE
if test 1205 -ne `wc -c <'example.cc'`; then
    echo shar: \"'example.cc'\" unpacked with wrong size!
fi
# end of 'example.cc'
fi
if test -f 'OvalBorder.cc' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'OvalBorder.cc'\"
else
echo shar: Extracting \"'OvalBorder.cc'\" \(3705 characters\)
sed "s/^X//" >'OvalBorder.cc' <<'END_OF_FILE'
X#include <InterViews/canvas.h>
X#include <InterViews/color.h>
X#include <InterViews/brush.h>
X#include <InterViews/printer.h>
X#include "OvalBorder.h"
X
XOvalBorder::OvalBorder(Glyph* body, Color* c, Brush *b)
X  : MonoGlyph(body)
X{
X    color_ = c;
X    if (color_ != nil) {
X	color_->ref();
X    }
X    brush_ = b;
X    if (brush_ != nil) {
X	brush_->ref();
X	rx_ = ry_ = brush_ -> width() * 2;
X    } else {
X	rx_ = 3;
X	ry_ = 3;
X    }
X}
X
XOvalBorder::OvalBorder(Glyph* body, Color* c, Brush *b, Coord x, Coord y)
X  : MonoGlyph(body)
X{
X    color_ = c;
X    if (color_ != nil) {
X	color_->ref();
X    }
X    brush_ = b;
X    if (brush_ != nil) {
X	brush_->ref();
X    }
X    rx_ = x;
X    ry_ = y;
X}
X
XOvalBorder::~OvalBorder()
X{
X    Resource::unref(color_);
X    Resource::unref(brush_);
X}
X
Xvoid OvalBorder::request(Requisition& requisition)
X{
X    //
X    // let body make request
X    //
X    MonoGlyph::request(requisition);
X
X    //
X    // now add in our stuff
X    //
X    Requirement x = requisition.requirement(Dimension_X);
X    if (x.defined()) {
X	x.natural(x.natural() + 2 * rx_);
X    }
X
X    requisition.require(Dimension_X, x);
X    Requirement y = requisition.requirement(Dimension_Y);
X    if (y.defined()) {
X	y.natural(y.natural() + 2 * ry_);
X    }
X    requisition.require(Dimension_Y, y);
X}
X
X
Xvoid
XOvalBorder::subAllocation(Allocation& a, Allocation& newa)
X{
X    Allotment ox = a.allotment(Dimension_X);
X    Allotment oy = a.allotment(Dimension_Y);
X
X    newa.allot(Dimension_X,
X	       Allotment(ox.origin() + rx_,
X			 ox.span() - (2 * rx_),
X			 ox.alignment()
X			 ));
X
X    newa.allot(Dimension_Y,
X	       Allotment(oy.origin() + ry_,
X			 oy.span() - (2 * ry_),
X			 oy.alignment()));
X}
X
Xvoid OvalBorder::allocate(Canvas* canvas, Allocation& a, Extension& ext)
X{
X    Allocation newa;
X    
X    subAllocation(a, newa);
X    MonoGlyph::allocate(canvas, newa, ext);
X    ext.extend(a);
X}
X
Xvoid
XOvalBorder::ovalbox(Canvas* c, Allocation& a)
X{
X    static float p0 = 1.00000000;
X    static float p1 = 0.89657547;
X    static float p2 = 0.70710678;
X    static float p3 = 0.51763809;
X    static float p4 = 0.26794919;
X
X    Coord l = a.left();
X    Coord r = a.right();
X    Coord b = a.bottom();
X    Coord t = a.top();
X    
X    Coord px0 = p0 * rx_, py0 = p0 * ry_;
X    Coord px1 = p1 * rx_, py1 = p1 * ry_;
X    Coord px2 = p2 * rx_, py2 = p2 * ry_;
X    Coord px3 = p3 * rx_, py3 = p3 * ry_;
X    Coord px4 = p4 * rx_, py4 = p4 * ry_;
X    Coord x,y;
X    
X    c -> new_path();
X
X    //
X    // right side & top right quad
X    c -> move_to(r, b + ry_);
X    c -> line_to(r, t - ry_);
X    x = r - rx_;
X    y = t - ry_;
X    c -> curve_to(x + px2, y + py2, x + px0, y + py4, x + px1, y + py3);
X    c -> curve_to(x, y + ry_, x + px3, y + py1, x + px4, y + py0);
X
X    //
X    // top and top left quad
X    //
X    c -> line_to(l + rx_, t);
X    x = l + rx_;
X    y = t - ry_;
X    c -> curve_to(x - px2, y + py2, x - px4, y + py0, x - px3, y + py1);
X    c -> curve_to(x - rx_, y, x - px1, y + py3, x - px0, y + py4);
X
X    //
X    // left and bottom left quad
X    c -> line_to(l, b + ry_);
X    x = l + rx_;
X    y = b + ry_;
X    c -> curve_to(x - px2, y - py2, x - px0, y - py4, x - px1, y - py3);
X    c -> curve_to(x, y - ry_, x - px3, y - py1, x - px4, y - py0);
X
X    //
X    // bottom and bottom right quad
X    //
X    c -> line_to(r-rx_, b);
X    x = r - rx_;
X    y = b + ry_;
X    c -> curve_to(x + px2, y - py2, x + px4, y - py0, x + px3, y - py1);
X    c -> curve_to(x + rx_, y, x + px1, y - py3, x + px0, y - py4);
X
X    c -> close_path();
X    c -> stroke(color_, brush_);
X}
X
Xvoid OvalBorder::draw(Canvas* canvas, Allocation& a)
X{
X    if (canvas != nil) {
X	Allocation newa;
X	subAllocation(a, newa);
X	MonoGlyph::draw(canvas, newa);
X	ovalbox(canvas, a);
X    }
X}
END_OF_FILE
if test 3705 -ne `wc -c <'OvalBorder.cc'`; then
    echo shar: \"'OvalBorder.cc'\" unpacked with wrong size!
fi
# end of 'OvalBorder.cc'
fi
if test -f 'OvalBorder.h' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'OvalBorder.h'\"
else
echo shar: Extracting \"'OvalBorder.h'\" \(929 characters\)
sed "s/^X//" >'OvalBorder.h' <<'END_OF_FILE'
X#ifndef ivlook_ovalborder_h
X#define ivlook_ovalborder_h
X
X#include <InterViews/monoglyph.h>
X
Xclass Color;
Xclass Brush;
X
X//
X// OvalBorder is similar to Margin; it places an oval border around
X// a glyph. The corners have (x,y) radii of (rx,ry). The enclosed
X// glyph gets it's natural allotment, and the border is added on. The
X//
X
Xclass OvalBorder : public MonoGlyph {
Xpublic:
X    OvalBorder(Glyph* body, Color*, Brush*);
X    OvalBorder(Glyph* body, Color*, Brush*,
X	       Coord rx, Coord ry);
X
X    virtual ~OvalBorder();
X
X    virtual void request(Requisition& requisition);
X    virtual void allocate(Canvas*, Allocation&, Extension&);
X    virtual void draw(Canvas*, Allocation&);
X//    virtual void print(Printer*, Allocation&);
X
Xprivate:
X    virtual void subAllocation(Allocation&, Allocation&);
X    virtual void ovalbox(Canvas *c, Allocation& a);
X    Coord rx_;
X    Coord ry_;
X    Color* color_;
X    Brush* brush_;
X};
X
X#endif
END_OF_FILE
if test 929 -ne `wc -c <'OvalBorder.h'`; then
    echo shar: \"'OvalBorder.h'\" unpacked with wrong size!
fi
# end of 'OvalBorder.h'
fi
echo shar: End of shell archive.
exit 0

grunwald@foobar.colorado.edu (Dirk Grunwald) (05/29/91)

As you probably guess, that posting had nothing to do with 'manual.sty'.
pesky gnus-reader.

linton@marktwain.rad.sgi.com (Mark Linton) (05/30/91)

In article <9105290155.AA10918@kurango.cs.flinders.oz.au>, cameron@cs.flinders.oz.au (Cameron Humphries) writes:
|> Could some kind person send me the doc style file "manual.sty"? It doesn't
|> appear to be part of the 3.0beta distribution but is needed for the Reference
|> Manual.

It should be in iv/src/man/refman/manual.sty.  A copy is enclosed below.

\documentstyle{book}
%textwidth 6.5in
%textheight 8.5in
%leftsidemargin 2pt
%rightsidemargin 2pt
%bottommargin 48pt
%topmargin 2pt
%baselineskip 0
%macro{chapter}{\newpage\counter{chapter}{\bf\LARGE Chapter~\ref{chapter}\smallskip#\hfil}\medvspace}
%macro{section}{\medskip\counter{section}\bf\Large\ref{section}\hfill\parbox{-30pt}{#\hfil}\smallvspace}
%macro{subsection}{\smallskip\counter{subsection}\bf\large\ref{subsection}\hfill\parbox{-35pt}{#\hfil}\linebreak}
%macro{code}{\float{figure}{\parbox{6.5in}{\small\\\hrule\\\sf\quad\quad\parbox{6.0in}{#}\\\hrule}}}