Old 08-09-2018, 02:44 AM   #1
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default WDL/SWELL/CoolScrollBar: How to zoom windows?

Is it possible to zoom windows, using SWELL or CoolSB?

SetScrollInfo changes the scrollbar position, but the window itself doesn't update. ScrollWindow simply scrolls left or right.

I have tried sending a WM_PAINT message myself, or InvalidateRect followed by UpdateWindow, but that doesn't seem to work.

In the case of the MIDI editor, the item chunk contains zoom and scroll values. Unfortunately, unlike other chunk values such as CC lane heights, which changes the MIDI editor appearance when the chunk is set, the zoom/scroll values are overridden and overwritten by the existing window zoom/scroll.
juliansader is offline   Reply With Quote
Old 08-12-2018, 11:40 PM   #2
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

* Win32's GetScrollInfo and SetScrollInfo don't work at all, but CoolSB's CoolSB_GetScrollInfo and CoolSB_SetScrollInfo do work. (SWS also uses only CoolSB.) Why is that?

* The following code works for scrolling (changing position), but not for zooming (changing range min and max):

Code:
// Prepare SCROLLINFO with user's min, max and pos. Will get page size later.
SCROLLINFO si = { sizeof(SCROLLINFO), SIF_PAGE, min, max, 0, position, 0 }; 

// Get page size
CoolSB_GetScrollInfo(hwnd, SB_HORZ, &si);

// Set mask to (try to) set position/scroll as well as range/zoom 
si.fMask = SIF_RANGE | SIF_POS; 

scrollOK = !!CoolSB_SetScrollInfo(hwnd, SB_HORZ, &si, TRUE)
SendMessage(hwnd, WM_HSCROLL, MAKEWPARAM(SB_THUMBPOSITION, si.nPos), NULL);
Is there any other WM_ message that should be used for zooming?
juliansader is offline   Reply With Quote
Old 08-17-2018, 08:54 AM   #3
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

I have tried to take a peek at the WM_ messages that are received by REAPER's windows when scrolling and zooming.

When scrolling, WM_HSCROLL are received, but not when zooming.

Instead, when zooming, WM_STYLECHANGED and WM_STYLECHANGING are received.
juliansader is offline   Reply With Quote
Old 08-19-2018, 12:33 PM   #4
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Some observations:
  1. scrollbar zooming handles are pressed: WM_USER+517 is sent
  2. right handle is dragged: WM_USER+514 is sent
  3. left handle is dragged: WM_USER+513 is sent




https://github.com/olilarkin/wdl-ol/...roll.h#L46-L54

Code:
// notifications sent on user actions
#define WM_SB_RESIZE (WM_USER+511)
#define WM_SB_ZOOM (WM_USER+512)
#define WM_SB_TRESIZE_HL (WM_USER+513)
#define WM_SB_TRESIZE_HR (WM_USER+514)
#define WM_SB_TRESIZE_VT (WM_USER+515)
#define WM_SB_TRESIZE_VB (WM_USER+516)
#define WM_SB_TRESIZE_START (WM_USER+517)
#define WM_SB_DBLCLK (WM_USER+518) // wParam has SB_HORZ or SB_VERT
https://github.com/olilarkin/wdl-ol/...pp#L2314-L2320
Code:
    if(wParam == HTHSCROLL)
    {
      int nThumbSize, nThumbPos;
      GetHScrollRect(sw, hwnd, &rect,NULL);
      CalcThumbSize(sb, &rect, &nThumbSize, &nThumbPos);
      SendMessage(hwnd, WM_SB_TRESIZE_START, nThumbSize, nThumbPos);
    }
https://github.com/olilarkin/wdl-ol/...roll.cpp#L2787
Code:
SendMessage(hwnd, (sw->uCurrentScrollPortion == HTSCROLL_RRESIZER?WM_SB_TRESIZE_HR:WM_SB_TRESIZE_HL), offs, ((nThumbSize&0xffff)
spk77 is offline   Reply With Quote
Old 09-17-2018, 11:22 AM   #5
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 3,714
Default

After some more unsuccessful attempts, I asked Justin himself at askjf:

Quote:
Question: Is there any way to *zoom* windows such as REAPER's MIDI editor, using SWELL? CoolSB_SetScrollInfo (followed by sending WM_HSCROLL) seems to work for scrolling but not zooming. [permalink]
Asked by Julian (192.42.116.x) on September 1 2018, 9:44pm
Reply on September 2 2018, 10:14am:

Not cleanly, better to use the actions perhaps?
So, there is not a generally applicable function to scroll SWELL windows.

For the MIDI editor, at least, there are some REAPER actions for scrolling to the time selection.

To coordinate the zoom/scroll of all open MIDI editors, one can parse the active take's chunk to get zoom/scroll info, and use GetScrollInfo() or GetClientRect() to get the size of the MIDI editor and to calculate the time range of the active MIDI editor. This range can then be applied to all other open MIDI editors.
juliansader is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.