diff --git a/Code/Flowframes.csproj b/Code/Flowframes.csproj
index a920d31..b614300 100644
--- a/Code/Flowframes.csproj
+++ b/Code/Flowframes.csproj
@@ -380,6 +380,9 @@
DebugForm.cs
+
+ Form
+
Form
@@ -451,10 +454,10 @@
-
+
Form
-
+
Form1.cs
@@ -484,7 +487,7 @@
-
+
Form1.cs
Designer
diff --git a/Code/Form1.Designer.cs b/Code/Forms/Main/Form1.Designer.cs
similarity index 99%
rename from Code/Form1.Designer.cs
rename to Code/Forms/Main/Form1.Designer.cs
index 09428a1..79f3486 100644
--- a/Code/Form1.Designer.cs
+++ b/Code/Forms/Main/Form1.Designer.cs
@@ -1,4 +1,4 @@
-namespace Flowframes
+namespace Flowframes.Forms.Main
{
partial class Form1
{
diff --git a/Code/Forms/Main/Form1.Properties.cs b/Code/Forms/Main/Form1.Properties.cs
new file mode 100644
index 0000000..92face0
--- /dev/null
+++ b/Code/Forms/Main/Form1.Properties.cs
@@ -0,0 +1,74 @@
+using Flowframes.Data;
+using Flowframes.Main;
+using Flowframes.MiscUtils;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Flowframes.Forms.Main
+{
+ partial class Form1
+ {
+ Enums.Output.Format OutputFormat { get { return ParseUtils.GetEnum(comboxOutputFormat.Text, true, Strings.OutputFormat); } }
+
+ Enums.Encoding.Encoder Encoder
+ {
+ get
+ {
+ if (comboxOutputEncoder.Visible)
+ return ParseUtils.GetEnum(comboxOutputEncoder.Text, true, Strings.Encoder);
+ else
+ return (Enums.Encoding.Encoder)(-1);
+ }
+ }
+
+ Enums.Encoding.PixelFormat PixelFormat
+ {
+ get
+ {
+ if (comboxOutputColors.Visible)
+ return ParseUtils.GetEnum(comboxOutputColors.Text, true, Strings.PixelFormat);
+ else
+ return (Enums.Encoding.PixelFormat)(-1);
+ }
+ }
+
+ public ModelCollection.ModelInfo GetModel(AI currentAi)
+ {
+ try
+ {
+ return AiModels.GetModels(currentAi).Models[aiModel.SelectedIndex];
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public AI GetAi()
+ {
+ try
+ {
+ foreach (AI ai in Implementations.NetworksAll)
+ {
+ if (GetAiComboboxName(ai) == aiCombox.Text)
+ return ai;
+ }
+
+ return Implementations.NetworksAvailable[0];
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public OutputSettings GetOutputSettings()
+ {
+ string custQ = textboxOutputQualityCust.Visible ? textboxOutputQualityCust.Text.Trim() : "";
+ return new OutputSettings() { Encoder = Encoder, Format = OutputFormat, PixelFormat = PixelFormat, Quality = comboxOutputQuality.Text, CustomQuality = custQ };
+ }
+ }
+}
diff --git a/Code/Form1.cs b/Code/Forms/Main/Form1.cs
similarity index 93%
rename from Code/Form1.cs
rename to Code/Forms/Main/Form1.cs
index 6dddc8d..82ee680 100644
--- a/Code/Form1.cs
+++ b/Code/Forms/Main/Form1.cs
@@ -20,7 +20,7 @@ using System.Runtime.InteropServices;
#pragma warning disable IDE1006
-namespace Flowframes
+namespace Flowframes.Forms.Main
{
public partial class Form1 : Form
{
@@ -29,8 +29,9 @@ namespace Flowframes
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); // PREVENT WINDOWS FROM GOING TO SLEEP
- public bool initialized = false;
- public bool quickSettingsInitialized = false;
+ private bool _initialized = false;
+ private bool _mainTabInitialized = false;
+ private bool _quickSettingsInitialized = false;
public Form1()
{
@@ -337,9 +338,18 @@ namespace Flowframes
return ai.FriendlyName + " - " + ai.Description;
}
+ private void InitializeMainTab ()
+ {
+ if (_mainTabInitialized)
+ return;
+
+ LoadOutputSettings();
+ _mainTabInitialized = true;
+ }
+
public void Initialized()
{
- initialized = true;
+ _initialized = true;
runBtn.Enabled = true;
}
@@ -378,7 +388,7 @@ namespace Flowframes
Interpolate.currentSettings = GetCurrentSettings();
AiProcessSuspend.Reset();
-
+ SaveOutputSettings();
if (Interpolate.currentSettings.outSettings.Format == Enums.Output.Format.Realtime)
{
@@ -391,33 +401,27 @@ namespace Flowframes
}
}
- public ModelCollection.ModelInfo GetModel(AI currentAi)
+ private void SaveOutputSettings ()
{
- try
- {
- return AiModels.GetModels(currentAi).Models[aiModel.SelectedIndex];
- }
- catch
- {
- return null;
- }
+ var strings = new List();
+ if (comboxOutputFormat.Visible) strings.Add(comboxOutputFormat.Text);
+ if (comboxOutputEncoder.Visible) strings.Add(comboxOutputEncoder.Text);
+ if (comboxOutputQuality.Visible) strings.Add(comboxOutputQuality.Text);
+ if (comboxOutputColors.Visible) strings.Add(comboxOutputColors.Text);
+ Config.Set(Config.Key.lastOutputSettings, string.Join(",", strings));
}
- Enums.Output.Format GetOutputFormat { get { return ParseUtils.GetEnum(comboxOutputFormat.Text, true, Strings.OutputFormat); } }
- Enums.Encoding.Encoder GetEncoder { get { return ParseUtils.GetEnum(comboxOutputEncoder.Text, true, Strings.Encoder); } }
-
- private Enums.Encoding.PixelFormat GetPixelFormat()
+ private void LoadOutputSettings()
{
- if (!comboxOutputColors.Visible)
- return (Enums.Encoding.PixelFormat)(-1);
+ string[] strings = Config.Get(Config.Key.lastOutputSettings).Split(',');
- return ParseUtils.GetEnum(comboxOutputColors.Text, true, Strings.PixelFormat);
- }
+ if (strings.Length < 4)
+ return;
- public OutputSettings GetOutputSettings()
- {
- string custQ = textboxOutputQualityCust.Visible ? textboxOutputQualityCust.Text.Trim() : "";
- return new OutputSettings() { Encoder = GetEncoder, Format = GetOutputFormat, PixelFormat = GetPixelFormat(), Quality = comboxOutputQuality.Text, CustomQuality = custQ };
+ if (comboxOutputFormat.Visible) comboxOutputFormat.Text = strings[0];
+ if (comboxOutputEncoder.Visible) comboxOutputEncoder.Text = strings[1];
+ if (comboxOutputQuality.Visible) comboxOutputQuality.Text = strings[2];
+ if (comboxOutputColors.Visible) comboxOutputColors.Text = strings[3];
}
public void SetFormat(Enums.Output.Format format)
@@ -425,25 +429,6 @@ namespace Flowframes
comboxOutputFormat.Text = Strings.OutputFormat.Get(format.ToString());
}
- public AI GetAi()
- {
- try
- {
- foreach (AI ai in Implementations.NetworksAll)
- {
- if (GetAiComboboxName(ai) == aiCombox.Text)
- return ai;
- }
-
- Logger.Log($"AI implementation lookup failed! This should not happen! Please tell the developer!");
- return Implementations.NetworksAvailable[0];
- }
- catch
- {
- return null;
- }
- }
-
void inputTbox_DragEnter(object sender, DragEventArgs e) { e.Effect = DragDropEffects.Copy; }
private void inputTbox_DragDrop(object sender, DragEventArgs e)
@@ -530,7 +515,7 @@ namespace Flowframes
interpFactorCombox.SelectedIndex = 0;
- if (initialized)
+ if (_initialized)
Config.Set(Config.Key.lastUsedAiName, GetAi().NameInternal);
interpFactorCombox_SelectedIndexChanged(null, null);
@@ -690,8 +675,13 @@ namespace Flowframes
private void mainTabControl_SelectedIndexChanged(object sender, EventArgs e)
{
- if (!initialized) return;
- aiCombox_SelectedIndexChanged(null, null);
+ if (!_initialized) return;
+
+ if(mainTabControl.SelectedTab == interpOptsTab)
+ {
+ aiCombox_SelectedIndexChanged(null, null);
+ InitializeMainTab();
+ }
}
private void trimCombox_SelectedIndexChanged(object sender, EventArgs e)
@@ -720,7 +710,7 @@ namespace Flowframes
public void SaveQuickSettings(object sender, EventArgs e)
{
- if (!quickSettingsInitialized) return;
+ if (!_quickSettingsInitialized) return;
if (Program.busy)
LoadQuickSettings(); // Discard any changes if busy
@@ -746,7 +736,7 @@ namespace Flowframes
ConfigParser.LoadGuiElement(scnDetectValue);
ConfigParser.LoadGuiElement(maxFps);
- quickSettingsInitialized = true;
+ _quickSettingsInitialized = true;
}
private void dedupMode_SelectedIndexChanged(object sender, EventArgs e)
diff --git a/Code/Form1.resx b/Code/Forms/Main/Form1.resx
similarity index 100%
rename from Code/Form1.resx
rename to Code/Forms/Main/Form1.resx
diff --git a/Code/IO/Config.cs b/Code/IO/Config.cs
index a5c5106..aa31be2 100644
--- a/Code/IO/Config.cs
+++ b/Code/IO/Config.cs
@@ -360,7 +360,8 @@ namespace Flowframes.IO
torchGpus,
uhdThresh,
vsRtShowOsd,
- vsUseLsmash
+ vsUseLsmash,
+ lastOutputSettings,
}
}
}
diff --git a/Code/Media/AvOutputHandler.cs b/Code/Media/AvOutputHandler.cs
index a751bfb..8142c6b 100644
--- a/Code/Media/AvOutputHandler.cs
+++ b/Code/Media/AvOutputHandler.cs
@@ -1,4 +1,5 @@
-using Flowframes.MiscUtils;
+using Flowframes.Forms.Main;
+using Flowframes.MiscUtils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
diff --git a/Code/Program.cs b/Code/Program.cs
index 5cb4273..334cd9b 100644
--- a/Code/Program.cs
+++ b/Code/Program.cs
@@ -1,5 +1,6 @@
using Flowframes.Data;
using Flowframes.Forms;
+using Flowframes.Forms.Main;
using Flowframes.IO;
using Flowframes.MiscUtils;
using Flowframes.Os;