From c90d846f2eeef259fa10351da65c15098c8af864 Mon Sep 17 00:00:00 2001 From: Ray Date: Sat, 16 May 2020 13:25:59 +0100 Subject: [PATCH] Changed: new light theme --- LinearAppLauncher.csproj | 29 ++-- MainForm.Designer.cs | 1 + MainForm.cs | 10 +- Properties/Resources.Designer.cs | 4 +- Properties/Resources.resx | 4 +- Resources/folder_32.png | Bin 0 -> 601 bytes Resources/raw/arrow-down.svg | 1 - Resources/raw/arrow-right.svg | 75 --------- Resources/raw/folder.svg | 63 -------- Resources/raw/grid.svg | 96 ------------ Resources/raw/{listbox.svg => icon-set.svg} | 16 +- Resources/raw/toggle-left.svg | 78 ---------- Resources/raw/toggle-right.svg | 77 ---------- Windows/Forms/AForm.cs | 142 +++++++++--------- Windows/Forms/Tile/AddListTileForm.cs | 6 +- Windows/Forms/Tile/AddTileForm.cs | 6 +- Windows/Forms/Tile/EditGroupForm.cs | 6 +- Windows/Forms/Tile/EditListTileForm.cs | 6 +- Windows/Forms/Tile/EditTileForm.cs | 6 +- ...nel.Designer.cs => TTilePanel.Designer.cs} | 3 +- .../Tile/{TilePanel.cs => TTilePanel.cs} | 30 +++- .../Tile/{TilePanel.resx => TTilePanel.resx} | 0 ...signer.cs => TTilePanelLayout.Designer.cs} | 2 +- ...TilePanelLayout.cs => TTilePanelLayout.cs} | 47 +++--- ...PanelLayout.resx => TTilePanelLayout.resx} | 0 25 files changed, 165 insertions(+), 543 deletions(-) create mode 100644 Resources/folder_32.png delete mode 100644 Resources/raw/arrow-down.svg delete mode 100644 Resources/raw/arrow-right.svg delete mode 100644 Resources/raw/folder.svg delete mode 100644 Resources/raw/grid.svg rename Resources/raw/{listbox.svg => icon-set.svg} (96%) delete mode 100644 Resources/raw/toggle-left.svg delete mode 100644 Resources/raw/toggle-right.svg rename Windows/Forms/Tile/{TilePanel.Designer.cs => TTilePanel.Designer.cs} (97%) rename Windows/Forms/Tile/{TilePanel.cs => TTilePanel.cs} (85%) rename Windows/Forms/Tile/{TilePanel.resx => TTilePanel.resx} (100%) rename Windows/Forms/Tile/{TilePanelLayout.Designer.cs => TTilePanelLayout.Designer.cs} (99%) rename Windows/Forms/Tile/{TilePanelLayout.cs => TTilePanelLayout.cs} (93%) rename Windows/Forms/Tile/{TilePanelLayout.resx => TTilePanelLayout.resx} (100%) diff --git a/LinearAppLauncher.csproj b/LinearAppLauncher.csproj index 0e11b08..f001814 100644 --- a/LinearAppLauncher.csproj +++ b/LinearAppLauncher.csproj @@ -155,17 +155,17 @@ UserControl - + UserControl - - TilePanelLayout.cs + + TTilePanelLayout.cs - + UserControl - - TilePanel.cs + + TTilePanel.cs MainForm.cs @@ -211,11 +211,11 @@ EditTileForm.cs - - TilePanelLayout.cs + + TTilePanelLayout.cs - - TilePanel.cs + + TTilePanel.cs @@ -286,14 +286,11 @@ - - - - - - + + + \ No newline at end of file diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index de5fcdb..e39d5a3 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -120,6 +120,7 @@ this.Controls.Add(this.flowLayoutPanel1); this.Name = "MainForm"; this.Text = "Form1"; + this.TitleContextMenuStrip = this.contextMenuStrip1; this.contextMenuStrip1.ResumeLayout(false); this.ResumeLayout(false); diff --git a/MainForm.cs b/MainForm.cs index 172b6a7..7efe808 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -52,7 +52,6 @@ namespace AppLauncher if (this.Width > collapsedWidth) { flowLayoutPanel1.Visible = false; - //titlePanel1.LabelVisible = false; await collapseWindow(collapsedWidth, 6); } @@ -61,7 +60,6 @@ namespace AppLauncher await expandWindow(expandedWidth, 8); flowLayoutPanel1.Visible = true; - //titlePanel1.LabelVisible = true; } } @@ -92,12 +90,12 @@ namespace AppLauncher List rs = new List(); for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++) { - if (flowLayoutPanel1.Controls[i].GetType() != typeof(TilePanelLayout)) + if (flowLayoutPanel1.Controls[i].GetType() != typeof(TTilePanelLayout)) { continue; } - TilePanelLayout container = flowLayoutPanel1.Controls[i] as TilePanelLayout; + TTilePanelLayout container = flowLayoutPanel1.Controls[i] as TTilePanelLayout; rs.Add(container.Model); } @@ -175,7 +173,7 @@ namespace AppLauncher foreach (TileGroupModel item in rs) { - TilePanelLayout panel = new TilePanelLayout(item); + TTilePanelLayout panel = new TTilePanelLayout(item); maxWidth = Math.Max(maxWidth, panel.Width); flowLayoutPanel1.Controls.Add(panel); @@ -184,7 +182,7 @@ namespace AppLauncher flowLayoutPanel1.Width = maxWidth + SystemInformation.VerticalScrollBarWidth + 20; //this.Width = flowLayoutPanel1.Width + (flowLayoutPanel1.Left * 2); - //##this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left; + this.Width = flowLayoutPanel1.Width + flowLayoutPanel1.Left; } } diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs index 79b0177..28276dc 100644 --- a/Properties/Resources.Designer.cs +++ b/Properties/Resources.Designer.cs @@ -83,9 +83,9 @@ namespace AppLauncher.Properties { /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - internal static System.Drawing.Bitmap folder_ea_32 { + internal static System.Drawing.Bitmap folder_32 { get { - object obj = ResourceManager.GetObject("folder_ea_32", resourceCulture); + object obj = ResourceManager.GetObject("folder_32", resourceCulture); return ((System.Drawing.Bitmap)(obj)); } } diff --git a/Properties/Resources.resx b/Properties/Resources.resx index a92d9ed..3b81589 100644 --- a/Properties/Resources.resx +++ b/Properties/Resources.resx @@ -124,8 +124,8 @@ ..\Resources\arrow-right-ea-16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\folder-ea-32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\folder_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ..\Resources\form16_close.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/Resources/folder_32.png b/Resources/folder_32.png new file mode 100644 index 0000000000000000000000000000000000000000..832fd3c9b04b64cf590032b045d45050e033aaef GIT binary patch literal 601 zcmV-f0;c_mP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!TVrcG=30_DO16O;x4pyeRIh||EuJw0C;nEs~%ng4;9jfsKj03*ZyyTst1 z|G$4o$tXXYlvQp6HVg`o9Y7SAJGE;sFpg$JxugK*|BMVqjQ<(-r({+bL&ZpU00?~M z_+0>WL?JLBI*G+V^|OFl{{S(|KZgIUV1s}FISqh<6$Efwd;%=Kl=;UO;511Aq-$Ng(9|Vgenqe$KScAc!~=q-IyD z{rmS1)Yj*Qh|mmtWnyA7nmx7s7Kj6HmY+L)% literal 0 HcmV?d00001 diff --git a/Resources/raw/arrow-down.svg b/Resources/raw/arrow-down.svg deleted file mode 100644 index 4f84f62..0000000 --- a/Resources/raw/arrow-down.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/Resources/raw/arrow-right.svg b/Resources/raw/arrow-right.svg deleted file mode 100644 index f746daf..0000000 --- a/Resources/raw/arrow-right.svg +++ /dev/null @@ -1,75 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - diff --git a/Resources/raw/folder.svg b/Resources/raw/folder.svg deleted file mode 100644 index ca2bf03..0000000 --- a/Resources/raw/folder.svg +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - diff --git a/Resources/raw/grid.svg b/Resources/raw/grid.svg deleted file mode 100644 index 20de206..0000000 --- a/Resources/raw/grid.svg +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - - - diff --git a/Resources/raw/listbox.svg b/Resources/raw/icon-set.svg similarity index 96% rename from Resources/raw/listbox.svg rename to Resources/raw/icon-set.svg index c615e04..df94784 100644 --- a/Resources/raw/listbox.svg +++ b/Resources/raw/icon-set.svg @@ -7,7 +7,7 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="listbox.svg" + sodipodi:docname="icon-set.svg" inkscape:version="1.0 (4035a4fb49, 2020-05-01)" id="svg8" version="1.1" @@ -26,7 +26,7 @@ inkscape:document-rotation="0" inkscape:current-layer="layer1" inkscape:document-units="mm" - inkscape:cy="390.6468" + inkscape:cy="362.07537" inkscape:cx="331.14896" inkscape:zoom="5.6" inkscape:pageshadow="2" @@ -522,5 +522,17 @@ inkscape:export-xdpi="120" inkscape:export-ydpi="120" /> + + + diff --git a/Resources/raw/toggle-left.svg b/Resources/raw/toggle-left.svg deleted file mode 100644 index 51ef76e..0000000 --- a/Resources/raw/toggle-left.svg +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - - diff --git a/Resources/raw/toggle-right.svg b/Resources/raw/toggle-right.svg deleted file mode 100644 index 788c511..0000000 --- a/Resources/raw/toggle-right.svg +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - image/svg+xml - - - - - - - - - diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index 3d1772d..7bf09f4 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -1,17 +1,14 @@ using System; -using System.Collections.Generic; +using System.ComponentModel; using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Text; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Forms; namespace AppLauncher.Windows.Forms { public class AForm : Form { + protected readonly int titleHeight = 56; + protected bool isDragging = false; protected Point startPosition = new Point(); @@ -22,29 +19,6 @@ namespace AppLauncher.Windows.Forms this.FormBorderStyle = FormBorderStyle.None; this.StartPosition = FormStartPosition.Manual; } - - this.MouseDown += mainForm_MouseDown; - this.MouseUp += mainForm_MouseUp; - this.MouseMove += mainForm_MouseMove; - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - if (this.DesignMode) - { - return; - } - - //int requestedHeight = (int)Math.Floor(decimal.Divide((Screen.PrimaryScreen.WorkingArea.Height - this.Height), 2)); - //this.Location = new Point(Screen.PrimaryScreen.WorkingArea.X, (Screen.PrimaryScreen.WorkingArea.Y + requestedHeight)); - - //Point newPosition = new Point(Cursor.Position.X, Cursor.Position.Y); - //newPosition.X -= (this.Width / 2); - //newPosition.Y -= (this.Height / 2); - - //this.Location = newPosition; } protected override void OnPaint(PaintEventArgs e) @@ -62,32 +36,81 @@ namespace AppLauncher.Windows.Forms area.Inflate(-1, -1); - g.FillRectangle(new SolidBrush(menubarColour), area.X, area.Y, (area.Width + area.X), 56); - g.DrawLine(new Pen(borderColour, 1), area.X, 57, (area.Width + area.X), 57); + g.FillRectangle(new SolidBrush(menubarColour), area.X, area.Y, (area.Width + area.X), titleHeight); + g.DrawLine(new Pen(borderColour, 1), area.X, (titleHeight + 1), (area.Width + area.X), (titleHeight + 1)); g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17); TextRenderer.DrawText(e.Graphics, "Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); - //g.DrawRectangle(new Pen(Color.FromArgb(232, 231, 236), 1), borderArea); - //g.DrawRectangle(new Pen(Color.Red, 1), area); - } - //protected override void OnPaintBackground(PaintEventArgs e) - //{ - // base.OnPaintBackground(e); + protected override void OnMouseClick(MouseEventArgs e) + { + base.OnMouseClick(e); - //Graphics g = e.Graphics; - //g.TextRenderingHint = TextRenderingHint.AntiAlias; - //g.InterpolationMode = InterpolationMode.HighQualityBilinear; - //g.PixelOffsetMode = PixelOffsetMode.HighQuality; - //g.SmoothingMode = SmoothingMode.HighQuality; + bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= titleHeight)); - //g.FillRectangle(new LinearGradientBrush(this.DisplayRectangle, Color.FromArgb(76, 83, 93), Color.FromArgb(255, 255, 255), -30F), this.DisplayRectangle); + if (e.Button == MouseButtons.Left) + { + if (isLabel) + { + // do nothing + } + else + { + // do nothing + } + } + else if (e.Button == MouseButtons.Right) + { + if (isLabel) + { + if (this.TitleContextMenuStrip != null) + { + this.TitleContextMenuStrip.Show(this, e.Location); + } + } + else + { + // do nothing + } + } + } - //g.DrawRectangle(new Pen(new SolidBrush(Color.Red), 1), this.DisplayRectangle); - //} + protected override void OnMouseDown(MouseEventArgs e) + { + base.OnMouseDown(e); + + if (e.Button != MouseButtons.Left) + { + return; + } + + isDragging = true; + startPosition = e.Location; + } + + protected override void OnMouseMove(MouseEventArgs e) + { + base.OnMouseMove(e); + + if (isDragging) + { + int x = (this.Location.X + (e.Location.X - startPosition.X)); + int y = (this.Location.Y + (e.Location.Y - startPosition.Y)); + + //this.Location = validateFormLocation(x, y); + this.Location = new Point(x, y); + } + } + + protected override void OnMouseUp(MouseEventArgs e) + { + base.OnMouseUp(e); + + isDragging = false; + } protected Point DefaultLocation { @@ -106,33 +129,8 @@ namespace AppLauncher.Windows.Forms public override Color BackColor { get => base.BackColor; set => base.BackColor = Color.FromArgb(254, 254, 254); } - private void mainForm_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - isDragging = true; - startPosition = e.Location; - } - - private void mainForm_MouseUp(object sender, MouseEventArgs e) - { - isDragging = false; - } - - private void mainForm_MouseMove(object sender, MouseEventArgs e) - { - if (isDragging) - { - int x = (this.Location.X + (e.Location.X - startPosition.X)); - int y = (this.Location.Y + (e.Location.Y - startPosition.Y)); - - //this.Location = validateFormLocation(x, y); - this.Location = new Point(x, y); - } - } + [Category("Appearance")] + public ContextMenuStrip TitleContextMenuStrip { get; set; } = null; } } \ No newline at end of file diff --git a/Windows/Forms/Tile/AddListTileForm.cs b/Windows/Forms/Tile/AddListTileForm.cs index e13c601..5cb9a78 100644 --- a/Windows/Forms/Tile/AddListTileForm.cs +++ b/Windows/Forms/Tile/AddListTileForm.cs @@ -6,7 +6,7 @@ namespace AppLauncher.Windows.Forms { public class AddListTileForm : TDialogForm { - public static void ShowDialog(TilePanelLayout panel) + public static void ShowDialog(TTilePanelLayout panel) { AddListTileForm form = new AddListTileForm(panel); form.ShowDialog(); @@ -16,14 +16,14 @@ namespace AppLauncher.Windows.Forms private TButton button1; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private TTextBox textBox1; - protected TilePanelLayout parentPanel = null; + protected TTilePanelLayout parentPanel = null; public AddListTileForm() : base() { InitializeComponent(); } - public AddListTileForm(TilePanelLayout panel) : base() + public AddListTileForm(TTilePanelLayout panel) : base() { parentPanel = panel; diff --git a/Windows/Forms/Tile/AddTileForm.cs b/Windows/Forms/Tile/AddTileForm.cs index 2970110..6bf7fb8 100644 --- a/Windows/Forms/Tile/AddTileForm.cs +++ b/Windows/Forms/Tile/AddTileForm.cs @@ -11,7 +11,7 @@ namespace AppLauncher.Windows.Forms { public class AddTileForm : TDialogForm { - public static void ShowDialog(TilePanelLayout panel) + public static void ShowDialog(TTilePanelLayout panel) { AddTileForm form = new AddTileForm(panel); form.ShowDialog(); @@ -32,7 +32,7 @@ namespace AppLauncher.Windows.Forms private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TTextBox textBox1; - protected TilePanelLayout parentPanel = null; + protected TTilePanelLayout parentPanel = null; public AddTileForm() : base() { @@ -40,7 +40,7 @@ namespace AppLauncher.Windows.Forms initialiseComponents2(); } - public AddTileForm(TilePanelLayout panel) : base() + public AddTileForm(TTilePanelLayout panel) : base() { parentPanel = panel; diff --git a/Windows/Forms/Tile/EditGroupForm.cs b/Windows/Forms/Tile/EditGroupForm.cs index 80f05ef..d7473bb 100644 --- a/Windows/Forms/Tile/EditGroupForm.cs +++ b/Windows/Forms/Tile/EditGroupForm.cs @@ -11,7 +11,7 @@ namespace AppLauncher.Windows.Forms private TButton button1; private TPickerBox pickerBox1; private TTextBox textBox1; - protected TilePanelLayout parentContainer = null; + protected TTilePanelLayout parentContainer = null; public EditGroupForm() : base() { @@ -19,7 +19,7 @@ namespace AppLauncher.Windows.Forms initialiseComponents2(); } - public EditGroupForm(TilePanelLayout container) : base() + public EditGroupForm(TTilePanelLayout container) : base() { parentContainer = container; @@ -172,7 +172,7 @@ namespace AppLauncher.Windows.Forms model.Title = textBox1.Text?.Trim(); model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1); - parentContainer.LoadModel(model, false); + parentContainer.UpdateModel(model); this.Close(); } diff --git a/Windows/Forms/Tile/EditListTileForm.cs b/Windows/Forms/Tile/EditListTileForm.cs index f50cbd9..c716b38 100644 --- a/Windows/Forms/Tile/EditListTileForm.cs +++ b/Windows/Forms/Tile/EditListTileForm.cs @@ -6,7 +6,7 @@ namespace AppLauncher.Windows.Forms { public class EditListTileForm : TDialogForm { - public static void ShowDialog(TilePanel panel) + public static void ShowDialog(TTilePanel panel) { EditListTileForm form = new EditListTileForm(panel); form.ShowDialog(); @@ -22,14 +22,14 @@ namespace AppLauncher.Windows.Forms private TButton tButton2; private TButton tButton3; private TButton tButton4; - protected TilePanel parentPanel = null; + protected TTilePanel parentPanel = null; public EditListTileForm() : base() { InitializeComponent(); } - public EditListTileForm(TilePanel panel) : base() + public EditListTileForm(TTilePanel panel) : base() { parentPanel = panel; diff --git a/Windows/Forms/Tile/EditTileForm.cs b/Windows/Forms/Tile/EditTileForm.cs index 1940ff6..697763e 100644 --- a/Windows/Forms/Tile/EditTileForm.cs +++ b/Windows/Forms/Tile/EditTileForm.cs @@ -7,7 +7,7 @@ namespace AppLauncher.Windows.Forms { public class EditTileForm : TDialogForm { - public static void ShowDialog(TilePanel panel) + public static void ShowDialog(TTilePanel panel) { EditTileForm form = new EditTileForm(panel); form.ShowDialog(); @@ -28,7 +28,7 @@ namespace AppLauncher.Windows.Forms private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private TTextBox textBox1; - protected TilePanel parentPanel = null; + protected TTilePanel parentPanel = null; public EditTileForm() : base() { @@ -36,7 +36,7 @@ namespace AppLauncher.Windows.Forms initialiseComponents2(); } - public EditTileForm(TilePanel panel) : base() + public EditTileForm(TTilePanel panel) : base() { parentPanel = panel; diff --git a/Windows/Forms/Tile/TilePanel.Designer.cs b/Windows/Forms/Tile/TTilePanel.Designer.cs similarity index 97% rename from Windows/Forms/Tile/TilePanel.Designer.cs rename to Windows/Forms/Tile/TTilePanel.Designer.cs index 4706771..84b30d3 100644 --- a/Windows/Forms/Tile/TilePanel.Designer.cs +++ b/Windows/Forms/Tile/TTilePanel.Designer.cs @@ -1,6 +1,6 @@ namespace AppLauncher.Windows.Forms { - partial class TilePanel + partial class TTilePanel { /// /// Required designer variable. @@ -96,7 +96,6 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(68)))), ((int)(((byte)(68)))), ((int)(((byte)(68))))); this.Controls.Add(this.pictureBox1); this.Controls.Add(this.label1); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234))))); diff --git a/Windows/Forms/Tile/TilePanel.cs b/Windows/Forms/Tile/TTilePanel.cs similarity index 85% rename from Windows/Forms/Tile/TilePanel.cs rename to Windows/Forms/Tile/TTilePanel.cs index 55f4086..a399247 100644 --- a/Windows/Forms/Tile/TilePanel.cs +++ b/Windows/Forms/Tile/TTilePanel.cs @@ -8,19 +8,23 @@ using System.Windows.Forms; namespace AppLauncher.Windows.Forms { - public partial class TilePanel : AUserControl + public partial class TTilePanel : AUserControl { protected bool isDragging = false; protected Point startPosition = new Point(); protected TileModel modelInfo = new TileModel(); - public TilePanel() : base() + public TTilePanel() : base() { InitializeComponent(); + this.BackColor = Color.FromArgb(250, 250, 250); this.ContextMenuStrip = contextMenuStrip1; + label1.ForeColor = Color.FromArgb(99, 105, 119); + label1.Font = new Font(this.Font.FontFamily, 8.25F); + this.MouseDown += panel_MouseDown; this.MouseUp += panel_MouseUp; this.MouseMove += panel_MouseMove; @@ -32,6 +36,16 @@ namespace AppLauncher.Windows.Forms label1.MouseMove += panel_MouseMove; } + protected override void OnPaint(PaintEventArgs e) + { + base.OnPaint(e); + + Graphics g = e.Graphics; + + g.DrawRectangle(new Pen(Color.FromArgb(204, 206, 218), 1), new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - 1), (this.DisplayRectangle.Height - 1))); + + } + [Category("Appearance"), Browsable(true)] public string Title { get => label1.Text; protected set => label1.Text = value; } @@ -41,7 +55,7 @@ namespace AppLauncher.Windows.Forms [Browsable(false)] public TileModel ModelInfo => modelInfo; - public TilePanelLayout PanelContainer + public TTilePanelLayout PanelContainer { get { @@ -50,12 +64,12 @@ namespace AppLauncher.Windows.Forms return null; } - if (this.Parent.GetType() != typeof(TilePanelLayout)) + if (this.Parent.GetType() != typeof(TTilePanelLayout)) { return null; } - return (TilePanelLayout)this.Parent; + return (TTilePanelLayout)this.Parent; } } @@ -67,7 +81,7 @@ namespace AppLauncher.Windows.Forms if (this.modelInfo.IsGroup) { - this.Image = Properties.Resources.folder_ea_32; + this.Image = Properties.Resources.folder_32; } else { @@ -96,7 +110,7 @@ namespace AppLauncher.Windows.Forms private void panel_MouseDown(object sender, MouseEventArgs e) { - TilePanelLayout container = this.PanelContainer; + TTilePanelLayout container = this.PanelContainer; if (container == null) { return; @@ -122,7 +136,7 @@ namespace AppLauncher.Windows.Forms { if (isDragging) { - TilePanelLayout layoutPanel = this.PanelContainer; + TTilePanelLayout layoutPanel = this.PanelContainer; if (layoutPanel == null) { return; diff --git a/Windows/Forms/Tile/TilePanel.resx b/Windows/Forms/Tile/TTilePanel.resx similarity index 100% rename from Windows/Forms/Tile/TilePanel.resx rename to Windows/Forms/Tile/TTilePanel.resx diff --git a/Windows/Forms/Tile/TilePanelLayout.Designer.cs b/Windows/Forms/Tile/TTilePanelLayout.Designer.cs similarity index 99% rename from Windows/Forms/Tile/TilePanelLayout.Designer.cs rename to Windows/Forms/Tile/TTilePanelLayout.Designer.cs index 83b92c0..03dd3db 100644 --- a/Windows/Forms/Tile/TilePanelLayout.Designer.cs +++ b/Windows/Forms/Tile/TTilePanelLayout.Designer.cs @@ -1,6 +1,6 @@ namespace AppLauncher.Windows.Forms { - partial class TilePanelLayout + partial class TTilePanelLayout { /// /// Required designer variable. diff --git a/Windows/Forms/Tile/TilePanelLayout.cs b/Windows/Forms/Tile/TTilePanelLayout.cs similarity index 93% rename from Windows/Forms/Tile/TilePanelLayout.cs rename to Windows/Forms/Tile/TTilePanelLayout.cs index 7cb5338..2f6af0c 100644 --- a/Windows/Forms/Tile/TilePanelLayout.cs +++ b/Windows/Forms/Tile/TTilePanelLayout.cs @@ -13,11 +13,11 @@ using System.Windows.Forms; namespace AppLauncher.Windows.Forms { - public partial class TilePanelLayout : AUserControl + public partial class TTilePanelLayout : AUserControl { public class Item { - public TilePanel Tile { get; set; } + public TTilePanel Tile { get; set; } public Point Coord { get; set; } = new Point(0, 0); } @@ -36,7 +36,7 @@ namespace AppLauncher.Windows.Forms protected bool isAnimating = false; protected bool isChecked = true; - public TilePanelLayout(TileGroupModel model) : base() + public TTilePanelLayout(TileGroupModel model) : base() { InitializeComponent(); @@ -44,8 +44,6 @@ namespace AppLauncher.Windows.Forms this.BackColor = Color.Transparent; this.LoadModel(model); - - //panel1.Resize += panel1_Resize; } protected override void OnDragDrop(DragEventArgs e) @@ -172,8 +170,6 @@ namespace AppLauncher.Windows.Forms protected override void OnMouseDoubleClick(MouseEventArgs e) => base.OnMouseClick(e); - //private async void panel1_Resize(object sender, EventArgs e) => await this.InvalidateContainer(); - public Point GridSize { get @@ -189,10 +185,6 @@ namespace AppLauncher.Windows.Forms public int ExpandedHeight => expandedHeight + this.Padding.Bottom; - //public int CollapseHeight => labelHeight + collapseHeight panel1.CollapseHeight; - - //public int ExpandedHeight => labelHeight + panel1.ExpandedHeight + this.Padding.Top + this.Padding.Bottom; - public TileGroupModel Model { get @@ -200,12 +192,10 @@ namespace AppLauncher.Windows.Forms TileGroupModel rs = new TileGroupModel() { Title = groupInfo.Title, - //GridSize = new Size(panel1.GridSize.X, panel1.GridSize.Y), GridSize = new Size(this.GridSize.X, this.GridSize.Y), IsExpanded = isChecked, IsExclusive = groupInfo.IsExclusive, Items = this.Tiles - //Items = panel1.Tiles }; return rs; @@ -266,7 +256,7 @@ namespace AppLauncher.Windows.Forms tile.Position = newCoord.Value; - TilePanel panel = new TilePanel(); + TTilePanel panel = new TTilePanel(); panel.LoadInfo(tile); panel.Location = convertCoordToLocation(tile.Position); @@ -383,7 +373,7 @@ namespace AppLauncher.Windows.Forms return; } - this.FlowLayoutPanel.Controls.Add(new TilePanelLayout(new TileGroupModel() + this.FlowLayoutPanel.Controls.Add(new TTilePanelLayout(new TileGroupModel() { Title = "New Group", GridSize = new Size(8, 1) @@ -392,29 +382,32 @@ namespace AppLauncher.Windows.Forms public void AddRow() { - //panel1.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1)); this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1)); } public void EditGroup() { - //EditGroupForm editForm = new EditGroupForm(this); - //editForm.ShowDialog(); + EditGroupForm editForm = new EditGroupForm(this); + editForm.ShowDialog(); } - public void LoadModel(TileGroupModel model, bool loadTiles = true) + public void LoadModel(TileGroupModel model) { groupInfo = model; this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height); - //this.Width = panel1.Width; isChecked = groupInfo.IsExpanded; - if (loadTiles) - { - this.LoadTiles(model.Items); - } + this.LoadTiles(model.Items); + + this.Invalidate(); + } + + public void UpdateModel(TileGroupModel model) + { + groupInfo = model; + isChecked = groupInfo.IsExpanded; this.Invalidate(); } @@ -442,7 +435,7 @@ namespace AppLauncher.Windows.Forms } // place control - TilePanel panel = new TilePanel(); + TTilePanel panel = new TTilePanel(); panel.LoadInfo(item); panel.Location = convertCoordToLocation(confirmedPosition.Value); @@ -456,7 +449,7 @@ namespace AppLauncher.Windows.Forms } } - public void MoveTile(TilePanel panel, int posX, int posY) + public void MoveTile(TTilePanel panel, int posX, int posY) { Item item = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault(); if (item == null) @@ -551,7 +544,7 @@ namespace AppLauncher.Windows.Forms this.FlowLayoutPanel.Controls.Remove(this); } - public void Remove(TilePanel panel) + public void Remove(TTilePanel panel) { Item m = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault(); if (m != null) diff --git a/Windows/Forms/Tile/TilePanelLayout.resx b/Windows/Forms/Tile/TTilePanelLayout.resx similarity index 100% rename from Windows/Forms/Tile/TilePanelLayout.resx rename to Windows/Forms/Tile/TTilePanelLayout.resx