Ejemplo n.º 1
0
void XMLMenuCheckBox::ReadFromXML( TiXmlElement* element )
{
	TiXmlAttribute* attrib = element->FirstAttribute();
		
	while( attrib )
	{
		if( strcmp( attrib->Name(), "image_on" ) == 0 )
		{
			m_imageOnName = const_cast< char* >( attrib->Value() );
		}
		else if( strcmp( attrib->Name(), "image_off" ) == 0 )
		{
			m_imageOffName = const_cast< char* >( attrib->Value() );
		}
		else if( strcmp( attrib->Name(), "text_id" ) == 0 )
		{
			m_textID = const_cast< char* >( attrib->Value() );
		}
		else
		{
			setAttribs( attrib->Name(), const_cast< char* >( attrib->Value() ) );
		}

		attrib = attrib->Next();
	}
}
Ejemplo n.º 2
0
/*****************************************************************
CLASS: QtGuiToolBarPrivate
*****************************************************************/
void QtGuiToolBarPrivate::create(QWidget *parent)
{
  if (parent->inherits("QMainWindow"))
    widget_=toolbar_=new QToolBar((QMainWindow*)parent,name_);
  else
    widget_=new QWidget();
  setAttribs();
  QTGUI_DO_ITEMS(QtGuiDialogItem,item_,create(widget_))
}
Ejemplo n.º 3
0
TMsg::TMsg(int iface, SPtr<TIPv6Addr> addr, int msgType)
    :pkt(0), NotifyScripts(NULL)
{
    long tmp = rand() % (255*255*255);
    setAttribs(iface,addr,msgType,tmp);

    if (msgType == LEASEQUERY_MSG) {
      MsgSize=getSize();
    }

}
Ejemplo n.º 4
0
TMsg::TMsg(int iface, SPtr<TIPv6Addr> addr, char* &buf, int &bufSize)
    :pkt(0), NotifyScripts(NULL)
{
    setAttribs(iface, addr, 0, 0);
    if (bufSize<4)
	return;
    this->MsgType=buf[0];
    unsigned char * buf2 = (unsigned char *)(buf+1);
    this->TransID= ((long)buf2[0])<<16 | ((long)buf2[1])<<8 | (long)buf2[2];
    buf+=4; bufSize-=4;
}
Ejemplo n.º 5
0
TMsg::TMsg(int iface, SPtr<TIPv6Addr> addr, char * &buf, int msgType, int  &bufSize)
    :pkt(0), NotifyScripts(NULL)
{

    this->Bulk = true;

    if (bufSize<6)
    return;
    this->MsgType=msgType;
    this->MsgSize=buf[0]*256+buf[1];
    unsigned char * buf2 = (unsigned char *)(buf+3);
    this->TransID= ((long)buf2[0])<<16 | ((long)buf2[1])<<8 | (long)buf2[2];
    buf+=6; bufSize-=6;

    setAttribs(iface, addr,msgType,this->TransID);

}
Ejemplo n.º 6
0
void XMLMenuLabel::ReadFromXML( TiXmlElement* element )
{
    TiXmlAttribute* attrib = element->FirstAttribute();

    while( attrib )
    {
        if( strcmp( attrib->Name(), "text_id" ) == 0 )
        {
            m_textID = const_cast< char* >( attrib->Value() );
        }
        else if( strcmp( attrib->Name(), "underlined" ) == 0 )
        {
            m_underlined = XMLMenuHelper::charToBool( const_cast< char* >( attrib->Value() ) );
        }
        else if( strcmp( attrib->Name(), "back_button" ) == 0 )
        {
            m_backButton = XMLMenuHelper::charToBool( const_cast< char* >( attrib->Value() ) );
        }
        else if( strcmp( attrib->Name(), "fontsize" ) == 0 )
        {
            sscanf( attrib->Value(), "%d", &m_fontSize );
        }
        else if( strcmp( attrib->Name(), "alignment" ) == 0 )
        {
            m_alignment = XMLMenuHelper::convertAlignmentStrToInt( attrib->Value() );
        }
        else if( strcmp( attrib->Name(), "inputtextbox" ) == 0 )
        {
            m_isInputBox = XMLMenuHelper::charToBool( const_cast< char* >( attrib->Value() ) );
        }
        else
        {
            setAttribs( attrib->Name(), const_cast< char* >( attrib->Value() ) );
        }

        attrib = attrib->Next();
    }
}
Ejemplo n.º 7
0
//TMsg(iface, addr, buf, bufSize)
TMsg::TMsg(int iface, SPtr<TIPv6Addr> addr, int msgType,  long transID)
    :NotifyScripts(NULL)
{
    setAttribs(iface,addr,msgType,transID);
}
Ejemplo n.º 8
0
TMsg::TMsg(int iface, SPtr<TIPv6Addr> addr, int msgType)
    :NotifyScripts(NULL)
{
    long tmp = rand() % (255*255*255);
    setAttribs(iface,addr,msgType,tmp);
}
Ejemplo n.º 9
0
void
OSGLContext_win::createGLContext(const FramebufferConfig& pixelFormatAttrs,
                                 int major,
                                 int minor,
                                 bool coreProfile,
                                 const GLRendererID &rendererID,
                                 const OSGLContext_win* shareContext)
{
    const OSGLContext_wgl_data* wglInfo = appPTR->getWGLData();

    assert(wglInfo);
    if (!wglInfo) {
        throw std::invalid_argument("No wgl info");
    }
    bool useNVGPUAffinity = rendererID.rendererHandle && wglInfo->NV_gpu_affinity;
    if (useNVGPUAffinity) {
        HGPUNV GpuMask[2] = {(HGPUNV)rendererID.rendererHandle, NULL};
        _dc = wglInfo->CreateAffinityDCNV(GpuMask);
    } else {
        _dc = GetDC(_windowHandle);
    }
    if (!_dc) {
        throw std::runtime_error("WGL: Failed to retrieve DC for window");
    }


    std::vector<FramebufferConfig> usableConfigs;
    int nativeCount = 0, usableCount = 0;

    if (wglInfo->ARB_pixel_format) {
        nativeCount = getPixelFormatAttrib(wglInfo, 1, WGL_NUMBER_PIXEL_FORMATS_ARB);
    } else {
        nativeCount = DescribePixelFormat(_dc, 1, sizeof(PIXELFORMATDESCRIPTOR), NULL);
    }

    usableConfigs.resize(nativeCount);

    for (int i = 0; i < nativeCount; ++i) {
        const int n = i + 1;
        FramebufferConfig& u = usableConfigs[usableCount];

        if (wglInfo->ARB_pixel_format) {
            // Get pixel format attributes through "modern" extension

            if ( !getPixelFormatAttrib(wglInfo, n, WGL_SUPPORT_OPENGL_ARB) ||
                 !getPixelFormatAttrib(wglInfo, n, WGL_DRAW_TO_WINDOW_ARB) ) {
                continue;
            }

            if (getPixelFormatAttrib(wglInfo, n, WGL_PIXEL_TYPE_ARB) != WGL_TYPE_RGBA_ARB) {
                continue;
            }

            if (getPixelFormatAttrib(wglInfo, n, WGL_ACCELERATION_ARB) == WGL_NO_ACCELERATION_ARB) {
                continue;
            }

            u.redBits = getPixelFormatAttrib(wglInfo, n, WGL_RED_BITS_ARB);
            u.greenBits = getPixelFormatAttrib(wglInfo, n, WGL_GREEN_BITS_ARB);
            u.blueBits = getPixelFormatAttrib(wglInfo, n, WGL_BLUE_BITS_ARB);
            u.alphaBits = getPixelFormatAttrib(wglInfo, n, WGL_ALPHA_BITS_ARB);

            u.depthBits = getPixelFormatAttrib(wglInfo, n, WGL_DEPTH_BITS_ARB);
            u.stencilBits = getPixelFormatAttrib(wglInfo, n, WGL_STENCIL_BITS_ARB);

            u.accumRedBits = getPixelFormatAttrib(wglInfo, n, WGL_ACCUM_RED_BITS_ARB);
            u.accumGreenBits = getPixelFormatAttrib(wglInfo, n, WGL_ACCUM_GREEN_BITS_ARB);
            u.accumBlueBits = getPixelFormatAttrib(wglInfo, n, WGL_ACCUM_BLUE_BITS_ARB);
            u.accumAlphaBits = getPixelFormatAttrib(wglInfo, n, WGL_ACCUM_ALPHA_BITS_ARB);

            u.auxBuffers = getPixelFormatAttrib(wglInfo, n, WGL_AUX_BUFFERS_ARB);

            if ( getPixelFormatAttrib(wglInfo, n, WGL_STEREO_ARB) ) {
                u.stereo = GL_TRUE;
            }
            if ( getPixelFormatAttrib(wglInfo, n, WGL_DOUBLE_BUFFER_ARB) ) {
                u.doublebuffer = GL_TRUE;
            }

            if (wglInfo->ARB_multisample) {
                u.samples = getPixelFormatAttrib(wglInfo, n, WGL_SAMPLES_ARB);
            }

            if (wglInfo->ARB_framebuffer_sRGB ||  wglInfo->EXT_framebuffer_sRGB) {
                if ( getPixelFormatAttrib(wglInfo, n, WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB) ) {
                    u.sRGB = GL_TRUE;
                }
            }
        } else {
            PIXELFORMATDESCRIPTOR pfd;

            // Get pixel format attributes through legacy PFDs

            if ( !DescribePixelFormat(_dc, n, sizeof(PIXELFORMATDESCRIPTOR), &pfd) ) {
                continue;
            }

            if ( !(pfd.dwFlags & PFD_DRAW_TO_WINDOW) || !(pfd.dwFlags & PFD_SUPPORT_OPENGL) ) {
                continue;
            }

            if ( !(pfd.dwFlags & PFD_GENERIC_ACCELERATED) && (pfd.dwFlags & PFD_GENERIC_FORMAT) ) {
                continue;
            }

            if (pfd.iPixelType != PFD_TYPE_RGBA) {
                continue;
            }

            u.redBits = pfd.cRedBits;
            u.greenBits = pfd.cGreenBits;
            u.blueBits = pfd.cBlueBits;
            u.alphaBits = pfd.cAlphaBits;

            u.depthBits = pfd.cDepthBits;
            u.stencilBits = pfd.cStencilBits;

            u.accumRedBits = pfd.cAccumRedBits;
            u.accumGreenBits = pfd.cAccumGreenBits;
            u.accumBlueBits = pfd.cAccumBlueBits;
            u.accumAlphaBits = pfd.cAccumAlphaBits;

            u.auxBuffers = pfd.cAuxBuffers;

            if (pfd.dwFlags & PFD_STEREO) {
                u.stereo = GL_TRUE;
            }
            if (pfd.dwFlags & PFD_DOUBLEBUFFER) {
                u.doublebuffer = GL_TRUE;
            }
        }

        u.handle = n;
        ++usableCount;
    }

    if (!usableCount) {
        throw std::runtime_error("WGL: The driver does not appear to support OpenGL");
    }
    FramebufferConfig closestConfig = OSGLContext::chooseFBConfig(pixelFormatAttrs, usableConfigs, usableCount);
    int pixelFormat = closestConfig.handle;
    PIXELFORMATDESCRIPTOR pfd;
    HGLRC share = shareContext ? shareContext->_handle : 0;

    if ( !DescribePixelFormat(_dc, pixelFormat, sizeof(pfd), &pfd) ) {
        throw std::runtime_error("WGL: Failed to retrieve PFD for selected pixel format");
    }

    if ( !SetPixelFormat(_dc, pixelFormat, &pfd) ) {
        throw std::runtime_error("WGL: Failed to set selected pixel format");
    }


    if (useNVGPUAffinity) {
        _handle = wglInfo->CreateContext(_dc);
    } else if ( (rendererID.renderID > 0) && wglInfo->AMD_gpu_association ) {
        std::vector<int> attribs;
        setAttribs(major, minor, coreProfile, attribs);
        _handle = wglInfo->CreateAssociatedContextAttribsAMD( (UINT)rendererID.renderID, share, &attribs[0] );
    } else if (wglInfo->ARB_create_context) {
        std::vector<int> attribs;
        setAttribs(major, minor, coreProfile, attribs);
        _handle = wglInfo->CreateContextAttribsARB(_dc, share, &attribs[0]);
    } else {
        _handle = wglInfo->CreateContext(_dc);
    }

    if (!_handle) {
        throw std::runtime_error("WGL: Failed to create OpenGL context");
    }
} // createGLContext