Dennis Nedry
Well-known member
Some very VERRRRY preliminary hacking. The scope of this project shall not include hacking of any Kaleidoscope specific resources until permission is granted or some other justifiable reason. This initially intends only to convert ics8, ics# and cicn resources into pxm# resources. Consequently, themes that utilize the wnd# resource, such as Scherzo, shall not be convertable within this scope, because this requires the electronic parsing of a wnd# resource in a program other than Kaleidoscope, which is apparently forbidden somehow. But we don't have to worry about that yet, there's plenty that we can do without touching that.
So far, it loads a k-scheme resource file into memory, then converts ics8 and ics# window widget resources from memory into their respective pxm# resources. These pxm# resources are a lossless conversion, so they must reference an 8-bit system color palette stored in 'clut' ID 128 (not included). This 'clut' resource is apparently not included in the System file (surprising), so you can get it from inside of Resourcerer's own resource fork, clut ID 72, if you wish to copy the generated pxm# resources into a working theme. Note that you will also probably have to add clut ID 128 to the tdat resource of the modified theme. Details, details....
During the conversion, the new 'pxm#' resources are written to an output text file, output.c. At the end of all conversions, the 'tdat' resource is built and stored in there as well. Output.c is in such a format that it must be built with "Rez", which can be found in /Developer/Tools/ in your Xcode installation. This will turn it into a resource file that can be opened with ResEdit or Resourcerer. This is much easier for me than trying to directly create a resource fork.
Next to do is parsing 'cicn' data. That is a bit of a project in itself due to different color depths. Themes do not support alpha transparency, so schemes that use alpha transparent 'cicn's will not ever be able to be converted properly without creating a system extension. But alpha transparent cicns only work with wnd# resources I think, so for we're probably in the clear for that. Alpha transparency, custom cursors, selectable color variations, and selectable checkbox styles are all of the features of k-schemes that are not supported in themes as far as I am aware. Neither support the Right-to-left interface that is found hidden in themes. This was presumably for localizations with text that reads right-to-left. The only feature existing in themes and not schemes that I'm aware of is the ability to align an image to the top, left corner of the screen. This is useful for large (>16x16) Apple menu icons and alternate selected state icon. You can see that in AquaMaX. I can't imagine any other use.
If anybody has any comments, concerns, praise, hate, etc, I'd like to hear it. I had a pole about this earlier and there didn't seem to be a whole lot of response to it. I think it could be cool, it's definitely quite the curiosity to consider converting schemes to themes. Even converting themes back to schemes might be interesting, as some themes have custom cursors stored in them that would finally spring to life in a scheme.
http://www.d.umn.edu/~bold0070/projects/scheme2theme/
edit
Also to be noted is that schemes properly support separate masks for pressed and unpressed window widget states whereas themes leave artifact of the opposite state in unmasked areas (appearance manager does not redraw the window underneath widgets when they change state). So I have elected to use the ics# mask of the unpressed state for both pressed and unpressed forms of all widgets. The worst-case effect of this is distortion of the pressed state, but this distortion will result in proper-looking unpressed state when the widget is returned to the unpressed state.
Also, all 'ppat' resources can be used DIRECTLY in themes without modification. Only proper referencing must be generated. ('plut' and 'tdat' entries)
So far, it loads a k-scheme resource file into memory, then converts ics8 and ics# window widget resources from memory into their respective pxm# resources. These pxm# resources are a lossless conversion, so they must reference an 8-bit system color palette stored in 'clut' ID 128 (not included). This 'clut' resource is apparently not included in the System file (surprising), so you can get it from inside of Resourcerer's own resource fork, clut ID 72, if you wish to copy the generated pxm# resources into a working theme. Note that you will also probably have to add clut ID 128 to the tdat resource of the modified theme. Details, details....
During the conversion, the new 'pxm#' resources are written to an output text file, output.c. At the end of all conversions, the 'tdat' resource is built and stored in there as well. Output.c is in such a format that it must be built with "Rez", which can be found in /Developer/Tools/ in your Xcode installation. This will turn it into a resource file that can be opened with ResEdit or Resourcerer. This is much easier for me than trying to directly create a resource fork.
Next to do is parsing 'cicn' data. That is a bit of a project in itself due to different color depths. Themes do not support alpha transparency, so schemes that use alpha transparent 'cicn's will not ever be able to be converted properly without creating a system extension. But alpha transparent cicns only work with wnd# resources I think, so for we're probably in the clear for that. Alpha transparency, custom cursors, selectable color variations, and selectable checkbox styles are all of the features of k-schemes that are not supported in themes as far as I am aware. Neither support the Right-to-left interface that is found hidden in themes. This was presumably for localizations with text that reads right-to-left. The only feature existing in themes and not schemes that I'm aware of is the ability to align an image to the top, left corner of the screen. This is useful for large (>16x16) Apple menu icons and alternate selected state icon. You can see that in AquaMaX. I can't imagine any other use.
If anybody has any comments, concerns, praise, hate, etc, I'd like to hear it. I had a pole about this earlier and there didn't seem to be a whole lot of response to it. I think it could be cool, it's definitely quite the curiosity to consider converting schemes to themes. Even converting themes back to schemes might be interesting, as some themes have custom cursors stored in them that would finally spring to life in a scheme.
http://www.d.umn.edu/~bold0070/projects/scheme2theme/
edit
Also to be noted is that schemes properly support separate masks for pressed and unpressed window widget states whereas themes leave artifact of the opposite state in unmasked areas (appearance manager does not redraw the window underneath widgets when they change state). So I have elected to use the ics# mask of the unpressed state for both pressed and unpressed forms of all widgets. The worst-case effect of this is distortion of the pressed state, but this distortion will result in proper-looking unpressed state when the widget is returned to the unpressed state.
Also, all 'ppat' resources can be used DIRECTLY in themes without modification. Only proper referencing must be generated. ('plut' and 'tdat' entries)