Module: CryptopunksGui::View::MenuBar

Includes:
HelpDialog
Included in:
CryptopunksGui
Defined in:
app/view/menu_bar.rb

Constant Summary collapse

LICENSE =
File.expand_path('../../LICENSE.txt', __dir__)
HELP =
File.expand_path('../../README.md', __dir__)

Instance Method Summary collapse

Methods included from HelpDialog

#help_dialog

Instance Method Details

#cryptopunks_gui_menu_bar(root:, image:) ⇒ Object



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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'app/view/menu_bar.rb', line 13

def cryptopunks_gui_menu_bar(root: , image: )
  menu {
    if OS.mac?
      menu(:application) {
        menu_item(:about, label: 'About') {
          accelerator OS.mac? ? 'Command+Shift+A' : 'Control+Alt+A'
          
          on('command') do
            show_about_dialog(root: root)
          end
        }
        
#               menu_item(:preferences) {
#                 on('command') do
#                   preferences_dialog(root: root, image: image)
#                 end
#               }
      }
    end
    
    menu(label: 'File', underline: 0) {
      menu_item(label: 'Change Output Location...', underline: 7) {
        accelerator OS.mac? ? 'Command+O' : 'Control+O'
        
        on('command') do
          change_output_location(root: root, image: image) # assumes View::ImageFrame is mixed in
        end
      }
      
      menu_item(label: 'Reset Output Location', underline: 0) {
        on('command') do
          image.reset_output_location
        end
      }
      
      menu_item(:separator)
      
#             menu_item(label: 'Preferences...', underline: 0) {
#               on('command') do
#                 preferences_dialog(root: root, image: image)
#               end
#             }
    
      menu_item(:separator)
      
      menu_item(label: 'Exit', underline: 1) {
        on('command') do
          exit(0)
        end
      }
    }
    
    menu(label: 'Help') {
      menu_item(:help) {
        on('command') do
          help_dialog(root: root)
        end
      }
    }
  }
end

#helpObject



83
84
85
# File 'app/view/menu_bar.rb', line 83

def help
  @help ||= File.read(HELP)
end

#licenseObject



79
80
81
# File 'app/view/menu_bar.rb', line 79

def license
  @license ||= File.read(LICENSE)
end

#show_about_dialog(root:) ⇒ Object



75
76
77
# File 'app/view/menu_bar.rb', line 75

def show_about_dialog(root: )
  message_box(parent: root, title: 'CryptoPunks GUI', message: "CryptoPunks GUI\n\n#{license}")
end