Path: utzoo!attcan!uunet!cme!durer!warsaw From: warsaw@cme.nist.gov (Barry A. Warsaw) Newsgroups: comp.windows.x Subject: Help w/ resources, maybe what I want in R5... Message-ID: Date: 28 Jun 90 14:46:03 GMT Sender: news@cme.nist.gov Organization: National Institute of Standards and Technology Lines: 130 I have some questions about using resources to specify the "personality" of my Athena based applications. If the answer to my questions is "Here's the way to do what you want..." then that's great. If the answer is, as I suspect, "Nope, you can't do what you want", then consider this a Wish For R5. I want to be able to use resources to control the personality of the applications running in my environment. The kinds of things I want to do are: 1) Make all command buttons be oval shaped, with Black on Wheat colors, using the helvetica.b.12 (*) font. 2) Make all SimpleMenu objects use the newcent.14 (**) font, with Black on LightYellow colors. (*) alias for -adobe-helvetica-bold-r-normal--12-120-75-75-p-70-iso8859-1 (**) alias for -adobe-new century schoolbook-bold-r-normal--14-140-75-75-p-87-iso8859-1 I want things like this so that all clients I run will have a consistent look to them. Now, I can, for the most part, accomplish this easily and consicely by setting up my resources like so: *Command.ShapeStyle: Oval *Command.Foreground: Black *Command.Background: Wheat *Command.Font: helvetica.b.12 *SimpleMenu.Foreground: Black *SimpleMenu.Background: LightYellow *SimpleMenu.Font: newcent.14 These simple settings will give me the look I describe in my examples 1 & 2 above for the vast majority of Xt applications. The rub comes when an application, in its app-defaults file, sets one of these resources. The typical application will provide the application class name as the first componant in the resources in the app-defaults file, and such a setting will take precedence over my more general settings. An example of this is xpostit. The relevent settings in the Xpostit app-defaults file are: ! ! Fonts ! Xpostit*Command*font: -adobe-helvetica-bold-r-normal--*-120-*-*-*-*-*-* Xpostit*Menu*font: -adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-* Xpostit*Text*font: -b&h-lucidatypewriter-medium-r-normal-*-*-120-*-*-*-*-*-* You see here that the Xpostit*Command*font setting will override my *Command.Font setting, even though what I really want is my more general *Command.Font resource value. Though I can set all command button's fonts for most of the general cases, I am forced to deal with xpostit as a special case. The only way to get xpostit to conform to my personal "Look" policy is to have this setting in my Xdefaults file: Xpostit*Command.Font: helvetica.b.12 For this limited example it may not seem like much, but it can get to be a big hassle with a large number of resources and/or applications, especially considering that I'm forced to check out each application's app-defaults file for those resource settings which might override my general ones. Further, there is no way that I can nullify a setting in an application's app-defaults file without editing the root-owned file, or tell Xt not to load the app-defaults file in the system location. One thing that I *can* do is copy the system app-defaults file into a directory I own pointed to by XAPPLRESDIR, and comment out the font setting mentioned above, but this does not perclude the loading of the system app-defaults file; my local copy gets loaded *after* the system file (ORA, vol. 4, pp 245) so the higher precedence resource in the system file will override any more general setting in my local copy with lower precedence, in which case I must still deal with that particular setting for that particular application on a special basis. As I see it there are a few possible answers: 1) What I want to do is really not relevent, or arises from my incomplete understanding of the use of resources, or is not something that should be wanted by serious X heads (X:-). 2) Xt already provides a simple way to do what I want, but I just haven't found it yet. 3) Applications writers are not specifying the resources in their app-defaults files "correctly". 4) There currently is no provision to accomplish what I want. I wouldn't be at all suprised to find that case #1 or #2 is true, and if so, please post a reasonable explanation of why what I describe is really a non-problem. I (and perhaps others) would certainly appreciate the clarification. In the case of #3, is it possible that application writers should not specify the application class in the app-defaults file, but instead should wildcard the first componant? In the case of #4, then consider this a RFE for R5. I'd like to see an extension to the resource manager where the user can specify a "universal highest precedence wildcard match" sequence, so that I could put this sequence in my resource setting and it would act like a wildcard, but with higher precedence than the fully specified componant. I propose ".*", but the exact sequence doesn't matter really. This would modify my general resource settings described at the beginning of this article to look like this: .*Command.ShapeStyle: Oval .*Command.Foreground: Black .*Command.Background: Wheat .*Command.Font: helvetica.b.12 .*SimpleMenu.Foreground: Black .*SimpleMenu.Background: LightYellow .*SimpleMenu.Font: newcent.14 Now the .* in .*Command.ShapeStyle would match any number of componants but would match with a higher precedence and so my general setting would win. Anyway, does this sound like a reasonable wish, even if the real solution differs from what I suggest? A second Wish for R5 would be to extend the resource manager to understand escape sequences for special characters. -Barry NAME: Barry A. Warsaw USMAIL: National Institute of Standards TELE: (301) 975-3460 and Technology (formerly NBS) UUCP: uunet!cme.nist.gov!warsaw Rm. B-124, Bldg. 220 INET: warsaw@cme.nist.gov Gaithersburg, MD 20899