Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: PluginUI.cs
- ===================================================================
- --- PluginUI.cs (revision 1929)
- +++ PluginUI.cs (working copy)
- @@ -33,10 +33,14 @@
- private Regex todoParser = null;
- private Boolean isEnabled = false;
- private Boolean refreshEnabled = false;
- + private Boolean copySelectedEnabled = false;
- + private Boolean copyAllEnabled = false;
- private Boolean firstExecutionCompleted = false;
- private Dictionary<String, DateTime> filesCache;
- private ContextMenuStrip contextMenu;
- private ToolStripMenuItem refreshButton;
- + private ToolStripMenuItem copySelectedButton;
- + private ToolStripMenuItem copyAllButton;
- private ToolStripLabel toolStripLabel;
- private ListViewSorter columnSorter;
- private StatusStrip statusStrip;
- @@ -68,7 +72,7 @@
- {
- this.groups.AddRange(settings.GroupValues);
- String pattern = String.Join("|", settings.GroupValues);
- - this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*([^\r|\n|\*\*/]*)", RegexOptions.Multiline);
- + this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*(.*?)(?:\r|\n|\**\*/)", RegexOptions.Multiline);
- this.isEnabled = true;
- this.InitGraphics();
- }
- @@ -122,7 +126,7 @@
- this.listView.FullRowSelect = true;
- this.listView.GridLines = true;
- this.listView.LabelWrap = false;
- - this.listView.MultiSelect = false;
- + this.listView.MultiSelect = true;
- this.listView.Name = "listView";
- this.listView.ShowItemToolTips = true;
- this.listView.Size = new System.Drawing.Size(278, 330);
- @@ -201,10 +205,22 @@
- this.contextMenu = new ContextMenuStrip();
- this.contextMenu.Font = PluginBase.Settings.DefaultFont;
- this.statusStrip.Font = PluginBase.Settings.DefaultFont;
- +
- Image image = PluginBase.MainForm.FindImage("66");
- String label = TextHelper.GetString("FlashDevelop.Label.Refresh");
- this.refreshButton = new ToolStripMenuItem(label, image, new EventHandler(this.RefreshButtonClick));
- this.contextMenu.Items.Add(this.refreshButton);
- +
- + image = PluginBase.MainForm.FindImage("278");
- + label = TextHelper.GetString("FlashDevelop.Label.Copy");
- + this.copySelectedButton = new ToolStripMenuItem(label, image, new EventHandler(this.CopySelectedButtonClick));
- + this.contextMenu.Items.Add(this.copySelectedButton);
- +
- + image = PluginBase.MainForm.FindImage("278");
- + label = TextHelper.GetString("TaskListPanel.Label.CopyAll");
- + this.copyAllButton = new ToolStripMenuItem(label, image, new EventHandler(this.CopyAllButtonClick));
- + this.contextMenu.Items.Add(this.copyAllButton);
- +
- this.listView.ContextMenuStrip = this.contextMenu;
- }
- @@ -237,7 +253,7 @@
- {
- this.groups.AddRange(settings.GroupValues);
- String pattern = String.Join("|", settings.GroupValues);
- - this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*([^\r|\n|\*\*/]*)", RegexOptions.Multiline);
- + this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*(.*?)(?:\r|\n|\**\*/)", RegexOptions.Multiline);
- this.isEnabled = true;
- this.InitGraphics();
- }
- @@ -266,6 +282,32 @@
- }
- /// <summary>
- + /// While parsing project files we need to disable the copy button
- + /// </summary>
- + public Boolean CopySelectedEnabled
- + {
- + get { return this.copySelectedEnabled; }
- + set
- + {
- + this.copySelectedEnabled = value;
- + this.copySelectedButton.Enabled = value;
- + }
- + }
- +
- + /// <summary>
- + /// While parsing project files we need to disable the copy button
- + /// </summary>
- + public Boolean CopyAllEnabled
- + {
- + get { return this.copyAllEnabled; }
- + set
- + {
- + this.copyAllEnabled = value;
- + this.copyAllButton.Enabled = value;
- + }
- + }
- +
- + /// <summary>
- /// Stops the parse timer if not enabled.
- /// </summary>
- public void Terminate()
- @@ -376,6 +418,8 @@
- if (this.isEnabled && PluginBase.CurrentProject != null)
- {
- this.RefreshEnabled = false;
- + this.CopySelectedEnabled = false;
- + this.CopyAllEnabled = false;
- // stop current exploration
- if (this.parseTimer.Enabled) this.parseTimer.Stop();
- @@ -428,6 +472,66 @@
- }
- /// <summary>
- + /// Copies the currently selected list view item contents to the clipboard.
- + /// </summary>
- + public void CopySelectedToClipboard()
- + {
- + if (this.listView.SelectedItems.Count >= 1)
- + {
- + StringBuilder content = new StringBuilder();
- +
- + foreach(ColumnHeader header in this.listView.Columns)
- + {
- + content.Append(header.Text.Trim() + "\t");
- + }
- +
- + foreach(ListViewItem item in this.listView.SelectedItems)
- + {
- + content.AppendLine();
- + content.Append(item.Text.Trim());
- +
- + for(int i = 1; i < item.SubItems.Count; i ++)
- + {
- + content.Append("\t" + item.SubItems[i].Text.Trim());
- + }
- + }
- +
- + Clipboard.SetText(content.ToString());
- + }
- + }
- +
- + /// <summary>
- + /// Copies the list view contents to the clipboard.
- + /// </summary>
- + public void CopyAllToClipboard()
- + {
- + StringBuilder content = new StringBuilder();
- +
- + foreach(ColumnHeader header in this.listView.Columns)
- + {
- + content.Append(header.Text.Trim() + "\t");
- + }
- +
- + foreach(ListViewGroup group in this.listView.Groups)
- + {
- + content.AppendLine();
- +
- + foreach(ListViewItem item in group.Items)
- + {
- + content.AppendLine();
- + content.Append(item.Text.Trim());
- +
- + for(int i = 1; i < item.SubItems.Count; i ++)
- + {
- + content.Append("\t" + item.SubItems[i].Text.Trim());
- + }
- + }
- + }
- +
- + Clipboard.SetText(content.ToString());
- + }
- +
- + /// <summary>
- /// At startup parse all opened files
- /// </summary>
- private void ParseNextFile()
- @@ -482,7 +586,11 @@
- {
- this.parseTimer.Enabled = false;
- this.parseTimer.Stop();
- +
- this.RefreshEnabled = true;
- + this.CopySelectedEnabled = true;
- + this.CopyAllEnabled = true;
- +
- this.toolStripLabel.Text = "";
- if (this.firstExecutionCompleted == false)
- {
- @@ -685,6 +793,28 @@
- }
- /// <summary>
- + /// Clicked on "Copy" button. This will copy the currently selected list view entry contents to the cliboard.
- + /// </summary>
- + private void CopySelectedButtonClick(Object sender, EventArgs e)
- + {
- + if (this.isEnabled)
- + {
- + CopySelectedToClipboard();
- + }
- + }
- +
- + /// <summary>
- + /// Clicked on "Copy" button. This will copy the list view contents to the cliboard.
- + /// </summary>
- + private void CopyAllButtonClick(Object sender, EventArgs e)
- + {
- + if (this.isEnabled)
- + {
- + CopyAllToClipboard();
- + }
- + }
- +
- + /// <summary>
- /// When user stop mouse movement parse again this file
- /// </summary>
- private void SciControlDwellStart(ScintillaControl sci, int position)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement