void WorkspacePanel::OnAddMaterial(wxCommandEvent& event) { wxFileDialog * openDialog = new wxFileDialog(this, wxT("Add a Material"), wxEmptyString, wxEmptyString, wxT("Material Files (*.material)|*.material|All Files (*.*)|*.*")); if(openDialog->ShowModal() == wxID_OK) { wxString path = openDialog->GetPath(); if(path.EndsWith(wxT(".material"))) { wxTreeItemId selId = mTreeCtrl->GetSelection(); if(isProject(selId)) { Project* project = getProject(selId); MaterialScriptEditor* editor = new MaterialScriptEditor(EditorManager::getSingletonPtr()->getEditorNotebook()); editor->loadFile(path); int index = (int)path.find_last_of('\\'); if(index == -1) index = (int)path.find_last_of('/'); editor->setName((index != -1) ? path.substr(index + 1, path.Length()) : path); EditorManager::getSingletonPtr()->openEditor(editor); Ogre::MaterialPtr mat = Ogre::MaterialManager::getSingleton().getByName("Ogre/Earring"); project->addMaterial(mat); } } } }
void WorkspacePanel::OnNewTechnique(wxCommandEvent& event) { Project* project = NULL; MaterialController* material = NULL; wxTreeItemId selId = mTreeCtrl->GetSelection(); if(isProject(selId)) { project = getProject(selId); } else if(isMaterial(selId)) { wxTreeItemId projectId = mTreeCtrl->GetItemParent(selId); project = getProject(projectId); material = getMaterial(selId); } TechniqueWizard* wizard = new TechniqueWizard(); wizard->Create(this, wxID_ANY, wxT("New Technique"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wizard->getTechniquePage()->setProject(project); wizard->getTechniquePage()->setMaterial(material); wizard->RunWizard(wizard->getTechniquePage()); // This seems unnatural, seems there must be a better way to deal with wizards wizard->Destroy(); delete wizard; }
void WorkspacePanel::OnSelectionChanged(wxTreeEvent& event) { SelectionList list; wxTreeItemId id = event.GetItem(); if(isProject(id)) list.push_back(getProject(id)); else if(isMaterial(id)) list.push_back(getMaterial(id)); else if(isTechnique(id)) list.push_back(getTechnique(id)); else if(isPass(id)) list.push_back(getPass(id)); // else its the workspace so just leave the list empty as if nothing were selected SelectionService::getSingletonPtr()->setSelection(list); }
void WorkspacePanel::showContextMenu(wxPoint point, wxTreeItemId id) { wxMenu contextMenu; appendNewMenu(&contextMenu); contextMenu.AppendSeparator(); if(isProject(id)) appendProjectMenuItems(&contextMenu); else if(isMaterial(id)) appendMaterialMenuItems(&contextMenu); else if(isTechnique(id)) appendTechniqueMenuItems(&contextMenu); //else appendPassMenuItems(&contextMenu); contextMenu.Append(ID_MENU_EDIT, wxT("Edit")); PopupMenu(&contextMenu, point); }
void WorkspacePanel::OnNewPass(wxCommandEvent& event) { Project* project = NULL; MaterialController* material = NULL; TechniqueController* technique = NULL; wxTreeItemId selId = mTreeCtrl->GetSelection(); if(isProject(selId)) { project = getProject(selId); } else if(isMaterial(selId)) { wxTreeItemId projectId = mTreeCtrl->GetItemParent(selId); project = getProject(projectId); material = getMaterial(selId); } else if(isTechnique(selId)) { wxTreeItemId materialId = mTreeCtrl->GetItemParent(selId); material = getMaterial(materialId); wxTreeItemId projectId = mTreeCtrl->GetItemParent(materialId); project = getProject(projectId); technique = getTechnique(selId); } PassWizard* wizard = new PassWizard(); wizard->Create(this, wxID_ANY, wxT("New Pass"), wxNullBitmap, wxDefaultPosition, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER); wizard->getPassPage()->setProject(project); wizard->getPassPage()->setMaterial(material); wizard->getPassPage()->setTechnique(technique); wizard->RunWizard(wizard->getPassPage()); wizard->Destroy(); delete wizard; }
/* getDiscType * method checks which kind of cd/dvd is to burn * returns integer which is defined in header (AI.h) */ int ProjectTypeSelector::getDiscType() { if(objFileAccess == NULL) throw new ProjectTypeSelectorException(new BString("FileAccess object isn't seted ProjectTypeSelector::getDiscType()")); objFileAccess->generateFileInfos(); TypeList = objFileAccess->getTypes(); fSizeOfFiles = objFileAccess->getFileSize(); FileList = objFileAccess->getFiles(); if(FileList->CountItems() == 0) { return EMPTYLIST; } if(FileList->CountItems() == 1 && isVolume()) { //CD or DVD if(fSizeOfFiles > CDSIZE) { return DVDCOPY; } else { return CDCOPY; } } else if(FileList->CountItems() == 1 && isCue()) { return CUE; } else if(FileList->CountItems() == 1 && isImage()) { //CD or DVD if(fSizeOfFiles > CDSIZE) { return DVDIMAGE; } else { return CDIMAGE; } } else if(FileList->CountItems() == 1 && isProject()) { return PORJECT; } if(isAudioDisc() && intPlayTime > AUDIOCDPLAYTIME) { return AUDIODVD; } else if(isAudioDisc()) { return AUDIOCD; } //CD or DVD if(fSizeOfFiles > CDSIZE) { return DATADVD; } else { //Video CD or data CD if(isVideoDisc()) { return VCD; } else { return DATACD; } } return ERROR; }