本文整理汇总了C++中PolycodeEditor::openFile方法的典型用法代码示例。如果您正苦于以下问题:C++ PolycodeEditor::openFile方法的具体用法?C++ PolycodeEditor::openFile怎么用?C++ PolycodeEditor::openFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolycodeEditor
的用法示例。
在下文中一共展示了PolycodeEditor::openFile方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
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->newProjectWindow) {
if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::OK_EVENT) {
projectManager->createNewProject(frame->newProjectWindow->getTemplateFolder(), frame->newProjectWindow->getProjectName(), frame->newProjectWindow->getProjectLocation());
frame->hideModal();
}
}
}
示例2: getEditorForPath
PolycodeEditor *PolycodeEditorManager::openFile(OSFileEntry file) {
// NOCMAKE_TODO:
/*
if(!Services()->getCore()->fileExists(file.fullPath)) {
return NULL;
}
*/
PolycodeEditor *editor = getEditorForPath(file.fullPath);
if(editor) {
return editor;
} else {
editor = createEditorForExtension(file.extension);
if(editor) {
editor->parentProject = projectManager->getActiveProject();
if(!editor->openFile(file)) {
delete editor;
editor = NULL;
}
}
}
return editor;
}
示例3: openFile
void PolycodeIDEApp::openFile(OSFileEntry file) {
PolycodeEditorFactory *factory = editorManager->getEditorFactoryForExtension(file.extension);
if(dynamic_cast<PolycodeTextEditorFactory*>(factory)) {
CoreServices *core = CoreServices::getInstance();
Config *config = core->getConfig();
bool useExternalTextEditor = (config->getStringValue("Polycode", "useExternalTextEditor") == "true") && (config->getStringValue("Polycode", "externalTextEditorCommand") != "");
if(useExternalTextEditor) {
PolycodeToolLauncher::openExternalEditor(config->getStringValue("Polycode", "externalTextEditorCommand"), file.fullPath, projectManager->getActiveProject()->getRootFolder());
return;
}
}
PolycodeEditor *editor = editorManager->getEditorForPath(file.fullPath);
if(editor) {
frame->showEditor(editor);
} else {
editor = editorManager->createEditorForExtension(file.extension);
if(editor) {
editor->parentProject = projectManager->getActiveProject();
if(editor->openFile(file)) {
frame->addEditor(editor);
frame->showEditor(editor);
} else {
delete editor;
editor = NULL;
}
}
}
if(editor) {
editorManager->setCurrentEditor(editor);
}
}
示例4: openFile
void PolycodeIDEApp::openFile(OSFileEntry file) {
PolycodeEditor *editor;
editor = editorManager->getEditorForPath(file.fullPath);
if(editor) {
frame->showEditor(editor);
} else {
editor = editorManager->createEditorForExtension(file.extension);
if(editor) {
editor->parentProject = projectManager->getActiveProject();
if(editor->openFile(file)) {
frame->addEditor(editor);
frame->showEditor(editor);
} else {
delete editor;
editor = NULL;
}
}
}
if(editor) {
editorManager->setCurrentEditor(editor);
}
}
示例5: 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();
}
//.........这里部分代码省略.........