SGI window size.

Conn Copas cvc at itd.dsto.gov.au
Fri Jun 23 08:00:00 EDT 1995


Re the initial size of the SGI window, I posted some code a while ago for
automatically sizing the X window according to the aspect ratio of the data in
the current region. I mentioned that I had done the same for the SGI if people
wanted more details, and that offer still stands.

Briefly, here is what I have added to Graph_Set.c:

--------------------------------------------------
Graph_Set(Prog)
char *Prog;
{
    int pref_rows,pref_cols, x_left,y_top;

    setpgrp (); /* avoid signal problems */
    get_aspect(&pref_rows,&pref_cols,Prog);
    get_user("XDRIVER_LEFT",&x_left,10);
    get_user("XDRIVER_TOP",&y_top,30);

/*    prefsize(pref_cols,pref_rows);
    prefposition(x_left,x_left+pref_cols,y_top,y_top+pref_rows); */

    keepaspect(pref_cols,pref_rows);

    if (0 > winopen (Prog))
        fprintf (stderr, "Cannot open graphics window\n"), exit (-1);

    winposition(x_left,x_left+pref_cols,getgdesc(GD_YPMAX)-y_top,getgdesc(GD_YP
M
AX)-y_top-pref_rows);

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

prefsize/2, prefposition/4, keepaspect/2, and winposition/4 are all part of
the SGI graphics library; take a look at the man pages.

get_aspect/3 is something I wrote which takes a look at the aspect ratio of
the current region, and scales up the rows and columns if considered necessary.

get_user/3 is something I used from the XDRIVER which takes a look in the
.grassrc file to see whether certain parameters are defined. If not, it
substitutes arg 3 as the default.

 
-- 
Conn V Copas
Information Technology Division
Defence Science and Technology Organisation
PO Box 1500
Salisbury            tel: +61 (0)8 25 95349
SA  5108             fax: +61 (0)8 25 96781
Australia       e-mail: cvc at itd.dsto.gov.au
-------------------------------------------          





More information about the grass-dev mailing list