本文整理汇总了C++中PolycodeEditor::setFilePath方法的典型用法代码示例。如果您正苦于以下问题:C++ PolycodeEditor::setFilePath方法的具体用法?C++ PolycodeEditor::setFilePath怎么用?C++ PolycodeEditor::setFilePath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolycodeEditor
的用法示例。
在下文中一共展示了PolycodeEditor::setFilePath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleEvent
void PolycodeIDEApp::handleEvent(Event *event) {
if(event->getDispatcher() == core) {
switch(event->getEventCode()) {
case Core::EVENT_CORE_RESIZE:
frame->Resize(core->getXRes(), core->getYRes());
break;
}
}
if(event->getDispatcher() == frame->getProjectBrowser()) {
if(event->getEventType() == "PolycodeProjectBrowserEvent") {
switch(event->getEventCode()) {
case PolycodeProjectBrowserEvent::SHOW_MENU:
dispatchEvent(new Event(), EVENT_SHOW_MENU);
break;
}
}
if(event->getEventCode() == Event::CHANGE_EVENT) {
BrowserUserData *selectedData = frame->getProjectBrowser()->getSelectedData();
if(selectedData->type == 3) {
projectManager->activeFolder = selectedData->parentProject->getRootFolder();
projectManager->selectedFile = "";
} else if(selectedData->type == 0) {
projectManager->activeFolder = "";
projectManager->selectedFile = "";
} else {
projectManager->selectedFileEntry = selectedData->fileEntry;
projectManager->selectedFile = selectedData->fileEntry.fullPath;
if(selectedData->fileEntry.type == OSFileEntry::TYPE_FILE) {
projectManager->activeFolder = selectedData->fileEntry.basePath;
} else {
projectManager->activeFolder = selectedData->fileEntry.fullPath;
}
}
projectManager->setActiveProject(selectedData->parentProject);
if(selectedData->type == 0)
return;
if(selectedData) {
PolycodeEditor *editor;
editor = editorManager->getEditorForPath(selectedData->fileEntry.fullPath);
if(editor) {
frame->showEditor(editor);
} else {
editor = editorManager->createEditorForExtension(selectedData->fileEntry.extension);
if(editor) {
if(editor->openFile(selectedData->fileEntry.fullPath)) {
frame->addEditor(editor);
frame->showEditor(editor);
} else {
delete editor;
editor = NULL;
}
}
}
if(editor) {
editorManager->setCurrentEditor(editor);
}
}
}
}
if(event->getDispatcher() == frame->playButton) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
runProject();
}
}
if(event->getDispatcher() == frame->textInputPopup) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
}
PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
if(editor) {
editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
}
projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();
frame->hideModal();
}
}
if(event->getDispatcher() == frame->newProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());
frame->hideModal();
}
//.........这里部分代码省略.........
示例2: handleEvent
//.........这里部分代码省略.........
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
if(frame->yesNoPopup->action == "removeFile") {
doRemoveFile();
}
if(frame->yesNoPopup->action == "saveAndRun") {
editorManager->saveFilesForProject(projectManager->getActiveProject());
runNextFrame = true;
}
frame->hideModal();
frame->yesNoPopup->action = "";
}
}
if(event->getDispatcher() == frame->textInputPopup) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
if(frame->textInputPopup->action == "newGroup") {
core->createFolder(projectManager->activeFolder+"/"+frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
refreshProject();
}
}
if(frame->textInputPopup->action == "renameFile") {
core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
refreshProject();
}
PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
if(editor) {
editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
}
projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();
}
frame->hideModal();
}
}
if(event->getDispatcher() == frame->settingsWindow) {
if(event->getEventType() == "UIEvent") {
Config *config = CoreServices::getInstance()->getConfig();
SettingsWindow *settingsWindow = frame->settingsWindow;
if(event->getEventCode() == UIEvent::OK_EVENT) {
config->setStringValue("Polycode", "useExternalTextEditor", settingsWindow->useExternalTextEditorBox->isChecked() ? "true" : "false");
config->setStringValue("Polycode", "externalTextEditorCommand", settingsWindow->externalTextEditorCommand->getText());
config->setStringValue("Polycode", "uiTheme", settingsWindow->uiThemeBox->getSelectedItem()->label);
if(settingsWindow->textureFilteringBox->getSelectedIndex() == 0) {
config->setStringValue("Polycode", "textureFilteringMode", "linear");
} else {
config->setStringValue("Polycode", "textureFilteringMode", "nearest");
}
frame->hideModal();
}
}
}
if(event->getDispatcher() == frame->exportProjectWindow) {
示例3: handleEvent
//.........这里部分代码省略.........
}
frame->hideModal();
}
break;
case UIEvent::CANCEL_EVENT:
break;
}
}
} else if(event->getDispatcher() == frame->yesNoPopup) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CANCEL_EVENT) {
if(frame->yesNoPopup->action == "saveAndRun") {
runNextFrame = true;
}
frame->hideModal();
frame->yesNoPopup->action = "";
}
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
if(frame->yesNoPopup->action == "removeFile") {
doRemoveFile();
}
if(frame->yesNoPopup->action == "saveAndRun") {
editorManager->saveAll();
runNextFrame = true;
}
frame->hideModal();
frame->yesNoPopup->action = "";
}
}
if(event->getDispatcher() == frame->textInputPopup) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
if(frame->textInputPopup->action == "newGroup") {
core->createFolder(projectManager->activeFolder+"/"+frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
}
}
if(frame->textInputPopup->action == "renameFile") {
core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
}
PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
if(editor) {
editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
}
projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();
}
frame->hideModal();
}
}
if(event->getDispatcher() == frame->exportProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->exportProject(projectManager->getActiveProject(), frame->exportProjectWindow->projectLocationInput->getText(), frame->exportProjectWindow->macCheckBox->isChecked(), frame->exportProjectWindow->winCheckBox->isChecked(), frame->exportProjectWindow->linCheckBox->isChecked());
frame->hideModal();
}
}
if(event->getDispatcher() == frame->newProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());
frame->hideModal();
}
}
if(event->getDispatcher() == frame->newFileWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewFile(frame->newFileWindow->getTemplatePath(), frame->newFileWindow->getFileName());
frame->hideModal();
if(projectManager->getActiveProject()) {
frame->projectBrowser->refreshProject(projectManager->getActiveProject());
}
}
}
if(event->getDispatcher() == frame->exampleBrowserWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
String fullPath = String(core->getDefaultWorkingDirectory()+"/"+frame->exampleBrowserWindow->getExamplePath());
PolycodeProject* project = projectManager->openProject(fullPath);
OSFileEntry projectEntry = OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
projectManager->setActiveProject(project);
openFile(projectEntry);
frame->hideModal();
}
}
}
示例4: handleEvent
//.........这里部分代码省略.........
BrowserUserData *selectedData = frame->getProjectBrowser()->getSelectedData();
if(selectedData->type == 3) {
projectManager->activeFolder = selectedData->parentProject->getRootFolder();
projectManager->selectedFile = "";
} else if(selectedData->type == 0) {
projectManager->activeFolder = "";
projectManager->selectedFile = "";
} else {
projectManager->selectedFileEntry = selectedData->fileEntry;
projectManager->selectedFile = selectedData->fileEntry.fullPath;
if(selectedData->fileEntry.type == OSFileEntry::TYPE_FILE) {
projectManager->activeFolder = selectedData->fileEntry.basePath;
} else {
projectManager->activeFolder = selectedData->fileEntry.fullPath;
}
}
projectManager->setActiveProject(selectedData->parentProject);
if(selectedData->type == 0)
return;
if(selectedData) {
openFile(selectedData->fileEntry);
}
}
}
if(event->getDispatcher() == frame->playButton) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
willRunProject = true;
}
}
if(event->getDispatcher() == frame->stopButton) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) {
stopProject();
}
}
if(event->getDispatcher() == frame->textInputPopup) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
core->moveDiskItem(projectManager->selectedFileEntry.fullPath, projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
if(projectManager->getActiveProject()) {
frame->getProjectBrowser()->refreshProject(projectManager->getActiveProject());
}
PolycodeEditor *editor = editorManager->getEditorForPath(projectManager->selectedFileEntry.fullPath);
if(editor) {
editor->setFilePath(projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue());
}
projectManager->selectedFileEntry.fullPath = projectManager->selectedFileEntry.basePath + "/" + frame->textInputPopup->getValue();
projectManager->selectedFileEntry.name = frame->textInputPopup->getValue();
frame->hideModal();
}
}
if(event->getDispatcher() == frame->exportProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->exportProject(projectManager->getActiveProject(), frame->exportProjectWindow->projectLocationInput->getText(), frame->exportProjectWindow->macCheckBox->isChecked(), frame->exportProjectWindow->winCheckBox->isChecked(), frame->exportProjectWindow->linCheckBox->isChecked());
frame->hideModal();
}
}
if(event->getDispatcher() == frame->newProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());
frame->hideModal();
}
}
if(event->getDispatcher() == frame->newFileWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewFile(frame->newFileWindow->getTemplatePath(), frame->newFileWindow->getFileName());
frame->hideModal();
if(projectManager->getActiveProject()) {
frame->projectBrowser->refreshProject(projectManager->getActiveProject());
}
}
}
if(event->getDispatcher() == frame->exampleBrowserWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
String fullPath = String(core->getDefaultWorkingDirectory()+"/"+frame->exampleBrowserWindow->getExamplePath());
PolycodeProject* project = projectManager->openProject(fullPath);
OSFileEntry projectEntry = OSFileEntry(project->getProjectFile(), OSFileEntry::TYPE_FILE);
projectManager->setActiveProject(project);
openFile(projectEntry);
frame->hideModal();
}
}
}