Path: utzoo!utgpu!watserv1!watmath!att!pacbell.com!ames!uakari.primate.wisc.edu!samsung!spool2.mu.edu!uunet!hsi!genly!chris From: chris@genly.UUCP (Chris Hind Genly) Newsgroups: comp.sys.amiga.programmer Subject: Re: Some Intuition/Graphics questions Message-ID: Date: 25 Jan 91 15:21:33 GMT References: <1991Jan20.022627.13975@cs.dal.ca> Organization: Eggplant Software Tools, CT, USA Lines: 82 >In article <1991Jan20.022627.13975@cs.dal.ca> dewolfe@ug.cs.dal.ca (Colin DeWolfe) writes: >I am doing a project for my 4550 Computer Science class (microcomputers) and >have a couple of questions. > >1) How would one find out what the dimensions of the window borders are > without actually opening a window. I need to know this so that I can > render text correctly in a 80x24 column console window. ie, I need to know > know the size of the window required before I open it. If you use the default 80 column font on a high res screen, you'll have to open a borderless window as wide as the screen to fit all 80 on one line. In struct Screen { ... /* Bar sizes for this Screen and all Window's in this Screen */ BYTE BarHeight, BarVBorder, BarHBorder, MenuVBorder, MenuHBorder; BYTE WBorTop, WBorLeft, WBorRight, WBorBottom; You can find existing screens using Intuition base. This is the pointer returned by OpenLibrary("intuition.library", 0). struct IntuitionBase /* IntuitionBase should never be directly modified by programs */ /* even a little bit, guys/gals; do you hear me? */ { . . . struct Window *ActiveWindow; struct Screen *ActiveScreen; /* the FirstScreen variable points to the frontmost Screen. Screens are * then maintained in a front to back order using Screen.NextScreen */ struct Screen *FirstScreen; /* for linked list of all screens */ >2) How does one find the size of the default system font so that I will know > how large a window to open (as per above) as well the size of the font for > the border. As above, I need to figure this out WITHOUT opening a window. I've been pulling the default font from GfxBase. struct GfxBase { . . . struct TextFont *DefaultFont; There is a text attribute structure in the screen structure. You could use it to open a font. I don't know if this applies only to text rendered by the workbench, or if it is used to set the default font in the graphics base too. (Anyone on the net know?) struct Screen { . . . struct TextAttr *Font; /* this screen's default font */ >3) how does one find out in C whether you were launced from workbench or CLI? Under Lattice, check main's argc. If its 0, you were started by the Workbench. The second argument is a pointer to the workbench startup message. If its non-zero you were started by the CLI. See for the workbench startup structure. * * * \|/ * _______ --O-- ____/ KC1VP \____ * /|\ * ______/ (203) 389-8680 \______ ______/ Eggplant Software Tools \________ ______/ 95 Fountain Terr., New Haven, CT, USA, 06515 \_______ / Chris Hind Genly chris@genly.uucp uunet!hsi!genly!chris \ ----------------------------------------------------------------