コード例 #1
0
void Settings::setBrowser(QString value)
{
    if (getBrowser() != value) {
        settings.setValue("browser", value);
        emit browserChanged();
    }
}
コード例 #2
0
ファイル: gvscene.cpp プロジェクト: deepmatrix/blaxxun-cc3d
GvBool
GvScene::read(GvInput *in)
{
    // push scene
    GvScene *current = in->getScene();
   
	in->setScene(this);  // set the current scene 
	
	ASSERT(getBrowser() != NULL);


	// in->setUrl(GetUrl());
	
    in->pushNameSpace(&nameSpace);

    
    GvBool ret = children.readValueList(in,EOF); // EOF
    
    children.setDefault(FALSE);

    in->popNameSpace();


    // pop scene
    //setCurrent(current);
	
	in->setScene(current);

    vrml2.set(in->isVrml2());



    return(ret);

}
コード例 #3
0
// send bind message to browser
void GvViewpoint::set_bind(GvSFBool *bind)
{
    TRACE("%s::set_bind \n",ClassName());
	GView *view = (GView*) getBrowser();

	ASSERT(view != NULL);

	if (view)
		view->BindViewpoint(this,*bind);
}
コード例 #4
0
void VlcPluginBase::event_callback(const libvlc_event_t* event,
                NPVariant *npparams, uint32_t npcount)
{
#if defined(XP_UNIX) || defined(XP_WIN)
    events.callback(event, npparams, npcount);
    NPN_PluginThreadAsyncCall(getBrowser(), eventAsync, this);
#else
#   warning NPN_PluginThreadAsyncCall not implemented yet.
    printf("No NPN_PluginThreadAsyncCall(), doing nothing.\n");
#endif
}
コード例 #5
0
ファイル: gvscene.cpp プロジェクト: deepmatrix/blaxxun-cc3d
// create a NodeInstace given classname and using protos classes
GvNode* GvScene::
createNodeInstance(const GvName &className)
{
	GvNode* instance;

	// is there a proto defined for this name ? 
	instance = createProtoInstance(className);
	if (instance) return(instance);

	instance = createInstanceFromName(className,isVrml2());
	if (instance) instance->setBrowser(getBrowser());
	return(instance);
}
コード例 #6
0
ファイル: gvscene.cpp プロジェクト: deepmatrix/blaxxun-cc3d
// try to create a ProtoInstance node of scene Proto with name classname
GvNode *
GvScene::createProtoInstance(const GvName &className)
{
    GvProto* proto = nameSpace.findProto(className);
    if (!proto) {	 // no proto found
        return(NULL);
    }
    GvNode		*instance;
	instance = proto->createInstance();
	if (instance) instance->setBrowser(getBrowser());
	// TRACE("GvScene::CreateProtoInstance : %s \n",className.getString());
	return(instance);
}
コード例 #7
0
ファイル: gvscene.cpp プロジェクト: deepmatrix/blaxxun-cc3d
// parse the string and build new scene
GvScene* GvScene::createVrmlFromString(char *vrmlSyntax,GReporter *reporter)
{
	GvScene *scene=new GvScene();

	scene->setBrowser(getBrowser());
	ASSERT(scene->getBrowser() != NULL);	

	scene->vrml2.set(TRUE);
	scene->worldUrl = this->worldUrl;
	scene->baseUrl = this->baseUrl; // wrong get baseUrl from script node 


	GvInput in;
	in.setScene(scene);
	
	in.setSrc("createVrmlFromString");

    in.setString(vrmlSyntax);
	in.version = 2.0;
	in.vrml2 = 1;
	
	if (reporter) {
	   in.setReporter(reporter);
	   in.reportErrors = TRUE;
	}	


#ifndef _DEBUG
	// in.reportErrors = FALSE;
#endif


    in.pushNameSpace(&this->nameSpace); // push this scene on name space to resolve PROTOS 

    in.pushNameSpace(&scene->nameSpace); // push new scene, for new node names

   
    GvBool ret = scene->children.readValueList(&in,EOF); 

    scene->children.setDefault(FALSE);

    in.popNameSpace();
    in.popNameSpace();


	return scene;
}
コード例 #8
0
void *NavigatePlugin::processEvent(Event *e)
{
#ifdef WIN32
    if (e->type() == EventGetURL){
        string *url = (string*)(e->param());
        *url = getCurrentUrl();
        return e->param();
    }
#endif
    if (e->type() == EventGoURL){
        string url = (const char*)(e->param());
        string proto;
        if (url.length() == 0)
            return NULL;
        int n = url.find(':');
        if (n < 0){
            proto = "http";
            url = proto + "://" + url;
        }else{
            proto = url.substr(0, n);
            if ((proto != "http") &&
                    (proto != "https") &&
                    (proto != "ftp") &&
                    (proto != "file") &&
                    (proto != "mailto"))
                return NULL;
        }
#ifdef WIN32
        bool bExec = false;
        if (getNewWindow()){
            string key_name = proto;
            key_name += "\\Shell\\Open";
            RegEntry rp(HKEY_CLASSES_ROOT, key_name.c_str());
            string prg    = rp.value("command");
            string action = rp.value("ddeexec");
            string topic  = rp.value("ddeexec\\Topic");
            string server = rp.value("ddeexec\\Application");
            if (!action.empty()){
                int pos = action.find("%1");
                if (pos >= 0)
                    action = action.substr(0, pos) + url + action.substr(pos + 2);
                pos = prg.find("%1");
                if (pos >= 0)
                    prg = prg.substr(0, pos) + url + prg.substr(pos + 2);
                if (!prg.empty()){
                    STARTUPINFOA si;
                    PROCESS_INFORMATION pi;
                    ZeroMemory(&si, sizeof(si));
                    si.cb = sizeof(si);
                    ZeroMemory(&pi, sizeof(pi));
                    if (CreateProcessA(NULL, (char*)prg.c_str(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)){
                        WaitForInputIdle(pi.hProcess, INFINITE);
                        CloseHandle(pi.hProcess);
                        CloseHandle(pi.hThread);
                    }
                }
                DDEbase b;
                DDEconversation conv(server.c_str(), topic.c_str());
                if (conv.Execute(action.c_str()))
                    bExec = true;
            }
        }
        if (!bExec){
            if (proto == "file")
                url = url.substr(5);
            ShellExecuteA(NULL, NULL, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
        }
#else
        ExecParam execParam;
        if (proto == "mailto"){
            execParam.cmd = getMailer();
            url = url.substr(proto.length() + 1);
        }else{
            execParam.cmd = getBrowser();
        }
        execParam.arg = url.c_str();
        Event eExec(EventExec, &execParam);
        eExec.process();
#endif
        return e->param();
    }
    if (e->type() == EventEncodeText){
        QString *text = (QString*)(e->param());
        *text = parseUrl(*text);
        return e->param();
    }
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdMail){
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact == NULL)
                return NULL;
            QString mails = contact->getEMails();
            if (mails.length() == 0)
                return NULL;
            int nMails = 0;
            while (mails.length()){
                getToken(mails, ';');
                nMails++;
            }
            cmd->popup_id = (nMails <= 1) ? 0 : MenuMail;
            return e->param();
        }
        if (cmd->id == CmdMailList){
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact == NULL)
                return NULL;
            QString mails = contact->getEMails();
            if (mails.length() == 0)
                return NULL;
            int nMails = 0;
            while (mails.length()){
                getToken(mails, ';');
                nMails++;
            }
            CommandDef *cmds = new CommandDef[nMails + 1];
            unsigned n = 0;
            mails = contact->getEMails();
            while (mails.length()){
                QString mail = getToken(mails, ';', false);
                mail = getToken(mail, '/');
                cmds[n] = *cmd;
                cmds[n].id = CmdMailList + n;
                cmds[n].flags = COMMAND_DEFAULT;
                cmds[n].text_wrk = strdup(mail.utf8());
                n++;
            }
            memset(&cmds[n], 0, sizeof(CommandDef));
            cmd->param = cmds;
            cmd->flags |= COMMAND_RECURSIVE;
            return e->param();
        }
    }
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdMail){
            QString mail;
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact)
                mail = contact->getEMails();
            mail = getToken(mail, ';', false);
            mail = getToken(mail, '/');
            if (mail.length()){
                string addr = "mailto:";
                addr += mail.local8Bit();
                Event eMail(EventGoURL, (void*)addr.c_str());
                eMail.process();
            }
            return e->param();
        }
        if (cmd->menu_id == MenuMail){
            unsigned n = cmd->id - CmdMailList;
            QString mails;
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact)
                mails = contact->getEMails();
            while (mails.length()){
                QString mail = getToken(mails, ';', false);
                if (n-- == 0){
                    mail = getToken(mail, '/');
                    if (mail.length()){
                        string addr = "mailto:";
                        addr += mail.local8Bit();
                        Event eMail(EventGoURL, (void*)addr.c_str());
                        eMail.process();
                    }
                    break;
                }
            }
            return e->param();
        }
    }
    return NULL;
}
コード例 #9
0
ファイル: FBVLC_Win.cpp プロジェクト: RSATom/WebChimera
bool FBVLC_Win::onRefreshEvent( FB::RefreshEvent *evt, FB::PluginWindowlessWin* w )
{
    HDC hDC = w->getHDC();
    FB::Rect fbRect = evt->bounds;

    RECT Rect = { fbRect.left, fbRect.top, fbRect.right, fbRect.bottom };
    FillRect( hDC, &Rect, m_hBgBrush );

    boost::lock_guard<boost::mutex> lock( m_frame_guard );

    const unsigned media_width = vlc::vmem::width();
    const unsigned media_height = vlc::vmem::height();

    if( m_frame_buf ) {
        assert( m_frame_buf->size() >= media_width * media_height * vlc::DEF_PIXEL_BYTES );

        BITMAPINFO BmpInfo; ZeroMemory( &BmpInfo, sizeof( BmpInfo ) );
        BITMAPINFOHEADER& BmpH = BmpInfo.bmiHeader;
        BmpH.biSize = sizeof( BITMAPINFOHEADER );
        BmpH.biWidth = media_width;
        BmpH.biHeight = -( ( int ) media_height );
        BmpH.biPlanes = 1;
        BmpH.biBitCount = vlc::DEF_PIXEL_BYTES * 8;
        BmpH.biCompression = BI_RGB;
        //following members are already zeroed
        //BmpH.biSizeImage = 0;
        //BmpH.biXPelsPerMeter = 0;
        //BmpH.biYPelsPerMeter = 0;
        //BmpH.biClrUsed = 0;
        //BmpH.biClrImportant = 0;

        FB::Rect wrect;
        if( getBrowser() == "IE" )
            wrect = fbRect;
        else
            wrect = w->getWindowPosition();

        if( m_use_native_scaling ) {
            const float src_aspect = ( float ) media_width / media_height;
            const float dst_aspect = ( float ) w->getWindowWidth() / w->getWindowHeight();
            unsigned dst_media_width = w->getWindowWidth();
            unsigned dst_media_height = w->getWindowHeight();
            if( src_aspect > dst_aspect ) {
                if( w->getWindowWidth() != media_width ) { //don't scale if size equal
                    dst_media_height = static_cast<unsigned>( w->getWindowWidth() / src_aspect + 0.5 );
                } else {
                    dst_media_height = media_height;
                }
            }
            else {
                if( w->getWindowHeight() != media_height ) { //don't scale if size equal
                    dst_media_width = static_cast<unsigned>( w->getWindowHeight() * src_aspect + 0.5 );
                } else {
                    dst_media_width = media_width;
                }
            }

            SetStretchBltMode( hDC, COLORONCOLOR );
            BOOL r =
                StretchDIBits( hDC,
                               wrect.left + ( w->getWindowWidth() - dst_media_width ) / 2,
                               wrect.top + ( w->getWindowHeight() - dst_media_height ) / 2,
                               dst_media_width, dst_media_height,
                               0, 0,
                               media_width, media_height,
                               &( *m_frame_buf )[0],
                               &BmpInfo, DIB_RGB_COLORS, SRCCOPY );
        } else {
            BOOL r =
                SetDIBitsToDevice( hDC,
                                   wrect.left + ( w->getWindowWidth() - media_width ) / 2,
                                   wrect.top + ( w->getWindowHeight() - media_height ) / 2,
                                   media_width, media_height,
                                   0, 0,
                                   0, media_height,
                                   &( *m_frame_buf )[0],
                                   &BmpInfo, DIB_RGB_COLORS );
        }
    }

    return true;
}
コード例 #10
0
void *NavigatePlugin::processEvent(Event *e)
{
    if (e->type() == EventGoURL){
        string url = (const char*)(e->param());
        string proto;
        if (url.length() == 0)
            return NULL;
        int n = url.find(':');
        if (n < 0){
            proto = "http";
            url = proto + "://" + url;
        }else{
            proto = url.substr(0, n);
            if ((proto != "http") &&
                    (proto != "https") &&
                    (proto != "ftp") &&
                    (proto != "file") &&
                    (proto != "mailto"))
                return NULL;
        }
#ifdef WIN32
        ShellExecuteA(NULL, NULL, url.c_str(), NULL, NULL, SW_SHOWNORMAL);
#else
        ExecParam execParam;
        if (proto == "mailto"){
            execParam.cmd = getMailer();
            url = url.substr(proto.length() + 1);
        }else{
            execParam.cmd = getBrowser();
        }
        execParam.arg = url.c_str();
        Event eExec(EventExec, &execParam);
        eExec.process();
#endif
        return e->param();
    }
    if (e->type() == EventEncodeText){
        QString *text = (QString*)(e->param());
        *text = parseUrl(*text);
        return e->param();
    }
    if (e->type() == EventCheckState){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdMail){
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact == NULL)
                return NULL;
            QString mails = contact->getEMails();
            if (mails.length() == 0)
                return NULL;
            int nMails = 0;
            while (mails.length()){
                getToken(mails, ';');
                nMails++;
            }
            cmd->popup_id = (nMails <= 1) ? 0 : MenuMail;
            return e->param();
        }
        if (cmd->id == CmdMailList){
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact == NULL)
                return NULL;
            QString mails = contact->getEMails();
            if (mails.length() == 0)
                return NULL;
            int nMails = 0;
            while (mails.length()){
                getToken(mails, ';');
                nMails++;
            }
            CommandDef *cmds = new CommandDef[nMails + 1];
            unsigned n = 0;
            mails = contact->getEMails();
            while (mails.length()){
                QString mail = getToken(mails, ';', false);
                mail = getToken(mail, '/');
                cmds[n] = *cmd;
                cmds[n].id = CmdMailList + n;
                cmds[n].flags = COMMAND_DEFAULT;
                cmds[n].text_wrk = strdup(mail.utf8());
                n++;
            }
            memset(&cmds[n], 0, sizeof(CommandDef));
            cmd->param = cmds;
            cmd->flags |= COMMAND_RECURSIVE;
            return e->param();
        }
    }
    if (e->type() == EventCommandExec){
        CommandDef *cmd = (CommandDef*)(e->param());
        if (cmd->id == CmdMail){
            QString mail;
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact)
                mail = contact->getEMails();
            mail = getToken(mail, ';', false);
            mail = getToken(mail, '/');
            if (mail.length()){
                string addr = "mailto:";
                addr += mail.local8Bit();
                Event eMail(EventGoURL, (void*)addr.c_str());
                eMail.process();
            }
            return e->param();
        }
        if (cmd->menu_id == MenuMail){
            unsigned n = cmd->id - CmdMailList;
            QString mails;
            Contact *contact = getContacts()->contact((unsigned long)(cmd->param));
            if (contact)
                mails = contact->getEMails();
            while (mails.length()){
                QString mail = getToken(mails, ';', false);
                if (n-- == 0){
                    mail = getToken(mail, '/');
                    if (mail.length()){
                        string addr = "mailto:";
                        addr += mail.local8Bit();
                        Event eMail(EventGoURL, (void*)addr.c_str());
                        eMail.process();
                    }
                    break;
                }
            }
            return e->param();
        }
    }
    return NULL;
}