mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 12:04:43 -04:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
33551c4d81
20 changed files with 1316 additions and 426 deletions
|
@ -199,6 +199,9 @@ var palette_import_file_dialog : FileDialog
|
|||
var error_dialog : AcceptDialog
|
||||
|
||||
func _ready() -> void:
|
||||
# Load settings from the config file
|
||||
config_cache.load("user://cache.ini")
|
||||
|
||||
undo_redo = UndoRedo.new()
|
||||
image_clipboard = Image.new()
|
||||
|
||||
|
|
|
@ -28,14 +28,11 @@ func _ready() -> void:
|
|||
Global.loaded_locales = TranslationServer.get_loaded_locales()
|
||||
else:
|
||||
# Hardcoded list of locales
|
||||
Global.loaded_locales = ["de", "el", "en", "fr", "pl", "ru", "zh_TW"]
|
||||
Global.loaded_locales = ["de", "el", "en", "fr", "pl", "pt_BR", "ru", "zh_TW"]
|
||||
|
||||
# Make sure locales are always sorted, in the same order
|
||||
Global.loaded_locales.sort()
|
||||
|
||||
# Load settings from the config file
|
||||
Global.config_cache.load("user://cache.ini")
|
||||
|
||||
# Restore the window position/size if values are present in the configuration cache
|
||||
if Global.config_cache.has_section_key("window", "screen"):
|
||||
OS.current_screen = Global.config_cache.get_value("window", "screen")
|
||||
|
@ -115,6 +112,7 @@ func _ready() -> void:
|
|||
i += 1
|
||||
view_menu.set_item_checked(2, true) #Show Rulers
|
||||
view_menu.set_item_checked(3, true) #Show Guides
|
||||
view_menu.hide_on_checkable_item_selection = false
|
||||
i = 0
|
||||
for item in help_menu_items.keys():
|
||||
help_menu.add_item(item, i, help_menu_items[item])
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
extends AcceptDialog
|
||||
|
||||
func _ready() -> void:
|
||||
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
|
||||
|
||||
func _on_LanguageOption_item_selected(ID : int) -> void:
|
||||
if ID == 0:
|
||||
TranslationServer.set_locale(OS.get_locale())
|
||||
|
@ -14,19 +20,35 @@ func _on_LanguageOption_item_selected(ID : int) -> void:
|
|||
Global.config_cache.save("user://cache.ini")
|
||||
|
||||
func _on_ThemeOption_item_selected(ID : int) -> void:
|
||||
change_theme(ID)
|
||||
|
||||
Global.config_cache.set_value("preferences", "theme", ID)
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
|
||||
func change_theme(ID : int) -> void:
|
||||
var font = Global.control.theme.default_font
|
||||
var main_theme
|
||||
var top_menu_style
|
||||
var ruler_style
|
||||
if ID == 0: #Main Theme
|
||||
main_theme = preload("res://Themes & Styles/Main Theme/Main Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Main Theme/TopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Main Theme/RulerStyle.tres")
|
||||
elif ID == 1: #Dark Theme
|
||||
if ID == 0: #Dark Theme
|
||||
main_theme = preload("res://Themes & Styles/Dark Theme/Dark Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Dark Theme/DarkTopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Dark Theme/DarkRulerStyle.tres")
|
||||
elif ID == 1: #Gray Theme
|
||||
main_theme = preload("res://Themes & Styles/Gray Theme/Gray Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Gray Theme/GrayTopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Dark Theme/DarkRulerStyle.tres")
|
||||
elif ID == 2: #Godot's Theme
|
||||
main_theme = preload("res://Themes & Styles/Godot\'s Theme/Godot\'s Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Godot\'s Theme/TopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Godot\'s Theme/RulerStyle.tres")
|
||||
elif ID == 3: #Light Theme
|
||||
main_theme = preload("res://Themes & Styles/Light Theme/Light Theme.tres")
|
||||
top_menu_style = preload("res://Themes & Styles/Light Theme/LightTopMenuStyle.tres")
|
||||
ruler_style = preload("res://Themes & Styles/Light Theme/LightRulerStyle.tres")
|
||||
|
||||
Global.control.theme = main_theme
|
||||
Global.control.theme.default_font = font
|
||||
Global.top_menu_container.add_stylebox_override("panel", top_menu_style)
|
||||
Global.horizontal_ruler.add_stylebox_override("normal", ruler_style)
|
||||
Global.horizontal_ruler.add_stylebox_override("pressed", ruler_style)
|
||||
|
|
|
@ -46,8 +46,11 @@ func _draw() -> void:
|
|||
var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, i))
|
||||
if i % (major_subdivision * minor_subdivision) == 0:
|
||||
draw_line(Vector2(0, position.y), Vector2(RULER_WIDTH, position.y), Color.white)
|
||||
var text_xform = Transform2D(-PI / 2, Vector2(font.get_height() - 4, position.y - 2))
|
||||
draw_set_transform_matrix(get_transform() * text_xform)
|
||||
var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, i)).y
|
||||
draw_string(font, Vector2(0, position.y - 2), str(int(val)))
|
||||
draw_string(font, Vector2(), str(int(val)))
|
||||
draw_set_transform_matrix(get_transform())
|
||||
else:
|
||||
if i % minor_subdivision == 0:
|
||||
draw_line(Vector2(RULER_WIDTH * 0.33, position.y), Vector2(RULER_WIDTH, position.y), Color.white)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue