about summary refs log tree commit diff stats
path: root/themes/joker
blob: 59e9ed94e65ce5cd57583aa11b3b5f3ba7c7c97b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
[colours]
bkgnd=default
titlebar=magenta
titlebar.text=white
titlebar.brackets=cyan
titlebar.unencrypted=red
titlebar.encrypted=green
titlebar.untrusted=red
titlebar.trusted=green
titlebar.online=white
titlebar.offline=black
titlebar.away=white
titlebar.chat=white
titlebar.dnd=black
titlebar.xa=white
statusbar=magenta
statusbar.text=green
statusbar.brackets=cyan
statusbar.active=green
statusbar.new=white
main.text=white
main.text.me=white
main.text.them=white
main.splash=green
main.time=white
input.text=green
subscribed=green
unsubscribed=white
otr.started.trusted=green
otr.started.untrusted=red
otr.ended=yellow
otr.trusted=green
otr.untrusted=red
online=green
away=yellow
chat=green
dnd=green
xa=yellow
offline=bold_black
incoming=yellow
typing=green
gone=red
error=red
roominfo=green
roommention=green
me=magenta
them=green
roster.header=magenta
occupants.header=magenta
receipt.sent=red
/* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
Menu_background_color = {r=0.6, g=0.8, b=0.6}
Menu_border_color = {r=0.6, g=0.7, b=0.6}
Menu_command_color = {r=0.2, g=0.2, b=0.2}
Menu_highlight_color = {r=0.5, g=0.7, b=0.3}

function source.draw_menu_bar()
  if App.run_tests then return end  -- disable in tests
  App.color(Menu_background_color)
  love.graphics.rectangle('fill', 0,0, App.screen.width, Menu_status_bar_height)
  App.color(Menu_border_color)
  love.graphics.rectangle('line', 0,0, App.screen.width, Menu_status_bar_height)
  App.color(Menu_command_color)
  Menu_cursor = 5
  if Show_file_navigator then
    source.draw_file_navigator()
    return
  end
  add_hotkey_to_menu('ctrl+e: run')
  if Focus == 'edit' then
    add_hotkey_to_menu('ctrl+g: switch file')
    if Show_log_browser_side then
      add_hotkey_to_menu('ctrl+l: hide log browser')
    else
      add_hotkey_to_menu('ctrl+l: show log browser')
    end
    if Editor_state.expanded then
      add_hotkey_to_menu('alt+b: collapse debug prints')
    else
      add_hotkey_to_menu('alt+b: expand debug prints')
    end
    add_hotkey_to_menu('alt+d: create/edit debug print')
    add_hotkey_to_menu('ctrl+f: find in file')
    add_hotkey_to_menu('alt+left alt+right: prev/next word')
  elseif Focus == 'log_browser' then
    -- nothing yet
  else
    assert(false, 'unknown focus "'..Focus..'"')
  end
  add_hotkey_to_menu('ctrl+z ctrl+y: undo/redo')
  add_hotkey_to_menu('ctrl+x ctrl+c ctrl+v: cut/copy/paste')
  add_hotkey_to_menu('ctrl+= ctrl+- ctrl+0: zoom')
end

function add_hotkey_to_menu(s)
  local s_text = to_text(s)
  local width = App.width(s_text)
  if Menu_cursor + width > App.screen.width - 5 then
    return
  end
  App.color(Menu_command_color)
  App.screen.draw(s_text, Menu_cursor,5)
  Menu_cursor = Menu_cursor + width + 30
end

function source.draw_file_navigator()
  log_start('render file navigator')
  for i,file in ipairs(File_navigation.candidates) do
    if file == 'source' then
      App.color(Menu_border_color)
      love.graphics.line(Menu_cursor-10,2, Menu_cursor-10,Menu_status_bar_height-2)
    end
    log(2, file)
    add_file_to_menu(file, i == File_navigation.index)
  end
  log_end('render file navigator')
end

function add_file_to_menu(s, cursor_highlight)
  local s_text = to_text(s)
  local width = App.width(s_text)
  if Menu_cursor + width > App.screen.width - 5 then
    log(2, 'skipped')
    return
  end
  if cursor_highlight then
    App.color(Menu_highlight_color)
    love.graphics.rectangle('fill', Menu_cursor-5,5-2, width+5*2,Editor_state.line_height+2*2)
  end
  App.color(Menu_command_color)
  App.screen.draw(s_text, Menu_cursor,5)
  Menu_cursor = Menu_cursor + width + 30
end

function keychord_pressed_on_file_navigator(chord, key)
  if chord == 'escape' then
    Show_file_navigator = false
  elseif chord == 'return' then
    local candidate = guess_source(File_navigation.candidates[File_navigation.index]..'.lua')
    source.switch_to_file(candidate)
    Show_file_navigator = false
  elseif chord == 'left' then
    if File_navigation.index > 1 then
      File_navigation.index = File_navigation.index-1
    end
  elseif chord == 'right' then
    if File_navigation.index < #File_navigation.candidates then
      File_navigation.index = File_navigation.index+1
    end
  end
end