Module: Rabbit::Action

Extended by:
Utils
Includes:
GetText
Defined in:
lib/rabbit/action.rb,
lib/rabbit/action/basic.rb,
lib/rabbit/action/radio.rb,
lib/rabbit/action/toggle.rb

Constant Summary collapse

@@actions =
[]
@@toggle_actions =
[]
@@radio_actions =
[]
@@update_status_methods =
[]
@@quit_label =
N_("_Quit")
@@quit_with_confirmation_label =
N_("_Quit with confirmation")
@@radio_blank_values =
[
  [:white, 1],
  [:black, 2],
  [:show, 3],
]

Constants included from GetText

GetText::DOMAIN

Class Method Summary collapse

Methods included from Utils

arg_list, collect_classes_under_module, collect_modules_under_module, collect_under_module, combination, compute_bottom_y, compute_left_x, compute_right_x, compute_top_y, corresponding_class_under_module, corresponding_module_under_module, corresponding_objects, drawable_to_pixbuf, ensure_time, events_pending_available?, extract_four_way, find_path_in_load_path, init_by_constants_as_default_value, move_to, move_to_bottom_left, move_to_bottom_right, move_to_top_left, move_to_top_right, parse_four_way, process_pending_events, process_pending_events_proc, quartz?, require_files_under_directory_in_load_path, require_safe, split_number_to_minute_and_second, stringify_hash_key, support_console_input?, support_console_output?, syntax_highlighting_debug?, time, to_class_name, unescape_title, windows?

Methods included from GetText

included

Class Method Details

.act_cache_all_slides(action, group, canvas) ⇒ Object



171
172
173
# File 'lib/rabbit/action/basic.rb', line 171

def act_cache_all_slides(action, group, canvas)
  canvas.cache_all_slides
end

.act_cache_all_slides_config(config, canvas) ⇒ Object



174
175
176
# File 'lib/rabbit/action/basic.rb', line 174

def act_cache_all_slides_config(config, canvas)
  config[:label] = N_("Cache all slides")
end

.act_change_graffiti_color(action, group, canvas) ⇒ Object



202
203
204
# File 'lib/rabbit/action/basic.rb', line 202

def act_change_graffiti_color(action, group, canvas)
  canvas.change_graffiti_color
end

.act_change_graffiti_color_config(config, canvas) ⇒ Object



205
206
207
208
# File 'lib/rabbit/action/basic.rb', line 205

def act_change_graffiti_color_config(config, canvas)
  config[:label] = N_("Change graffiti color")
  config[:stock_id] = Gtk::Stock::SELECT_COLOR
end

.act_change_theme(action, group, canvas) ⇒ Object



95
96
97
98
99
100
# File 'lib/rabbit/action/basic.rb', line 95

def act_change_theme(action, group, canvas)
  if action.block_given?
    entry, block = action.call(action, group, canvas)
    canvas.apply_theme(entry.name, &block)
  end
end

.act_change_theme_config(config, canvas) ⇒ Object



101
102
103
# File 'lib/rabbit/action/basic.rb', line 101

def act_change_theme_config(config, canvas)
  config[:label] = N_("Change theme")
end

.act_clear_graffiti(action, group, canvas) ⇒ Object



186
187
188
# File 'lib/rabbit/action/basic.rb', line 186

def act_clear_graffiti(action, group, canvas)
  canvas.clear_graffiti
end

.act_clear_graffiti_config(config, canvas) ⇒ Object



189
190
191
192
# File 'lib/rabbit/action/basic.rb', line 189

def act_clear_graffiti_config(config, canvas)
  config[:label] = N_("Clear graffiti")
  config[:stock_id] = Gtk::Stock::CLEAR
end

.act_clear_slide(action, group, canvas) ⇒ Object



133
134
135
# File 'lib/rabbit/action/basic.rb', line 133

def act_clear_slide(action, group, canvas)
  canvas.clear_slide
end

.act_clear_slide_config(config, canvas) ⇒ Object



136
137
138
139
# File 'lib/rabbit/action/basic.rb', line 136

def act_clear_slide_config(config, canvas)
  config[:label] = N_("Clear slide")
  config[:stock_id] = Gtk::Stock::CLEAR
end

.act_expand_hole(action, group, canvas) ⇒ Object



236
237
238
# File 'lib/rabbit/action/basic.rb', line 236

def act_expand_hole(action, group, canvas)
  canvas.expand_hole
end

.act_expand_hole_config(config, canvas) ⇒ Object



239
240
241
# File 'lib/rabbit/action/basic.rb', line 239

def act_expand_hole_config(config, canvas)
  config[:label] = N_("Expand hole")
end

.act_first_slide(action, group, canvas) ⇒ Object



36
37
38
# File 'lib/rabbit/action/basic.rb', line 36

def act_first_slide(action, group, canvas)
  canvas.move_to_first
end

.act_first_slide_config(config, canvas) ⇒ Object



39
40
41
42
# File 'lib/rabbit/action/basic.rb', line 39

def act_first_slide_config(config, canvas)
  config[:label] = N_("First slide")
  config[:stock_id] = Gtk::Stock::GOTO_FIRST
end

.act_graffiti(action, group, canvas) ⇒ Object



178
179
180
# File 'lib/rabbit/action/basic.rb', line 178

def act_graffiti(action, group, canvas)
  update_graffiti_action_status(canvas)
end

.act_graffiti_config(config, canvas) ⇒ Object



181
182
183
184
# File 'lib/rabbit/action/basic.rb', line 181

def act_graffiti_config(config, canvas)
  config[:label] = N_("Graffiti")
  config[:stock_id] = Gtk::Stock::EDIT
end

.act_iconify(action, group, canvas) ⇒ Object



87
88
89
# File 'lib/rabbit/action/basic.rb', line 87

def act_iconify(action, group, canvas)
  canvas.iconify
end

.act_iconify_config(config, canvas) ⇒ Object



90
91
92
93
# File 'lib/rabbit/action/basic.rb', line 90

def act_iconify_config(config, canvas)
  config[:label] = N_("Iconify")
  config[:stock_id] = Stock::RABBIT
end

.act_jump_to(action, group, canvas) ⇒ Object



52
53
54
55
56
# File 'lib/rabbit/action/basic.rb', line 52

def act_jump_to(action, group, canvas)
  if action.block_given?
    canvas.move_to_if_can(action.call(action, group, canvas))
  end
end

.act_jump_to_config(config, canvas) ⇒ Object



57
58
59
60
# File 'lib/rabbit/action/basic.rb', line 57

def act_jump_to_config(config, canvas)
  config[:label] = N_("Jump to")
  config[:stock_id] = Gtk::Stock::JUMP_TO
end

.act_last_slide(action, group, canvas) ⇒ Object



44
45
46
# File 'lib/rabbit/action/basic.rb', line 44

def act_last_slide(action, group, canvas)
  canvas.move_to_last
end

.act_last_slide_config(config, canvas) ⇒ Object



47
48
49
50
# File 'lib/rabbit/action/basic.rb', line 47

def act_last_slide_config(config, canvas)
  config[:label] = N_("Last slide")
  config[:stock_id] = Gtk::Stock::GOTO_LAST
end

.act_log_level(action, group, canvas) ⇒ Object



298
299
# File 'lib/rabbit/action/basic.rb', line 298

def act_log_level(action, group, canvas)
end

.act_log_level_config(config, canvas) ⇒ Object



300
301
302
# File 'lib/rabbit/action/basic.rb', line 300

def act_log_level_config(config, canvas)
  config[:label] = N_("Log Level")
end

.act_merge_theme(action, group, canvas) ⇒ Object



105
106
107
108
109
110
# File 'lib/rabbit/action/basic.rb', line 105

def act_merge_theme(action, group, canvas)
  if action.block_given?
    entry, block = action.call(action, group, canvas)
    canvas.merge_theme(entry.name, &block)
  end
end

.act_merge_theme_config(config, canvas) ⇒ Object



111
112
113
# File 'lib/rabbit/action/basic.rb', line 111

def act_merge_theme_config(config, canvas)
  config[:label] = N_("Merge theme")
end

.act_narrow_hole(action, group, canvas) ⇒ Object



243
244
245
# File 'lib/rabbit/action/basic.rb', line 243

def act_narrow_hole(action, group, canvas)
  canvas.narrow_hole
end

.act_narrow_hole_config(config, canvas) ⇒ Object



246
247
248
# File 'lib/rabbit/action/basic.rb', line 246

def act_narrow_hole_config(config, canvas)
  config[:label] = N_("Narrow hole")
end

.act_next(action, group, canvas) ⇒ Object



4
5
6
# File 'lib/rabbit/action/basic.rb', line 4

def act_next(action, group, canvas)
  canvas.move_to_next_if_can
end

.act_next_config(config, canvas) ⇒ Object



7
8
9
10
# File 'lib/rabbit/action/basic.rb', line 7

def act_next_config(config, canvas)
  config[:label] = N_("Next")
  config[:stock_id] = Gtk::Stock::GO_FORWARD
end

.act_next_slide(action, group, canvas) ⇒ Object



20
21
22
# File 'lib/rabbit/action/basic.rb', line 20

def act_next_slide(action, group, canvas)
  canvas.move_to_next_slide_if_can
end

.act_next_slide_config(config, canvas) ⇒ Object



23
24
25
26
# File 'lib/rabbit/action/basic.rb', line 23

def act_next_slide_config(config, canvas)
  config[:label] = N_("Next slide")
  config[:stock_id] = Gtk::Stock::GO_FORWARD
end

.act_previous(action, group, canvas) ⇒ Object



12
13
14
# File 'lib/rabbit/action/basic.rb', line 12

def act_previous(action, group, canvas)
  canvas.move_to_previous_if_can
end

.act_previous_config(config, canvas) ⇒ Object



15
16
17
18
# File 'lib/rabbit/action/basic.rb', line 15

def act_previous_config(config, canvas)
  config[:label] = N_("Previous")
  config[:stock_id] = Gtk::Stock::GO_BACK
end

.act_previous_slide(action, group, canvas) ⇒ Object



28
29
30
# File 'lib/rabbit/action/basic.rb', line 28

def act_previous_slide(action, group, canvas)
  canvas.move_to_previous_slide_if_can
end

.act_previous_slide_config(config, canvas) ⇒ Object



31
32
33
34
# File 'lib/rabbit/action/basic.rb', line 31

def act_previous_slide_config(config, canvas)
  config[:label] = N_("Previous slide")
  config[:stock_id] = Gtk::Stock::GO_BACK
end

.act_print(action, group, canvas) ⇒ Object



79
80
81
# File 'lib/rabbit/action/basic.rb', line 79

def act_print(action, group, canvas)
  canvas.print
end

.act_print_config(config, canvas) ⇒ Object



82
83
84
85
# File 'lib/rabbit/action/basic.rb', line 82

def act_print_config(config, canvas)
  config[:label] = N_("Print")
  config[:stock_id] = Gtk::Stock::PRINT
end

.act_quit(action, group, canvas) ⇒ Object



156
157
158
159
160
161
# File 'lib/rabbit/action/basic.rb', line 156

def act_quit(action, group, canvas)
  if !canvas.processing? or
      canvas.confirm(_("Now processing... Do you really quit?"))
    canvas.quit
  end
end

.act_quit_config(config, canvas) ⇒ Object



162
163
164
165
# File 'lib/rabbit/action/basic.rb', line 162

def act_quit_config(config, canvas)
  config[:label] = quit_action_label(canvas)
  config[:stock_id] = Gtk::Stock::QUIT
end

.act_radio_blank(action, current, group, canvas) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rabbit/action/radio.rb', line 9

def act_radio_blank(action, current, group, canvas)
  case @@radio_blank_values.rassoc(current.value)[0]
  when :white
    canvas.toggle_whiteout
  when :black
    canvas.toggle_blackout
  when :show
    if canvas.whiteouting?
      canvas.toggle_whiteout
    elsif canvas.blackouting?
      canvas.toggle_blackout
    end
  else
    p "????"
  end
end

.act_radio_blank_blackout_config(config, canvas) ⇒ Object



31
32
33
34
35
# File 'lib/rabbit/action/radio.rb', line 31

def act_radio_blank_blackout_config(config, canvas)
  config[:label] = N_("Blackout")
  config[:value] = @@radio_blank_values.assoc(:black)[1]
  config[:default] = canvas.blackouting?
end

.act_radio_blank_show_config(config, canvas) ⇒ Object



36
37
38
39
40
# File 'lib/rabbit/action/radio.rb', line 36

def act_radio_blank_show_config(config, canvas)
  config[:label] = N_("Show")
  config[:value] = @@radio_blank_values.assoc(:show)[1]
  config[:default] = !canvas.whiteouting? && !canvas.blackouting?
end

.act_radio_blank_whiteout_config(config, canvas) ⇒ Object



26
27
28
29
30
# File 'lib/rabbit/action/radio.rb', line 26

def act_radio_blank_whiteout_config(config, canvas)
  config[:label] = N_("Whiteout")
  config[:value] = @@radio_blank_values.assoc(:white)[1]
  config[:default] = canvas.whiteouting?
end

.act_radio_log_level(action, current, group, canvas) ⇒ Object



43
44
45
# File 'lib/rabbit/action/radio.rb', line 43

def act_radio_log_level(action, current, group, canvas)
  canvas.logger.level = current.value
end

.act_radio_log_level_debug_config(config, canvas) ⇒ Object



47
48
49
50
51
# File 'lib/rabbit/action/radio.rb', line 47

def act_radio_log_level_debug_config(config, canvas)
  config[:label] = N_("Debug")
  config[:value] = Logger::Severity::DEBUG
  config[:default] = canvas.logger.level == config[:value]
end

.act_radio_log_level_error_config(config, canvas) ⇒ Object



62
63
64
65
66
# File 'lib/rabbit/action/radio.rb', line 62

def act_radio_log_level_error_config(config, canvas)
  config[:label] = N_("Error")
  config[:value] = Logger::Severity::ERROR
  config[:default] = canvas.logger.level == config[:value]
end

.act_radio_log_level_fatal_config(config, canvas) ⇒ Object



67
68
69
70
71
# File 'lib/rabbit/action/radio.rb', line 67

def act_radio_log_level_fatal_config(config, canvas)
  config[:label] = N_("Fatal")
  config[:value] = Logger::Severity::FATAL
  config[:default] = canvas.logger.level == config[:value]
end

.act_radio_log_level_info_config(config, canvas) ⇒ Object



52
53
54
55
56
# File 'lib/rabbit/action/radio.rb', line 52

def act_radio_log_level_info_config(config, canvas)
  config[:label] = N_("Info")
  config[:value] = Logger::Severity::INFO
  config[:default] = canvas.logger.level == config[:value]
end

.act_radio_log_level_unknown_config(config, canvas) ⇒ Object



72
73
74
75
76
# File 'lib/rabbit/action/radio.rb', line 72

def act_radio_log_level_unknown_config(config, canvas)
  config[:label] = N_("Unknown")
  config[:value] = Logger::Severity::UNKNOWN
  config[:default] = canvas.logger.level == config[:value]
end

.act_radio_log_level_warning_config(config, canvas) ⇒ Object



57
58
59
60
61
# File 'lib/rabbit/action/radio.rb', line 57

def act_radio_log_level_warning_config(config, canvas)
  config[:label] = N_("Warning")
  config[:value] = Logger::Severity::WARNING
  config[:default] = canvas.logger.level == config[:value]
end

.act_redraw(action, group, canvas) ⇒ Object



125
126
127
# File 'lib/rabbit/action/basic.rb', line 125

def act_redraw(action, group, canvas)
  canvas.redraw
end

.act_redraw_config(config, canvas) ⇒ Object



128
129
130
131
# File 'lib/rabbit/action/basic.rb', line 128

def act_redraw_config(config, canvas)
  config[:label] = N_("Redraw")
  config[:stock_id] = Gtk::Stock::REFRESH
end

.act_reload_theme(action, group, canvas) ⇒ Object



115
116
117
118
119
# File 'lib/rabbit/action/basic.rb', line 115

def act_reload_theme(action, group, canvas)
  block = nil
  block = action.call(action, group, canvas) if action.block_given?
  canvas.reload_theme(&block)
end

.act_reload_theme_config(config, canvas) ⇒ Object



120
121
122
123
# File 'lib/rabbit/action/basic.rb', line 120

def act_reload_theme_config(config, canvas)
  config[:label] = N_("Reload theme")
  config[:stock_id] = Gtk::Stock::REFRESH
end

.act_reset_adjustment(action, group, canvas) ⇒ Object



220
221
222
# File 'lib/rabbit/action/basic.rb', line 220

def act_reset_adjustment(action, group, canvas)
  canvas.reset_adjustment
end

.act_reset_adjustment_config(config, canvas) ⇒ Object



223
224
225
226
# File 'lib/rabbit/action/basic.rb', line 223

def act_reset_adjustment_config(config, canvas)
  config[:label] = N_("Reset adjustment")
  config[:stock_id] = Gtk::Stock::CLEAR
end

.act_reset_timer(action, group, canvas) ⇒ Object



228
229
230
# File 'lib/rabbit/action/basic.rb', line 228

def act_reset_timer(action, group, canvas)
  canvas.reset_timer
end

.act_reset_timer_config(config, canvas) ⇒ Object



231
232
233
234
# File 'lib/rabbit/action/basic.rb', line 231

def act_reset_timer_config(config, canvas)
  config[:label] = N_("Reset timer")
  config[:stock_id] = Gtk::Stock::CLEAR
end

.act_save_as_image(action, group, canvas) ⇒ Object



71
72
73
# File 'lib/rabbit/action/basic.rb', line 71

def act_save_as_image(action, group, canvas)
  canvas.save_as_image
end

.act_save_as_image_config(config, canvas) ⇒ Object



74
75
76
77
# File 'lib/rabbit/action/basic.rb', line 74

def act_save_as_image_config(config, canvas)
  config[:label] = N_("Save as image")
  config[:stock_id] = Gtk::Stock::SAVE
end

.act_search_slide_backward(action, group, canvas) ⇒ Object



258
259
260
261
# File 'lib/rabbit/action/basic.rb', line 258

def act_search_slide_backward(action, group, canvas)
  canvas.search_slide(false)
  update_saarch_action_status(canvas)
end

.act_search_slide_backward_config(config, canvas) ⇒ Object



262
263
264
# File 'lib/rabbit/action/basic.rb', line 262

def act_search_slide_backward_config(config, canvas)
  config[:label] = N_("Search slide backward")
end

.act_search_slide_backward_next(action, group, canvas) ⇒ Object



274
275
276
277
# File 'lib/rabbit/action/basic.rb', line 274

def act_search_slide_backward_next(action, group, canvas)
  canvas.search_slide(false)
  update_saarch_action_status(canvas)
end

.act_search_slide_backward_next_config(config, canvas) ⇒ Object



278
279
280
# File 'lib/rabbit/action/basic.rb', line 278

def act_search_slide_backward_next_config(config, canvas)
  config[:label] = N_("Search slide backward next")
end

.act_search_slide_forward(action, group, canvas) ⇒ Object



250
251
252
253
# File 'lib/rabbit/action/basic.rb', line 250

def act_search_slide_forward(action, group, canvas)
  canvas.search_slide(true)
  update_saarch_action_status(canvas)
end

.act_search_slide_forward_config(config, canvas) ⇒ Object



254
255
256
# File 'lib/rabbit/action/basic.rb', line 254

def act_search_slide_forward_config(config, canvas)
  config[:label] = N_("Search slide forward")
end

.act_search_slide_forward_next(action, group, canvas) ⇒ Object



266
267
268
269
# File 'lib/rabbit/action/basic.rb', line 266

def act_search_slide_forward_next(action, group, canvas)
  canvas.search_slide(true)
  update_saarch_action_status(canvas)
end

.act_search_slide_forward_next_config(config, canvas) ⇒ Object



270
271
272
# File 'lib/rabbit/action/basic.rb', line 270

def act_search_slide_forward_next_config(config, canvas)
  config[:label] = N_("Search slide forward next")
end

.act_stop_slide_search(action, group, canvas) ⇒ Object



282
283
284
285
# File 'lib/rabbit/action/basic.rb', line 282

def act_stop_slide_search(action, group, canvas)
  canvas.stop_slide_search
  update_saarch_action_status(canvas)
end

.act_stop_slide_search_config(config, canvas) ⇒ Object



286
287
288
# File 'lib/rabbit/action/basic.rb', line 286

def act_stop_slide_search_config(config, canvas)
  config[:label] = N_("Stop slide search")
end

.act_toggle_blackout(action, group, canvas) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rabbit/action/toggle.rb', line 15

def act_toggle_blackout(action, group, canvas)
  if canvas.blackouting?
    canvas.activate("RadioBlankShow")
  else
    canvas.activate("RadioBlankBlackout")
  end
end

.act_toggle_blackout_config(config, canvas) ⇒ Object



22
23
24
# File 'lib/rabbit/action/toggle.rb', line 22

def act_toggle_blackout_config(config, canvas)
  config[:label] = N_("Blackout")
end

.act_toggle_full_screen(action, group, canvas) ⇒ Object



34
35
36
# File 'lib/rabbit/action/toggle.rb', line 34

def act_toggle_full_screen(action, group, canvas)
  canvas.toggle_fullscreen
end

.act_toggle_full_screen_config(config, canvas) ⇒ Object



37
38
39
40
41
42
43
44
# File 'lib/rabbit/action/toggle.rb', line 37

def act_toggle_full_screen_config(config, canvas)
  config[:label] = N_("Full screen")
  if Gtk::Stock.const_defined?(:FULLSCREEN)
    config[:stock_id] = Gtk::Stock::FULLSCREEN
  else
    config[:stock_id] = Gtk::Stock::ZOOM_FIT
  end
end

.act_toggle_graffiti_mode(action, group, canvas) ⇒ Object



46
47
48
# File 'lib/rabbit/action/toggle.rb', line 46

def act_toggle_graffiti_mode(action, group, canvas)
  canvas.toggle_graffiti_mode
end

.act_toggle_graffiti_mode_config(config, canvas) ⇒ Object



49
50
51
52
# File 'lib/rabbit/action/toggle.rb', line 49

def act_toggle_graffiti_mode_config(config, canvas)
  config[:label] = N_("Graffiti mode")
  config[:stock_id] = Gtk::Stock::EDIT
end

.act_toggle_index_mode(action, group, canvas) ⇒ Object



26
27
28
# File 'lib/rabbit/action/toggle.rb', line 26

def act_toggle_index_mode(action, group, canvas)
  canvas.toggle_index_mode
end

.act_toggle_index_mode_config(config, canvas) ⇒ Object



29
30
31
32
# File 'lib/rabbit/action/toggle.rb', line 29

def act_toggle_index_mode_config(config, canvas)
  config[:label] = N_("Index mode")
  config[:stock_id] = Gtk::Stock::INDEX
end

.act_toggle_info_window(action, group, canvas) ⇒ Object



54
55
56
# File 'lib/rabbit/action/toggle.rb', line 54

def act_toggle_info_window(action, group, canvas)
  canvas.toggle_info_window
end

.act_toggle_info_window_config(config, canvas) ⇒ Object



57
58
59
# File 'lib/rabbit/action/toggle.rb', line 57

def act_toggle_info_window_config(config, canvas)
  config[:label] = N_("Information window")
end

.act_toggle_magnifier(action, group, canvas) ⇒ Object



68
69
70
# File 'lib/rabbit/action/toggle.rb', line 68

def act_toggle_magnifier(action, group, canvas)
  canvas.toggle_magnifier
end

.act_toggle_magnifier_config(config, canvas) ⇒ Object



71
72
73
# File 'lib/rabbit/action/toggle.rb', line 71

def act_toggle_magnifier_config(config, canvas)
  config[:label] = N_("Magnifier")
end

.act_toggle_spotlight(action, group, canvas) ⇒ Object



61
62
63
# File 'lib/rabbit/action/toggle.rb', line 61

def act_toggle_spotlight(action, group, canvas)
  canvas.toggle_spotlight
end

.act_toggle_spotlight_config(config, canvas) ⇒ Object



64
65
66
# File 'lib/rabbit/action/toggle.rb', line 64

def act_toggle_spotlight_config(config, canvas)
  config[:label] = N_("Spotlight")
end

.act_toggle_whiteout(action, group, canvas) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/rabbit/action/toggle.rb', line 4

def act_toggle_whiteout(action, group, canvas)
  if canvas.whiteouting?
    canvas.activate("RadioBlankShow")
  else
    canvas.activate("RadioBlankWhiteout")
  end
end

.act_toggle_whiteout_config(config, canvas) ⇒ Object



11
12
13
# File 'lib/rabbit/action/toggle.rb', line 11

def act_toggle_whiteout_config(config, canvas)
  config[:label] = N_("Whiteout")
end

.act_undo_graffiti(action, group, canvas) ⇒ Object



194
195
196
# File 'lib/rabbit/action/basic.rb', line 194

def act_undo_graffiti(action, group, canvas)
  canvas.undo_graffiti
end

.act_undo_graffiti_config(config, canvas) ⇒ Object



197
198
199
200
# File 'lib/rabbit/action/basic.rb', line 197

def act_undo_graffiti_config(config, canvas)
  config[:label] = N_("Undo graffiti")
  config[:stock_id] = Gtk::Stock::UNDO
end

.action_group(canvas, name = "Rabbit") ⇒ Object



52
53
54
55
56
57
58
59
60
61
# File 'lib/rabbit/action.rb', line 52

def action_group(canvas, name="Rabbit")
  Stock.init(canvas)
  group = Gtk::ActionGroup.new(name)
  group.set_translate_func(&method(:_))
  group.add_actions(to_gtk_actions(@@actions, canvas))
  actions = to_gtk_actions(@@toggle_actions, canvas, true)
  group.add_toggle_actions(actions)
  add_radio_actions(group, @@radio_actions, canvas)
  group
end

.method_added(name) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/rabbit/action.rb', line 37

def method_added(name)
  case name.to_s
  when /_config$/
    # ignore
  when /^act_(radio_.+)$/
    @@radio_actions << [Utils.to_class_name($1), name]
  when /^act_(toggle_.+)$/
    @@toggle_actions << [Utils.to_class_name($1), name]
  when /^act_(.+)$/
    @@actions << [Utils.to_class_name($1), name]
  when /^update_(.+)_status$/
    @@update_status_methods << name
  end
end

.quit_action_label(canvas) ⇒ Object



152
153
154
# File 'lib/rabbit/action/basic.rb', line 152

def quit_action_label(canvas)
  canvas.processing? ? @@quit_with_confirmation_label : @@quit_label
end

.update_graffiti_action_status(canvas) ⇒ Object



210
211
212
213
214
215
216
217
218
# File 'lib/rabbit/action/basic.rb', line 210

def update_graffiti_action_status(canvas)
  graffiti_available = canvas.graffiti_mode? || canvas.have_graffiti?
  canvas.action("Graffiti").sensitive = graffiti_available
  #canvas.action("ClearGraffiti").sensitive = canvas.have_graffiti?
  #canvas.action("UndoGraffiti").sensitive = canvas.can_undo_graffiti?
  canvas.action("ClearGraffiti").sensitive = graffiti_available
  canvas.action("UndoGraffiti").sensitive = graffiti_available
  canvas.action("ChangeGraffitiColor").sensitive = graffiti_available
end

.update_move_slide_action_status(canvas) ⇒ Object



62
63
64
65
66
67
68
69
# File 'lib/rabbit/action/basic.rb', line 62

def update_move_slide_action_status(canvas)
  canvas.action("Previous").sensitive = canvas.have_previous?
  canvas.action("Next").sensitive = canvas.have_next?
  canvas.action("PreviousSlide").sensitive = canvas.have_previous_slide?
  canvas.action("NextSlide").sensitive = canvas.have_next_slide?
  canvas.action("FirstSlide").sensitive = !canvas.first_slide?
  canvas.action("LastSlide").sensitive = !canvas.last_slide?
end

.update_processing_action_status(canvas) ⇒ Object



136
137
138
139
140
141
# File 'lib/rabbit/action.rb', line 136

def update_processing_action_status(canvas)
  canvas.action("ToggleIndexMode").sensitive = !canvas.processing?
  canvas.action("CacheAllSlides").sensitive = !canvas.processing?
  canvas.action("SaveAsImage").sensitive = !canvas.processing?
  canvas.action("Print").sensitive = !canvas.processing?
end

.update_quit_action_status(canvas) ⇒ Object



167
168
169
# File 'lib/rabbit/action/basic.rb', line 167

def update_quit_action_status(canvas)
  canvas.action("Quit").label = _(quit_action_label(canvas))
end

.update_saarch_action_status(canvas) ⇒ Object



290
291
292
293
294
295
296
# File 'lib/rabbit/action/basic.rb', line 290

def update_saarch_action_status(canvas)
  canvas.action("SearchSlideForward").sensitive = !canvas.searching?
  canvas.action("SearchSlideBackward").sensitive = !canvas.searching?
  canvas.action("SearchSlideForwardNext").sensitive = canvas.searching?
  canvas.action("SearchSlideBackwardNext").sensitive = canvas.searching?
  canvas.action("StopSlideSearch").sensitive = canvas.searching?
end

.update_status(canvas) ⇒ Object



63
64
65
66
67
# File 'lib/rabbit/action.rb', line 63

def update_status(canvas)
  @@update_status_methods.each do |method|
    __send__(method, canvas)
  end
end

.update_theme_action_status(canvas) ⇒ Object



141
142
143
144
145
146
147
148
# File 'lib/rabbit/action/basic.rb', line 141

def update_theme_action_status(canvas)
  not_applying = !canvas.applying?
  canvas.action("ReloadTheme").sensitive = not_applying
  canvas.action("ChangeTheme").sensitive = not_applying
  canvas.action("MergeTheme").sensitive = not_applying
  canvas.action("CacheAllSlides").sensitive = not_applying
  canvas.action("ToggleFullScreen").sensitive = not_applying
end