Advertisement
Guest User

FD3/External/Plugins/TaskListPanel/PluginUI.cs.patch

a guest
Jun 8th, 2011
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.37 KB | None | 0 0
  1. Index: PluginUI.cs
  2. ===================================================================
  3. --- PluginUI.cs (revision 1929)
  4. +++ PluginUI.cs (working copy)
  5. @@ -33,10 +33,14 @@
  6.          private Regex todoParser = null;
  7.          private Boolean isEnabled = false;
  8.          private Boolean refreshEnabled = false;
  9. +        private Boolean copySelectedEnabled = false;
  10. +        private Boolean copyAllEnabled = false;
  11.          private Boolean firstExecutionCompleted = false;
  12.          private Dictionary<String, DateTime> filesCache;
  13.          private ContextMenuStrip contextMenu;
  14.          private ToolStripMenuItem refreshButton;
  15. +        private ToolStripMenuItem copySelectedButton;
  16. +        private ToolStripMenuItem copyAllButton;
  17.          private ToolStripLabel toolStripLabel;
  18.          private ListViewSorter columnSorter;
  19.          private StatusStrip statusStrip;
  20. @@ -68,7 +72,7 @@
  21.                  {
  22.                      this.groups.AddRange(settings.GroupValues);
  23.                      String pattern = String.Join("|", settings.GroupValues);
  24. -                    this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*([^\r|\n|\*\*/]*)", RegexOptions.Multiline);
  25. +                    this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*(.*?)(?:\r|\n|\**\*/)", RegexOptions.Multiline);
  26.                      this.isEnabled = true;
  27.                      this.InitGraphics();
  28.                  }
  29. @@ -122,7 +126,7 @@
  30.              this.listView.FullRowSelect = true;
  31.              this.listView.GridLines = true;
  32.              this.listView.LabelWrap = false;
  33. -            this.listView.MultiSelect = false;
  34. +            this.listView.MultiSelect = true;
  35.              this.listView.Name = "listView";
  36.              this.listView.ShowItemToolTips = true;
  37.              this.listView.Size = new System.Drawing.Size(278, 330);
  38. @@ -201,10 +205,22 @@
  39.              this.contextMenu = new ContextMenuStrip();
  40.              this.contextMenu.Font = PluginBase.Settings.DefaultFont;
  41.              this.statusStrip.Font = PluginBase.Settings.DefaultFont;
  42. +            
  43.              Image image = PluginBase.MainForm.FindImage("66");
  44.              String label = TextHelper.GetString("FlashDevelop.Label.Refresh");
  45.              this.refreshButton = new ToolStripMenuItem(label, image, new EventHandler(this.RefreshButtonClick));
  46.              this.contextMenu.Items.Add(this.refreshButton);
  47. +            
  48. +            image = PluginBase.MainForm.FindImage("278");
  49. +            label = TextHelper.GetString("FlashDevelop.Label.Copy");
  50. +            this.copySelectedButton = new ToolStripMenuItem(label, image, new EventHandler(this.CopySelectedButtonClick));
  51. +            this.contextMenu.Items.Add(this.copySelectedButton);
  52. +            
  53. +            image = PluginBase.MainForm.FindImage("278");
  54. +            label = TextHelper.GetString("TaskListPanel.Label.CopyAll");
  55. +            this.copyAllButton = new ToolStripMenuItem(label, image, new EventHandler(this.CopyAllButtonClick));
  56. +            this.contextMenu.Items.Add(this.copyAllButton);
  57. +            
  58.              this.listView.ContextMenuStrip = this.contextMenu;
  59.          }
  60.  
  61. @@ -237,7 +253,7 @@
  62.                  {
  63.                      this.groups.AddRange(settings.GroupValues);
  64.                      String pattern = String.Join("|", settings.GroupValues);
  65. -                    this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*([^\r|\n|\*\*/]*)", RegexOptions.Multiline);
  66. +                    this.todoParser = new Regex(@"(//|/\*\*?|\*)[\t ]*(" + pattern + @")[:|\t ]*(.*?)(?:\r|\n|\**\*/)", RegexOptions.Multiline);
  67.                      this.isEnabled = true;
  68.                      this.InitGraphics();
  69.                  }
  70. @@ -266,6 +282,32 @@
  71.          }
  72.  
  73.          /// <summary>
  74. +        /// While parsing project files we need to disable the copy button
  75. +        /// </summary>
  76. +        public Boolean CopySelectedEnabled
  77. +        {
  78. +            get { return this.copySelectedEnabled; }
  79. +            set
  80. +            {
  81. +                this.copySelectedEnabled = value;
  82. +                this.copySelectedButton.Enabled = value;
  83. +            }
  84. +        }
  85. +
  86. +        /// <summary>
  87. +        /// While parsing project files we need to disable the copy button
  88. +        /// </summary>
  89. +        public Boolean CopyAllEnabled
  90. +        {
  91. +            get { return this.copyAllEnabled; }
  92. +            set
  93. +            {
  94. +                this.copyAllEnabled = value;
  95. +                this.copyAllButton.Enabled = value;
  96. +            }
  97. +        }
  98. +        
  99. +        /// <summary>
  100.          /// Stops the parse timer if not enabled.
  101.          /// </summary>
  102.          public void Terminate()
  103. @@ -376,6 +418,8 @@
  104.              if (this.isEnabled && PluginBase.CurrentProject != null)
  105.              {
  106.                  this.RefreshEnabled = false;
  107. +                this.CopySelectedEnabled = false;
  108. +                this.CopyAllEnabled = false;
  109.  
  110.                  // stop current exploration
  111.                  if (this.parseTimer.Enabled) this.parseTimer.Stop();
  112. @@ -428,6 +472,66 @@
  113.          }
  114.  
  115.          /// <summary>
  116. +        /// Copies the currently selected list view item contents to the clipboard.
  117. +        /// </summary>
  118. +        public void CopySelectedToClipboard()
  119. +        {
  120. +           if (this.listView.SelectedItems.Count >= 1)
  121. +           {
  122. +               StringBuilder content = new StringBuilder();
  123. +              
  124. +               foreach(ColumnHeader header in this.listView.Columns)
  125. +               {
  126. +                   content.Append(header.Text.Trim() + "\t");
  127. +               }
  128. +              
  129. +               foreach(ListViewItem item in this.listView.SelectedItems)
  130. +               {
  131. +                   content.AppendLine();
  132. +                   content.Append(item.Text.Trim());
  133. +                  
  134. +                   for(int i = 1; i < item.SubItems.Count; i ++)
  135. +                   {
  136. +                       content.Append("\t" + item.SubItems[i].Text.Trim());
  137. +                   }
  138. +               }
  139. +              
  140. +               Clipboard.SetText(content.ToString());
  141. +           }
  142. +        }
  143. +
  144. +        /// <summary>
  145. +        /// Copies the list view contents to the clipboard.
  146. +        /// </summary>
  147. +        public void CopyAllToClipboard()
  148. +        {
  149. +           StringBuilder content = new StringBuilder();
  150. +          
  151. +           foreach(ColumnHeader header in this.listView.Columns)
  152. +           {
  153. +               content.Append(header.Text.Trim() + "\t");
  154. +           }
  155. +          
  156. +           foreach(ListViewGroup group in this.listView.Groups)
  157. +           {
  158. +               content.AppendLine();
  159. +              
  160. +               foreach(ListViewItem item in group.Items)
  161. +               {
  162. +                   content.AppendLine();
  163. +                   content.Append(item.Text.Trim());
  164. +                  
  165. +                   for(int i = 1; i < item.SubItems.Count; i ++)
  166. +                   {
  167. +                       content.Append("\t" + item.SubItems[i].Text.Trim());
  168. +                   }
  169. +               }
  170. +           }
  171. +          
  172. +           Clipboard.SetText(content.ToString());
  173. +        }
  174. +
  175. +        /// <summary>
  176.          /// At startup parse all opened files
  177.          /// </summary>
  178.          private void ParseNextFile()
  179. @@ -482,7 +586,11 @@
  180.          {
  181.              this.parseTimer.Enabled = false;
  182.              this.parseTimer.Stop();
  183. +            
  184.              this.RefreshEnabled = true;
  185. +            this.CopySelectedEnabled = true;
  186. +            this.CopyAllEnabled = true;
  187. +            
  188.              this.toolStripLabel.Text = "";
  189.              if (this.firstExecutionCompleted == false)
  190.              {
  191. @@ -685,6 +793,28 @@
  192.          }
  193.  
  194.          /// <summary>
  195. +        /// Clicked on "Copy" button. This will copy the currently selected list view entry contents to the cliboard.
  196. +        /// </summary>
  197. +        private void CopySelectedButtonClick(Object sender, EventArgs e)
  198. +        {
  199. +            if (this.isEnabled)
  200. +            {
  201. +               CopySelectedToClipboard();
  202. +            }
  203. +        }
  204. +
  205. +        /// <summary>
  206. +        /// Clicked on "Copy" button. This will copy the list view contents to the cliboard.
  207. +        /// </summary>
  208. +        private void CopyAllButtonClick(Object sender, EventArgs e)
  209. +        {
  210. +            if (this.isEnabled)
  211. +            {
  212. +               CopyAllToClipboard();
  213. +            }
  214. +        }
  215. +        
  216. +        /// <summary>
  217.          /// When user stop mouse movement parse again this file
  218.          /// </summary>
  219.          private void SciControlDwellStart(ScintillaControl sci, int position)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement