Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!huxley!glenn From: glenn@glenn@bitstream.com (Glenn P. Parker) Newsgroups: comp.windows.interviews Subject: Re: a problem with "inch" Message-ID: Date: 3 Jun 91 18:42:40 GMT References: <1991Jun3.151557.10753@forwiss.uni-passau.de> Sender: glenn@huxley.UUCP Reply-To: (Glenn Parker) Distribution: comp Organization: Bitstream, Inc. Lines: 38 In-reply-to: fraus@forwiss.uni-passau.de's message of 3 Jun 91 15:15:57 GMT In article <1991Jun3.151557.10753@forwiss.uni-passau.de> fraus@forwiss.uni-passau.de (Uli Fraus) writes: > So maybe the variable inch (from file defs.h) is initialized by defining > a World variable. Precisely. > Is this a bug or a feature??? It's a bug or a feature, depending on how you look at it. :-) The global variable "inch" is set by the InterViews library to be the number of *pixels* per inch in a *particular* World, i.e. X display. Since display resolutions differ widely, this variable can't be set until a World has been created (establishing a connection to an X server, which can provide appropriate information about resolution). > How is it possible to have (global) constants based on 'inch'? It isn't, but is that what you really want? If you use a hard constant, your software will only work at one resolution. If you use inch instead (or something based on inch), things should scale nicely. In my Reconfig functions, I frequently begin with a statement like: const Coord spacer = round(inch/4); I then use spacer to express the Shape's of other components. This works fine because Reconfig can't (well... never should) be called before a World has been created. Why is this a bug and not just a feature? It is possible to have two Worlds with different resolutions. I've never had to worry about this, myself. -- Glenn P. Parker glenn@bitstream.com Bitstream, Inc. uunet!huxley!glenn 215 First Street BIX: parker Cambridge, MA 02142-1270