示例#1
0
void GuideManager::nextStep(int step)
{
    CCLOG("step = %d",step);

    const StepInfo& stepInfo = m_vecStep.at(step);
    
    if (getWait())
    {
        return;
    }
    
    if (isLimit(stepInfo))
    {
        return;
    }
    
    m_guideLayer->removeFromParent();
    getParent()->addChild(m_guideLayer, GUIDE_LAYER_ZORDER);
    
    if (stepInfo.getNextStepId() == END)
    {
        endGuide();
        return;
    }
    else if (stepInfo.getNextStepId() == WAIT)
    {
        setWait(true);
    }
    else if (stepInfo.getNextStepId() == SLEEP)
    {
        getGuideLayer()->sleep();
    }
    else if (stepInfo.getNextStepId() == WAKE)
    {
        getGuideLayer()->wake();
    }
    
    
    // by order
    checkDialog(stepInfo);
    checkRect(stepInfo);
    checkTalk(stepInfo);
    checkHand(stepInfo);
    checkEvent(stepInfo);
    
    setNextStepId(step + 1);
}
示例#2
0
bool MdpCtrl::setInfo(RotatorBase* r,
        const utils::PipeArgs& args,
        const utils::ScreenInfo& info)
{
    // new request
    utils::Whf whf(args.whf);
    mOVInfo.id = MSMFB_NEW_REQUEST;

    updateSource(r, args, info);

    setUserData(0);
    mOVInfo.alpha = 0xff;
    mOVInfo.transp_mask = 0xffffffff;
    setZ(args.zorder);
    setFlags(args.mdpFlags);
    setWait(args.wait);
    setIsFg(args.isFg);
    mSize = whf.size;
    return true;
}
示例#3
0
void GuideManager::handleEvent(cocos2d::EventCustom* event)
{
    void* userdata = event->getUserData();
    if (userdata)
    {
        setParent((Node*)userdata);
    }
    
    if (event->getEventName() == GUIDE_EVENT_TOUCH_IN_RECT)
    {
        nextStep(getNextStepId());
    }
    else if (event->getEventName() == GUIDE_EVENT_BEGIN_GUIDE)
    {
        nextStep(0); // test here
    }
    else if (event->getEventName() == GUIDE_EVENT_CONTENUE)
    {
        setWait(false);
        nextStep(getNextStepId());
    }
    else
    {}
}
/**-------------------------------------------------------------------------------------------
// reads a dictionary entry
// description:
//      reads a dictionary entry from an other canopen device.
//------------------------------------------------------------------------------------------*/
void CANFestivalGui::canopenDictRead( )
{
    unsigned short tempIndex;
    char            tempSubIndex;
    char            data[SDO_MAX_DOMAIN_LEN];

    // sets all values to 0
    for( int i=0; i<SDO_MAX_DOMAIN_LEN; i++ )
        data[i] = 0;

    // converts the data filds from the gui into integer values
    // as far as i know: when reading dict. entries no values are sent to the slave...
//    for( int i=0; i<getLength( canopenDictDataList ); i++ ) {
//        if( canopenDictHexFormat->isChecked( ) ) {
//            data[i] = strtol( canopenDictDataList.at( i )->text( ), NULL, 16 );
//        } else if( canopenDictBinFormat->isChecked( ) ) {
//            data[i] = strtol( canopenDictDataList.at( i )->text( ), NULL, 2 );
//        } else {
//            data[i] = canopenDictDataList.at( i )->text( ).toInt( );
//        }
//    }

    // gets and converts the indexnumber of the dictionary entry
    if( ui->canopenDictHexFormat->isChecked( ) ) {
        tempIndex = strtol( ui->canopenDictIndex->text( ).toStdString().c_str(), NULL, 16 );
    } else if( ui->canopenDictBinFormat->isChecked( ) ) {
        tempIndex = strtol( ui->canopenDictIndex->text( ).toStdString().c_str(), NULL, 2 );
    } else {
        tempIndex = ui->canopenDictIndex->text( ).toInt( );
    }

    // gets and converts the subindexnumber of the dictionary entry
    if( ui->canopenDictHexFormat->isChecked( ) ) {
        tempSubIndex = strtol( ui->canopenDictSubIndex->text( ).toStdString().c_str(), NULL, 16 );
    } else if( ui->canopenDictBinFormat->isChecked( ) ) {
        tempSubIndex = strtol( ui->canopenDictSubIndex->text( ).toStdString().c_str(), NULL, 2 );
    } else {
        tempSubIndex = ui->canopenDictSubIndex->text( ).toInt( );
    }

    // temporary stops the thread which sniffes the can-bus (this thread reads all received can-bus
    // messages and shows them in the logwindow)
    if( mLogThread )
        mLogThread->getSem( );
    // set f_can_receive to block (so reading the canbus blocks until a message was received)
    int tempWait = getWait( );
    setWait( 1 );

    // calls the function of canopenmatic which performs the rest for us...
    if( ReadDictionaryEntry( 0,
                         ui->canopenDictDeviceId->text( ).toInt( ),
                         tempIndex,
                         tempSubIndex,
                         data ) == 0 )
    {   // if read of dictionary entry was successful...
        QString intValue;
        QString textValue;
        QString hexValue;

        textValue = "Text: ";
        intValue = "Int: ";
        hexValue = "Hex: ";

        char text[5];

        // processes the received data, so it is useful for the user. after processing the data are shown in the gui
        //
        for( int i=0; i<SDO_MAX_DOMAIN_LEN; i++ ) {
            sprintf( text, "%.2d|", data[i] );
            intValue.append( text );
            sprintf( text, "%c", data[i] );
            textValue.append( text );
            sprintf( text, "%.2x|", data[i] );
            hexValue.append( text );
        }
        QMessageBox::information( this, "Dictionary Read Result (integer)", intValue + "\n" + textValue + "\n" + hexValue );
    }
    // sets the read/write flag (blocking or non-blocking) to the previous value
    setWait( tempWait );
    if( mLogThread )
        mLogThread->putSem( );
}
Widget CChangeCPPFieldPermissionsAction::GetAttributesArea(Widget parent, symbolPtr* pSym) {
	XmString labelStr;
	
	string result;
	string command;

	setWait(true);

	// get current attributes of the entity
	string id = prepareQuery(CEntityInfo::etag(pSym));
	command = string("printformat \"1 %s\t%s\t%s\" public protected private;print ") + id;
	CEntityInfo::exec(command,result);
	CQueryResult Attributes; 
	Attributes.parse(result); 	
	TRecord* pRecord = *Attributes.getStartRecord();
	Boolean bPublic = *(*pRecord)[1]=="1";
	Boolean bProtected = *(*pRecord)[2]=="1";
	Boolean bPrivate = *(*pRecord)[3]=="1";
	Boolean bConst = false;
	Boolean bStatic = false;

	CEntityInfo::exec("source_dis impacts.dis", result);
	
	command = "IsConst " + id;
	CEntityInfo::exec(command, result);
	if (result.find("1") != -1 ) {
		bConst = true;
	}

	command = "IsStatic " + id;
	CEntityInfo::exec(command, result);
	if (result.find("1") != -1 ) {
		bStatic = true;
	}

	Widget fullArea = XtVaCreateWidget("area",
			xmRowColumnWidgetClass, parent,
			XmNwidth, 290,
			NULL);
	

	Widget border = XtVaCreateManagedWidget("etchedBorder",
			xmFrameWidgetClass, fullArea,
			XmNshadowType, XmSHADOW_ETCHED_IN,
			NULL);
	Widget permissionsArea = XmCreateRadioBox(border,"permisArea",NULL,0);
	m_publicInd = XtVaCreateManagedWidget("Public",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_publicInd,bPublic,true);
	XtAddCallback(m_publicInd,XmNvalueChangedCallback,OnPermissionChanged,this);
	m_protectedInd = XtVaCreateManagedWidget("Protected",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_protectedInd,bProtected,true);
	XtAddCallback(m_protectedInd,XmNvalueChangedCallback,OnPermissionChanged,this);
	m_privateInd = XtVaCreateManagedWidget("Private",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_privateInd,bPrivate,true);
	XtAddCallback(m_privateInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	m_constInd = XtVaCreateManagedWidget("Const",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_constInd,bConst,true);


	m_staticInd = XtVaCreateManagedWidget("Static",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_staticInd,bStatic,true);

	XtManageChild(permissionsArea);

	setWait(false);
		
	return fullArea;	
}
Widget CRemoveFieldAction::GetAttributesArea(Widget parent, symbolPtr* pSym){
	XmString labelStr;
	Widget area = XtVaCreateWidget("area", 
		xmFormWidgetClass, parent,
		XmNwidth, 300,
		XmNheight, 30,
		XmNnumColumns, 2,
		XmNpacking, XmPACK_COLUMN,
		XmNorientation, XmVERTICAL,
		NULL);
	string result;
	string command;
	string id = prepareQuery(CEntityInfo::etag(pSym));

	setWait(true);
	CEntityInfo::exec("printformat \"%s\t%s\" cname etag",result);

	if(CEntityInfo::language(pSym).compare("JAVA"))  // For Java we also need to retrieve static fields ("uses -var")!
		command = string("sort [set_subtract [set_union [get_member_data ") + id + string("] [uses -var ") + id + 
				string("]] [set_copy ") + id + string("]]");
	else 
		command = string("sort [set_subtract [get_member_data ") + id + string("] [set_copy ") + id + string("]]");
	CEntityInfo::exec(command,result);
	m_pFields = new CQueryResult(); 
	m_pFields->parse(result); 	
	if(m_pFields->getRecordsCount()>0) {	// if we have something to remove - display it
		labelStr = XmStringCreateLocalized("Field:");
		Widget labelWidget = XtVaCreateManagedWidget("label_1",xmLabelGadgetClass, area,
			XmNlabelString, labelStr,
			XmNwidth, 100,
			XmNtopAttachment,XmATTACH_FORM, 
			XmNleftAttachment,XmATTACH_FORM,
			XmNbottomAttachment,XmATTACH_FORM, 
			NULL);
		XmStringFree(labelStr);
		m_FieldsList = XtVaCreateManagedWidget("fieldslist",
			        dtComboBoxWidgetClass, area,
				XmNtopAttachment,XmATTACH_FORM, 
				XmNleftAttachment,XmATTACH_WIDGET,
				XmNleftWidget, labelWidget,
				XmNrightAttachment,XmATTACH_FORM, 
				XmNbottomAttachment,XmATTACH_FORM, 
				NULL);

		TRecordSetIterator iter = m_pFields->getStartRecord();
		TRecordSetIterator end = m_pFields->getEndRecord();
		while(iter!=end) {
			TRecord* pRecord = *iter;
			labelStr = XmStringCreateLocalized((char*)(*pRecord)[1]->c_str());
			DtComboBoxAddItem(m_FieldsList, labelStr, 0, false);
			XmStringFree(labelStr);
			iter++;
		}
	} else { // otherwise display a message
		labelStr = XmStringCreateLocalized("Nothing to remove.");
		Widget labelWidget = XtVaCreateManagedWidget("label_1",xmLabelGadgetClass, area,
			XmNlabelString, labelStr,
			XmNwidth, 100,
			XmNtopAttachment,XmATTACH_FORM, 
			XmNleftAttachment,XmATTACH_FORM,
			XmNbottomAttachment,XmATTACH_FORM, 
			XmNrightAttachment,XmATTACH_FORM, 
			NULL);
		XmStringFree(labelStr);
	}

	setWait(false);
	
	return area;
}
Widget CDeleteVariableAction::GetAttributesArea(Widget parent, symbolPtr* pSym){

	XmString labelStr;
	Widget area = XtVaCreateWidget("area", 
		xmFormWidgetClass, parent,
		XmNwidth, 450,
		XmNheight, 30,
		XmNnumColumns, 2,
		XmNpacking, XmPACK_COLUMN,
		XmNorientation, XmVERTICAL,
		NULL);
	string result;
	string command;
	string id = prepareQuery(CEntityInfo::etag(pSym));
	setWait(true);

	CEntityInfo::exec("printformat \"%s\t%s\" name etag;", result);
	command = string("GetFunctionsUsingLocal " + id);
       
	CEntityInfo::exec("source_dis impacts.dis", result);
	CEntityInfo::exec(command,result);
	m_pClasses = new CQueryResult(); 

	string cleanResult;
	cleanResult = m_pClasses->cleanUpResult(result, "(funct)");

	if (cleanResult.size() >= 1) {
		m_pClasses->parse(cleanResult); 	
		if(m_pClasses->getRecordsCount()>0 ) {
			labelStr = XmStringCreateLocalized("Functions:");
			Widget labelWidget = XtVaCreateManagedWidget("label_1",xmLabelGadgetClass, area,
				XmNlabelString, labelStr,
				XmNwidth, 100,
				XmNtopAttachment,XmATTACH_FORM, 
				XmNleftAttachment,XmATTACH_FORM,
				XmNbottomAttachment,XmATTACH_FORM, 
				NULL);
			XmStringFree(labelStr);
			m_ClassesList = XtVaCreateManagedWidget("Functions",
				        dtComboBoxWidgetClass, area,
					XmNtopAttachment,XmATTACH_FORM, 
					XmNleftAttachment,XmATTACH_WIDGET,
					XmNleftWidget, labelWidget,
					XmNrightAttachment,XmATTACH_FORM, 
					XmNbottomAttachment,XmATTACH_FORM, 
					NULL);

			TRecordSetIterator iter = m_pClasses->getStartRecord();
			TRecordSetIterator end = m_pClasses->getEndRecord();
			while(iter!=end) {
				TRecord* pRecord = *iter;
				labelStr = XmStringCreateLocalized((char*)(*pRecord)[1]->c_str());
				DtComboBoxAddItem(m_ClassesList, labelStr, 0, false);
				XmStringFree(labelStr);
				iter++;
			} //while
			setWait(false);
			return area;
		}
		setWait(false);
	}  else {
		XmString labelStr;
	 	labelStr = XmStringCreateLocalized("Deleting this variable requires changing the the functions arguments.\nPlease run Change Arguments instead.");
		Widget labelWidget = 
			XtVaCreateManagedWidget("label_1", xmLabelGadgetClass, area, 		
			XmNlabelString, labelStr,
			XmNwidth, 150,
			XmNtopAttachment, XmATTACH_FORM,
			XmNleftAttachment, XmATTACH_FORM,
			XmNbottomAttachment, XmATTACH_FORM,
			XmNrightAttachment, XmATTACH_FORM,
			NULL);
		XmStringFree(labelStr);
	}

	setWait(false);
	return area;
}
Widget CChangeJavaFunctionPermissionsAction::GetAttributesArea(Widget parent, symbolPtr* pSym) {
	XmString labelStr;
	
	string result;
	string isClassFinalStr;
	string command;

	setWait(true);

	// get current attributes of the entity
	string id = prepareQuery(CEntityInfo::etag(pSym));
	command = string("printformat \"1 %s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\" public protected package_prot private abstract final static native;print ") + id;
	CEntityInfo::exec(command,result);
	CQueryResult Attributes; 
	Attributes.parse(result); 	
	TRecord* pRecord = *Attributes.getStartRecord();
	Boolean bPublic = *(*pRecord)[1]=="1";
	Boolean bProtected = *(*pRecord)[2]=="1";
	Boolean bPackage = *(*pRecord)[3]=="1";
	Boolean bPrivate = *(*pRecord)[4]=="1";

	// check to see if the class the function belongs to is final.
	// if so, then set final to true, and prohibit deselecting it
	command = string("final [ GetClassOf ") + id + string(" ] ");
	CEntityInfo::exec("source_dis impacts.dis", isClassFinalStr);
	CEntityInfo::exec(command, isClassFinalStr);
	
	Boolean bAbstract = *(*pRecord)[5]=="1";
	Boolean bFinal = *(*pRecord)[6]=="1";
	if (isClassFinalStr.compare("1\n") == 0) {
		bFinal = true;
		CChangeJavaFunctionPermissionsAction::isClassFinal = true;
	} else {
		CChangeJavaFunctionPermissionsAction::isClassFinal = false;
	}
	Boolean bStatic = *(*pRecord)[7]=="1";
	Boolean bNative = *(*pRecord)[8]=="1";

	Widget fullArea = XtVaCreateWidget("area",
			xmRowColumnWidgetClass, parent,
			XmNwidth, 290,
			NULL);
	

	Widget border = XtVaCreateManagedWidget("etchedBorder",
			xmFrameWidgetClass, fullArea,
			XmNshadowType, XmSHADOW_ETCHED_IN,
			NULL);
	Widget permissionsArea = XmCreateRadioBox(border,"permisArea",NULL,0);
	m_publicInd = XtVaCreateManagedWidget("Public",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_publicInd,bPublic,true);
	XtAddCallback(m_publicInd,XmNvalueChangedCallback,OnPermissionChanged,this);
	m_protectedInd = XtVaCreateManagedWidget("Protected",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_protectedInd,bProtected,true);
	XtAddCallback(m_protectedInd,XmNvalueChangedCallback,OnPermissionChanged,this);
	m_packageInd = XtVaCreateManagedWidget("\"Package\"",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_packageInd,bPackage,true);
	XtAddCallback(m_packageInd,XmNvalueChangedCallback,OnPermissionChanged,this);
	m_privateInd = XtVaCreateManagedWidget("Private",
			xmToggleButtonGadgetClass,permissionsArea,
			NULL);
	XmToggleButtonGadgetSetState(m_privateInd,bPrivate,true);
	XtAddCallback(m_privateInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	m_abstractInd = XtVaCreateManagedWidget("Abstract",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_abstractInd,bAbstract,true);
	XtAddCallback(m_abstractInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	m_staticInd = XtVaCreateManagedWidget("Static",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_staticInd,bStatic,true);
	XtAddCallback(m_staticInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	m_finalInd = XtVaCreateManagedWidget("Final",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_finalInd,bFinal,true);
	XtAddCallback(m_finalInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	m_nativeInd = XtVaCreateManagedWidget("Native",
			xmToggleButtonGadgetClass,fullArea,
			NULL);
	XmToggleButtonGadgetSetState(m_nativeInd,bNative,true);
	XtAddCallback(m_nativeInd,XmNvalueChangedCallback,OnPermissionChanged,this);

	XtManageChild(permissionsArea);

	setWait(false);
		
	return fullArea;	
}
示例#9
0
//コンストラクタ
StopBGMTask::StopBGMTask(Sound* sound,StopBGMOption option){
	m_snd = sound;
	m_option = option;
	setWait(false);
}