Add rightclick menu

This commit is contained in:
don-tnowe 2023-01-24 12:58:13 +02:00
parent c10bb18003
commit 9b84137ca4
6 changed files with 137 additions and 143 deletions

View File

@ -2,7 +2,6 @@
extends Control
signal grid_updated()
signal cells_context(cells)
@export @onready var node_folder_path : LineEdit = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer/Path"
@export @onready var node_recent_paths : OptionButton = $"HeaderContentSplit/VBoxContainer/HBoxContainer/HBoxContainer2/RecentPaths"
@ -312,6 +311,7 @@ func duplicate_selected_rows(new_name : String):
func delete_selected_rows():
io.delete_rows(_get_row_resources(_selection.get_edited_rows()))
refresh()
call_deferred(&"refresh")
func has_row_names():
@ -421,3 +421,7 @@ func _on_File_pressed():
func _on_SearchProcess_pressed():
$"HeaderContentSplit/VBoxContainer/Search".visible = !$"HeaderContentSplit/VBoxContainer/Search".visible
func _on_cells_context(cells):
pass # Replace with function body.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=25 format=3 uid="uid://tmleonv20aqk"]
[gd_scene load_steps=26 format=3 uid="uid://tmleonv20aqk"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/editor_view.gd" id="1_wfx75"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/editor_color_setter.gd" id="2_t2s7k"]
@ -22,6 +22,7 @@
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/typed_cells/cell_editor_enum.gd" id="20_swsbn"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/typed_cells/cell_editor_resource.gd" id="21_58wf8"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/typed_cells/cell_editor_string.gd" id="22_bni8r"]
[ext_resource type="PackedScene" uid="uid://b51hnttsie7k5" path="res://addons/resources_spreadsheet_view/main_screen/selection_actions.tscn" id="23_m53sx"]
[sub_resource type="Gradient" id="Gradient_8kp6w"]
offsets = PackedFloat32Array(0, 0.995413, 1)
@ -571,6 +572,14 @@ layout_mode = 2
button_pressed = true
text = "Enable"
[node name="SelectionActions" parent="Control" instance=ExtResource("23_m53sx")]
visible = false
layout_mode = 2
offset_left = -506.0
offset_top = 65.0
offset_right = -426.0
offset_bottom = 117.0
[node name="InputHandler" type="Node" parent="."]
script = ExtResource("14_2t57a")
@ -594,3 +603,5 @@ node_property_editors = NodePath("../HeaderContentSplit/MarginContainer/FooterCo
[connection signal="pressed" from="HeaderContentSplit/VBoxContainer/HBoxContainer3/Refresh" to="." method="_on_path_text_submitted"]
[connection signal="value_changed" from="HeaderContentSplit/VBoxContainer/HBoxContainer3/Pages/LineEdit" to="HeaderContentSplit/VBoxContainer/HBoxContainer3/Pages" method="_on_LineEdit_value_changed"]
[connection signal="dir_selected" from="Control/FileDialog" to="." method="_on_FileDialog_dir_selected"]
[connection signal="cells_rightclicked" from="SelectionManager" to="Control/SelectionActions" method="_on_grid_cells_rightclicked"]
[connection signal="cells_selected" from="SelectionManager" to="Control/SelectionActions" method="_on_grid_cells_selected"]

View File

@ -17,7 +17,7 @@ func _on_cell_gui_input(event : InputEvent, cell : Control):
selection.deselect_all_cells()
selection.select_cell(cell)
editor_view.cells_context.emit(selection.edited_cells)
selection.rightclick_cells()
return

View File

@ -7,7 +7,8 @@ enum {
EDITBOX_DELETE,
}
@export var editor_view := NodePath("../..")
@export @onready var editor_view := $"../.."
@export @onready var selection := $"../../SelectionManager"
@onready var editbox_node := $"Control/ColorRect/Popup"
@onready var editbox_label := editbox_node.get_node("Panel/VBoxContainer/Label")
@ -20,11 +21,12 @@ var editbox_action : int
func _ready():
editbox_input.get_node("../..").add_theme_stylebox_override(
"panel",
get_theme_stylebox("Content", "EditorStyles")
get_theme_stylebox(&"Content", &"EditorStyles")
)
close()
func _on_grid_cells_context(cells):
func _on_grid_cells_rightclicked(cells):
open(cells)
@ -36,6 +38,8 @@ func _on_grid_cells_selected(cells):
func open(cells : Array, pin_to_cell : bool = false):
set_process_input(true)
set_process_unhandled_input(true)
if cells.size() == 0:
hide()
cell = null
@ -56,12 +60,17 @@ func open(cells : Array, pin_to_cell : bool = false):
top_level = true
show()
$"Control2/Label".text = str(cells.size()) + (" Cells" if cells.size() % 10 != 1 else " Cell")
$"GridContainer/Rename".visible = get_node(editor_view).has_row_names()
$"GridContainer/Rename".visible = editor_view.has_row_names()
func close():
set_process_input(false)
set_process_unhandled_input(false)
func _unhandled_input(event):
if !get_node(editor_view).is_visible_in_tree():
hide()
if !editor_view.is_visible_in_tree():
close()
return
if event is InputEventKey:
@ -77,13 +86,13 @@ func _unhandled_input(event):
return
if event is InputEventMouseButton && event.is_pressed():
hide()
close()
func _input(event):
if cell == null: return
if !get_node(editor_view).is_visible_in_tree():
hide()
if !editor_view.is_visible_in_tree():
close()
return
global_position = Vector2(
@ -97,14 +106,14 @@ func _on_Duplicate_pressed():
func _on_CbCopy_pressed():
TextEditingUtils.multi_copy(get_node(editor_view).edited_cells_text)
TextEditingUtils.multi_copy(selection.edited_cells_text)
func _on_CbPaste_pressed():
get_node(editor_view).set_edited_cells_values(
editor_view.set_edited_cells_values(
TextEditingUtils.multi_paste(
get_node(editor_view).edited_cells_text,
get_node(editor_view).edit_cursor_positions
selection.edited_cells_text,
selection.edit_cursor_positions
)
)
@ -118,17 +127,16 @@ func _on_Delete_pressed():
func _show_editbox(action):
var node_editor_view = get_node(editor_view)
editbox_action = action
match action:
EDITBOX_DUPLICATE:
if !node_editor_view.has_row_names():
if !editor_view.has_row_names():
_on_editbox_accepted()
return
if node_editor_view.edited_cells.size() == 1:
if selection.edited_cells.size() == 1:
editbox_label.text = "Input new row's name..."
editbox_input.text = node_editor_view.get_last_selected_row()\
editbox_input.text = editor_view.get_last_selected_row()\
.resource_path.get_file().get_basename()
else:
@ -137,16 +145,17 @@ func _show_editbox(action):
EDITBOX_RENAME:
editbox_label.text = "Input new name for row..."
editbox_input.text = node_editor_view.get_last_selected_row()\
editbox_input.text = editor_view.get_last_selected_row()\
.resource_path.get_file().get_basename()
EDITBOX_DELETE:
editbox_label.text = "Really delete selected rows? (Irreversible!!!)"
editbox_input.text = node_editor_view.get_last_selected_row()\
editbox_input.text = editor_view.get_last_selected_row()\
.resource_path.get_file().get_basename()
editbox_input.grab_focus()
editbox_input.caret_position = 999999999
editbox_input.caret_column = 999999999
editbox_node.size = Vector2.ZERO
editbox_node.show()
$"Control/ColorRect".show()
$"Control/ColorRect".top_level = true
@ -166,12 +175,12 @@ func _on_editbox_closed():
func _on_editbox_accepted():
match(editbox_action):
EDITBOX_DUPLICATE:
get_node(editor_view).duplicate_selected_rows(editbox_input.text)
editor_view.duplicate_selected_rows(editbox_input.text)
EDITBOX_RENAME:
get_node(editor_view).rename_row(get_node(editor_view).get_last_selected_row(), editbox_input.text)
editor_view.rename_row(editor_view.get_last_selected_row(), editbox_input.text)
EDITBOX_DELETE:
get_node(editor_view).delete_selected_rows()
editor_view.delete_selected_rows()
_on_editbox_closed()

View File

@ -1,211 +1,176 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=7 format=3 uid="uid://b51hnttsie7k5"]
[ext_resource path="res://addons/resources_spreadsheet_view/editor_icon_button.gd" type="Script" id=1]
[ext_resource path="res://addons/resources_spreadsheet_view/selection_actions.gd" type="Script" id=2]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/editor_icon_button.gd" id="1"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/main_screen/selection_actions.gd" id="1_qv6ov"]
[ext_resource type="Script" path="res://addons/resources_spreadsheet_view/editor_color_setter.gd" id="2_a4ihj"]
[sub_resource type="Image" id=6]
[sub_resource type="Image" id="Image_1546g"]
data = {
"data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
"format": "LumAlpha8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id=2]
flags = 4
flags = 4
image = SubResource( 6 )
size = Vector2( 16, 16 )
[sub_resource type="ImageTexture" id="2"]
image = SubResource("Image_1546g")
[sub_resource type="Image" id=7]
data = {
"data": PoolByteArray( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ),
"format": "LumAlpha8",
"height": 16,
"mipmaps": false,
"width": 16
}
[sub_resource type="ImageTexture" id=4]
flags = 4
flags = 4
image = SubResource( 7 )
size = Vector2( 16, 16 )
[sub_resource type="StyleBoxTexture" id=5]
texture = SubResource( 4 )
region_rect = Rect2( 0, 0, 16, 16 )
margin_left = 2.0
margin_right = 2.0
margin_top = 2.0
margin_bottom = 2.0
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ydxuk"]
content_margin_left = 4.0
content_margin_top = 4.0
content_margin_right = 4.0
content_margin_bottom = 4.0
bg_color = Color(1, 0.365, 0.365, 1)
draw_center = false
border_width_left = 2
border_width_top = 2
border_width_right = 2
border_width_bottom = 2
corner_detail = 1
[node name="SelectionActions" type="MarginContainer"]
margin_right = 84.0
margin_bottom = 44.0
mouse_filter = 2
offset_right = 80.0
offset_bottom = 52.0
size_flags_horizontal = 9
script = ExtResource( 2 )
__meta__ = {
"_edit_group_": true,
"_edit_lock_": true
}
mouse_filter = 2
script = ExtResource("1_qv6ov")
[node name="Control2" type="Control" parent="."]
margin_right = 84.0
margin_bottom = 44.0
[node name="Control2" type="Panel" parent="."]
layout_mode = 2
mouse_filter = 2
[node name="ColorRect" type="ColorRect" parent="Control2"]
show_behind_parent = true
margin_left = -2.0
margin_top = -18.0
margin_bottom = 2.0
layout_mode = 0
mouse_filter = 2
[node name="ColorRect2" type="ColorRect" parent="Control2"]
modulate = Color(0, 0, 0, 1)
show_behind_parent = true
layout_mode = 1
anchors_preset = 9
anchor_bottom = 1.0
margin_left = -2.0
offset_left = -2.0
grow_vertical = 2
mouse_filter = 2
script = ExtResource("2_a4ihj")
[node name="Label" type="Label" parent="Control2"]
margin_left = 2.0
margin_top = -16.0
margin_right = 50.0
margin_bottom = -2.0
layout_mode = 0
offset_top = -26.0
offset_right = 57.0
text = "Actions"
vertical_alignment = 2
[node name="ColorRect3" type="Panel" parent="Control2/Label"]
show_behind_parent = true
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = -2.0
margin_top = -2.0
margin_bottom = 2.0
offset_left = -2.0
offset_top = 2.0
offset_right = 2.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="GridContainer" type="GridContainer" parent="."]
margin_right = 84.0
margin_bottom = 44.0
mouse_filter = 2
layout_mode = 2
size_flags_horizontal = 9
size_flags_vertical = 9
custom_constants/vseparation = 0
custom_constants/hseparation = 0
mouse_filter = 2
columns = 3
[node name="Duplicate" type="Button" parent="GridContainer"]
margin_right = 28.0
margin_bottom = 22.0
layout_mode = 2
tooltip_text = "Duplicate Selected Rows (Ctrl+D)"
mouse_filter = 1
icon = SubResource( 2 )
script = ExtResource( 1 )
icon = SubResource("2")
script = ExtResource("1")
icon_name = "Duplicate"
[node name="CbCopy" type="Button" parent="GridContainer"]
margin_left = 28.0
margin_right = 56.0
margin_bottom = 22.0
layout_mode = 2
tooltip_text = "Copy to Clipboard (Ctrl+C)"
mouse_filter = 1
icon = SubResource( 2 )
script = ExtResource( 1 )
icon = SubResource("2")
script = ExtResource("1")
icon_name = "ActionCopy"
[node name="CbPaste" type="Button" parent="GridContainer"]
margin_left = 56.0
margin_right = 84.0
margin_bottom = 22.0
layout_mode = 2
tooltip_text = "Paste Clipboard (Ctrl+V)"
mouse_filter = 1
icon = SubResource( 2 )
script = ExtResource( 1 )
icon = SubResource("2")
script = ExtResource("1")
icon_name = "ActionPaste"
[node name="Rename" type="Button" parent="GridContainer"]
margin_top = 22.0
margin_right = 28.0
margin_bottom = 44.0
layout_mode = 2
tooltip_text = "Rename Selected Rows (Ctrl+R)"
mouse_filter = 1
icon = SubResource( 2 )
script = ExtResource( 1 )
icon = SubResource("2")
script = ExtResource("1")
icon_name = "Edit"
[node name="Delete" type="Button" parent="GridContainer"]
margin_left = 28.0
margin_top = 22.0
margin_right = 56.0
margin_bottom = 44.0
layout_mode = 2
tooltip_text = "DELETE Selected Rows"
mouse_filter = 1
icon = SubResource( 2 )
script = ExtResource( 1 )
icon = SubResource("2")
script = ExtResource("1")
icon_name = "Remove"
[node name="Control" type="Control" parent="."]
margin_right = 84.0
margin_bottom = 44.0
layout_mode = 2
mouse_filter = 2
[node name="ColorRect" type="ColorRect" parent="Control"]
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
color = Color( 0, 0, 0, 0.498039 )
offset_right = -80.0
offset_bottom = -52.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0, 0, 0, 0.498039)
[node name="Popup" type="Popup" parent="Control/ColorRect"]
visible = true
margin_left = 42.0
margin_top = 22.0
margin_right = 42.0
margin_bottom = 22.0
mouse_filter = 2
popup_exclusive = true
[node name="Popup" type="MarginContainer" parent="Control/ColorRect"]
layout_mode = 0
offset_top = 100.0
offset_right = 140.0
offset_bottom = 196.0
[node name="Panel" type="PanelContainer" parent="Control/ColorRect/Popup"]
margin_right = 14.0
margin_bottom = 14.0
rect_min_size = Vector2( 192, 0 )
layout_mode = 2
mouse_filter = 2
custom_styles/panel = SubResource( 5 )
theme_override_styles/panel = SubResource("StyleBoxFlat_ydxuk")
[node name="VBoxContainer" type="VBoxContainer" parent="Control/ColorRect/Popup/Panel"]
margin_left = 7.0
margin_top = 7.0
margin_right = 185.0
margin_bottom = 73.0
layout_mode = 2
mouse_filter = 2
[node name="Label" type="Label" parent="Control/ColorRect/Popup/Panel/VBoxContainer"]
margin_right = 178.0
margin_bottom = 14.0
layout_mode = 2
text = "Input new name..."
[node name="LineEdit" type="LineEdit" parent="Control/ColorRect/Popup/Panel/VBoxContainer"]
margin_top = 18.0
margin_right = 178.0
margin_bottom = 42.0
layout_mode = 2
[node name="HBoxContainer" type="HBoxContainer" parent="Control/ColorRect/Popup/Panel/VBoxContainer"]
margin_top = 46.0
margin_right = 178.0
margin_bottom = 66.0
layout_mode = 2
alignment = 1
[node name="Button" type="Button" parent="Control/ColorRect/Popup/Panel/VBoxContainer/HBoxContainer"]
margin_left = 44.0
margin_right = 75.0
margin_bottom = 20.0
layout_mode = 2
text = "OK"
[node name="Button2" type="Button" parent="Control/ColorRect/Popup/Panel/VBoxContainer/HBoxContainer"]
margin_left = 79.0
margin_right = 133.0
margin_bottom = 20.0
layout_mode = 2
text = "Cancel"
[connection signal="pressed" from="GridContainer/Duplicate" to="." method="_on_Duplicate_pressed"]

View File

@ -2,6 +2,7 @@
extends Node
signal cells_selected(cells)
signal cells_rightclicked(cells)
const EditorView = preload("res://addons/resources_spreadsheet_view/editor_view.gd")
@ -110,6 +111,10 @@ func select_cells_to(cell : Control):
cells_selected.emit(edited_cells)
func rightclick_cells():
cells_rightclicked.emit(edited_cells)
func can_select_cell(cell : Control) -> bool:
if edited_cells.size() == 0:
return true