mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Avoid scrolling to right side when scrolling logBox to bottom
This commit is contained in:
@@ -66,7 +66,7 @@ namespace Flowframes.Forms
|
|||||||
|
|
||||||
private void logFilesDropdown_SelectedIndexChanged(object sender, EventArgs e)
|
private void logFilesDropdown_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
logBox.AppendText(File.ReadAllText(Path.Combine(Paths.GetLogPath(), logFilesDropdown.Text)).Trim('\r', '\n'));
|
DebugFormHelper.RefreshLogBox(logBox, logFilesDropdown.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textWrapBtn_Click(object sender, EventArgs e)
|
private void textWrapBtn_Click(object sender, EventArgs e)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Flowframes.UI
|
|||||||
{
|
{
|
||||||
#region Log Viewer
|
#region Log Viewer
|
||||||
|
|
||||||
public static void FillLogDropdown (ComboBox dd)
|
public static void FillLogDropdown(ComboBox dd)
|
||||||
{
|
{
|
||||||
dd.Items.Clear();
|
dd.Items.Clear();
|
||||||
|
|
||||||
@@ -24,6 +24,16 @@ namespace Flowframes.UI
|
|||||||
dd.Items.Add(file.Name);
|
dd.Items.Add(file.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RefreshLogBox(TextBox logBox, string logFilename)
|
||||||
|
{
|
||||||
|
bool wrap = logBox.WordWrap;
|
||||||
|
logBox.WordWrap = true;
|
||||||
|
logBox.Text = File.ReadAllText(Path.Combine(Paths.GetLogPath(), logFilename)).Trim('\r', '\n');
|
||||||
|
logBox.SelectionStart = logBox.Text.Length;
|
||||||
|
logBox.ScrollToCaret();
|
||||||
|
logBox.WordWrap = wrap;
|
||||||
|
}
|
||||||
|
|
||||||
public static void ToggleMonospace(TextBox logBox)
|
public static void ToggleMonospace(TextBox logBox)
|
||||||
{
|
{
|
||||||
bool isMonospace = logBox.Font.Name.ToLower().Contains("consolas");
|
bool isMonospace = logBox.Font.Name.ToLower().Contains("consolas");
|
||||||
@@ -34,7 +44,7 @@ namespace Flowframes.UI
|
|||||||
logBox.Font = new System.Drawing.Font("Consolas", 8.0f);
|
logBox.Font = new System.Drawing.Font("Consolas", 8.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void CopyLogToClipboard (string logFilename)
|
public static void CopyLogToClipboard(string logFilename)
|
||||||
{
|
{
|
||||||
StringCollection paths = new StringCollection();
|
StringCollection paths = new StringCollection();
|
||||||
string path = Path.Combine(Paths.GetLogPath(), logFilename);
|
string path = Path.Combine(Paths.GetLogPath(), logFilename);
|
||||||
@@ -46,11 +56,11 @@ namespace Flowframes.UI
|
|||||||
|
|
||||||
#region Config Editor Grid
|
#region Config Editor Grid
|
||||||
|
|
||||||
public static void LoadGrid (DataGridView grid)
|
public static void LoadGrid(DataGridView grid)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> configDict = new Dictionary<string, string>();
|
Dictionary<string, string> configDict = new Dictionary<string, string>();
|
||||||
|
|
||||||
if(grid.Columns.Count < 2)
|
if (grid.Columns.Count < 2)
|
||||||
{
|
{
|
||||||
grid.Columns.Add("keys", "Key Name");
|
grid.Columns.Add("keys", "Key Name");
|
||||||
grid.Columns.Add("vals", "Saved Value");
|
grid.Columns.Add("vals", "Saved Value");
|
||||||
@@ -71,7 +81,7 @@ namespace Flowframes.UI
|
|||||||
grid.Columns[1].FillWeight = 50;
|
grid.Columns[1].FillWeight = 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveGrid (DataGridView grid)
|
public static void SaveGrid(DataGridView grid)
|
||||||
{
|
{
|
||||||
foreach (DataGridViewRow row in grid.Rows)
|
foreach (DataGridViewRow row in grid.Rows)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user