Created
September 1, 2011 13:20
-
-
Save kattrali/1186147 to your computer and use it in GitHub Desktop.
small aesthetic changes to the redcar line numbers and annotations area
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Run via Redcar menu > Plugins > Execute > Eval Current Tab (within Redcar) | |
include Redcar | |
def get_swt_color hex_value | |
Swt::Graphics::Color.new( | |
ApplicationSWT.display, | |
hex_value[1,2].hex, | |
hex_value[3,2].hex, | |
hex_value[5,2].hex | |
) | |
end | |
def style_tab tab | |
bg_hex_value = tab.edit_view.controller.mate_text.colourer.theme.globalSettings.get('lineHighlight') | |
fg_hex_value = tab.edit_view.controller.mate_text.colourer.theme.globalSettings.get('foreground') | |
if bg_hex_value and fg_hex_value | |
bg = get_swt_color(bg_hex_value) | |
fg = get_swt_color(fg_hex_value) | |
tab.controller.widget.children.first.background = bg | |
tab.controller.widget.children.first.children[1].children.first.background = bg | |
tab.edit_view.controller.mate_text.gutter_background = bg | |
tab.edit_view.controller.mate_text.gutter_foreground = fg | |
end | |
font = Swt::Graphics::Font.new(ApplicationSWT.display, EditView.font, [EditView.font_size - 2,1].max, Swt::SWT::NORMAL) | |
tab.edit_view.controller.mate_text.line_number_column.font = font | |
end | |
def configure(win) | |
win.controller.shell.alpha = 255 | |
win.add_listener(:tab_focussed) do |tab| | |
if tab.is_a? EditTab | |
style_tab(tab) | |
end | |
end | |
win.all_tabs.select {|tab| tab.is_a? EditTab }.each do |tab| | |
style_tab(tab) | |
end | |
end | |
Redcar.app.windows.each {|w| configure(w)} | |
Redcar.app.add_listener(:window_added) do |win| | |
configure(win) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment