sylikc / jpegview

Fork of JPEGView by David Kleiner - fast and highly configurable viewer/editor for JPEG, BMP, PNG, WEBP, TGA, GIF and TIFF images with a minimal GUI. Basic on-the-fly image processing is provided - allowing adjusting typical parameters as sharpness, color balance, rotation, perspective, contrast and local under-/overexposure.
Other
2.14k stars 125 forks source link

"next image" does not follow windows explorer "sort by" preference. #18

Open dante987 opened 3 years ago

dante987 commented 3 years ago

No matter what i select, be it Sort by: Name or Type or Size or Date modified etc., the next image using jpegview is always the same. How can i make it so that "next image" always follows windows explorer "sort by" preference. Please help.

Bobbsterman commented 3 years ago

It does not follow the Windows Explorer "sort by" preference, nor should it. It has it's own sorting options. To find it, open an image in JPEGView ⇒ right click anywhere ⇒ look for "Display Order" ⇒ choose the sorting option you want.

dante987 commented 3 years ago

I wish "Display Order" ⇒ "folder preference" was also an option there. Its more convenient that way.

sylikc commented 3 years ago

Unfortunately, I don't even know if this is possible. While Windows Photo Viewer observes the "sort by" preference in a folder, I'm guessing it does it because it's tightly integrated with the Explorer process.

I don't know of any external apps which have this feature. If there is one, perhaps if it's open source, it'd be easier to figure out what APIs to call to read Windows Explorer's sort preference for a particular folder.

It would be nice to have... it was probably one of the first things I noticed when moving to JPEGView years ago.

dante987 commented 3 years ago

"ImageGlass" is a software which has this feature. ig

sylikc commented 3 years ago

hmmmmmmmmmmm let me look into that when I have time... perhaps perusing the ImageGlass source for stuff to put into JPEGView might be a good idea. Both are GPL licensed

sylikc commented 1 year ago

@dante987 I looked into this... even ImageGlass' implementation has caveats... like you have to keep the Explorer window open, and some sorting doesn't work etc

TetraTheta commented 4 months ago

I haven't looked into JPEGView's source code, but here is an information that might be useful.

Windows Explorer sorts files with StrCmpLogicalW(string, string) function in shlwapi.dll and it should be available from Windows XP.

From what I know, you can provide 'comparer' function as third argument in Sort() function. This might be usable.

Here is C# code that I use in various places like PowerShell, C# etc.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
namespace NaturalSort {
  public static class NaturalSort {
    [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
    public static extern int StrCmpLogicalW(string psz1, string psz2);
    public static System.Collections.ArrayList Sort(System.Collections.ArrayList foo) {
      foo.Sort(new NaturalStringComparer());
      return foo;
    }
  }
  public class NaturalStringComparer : IComparer {
    public int Compare(object x, object y) {
      return NaturalSort.StrCmpLogicalW(x.ToString(), y.ToString());
    }
  }
}