diff --git a/Frameworks/OakTextView/src/OakDocumentView.h b/Frameworks/OakTextView/src/OakDocumentView.h index b78815d3..dab79af1 100644 --- a/Frameworks/OakTextView/src/OakDocumentView.h +++ b/Frameworks/OakTextView/src/OakDocumentView.h @@ -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 diff --git a/Frameworks/OakTextView/src/OakDocumentView.mm b/Frameworks/OakTextView/src/OakDocumentView.mm index d705bdda..cffa7155 100644 --- a/Frameworks/OakTextView/src/OakDocumentView.mm +++ b/Frameworks/OakTextView/src/OakDocumentView.mm @@ -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]; diff --git a/Frameworks/OakTextView/src/OakTextView.mm b/Frameworks/OakTextView/src/OakTextView.mm index db091b0b..110aea5f 100644 --- a/Frameworks/OakTextView/src/OakTextView.mm +++ b/Frameworks/OakTextView/src/OakTextView.mm @@ -800,7 +800,8 @@ static std::string shell_quote (std::vector paths) case bundles::kItemTypeTheme: { - [self setTheme:parse_theme(item)]; + OakDocumentView* documentView = (OakDocumentView*)[[self enclosingScrollView] superview]; + [documentView setThemeWithUUID:[NSString stringWithCxxString:item->uuid()]]; } break; }