Skip to content

Commit

Permalink
Add save button to save context popup
Browse files Browse the repository at this point in the history
  • Loading branch information
MewPurPur committed Apr 9, 2024
1 parent 3209fec commit cefa281
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 69 deletions.
74 changes: 39 additions & 35 deletions project.godot

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions src/ui_parts/code_editor.gd
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ func _notification(what: int) -> void:


func _unhandled_input(input_event: InputEvent) -> void:
if input_event.is_action_pressed(&"import"):
if input_event.is_action_pressed("import"):
_on_import_button_pressed()
elif input_event.is_action_pressed(&"export"):
elif input_event.is_action_pressed("export"):
_on_export_button_pressed()
elif input_event.is_action_pressed(&"copy_svg_text"):
elif input_event.is_action_pressed("copy_svg_text"):
_on_copy_button_pressed()
elif input_event.is_action_pressed(&"clear_svg"):
elif input_event.is_action_pressed("clear_svg"):
clear_svg()
elif input_event.is_action_pressed(&"optimize_svg"):
elif input_event.is_action_pressed("optimize_svg"):
_on_optimize_button_pressed()
elif input_event.is_action_pressed(&"clear_file_path"):
elif input_event.is_action_pressed("clear_file_path"):
clear_file_path()
elif input_event.is_action_pressed(&"reset_svg"):
elif input_event.is_action_pressed("reset_svg"):
reset_svg()


Expand Down Expand Up @@ -150,11 +150,14 @@ func _on_optimize_button_pressed() -> void:

func _on_file_button_pressed() -> void:
var btn_array: Array[Button] = []
btn_array.append(Utils.create_btn(tr("Clear association"), clear_file_path,
false, load("res://visual/icons/Clear.svg")))
btn_array.append(Utils.create_btn(tr("Save SVG"), SVG.open_save_dialog.bind("svg",
SVG.native_file_save, SVG.save_svg_to_file),
false, load("res://visual/icons/Save.svg")))
btn_array.append(Utils.create_btn(tr("Reset SVG"), reset_svg,
SVG.does_svg_data_match_disk_contents(),
load("res://visual/icons/Reload.svg")))
btn_array.append(Utils.create_btn(tr("Clear saving path"), clear_file_path,
false, load("res://visual/icons/Clear.svg")))
var context_popup := ContextPopup.instantiate()
add_child(context_popup)
context_popup.setup(btn_array, true, file_button.size.x)
Expand Down
16 changes: 8 additions & 8 deletions src/ui_parts/display.gd
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ func _ready() -> void:


func _unhandled_input(input_event: InputEvent) -> void:
if input_event.is_action_pressed(&"open_settings"):
if input_event.is_action_pressed("open_settings"):
_on_settings_pressed()
elif input_event.is_action_pressed(&"view_show_grid"):
elif input_event.is_action_pressed("view_show_grid"):
toggle_grid_visuals()
elif input_event.is_action_pressed(&"view_show_handles"):
elif input_event.is_action_pressed("view_show_handles"):
toggle_handles_visuals()
elif input_event.is_action_pressed(&"view_rasterized_svg"):
elif input_event.is_action_pressed("view_rasterized_svg"):
toggle_rasterization()
elif input_event.is_action_pressed(&"snap_toggle"):
elif input_event.is_action_pressed("snap_toggle"):
toggle_snap()
elif input_event.is_action_pressed(&"about_repo"):
elif input_event.is_action_pressed("about_repo"):
open_godsvg_repo()
elif input_event.is_action_pressed(&"about_info"):
elif input_event.is_action_pressed("about_info"):
open_about()
elif input_event.is_action_pressed(&"about_donate"):
elif input_event.is_action_pressed("about_donate"):
open_sponsor()


Expand Down
6 changes: 3 additions & 3 deletions src/ui_parts/zoom_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ var _zoom_level: float


func _unhandled_input(input_event: InputEvent) -> void:
if input_event.is_action_pressed(&"zoom_in"):
if input_event.is_action_pressed("zoom_in"):
zoom_in()
elif input_event.is_action_pressed(&"zoom_out"):
elif input_event.is_action_pressed("zoom_out"):
zoom_out()
elif input_event.is_action_pressed(&"zoom_reset"):
elif input_event.is_action_pressed("zoom_reset"):
zoom_reset()


Expand Down
2 changes: 1 addition & 1 deletion translations/GodSVG.pot
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ msgstr ""
msgid "Absolute"
msgstr ""

msgid "Clear association"
msgid "Clear saving path"
msgstr ""

msgid "Apply the matrix"
Expand Down
8 changes: 5 additions & 3 deletions translations/bg.po
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,9 @@ msgstr "Избери"
msgid ""
"A file named \"{file_name}\" already exists. Replacing will overwrite its "
"contents!"
msgstr "Файл кръстен \"{file_name}\" вече съществува. Заместването ще пренапише неговото съдържание!"
msgstr ""
"Файл кръстен \"{file_name}\" вече съществува. Заместването ще пренапише "
"неговото съдържание!"

msgid "Godot third-party components"
msgstr "Компоненти в Godot от трети лица"
Expand Down Expand Up @@ -487,8 +489,8 @@ msgstr "Относително"
msgid "Absolute"
msgstr "Абсолютно"

msgid "Clear association"
msgstr "Премахни асоциацията"
msgid "Clear saving path"
msgstr "Премахни запазената пътека"

msgid "Apply the matrix"
msgstr "Приложи матрицата"
Expand Down
9 changes: 6 additions & 3 deletions translations/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,8 @@ msgstr "Relativ"
msgid "Absolute"
msgstr "Absolut"

#, fuzzy
msgid "Clear association"
msgstr "Dateizuordnung entfernen"
msgid "Clear saving path"
msgstr ""

msgid "Apply the matrix"
msgstr "Die Matrix anwenden"
Expand All @@ -524,3 +523,7 @@ msgstr "Immer aktiv."

msgid "Search color"
msgstr "Farbe suchen"

#, fuzzy
#~ msgid "Clear association"
#~ msgstr "Dateizuordnung entfernen"
2 changes: 1 addition & 1 deletion translations/en.po
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ msgstr ""
msgid "Absolute"
msgstr ""

msgid "Clear association"
msgid "Clear saving path"
msgstr ""

msgid "Apply the matrix"
Expand Down
9 changes: 6 additions & 3 deletions translations/ru.po
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,8 @@ msgstr "Относительная"
msgid "Absolute"
msgstr "Абсолютная"

#, fuzzy
msgid "Clear association"
msgstr "Удалить"
msgid "Clear saving path"
msgstr ""

msgid "Apply the matrix"
msgstr "Применить матрицу"
Expand All @@ -521,5 +520,9 @@ msgstr "Всегда активно."
msgid "Search color"
msgstr "Искать цвет"

#, fuzzy
#~ msgid "Clear association"
#~ msgstr "Удалить"

#~ msgid "Import SVG"
#~ msgstr "Импортировать SVG"
9 changes: 6 additions & 3 deletions translations/uk.po
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,8 @@ msgstr "Відносна"
msgid "Absolute"
msgstr "Абсолютна"

#, fuzzy
msgid "Clear association"
msgstr "Видалити асоціацію"
msgid "Clear saving path"
msgstr ""

msgid "Apply the matrix"
msgstr "Застосувати матрицю"
Expand All @@ -522,5 +521,9 @@ msgstr "Завжди активно."
msgid "Search color"
msgstr "Шукати колір"

#, fuzzy
#~ msgid "Clear association"
#~ msgstr "Видалити асоціацію"

#~ msgid "Import SVG"
#~ msgstr "Імпортувати SVG"
1 change: 1 addition & 0 deletions visual/icons/Save.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 37 additions & 0 deletions visual/icons/Save.svg.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid://rxfu7kcmo7c1"
path="res://.godot/imported/Save.svg-7220a8e5be4485153ca68c35b0008a2c.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://visual/icons/Save.svg"
dest_files=["res://.godot/imported/Save.svg-7220a8e5be4485153ca68c35b0008a2c.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

0 comments on commit cefa281

Please sign in to comment.