Ejemplo n.º 1
0
void SViewport( IRect *view )

{
	int xmin = view->xmin;
	int ymin = view->ymin;
	int xmax = view->xmax;
	int ymax = view->ymax;

	YMin = ymin;
	YMax = ymax;

	QViewport( xmin , ymin , xmax , ymax );
	QWindow( (float) xmin , (float) ymin , (float) xmax , (float) ymax );
}
Ejemplo n.º 2
0
int JasonQt_QML::Tool::devicePixelRatio(void)
{
    return QWindow().devicePixelRatio();
}
Ejemplo n.º 3
0
void QGraphInit( void )

{
    int dummy;

    XSizeHints myhint;
    XWMHints   mywmhint;
    XWindowAttributes   myattrib;

    if(MyDisplayName == NULL)
	MyDisplayName = NullName;
    if(MyTitle == NULL)
	MyTitle = MyText;

    if(MyWidget)
        MyDisplay  = XtDisplay(MyWidget);
    else
        MyDisplay  = XOpenDisplay(MyDisplayName);

    MyScreen   = DefaultScreen(MyDisplay);
    MyRootWindow = DefaultRootWindow(MyDisplay);
    MyDepth = XDefaultDepth(MyDisplay,MyScreen);

    MyBackGround  = WhitePixel(MyDisplay,MyScreen);
    MyForeGround  = BlackPixel(MyDisplay,MyScreen);
    MyBorderColor = MyForeGround;

#ifdef grid_width
    MyIcon = XCreatePixmapFromBitmapData(
                        MyDisplay,MyRootWindow,
                        (char *) grid_bits,grid_width,grid_height,
                        MyForeGround,MyBackGround,1);
#endif

    myhint.x = XMinPix;
    myhint.y = YMinPix;
    myhint.width  = XMaxPix - XMinPix + 1;
    myhint.height = YMaxPix - YMinPix + 1;
    myhint.flags  = PPosition | PSize;

    mywmhint.flags = InputHint | IconPixmapHint;
    mywmhint.input = True;
    mywmhint.icon_pixmap = MyIcon;

    if(MyWidget)
        MyWindow = XtWindow(MyWidget);
    else {
        MyWindow = XCreateSimpleWindow(MyDisplay,MyRootWindow
                ,myhint.x,myhint.y,myhint.width,myhint.height
                ,MyBorder,MyBorderColor,MyBackGround);
        XSetStandardProperties(MyDisplay,MyWindow,MyTitle,MyTitle
                ,MyIcon,MyCommand,1,&myhint);
        XSetWMHints(MyDisplay,MyWindow,&mywmhint);
    }

    MyGc = XCreateGC(MyDisplay,MyWindow,0,0);
    XSetBackground(MyDisplay,MyGc,MyBackGround);
    XSetForeground(MyDisplay,MyGc,MyForeGround);

/*    MyCursor=XCreateFontCursor(MyDisplay,XC_cross); */
/*    MyCursor=XCreateFontCursor(MyDisplay,XC_crosshair); */
    MyCursor=XCreateFontCursor(MyDisplay,XC_top_left_arrow);
    XDefineCursor(MyDisplay,MyWindow,MyCursor);

    XSetFillRule(MyDisplay,MyGc,WindingRule); /* p. 178 */
    XSetFillStyle(MyDisplay,MyGc,FillSolid); /* p. 195 */
    XSetFunction(MyDisplay,MyGc,GXcopy); /* p. 158 */
    XSetLineAttributes(MyDisplay,MyGc,MyLineWidth,LineSolid
			,CapRound,JoinRound); /* p. 158 */

    XSelectInput(MyDisplay,MyWindow,
                    ButtonPressMask | KeyPressMask | ExposureMask 
		  | StructureNotifyMask );

    MyFontStruct = XLoadQueryFont(MyDisplay,"fixed");
    if(MyFontStruct == 0) {
        printf("Cannot load font\n");
        exit(1);
    }
    XSetFont(MyDisplay,MyGc,MyFontStruct->fid);
    XTextExtents(MyFontStruct,"M",1,&dummy,&MyFontAscent,&MyFontDescent,
			&MyCharStruct);

    QInitColors();

    if( !MyWidget ) {
        XMapRaised(MyDisplay,MyWindow);
        XSync(MyDisplay,0); /* wait till window is raised and ready */
    }

    Initialized = 1;

    /* Viewport is total window */

    XGetWindowAttributes( MyDisplay , MyWindow , &myattrib );

    QViewport( 0 , 0 , myattrib.width , myattrib.height );
    QWindow( 0. , 0. , 1. , 1. );
}