Browse Source

added cancel to save changes window

Jonathan Higgins 6 months ago
parent
commit
ec294f59d0
3 changed files with 21 additions and 7 deletions
  1. 14 7
      scenes/main/control.tscn
  2. 5 0
      scenes/main/scripts/control.gd
  3. 2 0
      scenes/main/scripts/graph_edit.gd

+ 14 - 7
scenes/main/control.tscn

@@ -361,7 +361,7 @@ use_native_dialog = true
 auto_translate_mode = 1
 title = "No Input Selected"
 initial_position = 2
-size = Vector2i(350, 100)
+size = Vector2i(351, 100)
 visible = false
 transient = true
 exclusive = true
@@ -380,19 +380,25 @@ vertical_alignment = 1
 autowrap_mode = 2
 
 [node name="SaveChanges" type="Button" parent="SaveChangesPopup"]
-offset_left = -1.0
 offset_top = 70.0
-offset_right = 175.0
-offset_bottom = 101.0
+offset_right = 117.0
+offset_bottom = 100.0
 text = "Save"
 
 [node name="DontSaveChanges" type="Button" parent="SaveChangesPopup"]
-offset_left = 175.0
+offset_left = 117.0
 offset_top = 70.0
-offset_right = 351.0
-offset_bottom = 101.0
+offset_right = 234.0
+offset_bottom = 100.0
 text = "Don't Save"
 
+[node name="CancelChanges" type="Button" parent="SaveChangesPopup"]
+offset_left = 234.0
+offset_top = 70.0
+offset_right = 351.0
+offset_bottom = 100.0
+text = "Cancel"
+
 [node name="AudioSettings" parent="." groups=["popup_windows"] instance=ExtResource("5_dtf4o")]
 visible = false
 
@@ -528,6 +534,7 @@ text = "Stop Running Thread"
 [connection signal="file_selected" from="LoadDialog" to="." method="_on_load_dialog_file_selected"]
 [connection signal="button_down" from="SaveChangesPopup/SaveChanges" to="." method="_on_save_changes_button_down"]
 [connection signal="button_down" from="SaveChangesPopup/DontSaveChanges" to="." method="_on_dont_save_changes_button_down"]
+[connection signal="button_down" from="SaveChangesPopup/CancelChanges" to="." method="_on_cancel_changes_button_down"]
 [connection signal="close_requested" from="AudioSettings" to="." method="_on_audio_settings_close_requested"]
 [connection signal="about_to_popup" from="SearchMenu" to="SearchMenu" method="_on_about_to_popup"]
 [connection signal="editing_toggled" from="SearchMenu/VBoxContainer/SearchBar" to="SearchMenu" method="_on_search_bar_editing_toggled"]

+ 5 - 0
scenes/main/scripts/control.gd

@@ -39,6 +39,7 @@ func _ready() -> void:
 	$Settings.hide()
 	$ProgressWindow.hide()
 	$WrongFolderPopup.hide()
+	$SaveChangesPopup.hide()
 	
 	$SaveDialog.access = FileDialog.ACCESS_FILESYSTEM
 	$SaveDialog.file_mode = FileDialog.FILE_MODE_SAVE_FILE
@@ -546,6 +547,10 @@ func _on_dont_save_changes_button_down() -> void:
 	
 	savestate = "none"
 	
+func _on_cancel_changes_button_down() -> void:
+	$SaveChangesPopup.hide()
+	savestate = "none"
+	
 func _notification(what):
 	if what == NOTIFICATION_WM_CLOSE_REQUEST:
 		run_thread._on_kill_process_button_down()

+ 2 - 0
scenes/main/scripts/graph_edit.gd

@@ -243,6 +243,8 @@ func _make_node(command: String, skip_undo_redo := false) -> GraphNode:
 						graphnode.add_child(label)
 						graphnode.add_child(optionbutton)
 						graphnode.add_child(margin)
+				
+				control_script.changesmade = true
 			
 			
 			graphnode.set_script(node_logic)