機能 #595 » 0001-.patch
core/mui/gtk_extension.rb | ||
---|---|---|
return '(割り当てなし)' end
|
||
return r end end
|
||
def self.scrollname(key)
|
||
type_strict key => Array
|
||
type, direction, state = key
|
||
if key.empty? or type == 0 or not key.all?(&ret_nth)
|
||
return '(割り当てなし)'
|
||
else
|
||
r = ""
|
||
r << 'Control + ' if (state & Gdk::Window::CONTROL_MASK) != 0
|
||
r << 'Shift + ' if (state & Gdk::Window::SHIFT_MASK) != 0
|
||
r << 'Alt + ' if (state & Gdk::Window::MOD1_MASK) != 0
|
||
r << 'Super + ' if (state & Gdk::Window::SUPER_MASK) != 0
|
||
r << 'Hyper + ' if (state & Gdk::Window::HYPER_MASK) != 0
|
||
case direction
|
||
when Gdk::EventScroll::UP
|
||
r << 'Scroll Up'
|
||
when Gdk::EventScroll::DOWN
|
||
r << 'Scroll Down'
|
||
when Gdk::EventScroll::LEFT
|
||
r << 'Scroll Left'
|
||
when Gdk::EventScroll::RIGHT
|
||
r << 'Scroll Right'
|
||
else
|
||
return '(割り当てなし)' end
|
||
return r end end
|
||
end
|
||
=begin rdoc
|
core/mui/gtk_keyconfig.rb | ||
---|---|---|
box.pack_start(button)
|
||
button.signal_connect(:key_press_event, &key_set(label))
|
||
button.signal_connect(:button_press_event, &button_set(label))
|
||
button.signal_connect(:scroll_event, &scroll_set(label))
|
||
dialog.vbox.add(box)
|
||
dialog.show_all
|
||
dialog.run
|
||
... | ... | |
true }
|
||
end
|
||
def scroll_set(label)
|
||
lambda{ |widget, event|
|
||
self.keycode = Gtk.scrollname([event.event_type, event.direction, event.state])
|
||
buttonlabel.text = label.text = keycode
|
||
self.change_hook.call(keycode) if self.change_hook
|
||
true }
|
||
end
|
||
end
|
core/mui/gtk_tree_view_pretty_scroll.rb | ||
---|---|---|
scroll_to_top_animation = false if scroll_to_top_animation
|
||
get_scroll_to_top_animation_id += 1 }
|
||
scrolling = false
|
||
ssc(:scroll_event){ |this, e|
|
||
case e.direction
|
||
when Gdk::EventScroll::UP
|
||
this.vadjustment.value = [this.vadjustment.value - this.vadjustment.step_increment, this.vadjustment.lower].max
|
||
scroll_to_top_animation_id.call
|
||
when Gdk::EventScroll::DOWN
|
||
@scroll_to_zero_lator = false if this.vadjustment.value == 0
|
||
this.vadjustment.value = [this.vadjustment.value + this.vadjustment.step_increment, this.vadjustment.upper - visible_rect.height].min
|
||
scroll_to_top_animation_id.call end
|
||
false }
|
||
# タイムラインにincludeされている場合、コマンドを実行する
|
||
if defined?(imaginary) && imaginary.is_a?(Plugin::GUI::Timeline)
|
||
path, column, cell_x, cell_y = get_path_at_pos(e.x, e.y)
|
||
if column
|
||
if !scrolling
|
||
scrolling = true
|
||
Delayer.new(:ui_response) {
|
||
if Plugin::GUI.keypress(::Gtk::scrollname([e.event_type, e.direction, e.state]), imaginary)
|
||
Thread.new {
|
||
sleep 1.0
|
||
scrolling = false
|
||
}
|
||
else
|
||
scrolling = false
|
||
end
|
||
}
|
||
end
|
||
end
|
||
end
|
||
if e.state == 0
|
||
case e.direction
|
||
when Gdk::EventScroll::UP
|
||
this.vadjustment.value = [this.vadjustment.value - this.vadjustment.step_increment, this.vadjustment.lower].max
|
||
scroll_to_top_animation_id.call
|
||
when Gdk::EventScroll::DOWN
|
||
@scroll_to_zero_lator = false if this.vadjustment.value == 0
|
||
this.vadjustment.value = [this.vadjustment.value + this.vadjustment.step_increment, this.vadjustment.upper - visible_rect.height].min
|
||
scroll_to_top_animation_id.call end
|
||
end
|
||
false }
|
||
vadjustment.ssc(:value_changed){ |this|
|
||
if(scroll_to_zero? and not(scroll_to_top_animation))
|