From c7702652831a88cf5c4a5765da234530c5b2c0b7 Mon Sep 17 00:00:00 2001 From: Ray Date: Sun, 12 Sep 2021 15:38:38 +0100 Subject: [PATCH] WIP: icons + clean-up --- AppResource.Designer.cs | 10 + AppResource.resx | 3 + MainForm.Designer.cs | 42 +- Models/BookmarkItemModel.cs | 413 -------- Resources/bookmark.png | Bin 0 -> 295 bytes .../ThemedForms/BorderlessForm.Designer.cs | 193 ---- .../Windows/ThemedForms/BorderlessForm.cs | 409 -------- .../Windows/ThemedForms/BorderlessForm.resx | 158 --- .../BorderlessToolForm.Designer.cs | 191 ---- .../Windows/ThemedForms/BorderlessToolForm.cs | 394 -------- .../ThemedForms/BorderlessToolForm.resx | 138 --- Windows/Forms/BookmarkTreeViewSNode.cs | 211 ---- Windows/Forms/EditGroupForm.cs | 176 ---- Windows/Forms/EditGroupForm.resx | 60 -- Windows/Forms/EditTileFolderForm.cs | 394 -------- Windows/Forms/EditTileFolderForm.resx | 60 -- Windows/Forms/EditTileForm.cs | 482 --------- Windows/Forms/EditTileForm.resx | 97 -- Windows/Forms/TileContainer.cs | 149 --- Windows/Forms/TileContainer.resx | 120 --- Windows/Forms/TilePanel.Designer.cs | 82 -- Windows/Forms/TilePanel.cs | 506 ---------- Windows/Forms/TilePanel.resx | 66 -- Windows/Forms/TilePanelLayout.Designer.cs | 259 ----- Windows/Forms/TilePanelLayout.cs | 943 ------------------ Windows/Forms/TilePanelLayout.resx | 66 -- 26 files changed, 38 insertions(+), 5584 deletions(-) delete mode 100644 Models/BookmarkItemModel.cs create mode 100644 Resources/bookmark.png delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.cs delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessForm.resx delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs delete mode 100644 RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx delete mode 100644 Windows/Forms/BookmarkTreeViewSNode.cs delete mode 100644 Windows/Forms/EditGroupForm.cs delete mode 100644 Windows/Forms/EditGroupForm.resx delete mode 100644 Windows/Forms/EditTileFolderForm.cs delete mode 100644 Windows/Forms/EditTileFolderForm.resx delete mode 100644 Windows/Forms/EditTileForm.cs delete mode 100644 Windows/Forms/EditTileForm.resx delete mode 100644 Windows/Forms/TileContainer.cs delete mode 100644 Windows/Forms/TileContainer.resx delete mode 100644 Windows/Forms/TilePanel.Designer.cs delete mode 100644 Windows/Forms/TilePanel.cs delete mode 100644 Windows/Forms/TilePanel.resx delete mode 100644 Windows/Forms/TilePanelLayout.Designer.cs delete mode 100644 Windows/Forms/TilePanelLayout.cs delete mode 100644 Windows/Forms/TilePanelLayout.resx diff --git a/AppResource.Designer.cs b/AppResource.Designer.cs index 8b528a7..617a376 100644 --- a/AppResource.Designer.cs +++ b/AppResource.Designer.cs @@ -78,6 +78,16 @@ namespace BookmarkManager { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap bookmark { + get { + object obj = ResourceManager.GetObject("bookmark", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/AppResource.resx b/AppResource.resx index 7eeb7a0..bea1eb2 100644 --- a/AppResource.resx +++ b/AppResource.resx @@ -124,6 +124,9 @@ Bookmark Manager + + Resources\bookmark.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + Resources\file-text.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 3844f18..f5aead8 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -201,7 +201,7 @@ this.findToolStripMenuItem.Image = global::BookmarkManager.AppResource.search; this.findToolStripMenuItem.Name = "findToolStripMenuItem"; this.findToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F))); - this.findToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.findToolStripMenuItem.Size = new System.Drawing.Size(137, 22); this.findToolStripMenuItem.Text = "&Find"; this.findToolStripMenuItem.Click += new System.EventHandler(this.findToolStripMenuItem_Click); // @@ -375,71 +375,75 @@ // addPageToolStripMenuItem1 // this.addPageToolStripMenuItem1.Name = "addPageToolStripMenuItem1"; - this.addPageToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.addPageToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.addPageToolStripMenuItem1.Text = "Add &Page"; this.addPageToolStripMenuItem1.Click += new System.EventHandler(this.addPageToolStripMenuItem1_Click); // // addFolderToolStripMenuItem1 // this.addFolderToolStripMenuItem1.Name = "addFolderToolStripMenuItem1"; - this.addFolderToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.addFolderToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.addFolderToolStripMenuItem1.Text = "Add &Folder"; this.addFolderToolStripMenuItem1.Click += new System.EventHandler(this.addFolderToolStripMenuItem1_Click); // // toolStripMenuItem4 // this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(135, 6); + this.toolStripMenuItem4.Size = new System.Drawing.Size(177, 6); // // openAllToolStripMenuItem // + this.openAllToolStripMenuItem.Image = global::BookmarkManager.AppResource.bookmark; this.openAllToolStripMenuItem.Name = "openAllToolStripMenuItem"; - this.openAllToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.openAllToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.openAllToolStripMenuItem.Text = "&Open All"; this.openAllToolStripMenuItem.Click += new System.EventHandler(this.openAllToolStripMenuItem_Click); // // editToolStripMenuItem1 // this.editToolStripMenuItem1.Name = "editToolStripMenuItem1"; - this.editToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.editToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.editToolStripMenuItem1.Text = "&Edit"; this.editToolStripMenuItem1.Click += new System.EventHandler(this.editToolStripMenuItem1_Click); // // deleteToolStripMenuItem // + this.deleteToolStripMenuItem.Image = global::BookmarkManager.UIResource.trash2; this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.deleteToolStripMenuItem.Text = "&Delete"; this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // toolStripMenuItem5 // this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(135, 6); + this.toolStripMenuItem5.Size = new System.Drawing.Size(177, 6); // // sortToolStripMenuItem1 // this.sortToolStripMenuItem1.Name = "sortToolStripMenuItem1"; - this.sortToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.sortToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.sortToolStripMenuItem1.Text = "&Sort"; this.sortToolStripMenuItem1.Click += new System.EventHandler(this.sortToolStripMenuItem1_Click); // // toolStripMenuItem6 // this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(135, 6); + this.toolStripMenuItem6.Size = new System.Drawing.Size(177, 6); // // moveUpToolStripMenuItem // + this.moveUpToolStripMenuItem.Image = global::BookmarkManager.UIResource.arrow_up2; this.moveUpToolStripMenuItem.Name = "moveUpToolStripMenuItem"; - this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.moveUpToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.moveUpToolStripMenuItem.Text = "Move &Up"; this.moveUpToolStripMenuItem.Click += new System.EventHandler(this.moveUpToolStripMenuItem_Click); // // moveDownToolStripMenuItem // + this.moveDownToolStripMenuItem.Image = global::BookmarkManager.UIResource.arrow_down2; this.moveDownToolStripMenuItem.Name = "moveDownToolStripMenuItem"; - this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(138, 22); + this.moveDownToolStripMenuItem.Size = new System.Drawing.Size(180, 22); this.moveDownToolStripMenuItem.Text = "Move &Down"; this.moveDownToolStripMenuItem.Click += new System.EventHandler(this.moveDownToolStripMenuItem_Click); // @@ -454,12 +458,13 @@ this.moveUpToolStripMenuItem1, this.moveDownToolStripMenuItem1}); this.pageContextMenu.Name = "pageContextMenu"; - this.pageContextMenu.Size = new System.Drawing.Size(139, 126); + this.pageContextMenu.Size = new System.Drawing.Size(181, 148); // // openToolStripMenuItem1 // + this.openToolStripMenuItem1.Image = global::BookmarkManager.AppResource.bookmark; this.openToolStripMenuItem1.Name = "openToolStripMenuItem1"; - this.openToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.openToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.openToolStripMenuItem1.Text = "&Open"; this.openToolStripMenuItem1.Click += new System.EventHandler(this.openToolStripMenuItem1_Click); // @@ -477,8 +482,9 @@ // // deleteToolStripMenuItem1 // + this.deleteToolStripMenuItem1.Image = global::BookmarkManager.UIResource.trash2; this.deleteToolStripMenuItem1.Name = "deleteToolStripMenuItem1"; - this.deleteToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.deleteToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.deleteToolStripMenuItem1.Text = "&Delete"; this.deleteToolStripMenuItem1.Click += new System.EventHandler(this.deleteToolStripMenuItem1_Click); // @@ -489,15 +495,17 @@ // // moveUpToolStripMenuItem1 // + this.moveUpToolStripMenuItem1.Image = global::BookmarkManager.UIResource.arrow_up2; this.moveUpToolStripMenuItem1.Name = "moveUpToolStripMenuItem1"; - this.moveUpToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.moveUpToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.moveUpToolStripMenuItem1.Text = "Move &Up"; this.moveUpToolStripMenuItem1.Click += new System.EventHandler(this.moveUpToolStripMenuItem1_Click); // // moveDownToolStripMenuItem1 // + this.moveDownToolStripMenuItem1.Image = global::BookmarkManager.UIResource.arrow_down2; this.moveDownToolStripMenuItem1.Name = "moveDownToolStripMenuItem1"; - this.moveDownToolStripMenuItem1.Size = new System.Drawing.Size(138, 22); + this.moveDownToolStripMenuItem1.Size = new System.Drawing.Size(180, 22); this.moveDownToolStripMenuItem1.Text = "Move &Down"; this.moveDownToolStripMenuItem1.Click += new System.EventHandler(this.moveDownToolStripMenuItem1_Click); // diff --git a/Models/BookmarkItemModel.cs b/Models/BookmarkItemModel.cs deleted file mode 100644 index 1fca643..0000000 --- a/Models/BookmarkItemModel.cs +++ /dev/null @@ -1,413 +0,0 @@ -using bzit.bomg.Models; -using HtmlAgilityPack; -using RyzStudio.Net; -using System; -using System.Drawing; -using System.IO; -using System.Net; -using System.Text; -using HtmlDocument = HtmlAgilityPack.HtmlDocument; - -namespace bzit.bomg -{ - public class BookmarkItemModel : BookmarkItemViewModel - { - protected HttpWeb webClient = null; - - public BookmarkItemModel() - { - this.Clear(); - } - - public void Clear() - { - this.SiteName = string.Empty; - this.SiteAddress = string.Empty; - this.SiteDescription = string.Empty; - this.FaviconAddress = string.Empty; - this.TreeviewPath = string.Empty; - } - - public new string ToString() - { - StringBuilder sb = new StringBuilder(); - sb.Append("Name = "); - sb.Append(this.SiteName ?? string.Empty); - sb.Append(Environment.NewLine); - - sb.Append("Address = "); - sb.Append(this.SiteAddress ?? string.Empty); - sb.Append(Environment.NewLine); - - sb.Append("Description = "); - sb.Append(this.SiteDescription ?? string.Empty); - sb.Append(Environment.NewLine); - - return sb.ToString(); - } - - public BookmarkItemViewModel ToViewModel() - { - return new BookmarkItemViewModel() - { - SiteName = this.SiteName, - SiteAddress = this.SiteAddress, - SiteDescription = this.SiteDescription, - FaviconAddress = this.FaviconAddress, - TreeviewPath = this.TreeviewPath - }; - } - - public bool Update() - { - string sourceCode = retrieveSourceCode(); - if (string.IsNullOrWhiteSpace(sourceCode)) - { - return false; - } - - HtmlDocument document = new HtmlDocument(); - document.LoadHtml(sourceCode); - - // title - this.SiteName = parseSiteTitle(document); - - // description - this.SiteDescription = parseSiteDescription(document); - - // favicon - this.FaviconAddress = parseSiteIcon(document); - - // default infurred icon - if (string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - this.FaviconAddress = "/favicon.ico"; - } - - if (!string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - Uri iconAddressURI; - bool rv = Uri.TryCreate(new Uri(this.SiteAddress), this.FaviconAddress, out iconAddressURI); - if (rv) - { - this.FaviconAddress = iconAddressURI.ToString(); - } - } - - return true; - } - - public bool UpdateFavicon() - { - string sourceCode = retrieveSourceCode(); - if (string.IsNullOrWhiteSpace(sourceCode)) - { - return false; - } - - HtmlDocument document = new HtmlDocument(); - document.LoadHtml(sourceCode); - - // favicon - this.FaviconAddress = parseSiteIcon(document); - - // default infurred icon - if (string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - this.FaviconAddress = "/favicon.ico"; - } - - if (!string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - Uri iconAddressURI; - bool rv = Uri.TryCreate(new Uri(this.SiteAddress), this.FaviconAddress, out iconAddressURI); - if (rv) - { - this.FaviconAddress = iconAddressURI.ToString(); - } - } - - return true; - } - - public Bitmap RetrieveFavicon() - { - if (string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - return null; - } - - byte[] iconData = null; - WebClient webClient = new WebClient(); - webClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); - - try - { - iconData = webClient.DownloadData(this.FaviconAddress); - - if (!RyzStudio.IO.FileType.IsImage(iconData)) - { - throw new Exception("Not a supported image"); - } - - Image img = Image.FromStream(new MemoryStream(iconData)); - return new Bitmap(img, 16, 16); - } - catch - { - iconData = null; - this.FaviconAddress = null; - - return null; - } - } - - public Bitmap RetrieveFavicon(out byte[] rawData) - { - rawData = null; - - if (string.IsNullOrWhiteSpace(this.FaviconAddress)) - { - return null; - } - - byte[] iconData = null; - WebClient webClient = new WebClient(); - webClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); - - try - { - iconData = webClient.DownloadData(this.FaviconAddress); - - if (!RyzStudio.IO.FileType.IsImage(iconData)) - { - throw new Exception("Not a supported image"); - } - - rawData = iconData; - - Image img = Image.FromStream(new MemoryStream(iconData)); - return new Bitmap(img, 16, 16); - } - catch - { - iconData = null; - this.FaviconAddress = null; - - return null; - } - } - - protected string retrieveSourceCode() - { - if (webClient == null) - { - webClient = new HttpWeb(); - } - - string sourceCode; - int statusCode = webClient.GetResponse(out sourceCode, this.SiteAddress); - if ((statusCode == 200) || (statusCode == 301) || (statusCode == 302)) - { - return sourceCode; - } - - return null; - - //WebClient webClient = new WebClient(); - //webClient.CachePolicy = new System.Net.Cache.RequestCachePolicy(System.Net.Cache.RequestCacheLevel.NoCacheNoStore); - - //try - //{ - // return webClient.DownloadString(this.SiteAddress); - //} - //catch (Exception exc) - //{ - // return null; - //} - } - - protected string parseTagValue(HtmlDocument doc, string xpath, string defaultValue = "") - { - HtmlNodeCollection hnc = doc.DocumentNode.SelectNodes(xpath); - if (hnc == null) - { - return defaultValue; - } - - if (hnc.Count <= 0) - { - return defaultValue; - } - - foreach (HtmlNode hn in hnc) - { - if (string.IsNullOrWhiteSpace(hn.InnerHtml)) - { - continue; - } - - string rs = WebUtility.HtmlDecode(hn.InnerHtml)?.Replace("\r", "")?.Replace("\n", " ")?.Trim(); - if (string.IsNullOrWhiteSpace(rs)) - { - continue; - } - - return rs; - } - - return defaultValue; - } - - protected string parseTagValue_Attr(HtmlDocument doc, string xpath, string attr, string defaultValue = "") - { - HtmlNodeCollection hnc = doc.DocumentNode.SelectNodes(xpath); - if (hnc == null) - { - return defaultValue; - } - - if (hnc.Count <= 0) - { - return defaultValue; - } - - foreach (HtmlNode hn in hnc) - { - if (hn.Attributes[attr] == null) - { - continue; - } - - if (string.IsNullOrWhiteSpace(hn.Attributes[attr].Value)) - { - continue; - } - - return System.Web.HttpUtility.HtmlDecode(hn.Attributes[attr].Value?.Trim()); - } - - return defaultValue; - } - - protected string parseSiteTitle(HtmlDocument doc) - { - string rs = null; - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue(doc, "//title", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@property='og:title']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@name='twitter:title']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@property='og:site_name']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@itemprop='name']", "content", string.Empty); - } - - return rs?.Trim(); - } - - protected string parseSiteDescription(HtmlDocument doc) - { - string rs = null; - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@name='description']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@property='og:description']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@name='twitter:description']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@property='og:description']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - rs = parseTagValue_Attr(doc, "//meta[@itemprop='description']", "content", string.Empty); - } - - return rs; - } - - protected string parseSiteIcon(HtmlDocument doc) - { - string rs = null; - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//link[@rel='shortcut icon']", "href", string.Empty); - rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'shortcut icon']", "href", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//link[@rel='icon']", "href", string.Empty); - rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'icon']", "href", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon']", "href", string.Empty); - rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon']", "href", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//link[@rel='apple-touch-icon-precomposed']", "href", string.Empty); - rs = parseTagValue_Attr(doc, "//link[translate(@rel, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'apple-touch-icon-precomposed']", "href", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty); - rs = parseTagValue_Attr(doc, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//meta[@name='twitter:image']", "content", string.Empty); - rs = parseTagValue_Attr(doc, "//meta[translate(@name, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'twitter:image']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//meta[@property='og:image']", "content", string.Empty); - rs = parseTagValue_Attr(doc, "//meta[translate(@property, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'og:image']", "content", string.Empty); - } - - if (string.IsNullOrWhiteSpace(rs)) - { - //rs = parseTagValue_Attr(doc, "//meta[@itemprop='image']", "content", string.Empty); - rs = parseTagValue_Attr(doc, "//meta[translate(@itemprop, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz') = 'image']", "content", string.Empty); - } - - return rs; - } - - } -} \ No newline at end of file diff --git a/Resources/bookmark.png b/Resources/bookmark.png new file mode 100644 index 0000000000000000000000000000000000000000..786e869e918d1615062051729e21434585445cc3 GIT binary patch literal 295 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`EX7WqAsj$Z!;#Vf2?7 z8z9Vhe8JAOKtah8*NBqf{Irtt#G+J&^73-M%)IR4tC-(LL=Mb6>3$HXKn3HiiNK+=!tU8m!4V4SKxH_;q`~AjH=f( jjH1ORYHrT|=~f;PAw4bp&z^rk_cD08`njxgN@xNAMyqM? literal 0 HcmV?d00001 diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs b/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs deleted file mode 100644 index d39ad3c..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessForm.Designer.cs +++ /dev/null @@ -1,193 +0,0 @@ -using RyzStudio.Windows.Forms; - -namespace RyzStudio.Windows.ThemedForms -{ - partial class BorderlessForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BorderlessForm)); - this.label1 = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.area1 = new System.Windows.Forms.Panel(); - this.pictureBox4 = new RyzStudio.Windows.Forms.TImageBox(); - this.pictureBox2 = new RyzStudio.Windows.Forms.TImageBox(); - this.pictureBox1 = new RyzStudio.Windows.Forms.TImageBox(); - this.pictureBox3 = new RyzStudio.Windows.Forms.TImageBox(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); - this.SuspendLayout(); - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.label1.Location = new System.Drawing.Point(1, 1); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(48, 0, 0, 0); - this.label1.Size = new System.Drawing.Size(454, 48); - this.label1.TabIndex = 148; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.label1.DoubleClick += new System.EventHandler(this.label1_DoubleClick); - this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); - this.label1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); - this.label1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove); - this.label1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.Transparent; - this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.panel1.Location = new System.Drawing.Point(594, 674); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(6, 6); - this.panel1.TabIndex = 150; - this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); - this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); - this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); - // - // area1 - // - this.area1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.area1.BackColor = System.Drawing.Color.Transparent; - this.area1.Cursor = System.Windows.Forms.Cursors.SizeNS; - this.area1.Location = new System.Drawing.Point(1, 674); - this.area1.Name = "area1"; - this.area1.Size = new System.Drawing.Size(592, 6); - this.area1.TabIndex = 152; - this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); - this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove); - this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp); - // - // pictureBox4 - // - this.pictureBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBox4.BackColor = System.Drawing.Color.Transparent; - this.pictureBox4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox4.ErrorImage = null; - this.pictureBox4.ImageHover = global::hiim.dply.Properties.Resources.form20_menu2; - this.pictureBox4.Image = global::hiim.dply.Properties.Resources.form20_menu; - this.pictureBox4.InitialImage = null; - this.pictureBox4.Location = new System.Drawing.Point(460, 11); - this.pictureBox4.Name = "pictureBox4"; - this.pictureBox4.NormalImage = global::hiim.dply.Properties.Resources.form20_menu; - this.pictureBox4.Size = new System.Drawing.Size(28, 28); - this.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox4.TabIndex = 149; - this.pictureBox4.TabStop = false; - // - // pictureBox2 - // - this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBox2.BackColor = System.Drawing.Color.Transparent; - this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox2.ErrorImage = null; - this.pictureBox2.ImageHover = global::hiim.dply.Properties.Resources.form20_maximise2; - this.pictureBox2.Image = global::hiim.dply.Properties.Resources.form20_maximise; - this.pictureBox2.InitialImage = null; - this.pictureBox2.Location = new System.Drawing.Point(528, 11); - this.pictureBox2.Name = "pictureBox2"; - this.pictureBox2.NormalImage = global::hiim.dply.Properties.Resources.form20_maximise; - this.pictureBox2.Size = new System.Drawing.Size(28, 28); - this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox2.TabIndex = 147; - this.pictureBox2.TabStop = false; - // - // pictureBox1 - // - this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBox1.BackColor = System.Drawing.Color.Transparent; - this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox1.ErrorImage = null; - this.pictureBox1.ImageHover = global::hiim.dply.Properties.Resources.form20_minimise2; - this.pictureBox1.Image = global::hiim.dply.Properties.Resources.form20_minimise; - this.pictureBox1.InitialImage = null; - this.pictureBox1.Location = new System.Drawing.Point(494, 11); - this.pictureBox1.Name = "pictureBox1"; - this.pictureBox1.NormalImage = global::hiim.dply.Properties.Resources.form20_minimise; - this.pictureBox1.Size = new System.Drawing.Size(28, 28); - this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox1.TabIndex = 146; - this.pictureBox1.TabStop = false; - // - // pictureBox3 - // - this.pictureBox3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pictureBox3.BackColor = System.Drawing.Color.Transparent; - this.pictureBox3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.pictureBox3.ErrorImage = null; - this.pictureBox3.ImageHover = global::hiim.dply.Properties.Resources.form20_close2; - this.pictureBox3.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox3.Image"))); - this.pictureBox3.InitialImage = null; - this.pictureBox3.Location = new System.Drawing.Point(562, 11); - this.pictureBox3.Name = "pictureBox3"; - this.pictureBox3.NormalImage = ((System.Drawing.Image)(resources.GetObject("pictureBox3.NormalImage"))); - this.pictureBox3.Size = new System.Drawing.Size(28, 28); - this.pictureBox3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.pictureBox3.TabIndex = 145; - this.pictureBox3.TabStop = false; - // - // BorderlessForm - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.WhiteSmoke; - this.ClientSize = new System.Drawing.Size(600, 680); - this.Controls.Add(this.area1); - this.Controls.Add(this.panel1); - this.Controls.Add(this.pictureBox4); - this.Controls.Add(this.label1); - this.Controls.Add(this.pictureBox2); - this.Controls.Add(this.pictureBox1); - this.Controls.Add(this.pictureBox3); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Name = "BorderlessForm"; - ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - protected internal TImageBox pictureBox2; - protected internal TImageBox pictureBox1; - protected internal TImageBox pictureBox3; - protected internal System.Windows.Forms.Label label1; - protected internal TImageBox pictureBox4; - protected internal System.Windows.Forms.Panel panel1; - protected internal System.Windows.Forms.Panel area1; - } -} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.cs b/RyzStudio/Windows/ThemedForms/BorderlessForm.cs deleted file mode 100644 index 840d970..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessForm.cs +++ /dev/null @@ -1,409 +0,0 @@ -namespace RyzStudio.Windows.ThemedForms -{ - using System; - using System.ComponentModel; - using System.Drawing; - using System.Drawing.Design; - using System.Windows.Forms; - - public partial class BorderlessForm : System.Windows.Forms.Form - { - protected bool isBusy = false; - - protected Color topFillColour = Color.FromArgb(15, 15, 15); - protected int topFillHeight = 48; - protected Color bottomFillColour = Color.FromArgb(15, 15, 15); - protected int bottomFillMargin = 19; - protected int bottomLeftMargin = 20; - protected int borderWidth = 1; - protected int menuFillWidth = 160; - protected Color menuFillColour = Color.FromArgb(179, 179, 179); - - private bool windowDragging = false; - private Point windowOffset = new Point(); - private Point windowSize = new Point(); - - public BorderlessForm() : base() - { - this.InitializeComponent(); - - this.BackColor = Color.FromArgb(247, 247, 247); - this.FormBorderStyle = FormBorderStyle.None; - this.Padding = new Padding(1); - - this.topFillColour = Color.FromArgb(51, 51, 51); - this.topFillHeight = 48; - this.bottomFillColour = Color.FromArgb(0, 152, 167); - this.bottomFillMargin = 6; - - pictureBox1.Click += pictureBox1_Click; - pictureBox2.Click += pictureBox2_Click; - pictureBox3.Click += pictureBox3_Click; - pictureBox4.Click += pictureBox4_Click; - - updatePictureBox2Image(); - } - - protected override void OnClosing(CancelEventArgs e) - { - base.OnClosing(e); - - if (this.IsBusy) - { - e.Cancel = true; - } - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - Graphics g = e.Graphics; - - Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); - Rectangle areaBottom = new Rectangle(this.DisplayRectangle.Left, (this.DisplayRectangle.Height - bottomFillMargin + this.Padding.Top), this.DisplayRectangle.Width, bottomFillMargin); - Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); - - Rectangle areaMenu = new Rectangle(this.DisplayRectangle.Left, this.DisplayRectangle.Top + topFillHeight, menuFillWidth, (this.DisplayRectangle.Height - bottomFillMargin - topFillHeight)); - - // draw header - if (topFillHeight > 0) - { - g.FillRectangle(new SolidBrush(topFillColour), areaTop); - } - - // fill menu - g.FillRectangle(new SolidBrush(menuFillColour), areaMenu); - - // draw footer - if (bottomFillMargin > 0) - { - g.FillRectangle(new SolidBrush(bottomFillColour), areaBottom); - } - - // draw logo - if (this.TitleLogo != null) - { - g.DrawImageUnscaled(this.TitleLogo, this.Padding.Left, this.Padding.Top); - } - - if (this.Banner != null) - { - g.DrawImageUnscaled(this.Banner, this.Padding.Left + bottomLeftMargin, (this.DisplayRectangle.Height - this.Banner.Height - bottomFillMargin + this.Padding.Top), (this.DisplayRectangle.Width - (this.Padding.Left + this.Padding.Right)), this.Banner.Height); - } - - g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - - updatePictureBox2Image(); - - this.Invalidate(); - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new Padding Padding { get => base.Padding; set => base.Padding = value; } - - [Category("Appearance"), Browsable(true)] - public string Description - { - get - { - return label1.Text?.Replace("\n", "\\n"); - } - set - { - label1.Text = value?.Replace("\\n", "\n"); - } - } - - [Category("Appearance"), Browsable(true)] - public Image TitleLogo { get; set; } - - [Category("Appearance"), Browsable(true)] - public Image Banner { get; set; } - - [Category("Appearance"), Browsable(true)] - public bool ShowMenuButton { get => pictureBox4.Visible; set => pictureBox4.Visible = value; } - - protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } - - private void pictureBox4_Click(object sender, System.EventArgs e) - { - //this.WindowState = FormWindowState.Minimized; - } - - private void pictureBox1_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - this.WindowState = FormWindowState.Minimized; - } - - private void pictureBox2_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - if (this.WindowState == FormWindowState.Maximized) - { - this.WindowState = FormWindowState.Normal; - pictureBox2.NormalImage = Resources.form20_maximise; - pictureBox2.HighlightImage = Resources.form20_maximise2; - } - else - { - this.WindowState = FormWindowState.Maximized; - pictureBox2.NormalImage = Resources.form20_restore; - pictureBox2.HighlightImage = Resources.form20_restore2; - } - } - - private void pictureBox3_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - this.Close(); - } - - public void SetValue(Label sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); - } - else - { - sender.Text = value; - } - } - - public void SetValue(GroupBox sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); - } - else - { - sender.Text = value; - } - } - - public void AddValue(ListBox sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); - } - else - { - sender.Items.Add(value); - } - } - - public void AddControl(FlowLayoutPanel sender, Control value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => - { - sender.Controls.Add(value); - })); - } - else - { - sender.Controls.Add(value); - } - } - - public void ClearValues(ListBox sender) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); - } - else - { - sender.Items.Clear(); - } - } - - public string GetValue(ListBox sender) - { - string rv = string.Empty; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); - } - else - { - rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); - } - - return rv; - } - - public string GetValue(TextBox sender) - { - string rv = string.Empty; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); - } - else - { - rv = sender.Text.Trim(); - } - - return rv; - } - - public int GetValue(NumericUpDown sender) - { - int rv = 0; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); - } - else - { - rv = (int)sender.Value; - } - - return rv; - } - - protected void updatePictureBox2Image() - { - if (this.WindowState == FormWindowState.Maximized) - { - pictureBox2.NormalImage = Resources.form20_restore; - pictureBox2.HighlightImage = Resources.form20_restore2; - } - else - { - pictureBox2.NormalImage = Resources.form20_maximise; - pictureBox2.HighlightImage = Resources.form20_maximise2; - } - } - - private void label1_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - } - - private void label1_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void label1_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - Point currentScreenPos = PointToScreen(e.Location); - Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); - } - } - - private void label1_DoubleClick(object sender, EventArgs e) => pictureBox2_Click(sender, e); - - private void label1_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Middle) - { - this.TopMost = !this.TopMost; - } - } - - private void panel1_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - windowSize = new Point(this.Width, this.Height); - } - - private void panel1_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void panel1_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height); - } - } - - private void panel2_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - windowSize = new Point(this.Width, this.Height); - } - - private void panel2_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void panel2_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height); - } - } - - } -} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessForm.resx b/RyzStudio/Windows/ThemedForms/BorderlessForm.resx deleted file mode 100644 index db173e1..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessForm.resx +++ /dev/null @@ -1,158 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - - True - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADnSURBVDhP1ZVB - DoIwEEW7whNo9Cri/QCv5Y4YEoTWxK71Gvqn+W2AgEkbNvxkYPgzfWkpKcpau9NaX/u+/yC+iSFjK3Ay - RdhcU0qUChc3s67rzipRGJ8T+JYHR2ctWYGzXSC8Gzbs3rbtgZaSXDyp0QoKnJBMBK8WH5vVCUhCcvbX - bAuivwxsmmaP2TxYfyE3zJ/Ij2wLYu3/OxQoah4kYedgIt8TDTTGnFgeyfcsAodLxn205Dlo4IRkInjr - bgq8dT+bWG0L6A/WnLVo4b1eyHDHV8WHNaJwvwAkJeI9KMSGjC201tkP+AimzgF8cMEAAAAASUVORK5C - YII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - xAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAADnSURBVDhP1ZVB - DoIwEEW7whNo9Cri/QCv5Y4YEoTWxK71Gvqn+W2AgEkbNvxkYPgzfWkpKcpau9NaX/u+/yC+iSFjK3Ay - RdhcU0qUChc3s67rzipRGJ8T+JYHR2ctWYGzXSC8Gzbs3rbtgZaSXDyp0QoKnJBMBK8WH5vVCUhCcvbX - bAuivwxsmmaP2TxYfyE3zJ/Ij2wLYu3/OxQoah4kYedgIt8TDTTGnFgeyfcsAodLxn205Dlo4IRkInjr - bgq8dT+bWG0L6A/WnLVo4b1eyHDHV8WHNaJwvwAkJeI9KMSGjC201tkP+AimzgF8cMEAAAAASUVORK5C - YII= - - - \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs deleted file mode 100644 index 75f86a0..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.Designer.cs +++ /dev/null @@ -1,191 +0,0 @@ -namespace RyzStudio.Windows.ThemedForms -{ - partial class BorderlessToolForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.lblDescription = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.imgbxMenu = new RyzStudio.Windows.Forms.ImageBox(); - this.imgbxMaximise = new RyzStudio.Windows.Forms.ImageBox(); - this.imgbxMinimise = new RyzStudio.Windows.Forms.ImageBox(); - this.imgbxClose = new RyzStudio.Windows.Forms.ImageBox(); - this.area1 = new System.Windows.Forms.Panel(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxMenu)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxMaximise)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxMinimise)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).BeginInit(); - this.SuspendLayout(); - // - // lblDescription - // - this.lblDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblDescription.BackColor = System.Drawing.Color.Transparent; - this.lblDescription.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblDescription.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(241)))), ((int)(((byte)(241)))), ((int)(((byte)(241))))); - this.lblDescription.Location = new System.Drawing.Point(1, 1); - this.lblDescription.Name = "lblDescription"; - this.lblDescription.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0); - this.lblDescription.Size = new System.Drawing.Size(194, 30); - this.lblDescription.TabIndex = 148; - this.lblDescription.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.lblDescription.DoubleClick += new System.EventHandler(this.label1_DoubleClick); - this.lblDescription.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); - this.lblDescription.MouseDown += new System.Windows.Forms.MouseEventHandler(this.label1_MouseDown); - this.lblDescription.MouseMove += new System.Windows.Forms.MouseEventHandler(this.label1_MouseMove); - this.lblDescription.MouseUp += new System.Windows.Forms.MouseEventHandler(this.label1_MouseUp); - // - // panel1 - // - this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.panel1.BackColor = System.Drawing.Color.Transparent; - this.panel1.Cursor = System.Windows.Forms.Cursors.SizeNWSE; - this.panel1.Location = new System.Drawing.Point(335, 595); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(5, 5); - this.panel1.TabIndex = 150; - this.panel1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseDown); - this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove); - this.panel1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseUp); - // - // imgbxMenu - // - this.imgbxMenu.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.imgbxMenu.BackColor = System.Drawing.Color.Transparent; - this.imgbxMenu.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.imgbxMenu.ErrorImage = null; - this.imgbxMenu.HighlightImage = global::AppLauncher.Properties.Resources.form16_menu2; - this.imgbxMenu.Image = global::AppLauncher.Properties.Resources.form16_menu; - this.imgbxMenu.InitialImage = null; - this.imgbxMenu.Location = new System.Drawing.Point(224, 4); - this.imgbxMenu.Name = "imgbxMenu"; - this.imgbxMenu.NormalImage = global::AppLauncher.Properties.Resources.form16_menu; - this.imgbxMenu.Size = new System.Drawing.Size(24, 24); - this.imgbxMenu.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.imgbxMenu.TabIndex = 149; - this.imgbxMenu.TabStop = false; - // - // imgbxMaximise - // - this.imgbxMaximise.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.imgbxMaximise.BackColor = System.Drawing.Color.Transparent; - this.imgbxMaximise.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.imgbxMaximise.ErrorImage = null; - this.imgbxMaximise.HighlightImage = global::AppLauncher.Properties.Resources.form16_maximise2; - this.imgbxMaximise.Image = global::AppLauncher.Properties.Resources.form16_maximise; - this.imgbxMaximise.InitialImage = null; - this.imgbxMaximise.Location = new System.Drawing.Point(280, 4); - this.imgbxMaximise.Name = "imgbxMaximise"; - this.imgbxMaximise.NormalImage = global::AppLauncher.Properties.Resources.form16_maximise; - this.imgbxMaximise.Size = new System.Drawing.Size(24, 24); - this.imgbxMaximise.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.imgbxMaximise.TabIndex = 147; - this.imgbxMaximise.TabStop = false; - // - // imgbxMinimise - // - this.imgbxMinimise.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.imgbxMinimise.BackColor = System.Drawing.Color.Transparent; - this.imgbxMinimise.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.imgbxMinimise.ErrorImage = null; - this.imgbxMinimise.HighlightImage = global::AppLauncher.Properties.Resources.form16_minimise2; - this.imgbxMinimise.Image = global::AppLauncher.Properties.Resources.form16_minimise; - this.imgbxMinimise.InitialImage = null; - this.imgbxMinimise.Location = new System.Drawing.Point(252, 4); - this.imgbxMinimise.Name = "imgbxMinimise"; - this.imgbxMinimise.NormalImage = global::AppLauncher.Properties.Resources.form16_minimise; - this.imgbxMinimise.Size = new System.Drawing.Size(24, 24); - this.imgbxMinimise.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.imgbxMinimise.TabIndex = 146; - this.imgbxMinimise.TabStop = false; - // - // imgbxClose - // - this.imgbxClose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.imgbxClose.BackColor = System.Drawing.Color.Transparent; - this.imgbxClose.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; - this.imgbxClose.ErrorImage = null; - this.imgbxClose.HighlightImage = global::AppLauncher.Properties.Resources.form16_close2; - this.imgbxClose.Image = global::AppLauncher.Properties.Resources.form16_close; - this.imgbxClose.InitialImage = null; - this.imgbxClose.Location = new System.Drawing.Point(308, 4); - this.imgbxClose.Name = "imgbxClose"; - this.imgbxClose.NormalImage = global::AppLauncher.Properties.Resources.form16_close; - this.imgbxClose.Size = new System.Drawing.Size(24, 24); - this.imgbxClose.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; - this.imgbxClose.TabIndex = 145; - this.imgbxClose.TabStop = false; - // - // area1 - // - this.area1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.area1.BackColor = System.Drawing.Color.Transparent; - this.area1.Cursor = System.Windows.Forms.Cursors.SizeNS; - this.area1.Location = new System.Drawing.Point(0, 595); - this.area1.Name = "area1"; - this.area1.Size = new System.Drawing.Size(334, 5); - this.area1.TabIndex = 151; - this.area1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseDown); - this.area1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseMove); - this.area1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.panel2_MouseUp); - // - // BorderlessToolForm - // - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.BackColor = System.Drawing.Color.WhiteSmoke; - this.ClientSize = new System.Drawing.Size(340, 600); - this.Controls.Add(this.area1); - this.Controls.Add(this.panel1); - this.Controls.Add(this.imgbxMenu); - this.Controls.Add(this.lblDescription); - this.Controls.Add(this.imgbxMaximise); - this.Controls.Add(this.imgbxMinimise); - this.Controls.Add(this.imgbxClose); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.MinimumSize = new System.Drawing.Size(40, 0); - this.Name = "BorderlessToolForm"; - ((System.ComponentModel.ISupportInitialize)(this.imgbxMenu)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxMaximise)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxMinimise)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.imgbxClose)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - protected internal Forms.ImageBox imgbxMaximise; - protected internal Forms.ImageBox imgbxMinimise; - protected internal Forms.ImageBox imgbxClose; - protected internal System.Windows.Forms.Label lblDescription; - protected internal Forms.ImageBox imgbxMenu; - protected internal System.Windows.Forms.Panel panel1; - protected internal System.Windows.Forms.Panel area1; - } -} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs deleted file mode 100644 index 3c17b0b..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.cs +++ /dev/null @@ -1,394 +0,0 @@ -namespace RyzStudio.Windows.ThemedForms -{ - using System; - using System.ComponentModel; - using System.Drawing; - using System.Drawing.Design; - using System.Windows.Forms; - using Resources = AppLauncher.Properties.Resources; - - public partial class BorderlessToolForm : System.Windows.Forms.Form - { - protected bool isBusy = false; - - protected Color topFillColour = Color.FromArgb(15, 15, 15); - protected int topFillHeight = 32; - protected int borderWidth = 1; - - private bool windowDragging = false; - private Point windowOffset = new Point(); - private Point windowSize = new Point(); - - public BorderlessToolForm() : base() - { - this.InitializeComponent(); - - this.BackColor = Color.FromArgb(246, 246, 246); - this.Padding = new Padding(1); - - this.topFillColour = Color.FromArgb(51, 51, 51); - this.topFillHeight = 32; - - this.BackColor = Color.FromArgb(179, 179, 179); - this.FormBorderStyle = FormBorderStyle.None; - - imgbxMinimise.Click += pictureBox1_Click; - imgbxMaximise.Click += pictureBox2_Click; - imgbxClose.Click += pictureBox3_Click; - imgbxMenu.Click += pictureBox4_Click; - - updatePictureBox2Image(); - } - - protected override void OnClosing(CancelEventArgs e) - { - base.OnClosing(e); - - if (this.IsBusy) - { - e.Cancel = true; - } - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - Graphics g = e.Graphics; - - Rectangle areaTop = new Rectangle(this.DisplayRectangle.Left, this.Padding.Top, this.DisplayRectangle.Width, topFillHeight); - Rectangle areaBorder = new Rectangle(this.ClientRectangle.X, this.ClientRectangle.Y, this.ClientRectangle.Width - borderWidth, this.ClientRectangle.Height - borderWidth); - - // draw header - if (topFillHeight > 0) - { - g.FillRectangle(new SolidBrush(topFillColour), areaTop); - } - - // draw logo - //if (this.TitleLogo != null) - //{ - // g.DrawImageUnscaled(this.TitleLogo, this.Padding.Left, this.Padding.Top); - //} - - g.DrawRectangle(new Pen(Color.Black, borderWidth), areaBorder); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - - updatePictureBox2Image(); - - this.Invalidate(); - } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new Color BackColor { get => base.BackColor; set => base.BackColor = value; } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new FormBorderStyle FormBorderStyle { get => base.FormBorderStyle; set => base.FormBorderStyle = value; } - - [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] - public new Padding Padding { get => base.Padding; set => base.Padding = value; } - - [Category("Appearance"), Browsable(true)] - public string Description - { - get - { - return lblDescription.Text?.Replace("\n", "\\n"); - } - set - { - lblDescription.Text = value?.Replace("\\n", "\n"); - } - } - - //[Category("Appearance"), Browsable(true)] - //public Image TitleLogo { get; set; } - - [Category("Appearance"), Browsable(true)] - public Image Banner { get; set; } - - [Category("Appearance"), Browsable(true)] - public bool ShowMenuButton { get => imgbxMenu.Visible; set => imgbxMenu.Visible = value; } - - [Category("Appearance"), Browsable(true)] - public bool ShowMinimiseButton { get => imgbxMinimise.Visible; set => imgbxMinimise.Visible = value; } - - [Category("Appearance"), Browsable(true)] - public bool ShowMaximiseButton { get => imgbxMaximise.Visible; set => imgbxMaximise.Visible = value; } - - protected virtual bool IsBusy { get => isBusy; set => isBusy = value; } - - private void pictureBox4_Click(object sender, System.EventArgs e) - { - //this.WindowState = FormWindowState.Minimized; - } - - private void pictureBox1_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - this.WindowState = FormWindowState.Minimized; - } - - private void pictureBox2_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - if (this.WindowState == FormWindowState.Maximized) - { - this.WindowState = FormWindowState.Normal; - imgbxMaximise.NormalImage = Resources.form16_maximise; - imgbxMaximise.HighlightImage = Resources.form16_maximise2; - } - else - { - this.WindowState = FormWindowState.Maximized; - imgbxMaximise.NormalImage = Resources.form16_restore; - imgbxMaximise.HighlightImage = Resources.form16_restore2; - } - } - - private void pictureBox3_Click(object sender, System.EventArgs e) - { - MouseEventArgs mouseEvent = (MouseEventArgs)e; - if (mouseEvent != null) - { - if (mouseEvent.Button != MouseButtons.Left) - { - return; - } - } - - this.Close(); - } - - public void SetValue(Label sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); - } - else - { - sender.Text = value; - } - } - - public void SetValue(GroupBox sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Text = value; })); - } - else - { - sender.Text = value; - } - } - - public void AddValue(ListBox sender, string value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Items.Add(value); })); - } - else - { - sender.Items.Add(value); - } - } - - public void AddControl(FlowLayoutPanel sender, Control value) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => - { - sender.Controls.Add(value); - })); - } - else - { - sender.Controls.Add(value); - } - } - - public void ClearValues(ListBox sender) - { - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { sender.Items.Clear(); })); - } - else - { - sender.Items.Clear(); - } - } - - public string GetValue(ListBox sender) - { - string rv = string.Empty; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); })); - } - else - { - rv = (sender.SelectedItem == null) ? string.Empty : sender.SelectedItem.ToString(); - } - - return rv; - } - - public string GetValue(TTextBox sender) - { - string rv = string.Empty; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = sender.Text.Trim(); })); - } - else - { - rv = sender.Text.Trim(); - } - - return rv; - } - - public int GetValue(NumericUpDown sender) - { - int rv = 0; - - if (sender.InvokeRequired) - { - sender.Invoke(new MethodInvoker(() => { rv = (int)sender.Value; })); - } - else - { - rv = (int)sender.Value; - } - - return rv; - } - - protected void updatePictureBox2Image() - { - if (this.WindowState == FormWindowState.Maximized) - { - imgbxMaximise.NormalImage = Resources.form16_restore; - imgbxMaximise.HighlightImage = Resources.form16_restore2; - } - else - { - imgbxMaximise.NormalImage = Resources.form16_maximise; - imgbxMaximise.HighlightImage = Resources.form16_maximise2; - } - } - - private void label1_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - } - - private void label1_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void label1_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - Point currentScreenPos = PointToScreen(e.Location); - Location = new Point(currentScreenPos.X - windowOffset.X, currentScreenPos.Y - windowOffset.Y); - } - } - - private void label1_DoubleClick(object sender, EventArgs e) => pictureBox2_Click(sender, e); - - private void label1_MouseClick(object sender, MouseEventArgs e) - { - if (e.Button == MouseButtons.Middle) - { - this.TopMost = !this.TopMost; - } - } - - private void panel1_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - windowSize = new Point(this.Width, this.Height); - } - - private void panel1_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - } - - private void panel1_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - this.Size = new Size(e.X - windowOffset.X + this.Width, e.Y - windowOffset.Y + this.Height); - } - } - - private void panel2_MouseDown(object sender, MouseEventArgs e) - { - if (e.Button != MouseButtons.Left) - { - return; - } - - windowDragging = true; - windowOffset = e.Location; - windowSize = new Point(this.Width, this.Height); - } - - private void panel2_MouseUp(object sender, MouseEventArgs e) - { - windowDragging = false; - - } - - private void panel2_MouseMove(object sender, MouseEventArgs e) - { - if (windowDragging) - { - this.Size = new Size(windowSize.X, e.Y - windowOffset.Y + this.Height); - } - } - } -} \ No newline at end of file diff --git a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx b/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx deleted file mode 100644 index 8c98a25..0000000 --- a/RyzStudio/Windows/ThemedForms/BorderlessToolForm.resx +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - True - - - True - - - True - - - True - - \ No newline at end of file diff --git a/Windows/Forms/BookmarkTreeViewSNode.cs b/Windows/Forms/BookmarkTreeViewSNode.cs deleted file mode 100644 index e7756c7..0000000 --- a/Windows/Forms/BookmarkTreeViewSNode.cs +++ /dev/null @@ -1,211 +0,0 @@ -using bzit.bomg.Models; -using System; -using System.Windows.Forms; -using static RyzStudio.Windows.Forms.BookmarkTreeView; - -namespace RyzStudio.Windows.Forms -{ - public class BookmarkTreeViewSNode - { - protected BookmarkTreeView parentTreeview = null; - - - public BookmarkTreeViewSNode(BookmarkTreeView treeview) - { - parentTreeview = treeview; - } - - protected TreeNode SelectedNode - { - get => parentTreeview?.SelectedNode; - set - { - if (parentTreeview == null) - { - return; - } - - parentTreeview.SelectedNode = value; - } - } - - //public TreeNode AddFolder() => parentTreeview.AddFolder(this.SelectedNode); - - //public TreeNode AddFolder(string name) => parentTreeview.AddFolder(this.SelectedNode, name); - - //public TreeNode AddItem(string name, object tag) - //{ - // if (this.SelectedNode == null) - // { - // return null; - // } - - // if (this.SelectedNode.Tag != null) - // { - // return null; - // } - - // TreeNode tn = new TreeNode(name, (int)BookmarkTreeView.IconSet.Default, (int)BookmarkTreeView.IconSet.Default); - // tn.Tag = tag; - - // this.SelectedNode.Nodes.Add(tn); - - // return tn; - //} - - //public void AddOrUpdateItem(BookmarkItemViewModel viewModel) - //{ - // switch (this.GetNodeType()) - // { - // case NodeType.Root: - // case NodeType.Folder: - // parentTreeview.AddItem(this.SelectedNode, viewModel); - // break; - // case NodeType.Page: - // parentTreeview.UpdateItem(this.SelectedNode, viewModel); - // break; - // default: - // break; - // } - //} - - //public void Delete() - //{ - // if (this.SelectedNode == null) - // { - // return; - // } - - // if (parentTreeview.Nodes.Count <= 0) - // { - // return; - // } - - // if (this.SelectedNode.Equals(parentTreeview.Nodes[0])) - // { - // return; - // } - - // this.SelectedNode.Remove(); - //} - - //public void Edit() - //{ - // if (this.SelectedNode == null) - // { - // return; - // } - - // if (this.SelectedNode.IsEditing) - // { - // return; - // } - - // switch (this.GetNodeType()) - // { - // case BookmarkTreeView.NodeType.Root: - // case BookmarkTreeView.NodeType.Folder: - // parentTreeview.AllowBeginEdit = true; - // this.SelectedNode.BeginEdit(); - // break; - // case BookmarkTreeView.NodeType.Page: - // parentTreeview.AllowBeginEdit = true; - // this.SelectedNode.BeginEdit(); - // break; - // default: - // break; - // } - //} - - //public bool FindTextNode(string term) => parentTreeview.FindTextNode(this.SelectedNode, term); - - //public BookmarkTreeView.NodeType GetNodeType() => parentTreeview.GetNodeType(this.SelectedNode); - - //public BookmarkItemViewModel GetViewModel() => parentTreeview.GetViewModel(this.SelectedNode); - - //public void MoveDown() - //{ - // if (this.SelectedNode == null) - // { - // return; - // } - - // TreeNode tn = this.SelectedNode; - // if (tn.Parent == null) - // { - // return; - // } - - // TreeNode tn1 = tn.Parent; - - // if (tn.Index >= (tn1.Nodes.Count - 1)) - // { - // return; - // } - - // int n = tn.Index + 1; - - // tn1.Nodes.Remove(tn); - // tn1.Nodes.Insert(n, tn); - - // this.SelectedNode = tn; - //} - - //public void MoveUp() - //{ - // if (this.SelectedNode == null) - // { - // return; - // } - - // TreeNode tn = this.SelectedNode; - // if (tn.Parent == null) - // { - // return; - // } - - // if (tn.Index <= 0) - // { - // return; - // } - - // int n = tn.Index - 1; - - // TreeNode tn1 = tn.Parent; - // tn1.Nodes.Remove(tn); - // tn1.Nodes.Insert(n, tn); - - // this.SelectedNode = tn; - //} - - //public void Sort() - //{ - // if (this.SelectedNode == null) - // { - // return; - // } - - // string[] tnv = new string[0]; - // TreeNode[] tna = new TreeNode[0]; - - // foreach (TreeNode tn2 in this.SelectedNode.Nodes) - // { - // Array.Resize(ref tna, (tna.Length + 1)); - // tna[(tna.Length - 1)] = tn2; - - // Array.Resize(ref tnv, (tnv.Length + 1)); - // tnv[(tnv.Length - 1)] = tn2.Text; - // } - - // Array.Sort(tnv, tna); - - // this.SelectedNode.Nodes.Clear(); - - // foreach (TreeNode tn2 in tna) - // { - // this.SelectedNode.Nodes.Add(tn2); - // } - //} - - } -} diff --git a/Windows/Forms/EditGroupForm.cs b/Windows/Forms/EditGroupForm.cs deleted file mode 100644 index 96191f1..0000000 --- a/Windows/Forms/EditGroupForm.cs +++ /dev/null @@ -1,176 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.ThemedForms; -using System; - -namespace FizzyLauncher.Windows.Forms -{ - public class EditGroupForm : TDialogForm - { - public static void ShowDialog(TilePanelLayout control) - { - EditGroupForm form = new EditGroupForm(); - form.TilePanelLayout = control; - form.ShowDialog(); - } - - - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private TButton button1; - private TPickerBox pickerBox1; - private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; - private TTextBox textBox1; - - - public EditGroupForm() : base() - { - InitializeComponent(); - - pickerBox1.ComboBox.Items.Clear(); - pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" }); - if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0; - } - - private void InitializeComponent() - { - this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); - this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); - this.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.BackColor = System.Drawing.Color.Transparent; - this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(192, 20); - this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.textBox1.Name = "textBox1"; - this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox1.Size = new System.Drawing.Size(177, 35); - this.textBox1.SubmitButton = null; - this.textBox1.TabIndex = 152; - this.textBox1.UseSystemPasswordChar = false; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.ForeColor = System.Drawing.SystemColors.ControlText; - this.label2.Location = new System.Drawing.Point(10, 62); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label2.Size = new System.Drawing.Size(119, 34); - this.label2.TabIndex = 155; - this.label2.Text = "Show Only Expanded"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.ForeColor = System.Drawing.SystemColors.ControlText; - this.label1.Location = new System.Drawing.Point(10, 21); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label1.Size = new System.Drawing.Size(29, 34); - this.label1.TabIndex = 153; - this.label1.Text = "Title"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button1.BackColor = System.Drawing.Color.Transparent; - this.button1.DefaultImage = null; - this.button1.DownImage = null; - this.button1.IsSelected = false; - this.button1.LabelText = "&Save"; - this.button1.Location = new System.Drawing.Point(241, 469); - this.button1.Margin = new System.Windows.Forms.Padding(10); - this.button1.Name = "button1"; - this.button1.OverImage = null; - this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); - this.button1.Size = new System.Drawing.Size(128, 32); - this.button1.TabIndex = 173; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // pickerBox1 - // - this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pickerBox1.BackColor = System.Drawing.Color.Transparent; - this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.pickerBox1.Location = new System.Drawing.Point(285, 62); - this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.pickerBox1.Name = "pickerBox1"; - this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); - this.pickerBox1.Size = new System.Drawing.Size(84, 34); - this.pickerBox1.SubmitButton = null; - this.pickerBox1.TabIndex = 174; - // - // horizontalSeparator2 - // - this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent; - this.horizontalSeparator2.Location = new System.Drawing.Point(10, 437); - this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); - this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2); - this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22); - this.horizontalSeparator2.Name = "horizontalSeparator2"; - this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22); - this.horizontalSeparator2.TabIndex = 182; - // - // EditGroupForm - // - this.ClientSize = new System.Drawing.Size(384, 521); - this.Controls.Add(this.horizontalSeparator2); - this.Controls.Add(this.pickerBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox1); - this.MinimumSize = new System.Drawing.Size(400, 560); - this.Name = "EditGroupForm"; - this.Text = "Edit Group"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - protected override void OnShown(EventArgs e) - { - base.OnShown(e); - - if (this.TilePanelLayout != null) - { - textBox1.Text = this.TilePanelLayout.Model.Title; - pickerBox1.ComboBox.SelectedIndex = (this.TilePanelLayout.Model.IsExclusive ? 1 : 0); - } - } - - - public TilePanelLayout TilePanelLayout { get; set; } = null; - - - private void button1_Click(object sender, EventArgs e) - { - TileGroupModel model = this.TilePanelLayout.Model; - model.Title = textBox1.Text?.Trim(); - model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1); - - this.TilePanelLayout.UpdateModel(model); - - this.Close(); - } - - } -} diff --git a/Windows/Forms/EditGroupForm.resx b/Windows/Forms/EditGroupForm.resx deleted file mode 100644 index f298a7b..0000000 --- a/Windows/Forms/EditGroupForm.resx +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Windows/Forms/EditTileFolderForm.cs b/Windows/Forms/EditTileFolderForm.cs deleted file mode 100644 index 9f39b35..0000000 --- a/Windows/Forms/EditTileFolderForm.cs +++ /dev/null @@ -1,394 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.ThemedForms; -using System; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Windows.Forms; - -namespace FizzyLauncher.Windows.Forms -{ - public class EditTileFolderForm : TDialogForm - { - public static void ShowAddDialog(TilePanelLayout control, Point coord) - { - EditTileFolderForm form = new EditTileFolderForm(DialogModeType.Add); - form.TilePanelLayout = control; - form.AimCoord = coord; - form.ShowDialog(); - } - - public static void ShowEditDialog(TilePanel control) - { - EditTileFolderForm form = new EditTileFolderForm(DialogModeType.Edit); - form.TilePanel = control; - form.ShowDialog(); - } - - - private System.Windows.Forms.Label label1; - private TButton button1; - private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; - private TTextBox textBox1; - private TListBox listBox1; - private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1; - private System.Windows.Forms.Label label2; - - - public enum DialogModeType - { - Add = 0, - Edit - } - - - protected DialogModeType dialogMode = DialogModeType.Add; - - - public EditTileFolderForm(DialogModeType dialogMode) : base() - { - InitializeComponent(); - - this.DialogMode = dialogMode; - } - - private void InitializeComponent() - { - this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); - this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox(); - this.label2 = new System.Windows.Forms.Label(); - this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); - this.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.BackColor = System.Drawing.Color.Transparent; - this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(192, 20); - this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.textBox1.Name = "textBox1"; - this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox1.Size = new System.Drawing.Size(177, 35); - this.textBox1.SubmitButton = null; - this.textBox1.TabIndex = 152; - this.textBox1.UseSystemPasswordChar = false; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.ForeColor = System.Drawing.SystemColors.ControlText; - this.label1.Location = new System.Drawing.Point(10, 21); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label1.Size = new System.Drawing.Size(29, 34); - this.label1.TabIndex = 153; - this.label1.Text = "Title"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button1.BackColor = System.Drawing.Color.Transparent; - this.button1.DefaultImage = null; - this.button1.DownImage = null; - this.button1.IsSelected = false; - this.button1.LabelText = "&Save"; - this.button1.Location = new System.Drawing.Point(241, 469); - this.button1.Margin = new System.Windows.Forms.Padding(10); - this.button1.Name = "button1"; - this.button1.OverImage = null; - this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); - this.button1.Size = new System.Drawing.Size(128, 32); - this.button1.TabIndex = 173; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // horizontalSeparator2 - // - this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent; - this.horizontalSeparator2.Location = new System.Drawing.Point(10, 61); - this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); - this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2); - this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22); - this.horizontalSeparator2.Name = "horizontalSeparator2"; - this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22); - this.horizontalSeparator2.TabIndex = 177; - // - // listBox1 - // - this.listBox1.AllowDrop = true; - this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listBox1.BackColor = System.Drawing.Color.Transparent; - this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.listBox1.Location = new System.Drawing.Point(109, 87); - this.listBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4); - this.listBox1.Name = "listBox1"; - this.listBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); - this.listBox1.Size = new System.Drawing.Size(260, 346); - this.listBox1.SubmitButton = null; - this.listBox1.TabIndex = 180; - this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd); - this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit); - this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop); - this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.ForeColor = System.Drawing.SystemColors.ControlText; - this.label2.Location = new System.Drawing.Point(8, 87); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label2.Size = new System.Drawing.Size(25, 34); - this.label2.TabIndex = 181; - this.label2.Text = "List"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // tHorizontalSeparator1 - // - this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent; - this.tHorizontalSeparator1.Location = new System.Drawing.Point(10, 437); - this.tHorizontalSeparator1.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); - this.tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2); - this.tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22); - this.tHorizontalSeparator1.Name = "tHorizontalSeparator1"; - this.tHorizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22); - this.tHorizontalSeparator1.TabIndex = 182; - // - // EditTileFolderForm - // - this.ClientSize = new System.Drawing.Size(384, 521); - this.Controls.Add(this.tHorizontalSeparator1); - this.Controls.Add(this.label2); - this.Controls.Add(this.listBox1); - this.Controls.Add(this.horizontalSeparator2); - this.Controls.Add(this.button1); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox1); - this.MinimumSize = new System.Drawing.Size(400, 560); - this.Name = "EditTileFolderForm"; - this.Text = "Add List Tile"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - protected override void OnShown(EventArgs e) - { - base.OnShown(e); - - if (this.DialogMode == DialogModeType.Edit) - { - listBox1.ListBox.Items.Clear(); - - if (this.TilePanel == null) return; - if (this.TilePanel.ModelInfo == null) return; - - textBox1.Text = this.TilePanel.ModelInfo.Title; - - if (this.TilePanel.ModelInfo.Items != null) - { - foreach (TileModel item in this.TilePanel.ModelInfo.Items) - { - if (item.IsGroup) - { - continue; - } - - listBox1.ListBox.Items.Add(item); - } - } - } - } - - - public TilePanelLayout TilePanelLayout { get; set; } = null; - - public TilePanel TilePanel { get; set; } = null; - - public Point AimCoord { get; set; } = new Point(-1, -1); - - public DialogModeType DialogMode - { - get => dialogMode; - set - { - dialogMode = value; - - switch (dialogMode) - { - case DialogModeType.Add: - this.Text = "Add Folder"; - textBox1.Text = "New Folder"; - break; - case DialogModeType.Edit: - this.Text = "Edit Folder"; - break; - default: break; - } - } - } - - - private void button1_Click(object sender, EventArgs e) - { - TileModel model = new TileModel() - { - Title = textBox1.Text?.Trim(), - IsGroup = true - }; - - switch (this.DialogMode) - { - case DialogModeType.Add: - if (!this.AimCoord.Equals(new Point(-1, -1))) - { - model.Position = this.AimCoord; - } - - model.Items = new System.Collections.Generic.List(); - - foreach (TileModel item in listBox1.ListBox.Items.OfType()) - { - if (item.IsGroup) - { - continue; - } - - model.Items.Add(item); - } - - this.TilePanelLayout.AddTile(model); - - break; - case DialogModeType.Edit: - model.Items = new System.Collections.Generic.List(); - - foreach (TileModel item in listBox1.ListBox.Items.OfType()) - { - if (item.IsGroup) - { - continue; - } - - model.Items.Add(item); - } - - this.TilePanel.LoadInfo(model); - - break; - default: break; - } - - this.Close(); - } - - private void listBox1_OnAdd(object sender, EventArgs e) => EditTileForm.ShowAddDialog(listBox1); - - private void listBox1_OnEdit(object sender, EventArgs e) - { - if (listBox1.ListBox.Items.Count <= 0) - { - return; - } - - if (listBox1.ListBox.SelectedIndex < 0) - { - return; - } - - if (listBox1.ListBox.SelectedItem == null) - { - return; - } - - EditTileForm.ShowEditDialog(listBox1); - } - - private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - e.Effect = DragDropEffects.Link; - } - else - { - e.Effect = DragDropEffects.None; - } - } - - private void listBox1_DragDrop(object sender, DragEventArgs e) - { - string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[]; - if (fileList == null) - { - return; - } - - if (fileList.Length <= 0) - { - return; - } - - if (string.IsNullOrWhiteSpace(fileList[0])) - { - return; - } - - TileModel model = new TileModel() - { - ProcessFilename = fileList[0], - Title = Path.GetFileName(fileList[0]) - }; - - // exe - if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase)) - { - if (File.Exists(fileList[0])) - { - try - { - FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]); - if (fvi != null) - { - model.Title = fvi.ProductName; - } - } - catch - { - // do nothing - } - } - - - if (string.IsNullOrWhiteSpace(model.Title)) - { - model.Title = Path.GetFileNameWithoutExtension(fileList[0]); - } - } - - listBox1.ListBox.Items.Add(model); - } - - } -} \ No newline at end of file diff --git a/Windows/Forms/EditTileFolderForm.resx b/Windows/Forms/EditTileFolderForm.resx deleted file mode 100644 index f298a7b..0000000 --- a/Windows/Forms/EditTileFolderForm.resx +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Windows/Forms/EditTileForm.cs b/Windows/Forms/EditTileForm.cs deleted file mode 100644 index 54d2997..0000000 --- a/Windows/Forms/EditTileForm.cs +++ /dev/null @@ -1,482 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.ThemedForms; -using System; -using System.Drawing; - -namespace FizzyLauncher.Windows.Forms -{ - public class EditTileForm : TDialogForm - { - public static void ShowAddDialog(TilePanelLayout control, Point coord) - { - EditTileForm form = new EditTileForm(DialogModeType.Add); - form.TilePanelLayout = control; - form.AimCoord = coord; - form.ShowDialog(); - } - - public static void ShowAddDialog(TListBox control) - { - EditTileForm form = new EditTileForm(DialogModeType.Add); - form.ListBox = control; - form.ShowDialog(); - } - - public static void ShowEditDialog(TilePanel control) - { - EditTileForm form = new EditTileForm(DialogModeType.Edit); - form.TilePanel = control; - form.ShowDialog(); - } - - public static void ShowEditDialog(TListBox control) - { - EditTileForm form = new EditTileForm(DialogModeType.Edit); - form.ListBox = control; - form.ShowDialog(); - } - - - private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private TOpenFileTextBox textBox2; - private TTextBox textBox3; - private TFolderTextBox textBox4; - private TButton button1; - private TPickerBox pickerBox1; - private TPickerBox pickerBox2; - private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; - private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; - private TTextBox textBox1; - - - public enum DialogModeType - { - Add = 0, - Edit - } - - - protected DialogModeType dialogMode = DialogModeType.Add; - - - public EditTileForm(DialogModeType dialogMode) : base() - { - InitializeComponent(); - - this.DialogMode = dialogMode; - - pickerBox1.ComboBox.Items.Clear(); - pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" }); - if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0; - - pickerBox2.ComboBox.Items.Clear(); - pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" }); - if (pickerBox2.ComboBox.Items.Count > 0) pickerBox2.ComboBox.SelectedIndex = 0; - } - - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditTileForm)); - this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.textBox2 = new RyzStudio.Windows.ThemedForms.TOpenFileTextBox(); - this.textBox3 = new RyzStudio.Windows.ThemedForms.TTextBox(); - this.textBox4 = new RyzStudio.Windows.ThemedForms.TFolderTextBox(); - this.button1 = new RyzStudio.Windows.ThemedForms.TButton(); - this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox(); - this.pickerBox2 = new RyzStudio.Windows.ThemedForms.TPickerBox(); - this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); - this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); - this.SuspendLayout(); - // - // textBox1 - // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.BackColor = System.Drawing.Color.Transparent; - this.textBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox1.Location = new System.Drawing.Point(192, 20); - this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.textBox1.Name = "textBox1"; - this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox1.Size = new System.Drawing.Size(177, 35); - this.textBox1.SubmitButton = null; - this.textBox1.TabIndex = 152; - this.textBox1.UseSystemPasswordChar = false; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.BackColor = System.Drawing.Color.Transparent; - this.label6.ForeColor = System.Drawing.SystemColors.ControlText; - this.label6.Location = new System.Drawing.Point(10, 250); - this.label6.Name = "label6"; - this.label6.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label6.Size = new System.Drawing.Size(83, 34); - this.label6.TabIndex = 163; - this.label6.Text = "Run As Admin"; - this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.BackColor = System.Drawing.Color.Transparent; - this.label7.ForeColor = System.Drawing.SystemColors.ControlText; - this.label7.Location = new System.Drawing.Point(10, 209); - this.label7.Name = "label7"; - this.label7.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label7.Size = new System.Drawing.Size(79, 34); - this.label7.TabIndex = 161; - this.label7.Text = "Window Style"; - this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.BackColor = System.Drawing.Color.Transparent; - this.label4.ForeColor = System.Drawing.SystemColors.ControlText; - this.label4.Location = new System.Drawing.Point(10, 144); - this.label4.Name = "label4"; - this.label4.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label4.Size = new System.Drawing.Size(103, 34); - this.label4.TabIndex = 159; - this.label4.Text = "Working Directory"; - this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.BackColor = System.Drawing.Color.Transparent; - this.label3.ForeColor = System.Drawing.SystemColors.ControlText; - this.label3.Location = new System.Drawing.Point(10, 103); - this.label3.Name = "label3"; - this.label3.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label3.Size = new System.Drawing.Size(61, 34); - this.label3.TabIndex = 157; - this.label3.Text = "Argument"; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.BackColor = System.Drawing.Color.Transparent; - this.label2.ForeColor = System.Drawing.SystemColors.ControlText; - this.label2.Location = new System.Drawing.Point(10, 62); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label2.Size = new System.Drawing.Size(55, 34); - this.label2.TabIndex = 155; - this.label2.Text = "Filename"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.BackColor = System.Drawing.Color.Transparent; - this.label1.ForeColor = System.Drawing.SystemColors.ControlText; - this.label1.Location = new System.Drawing.Point(10, 21); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10); - this.label1.Size = new System.Drawing.Size(29, 34); - this.label1.TabIndex = 153; - this.label1.Text = "Title"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // textBox2 - // - this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox2.BackColor = System.Drawing.Color.Transparent; - this.textBox2.FileDialog = null; - this.textBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox2.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox2.HighlightImage"))); - this.textBox2.Location = new System.Drawing.Point(192, 61); - this.textBox2.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3); - this.textBox2.Name = "textBox2"; - this.textBox2.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox2.NormalImage"))); - this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox2.Size = new System.Drawing.Size(177, 35); - this.textBox2.SubmitButton = null; - this.textBox2.TabIndex = 170; - this.textBox2.UseSystemPasswordChar = false; - // - // textBox3 - // - this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox3.BackColor = System.Drawing.Color.Transparent; - this.textBox3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox3.Location = new System.Drawing.Point(192, 102); - this.textBox3.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.textBox3.Name = "textBox3"; - this.textBox3.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox3.Size = new System.Drawing.Size(177, 35); - this.textBox3.SubmitButton = null; - this.textBox3.TabIndex = 171; - this.textBox3.UseSystemPasswordChar = false; - // - // textBox4 - // - this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.textBox4.BackColor = System.Drawing.Color.Transparent; - this.textBox4.FolderDialog = null; - this.textBox4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.textBox4.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox4.HighlightImage"))); - this.textBox4.Location = new System.Drawing.Point(192, 143); - this.textBox4.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3); - this.textBox4.Name = "textBox4"; - this.textBox4.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox4.NormalImage"))); - this.textBox4.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9); - this.textBox4.Size = new System.Drawing.Size(177, 35); - this.textBox4.SubmitButton = null; - this.textBox4.TabIndex = 172; - this.textBox4.UseSystemPasswordChar = false; - // - // button1 - // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.button1.BackColor = System.Drawing.Color.Transparent; - this.button1.DefaultImage = null; - this.button1.DownImage = null; - this.button1.IsSelected = false; - this.button1.LabelText = "&Save"; - this.button1.Location = new System.Drawing.Point(241, 469); - this.button1.Margin = new System.Windows.Forms.Padding(10); - this.button1.Name = "button1"; - this.button1.OverImage = null; - this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3); - this.button1.Size = new System.Drawing.Size(128, 32); - this.button1.TabIndex = 173; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // pickerBox1 - // - this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pickerBox1.BackColor = System.Drawing.Color.Transparent; - this.pickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.pickerBox1.Location = new System.Drawing.Point(241, 209); - this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.pickerBox1.Name = "pickerBox1"; - this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); - this.pickerBox1.Size = new System.Drawing.Size(128, 34); - this.pickerBox1.SubmitButton = null; - this.pickerBox1.TabIndex = 174; - // - // pickerBox2 - // - this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.pickerBox2.BackColor = System.Drawing.Color.Transparent; - this.pickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.pickerBox2.Location = new System.Drawing.Point(285, 250); - this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6); - this.pickerBox2.Name = "pickerBox2"; - this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5); - this.pickerBox2.Size = new System.Drawing.Size(84, 34); - this.pickerBox2.SubmitButton = null; - this.pickerBox2.TabIndex = 175; - // - // horizontalSeparator1 - // - this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.horizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.horizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.horizontalSeparator1.BackColor = System.Drawing.Color.Transparent; - this.horizontalSeparator1.Location = new System.Drawing.Point(10, 181); - this.horizontalSeparator1.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); - this.horizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2); - this.horizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22); - this.horizontalSeparator1.Name = "horizontalSeparator1"; - this.horizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.horizontalSeparator1.Size = new System.Drawing.Size(364, 22); - this.horizontalSeparator1.TabIndex = 176; - // - // horizontalSeparator2 - // - this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0); - this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent; - this.horizontalSeparator2.Location = new System.Drawing.Point(10, 437); - this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0); - this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2); - this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22); - this.horizontalSeparator2.Name = "horizontalSeparator2"; - this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10); - this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22); - this.horizontalSeparator2.TabIndex = 177; - // - // EditTileForm - // - this.ClientSize = new System.Drawing.Size(384, 521); - this.Controls.Add(this.horizontalSeparator2); - this.Controls.Add(this.horizontalSeparator1); - this.Controls.Add(this.pickerBox2); - this.Controls.Add(this.pickerBox1); - this.Controls.Add(this.button1); - this.Controls.Add(this.textBox4); - this.Controls.Add(this.textBox3); - this.Controls.Add(this.textBox2); - this.Controls.Add(this.label6); - this.Controls.Add(this.label7); - this.Controls.Add(this.label4); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.Controls.Add(this.textBox1); - this.MinimumSize = new System.Drawing.Size(400, 560); - this.Name = "EditTileForm"; - this.Text = "Add Tile"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - protected override void OnShown(EventArgs e) - { - base.OnShown(e); - - if (this.DialogMode == DialogModeType.Edit) - { - if (this.TilePanel != null) - { - updateModel(this.TilePanel.ModelInfo); - } - else if (this.ListBox != null) - { - if (this.ListBox.ListBox.SelectedItem != null) - { - TileModel model = (this.ListBox.ListBox.SelectedItem as TileModel); - if (model != null) - { - updateModel(model); - } - } - } - } - } - - - public TilePanelLayout TilePanelLayout { get; set; } = null; - - public TilePanel TilePanel { get; set; } = null; - - public TListBox ListBox { get; set; } = null; - - public Point AimCoord { get; set; } = new Point(-1, -1); - - public DialogModeType DialogMode - { - get => dialogMode; - set - { - dialogMode = value; - - switch (dialogMode) - { - case DialogModeType.Add: - this.Text = "Add Tile"; - break; - case DialogModeType.Edit: - this.Text = "Edit Tile"; - break; - default: break; - } - } - } - - - private void button1_Click(object sender, EventArgs e) - { - TileModel model = buildModel(); - - switch (this.DialogMode) - { - case DialogModeType.Add: - if (this.TilePanelLayout != null) - { - this.TilePanelLayout.AddTile(model); - } - else if (this.ListBox != null) - { - int n = this.ListBox.ListBox.Items.Add(model); - this.ListBox.ListBox.SelectedIndex = n; - } - - break; - case DialogModeType.Edit: - if (this.TilePanel != null) - { - this.TilePanel.LoadInfo(model); - } - else if (this.ListBox != null) - { - int n = this.ListBox.ListBox.SelectedIndex; - if (n >= 0) - { - this.ListBox.ListBox.Items.RemoveAt(n); - this.ListBox.ListBox.Items.Insert(n, model); - this.ListBox.ListBox.SelectedIndex = n; - } - } - - break; - default: break; - } - - this.Close(); - } - - protected TileModel buildModel() - { - TileModel rs = new TileModel() - { - Title = textBox1.Text?.Trim(), - ProcessFilename = textBox2.Text?.Trim(), - ProcessArgument = textBox3.Text?.Trim(), - ProcessWorkingDirectory = textBox4.Text?.Trim(), - ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex, - ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1) - }; - - if (this.DialogMode == DialogModeType.Add) - { - if (!this.AimCoord.Equals(new Point(-1, -1))) - { - rs.Position = this.AimCoord; - } - } - - return rs; - } - - protected void updateModel(TileModel model) - { - if (model == null) - { - return; - } - - textBox1.Text = model.Title; - textBox2.Text = model.ProcessFilename; - textBox3.Text = model.ProcessArgument; - textBox4.Text = model.ProcessWorkingDirectory; - pickerBox1.ComboBox.SelectedIndex = (int)model.ProcessWindowStyle; - pickerBox2.ComboBox.SelectedIndex = (model.ProcessAsAdmin ? 1 : 0); - } - - } -} diff --git a/Windows/Forms/EditTileForm.resx b/Windows/Forms/EditTileForm.resx deleted file mode 100644 index 0220ec4..0000000 --- a/Windows/Forms/EditTileForm.resx +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vgAADr4B6kKxwAAAAK9JREFUOE/t0zsKwkAURuGp1BWJK3EhIrgAV+EOLLWwtRQLwQdiIbbiIkwynj+O - IVwnyhR2XvjyInNIkXHee8f0cEQBPbDOaKEarSvXhsAJO4wirlB4jipiA3phoIvIrLFChhnKiA3o8Ckw - RR93LNBODVwwwRL62kNKYIxNzQ1FSsDOEHk08HrYJMw/8KtA06/cCef6KJDZgDbTFrHNZO3x9idqOyui - m2+07bvPgHcPXOhtG3D6cUIAAAAASUVORK5CYII= - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - vgAADr4B6kKxwAAAAMZJREFUOE/tk7sNwjAQQF3BRohJGAQhMQBTsAElFLSUiAKJTxIXhBZlCILNuyRG - iXEQKeg46fmsO/slhU9Za5XWehiXYcD6JElygZ6qhdwTioVDGo4wDXDjsohXdYkvMDTHVa8R9Hb0tpCz - XzqJL5Df/CRYRFE0Yn8nr9M07XcSwBXmXN6QDfncRTCjt6+Rgfla4Adfn3D+ERS4Yht/wY8FxVN2xTac - gLP5qyYLAhmmA4SGyeeEoPkSq3EWydsoB4gRDEqBVU/p15ajstHKCgAAAABJRU5ErkJggg== - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wAAADsABataJCQAAAJtJREFUOE/t0zEKwkAQheEpvILHSLySlTeJ6AnEzpPYi0ERPIKWKtZKNv9LNS5x - E6xS+OCDJew8tsgYmeCECsGZo1dKXLBwtnghQ2fe0JDPGHecsW6xwgwjNM8tdIgyxQ0qij2gORV9LejK - Bk8dfi3QjGY/C0IISS7/gkEVtP3KfbKEZm0PLZM++IVK0d0rdrAcR8TrnKK7BzPLa7Wb+WX/Nb8PAAAA - AElFTkSuQmCC - - - - - iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO - wAAADsABataJCQAAALZJREFUOE/tkzEKwjAYRjt4BY9hvZKTN1HsCYqbJzGzKBGb9gY6qjgrxvdJK7ZS - Gpwc/ODBnzTvg0AT5Xk+hB3cwVc456ZRSIqi2MAeafbGEq5Zlg3KY+1Bvkkql89Ya/vsnUCZN8FJYWyM - 6ekKnsWkdF9hb8S3I6ioyRnkpa0FXcFbwOXrAjlyawXe+06q/At+qoDh41cOCU4iV8OaQY8pUVEgOnuA - VcSzjRm2UHvOHeisdc7FDwDnJKIbLgP9AAAAAElFTkSuQmCC - - - \ No newline at end of file diff --git a/Windows/Forms/TileContainer.cs b/Windows/Forms/TileContainer.cs deleted file mode 100644 index 6c6060b..0000000 --- a/Windows/Forms/TileContainer.cs +++ /dev/null @@ -1,149 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.Forms; -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Windows.Forms; - -namespace FizzyLauncher.Windows.Forms -{ - public class TileContainer : Panel - { - protected const int DEFAULT_COLUMN = 6; - - protected FlowLayoutPanel flowLayoutPanel1 = null; - - - public TileContainer() - { - flowLayoutPanel1 = new FlowLayoutPanel(); - flowLayoutPanel1.AutoSize = true; - flowLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; - flowLayoutPanel1.BackColor = Color.Transparent; - flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; - flowLayoutPanel1.Location = new Point(10, 10); - flowLayoutPanel1.Margin = new Padding(0); - flowLayoutPanel1.Padding = new Padding(0, 0, 0, 20); - flowLayoutPanel1.Size = new Size(0, 20); - flowLayoutPanel1.WrapContents = false; - - this.AutoScroll = true; - this.AutoSizeMode = AutoSizeMode.GrowAndShrink; - this.BackColor = System.Drawing.Color.Transparent; - this.Margin = new Padding(0); - this.Name = "tileContainer1"; - this.Padding = new Padding(10, 10, 10, 20); - this.Controls.Add(flowLayoutPanel1); - } - - - [Browsable(false)] - public event EventHandler OnColumnSizeChanged; - - - public int CalcWidth - { - get => - TilePanelLayout.CalcWidth(this.TileWidthCount) + - this.Left + this.Padding.Horizontal + this.Margin.Horizontal + - flowLayoutPanel1.Padding.Horizontal + flowLayoutPanel1.Margin.Horizontal; - } - - public int GroupCount - { - get => flowLayoutPanel1.Controls.Count; - } - - public IEnumerable Groups - { - get - { - for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++) - { - if (flowLayoutPanel1.Controls[i].GetType() != typeof(TilePanelLayout)) - { - continue; - } - - TilePanelLayout container = flowLayoutPanel1.Controls[i] as TilePanelLayout; - yield return container; - } - } - } - - public IEnumerable GroupModels - { - get - { - foreach (TilePanelLayout item in this.Groups) - { - yield return item.Model; - } - } - } - - public int TileWidthCount { get; private set; } = DEFAULT_COLUMN; - - - public void Add() - { - this.Add(new TilePanelLayout(new TileGroupModel() - { - Title = "New Group", - IsExpanded = true, - GridSize = new Size(this.TileWidthCount, 1) - })); - } - - public void Add(TilePanelLayout tilePanelLayout) - { - ThreadControl.Add(flowLayoutPanel1, tilePanelLayout); - - this.InvalidateColumnSize(); - } - - public void Add(int columnCount) - { - this.TileWidthCount = ((columnCount <= 0) ? DEFAULT_COLUMN : columnCount); - - this.Add(); - } - - public void Clear() - { - ThreadControl.Clear(flowLayoutPanel1); - - this.TileWidthCount = DEFAULT_COLUMN; - - InvalidateColumnSize(); - } - - public void InvalidateColumnSize() - { - this.OnColumnSizeChanged?.Invoke(this, null); - } - - public void Load(List groupList) - { - this.Clear(); - - if (groupList == null) - { - return; - } - - foreach (TileGroupModel item in groupList) - { - this.TileWidthCount = Math.Max(this.TileWidthCount, item.GridSize.Width); - - TilePanelLayout panel = new TilePanelLayout(item); - - this.Add(panel); - } - - InvalidateColumnSize(); - } - - } -} diff --git a/Windows/Forms/TileContainer.resx b/Windows/Forms/TileContainer.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Windows/Forms/TileContainer.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Windows/Forms/TilePanel.Designer.cs b/Windows/Forms/TilePanel.Designer.cs deleted file mode 100644 index b771cd9..0000000 --- a/Windows/Forms/TilePanel.Designer.cs +++ /dev/null @@ -1,82 +0,0 @@ -namespace FizzyLauncher.Windows.Forms -{ - partial class TilePanel - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); - this.contextMenuStrip1.SuspendLayout(); - this.SuspendLayout(); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.editToolStripMenuItem, - this.removeToolStripMenuItem}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(118, 48); - // - // editToolStripMenuItem - // - this.editToolStripMenuItem.Name = "editToolStripMenuItem"; - this.editToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.editToolStripMenuItem.Text = "&Edit"; - this.editToolStripMenuItem.Click += new System.EventHandler(this.editToolStripMenuItem_Click); - // - // removeToolStripMenuItem - // - this.removeToolStripMenuItem.Name = "removeToolStripMenuItem"; - this.removeToolStripMenuItem.Size = new System.Drawing.Size(117, 22); - this.removeToolStripMenuItem.Text = "&Remove"; - this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click); - // - // TilePanel - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234))))); - this.Margin = new System.Windows.Forms.Padding(4, 3, 0, 0); - this.MaximumSize = new System.Drawing.Size(82, 81); - this.MinimumSize = new System.Drawing.Size(82, 81); - this.Name = "TilePanel"; - this.Size = new System.Drawing.Size(82, 81); - this.contextMenuStrip1.ResumeLayout(false); - this.ResumeLayout(false); - - } - - #endregion - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem; - private System.Windows.Forms.ToolTip toolTip1; - } -} diff --git a/Windows/Forms/TilePanel.cs b/Windows/Forms/TilePanel.cs deleted file mode 100644 index a1b8968..0000000 --- a/Windows/Forms/TilePanel.cs +++ /dev/null @@ -1,506 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.Forms; -using System; -using System.ComponentModel; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Windows.Forms; -using AppResource = BookmarkManager.AppResource; - -namespace FizzyLauncher.Windows.Forms -{ - public partial class TilePanel : TUserControl - { - protected bool isDragging = false; - protected Point startPosition = new Point(); - - protected int imageLeft = 0; - protected int imageTop = 11; - protected int labelMargin = 3; - protected int labelTop = 47; - protected Rectangle labelRectangle = new Rectangle(); - - protected string title = ""; - protected Image icon = null; - protected ContextMenuStrip groupContextMenu = null; - protected TileModel modelInfo = new TileModel(); - - - public TilePanel() : base() - { - InitializeComponent(); - - this.AllowDrop = true; - this.AutoSize = false; - this.BackColor = Color.FromArgb(250, 250, 250); - this.ContextMenuStrip = contextMenuStrip1; - this.DoubleBuffered = true; - this.Font = new Font(this.Font.FontFamily, 8.25F); - this.ForeColor = Color.FromArgb(99, 105, 119); - this.Size = new Size(70, 70); - this.MaximumSize = this.MinimumSize = this.Size; - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - this.AllowDrop = true; - this.AutoSize = false; - this.BackColor = Color.FromArgb(250, 250, 250); - this.ContextMenuStrip = contextMenuStrip1; - this.DoubleBuffered = true; - this.Font = new Font(this.Font.FontFamily, 8.25F); - this.Size = new Size(70, 70); - this.MaximumSize = this.MinimumSize = this.Size; - } - - protected override void OnPaint(PaintEventArgs e) - { - base.OnPaint(e); - - Graphics g = e.Graphics; - - - if (this.Image != null) - { - g.DrawImage(this.Image, new Point(imageLeft, imageTop)); - } - - if (!string.IsNullOrWhiteSpace(this.Title)) - { - TextRenderer.DrawText(e.Graphics, this.Title, this.Font, labelRectangle, this.ForeColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.NoPadding | TextFormatFlags.EndEllipsis); - } - - 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("Tile"), Browsable(true)] - public Image Image - { - get => icon; - protected set - { - icon = value; - - if (icon == null) - { - imageLeft = 0; - } - else - { - imageLeft = (this.Width - icon.Width) / 2; - } - } - } - - [Category("Tile"), Browsable(true)] - public string Title - { - get => title; - protected set - { - title = value; - - labelRectangle = new Rectangle(labelMargin, labelTop, (this.Width - (labelMargin * 2)), (this.Height - labelTop - 1)); - - this.Invalidate(); - } - } - - - [Browsable(false)] - public TileModel ModelInfo => modelInfo; - - public TilePanelLayout PanelContainer - { - get - { - if (this.Parent == null) - { - return null; - } - - if (this.Parent.GetType() != typeof(TilePanelLayout)) - { - return null; - } - - return (TilePanelLayout)this.Parent; - } - } - - protected override void OnDragDrop(DragEventArgs e) - { - string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[]; - - if (this.ModelInfo.IsGroup) - { - this.DropFileList(fileList); - - invalidateGroupMenu(this.ModelInfo); - } - else - { - if (this.PanelContainer != null) - { - this.PanelContainer.DropFileList(fileList); - } - } - } - - protected override void OnDragOver(DragEventArgs e) - { - base.OnDragDrop(e); - - e.Effect = (e.Data.GetDataPresent(DataFormats.FileDrop)) ? DragDropEffects.Link : DragDropEffects.None; - } - - protected override void OnMouseUp(MouseEventArgs e) - { - base.OnMouseUp(e); - - isDragging = false; - } - - protected override void OnMouseDown(MouseEventArgs e) - { - base.OnMouseDown(e); - - TilePanelLayout container = this.PanelContainer; - if (container == null) - { - return; - } - - this.BringToFront(); - - if (((e.Button == MouseButtons.Left) && (Control.ModifierKeys == Keys.Control)) || (e.Button == MouseButtons.Right)) - { - isDragging = true; - startPosition = e.Location; - } - } - - protected override void OnMouseClick(MouseEventArgs e) - { - base.OnMouseClick(e); - - if (Control.ModifierKeys == Keys.Control) return; - if (this.ModelInfo == null) return; - - if (e.Button == MouseButtons.Left) - { - if (this.ModelInfo.IsGroup) - { - if (groupContextMenu != null) - { - invalidateGroupMenuSize(); - - groupContextMenu.Show(this, e.Location); - } - } - else - { - OnMouseDoubleClick(e); - } - } - } - - protected override void OnMouseDoubleClick(MouseEventArgs e) - { - base.OnMouseDoubleClick(e); - - if (Control.ModifierKeys == Keys.Control) return; - - if (e.Button == MouseButtons.Left) - { - execute(this.ModelInfo); - } - } - - protected override void OnMouseMove(MouseEventArgs e) - { - base.OnMouseMove(e); - - if (isDragging) - { - TilePanelLayout layoutPanel = this.PanelContainer; - if (layoutPanel == null) - { - return; - } - - int x = (this.Location.X + (e.Location.X - startPosition.X)); - int y = (this.Location.Y + (e.Location.Y - startPosition.Y)); - - layoutPanel.MoveTile(this, x, y); - } - } - - - public void DropFileList(string[] fileList) - { - if (fileList == null) - { - return; - } - - if (fileList.Length <= 0) - { - return; - } - - if (string.IsNullOrWhiteSpace(fileList[0])) - { - return; - } - - TileModel model = new TileModel() - { - ProcessFilename = fileList[0], - Title = Path.GetFileName(fileList[0]) - }; - - // exe - if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase)) - { - if (File.Exists(fileList[0])) - { - try - { - FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]); - if (fvi != null) - { - model.Title = fvi.ProductName; - } - } - catch - { - // do nothing - } - } - - if (string.IsNullOrWhiteSpace(model.Title)) - { - model.Title = Path.GetFileNameWithoutExtension(fileList[0]); - } - } - - this.ModelInfo.Items.Add(model); - } - - public void LoadInfo(TileModel model) - { - this.modelInfo = model; - - this.Image = null; - this.Title = model.Title; - - if (this.modelInfo.IsGroup) - { - this.Image = AppResource.folder_32; - - invalidateGroupMenu(this.modelInfo); - } - else - { - this.Image = getIcon(model); - } - - toolTip1.SetToolTip(this, this.Title); - } - - private void editToolStripMenuItem_Click(object sender, EventArgs e) - { - if (this.ModelInfo.IsGroup) - { - EditTileFolderForm.ShowEditDialog(this); - } - else - { - EditTileForm.ShowEditDialog(this); - } - } - - private void removeToolStripMenuItem_Click(object sender, EventArgs e) - { - if (this.PanelContainer == null) - { - return; - } - - this.PanelContainer.Remove(this); - } - - protected void execute(TileModel model) - { - if (model == null) - { - return; - } - - if (model.IsGroup) - { - return; - } - - if (string.IsNullOrWhiteSpace(model.CleanProcessFilename)) - { - return; - } - - if (!File.Exists(model.CleanProcessFilename)) - { - return; - } - - ProcessStartInfo p = new ProcessStartInfo(); - p.FileName = model.CleanProcessFilename; - p.WindowStyle = model.ProcessWindowStyle; - - if (!string.IsNullOrWhiteSpace(model.CleanProcessArgument)) - { - p.Arguments = model.CleanProcessArgument; - } - - if (!string.IsNullOrWhiteSpace(model.CleanProcessWorkingDirectory)) - { - p.WorkingDirectory = model.CleanProcessWorkingDirectory; - } - - if (model.ProcessAsAdmin) - { - p.UseShellExecute = true; - p.Verb = "runas"; - } - - MainForm parentForm = findMainForm(); - if (parentForm != null) - { - if (parentForm.CurrentSession != null) - { - if (parentForm.CurrentSession.HideOnClick) - { - parentForm.Visible = false; - } - } - } - - try - { - Process.Start(p); - } - catch (Exception exc) - { - MessageBox.Show(exc.Message); - } - } - - protected Image getIcon(TileModel model) - { - if (!File.Exists(model.CleanProcessFilename)) - { - return null; - } - - try - { - return Icon.ExtractAssociatedIcon(model.CleanProcessFilename)?.ToBitmap(); - } - catch - { - // do nothing - } - - return null; - } - - protected void invalidateGroupMenu(TileModel model) - { - if (groupContextMenu == null) - { - groupContextMenu = new ContextMenuStrip(); - } - - groupContextMenu.Items.Clear(); - - if (model.Items == null) - { - return; - } - - foreach (TileModel item in model.Items) - { - ToolStripItem toolItem = groupContextMenu.Items.Add(item.Title); - toolItem.Image = getIcon(item); - toolItem.Tag = item; - 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() - { - Control item = this; - - while (true) - { - item = item.Parent; - if (item == null) - { - return null; - } - - if (item.GetType() == typeof(MainForm)) - { - return (item as MainForm); - } - } - } - - private void toolItem_Click(object sender, EventArgs e) - { - if (sender.GetType() != typeof(ToolStripMenuItem)) - { - return; - } - - ToolStripMenuItem item = (sender as ToolStripMenuItem); - if (item.Tag == null) - { - return; - } - - if (item.Tag.GetType() != typeof(TileModel)) - { - return; - } - - TileModel model = (item.Tag as TileModel); - execute(model); - } - - } -} \ No newline at end of file diff --git a/Windows/Forms/TilePanel.resx b/Windows/Forms/TilePanel.resx deleted file mode 100644 index 60ff723..0000000 --- a/Windows/Forms/TilePanel.resx +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 172, 17 - - \ No newline at end of file diff --git a/Windows/Forms/TilePanelLayout.Designer.cs b/Windows/Forms/TilePanelLayout.Designer.cs deleted file mode 100644 index 3053842..0000000 --- a/Windows/Forms/TilePanelLayout.Designer.cs +++ /dev/null @@ -1,259 +0,0 @@ -namespace FizzyLauncher.Windows.Forms -{ - partial class TilePanelLayout - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Component Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.addListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator(); - this.removeRowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components); - this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem(); - this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.upToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.downToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem(); - this.label1 = new System.Windows.Forms.Label(); - this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); - this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem(); - this.removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.contextMenuStrip1.SuspendLayout(); - this.contextMenuStrip2.SuspendLayout(); - this.SuspendLayout(); - // - // contextMenuStrip1 - // - this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addToolStripMenuItem, - this.addListToolStripMenuItem, - this.toolStripMenuItem6, - this.removeRowToolStripMenuItem1}); - this.contextMenuStrip1.Name = "contextMenuStrip1"; - this.contextMenuStrip1.Size = new System.Drawing.Size(144, 76); - // - // addToolStripMenuItem - // - this.addToolStripMenuItem.Name = "addToolStripMenuItem"; - this.addToolStripMenuItem.Size = new System.Drawing.Size(143, 22); - this.addToolStripMenuItem.Text = "&Add Tile"; - this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click); - // - // addListToolStripMenuItem - // - this.addListToolStripMenuItem.Name = "addListToolStripMenuItem"; - this.addListToolStripMenuItem.Size = new System.Drawing.Size(143, 22); - this.addListToolStripMenuItem.Text = "Add &Folder"; - this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click); - // - // toolStripMenuItem6 - // - this.toolStripMenuItem6.Name = "toolStripMenuItem6"; - this.toolStripMenuItem6.Size = new System.Drawing.Size(140, 6); - // - // removeRowToolStripMenuItem1 - // - this.removeRowToolStripMenuItem1.Name = "removeRowToolStripMenuItem1"; - this.removeRowToolStripMenuItem1.Size = new System.Drawing.Size(143, 22); - this.removeRowToolStripMenuItem1.Text = "&Remove Row"; - this.removeRowToolStripMenuItem1.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1); - // - // contextMenuStrip2 - // - this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem2, - this.toolStripMenuItem1, - this.toolStripSeparator3, - this.toolStripMenuItem7, - this.toolStripSeparator2, - this.toolStripMenuItem4, - this.toolStripSeparator1, - this.toolStripMenuItem3}); - this.contextMenuStrip2.Name = "contextMenuStrip1"; - this.contextMenuStrip2.Size = new System.Drawing.Size(181, 154); - // - // toolStripMenuItem2 - // - this.toolStripMenuItem2.Name = "toolStripMenuItem2"; - this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem2.Text = "&Add Group"; - this.toolStripMenuItem2.Click += new System.EventHandler(this.addGroupMenuItem_Click); - // - // toolStripMenuItem1 - // - this.toolStripMenuItem1.Name = "toolStripMenuItem1"; - this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem1.Text = "&Edit"; - this.toolStripMenuItem1.Click += new System.EventHandler(this.editGroupMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); - // - // toolStripMenuItem4 - // - this.toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.topToolStripMenuItem, - this.upToolStripMenuItem, - this.downToolStripMenuItem, - this.bottomToolStripMenuItem}); - this.toolStripMenuItem4.Name = "toolStripMenuItem4"; - this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem4.Text = "&Move"; - // - // topToolStripMenuItem - // - this.topToolStripMenuItem.Name = "topToolStripMenuItem"; - this.topToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.topToolStripMenuItem.Text = "&Top"; - this.topToolStripMenuItem.Click += new System.EventHandler(this.moveTopMenuItem_Click); - // - // upToolStripMenuItem - // - this.upToolStripMenuItem.Name = "upToolStripMenuItem"; - this.upToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.upToolStripMenuItem.Text = "&Up"; - this.upToolStripMenuItem.Click += new System.EventHandler(this.moveUpMenuItem_Click); - // - // downToolStripMenuItem - // - this.downToolStripMenuItem.Name = "downToolStripMenuItem"; - this.downToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.downToolStripMenuItem.Text = "&Down"; - this.downToolStripMenuItem.Click += new System.EventHandler(this.moveDownMenuItem_Click); - // - // bottomToolStripMenuItem - // - this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem"; - this.bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22); - this.bottomToolStripMenuItem.Text = "&Bottom"; - this.bottomToolStripMenuItem.Click += new System.EventHandler(this.moveBottomMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); - // - // toolStripMenuItem3 - // - this.toolStripMenuItem3.Name = "toolStripMenuItem3"; - this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem3.Text = "&Remove"; - this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(99)))), ((int)(((byte)(105)))), ((int)(((byte)(119))))); - this.label1.Image = global::BookmarkManager.AppResource.toggle_left_ea_16; - this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.label1.Location = new System.Drawing.Point(265, 83); - this.label1.Margin = new System.Windows.Forms.Padding(0); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(0, 15); - this.label1.TabIndex = 2; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); - this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick); - // - // toolStripSeparator3 - // - this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); - // - // toolStripMenuItem7 - // - this.toolStripMenuItem7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.toolStripMenuItem5, - this.removeRowToolStripMenuItem}); - this.toolStripMenuItem7.Name = "toolStripMenuItem7"; - this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem7.Text = "Ro&w"; - // - // toolStripMenuItem5 - // - this.toolStripMenuItem5.Name = "toolStripMenuItem5"; - this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22); - this.toolStripMenuItem5.Text = "Add &Row"; - this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click); - // - // removeRowToolStripMenuItem - // - this.removeRowToolStripMenuItem.Name = "removeRowToolStripMenuItem"; - this.removeRowToolStripMenuItem.Size = new System.Drawing.Size(180, 22); - this.removeRowToolStripMenuItem.Text = "Remo&ve Row"; - this.removeRowToolStripMenuItem.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1); - // - // TilePanelLayout - // - this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.Transparent; - this.Controls.Add(this.label1); - this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); - this.Name = "TilePanelLayout"; - this.Size = new System.Drawing.Size(432, 173); - this.contextMenuStrip1.ResumeLayout(false); - this.contextMenuStrip2.ResumeLayout(false); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - private System.Windows.Forms.ContextMenuStrip contextMenuStrip1; - private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem; - private System.Windows.Forms.ContextMenuStrip contextMenuStrip2; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4; - private System.Windows.Forms.ToolStripMenuItem topToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6; - private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem1; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem7; - private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5; - private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem; - } -} diff --git a/Windows/Forms/TilePanelLayout.cs b/Windows/Forms/TilePanelLayout.cs deleted file mode 100644 index b931be3..0000000 --- a/Windows/Forms/TilePanelLayout.cs +++ /dev/null @@ -1,943 +0,0 @@ -using FizzyLauncher.Models; -using RyzStudio.Windows.Forms; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using AppResource = BookmarkManager.AppResource; - -namespace FizzyLauncher.Windows.Forms -{ - public partial class TilePanelLayout : TUserControl - { - public static int CalcWidth(int tileCount) => (tileCount * tileSize) + ((tileCount - 1) * margin); - - - public class Item - { - public TilePanel Tile { get; set; } - public Point Coord { get; set; } = new Point(0, 0); - } - - - protected const int tileSize = 70; - protected const int margin = 3; - protected const int labelHeight = 20; - protected const int collapseIncrement = 6; - protected const int expandIncrement = 8; - - protected TileGroupModel groupModel = null; - protected List items = new List(); - - protected int collapseHeight = 0; - protected int expandedHeight = 0; - - protected bool isAnimating = false; - protected bool isChecked = true; - protected Point lastMousePosition = new Point(); - protected Point gridSize = new Point(); - - - public TilePanelLayout(TileGroupModel model) : base() - { - InitializeComponent(); - - this.AllowDrop = true; - this.BackColor = Color.Transparent; - - this.LoadModel(model); - - label1.Location = new Point(0, 4); - label1.Margin = new Padding(0); - label1.Padding = new Padding(0); - } - - protected override void OnDragDrop(DragEventArgs e) - { - string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[]; - - this.DropFileList(fileList); - } - - protected override void OnDragOver(DragEventArgs e) - { - if (e.Data.GetDataPresent(DataFormats.FileDrop)) - { - e.Effect = DragDropEffects.Link; - } - else - { - e.Effect = DragDropEffects.None; - } - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - this.Margin = new Padding(0); - this.Padding = new Padding(0, 0, 0, 10); - } - - protected override async void OnResize(EventArgs e) - { - base.OnResize(e); - - await this.InvalidateContainer(); - } - - protected override void OnMouseClick(MouseEventArgs e) - { - base.OnMouseClick(e); - - lastMousePosition = e.Location; - - bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= 20)); - - if (e.Button == MouseButtons.Left) - { - // do nothing - } - else if (e.Button == MouseButtons.Right) - { - if (isLabel) - { - contextMenuStrip2.Show(this, e.Location); - } - else - { - contextMenuStrip1.Show(this, e.Location); - } - } - } - - protected override void OnMouseDoubleClick(MouseEventArgs e) => base.OnMouseClick(e); - - public Point GridSize - { - get => gridSize; - } - - 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 ExpandedHeight => expandedHeight + this.Padding.Bottom; - - public void DropFileList(string[] fileList) - { - if (fileList == null) - { - return; - } - - if (fileList.Length <= 0) - { - return; - } - - if (string.IsNullOrWhiteSpace(fileList[0])) - { - return; - } - - TileModel model = new TileModel() - { - ProcessFilename = fileList[0], - Title = Path.GetFileName(fileList[0]) - }; - - // exe - if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase)) - { - if (File.Exists(fileList[0])) - { - try - { - FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]); - if (fvi != null) - { - model.Title = fvi.ProductName; - } - } - catch - { - // do nothing - } - } - - if (string.IsNullOrWhiteSpace(model.Title)) - { - model.Title = Path.GetFileNameWithoutExtension(fileList[0]); - } - } - - this.AddTile(model); - } - - public TileGroupModel Model - { - get - { - TileGroupModel rs = new TileGroupModel() - { - Title = groupModel.Title, - GridSize = new Size(this.GridSize.X, this.GridSize.Y), - IsExpanded = isChecked, - IsExclusive = groupModel.IsExclusive, - Items = this.Tiles - }; - - return rs; - } - } - - public FlowLayoutPanel FlowLayoutPanel - { - get - { - Control parentControl = this.Parent; - while (true) - { - if (parentControl == null) - { - return null; - } - - if (parentControl.GetType() == typeof(FlowLayoutPanel)) - { - return parentControl as FlowLayoutPanel; - } - - parentControl = parentControl.Parent; - } - } - } - - public MainForm MainForm - { - get - { - Control parentControl = this.FlowLayoutPanel; - while (true) - { - if (parentControl == null) - { - return null; - } - - if (parentControl.GetType() == typeof(MainForm)) - { - return parentControl as MainForm; - } - - parentControl = parentControl.Parent; - } - } - } - - public List Tiles - { - get - { - List rs = new List(); - foreach (Item item in items) - { - TileModel model = item.Tile.ModelInfo; - model.Position = item.Coord; - - rs.Add(model); - } - - return rs; - } - } - - public int TileSize => (tileSize + margin); - - public void AddTile(TileModel tile) - { - Point gridSize = this.GridSize; - - if (items.Count >= (gridSize.X * gridSize.Y)) - { - this.SetGridSize(gridSize.X, (gridSize.Y + 1)); - } - - Point? newCoord = tile.Position; - if ((newCoord == null) || hasTile(tile.Position)) - { - newCoord = findLastFreeCoord(); - } - - if (newCoord == null) - { - return; - } - - tile.Position = newCoord.Value; - - TilePanel panel = new TilePanel(); - panel.LoadInfo(tile); - panel.Location = convertCoordToLocation(tile.Position); - - items.Add(new Item() - { - Tile = panel, - Coord = tile.Position - }); - - this.Controls.Add(panel); - } - - public void Clear() - { - this.Controls.Clear(); - } - - public async Task Collapse() - { - await Task.Run(() => - { - if (isAnimating) return; - - isAnimating = true; - isChecked = false; - - if (this.EnableAnimation) - { - while (this.Height > this.CollapseHeight) - { - ThreadControl.SetHeight(this, (this.Height - collapseIncrement)); - - Thread.Sleep(10); - } - } - - ThreadControl.SetHeight(this, this.CollapseHeight); - - isAnimating = false; - - this.Invalidate(this.DisplayRectangle, false); - }); - } - - public async Task Expand() - { - await Task.Run(() => - { - if (isAnimating) return; - - isAnimating = true; - isChecked = true; - - if (this.EnableAnimation) - { - while (this.Height < this.ExpandedHeight) - { - ThreadControl.SetHeight(this, (this.Height + expandIncrement)); - Thread.Sleep(10); - } - } - - ThreadControl.SetHeight(this, this.ExpandedHeight); - - isAnimating = false; - - this.Invalidate(this.DisplayRectangle, false); - }); - } - - public Point GetTilePosition(int posX, int posY) - { - int x = (int)Math.Round(decimal.Divide(posX, this.TileSize)); - int y = (int)Math.Round(decimal.Divide((posY - labelHeight), this.TileSize)); - - if (x < 0) x = 0; - if (y < 0) y = 0; - - return new Point((x * this.TileSize), ((y * this.TileSize) + labelHeight)); - } - - public async Task InvalidateContainer() - { - if (isAnimating) - { - return; - } - - if (isChecked) - { - await this.Expand(); - } - else - { - await this.Collapse(); - } - } - - public void AddGroup() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - this.FlowLayoutPanel.Controls.Add(new TilePanelLayout(new TileGroupModel() - { - Title = "New Group", - GridSize = new Size(8, 1) - })); - } - - public void AddRow() => this.SetGridSize(gridSize.X, (gridSize.Y + 1)); - - public void EditGroup() => EditGroupForm.ShowDialog(this); - - public void LoadModel(TileGroupModel model) - { - groupModel = model; - - isChecked = groupModel.IsExpanded; - - label1.Text = " " + groupModel?.Title; - label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16); - - this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height); - this.LoadTiles(model.Items); - this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height); - - this.Invalidate(); - } - - public void UpdateModel(TileGroupModel model) - { - groupModel = model; - isChecked = groupModel.IsExpanded; - - label1.Text = " " + groupModel?.Title; - - this.Invalidate(); - } - - public void LoadTiles(List tiles) - { - if (tiles == null) - { - return; - } - - if (tiles.Count() <= 0) - { - return; - } - - foreach (TileModel item in tiles) - { - // resolve final grid position - Point? confirmedPosition = resolveCoord(item.Position); - if (confirmedPosition == null) - { - continue; - } - - // place control - TilePanel panel = new TilePanel(); - panel.LoadInfo(item); - panel.Location = convertCoordToLocation(confirmedPosition.Value); - - items.Add(new Item() - { - Tile = panel, - Coord = confirmedPosition.Value - }); - - this.Controls.Add(panel); - } - } - - public void MoveTile(TilePanel panel, int posX, int posY) - { - Item item = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault(); - if (item == null) - { - return; - } - - Point newPosition = convertLocationToCoord_Nearest(posX, posY); - if (!isTileInBounds(newPosition)) - { - return; - } - - if (hasTile(newPosition)) - { - Item swapItem = items.Where(x => x.Coord.Equals(newPosition)).FirstOrDefault(); - if (swapItem != null) - { - swapItem.Coord = item.Coord; - swapItem.Tile.Location = convertCoordToLocation(item.Coord); - } - - item.Coord = newPosition; - panel.Location = convertCoordToLocation(newPosition); - } - else - { - item.Coord = newPosition; - panel.Location = convertCoordToLocation(newPosition); - } - } - - public void MoveTop() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - this.FlowLayoutPanel.Controls.SetChildIndex(this, 0); - } - - public void MoveUp() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - int pos = this.FlowLayoutPanel.Controls.GetChildIndex(this); - if (pos <= 0) - { - return; - } - - this.FlowLayoutPanel.Controls.SetChildIndex(this, (pos - 1)); - } - - public void MoveDown() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - int pos = this.FlowLayoutPanel.Controls.GetChildIndex(this); - if (pos >= (this.FlowLayoutPanel.Controls.Count - 1)) - { - return; - } - - this.FlowLayoutPanel.Controls.SetChildIndex(this, (pos + 1)); - } - - public void MoveBottom() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - this.FlowLayoutPanel.Controls.SetChildIndex(this, (this.FlowLayoutPanel.Controls.Count - 1)); - } - - public void Remove() - { - if (this.FlowLayoutPanel == null) - { - return; - } - - this.FlowLayoutPanel.Controls.Remove(this); - } - - public void Remove(TilePanel panel) - { - Item m = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault(); - if (m != null) - { - items.Remove(m); - } - - this.Controls.Remove(panel); - } - - public void SetGridSize(int width, int height) - { - gridSize = new Point(width, height); - - groupModel.GridSize = new Size(groupModel.GridSize.Width, height); - - expandedHeight = (this.TileSize * height) + labelHeight; - - int w = CalcWidth(gridSize.X); - - this.Size = new Size(w, (isChecked ? this.ExpandedHeight : this.CollapseHeight)); - } - - protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight)); - - protected Point convertLocationToCoord(int posX, int posY) - { - int x = (int)Math.Ceiling(decimal.Divide(posX, this.TileSize)); - int y = (int)Math.Ceiling(decimal.Divide((posY - labelHeight), this.TileSize)); - - x--; - y--; - - if (x < 0) x = 0; - if (y < 0) y = 0; - - return new Point(x, y); - } - - protected Point convertLocationToCoord_Nearest(int posX, int posY) - { - int x = (int)Math.Round(decimal.Divide(posX, this.TileSize)); - int y = (int)Math.Round(decimal.Divide((posY - labelHeight), this.TileSize)); - - if (x < 0) x = 0; - if (y < 0) y = 0; - - return new Point(x, y); - } - - protected Point? findFirstFreeCoord() - { - Point gridSize = this.GridSize; - - for (int y = 0; y < gridSize.Y; y++) - { - for (int x = 0; x < gridSize.X; x++) - { - if (hasTile(new Point(x, y))) - { - continue; - } - - return new Point(x, y); - } - } - - return null; - } - - protected Point? findLastFreeCoord() - { - Point gridSize = this.GridSize; - - // none available - if (items.Count >= (gridSize.X * gridSize.Y)) - { - return null; - } - - if (items.Count <= 0) - { - return findFirstFreeCoord(); - } - - // only one available - if (items.Count >= ((gridSize.X * gridSize.Y) - 1)) - { - return findFirstFreeCoord(); - } - - Point? rv = null; - - for (int y = (gridSize.Y - 1); y >= 0; y--) - { - for (int x = (gridSize.X - 1); x >= 0; x--) - { - if (hasTile(new Point(x, y))) - { - if (rv.HasValue) - { - return rv; - } - } - else - { - rv = new Point(x, y); - } - } - } - - return null; - } - - protected bool hasTile(Point position) - { - if (items == null) - { - return false; - } - - if (items.Count <= 0) - { - return false; - } - - return (items.Count(x => x.Coord.Equals(position)) > 0); - } - - protected bool isTileInBounds(Point position) - { - Point gridSize = this.GridSize; - - if (position.X >= gridSize.X) - { - return false; - } - - if (position.Y >= gridSize.Y) - { - return false; - } - - return true; - } - - protected Point? resolveCoord(Point coord) - { - if (!isTileInBounds(coord)) - { - return null; - } - - if (!hasTile(coord)) - { - return coord; - } - - return resolveNextCoord(coord); - } - - protected Point? resolveNextCoord(Point coord) - { - Point gridSize = this.GridSize; - Point newCoord = coord; - - while (true) - { - newCoord.X++; - - if (newCoord.X >= gridSize.X) - { - newCoord.Y++; - newCoord.X = 0; - } - - if (!isTileInBounds(newCoord)) - { - return null; - } - - if (hasTile(newCoord)) - { - continue; - } - - return newCoord; - } - } - - private async void label1_MouseClick(object sender, MouseEventArgs e) - { - if (isAnimating) return; - - if (e.Button == MouseButtons.Left) - { - isChecked = !isChecked; - - label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16); - - this.Invalidate(); - - await this.InvalidateContainer(); - - // exclusivity - if (isChecked) - { - if (this.Model.IsExclusive) - { - if (this.FlowLayoutPanel != null) - { - foreach (TilePanelLayout item in this.FlowLayoutPanel.Controls.OfType()) - { - if (item.Equals(this)) - { - continue; - } - - await item.Collapse(); - } - } - } - } - - label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16); - } - else if (e.Button == MouseButtons.Right) - { - contextMenuStrip2.Show(this, e.Location); - } - } - - #region tile context menu - - /// - /// Add tile - /// - /// - /// - private void addTileMenuItem_Click(object sender, EventArgs e) - { - Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); - - EditTileForm.ShowAddDialog(this, coord); - } - - /// - /// Add folder - /// - /// - /// - private void addListTileMenuItem_Click(object sender, EventArgs e) - { - Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y); - - EditTileFolderForm.ShowAddDialog(this, coord); - } - - #endregion - - #region group context menu - - /// - /// Add group - /// - /// - /// - private void addGroupMenuItem_Click(object sender, EventArgs e) - { - this.AddGroup(); - } - - /// - /// Edit group - /// - /// - /// - private void editGroupMenuItem_Click(object sender, EventArgs e) - { - this.EditGroup(); - } - - /// - /// Add row - /// - /// - /// - private void toolStripMenuItem5_Click(object sender, EventArgs e) - { - this.AddRow(); - } - - /// - /// Remove row - /// - /// - /// - private void removeRowToolStripMenuItem_Click_1(object sender, EventArgs e) - { - if (gridSize.Y <= 1) - { - return; - } - - bool rs = items.Exists(x => x.Coord.Y.Equals(gridSize.Y - 1)); - if (rs) - { - return; - } - - this.SetGridSize(gridSize.X, (gridSize.Y - 1)); - } - - /// - /// Move to top - /// - /// - /// - private void moveTopMenuItem_Click(object sender, EventArgs e) - { - this.MoveTop(); - } - - /// - /// Move up - /// - /// - /// - private void moveUpMenuItem_Click(object sender, EventArgs e) - { - this.MoveUp(); - } - - /// - /// Move down - /// - /// - /// - private void moveDownMenuItem_Click(object sender, EventArgs e) - { - this.MoveDown(); - } - - /// - /// Move to bottom - /// - /// - /// - private void moveBottomMenuItem_Click(object sender, EventArgs e) - { - this.MoveBottom(); - } - - /// - /// Remove group - /// - /// - /// - private void removeGroupMenuItem3_Click(object sender, EventArgs e) - { - this.Remove(); - } - - #endregion - - } -} diff --git a/Windows/Forms/TilePanelLayout.resx b/Windows/Forms/TilePanelLayout.resx deleted file mode 100644 index b5d6123..0000000 --- a/Windows/Forms/TilePanelLayout.resx +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 172, 17 - - \ No newline at end of file