Author Topic: Early WIP on v2.55  (Read 132823 times)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #135 on: November 08, 2018, 10:58:12 am »
Quote
... many of the new commands, will be moved to an overlay rather than menu, to be more user friendly.

In my opinion, triple nested popup menus are still user friendly enough (especially in full screen where there's no other way to use many of OR's options) while quadruple nested would be too shaky and cumbersome.

Another one of my ideas of user friendliness is having many of popup menu options duplicated in the main menu for much faster access when windowed.

Yet more user friendliness lies in being able to utilize ESC and TAB keys to the fullest. ObjReader can now ESC from the toolwindow, Z-axis rotation, full screen, and design/fancy render modes directly to the main render mode (in precisely that order) without the help of the menu. Moreover, when in a texture inspection or fancy render mode, the user can now loop through the other modes of the group (bypassing the disabled ones) with the help of TAB key, again without having to resort to the menu.

That's what I call genuine user friendliness of a GUI, my friend. And if at the same time the GUI is also a pleasure to look at, then the entire program's strong wow-factor appeals to the user to the fullest. Not every user is a pure point-and-click guy like us, you know. ::)

Quote
I could turn it into property rather than adding a new Windows style, that is a MS prerogative.

That'll be the best thing to do for all trackbars because the moment the user needs the latest thumb position value, e.g. to handle custom tooltip text for keyboard key presses, currently it isn't yet available to poll from the user code. Or we need a hypothetic skGetThumbPosition() export for genuine Windows trackbars, not only for your custom-drawn mockups. And that export must be 100% guaranteed functional and always freshly updated for trackbar keyboard control as well.
« Last Edit: November 08, 2018, 11:08:48 am by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #136 on: November 08, 2018, 11:55:14 am »
Mike

Working back on CUSTOMTIP for the new property, i found several mistakes because i have used skChild rather than the new skTip, this is what happens when i am getting too tired…
This could cause the memory allocation error you are experiencing  :-[

I shall post a new pandora with my latest changes for winmerge comparison purpose, as soon as i have got some good food :)
« Last Edit: November 08, 2018, 12:31:16 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #137 on: November 08, 2018, 12:39:35 pm »
No problem my friend, we aren't as mighty as we used to be and that's only natural. :)

Take as much time as you need to still feel fun from coding. We're in no hurry and it's our valued privilege at our age. :)

(The toolwindow's latent memory corruption seems so heavy I can't call a ChooseColor common dialog in response to the button press. The dialog crashes OR at dialog show or hide time... :'( )
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #138 on: November 08, 2018, 02:18:21 pm »
Mike

Here is the latest pandora, please do a winmerge to see the changes done to the code.

The name of the new property is
skUseCustomTip(IN HWND hWnd)

Note: when used, the TBS_TOOLTIPS style is disabled

Would you like me to send a WM_NOTIFY/TTN_NEEDTEXT from SetThumbLocation and GetThumbTrackLocation, when CustomTip is being used?

Tell me what you think?
« Last Edit: November 08, 2018, 04:03:01 pm by Michael Lobko-Lobanovsky »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #139 on: November 08, 2018, 04:02:26 pm »
DL'ed OK , now starting to merge, then will proceed with testing...

Please don't expect it to be soon. Build some nice little model for us in the meantime. :)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #140 on: November 08, 2018, 06:15:44 pm »
No Patrice,

The one and only obvious improvement is that now there seem to be no more app crashes due to memory corruption, and that is very very good! :)

SYNOPSIS
  • The TBS_TOOLTIPS style without skUseCustomTip() behaves automatically as expected in bare Windows, being responsive to both the mouse and the keyboard. Its readings polled in WM_HSCROLL with SendMessage((HWND)lParam, TBM_GETPOS, 0, 0) update correctly while the mouse hovers above, or drags, the thumb and also when the mouse hovers above the trackbar and the arrow/homing keys are pressed on the keyboard.
  • The TBS_TOOLTIPS style with skUseCustomTip() behaves like a custom tooltip text control, which means this style and this property complement each other just overriding Windows automatic readings in the tooltip with our own ones. But the problem with the keys persists exactly like it was in the old code: both the mouse and keyboard keys generate WM_HSCROLL messages but only the mouse values of thumb position are correct when polled with SendMessage(TBM_GETPOS). The thumb positions polled with this message in response to key presses appear to be one key press old: Home returns whatever was the previous position, then End returns Home position, then Home again returns End position, etc.
  • No TBS_TOOLTIPS style with skUseCustomTip() still brings the custom tooltip text on screen as in issue #2 above, which IMHO is absolutely wrong. If there's no TBS_TOOLTIP style, there should be no tooltip created at all, and consequently, neither skUseCustomTip() nor skSetCustomTipText() should have any effect whatsoever.

While issue #3 is easy to resolve, I'm seeing no progress with issue #2. We still have no means to determine the real current position of the custom-drawn thumb at all times (including WM_H/VSCROLL) by polling WinLIFT directly, rather/other than SendMessage(TBM_GETPOS). It probably goes to the trackbar too early when the thumb hasn't yet reached the new position in response to a key press, or hasn't yet updated its thumb position value.

While this nuance may not be so important for verbal/descriptive custom tooltip texts, it is absolutely essential for the accurate numeric readings of current parameter's real values.

What trackbar are you using to test your mods against? I have a feeling you're modding WinLIFT by ear following my descriptions rather than testing your mods against some real setup. My ToolWindow.h is now heavily modified as compared to what it used to be originally and I wouldn't want to incorporate it in your OR too early without my other mods.

Yet I could probably describe what minimal code you should add to your virgin ToolWindow to have a test bench to reproduce and correct issue #2 on your own machine... ???
« Last Edit: November 08, 2018, 06:31:55 pm by Michael Lobko-Lobanovsky »
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #141 on: November 08, 2018, 06:30:24 pm »
My Friend

To say the truth i have got a flu, and was coding most of the last changes with a terrible headache.

After looking again at it, it seems that
UseCustomTip should be renamed skIsCtrlUsingCustomTip and exported from the DLL.
To be able to use it with the WM_VSCROLL and WM_HSCROLL messages

Glad it has solved the memory corruption, sorry for the confusion between skChild and skTip that was my mistake :-[

Added:
Quote
What trackbar are you using to test your mods against?
The vertical straylight one  :(
...
« Last Edit: November 08, 2018, 06:35:46 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #142 on: November 08, 2018, 06:42:58 pm »
MY FRIEND,

WHY DIDN'T YOU TELL ME EARLIER YOU AREN'T FEELING WELL? :'(

This all can wait till you get better; I have other important things to do with my code, and I can live with inaccurate readings for the time being. When you tell me you're in a good shape again, I'll send you my minimal code for a virgin ToolWindow for us to be as close to the real setup as possible.

Get well soon and sorry for my being so insistent, impatient and perhaps even aggressive in the recent couple of days. :-[

Please accept my sincere apologies!
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #143 on: November 08, 2018, 07:57:01 pm »
Mike

The OR WndProc
    case WM_VSCROLL: // ML 02-01-2018: scene brightness
is incomplete, because so far it considers only the SB_THUMBPOSITION,
none of the SB_BOTTOM to SB_TOP flags are handled correctly.
https://docs.microsoft.com/en-us/windows/desktop/controls/wm-vscroll

As you said, being "point and click" guy, we never noticed the wrong value while using the keyboard arrow keys to move the slider.  :-\

Easy to solve when using SendMessage(TBM_GETPOS) rather than HIINT(wParam).

Code: [Select]
    case WM_VSCROLL: // ML 02-01-2018: scene brightness
        //zTrace(STRL(SendMessage(GetDlgItem(hWnd, IDC_BRIGHT_CONTROL), TBM_GETPOS, 0, 0)));

        //gP.rIllumFactor = (HIINT(wParam)) / -100.0f;
        hCtrl = (HWND) lParam;
        if (hCtrl == GetDlgItem(hWnd, IDC_BRIGHT_CONTROL)) {
            gP.rIllumFactor = SendMessage(hCtrl, TBM_GETPOS, 0, 0) / -100.0f;
            SCALEILLUM(0); SCALEILLUM(1); SCALEILLUM(2); SCALEILLUM(3);
            //zTrace(STRF(gP.rIllumFactor));
            if (skIsCtrlUsingCustomTip(hCtrl)) {
                swprintf_s(zTxt, strSize(zTxt), L"brightness %2.0f", gP.rIllumFactor * 100 + 0.001f);
                skSetToolTipText(hCtrl, zTxt);
            }
            gP.redraw = -1; // Redraw the OpenGL scene
        }
        break;
« Last Edit: November 08, 2018, 09:44:29 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #144 on: November 08, 2018, 09:54:47 pm »
You're dealing with trackbars rather than scrollbars, Patrice. Prefer to use TB_xxx constants here.

And note that HIINT (HIWORD actually) isn't recommended by MSDN itself.

Note also that it's exactly SendMessage(TBM_GETPOS) that  falters in WM_HSCROLL when our trackbars have custom text tooltips and the keyboard keys are pressed. :(

Get a good rest and tell me when you're ready for the ToolWindow minimum code to reproduce the glitch.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #145 on: November 08, 2018, 09:59:29 pm »
YEs i meant TB_rather than SB_ of course.
So far with the posted code that works well by me, using either the mouse or the keyboard, i got exactly what i want.

Added:
Quote
Get a good rest and tell me when you're ready for the ToolWindow minimum code to reproduce the glitch.
I can start looking at it tomorrow, thanks!
« Last Edit: November 08, 2018, 10:07:48 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #146 on: November 09, 2018, 08:44:47 am »
OK Patrice,

I hope you're feeling better today. :)

Please overwrite the DetectCtrlKey() function in Main.cpp with the this code:

void DetectCtrlKey(MSG* msg) { // MLL 11-06-2018: hide on [X] button only
    if (msg->wParam == VK_CONTROL) {
        if (msg->message == WM_KEYDOWN) {
            gP.hTool = CreateToolWindow();
        }
    }
}


and do the following:
  • Rename your existing ToolWindow.h to something else.
  • Copy the file from the zip into your project folder.
  • Press Ctrl to pop up the tool window and play with its trackbar with your mouse, keyboard keys and Reset button to ensure the regular tooltip works as expected.
  • Now uncomment the two "custom tooltip" lines 206/207 in CreateToolWindow() and do the same with a custom tooltip only to see that it works OK with the mouse but fails with the keys and Reset button as its readings lag behind one step against what they should currently be. That's what needs correction, presumably in WinLIFT.
And get well soon! :)
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #147 on: November 09, 2018, 03:15:01 pm »
Problem solved, thank you!

Doing some UI improvements before posting the result...
« Last Edit: November 09, 2018, 04:54:57 pm by Patrice Terrier »
Patrice
(Always working with the latest Windows version available...)

Patrice Terrier

  • Administrator
  • *****
  • Posts: 1980
    • zapsolution
Re: Early WIP on v2.55
« Reply #148 on: November 09, 2018, 06:57:39 pm »
Mike

About pandora i reverted back to the Quo ante status.

And the trackbar tooltips are shown/used as soon as we are calling skCreateToolTip (no need to use the TBS_TOOLTIPS style first).

I made a few changes into the ToolWindow to better see the current value setting, without having first to click on the track bar.


Here is the WM_HSCROLL used in ToolWindow.h
Code: [Select]
    case WM_HSCROLL:
        hCtrl = (HWND)lParam;
        gMinn.spotCur = SendMessage(hCtrl, TBM_GETPOS, 0, 0) * gMinn.spotStep;
        swprintf_s(zTip, strSize(zTip), L"%2.0f", gMinn.spotCur);
        skSetToolTipText(hCtrl, zTip);
        SetWindowText(GetDlgItem(hWnd, IDT_VALUE02), zTip);
        gP.redraw = -1; // request redraw
        return 0;


Here is the WM_VSCROLL used in Main.cpp
Code: [Select]
    case WM_VSCROLL: // ML 02-01-2018: scene brightness
        hCtrl = (HWND) lParam;
        if (hCtrl == GetDlgItem(hWnd, IDC_BRIGHT_CONTROL)) {
            gP.rIllumFactor = SendMessage(hCtrl, TBM_GETPOS, 0, 0) / -100.0f;
            SCALEILLUM(0); SCALEILLUM(1); SCALEILLUM(2); SCALEILLUM(3);
            swprintf_s(zTxt, strSize(zTxt), L"brightness %2.0f", gP.rIllumFactor * 100 + 0.001f);
            skSetToolTipText(hCtrl, zTxt);

            gP.redraw = -1; // Redraw the OpenGL scene
        }
        break;



« Last Edit: November 09, 2018, 07:46:52 pm by Michael Lobko-Lobanovsky »
Patrice
(Always working with the latest Windows version available...)

Michael Lobko-Lobanovsky

  • Administrator
  • *****
  • Posts: 1481
Re: Early WIP on v2.55
« Reply #149 on: November 09, 2018, 07:48:03 pm »
Thank you Patrice,

I'll try out your mods and report back a.s.a.p.
Mike
(3.6GHz Intel Core i5 Quad w/ 16GB RAM, nVidia GTX 1060Ti w/ 6GB VRAM, Windows 7 Ultimate Sp1)