Public Class Settings
	Public npu As NPUWindow
	Private Sub Settings_Load(sender As Object, e As EventArgs) Handles MyBase.Load
		NPUWindow.Enabled = False
		npu.Throbber.Visible = False
		Icon = ProgramIcon()
		BaseDirBox.Text = My.Settings.WorkingDirectory
		DefaultTheme.SelectedIndex = My.Settings.CurrentTheme
		SidebarCheckbox.Checked = My.Settings.ShowSidebar
		TransparencyCheckbox.Checked = My.Settings.MoveTransparency
		EncodingDropdown.SelectedIndex = My.Settings.DefaultEncoding
		GreenNotificationsCheckbox.Checked = My.Settings.GreenNotifications
		RecycleBinCheckbox.Checked = My.Settings.UseRecycleBin

		UnlimitedUndosCheckbox.Checked = My.Settings.UndoSteps = -1
		UndoStepLimit.Value = Math.Abs(My.Settings.UndoSteps)
		'UndoMemoryLimitCount.Value = Math.Abs(My.Settings.UndoMaxMemory)
		'UndoMemoryLimitCheckbox.Checked = My.Settings.UndoMaxMemory = -1

	End Sub

	Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
		Close()
	End Sub
	Private Sub enableMainWindow() Handles Me.FormClosed
		NPUWindow.Enabled = True
	End Sub

	Private Sub SidebarCheckbox_CheckedChanged(sender As Object, e As EventArgs) Handles SidebarCheckbox.CheckedChanged
		'If Not SidebarCheckbox.Checked Then MsgBox("Friendly reminder: You can show or hide the sidebar at any time by pressing F6.")
	End Sub

	Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
		BaseDirBox.Text = My.Computer.FileSystem.SpecialDirectories.MyDocuments 'visual basic is truly something else
	End Sub

	Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
		DirectoryPicker.ShowDialog()
		BaseDirBox.Text = DirectoryPicker.SelectedPath
	End Sub

	Private Sub Button3_Click(sender As Object, e As EventArgs) Handles SaveButton.Click
		My.Settings.WorkingDirectory = BaseDirBox.Text
		My.Settings.CurrentTheme = DefaultTheme.SelectedIndex
		My.Settings.ShowSidebar = SidebarCheckbox.Checked
		My.Settings.MoveTransparency = TransparencyCheckbox.Checked
		My.Settings.DefaultEncoding = EncodingDropdown.SelectedIndex
		My.Settings.GreenNotifications = GreenNotificationsCheckbox.Checked
		My.Settings.UseRecycleBin = RecycleBinCheckbox.Checked

		My.Settings.UndoUnlimitedSteps = UnlimitedUndosCheckbox.Checked = -1
		My.Settings.UndoSteps = UndoStepLimit.Value
		'My.Settings.UndoMemoryLimit = UndoMemoryLimitCount.Value
		'My.Settings.UndoMaxMemory = UndoMemoryLimitCheckbox.Checked = -1
		My.Settings.Save()
		Close()
	End Sub

	Private Sub setCustomColours_Click(sender As Object, e As EventArgs) Handles setCustomColours.Click
		Customise_Colours.Show()
	End Sub

	Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
		If MsgBox("Editing the supported file extensions may lead to critical errors and a less stable Notepad Ultra. It is only recommended if you know what you're doing. Continue?", MsgBoxStyle.Exclamation Or MsgBoxStyle.YesNo Or MsgBoxStyle.DefaultButton2, "Be careful!") = MsgBoxResult.Yes Then Supported_File_Extensions.Show()
	End Sub

	Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
		Status_Bar_Options.Show()
	End Sub

	Private Sub DefaultButton_Click(sender As Object, e As EventArgs) Handles DefaultButton.Click
		MsgBox("Not yet supported")
	End Sub

	Private Sub UndoStepLimit_ValueChanged(sender As Object, e As EventArgs) Handles UndoStepLimit.ValueChanged
		UndoMemoryLimitCount.Enabled = UndoStepLimit.Value = 0 'pretend these are all == 0
		UndoMemoryLimitCheckbox.Enabled = UndoStepLimit.Value = 0
		UnlimitedUndosCheckbox.Enabled = UndoStepLimit.Value = 0
	End Sub

	Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
		Passed_File_Action_Settings.Show()
	End Sub

	Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
		Preset_Directory_Manager.Show()
	End Sub
End Class