Class: Rabbit::Element::IndexSlide
- Inherits:
-
Object
- Object
- Rabbit::Element::IndexSlide
- Includes:
- SlideElement
- Defined in:
- lib/rabbit/element/index-slide.rb
Constant Summary collapse
- ROW_NUMBER =
4
- COLUMN_NUMBER =
4
Constants included from GetText
Instance Attribute Summary
Attributes included from SlideElement
#drawing_index, #index, #transition
Attributes included from ContainerElement
Attributes included from Base
#base_h, #base_w, #base_x, #base_y, #default_margin_bottom, #default_margin_left, #default_margin_right, #default_margin_top, #default_padding_bottom, #default_padding_left, #default_padding_right, #default_padding_top, #default_visible, #h, #horizontal_centering, #margin_bottom, #margin_left, #margin_right, #margin_top, #padding_bottom, #padding_left, #padding_right, #padding_top, #parent, #ph, #pw, #px, #py, #real_simulation, #user_property, #vertical_centering, #w, #x, #y
Class Method Summary collapse
Instance Method Summary collapse
Methods included from SlideElement
#clear_theme, #clear_transition, #clear_waiting, #draw, #first?, #flush, #initialize, #last?, #move_to_next, #move_to_previous, #register_default_wait_proc, #register_wait_proc, #size_ratio, #slide, #waited_draw_procs
Methods included from BlockElement
#adjust_y_padding, #inline_element?
Methods included from ContainerElement
#<<, #[], #[]=, #_width, #clear_theme, #compile, #compile_elements, #compile_horizontal, #compile_horizontal_element, #delete, #dirty?, #draw_element, #draw_elements, #have_tag?, #have_wait_tag?, #height, #initialize, #inspect, #prop_delete, #prop_get, #prop_set, #replace_element, #substitute_text, #text, #to_rd, #unshift, #width
Methods included from Base
#[], #[]=, #add_default_prop, #adjust_x_centering, #adjust_y_margin, #adjust_y_padding, #available_w, #centering_adjusted_height, #centering_adjusted_width, #clear_margin, #clear_padding, #clear_theme, #clone, #compile, #compile_element, #compile_for_horizontal_centering, #compile_horizontal, #default_prop, #dirty!, #dirty?, #do_horizontal_centering, #do_horizontal_centering?, #do_vertical_centering?, #draw, #font, #have_tag?, #have_wait_tag?, #height, #hide, #if_dirty, #init_default_margin, #init_default_padding, #init_default_visible, #initialize, #inline_element?, #inspect, #margin_set, #margin_with, #match?, #next_element, #padding_set, #padding_with, #previous_element, #prop_delete, #prop_get, #prop_set, #prop_value, #reset_horizontal_centering, #restore_x_margin, #restore_x_padding, #setup_margin, #setup_padding, #show, #slide, #substitute_newline, #substitute_text, #text_renderer?, #visible?, #wait, #width
Methods included from Base::DrawHook
#clear_draw_procs, def_draw_hook, def_draw_hooks
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
Class Method Details
.make_index_slides(canvas) ⇒ Object
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 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/rabbit/element/index-slide.rb', line 48 def (canvas) width = canvas.width.to_f / (COLUMN_NUMBER + 1) height = canvas.height.to_f / (ROW_NUMBER + 1) default_margin_top = (height / (ROW_NUMBER + 1) / 2).ceil default_margin_bottom = default_margin_top default_margin_left = (width / (COLUMN_NUMBER + 1) / 2).ceil default_margin_right = default_margin_left thumbnails = make_thumbnails(canvas, width, height) return [] unless thumbnails = ROW_NUMBER * COLUMN_NUMBER thumbnail_rows_set = [] thumbnails.each_with_index do |thumbnail, | if .remainder().zero? thumbnail_rows_set << [] end if .remainder(ROW_NUMBER).zero? row = IndexThumbnailRow.new row.default_margin_top = default_margin_top row.default_margin_bottom = default_margin_bottom row.default_margin_left = default_margin_left row.default_margin_right = default_margin_right row.clear_theme thumbnail_rows_set.last << row end thumbnail_rows_set.last.last << thumbnail end thumbnail_rows_set.collect do |rows| = new(rows) .default_margin_top = default_margin_top .default_margin_bottom = default_margin_bottom .default_margin_left = default_margin_left .default_margin_right = default_margin_right .clear_theme end end |
.make_thumbnails(canvas, width, height) ⇒ Object
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 |
# File 'lib/rabbit/element/index-slide.rb', line 15 def make_thumbnails(canvas, width, height) maker = make_thumbnail_maker(canvas, width, height) maker.apply_theme(canvas.theme_name) if canvas.theme_name canvas.source_force_modified(true) do |source| maker.parse(source) end thumbnails = [] = maker. - 1 canvas.renderer.pre_to_pixbuf() canceled = false maker. do |, pixbuf, | if canvas.renderer.to_pixbufing() thumbnails << IndexThumbnail.new(pixbuf, maker.(), , ) else canceled = true end !canceled end canvas.renderer.post_to_pixbuf(canceled) maker.quit if canceled nil else thumbnails end end |
Instance Method Details
#slide_number(canvas, x, y) ⇒ Object
106 107 108 109 110 111 112 113 114 115 |
# File 'lib/rabbit/element/index-slide.rb', line 106 def (canvas, x, y) column = (COLUMN_NUMBER * (x / canvas.width)).to_i row = (ROW_NUMBER * (y / canvas.height)).to_i thumb = self[row] && self[row][column] if thumb thumb.number else nil end end |
#title ⇒ Object
102 103 104 |
# File 'lib/rabbit/element/index-slide.rb', line 102 def title _("Index") end |
#to_html(generator) ⇒ Object
117 118 119 |
# File 'lib/rabbit/element/index-slide.rb', line 117 def to_html(generator) "<div class=\"index-slide\">\n#{super}\n</div>" end |