Changed: new light theme

This commit is contained in:
Ray committed 2020-05-16 13:25:59 +01:00
1 parent 19ea78868b
commit c90d846f2e
25 files changed
+165 -543

No files matched your search

+70 -72
View File
@@ -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;
}
}
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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();
}
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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;
@@ -1,6 +1,6 @@
namespace AppLauncher.Windows.Forms
{
partial class TilePanel
partial class TTilePanel
{
/// <summary>
/// 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)))));
@@ -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;
File renamed without changes.
@@ -1,6 +1,6 @@
namespace AppLauncher.Windows.Forms
{
partial class TilePanelLayout
partial class TTilePanelLayout
{
/// <summary>
/// Required designer variable.
@@ -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)