RickStrahl / MarkdownMonster

An extensible Markdown Editor, Viewer and Weblog Publisher for Windows
https://markdownmonster.west-wind.com
Other
1.59k stars 236 forks source link

Folder Browser: Double click on image file causes error #189

Closed HeyJoel closed 7 years ago

HeyJoel commented 7 years ago

Using the new Folder Browser feature, if I double click on an image file I get an exception:

09/05/2017 09:50:29 - Last Resort Handler
Markdown Monster v1.3.6.0
10.0.14393.1066.amd64fre.rs1_release_sec.170327-1835 - en-GB - NET 4.6.2 - 32 bit
---
System
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start()
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at MarkdownMonster.mmFileUtils.OpenImageInImageEditor(String imageFile) in C:\projects2010\MarkdownMonster\MarkdownMonster\_Classes\Utilities\mmFileUtils.cs:line 384
   at MarkdownMonster.Windows.FolderBrowerSidebar.OpenFile(String file) in C:\projects2010\MarkdownMonster\MarkdownMonster\Windows\FolderBrowserSidebar\FolderBrowerSidebar.xaml.cs:line 316
   at MarkdownMonster.Windows.FolderBrowerSidebar.HandleSelection() in C:\projects2010\MarkdownMonster\MarkdownMonster\Windows\FolderBrowserSidebar\FolderBrowerSidebar.xaml.cs:line 251
   at MarkdownMonster.Windows.FolderBrowerSidebar.TreeViewItem_MouseDoubleClick(Object sender, MouseButtonEventArgs e) in C:\projects2010\MarkdownMonster\MarkdownMonster\Windows\FolderBrowserSidebar\FolderBrowerSidebar.xaml.cs:line 339
   at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawMouseActions actions, Int32 x, Int32 y, Int32 wheel)
   at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr hwnd, WindowMessage msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
   at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
---------------------------

You've indicated this might be to do with my image editor settings, which I think is true because the default value when installed is "C:\Program Files\paint.net\PaintDotNet.exe", which I don't have installed. I haven't used the image editor features yet so I was expecting the image to just open as a preview in the windows photo app, which is what happens if I right click the image and select Open File With Shell. Some message here to say I haven't configured my image editor correctly would be better.

For my use case I would prefer a preview rather than an editor anyway, since I use photoshop for editing photos and it can take a while to load and isn't good for previewing. This isn't a problem for me though as I'm happy work around it, so its just for your feedback.

RickStrahl commented 7 years ago

Can you check this in 1.3.7 please? I added additional checks for the execution of the image editor and it does show a dialog and opens the configuration for you now.

RickStrahl commented 7 years ago

FWIW you can specify which image 'editor' to use - so if you'd rather preview then just put the ath to PhotoViewer (or whatever) in the ImageEditor key in the Settings.

HeyJoel commented 7 years ago

So that popup message works great, but if I want to configure the app to use the built-in windows photo viewer that is registered with the shell I get an error. It took me a while to track down the exe because I think it's a store app and I had to locate it using the current running process, the location is "C:\Program Files\WindowsApps\Microsoft.Windows.Photos_17.425.10010.0_x64__8wekyb3d8bbwe\Microsoft.Photos.exe" and the error is from windows defender smartscreen, followed by the same MM "unable to launch.." popup.

If I change it to paint.exe it works fine. That's ok for me but from a UX point of view that feels like a little more work than you'd expect. My initial thoughts were that this should behave in a similar way to file explorer, e.g. defer to your shell to open the file with whatever app I have set up but I see that that could be annoying if you did indeed want to edit the file. An additional option in the right click menu to edit the file would also mimic the explorer behaviour. However I haven't road tested the folder browser a great deal yet and I don't use the image editor elsewhere in MM so take from this what you will.

RickStrahl commented 7 years ago

Yeah, i think the best thing would be for the default to be an 'empty' field and pick whatever the Windows default is for image viewing/editing.

I think the disconnect here is mainly between viewing and editing images. Personally I think it's more important to have image EDITING available in an easy way over seeing images. I think for image viewing in the folder browser the ideal UI will be to show the image as a thumbnail as you hover over the file and maybe seperate menu options for View/Edit Image on the menu.

RickStrahl commented 7 years ago

Ok... so added a few enhancements here that should help with all of this. Thanks for these suggestions as they make for some great improvements I think:

Here's the previewer:

image

and here's is the menu when over a selected image:

image

I've pushed this up to the download page in version 1.3.7.3 and later.

HeyJoel commented 7 years ago

I had a quick play around with this and it looks great! My only feedback would be:

  1. For large images such as full-size screen shots I expected the size to be constrained, especially since I can double click to open in photo viewer. I could see that some may prefer a full size preview so this could be down to preference.
  2. I expected the preview to be left anchored to the mouse pointer, but I could see that making it right aligned allows you to see more of the markdown editor. Again I think this is just my preference, or maybe just my initial expectation (perhaps once I used it for a while I'd prefer it that way...).
  3. A thin border might be appropriate for the preview as you have with the right click menu to make it pop out better with dark/light images over dark/light backgrounds.

Excellent work!

RickStrahl commented 7 years ago

Yeah I am still trying to figure out how to render the popup window properly. The behavior is mostly driven by the underlying Popup control that's displaying the popup. The good news and why I'm still using it at this point is that it automatically handles placement so that it's not partially obscured if at the edges of the screen which is pretty nice.

As to sizing I'm having some issue with the pop up control as it will not do proper auto-sizing. Set any bounds and everything will size to those bounds so 16px images blow up to say 600px which looks terrible... There will be some changes to this coming yet. Ideally I see the preview somewhere in the 600-800px range.

RickStrahl commented 7 years ago

If made a few tweaks - border was a great idea to offset. Thumbnails now are constrained to 600px or so. Really small icons look like shit (under 100px), but otherwise things look pretty good. Going any smaller and there's too much detail loss in larger images especially screenshots they become a mess.

Updated in 1.3.8.