Refactor theme selection to pass through OakDocumentView

This commit is contained in:
Jacob Bandes-Storch
2012-08-18 18:17:18 -07:00
committed by Allan Odgaard
parent c0f65b6101
commit dc810607b2
3 changed files with 10 additions and 3 deletions

View File

@@ -29,6 +29,8 @@
- (IBAction)toggleLineNumbers:(id)sender;
- (IBAction)takeThemeUUIDFrom:(id)sender;
- (void)setThemeWithUUID:(NSString*)themeUUID;
- (void)addAuxiliaryView:(NSView*)aView atEdge:(NSRectEdge)anEdge;
- (void)removeAuxiliaryView:(NSView*)aView;
@end

View File

@@ -562,8 +562,12 @@ private:
- (IBAction)takeThemeUUIDFrom:(id)sender
{
NSString* themeUUID = [sender representedObject];
if(bundles::item_ptr themeItem = bundles::lookup(to_s(themeUUID)))
[self setThemeWithUUID:[sender representedObject]];
}
- (void)setThemeWithUUID:(NSString*)themeUUID
{
if(bundles::item_ptr const& themeItem = bundles::lookup(to_s(themeUUID)))
{
[[NSUserDefaults standardUserDefaults] setObject:themeUUID forKey:kUserDefaultsThemeUUIDKey];
[[NSUserDefaults standardUserDefaults] synchronize];

View File

@@ -800,7 +800,8 @@ static std::string shell_quote (std::vector<std::string> paths)
case bundles::kItemTypeTheme:
{
[self setTheme:parse_theme(item)];
OakDocumentView* documentView = (OakDocumentView*)[[self enclosingScrollView] superview];
[documentView setThemeWithUUID:[NSString stringWithCxxString:item->uuid()]];
}
break;
}