Themes

24 views
Skip to first unread message

luddep

unread,
Sep 15, 2009, 5:35:01 PM9/15/09
to Cappuccino & Objective-J
Hello,

I'm quite curious if there is any official word on how to use your own
themes? I've managed to use my own by first replacing the hardcoded
Aristo parts in /AppKit/Rakefile with my own theme paths & then
explicitly telling each themed control to use my own theme, which is
quite the pain. :)

I've looked at putting [CPTheme setDefaultTheme:[CPTheme ..]] at the
top of the - (void)applicationDidFinishLaunching: method on my
AppController but I assume I'm setting it too late, as none of my
themed items can actually find the default theme.

I'd love to hear from the core peeps on how to actually use your own
theme, as I've managed to find some parts - but it feels quite broken
to have to edit the Rakefile - so I hope I've been doing it all wrong.

Thanks,
Ludwig Pettersson

Fredrik Wärnsberg

unread,
Sep 17, 2009, 3:58:26 PM9/17/09
to Cappuccino & Objective-J
I agree that your experience doesn't seem quite right, especially
since it's supposed to be an integrated feature.

Could someone from core enlighten us on this matter?

Fredrik

Holly Woodland

unread,
Sep 25, 2009, 5:19:52 AM9/25/09
to objec...@googlegroups.com
Well i'm not sure on the official process but here's how I got things working.

1. Copy folder AppKit/Themes/Aristo and rename as appropriate (eg AppKit/Themes/MyTheme)
2. Place my versions of all the images in the Resources folder (to keep it simple I used the same file names as in aristo but this isn't strictly necessary)
3. Edit info.plist (in the MyTheme folder)  - most important is changing the CPBundleName to the name of your theme
4. Edit ThemeDescriptors.j to reference the fonts and colours of my theme - if you change the image file names you will need to change these in ThemeDescriptors.j too)
5. compile MyTheme using blend (i had to rebuilt blend from source to work on Windows)
6. Copy the output folder from blend (eg MyTheme.blend) to Frameworks/AppKit/Resources for the application you want to use it in
7. modify AppController.j to load the theme - eg:

- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];

     var blend_mytheme = [[CPThemeBlend alloc] initWithContentsOfURL:[[CPBundle bundleForClass:[CPApplication class]] pathForResource:@"MyTheme.blend"]];
    [blend_mytheme loadWithDelegate:self];

    [theWindow orderFront:self];

}

- (void)blendDidFinishLoading:(CPBundle)aBundle
{
      [CPTheme setDefaultTheme:[CPTheme themeNamed:@"MyTheme"]];
[self continueProcessing];   //continueProcessing function does everything else in the app that needs to happen AFTER the theme is loaded
}


Hope that helps
Holly


--
Holly Woodland
holly.w...@gmail.com


2009/9/17 Fredrik Wärnsberg <war...@gmail.com>

sant0sk1

unread,
Oct 6, 2009, 3:47:47 PM10/6/09
to Cappuccino & Objective-J
Is this then the prescribed method of integrating our own themes? If
so, I will add it to the wiki so others can find it easily.
> holly.woodl...@gmail.com

luddep

unread,
Oct 6, 2009, 5:04:55 PM10/6/09
to Cappuccino & Objective-J
I assume it's not - more of a get it working fix. I don't want to load
Aristo if I'm not going to use it.
Reply all
Reply to author
Forward
0 new messages