1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Add color switch shortcut to preferences.

This commit is contained in:
novhack 2020-04-15 20:52:20 +02:00
parent bfbe76ab79
commit 840b83fee7
6 changed files with 54 additions and 14 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=55 format=2]
[gd_scene load_steps=54 format=2]
[ext_resource path="res://Themes & Styles/Dark Theme/Dark Theme.tres" type="Theme" id=1]
[ext_resource path="res://Scripts/Main.gd" type="Script" id=2]
@ -45,11 +45,7 @@
[ext_resource path="res://Assets/Graphics/Dark Themes/Tools/Zoom.png" type="Texture" id=43]
[ext_resource path="res://Prefabs/Dialogs/HSVDialog.tscn" type="PackedScene" id=44]
[sub_resource type="InputEventKey" id=1]
scancode = 88
[sub_resource type="ShortCut" id=2]
shortcut = SubResource( 1 )
[sub_resource type="Image" id=11]
data = {
@ -1324,6 +1320,7 @@ current_path = "D:/libDev/git/Pixelorama-git/"
[node name="ScaleImage" parent="." instance=ExtResource( 31 )]
[node name="PreferencesDialog" parent="." instance=ExtResource( 32 )]
visible = false
[node name="RotateImage" parent="." instance=ExtResource( 38 )]

View file

@ -6,10 +6,10 @@
[node name="PreferencesDialog" type="AcceptDialog"]
margin_left = -3.0
margin_top = 2.0
margin_top = 9.0
margin_right = 419.0
margin_bottom = 1092.0
rect_min_size = Vector2( 422, 0 )
margin_bottom = 1163.0
rect_min_size = Vector2( 422, 340 )
window_title = "Preferences"
resizable = true
script = ExtResource( 1 )
@ -35,7 +35,7 @@ __meta__ = {
[node name="Tree" type="Tree" parent="HSplitContainer"]
margin_right = 86.0
margin_bottom = 1046.0
margin_bottom = 1110.0
rect_min_size = Vector2( 85, 0 )
custom_constants/item_margin = -2
hide_root = true
@ -43,13 +43,13 @@ hide_root = true
[node name="ScrollContainer" type="ScrollContainer" parent="HSplitContainer"]
margin_left = 98.0
margin_right = 406.0
margin_bottom = 1046.0
margin_bottom = 1110.0
rect_min_size = Vector2( 100, 0 )
size_flags_horizontal = 3
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/ScrollContainer"]
margin_right = 308.0
margin_bottom = 1042.0
margin_bottom = 1074.0
size_flags_horizontal = 3
[node name="General" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
@ -461,7 +461,7 @@ color = Color( 0, 0, 0, 0 )
[node name="Shortcuts" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
margin_top = 820.0
margin_right = 308.0
margin_bottom = 1042.0
margin_bottom = 1074.0
[node name="HBoxContainer" type="HBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts"]
margin_right = 308.0
@ -492,7 +492,7 @@ margin_bottom = 28.0
[node name="Shortcuts" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts"]
margin_top = 32.0
margin_right = 308.0
margin_bottom = 222.0
margin_bottom = 254.0
custom_constants/hseparation = 5
columns = 3
@ -671,6 +671,35 @@ margin_top = 170.0
margin_right = 307.0
margin_bottom = 190.0
[node name="HSeparator4" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts/Shortcuts"]
margin_top = 194.0
margin_right = 137.0
margin_bottom = 198.0
[node name="HSeparator5" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts/Shortcuts"]
margin_left = 142.0
margin_top = 194.0
margin_right = 222.0
margin_bottom = 198.0
[node name="HSeparator6" type="HSeparator" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts/Shortcuts"]
margin_left = 227.0
margin_top = 194.0
margin_right = 307.0
margin_bottom = 198.0
[node name="Switch Colors" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts/Shortcuts"]
margin_top = 205.0
margin_right = 137.0
margin_bottom = 219.0
text = "Switch Colors"
[node name="switch_colors" type="Button" parent="HSplitContainer/ScrollContainer/VBoxContainer/Shortcuts/Shortcuts"]
margin_left = 142.0
margin_top = 202.0
margin_right = 222.0
margin_bottom = 222.0
[node name="Popups" type="Node" parent="."]
[node name="ShortcutSelector" type="ConfirmationDialog" parent="Popups"]

View file

@ -363,6 +363,9 @@ func set_action_shortcut(action : String, old_input : InputEventKey, new_input :
InputMap.action_erase_event(action, old_input)
InputMap.action_add_event(action, new_input)
Global.update_hint_tooltips()
# Set shortcut to switch colors button
if action == "switch_colors":
Global.color_switch_button.shortcut.shortcut = InputMap.get_action_list("switch_colors")[0]
func _on_GridWidthValue_value_changed(value : float) -> void:

View file

@ -210,6 +210,8 @@ var import_sprites_dialog : FileDialog
var left_color_picker : ColorPickerButton
var right_color_picker : ColorPickerButton
var color_switch_button : TextureButton
var left_tool_options_container : Container
var right_tool_options_container : Container
@ -337,6 +339,7 @@ func _ready() -> void:
left_color_picker = find_node_by_name(root, "LeftColorPickerButton")
right_color_picker = find_node_by_name(root, "RightColorPickerButton")
color_switch_button = find_node_by_name(root, "ColorSwitch")
left_brush_type_container = find_node_by_name(left_tool_options_container, "LeftBrushType")
right_brush_type_container = find_node_by_name(right_tool_options_container, "RightBrushType")
@ -746,7 +749,7 @@ Hold %s to make a line""") % [InputMap.get_action_list("left_eraser_tool")[0].as
var color_switch : BaseButton = find_node_by_name(root, "ColorSwitch")
color_switch.hint_tooltip = tr("""Switch left and right colors
(%s)""") % "X"
(%s)""") % InputMap.get_action_list("switch_colors")[0].as_text()
var first_frame : BaseButton = find_node_by_name(root, "FirstFrame")
first_frame.hint_tooltip = tr("""Jump to the first frame

View file

@ -972,6 +972,9 @@ msgstr ""
msgid "Lighten/Darken"
msgstr ""
msgid "Switch Colors"
msgstr ""
msgid "Set the shortcut"
msgstr ""

View file

@ -320,6 +320,11 @@ right_zoom_tool={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":true,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":90,"unicode":0,"echo":false,"script":null)
]
}
switch_colors={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":88,"unicode":0,"echo":false,"script":null)
]
}
[locale]