機能 #595 » 0001-.patch
core/mui/gtk_extension.rb | ||
---|---|---|
94 | 94 |
return '(割り当てなし)' end |
95 | 95 |
return r end end |
96 | 96 | |
97 |
def self.scrollname(key) |
|
98 |
type_strict key => Array |
|
99 |
type, direction, state = key |
|
100 |
if key.empty? or type == 0 or not key.all?(&ret_nth) |
|
101 |
return '(割り当てなし)' |
|
102 |
else |
|
103 |
r = "" |
|
104 |
r << 'Control + ' if (state & Gdk::Window::CONTROL_MASK) != 0 |
|
105 |
r << 'Shift + ' if (state & Gdk::Window::SHIFT_MASK) != 0 |
|
106 |
r << 'Alt + ' if (state & Gdk::Window::MOD1_MASK) != 0 |
|
107 |
r << 'Super + ' if (state & Gdk::Window::SUPER_MASK) != 0 |
|
108 |
r << 'Hyper + ' if (state & Gdk::Window::HYPER_MASK) != 0 |
|
109 |
case direction |
|
110 |
when Gdk::EventScroll::UP |
|
111 |
r << 'Scroll Up' |
|
112 |
when Gdk::EventScroll::DOWN |
|
113 |
r << 'Scroll Down' |
|
114 |
when Gdk::EventScroll::LEFT |
|
115 |
r << 'Scroll Left' |
|
116 |
when Gdk::EventScroll::RIGHT |
|
117 |
r << 'Scroll Right' |
|
118 |
else |
|
119 |
return '(割り当てなし)' end |
|
120 |
return r end end |
|
121 | ||
97 | 122 |
end |
98 | 123 | |
99 | 124 |
=begin rdoc |
core/mui/gtk_keyconfig.rb | ||
---|---|---|
44 | 44 |
box.pack_start(button) |
45 | 45 |
button.signal_connect(:key_press_event, &key_set(label)) |
46 | 46 |
button.signal_connect(:button_press_event, &button_set(label)) |
47 |
button.signal_connect(:scroll_event, &scroll_set(label)) |
|
47 | 48 |
dialog.vbox.add(box) |
48 | 49 |
dialog.show_all |
49 | 50 |
dialog.run |
... | ... | |
65 | 66 |
true } |
66 | 67 |
end |
67 | 68 | |
69 |
def scroll_set(label) |
|
70 |
lambda{ |widget, event| |
|
71 |
self.keycode = Gtk.scrollname([event.event_type, event.direction, event.state]) |
|
72 |
buttonlabel.text = label.text = keycode |
|
73 |
self.change_hook.call(keycode) if self.change_hook |
|
74 |
true } |
|
75 |
end |
|
76 | ||
68 | 77 |
end |
core/mui/gtk_tree_view_pretty_scroll.rb | ||
---|---|---|
17 | 17 |
scroll_to_top_animation = false if scroll_to_top_animation |
18 | 18 |
get_scroll_to_top_animation_id += 1 } |
19 | 19 | |
20 |
scrolling = false |
|
21 | ||
20 | 22 |
ssc(:scroll_event){ |this, e| |
21 |
case e.direction |
|
22 |
when Gdk::EventScroll::UP |
|
23 |
this.vadjustment.value = [this.vadjustment.value - this.vadjustment.step_increment, this.vadjustment.lower].max |
|
24 |
scroll_to_top_animation_id.call |
|
25 |
when Gdk::EventScroll::DOWN |
|
26 |
@scroll_to_zero_lator = false if this.vadjustment.value == 0 |
|
27 |
this.vadjustment.value = [this.vadjustment.value + this.vadjustment.step_increment, this.vadjustment.upper - visible_rect.height].min |
|
28 |
scroll_to_top_animation_id.call end |
|
29 |
false } |
|
23 | ||
24 |
# タイムラインにincludeされている場合、コマンドを実行する |
|
25 |
if defined?(imaginary) && imaginary.is_a?(Plugin::GUI::Timeline) |
|
26 |
path, column, cell_x, cell_y = get_path_at_pos(e.x, e.y) |
|
27 | ||
28 |
if column |
|
29 |
if !scrolling |
|
30 |
scrolling = true |
|
31 |
Delayer.new(:ui_response) { |
|
32 |
if Plugin::GUI.keypress(::Gtk::scrollname([e.event_type, e.direction, e.state]), imaginary) |
|
33 |
Thread.new { |
|
34 |
sleep 1.0 |
|
35 |
scrolling = false |
|
36 |
} |
|
37 |
else |
|
38 |
scrolling = false |
|
39 |
end |
|
40 |
} |
|
41 |
end |
|
42 |
end |
|
43 |
end |
|
44 | ||
45 |
if e.state == 0 |
|
46 |
case e.direction |
|
47 |
when Gdk::EventScroll::UP |
|
48 |
this.vadjustment.value = [this.vadjustment.value - this.vadjustment.step_increment, this.vadjustment.lower].max |
|
49 |
scroll_to_top_animation_id.call |
|
50 |
when Gdk::EventScroll::DOWN |
|
51 |
@scroll_to_zero_lator = false if this.vadjustment.value == 0 |
|
52 |
this.vadjustment.value = [this.vadjustment.value + this.vadjustment.step_increment, this.vadjustment.upper - visible_rect.height].min |
|
53 |
scroll_to_top_animation_id.call end |
|
54 |
end |
|
55 |
false } |
|
30 | 56 | |
31 | 57 |
vadjustment.ssc(:value_changed){ |this| |
32 | 58 |
if(scroll_to_zero? and not(scroll_to_top_animation)) |