class Gdk::SubPartsQuote

Constants

EDGE_ABSENT_SIZE
EDGE_PRESENT_SIZE

Public Class Methods

new(*args) click to toggle source
Calls superclass method Gdk::SubParts.new
# File core/mui/cairo_sub_parts_quote.rb, line 23
def initialize(*args)
  super
  @edge = show_edge? ? EDGE_PRESENT_SIZE : EDGE_ABSENT_SIZE
  promise_list = helper.score.select{ |note|
    note.respond_to?(:reference)
  }.map{ |note|
    note.reference&.uri || note.uri
  }.select{ |u|
    u.is_a?(Diva::URI)
  }.map{ |target_uri|
    model_class = Enumerator.new{ |y|
      Plugin.filtering(:model_of_uri, target_uri, y)
    }.lazy.map{ |model_slug|
      Diva::Model(model_slug)
    }.find{ |mc|
      mc.spec.timeline
    }
    Delayer.Deferred.new{ model_class.find_by_uri(target_uri) } if model_class
  }.compact
  if !promise_list.empty?
    Delayer::Deferred.when(promise_list).next{ |quoting|
      quoting = quoting.compact
      if !quoting.empty?
        @messages = quoting.freeze
        render_messages
      end
    }.terminate('コメント付きリツイート描画中にエラーが発生しました')
  end
end

Public Instance Methods

background_color(message) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 67
def background_color(message)
  color = Plugin.filtering(:subparts_quote_background_color, message, UserConfig[:quote_background_color]).last
  if color.is_a? Array and 3 == color.size
    color.map{ |c| c.to_f / 65536 }
  else
    [1.0]*3 end end
badge(_message) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 64
def badge(_message)
  Skin['quote.png'].pixbuf(width: @badge_radius*2, height: @badge_radius*2) end
edge() click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 53
def edge
  if show_edge?
    unless @edge == EDGE_PRESENT_SIZE
      @edge = EDGE_PRESENT_SIZE
      helper.reset_height end
  else
    unless @edge == EDGE_ABSENT_SIZE
      @edge = EDGE_ABSENT_SIZE
      helper.reset_height end end
  @edge end
header_left_content(*args) click to toggle source
Calls superclass method
# File core/mui/cairo_sub_parts_quote.rb, line 83
def header_left_content(*args)
  if show_header?
    super end end
header_right_content(*args) click to toggle source
Calls superclass method
# File core/mui/cairo_sub_parts_quote.rb, line 87
def header_right_content(*args)
  if show_header?
    super end end
icon_size() click to toggle source
Calls superclass method
# File core/mui/cairo_sub_parts_quote.rb, line 91
def icon_size
  if show_icon?
    if UserConfig[:quote_icon_size]
      Gdk::Rectangle.new(0, 0, UserConfig[:quote_icon_size], UserConfig[:quote_icon_size])
    else
      super end end end
main_text_color(message) click to toggle source
Calls superclass method
# File core/mui/cairo_sub_parts_quote.rb, line 74
def main_text_color(message)
  if UserConfig[:quote_text_color]
    UserConfig[:quote_text_color].map{ |c| c.to_f / 65536 }
  else
    super end end
main_text_font(message) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 80
def main_text_font(message)
  Pango::FontDescription.new(UserConfig[:quote_text_font]) end
messages() click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 10
def messages
  @messages end
on_click(e, message) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 13
def on_click(e, message)
  case e.button
  when 1
    case UserConfig[:quote_clicked_action]
    when :open
      Plugin.call(:open, message)
    when :smartthread
      Plugin.call(:open_smartthread, [message]) end
  end end
render_badge(message, context) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 111
def render_badge(message, context)
  return unless show_edge?
  case UserConfig[:quote_edge]
  when :floating
    render_badge_floating(message, context)
  when :solid
    render_badge_solid(message, context)
  when :flat
    render_badge_flat(message, context) end end
render_outline(message, context, base_y) click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 101
def render_outline(message, context, base_y)
  return unless show_edge?
  case UserConfig[:quote_edge]
  when :floating
    render_outline_floating(message, context, base_y)
  when :solid
    render_outline_solid(message, context, base_y)
  when :flat
    render_outline_flat(message, context, base_y) end end
show_edge?() click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 127
def show_edge?
  (UserConfig[:quote_present_policy] || []).include?(:edge) end
show_header?() click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 121
def show_header?
  (UserConfig[:quote_present_policy] || []).include?(:header) end
show_icon?() click to toggle source
# File core/mui/cairo_sub_parts_quote.rb, line 124
def show_icon?
  (UserConfig[:quote_present_policy] || []).include?(:icon) end
text_max_line_count(message) click to toggle source
Calls superclass method
# File core/mui/cairo_sub_parts_quote.rb, line 98
def text_max_line_count(message)
  UserConfig[:quote_text_max_line_count] || super end