tannerhelland / PhotoDemon

A free portable photo editor focused on pro-grade features, high performance, and maximum usability.
https://photodemon.org
Other
1.39k stars 203 forks source link

6.2 "Big-Ticket Items" Roadmap #89

Closed tannerhelland closed 10 years ago

tannerhelland commented 11 years ago

Because 6.0 was such a feature-heavy release, I would like 6.2 to focus more on incremental improvements and back-end updates. I would also like a much shorter release window (5-6 weeks).

With 6.0 now in feature freeze, here is a list of the significant items I plan to investigate for 6.2. A few disclaimers:

That said, here's the current roadmap.

Kroc commented 11 years ago

Re: Help docs, this is an area of interest for myself too as I wish to include help in MaSS1VE. My approach would be a side-pane in the MDI with a web-browser control, browsing web-based [HTML] documentation. Thus, one could share the same doc files on the website (good for your Google index) and in the app.

Having a side-pane on the MDI means that one can always refer to the help step-by-step at the same time as using the application, without having to alt-tab between windows. Others however may have large screens or two screens and will want to open the help in their browser, and with web-based docs that wouldn't be a problem.

One issue that would affect PD more than it does MaSS1VE is tool windows being in the way of the help pane or modal windows not allowing you to scroll the help pane. You could position the tool windows on the screen appropriately when the help pane is visible.

tannerhelland commented 11 years ago

Do you know a good way to implement an in-app HTML viewer in VB?

I do not, so my first draft will probably just spawn pages in the user's browser, which they can then deal with as they please. I'll be wrapping all help calls in a dedicated function, so if I ever crack the issue of rendering webpages inside the app itself, then I could revisit displaying it in-program, with all the pitfalls that entails.

(edited to clean up email formatting)

Kroc commented 11 years ago

I thought you would have known this already -- it's incredibly simple to embed an IE web view into VB6, Microsoft have provided an ActiveX control for decades. See http://www.vbforums.com/showthread.php?384076-Webbrowser-Control-Tip-and-Examples for some initial directions.

tannerhelland commented 11 years ago

Oh I know about the ActiveX control, but I can't use it for PD. :( VB6 OCXs are not included by default in Vista/7/8 installs - see the support statement:

http://msdn.microsoft.com/en-us/vstudio/ms788708.aspx

You must distribute/install any OCXs yourself, which is why I don't use them in PD.

Note also that if you do decide to go the OCX route, they have a number of known issues with IE10 installs (one such thread: http://answers.microsoft.com/en-us/ie/forum/ie10-windows_7/common-controls-do-not-load-in-vb6-after-ie10/484d3294-162c-41d8-b349-1c90dff9b36b)

Kroc commented 11 years ago

Oh yes, I hadn't thought about having to redistribute the OCX >.< That is a pain. I wonder if it would be possible to adapt this code to embed IE without using the OCX: http://www.codeproject.com/Articles/18417/Use-an-ActiveX-control-in-your-Win32-Project-witho But that would be a major project (embedding it would be alright -- interfacing with it in VB6 could be impossible)

tannerhelland commented 11 years ago

If anyone was to go that route, I wonder if it would be easier to hack the IE scripting interface:

http://msdn.microsoft.com/en-us/library/ms970457.aspx

I use the scripting model for my Language Editor -> Google Translate interoperability, and it's quite nice to work with. (It also uses the fully supported and installed-by-default scrrun.dll)

As you mention, interfacing with the webpage is the big problem. The scripting language allows you to spawn an IE window, with parameters for things like the size of the window, but I have no idea if those parameters affects the default IE install - quite a lot of testing would be required to make sure the user's default IE experience wasn't affected!

tannerhelland commented 11 years ago

OT: documentation for the IE scripting model:

http://msdn.microsoft.com/en-us/library/ms970457.aspx

Kroc commented 11 years ago

Thanks for the links, I may consider tackling this in the future. I definitely want some kind of embedded help before I reach 1.0.

tannerhelland commented 11 years ago

What would be REALLY nice would be a markdown/remarkable user control: pass it a string, and it renders an interactive window... (hint hint nudge nudge)

:D

Kroc commented 11 years ago

Rendering plain text manually wouldn't be difficult, DrawText could do it all in one call (it has multi-line support with word-wrapping) -- the huge issue is formatting, working out where one word ends and the next begins when changing text style, and then adding word-wrapping to that. And on top of that, how would I support system text-selection in a custom render like that? It's such a tricky problem I don't know if I would be up to the task.

We could use the RichText control, but the RTF format is rather nasty and not very portable (to other formats that is)

tannerhelland commented 11 years ago

Ugh, I didn't think of text selection. Ugly ugly stuff. I am starting to see why so many applications simply spawn a help page in the default system browser.

Here's another idea. Not sure if you've heard of the vbRichClient project (basically a project to let VB6 interface with the cairo rendering library):

http://www.vbrichclient.com/#/en/Downloads.htm

Very interesting project, with some very impressive demos. It includes a preliminary webkit wrapper that's only ~3.5mb, with an associated widget for interactions. (Large for a dependency, I know - but tiny considering it's an embedded browser.)

The problem with vbRichClient is that the core DLL must be registered on the target system. I don't know if there is a way around this, but I have been investigating that project for other reasons, so when the time comes perhaps I'll open a dialog with Olaf. (We've met peripherally through vbforums, very nice guy and very talented coder.)

Kroc commented 11 years ago

A lot of people have created rich text / HTML controls but there's just none with source that could be embedded and not that many that are free! I think I'll have to look into the CreateWindowEx approach

Kroc commented 11 years ago

I have discovered that it's very easy to create a web browser control!:

'Use an ActiveX container: http://support.microsoft.com/kb/192560
'BTW: atl.dll is shipped and supported in Vista/7/8, and probably XP
Private Declare Function AtlAxWinInit Lib "atl.dll" () As Long

Private Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" ( _
    ByVal dwExStyle As Long, _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String, _
    ByVal dwStyle As Long, _
    ByVal X As Long, _
    ByVal Y As Long, _
    ByVal nWidth As Long, _
    ByVal nHeight As Long, _
    ByVal hWndParent As Long, _
    ByVal hMenu As Long, _
    ByVal hInstance As Long, _
    lpParam As Any _
) As Long

Private Sub Form_Load()
    Call AtlAxWinInit
    'Create the web browser instance: http://forum.vingrad.ru/faq/topic-159618.html
    Call CreateWindowEx( _
        0, "AtlAxWin", "http://localhost/forums", &H40000000 Or &H10000000 Or &H40000, _
        25, 25, 640, 300, Me.hWnd, ByVal 0, App.hInstance, ByVal 0 _
    )
End Sub

Now I just need to interface with the thing! We won't need much to use this as a help browser (just Navigate and Back / Forward calls). I think there's a lot more code examples out there of how to attach an IWebBrowser2 interface to a hwnd than there are examples of creating the ActiveX control container -- that took some serious sleuthing!

Kroc commented 11 years ago

Note to self: Interfacing with this is actually super hard to work out. I've discovered through much Googling that we can use AtlAxGetControl to return an IUnknown interface, using a TypeLibrary that exposes this interface we can potentially get an Object reference from that to interface with the web browser in a late-binding fashion.

See the "Adding methods and properties at run-time with IDispatch" on this page http://www.mvps.org/emorcillo/en/code/vb6/index.shtml for details -- he very easily converts an IUnknown into an Object and I will play with this to see if I can interface with the web browser control I've created.

This is crazy-hard stuff to work out! >_<

Kroc commented 11 years ago

DONE IT!!!!!

Despite the 6-hour absolute headache of researching this, I have successfully late-bound to a web browser control (using only the hWnd) that I've made with CreateWindowEx -- no OCX!! The only drawback is that you have to distribute olelib.tlb with your source code, but it won't be required by the exe.

It's a really, really small amount of code in the end, would you believe it!

Private Sub Form_Load()
    Call AtlAxWinInit
    Let IE_hWnd = CreateWindowEx( _
        0, "AtlAxWin", "http://localhost/", &H40000000 Or &H10000000 Or &H40000, _
        25, 25, 640, 300, Me.hWnd, ByVal 0, App.hInstance, ByVal 0 _
    )
End Sub

Private Sub Command1_Click()
    Dim IUnk As Long
    Call AtlAxGetControl(IE_hWnd, IUnk)

    Dim IE As Object
    Set IE = GetObjectFromIUnknown(IUnk)

    MsgBox IE.LocationName

    Set IE = Nothing
End Sub

Public Function GetObjectFromIUnknown(ByVal ptrIUnknown As Long) As Object
    Dim objUnk As OLELIB.IUnknown

    Call CopyMemory(objUnk, ptrIUnknown, 4&)
    Set GetObjectFromIUnknown = objUnk
    Call CopyMemory(objUnk, 0&, 4&)
End Function

I'll probably work on turning what I've learned into a user control now. It won't get the browser events, but that shouldn't be necessary for a simple help browser.

Kroc commented 11 years ago

Correction: TLB is not needed :)

Kroc commented 10 years ago

Are you still looking to have help files for 6.2? I'm working on the help viewer control for MaSS1VE and if you give the go ahead I can focus on finishing up the control so you could use it for PhotoDemon. It works a the moment but lacks events and methods, which I've started to tackle.

tannerhelland commented 10 years ago

Hoo boy, that's an excellent question. I think I've finally settled on a mechanism for creating the documentation itself: Dokuwiki (https://www.dokuwiki.org/dokuwiki). I got the idea from this article (http://archive.timmmmyboy.com/2013/11/writing-collaborative-documentation-with-dokuwiki-and-github/). Not sure if you've seen dokuwiki before, but it's basically the NNF of wikis! No database, all information stored as text files, autogeneration of ToC menus based on folder layouts - for me, I think it's a good solution, especially since I still use git to track diffs.

Anyway, aside from setting up a test implementation at photodemon.org/help, I've done very little actual documenting. Since I'm getting fairly close to having a 6.2 beta ready, and I have effectively zero documentation written, I'm going to say that an in-program help viewer is not going to happen in 6.2.

So no hurry on my part, but soon I'll start playing with the control as part of solving the contextual help problem for PD. Is the MaSS1VE Issues page the best place to post feedback?