Code Cleaning
f5324a46
Aaron Campf
committed
4 changed files
MainWindow.xaml.cs
/BExplorer/BetterExplorer/MainWindow.xaml.cs-4+6
/BExplorer/BetterExplorer/MainWindow.xaml.cs
Add comment 363 this.ShellListView.SetGroupOrder();
Add comment 364 }
Add comment 365
Add comment 366 Minus   private void SetupColumnsButton(List<Collumns> allAvailColls) {
Add comment 366 Plus   private void SetupColumnsButton() {
Add comment 367 Plus   var allAvailColls = this.ShellListView.AllAvailableColumns;
Add comment 367 368 btnMoreColls.Items.Clear();
Add comment 368 369 chcm.Items.Clear();
Add comment 369 370
Add comment 2219 2220 #region On Navigated
Add comment 2220 2221
Add comment 2221 2222 void ShellListView_Navigated(object sender, NavigatedEventArgs e) {
Add comment 2222 Minus   SetupColumnsButton(this.ShellListView.AllAvailableColumns);
Add comment 2223 Plus   SetupColumnsButton();
Add comment 2223 2224 SetSortingAndGroupingButtons();
Add comment 2224 2225 //SetUpBreadcrumbbarOnNavComplete(e);
Add comment 2225 2226
Add comment 2231 2232
Add comment 2232 2233 tcMain.isGoingBackOrForward = false;
Add comment 2233 2234
Add comment 2234 Minus  
Add comment 2235 SetupUIonNavComplete(e);
Add comment 2236
Add comment 2237 if (this.IsConsoleShown)
Add comment 2290 miRestoreALLRB.Visibility = Visibility.Collapsed;
Add comment 2291 }
Add comment 2292 int selectedItemsCount = ShellListView.GetSelectedCount();
Add comment 2293 Minus   bool IsChanged = (selectedItemsCount > 0);
Add comment 2293 Plus  
Add comment 2294 bool isFuncAvail;
Add comment 2295 if (selectedItemsCount == 1) {
Add comment 2296 isFuncAvail = ShellListView.GetFirstSelectedItem().IsFileSystem || ShellListView.CurrentFolder.ParsingName == KnownFolders.Libraries.ParsingName;
Add comment 2300 ctgFolderTools.Visibility = Visibility.Collapsed;
Add comment 2301 isFuncAvail = true;
Add comment 2302 }
Add comment 2303 Plus  
Add comment 2304 Plus   bool IsChanged = (selectedItemsCount > 0);
Add comment 2303 2305 btnCopy.IsEnabled = IsChanged;
Add comment 2304 2306 //btnPathCopy.IsEnabled = IsChanged;
Add comment 2305 2307 btnCut.IsEnabled = IsChanged;
ShellViewEx.cs
/Shell/ShellViewEx.cs-39+16
/Shell/ShellViewEx.cs
Add comment 289
Add comment 290 public String NewName { get; set; }
Add comment 291
Add comment 292 Minus   public int ItemForRename { get; set; }
Add comment 292 Plus   public int ItemForRename { get; set; } //TODO: Find out why this is used in so many places and try to stop that!!!!!
Add comment 293 Plus  
Add comment 293 294 public bool IsRenameNeeded { get; set; }
Add comment 294 295
Add comment 295 296 //public Boolean IsGroupsEnabled { get; private set; }
Add comment 573 574 private ShellItem _kpreselitem = null;
Add comment 574 575 private LVIS _IsDragSelect = 0;
Add comment 575 576 private BackgroundWorker bw = new BackgroundWorker();
Add comment 576 Minus   private ConcurrentDictionary<int, Bitmap> cache = new ConcurrentDictionary<int, Bitmap>();
Add comment 577 Plus   //private ConcurrentDictionary<int, Bitmap> cache = new ConcurrentDictionary<int, Bitmap>();
Add comment 577 578 private Thread _IconCacheLoadingThread;
Add comment 578 579
Add comment 579 580 private Bitmap ExeFallBack16;
Add comment 615 616 private ManualResetEvent resetEvent = new ManualResetEvent(true);
Add comment 616 617 private SyncQueue<int> waitingThumbnails = new SyncQueue<int>(); //3000
Add comment 617 618 private List<int> _CuttedIndexes = new List<int>();
Add comment 618 Minus   private int LastI = 0;
Add comment 619 Minus   private int CurrentI = 0;
Add comment 619 Plus   //private int LastI = 0;
Add comment 620 Plus   //private int CurrentI = 0;
Add comment 620 621 private const int SW_SHOW = 5;
Add comment 621 622 private const uint SEE_MASK_INVOKEIDLIST = 12;
Add comment 622 623 private int _LastSelectedIndexByDragDrop = -1;
Add comment 2892 2893 public void ResizeIcons(int value) {
Add comment 2893 2894 try {
Add comment 2894 2895 IconSize = value;
Add comment 2895 Minus   cache.Clear();
Add comment 2896 Plus   //cache.Clear();
Add comment 2896 2897 ThumbnailsForCacheLoad.Clear();
Add comment 2897 2898 waitingThumbnails.Clear();
Add comment 2898 2899 foreach (var obj in this.Items) {
Add comment 3027 3028 this.LastSortedColumnIndex = colIndex;
Add comment 3028 3029 this.LastSortOrder = Order;
Add comment 3029 3030 }
Add comment 3030 Minus   var i = 0;
Add comment 3031 if (Order == SortOrder.Ascending) {
Add comment 3032 this.Items = this.Items.Where(w => this.ShowHidden ? true : !w.IsHidden).OrderByDescending(o => o.IsFolder).ThenBy(o => o.GetPropertyValue(this.Collumns[colIndex].pkey, typeof(String)).Value).ToList();
Add comment 3033 }
Add comment 3035 this.Items = this.Items.Where(w => this.ShowHidden ? true : !w.IsHidden).OrderByDescending(o => o.IsFolder).ThenByDescending(o => o.GetPropertyValue(this.Collumns[colIndex].pkey, typeof(String)).Value).ToList();
Add comment 3036 }
Add comment 3037
Add comment 3038 Plus   var i = 0;
Add comment 3038 3039 this.ItemsHashed = this.Items.Distinct().ToDictionary(k => k, el => i++);
Add comment 3039 3040 User32.SendMessage(this.LVHandle, BExplorer.Shell.Interop.MSG.LVM_SETITEMCOUNT, this.Items.Count, 0);
Add comment 3040 3041 this.SetSortIcon(colIndex, Order);
Add comment 3191 3192 this.OnNavigating(new NavigatingEventArgs(destination, isInSameTab));
Add comment 3192 3193
Add comment 3193 3194 //TODO: Check the following Change
Add comment 3194 Minus   //Note: User: Aaron Campf Date: 8/9/2014 Message: The below SetSortIcon(...) seems to have no effect as it is called later
Add comment 3195 Minus   this.SetSortIcon(this.LastSortedColumnIndex, this.LastSortOrder);
Add comment 3195 Plus   //Note: User: Aaron Campf Date: 8/11/2014 Message: The below SetSortIcon(...) seems to have no effect as it is called later
Add comment 3196 Plus   //this.SetSortIcon(this.LastSortedColumnIndex, this.LastSortOrder);
Add comment 3197 Plus  
Add comment 3196 3198 this.Notifications.UnregisterChangeNotify();
Add comment 3197 Minus   //overlays.Clear();
Add comment 3198 Minus   //shieldedIcons.Clear();
Add comment 3199 Minus   cache.Clear();
Add comment 3199 Plus   //cache.Clear();
Add comment 3200 Items.Clear();
Add comment 3201 Minus   //cachedIndexes.Clear();
Add comment 3202 3201 ItemsForSubitemsUpdate.Clear();
Add comment 3203 3202 waitingThumbnails.Clear();
Add comment 3204 3203 overlayQueue.Clear();
Add comment 3205 3204 shieldQueue.Clear();
Add comment 3206 Minus   this.cache.Clear();
Add comment 3205 Plus   //this.cache.Clear();
Add comment 3207 3206 this._CuttedIndexes.Clear();
Add comment 3208 Minus   //SubItems.Clear();
Add comment 3209 Minus   CurrentI = 0;
Add comment 3210 Minus   LastI = 0;
Add comment 3211 3207
Add comment 3212 3208 Tuple<int, PROPERTYKEY, object> tmp = null;
Add comment 3213 3209 while (!SubItemValues.IsEmpty) {
Add comment 3215 3211 }
Add comment 3216 3212
Add comment 3217 3213 if (tmp != null) tmp = null;
Add comment 3218 Minus   //SubItems.Clear();
Add comment 3219 3214 User32.SendMessage(this.LVHandle, Interop.MSG.LVM_SETITEMCOUNT, 0, 0);
Add comment 3220 3215 this.ItemForRename = -1;
Add comment 3221 3216
Add comment 3227 3222 var folderSettings = new FolderSettings();
Add comment 3228 3223 var isThereSettings = LoadSettingsFromDatabase(destination, out folderSettings);
Add comment 3229 3224
Add comment 3225 Plus   //TODO: Figure out if the folder is actually sorted and we are not incorrectly setting the sort icon.
Add comment 3230 3226 this.SetSortIcon(folderSettings.SortColumn, folderSettings.SortOrder == SortOrder.None ? SortOrder.Ascending : folderSettings.SortOrder);
Add comment 3231 3227
Add comment 3232 3228 this.View = isThereSettings ? folderSettings.View : ShellViewStyle.Medium;
Add comment 3233 3229 if (folderSettings.View == ShellViewStyle.Details || folderSettings.View == ShellViewStyle.SmallIcon || folderSettings.View == ShellViewStyle.List)
Add comment 3234 3230 ResizeIcons(16);
Add comment 3235 3231
Add comment 3236 Minus   //this._IsNavigationInProgress = true;
Add comment 3237 Minus  
Add comment 3232 Plus   int CurrentI = 0, LastI = 0;
Add comment 3238 3233 foreach (var Shell in destination) {
Add comment 3239 3234 F.Application.DoEvents();
Add comment 3240 3235 if (this.Items.Count > 0 && this.Items.Last().Parent != Shell.Parent) {
Add comment 3252 3247 }
Add comment 3253 3248 }
Add comment 3254 3249
Add comment 3255 Minus  
Add comment 3256 Minus   //this._IsNavigationInProgress = false;
Add comment 3257 Minus  
Add comment 3258 Minus   //if (isThereSettings && folderSettings.SortColumn != null) {
Add comment 3259 3250 if (isThereSettings) {
Add comment 3260 3251 SetSortCollumn(folderSettings.SortColumn, folderSettings.SortOrder, false);
Add comment 3261 3252 }
Add comment 3266 3257 this.Items = this.Items.OrderByDescending(o => o.IsFolder).ThenBy(o => o.DisplayName).ToList();
Add comment 3267 3258 }
Add comment 3268 3259
Add comment 3269 Minus   //if (!(isThereSettings && folderSettings.SortColumn != null))
Add comment 3270 Minus  
Add comment 3271 3260 if (!isThereSettings) {
Add comment 3272 3261 var i = 0;
Add comment 3273 3262 this.ItemsHashed = this.Items.Distinct().ToDictionary(k => k, el => i++);
Add comment 3278 3267 if (!isThereSettings) {
Add comment 3279 3268 this.LastSortedColumnIndex = 0;
Add comment 3280 3269 this.LastSortOrder = SortOrder.Ascending;
Add comment 3281 Minus   //this.SetSortIcon(this.LastSortedColumnIndex, this.LastSortOrder);
Add comment 3282 3270 }
Add comment 3283 3271
Add comment 3284 3272
Add comment 3285 3273 Notifications.RegisterChangeNotify(this.Handle, destination, true);
Add comment 3286 Minus   /*
Add comment 3287 Minus   try {
Add comment 3288 Minus   History.Add(destination);
Add comment 3289 Minus   }
Add comment 3290 Minus   catch { }
Add comment 3291 Minus   */
Add comment 3292 Minus   //if (!(isThereSettings && folderSettings.SortColumn != null))
Add comment 3274 Plus  
Add comment 3293 3275 if (!isThereSettings)
Add comment 3294 3276 User32.SendMessage(this.LVHandle, Interop.MSG.LVM_SETITEMCOUNT, this.Items.Count, 0);
Add comment 3295 3277 if (IsGroupsEnabled) {
Add comment 3298 3280 GenerateGroupsFromColumn(this.Collumns.First());
Add comment 3299 3281 }
Add comment 3300 3282
Add comment 3301 Minus   //dest.Dispose();
Add comment 3302 Minus  
Add comment 3303 Minus  
Add comment 3304 3283 var NavArgs = new NavigatedEventArgs(destination, this.CurrentFolder, isInSameTab);
Add comment 3305 3284 this.CurrentFolder = destination;
Add comment 3306 3285 this.OnNavigated(NavArgs);
Add comment 3307 3286
Add comment 3308 Minus   //IsDoubleNavFinished = false;
Add comment 3309 3287 //AutosizeAllColumns(this.View != ShellViewStyle.Details ? -2 : -1);
Add comment 3310 3288
Add comment 3311 3289 //if (this.View != ShellViewStyle.Details)
Add comment 3338 3316 }
Add comment 3339 3317
Add comment 3340 3318 public void EnableGroups() {
Add comment 3341 Minus   VirtualGrouping g = new VirtualGrouping(this);
Add comment 3319 Plus   var g = new VirtualGrouping(this);
Add comment 3342 3320
Add comment 3343 3321 const int LVM_SETOWNERDATACALLBACK = 0x10BB;
Add comment 3344 3322 IntPtr ptr = Marshal.GetComInterfaceForObject(g, typeof(IOwnerDataCallback));
Add comment 3345 3323 var x = User32.SendMessage(this.LVHandle, LVM_SETOWNERDATACALLBACK, ptr, IntPtr.Zero);
Add comment 3346 Minus   //System.Diagnostics.Debug.WriteLine(x);
Add comment 3347 3324 Marshal.Release(ptr);
Add comment 3348 3325
Add comment 3349 3326 const int LVM_ENABLEGROUPVIEW = 0x1000 + 157;
BetterExplorer1.psess
/BetterExplorer1.psess+3
/BetterExplorer1.psess
Add comment 89 <Report>
Add comment 90 <Path>BetterExplorer140811.vsp</Path>
Add comment 91 </Report>
Add comment 92 Plus   <Report>
Add comment 93 Plus   <Path>BetterExplorer140811(1).vsp</Path>
Add comment 94 Plus   </Report>
Add comment 92 95 </Reports>
Add comment 93 96 <Launches>
Add comment 94 97 <ProjBinary>
BetterExplorer140811(1).vsp
/BetterExplorer140811(1).vsp
/BetterExplorer140811(1).vsp