From d5cb86a1b05c0f0595a7bd119ff6dc12e4ace8b9 Mon Sep 17 00:00:00 2001 From: moguno Date: Sun, 30 Jun 2013 17:43:03 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC=E3=82=B8=E3=81?= =?UTF-8?q?=AE=E3=83=80=E3=83=96=E3=83=AB=E3=82=AF=E3=83=AA=E3=83=83=E3=82=AF?= =?UTF-8?q?=E3=81=AB=E3=82=B3=E3=83=9E=E3=83=B3=E3=83=89=E3=82=92=E3=82=A2=E3?= =?UTF-8?q?=82=B5=E3=82=A4=E3=83=B3=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81?= =?UTF-8?q?=86=E3=81=AB=E3=81=97=E3=81=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/mui/gtk_keyconfig.rb | 29 +++++++++++++++++++++++ core/plugin/gtk/gtk.rb | 6 +++++ core/plugin/shortcutkey/shortcutkey_listview.rb | 3 ++- 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/core/mui/gtk_keyconfig.rb b/core/mui/gtk_keyconfig.rb index c62ebc9..4b5c302 100644 --- a/core/mui/gtk_keyconfig.rb +++ b/core/mui/gtk_keyconfig.rb @@ -37,11 +37,40 @@ class Gtk::KeyConfig < Gtk::Button button = Gtk::Button.new dialog = Gtk::Dialog.new(title, self.get_ancestor(Gtk::Window), Gtk::Dialog::MODAL, [ Gtk::Stock::OK, Gtk::Dialog::RESPONSE_OK]) + + radio_keybind = ::Gtk::RadioButton.new('キーバインド') + radio_dclick = ::Gtk::RadioButton.new(radio_keybind, 'ダブルクリック') + + radio_keybind.ssc(:clicked){ + keycode = "" + buttonlabel.text = label.text = keycode + button.sensitive = true + self.change_hook.call(keycode) if self.change_hook + } + + radio_dclick.ssc(:clicked){ + keycode = "Double_Click" + buttonlabel.text = label.text = keycode + button.sensitive = false + self.change_hook.call(keycode) if self.change_hook + } + + if keycode == "Double_Click" + button.sensitive = false + radio_dclick.active = true + else + button.sensitive = true + radio_keybind.active = true + end + label.text = keycode + box.border_width = 20 button.add(label) box.pack_start(Gtk::Label.new('下のボタンをクリックして、割り当てたいキーを押してください。')) + box.pack_start(radio_keybind) box.pack_start(button) + box.pack_start(radio_dclick) button.signal_connect('key_press_event', &key_set(label)) dialog.vbox.add(box) dialog.show_all diff --git a/core/plugin/gtk/gtk.rb b/core/plugin/gtk/gtk.rb index b6f4803..544a929 100644 --- a/core/plugin/gtk/gtk.rb +++ b/core/plugin/gtk/gtk.rb @@ -175,6 +175,12 @@ Plugin.create :gtk do timeline = ::Gtk::TimeLine.new(i_timeline) @slug_dictionary.add(i_timeline, timeline) handler = { + button_press_event: lambda { |widget, event| + if event.event_type.name == "GDK_2BUTTON_PRESS" then + Plugin::GUI.keypress("Double_Click", i_timeline) + end + }, + key_press_event: timeline_key_press_event(i_timeline), key_press_event: timeline_key_press_event(i_timeline), focus_in_event: timeline_focus_in_event(i_timeline), destroy: lambda{ |this| timeline_hook_events(timeline, handler) } } diff --git a/core/plugin/shortcutkey/shortcutkey_listview.rb b/core/plugin/shortcutkey/shortcutkey_listview.rb index ab06eb0..3de5b2f 100644 --- a/core/plugin/shortcutkey/shortcutkey_listview.rb +++ b/core/plugin/shortcutkey/shortcutkey_listview.rb @@ -109,7 +109,8 @@ module Plugin::Shortcutkey btn_cancel.ssc(:clicked){ window.destroy } btn_ok.ssc(:clicked){ error = catch(:validate) { - throw :validate, "キーバインドを選択してください" unless values[COLUMN_KEYBIND] + throw :validate, "キーバインドを選択してください" unless (values[COLUMN_KEYBIND] && values[COLUMN_KEYBIND] != "") + throw :validate, "コマンドを選択してください" unless values[COLUMN_SLUG] result = values window.destroy } -- 1.7.10.2 (Apple Git-33)