summaryrefslogtreecommitdiff
path: root/src/Xw/Xw_get_width.cxx
blob: aa65944321ac31e5eb17efc544c3cec94bb719dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

#include <Xw_Extension.h>

	/* ifdef then trace on */
#ifdef TRACE
#define TRACE_GET_WIDTH
#endif

/*
   XW_STATUS Xw_get_width (awidthmap,index,width):
   XW_EXT_WIDTHMAP *awidthmap
   int index			Line width index
   float *width			width in MM

	Get Line Width Extended widthmap WIDTH value from index . 

	Returns XW_ERROR if BadWidth Index or Width is not defined
	Returns XW_SUCCESS if Successful      

*/

#ifdef XW_PROTOTYPE
XW_STATUS Xw_get_width (void *awidthmap,int index,float *width)
#else
XW_STATUS Xw_get_width (awidthmap,index,width)
void *awidthmap;
int index ;
float *width ;
#endif /*XW_PROTOTYPE*/
{
XW_EXT_WIDTHMAP *pwidthmap = (XW_EXT_WIDTHMAP*)awidthmap;
Screen *screen ;

	if ( !Xw_isdefine_width(pwidthmap,index) ) {
	    /*ERROR*Bad Defined Width*/
	    Xw_set_error(52,"Xw_get_width",&index) ;
	    return (XW_ERROR) ;
	}

	screen = ScreenOfDisplay(_WDISPLAY,DefaultScreen(_WDISPLAY)) ;

	*width = (float)pwidthmap->widths[index] *
		(float)WidthMMOfScreen(screen)/(float)WidthOfScreen(screen) ;

#ifdef  TRACE_GET_WIDTH
if( Xw_get_trace() > 1 ) {
    printf (" Xw_get_width(%lx,%d,%f)\n",(long ) pwidthmap,index,*width) ;
}
#endif

	return (XW_SUCCESS);
}