Changed: textbox button to respond to left-button only
This commit is contained in:
		
							parent
							
								
									2af53adcae
								
							
						
					
					
						commit
						3518084267
					
				@ -1,15 +1,14 @@
 | 
			
		||||
using FizzyLauncher.Models;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
using BookmarkManager;
 | 
			
		||||
using bzit.bomg.Models;
 | 
			
		||||
using RyzStudio.Windows.Forms;
 | 
			
		||||
using RyzStudio.Windows.ThemedForms;
 | 
			
		||||
using System;
 | 
			
		||||
using RyzStudio.Windows.Forms;
 | 
			
		||||
using bzit.bomg.Models;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using BookmarkManager;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Net;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
 | 
			
		||||
namespace FizzyLauncher
 | 
			
		||||
{
 | 
			
		||||
@ -32,10 +31,9 @@ namespace FizzyLauncher
 | 
			
		||||
        private ToolTip toolTip1;
 | 
			
		||||
        private System.ComponentModel.IContainer components;
 | 
			
		||||
 | 
			
		||||
        protected bool isBusy = false;
 | 
			
		||||
 | 
			
		||||
        protected WebParser webParser = null;
 | 
			
		||||
        protected WebClient webClient = null;
 | 
			
		||||
        protected bool isBusy = false;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public BookmarkForm(BookmarkItem model, Image icon) : base()
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,6 @@
 | 
			
		||||
using Microsoft.Data.Sqlite;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Drawing;
 | 
			
		||||
using System.Drawing.Imaging;
 | 
			
		||||
using System.IO;
 | 
			
		||||
 | 
			
		||||
namespace BookmarkManager
 | 
			
		||||
@ -50,11 +49,8 @@ namespace BookmarkManager
 | 
			
		||||
            {
 | 
			
		||||
                command.ExecuteNonQuery();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -84,11 +80,8 @@ namespace BookmarkManager
 | 
			
		||||
            {
 | 
			
		||||
                command.ExecuteNonQuery();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -119,11 +112,8 @@ namespace BookmarkManager
 | 
			
		||||
 | 
			
		||||
                command.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -138,16 +128,12 @@ namespace BookmarkManager
 | 
			
		||||
            {
 | 
			
		||||
                img = Image.FromStream(new MemoryStream(iconBytes));
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return img;
 | 
			
		||||
            //return new Bitmap(img, 16, 16);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public bool HasIcon(string id)
 | 
			
		||||
@ -168,11 +154,8 @@ namespace BookmarkManager
 | 
			
		||||
 | 
			
		||||
                command.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -200,11 +183,8 @@ namespace BookmarkManager
 | 
			
		||||
            {
 | 
			
		||||
                command.ExecuteNonQuery();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -222,11 +202,8 @@ namespace BookmarkManager
 | 
			
		||||
                command.ExecuteNonQuery();
 | 
			
		||||
                command.Dispose();
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception exc)
 | 
			
		||||
            catch (Exception)
 | 
			
		||||
            {
 | 
			
		||||
//#if DEBUG
 | 
			
		||||
//                MessageBox.Show(exc.Message);
 | 
			
		||||
//#endif
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -235,12 +212,6 @@ namespace BookmarkManager
 | 
			
		||||
 | 
			
		||||
        protected byte[] ImageToBytes(Image image)
 | 
			
		||||
        {
 | 
			
		||||
            //MemoryStream stream = new MemoryStream();
 | 
			
		||||
            //image.Save(stream, image.RawFormat);
 | 
			
		||||
            //stream.Close();
 | 
			
		||||
 | 
			
		||||
            //return stream.ToArray();
 | 
			
		||||
 | 
			
		||||
            ImageConverter imageConverter = new ImageConverter();
 | 
			
		||||
            return (byte[])imageConverter.ConvertTo(image, typeof(byte[]));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										52
									
								
								MainForm.cs
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								MainForm.cs
									
									
									
									
									
								
							@ -1,7 +1,6 @@
 | 
			
		||||
using BookmarkManager;
 | 
			
		||||
using bzit.bomg.Models;
 | 
			
		||||
using FizzyLauncher.Models;
 | 
			
		||||
using Microsoft.Data.Sqlite;
 | 
			
		||||
using Newtonsoft.Json;
 | 
			
		||||
using RyzStudio.Windows.Forms;
 | 
			
		||||
using System;
 | 
			
		||||
@ -521,7 +520,25 @@ namespace FizzyLauncher
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //treeView1.AddItem(.AddFolder("New Folder");
 | 
			
		||||
            if (treeView1.GetNodeType() == BookmarkTreeView.NodeType.Page)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (treeView1.SelectedNode == null)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // add placeholder
 | 
			
		||||
            TreeNode node = treeView1.AddItem(treeView1.SelectedNode, new BookmarkItem()
 | 
			
		||||
            {
 | 
			
		||||
                SiteName = "New Bookmark"
 | 
			
		||||
            });
 | 
			
		||||
            node.EnsureVisible();
 | 
			
		||||
            treeView1.SelectedNode = node;
 | 
			
		||||
 | 
			
		||||
            UpdateBookmarkNode(true);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@ -551,9 +568,7 @@ namespace FizzyLauncher
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="sender"></param>
 | 
			
		||||
        /// <param name="e"></param>
 | 
			
		||||
        private void addPageToolStripMenuItem1_Click(object sender, EventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        private void addPageToolStripMenuItem1_Click(object sender, EventArgs e) => addPageToolStripMenuItem_Click(sender, e);
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// Add folder
 | 
			
		||||
@ -640,7 +655,16 @@ namespace FizzyLauncher
 | 
			
		||||
        /// <param name="e"></param>
 | 
			
		||||
        private void editToolStripMenuItem2_Click(object sender, EventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (this.IsBusy)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            BookmarkTreeView.NodeType nodeType = treeView1.GetNodeType();
 | 
			
		||||
            if (nodeType == BookmarkTreeView.NodeType.Page)
 | 
			
		||||
            {
 | 
			
		||||
                UpdateBookmarkNode(false);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
@ -684,11 +708,7 @@ namespace FizzyLauncher
 | 
			
		||||
                    await OpenBookmark(tn);
 | 
			
		||||
                    break;
 | 
			
		||||
                case Keys.F2:
 | 
			
		||||
                    if (nodeType == BookmarkTreeView.NodeType.Page)
 | 
			
		||||
                    {
 | 
			
		||||
                        UpdateBookmarkNode(false);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    editToolStripMenuItem2_Click(sender, null);
 | 
			
		||||
                    break;
 | 
			
		||||
                case Keys.Insert:
 | 
			
		||||
                    if (e.Modifiers != Keys.Shift)
 | 
			
		||||
@ -702,15 +722,7 @@ namespace FizzyLauncher
 | 
			
		||||
                            treeView1.SelectedNode = tn.Parent;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        // add placeholder
 | 
			
		||||
                        TreeNode node = treeView1.AddItem(treeView1.SelectedNode, new BookmarkItem()
 | 
			
		||||
                        {
 | 
			
		||||
                            SiteName = "New Bookmark"
 | 
			
		||||
                        });
 | 
			
		||||
                        node.EnsureVisible();
 | 
			
		||||
                        treeView1.SelectedNode = node;
 | 
			
		||||
 | 
			
		||||
                        UpdateBookmarkNode(true);
 | 
			
		||||
                        addPageToolStripMenuItem_Click(sender, null);
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    break;
 | 
			
		||||
@ -1073,7 +1085,7 @@ namespace FizzyLauncher
 | 
			
		||||
                string iconID = Crypto.GetSHA256Hash(bookmarkForm.Model.Item?.SiteName);
 | 
			
		||||
                if (!string.IsNullOrWhiteSpace(iconID))
 | 
			
		||||
                {
 | 
			
		||||
                    iconDatabase.AddIcon(iconID, icon);
 | 
			
		||||
                    iconDatabase.AddIcon(iconID, bookmarkForm.Model.Icon);
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                treeView1.UpdateItem(treeView1.SelectedNode, bookmarkForm.Model.Item);
 | 
			
		||||
 | 
			
		||||
@ -2,8 +2,8 @@
 | 
			
		||||
{
 | 
			
		||||
    using RyzStudio.Drawing;
 | 
			
		||||
    using System;
 | 
			
		||||
	using System.ComponentModel;
 | 
			
		||||
	using System.Drawing;
 | 
			
		||||
    using System.ComponentModel;
 | 
			
		||||
    using System.Drawing;
 | 
			
		||||
    using System.Windows.Forms;
 | 
			
		||||
 | 
			
		||||
    public partial class TButtonTextBox : RyzStudio.Windows.ThemedForms.TUserControl
 | 
			
		||||
@ -22,11 +22,19 @@
 | 
			
		||||
            textBox1.Left = this.Margin.Left;
 | 
			
		||||
            textBox1.PreviewKeyDown += textBox_PreviewKeyDown;
 | 
			
		||||
 | 
			
		||||
            imageBox1.Click += imageBox1_Click;
 | 
			
		||||
            imageBox1.MouseClick += imageBox1_MouseClick;
 | 
			
		||||
 | 
			
		||||
            OnResize(null);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void imageBox1_MouseClick(object sender, MouseEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.Button == MouseButtons.Left)
 | 
			
		||||
            {
 | 
			
		||||
                OnButtonClick?.Invoke(sender, e);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void OnResize(EventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            base.OnResize(e);
 | 
			
		||||
@ -69,8 +77,6 @@
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected virtual void imageBox1_Click(object sender, EventArgs e) => OnButtonClick?.Invoke(sender, e);
 | 
			
		||||
 | 
			
		||||
        [Category("Action")]
 | 
			
		||||
        [Browsable(true)]
 | 
			
		||||
        public event EventHandler OnButtonClick;
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,4 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
using UIResources = BookmarkManager.UIResource;
 | 
			
		||||
 | 
			
		||||
@ -16,8 +15,13 @@ namespace RyzStudio.Windows.ThemedForms
 | 
			
		||||
 | 
			
		||||
        public FolderBrowserDialog FolderDialog { get; set; } = null;
 | 
			
		||||
 | 
			
		||||
        protected override void imageBox1_Click(object sender, EventArgs e)
 | 
			
		||||
        protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.Button != MouseButtons.Left)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (this.FolderDialog == null)
 | 
			
		||||
            {
 | 
			
		||||
                this.FolderDialog = new FolderBrowserDialog();
 | 
			
		||||
 | 
			
		||||
@ -1,5 +1,4 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Windows.Forms;
 | 
			
		||||
using UIResources = BookmarkManager.UIResource;
 | 
			
		||||
 | 
			
		||||
@ -71,8 +70,13 @@ namespace RyzStudio.Windows.ThemedForms
 | 
			
		||||
            this.Text = this.KeyCodeResults.DisplayText;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        protected override void imageBox1_Click(object sender, EventArgs e)
 | 
			
		||||
        protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.Button != MouseButtons.Left)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            this.KeyCodeResults.Clear();
 | 
			
		||||
 | 
			
		||||
            this.Text = this.KeyCodeResults.DisplayText;
 | 
			
		||||
 | 
			
		||||
@ -16,8 +16,13 @@ namespace RyzStudio.Windows.ThemedForms
 | 
			
		||||
 | 
			
		||||
        public OpenFileDialog FileDialog { get; set; } = null;
 | 
			
		||||
 | 
			
		||||
        protected override void imageBox1_Click(object sender, EventArgs e)
 | 
			
		||||
        protected override void imageBox1_MouseClick(object sender, MouseEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            if (e.Button != MouseButtons.Left)
 | 
			
		||||
            {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (this.FileDialog == null)
 | 
			
		||||
            {
 | 
			
		||||
                this.FileDialog = new OpenFileDialog();
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user