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

Add a preference to change max undo steps

This commit is contained in:
Emmanouil Papadeas 2024-08-16 14:28:54 +03:00
parent 19574bca7d
commit b0aabe4e8a
5 changed files with 33 additions and 9 deletions

View file

@ -1650,6 +1650,10 @@ msgstr ""
msgid "Sets the limit of the application's frames per second. The lower the number, the lower the CPU usage, but the application gets slower, choppier and unresponsive. 0 means that there is no limit."
msgstr ""
#. Found in the Preferences, under the Performance section. Changes the value of the maximum undo steps projects can use.
msgid "Max undo steps:"
msgstr ""
#. An option found in the preferences, under the Performance section.
msgid "Pause application when it loses focus"
msgstr ""

View file

@ -466,13 +466,21 @@ var selection_border_color_2 := Color.BLACK:
## Found in Preferences. If [code]true[/code], Pixelorama pauses when unfocused to save cpu usage.
var pause_when_unfocused := true
## Found in Preferences. The max fps, Pixelorama is allowed to use (does not limit fps if it is 0).
## Found in Preferences. The maximum FPS value Pixelorama can reach. 0 means no limit.
var fps_limit := 0:
set(value):
if value == fps_limit:
return
fps_limit = value
Engine.max_fps = fps_limit
## Found in Preferences. The maximum amount of undo steps projects can use. 0 means no limit.
var max_undo_steps := 0:
set(value):
if value == max_undo_steps:
return
max_undo_steps = value
for project in projects:
project.undo_redo.max_steps = max_undo_steps
## Found in Preferences. Affects the per_pixel_transparency project setting.
## If [code]true[/code], it allows for the window to be transparent.
## This affects performance, so keep it [code]false[/code] if you don't need it.

View file

@ -93,6 +93,7 @@ func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2
tiles = Tiles.new(size)
selection_map.copy_from(Image.create(size.x, size.y, false, Image.FORMAT_LA8))
Global.tabs.add_tab(name)
undo_redo.max_steps = Global.max_undo_steps
x_symmetry_point = size.x - 1
y_symmetry_point = size.y - 1

View file

@ -169,6 +169,7 @@ var preferences: Array[Preference] = [
"selection_border_color_2", "Selection/SelectionOptions/BorderColor2", "color", Color.BLACK
),
Preference.new("fps_limit", "Performance/PerformanceContainer/SetFPSLimit", "value", 0),
Preference.new("max_undo_steps", "Performance/PerformanceContainer/MaxUndoSteps", "value", 0),
Preference.new(
"pause_when_unfocused",
"Performance/PerformanceContainer/PauseAppFocus",

View file

@ -295,10 +295,9 @@ text = "Tool button size:"
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Small"
popup/item_0/id = 0
popup/item_1/text = "Big"
popup/item_1/id = 1
@ -309,10 +308,9 @@ text = "Icon color from:"
[node name="IconColorOptionButton" type="OptionButton" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Interface/ButtonOptions"]
layout_mode = 2
mouse_default_cursor_shape = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Theme"
popup/item_0/id = 0
popup/item_1/text = "Custom"
popup/item_1/id = 1
@ -508,10 +506,9 @@ layout_mode = 2
size_flags_horizontal = 3
tooltip_text = "Sets the type of the grid between rectangular, isometric or both"
mouse_default_cursor_shape = 2
item_count = 3
selected = 0
item_count = 3
popup/item_0/text = "Rectangular"
popup/item_0/id = 0
popup/item_1/text = "Isometric"
popup/item_1/id = 1
popup/item_2/text = "All"
@ -803,10 +800,9 @@ text = "Background color from:"
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 2
selected = 0
item_count = 2
popup/item_0/text = "Theme"
popup/item_0/id = 0
popup/item_1/text = "Custom"
popup/item_1/id = 1
@ -1043,6 +1039,20 @@ tooltip_text = "Sets the limit of the application's frames per second. The lower
mouse_default_cursor_shape = 2
max_value = 144.0
[node name="MaxUndoStepsLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
layout_mode = 2
size_flags_horizontal = 3
mouse_filter = 0
text = "Max undo steps:"
[node name="MaxUndoSteps" type="SpinBox" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
custom_minimum_size = Vector2(95, 0)
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
max_value = 1000.0
allow_greater = true
[node name="PauseAppFocusLabel" type="Label" parent="HSplitContainer/VBoxContainer/ScrollContainer/RightSide/Performance/PerformanceContainer"]
layout_mode = 2
tooltip_text = "If this is toggled on, when the application's window loses focus, it gets paused. This helps lower CPU usage when idle. The application gets unpaused when the mouse enters the application's window."