Added support for resizing tile layout table
This commit is contained in:
parent
95ccefbb1b
commit
4c52f19a60
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using RokettoLaunch.Models.SaveFile;
|
||||
using RokettoLaunch.Windows.Forms;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
|
||||
using RyzStudio.Windows.ThemedForms.PickerBox;
|
||||
@ -14,8 +15,11 @@ namespace RokettoLaunch
|
||||
private ThYesNoPickerBox pickerBox1;
|
||||
private ThClearableTextBox textBox1;
|
||||
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
|
||||
|
||||
|
||||
private THorizontalSeparator horizontalSeparator1;
|
||||
private RyzStudio.Windows.ThemedForms.ThNumericBox numericBox1;
|
||||
private Label label4;
|
||||
private RyzStudio.Windows.ThemedForms.ThNumericBox numericBox2;
|
||||
private Label label3;
|
||||
private App4Options.Group result = null;
|
||||
|
||||
|
||||
@ -30,6 +34,10 @@ namespace RokettoLaunch
|
||||
result = model;
|
||||
|
||||
pickerBox1.Setup([ "No", "Yes" ], 0);
|
||||
numericBox1.Minimum = TileLayoutPanel.MIN_COLUMNS;
|
||||
numericBox1.Maximum = 32;
|
||||
numericBox2.Minimum = 1;
|
||||
numericBox2.Maximum = 32;
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
@ -38,6 +46,8 @@ namespace RokettoLaunch
|
||||
|
||||
textBox1.Text = result?.Title?.Trim() ?? "New Group";
|
||||
pickerBox1.Value = result?.IsOpen ?? true;
|
||||
numericBox1.Value = Math.Max(TileLayoutPanel.MIN_COLUMNS, result?.GridSize.Width ?? TileLayoutPanel.MIN_COLUMNS);
|
||||
numericBox2.Value = Math.Max(1, result?.GridSize.Height ?? 1);
|
||||
}
|
||||
|
||||
|
||||
@ -48,6 +58,11 @@ namespace RokettoLaunch
|
||||
label1 = new Label();
|
||||
pickerBox1 = new ThYesNoPickerBox();
|
||||
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
||||
horizontalSeparator1 = new THorizontalSeparator();
|
||||
numericBox1 = new RyzStudio.Windows.ThemedForms.ThNumericBox();
|
||||
label4 = new Label();
|
||||
numericBox2 = new RyzStudio.Windows.ThemedForms.ThNumericBox();
|
||||
label3 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
@ -118,10 +133,78 @@ namespace RokettoLaunch
|
||||
dialogFooter1.TabIndex = 0;
|
||||
dialogFooter1.TabStop = false;
|
||||
//
|
||||
// horizontalSeparator1
|
||||
//
|
||||
horizontalSeparator1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
horizontalSeparator1.Location = new System.Drawing.Point(5, 99);
|
||||
horizontalSeparator1.Name = "horizontalSeparator1";
|
||||
horizontalSeparator1.Size = new System.Drawing.Size(375, 10);
|
||||
//
|
||||
// numericBox1
|
||||
//
|
||||
numericBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
numericBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
numericBox1.EnableMovable = false;
|
||||
numericBox1.Location = new System.Drawing.Point(275, 116);
|
||||
numericBox1.Maximum = 20;
|
||||
numericBox1.Minimum = 4;
|
||||
numericBox1.Name = "numericBox1";
|
||||
numericBox1.Size = new System.Drawing.Size(100, 32);
|
||||
numericBox1.TabIndex = 198;
|
||||
numericBox1.TabStop = false;
|
||||
numericBox1.Value = 1;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.BackColor = System.Drawing.Color.Transparent;
|
||||
label4.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
label4.Location = new System.Drawing.Point(10, 116);
|
||||
label4.Margin = new Padding(0);
|
||||
label4.Name = "label4";
|
||||
label4.Padding = new Padding(0, 8, 0, 0);
|
||||
label4.Size = new System.Drawing.Size(76, 23);
|
||||
label4.TabIndex = 197;
|
||||
label4.Text = "Tiles Per Row";
|
||||
label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// numericBox2
|
||||
//
|
||||
numericBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
numericBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
numericBox2.EnableMovable = false;
|
||||
numericBox2.Location = new System.Drawing.Point(275, 158);
|
||||
numericBox2.Maximum = 32;
|
||||
numericBox2.Minimum = 1;
|
||||
numericBox2.Name = "numericBox2";
|
||||
numericBox2.Size = new System.Drawing.Size(100, 32);
|
||||
numericBox2.TabIndex = 200;
|
||||
numericBox2.TabStop = false;
|
||||
numericBox2.Value = 1;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.BackColor = System.Drawing.Color.Transparent;
|
||||
label3.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
label3.Location = new System.Drawing.Point(10, 158);
|
||||
label3.Margin = new Padding(0);
|
||||
label3.Name = "label3";
|
||||
label3.Padding = new Padding(0, 8, 0, 0);
|
||||
label3.Size = new System.Drawing.Size(96, 23);
|
||||
label3.TabIndex = 199;
|
||||
label3.Text = "Number of Rows";
|
||||
label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// EditGroupForm
|
||||
//
|
||||
BackColor = System.Drawing.Color.White;
|
||||
ClientSize = new System.Drawing.Size(384, 521);
|
||||
Controls.Add(numericBox2);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(numericBox1);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(horizontalSeparator1);
|
||||
Controls.Add(dialogFooter1);
|
||||
Controls.Add(pickerBox1);
|
||||
Controls.Add(label2);
|
||||
@ -143,8 +226,13 @@ namespace RokettoLaunch
|
||||
result = new App4Options.Group();
|
||||
}
|
||||
|
||||
var maxGridSize = result.GetMaxGridSize();
|
||||
var x = Math.Max(maxGridSize.Width, numericBox1.Value);
|
||||
var y = Math.Max(maxGridSize.Height, numericBox2.Value);
|
||||
|
||||
result.Title = textBox1.Text?.Trim() ?? string.Empty;
|
||||
result.IsOpen = pickerBox1.Value;
|
||||
result.GridSize = new System.Drawing.Size(x, y);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
10
MainForm.cs
10
MainForm.cs
@ -13,16 +13,11 @@ using RyzStudio;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
|
||||
using RyzStudio.Windows.TileForms;
|
||||
|
||||
namespace RokettoLaunch
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
//private const int MIN_COLUMNS = 4;
|
||||
//private const int TILE_SIZE = 70;
|
||||
//private const int TILE_PADDING = 3;
|
||||
|
||||
private readonly IServiceProvider _provider;
|
||||
private readonly IFileSessionManager _fileSessionManager;
|
||||
|
||||
@ -685,6 +680,8 @@ namespace RokettoLaunch
|
||||
return;
|
||||
}
|
||||
|
||||
var tableLayout = (TileLayoutPanel)panel.ToggleControl;
|
||||
|
||||
var editGroupForm = new EditGroupForm(groupInfo);
|
||||
if (editGroupForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
@ -692,10 +689,13 @@ namespace RokettoLaunch
|
||||
|
||||
groupInfo.Title = newGroupInfo.Title;
|
||||
groupInfo.IsOpen = newGroupInfo.IsOpen;
|
||||
groupInfo.GridSize = newGroupInfo.GridSize;
|
||||
|
||||
panel.Title = newGroupInfo.Title;
|
||||
panel.Invalidate();
|
||||
|
||||
tableLayout.SetGridSize(groupInfo.GridSize);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user