peter@cbmvax.commodore.com (Peter Cherna) (01/22/91)
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. Some people open a small window first, and use the border dimensions from that. You could add a "Welcome" window that introduced the program. Something that said "Welcome to MyUtility, by Colin DeWolfe", would seamlessly give you that information. Many people rely on knowledge of the quantities that will be placed in the Border variables of the windows they create. These values have not changed in 2.0, though I'll warn you that Intuition now renders into ALL the pixels that those values declare. >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. The font that your window will get (if it's on the Workbench screen) is GfxBase->DefaultFont for the text that will be contained, and the WorkbenchScreen->Font for the title bar. The title-bar's height will be WorkbenchScreen->WBorTop + WorkbenchScreen->Font->ta_YSize + 1. >3) how does one find out in C whether you were launced from workbench or CLI? The standard argc variable is zero from the Workbench, and always at least one from the CLI. You can use your workbench startup message to get Workbench arguments, and argv[] to get your CLI arguments. >-- >Colin DeWolfe >dewolfe@ug.cs.dal.ca Peter -- Peter Cherna, Software Engineer, Commodore-Amiga, Inc. {uunet|rutgers}!cbmvax!peter peter@cbmvax.commodore.com My opinions do not necessarily represent the opinions of my employer. "Oh, PIN-compatible! I thought you wanted me to make it IN-compatible!"
chris@genly.UUCP (Chris Hind Genly) (01/25/91)
>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 <intuition/screens.h> 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 <workbench/startup.h> 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 \ ----------------------------------------------------------------
peter@sugar.hackercorp.com (Peter da Silva) (01/27/91)
A plea for sanity... In article <chris.8332@genly.UUCP> chris@genly.UUCP (Chris Hind Genly) writes: > 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. *IF* you do this, *please* let it be a selectable option. It takes a small amount of overscan to display a full-sized window with borders, there are plenty of utilities to do this in 1.3 (hell, I wrote one... all you need to do is write a prefs structure), and finally it's fully supported in 2.0. -- Peter da Silva. `-_-' <peter@sugar.hackercorp.com>.
xanthian@zorch.SF-Bay.ORG (Kent Paul Dolan) (02/03/91)
peter@sugar.hackercorp.com (Peter da Silva) writes: > A plea for sanity... > chris@genly.UUCP (Chris Hind Genly) writes: >> 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. > *IF* you do this, *please* let it be a selectable option. It takes a > small amount of overscan to display a full-sized window with borders, > there are plenty of utilities to do this in 1.3 (hell, I wrote one... > all you need to do is write a prefs structure), and finally it's fully > supported in 2.0. But while we're on the subject, sort of: I'd really like a resizing gadget that could be used for a borderless window with the following characteristics: * Does _not_ disable a strip up the side or across the bottom from being used for display surface. * Is invisible when not selected. * Can be drawn over when not selected. * Is inverse video when selected, so that it doesn't destroy data "under" itself. I'm not sure if that is very clear, but I'd like it to draw itself with and XOR and remove itself the same way, and in general not intrude at all when not in use. Does any such animal exist? (Naturally the idea generalizes to all the border gadgets.) Kent, the man from xanth. <xanthian@Zorch.SF-Bay.ORG> <xanthian@well.sf.ca.us>
markv@kuhub.cc.ukans.edu (02/06/91)
> I'd really like a resizing gadget that could be used for a borderless window > with the following characteristics:...many nice features of agadget... At present, it isn't really possible to do much to the system gadgets. But you could do your own with a gadget with an empty image, and appropriate hitbox. Make it GRELRIGHT, GRELBOTTOM, GADGIMMEDIATE, RELVERIFY, and FOLLOWMOUSE (excuse minor errors, off the top of my head). Then when you get the GADGETDOWN message, follow the mouse events, draw a "rubberband" box with Draw() or DrawPoly() and mode COMPLEMENT to show the border, and call ResizeWindow() when you the the GADGETUP message. (I use the COMPLEMENT trick to make my window Open/Closes do a Zoom, ala the Mac) -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark Gooderum Only... \ Good Cheer !!! Academic Computing Services /// \___________________________ University of Kansas /// /| __ _ Bix: mgooderum \\\ /// /__| |\/| | | _ /_\ makes it Bitnet: MARKV@UKANVAX \/\/ / | | | | |__| / \ possible... Internet: markv@kuhub.cc.ukans.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~