From ea717cfea747ab228bf812b40178e69707ec6e13 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 15 Jul 2020 03:25:59 +0300 Subject: [PATCH] CreateNewImage now remembers the last created canvas size - Closes #178 The default image width, height and fill color are being used only when the program first launches. After that, if the user creates an image with changed settings, these settings are being kept. --- CHANGELOG.md | 1 + src/UI/Dialogs/CreateNewImage.gd | 15 ++++----------- src/UI/Dialogs/CreateNewImage.tscn | 1 - src/UI/Dialogs/PreviewDialog.gd | 1 - 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 934b7adce..26a1d3180 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Darshan Phaldesai (luiq54), Igor Santarek (jegor377), rob-a-bolton, Kinwailo - Pixelorama now remembers the selected colors, tools and their options when it's closed and re-opened. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281)) - Drawing brushes with mirror also mirrors the images of the brushes themselves. ([#281](https://github.com/Orama-Interactive/Pixelorama/pull/281)) - When making a new palette or importing one and its name already exists, Pixelorama will add a number to its name. For example, "Palette_Name" would become "Palette_Name (2)", "Palette_Name (3)", etc. +- The "create new image" dialog now remembers the last created canvas size. The default image settings are being used only when Pixelorama first launches. ([#178](https://github.com/Orama-Interactive/Pixelorama/issues/178)) - Language and theme checkboxes are now radio buttons. - The Blue theme has more similar margins and seperations with the rest of the themes. diff --git a/src/UI/Dialogs/CreateNewImage.gd b/src/UI/Dialogs/CreateNewImage.gd index b54535995..baaa16945 100644 --- a/src/UI/Dialogs/CreateNewImage.gd +++ b/src/UI/Dialogs/CreateNewImage.gd @@ -53,7 +53,11 @@ var TStrings ={ func _ready() -> void: + width_value.value = Global.default_image_width + height_value.value = Global.default_image_height + fill_color_node.color = Global.default_fill_color fill_color_node.get_picker().presets_visible = false + ratio_box.connect("pressed", self, "_on_RatioCheckBox_toggled", [ratio_box.pressed]) templates_options.connect("item_selected", self, "_on_TemplatesOptions_item_selected") @@ -84,17 +88,6 @@ func _on_CreateNewImage_confirmed() -> void: Global.canvas.camera_zoom() -func _on_CreateNewImage_about_to_show() -> void: - width_value.value = Global.default_image_width - height_value.value = Global.default_image_height - 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 func _on_RatioCheckBox_toggled(_button_pressed: bool) -> void: diff --git a/src/UI/Dialogs/CreateNewImage.tscn b/src/UI/Dialogs/CreateNewImage.tscn index 539f4fcfc..5f6cf84b0 100644 --- a/src/UI/Dialogs/CreateNewImage.tscn +++ b/src/UI/Dialogs/CreateNewImage.tscn @@ -119,5 +119,4 @@ margin_bottom = 128.0 rect_min_size = Vector2( 64, 20 ) mouse_default_cursor_shape = 2 color = Color( 0, 0, 0, 0 ) -[connection signal="about_to_show" from="." to="." method="_on_CreateNewImage_about_to_show"] [connection signal="confirmed" from="." to="." method="_on_CreateNewImage_confirmed"] diff --git a/src/UI/Dialogs/PreviewDialog.gd b/src/UI/Dialogs/PreviewDialog.gd index 27944f8d7..32205ffdf 100644 --- a/src/UI/Dialogs/PreviewDialog.gd +++ b/src/UI/Dialogs/PreviewDialog.gd @@ -196,7 +196,6 @@ func add_brush() -> void: dir.list_dir_begin() var curr_file := dir.get_next() while curr_file != "": - print(curr_file) if curr_file.begins_with("%") and brush_name in curr_file: random_brushes.append(curr_file) curr_file = dir.get_next()