From c2e527653d5340240d186b06e2baf608f540acd1 Mon Sep 17 00:00:00 2001 From: Cyberarm Date: Sun, 23 Oct 2022 17:36:29 -0500 Subject: [PATCH] Added Alt+G/A/V shortcuts to add groups, actions, and variables respectively. --- lib/pages/editor.rb | 47 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/lib/pages/editor.rb b/lib/pages/editor.rb index 30d74a1..7a0e4bc 100644 --- a/lib/pages/editor.rb +++ b/lib/pages/editor.rb @@ -418,6 +418,51 @@ module TAC end end end + + def button_down(id) + super + + return if control_down? || shift_down? || !alt_down? + + case id + when Gosu::KB_G + push_state( + TAC::Dialog::NamePromptDialog, + title: "Create Group", + list: window.backend.config.groups, + callback_method: method(:create_group) + ) + when Gosu::KB_A + if @active_group + push_state( + TAC::Dialog::ActionDialog, + title: "Create Action", + list: @active_group.actions, + callback_method: method(:create_action) + ) + else + push_state( + TAC::Dialog::AlertDialog, + title: "Error", + message: "Unable to create action, no group selected." + ) + end + when Gosu::KB_V + if @active_action + push_state( + TAC::Dialog::VariableDialog, + title: "Create Variable", + callback_method: method(:create_variable) + ) + else + push_state( + TAC::Dialog::AlertDialog, + title: "Error", + message: "Unable to create variable, no action selected." + ) + end + end + end end end -end \ No newline at end of file +end