RPR GetHZoomLevel

From CockosWiki

(Difference between revisions)
Jump to: navigation, search
(Examples)
(C++)
 
Line 9: Line 9:
==Examples==
==Examples==
===C++===
===C++===
-
<source lang=cpp>
+
<source lang=cpp highlight=6>
 +
void SetHorizPos(HWND hwnd, double dPos, double dOffset = 0.0)
 +
{
 +
SCROLLINFO si = { sizeof(SCROLLINFO), };
 +
si.fMask = SIF_ALL;
 +
CoolSB_GetScrollInfo(hwnd, SB_HORZ, &si);
 +
si.nPos = (int)(dPos * GetHZoomLevel());
 +
if (dOffset)
 +
si.nPos -= (int)(dOffset * si.nPage);
 +
CoolSB_SetScrollInfo(hwnd, SB_HORZ, &si, true);
 +
SendMessage(hwnd, WM_HSCROLL, SB_THUMBPOSITION, NULL);
 +
}
</source>
</source>
 +
===Perl===
===Perl===
<source lang=perl>
<source lang=perl>

Latest revision as of 22:20, 11 February 2010

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetHZoomLevel
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetHZoomLevel

Contents

GetHZoomLevel()

double GetHZoomLevel()

Get the horizontal zoom level.

Parameters

Returns

double - The horizontal zoom level in pixels per second

Examples

C++

void SetHorizPos(HWND hwnd, double dPos, double dOffset = 0.0)
{
	SCROLLINFO si = { sizeof(SCROLLINFO), };
	si.fMask = SIF_ALL;
	CoolSB_GetScrollInfo(hwnd, SB_HORZ, &si);
	si.nPos = (int)(dPos * GetHZoomLevel());	if (dOffset)
		si.nPos -= (int)(dOffset * si.nPage);
	CoolSB_SetScrollInfo(hwnd, SB_HORZ, &si, true);
	SendMessage(hwnd, WM_HSCROLL, SB_THUMBPOSITION, NULL);
}

Perl

 

Python

 

See Also

Stuff

Main Page > REAPER Documentation > ReaScript > ReaScript API, Functions > RPR GetHZoomLevel
Main Page > REAPER Documentation > REAPER API > REAPER API Functions > RPR GetHZoomLevel