//---------------------------------------------------------------------------------------- // HandlePopupSelectionChange //---------------------------------------------------------------------------------------- void CZPAssetsPanelObserver::HandlePopupSelectionChange( const ClassID& theChange, ISubject* theSubject, const PMIID & protocol, void* changedBy) { LogFunctionEnterExit; InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID()); ASSERT(controlView); WidgetID theChangedWidgetID = controlView->GetWidgetID(); if( theChangedWidgetID.Get() == kZPUIAssetsPanelTitleDropDownWidgetID ) { this->RefreshEditionPopup(); //TODO: we should disable tree view till editions popup is not refreshed. // as the tree view might be showing data of some other title. } else if( theChangedWidgetID.Get() == kZPUIAssetsPanelEditionDropDownWidgetID ) { //Refresh the Assets treeview this->RefreshAssetsTreeView(); } }
//-------------------------------------------------------------------------- // Update //-------------------------------------------------------------------------- void CZPAssetsPanelObserver::Update( const ClassID& theChange, ISubject* theSubject, const PMIID &protocol, void* changedBy) { LogFunctionEnterExit; do { if ( theChange == kZPLogin_LoggedInMsg && protocol == IZPLoginController::kDefaultIID ) { this->HandleUserLoginDone(); } else if ( theChange == kZPLogin_AuthenticationDoneMsg ) { this->DoPanelRefresh(); } else if( protocol == IZPLoginController::kDefaultIID && theChange != kZPLogin_CanLogoutMsg ) { //disable controls if state is not logged in, this->UpdateUserName(); this->EnableDisableControls( false ); } else if ( theChange == kZPUIAssetTV_SelectionChangedMsg ) { this->HandleTreeSelectionChange( theChange, theSubject, protocol, changedBy ); } else if ( theChange == kZPUIDBObjDropDown_ListLengthChangedMsg ) { this->HandlePopupListChange( theChange, theSubject, protocol, changedBy ); } else if ( theChange == kZPUIDBObjDropDown_SelectionChangedMsg ) { this->HandlePopupSelectionChange( theChange, theSubject, protocol, changedBy ); } else if ( theChange == kZPAssetThumbnailAvailableMsg ) { this->RefreshPreview( ); //TODO: check the asset ID, if waiting for same ID then refresh. } else if (theChange == kTrueStateMessage) { InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID()); ASSERT(controlView); if(!controlView) break; // Get the button ID from the view. WidgetID widgetID = controlView->GetWidgetID(); switch( widgetID.Get() ) { case kZPUIAssetsPanelRefreshButtonWidgetID: this->DoPanelRefresh(); break; } } }while(kFalse); }
//---------------------------------------------------------------------------------------- // HandlePopupListChange //---------------------------------------------------------------------------------------- void CZPAssetsPanelObserver::HandlePopupListChange( const ClassID& theChange, ISubject* theSubject, const PMIID & protocol, void* changedBy) { LogFunctionEnterExit; InterfacePtr<IControlView> controlView(theSubject, UseDefaultIID()); ASSERT(controlView); WidgetID theChangedWidgetID = controlView->GetWidgetID(); if( theChangedWidgetID.Get() == kZPUIAssetsPanelTitleDropDownWidgetID ) { //Refresh the edition popup. //this->RefreshEditionPopup(); //Commented as It should be done on selection change only. } else if( theChangedWidgetID.Get() == kZPUIAssetsPanelEditionDropDownWidgetID ) { //Refresh the Assets treeview //this->RefreshAssetsTreeView(); //Commented as It should be done on selection change only. } }
void MyPlugin2SelectionObserver::HandleSelectionAttributeChanged(const ISelectionMessage* iSelectionMessage) { return; //CAlert::InformationAlert("Selection Attribute changed.."); if(iSelectionMessage->WasSuiteAffected(IID_IAPPEARANCESUITE)){ // CAlert::InformationAlert("appearacne suite"); } if (iSelectionMessage->WasSuiteAffected(IID_IGRAPHICATTRIBUTESUITE)){ //CAlert::InformationAlert("Graphic suite"); } if (iSelectionMessage->WasSuiteAffected(IID_IFORMFIELDSUITE)){ // CAlert::InformationAlert("form Field suite"); } InterfacePtr<IControlView> controlView(this, IID_ICONTROLVIEW); if (controlView !=nil) { CAlert::InformationAlert("controlView found"); } };
int main ( int argc, char** argv ) { // Initialize world. DYN_initialize(&world, 0.02); { DYN_Body body; DYN_BodyStaticAttributes attributes; double nullVector[3] = {0, 0, 0}; double identity[9] = { 1, 0, 0, 0, 1, 0, 0, 0, 1 }; // double impulse[3] = {100, 0, 0}; // double pointOfImpulse[3] = {0, 1, 1}; attributes.shape = DYN_BS_CUBOID; attributes.cuboidAttributes.width = 3; attributes.cuboidAttributes.height = 3; attributes.cuboidAttributes.depth = 3; DYN_calculateMass(&attributes, 1); memcpy(body.position, nullVector, sizeof(nullVector)); memcpy(body.velocity, nullVector, sizeof(nullVector)); memcpy(body.angularVelocity, nullVector, sizeof(nullVector)); memcpy(body.orientation, identity, sizeof(identity)); DYN_addBody(&world, &body, &attributes); //applyImpulse(&world, &world.bodies[0], pointOfImpulse, impulse); /* attributes.cuboidAttributes.width = 1; attributes.cuboidAttributes.height = 1; attributes.cuboidAttributes.depth = 1; DYN_calculateMass(&attributes, 1); body.position[0] = 0; body.position[1] = 0; body.position[2] = -100; body.velocity[2] = 1; DYN_addBody(&world, &body, &attributes);*/ { int i,j,k; attributes.cuboidAttributes.width = 3; attributes.cuboidAttributes.height = 3; attributes.cuboidAttributes.depth = 3; DYN_calculateMass(&attributes, 1); for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { for (k = 0; k < 4; k++) { body.position[0] = 10 + 5*i; body.position[1] = 10 + 5*j; body.position[2] = 10 + 5*k; memcpy(body.velocity, nullVector, sizeof(nullVector)); DYN_addBody(&world, &body, &attributes); } } } } } // initialize SDL video if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf( "Unable to init SDL: %s\n", SDL_GetError() ); return 1; } // make sure SDL cleans up before exit atexit(SDL_Quit); // Setting OpenGL attributes SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); // create a new window SDL_Surface* screen = SDL_SetVideoMode(RESOLUTION_X, RESOLUTION_Y, 16, SDL_HWSURFACE | SDL_OPENGL); // Lock mouse in SDL_ShowCursor(0); //SDL_WM_GrabInput(SDL_GRAB_ON); //< Toggle this // Create display lists createDisplayLists(); // Initialize modes glEnable(GL_DEPTH_TEST); glEnable(GL_COLOR_MATERIAL); // Initialize gl matrixes glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60, 4.0/3.0, 1, 100000.0); // Initlalize GL lights { GLfloat ambient[4] = {0.1, 0.1, 0.1, 1}; GLfloat diffuseColor[4] = {1, 1, 1, 1}; GLfloat specularColor[4] = {0,0,0,0}; glEnable(GL_LIGHTING); glEnable(GL_CULL_FACE); glEnable(GL_LIGHT0); glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient); glMatrixMode(GL_MODELVIEW); glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuseColor); glLightfv(GL_LIGHT0, GL_AMBIENT, ambient); glLightfv(GL_LIGHT0, GL_SPECULAR, specularColor); glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0); } if ( !screen ) { printf("Unable to set 640x480 video: %s\n", SDL_GetError()); return 1; } // program main loop while (!handleEvents()) { // message processing loop DYN_stepWorld(&world); controlView(); draw(); usleep(20000); // finally, update the screen SDL_GL_SwapBuffers(); } // end main loop // all is well ;) printf("Exited cleanly\n"); return 0; }