model_server/driver_aset/src/dialog_scroll.cxx
//------------------------------------------
// set_horiz_scrollbar_value
//
// Set the position of the rightmost edge of the horizontal thumb.
//------------------------------------------
set_horiz_scrollbar_value
Set the position of the rightmost edge of the horizontal thumb.
set_horiz_scrollbar_value Set the position of the rightmost edge of the horizontal thumb .
void dialog::set_horiz_scrollbar_value(int view_num, int val)
{
    Initialize(dialog::set_horiz_scrollbar_value);
    if((view_num >= 0) && (view_num < max_view_num()))
    {
	Widget hscroll = Widget(get_horz_scroll(view_num));
	if (hscroll)
	    ui_set_scroll_value(hscroll, val);
	Widget panner = Widget(get_panner(view_num));
	if(panner)
	{
	    int min = 0, max = 100;
	    ui_get_scroll_range (hscroll, &min, &max);
	    float factor = 100.0 / (max > min ? max - min : 1);
	    int x0, y0, w, h, cx, cy, cw, ch;
	    Panner_values(panner, &x0, &y0, &w, &h, &cx, &cy, &cw, &ch);
	    cx = val - cw;
	    if (cx < 0)
		cx = 0;
	    if (cx > 100)
		cx = 100;
	    Panner_perspective(panner, 0, 0, 100, 100,
			       (int)(cx * factor), cy, cw, ch);
	}
    }
    Return
}
void dialog :: set_horiz_scrollbar_value ( int view_num , int val ) { Initialize ( dialog :: set_horiz_scrollbar_value ) ; if ( ( view_num >= 0 ) && ( view_num < max_view_num ( ) ) ) { Widget hscroll = Widget ( get_horz_scroll ( view_num ) ) ; if ( hscroll ) ui_set_scroll_value ( hscroll , val ) ; Widget panner = Widget ( get_panner ( view_num ) ) ; if ( panner ) { int min = 0 , max = 100 ; ui_get_scroll_range ( hscroll , & min , & max ) ; float factor = 100.0 / ( max > min ? max - min : 1 ) ; int x0 , y0 , w , h , cx , cy , cw , ch ; Panner_values ( panner , & x0 , & y0 , & w , & h , & cx , & cy , & cw , & ch ) ; cx = val - cw ; if ( cx < 0 ) cx = 0 ; if ( cx > 100 ) cx = 100 ; Panner_perspective ( panner , 0 , 0 , 100 , 100 , ( int ) ( cx * factor ) , cy , cw , ch ) ; } } Return }
set_horiz_scrollbar_value
Set the position of the rightmost edge of the horizontal thumb.
set_horiz_scrollbar_value Set the position of the rightmost edge of the horizontal thumb .
// The x position varies between the thumb width and 100 // EXCEPT when the graphic is smaller in width than the // viewer.  Then the thumb width is 100 and val = 0;