Sorry for that, i'm really newbie and it is my first really patch, i
just did copy/paste the content of the console in the patch file and ,
it doesn't work (UTF8 or something else) so here it is a new one with
: svn diff FileDialog.cs > FileDialog.diff and now it should work.

2008/9/16 Petit Eric <[EMAIL PROTECTED]>:
> As sayed on IRC, better to attach the patch file.
>
> 2008/9/16 Petit Eric <[EMAIL PROTECTED]>:
>> Hi
>> i add the listview item comparer for FileDialog, like this in a FSdlg,
>> yu can click to a collumn header (details view) to change the order,
>> like in .NET.
>> a perfect think, should be to add "order by group".
>>
>> At this time, this patch provide similar way as .NET, except for one
>> thing, with .NET that work as it, yu click on the first column header
>> it  order asc and class by the first column item, yu click on the 2th
>> column header, it order asc and class by the 2th clm header.
>> Mine patch, change order asc/desc, each time yu click on a column, it
>> will need to copy paste my method for each column and dont continu to
>> use the same click event void to use my order function/class.
>>
>>
>> [EMAIL PROTECTED] System.Windows.Forms]# svn diff FileDialog.cs
>> Index: FileDialog.cs
>> ===================================================================
>> --- FileDialog.cs       (révision 113212)
>> +++ FileDialog.cs       (copie de travail)
>> @@ -360,6 +360,9 @@
>>                        mwfFileView.SelectedFileChanged += new
>> EventHandler (OnSelectedFileChangedFileView);
>>                        mwfFileView.ForceDialogEnd += new EventHandler
>> (OnForceDialogEndFileView);
>>                        mwfFileView.SelectedFilesChanged += new
>> EventHandler (OnSelectedFilesChangedFileView);
>> +
>> +                       //Add Column click event for manual sorting. line 379
>> +                       mwfFileView.ColumnClick += new
>> System.Windows.Forms.ColumnClickEventHandler(mwfFileView_ColumnClick);
>>
>>                        dirComboBox.DirectoryChanged += new
>> EventHandler (OnDirectoryChangedDirComboBox);
>>                        popupButtonPanel.DirectoryChanged += new
>> EventHandler (OnDirectoryChangedPopupButtonPanel);
>> @@ -373,6 +376,25 @@
>>  #endif
>>                }
>>
>> +               bool AscDesc = true;
>> +               private void mwfFileView_ColumnClick(object sender,
>> ColumnClickEventArgs e)
>> +               {
>> +                       try
>> +                       {
>> +                               AscDesc = !AscDesc;
>> +
>> +                               // Set the ListViewItemSorter property
>> to a new ListViewItemComparer object.
>> +                               mwfFileView.ListViewItemSorter = new
>> ListViewItemComparer(e.Column, AscDesc);
>> +                               // Call the sort method to manually sort.
>> +                               mwfFileView.Sort();
>> +
>> +                       }
>> +                       catch (Exception ex)
>> +                       {
>> +                               Console.WriteLine(DateTime.Now + ": "
>> + ex.Message + Environment.NewLine + ex.StackTrace);
>> +                       }
>> +               }
>> +
>>                [DefaultValue(true)]
>>                public bool AddExtension {
>>                        get {
>> @@ -2198,6 +2220,41 @@
>>        }
>>        #endregion
>>
>> +       #region ListViewItemComparer Added by [EMAIL PROTECTED]
>> +    // Implements the manual sorting of items by column.
>> +    class ListViewItemComparer : IComparer
>> +    {
>> +               private int col;
>> +               private bool AscDescInternal;
>> +               public ListViewItemComparer()
>> +               {
>> +                       col = 0;
>> +               }
>> +
>> +               public ListViewItemComparer(int column, bool AscDesc)
>> +               {
>> +                       col = column;
>> +                       AscDescInternal = AscDesc;
>> +               }
>> +               public int Compare(object x, object y)
>> +               {
>> +                       int returnVal = -1;
>> +                       if (AscDescInternal == true)
>> +                       {
>> +                               returnVal =
>> String.Compare(((ListViewItem)x).SubItems[col].Text,
>> +                               ((ListViewItem)y).SubItems[col].Text);
>> +                       }
>> +
>> +                       else
>> +                       {
>> +                               returnVal =
>> String.Compare(((ListViewItem)y).SubItems[col].Text,
>> +                               ((ListViewItem)x).SubItems[col].Text);
>> +                       }
>> +               return returnVal;
>> +               }
>> +       }
>> +    #endregion
>> +
>>        #region MWFFileView
>>
>>        internal class MWFFileView : ListView
>> @@ -2333,14 +2390,14 @@
>>                        columns [1] = CreateColumnHeader ("Size ", 80,
>> HorizontalAlignment.Right);
>>                        columns [2] = CreateColumnHeader (" Type",
>> 100, HorizontalAlignment.Left);
>>                        columns [3] = CreateColumnHeader (" Last
>> Access", 150, HorizontalAlignment.Left);
>> -
>> +
>>                        AllowColumnReorder = true;
>>
>>                        ResumeLayout (false);
>>
>>                        KeyDown += new KeyEventHandler (MWF_KeyDown);
>>                }
>> -
>> +
>>                ColumnHeader CreateColumnHeader (string text, int
>> width, HorizontalAlignment alignment)
>>                {
>>                        ColumnHeader col = new ColumnHeader ();
>>
>>
>> --
>>
>> Cordially.
>>
>> Small Eric Quotations of the days:
>> ---------------------------------------------------------------------------
>> If one day one reproaches you that your work is not a work of
>> professional, say you that:
>> Amateurs built the arch of Noah, and professionals the Titanic.
>> ---------------------------------------------------------------------------
>>
>> Few people are done for independence, it is the privilege of the powerful 
>> ones.
>> ---------------------------------------------------------------------------
>>
>> No key was wounded during the drafting of this message.
>>
>
>
>
> --
>
> Cordially.
>
> Small Eric Quotations of the days:
> ---------------------------------------------------------------------------
> If one day one reproaches you that your work is not a work of
> professional, say you that:
> Amateurs built the arch of Noah, and professionals the Titanic.
> ---------------------------------------------------------------------------
>
> Few people are done for independence, it is the privilege of the powerful 
> ones.
> ---------------------------------------------------------------------------
>
> No key was wounded during the drafting of this message.
>



-- 

Cordially.

Small Eric Quotations of the days:
---------------------------------------------------------------------------
If one day one reproaches you that your work is not a work of
professional, say you that:
Amateurs built the arch of Noah, and professionals the Titanic.
---------------------------------------------------------------------------

Few people are done for independence, it is the privilege of the powerful ones.
---------------------------------------------------------------------------

No key was wounded during the drafting of this message.
Index: FileDialog.cs
===================================================================
--- FileDialog.cs	(révision 113217)
+++ FileDialog.cs	(copie de travail)
@@ -360,6 +360,8 @@
 			mwfFileView.SelectedFileChanged += new EventHandler (OnSelectedFileChangedFileView);
 			mwfFileView.ForceDialogEnd += new EventHandler (OnForceDialogEndFileView);
 			mwfFileView.SelectedFilesChanged += new EventHandler (OnSelectedFilesChangedFileView);
+                       //Add Column click event for manual sorting. line 379
+                       mwfFileView.ColumnClick += new System.Windows.Forms.ColumnClickEventHandler(mwfFileView_ColumnClick);
 			
 			dirComboBox.DirectoryChanged += new EventHandler (OnDirectoryChangedDirComboBox);
 			popupButtonPanel.DirectoryChanged += new EventHandler (OnDirectoryChangedPopupButtonPanel);
@@ -371,8 +373,27 @@
 #else
 			form.Closed += new EventHandler (OnFileDialogFormClosed);
 #endif
-		}
+		}	
 		
+               bool AscDesc = true;
+               private void mwfFileView_ColumnClick(object sender, ColumnClickEventArgs e)
+               {
+                       try
+                       {
+                               AscDesc = !AscDesc;
+
+                               // Set the ListViewItemSorter property to a new ListViewItemComparer object.
+                               mwfFileView.ListViewItemSorter = new ListViewItemComparer(e.Column, AscDesc);
+                               // Call the sort method to manually sort.
+                               mwfFileView.Sort();
+
+                       }
+                       catch (Exception ex)
+                       {
+                               Console.WriteLine(DateTime.Now + ": " + ex.Message + Environment.NewLine + ex.StackTrace);
+                       }
+               }
+		
 		[DefaultValue(true)]
 		public bool AddExtension {
 			get {
@@ -2197,6 +2218,41 @@
 		}
 	}
 	#endregion
+	       
+       #region ListViewItemComparer Added by [EMAIL PROTECTED]
+	// Implements the manual sorting of items by column.
+	class ListViewItemComparer : IComparer
+	{
+		private int col;
+		private bool AscDescInternal;
+		public ListViewItemComparer()
+		{
+			col = 0;
+		}
+
+		public ListViewItemComparer(int column, bool AscDesc)
+		{
+			col = column;
+			AscDescInternal = AscDesc;
+		}
+		
+	       public int Compare(object x, object y)
+		{
+			int returnVal = -1;
+			if (AscDescInternal == true)
+			{
+				returnVal = String.Compare(((ListViewItem)x).SubItems[col].Text,
+				((ListViewItem)y).SubItems[col].Text);
+			}
+			else
+			{
+				returnVal = String.Compare(((ListViewItem)y).SubItems[col].Text,
+				((ListViewItem)x).SubItems[col].Text);
+                       }
+		return returnVal;
+		}
+	}
+	#endregion
 	
 	#region MWFFileView
 
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to