提案 #1381 » 0001-「上にスクロール」「下にスクロール」コマンドを実装.patch
core/mui/cairo_inner_tl.rb | ||
---|---|---|
options[:postboxstorage] = postbox end
|
||
create_postbox(options) end
|
||
def set_cursor_to_display_top
|
||
iter = model.iter_first
|
||
set_cursor(iter.path, get_column(0), false) if iter end
|
||
def get_active_messages
|
||
get_active_iterators.map{ |iter| iter[1] } end
|
||
core/plugin/command/command.rb | ||
---|---|---|
condition: :itself.to_proc,
|
||
visible: false,
|
||
role: :timeline) do |opt|
|
||
opt.widget.scroll_to_top end
|
||
Plugin.call :gui_timeline_scroll, opt.widget, :top
|
||
end
|
||
command(:scroll_up,
|
||
name: _('上にスクロール'),
|
||
condition: :itself.to_proc,
|
||
visible: false,
|
||
role: :timeline) do |opt|
|
||
Plugin.call :gui_timeline_scroll, opt.widget, :up
|
||
end
|
||
command(:scroll_down,
|
||
name: _('下にスクロール'),
|
||
condition: :itself.to_proc,
|
||
visible: false,
|
||
role: :timeline) do |opt|
|
||
Plugin.call :gui_timeline_scroll, opt.widget, :down
|
||
end
|
||
# フォーカスを _widget_ から _distance_ に移動する
|
||
# ==== Args
|
core/plugin/gtk/gtk.rb | ||
---|---|---|
if timeline
|
||
timeline.clear end end
|
||
on_gui_timeline_scroll_to_top do |i_timeline|
|
||
timeline = widgetof(i_timeline)
|
||
if timeline
|
||
timeline.set_cursor_to_display_top end end
|
||
on_gui_timeline_scroll do |i_timeline, msg|
|
||
tl = widgetof(i_timeline) or next
|
||
case msg
|
||
when :top
|
||
iter = tl.model.iter_first or next
|
||
tl.set_cursor iter.path, nil, false
|
||
when :up
|
||
rect = tl.visible_rect
|
||
x, y = tl.convert_tree_to_bin_window_coords rect.x, rect.y
|
||
path, _, _, _ = tl.get_path x, y
|
||
path or next
|
||
tl.set_cursor path, nil, false
|
||
tl.scroll_to_cell path, nil, true, 1, 0
|
||
when :down
|
||
rect = tl.visible_rect
|
||
x, y = tl.convert_tree_to_bin_window_coords rect.x, rect.y + rect.height
|
||
path, _, _, _ = tl.get_path x, y
|
||
path or next
|
||
tl.set_cursor path, nil, false
|
||
tl.scroll_to_cell path, nil, true, 0, 0
|
||
end
|
||
end
|
||
on_gui_timeline_move_cursor_to do |i_timeline, message|
|
||
tl = widgetof(i_timeline)
|