示例#1
0
void GroupScreen::screenCB( Fl_Widget* w )
{
	if ( w == groupUI->acceptScaleButton )
	{
		scriptMgr->addLineDouble("xform scale", geomGroup->scaleFactor());
		geomGroup->acceptScaleFactor();
	}
	else if ( w == groupUI->acceptXformButton )
	{
		scriptMgr->addLine("xform", "loc", geomGroup->xLocOff(), geomGroup->yLocOff(), geomGroup->zLocOff());
		scriptMgr->addLine("xform", "rot", geomGroup->xRotOff(), geomGroup->yRotOff(), geomGroup->zRotOff());

		geomGroup->acceptXform();
	}
	else if ( w == groupUI->resetScaleButton )
	{
		geomGroup->resetScaleFactor();
		scriptMgr->addLine("xform", "resetscale");
	}
	else if ( w == groupUI->resetXformButton )
	{
		geomGroup->resetXform();		
		scriptMgr->addLine("xform", "resetxform");
	}
	else if ( w == groupUI->redSlider || 
			  w == groupUI->greenSlider	||
			  w == groupUI->blueSlider )				
	{
		int r = (int)groupUI->redSlider->value();
		int g = (int)groupUI->greenSlider->value();
		int b = (int)groupUI->blueSlider->value();

		geomGroup->setColor( r, g, b );

		groupUI->primColorButton->color( fl_rgb_color(r, g, b) );
		groupUI->primColorButton->redraw();

		if (!Fl::event_state(FL_BUTTONS))
			scriptMgr->addLine("gen", "color", r, g, b);
	}
	else if ( w == groupUI->materialChoice )
	{
		geomGroup->setMaterialID( groupUI->materialChoice->value() );
		Stringc matName = matMgrPtr->getMaterial(groupUI->materialChoice->value())->name();
		matName.quote('\"');
//		char str[128];
//		sprintf(str, "\"%s\"", matMgrPtr->getMaterial(groupUI->materialChoice->value())->name());
		scriptMgr->addLine("gen", "material", matName);
	}
	else if ( w == groupUI->scaleLocButton )
	{
		geomGroup->setScaleLocFlag( groupUI->scaleLocButton->value() );
	}



}
示例#2
0
void GeomScreen::screenCB( Fl_Widget* w )
{

	if ( w == geomUI->addGeomButton )
	{
		int type = geomUI->geomTypeChoice->value();

		if ( type >= WING_GEOM_TYPE )			// Compensate for removing Wing Type
			type += 1;

		s_add_geom(ScriptMgr::GUI, type, Stringc(""));
	}
	else if ( w == geomUI->geomBrowser)
	{
		s_select_gui();
	}
	else if ( w == geomUI->noshowGeomButton )
	{
		vector<Geom*> selVec = getSelectedGeomVec();

		for ( int i = 0 ; i < (int)selVec.size() ; i++ )
		{
			selVec[i]->setNoShowFlag( 1 );
		}
		aircraftPtr->triggerDraw();
		loadGeomBrowser();
	}
	else if ( w == geomUI->showGeomButton )
	{
		vector<Geom*> selVec = getSelectedGeomVec();

		for ( int i = 0 ; i < (int)selVec.size() ; i++ )
		{
			selVec[i]->setNoShowFlag( 0 );
		}
		aircraftPtr->triggerDraw();
		loadGeomBrowser();

	}
	else if ( w == geomUI->selectAllGeomButton )
	{
		s_select_all(ScriptMgr::GUI);
	}
	else if ( w == geomUI->activeGeomInput )
	{
		Geom* activeGeom = aircraftPtr->getActiveGeom();
		if ( activeGeom )
		{
			Stringc name = geomUI->activeGeomInput->value();
			activeGeom->setName( name );
			loadGeomBrowser();

			name.quote('\"');
			scriptMgr->addLine("gen", "name", name);		}
		else
		{
			aircraftPtr->setName( geomUI->activeGeomInput->value() );
			loadGeomBrowser();
		}

		vector<Geom*> selVec = getSelectedGeomVec();

		if ( selVec.size() == 1 )
			aircraftPtr->modifyGeom( selVec[0] );
	}
	else if ( w == geomUI->cutGeomButton )
	{
		s_cut(ScriptMgr::GUI, deque< Stringc >());
	}
	else if ( w == geomUI->copyGeomButton )
	{
		s_copy(ScriptMgr::GUI, deque< Stringc >());
	}
	else if ( w == geomUI->pasteGeomButton )
	{
		s_paste(ScriptMgr::GUI);
	}
	else if ( w == geomUI->wireGeomButton )
	{
		setGeomDisplayFlag( GEOM_WIRE_FLAG );
	}
	else if ( w == geomUI->hiddenGeomButton )
	{
		setGeomDisplayFlag( GEOM_HIDDEN_FLAG );
	}
	else if ( w == geomUI->shadeGeomButton )
	{
		setGeomDisplayFlag( GEOM_SHADE_FLAG );
	}
	else if ( w == geomUI->textureGeomButton )
	{
		setGeomDisplayFlag( GEOM_TEXTURE_FLAG );
	}
	else if ( w == geomUI->moveUpButton )
	{
		aircraftPtr->reorderGeom( Aircraft::MOVE_UP );
		deselectGeomBrowser();
			
		Geom * activeGeom = aircraftPtr->getActiveGeom();
		if ( activeGeom )
			selectGeomBrowser(activeGeom);
		loadGeomBrowser();
	}
	else if ( w == geomUI->moveDownButton )
	{
		aircraftPtr->reorderGeom( Aircraft::MOVE_DOWN );
		deselectGeomBrowser();

		Geom * activeGeom = aircraftPtr->getActiveGeom();
		if ( activeGeom )
			selectGeomBrowser(activeGeom);
		loadGeomBrowser();
	}
	else if ( w == geomUI->moveTopButton )
	{
		aircraftPtr->reorderGeom( Aircraft::MOVE_TOP );
		deselectGeomBrowser();
			
		Geom * activeGeom = aircraftPtr->getActiveGeom();
		if ( activeGeom )
			selectGeomBrowser(activeGeom);
		loadGeomBrowser();
	}
	else if ( w == geomUI->moveBotButton )
	{
		aircraftPtr->reorderGeom( Aircraft::MOVE_BOT );
		deselectGeomBrowser();
			
		Geom * activeGeom = aircraftPtr->getActiveGeom();
		if ( activeGeom )
			selectGeomBrowser(activeGeom);
		loadGeomBrowser();
	}
	else if ( w == geomUI->defaultAircraftTypeChoice )
	{
		int id = geomUI->defaultAircraftTypeChoice->value();
		VspPreferences::Instance()->setDefaultCompFileID( id );
		aircraftPtr->setDefaultCompGroupID(id);
	}

}