[Monodevelop-patches-list] r454 - in trunk/MonoDevelop/src/Main/Base: Commands Gui/Dialogs
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Jan 11 18:49:56 EST 2004
Author: jluke
Date: 2004-01-11 18:49:56 -0500 (Sun, 11 Jan 2004)
New Revision: 454
Modified:
trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs
trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs
Log:
oops, fix these
Modified: trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs 2004-01-11 23:40:52 UTC (rev 453)
+++ trunk/MonoDevelop/src/Main/Base/Commands/HelpCommands.cs 2004-01-11 23:49:56 UTC (rev 454)
@@ -1,113 +1,107 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Collections;
-//using System.Windows.Forms;
-using System.Drawing; // Added
-using System.ComponentModel; //Added
-using System.Resources; // Added
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Diagnostics;
+using System.IO;
+using System.Collections;
using Gtk;
-using GtkSharp;
-
-using ICSharpCode.Core.AddIns.Codons;
-
-using ICSharpCode.Core.Properties;
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Services;
-using ICSharpCode.SharpDevelop.Gui;
-using ICSharpCode.SharpDevelop.Gui.Dialogs;
-using ICSharpCode.SharpDevelop.Gui.XmlForms; // Added
-
-namespace ICSharpCode.SharpDevelop.Commands
-{
- public class ShowHelp : AbstractMenuCommand
- {
- public override void Run()
- {
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- string fileName = fileUtilityService.SharpDevelopRootPath +
- Path.DirectorySeparatorChar + "doc" +
- Path.DirectorySeparatorChar + "help" +
- Path.DirectorySeparatorChar + "sharpdevelop.chm";
- //if (fileUtilityService.TestFileExists(fileName)) {
- // Help.ShowHelp((Gtk.Window)WorkbenchSingleton.Workbench, fileName);
- //}
- }
- }
-
- public class ViewGPL : AbstractMenuCommand
- {
- public override void Run()
- {
- ViewGPLDialog vgd = new ViewGPLDialog();
+using GtkSharp;
+
+using ICSharpCode.Core.AddIns.Codons;
+using ICSharpCode.Core.Properties;
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Services;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Gui.Dialogs;
+
+namespace ICSharpCode.SharpDevelop.Commands
+{
+ public class ShowHelp : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ string fileName = fileUtilityService.SharpDevelopRootPath +
+ Path.DirectorySeparatorChar + "doc" +
+ Path.DirectorySeparatorChar + "help" +
+ Path.DirectorySeparatorChar + "sharpdevelop.chm";
+ //if (fileUtilityService.TestFileExists(fileName)) {
+ // Help.ShowHelp((Gtk.Window)WorkbenchSingleton.Workbench, fileName);
+ //}
+ }
+ }
+
+ public class ViewGPL : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ ViewGPLDialog vgd = new ViewGPLDialog();
vgd.Run ();
- vgd.Hide ();
- }
- }
-
- public class GotoWebSite : AbstractMenuCommand
- {
- string site;
-
- public GotoWebSite(string site)
- {
- this.site = site;
- }
-
- public override void Run()
- {
- IFileService fileService = (IFileService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IFileService));
- fileService.OpenFile(site);
- }
- }
-
- public class GotoLink : AbstractMenuCommand
- {
- string site;
-
- public GotoLink(string site)
- {
- this.site = site;
- }
-
- public override void Run()
- {
- FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
- string file = site.StartsWith("home://") ? fileUtilityService.GetDirectoryNameWithSeparator(fileUtilityService.SharpDevelopRootPath) + "bin" + Path.DirectorySeparatorChar + site.Substring(7).Replace('/', Path.DirectorySeparatorChar) : site;
- try {
- Process.Start(file);
- } catch (Exception) {
- IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
- messageService.ShowError("Can't execute/view " + file + "\n Please check that the file exists and that you can open this file.");
- }
- }
- }
-
- public class ViewTipOfTheDay : AbstractMenuCommand
- {
- public override void Run()
- {
- //using (TipOfTheDayDialog totdd = new TipOfTheDayDialog()) {
- // totdd.Owner = (Gtk.Window)WorkbenchSingleton.Workbench;
- // totdd.ShowDialog();
- //}
- }
- }
-
- public class AboutSharpDevelop : AbstractMenuCommand
- {
- public override void Run()
- {
- CommonAboutDialog ad = new CommonAboutDialog("About SharpDevelop", (Window) WorkbenchSingleton.Workbench, DialogFlags.DestroyWithParent);
+ vgd.Hide ();
+ }
+ }
+
+ public class GotoWebSite : AbstractMenuCommand
+ {
+ string site;
+
+ public GotoWebSite(string site)
+ {
+ this.site = site;
+ }
+
+ public override void Run()
+ {
+ IFileService fileService = (IFileService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IFileService));
+ fileService.OpenFile(site);
+ }
+ }
+
+ // FIXME: dont use Process Start for HTML files
+ public class GotoLink : AbstractMenuCommand
+ {
+ string site;
+
+ public GotoLink(string site)
+ {
+ this.site = site;
+ }
+
+ public override void Run()
+ {
+ FileUtilityService fileUtilityService = (FileUtilityService)ServiceManager.Services.GetService(typeof(FileUtilityService));
+ string file = site.StartsWith("home://") ? fileUtilityService.GetDirectoryNameWithSeparator(fileUtilityService.SharpDevelopRootPath) + "bin" + Path.DirectorySeparatorChar + site.Substring(7).Replace('/', Path.DirectorySeparatorChar) : site;
+ try {
+ Process.Start(file);
+ } catch (Exception) {
+ IMessageService messageService =(IMessageService)ServiceManager.Services.GetService(typeof(IMessageService));
+ messageService.ShowError("Can't execute/view " + file + "\n Please check that the file exists and that you can open this file.");
+ }
+ }
+ }
+
+ public class ViewTipOfTheDay : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ // TipOfTheDayDialog totdd = new TipOfTheDayDialog ();
+ // totdd.Run ();
+ // totdd.Hide ();
+ }
+ }
+
+ public class AboutSharpDevelop : AbstractMenuCommand
+ {
+ public override void Run()
+ {
+ CommonAboutDialog ad = new CommonAboutDialog ();
ad.Run ();
- ad.Hide ();
- }
- }
-}
+ ad.Hide ();
+ }
+ }
+}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs 2004-01-11 23:40:52 UTC (rev 453)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/CommonAboutDialog.cs 2004-01-11 23:49:56 UTC (rev 454)
@@ -84,7 +84,7 @@
//text = "\"The '#pragma' command is specified in the ANSI standard to have an arbitrary implementation-defined effect. In the GNU C preprocessor, `#pragma' first attempts to run the game rogue; if that fails, it tries to run the game hack; if that fails, it tries to run GNU Emacs displaying the Tower of Hanoi; if that fails, it reports a fatal error. In any case, preprocessing does not continue.\"\n --From an old GNU C Preprocessor document";
Gtk.Function ScrollHandler = new Gtk.Function (ScrollDown);
- hndlr = Timeout.Add (30, ScrollHandler);
+ hndlr = Timeout.Add (30, ScrollHandler);
}
bool ScrollDown ()
@@ -154,12 +154,8 @@
type = RegisterGType (typeof (CommonAboutDialog));
}
- public CommonAboutDialog() : base (type)
+ public CommonAboutDialog() : base ("About MonoDevelop", (Gtk.Window) WorkbenchSingleton.Workbench, DialogFlags.DestroyWithParent)
{
- }
-
- public CommonAboutDialog(string title, Gtk.Window parent, DialogFlags flags) : base (title, parent, flags)
- {
ResourceService resourceService = (ResourceService) ServiceManager.Services.GetService(typeof (IResourceService));
aboutPictureScrollBox = new ScrollBox ();
@@ -180,9 +176,7 @@
nb.AppendPage (changelog, new Label ("ChangeLog"));
nb.AppendPage (vinfo, new Label ("Version Info"));
this.VBox.PackStart (nb);
- Button close = new Button (Stock.Close);
- close.Show ();
- this.AddButton (close, (int) ResponseType.Close);
+ this.AddButton (Stock.Close, (int) ResponseType.Close);
this.ShowAll ();
}
Modified: trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs
===================================================================
--- trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs 2004-01-11 23:40:52 UTC (rev 453)
+++ trunk/MonoDevelop/src/Main/Base/Gui/Dialogs/WordCountDialog.cs 2004-01-11 23:49:56 UTC (rev 454)
@@ -1,241 +1,241 @@
-// <file>
-// <copyright see="prj:///doc/copyright.txt"/>
-// <license see="prj:///doc/license.txt"/>
-// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
-// <version value="$version"/>
-// </file>
-
-using System;
-using System.IO;
-using System.Drawing;
-using Gtk;
-using System.Collections;
-
-using ICSharpCode.SharpDevelop.Gui;
-using ICSharpCode.Core.Properties;
-
-using ICSharpCode.Core.Services;
-using ICSharpCode.SharpDevelop.Internal.Project;
-using ICSharpCode.SharpDevelop.Services;
-
-namespace ICSharpCode.SharpDevelop.Gui.Dialogs
-{
- public class WordCountDialog : Dialog
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.IO;
+using System.Drawing;
+using Gtk;
+using System.Collections;
+
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.Core.Properties;
+
+using ICSharpCode.Core.Services;
+using ICSharpCode.SharpDevelop.Internal.Project;
+using ICSharpCode.SharpDevelop.Services;
+
+namespace ICSharpCode.SharpDevelop.Gui.Dialogs
+{
+ public class WordCountDialog : Dialog
{
static GLib.GType type;
TreeView resultListView;
- TreeStore store;
- ArrayList items;
+ TreeStore store;
+ ArrayList items;
Report total;
int selectedIndex = 0;
StringParserService stringParserService = (StringParserService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(StringParserService));
- MessageService messageService = (MessageService)ICSharpCode.Core.Services.ServiceManager.Services.GetService (typeof(MessageService));
-
- internal class Report
- {
- public string name;
- public long chars;
- public long words;
- public long lines;
-
- public Report(string name, long chars, long words, long lines)
- {
- this.name = name;
- this.chars = chars;
- this.words = words;
- this.lines = lines;
- }
-
- public string[] ToListItem()
- {
- return new string[] {System.IO.Path.GetFileName (name), chars.ToString (), words.ToString (), lines.ToString ()};
- }
-
- public static Report operator+(Report r, Report s)
- {
- ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
+ MessageService messageService = (MessageService)ICSharpCode.Core.Services.ServiceManager.Services.GetService (typeof(MessageService));
+
+ internal class Report
+ {
+ public string name;
+ public long chars;
+ public long words;
+ public long lines;
+
+ public Report(string name, long chars, long words, long lines)
+ {
+ this.name = name;
+ this.chars = chars;
+ this.words = words;
+ this.lines = lines;
+ }
+
+ public string[] ToListItem()
+ {
+ return new string[] {System.IO.Path.GetFileName (name), chars.ToString (), words.ToString (), lines.ToString ()};
+ }
+
+ public static Report operator+(Report r, Report s)
+ {
+ ResourceService resourceService = (ResourceService)ServiceManager.Services.GetService(typeof(IResourceService));
Report tmpReport = new Report (resourceService.GetString ("Dialog.WordCountDialog.TotalText"), s.chars, s.words, s.lines);
-
- tmpReport.chars += r.chars;
- tmpReport.words += r.words;
- tmpReport.lines += r.lines;
- return tmpReport;
- }
- }
-
- Report GetReport(string filename)
- {
- long numLines = 0;
- long numWords = 0;
- long numChars = 0;
-
- if (!File.Exists(filename)) return null;
-
- FileStream istream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
- StreamReader sr = new StreamReader(istream);
- string line = sr.ReadLine();
- while (line != null) {
- ++numLines;
- numChars += line.Length;
- string[] words = line.Split(null);
- numWords += words.Length;
- line = sr.ReadLine();
- }
-
- sr.Close();
- return new Report(filename, numChars, numWords, numLines);
- }
-
- void startEvent(object sender, System.EventArgs e)
- {
- items = new ArrayList();
+
+ tmpReport.chars += r.chars;
+ tmpReport.words += r.words;
+ tmpReport.lines += r.lines;
+ return tmpReport;
+ }
+ }
+
+ Report GetReport(string filename)
+ {
+ long numLines = 0;
+ long numWords = 0;
+ long numChars = 0;
+
+ if (!File.Exists(filename)) return null;
+
+ FileStream istream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
+ StreamReader sr = new StreamReader(istream);
+ string line = sr.ReadLine();
+ while (line != null) {
+ ++numLines;
+ numChars += line.Length;
+ string[] words = line.Split(null);
+ numWords += words.Length;
+ line = sr.ReadLine();
+ }
+
+ sr.Close();
+ return new Report(filename, numChars, numWords, numLines);
+ }
+
+ void startEvent(object sender, System.EventArgs e)
+ {
+ items = new ArrayList();
total = null;
-
- switch (selectedIndex) {
- case 0: {// current file
- IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
- if (window != null) {
- if (window.ViewContent.ContentName == null) {
- messageService.ShowWarning ("${res:Dialog.WordCountDialog.SaveTheFileWarning}");
- } else {
- Report r = GetReport(window.ViewContent.ContentName);
+
+ switch (selectedIndex) {
+ case 0: {// current file
+ IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;
+ if (window != null) {
+ if (window.ViewContent.ContentName == null) {
+ messageService.ShowWarning ("${res:Dialog.WordCountDialog.SaveTheFileWarning}");
+ } else {
+ Report r = GetReport(window.ViewContent.ContentName);
if (r != null) items.Add(r);
- string[] tmp = r.ToListItem ();
- store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
- }
- }
- break;
- }
- case 1: {// all open files
- if (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0) {
- bool dirty = false;
-
- total = new Report (stringParserService.Parse ("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
- foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
- if (content.ContentName == null) {
- messageService.ShowWarning ("${res:Dialog.WordCountDialog.SaveAllFileWarning}");
- continue;
- } else {
- Report r = GetReport(content.ContentName);
- if (r != null) {
- if (content.IsDirty) dirty = true;
- total += r;
- items.Add(r);
- string[] tmp = r.ToListItem ();
- store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
- }
- }
- }
-
- if (dirty) {
- messageService.ShowWarning ("${res:Dialog.WordCountDialog.DirtyWarning}");
- }
-
+ string[] tmp = r.ToListItem ();
+ store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
+ }
+ }
+ break;
+ }
+ case 1: {// all open files
+ if (WorkbenchSingleton.Workbench.ViewContentCollection.Count > 0) {
+ bool dirty = false;
+
+ total = new Report (stringParserService.Parse ("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
+ foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
+ if (content.ContentName == null) {
+ messageService.ShowWarning ("${res:Dialog.WordCountDialog.SaveAllFileWarning}");
+ continue;
+ } else {
+ Report r = GetReport(content.ContentName);
+ if (r != null) {
+ if (content.IsDirty) dirty = true;
+ total += r;
+ items.Add(r);
+ string[] tmp = r.ToListItem ();
+ store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
+ }
+ }
+ }
+
+ if (dirty) {
+ messageService.ShowWarning ("${res:Dialog.WordCountDialog.DirtyWarning}");
+ }
+
store.AppendValues ("", "", "", "");
- //string[] allItems = all.ToListItem ();
- //store.AppendValues (allItems[0], allItems[1], allItems[2], allItems[3]);
- }
- break;
- }
- case 2: {// whole project
- IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
-
- if (projectService.CurrentOpenCombine == null) {
- messageService.ShowError ("${res:Dialog.WordCountDialog.MustBeInProtectedModeWarning}");
- break;
- }
- total = new Report (stringParserService.Parse ("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
- CountCombine(projectService.CurrentOpenCombine, ref total);
- store.AppendValues ("", "", "", "");
- //string[] allItems = all.ToListItem ();
- //store.AppendValues (allItems[0], allItems[1], allItems[2], allItems[3]);
- break;
- }
+ //string[] allItems = all.ToListItem ();
+ //store.AppendValues (allItems[0], allItems[1], allItems[2], allItems[3]);
+ }
+ break;
+ }
+ case 2: {// whole project
+ IProjectService projectService = (IProjectService)ICSharpCode.Core.Services.ServiceManager.Services.GetService(typeof(IProjectService));
+
+ if (projectService.CurrentOpenCombine == null) {
+ messageService.ShowError ("${res:Dialog.WordCountDialog.MustBeInProtectedModeWarning}");
+ break;
+ }
+ total = new Report (stringParserService.Parse ("${res:Dialog.WordCountDialog.TotalText}"), 0, 0, 0);
+ CountCombine(projectService.CurrentOpenCombine, ref total);
+ store.AppendValues ("", "", "", "");
+ //string[] allItems = all.ToListItem ();
+ //store.AppendValues (allItems[0], allItems[1], allItems[2], allItems[3]);
+ break;
+ }
}
-
- UpdateList(0);
- }
-
- void CountCombine(Combine combine, ref Report all)
- {
- foreach (CombineEntry entry in combine.Entries) {
- if (entry.Entry is IProject) {
- // string tmp = "";
- foreach (ProjectFile finfo in ((IProject)entry.Entry).ProjectFiles) {
- if (finfo.Subtype != Subtype.Directory &&
- finfo.BuildAction == BuildAction.Compile) {
- Report r = GetReport(finfo.Name);
- all += r;
- items.Add(r);
+
+ UpdateList(0);
+ }
+
+ void CountCombine(Combine combine, ref Report all)
+ {
+ foreach (CombineEntry entry in combine.Entries) {
+ if (entry.Entry is IProject) {
+ // string tmp = "";
+ foreach (ProjectFile finfo in ((IProject)entry.Entry).ProjectFiles) {
+ if (finfo.Subtype != Subtype.Directory &&
+ finfo.BuildAction == BuildAction.Compile) {
+ Report r = GetReport(finfo.Name);
+ all += r;
+ items.Add(r);
string[] tmp = r.ToListItem();
- store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
- }
- }
- } else
- CountCombine((Combine)entry.Entry, ref all);
- }
- }
-
- void UpdateList(int SortKey)
- {
- if (items == null) {
- return;
- }
+ store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
+ }
+ }
+ } else
+ CountCombine((Combine)entry.Entry, ref all);
+ }
+ }
+
+ void UpdateList(int SortKey)
+ {
+ if (items == null) {
+ return;
+ }
// clear it here
- store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
-
- if (items.Count == 0) {
- return;
- }
-
- ReportComparer rc = new ReportComparer(SortKey);
- items.Sort(rc);
-
+ store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
+
+ if (items.Count == 0) {
+ return;
+ }
+
+ ReportComparer rc = new ReportComparer(SortKey);
+ items.Sort(rc);
+
for (int i = 0; i < items.Count; ++i) {
- string[] tmp = ((Report)items[i]).ToListItem();
- store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
- }
-
- if (total != null) {
+ string[] tmp = ((Report)items[i]).ToListItem();
+ store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
+ }
+
+ if (total != null) {
store.AppendValues ("", "", "", "");
- string[] tmp = total.ToListItem();
- store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
+ string[] tmp = total.ToListItem();
+ store.AppendValues (tmp[0], tmp[1], tmp[2], tmp[3]);
}
resultListView.Model = store;
- resultListView.HeadersClickable = true;
- }
-
- internal class ReportComparer : IComparer
- {
- int sortKey;
-
- public ReportComparer(int SortKey)
- {
- sortKey = SortKey;
- }
-
- public int Compare(object x, object y)
- {
- Report xr = x as Report;
- Report yr = y as Report;
-
- if (x == null || y == null) return 1;
-
- switch (sortKey) {
- case 0: // files
- return String.Compare(xr.name, yr.name);
- case 1: // chars
- return xr.chars.CompareTo(yr.chars);
- case 2: // words
- return xr.words.CompareTo(yr.words);
- case 3: // lines
- return xr.lines.CompareTo(yr.lines);
- default:
- return 1;
- }
- }
+ resultListView.HeadersClickable = true;
+ }
+
+ internal class ReportComparer : IComparer
+ {
+ int sortKey;
+
+ public ReportComparer(int SortKey)
+ {
+ sortKey = SortKey;
+ }
+
+ public int Compare(object x, object y)
+ {
+ Report xr = x as Report;
+ Report yr = y as Report;
+
+ if (x == null || y == null) return 1;
+
+ switch (sortKey) {
+ case 0: // files
+ return String.Compare(xr.name, yr.name);
+ case 1: // chars
+ return xr.chars.CompareTo(yr.chars);
+ case 2: // words
+ return xr.words.CompareTo(yr.words);
+ case 3: // lines
+ return xr.lines.CompareTo(yr.lines);
+ default:
+ return 1;
+ }
+ }
}
private SortType ReverseSort (SortType st)
@@ -245,9 +245,9 @@
return SortType.Descending;
else
return SortType.Ascending;
- }
-
- void SortEvt (object sender, EventArgs e)
+ }
+
+ void SortEvt (object sender, EventArgs e)
{
TreeViewColumn col = (TreeViewColumn) sender;
@@ -267,34 +267,33 @@
default:
break;
}
-
- //UpdateList ((TreeViewColumn)e.Column);
+
+ //UpdateList ((TreeViewColumn)e.Column);
}
static WordCountDialog ()
{
type = RegisterGType (typeof (WordCountDialog));
- }
-
- public WordCountDialog() : base (type)
+ }
+
+ public WordCountDialog() : base (type)
{
this.BorderWidth = 6;
this.TransientFor = (Window) WorkbenchSingleton.Workbench;
- this.HasSeparator = false;
+ this.HasSeparator = false;
InitializeComponents();
- this.ShowAll ();
- }
-
- void InitializeComponents()
+ this.ShowAll ();
+ }
+
+ void InitializeComponents()
{
this.SetDefaultSize (300, 300);
this.Title = "Word Count";
- Button startButton = new Button (Stock.Execute);
+ Button startButton = new Button (Stock.Execute);
startButton.Clicked += new EventHandler (startEvent);
- this.AddButton (startButton, 7);
+ this.AddActionWidget (startButton, 7);
- Button cancelButton = new Button (Stock.Cancel);
- this.AddButton (cancelButton, (int) ResponseType.Cancel);
+ this.AddButton (Stock.Cancel, (int) ResponseType.Cancel);
resultListView = new TreeView ();
resultListView.RulesHint = true;
@@ -313,14 +312,14 @@
TreeViewColumn linesColumn = new TreeViewColumn ("Lines", new CellRendererText (), "text", 3);
linesColumn.Clicked += new EventHandler (SortEvt);
- resultListView.AppendColumn (linesColumn);
+ resultListView.AppendColumn (linesColumn);
store = new TreeStore (typeof (string), typeof (string), typeof (string), typeof (string));
store.AppendValues ("", "", "", "");
- resultListView.Model = store;
+ resultListView.Model = store;
- IconService iconService = (IconService)ICSharpCode.Core.Services.ServiceManager.Services.GetService (typeof(IconService));
- this.Icon = iconService.GetIcon ("Icons.16x16.FindIcon");
+ IconService iconService = (IconService)ICSharpCode.Core.Services.ServiceManager.Services.GetService (typeof(IconService));
+ this.Icon = iconService.GetIcon ("Icons.16x16.FindIcon");
this.TransientFor = (Window) WorkbenchSingleton.Workbench;
HBox hbox = new HBox (false, 0);
@@ -329,20 +328,20 @@
OptionMenu locationComboBox = new OptionMenu ();
locationComboBox.Changed += new EventHandler (OnOptionChanged);
- Menu m = new Menu ();
- m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.currentfile}")));
- m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.allopenfiles}")));
- m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.wholeproject}")));
+ Menu m = new Menu ();
+ m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.currentfile}")));
+ m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.allopenfiles}")));
+ m.Append (new MenuItem (stringParserService.Parse ("${res:Global.Location.wholeproject}")));
locationComboBox.Menu = m;
hbox.PackStart (locationComboBox);
this.VBox.PackStart (hbox, false, true, 0);
- this.VBox.PackStart (resultListView, true, true, 6);
+ this.VBox.PackStart (resultListView, true, true, 6);
}
private void OnOptionChanged (object o, EventArgs args)
{
selectedIndex = ((OptionMenu) o).History;
- }
- }
-}
+ }
+ }
+}
More information about the Monodevelop-patches-list
mailing list