I have always been very interested in classic Mac themes and I am having loads of fun playing with AppearanceLib. I have a few new interesting things I have found in case anyone is interested.
First of all, I am finding that running Mac OS 9.2.2 in classic mode of Tiger, no modifications of AppearanceLib in the system file are having any effect. I think this means that Mac OS X is providing its own appearance manager for classic mode. Considering this and reflecting on early betas of OS X having a platinum appearance under the hood, it seems that maybe we are actually seeing OS X applying separate themes for classic and non-classic apps. And based on that possibility, maybe it is somehow possible to enable OS X's aqua appearance to classic apps. That might be cool!
I went on an expedition to gather the AppearanceLibs from all different classic Mac OS versions, starting with the 8.2 betas and even including some stuff from Copland. The build date embedded in the PEF header did change almost every version. Starting with Mac OS 8.5, the file size of AppearanceLib remained pretty stable but there were at least 5 times that it changed by the time we got to 9.2.2. The size went up and down slightly. Interesting to see that things were still happening.
I mentioned before about a layo ID 502. ID 500 is the normal push button, ID 501 is the default push button (i.e. with a ring around it or blue in OS X), and I discovered that 502 is a "Cancel" push button. Here is the pseudocode that fetches layo ID 502:
[layo id decision.PNG]
Note that I don't fully understand how the variables are structured and passed around yet, so the names and handling of the variables probably don't all make sense. You can see here, "result" is a bitfield where bit 0 (&1) means the button is default, and bit 1 (&2) means that the button is cancel. If neither of those bits are set, it is a normal button.
So that brings us to this "byte_40F48". This is a flag that is normally 0, preventing this cancel behavior ever happening. After some other hacking, I found that this flag is stored directly after Checkbox Style (X vs check), Scrollbar Arrow Style (single vs double vs both ends), and Scrollbar thumb style (fixed size or proportional size). The next spot is this flag that makes the cancel buttons separate.
[global variables.PNG]
It is possible to make a 1-byte change that skips checking that flag, permanently enabling the cancel behavior. You can do this to try it out if you want, but you won't want to leave it that way. No themes have layo 502, so you are going to have a platinum button any place there is a cancel button. In 9.2.2, you can modify this green byte; change it from 10 to 1C:
[9.2.2 data fork.png]
In 8.6:
[8.6-data-fork.png]
After making that change, you can try the attached Doohickey theme that I modified. I added a layo 502 resource in that theme copied from the default push button. For the unpressed, active state, I made a copy of the 'frme' resource and I changed the blue ring to red and gave it a light red background. (It still uses the pressed and disabled states from the original default push button.) You will see various cancel buttons turn red this way!
[cancel-button.png]
That's kind of interesting don't ya think??
I also said earlier that I could not find references to all of the layo resources, especially I could not find any of the window layo resources. I figured that out, and it is having to do with the 'tdat' resource. Themes have a 'tdat' resource where you have to basicallly register all of the elements of the theme. It is a list of resource types and IDs and the AppearanceLib runs through that list and loads all of those items into memory for quick access. There is a 'tdat' ID 1 in each theme, and there is also a 'tdat' ID 0 in the system file. There is a function in AppearanceLib that allows you to load specific items from the tdat using the index. Positive indexes come from the theme's 'tdat' and negative indexes come from the system file's 'tdat'. This is similar to the positive/negative behavior of plut resources. Having learned this, I found all of those missing layos were being referenced by their position in the system 'tdat'!
Going deeper down the system 'tdat' rabbit hole, I just looked at what was in the 'tdat' in the first place and I found some more 'layo's that I didn't know about:
502 - Cancel Button -> it is in there.
435 - Small Progress Bar in OS X
445 - Small Indeterminate (barber pole) Progress Bar in OS X
144 - Plain D Box Active in Copland
145 - Plain D Box Inactive in Copland
146 - Shadow D Box Active in Copland
147 - Shadow D Box Inactive in Copland
148 - ?
149 - ?
Small progress bars made their appearance in Mac OS X. I haven't seen a progress bar revert to platinum when it got too small. There seems to be no handling for it in AppearanceLib, but definitely interesting to find that in there. Maybe they were working on it.
These "D box" things are additional window types. They are present in the Copland previews and there is code in appearanceLib where they potentially could be used. I got the names from the layo resource names in the Copland "Z theme", which is an early version of Gizmo.
In the 9.2.2 AppearanceLib, the function at 0x1BBCC takes in an enumerated value and provides the negative tdat index to the layo resource for each window type, including active and inactive. I am not sure where that enumerated value comes from, if it is some sort of "Proc ID" or WDEF number, etc, but here is the list (let me know if this looks familiar to you):
0 = Document Window
1 = Dialog Window
2 = Movable Modal Window
3 = Alert Window
4 = Movable Alert
5 = Copland Plain D Box
6 = Copland Shadow D Box
7 = Drawer Window (i.e. docked to the bottom of the screen)
8 = Utility Window
9 = Side Utility Window
layos 148 and 149 are not present in Copland and I am not sure why they are in the system 'tdat' resource. There are also 2 copies of them in there. Based on the layo ID, it was probably a window and matching inactive window. It could have been there for debug purposes or something.
Things I am still interested to look into:
- Why are theme cursors not working? Gizmo has custom cursors that aren't used.
- 'trns' resources were an old way to provide animations for checkboxes, radio buttons, menu items, etc. It was still there in 8.2d8's Gizmo and it was removed in 8.2a2's Gizmo. It became hard-coded only for disclosure triangles (specifically pxm# 1026). I would like to see how that worked. It definitely has something to do with 'frg#' 125 in the system file, though the AppearanceLib attempts to load 'frg#' 129. Not sure if I could hook it back up by loading 125 but there is more that was removed so it won't be simple bringing that back to life. I am not seeing where it ever worked. It is possible it worked in Copland. Menu items may have had a "flip" effect? I vaguely remember a video demo showing this.
- How to use right-to-left behavior of checkboxes, radio buttons, etc. I have seen left-side growboxes in windows that are never allowed visible as well; there is some sort of left-facing behavior sprinkled around that I would like to see.
- Text color of popup menus is using index 0 in the clr# resource instead of the correct index; I would like to find that and see if it can be fixed.
- Mac OS X AppearanceLib that is being used in classic mode. I would like to learn more how that works and see if that is separate or integrated with the aqua appearanceLib.