// // handle_object_created // int CBML_MultiInput_Handler:: handle_object_created (GAME::Mga::Object_in obj) { if (this->is_importing_) return 0; const std::string no_op_message = "A MultiInputAction has already been created for all facet operations."; GAME::Mga::Connection connection = GAME::Mga::Connection::_narrow (obj); GAME::Mga::Reference facet = GAME::Mga::Reference::_narrow (connection->src ()); GAME::Mga::FCO input_action = connection->dst (); GAME::Mga::Model object = GAME::Mga::Model::_narrow (facet->refers_to ()); // Collect the operations on the Object std::vector <GAME::Mga::Object> operations; this->get_operations (object, operations); // Get all the other MultiInputActions connected to the facet std::vector <GAME::Mga::Object> existing_actions; this->get_actions (facet, existing_actions); // Remove existing actions from the operations std::vector <GAME::Mga::Object> targets; this->narrow_targets (operations, existing_actions, targets); // The name to use for the MultiInputAction std::string name; if (targets.size () == 0) { ::AfxMessageBox (no_op_message.c_str (), MB_ICONINFORMATION | MB_OK); return 0; } else if (targets.size () == 1) name = targets.front ()->name (); else { AFX_MANAGE_STATE (::AfxGetStaticModuleState ()); using GAME::Dialogs::Selection_List_Dialog_T; Selection_List_Dialog_T <GAME::Mga::Object> dlg (0, ::AfxGetMainWnd ()); dlg.title ("Target Operation"); dlg.directions ("Select the target Operation for the MultiInputAction"); dlg.insert (targets); if (IDOK != dlg.DoModal ()) return 0; name = dlg.selection ()->name (); } if (!name.empty()) input_action->name (name); return 0; }
// // list delete // bool Lesser_Expr::list_delete (GAME::Mga::Model & obj, size_t count, GAME::Mga::Meta::FCO & metatype, GAME::Mga::Meta::Role & metarole) { std::vector <GAME::Mga::FCO> elements; GAME::Mga::FCO select; obj->children (elements); std::vector <GAME::Mga::FCO> qual_fcos; std::vector <GAME::Mga::FCO>::iterator it = elements.begin (), it_end = elements.end (); for (; it != it_end; ++it) { if ((*it)->meta ()->name () == metatype->name ()) qual_fcos.push_back ((*it)); } for (size_t i = 0; i < count; ++i) { AFX_MANAGE_STATE (::AfxGetStaticModuleState ()); // Create the dialog and pass in the data using GAME::Dialogs::Selection_List_Dialog_T; Selection_List_Dialog_T <GAME::Mga::FCO> dlg (0, ::AfxGetMainWnd (), 0); dlg.title ("Please select the Model/Atom for deletion"); dlg.directions ("Target evaluator"); dlg.insert (qual_fcos); if (IDOK != dlg.DoModal ()) return false; select = dlg.selection (); if (!select.is_nil ()) { select->destroy (); } } return true; }