2019-12-18 16:12:44 +00:00
|
|
|
extends AcceptDialog
|
|
|
|
|
2020-07-29 00:16:02 +00:00
|
|
|
# Preferences table: [Prop name in Global, relative node path, value type, default value]
|
2020-05-31 20:04:59 +00:00
|
|
|
var preferences = [
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"open_last_project",
|
|
|
|
"Startup/StartupContainer/OpenLastProject",
|
|
|
|
"pressed",
|
|
|
|
Global.open_last_project
|
|
|
|
],
|
2022-01-05 00:34:45 +00:00
|
|
|
[
|
|
|
|
"quit_confirmation",
|
|
|
|
"Startup/StartupContainer/QuitConfirmation",
|
|
|
|
"pressed",
|
|
|
|
Global.quit_confirmation
|
|
|
|
],
|
2020-11-08 23:52:53 +00:00
|
|
|
["shrink", "Interface/ShrinkContainer/ShrinkHSlider", "value", Global.shrink],
|
2021-03-17 17:28:01 +00:00
|
|
|
["dim_on_popup", "Interface/DimPopup/CheckBox", "pressed", Global.dim_on_popup],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"icon_color_from",
|
|
|
|
"Interface/IconColorFrom/IconColorOptionButton",
|
|
|
|
"selected",
|
|
|
|
Global.icon_color_from
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"custom_icon_color",
|
|
|
|
"Interface/IconColorFrom/IconColorButton",
|
|
|
|
"color",
|
|
|
|
Global.custom_icon_color
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"tool_button_size",
|
|
|
|
"Interface/ToolButtonSize/ToolButtonSizeOptionButton",
|
|
|
|
"selected",
|
|
|
|
Global.tool_button_size
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"pressure_sensitivity_mode",
|
|
|
|
"Startup/PressureSentivity/PressureSensitivityOptionButton",
|
|
|
|
"selected",
|
|
|
|
Global.pressure_sensitivity_mode
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"show_left_tool_icon",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors/CursorsContainer/LeftToolIconCheckbox",
|
2021-11-25 12:48:30 +00:00
|
|
|
"pressed",
|
|
|
|
Global.show_left_tool_icon
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"show_right_tool_icon",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors/CursorsContainer/RightToolIconCheckbox",
|
2021-11-25 12:48:30 +00:00
|
|
|
"pressed",
|
|
|
|
Global.show_right_tool_icon
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"left_square_indicator_visible",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors/CursorsContainer/LeftIndicatorCheckbox",
|
2021-11-25 12:48:30 +00:00
|
|
|
"pressed",
|
|
|
|
Global.left_square_indicator_visible
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"right_square_indicator_visible",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors/CursorsContainer/RightIndicatorCheckbox",
|
2021-11-25 12:48:30 +00:00
|
|
|
"pressed",
|
|
|
|
Global.right_square_indicator_visible
|
|
|
|
],
|
2022-02-10 20:32:55 +00:00
|
|
|
[
|
|
|
|
"native_cursors",
|
|
|
|
"Cursors/CursorsContainer/NativeCursorsCheckbox",
|
|
|
|
"pressed",
|
|
|
|
Global.native_cursors
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"cross_cursor",
|
|
|
|
"Cursors/CursorsContainer/CrossCursorCheckbox",
|
|
|
|
"pressed",
|
|
|
|
Global.cross_cursor
|
|
|
|
],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"autosave_interval",
|
|
|
|
"Backup/AutosaveContainer/AutosaveInterval",
|
|
|
|
"value",
|
|
|
|
Global.autosave_interval
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"enable_autosave",
|
|
|
|
"Backup/AutosaveContainer/EnableAutosave",
|
|
|
|
"pressed",
|
|
|
|
Global.enable_autosave
|
|
|
|
],
|
2021-12-01 18:50:50 +00:00
|
|
|
["default_width", "Image/ImageOptions/ImageDefaultWidth", "value", Global.default_width],
|
|
|
|
["default_height", "Image/ImageOptions/ImageDefaultHeight", "value", Global.default_height],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"default_fill_color",
|
|
|
|
"Image/ImageOptions/DefaultFillColor",
|
|
|
|
"color",
|
|
|
|
Global.default_fill_color
|
|
|
|
],
|
2021-06-04 18:44:05 +00:00
|
|
|
["smooth_zoom", "Canvas/ZoomOptions/SmoothZoom", "pressed", Global.smooth_zoom],
|
2020-08-19 21:12:07 +00:00
|
|
|
["grid_type", "Canvas/GridOptions/GridType", "selected", Global.grid_type],
|
2020-07-29 00:16:02 +00:00
|
|
|
["grid_width", "Canvas/GridOptions/GridWidthValue", "value", Global.grid_width],
|
|
|
|
["grid_height", "Canvas/GridOptions/GridHeightValue", "value", Global.grid_height],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"grid_isometric_cell_bounds_width",
|
|
|
|
"Canvas/GridOptions/IsometricCellBoundsWidthValue",
|
|
|
|
"value",
|
|
|
|
Global.grid_isometric_cell_bounds_width
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"grid_isometric_cell_bounds_height",
|
|
|
|
"Canvas/GridOptions/IsometricCellBoundsHeightValue",
|
|
|
|
"value",
|
|
|
|
Global.grid_isometric_cell_bounds_height
|
|
|
|
],
|
2021-01-20 00:17:33 +00:00
|
|
|
["grid_offset_x", "Canvas/GridOptions/GridOffsetXValue", "value", Global.grid_offset_x],
|
|
|
|
["grid_offset_y", "Canvas/GridOptions/GridOffsetYValue", "value", Global.grid_offset_y],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"grid_draw_over_tile_mode",
|
|
|
|
"Canvas/GridOptions/GridDrawOverTileMode",
|
|
|
|
"pressed",
|
|
|
|
Global.grid_draw_over_tile_mode
|
|
|
|
],
|
2020-07-29 00:16:02 +00:00
|
|
|
["grid_color", "Canvas/GridOptions/GridColor", "color", Global.grid_color],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"pixel_grid_show_at_zoom",
|
|
|
|
"Canvas/PixelGridOptions/ShowAtZoom",
|
|
|
|
"value",
|
|
|
|
Global.pixel_grid_show_at_zoom
|
|
|
|
],
|
2021-01-16 18:24:46 +00:00
|
|
|
["pixel_grid_color", "Canvas/PixelGridOptions/GridColor", "color", Global.pixel_grid_color],
|
2020-07-29 00:16:02 +00:00
|
|
|
["guide_color", "Canvas/GuideOptions/GuideColor", "color", Global.guide_color],
|
|
|
|
["checker_size", "Canvas/CheckerOptions/CheckerSizeValue", "value", Global.checker_size],
|
|
|
|
["checker_color_1", "Canvas/CheckerOptions/CheckerColor1", "color", Global.checker_color_1],
|
|
|
|
["checker_color_2", "Canvas/CheckerOptions/CheckerColor2", "color", Global.checker_color_2],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"checker_follow_movement",
|
|
|
|
"Canvas/CheckerOptions/CheckerFollowMovement",
|
|
|
|
"pressed",
|
|
|
|
Global.checker_follow_movement
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"checker_follow_scale",
|
|
|
|
"Canvas/CheckerOptions/CheckerFollowScale",
|
|
|
|
"pressed",
|
|
|
|
Global.checker_follow_scale
|
|
|
|
],
|
2020-10-25 23:10:14 +00:00
|
|
|
["tilemode_opacity", "Canvas/CheckerOptions/TileModeOpacity", "value", Global.tilemode_opacity],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
|
|
|
"selection_animated_borders",
|
|
|
|
"Selection/SelectionOptions/Animate",
|
|
|
|
"pressed",
|
|
|
|
Global.selection_animated_borders
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"selection_border_color_1",
|
|
|
|
"Selection/SelectionOptions/BorderColor1",
|
|
|
|
"color",
|
|
|
|
Global.selection_border_color_1
|
|
|
|
],
|
|
|
|
[
|
|
|
|
"selection_border_color_2",
|
|
|
|
"Selection/SelectionOptions/BorderColor2",
|
|
|
|
"color",
|
|
|
|
Global.selection_border_color_2
|
|
|
|
],
|
2021-01-05 18:01:50 +00:00
|
|
|
["fps_limit", "Performance/PerformanceContainer/SetFPSLimit", "value", Global.fps_limit],
|
2021-11-25 12:48:30 +00:00
|
|
|
[
|
2021-12-11 18:02:51 +00:00
|
|
|
"pause_when_unfocused",
|
|
|
|
"Performance/PerformanceContainer/PauseAppFocus",
|
2021-11-25 12:48:30 +00:00
|
|
|
"pressed",
|
2021-12-11 18:02:51 +00:00
|
|
|
Global.pause_when_unfocused
|
2021-11-25 12:48:30 +00:00
|
|
|
],
|
2020-05-31 20:04:59 +00:00
|
|
|
]
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2020-06-25 19:27:08 +00:00
|
|
|
var selected_item := 0
|
2021-11-25 12:48:30 +00:00
|
|
|
var restore_default_button_tcsn = preload("res://src/Preferences/RestoreDefaultButton.tscn")
|
2020-06-25 19:27:08 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
onready var list: ItemList = $HSplitContainer/List
|
|
|
|
onready var right_side: VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer
|
|
|
|
onready var autosave_interval: SpinBox = right_side.get_node(
|
|
|
|
"Backup/AutosaveContainer/AutosaveInterval"
|
|
|
|
)
|
|
|
|
onready var shrink_label: Label = right_side.get_node("Interface/ShrinkContainer/ShrinkLabel")
|
|
|
|
onready var themes: BoxContainer = right_side.get_node("Interface/Themes")
|
2020-05-31 21:44:53 +00:00
|
|
|
|
|
|
|
|
2019-12-20 14:36:23 +00:00
|
|
|
func _ready() -> void:
|
2021-11-25 12:48:30 +00:00
|
|
|
# Replace OK since preference changes are being applied immediately, not after OK confirmation
|
2020-04-30 17:33:24 +00:00
|
|
|
get_ok().text = tr("Close")
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2020-06-25 20:25:46 +00:00
|
|
|
if OS.get_name() == "HTML5":
|
2020-07-28 22:54:15 +00:00
|
|
|
right_side.get_node("Startup").queue_free()
|
|
|
|
right_side.get_node("Languages").visible = true
|
2020-06-25 20:25:46 +00:00
|
|
|
Global.open_last_project = false
|
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
for pref in preferences:
|
|
|
|
var node = right_side.get_node(pref[1])
|
2020-07-29 00:16:02 +00:00
|
|
|
var node_position = node.get_index()
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
var restore_default_button: BaseButton = restore_default_button_tcsn.instance()
|
2020-07-29 00:16:02 +00:00
|
|
|
restore_default_button.setting_name = pref[0]
|
|
|
|
restore_default_button.value_type = pref[2]
|
|
|
|
restore_default_button.default_value = pref[3]
|
|
|
|
restore_default_button.node = node
|
|
|
|
node.get_parent().add_child(restore_default_button)
|
|
|
|
node.get_parent().move_child(restore_default_button, node_position)
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
match pref[2]:
|
|
|
|
"pressed":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"toggled",
|
|
|
|
self,
|
|
|
|
"_on_Preference_toggled",
|
|
|
|
[pref[0], pref[3], restore_default_button]
|
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"value":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"value_changed",
|
|
|
|
self,
|
|
|
|
"_on_Preference_value_changed",
|
|
|
|
[pref[0], pref[3], restore_default_button]
|
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"color":
|
|
|
|
node.get_picker().presets_visible = false
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"color_changed",
|
|
|
|
self,
|
|
|
|
"_on_Preference_color_changed",
|
|
|
|
[pref[0], pref[3], restore_default_button]
|
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
"selected":
|
2021-11-25 12:48:30 +00:00
|
|
|
node.connect(
|
|
|
|
"item_selected",
|
|
|
|
self,
|
|
|
|
"_on_Preference_item_selected",
|
|
|
|
[pref[0], pref[3], restore_default_button]
|
|
|
|
)
|
2020-05-31 20:04:59 +00:00
|
|
|
|
2020-06-04 11:42:23 +00:00
|
|
|
if Global.config_cache.has_section_key("preferences", pref[0]):
|
|
|
|
var value = Global.config_cache.get_value("preferences", pref[0])
|
|
|
|
Global.set(pref[0], value)
|
|
|
|
node.set(pref[2], value)
|
2020-04-11 02:36:51 +00:00
|
|
|
|
2020-07-29 00:16:02 +00:00
|
|
|
# This is needed because color_changed doesn't fire if the color changes in code
|
|
|
|
if pref[2] == "color":
|
|
|
|
preference_update(pref[0])
|
2021-11-25 12:48:30 +00:00
|
|
|
disable_restore_default_button(
|
|
|
|
restore_default_button, Global.get(pref[0]).is_equal_approx(pref[3])
|
|
|
|
)
|
2020-08-19 21:12:07 +00:00
|
|
|
elif pref[2] == "selected":
|
|
|
|
preference_update(pref[0])
|
2021-11-25 12:48:30 +00:00
|
|
|
disable_restore_default_button(
|
|
|
|
restore_default_button, Global.get(pref[0]) == pref[3]
|
|
|
|
)
|
2020-07-29 00:16:02 +00:00
|
|
|
|
2020-02-11 17:45:36 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_Preference_toggled(
|
|
|
|
button_pressed: bool, prop: String, default_value, restore_default_button: BaseButton
|
|
|
|
) -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.set(prop, button_pressed)
|
|
|
|
Global.config_cache.set_value("preferences", prop, button_pressed)
|
|
|
|
preference_update(prop)
|
2020-07-29 00:16:02 +00:00
|
|
|
disable_restore_default_button(restore_default_button, Global.get(prop) == default_value)
|
2020-04-30 17:33:24 +00:00
|
|
|
|
2020-01-09 22:12:36 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_Preference_value_changed(
|
|
|
|
value: float, prop: String, default_value, restore_default_button: BaseButton
|
|
|
|
) -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.set(prop, value)
|
|
|
|
Global.config_cache.set_value("preferences", prop, value)
|
|
|
|
preference_update(prop)
|
2020-07-29 00:16:02 +00:00
|
|
|
disable_restore_default_button(restore_default_button, Global.get(prop) == default_value)
|
2020-01-09 22:12:36 +00:00
|
|
|
|
2020-04-18 07:03:18 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_Preference_color_changed(
|
|
|
|
color: Color, prop: String, default_value, restore_default_button: BaseButton
|
|
|
|
) -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.set(prop, color)
|
|
|
|
Global.config_cache.set_value("preferences", prop, color)
|
|
|
|
preference_update(prop)
|
2021-11-25 12:48:30 +00:00
|
|
|
disable_restore_default_button(
|
|
|
|
restore_default_button, Global.get(prop).is_equal_approx(default_value)
|
|
|
|
)
|
2020-04-18 07:03:18 +00:00
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_Preference_item_selected(
|
|
|
|
id: int, prop: String, default_value, restore_default_button: BaseButton
|
|
|
|
) -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.set(prop, id)
|
|
|
|
Global.config_cache.set_value("preferences", prop, id)
|
|
|
|
preference_update(prop)
|
2020-07-29 00:16:02 +00:00
|
|
|
disable_restore_default_button(restore_default_button, Global.get(prop) == default_value)
|
2020-04-20 16:12:22 +00:00
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func preference_update(prop: String) -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
if prop in ["autosave_interval", "enable_autosave"]:
|
|
|
|
OpenSave.update_autosave()
|
2020-07-28 22:54:15 +00:00
|
|
|
autosave_interval.editable = Global.enable_autosave
|
|
|
|
if autosave_interval.editable:
|
|
|
|
autosave_interval.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
else:
|
|
|
|
autosave_interval.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
if (
|
|
|
|
prop
|
|
|
|
in [
|
|
|
|
"grid_type",
|
|
|
|
"grid_width",
|
|
|
|
"grid_height",
|
|
|
|
"grid_isometric_cell_bounds_width",
|
|
|
|
"grid_isometric_cell_bounds_height",
|
|
|
|
"grid_offset_x",
|
|
|
|
"grid_offset_y",
|
|
|
|
"grid_draw_over_tile_mode",
|
|
|
|
"grid_color"
|
|
|
|
]
|
|
|
|
):
|
2020-08-17 19:54:33 +00:00
|
|
|
Global.canvas.grid.update()
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2021-01-16 18:24:46 +00:00
|
|
|
if prop in ["pixel_grid_show_at_zoom", "pixel_grid_color"]:
|
|
|
|
Global.canvas.pixel_grid.update()
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
if (
|
|
|
|
prop
|
|
|
|
in [
|
|
|
|
"checker_size",
|
|
|
|
"checker_color_1",
|
|
|
|
"checker_color_2",
|
|
|
|
"checker_follow_movement",
|
|
|
|
"checker_follow_scale"
|
|
|
|
]
|
|
|
|
):
|
|
|
|
Global.transparent_checker.update_rect()
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
if prop in ["guide_color"]:
|
2020-06-02 23:14:24 +00:00
|
|
|
for guide in Global.canvas.get_children():
|
2021-11-16 23:48:21 +00:00
|
|
|
if guide is SymmetryGuide:
|
|
|
|
# Add a subtle difference to the normal guide color by mixing in some blue
|
2021-11-25 12:48:30 +00:00
|
|
|
guide.default_color = Global.guide_color.linear_interpolate(
|
|
|
|
Color(0.2, 0.2, .65), .6
|
|
|
|
)
|
2021-11-16 23:48:21 +00:00
|
|
|
elif guide is Guide:
|
2020-06-02 23:14:24 +00:00
|
|
|
guide.default_color = Global.guide_color
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2021-01-05 18:01:50 +00:00
|
|
|
if prop in ["fps_limit"]:
|
|
|
|
Engine.set_target_fps(Global.fps_limit)
|
2021-10-02 12:08:58 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
if (
|
|
|
|
prop
|
|
|
|
in ["selection_animated_borders", "selection_border_color_1", "selection_border_color_2"]
|
|
|
|
):
|
|
|
|
Global.canvas.selection.marching_ants_outline.material.set_shader_param(
|
|
|
|
"animated", Global.selection_animated_borders
|
|
|
|
)
|
|
|
|
Global.canvas.selection.marching_ants_outline.material.set_shader_param(
|
|
|
|
"first_color", Global.selection_border_color_1
|
|
|
|
)
|
|
|
|
Global.canvas.selection.marching_ants_outline.material.set_shader_param(
|
|
|
|
"second_color", Global.selection_border_color_2
|
|
|
|
)
|
2021-05-28 00:46:16 +00:00
|
|
|
Global.canvas.selection.update()
|
|
|
|
|
2021-06-04 18:44:05 +00:00
|
|
|
if prop in ["icon_color_from", "custom_icon_color"]:
|
|
|
|
if Global.icon_color_from == Global.IconColorFrom.THEME:
|
2022-02-17 18:36:10 +00:00
|
|
|
var current_theme: Theme = themes.themes[themes.theme_index]
|
|
|
|
Global.modulate_icon_color = current_theme.get_color("modulate_color", "Icons")
|
2021-06-04 18:44:05 +00:00
|
|
|
else:
|
|
|
|
Global.modulate_icon_color = Global.custom_icon_color
|
|
|
|
themes.change_icon_colors()
|
|
|
|
|
2021-06-13 23:14:31 +00:00
|
|
|
if prop == "tool_button_size":
|
|
|
|
Tools.set_button_size(Global.tool_button_size)
|
|
|
|
|
2022-02-10 20:32:55 +00:00
|
|
|
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
|
|
|
|
|
2020-05-31 20:04:59 +00:00
|
|
|
Global.config_cache.save("user://cache.ini")
|
2020-02-15 05:34:42 +00:00
|
|
|
|
2020-04-07 22:56:05 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func disable_restore_default_button(button: BaseButton, disable: bool) -> void:
|
2020-07-29 00:16:02 +00:00
|
|
|
button.disabled = disable
|
|
|
|
if disable:
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_ARROW
|
|
|
|
button.hint_tooltip = ""
|
|
|
|
else:
|
|
|
|
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
|
|
|
button.hint_tooltip = "Restore default value"
|
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_PreferencesDialog_about_to_show() -> void:
|
|
|
|
add_tabs(false)
|
|
|
|
|
|
|
|
|
|
|
|
func add_tabs(changed_language := false) -> void:
|
2020-07-28 22:54:15 +00:00
|
|
|
if OS.get_name() != "HTML5":
|
|
|
|
list.add_item(" " + tr("Startup"))
|
2020-05-31 20:04:59 +00:00
|
|
|
list.add_item(" " + tr("Language"))
|
2020-11-08 23:52:53 +00:00
|
|
|
list.add_item(" " + tr("Interface"))
|
2020-05-31 20:04:59 +00:00
|
|
|
list.add_item(" " + tr("Canvas"))
|
2021-05-28 00:46:16 +00:00
|
|
|
list.add_item(" " + tr("Selection"))
|
2020-05-31 20:04:59 +00:00
|
|
|
list.add_item(" " + tr("Image"))
|
|
|
|
list.add_item(" " + tr("Shortcuts"))
|
2020-07-28 22:54:15 +00:00
|
|
|
list.add_item(" " + tr("Backup"))
|
2021-01-05 18:01:50 +00:00
|
|
|
list.add_item(" " + tr("Performance"))
|
2022-02-10 20:32:55 +00:00
|
|
|
list.add_item(" " + tr("Cursors"))
|
2020-05-31 20:43:24 +00:00
|
|
|
|
2020-06-25 19:27:08 +00:00
|
|
|
list.select(1 if changed_language else selected_item)
|
2020-07-28 22:54:15 +00:00
|
|
|
autosave_interval.suffix = tr("minute(s)")
|
2020-05-05 13:03:32 +00:00
|
|
|
|
2019-12-27 00:12:26 +00:00
|
|
|
|
2019-12-31 23:27:34 +00:00
|
|
|
func _on_PreferencesDialog_popup_hide() -> void:
|
2020-05-31 20:04:59 +00:00
|
|
|
list.clear()
|
2019-12-20 14:36:23 +00:00
|
|
|
|
2020-04-07 22:56:05 +00:00
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_List_item_selected(index: int) -> void:
|
2020-06-25 19:27:08 +00:00
|
|
|
selected_item = index
|
2019-12-26 23:02:36 +00:00
|
|
|
for child in right_side.get_children():
|
2021-11-25 12:48:30 +00:00
|
|
|
var content_list = [
|
|
|
|
"Startup",
|
|
|
|
"Languages",
|
|
|
|
"Interface",
|
|
|
|
"Canvas",
|
|
|
|
"Selection",
|
|
|
|
"Image",
|
|
|
|
"Shortcuts",
|
|
|
|
"Backup",
|
|
|
|
"Performance",
|
2022-02-10 20:32:55 +00:00
|
|
|
"Cursors"
|
2021-11-25 12:48:30 +00:00
|
|
|
]
|
2020-07-28 22:54:15 +00:00
|
|
|
if OS.get_name() == "HTML5":
|
|
|
|
content_list.erase("Startup")
|
|
|
|
child.visible = child.name == content_list[index]
|
2020-11-07 01:57:35 +00:00
|
|
|
|
|
|
|
|
2021-11-25 12:48:30 +00:00
|
|
|
func _on_ShrinkHSlider_value_changed(value: float) -> void:
|
2020-11-07 01:57:35 +00:00
|
|
|
shrink_label.text = str(value)
|
|
|
|
|
|
|
|
|
2020-11-09 23:32:27 +00:00
|
|
|
func _on_ShrinkApplyButton_pressed() -> void:
|
2021-11-25 12:48:30 +00:00
|
|
|
get_tree().set_screen_stretch(
|
|
|
|
SceneTree.STRETCH_MODE_DISABLED,
|
|
|
|
SceneTree.STRETCH_ASPECT_IGNORE,
|
|
|
|
Vector2(1024, 576),
|
|
|
|
Global.shrink
|
|
|
|
)
|
2020-11-09 23:32:27 +00:00
|
|
|
hide()
|
|
|
|
popup_centered(Vector2(400, 280))
|
|
|
|
Global.dialog_open(true)
|
|
|
|
yield(Global.get_tree().create_timer(0.01), "timeout")
|
|
|
|
Global.camera.fit_to_frame(Global.current_project.size)
|