1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-12 22:35:18 +00:00

Add extra cursor options to the Preferences

Changes "Indicators" to "Cursors" and adds options that let the user use the native mouse cursors of the OS and toggle the cross cursor on or off for the canvas
This commit is contained in:
Manolis Papadeas 2022-02-10 22:32:55 +02:00
parent 1285fa89c5
commit 74df57ed70
5 changed files with 113 additions and 45 deletions

View file

@ -443,6 +443,9 @@ msgstr ""
msgid "Performance"
msgstr ""
msgid "Cursors"
msgstr ""
msgid "Indicators"
msgstr ""
@ -929,6 +932,12 @@ msgstr ""
msgid "Displays an icon of the selected right tool next to the cursor on the canvas"
msgstr ""
msgid "Use native mouse cursors"
msgstr ""
msgid "Use cross cursor for the canvas"
msgstr ""
msgid "Guides"
msgstr ""

View file

@ -80,6 +80,8 @@ var show_left_tool_icon := true
var show_right_tool_icon := true
var left_square_indicator_visible := true
var right_square_indicator_visible := false
var native_cursors := false
var cross_cursor := true
# View menu options
var mirror_view := false

View file

@ -19,7 +19,8 @@ func _ready() -> void:
if OS.get_name() == "OSX":
_use_osx_shortcuts()
Input.set_custom_mouse_cursor(cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
if !Global.native_cursors:
Input.set_custom_mouse_cursor(cursor_image, Input.CURSOR_CROSS, Vector2(15, 15))
Global.window_title = tr("untitled") + " - Pixelorama " + Global.current_version
Global.current_project.layers[0].name = tr("Layer") + " 0"

View file

@ -42,28 +42,40 @@ var preferences = [
],
[
"show_left_tool_icon",
"Indicators/IndicatorsContainer/LeftToolIconCheckbox",
"Cursors/CursorsContainer/LeftToolIconCheckbox",
"pressed",
Global.show_left_tool_icon
],
[
"show_right_tool_icon",
"Indicators/IndicatorsContainer/RightToolIconCheckbox",
"Cursors/CursorsContainer/RightToolIconCheckbox",
"pressed",
Global.show_right_tool_icon
],
[
"left_square_indicator_visible",
"Indicators/IndicatorsContainer/LeftIndicatorCheckbox",
"Cursors/CursorsContainer/LeftIndicatorCheckbox",
"pressed",
Global.left_square_indicator_visible
],
[
"right_square_indicator_visible",
"Indicators/IndicatorsContainer/RightIndicatorCheckbox",
"Cursors/CursorsContainer/RightIndicatorCheckbox",
"pressed",
Global.right_square_indicator_visible
],
[
"native_cursors",
"Cursors/CursorsContainer/NativeCursorsCheckbox",
"pressed",
Global.native_cursors
],
[
"cross_cursor",
"Cursors/CursorsContainer/CrossCursorCheckbox",
"pressed",
Global.cross_cursor
],
[
"autosave_interval",
"Backup/AutosaveContainer/AutosaveInterval",
@ -358,6 +370,20 @@ func preference_update(prop: String) -> void:
if prop == "tool_button_size":
Tools.set_button_size(Global.tool_button_size)
if prop == "native_cursors":
var image
if Global.native_cursors:
image = null
else:
image = Global.control.cursor_image
Input.set_custom_mouse_cursor(image, Input.CURSOR_CROSS, Vector2(15, 15))
if prop == "cross_cursor":
if Global.cross_cursor:
Global.main_viewport.mouse_default_cursor_shape = Control.CURSOR_CROSS
else:
Global.main_viewport.mouse_default_cursor_shape = Control.CURSOR_ARROW
Global.config_cache.save("user://cache.ini")
@ -386,7 +412,7 @@ func add_tabs(changed_language := false) -> void:
list.add_item(" " + tr("Shortcuts"))
list.add_item(" " + tr("Backup"))
list.add_item(" " + tr("Performance"))
list.add_item(" " + tr("Indicators"))
list.add_item(" " + tr("Cursors"))
list.select(1 if changed_language else selected_item)
autosave_interval.suffix = tr("minute(s)")
@ -409,7 +435,7 @@ func _on_List_item_selected(index: int) -> void:
"Shortcuts",
"Backup",
"Performance",
"Indicators"
"Cursors"
]
if OS.get_name() == "HTML5":
content_list.erase("Startup")

View file

@ -1443,29 +1443,28 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="Indicators" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
[node name="Cursors" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false
margin_top = 54.0
margin_right = 498.0
margin_bottom = 180.0
margin_top = 56.0
margin_right = 525.0
margin_bottom = 164.0
[node name="IndicatorsContainer" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators"]
margin_top = 18.0
margin_right = 498.0
margin_bottom = 126.0
[node name="CursorsContainer" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors"]
margin_right = 525.0
margin_bottom = 108.0
custom_constants/vseparation = 4
custom_constants/hseparation = 4
columns = 3
[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
[node name="Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_top = 5.0
margin_right = 127.0
margin_right = 126.0
margin_bottom = 19.0
text = "Left pixel indicator"
[node name="LeftIndicatorCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_left = 131.0
margin_right = 498.0
[node name="LeftIndicatorCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 130.0
margin_right = 354.0
margin_bottom = 24.0
hint_tooltip = "Show left mouse pixel indicator or brush on the canvas when drawing"
mouse_default_cursor_shape = 2
@ -1473,56 +1472,87 @@ size_flags_horizontal = 3
pressed = true
text = "On"
[node name="Label2" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_top = 33.0
margin_right = 127.0
margin_bottom = 47.0
[node name="Label2" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 358.0
margin_top = 5.0
margin_right = 525.0
margin_bottom = 19.0
text = "Right pixel indicator"
[node name="RightIndicatorCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_left = 131.0
[node name="RightIndicatorCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_top = 28.0
margin_right = 498.0
margin_right = 126.0
margin_bottom = 52.0
hint_tooltip = "Show right mouse pixel indicator or brush on the canvas when drawing"
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
text = "On"
[node name="Label3" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_top = 61.0
margin_right = 127.0
margin_bottom = 75.0
[node name="Label3" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 130.0
margin_top = 33.0
margin_right = 354.0
margin_bottom = 47.0
text = "Show left tool icon"
[node name="LeftToolIconCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_left = 131.0
margin_top = 56.0
margin_right = 498.0
margin_bottom = 80.0
[node name="LeftToolIconCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 358.0
margin_top = 28.0
margin_right = 525.0
margin_bottom = 52.0
hint_tooltip = "Displays an icon of the selected left tool next to the cursor on the canvas"
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
pressed = true
text = "On"
[node name="Label4" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_top = 89.0
margin_right = 127.0
margin_bottom = 103.0
[node name="Label4" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_top = 61.0
margin_right = 126.0
margin_bottom = 75.0
text = "Show right tool icon"
[node name="RightToolIconCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Indicators/IndicatorsContainer"]
margin_left = 131.0
margin_top = 84.0
margin_right = 498.0
margin_bottom = 108.0
[node name="RightToolIconCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 130.0
margin_top = 56.0
margin_right = 354.0
margin_bottom = 80.0
hint_tooltip = "Displays an icon of the selected right tool next to the cursor on the canvas"
mouse_default_cursor_shape = 2
size_flags_horizontal = 3
pressed = true
text = "On"
[node name="Label5" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 358.0
margin_top = 61.0
margin_right = 525.0
margin_bottom = 75.0
text = "Use native mouse cursors"
[node name="NativeCursorsCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_top = 84.0
margin_right = 126.0
margin_bottom = 108.0
mouse_default_cursor_shape = 2
text = "On"
[node name="Label6" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 130.0
margin_top = 89.0
margin_right = 354.0
margin_bottom = 103.0
text = "Use cross cursor for the canvas"
[node name="CrossCursorCheckbox" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Cursors/CursorsContainer"]
margin_left = 358.0
margin_top = 84.0
margin_right = 525.0
margin_bottom = 108.0
mouse_default_cursor_shape = 2
pressed = true
text = "On"
[node name="Popups" type="Node" parent="."]
[node name="ShortcutSelector" type="ConfirmationDialog" parent="Popups"]