Ejemplo n.º 1
0
//-----------------------------------------------------------------------
bool gkObjectManager::UpdateGizmoHover(uint8 selmode)
{
//	// add a pre highlight [10/14/2011 Kaiming]
// 	Ray ray = GetIEditor()->getMainViewport()->getRayFronScreen();
// 	IgkEntity* pPick = gEnv->p3DEngine->getRayHitEntity(ray);
// 	if (pPick &&  pPick != ms_pCurrentPick)
// 		GetIEditor()->getObjectMng()->setCurrHover(pPick);
	// disable now [2/12/2012 Kaiming]
		// while not draging, check the axis user check
	ms_selectedAxis = 0;

	float size = ms_pCurrentPick->getAABB().GetRadius() > 5.0? 5.0 : ms_pCurrentPick->getAABB().GetRadius();

	if (selmode)
	{
		if(checkSelected(GKSTUDIO_AXIS_X, size ))
		{
			ms_selectedAxis = GKSTUDIO_AXIS_X;
			return true;
		}
		else if (checkSelected(GKSTUDIO_AXIS_Y, size))
		{
			ms_selectedAxis = GKSTUDIO_AXIS_Y;
			return true;
		}
		else if (checkSelected(GKSTUDIO_AXIS_Z, size))
		{
			ms_selectedAxis = GKSTUDIO_AXIS_Z;
			return true;
		}
	}
	return false;
}
Ejemplo n.º 2
0
ChooseSamba::ChooseSamba(QWidget *parent) :
    GenericPage(parent),
    ui(new Ui::ChooseSamba)
{
    ui->setupUi(this);

    // setup default options
    setWindowTitle(i18nc("@title:window", "Select a Printer to Add"));

    connect(ui->addressLE, SIGNAL(textChanged(QString)), this, SLOT(checkSelected()));
    connect(ui->usernameLE, SIGNAL(textChanged(QString)), this, SLOT(checkSelected()));
    connect(ui->passwordLE, SIGNAL(textChanged(QString)), this, SLOT(checkSelected()));
}
Ejemplo n.º 3
0
void BaseFilter::updateSelectedEntities(const ccHObject::Container& selectedEntities)
{
	m_selected = selectedEntities;

	if (m_action)
		m_action->setEnabled(checkSelected() == 1);
}
Ejemplo n.º 4
0
int BaseFilter::performAction()
{
    //check if selected entities are good
    int check_result = checkSelected();
    if (check_result != 1)
    {
        throwError(check_result);
        return check_result;
    }

    //if dialog is needed open the dialog
    int dialog_result = openInputDialog();
	if (dialog_result < 1)
	{
		if (dialog_result<0)
        throwError(dialog_result);
		else
			dialog_result = 1; //the operation is canceled by the user, no need to throw an error!
		return dialog_result;
	}

    //get the parameters from the dialog
    getParametersFromDialog();

    //are the given parameters ok?
    int par_status = checkParameters();
    if (par_status != 1)
    {
        throwError(par_status);
        return par_status;
    }

    //if so go ahead with start()
    int start_status = start();
    if (start_status != 1)
    {
        throwError(start_status);
        return start_status;
    }

    //if we have an output dialog is time to show it
    int out_dialog_result = openOutputDialog();
    if (out_dialog_result < 1)
    {
        if (out_dialog_result<0)
        throwError(out_dialog_result);
        else
            out_dialog_result = 1; //the operation is canceled by the user, no need to throw an error!
        return out_dialog_result; //maybe some filter could ask the user if he wants to ac
    }


	return 1;
}
	void SplineDisplayerWidget::mouseReleaseEvent(QMouseEvent *event){
        if(!m_spline_data)
            return ;
        aaAaa::aaSpline &m_spline_data = *(this->m_spline_data);

		if(event->button() == Qt::RightButton){
            aaAaa::aaSpline::KnotsList &ctrlpoints = m_spline_data.knots;
			if (ctrlSelected >= 0){
				if(ctrlSelected != 0 && ctrlSelected != ctrlpoints.size()-1){
					ctrlpoints.erase(ctrlpoints.begin() + ctrlSelected);
				}

                aaAaa::Vector2 glpoint = screen2gl(event->x(), event->y());
                ctrlSelected = checkSelected(glpoint);

			}else{
				aaAaa::Vector2 p = screen2gl(event->x(), event->y());
				if(p.t > ctrlpoints[0].t &&
					p.t < ctrlpoints[ctrlpoints.size()-1].t){

                    aaAaa::aaSpline::KnotsList::iterator it = ctrlpoints.begin();
					++it;
					for(; it!=ctrlpoints.end(); ++it){
						if(p.t < (*it).t)
							break;
					}

					ctrlpoints.insert(it, p);

                    aaAaa::Vector2 glpoint = screen2gl(event->x(), event->y());
                    ctrlSelected = checkSelected(glpoint);
				}
			}

			updateGL();
		}
		//ctrlSelected = -1;
	}
	void SplineDisplayerWidget::mousePressEvent(QMouseEvent *event)
	{
		//if(event->buttons() & Qt::MidButton)
		lastPos = event->pos();
		
	//	if(ctrlSelected == -1){
        if(event->button() == Qt::LeftButton || event->button() == Qt::RightButton){
			aaAaa::Vector2 glpoint = screen2gl(event->x(), event->y());

			ctrlSelected = checkSelected(glpoint);

            emit selectValuesChanged(glpoint.t, glpoint.y);
//			std::cout << "glpoint: (" << glpoint.t << ", " << glpoint.y << "); ctrlSelected: " << ctrlSelected << "\n";
		}

        updateGL();
	}
Ejemplo n.º 7
0
int BaseFilter::performAction()
{
    //check if selected entities are good
    int check_result = checkSelected();
    if (check_result != 1)
    {
        throwError(check_result);
        return check_result;
    }

    //if dialog is needed open the dialog
	int dialog_result = openDialog();
	if (dialog_result < 1)
	{
		if (dialog_result<0)
        throwError(dialog_result);
		else
			dialog_result = 1; //the operation is canceled by the user, no need to throw an error!
		return dialog_result;
	}

    //get the parameters from the dialog
    getParametersFromDialog();

    //are the given parameters ok?
    int par_status = checkParameters();
    if (par_status != 1)
    {
        throwError(par_status);
        return par_status;
    }

    //if so go ahead with start()
    int start_status = start();
    if (start_status != 1)
    {
        throwError(start_status);
        return start_status;
    }

	return 1;
}
k9Cell *k9CellCopyList::addCell(int _VTS,int _pgc,int _id,uint32_t startSector,uint32_t lastSector,uchar _angleBlock) {
    bool bInsert=false;
    bool bFound=false;
    uint position=0;
    k9Cell *cell =NULL;

    for (int i=0; i< count() && !bFound && !bInsert; i++) {
        cell=(k9Cell*) at(i);
        if (cell->startSector ==startSector && cell->vts==_VTS) {
            bFound=true;
            if (cell->lastSector!=lastSector  )
                qDebug("last sector doesn't match");

        }
        if (!bFound && (_VTS <cell->vts  || (startSector<cell->startSector  && cell->vts ==_VTS ) )) {
            bInsert=true;
            position=i;
        }

    }

    if (!bFound) {
        cell = new k9Cell();
        cell->vts=_VTS;
        cell->startSector=startSector;
        cell->lastSector=lastSector;
        cell->pgc=_pgc;
        cell->id=_id;
        cell->angleBlock=_angleBlock;
        cell->selected=checkSelected(cell);

        if (bInsert)
            insert(position,cell);
        else
            append(cell);

        uint32_t isize;
        isize= cell->selected ? ((lastSector-startSector)*2048):2;
        setVTS(_VTS,isize);
    }
    return(cell);
}
Ejemplo n.º 9
0
int menuWiimote(WPADData *wd, u32 wpaddown) {
	checkSelected(wd);

	// button A selects an option
	if(wpaddown & WPAD_BUTTON_A) {
		switch(curmenunum) {
			case MAIN_MENU :
				switch(msel) {
					case 0:
                        //play menu
						playClick();
						killMainMenu();
						initPlayMenu();
						break;
					case 1 :
                        //hi score
						playClick();
                        killMainMenu();
                        initHighscoreMenu();
						break;
					case 2 :
                        //optionsmenu
						playClick();
						killMainMenu();
						initOptionMenu();
						break;
					case 3 :
                        //sound menu
						playClick();
						killMainMenu();
						initSoundMenu();
						break;
					case 4 :
                        //exit
						playClick();
						killMainMenu();
						return EXIT;
				}
				break;
			case PLAY_MENU :
				switch(msel) {
					case 0 :
						playClick();
						killPlayMenu();
						return ONE_PLAYER_GAME;
						break;
					case 1 :
						playClick();
						killPlayMenu();
						return TWO_PLAYER_COOP;
						break;
					case 2 :
						playClick();
						killPlayMenu();
						return TWO_PLAYER_VERSUS;
						break;
					case 3 :
						playClick();
						killPlayMenu();
						initMainMenu();
						break;
				}
				break;
			case OPTIONS_MENU :
				switch(msel) {
					case 0 :
						// change tileset
						playClick();
						killMenu();
						initTilesetMenu();
						break;
					case 1 :
						// change layout
						playClick();
						killMenu();
						initLayoutMenu();
						break;
					case 2 :
						// hover hint
						playWrong();
						break;
					case 3 :
						// language selection
						playClick();
						killMenu();
						initLangMenu();
						break;
					case 4 :
						// rumble on/off
						if(opt_rumble)
							opt_rumble=false;
						else
							opt_rumble=true;
						playClick();
						break;
					case 5 :
						// widescreen on/off
						if(opt_widescreen)
							opt_widescreen=false;
						else
							opt_widescreen=true;
						GRRLIB_Widescreen(opt_widescreen);
						playClick();
						break;
					case 6 :
						// back
						playClick();
						killMenu();
						initMainMenu();
						break;
				}
				break;
			case SOUND_MENU :
				switch(msel) {
					case 2 :
						playClick();
						killSoundMenu();
						initMainMenu();
						break;
				}
				break;
			case LANG_MENU :
				if(msel>-1) {
					int tmp_lang=msel + (curpage==0?0:9);
					if(tmp_lang>NORWEGIAN) return NOTHING;
					opt_lang=tmp_lang;
					setLanguage();
					playClick();
					killLangMenu();
					initOptionMenu();
				}
				if(btnover) {
				    curpage++;
					curpage = curpage % 2;
					playClick();
				}
				break;
			case LAYOUT_MENU :
				if(msel>-1) {
					playClick();
					int tmp_sel = msel + (curpage==0?0:6);
					opt_layout=tmp_sel;
					killLayoutMenu();
					initOptionMenu();
				}
				if(btnover) {
				    curpage++;
					curpage = curpage % 2;
					playClick();
				}
				break;
			case TILESET_MENU :
			{
				if(msel>-1) {
					playClick();
					opt_tileset=msel;
					killTilesetMenu();
					initOptionMenu();
				}
			}
			break;

			case HIGHSCORE_MENU:
			{
                playClick();
                killHighscoreMenu();
                initMainMenu();
			}
			break;
		}
	}

	if (curmenunum==SOUND_MENU && wd->btns_h & WPAD_BUTTON_A) {
		switch(msel) {
			case 0 :
				xmusic=wd->ir.x;
				opt_music = (int) (((double)xmusic-soundhs[0][0])/soundhs[0][2]*64);
				return MUSIC_BAR + opt_music;
				break;
			case 1 :
				xsound=wd->ir.x;
				opt_sound = (int) (((double)xsound-soundhs[1][0])/soundhs[1][2]*255);
				playWrong();
				break;
		}
	}

	// button B acts the same as back
	if(wpaddown & WPAD_BUTTON_B) {
		switch(curmenunum) {
			case MAIN_MENU :
				break;
			case PLAY_MENU :
				playClick();
				killPlayMenu();
				initMainMenu();
				break;
			case OPTIONS_MENU :
				playClick();
				killMenu();
				initMainMenu();
				break;
			case SOUND_MENU :
				playClick();
				killSoundMenu();
				initMainMenu();
				break;
			case LANG_MENU :
				playClick();
				killLangMenu();
				initOptionMenu();
				break;
			case LAYOUT_MENU :
				playClick();
				killLayoutMenu();
				initOptionMenu();
				break;
			case TILESET_MENU :
			{
				playClick();
				killTilesetMenu();
				initOptionMenu();
			}
			break;

			case HIGHSCORE_MENU:
			{
                playClick();
                killHighscoreMenu();
                initMainMenu();
			}
			break;
		}
	}

	if(wpaddown & WPAD_BUTTON_PLUS) {
		if((curmenunum==LANG_MENU || curmenunum==LAYOUT_MENU) && curpage==0) curpage++;
	}

	if(wpaddown & WPAD_BUTTON_MINUS) {
		if((curmenunum==LANG_MENU || curmenunum==LAYOUT_MENU) && curpage==1) curpage--;
	}

	return NOTHING;
}