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

Preferences Window Overhaul

Languages are now unique buttons instead of one OptionButton, this also fixes problem where Chinese characters weren't being rendered with the Roboto font. Also made the brushes popup a little bigger.
This commit is contained in:
OverloadedOrama 2019-12-27 01:02:36 +02:00
parent 0c664a34be
commit de2f9b68be
4 changed files with 183 additions and 64 deletions

View file

@ -552,6 +552,7 @@ size_flags_vertical = 1
min_value = 1.0
value = 1.0
allow_greater = true
ticks_on_borders = true
[node name="LeftBrushSizeEdit" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftBrushSize"]
margin_left = 154.0
@ -585,6 +586,7 @@ hint_tooltip = "COLORFROM_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 100.0
ticks_on_borders = true
[node name="LeftInterpolateFactor" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftColorInterpolation"]
margin_left = 153.0
@ -647,6 +649,7 @@ hint_tooltip = "LDAMOUNT_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 10.0
ticks_on_borders = true
[node name="LeftLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/LeftToolOptions/LeftLDOptions/LeftLDAmount"]
margin_left = 154.0
@ -856,6 +859,7 @@ hint_tooltip = "LDAMOUNT_HT"
size_flags_horizontal = 3
size_flags_vertical = 1
value = 10.0
ticks_on_borders = true
[node name="RightLDAmountSpinbox" type="SpinBox" parent="MenuAndUI/UI/ToolPanel/Tools/ColorAndToolOptions/RightToolOptions/RightLDOptions/RightLDAmount"]
margin_left = 154.0
@ -1541,11 +1545,13 @@ size_flags_horizontal = 3
[node name="BrushesPopup" type="Popup" parent="."]
editor/display_folded = true
margin_right = 226.0
margin_bottom = 72.0
margin_bottom = 144.0
rect_min_size = Vector2( 0, 144 )
[node name="TabContainer" type="TabContainer" parent="BrushesPopup"]
margin_right = 224.0
margin_bottom = 72.0
anchor_right = 1.0
anchor_bottom = 1.0
size_flags_vertical = 3
drag_to_rearrange_enabled = true
[node name="File" type="ScrollContainer" parent="BrushesPopup/TabContainer"]
@ -1560,7 +1566,7 @@ size_flags_horizontal = 3
scroll_horizontal_enabled = false
[node name="FileBrushContainer" type="GridContainer" parent="BrushesPopup/TabContainer/File"]
columns = 5
columns = 6
[node name="PixelBrushButton" parent="BrushesPopup/TabContainer/File/FileBrushContainer" instance=ExtResource( 58 )]
hint_tooltip = "Pixel brush"
@ -1795,6 +1801,7 @@ items = [ "Nearest", null, false, 0, null, "Bilinear", null, false, 1, null, "Cu
selected = 0
[node name="PreferencesDialog" parent="." instance=ExtResource( 61 )]
visible = false
[node name="OutlineDialog" type="ConfirmationDialog" parent="."]
editor/display_folded = true

View file

@ -1,6 +1,8 @@
[gd_scene load_steps=2 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Scripts/PreferencesDialog.gd" type="Script" id=1]
[ext_resource path="res://Assets/Fonts/Roboto-Regular.tres" type="DynamicFont" id=2]
[ext_resource path="res://Assets/Fonts/NotoSansCJKtc-Regular.tres" type="DynamicFont" id=3]
[node name="PreferencesDialog" type="AcceptDialog"]
margin_right = 200.0
@ -9,67 +11,135 @@ window_title = "Preferences"
resizable = true
script = ExtResource( 1 )
[node name="VBoxContainer" type="VBoxContainer" parent="."]
anchor_left = 0.5
anchor_right = 0.5
margin_left = -92.0
[node name="HSplitContainer" type="HSplitContainer" parent="."]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 8.0
margin_top = 8.0
margin_right = 92.0
margin_bottom = 34.0
margin_right = -8.0
margin_bottom = -36.0
size_flags_horizontal = 3
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
margin_right = 218.0
margin_bottom = 44.0
columns = 2
[node name="Tree" type="Tree" parent="HSplitContainer"]
margin_right = 88.0
margin_bottom = 26.0
rect_min_size = Vector2( 88, 0 )
custom_constants/item_margin = -2
hide_root = true
[node name="LanguageLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 3.0
margin_right = 63.0
margin_bottom = 17.0
text = "Language:"
[node name="ScrollContainer" type="ScrollContainer" parent="HSplitContainer"]
margin_left = 100.0
margin_right = 200.0
margin_bottom = 26.0
rect_min_size = Vector2( 100, 0 )
size_flags_horizontal = 3
[node name="LanguageOption" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
margin_left = 67.0
margin_right = 218.0
margin_bottom = 20.0
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/ScrollContainer"]
margin_right = 205.0
margin_bottom = 282.0
size_flags_horizontal = 3
[node name="Languages" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
margin_right = 205.0
margin_bottom = 282.0
[node name="LanguageOptions" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_right = 205.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
text = "Language Options:"
[node name="SystemLanguage" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 32.0
margin_right = 205.0
margin_bottom = 56.0
pressed = true
text = "System Language"
items = [ "System Language", null, false, 0, null, "Deutsch [de]", null, false, 1, null, "Ελληνικά [el]", null, false, 2, null, "English [en]", null, false, 3, null, "Français [fr]", null, false, 4, null, "Polski [pl]", null, false, 5, null, "Português Brasileiro [pt_BR]", null, false, 6, null, "Русский [ru]", null, false, 7, null, "繁體中文 [zh_TW]", null, false, 8, null ]
selected = 0
[node name="ThemeLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
margin_top = 27.0
margin_right = 63.0
margin_bottom = 41.0
text = "Theme:"
[node name="German" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 60.0
margin_right = 205.0
margin_bottom = 84.0
text = "Deutsch [de]"
[node name="ThemeOption" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
margin_left = 67.0
[node name="Greek" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 88.0
margin_right = 205.0
margin_bottom = 112.0
custom_fonts/font = ExtResource( 2 )
text = "Ελληνικά [el]"
[node name="English" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 116.0
margin_right = 205.0
margin_bottom = 140.0
text = "English [en]"
[node name="French" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 144.0
margin_right = 205.0
margin_bottom = 168.0
text = "Français [fr]"
[node name="Polish" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 172.0
margin_right = 205.0
margin_bottom = 196.0
text = "Polski [pl]"
[node name="Brazilian Portuguese" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 200.0
margin_right = 205.0
margin_bottom = 224.0
text = "Português Brasileiro [pt_BR]"
[node name="Russian" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 228.0
margin_right = 205.0
margin_bottom = 252.0
text = "Русский [ru]"
[node name="Traditional Chinese" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Languages"]
margin_top = 256.0
margin_right = 205.0
margin_bottom = 282.0
custom_fonts/font = ExtResource( 3 )
text = "繁體中文 [zh_TW]"
[node name="ThemeOption" type="OptionButton" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false
margin_top = 24.0
margin_right = 218.0
margin_right = 151.0
margin_bottom = 44.0
text = "Dark"
items = [ "Dark", null, false, 0, null, "Gray", null, false, 1, null, "Godot", null, false, 2, null, "Gold", null, false, 3, null, "Light", null, false, 4, null ]
selected = 0
[node name="GridOptionsLabel" type="Label" parent="VBoxContainer"]
margin_top = 48.0
margin_right = 218.0
margin_bottom = 62.0
[node name="Grid&Guides" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
editor/display_folded = true
visible = false
margin_top = 24.0
margin_right = 151.0
margin_bottom = 118.0
[node name="GridOptionsLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides"]
margin_right = 151.0
margin_bottom = 14.0
text = "Grid options"
[node name="GridOptions" type="GridContainer" parent="VBoxContainer"]
margin_top = 66.0
margin_right = 218.0
margin_bottom = 142.0
[node name="GridOptions" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides"]
margin_top = 18.0
margin_right = 151.0
margin_bottom = 94.0
columns = 2
[node name="WidthLabel" type="Label" parent="VBoxContainer/GridOptions"]
[node name="WidthLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_top = 5.0
margin_right = 46.0
margin_bottom = 19.0
text = "Width:"
[node name="GridWidthValue" type="SpinBox" parent="VBoxContainer/GridOptions"]
[node name="GridWidthValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_left = 50.0
margin_right = 124.0
margin_bottom = 24.0
@ -78,13 +148,13 @@ max_value = 16384.0
value = 1.0
suffix = "px"
[node name="Height" type="Label" parent="VBoxContainer/GridOptions"]
[node name="Height" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_top = 33.0
margin_right = 46.0
margin_bottom = 47.0
text = "Height:"
[node name="GridHeightValue" type="SpinBox" parent="VBoxContainer/GridOptions"]
[node name="GridHeightValue" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_left = 50.0
margin_top = 28.0
margin_right = 124.0
@ -94,20 +164,20 @@ max_value = 16384.0
value = 1.0
suffix = "px"
[node name="GridColorLabel" type="Label" parent="VBoxContainer/GridOptions"]
[node name="GridColorLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_top = 59.0
margin_right = 46.0
margin_bottom = 73.0
text = "Color:"
[node name="GridColor" type="ColorPickerButton" parent="VBoxContainer/GridOptions"]
[node name="GridColor" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions"]
margin_left = 50.0
margin_top = 56.0
margin_right = 124.0
margin_bottom = 76.0
rect_min_size = Vector2( 64, 20 )
[connection signal="item_selected" from="VBoxContainer/OptionsContainer/LanguageOption" to="." method="_on_LanguageOption_item_selected"]
[connection signal="item_selected" from="VBoxContainer/OptionsContainer/ThemeOption" to="." method="_on_ThemeOption_item_selected"]
[connection signal="value_changed" from="VBoxContainer/GridOptions/GridWidthValue" to="." method="_on_GridWidthValue_value_changed"]
[connection signal="value_changed" from="VBoxContainer/GridOptions/GridHeightValue" to="." method="_on_GridHeightValue_value_changed"]
[connection signal="color_changed" from="VBoxContainer/GridOptions/GridColor" to="." method="_on_GridColor_color_changed"]
[connection signal="item_selected" from="HSplitContainer/Tree" to="." method="_on_Tree_item_selected"]
[connection signal="item_selected" from="HSplitContainer/ScrollContainer/VBoxContainer/ThemeOption" to="." method="_on_ThemeOption_item_selected"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridWidthValue" to="." method="_on_GridWidthValue_value_changed"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridHeightValue" to="." method="_on_GridHeightValue_value_changed"]
[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridColor" to="." method="_on_GridColor_color_changed"]

View file

@ -11,7 +11,7 @@ var export_as_single_file : CheckBox
var export_vertical_spritesheet : CheckBox
var redone := false
var fps := 6.0
var animation_loop := 0 #0 is no loop, 1 is cycle loop, 2 is ping-pong loop
var animation_loop := 0 # 0 is no loop, 1 is cycle loop, 2 is ping-pong loop
var animation_forward := true
var previous_left_color := Color.black
var previous_right_color := Color.white
@ -89,7 +89,8 @@ func _ready() -> void:
# Set the language option menu's default selected option to the loaded locale
var locale_index := Global.loaded_locales.find(saved_locale)
$PreferencesDialog/VBoxContainer/OptionsContainer/LanguageOption.selected = locale_index + 1
$PreferencesDialog.languages.get_child(1).pressed = false
$PreferencesDialog.languages.get_child(locale_index + 2).pressed = true
else: # If the user doesn't have a language preference, set it to their OS' locale
TranslationServer.set_locale(OS.get_locale())
@ -251,7 +252,7 @@ func edit_menu_id_pressed(id : int) -> void:
Global.selected_pixels.clear()
Global.canvas.handle_redo("Rectangle Select")
3: # Preferences
$PreferencesDialog.popup_centered()
$PreferencesDialog.popup_centered(Vector2(380, 300))
Global.can_draw = false
func view_menu_id_pressed(id : int) -> void:

View file

@ -1,20 +1,61 @@
extends AcceptDialog
onready var tree : Tree = $HSplitContainer/Tree
onready var right_side : VBoxContainer = $HSplitContainer/ScrollContainer/VBoxContainer
onready var languages = $HSplitContainer/ScrollContainer/VBoxContainer/Languages
onready var theme_option = $HSplitContainer/ScrollContainer/VBoxContainer/ThemeOption
onready var grid_guides = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides"
func _ready() -> void:
var root := tree.create_item()
var language_button := tree.create_item(root)
var theme_button := tree.create_item(root)
var grid_button := tree.create_item(root)
language_button.set_text(0, " Language")
language_button.select(0)
theme_button.set_text(0, " Themes")
grid_button.set_text(0, " Guides & Grid")
for child in languages.get_children():
if child is Button:
child.connect("pressed", self, "_on_Language_pressed", [child])
if Global.config_cache.has_section_key("preferences", "theme"):
var theme_id = Global.config_cache.get_value("preferences", "theme")
change_theme(theme_id)
$VBoxContainer/OptionsContainer/ThemeOption.selected = theme_id
theme_option.selected = theme_id
func _on_LanguageOption_item_selected(ID : int) -> void:
if ID == 0:
func _on_Tree_item_selected() -> void:
for child in right_side.get_children():
child.visible = false
var selected := tree.get_selected().get_text(0)
if "Language" in selected:
languages.visible = true
elif "Themes" in selected:
theme_option.visible = true
elif "Guides & Grid" in selected:
grid_guides.visible = true
func _on_Language_pressed(button : Button) -> void:
var index := 0
var i := -1
for child in languages.get_children():
if child is Button:
if child == button:
button.pressed = true
index = i
else:
child.pressed = false
i += 1
if index == -1:
TranslationServer.set_locale(OS.get_locale())
else:
TranslationServer.set_locale(Global.loaded_locales[ID - 1])
if Global.loaded_locales[ID - 1] == "zh_TW":
Global.control.theme.default_font = preload("res://Assets/Fonts/NotoSansCJKtc-Regular.tres")
else:
Global.control.theme.default_font = preload("res://Assets/Fonts/Roboto-Regular.tres")
TranslationServer.set_locale(Global.loaded_locales[index])
if TranslationServer.get_locale() == "zh_TW":
Global.control.theme.default_font = preload("res://Assets/Fonts/NotoSansCJKtc-Regular.tres")
else:
Global.control.theme.default_font = preload("res://Assets/Fonts/Roboto-Regular.tres")
Global.config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
Global.config_cache.save("user://cache.ini")