Browse Source

added option to swap zoom and move

Jonathan Higgins 3 months ago
parent
commit
55f2e563e6

+ 1 - 0
Global/config_handler.gd

@@ -18,6 +18,7 @@ func _ready():
 	ensure_setting("interface_settings", "theme", 0)
 	ensure_setting("interface_settings", "theme_custom_colour", "#865699")
 	ensure_setting("interface_settings", "invert_theme", false)
+	ensure_setting("interface_settings", "swap_zoom_and_move", false)
 	ensure_setting("interface_settings", "delete_intermediate", true)
 	ensure_setting("interface_settings", "reuse_output_folder", true)
 	ensure_setting("interface_settings", "autoplay", true)

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

@@ -84,6 +84,7 @@ func make_signal_connections():
 	get_node("Settings").open_cdp_location.connect(show_cdp_location)
 	get_node("Settings").console_on_top.connect(change_console_settings)
 	get_node("Settings").invert_ui.connect(invert_theme_toggled)
+	get_node("Settings").swap_zoom_and_move.connect(swap_zoom_and_move)
 	
 func hidpi_adjustment():
 	#checks if display is hidpi and scales ui accordingly hidpi - 144
@@ -185,6 +186,7 @@ func check_user_preferences():
 			
 	#set the theme to either the main theme or inverted theme depending on user preferences
 	invert_theme_toggled(interface_settings.invert_theme)
+	swap_zoom_and_move(interface_settings.swap_zoom_and_move)
 
 		
 func show_cdp_location():
@@ -708,3 +710,9 @@ func invert_theme(theme: Theme) -> Theme:
 			inverted_theme.set_stylebox(sname, type, new_sb)
 	
 	return inverted_theme
+
+func swap_zoom_and_move(toggled: bool):
+	if toggled:
+		graph_edit.set_panning_scheme(1)
+	else:
+		graph_edit.set_panning_scheme(0)

+ 10 - 1
scenes/main/scripts/settings.gd

@@ -1,11 +1,14 @@
 extends Window
 signal open_cdp_location
 signal console_on_top
+signal invert_ui
+signal swap_zoom_and_move
+
 var interface_settings
 var main_theme = preload("res://theme/main_theme.tres")
 var cdpprogs_location
 
-signal invert_ui
+
 
 # Called when the node enters the scene tree for the first time.
 func _ready() -> void:
@@ -26,6 +29,7 @@ func _on_about_to_popup() -> void:
 	$VBoxContainer/HBoxContainer5/ThemeList.select(interface_settings.theme, true)
 	$VBoxContainer/HBoxContainer/CustomColourPicker.color = Color(interface_settings.theme_custom_colour)
 	$VBoxContainer/invert_ui_container/InvertUI.button_pressed = interface_settings.invert_theme
+	$VBoxContainer/HBoxContainer8/SwapZoomAndMoveToggle.button_pressed = interface_settings.swap_zoom_and_move
 	$VBoxContainer/HBoxContainer2/PvocWarning.button_pressed = interface_settings.disable_pvoc_warning
 	$VBoxContainer/HBoxContainer6/ProgressBar.button_pressed = interface_settings.disable_progress_bar
 	$VBoxContainer/HBoxContainer3/AutoCloseConsole.button_pressed = interface_settings.auto_close_console
@@ -74,3 +78,8 @@ func _on_custom_colour_picker_color_changed(color: Color) -> void:
 func _on_invert_ui_toggled(toggled_on: bool) -> void:
 	ConfigHandler.save_interface_settings("invert_theme", toggled_on)
 	invert_ui.emit(toggled_on)
+
+
+func _on_swap_zoom_and_move_toggle_toggled(toggled_on: bool) -> void:
+	ConfigHandler.save_interface_settings("swap_zoom_and_move", toggled_on)
+	swap_zoom_and_move.emit(toggled_on)

+ 27 - 4
scenes/main/settings.tscn

@@ -7,7 +7,7 @@
 auto_translate_mode = 1
 title = "SoundThread Settings"
 initial_position = 2
-size = Vector2i(500, 458)
+size = Vector2i(500, 516)
 transient = true
 unresizable = true
 always_on_top = true
@@ -15,7 +15,7 @@ script = ExtResource("1_uey6c")
 
 [node name="ColorRect" type="ColorRect" parent="." groups=["invertable_background"]]
 offset_right = 506.0
-offset_bottom = 467.0
+offset_bottom = 522.0
 color = Color(0.101961, 0.101961, 0.101961, 0.6)
 script = ExtResource("2_bym2s")
 
@@ -59,10 +59,10 @@ text = "Change location for cdprogs folder"
 layout_mode = 2
 theme_override_constants/margin_bottom = 7
 
-[node name="Label2" type="Label" parent="VBoxContainer"]
+[node name="Theme" type="Label" parent="VBoxContainer"]
 layout_mode = 2
 theme_override_font_sizes/font_size = 18
-text = "User Interface"
+text = "Appearance"
 
 [node name="HBoxContainer5" type="HBoxContainer" parent="VBoxContainer"]
 layout_mode = 2
@@ -107,6 +107,28 @@ text = "Invert UI colours:"
 layout_mode = 2
 size_flags_horizontal = 3
 
+[node name="Controls" type="Label" parent="VBoxContainer"]
+layout_mode = 2
+theme_override_font_sizes/font_size = 18
+text = "Controls"
+
+[node name="HBoxContainer8" type="HBoxContainer" parent="VBoxContainer"]
+layout_mode = 2
+tooltip_text = "Default: Scroll Zooms, Ctrl/Cmd + Scroll Moves"
+
+[node name="Label" type="Label" parent="VBoxContainer/HBoxContainer8"]
+layout_mode = 2
+text = "Swap Zoom and Move:"
+
+[node name="SwapZoomAndMoveToggle" type="CheckButton" parent="VBoxContainer/HBoxContainer8"]
+layout_mode = 2
+size_flags_horizontal = 3
+
+[node name="Windows" type="Label" parent="VBoxContainer"]
+layout_mode = 2
+theme_override_font_sizes/font_size = 18
+text = "Windows"
+
 [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"]
 layout_mode = 2
 
@@ -157,6 +179,7 @@ size_flags_horizontal = 3
 [connection signal="item_selected" from="VBoxContainer/HBoxContainer5/ThemeList" to="." method="_on_theme_list_item_selected"]
 [connection signal="color_changed" from="VBoxContainer/HBoxContainer/CustomColourPicker" to="." method="_on_custom_colour_picker_color_changed"]
 [connection signal="toggled" from="VBoxContainer/invert_ui_container/InvertUI" to="." method="_on_invert_ui_toggled"]
+[connection signal="toggled" from="VBoxContainer/HBoxContainer8/SwapZoomAndMoveToggle" to="." method="_on_swap_zoom_and_move_toggle_toggled"]
 [connection signal="toggled" from="VBoxContainer/HBoxContainer2/PvocWarning" to="." method="_on_pvoc_warning_toggled"]
 [connection signal="toggled" from="VBoxContainer/HBoxContainer6/ProgressBar" to="." method="_on_progress_bar_toggled"]
 [connection signal="toggled" from="VBoxContainer/HBoxContainer3/AutoCloseConsole" to="." method="_on_auto_close_console_toggled"]