In an E-mail message, Conn Copas wrote:
> 
> Amy writes:
> 
> "How can I specify what size the
> monitor will be __right__  after
> I open it with 'd.mon'?  I'm writing
> a script and would prefer that the 
> user does not have to enlarge the
> monitor before displaying any maps.
> Please respond directly to me."
> 
> I recently hacked the X driver to do something which may be of general interest
> so, if you can stand a small amount of C code, here it is. The idea is that the
> default aspect ratio of the monitor reflects the aspect ratio of the data
> within the current region, unless this is overridden by the presence of 
> XDRIVER_HEIGHT/WIDTH environment variables. So, no more ugly black borders
> around rectangular data within square monitors. Also, if you zoom into some
> tiny region, the monitor is magnified to a size which occupies a reasonable
> amount of screen real-estate; around 20%. If the monitor is resized
> interactively, the aspect ratio is preserved.

Hello Conn,

I tried your XDRIVER code change but was not able to see any effect from
it.  When I started a monitor, a square monitor came up and maps dispayed
to it had black borders on the left and right sides.  I also saw no effect
when I zoomed and displayed maps.  The compile seemed to work fine but did
result in a warning for lines 322 and 323 in the Graph_Set.c code where you
made changes:

cc -O -D_NO_PROTO  -I/usr/openwin/include -I/data/softail/loechl/grass_up4/grass
.src/src/include  -c Graph_Set.c
"Graph_Set.c", line 322: warning: struct/union or struct/union pointer required
"Graph_Set.c", line 323: warning: struct/union or struct/union pointer required
mv Graph_Set.o OBJ.sun4/Graph_Set.o
rm -f OBJ.sun4/Panel.o



The relevant lines in Graph_Set.c are shown below.  Any ideas on what happened?


get_aspect(pref_rows,pref_cols,me,dpy, scrn)
int *pref_rows, *pref_cols;
char *me;

{
    float rows, cols, row_frac, col_frac, side, temp;
    int mag = 1;
    int x, y;

        get_user ("XDRIVER_HEIGHT",pref_rows,0);
        get_user ("XDRIVER_WIDTH",pref_cols,0);

        if (*pref_rows <= 0 || *pref_cols <= 0)
        {
        G_gisinit(me);
        rows = G_window_rows();
        cols = G_window_cols();
>>>>>>> row_frac = rows/DisplayHeight(dpy, scrn);
>>>>>>> col_frac = cols/DisplayWidth(dpy, scrn);
        if (rows > cols)
                side = row_frac;
        else
                side = col_frac;

        do
                {
                mag++;
                temp = mag*side;
                }
        while (temp <= 0.5);

        *pref_rows = rows*--mag;
        *pref_cols = cols*mag;
        }
}


-- 
-------------------------

Paul Loechl					p-loechl@cecer.army.mil
USA CERL					(217)352-6511x7668

