From e4a7bdc2335874bdeca4d1f95b8f833337fdca1c Mon Sep 17 00:00:00 2001 From: Sokomine Date: Fri, 25 Jun 2021 19:12:58 +0200 Subject: [PATCH] added save button to edit options dialog (not yet functional) --- fs_edit_options_dialog.lua | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/fs_edit_options_dialog.lua b/fs_edit_options_dialog.lua index 9e516b4..4a9c7c5 100644 --- a/fs_edit_options_dialog.lua +++ b/fs_edit_options_dialog.lua @@ -36,6 +36,12 @@ yl_speak_up.input_edit_option_dialog = function(player, formname, fields) return end + if(fields.save_option) then + yl_speak_up.show_fs(player, "edit_option_dialog", + {n_id = n_id, d_id = d_id, o_id = o_id, caller="save_option"}) + return + end + -- back to the main dialog window? -- (this also happens when the last option was deleted) if(fields.show_current_dialog or fields.quit or fields.button_exit or not(d_option) or fields.del_option) then @@ -252,13 +258,13 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id) for i, o in ipairs(sorted_list) do if(o == o_id and sorted_list[ i-1 ]) then button_prev = "".. - "button[7.4,18.7;2.0,0.9;edit_option_prev;Prev]".. + "button[7.9,18.7;2.0,0.9;edit_option_prev;Prev]".. "tooltip[edit_option_prev;Go to previous option/answer ".. "(according to o_sort).]" end if(o == o_id and sorted_list[ i+1 ]) then button_next = "".. - "button[12.0,18.7;2.0,0.9;edit_option_next;Next]".. + "button[12.5,18.7;2.0,0.9;edit_option_next;Next]".. "tooltip[edit_option_next;Go to next option/answer ".. "(according to o_sort).]" end @@ -357,6 +363,9 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id) "tooltip[del_option;Delete this option/answer.]".. -- button: add new button_add.. + -- button: save + "button[4.6,18.7;2.0,0.9;save_option;Save]".. + "tooltip[save_option;Save what you canged (or discard it).]".. -- button: prev/next button_prev.. button_next.. @@ -366,8 +375,8 @@ yl_speak_up.get_fs_edit_option_dialog = function(player, n_id, d_id, o_id) "tooltip[show_current_dialog;Go back to dialog ".. minetest.formspec_escape(d_id).." and continue editing that dialog.]".. -- allow to enter o_sort - "label[9.6,19.2;Sort:]".. - "field[10.6,18.7;1.0,0.9;edit_option_o_sort;;".. + "label[10.1,19.2;Sort:]".. + "field[11.1,18.7;1.0,0.9;edit_option_o_sort;;".. minetest.formspec_escape(d_option.o_sort).."]".. "tooltip[edit_option_o_sort;o_sort: The lower the number, the higher up in the ".. "list this option goes\nNegative values are ignored;#FFFFFF;#000000]"..