diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 47fee2f..1647829 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -57,7 +57,6 @@ this.viewHelpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator(); this.aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); - this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); this.rootContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components); this.addPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -86,10 +85,19 @@ this.toolStripMenuItem8 = new System.Windows.Forms.ToolStripSeparator(); this.moveUpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); this.moveDownToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.toolStripButton1 = new System.Windows.Forms.ToolStripButton(); + this.toolStripButton2 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton3 = new System.Windows.Forms.ToolStripButton(); + this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator(); + this.toolStripButton4 = new System.Windows.Forms.ToolStripButton(); + this.treeView1 = new RyzStudio.Windows.Forms.BookmarkTreeView(); this.menuStrip1.SuspendLayout(); this.rootContextMenu.SuspendLayout(); this.folderContextMenu.SuspendLayout(); this.pageContextMenu.SuspendLayout(); + this.toolStrip1.SuspendLayout(); this.SuspendLayout(); // // saveFileDialog1 @@ -306,15 +314,6 @@ this.aboutToolStripMenuItem1.Text = "&About"; this.aboutToolStripMenuItem1.Click += new System.EventHandler(this.aboutToolStripMenuItem1_Click); // - // treeView1 - // - this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.treeView1.Location = new System.Drawing.Point(0, 24); - this.treeView1.Name = "treeView1"; - this.treeView1.Size = new System.Drawing.Size(300, 556); - this.treeView1.TabIndex = 3; - // // openFileDialog1 // this.openFileDialog1.DefaultExt = "jsnx"; @@ -526,6 +525,81 @@ this.moveDownToolStripMenuItem1.Text = "Move &Down"; this.moveDownToolStripMenuItem1.Click += new System.EventHandler(this.moveDownToolStripMenuItem1_Click); // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripButton1, + this.toolStripButton2, + this.toolStripSeparator3, + this.toolStripButton3, + this.toolStripSeparator4, + this.toolStripButton4}); + this.toolStrip1.Location = new System.Drawing.Point(0, 24); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(300, 25); + this.toolStrip1.TabIndex = 4; + this.toolStrip1.Text = "toolStrip1"; + // + // toolStripButton1 + // + this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton1.Image = global::BookmarkManager.UIResource.file2; + this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton1.Name = "toolStripButton1"; + this.toolStripButton1.Size = new System.Drawing.Size(23, 22); + this.toolStripButton1.Text = "toolStripButton1"; + this.toolStripButton1.ToolTipText = "New"; + this.toolStripButton1.Click += new System.EventHandler(this.newToolStripMenuItem_Click); + // + // toolStripButton2 + // + this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton2.Image = global::BookmarkManager.UIResource.folder2; + this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton2.Name = "toolStripButton2"; + this.toolStripButton2.Size = new System.Drawing.Size(23, 22); + this.toolStripButton2.Text = "Open"; + this.toolStripButton2.Click += new System.EventHandler(this.openToolStripMenuItem_Click); + // + // toolStripSeparator3 + // + this.toolStripSeparator3.Name = "toolStripSeparator3"; + this.toolStripSeparator3.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton3 + // + this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton3.Image = global::BookmarkManager.UIResource.disk2; + this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton3.Name = "toolStripButton3"; + this.toolStripButton3.Size = new System.Drawing.Size(23, 22); + this.toolStripButton3.Text = "Save"; + this.toolStripButton3.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); + // + // toolStripSeparator4 + // + this.toolStripSeparator4.Name = "toolStripSeparator4"; + this.toolStripSeparator4.Size = new System.Drawing.Size(6, 25); + // + // toolStripButton4 + // + this.toolStripButton4.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; + this.toolStripButton4.Image = global::BookmarkManager.UIResource.search2; + this.toolStripButton4.ImageTransparentColor = System.Drawing.Color.Magenta; + this.toolStripButton4.Name = "toolStripButton4"; + this.toolStripButton4.Size = new System.Drawing.Size(23, 22); + this.toolStripButton4.Text = "Find"; + this.toolStripButton4.Click += new System.EventHandler(this.findToolStripMenuItem_Click); + // + // treeView1 + // + this.treeView1.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.treeView1.Dock = System.Windows.Forms.DockStyle.Fill; + this.treeView1.Location = new System.Drawing.Point(0, 49); + this.treeView1.Name = "treeView1"; + this.treeView1.Size = new System.Drawing.Size(300, 531); + this.treeView1.TabIndex = 5; + // // MainForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -533,6 +607,7 @@ this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ClientSize = new System.Drawing.Size(300, 580); this.Controls.Add(this.treeView1); + this.Controls.Add(this.toolStrip1); this.Controls.Add(this.menuStrip1); this.DoubleBuffered = true; this.ForeColor = System.Drawing.SystemColors.ControlText; @@ -545,6 +620,8 @@ this.rootContextMenu.ResumeLayout(false); this.folderContextMenu.ResumeLayout(false); this.pageContextMenu.ResumeLayout(false); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -576,7 +653,6 @@ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem findToolStripMenuItem; private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; - private RyzStudio.Windows.Forms.BookmarkTreeView treeView1; private System.Windows.Forms.OpenFileDialog openFileDialog1; private System.Windows.Forms.ContextMenuStrip rootContextMenu; private System.Windows.Forms.ToolStripMenuItem addPageToolStripMenuItem; @@ -607,6 +683,14 @@ private System.Windows.Forms.ToolStripMenuItem moveDownToolStripMenuItem1; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem9; private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripButton toolStripButton1; + private System.Windows.Forms.ToolStripButton toolStripButton2; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripButton toolStripButton3; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; + private System.Windows.Forms.ToolStripButton toolStripButton4; + private RyzStudio.Windows.Forms.BookmarkTreeView treeView1; } } diff --git a/MainForm.cs b/MainForm.cs index 85ba623..d32e065 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -160,9 +160,11 @@ namespace FizzyLauncher ThreadControl.SetEnable(closeToolStripMenuItem, false); ThreadControl.SetEnable(saveToolStripMenuItem, false); + ThreadControl.SetEnable(toolStripButton3, false); ThreadControl.SetEnable(saveAsToolStripMenuItem, false); ThreadControl.SetEnable(findToolStripMenuItem, false); + ThreadControl.SetEnable(toolStripButton4, false); ThreadControl.SetEnable(toolStripMenuItem9, false); @@ -174,9 +176,11 @@ namespace FizzyLauncher ThreadControl.SetEnable(closeToolStripMenuItem, true); ThreadControl.SetEnable(saveToolStripMenuItem, true); + ThreadControl.SetEnable(toolStripButton3, true); ThreadControl.SetEnable(saveAsToolStripMenuItem, true); ThreadControl.SetEnable(findToolStripMenuItem, true); + ThreadControl.SetEnable(toolStripButton4, true); ThreadControl.SetEnable(toolStripMenuItem9, true); @@ -190,9 +194,11 @@ namespace FizzyLauncher ThreadControl.SetEnable(closeToolStripMenuItem, true); ThreadControl.SetEnable(saveToolStripMenuItem, false); + ThreadControl.SetEnable(toolStripButton3, false); ThreadControl.SetEnable(saveAsToolStripMenuItem, true); ThreadControl.SetEnable(findToolStripMenuItem, true); + ThreadControl.SetEnable(toolStripButton4, true); ThreadControl.SetEnable(toolStripMenuItem9, true); @@ -769,7 +775,10 @@ namespace FizzyLauncher private void treeView1_OnNodeChanged(object sender, EventArgs e) { - ThreadControl.SetEnable(saveToolStripMenuItem, (treeView1.HasChanged && ApplicationMode == AppMode.Open)); + bool state = (treeView1.HasChanged && ApplicationMode == AppMode.Open); + + ThreadControl.SetEnable(saveToolStripMenuItem, state); + ThreadControl.SetEnable(toolStripButton3, state); } protected string BuildOpenFileSupportedFiles(List supportList) diff --git a/MainForm.resx b/MainForm.resx index 17dacaa..f254feb 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -75,6 +75,9 @@ 1137, 17 + + 1290, 17 + diff --git a/RyzStudio/Windows/Forms/ThreadControl.cs b/RyzStudio/Windows/Forms/ThreadControl.cs index 4e69c30..08a2e45 100644 --- a/RyzStudio/Windows/Forms/ThreadControl.cs +++ b/RyzStudio/Windows/Forms/ThreadControl.cs @@ -552,6 +552,27 @@ namespace RyzStudio.Windows.Forms } } + public static void SetEnable(ToolStripButton control, bool value) + { + if (control.GetCurrentParent() == null) + { + control.Enabled = value; + return; + } + + if (control.GetCurrentParent().InvokeRequired) + { + control.GetCurrentParent().Invoke(new MethodInvoker(() => + { + control.Enabled = value; + })); + } + else + { + control.Enabled = value; + } + } + public static void SetFocus(Control control) { if (control.InvokeRequired)