//=========================================================================
-bool wxVtkSceneManager::OnChar() {
- char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
- int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
+bool wxVtkSceneManager::OnChar()
+{
+ bool ok=false;
+ char keyCode = _vtkInteractorStyleBaseView->GetInteractor()-> GetKeyCode();
+ int ctrlkey = _vtkInteractorStyleBaseView->GetInteractor()->GetControlKey();
// KeyCode 127 : Delete Key
// KeyCode 8 : Backspace Key
- if (keyCode == 8 || keyCode == 127) {
- if (_selectedObjects.size() > 0) {
- for (int i = 0; i < (int) _selectedObjects.size(); i++) {
+ if (keyCode == 8 || keyCode == 127)
+ {
+ for (int i = 0; i < (int) _selectedObjects.size(); i++)
+ {
int id = _selectedObjects[i];
+ printf("EED wxVtkSceneManager::OnChar %d %d\n", i, id);
std::map<int, GObjectController*>::iterator it;
it = _controllers.find(id);
if (it != _controllers.end()) {
- deleteObject(id);
- }
+ ok=ok||deleteObject(id);
+ } // if
+ }// for selected objects
+ if (ok) _selectedObjects.clear();
+ _parent->saveTempandUpdate("delete object");
+ }// if keyCode
+
+ /// Duplicate
+#ifdef MACOSX
+ if((keyCode==0) && (ctrlkey==1)) {
+#else
+ ctrlkey+=keyCode;
+ if(ctrlkey==5){
+#endif
+ if(_selectedObjects.size()){
+ std::cout<<"objects to copy :";
+ for(int i=0;i<_selectedObjects.size();i++){
+ std::cout<<_selectedObjects.at(i)<<" ";
}
- _selectedObjects.clear();
- }
- }
- ctrlkey+=keyCode;
- /// Duplicate
- if(ctrlkey==5){
- if(_selectedObjects.size()){
- std::cout<<"objects to copy :";
- for(int i=0;i<_selectedObjects.size();i++){
- std::cout<<_selectedObjects.at(i)<<" ";
- }
- DuplicateObjects(getSelectedObjects());
- }else{
- std::cout<<"No objects to copy\n";
- }
- }
+ DuplicateObjects(getSelectedObjects());
+ }else{
+ std::cout<<"No objects to copy\n";
+ } // _selectedObjects.size
+ } // ctrlkey 5
return true;
}
//=========================================================================
-void wxVtkSceneManager::deleteObject(int id) {
+bool wxVtkSceneManager::deleteObject(int id)
+{
+ bool result=true;
GObjectController *control = _controllers[id];
std::vector<int> controllersToRemove;
// Add box input controllers to be removed
for (int i = 0; i < (int) inputs.size(); i++) {
- AddControlerToBeRemove(&controllersToRemove,
- inputs[i]->getObjectId());
+ AddControlerToBeRemove(&controllersToRemove, inputs[i]->getObjectId());
if (inputs[i]->isConnected()) {
boxConnected = true;
}
// Add box output controllers to be removed
for (int i = 0; i < (int) outputs.size(); i++) {
- AddControlerToBeRemove(&controllersToRemove,
- outputs[i]->getObjectId());
+ AddControlerToBeRemove(&controllersToRemove, outputs[i]->getObjectId());
if (outputs[i]->isConnected()) {
boxConnected = true;
}
// Add box controller to be removed
AddControlerToBeRemove(&controllersToRemove, bbmod->getObjectId());
} else if (control->getGObjectType() == GCONNECTOR) {
- GConnectorModel *conMod = (GConnectorModel*) control->getModel();
- AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId());
+ GConnectorController *gconnectorcontroler = (GConnectorController*)control;
+ if (gconnectorcontroler->getManualContourController()->IsEditable()==false)
+ {
+ GConnectorModel *conMod = (GConnectorModel*) control->getModel();
+ AddControlerToBeRemove(&controllersToRemove, conMod->getObjectId());
+ } else{
+ gconnectorcontroler->getManualContourController()->OnChar();
+ result = false;
+ }
}
std::map<int, GObjectController*>::iterator it;
_controllers.erase(it);
}//if
}// for
- _parent->saveTempandUpdate("delete object");
+
+
+ return result;
}
//=========================================================================
int createGConnector(GPortModel* startPort);
void configGBlackBox(int idBox, double xIn, double yIn, double zIn, std::string name, bool boxExecutable,double xEn,double yEn,double zEn);
- int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string
- nameEndBox, std::string nameEndPort);
+ int configGConnetion( std::string nameStartBox, std::string nameStartPort, std::string nameEndBox, std::string nameEndPort);
void configGComBoxInputOutputPort(bool inputoutput, std::string inputPortName, double xIn, double yIn,double zIn);
GBoxModel* findGBox(std::string boxname);
vtkRenderWindow* getRenderWindow();
- vtkRenderer* getRenderer();
+ vtkRenderer* getRenderer();
virtual void update(int idController,int command);
std::string saveComplexBoxBBS();
//Delete the object in the list of controllers with the id given by parameter.
- void deleteObject(int id);
+ bool deleteObject(int id);
void AddControlerToBeRemove(std::vector<int> *controllersToRemove, int id);