mirror of
https://github.com/textmate/textmate.git
synced 2026-04-28 03:00:34 -04:00
Update themed UI colors from OakDocumentView
This is an ongoing effort to refactor and simplify OakTextView. The goal is to move decisions up the hierarchy and instead have properties on the objects lower in the hierarchy (making the components more flexible and allowing for better decision making at the higher level).
This commit is contained in:
@@ -326,8 +326,26 @@ private:
|
||||
{
|
||||
if(document && [textView theme])
|
||||
{
|
||||
auto theme = [textView theme];
|
||||
|
||||
[[self window] setOpaque:!theme->is_transparent()];
|
||||
[textScrollView setBackgroundColor:[NSColor tmColorWithCGColor:theme->background(document->file_type())]];
|
||||
|
||||
if(theme->is_dark())
|
||||
{
|
||||
NSImage* whiteIBeamImage = [NSImage imageNamed:@"IBeam white" inSameBundleAsClass:[self class]];
|
||||
[whiteIBeamImage setSize:[[[NSCursor IBeamCursor] image] size]];
|
||||
[textView setIbeamCursor:[[[NSCursor alloc] initWithImage:whiteIBeamImage hotSpot:NSMakePoint(4, 9)] autorelease]];
|
||||
[textScrollView setScrollerKnobStyle:NSScrollerKnobStyleLight];
|
||||
}
|
||||
else
|
||||
{
|
||||
[textView setIbeamCursor:[NSCursor IBeamCursor]];
|
||||
[textScrollView setScrollerKnobStyle:NSScrollerKnobStyleDark];
|
||||
}
|
||||
|
||||
[self setFont:textView.font]; // trigger update of gutter view’s line number font
|
||||
auto styles = [textView theme]->gutter_styles();
|
||||
auto styles = theme->gutter_styles();
|
||||
self.gutterDividerColor = [NSColor tmColorWithCGColor:styles.divider];
|
||||
|
||||
gutterView.foregroundColor = [NSColor tmColorWithCGColor:styles.foreground];
|
||||
|
||||
@@ -407,11 +407,6 @@ static std::string shell_quote (std::vector<std::string> paths)
|
||||
layout->remove_enclosing_folds(range->min().index, range->max().index);
|
||||
}
|
||||
|
||||
auto bgColor = theme->styles_for_scope(document->buffer().scope(0).left, fontName, fontSize).background();
|
||||
[[self enclosingScrollView] setBackgroundColor:[NSColor tmColorWithCGColor:bgColor]];
|
||||
SetLionScrollerKnobStyle([self enclosingScrollView], cf::color_is_dark(bgColor) ? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark);
|
||||
[[self window] setOpaque:CGColorGetAlpha(bgColor) == 1];
|
||||
|
||||
[self reflectDocumentSize];
|
||||
[self updateSelection];
|
||||
|
||||
@@ -1727,15 +1722,6 @@ static void update_menu_key_equivalents (NSMenu* menu, action_to_key_t const& ac
|
||||
- (void)setTheme:(theme_ptr const&)newTheme
|
||||
{
|
||||
theme = newTheme;
|
||||
|
||||
if(document)
|
||||
{
|
||||
auto bgColor = theme->styles_for_scope(document->buffer().scope(0).left, fontName, fontSize).background();
|
||||
[[self enclosingScrollView] setBackgroundColor:[NSColor tmColorWithCGColor:bgColor]];
|
||||
SetLionScrollerKnobStyle([self enclosingScrollView], cf::color_is_dark(bgColor) ? NSScrollerKnobStyleLight : NSScrollerKnobStyleDark);
|
||||
[[self window] setOpaque:CGColorGetAlpha(bgColor) == 1];
|
||||
}
|
||||
|
||||
if(layout)
|
||||
{
|
||||
AUTO_REFRESH;
|
||||
|
||||
Reference in New Issue
Block a user