Added: big icon support

This commit is contained in:
Ray 2020-11-14 16:47:52 +00:00
parent eb334fe00c
commit 71480592d2
6 changed files with 111 additions and 20 deletions

View File

@ -290,6 +290,21 @@ namespace RyzStudio.Windows.Forms
return rv; return rv;
} }
public static void SetChecked(ToolStripMenuItem control, bool value)
{
if (control.GetCurrentParent().InvokeRequired)
{
control.GetCurrentParent().Invoke(new MethodInvoker(() =>
{
control.Checked = value;
}));
}
else
{
control.Checked = value;
}
}
public static void SetEnable(Control control, bool value) public static void SetEnable(Control control, bool value)
{ {
if (control.InvokeRequired) if (control.InvokeRequired)

24
MainForm.Designer.cs generated
View File

@ -42,6 +42,7 @@
this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripMenuItem10 = new System.Windows.Forms.ToolStripSeparator();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem9 = new System.Windows.Forms.ToolStripMenuItem();
this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.optionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -55,7 +56,7 @@
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItem11 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem12 = new System.Windows.Forms.ToolStripMenuItem();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.contextMenuStrip2.SuspendLayout(); this.contextMenuStrip2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -147,16 +148,24 @@
// toolStripMenuItem3 // toolStripMenuItem3
// //
this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem12,
this.toolStripMenuItem11, this.toolStripMenuItem11,
this.toolStripMenuItem1}); this.toolStripMenuItem1});
this.toolStripMenuItem3.Name = "toolStripMenuItem3"; this.toolStripMenuItem3.Name = "toolStripMenuItem3";
this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
this.toolStripMenuItem3.Text = "&View"; this.toolStripMenuItem3.Text = "&View";
// //
// toolStripMenuItem11
//
this.toolStripMenuItem11.Name = "toolStripMenuItem11";
this.toolStripMenuItem11.Size = new System.Drawing.Size(222, 22);
this.toolStripMenuItem11.Text = "Enable &Animation";
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click);
//
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem1.Size = new System.Drawing.Size(222, 22);
this.toolStripMenuItem1.Text = "Always On &Top"; this.toolStripMenuItem1.Text = "Always On &Top";
this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click); this.toolStripMenuItem1.Click += new System.EventHandler(this.toolStripMenuItem1_Click);
// //
@ -251,12 +260,12 @@
this.exitToolStripMenuItem1.Text = "E&xit"; this.exitToolStripMenuItem1.Text = "E&xit";
this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click); this.exitToolStripMenuItem1.Click += new System.EventHandler(this.exitToolStripMenuItem1_Click);
// //
// toolStripMenuItem11 // toolStripMenuItem12
// //
this.toolStripMenuItem11.Name = "toolStripMenuItem11"; this.toolStripMenuItem12.Name = "toolStripMenuItem12";
this.toolStripMenuItem11.Size = new System.Drawing.Size(180, 22); this.toolStripMenuItem12.Size = new System.Drawing.Size(222, 22);
this.toolStripMenuItem11.Text = "Enable &Animation"; this.toolStripMenuItem12.Text = "Enable &Big Icons (In Folders)";
this.toolStripMenuItem11.Click += new System.EventHandler(this.toolStripMenuItem11_Click); this.toolStripMenuItem12.Click += new System.EventHandler(this.toolStripMenuItem12_Click);
// //
// MainForm // MainForm
// //
@ -304,6 +313,7 @@
private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem11;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem12;
} }
} }

View File

@ -390,7 +390,6 @@ namespace AppLauncher
foreach (TileGroupModel item in this.CurrentSession.Groups) foreach (TileGroupModel item in this.CurrentSession.Groups)
{ {
TTilePanelLayout panel = new TTilePanelLayout(item); TTilePanelLayout panel = new TTilePanelLayout(item);
panel.EnableAnimation = this.CurrentSession.EnableAnimation;
maxWidth = Math.Max(maxWidth, panel.Width); maxWidth = Math.Max(maxWidth, panel.Width);
@ -405,6 +404,8 @@ namespace AppLauncher
// //
ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop); ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
ThreadControl.SetVisible(this, true); ThreadControl.SetVisible(this, true);
ThreadControl.SetChecked(toolStripMenuItem11, this.CurrentSession.EnableAnimation);
ThreadControl.SetChecked(toolStripMenuItem12, this.CurrentSession.EnableBigIconInFolder);
if (this.InvokeRequired) if (this.InvokeRequired)
{ {
@ -567,17 +568,15 @@ namespace AppLauncher
this.CurrentSession.EnableAnimation = !this.CurrentSession.EnableAnimation; this.CurrentSession.EnableAnimation = !this.CurrentSession.EnableAnimation;
toolStripMenuItem11.Checked = this.CurrentSession.EnableAnimation; toolStripMenuItem11.Checked = this.CurrentSession.EnableAnimation;
for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
{
if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout))
{
continue;
} }
TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout; private void toolStripMenuItem12_Click(object sender, EventArgs e)
container.EnableAnimation = this.CurrentSession.EnableAnimation; {
} if (this.CurrentSession == null) return;
this.CurrentSession.EnableBigIconInFolder = !this.CurrentSession.EnableBigIconInFolder;
toolStripMenuItem12.Checked = this.CurrentSession.EnableBigIconInFolder;
} }
} }

View File

@ -29,6 +29,7 @@ namespace AppLauncher.Models
public bool AlwaysOnTop { get; set; } = false; public bool AlwaysOnTop { get; set; } = false;
public bool EnableAnimation { get; set; } = false; public bool EnableAnimation { get; set; } = false;
public bool EnableBigIconInFolder { get; set; } = false;
public bool HideOnClose { get; set; } = false; public bool HideOnClose { get; set; } = false;
public bool HideOnClick { get; set; } = false; public bool HideOnClick { get; set; } = false;

View File

@ -85,7 +85,7 @@ namespace AppLauncher.Windows.Forms
{ {
this.DropFileList(fileList); this.DropFileList(fileList);
this.LoadInfo(this.ModelInfo); invalidateGroupMenu(this.ModelInfo);
} }
else else
{ {
@ -227,6 +227,8 @@ namespace AppLauncher.Windows.Forms
{ {
if (groupContextMenu != null) if (groupContextMenu != null)
{ {
invalidateGroupMenuSize();
groupContextMenu.Show(this, e.Location); groupContextMenu.Show(this, e.Location);
} }
} }
@ -341,7 +343,11 @@ namespace AppLauncher.Windows.Forms
protected void invalidateGroupMenu(TileModel model) protected void invalidateGroupMenu(TileModel model)
{ {
if (groupContextMenu == null) groupContextMenu = new ContextMenuStrip(); if (groupContextMenu == null)
{
groupContextMenu = new ContextMenuStrip();
}
groupContextMenu.Items.Clear(); groupContextMenu.Items.Clear();
if (model.Items == null) if (model.Items == null)
@ -356,7 +362,26 @@ namespace AppLauncher.Windows.Forms
toolItem.Tag = item; toolItem.Tag = item;
toolItem.Click += toolItem_Click; toolItem.Click += toolItem_Click;
} }
}
protected void invalidateGroupMenuSize()
{
if (this.PanelContainer != null)
{
if (this.PanelContainer.MainForm != null)
{
if (this.PanelContainer.MainForm.CurrentSession != null)
{
if (this.PanelContainer.MainForm.CurrentSession.EnableBigIconInFolder)
{
groupContextMenu.ImageScalingSize = new Size(24, 24);
return;
}
}
}
}
groupContextMenu.ImageScalingSize = new Size(16, 16);
} }
protected MainForm findMainForm() protected MainForm findMainForm()

View File

@ -129,7 +129,24 @@ namespace AppLauncher.Windows.Forms
} }
} }
public bool EnableAnimation { get; set; } = true; public bool EnableAnimation
{
get
{
MainForm mainForm = this.MainForm;
if (mainForm == null)
{
return false;
}
if (mainForm.CurrentSession == null)
{
return false;
}
return mainForm.CurrentSession.EnableAnimation;
}
}
public int CollapseHeight => labelHeight + collapseHeight; public int CollapseHeight => labelHeight + collapseHeight;
@ -221,6 +238,30 @@ namespace AppLauncher.Windows.Forms
} }
} }
public MainForm MainForm
{
get
{
FlowLayoutPanel layoutPanel = this.FlowLayoutPanel;
if (layoutPanel == null)
{
return null;
}
if (layoutPanel.Parent == null)
{
return null;
}
if (layoutPanel.Parent.GetType() != typeof(MainForm))
{
return null;
}
return layoutPanel.Parent as MainForm;
}
}
public List<TileModel> Tiles public List<TileModel> Tiles
{ {
get get