Skip to content

Commit 0c50651

Browse files
Sync with upstream and some theme fixes (#45)
1 parent b3fba75 commit 0c50651

88 files changed

Lines changed: 2431 additions & 1313 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

app_info.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

app_info.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
project_founder_and_manager = "Anish Mishra"
2+
authors = [
3+
"Anish Mishra (syntaxerror247)"
4+
]
5+
6+
donors = []
7+
anonymous_donors = 0
8+
golden_donors = []
9+
anonymous_golden_donors = 0
10+
11+
diamond_donors = []
12+
anonymous_diamond_donors = 0
13+
14+
past_donors = []
15+
past_anonymous_donors = 0
16+
past_golden_donors = []
17+
past_anonymous_golden_donors = 0
18+
past_diamond_donors = []
19+
past_anonymous_diamond_donors = 0

godot_only/scripts/tests.gd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ func _run() -> void:
1515
for report_line in report:
1616
print_rich(report_line)
1717

18-
1918
func add_to_report(test_category: String, test: String, result: String,
2019
expected: String) -> void:
2120
report.append('%s: [b]"%s"[/b] returned [b]"%s"[/b], expected [b]"%s"[/b]' %\
2221
[test_category, test, result, expected])
2322

23+
2424
# This test is dependent on specifics of the Formatter and AttributePathdata classes.
2525
# But its logic would likely not change enough in the future to make the tests obsolete.
2626
# https://www.w3.org/TR/SVG11/paths.html#PathDataBNF
@@ -103,6 +103,6 @@ func transform_list_tests() -> void:
103103
}
104104

105105
for test in tests:
106-
var result := AttributeTransformList.new("transform")._format(test, spacious_formatter)
106+
var result := AttributeTransformList.new("transform").format(test, spacious_formatter)
107107
if result != tests[test]:
108108
add_to_report("Transform list parser", test, result, tests[test])

godot_only/scripts/update_translations.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func populate_delimiters() -> void:
3838
for method in ["translate"]:
3939
for quote in ["'", '"', '"""']:
4040
delimiters["Translator." + method + "(" + quote] = quote + ")"
41-
for i in range(2, 8):
41+
for i in range(2, 10):
4242
delimiters["Translator." + method + "(\n" + "\t".repeat(i) + quote] = quote + ")"
4343

4444
var messages: Array[Message] = [Message.new("translation-credits", PackedStringArray())]

project.godot

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ HandlerGUI="*res://src/autoload/HandlerGUI.gd"
3636

3737
window/size/viewport_width=480
3838
window/size/viewport_height=854
39-
window/energy_saving/keep_screen_on=false
4039
window/handheld/orientation=6
4140
mouse_cursor/tooltip_position_offset=Vector2(0, 10)
4241

src/autoload/Configs.gd

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,10 @@ func post_load() -> void:
9696
sync_canvas_color()
9797
sync_locale()
9898
sync_max_fps()
99+
sync_keep_screen_on()
99100
sync_theme()
100101

101102

102-
func generate_highlighter() -> SVGHighlighter:
103-
var new_highlighter := SVGHighlighter.new()
104-
new_highlighter.symbol_color = Configs.savedata.highlighting_symbol_color
105-
new_highlighter.element_color = Configs.savedata.highlighting_element_color
106-
new_highlighter.attribute_color = Configs.savedata.highlighting_attribute_color
107-
new_highlighter.string_color = Configs.savedata.highlighting_string_color
108-
new_highlighter.comment_color = Configs.savedata.highlighting_comment_color
109-
new_highlighter.text_color = Configs.savedata.highlighting_text_color
110-
new_highlighter.cdata_color = Configs.savedata.highlighting_cdata_color
111-
new_highlighter.error_color = Configs.savedata.highlighting_error_color
112-
return new_highlighter
113-
114-
115103
# Global effects from settings. Some of them should also be used on launch.
116104

117105
func sync_canvas_color() -> void:
@@ -130,6 +118,9 @@ func sync_vsync() -> void:
130118
func sync_max_fps() -> void:
131119
Engine.max_fps = savedata.max_fps
132120

121+
func sync_keep_screen_on() -> void:
122+
DisplayServer.screen_set_keep_on(savedata.keep_screen_on)
123+
133124
func sync_theme() -> void:
134125
ThemeUtils.generate_and_apply_theme()
135126
theme_changed.emit()

src/autoload/State.gd

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,9 @@ func get_selection_context(popup_method: Callable, context: Utils.LayoutPart) ->
756756
btn_arr.append(ContextPopup.create_shortcut_button("duplicate"))
757757

758758
var xnode := root_element.get_xnode(selected_xids[0])
759-
if selected_xids.size() == 1 and ((not xnode.is_element() and\
760-
xnode.get_type() != BasicXNode.NodeType.UNKNOWN) or (xnode.is_element() and\
761-
not xnode.possible_conversions.is_empty())):
762-
btn_arr.append(ContextPopup.create_button(
763-
Translator.translate("Convert To"),
759+
if selected_xids.size() == 1 and (not xnode.is_element() or\
760+
(xnode.is_element() and not xnode.possible_conversions.is_empty())):
761+
btn_arr.append(ContextPopup.create_button(Translator.translate("Convert To"),
764762
popup_convert_to_context.bind(popup_method), false,
765763
load("res://assets/icons/Reload.svg")))
766764

src/config_classes/Formatter.gd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static func get_enum_value_text_map(property: String) -> Dictionary:
5353

5454
func get_setting_default(setting: String) -> Variant:
5555
match setting:
56-
"xml_keep_unrecognized": return false
5756
"xml_add_trailing_newline": return false
5857
"xml_indentation_use_spaces": return false
5958
"xml_indentation_spaces": return 2
@@ -115,12 +114,6 @@ func _init(new_preset := Preset.COMPACT) -> void:
115114
xml_keep_comments = new_value
116115
emit_changed()
117116

118-
@export var xml_keep_unrecognized := false:
119-
set(new_value):
120-
if xml_keep_unrecognized != new_value:
121-
xml_keep_unrecognized = new_value
122-
emit_changed()
123-
124117
@export var xml_add_trailing_newline := false:
125118
set(new_value):
126119
if xml_add_trailing_newline != new_value:
@@ -245,3 +238,10 @@ const INDENTS_MAX = 16
245238
if transform_list_remove_unnecessary_params != new_value:
246239
transform_list_remove_unnecessary_params = new_value
247240
emit_changed()
241+
242+
243+
func get_indent_string() -> String:
244+
if xml_indentation_use_spaces:
245+
return " ".repeat(xml_indentation_spaces)
246+
else:
247+
return "\t"

src/config_classes/SVGHighlighter.gd

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@ var attribute_color := Color("bce0ff"):
2020
unrecognized_attribute_color = Color(new_value, new_value.a * 0.7)
2121

2222

23+
func _init() -> void:
24+
symbol_color = Configs.savedata.highlighting_symbol_color
25+
element_color = Configs.savedata.highlighting_element_color
26+
attribute_color = Configs.savedata.highlighting_attribute_color
27+
string_color = Configs.savedata.highlighting_string_color
28+
comment_color = Configs.savedata.highlighting_comment_color
29+
text_color = Configs.savedata.highlighting_text_color
30+
cdata_color = Configs.savedata.highlighting_cdata_color
31+
error_color = Configs.savedata.highlighting_error_color
32+
2333
func _get_line_syntax_highlighting(line: int) -> Dictionary:
2434
var svg_text := get_text_edit().get_line(line)
2535
if svg_text.is_empty():
@@ -66,13 +76,13 @@ func _get_line_syntax_highlighting(line: int) -> Dictionary:
6676
color_map[offset] = {"color": symbol_color}
6777
break
6878
else:
69-
if not expecting_attribute_name:
70-
color_map[offset] = {"color": error_color}
71-
return color_map
72-
else:
73-
expecting_end = false
79+
if expecting_attribute_name and c != "=":
7480
expecting_attribute_name = false
81+
expecting_end = false
7582
current_attribute_name += c
83+
else:
84+
color_map[offset] = {"color": error_color}
85+
return color_map
7686
elif not current_attribute_name.is_empty():
7787
if c in " \t\n\r":
7888
color_map[offset - current_attribute_name.length()] = {"color":

src/config_classes/SaveData.gd

Lines changed: 29 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func get_setting_default(setting: String) -> Variant:
2020
"accent_color":
2121
match theme_preset:
2222
ThemePreset.DARK: return Color("3e8cfc")
23-
ThemePreset.LIGHT: return Color("0830a6ff")
23+
ThemePreset.LIGHT: return Color("0031bf")
2424
ThemePreset.BLACK: return Color("7c8dbf")
2525
"highlighter_preset":
2626
match theme_preset:
@@ -68,7 +68,7 @@ func get_setting_default(setting: String) -> Variant:
6868
ThemePreset.LIGHT: return Color("b22")
6969
"basic_color_warning":
7070
match theme_preset:
71-
ThemePreset.DARK,ThemePreset.BLACK: return Color("ee5")
71+
ThemePreset.DARK,ThemePreset.BLACK: return Color("ee6")
7272
ThemePreset.LIGHT: return Color("991")
7373
"handle_size": return 1.0 if OS.get_name() != "Android" else 2.0
7474
"handle_inner_color": return Color("fff")
@@ -94,21 +94,24 @@ func get_setting_default(setting: String) -> Variant:
9494
"invert_zoom": return false
9595
"wraparound_panning": return false
9696
"use_ctrl_for_zoom": return true
97-
"use_native_file_dialog": return true
98-
"use_filename_for_window_title": return true
9997
"ui_scale": return ScalingApproach.AUTO
10098
"vsync": return true
10199
"max_fps": return 0
100+
"keep_screen_on": return false
101+
"use_native_file_dialog": return true
102+
"use_filename_for_window_title": return true
102103
return null
103104

104105
func reset_to_default() -> void:
105106
for setting in _get_setting_names():
106107
set(setting, get_setting_default(setting))
107108

108109
func reset_theme_items_to_default() -> void:
110+
var old_highlighter_preset_value := highlighter_preset
109111
for setting in theme_items:
110112
set(setting, get_setting_default(setting))
111-
reset_highlighting_items_to_default()
113+
if old_highlighter_preset_value != highlighter_preset:
114+
reset_highlighting_items_to_default()
112115

113116
func reset_highlighting_items_to_default() -> void:
114117
for setting in highlighting_items:
@@ -129,17 +132,6 @@ const theme_items: PackedStringArray = [
129132
"basic_color_valid",
130133
"basic_color_error",
131134
"basic_color_warning",
132-
"handle_size",
133-
"handle_inner_color",
134-
"handle_color",
135-
"handle_hovered_color",
136-
"handle_selected_color",
137-
"handle_hovered_selected_color",
138-
"selection_rectangle_speed",
139-
"selection_rectangle_width",
140-
"selection_rectangle_dash_length",
141-
"selection_rectangle_color1",
142-
"selection_rectangle_color2",
143135
"canvas_color",
144136
"grid_color",
145137
]
@@ -326,7 +318,7 @@ const CURRENT_VERSION = 1
326318
emit_changed()
327319
Configs.basic_colors_changed.emit()
328320

329-
@export var basic_color_warning := Color("ee5"):
321+
@export var basic_color_warning := Color("ee6"):
330322
set(new_value):
331323
if basic_color_warning != new_value:
332324
basic_color_warning = new_value
@@ -485,19 +477,6 @@ const MAX_SELECTION_RECTANGLE_DASH_LENGTH = 600.0
485477
use_ctrl_for_zoom = new_value
486478
emit_changed()
487479

488-
@export var use_native_file_dialog := true:
489-
set(new_value):
490-
if use_native_file_dialog != new_value:
491-
use_native_file_dialog = new_value
492-
emit_changed()
493-
494-
@export var use_filename_for_window_title := true:
495-
set(new_value):
496-
if use_filename_for_window_title != new_value:
497-
use_filename_for_window_title = new_value
498-
emit_changed()
499-
external_call(HandlerGUI.update_window_title)
500-
501480
enum ScalingApproach {AUTO, CONSTANT_075, CONSTANT_100, CONSTANT_125, CONSTANT_150,
502481
CONSTANT_175, CONSTANT_200, CONSTANT_225, CONSTANT_250, CONSTANT_275, CONSTANT_300, CONSTANT_400, MAX}
503482
@export var ui_scale := ScalingApproach.AUTO:
@@ -533,6 +512,26 @@ const MAX_FPS_MAX = 600
533512
emit_changed()
534513
external_call(Configs.sync_max_fps)
535514

515+
@export var keep_screen_on := false:
516+
set(new_value):
517+
if keep_screen_on != new_value:
518+
keep_screen_on = new_value
519+
emit_changed()
520+
external_call(Configs.sync_keep_screen_on)
521+
522+
@export var use_native_file_dialog := true:
523+
set(new_value):
524+
if use_native_file_dialog != new_value:
525+
use_native_file_dialog = new_value
526+
emit_changed()
527+
528+
@export var use_filename_for_window_title := true:
529+
set(new_value):
530+
if use_filename_for_window_title != new_value:
531+
use_filename_for_window_title = new_value
532+
emit_changed()
533+
external_call(HandlerGUI.update_window_title)
534+
536535

537536
# Session
538537

0 commit comments

Comments
 (0)