mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
* Sync fork * Added 'Lock aspect ratio' when creating a new image * Added common templates in 'CreateNewImage' dialog * Last fix * Added translation strings
This commit is contained in:
parent
30e8522677
commit
1efec81a6b
|
@ -3,39 +3,82 @@
|
||||||
[ext_resource path="res://Scripts/Dialogs/CreateNewImage.gd" type="Script" id=1]
|
[ext_resource path="res://Scripts/Dialogs/CreateNewImage.gd" type="Script" id=1]
|
||||||
|
|
||||||
[node name="CreateNewImage" type="ConfirmationDialog"]
|
[node name="CreateNewImage" type="ConfirmationDialog"]
|
||||||
margin_right = 200.0
|
margin_right = 205.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 200.0
|
||||||
|
rect_min_size = Vector2( 250, 200 )
|
||||||
|
window_title = "Please Confirm..."
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||||
margin_left = 8.0
|
margin_left = 8.0
|
||||||
margin_top = 8.0
|
margin_top = 8.0
|
||||||
margin_right = 192.0
|
margin_right = 242.0
|
||||||
margin_bottom = 34.0
|
margin_bottom = 164.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="ImageSize" type="Label" parent="VBoxContainer"]
|
[node name="ImageSize" type="Label" parent="VBoxContainer"]
|
||||||
margin_right = 184.0
|
margin_right = 234.0
|
||||||
margin_bottom = 15.0
|
margin_bottom = 14.0
|
||||||
text = "Image Size"
|
text = "Image Size"
|
||||||
|
|
||||||
|
[node name="HSeparator" type="HSeparator" parent="VBoxContainer"]
|
||||||
|
margin_top = 18.0
|
||||||
|
margin_right = 234.0
|
||||||
|
margin_bottom = 22.0
|
||||||
|
|
||||||
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
|
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
|
||||||
margin_top = 19.0
|
margin_top = 26.0
|
||||||
margin_right = 184.0
|
margin_right = 234.0
|
||||||
margin_bottom = 76.0
|
margin_bottom = 154.0
|
||||||
custom_constants/vseparation = 4
|
custom_constants/vseparation = 4
|
||||||
custom_constants/hseparation = 2
|
custom_constants/hseparation = 2
|
||||||
columns = 2
|
columns = 2
|
||||||
|
|
||||||
|
[node name="TemplatesLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
||||||
|
margin_top = 3.0
|
||||||
|
margin_right = 112.0
|
||||||
|
margin_bottom = 17.0
|
||||||
|
text = "Templates:"
|
||||||
|
|
||||||
|
[node name="TemplatesOptions" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
|
||||||
|
margin_left = 114.0
|
||||||
|
margin_right = 188.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
toggle_mode = false
|
||||||
|
items = [ "Default", null, false, 0, null, "16x16", null, false, 1, null, "32x32", null, false, 2, null, "64x64", null, false, 3, null, "128x128", null, false, 4, null ]
|
||||||
|
selected = 0
|
||||||
|
|
||||||
|
[node name="RatioLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
||||||
|
margin_top = 29.0
|
||||||
|
margin_right = 112.0
|
||||||
|
margin_bottom = 43.0
|
||||||
|
text = "Lock aspect ratio:"
|
||||||
|
|
||||||
|
[node name="RatioCheckBox" type="CheckBox" parent="VBoxContainer/OptionsContainer"]
|
||||||
|
margin_left = 114.0
|
||||||
|
margin_top = 24.0
|
||||||
|
margin_right = 188.0
|
||||||
|
margin_bottom = 48.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
[node name="WidthLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_top = 1.0
|
margin_top = 57.0
|
||||||
margin_right = 75.0
|
margin_right = 112.0
|
||||||
margin_bottom = 16.0
|
margin_bottom = 71.0
|
||||||
text = "Width:"
|
text = "Width:"
|
||||||
|
|
||||||
[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
|
[node name="WidthValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_left = 75.0
|
margin_left = 114.0
|
||||||
margin_right = 139.0
|
margin_top = 52.0
|
||||||
margin_bottom = 17.0
|
margin_right = 188.0
|
||||||
|
margin_bottom = 76.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
min_value = 1.0
|
min_value = 1.0
|
||||||
max_value = 16384.0
|
max_value = 16384.0
|
||||||
|
@ -43,16 +86,16 @@ value = 64.0
|
||||||
suffix = "px"
|
suffix = "px"
|
||||||
|
|
||||||
[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"]
|
[node name="Height" type="Label" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_top = 19.0
|
margin_top = 85.0
|
||||||
margin_right = 75.0
|
margin_right = 112.0
|
||||||
margin_bottom = 33.0
|
margin_bottom = 99.0
|
||||||
text = "Height:"
|
text = "Height:"
|
||||||
|
|
||||||
[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
|
[node name="HeightValue" type="SpinBox" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_left = 75.0
|
margin_left = 114.0
|
||||||
margin_top = 19.0
|
margin_top = 80.0
|
||||||
margin_right = 139.0
|
margin_right = 188.0
|
||||||
margin_bottom = 34.0
|
margin_bottom = 104.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
min_value = 1.0
|
min_value = 1.0
|
||||||
max_value = 16384.0
|
max_value = 16384.0
|
||||||
|
@ -60,16 +103,16 @@ value = 64.0
|
||||||
suffix = "px"
|
suffix = "px"
|
||||||
|
|
||||||
[node name="FillColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
[node name="FillColorLabel" type="Label" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_top = 41.0
|
margin_top = 111.0
|
||||||
margin_right = 75.0
|
margin_right = 112.0
|
||||||
margin_bottom = 53.0
|
margin_bottom = 125.0
|
||||||
text = "Fill with color:"
|
text = "Fill with color:"
|
||||||
|
|
||||||
[node name="FillColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"]
|
[node name="FillColor" type="ColorPickerButton" parent="VBoxContainer/OptionsContainer"]
|
||||||
margin_left = 75.0
|
margin_left = 114.0
|
||||||
margin_top = 38.0
|
margin_top = 108.0
|
||||||
margin_right = 139.0
|
margin_right = 188.0
|
||||||
margin_bottom = 57.0
|
margin_bottom = 128.0
|
||||||
rect_min_size = Vector2( 64, 20 )
|
rect_min_size = Vector2( 64, 20 )
|
||||||
color = Color( 0, 0, 0, 0 )
|
color = Color( 0, 0, 0, 0 )
|
||||||
[connection signal="about_to_show" from="." to="." method="_on_CreateNewImage_about_to_show"]
|
[connection signal="about_to_show" from="." to="." method="_on_CreateNewImage_about_to_show"]
|
||||||
|
|
|
@ -1,9 +1,31 @@
|
||||||
extends ConfirmationDialog
|
extends ConfirmationDialog
|
||||||
|
|
||||||
|
onready var templates_options = $VBoxContainer/OptionsContainer/TemplatesOptions
|
||||||
|
onready var ratio_box = $VBoxContainer/OptionsContainer/RatioCheckBox
|
||||||
onready var width_value = $VBoxContainer/OptionsContainer/WidthValue
|
onready var width_value = $VBoxContainer/OptionsContainer/WidthValue
|
||||||
onready var height_value = $VBoxContainer/OptionsContainer/HeightValue
|
onready var height_value = $VBoxContainer/OptionsContainer/HeightValue
|
||||||
onready var fill_color_node = $VBoxContainer/OptionsContainer/FillColor
|
onready var fill_color_node = $VBoxContainer/OptionsContainer/FillColor
|
||||||
|
|
||||||
|
#Template Id identifier
|
||||||
|
enum Templates {
|
||||||
|
TDefault = 0,
|
||||||
|
T16 = 1,
|
||||||
|
T32 = 2,
|
||||||
|
T64 = 3,
|
||||||
|
T128 = 4,
|
||||||
|
}
|
||||||
|
#Template actual value, without Default because we get it from Global
|
||||||
|
enum TValues {
|
||||||
|
T16 = 16,
|
||||||
|
T32 = 32,
|
||||||
|
T64 = 64,
|
||||||
|
T128 = 128,
|
||||||
|
}
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
ratio_box.connect("pressed", self, "_on_RatioCheckBox_toggled", [ratio_box.pressed])
|
||||||
|
templates_options.connect("item_selected", self, "_on_TemplatesOptions_item_selected")
|
||||||
|
|
||||||
func _on_CreateNewImage_confirmed() -> void:
|
func _on_CreateNewImage_confirmed() -> void:
|
||||||
var width : int = width_value.value
|
var width : int = width_value.value
|
||||||
var height : int = height_value.value
|
var height : int = height_value.value
|
||||||
|
@ -32,3 +54,43 @@ func _on_CreateNewImage_about_to_show() -> void:
|
||||||
width_value.value = Global.default_image_width
|
width_value.value = Global.default_image_width
|
||||||
height_value.value = Global.default_image_height
|
height_value.value = Global.default_image_height
|
||||||
fill_color_node.color = Global.default_fill_color
|
fill_color_node.color = Global.default_fill_color
|
||||||
|
templates_options.selected = Templates.TDefault
|
||||||
|
ratio_box.pressed = false
|
||||||
|
for spin_box in [width_value, height_value]:
|
||||||
|
if spin_box.is_connected("value_changed", self, "_on_SizeValue_value_changed"):
|
||||||
|
spin_box.disconnect("value_changed", self, "_on_SizeValue_value_changed")
|
||||||
|
|
||||||
|
var aspect_ratio: float
|
||||||
|
|
||||||
|
# warning-ignore:unused_argument
|
||||||
|
func _on_RatioCheckBox_toggled(button_pressed: bool) -> void:
|
||||||
|
aspect_ratio = width_value.value / height_value.value
|
||||||
|
for spin_box in [width_value, height_value]:
|
||||||
|
if spin_box.is_connected("value_changed", self, "_on_SizeValue_value_changed"):
|
||||||
|
spin_box.disconnect("value_changed", self, "_on_SizeValue_value_changed")
|
||||||
|
else:
|
||||||
|
spin_box.connect("value_changed", self, "_on_SizeValue_value_changed")
|
||||||
|
|
||||||
|
func _on_SizeValue_value_changed(value: float) -> void:
|
||||||
|
if width_value.value == value:
|
||||||
|
height_value.value = width_value.value / aspect_ratio
|
||||||
|
if height_value.value == value:
|
||||||
|
width_value.value = height_value.value * aspect_ratio
|
||||||
|
|
||||||
|
func _on_TemplatesOptions_item_selected(id: int) -> void:
|
||||||
|
match id:
|
||||||
|
Templates.TDefault:
|
||||||
|
width_value.value = Global.default_image_width
|
||||||
|
height_value.value = Global.default_image_height
|
||||||
|
Templates.T16:
|
||||||
|
width_value.value = TValues.T16
|
||||||
|
height_value.value = TValues.T16
|
||||||
|
Templates.T32:
|
||||||
|
width_value.value = TValues.T32
|
||||||
|
height_value.value = TValues.T32
|
||||||
|
Templates.T64:
|
||||||
|
width_value.value = TValues.T64
|
||||||
|
height_value.value = TValues.T64
|
||||||
|
Templates.T128:
|
||||||
|
width_value.value = TValues.T128
|
||||||
|
height_value.value = TValues.T128
|
||||||
|
|
|
@ -825,3 +825,9 @@ msgstr ""
|
||||||
|
|
||||||
msgid "Default Fill Color:"
|
msgid "Default Fill Color:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Lock aspect ratio:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Templates:"
|
||||||
|
msgstr ""
|
||||||
|
|
|
@ -742,3 +742,9 @@ msgstr "Default Height:"
|
||||||
|
|
||||||
msgid "Default Fill Color:"
|
msgid "Default Fill Color:"
|
||||||
msgstr "Default Fill Color:"
|
msgstr "Default Fill Color:"
|
||||||
|
|
||||||
|
msgid "Lock aspect ratio:"
|
||||||
|
msgstr "Lock aspect ratio:"
|
||||||
|
|
||||||
|
msgid "Templates:"
|
||||||
|
msgstr "Templates:"
|
||||||
|
|
|
@ -850,3 +850,8 @@ msgstr "Altezza default:"
|
||||||
msgid "Default Fill Color:"
|
msgid "Default Fill Color:"
|
||||||
msgstr "Riempimento default:"
|
msgstr "Riempimento default:"
|
||||||
|
|
||||||
|
msgid "Lock aspect ratio:"
|
||||||
|
msgstr "Blocca rapporto d'aspetto:"
|
||||||
|
|
||||||
|
msgid "Templates:"
|
||||||
|
msgstr "Modelli:"
|
||||||
|
|
Loading…
Reference in a new issue