Пример #1
0
// static
KUrl KDirSelectDialog::selectDirectory( const KUrl& startDir,
                                        bool localOnly,
                                        QWidget *parent,
                                        const QString& caption)
{
    KDirSelectDialog myDialog( startDir, localOnly, parent);

    if ( !caption.isNull() )
        myDialog.setCaption( caption );

    if ( myDialog.exec() == QDialog::Accepted )
        return KIO::NetAccess::mostLocalUrl(myDialog.url(),parent);
    else
        return KUrl();
}
Пример #2
0
SimpleJoint* SimulatedWorld::AddJoint()
{
	SimpleJoint* createdJoint;
	wxArrayString options; wxString option1("Prismatic"); wxString option2("rotational");
	options.Add(option1); options.Add(option2);
	wxArrayString AxisOptions; wxString AxisOption1("X_AXIS"); wxString AxisOption2("Y_AXIS");wxString AxisOption3("Z_AXIS");
	AxisOptions.Add(AxisOption1);AxisOptions.Add(AxisOption2);AxisOptions.Add(AxisOption3);
	bool prismatic=false; int axis=0;double vmin=-PI; double vmax=PI;
	wxString Type;
	wxSingleChoiceDialog myDialog(NULL,wxString("Select joint type"),wxString("Options"),options);
	if (myDialog.ShowModal()==wxID_OK )
	{
		if(myDialog.GetStringSelection()==wxString("Prismatic")) prismatic=true;
			else prismatic=false;
	}
	wxTextEntryDialog myDialogVmax(NULL,wxString("Introduce Vmax"),wxGetTextFromUserPromptStr,wxEmptyString,wxTextEntryDialogStyle,wxDefaultPosition);
	if (myDialogVmax.ShowModal()==wxID_OK )
	{
		wxString value=myDialogVmax.GetValue();
		value.ToDouble(&vmax);
	}
	wxTextEntryDialog myDialogVmin(NULL,wxString("Introduce Vmin"),wxGetTextFromUserPromptStr,wxEmptyString,wxTextEntryDialogStyle,wxDefaultPosition);
	if (myDialogVmin.ShowModal()==wxID_OK )
	{
			wxString value=myDialogVmin.GetValue();
			value.ToDouble(&vmin);
			if(vmin>=vmax)
			{
				wxMessageDialog errorDialog(NULL, wxString("Wrong Value-SimpleJoint will be created with default values") ,wxMessageBoxCaptionStr,wxOK|wxCENTRE,wxDefaultPosition);
				errorDialog.ShowModal();
				vmin=-PI;
				vmax=PI;
			}
	}
	wxSingleChoiceDialog myDialog2(NULL,wxString("Select Axis"),wxString("Options"),AxisOptions);
	if (myDialog2.ShowModal()==wxID_OK )
	{
		if(myDialog2.GetStringSelection()==wxString("X_AXIS")) axis=1;
		if(myDialog2.GetStringSelection()==wxString("Y_AXIS")) axis=2;
		else axis=3;
	}

	if (axis==1) createdJoint=new SimpleJoint(vmax,vmin,true,0,X_AXIS,prismatic);
	else if(axis==2) createdJoint=new SimpleJoint(vmax,vmin,true,0,Y_AXIS,prismatic);
	else createdJoint=new SimpleJoint(vmax,vmin,true,0,Z_AXIS,prismatic);

	return createdJoint;
}
Пример #3
0
void CreateComposed::AddNewComposed(wxCommandEvent& event)
{
	int id=event.GetId();
	if (id==ID_ADDCOMPPART)
	{
		ComposedEntity* Comp=new ComposedEntity();
		string NameSet;
		wxTextEntryDialog myDialog(this,"Introduce name");
		if (myDialog.ShowModal()==wxID_OK )
		{
			wxString Name=myDialog.GetValue();
			VComposedNames.push_back(Name);
			ComposedIntegratedNames.push_back(Name);
			NameSet=std::string(Name.mb_str());
			Comp->setName(NameSet);
			selectComposedtoView->AppendString(Name);
			CurrentComposed->AppendString(Name);
		}
		IntegratedParts.push_back(Comp);
		(*currentComp)+=IntegratedParts[IntegratedParts.size()-1];
	}
	wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Composed added"), wxT("Confirmation"), wxOK | wxICON_INFORMATION);
	dial->ShowModal();
}
Пример #4
0
void CreateComposed::AddNewObject(wxCommandEvent& event)
{
	string NameSet;
	if(checkAddition==true)
	{
		int id=event.GetId();
	
		if (id==ID_CYLINDCOMPOSED)
		{
			Temp= new CylindricalPart();
			wxTextEntryDialog myDialog(this,"Introduce name");
			if (myDialog.ShowModal()==wxID_OK )
			{
				wxString Name=myDialog.GetValue();
				NameSet=std::string(Name.mb_str());
				Temp->setName(NameSet);
			}
			Height->Enable();
			Radio->Enable();
			BaseVertex->Disable();
			canvas3d->AddObject(Temp);
			canvas3d->Refresh();
			ResetValues();
			type=1;
		}

		if (id==ID_SPHERECOMPOSED)
		{
			Temp= new SpherePart();
			wxTextEntryDialog myDialog(this,"Introduce name");
			if (myDialog.ShowModal()==wxID_OK )
			{
				wxString Name=myDialog.GetValue();
				NameSet=std::string(Name.mb_str());
				Temp->setName(NameSet);
			}
			Height->Disable();
			Radio->Enable();
			BaseVertex->Disable();
			canvas3d->AddObject(Temp);
			canvas3d->Refresh();
			ResetValues();
			type=2;
		}

		if (id==ID_IRRPRISMCOMPOSED)
		{
			Temp=new PrismaticPart();
			wxTextEntryDialog myDialog(this,"Introduce name");
			if (myDialog.ShowModal()==wxID_OK )
			{
				wxString Name=myDialog.GetValue();
				NameSet=std::string(Name.mb_str());
				Temp->setName(NameSet);
			}
			Height->Enable();
			Radio->Disable();
			BaseVertex->Disable();
			ResetValues();
			type=3;
			CreateFig=new globalView(this,wxID_ANY,wxT("Create Base"));
			CreateFig->Show(true);
		}


		if (id==ID_REGPRISMCOMPOSED)
		{
			Temp=new PrismaticPart();
			wxTextEntryDialog myDialog(this,"Introduce name");
			if (myDialog.ShowModal()==wxID_OK )
			{
				wxString Name=myDialog.GetValue();
				NameSet=std::string(Name.mb_str());
				Temp->setName(NameSet);
			}
			prism=dynamic_cast<PrismaticPart*>(Temp);
			prism->setRegularPolygonBase(1,4);	
			prism->setColor(0.5,0.5,0.5);
			canvas3d->AddObject(Temp);
			canvas3d->Refresh();
			Height->Enable();
			Radio->Enable();
			BaseVertex->Enable();
			ResetValues();
			type=4;
		}
		checkAddition=false;
	}
	else 
	{
		wxMessageDialog *dial = new wxMessageDialog(NULL, wxT("Last item needs to be added"), wxT("Error"),wxOK | wxICON_EXCLAMATION);
		dial->ShowModal();
	}
}
Пример #5
0
/*!
 *  Events handling
 *  returns 0: pressed ESCAPE key
 *  returns 1: pressed any other keys
 * 
 *  Inside the handleEvents() routine is handled the movements
 *  of the fighter on the splashscreen.
 *  The mechanics is handled using the states of the ENUM
 * 
 */
bool SplashScreen::handleEvents() {
    sf::Event Event;
    sf::RenderWindow& window = Game::getMainWindow();
    if (window.GetEvent(Event)) {
        //PRESSING KEY UP
        if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Up)) {

            if (FighterState == SplashScreen::StartGame) {
                _fighter.SetPosition(250, 385);
                FighterState = SplashScreen::StartGame;
            }

            if (FighterState == SplashScreen::Option) {
                _fighter.SetPosition(250, 385);
                FighterState = SplashScreen::StartGame;
                _menuSound.Play();
            }

            return 1;
        }
        //PRESSING KEY DOWN
        if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Down)) {
            if (FighterState == SplashScreen::StartGame) {
                _fighter.SetPosition(250, 450);
                _menuSound.Play();
                FighterState = SplashScreen::Option;
            };

            if (FighterState == SplashScreen::Option) {
                _fighter.SetPosition(250, 450);
                FighterState = SplashScreen::Option;
            }

            return 1;
        }

        //PRESSING KEY ESCAPE
        if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape)) {
            return 0;
        }

        //PRESSING KEY ENTER
        if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Return))
       {
            if(FighterState==SplashScreen::Option)
            {
                sf::String Titolo; Titolo.SetText("Sorry, this was a joke...");
                Titolo.SetPosition(180,180);
                sf::String sottoTitolo; sottoTitolo.SetText("");
                Dialog myDialog(Titolo,sottoTitolo);
                     
                sf::PostFX Effect;
                Effect.LoadFromFile("shaders/blur.sfx");
                Effect.SetTexture("framebuffer", NULL);
                Effect.SetParameter("offset", 0.008f);
                
                window.Clear();
                window.Draw(_background);
                window.Draw(Effect);
                window.Display();

                myDialog.run();
            }
            if (FighterState == SplashScreen::StartGame) {
                _bgmusic.Stop();
                ResourcesManager::getSingleton().setScope(1);
                _field->initialize();
                _splashState = InGame;
            }
            return 1;
        }
    }
    return 1;
}
Пример #6
0
void guiGate::doParamsDialog(void* gc, wxCommandProcessor* wxcmd) {
	if(wxGetApp().libraries[libName][libGateName].dlgParams.size() == 0) return;
	paramDialog myDialog(std2wx("Parameters"), gc, this, wxcmd);
	myDialog.ShowModal();
}